@amp-labs/react 2.7.13 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +13 -13
- package/build/amp-react.cjs.js.map +1 -1
- package/build/amp-react.es.js +759 -768
- package/build/amp-react.es.js.map +1 -1
- package/build/index.d.ts +139 -67
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var $a=e=>{throw TypeError(e)};var qo=(e,t,n)=>t.has(e)||$a("Cannot "+n);var _=(e,t,n)=>(qo(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?$a("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(qo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(qo(e,t,"access private method"),n);var qi=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function Gf(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 k=Gf(w);var zr=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(){}},ur=typeof window>"u"||"Deno"in globalThis;function ft(){}function Xf(e,t){return typeof e=="function"?e(t):e}function os(e){return typeof e=="number"&&e>=0&&e!==1/0}function ul(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Or(e,t){return typeof e=="function"?e(t):e}function Bt(e,t){return typeof e=="function"?e(t):e}function Ha(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==qs(s,t.options))return!1}else if(!li(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 Ba(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(dr(t.options.mutationKey)!==dr(i))return!1}else if(!li(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function qs(e,t){return((t==null?void 0:t.queryKeyHashFn)||dr)(e)}function dr(e){return JSON.stringify(e,(t,n)=>as(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function li(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>li(e[n],t[n])):!1}function ss(e,t){if(e===t)return e;const n=Ja(e)&&Ja(t);if(n||as(e)&&as(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let f=0;f<s;f++){const u=n?f:i[f];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,c++):(a[u]=ss(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function to(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 Ja(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function as(e){if(!Wa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Wa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Wa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yf(e){return new Promise(t=>{setTimeout(t,e)})}function cs(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ss(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 ss(e,t)}return t}function Zf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function ep(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var no=Symbol();function dl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===no&&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===no?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fl(e,t){return typeof e=="function"?e(...t):!!e}var tr,Rn,Sr,el,tp=(el=class extends zr{constructor(){super();se(this,tr);se(this,Rn);se(this,Sr);G(this,Sr,t=>{if(!ur&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Rn)||this.setEventListener(_(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Rn))==null||t.call(this),G(this,Rn,void 0))}setEventListener(t){var n;G(this,Sr,t),(n=_(this,Rn))==null||n.call(this),G(this,Rn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,tr)!==t&&(G(this,tr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,tr)=="boolean"?_(this,tr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},tr=new WeakMap,Rn=new WeakMap,Sr=new WeakMap,el),Ks=new tp,Er,An,Nr,tl,np=(tl=class extends zr{constructor(){super();se(this,Er,!0);se(this,An);se(this,Nr);G(this,Nr,t=>{if(!ur&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,An)||this.setEventListener(_(this,Nr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,An))==null||t.call(this),G(this,An,void 0))}setEventListener(t){var n;G(this,Nr,t),(n=_(this,An))==null||n.call(this),G(this,An,t(this.setOnline.bind(this)))}setOnline(t){_(this,Er)!==t&&(G(this,Er,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Er)}},Er=new WeakMap,An=new WeakMap,Nr=new WeakMap,tl),ro=new np;function ls(){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 rp(e){return Math.min(1e3*2**e,3e4)}function pl(e){return(e??"online")==="online"?ro.isOnline():!0}var hl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ko(e){return e instanceof hl}function ml(e){let t=!1,n=0,r=!1,o;const i=ls(),s=y=>{var p;r||(g(new hl(y)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>Ks.isFocused()&&(e.networkMode==="always"||ro.isOnline())&&e.canRun(),u=()=>pl(e.networkMode)&&e.canRun(),d=y=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,y),o==null||o(),i.resolve(y))},g=y=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,y),o==null||o(),i.reject(y))},m=()=>new Promise(y=>{var p;o=C=>{(r||f())&&y(C)},(p=e.onPause)==null||p.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),b=()=>{if(r)return;let y;const p=n===0?e.initialPromise:void 0;try{y=p??e.fn()}catch(C){y=Promise.reject(C)}Promise.resolve(y).then(d).catch(C=>{var S;if(r)return;const h=e.retry??(ur?0:3),v=e.retryDelay??rp,I=typeof v=="function"?v(n,C):v,O=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,C);if(t||!O){g(C);return}n++,(S=e.onFail)==null||S.call(e,n,C),Yf(I).then(()=>f()?void 0:m()).then(()=>{t?g(C):b()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),i)}}var ip=e=>setTimeout(e,0);function op(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=ip;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=op(),nr,nl,gl=(nl=class{constructor(){se(this,nr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),os(this.gcTime)&&G(this,nr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ur?1/0:5*60*1e3))}clearGcTimeout(){_(this,nr)&&(clearTimeout(_(this,nr)),G(this,nr,void 0))}},nr=new WeakMap,nl),Tr,Rr,At,rr,ct,yi,ir,$t,pn,rl,sp=(rl=class extends gl{constructor(t){super();se(this,$t);se(this,Tr);se(this,Rr);se(this,At);se(this,rr);se(this,ct);se(this,yi);se(this,ir);G(this,ir,!1),G(this,yi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,rr,t.client),G(this,At,_(this,rr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Tr,ap(this.options)),this.state=t.state??_(this,Tr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ct))==null?void 0:t.promise}setOptions(t){this.options={..._(this,yi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,At).remove(this)}setData(t,n){const r=cs(this.state.data,t,this.options);return pe(this,$t,pn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,$t,pn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,ct))==null?void 0:r.promise;return(o=_(this,ct))==null||o.cancel(t),n?n.then(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Tr))}isActive(){return this.observers.some(t=>Bt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===no||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!ul(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,At).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ct)&&(_(this,ir)?_(this,ct).cancel({revert:!0}):_(this,ct).cancelRetry()),this.scheduleGc()),_(this,At).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,$t,pn).call(this,{type:"invalidate"})}fetch(t,n){var c,f,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ct))return _(this,ct).continueRetry(),_(this,ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(g=>g.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(G(this,ir,!0),r.signal)})},i=()=>{const d=dl(this.options,n),g={client:_(this,rr),queryKey:this.queryKey,meta:this.meta};return o(g),G(this,ir,!1),this.options.persister?this.options.persister(d,g,this):d(g)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,rr),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),G(this,Rr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&pe(this,$t,pn).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var g,m,b,y;Ko(d)&&d.silent||pe(this,$t,pn).call(this,{type:"error",error:d}),Ko(d)||((m=(g=_(this,At).config).onError)==null||m.call(g,d,this),(y=(b=_(this,At).config).onSettled)==null||y.call(b,this.state.data,d,this)),this.scheduleGc()};return G(this,ct,ml({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var g,m,b,y;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(p){a(p);return}(m=(g=_(this,At).config).onSuccess)==null||m.call(g,d,this),(y=(b=_(this,At).config).onSettled)==null||y.call(b,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,g)=>{pe(this,$t,pn).call(this,{type:"failed",failureCount:d,error:g})},onPause:()=>{pe(this,$t,pn).call(this,{type:"pause"})},onContinue:()=>{pe(this,$t,pn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),_(this,ct).start()}},Tr=new WeakMap,Rr=new WeakMap,At=new WeakMap,rr=new WeakMap,ct=new WeakMap,yi=new WeakMap,ir=new WeakMap,$t=new WeakSet,pn=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,...yl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Ko(o)&&o.revert&&_(this,Rr)?{..._(this,Rr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,At).notify({query:this,type:"updated",action:t})})},rl);function yl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ap(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 en,il,cp=(il=class extends zr{constructor(t={}){super();se(this,en);this.config=t,G(this,en,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??qs(o,n);let s=this.get(i);return s||(s=new sp({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,en).has(t.queryHash)||(_(this,en).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,en).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,en).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,en).get(t)}getAll(){return[..._(this,en).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ha(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ha(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()})})}},en=new WeakMap,il),tn,ut,or,nn,Tn,ol,lp=(ol=class extends gl{constructor(t){super();se(this,nn);se(this,tn);se(this,ut);se(this,or);this.mutationId=t.mutationId,G(this,ut,t.mutationCache),G(this,tn,[]),this.state=t.state||vl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,tn).includes(t)||(_(this,tn).push(t),this.clearGcTimeout(),_(this,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,tn,_(this,tn).filter(n=>n!==t)),this.scheduleGc(),_(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,tn).length||(this.state.status==="pending"?this.scheduleGc():_(this,ut).remove(this))}continue(){var t;return((t=_(this,or))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,u,d,g,m,b,y,p,C,h,v,I,O,S,N,T;const n=()=>{pe(this,nn,Tn).call(this,{type:"continue"})};G(this,or,ml({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{pe(this,nn,Tn).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{pe(this,nn,Tn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ut).canRun(this)}));const r=this.state.status==="pending",o=!_(this,or).canStart();try{if(r)n();else{pe(this,nn,Tn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=_(this,ut).config).onMutate)==null?void 0:s.call(i,t,this));const D=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));D!==this.state.context&&pe(this,nn,Tn).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const A=await _(this,or).start();return await((u=(f=_(this,ut).config).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,this)),await((g=(d=this.options).onSuccess)==null?void 0:g.call(d,A,t,this.state.context)),await((b=(m=_(this,ut).config).onSettled)==null?void 0:b.call(m,A,null,this.state.variables,this.state.context,this)),await((p=(y=this.options).onSettled)==null?void 0:p.call(y,A,null,t,this.state.context)),pe(this,nn,Tn).call(this,{type:"success",data:A}),A}catch(A){try{throw await((h=(C=_(this,ut).config).onError)==null?void 0:h.call(C,A,t,this.state.context,this)),await((I=(v=this.options).onError)==null?void 0:I.call(v,A,t,this.state.context)),await((S=(O=_(this,ut).config).onSettled)==null?void 0:S.call(O,void 0,A,this.state.variables,this.state.context,this)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,void 0,A,t,this.state.context)),A}finally{pe(this,nn,Tn).call(this,{type:"error",error:A})}}finally{_(this,ut).runNext(this)}}},tn=new WeakMap,ut=new WeakMap,or=new WeakMap,nn=new WeakSet,Tn=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(()=>{_(this,tn).forEach(r=>{r.onMutationUpdate(t)}),_(this,ut).notify({mutation:this,type:"updated",action:t})})},ol);function vl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hn,Ht,vi,sl,up=(sl=class extends zr{constructor(t={}){super();se(this,hn);se(this,Ht);se(this,vi);this.config=t,G(this,hn,new Set),G(this,Ht,new Map),G(this,vi,0)}build(t,n,r){const o=new lp({mutationCache:this,mutationId:++qi(this,vi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,hn).add(t);const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).get(n);r?r.push(t):_(this,Ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,hn).delete(t)){const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,Ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).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=Ki(t);if(typeof n=="string"){const o=(r=_(this,Ht).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(()=>{_(this,hn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,hn).clear(),_(this,Ht).clear()})}getAll(){return Array.from(_(this,hn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ba(n,r))}findAll(t={}){return this.getAll().filter(n=>Ba(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(ft))))}},hn=new WeakMap,Ht=new WeakMap,vi=new WeakMap,sl);function Ki(e){var t;return(t=e.options.scope)==null?void 0:t.id}function za(e){return{onFetch:(t,n)=>{var u,d,g,m,b;const r=t.options,o=(g=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let y=!1;const p=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},C=dl(t.options,t.fetchOptions),h=async(v,I,O)=>{if(y)return Promise.reject();if(I==null&&v.pages.length)return Promise.resolve(v);const S={client:t.client,queryKey:t.queryKey,pageParam:I,direction:O?"backward":"forward",meta:t.options.meta};p(S);const N=await C(S),{maxPages:T}=t.options,A=O?ep:Zf;return{pages:A(v.pages,N,T),pageParams:A(v.pageParams,I,T)}};if(o&&i.length){const v=o==="backward",I=v?dp:Qa,O={pages:i,pageParams:s},S=I(r,O);a=await h(O,S,v)}else{const v=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Qa(r,a);if(c>0&&I==null)break;a=await h(a,I),c++}while(c<v)}return a};t.options.persister?t.fetchFn=()=>{var y,p;return(p=(y=t.options).persister)==null?void 0:p.call(y,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Qa(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 dp(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,Fn,Pn,Ar,Fr,Dn,Pr,Dr,al,fp=(al=class{constructor(e={}){se(this,ke);se(this,Fn);se(this,Pn);se(this,Ar);se(this,Fr);se(this,Dn);se(this,Pr);se(this,Dr);G(this,ke,e.queryCache||new cp),G(this,Fn,e.mutationCache||new up),G(this,Pn,e.defaultOptions||{}),G(this,Ar,new Map),G(this,Fr,new Map),G(this,Dn,0)}mount(){qi(this,Dn)._++,_(this,Dn)===1&&(G(this,Pr,Ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ke).onFocus())})),G(this,Dr,ro.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ke).onOnline())})))}unmount(){var e,t;qi(this,Dn)._--,_(this,Dn)===0&&((e=_(this,Pr))==null||e.call(this),G(this,Pr,void 0),(t=_(this,Dr))==null||t.call(this),G(this,Dr,void 0))}isFetching(e){return _(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Fn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Or(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,ke).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Xf(t,i);if(s!==void 0)return _(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>_(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,ke);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(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(()=>_(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ft).catch(ft)}invalidateQueries(e,t={}){return ze.batch(()=>(_(this,ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>_(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,ke).build(this,t);return n.isStaleByTime(Or(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=za(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=za(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ro.isOnline()?_(this,Fn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,ke)}getMutationCache(){return _(this,Fn)}getDefaultOptions(){return _(this,Pn)}setDefaultOptions(e){G(this,Pn,e)}setQueryDefaults(e,t){_(this,Ar).set(dr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Ar).values()],n={};return t.forEach(r=>{li(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,Fr).set(dr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Fr).values()],n={};return t.forEach(r=>{li(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Pn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=qs(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===no&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Pn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,ke).clear(),_(this,Fn).clear()}},ke=new WeakMap,Fn=new WeakMap,Pn=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,Dn=new WeakMap,Pr=new WeakMap,Dr=new WeakMap,al),yt,ve,wi,dt,sr,Mr,Mn,kn,bi,kr,jr,ar,cr,jn,Lr,Se,ii,us,ds,fs,ps,hs,ms,gs,wl,cl,pp=(cl=class extends zr{constructor(t,n){super();se(this,Se);se(this,yt);se(this,ve);se(this,wi);se(this,dt);se(this,sr);se(this,Mr);se(this,Mn);se(this,kn);se(this,bi);se(this,kr);se(this,jr);se(this,ar);se(this,cr);se(this,jn);se(this,Lr,new Set);this.options=n,G(this,yt,t),G(this,kn,null),G(this,Mn,ls()),this.options.experimental_prefetchInRender||_(this,Mn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,ve).addObserver(this),Ga(_(this,ve),this.options)?pe(this,Se,ii).call(this):this.updateResult(),pe(this,Se,ps).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ys(_(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ys(_(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Se,hs).call(this),pe(this,Se,ms).call(this),_(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,ve);if(this.options=_(this,yt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bt(this.options.enabled,_(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Se,gs).call(this),_(this,ve).setOptions(this.options),n._defaulted&&!to(this.options,n)&&_(this,yt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,ve),observer:this});const o=this.hasListeners();o&&Xa(_(this,ve),r,this.options,n)&&pe(this,Se,ii).call(this),this.updateResult(),o&&(_(this,ve)!==r||Bt(this.options.enabled,_(this,ve))!==Bt(n.enabled,_(this,ve))||Or(this.options.staleTime,_(this,ve))!==Or(n.staleTime,_(this,ve)))&&pe(this,Se,us).call(this);const i=pe(this,Se,ds).call(this);o&&(_(this,ve)!==r||Bt(this.options.enabled,_(this,ve))!==Bt(n.enabled,_(this,ve))||i!==_(this,jn))&&pe(this,Se,fs).call(this,i)}getOptimisticResult(t){const n=_(this,yt).getQueryCache().build(_(this,yt),t),r=this.createResult(n,t);return mp(this,r)&&(G(this,dt,r),G(this,Mr,this.options),G(this,sr,_(this,ve).state)),r}getCurrentResult(){return _(this,dt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){_(this,Lr).add(t)}getCurrentQuery(){return _(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,yt).defaultQueryOptions(t),r=_(this,yt).getQueryCache().build(_(this,yt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Se,ii).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,dt)))}createResult(t,n){var A;const r=_(this,ve),o=this.options,i=_(this,dt),s=_(this,sr),a=_(this,Mr),f=t!==r?t.state:_(this,wi),{state:u}=t;let d={...u},g=!1,m;if(n._optimisticResults){const D=this.hasListeners(),J=!D&&Ga(t,n),K=D&&Xa(t,r,n,o);(J||K)&&(d={...d,...yl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:y,status:p}=d;m=d.data;let C=!1;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let D;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(D=i.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,jr))==null?void 0:A.state.data,_(this,jr)):n.placeholderData,D!==void 0&&(p="success",m=cs(i==null?void 0:i.data,D,n),g=!0)}if(n.select&&m!==void 0&&!C)if(i&&m===(s==null?void 0:s.data)&&n.select===_(this,bi))m=_(this,kr);else try{G(this,bi,n.select),m=n.select(m),m=cs(i==null?void 0:i.data,m,n),G(this,kr,m),G(this,kn,null)}catch(D){G(this,kn,D)}_(this,kn)&&(b=_(this,kn),m=_(this,kr),y=Date.now(),p="error");const h=d.fetchStatus==="fetching",v=p==="pending",I=p==="error",O=v&&h,S=m!==void 0,T={status:p,fetchStatus:d.fetchStatus,isPending:v,isSuccess:p==="success",isError:I,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:y,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:h,isRefetching:h&&!v,isLoadingError:I&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:I&&S,isStale:Us(t,n),refetch:this.refetch,promise:_(this,Mn)};if(this.options.experimental_prefetchInRender){const D=$=>{T.status==="error"?$.reject(T.error):T.data!==void 0&&$.resolve(T.data)},J=()=>{const $=G(this,Mn,T.promise=ls());D($)},K=_(this,Mn);switch(K.status){case"pending":t.queryHash===r.queryHash&&D(K);break;case"fulfilled":(T.status==="error"||T.data!==K.value)&&J();break;case"rejected":(T.status!=="error"||T.error!==K.reason)&&J();break}}return T}updateResult(){const t=_(this,dt),n=this.createResult(_(this,ve),this.options);if(G(this,sr,_(this,ve).state),G(this,Mr,this.options),_(this,sr).data!==void 0&&G(this,jr,_(this,ve)),to(n,t))return;G(this,dt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!_(this,Lr).size)return!0;const s=new Set(i??_(this,Lr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,dt)).some(a=>{const c=a;return _(this,dt)[c]!==t[c]&&s.has(c)})};pe(this,Se,wl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Se,ps).call(this)}},yt=new WeakMap,ve=new WeakMap,wi=new WeakMap,dt=new WeakMap,sr=new WeakMap,Mr=new WeakMap,Mn=new WeakMap,kn=new WeakMap,bi=new WeakMap,kr=new WeakMap,jr=new WeakMap,ar=new WeakMap,cr=new WeakMap,jn=new WeakMap,Lr=new WeakMap,Se=new WeakSet,ii=function(t){pe(this,Se,gs).call(this);let n=_(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ft)),n},us=function(){pe(this,Se,hs).call(this);const t=Or(this.options.staleTime,_(this,ve));if(ur||_(this,dt).isStale||!os(t))return;const r=ul(_(this,dt).dataUpdatedAt,t)+1;G(this,ar,setTimeout(()=>{_(this,dt).isStale||this.updateResult()},r))},ds=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,ve)):this.options.refetchInterval)??!1},fs=function(t){pe(this,Se,ms).call(this),G(this,jn,t),!(ur||Bt(this.options.enabled,_(this,ve))===!1||!os(_(this,jn))||_(this,jn)===0)&&G(this,cr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ks.isFocused())&&pe(this,Se,ii).call(this)},_(this,jn)))},ps=function(){pe(this,Se,us).call(this),pe(this,Se,fs).call(this,pe(this,Se,ds).call(this))},hs=function(){_(this,ar)&&(clearTimeout(_(this,ar)),G(this,ar,void 0))},ms=function(){_(this,cr)&&(clearInterval(_(this,cr)),G(this,cr,void 0))},gs=function(){const t=_(this,yt).getQueryCache().build(_(this,yt),this.options);if(t===_(this,ve))return;const n=_(this,ve);G(this,ve,t),G(this,wi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wl=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,dt))}),_(this,yt).getQueryCache().notify({query:_(this,ve),type:"observerResultsUpdated"})})},cl);function hp(e,t){return Bt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ga(e,t){return hp(e,t)||e.state.data!==void 0&&ys(e,t,t.refetchOnMount)}function ys(e,t,n){if(Bt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Us(e,t)}return!1}function Xa(e,t,n,r){return(e!==t||Bt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Us(e,n)}function Us(e,t){return Bt(t.enabled,e)!==!1&&e.isStaleByTime(Or(t.staleTime,e))}function mp(e,t){return!to(e.getCurrentResult(),t)}var Ln,qn,vt,mn,yn,Gi,vs,ll,gp=(ll=class extends zr{constructor(n,r){super();se(this,yn);se(this,Ln);se(this,qn);se(this,vt);se(this,mn);G(this,Ln,n),this.setOptions(r),this.bindMethods(),pe(this,yn,Gi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Ln).defaultMutationOptions(n),to(this.options,r)||_(this,Ln).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&dr(r.mutationKey)!==dr(this.options.mutationKey)?this.reset():((o=_(this,vt))==null?void 0:o.state.status)==="pending"&&_(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,vt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,yn,Gi).call(this),pe(this,yn,vs).call(this,n)}getCurrentResult(){return _(this,qn)}reset(){var n;(n=_(this,vt))==null||n.removeObserver(this),G(this,vt,void 0),pe(this,yn,Gi).call(this),pe(this,yn,vs).call(this)}mutate(n,r){var o;return G(this,mn,r),(o=_(this,vt))==null||o.removeObserver(this),G(this,vt,_(this,Ln).getMutationCache().build(_(this,Ln),this.options)),_(this,vt).addObserver(this),_(this,vt).execute(n)}},Ln=new WeakMap,qn=new WeakMap,vt=new WeakMap,mn=new WeakMap,yn=new WeakSet,Gi=function(){var r;const n=((r=_(this,vt))==null?void 0:r.state)??vl();G(this,qn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},vs=function(n){ze.batch(()=>{var r,o,i,s,a,c,f,u;if(_(this,mn)&&this.hasListeners()){const d=_(this,qn).variables,g=_(this,qn).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,mn)).onSuccess)==null||o.call(r,n.data,d,g),(s=(i=_(this,mn)).onSettled)==null||s.call(i,n.data,null,d,g)):(n==null?void 0:n.type)==="error"&&((c=(a=_(this,mn)).onError)==null||c.call(a,n.error,d,g),(u=(f=_(this,mn)).onSettled)==null||u.call(f,void 0,n.error,d,g))}this.listeners.forEach(d=>{d(_(this,qn))})})},ll),bl=k.createContext(void 0),Le=e=>{const t=k.useContext(bl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yp=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(bl.Provider,{value:e,children:t})),Il=k.createContext(!1),vp=()=>k.useContext(Il);Il.Provider;function wp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bp=k.createContext(wp()),Ip=()=>k.useContext(bp),Cp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},xp=e=>{k.useEffect(()=>{e.clearReset()},[e])},Op=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||fl(n,[e.error,r])),_p=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Sp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ep=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ya=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Np(e,t,n){var d,g,m,b,y;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=Le(),o=vp(),i=Ip(),s=r.defaultQueryOptions(e);(g=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||g.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=o?"isRestoring":"optimistic",_p(s),Cp(s,i),xp(i);const a=!r.getQueryCache().get(s.queryHash),[c]=k.useState(()=>new t(r,s)),f=c.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(p=>{const C=u?c.subscribe(ze.batchCalls(p)):ft;return c.updateResult(),C},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),Ep(s,f))throw Ya(s,c,i);if(Op({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((b=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,s,f),s.experimental_prefetchInRender&&!ur&&Sp(f,o)){const p=a?Ya(s,c,i):(y=r.getQueryCache().get(s.queryHash))==null?void 0:y.promise;p==null||p.catch(ft).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function Jn(e,t){return Np(e,pp)}function vn(e,t){const n=Le(),[r]=k.useState(()=>new gp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(ze.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ft)},[r]);if(o.error&&fl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Cl=w.createContext(null),Tp=Cl.Provider,xl=()=>{const e=w.useContext(Cl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(ue||{});const Ol=w.createContext(void 0);function Dt(){const e=w.useContext(Ol);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Rp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Ap({children:e}){const[t,n]=w.useState(Rp),r=w.useCallback((u,d,g=!0)=>{n(m=>{const b={...m};return b[u]=b[u]||{},b[u][d]=g,b})},[n]),o=w.useCallback((u,d)=>{var g;return!!((g=t[u])!=null&&g[d])},[t]),i=w.useCallback((u,d)=>{var g;return(g=t[u])==null?void 0:g[d]},[t]),s=w.useCallback((u,d)=>{n(g=>{var b;const m={...g};return(b=m[u])==null||delete b[d],m})},[n]),a=w.useCallback(u=>{n(d=>{const g={...d};return g[u]={},g})},[n]),c=w.useCallback((u,d)=>{n(g=>{const m={...g};return m[u]=m[u]||{},d.forEach(b=>{m[u][b]=!0}),m})},[n]),f=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(Ol.Provider,{value:f,children:e})}const Fp="https://api.withampersand.com/v1".replace(/\/+$/,"");class Vs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Fp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Sl}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Pp=new Vs,wo=class wo{constructor(t=Pp){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 kp(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?wo.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 _l(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:Mp(a.body)||a.body instanceof URLSearchParams||Dp(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}};wo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=wo;function Dp(e){return typeof Blob<"u"&&e instanceof Blob}function Mp(e){return typeof FormData<"u"&&e instanceof FormData}class _l extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class kp 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 R(e,t){const n=e[t];return n!=null}function Sl(e,t=""){return Object.keys(e).map(n=>El(n,e[n],t)).filter(n=>n.length>0).join("&")}function El(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return El(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Sl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ke(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class fr{constructor(t){this.raw=t}async value(){}}class Za{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function qp(e){return Kp(e)}function Kp(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function Up(e){return Vp(e)}function Vp(e,t){return e==null?e:{name:e.name}}function $p(e){return Hp(e)}function Hp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?Up(e.query):void 0,header:R(e,"header")?qp(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Wp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function zp(e){return Qp(e)}function Qp(e,t){return e==null?e:{url:e.url,method:R(e,"method")?e.method:void 0,successStatusCodes:R(e,"successStatusCodes")?e.successStatusCodes:void 0}}const ec={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Gp(e){return Xp(e)}function Xp(e,t){return e}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function eh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Nl(e){return th(e)}function th(e,t){return e==null?e:{defaultPeriod:Yp(e.defaultPeriod)}}function nh(e){if(e!==void 0)return e===null?null:{defaultPeriod:eh(e.defaultPeriod)}}function rh(e){return ih(e)}function ih(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function oh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{defaultPeriod:rh(e.defaultPeriod)}}function Tl(e){if(e!==void 0)return e===null?null:{defaultPeriod:oh(e.defaultPeriod)}}function ch(e){return lh(e)}function lh(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Rl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function uh(e){return dh(e)}function dh(e,t){return e}function fh(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:Tl(e.backfill)}}function ph(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,fh)}}function hh(e){return mh(e)}function mh(e,t){return e==null?e:{stringValue:R(e,"stringValue")?e.stringValue:void 0,integerValue:R(e,"integerValue")?e.integerValue:void 0,booleanValue:R(e,"booleanValue")?e.booleanValue:void 0}}function gh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function yh(e){return vh(e)}function vh(e,t){return e==null?e:{_default:R(e,"default")?hh(e.default):void 0,writeOnCreate:R(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:R(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Al(e){if(e!==void 0)return e===null?null:{default:gh(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function wh(e){let t=!0;return t=t&&"value"in e,t}function bh(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Ih(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ch(e){let t=!0;return t=t&&"value"in e,t}function xh(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Oh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function _h(e){let t=!0;return t=t&&"value"in e,t}function Sh(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Eh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Nh(e){return Th(e)}function Th(e,t){return e==null?e:{...bh(e),...xh(e),...Sh(e)}}function Fl(e){if(e!==void 0)return e===null?null:wh(e)?Ih(e):Ch(e)?Oh(e):_h(e)?Eh(e):{}}function Rh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ke(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ke(e.selectedFieldSettings,Al)}}function Ah(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,Rh)}}function Fh(e){return Ph(e)}function Ph(e,t){return e==null?e:{enabled:e.enabled}}function Dh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mh(e){return kh(e)}function kh(e,t){return e==null?e:{enabled:e.enabled}}function jh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Lh(e){return qh(e)}function qh(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Uh(e){return Vh(e)}function Vh(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?jp(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function $h(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{value:e.value}}function Jh(e){return Wh(e)}function Wh(e,t){return e==null?e:{brandingRemoval:R(e,"brandingRemoval")?Hh(e.brandingRemoval):void 0}}function Ui(e){return zh(e)}function zh(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:R(e,"entitlements")?Jh(e.entitlements):void 0}}function Qh(e){return Gh(e)}function Gh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:R(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:R(e,"selectedFieldsAuto")?uh(e.selectedFieldsAuto):void 0,backfill:R(e,"backfill")?sh(e.backfill):void 0}}function Zh(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:Tl(e.backfill)}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{objects:Ke(e.objects,Xh)}}function nm(e){if(e!==void 0)return e===null?null:{objects:Ke(e.objects,Zh)}}function rm(e){return im(e)}function im(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:R(e,"createEvent")?Fh(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?Lh(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?Mh(e.deleteEvent):void 0}}function om(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Dh(e.createEvent),updateEvent:Kh(e.updateEvent),deleteEvent:jh(e.deleteEvent)}}function sm(e){return am(e)}function am(e,t){return e==null?e:{objects:Ke(e.objects,rm)}}function cm(e){if(e!==void 0)return e===null?null:{objects:Ke(e.objects,om)}}function lm(e){return um(e)}function um(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:R(e,"selectedValueDefaults")?Ke(e.selectedValueDefaults,Nh):void 0,selectedFieldSettings:R(e,"selectedFieldSettings")?Ke(e.selectedFieldSettings,yh):void 0}}function dm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ke(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ke(e.selectedFieldSettings,Al)}}function fm(e){return pm(e)}function pm(e,t){return e==null?e:{objects:R(e,"objects")?Ke(e.objects,lm):void 0}}function hm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,dm)}}function mm(e){return gm(e)}function gm(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?em(e.read):void 0,write:R(e,"write")?fm(e.write):void 0,proxy:R(e,"proxy")?ch(e.proxy):void 0,subscribe:R(e,"subscribe")?sm(e.subscribe):void 0}}function ym(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:nm(e.read),write:hm(e.write),proxy:Rl(e.proxy),subscribe:cm(e.subscribe)}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:mm(e.content)}}function bm(e){return Im(e)}function Im(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Pl(e){return Cm(e)}function Cm(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function xm(e){return Om(e)}function Om(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function _m(e){return Sm(e)}function Sm(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Em(e){return Nm(e)}function Nm(e,t){return e==null?e:{accessToken:R(e,"accessToken")?xm(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?_m(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function Xi(e){return Tm(e)}function Tm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{value:e.value,source:e.source,displayName:R(e,"displayName")?e.displayName:void 0}}function $s(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function oi(e){return Fm(e)}function Fm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?Xi(e.providerApp):void 0,group:Pl(e.group),consumer:bm(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?Em(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0,providerMetadata:R(e,"providerMetadata")?Ke(e.providerMetadata,Rm):void 0}}function Dl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ml(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function kl(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 Pm(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 Dm(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 jl(e){if(e!==void 0)return e===null?null:{accessToken:Pm(e.accessToken),refreshToken:Dm(e.refreshToken),scopes:e.scopes}}function Mm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Dl(e.basicAuth),oauth2ClientCredentials:Ml(e.oauth2ClientCredentials),oauth2PasswordCredentials:kl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:jl(e.oauth2AuthorizationCode)}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function qm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ym(e.content)}}function Km(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:qm(e.config)}}function Um(e){return Vm(e)}function Vm(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function $m(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Wm(e){let t=!0;return t=t&&"fieldName"in e,t}function zm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Qm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Gm(e){let t=!0;return t=t&&"mapToName"in e,t}function Ll(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function Xm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function tc(e){return Ym(e)}function Ym(e,t){return e==null?e:{...zm(e),...Ll(e)}}function nc(e){if(e!==void 0)return e===null?null:Wm(e)?Qm(e):Gm(e)?Xm(e):{}}function ql(e){return Zm(e)}function Zm(e,t){return e}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(tc):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(tc):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ql(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?Nl(e.backfill):void 0,delivery:R(e,"delivery")?Hm(e.delivery):void 0}}function ng(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(nc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(nc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:nh(e.backfill),delivery:Jm(e.delivery)}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(eg):void 0}}function og(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ng)}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function cg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lg(e){return ug(e)}function ug(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function dg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:R(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:R(e,"createEvent")?km(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?lg(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?sg(e.deleteEvent):void 0,associationChangeEvent:R(e,"associationChangeEvent")?Bp(e.associationChangeEvent):void 0,otherEvents:R(e,"otherEvents")?e.otherEvents:void 0}}function hg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Lm(e.createEvent),updateEvent:dg(e.updateEvent),deleteEvent:cg(e.deleteEvent),associationChangeEvent:Wp(e.associationChangeEvent),otherEvents:e.otherEvents}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(fg):void 0}}function yg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(hg)}}function Kl(e){return vg(e)}function vg(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function wg(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function bg(e){return Ig(e)}function Ig(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?Kl(e.valueDefaults):void 0}}function Cg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:wg(e.valueDefaults)}}function xg(e){return Og(e)}function Og(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(bg):void 0}}function _g(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Cg)}}function Sg(e){return Eg(e)}function Eg(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?rg(e.read):void 0,write:R(e,"write")?xg(e.write):void 0,proxy:R(e,"proxy")?Um(e.proxy):void 0,subscribe:R(e,"subscribe")?mg(e.subscribe):void 0}}function Ng(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:og(e.read),write:_g(e.write),proxy:$m(e.proxy),subscribe:yg(e.subscribe)}}function Tg(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ng(e.content)}}function Rg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Tg(e.latestRevision)}}function Ag(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Fg(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 Pg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(Dg):void 0}}function Lg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Dl(e.basicAuth),oauth2ClientCredentials:Ml(e.oauth2ClientCredentials),oauth2PasswordCredentials:kl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:jl(e.oauth2AuthorizationCode)}}function qg(e){return Kg(e)}function Kg(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Ug(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Uo(e){return Vg(e)}function Vg(e,t){return e==null?e:{...Ug(e),...Ll(e)}}function $g(e){return Hg(e)}function Hg(e,t){return e==null?e:{error:R(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Uo):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Uo):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ql(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Uo):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?Ke(e.allFieldsMetadata,kg):void 0,backfill:R(e,"backfill")?Nl(e.backfill):void 0}}function Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map($g):void 0}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?Kl(e.valueDefaults):void 0}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Wg):void 0}}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Bg(e.read):void 0,write:R(e,"write")?Qg(e.write):void 0,proxy:R(e,"proxy")?qg(e.proxy):void 0}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Xg(e.content)}}function Vi(e){return ty(e)}function ty(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?Pl(e.group):void 0,healthStatus:e.healthStatus,connection:oi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:vm(e.config)}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Sg(e.content)}}function rc(e){return iy(e)}function iy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:ny(e.latestRevision)}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function ay(e){return cy(e)}function cy(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function ly(e){return uy(e)}function uy(e,t){return e==null?e:{regular:R(e,"regular")?ay(e.regular):void 0,darkMode:R(e,"darkMode")?oy(e.darkMode):void 0}}function dy(e){return fy(e)}function fy(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function py(e){return hy(e)}function hy(e,t){return e==null?e:{name:e.name}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function Ul(e){return yy(e)}function yy(e,t){return e==null?e:{bulkWrite:Qh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?my(e.subscribeSupport):void 0}}function vy(e){return wy(e)}function wy(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ul(e.support)}}function by(e){return Iy(e)}function Iy(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:R(e,"capture")?e.capture:void 0}}function Cy(e){return xy(e)}function xy(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0,otherFields:R(e,"otherFields")?e.otherFields.map(by):void 0}}const Vo={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function Oy(e){return _y(e)}function _y(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:Cy(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function Sy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Ey(e){return Ny(e)}function Ny(e,t){return e==null?e:{input:R(e,"input")?e.input.map(dy):void 0,postAuthentication:R(e,"postAuthentication")?e.postAuthentication.map(py):void 0}}function Ty(e){return Ry(e)}function Ry(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function ic(e){return Ay(e)}function Ay(e,t){return e==null?e:{name:e.name,authType:Gp(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:R(e,"oauth2Opts")?Oy(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?$p(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Uh(e.basicOpts):void 0,support:Ul(e.support),providerOpts:e.providerOpts,authHealthCheck:R(e,"authHealthCheck")?zp(e.authHealthCheck):void 0,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?ly(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?Ty(e.subscribeOpts):void 0,modules:R(e,"modules")?Ke(e.modules,vy):void 0,metadata:R(e,"metadata")?Ey(e.metadata):void 0}}function Fy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Mm(e.connection)}}function Py(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:ph(e.read),write:Ah(e.write),proxy:Rl(e.proxy)}}function Dy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Py(e.content)}}function My(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Dy(e.config)}}function ky(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:My(e.installation)}}function jy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Ly(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:jy(e.project)}}function qy(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 Ky(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:qy(e.providerApp)}}class Uy extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Lg(t.generateConnectionParams)},n);return new je(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:Fy(t.updateConnectionRequest)},n);return new je(i,s=>oi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Vy extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Km(t.installation)},n);return new je(i,s=>Vi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Vi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Vi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new 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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:ky(t.installationUpdate)},n);return new je(i,s=>Vi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class $y extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:$h(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(rc))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Rg(t.integration)},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new fr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(rc))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Hy extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Sy(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Za(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Za(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class By extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Ag(t.project)},n);return new je(i,s=>Ui(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new fr(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Ui(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new je(o,i=>i.map(Ui))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:Ly(t.projectUpdate)},n);return new je(i,s=>Ui(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Jy extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new je(i,s=>ic(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new je(o,i=>Ke(i,ic))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Wy extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Fg(t.providerApp)},n);return new je(i,s=>Xi(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Xi))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:Ky(t.providerAppUpdate)},n);return new je(i,s=>Xi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class zy extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Pg(t.revision)},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Zg(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Vl{constructor(t){this.connectionApi=new Uy(t),this.installationApi=new Vy(t),this.integrationApi=new $y(t),this.oAuthApi=new Hy(t),this.projectApi=new By(t),this.providerApi=new Jy(t),this.providerAppApi=new Wy(t),this.revisionApi=new zy(t)}}const $l="2.7.13",Qy="v1",$i="https://api.withampersand.com";function Hl(){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 $i;case"mock":return"http://127.0.0.1:4010";case"":return $i;default:return e??$i}}catch{return $i}}const Gy=(e,t)=>`${e}/${t}`;function Xy(){return Gy(Hl(),Qy)}const Bl=Hl(),Jl=Xy(),Yy=new Vs({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l}});let Zy=new Vl(Yy);const Hs=()=>Zy;function it(){const e=xl();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Vs({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l,"X-Api-Key":e}});return new Vl(n)},[e])}const ev=e=>{const t=it();return Jn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Wl=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ne=()=>{const e=w.useContext(Wl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function tv({projectIdOrName:e,children:t}){const{setError:n}=Dt(),{data:r,isLoading:o,isError:i}=ev(e);w.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=w.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(Wl.Provider,{value:s,children:t})}function zl(){const e=it(),{projectIdOrName:t}=Ne();return Jn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Ue=async(e,t)=>{var n;if(e instanceof _l){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 $a=e=>{throw TypeError(e)};var qo=(e,t,n)=>t.has(e)||$a("Cannot "+n);var _=(e,t,n)=>(qo(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?$a("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(qo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(qo(e,t,"access private method"),n);var qi=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function Qf(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 k=Qf(w);var Wr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ur=typeof window>"u"||"Deno"in globalThis;function ft(){}function Gf(e,t){return typeof e=="function"?e(t):e}function os(e){return typeof e=="number"&&e>=0&&e!==1/0}function ul(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xr(e,t){return typeof e=="function"?e(t):e}function Bt(e,t){return typeof e=="function"?e(t):e}function Ha(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==qs(s,t.options))return!1}else if(!li(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 Ba(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(dr(t.options.mutationKey)!==dr(i))return!1}else if(!li(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function qs(e,t){return((t==null?void 0:t.queryKeyHashFn)||dr)(e)}function dr(e){return JSON.stringify(e,(t,n)=>as(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function li(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>li(e[n],t[n])):!1}function ss(e,t){if(e===t)return e;const n=Ja(e)&&Ja(t);if(n||as(e)&&as(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let f=0;f<s;f++){const u=n?f:i[f];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,c++):(a[u]=ss(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function to(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 Ja(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function as(e){if(!Wa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Wa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Wa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xf(e){return new Promise(t=>{setTimeout(t,e)})}function cs(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ss(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 ss(e,t)}return t}function Yf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Zf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var no=Symbol();function dl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===no&&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===no?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fl(e,t){return typeof e=="function"?e(...t):!!e}var tr,Rn,_r,el,ep=(el=class extends Wr{constructor(){super();se(this,tr);se(this,Rn);se(this,_r);G(this,_r,t=>{if(!ur&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Rn)||this.setEventListener(_(this,_r))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Rn))==null||t.call(this),G(this,Rn,void 0))}setEventListener(t){var n;G(this,_r,t),(n=_(this,Rn))==null||n.call(this),G(this,Rn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,tr)!==t&&(G(this,tr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,tr)=="boolean"?_(this,tr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},tr=new WeakMap,Rn=new WeakMap,_r=new WeakMap,el),Ks=new ep,Sr,An,Er,tl,tp=(tl=class extends Wr{constructor(){super();se(this,Sr,!0);se(this,An);se(this,Er);G(this,Er,t=>{if(!ur&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,An)||this.setEventListener(_(this,Er))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,An))==null||t.call(this),G(this,An,void 0))}setEventListener(t){var n;G(this,Er,t),(n=_(this,An))==null||n.call(this),G(this,An,t(this.setOnline.bind(this)))}setOnline(t){_(this,Sr)!==t&&(G(this,Sr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Sr)}},Sr=new WeakMap,An=new WeakMap,Er=new WeakMap,tl),ro=new tp;function ls(){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 np(e){return Math.min(1e3*2**e,3e4)}function pl(e){return(e??"online")==="online"?ro.isOnline():!0}var hl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ko(e){return e instanceof hl}function ml(e){let t=!1,n=0,r=!1,o;const i=ls(),s=y=>{var p;r||(g(new hl(y)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>Ks.isFocused()&&(e.networkMode==="always"||ro.isOnline())&&e.canRun(),u=()=>pl(e.networkMode)&&e.canRun(),d=y=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,y),o==null||o(),i.resolve(y))},g=y=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,y),o==null||o(),i.reject(y))},m=()=>new Promise(y=>{var p;o=C=>{(r||f())&&y(C)},(p=e.onPause)==null||p.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),b=()=>{if(r)return;let y;const p=n===0?e.initialPromise:void 0;try{y=p??e.fn()}catch(C){y=Promise.reject(C)}Promise.resolve(y).then(d).catch(C=>{var S;if(r)return;const h=e.retry??(ur?0:3),v=e.retryDelay??np,I=typeof v=="function"?v(n,C):v,O=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,C);if(t||!O){g(C);return}n++,(S=e.onFail)==null||S.call(e,n,C),Xf(I).then(()=>f()?void 0:m()).then(()=>{t?g(C):b()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),i)}}var rp=e=>setTimeout(e,0);function ip(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=rp;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=ip(),nr,nl,gl=(nl=class{constructor(){se(this,nr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),os(this.gcTime)&&G(this,nr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ur?1/0:5*60*1e3))}clearGcTimeout(){_(this,nr)&&(clearTimeout(_(this,nr)),G(this,nr,void 0))}},nr=new WeakMap,nl),Nr,Tr,At,rr,ct,yi,ir,$t,pn,rl,op=(rl=class extends gl{constructor(t){super();se(this,$t);se(this,Nr);se(this,Tr);se(this,At);se(this,rr);se(this,ct);se(this,yi);se(this,ir);G(this,ir,!1),G(this,yi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,rr,t.client),G(this,At,_(this,rr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Nr,sp(this.options)),this.state=t.state??_(this,Nr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ct))==null?void 0:t.promise}setOptions(t){this.options={..._(this,yi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,At).remove(this)}setData(t,n){const r=cs(this.state.data,t,this.options);return pe(this,$t,pn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,$t,pn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,ct))==null?void 0:r.promise;return(o=_(this,ct))==null||o.cancel(t),n?n.then(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Nr))}isActive(){return this.observers.some(t=>Bt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===no||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!ul(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,At).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ct)&&(_(this,ir)?_(this,ct).cancel({revert:!0}):_(this,ct).cancelRetry()),this.scheduleGc()),_(this,At).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,$t,pn).call(this,{type:"invalidate"})}fetch(t,n){var c,f,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ct))return _(this,ct).continueRetry(),_(this,ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(g=>g.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(G(this,ir,!0),r.signal)})},i=()=>{const d=dl(this.options,n),g={client:_(this,rr),queryKey:this.queryKey,meta:this.meta};return o(g),G(this,ir,!1),this.options.persister?this.options.persister(d,g,this):d(g)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,rr),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),G(this,Tr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&pe(this,$t,pn).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var g,m,b,y;Ko(d)&&d.silent||pe(this,$t,pn).call(this,{type:"error",error:d}),Ko(d)||((m=(g=_(this,At).config).onError)==null||m.call(g,d,this),(y=(b=_(this,At).config).onSettled)==null||y.call(b,this.state.data,d,this)),this.scheduleGc()};return G(this,ct,ml({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var g,m,b,y;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(p){a(p);return}(m=(g=_(this,At).config).onSuccess)==null||m.call(g,d,this),(y=(b=_(this,At).config).onSettled)==null||y.call(b,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,g)=>{pe(this,$t,pn).call(this,{type:"failed",failureCount:d,error:g})},onPause:()=>{pe(this,$t,pn).call(this,{type:"pause"})},onContinue:()=>{pe(this,$t,pn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),_(this,ct).start()}},Nr=new WeakMap,Tr=new WeakMap,At=new WeakMap,rr=new WeakMap,ct=new WeakMap,yi=new WeakMap,ir=new WeakMap,$t=new WeakSet,pn=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,...yl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Ko(o)&&o.revert&&_(this,Tr)?{..._(this,Tr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,At).notify({query:this,type:"updated",action:t})})},rl);function yl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function sp(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 en,il,ap=(il=class extends Wr{constructor(t={}){super();se(this,en);this.config=t,G(this,en,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??qs(o,n);let s=this.get(i);return s||(s=new op({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,en).has(t.queryHash)||(_(this,en).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,en).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,en).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,en).get(t)}getAll(){return[..._(this,en).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ha(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ha(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()})})}},en=new WeakMap,il),tn,ut,or,nn,Tn,ol,cp=(ol=class extends gl{constructor(t){super();se(this,nn);se(this,tn);se(this,ut);se(this,or);this.mutationId=t.mutationId,G(this,ut,t.mutationCache),G(this,tn,[]),this.state=t.state||vl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,tn).includes(t)||(_(this,tn).push(t),this.clearGcTimeout(),_(this,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,tn,_(this,tn).filter(n=>n!==t)),this.scheduleGc(),_(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,tn).length||(this.state.status==="pending"?this.scheduleGc():_(this,ut).remove(this))}continue(){var t;return((t=_(this,or))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,f,u,d,g,m,b,y,p,C,h,v,I,O,S,N,T;const n=()=>{pe(this,nn,Tn).call(this,{type:"continue"})};G(this,or,ml({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{pe(this,nn,Tn).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{pe(this,nn,Tn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ut).canRun(this)}));const r=this.state.status==="pending",o=!_(this,or).canStart();try{if(r)n();else{pe(this,nn,Tn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=_(this,ut).config).onMutate)==null?void 0:s.call(i,t,this));const D=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));D!==this.state.context&&pe(this,nn,Tn).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const A=await _(this,or).start();return await((u=(f=_(this,ut).config).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,this)),await((g=(d=this.options).onSuccess)==null?void 0:g.call(d,A,t,this.state.context)),await((b=(m=_(this,ut).config).onSettled)==null?void 0:b.call(m,A,null,this.state.variables,this.state.context,this)),await((p=(y=this.options).onSettled)==null?void 0:p.call(y,A,null,t,this.state.context)),pe(this,nn,Tn).call(this,{type:"success",data:A}),A}catch(A){try{throw await((h=(C=_(this,ut).config).onError)==null?void 0:h.call(C,A,t,this.state.context,this)),await((I=(v=this.options).onError)==null?void 0:I.call(v,A,t,this.state.context)),await((S=(O=_(this,ut).config).onSettled)==null?void 0:S.call(O,void 0,A,this.state.variables,this.state.context,this)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,void 0,A,t,this.state.context)),A}finally{pe(this,nn,Tn).call(this,{type:"error",error:A})}}finally{_(this,ut).runNext(this)}}},tn=new WeakMap,ut=new WeakMap,or=new WeakMap,nn=new WeakSet,Tn=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(()=>{_(this,tn).forEach(r=>{r.onMutationUpdate(t)}),_(this,ut).notify({mutation:this,type:"updated",action:t})})},ol);function vl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hn,Ht,vi,sl,lp=(sl=class extends Wr{constructor(t={}){super();se(this,hn);se(this,Ht);se(this,vi);this.config=t,G(this,hn,new Set),G(this,Ht,new Map),G(this,vi,0)}build(t,n,r){const o=new cp({mutationCache:this,mutationId:++qi(this,vi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,hn).add(t);const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).get(n);r?r.push(t):_(this,Ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,hn).delete(t)){const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,Ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ki(t);if(typeof n=="string"){const r=_(this,Ht).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=Ki(t);if(typeof n=="string"){const o=(r=_(this,Ht).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(()=>{_(this,hn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,hn).clear(),_(this,Ht).clear()})}getAll(){return Array.from(_(this,hn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ba(n,r))}findAll(t={}){return this.getAll().filter(n=>Ba(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(ft))))}},hn=new WeakMap,Ht=new WeakMap,vi=new WeakMap,sl);function Ki(e){var t;return(t=e.options.scope)==null?void 0:t.id}function za(e){return{onFetch:(t,n)=>{var u,d,g,m,b;const r=t.options,o=(g=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let y=!1;const p=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},C=dl(t.options,t.fetchOptions),h=async(v,I,O)=>{if(y)return Promise.reject();if(I==null&&v.pages.length)return Promise.resolve(v);const S={client:t.client,queryKey:t.queryKey,pageParam:I,direction:O?"backward":"forward",meta:t.options.meta};p(S);const N=await C(S),{maxPages:T}=t.options,A=O?Zf:Yf;return{pages:A(v.pages,N,T),pageParams:A(v.pageParams,I,T)}};if(o&&i.length){const v=o==="backward",I=v?up:Qa,O={pages:i,pageParams:s},S=I(r,O);a=await h(O,S,v)}else{const v=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Qa(r,a);if(c>0&&I==null)break;a=await h(a,I),c++}while(c<v)}return a};t.options.persister?t.fetchFn=()=>{var y,p;return(p=(y=t.options).persister)==null?void 0:p.call(y,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Qa(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function up(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ke,Fn,Pn,Rr,Ar,Dn,Fr,Pr,al,dp=(al=class{constructor(e={}){se(this,ke);se(this,Fn);se(this,Pn);se(this,Rr);se(this,Ar);se(this,Dn);se(this,Fr);se(this,Pr);G(this,ke,e.queryCache||new ap),G(this,Fn,e.mutationCache||new lp),G(this,Pn,e.defaultOptions||{}),G(this,Rr,new Map),G(this,Ar,new Map),G(this,Dn,0)}mount(){qi(this,Dn)._++,_(this,Dn)===1&&(G(this,Fr,Ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ke).onFocus())})),G(this,Pr,ro.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ke).onOnline())})))}unmount(){var e,t;qi(this,Dn)._--,_(this,Dn)===0&&((e=_(this,Fr))==null||e.call(this),G(this,Fr,void 0),(t=_(this,Pr))==null||t.call(this),G(this,Pr,void 0))}isFetching(e){return _(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Fn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(xr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,ke).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Gf(t,i);if(s!==void 0)return _(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>_(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,ke);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(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(()=>_(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ft).catch(ft)}invalidateQueries(e,t={}){return ze.batch(()=>(_(this,ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>_(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,ke).build(this,t);return n.isStaleByTime(xr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=za(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=za(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ro.isOnline()?_(this,Fn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,ke)}getMutationCache(){return _(this,Fn)}getDefaultOptions(){return _(this,Pn)}setDefaultOptions(e){G(this,Pn,e)}setQueryDefaults(e,t){_(this,Rr).set(dr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Rr).values()],n={};return t.forEach(r=>{li(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,Ar).set(dr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Ar).values()],n={};return t.forEach(r=>{li(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Pn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=qs(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===no&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Pn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,ke).clear(),_(this,Fn).clear()}},ke=new WeakMap,Fn=new WeakMap,Pn=new WeakMap,Rr=new WeakMap,Ar=new WeakMap,Dn=new WeakMap,Fr=new WeakMap,Pr=new WeakMap,al),yt,ve,wi,dt,sr,Dr,Mn,kn,bi,Mr,kr,ar,cr,jn,jr,Se,ii,us,ds,fs,ps,hs,ms,gs,wl,cl,fp=(cl=class extends Wr{constructor(t,n){super();se(this,Se);se(this,yt);se(this,ve);se(this,wi);se(this,dt);se(this,sr);se(this,Dr);se(this,Mn);se(this,kn);se(this,bi);se(this,Mr);se(this,kr);se(this,ar);se(this,cr);se(this,jn);se(this,jr,new Set);this.options=n,G(this,yt,t),G(this,kn,null),G(this,Mn,ls()),this.options.experimental_prefetchInRender||_(this,Mn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,ve).addObserver(this),Ga(_(this,ve),this.options)?pe(this,Se,ii).call(this):this.updateResult(),pe(this,Se,ps).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ys(_(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ys(_(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Se,hs).call(this),pe(this,Se,ms).call(this),_(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,ve);if(this.options=_(this,yt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bt(this.options.enabled,_(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Se,gs).call(this),_(this,ve).setOptions(this.options),n._defaulted&&!to(this.options,n)&&_(this,yt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,ve),observer:this});const o=this.hasListeners();o&&Xa(_(this,ve),r,this.options,n)&&pe(this,Se,ii).call(this),this.updateResult(),o&&(_(this,ve)!==r||Bt(this.options.enabled,_(this,ve))!==Bt(n.enabled,_(this,ve))||xr(this.options.staleTime,_(this,ve))!==xr(n.staleTime,_(this,ve)))&&pe(this,Se,us).call(this);const i=pe(this,Se,ds).call(this);o&&(_(this,ve)!==r||Bt(this.options.enabled,_(this,ve))!==Bt(n.enabled,_(this,ve))||i!==_(this,jn))&&pe(this,Se,fs).call(this,i)}getOptimisticResult(t){const n=_(this,yt).getQueryCache().build(_(this,yt),t),r=this.createResult(n,t);return hp(this,r)&&(G(this,dt,r),G(this,Dr,this.options),G(this,sr,_(this,ve).state)),r}getCurrentResult(){return _(this,dt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){_(this,jr).add(t)}getCurrentQuery(){return _(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,yt).defaultQueryOptions(t),r=_(this,yt).getQueryCache().build(_(this,yt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Se,ii).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,dt)))}createResult(t,n){var A;const r=_(this,ve),o=this.options,i=_(this,dt),s=_(this,sr),a=_(this,Dr),f=t!==r?t.state:_(this,wi),{state:u}=t;let d={...u},g=!1,m;if(n._optimisticResults){const D=this.hasListeners(),J=!D&&Ga(t,n),K=D&&Xa(t,r,n,o);(J||K)&&(d={...d,...yl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:y,status:p}=d;m=d.data;let C=!1;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let D;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(D=i.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,kr))==null?void 0:A.state.data,_(this,kr)):n.placeholderData,D!==void 0&&(p="success",m=cs(i==null?void 0:i.data,D,n),g=!0)}if(n.select&&m!==void 0&&!C)if(i&&m===(s==null?void 0:s.data)&&n.select===_(this,bi))m=_(this,Mr);else try{G(this,bi,n.select),m=n.select(m),m=cs(i==null?void 0:i.data,m,n),G(this,Mr,m),G(this,kn,null)}catch(D){G(this,kn,D)}_(this,kn)&&(b=_(this,kn),m=_(this,Mr),y=Date.now(),p="error");const h=d.fetchStatus==="fetching",v=p==="pending",I=p==="error",O=v&&h,S=m!==void 0,T={status:p,fetchStatus:d.fetchStatus,isPending:v,isSuccess:p==="success",isError:I,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:y,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:h,isRefetching:h&&!v,isLoadingError:I&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:I&&S,isStale:Us(t,n),refetch:this.refetch,promise:_(this,Mn)};if(this.options.experimental_prefetchInRender){const D=$=>{T.status==="error"?$.reject(T.error):T.data!==void 0&&$.resolve(T.data)},J=()=>{const $=G(this,Mn,T.promise=ls());D($)},K=_(this,Mn);switch(K.status){case"pending":t.queryHash===r.queryHash&&D(K);break;case"fulfilled":(T.status==="error"||T.data!==K.value)&&J();break;case"rejected":(T.status!=="error"||T.error!==K.reason)&&J();break}}return T}updateResult(){const t=_(this,dt),n=this.createResult(_(this,ve),this.options);if(G(this,sr,_(this,ve).state),G(this,Dr,this.options),_(this,sr).data!==void 0&&G(this,kr,_(this,ve)),to(n,t))return;G(this,dt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!_(this,jr).size)return!0;const s=new Set(i??_(this,jr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,dt)).some(a=>{const c=a;return _(this,dt)[c]!==t[c]&&s.has(c)})};pe(this,Se,wl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Se,ps).call(this)}},yt=new WeakMap,ve=new WeakMap,wi=new WeakMap,dt=new WeakMap,sr=new WeakMap,Dr=new WeakMap,Mn=new WeakMap,kn=new WeakMap,bi=new WeakMap,Mr=new WeakMap,kr=new WeakMap,ar=new WeakMap,cr=new WeakMap,jn=new WeakMap,jr=new WeakMap,Se=new WeakSet,ii=function(t){pe(this,Se,gs).call(this);let n=_(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ft)),n},us=function(){pe(this,Se,hs).call(this);const t=xr(this.options.staleTime,_(this,ve));if(ur||_(this,dt).isStale||!os(t))return;const r=ul(_(this,dt).dataUpdatedAt,t)+1;G(this,ar,setTimeout(()=>{_(this,dt).isStale||this.updateResult()},r))},ds=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,ve)):this.options.refetchInterval)??!1},fs=function(t){pe(this,Se,ms).call(this),G(this,jn,t),!(ur||Bt(this.options.enabled,_(this,ve))===!1||!os(_(this,jn))||_(this,jn)===0)&&G(this,cr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ks.isFocused())&&pe(this,Se,ii).call(this)},_(this,jn)))},ps=function(){pe(this,Se,us).call(this),pe(this,Se,fs).call(this,pe(this,Se,ds).call(this))},hs=function(){_(this,ar)&&(clearTimeout(_(this,ar)),G(this,ar,void 0))},ms=function(){_(this,cr)&&(clearInterval(_(this,cr)),G(this,cr,void 0))},gs=function(){const t=_(this,yt).getQueryCache().build(_(this,yt),this.options);if(t===_(this,ve))return;const n=_(this,ve);G(this,ve,t),G(this,wi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wl=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,dt))}),_(this,yt).getQueryCache().notify({query:_(this,ve),type:"observerResultsUpdated"})})},cl);function pp(e,t){return Bt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ga(e,t){return pp(e,t)||e.state.data!==void 0&&ys(e,t,t.refetchOnMount)}function ys(e,t,n){if(Bt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Us(e,t)}return!1}function Xa(e,t,n,r){return(e!==t||Bt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Us(e,n)}function Us(e,t){return Bt(t.enabled,e)!==!1&&e.isStaleByTime(xr(t.staleTime,e))}function hp(e,t){return!to(e.getCurrentResult(),t)}var Ln,qn,vt,mn,yn,Gi,vs,ll,mp=(ll=class extends Wr{constructor(n,r){super();se(this,yn);se(this,Ln);se(this,qn);se(this,vt);se(this,mn);G(this,Ln,n),this.setOptions(r),this.bindMethods(),pe(this,yn,Gi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Ln).defaultMutationOptions(n),to(this.options,r)||_(this,Ln).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&dr(r.mutationKey)!==dr(this.options.mutationKey)?this.reset():((o=_(this,vt))==null?void 0:o.state.status)==="pending"&&_(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,vt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,yn,Gi).call(this),pe(this,yn,vs).call(this,n)}getCurrentResult(){return _(this,qn)}reset(){var n;(n=_(this,vt))==null||n.removeObserver(this),G(this,vt,void 0),pe(this,yn,Gi).call(this),pe(this,yn,vs).call(this)}mutate(n,r){var o;return G(this,mn,r),(o=_(this,vt))==null||o.removeObserver(this),G(this,vt,_(this,Ln).getMutationCache().build(_(this,Ln),this.options)),_(this,vt).addObserver(this),_(this,vt).execute(n)}},Ln=new WeakMap,qn=new WeakMap,vt=new WeakMap,mn=new WeakMap,yn=new WeakSet,Gi=function(){var r;const n=((r=_(this,vt))==null?void 0:r.state)??vl();G(this,qn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},vs=function(n){ze.batch(()=>{var r,o,i,s,a,c,f,u;if(_(this,mn)&&this.hasListeners()){const d=_(this,qn).variables,g=_(this,qn).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,mn)).onSuccess)==null||o.call(r,n.data,d,g),(s=(i=_(this,mn)).onSettled)==null||s.call(i,n.data,null,d,g)):(n==null?void 0:n.type)==="error"&&((c=(a=_(this,mn)).onError)==null||c.call(a,n.error,d,g),(u=(f=_(this,mn)).onSettled)==null||u.call(f,void 0,n.error,d,g))}this.listeners.forEach(d=>{d(_(this,qn))})})},ll),bl=k.createContext(void 0),Le=e=>{const t=k.useContext(bl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},gp=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(bl.Provider,{value:e,children:t})),Il=k.createContext(!1),yp=()=>k.useContext(Il);Il.Provider;function vp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wp=k.createContext(vp()),bp=()=>k.useContext(wp),Ip=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Cp=e=>{k.useEffect(()=>{e.clearReset()},[e])},xp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||fl(n,[e.error,r])),Op=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},_p=(e,t)=>e.isLoading&&e.isFetching&&!t,Sp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ya=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ep(e,t,n){var d,g,m,b,y;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=Le(),o=yp(),i=bp(),s=r.defaultQueryOptions(e);(g=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||g.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=o?"isRestoring":"optimistic",Op(s),Ip(s,i),Cp(i);const a=!r.getQueryCache().get(s.queryHash),[c]=k.useState(()=>new t(r,s)),f=c.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(p=>{const C=u?c.subscribe(ze.batchCalls(p)):ft;return c.updateResult(),C},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),Sp(s,f))throw Ya(s,c,i);if(xp({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((b=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,s,f),s.experimental_prefetchInRender&&!ur&&_p(f,o)){const p=a?Ya(s,c,i):(y=r.getQueryCache().get(s.queryHash))==null?void 0:y.promise;p==null||p.catch(ft).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function Jn(e,t){return Ep(e,fp)}function vn(e,t){const n=Le(),[r]=k.useState(()=>new mp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(ze.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ft)},[r]);if(o.error&&fl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Cl=w.createContext(null),Np=Cl.Provider,xl=()=>{const e=w.useContext(Cl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(ue||{});const Ol=w.createContext(void 0);function Dt(){const e=w.useContext(Ol);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Tp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Rp({children:e}){const[t,n]=w.useState(Tp),r=w.useCallback((u,d,g=!0)=>{n(m=>{const b={...m};return b[u]=b[u]||{},b[u][d]=g,b})},[n]),o=w.useCallback((u,d)=>{var g;return!!((g=t[u])!=null&&g[d])},[t]),i=w.useCallback((u,d)=>{var g;return(g=t[u])==null?void 0:g[d]},[t]),s=w.useCallback((u,d)=>{n(g=>{var b;const m={...g};return(b=m[u])==null||delete b[d],m})},[n]),a=w.useCallback(u=>{n(d=>{const g={...d};return g[u]={},g})},[n]),c=w.useCallback((u,d)=>{n(g=>{const m={...g};return m[u]=m[u]||{},d.forEach(b=>{m[u][b]=!0}),m})},[n]),f=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(Ol.Provider,{value:f,children:e})}const Ap="https://api.withampersand.com/v1".replace(/\/+$/,"");class Vs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ap}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Sl}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Fp=new Vs,wo=class wo{constructor(t=Fp){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 Mp(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?wo.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 _l(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:Dp(a.body)||a.body instanceof URLSearchParams||Pp(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}};wo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=wo;function Pp(e){return typeof Blob<"u"&&e instanceof Blob}function Dp(e){return typeof FormData<"u"&&e instanceof FormData}class _l extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Mp 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 R(e,t){const n=e[t];return n!=null}function Sl(e,t=""){return Object.keys(e).map(n=>El(n,e[n],t)).filter(n=>n.length>0).join("&")}function El(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return El(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Sl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ke(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class fr{constructor(t){this.raw=t}async value(){}}class Za{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function kp(e){return jp(e)}function jp(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function Lp(e){return qp(e)}function qp(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function Kp(e){return Up(e)}function Up(e,t){return e==null?e:{name:e.name}}function Vp(e){return $p(e)}function $p(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?Kp(e.query):void 0,header:R(e,"header")?Lp(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Hp(e){return Bp(e)}function Bp(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,includeFullRecords:R(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Jp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Wp(e){return zp(e)}function zp(e,t){return e==null?e:{url:e.url,method:R(e,"method")?e.method:void 0,successStatusCodes:R(e,"successStatusCodes")?e.successStatusCodes:void 0}}const ec={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Qp(e){return Gp(e)}function Gp(e,t){return e}function Xp(e){return Yp(e)}function Yp(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function Zp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Nl(e){return eh(e)}function eh(e,t){return e==null?e:{defaultPeriod:Xp(e.defaultPeriod)}}function th(e){if(e!==void 0)return e===null?null:{defaultPeriod:Zp(e.defaultPeriod)}}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function ih(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{defaultPeriod:nh(e.defaultPeriod)}}function Tl(e){if(e!==void 0)return e===null?null:{defaultPeriod:ih(e.defaultPeriod)}}function ah(e){return ch(e)}function ch(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Rl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lh(e){return uh(e)}function uh(e,t){return e}function dh(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:Tl(e.backfill)}}function fh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,dh)}}function ph(e){return hh(e)}function hh(e,t){return e==null?e:{stringValue:R(e,"stringValue")?e.stringValue:void 0,integerValue:R(e,"integerValue")?e.integerValue:void 0,booleanValue:R(e,"booleanValue")?e.booleanValue:void 0}}function mh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function gh(e){return yh(e)}function yh(e,t){return e==null?e:{_default:R(e,"default")?ph(e.default):void 0,writeOnCreate:R(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:R(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Al(e){if(e!==void 0)return e===null?null:{default:mh(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function vh(e){let t=!0;return t=t&&"value"in e,t}function wh(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function bh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ih(e){let t=!0;return t=t&&"value"in e,t}function Ch(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function xh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Oh(e){let t=!0;return t=t&&"value"in e,t}function _h(e,t){return e==null?e:{value:e.value,applyOnUpdate:R(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Sh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Eh(e){return Nh(e)}function Nh(e,t){return e==null?e:{...wh(e),...Ch(e),..._h(e)}}function Fl(e){if(e!==void 0)return e===null?null:vh(e)?bh(e):Ih(e)?xh(e):Oh(e)?Sh(e):{}}function Th(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ke(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ke(e.selectedFieldSettings,Al)}}function Rh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,Th)}}function Ah(e){return Fh(e)}function Fh(e,t){return e==null?e:{enabled:e.enabled}}function Ph(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{enabled:e.enabled}}function kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function qh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Kh(e){return Uh(e)}function Uh(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?kp(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Vh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function $h(e){return Hh(e)}function Hh(e,t){return e==null?e:{value:e.value}}function Bh(e){return Jh(e)}function Jh(e,t){return e==null?e:{brandingRemoval:R(e,"brandingRemoval")?$h(e.brandingRemoval):void 0}}function Ui(e){return Wh(e)}function Wh(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:R(e,"entitlements")?Bh(e.entitlements):void 0}}function zh(e){return Qh(e)}function Qh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Gh(e){return Xh(e)}function Xh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:R(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:R(e,"selectedFieldsAuto")?lh(e.selectedFieldsAuto):void 0,backfill:R(e,"backfill")?oh(e.backfill):void 0}}function Yh(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:Tl(e.backfill)}}function Zh(e){return em(e)}function em(e,t){return e==null?e:{objects:Ke(e.objects,Gh)}}function tm(e){if(e!==void 0)return e===null?null:{objects:Ke(e.objects,Yh)}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:R(e,"createEvent")?Ah(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?jh(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?Dh(e.deleteEvent):void 0}}function im(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Ph(e.createEvent),updateEvent:qh(e.updateEvent),deleteEvent:kh(e.deleteEvent)}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{objects:Ke(e.objects,nm)}}function am(e){if(e!==void 0)return e===null?null:{objects:Ke(e.objects,im)}}function cm(e){return lm(e)}function lm(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:R(e,"selectedValueDefaults")?Ke(e.selectedValueDefaults,Eh):void 0,selectedFieldSettings:R(e,"selectedFieldSettings")?Ke(e.selectedFieldSettings,gh):void 0}}function um(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ke(e.selectedValueDefaults,Fl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ke(e.selectedFieldSettings,Al)}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{objects:R(e,"objects")?Ke(e.objects,cm):void 0}}function pm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ke(e.objects,um)}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?Zh(e.read):void 0,write:R(e,"write")?dm(e.write):void 0,proxy:R(e,"proxy")?ah(e.proxy):void 0,subscribe:R(e,"subscribe")?om(e.subscribe):void 0}}function gm(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:tm(e.read),write:pm(e.write),proxy:Rl(e.proxy),subscribe:am(e.subscribe)}}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:hm(e.content)}}function wm(e){return bm(e)}function bm(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Pl(e){return Im(e)}function Im(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Cm(e){return xm(e)}function xm(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Om(e){return _m(e)}function _m(e,t){return e==null?e:{token:e.token,issuedAt:R(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:R(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Sm(e){return Em(e)}function Em(e,t){return e==null?e:{accessToken:R(e,"accessToken")?Cm(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?Om(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function Xi(e){return Nm(e)}function Nm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:R(e,"displayName")?e.displayName:void 0}}function $s(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function oi(e){return Am(e)}function Am(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?Xi(e.providerApp):void 0,group:Pl(e.group),consumer:wm(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?Sm(e.oauth2AuthorizationCode):void 0,apiKey:R(e,"apiKey")?e.apiKey:void 0,providerMetadata:R(e,"providerMetadata")?Ke(e.providerMetadata,Tm):void 0}}function Dl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ml(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function kl(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 Fm(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 Pm(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 jl(e){if(e!==void 0)return e===null?null:{accessToken:Fm(e.accessToken),refreshToken:Pm(e.refreshToken),scopes:e.scopes}}function Dm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Dl(e.basicAuth),oauth2ClientCredentials:Ml(e.oauth2ClientCredentials),oauth2PasswordCredentials:kl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:jl(e.oauth2AuthorizationCode)}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function jm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Lm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:gm(e.content)}}function qm(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Lm(e.config)}}function Km(e){return Um(e)}function Um(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function $m(e){return Hm(e)}function Hm(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function Bm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Jm(e){let t=!0;return t=t&&"fieldName"in e,t}function Wm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function zm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Qm(e){let t=!0;return t=t&&"mapToName"in e,t}function Ll(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function Gm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function tc(e){return Xm(e)}function Xm(e,t){return e==null?e:{...Wm(e),...Ll(e)}}function nc(e){if(e!==void 0)return e===null?null:Jm(e)?zm(e):Qm(e)?Gm(e):{}}function ql(e){return Ym(e)}function Ym(e,t){return e}function Zm(e){return eg(e)}function eg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map(tc):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(tc):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ql(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?Nl(e.backfill):void 0,delivery:R(e,"delivery")?$m(e.delivery):void 0}}function tg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(nc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(nc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:th(e.backfill),delivery:Bm(e.delivery)}}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Zm):void 0}}function ig(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(tg)}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function ag(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function cg(e){return lg(e)}function lg(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0,watchFieldsAuto:R(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:R(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function ug(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:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:R(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:R(e,"createEvent")?Mm(e.createEvent):void 0,updateEvent:R(e,"updateEvent")?cg(e.updateEvent):void 0,deleteEvent:R(e,"deleteEvent")?og(e.deleteEvent):void 0,associationChangeEvent:R(e,"associationChangeEvent")?Hp(e.associationChangeEvent):void 0,otherEvents:R(e,"otherEvents")?e.otherEvents:void 0}}function pg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:jm(e.createEvent),updateEvent:ug(e.updateEvent),deleteEvent:ag(e.deleteEvent),associationChangeEvent:Jp(e.associationChangeEvent),otherEvents:e.otherEvents}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(dg):void 0}}function gg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(pg)}}function Kl(e){return yg(e)}function yg(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function vg(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function wg(e){return bg(e)}function bg(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?Kl(e.valueDefaults):void 0}}function Ig(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:vg(e.valueDefaults)}}function Cg(e){return xg(e)}function xg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(wg):void 0}}function Og(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ig)}}function _g(e){return Sg(e)}function Sg(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?ng(e.read):void 0,write:R(e,"write")?Cg(e.write):void 0,proxy:R(e,"proxy")?Km(e.proxy):void 0,subscribe:R(e,"subscribe")?hg(e.subscribe):void 0}}function Eg(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ig(e.read),write:Og(e.write),proxy:Vm(e.proxy),subscribe:gg(e.subscribe)}}function Ng(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Eg(e.content)}}function Tg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Ng(e.latestRevision)}}function Rg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ag(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 Fg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Pg(e){return Dg(e)}function Dg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Mg(e){return kg(e)}function kg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(Pg):void 0}}function jg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Dl(e.basicAuth),oauth2ClientCredentials:Ml(e.oauth2ClientCredentials),oauth2PasswordCredentials:kl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:jl(e.oauth2AuthorizationCode)}}function Lg(e){return qg(e)}function qg(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Kg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Uo(e){return Ug(e)}function Ug(e,t){return e==null?e:{...Kg(e),...Ll(e)}}function Vg(e){return $g(e)}function $g(e,t){return e==null?e:{error:R(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(Uo):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(Uo):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?ql(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(Uo):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?Ke(e.allFieldsMetadata,Mg):void 0,backfill:R(e,"backfill")?Nl(e.backfill):void 0}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Vg):void 0}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?Kl(e.valueDefaults):void 0}}function zg(e){return Qg(e)}function Qg(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Jg):void 0}}function Gg(e){return Xg(e)}function Xg(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Hg(e.read):void 0,write:R(e,"write")?zg(e.write):void 0,proxy:R(e,"proxy")?Lg(e.proxy):void 0}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Gg(e.content)}}function Vi(e){return ey(e)}function ey(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?Pl(e.group):void 0,healthStatus:e.healthStatus,connection:oi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:ym(e.config)}}function ty(e){return ny(e)}function ny(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:_g(e.content)}}function rc(e){return ry(e)}function ry(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:ty(e.latestRevision)}}function iy(e){return oy(e)}function oy(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function cy(e){return ly(e)}function ly(e,t){return e==null?e:{regular:R(e,"regular")?sy(e.regular):void 0,darkMode:R(e,"darkMode")?iy(e.darkMode):void 0}}function uy(e){return dy(e)}function dy(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function fy(e){return py(e)}function py(e,t){return e==null?e:{name:e.name}}function hy(e){return my(e)}function my(e,t){return e==null?e:{create:R(e,"create")?e.create:void 0,update:R(e,"update")?e.update:void 0,_delete:R(e,"delete")?e.delete:void 0,passThrough:R(e,"passThrough")?e.passThrough:void 0}}function Ul(e){return gy(e)}function gy(e,t){return e==null?e:{bulkWrite:zh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:R(e,"subscribeSupport")?hy(e.subscribeSupport):void 0}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ul(e.support)}}function wy(e){return by(e)}function by(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:R(e,"capture")?e.capture:void 0}}function Iy(e){return Cy(e)}function Cy(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0,otherFields:R(e,"otherFields")?e.otherFields.map(wy):void 0}}const Vo={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:Iy(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function _y(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ke(e.providerMetadata,$s),projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Sy(e){return Ey(e)}function Ey(e,t){return e==null?e:{input:R(e,"input")?e.input.map(uy):void 0,postAuthentication:R(e,"postAuthentication")?e.postAuthentication.map(fy):void 0}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function ic(e){return Ry(e)}function Ry(e,t){return e==null?e:{name:e.name,authType:Qp(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:R(e,"oauth2Opts")?xy(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?Vp(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Kh(e.basicOpts):void 0,support:Ul(e.support),providerOpts:e.providerOpts,authHealthCheck:R(e,"authHealthCheck")?Wp(e.authHealthCheck):void 0,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?cy(e.media):void 0,labels:R(e,"labels")?e.labels:void 0,subscribeOpts:R(e,"subscribeOpts")?Ny(e.subscribeOpts):void 0,modules:R(e,"modules")?Ke(e.modules,yy):void 0,metadata:R(e,"metadata")?Sy(e.metadata):void 0}}function Ay(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Dm(e.connection)}}function Fy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:fh(e.read),write:Rh(e.write),proxy:Rl(e.proxy)}}function Py(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Fy(e.content)}}function Dy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Py(e.config)}}function My(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Dy(e.installation)}}function ky(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function jy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ky(e.project)}}function Ly(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 qy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Ly(e.providerApp)}}class Ky extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:jg(t.generateConnectionParams)},n);return new je(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:Ay(t.updateConnectionRequest)},n);return new je(i,s=>oi(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Uy extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:qm(t.installation)},n);return new je(i,s=>Vi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Vi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Vi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new 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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:My(t.installationUpdate)},n);return new je(i,s=>Vi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Vy extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Vh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(rc))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Tg(t.integration)},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new fr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(rc))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class $y extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:_y(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Za(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Za(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Hy extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Rg(t.project)},n);return new je(i,s=>Ui(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new fr(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Ui(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new je(o,i=>i.map(Ui))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:jy(t.projectUpdate)},n);return new je(i,s=>Ui(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class By extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new je(i,s=>ic(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new je(o,i=>Ke(i,ic))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Jy extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Ag(t.providerApp)},n);return new je(i,s=>Xi(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Xi))}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={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:qy(t.providerAppUpdate)},n);return new je(i,s=>Xi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Wy extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Fg(t.revision)},n);return new fr(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={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Yg(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Vl{constructor(t){this.connectionApi=new Ky(t),this.installationApi=new Uy(t),this.integrationApi=new Vy(t),this.oAuthApi=new $y(t),this.projectApi=new Hy(t),this.providerApi=new By(t),this.providerAppApi=new Jy(t),this.revisionApi=new Wy(t)}}const $l="2.8.0",zy="v1",$i="https://api.withampersand.com";function Hl(){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 $i;case"mock":return"http://127.0.0.1:4010";case"":return $i;default:return e??$i}}catch{return $i}}const Qy=(e,t)=>`${e}/${t}`;function Gy(){return Qy(Hl(),zy)}const Bl=Hl(),Jl=Gy(),Xy=new Vs({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l}});let Yy=new Vl(Xy);const Hs=()=>Yy;function it(){const e=xl();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Vs({basePath:Jl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l,"X-Api-Key":e}});return new Vl(n)},[e])}const Zy=e=>{const t=it();return Jn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Wl=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ne=()=>{const e=w.useContext(Wl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function ev({projectIdOrName:e,children:t}){const{setError:n}=Dt(),{data:r,isLoading:o,isError:i}=Zy(e);w.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=w.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(Wl.Provider,{value:s,children:t})}function zl(){const e=it(),{projectIdOrName:t}=Ne();return Jn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Ue=async(e,t)=>{var n;if(e instanceof _l){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
2
2
|
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
|
|
3
3
|
|
|
4
|
-
[Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Ql=w.createContext({integrations:null,isLoading:!0}),Bs=()=>{const e=w.useContext(Ql);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function
|
|
5
|
-
component is wrapped with AmpersandProvider`);return e}const Js=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ne(),r=it();return Jn({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})},
|
|
6
|
-
`).filter(n=>n.trim()!==""),bv=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Iv=e=>e.replace(/[.:/\\]/g,"\\$&"),Cv=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},eu=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ot(){const e=w.useContext(eu);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function xv({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f}){const{integrations:u}=Bs(),{setError:d,isError:g,removeError:m}=Dt(),{isIntegrationDeleted:b,setIntegrationDeleted:y,resetIntegrationDeleted:p}=Cv(),C=w.useMemo(()=>bv(t,u||[]),[t,u]),{data:h,isLoading:v,isError:I,error:O}=Ws(t,o),S=(h==null?void 0:h[0])||null;w.useEffect(()=>{p()},[t,n,r,o,i,f]),w.useEffect(()=>{C===null&&(u!=null&&u.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,C,u]),w.useEffect(()=>{I?(d(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||""),Ue(O)):m(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||"")},[I,C,d,m,O]);const N=Le(),T=w.useCallback(()=>{N.invalidateQueries({queryKey:["amp","installations"]})},[N]),A=w.useCallback(K=>{N.setQueryData(["amp","installations"],[K]),N.invalidateQueries({queryKey:["amp","installations"]})},[N]),D=(C==null?void 0:C.id)||"",J=w.useMemo(()=>({integrationId:(C==null?void 0:C.id)||"",provider:(C==null?void 0:C.provider)||"",integrationObj:C,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:S||void 0,setInstallation:A,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:b,setIntegrationDeleted:y,fieldMapping:f}),[C,n,r,o,i,S,A,T,s,a,c,b,y,f]);if(v)return l.jsx(Xr,{});if(C===null)return l.jsx(Wt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,D)){const K=`Error retrieving installation information for integration "${(C==null?void 0:C.name)||"unknown"}"`;return l.jsx(Wt,{message:K})}return l.jsx(eu.Provider,{value:J,children:e})}const tu=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Xt=()=>{const e=w.useContext(tu);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function nu({groupRef:e,provider:t,children:n}){const r=Le(),{setError:o,isError:i}=Dt(),{projectId:s,isLoading:a}=Ne(),{integrationId:c,groupRef:f}=ot(),{provider:u}=Qr(c),{data:d,isLoading:g,isError:m,error:b}=Js({groupRef:e||f,provider:u||t}),y=d==null?void 0:d[0],p=w.useCallback(v=>{r.setQueryData(["amp","connections"],()=>v),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),C=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{m?(o(ue.CONNECTION_LIST,s,!0),Ue(b)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,b]);const h=w.useMemo(()=>({connections:d||null,isConnectionsLoading:g,selectedConnection:y||null,setConnections:p,setSelectedConnection:C}),[d,g,y,p,C]);if(g||a)return l.jsx(Xr,{});if(i(ue.PROJECT,s))return l.jsx(Wt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Wt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(tu.Provider,{value:h,children:n})}function ru(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var io={exports:{}};io.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]",u="[object Boolean]",d="[object Date]",g="[object Error]",m="[object Function]",b="[object GeneratorFunction]",y="[object Map]",p="[object Number]",C="[object Null]",h="[object Object]",v="[object Promise]",I="[object Proxy]",O="[object RegExp]",S="[object Set]",N="[object String]",T="[object Symbol]",A="[object Undefined]",D="[object WeakMap]",J="[object ArrayBuffer]",K="[object DataView]",$="[object Float32Array]",B="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",L="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,M={};M[$]=M[B]=M[ae]=M[re]=M[ne]=M[ge]=M[be]=M[F]=M[L]=!0,M[a]=M[c]=M[J]=M[u]=M[K]=M[d]=M[g]=M[m]=M[y]=M[p]=M[h]=M[O]=M[S]=M[N]=M[D]=!1;var Z=typeof Hi=="object"&&Hi&&Hi.Object===Object&&Hi,ee=typeof self=="object"&&self&&self.Object===Object&&self,W=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,X=te&&!0&&e&&!e.nodeType&&e,de=X&&X.exports===te,j=de&&Z.process,we=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),z=we&&we.isTypedArray;function Ee(x,E){for(var P=-1,Y=x==null?0:x.length,Re=0,fe=[];++P<Y;){var Me=x[P];E(Me,P,x)&&(fe[Re++]=Me)}return fe}function Ve(x,E){for(var P=-1,Y=E.length,Re=x.length;++P<Y;)x[Re+P]=E[P];return x}function Ze(x,E){for(var P=-1,Y=x==null?0:x.length;++P<Y;)if(E(x[P],P,x))return!0;return!1}function $e(x,E){for(var P=-1,Y=Array(x);++P<x;)Y[P]=E(P);return Y}function Ie(x){return function(E){return x(E)}}function Mt(x,E){return x.has(E)}function et(x,E){return x==null?void 0:x[E]}function bt(x){var E=-1,P=Array(x.size);return x.forEach(function(Y,Re){P[++E]=[Re,Y]}),P}function kt(x,E){return function(P){return x(E(P))}}function jt(x){var E=-1,P=Array(x.size);return x.forEach(function(Y){P[++E]=Y}),P}var tt=Array.prototype,Ge=Function.prototype,He=Object.prototype,Fe=W["__core-js_shared__"],Lt=Ge.toString,pt=He.hasOwnProperty,an=function(){var x=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Zt=He.toString,It=RegExp("^"+Lt.call(pt).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?W.Buffer:void 0,cn=W.Symbol,Cn=W.Uint8Array,ln=He.propertyIsEnumerable,Wn=tt.splice,ht=cn?cn.toStringTag:void 0,un=Object.getOwnPropertySymbols,xn=Pe?Pe.isBuffer:void 0,zn=kt(Object.keys,Object),On=Ir(W,"DataView"),Ae=Ir(W,"Map"),st=Ir(W,"Promise"),oe=Ir(W,"Set"),me=Ir(W,"WeakMap"),Be=Ir(Object,"create"),dn=Gn(On),Q=Gn(Ae),ce=Gn(st),le=Gn(oe),qe=Gn(me),Je=cn?cn.prototype:void 0,mt=Je?Je.valueOf:void 0;function Xe(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function nt(){this.__data__=Be?Be(null):{},this.size=0}function gt(x){var E=this.has(x)&&delete this.__data__[x];return this.size-=E?1:0,E}function Te(x){var E=this.__data__;if(Be){var P=E[x];return P===r?void 0:P}return pt.call(E,x)?E[x]:void 0}function _n(x){var E=this.__data__;return Be?E[x]!==void 0:pt.call(E,x)}function ko(x,E){var P=this.__data__;return this.size+=this.has(x)?0:1,P[x]=Be&&E===void 0?r:E,this}Xe.prototype.clear=nt,Xe.prototype.delete=gt,Xe.prototype.get=Te,Xe.prototype.has=_n,Xe.prototype.set=ko;function qt(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function Ni(){this.__data__=[],this.size=0}function Ti(x){var E=this.__data__,P=Di(E,x);if(P<0)return!1;var Y=E.length-1;return P==Y?E.pop():Wn.call(E,P,1),--this.size,!0}function Ri(x){var E=this.__data__,P=Di(E,x);return P<0?void 0:E[P][1]}function Ai(x){return Di(this.__data__,x)>-1}function Fi(x,E){var P=this.__data__,Y=Di(P,x);return Y<0?(++this.size,P.push([x,E])):P[Y][1]=E,this}qt.prototype.clear=Ni,qt.prototype.delete=Ti,qt.prototype.get=Ri,qt.prototype.has=Ai,qt.prototype.set=Fi;function ye(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function Kt(){this.size=0,this.__data__={hash:new Xe,map:new(Ae||qt),string:new Xe}}function ei(x){var E=Mi(this,x).delete(x);return this.size-=E?1:0,E}function Qn(x){return Mi(this,x).get(x)}function jo(x){return Mi(this,x).has(x)}function ti(x,E){var P=Mi(this,x),Y=P.size;return P.set(x,E),this.size+=P.size==Y?0:1,this}ye.prototype.clear=Kt,ye.prototype.delete=ei,ye.prototype.get=Qn,ye.prototype.has=jo,ye.prototype.set=ti;function Pi(x){var E=-1,P=x==null?0:x.length;for(this.__data__=new ye;++E<P;)this.add(x[E])}function Cf(x){return this.__data__.set(x,r),this}function xf(x){return this.__data__.has(x)}Pi.prototype.add=Pi.prototype.push=Cf,Pi.prototype.has=xf;function Sn(x){var E=this.__data__=new qt(x);this.size=E.size}function Of(){this.__data__=new qt,this.size=0}function _f(x){var E=this.__data__,P=E.delete(x);return this.size=E.size,P}function Sf(x){return this.__data__.get(x)}function Ef(x){return this.__data__.has(x)}function Nf(x,E){var P=this.__data__;if(P instanceof qt){var Y=P.__data__;if(!Ae||Y.length<n-1)return Y.push([x,E]),this.size=++P.size,this;P=this.__data__=new ye(Y)}return P.set(x,E),this.size=P.size,this}Sn.prototype.clear=Of,Sn.prototype.delete=_f,Sn.prototype.get=Sf,Sn.prototype.has=Ef,Sn.prototype.set=Nf;function Tf(x,E){var P=ki(x),Y=!P&&Hf(x),Re=!P&&!Y&&Lo(x),fe=!P&&!Y&&!Re&&Ua(x),Me=P||Y||Re||fe,Ye=Me?$e(x.length,String):[],rt=Ye.length;for(var De in x)pt.call(x,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||qf(De,rt)))&&Ye.push(De);return Ye}function Di(x,E){for(var P=x.length;P--;)if(ja(x[P][0],E))return P;return-1}function Rf(x,E,P){var Y=E(x);return ki(x)?Y:Ve(Y,P(x))}function ni(x){return x==null?x===void 0?A:C:ht&&ht in Object(x)?jf(x):$f(x)}function Pa(x){return ri(x)&&ni(x)==a}function Da(x,E,P,Y,Re){return x===E?!0:x==null||E==null||!ri(x)&&!ri(E)?x!==x&&E!==E:Af(x,E,P,Y,Da,Re)}function Af(x,E,P,Y,Re,fe){var Me=ki(x),Ye=ki(E),rt=Me?c:En(x),De=Ye?c:En(E);rt=rt==a?h:rt,De=De==a?h:De;var Ct=rt==h,Ut=De==h,at=rt==De;if(at&&Lo(x)){if(!Lo(E))return!1;Me=!0,Ct=!1}if(at&&!Ct)return fe||(fe=new Sn),Me||Ua(x)?Ma(x,E,P,Y,Re,fe):Mf(x,E,rt,P,Y,Re,fe);if(!(P&o)){var Nt=Ct&&pt.call(x,"__wrapped__"),Tt=Ut&&pt.call(E,"__wrapped__");if(Nt||Tt){var Nn=Nt?x.value():x,fn=Tt?E.value():E;return fe||(fe=new Sn),Re(Nn,fn,P,Y,fe)}}return at?(fe||(fe=new Sn),kf(x,E,P,Y,Re,fe)):!1}function Ff(x){if(!Ka(x)||Uf(x))return!1;var E=La(x)?It:U;return E.test(Gn(x))}function Pf(x){return ri(x)&&qa(x.length)&&!!M[ni(x)]}function Df(x){if(!Vf(x))return zn(x);var E=[];for(var P in Object(x))pt.call(x,P)&&P!="constructor"&&E.push(P);return E}function Ma(x,E,P,Y,Re,fe){var Me=P&o,Ye=x.length,rt=E.length;if(Ye!=rt&&!(Me&&rt>Ye))return!1;var De=fe.get(x);if(De&&fe.get(E))return De==E;var Ct=-1,Ut=!0,at=P&i?new Pi:void 0;for(fe.set(x,E),fe.set(E,x);++Ct<Ye;){var Nt=x[Ct],Tt=E[Ct];if(Y)var Nn=Me?Y(Tt,Nt,Ct,E,x,fe):Y(Nt,Tt,Ct,x,E,fe);if(Nn!==void 0){if(Nn)continue;Ut=!1;break}if(at){if(!Ze(E,function(fn,Xn){if(!Mt(at,Xn)&&(Nt===fn||Re(Nt,fn,P,Y,fe)))return at.push(Xn)})){Ut=!1;break}}else if(!(Nt===Tt||Re(Nt,Tt,P,Y,fe))){Ut=!1;break}}return fe.delete(x),fe.delete(E),Ut}function Mf(x,E,P,Y,Re,fe,Me){switch(P){case K:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case J:return!(x.byteLength!=E.byteLength||!fe(new Cn(x),new Cn(E)));case u:case d:case p:return ja(+x,+E);case g:return x.name==E.name&&x.message==E.message;case O:case N:return x==E+"";case y:var Ye=bt;case S:var rt=Y&o;if(Ye||(Ye=jt),x.size!=E.size&&!rt)return!1;var De=Me.get(x);if(De)return De==E;Y|=i,Me.set(x,E);var Ct=Ma(Ye(x),Ye(E),Y,Re,fe,Me);return Me.delete(x),Ct;case T:if(mt)return mt.call(x)==mt.call(E)}return!1}function kf(x,E,P,Y,Re,fe){var Me=P&o,Ye=ka(x),rt=Ye.length,De=ka(E),Ct=De.length;if(rt!=Ct&&!Me)return!1;for(var Ut=rt;Ut--;){var at=Ye[Ut];if(!(Me?at in E:pt.call(E,at)))return!1}var Nt=fe.get(x);if(Nt&&fe.get(E))return Nt==E;var Tt=!0;fe.set(x,E),fe.set(E,x);for(var Nn=Me;++Ut<rt;){at=Ye[Ut];var fn=x[at],Xn=E[at];if(Y)var Va=Me?Y(Xn,fn,at,E,x,fe):Y(fn,Xn,at,x,E,fe);if(!(Va===void 0?fn===Xn||Re(fn,Xn,P,Y,fe):Va)){Tt=!1;break}Nn||(Nn=at=="constructor")}if(Tt&&!Nn){var ji=x.constructor,Li=E.constructor;ji!=Li&&"constructor"in x&&"constructor"in E&&!(typeof ji=="function"&&ji instanceof ji&&typeof Li=="function"&&Li instanceof Li)&&(Tt=!1)}return fe.delete(x),fe.delete(E),Tt}function ka(x){return Rf(x,Wf,Lf)}function Mi(x,E){var P=x.__data__;return Kf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function Ir(x,E){var P=et(x,E);return Ff(P)?P:void 0}function jf(x){var E=pt.call(x,ht),P=x[ht];try{x[ht]=void 0;var Y=!0}catch{}var Re=Zt.call(x);return Y&&(E?x[ht]=P:delete x[ht]),Re}var Lf=un?function(x){return x==null?[]:(x=Object(x),Ee(un(x),function(E){return ln.call(x,E)}))}:zf,En=ni;(On&&En(new On(new ArrayBuffer(1)))!=K||Ae&&En(new Ae)!=y||st&&En(st.resolve())!=v||oe&&En(new oe)!=S||me&&En(new me)!=D)&&(En=function(x){var E=ni(x),P=E==h?x.constructor:void 0,Y=P?Gn(P):"";if(Y)switch(Y){case dn:return K;case Q:return y;case ce:return v;case le:return S;case qe:return D}return E});function qf(x,E){return E=E??s,!!E&&(typeof x=="number"||q.test(x))&&x>-1&&x%1==0&&x<E}function Kf(x){var E=typeof x;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?x!=="__proto__":x===null}function Uf(x){return!!an&&an in x}function Vf(x){var E=x&&x.constructor,P=typeof E=="function"&&E.prototype||He;return x===P}function $f(x){return Zt.call(x)}function Gn(x){if(x!=null){try{return Lt.call(x)}catch{}try{return x+""}catch{}}return""}function ja(x,E){return x===E||x!==x&&E!==E}var Hf=Pa(function(){return arguments}())?Pa:function(x){return ri(x)&&pt.call(x,"callee")&&!ln.call(x,"callee")},ki=Array.isArray;function Bf(x){return x!=null&&qa(x.length)&&!La(x)}var Lo=xn||Qf;function Jf(x,E){return Da(x,E)}function La(x){if(!Ka(x))return!1;var E=ni(x);return E==m||E==b||E==f||E==I}function qa(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=s}function Ka(x){var E=typeof x;return x!=null&&(E=="object"||E=="function")}function ri(x){return x!=null&&typeof x=="object"}var Ua=z?Ie(z):Pf;function Wf(x){return Bf(x)?Tf(x):Df(x)}function zf(){return[]}function Qf(){return!1}e.exports=Jf})(io,io.exports);var Ov=io.exports;const iu=zs(Ov),pr="other",oo="manage-tab";function $n(e){return!e.fieldName}function _v(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Sv(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}function Ev(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function Nv(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function Tv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}const ou=(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 Rv(e){return $n(e)?e.mapToName:e.fieldName}const su=(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)&&Vn(s==null?void 0:s.objectName),completed:e?!!ou(e,s.objectName):!1})}),n},au=e=>{var n;return{name:pr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Av(e,t){var i;const n=su(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?au(e):void 0;return o&&n.push(o),n}function cu(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function Fv(e,t){return iu(e,t)}function lu(e,t){return iu(e,t)}const Pv=(e,t,n)=>{var p,C,h,v,I,O,S,N,T;if(!e)return null;const r=_v(e,t),o=r&&Sv(r),i=r&&Tv(r),s=r&&Ev(r),a=r&&Nv(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,d=((h=(C=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:C[t])==null?void 0:h.selectedFields)||{},g=((O=(I=(v=u==null?void 0:u.read)==null?void 0:v.objects)==null?void 0:I[t])==null?void 0:O.selectedValueMappings)||{},m=((T=(N=(S=u==null?void 0:u.read)==null?void 0:S.objects)==null?void 0:N[t])==null?void 0:T.selectedFieldMappings)||{},b={...d},y={...m};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:d,selectedFieldMappings:m,selectedValueMappings:g,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:b,requiredMapFields:y,selectedValueMappings:g}}},Dv=(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 uu(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:Pv(r,t,n),write:Dv(o,n)}}const du=(e,t,n,r)=>{const o=uu(e,n,t);r(n,o)},Mv=(e,t,n)=>{const r=Av(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=uu(e,i,t))}),n(o)},fu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Rv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},pu=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},hu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function mu(e,t){return t[e]||void 0}async function gu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const f={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const u=await Hs().installationApi.createInstallation(f,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(u),c==null||c(u.id,u.config)}catch(u){Ue(u,s)}}function Ii(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const kv=(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)},jv=(e,t,n,r)=>{const o=fu(e),i=pu(e),s=hu(e),a=kv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Ii(n)&&(c.content.proxy={enabled:!0}),c},Lv=(e,t,n,r,o,i,s,a,c,f,u,d)=>{const g=jv(c,i,a,r);return g?gu({createConfig:g,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:f,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},yu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},qv=e=>{const t=e.content.write;return t==null?void 0:t.objects},Kv=(e,t,n)=>{if(!qv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=yu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Ii(t)&&(i.content.proxy={enabled:!0}),i},Uv=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=Kv(a,s,r);return d?gu({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:f,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var vu={exports:{}};/*!
|
|
4
|
+
[Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Ql=w.createContext({integrations:null,isLoading:!0}),Bs=()=>{const e=w.useContext(Ql);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function tv({children:e}){const{projectIdOrName:t}=Ne(),{setError:n,removeError:r}=Dt(),{data:o,isLoading:i,isError:s}=zl();w.useEffect(()=>{s?(Ue(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=w.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(Ql.Provider,{value:a,children:e})}const nv=new dp;function rv(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(gp,{client:nv,children:l.jsx(Rp,{children:l.jsx(Np,{value:t,children:l.jsx(ev,{projectIdOrName:i,children:l.jsx(tv,{children:o})})})})})}const Gl=w.createContext(null);function iv(){const e=w.useContext(Gl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
5
|
+
component is wrapped with AmpersandProvider`);return e}const Js=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ne(),r=it();return Jn({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})},zr=e=>{const t=zl(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}};function ov(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("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"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const sv="_box_1p7c5_1",oc={box:sv};function wn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${oc.box} ${t}`:oc.box,style:n,children:e})}const av="_container_1wvzr_1",sc={container:av};function Qr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${sc.container} ${t}`:sc.container,style:n,children:e})}const cv="_errorBoxContainer_4sdb2_1",lv="_errorBox_4sdb2_1",uv="_errorText_4sdb2_20",ws={errorBoxContainer:cv,errorBox:lv,errorText:uv};function Xl({message:e}){return l.jsx(wn,{className:ws.errorBox,children:l.jsx("p",{className:ws.errorText,children:e})})}function Yl({message:e,children:t}){return l.jsxs(Qr,{className:ws.errorBoxContainer,children:[l.jsx(ov,{}),l.jsx(Xl,{message:e}),t]})}const dv="_loader_6ubm6_1",fv="_rotate_6ubm6_1",pv="_ball1_6ubm6_1",hv="_ball2_6ubm6_1",mv={loader:dv,rotate:fv,ball1:pv,ball2:hv};function gv(){return l.jsx("span",{className:mv.loader})}function ui(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(gv,{})})}function Zl({children:e}){return l.jsx(Qr,{style:{maxWidth:"55rem"},children:l.jsx(wn,{children:e})})}function Gr(){return l.jsx(Zl,{children:l.jsx(ui,{})})}function Wt({message:e,children:t}){return l.jsx(Zl,{children:l.jsx(Yl,{message:e,children:t})})}const Ws=(e,t)=>{var s;const n=it(),{projectIdOrName:r}=Ne(),{integrations:o}=Bs(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Jn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function Vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yv(e,t){return(t==null?void 0:t.displayName)??Vn(e)}const vv=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),wv=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,bv=e=>e.replace(/[.:/\\]/g,"\\$&"),Iv=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},eu=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ot(){const e=w.useContext(eu);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Cv({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f}){const{integrations:u}=Bs(),{setError:d,isError:g,removeError:m}=Dt(),{isIntegrationDeleted:b,setIntegrationDeleted:y,resetIntegrationDeleted:p}=Iv(),C=w.useMemo(()=>wv(t,u||[]),[t,u]),{data:h,isLoading:v,isError:I,error:O}=Ws(t,o),S=(h==null?void 0:h[0])||null;w.useEffect(()=>{p()},[t,n,r,o,i,f]),w.useEffect(()=>{C===null&&(u!=null&&u.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,C,u]),w.useEffect(()=>{I?(d(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||""),Ue(O)):m(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||"")},[I,C,d,m,O]);const N=Le(),T=w.useCallback(()=>{N.invalidateQueries({queryKey:["amp","installations"]})},[N]),A=w.useCallback(K=>{N.setQueryData(["amp","installations"],[K]),N.invalidateQueries({queryKey:["amp","installations"]})},[N]),D=(C==null?void 0:C.id)||"",J=w.useMemo(()=>({integrationId:(C==null?void 0:C.id)||"",provider:(C==null?void 0:C.provider)||"",integrationObj:C,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:S||void 0,setInstallation:A,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:b,setIntegrationDeleted:y,fieldMapping:f}),[C,n,r,o,i,S,A,T,s,a,c,b,y,f]);if(v)return l.jsx(Gr,{});if(C===null)return l.jsx(Wt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,D)){const K=`Error retrieving installation information for integration "${(C==null?void 0:C.name)||"unknown"}"`;return l.jsx(Wt,{message:K})}return l.jsx(eu.Provider,{value:J,children:e})}const tu=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Xt=()=>{const e=w.useContext(tu);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function nu({groupRef:e,provider:t,children:n}){const r=Le(),{setError:o,isError:i}=Dt(),{projectId:s,isLoading:a}=Ne(),{integrationId:c,groupRef:f}=ot(),{provider:u}=zr(c),{data:d,isLoading:g,isError:m,error:b}=Js({groupRef:e||f,provider:u||t}),y=d==null?void 0:d[0],p=w.useCallback(v=>{r.setQueryData(["amp","connections"],()=>v),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),C=w.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);w.useEffect(()=>{m?(o(ue.CONNECTION_LIST,s,!0),Ue(b)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,b]);const h=w.useMemo(()=>({connections:d||null,isConnectionsLoading:g,selectedConnection:y||null,setConnections:p,setSelectedConnection:C}),[d,g,y,p,C]);if(g||a)return l.jsx(Gr,{});if(i(ue.PROJECT,s))return l.jsx(Wt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Wt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(tu.Provider,{value:h,children:n})}function ru(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var io={exports:{}};io.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]",u="[object Boolean]",d="[object Date]",g="[object Error]",m="[object Function]",b="[object GeneratorFunction]",y="[object Map]",p="[object Number]",C="[object Null]",h="[object Object]",v="[object Promise]",I="[object Proxy]",O="[object RegExp]",S="[object Set]",N="[object String]",T="[object Symbol]",A="[object Undefined]",D="[object WeakMap]",J="[object ArrayBuffer]",K="[object DataView]",$="[object Float32Array]",B="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",L="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,M={};M[$]=M[B]=M[ae]=M[re]=M[ne]=M[ge]=M[be]=M[F]=M[L]=!0,M[a]=M[c]=M[J]=M[u]=M[K]=M[d]=M[g]=M[m]=M[y]=M[p]=M[h]=M[O]=M[S]=M[N]=M[D]=!1;var Z=typeof Hi=="object"&&Hi&&Hi.Object===Object&&Hi,ee=typeof self=="object"&&self&&self.Object===Object&&self,W=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,X=te&&!0&&e&&!e.nodeType&&e,de=X&&X.exports===te,j=de&&Z.process,we=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),z=we&&we.isTypedArray;function Ee(x,E){for(var P=-1,Y=x==null?0:x.length,Re=0,fe=[];++P<Y;){var Me=x[P];E(Me,P,x)&&(fe[Re++]=Me)}return fe}function Ve(x,E){for(var P=-1,Y=E.length,Re=x.length;++P<Y;)x[Re+P]=E[P];return x}function Ze(x,E){for(var P=-1,Y=x==null?0:x.length;++P<Y;)if(E(x[P],P,x))return!0;return!1}function $e(x,E){for(var P=-1,Y=Array(x);++P<x;)Y[P]=E(P);return Y}function Ie(x){return function(E){return x(E)}}function Mt(x,E){return x.has(E)}function et(x,E){return x==null?void 0:x[E]}function bt(x){var E=-1,P=Array(x.size);return x.forEach(function(Y,Re){P[++E]=[Re,Y]}),P}function kt(x,E){return function(P){return x(E(P))}}function jt(x){var E=-1,P=Array(x.size);return x.forEach(function(Y){P[++E]=Y}),P}var tt=Array.prototype,Ge=Function.prototype,He=Object.prototype,Fe=W["__core-js_shared__"],Lt=Ge.toString,pt=He.hasOwnProperty,an=function(){var x=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Zt=He.toString,It=RegExp("^"+Lt.call(pt).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?W.Buffer:void 0,cn=W.Symbol,Cn=W.Uint8Array,ln=He.propertyIsEnumerable,Wn=tt.splice,ht=cn?cn.toStringTag:void 0,un=Object.getOwnPropertySymbols,xn=Pe?Pe.isBuffer:void 0,zn=kt(Object.keys,Object),On=br(W,"DataView"),Ae=br(W,"Map"),st=br(W,"Promise"),oe=br(W,"Set"),me=br(W,"WeakMap"),Be=br(Object,"create"),dn=Gn(On),Q=Gn(Ae),ce=Gn(st),le=Gn(oe),qe=Gn(me),Je=cn?cn.prototype:void 0,mt=Je?Je.valueOf:void 0;function Xe(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function nt(){this.__data__=Be?Be(null):{},this.size=0}function gt(x){var E=this.has(x)&&delete this.__data__[x];return this.size-=E?1:0,E}function Te(x){var E=this.__data__;if(Be){var P=E[x];return P===r?void 0:P}return pt.call(E,x)?E[x]:void 0}function _n(x){var E=this.__data__;return Be?E[x]!==void 0:pt.call(E,x)}function ko(x,E){var P=this.__data__;return this.size+=this.has(x)?0:1,P[x]=Be&&E===void 0?r:E,this}Xe.prototype.clear=nt,Xe.prototype.delete=gt,Xe.prototype.get=Te,Xe.prototype.has=_n,Xe.prototype.set=ko;function qt(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function Ni(){this.__data__=[],this.size=0}function Ti(x){var E=this.__data__,P=Di(E,x);if(P<0)return!1;var Y=E.length-1;return P==Y?E.pop():Wn.call(E,P,1),--this.size,!0}function Ri(x){var E=this.__data__,P=Di(E,x);return P<0?void 0:E[P][1]}function Ai(x){return Di(this.__data__,x)>-1}function Fi(x,E){var P=this.__data__,Y=Di(P,x);return Y<0?(++this.size,P.push([x,E])):P[Y][1]=E,this}qt.prototype.clear=Ni,qt.prototype.delete=Ti,qt.prototype.get=Ri,qt.prototype.has=Ai,qt.prototype.set=Fi;function ye(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var Y=x[E];this.set(Y[0],Y[1])}}function Kt(){this.size=0,this.__data__={hash:new Xe,map:new(Ae||qt),string:new Xe}}function ei(x){var E=Mi(this,x).delete(x);return this.size-=E?1:0,E}function Qn(x){return Mi(this,x).get(x)}function jo(x){return Mi(this,x).has(x)}function ti(x,E){var P=Mi(this,x),Y=P.size;return P.set(x,E),this.size+=P.size==Y?0:1,this}ye.prototype.clear=Kt,ye.prototype.delete=ei,ye.prototype.get=Qn,ye.prototype.has=jo,ye.prototype.set=ti;function Pi(x){var E=-1,P=x==null?0:x.length;for(this.__data__=new ye;++E<P;)this.add(x[E])}function If(x){return this.__data__.set(x,r),this}function Cf(x){return this.__data__.has(x)}Pi.prototype.add=Pi.prototype.push=If,Pi.prototype.has=Cf;function Sn(x){var E=this.__data__=new qt(x);this.size=E.size}function xf(){this.__data__=new qt,this.size=0}function Of(x){var E=this.__data__,P=E.delete(x);return this.size=E.size,P}function _f(x){return this.__data__.get(x)}function Sf(x){return this.__data__.has(x)}function Ef(x,E){var P=this.__data__;if(P instanceof qt){var Y=P.__data__;if(!Ae||Y.length<n-1)return Y.push([x,E]),this.size=++P.size,this;P=this.__data__=new ye(Y)}return P.set(x,E),this.size=P.size,this}Sn.prototype.clear=xf,Sn.prototype.delete=Of,Sn.prototype.get=_f,Sn.prototype.has=Sf,Sn.prototype.set=Ef;function Nf(x,E){var P=ki(x),Y=!P&&$f(x),Re=!P&&!Y&&Lo(x),fe=!P&&!Y&&!Re&&Ua(x),Me=P||Y||Re||fe,Ye=Me?$e(x.length,String):[],rt=Ye.length;for(var De in x)pt.call(x,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Lf(De,rt)))&&Ye.push(De);return Ye}function Di(x,E){for(var P=x.length;P--;)if(ja(x[P][0],E))return P;return-1}function Tf(x,E,P){var Y=E(x);return ki(x)?Y:Ve(Y,P(x))}function ni(x){return x==null?x===void 0?A:C:ht&&ht in Object(x)?kf(x):Vf(x)}function Pa(x){return ri(x)&&ni(x)==a}function Da(x,E,P,Y,Re){return x===E?!0:x==null||E==null||!ri(x)&&!ri(E)?x!==x&&E!==E:Rf(x,E,P,Y,Da,Re)}function Rf(x,E,P,Y,Re,fe){var Me=ki(x),Ye=ki(E),rt=Me?c:En(x),De=Ye?c:En(E);rt=rt==a?h:rt,De=De==a?h:De;var Ct=rt==h,Ut=De==h,at=rt==De;if(at&&Lo(x)){if(!Lo(E))return!1;Me=!0,Ct=!1}if(at&&!Ct)return fe||(fe=new Sn),Me||Ua(x)?Ma(x,E,P,Y,Re,fe):Df(x,E,rt,P,Y,Re,fe);if(!(P&o)){var Nt=Ct&&pt.call(x,"__wrapped__"),Tt=Ut&&pt.call(E,"__wrapped__");if(Nt||Tt){var Nn=Nt?x.value():x,fn=Tt?E.value():E;return fe||(fe=new Sn),Re(Nn,fn,P,Y,fe)}}return at?(fe||(fe=new Sn),Mf(x,E,P,Y,Re,fe)):!1}function Af(x){if(!Ka(x)||Kf(x))return!1;var E=La(x)?It:U;return E.test(Gn(x))}function Ff(x){return ri(x)&&qa(x.length)&&!!M[ni(x)]}function Pf(x){if(!Uf(x))return zn(x);var E=[];for(var P in Object(x))pt.call(x,P)&&P!="constructor"&&E.push(P);return E}function Ma(x,E,P,Y,Re,fe){var Me=P&o,Ye=x.length,rt=E.length;if(Ye!=rt&&!(Me&&rt>Ye))return!1;var De=fe.get(x);if(De&&fe.get(E))return De==E;var Ct=-1,Ut=!0,at=P&i?new Pi:void 0;for(fe.set(x,E),fe.set(E,x);++Ct<Ye;){var Nt=x[Ct],Tt=E[Ct];if(Y)var Nn=Me?Y(Tt,Nt,Ct,E,x,fe):Y(Nt,Tt,Ct,x,E,fe);if(Nn!==void 0){if(Nn)continue;Ut=!1;break}if(at){if(!Ze(E,function(fn,Xn){if(!Mt(at,Xn)&&(Nt===fn||Re(Nt,fn,P,Y,fe)))return at.push(Xn)})){Ut=!1;break}}else if(!(Nt===Tt||Re(Nt,Tt,P,Y,fe))){Ut=!1;break}}return fe.delete(x),fe.delete(E),Ut}function Df(x,E,P,Y,Re,fe,Me){switch(P){case K:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case J:return!(x.byteLength!=E.byteLength||!fe(new Cn(x),new Cn(E)));case u:case d:case p:return ja(+x,+E);case g:return x.name==E.name&&x.message==E.message;case O:case N:return x==E+"";case y:var Ye=bt;case S:var rt=Y&o;if(Ye||(Ye=jt),x.size!=E.size&&!rt)return!1;var De=Me.get(x);if(De)return De==E;Y|=i,Me.set(x,E);var Ct=Ma(Ye(x),Ye(E),Y,Re,fe,Me);return Me.delete(x),Ct;case T:if(mt)return mt.call(x)==mt.call(E)}return!1}function Mf(x,E,P,Y,Re,fe){var Me=P&o,Ye=ka(x),rt=Ye.length,De=ka(E),Ct=De.length;if(rt!=Ct&&!Me)return!1;for(var Ut=rt;Ut--;){var at=Ye[Ut];if(!(Me?at in E:pt.call(E,at)))return!1}var Nt=fe.get(x);if(Nt&&fe.get(E))return Nt==E;var Tt=!0;fe.set(x,E),fe.set(E,x);for(var Nn=Me;++Ut<rt;){at=Ye[Ut];var fn=x[at],Xn=E[at];if(Y)var Va=Me?Y(Xn,fn,at,E,x,fe):Y(fn,Xn,at,x,E,fe);if(!(Va===void 0?fn===Xn||Re(fn,Xn,P,Y,fe):Va)){Tt=!1;break}Nn||(Nn=at=="constructor")}if(Tt&&!Nn){var ji=x.constructor,Li=E.constructor;ji!=Li&&"constructor"in x&&"constructor"in E&&!(typeof ji=="function"&&ji instanceof ji&&typeof Li=="function"&&Li instanceof Li)&&(Tt=!1)}return fe.delete(x),fe.delete(E),Tt}function ka(x){return Tf(x,Jf,jf)}function Mi(x,E){var P=x.__data__;return qf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function br(x,E){var P=et(x,E);return Af(P)?P:void 0}function kf(x){var E=pt.call(x,ht),P=x[ht];try{x[ht]=void 0;var Y=!0}catch{}var Re=Zt.call(x);return Y&&(E?x[ht]=P:delete x[ht]),Re}var jf=un?function(x){return x==null?[]:(x=Object(x),Ee(un(x),function(E){return ln.call(x,E)}))}:Wf,En=ni;(On&&En(new On(new ArrayBuffer(1)))!=K||Ae&&En(new Ae)!=y||st&&En(st.resolve())!=v||oe&&En(new oe)!=S||me&&En(new me)!=D)&&(En=function(x){var E=ni(x),P=E==h?x.constructor:void 0,Y=P?Gn(P):"";if(Y)switch(Y){case dn:return K;case Q:return y;case ce:return v;case le:return S;case qe:return D}return E});function Lf(x,E){return E=E??s,!!E&&(typeof x=="number"||q.test(x))&&x>-1&&x%1==0&&x<E}function qf(x){var E=typeof x;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?x!=="__proto__":x===null}function Kf(x){return!!an&&an in x}function Uf(x){var E=x&&x.constructor,P=typeof E=="function"&&E.prototype||He;return x===P}function Vf(x){return Zt.call(x)}function Gn(x){if(x!=null){try{return Lt.call(x)}catch{}try{return x+""}catch{}}return""}function ja(x,E){return x===E||x!==x&&E!==E}var $f=Pa(function(){return arguments}())?Pa:function(x){return ri(x)&&pt.call(x,"callee")&&!ln.call(x,"callee")},ki=Array.isArray;function Hf(x){return x!=null&&qa(x.length)&&!La(x)}var Lo=xn||zf;function Bf(x,E){return Da(x,E)}function La(x){if(!Ka(x))return!1;var E=ni(x);return E==m||E==b||E==f||E==I}function qa(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=s}function Ka(x){var E=typeof x;return x!=null&&(E=="object"||E=="function")}function ri(x){return x!=null&&typeof x=="object"}var Ua=z?Ie(z):Ff;function Jf(x){return Hf(x)?Nf(x):Pf(x)}function Wf(){return[]}function zf(){return!1}e.exports=Bf})(io,io.exports);var xv=io.exports;const iu=zs(xv),pr="other",oo="manage-tab";function $n(e){return!e.fieldName}function Ov(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function _v(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}function Sv(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function Ev(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function Nv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}const ou=(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 Tv(e){return $n(e)?e.mapToName:e.fieldName}const su=(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)&&Vn(s==null?void 0:s.objectName),completed:e?!!ou(e,s.objectName):!1})}),n},au=e=>{var n;return{name:pr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Rv(e,t){var i;const n=su(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?au(e):void 0;return o&&n.push(o),n}function cu(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function Av(e,t){return iu(e,t)}function lu(e,t){return iu(e,t)}const Fv=(e,t,n)=>{var p,C,h,v,I,O,S,N,T;if(!e)return null;const r=Ov(e,t),o=r&&_v(r),i=r&&Nv(r),s=r&&Sv(r),a=r&&Ev(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,d=((h=(C=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:C[t])==null?void 0:h.selectedFields)||{},g=((O=(I=(v=u==null?void 0:u.read)==null?void 0:v.objects)==null?void 0:I[t])==null?void 0:O.selectedValueMappings)||{},m=((T=(N=(S=u==null?void 0:u.read)==null?void 0:S.objects)==null?void 0:N[t])==null?void 0:T.selectedFieldMappings)||{},b={...d},y={...m};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:d,selectedFieldMappings:m,selectedValueMappings:g,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:b,requiredMapFields:y,selectedValueMappings:g}}},Pv=(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 uu(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:Fv(r,t,n),write:Pv(o,n)}}const du=(e,t,n,r)=>{const o=uu(e,n,t);r(n,o)},Dv=(e,t,n)=>{const r=Rv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=uu(e,i,t))}),n(o)},fu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Tv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},pu=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},hu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function mu(e,t){return t[e]||void 0}async function gu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const f={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const u=await Hs().installationApi.createInstallation(f,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(u),c==null||c(u.id,u.config)}catch(u){Ue(u,s)}}function Ii(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Mv=(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)},kv=(e,t,n,r)=>{const o=fu(e),i=pu(e),s=hu(e),a=Mv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Ii(n)&&(c.content.proxy={enabled:!0}),c},jv=(e,t,n,r,o,i,s,a,c,f,u,d)=>{const g=kv(c,i,a,r);return g?gu({createConfig:g,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:f,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},yu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Lv=e=>{const t=e.content.write;return t==null?void 0:t.objects},qv=(e,t,n)=>{if(!Lv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=yu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Ii(t)&&(i.content.proxy={enabled:!0}),i},Kv=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=qv(a,s,r);return d?gu({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:f,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var vu={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})()})(vu);var Vv=vu.exports;const Pt=zs(Vv),$v="_button_kwfiu_1",Hv="_buttonError_kwfiu_28",Bv="_danger_kwfiu_42",Jv="_ghost_kwfiu_47",$o={button:$v,buttonError:Hv,danger:Bv,ghost:Jv};function Qe({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Pt($o.button,{[$o.danger]:o==="danger",[$o.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Wv={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 Ci({children:e,style:t}){return l.jsx(wn,{style:{...Wv,...t},children:e})}const bo=e=>{const t=it(),{provider:n}=ot(),r=e||n;return Jn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},lt=e=>{const t=bo(e),{data:n}=t,{provider:r}=ot(),o=n&&vv(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function bn({error:e}){return e?l.jsx(Ci,{style:{marginTop:"2em"},children:e}):null}const zv="_input_1ymb7_1",Qv="_inputError_1ymb7_27",Gv="_error_1ymb7_43",Ho={input:zv,inputError:Qv,error:Gv};function Xv({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Pt(Ho.inputError,Ho.input):Ho.input;return l.jsx("input",{id:e,type:t,className:Pt(i,n),...o})}const Yv="_textarea_18zl4_1",Zv="_textareaError_18zl4_14",ew="_error_18zl4_29",Bo={textarea:Yv,textareaError:Zv,error:ew};function tw({className:e,isError:t=!1,...n}){const r=t?Pt(Bo.textareaError,Bo.textarea):Bo.textarea;return l.jsx("textarea",{className:Pt(e,r),...n})}const Jt={Input:Xv,Textarea:tw},nw=()=>{const{project:e}=Ne(),t=e==null?void 0:e.id,n=it();return Jn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function wu(){var n,r;const{data:e}=nw();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function vr({children:e}){return l.jsx(Gr,{children:l.jsxs(wn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(wu,{})]})})}function wr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function rw({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const iw="_link_oo2kv_1",ow={link:iw};function bu({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Pt(ow.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function so({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(bu,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Qs(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 di(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Iu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var I,O;const[s,a]=w.useState(!1),c=()=>a(S=>!S),[f,u]=w.useState({apiKey:""}),d=((I=t.metadata)==null?void 0:I.input)||[],g=S=>{const{name:N,value:T}=S.currentTarget;u(A=>({...A,[N]:T.trim()}))},{apiKey:m}=f,{providerName:b}=lt(e),y=m.length>0,p=di(d,f),C=r||!y||!p,h=(O=t.apiKeyOpts)==null?void 0:O.docsURL,v=()=>{const S=Qs(d,f);n({apiKey:m,providerMetadata:S})};return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[h&&l.jsx(so,{url:h,providerDisplayName:b||Vn(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"apiKey",name:"apiKey",type:s?"text":"password",placeholder:"API Key",onChange:g}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:s?"Hide":"Show"})]}),d.map(S=>l.jsxs("div",{children:[S.docsURL&&l.jsx(so,{url:S.docsURL,providerDisplayName:b||Vn(e),credentialName:S.displayName||S.name}),l.jsx(Jt.Input,{id:S.name,name:S.name,type:"text",placeholder:S.displayName||S.name,onChange:g})]},S.name)),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:C,type:i||"submit",onClick:v,variant:o,children:"Next"})]})}function sw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(bn,{error:r}),l.jsx(Iu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function aw({...e}){return l.jsx(sw,{...e})}const cw={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 Io({children:e,style:t}){return l.jsx(wn,{style:{...cw,...t},children:e})}const Gs=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},lw="_divider_1kmoj_1",ac={divider:lw};function Co({className:e,style:t}){return l.jsx("hr",{className:e?`${ac.divider} ${e}`:ac.divider,style:t})}function _t({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function uw({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>g(!1),b=()=>{g(!0),u(null)},y=(c==null?void 0:c.message)||f||null,p=async C=>{m(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:C.apiKey}}},{onError:h=>{console.error("Update connection error:",h),Ue(h,u)},onSuccess:()=>{b()}})}catch(h){console.error("Update connection caught error:",h),Ue(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} API Key`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),y&&l.jsx(Ci,{children:`Error updating connection ${y}`}),l.jsx(Iu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Cu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var v,I;const[i,s]=w.useState(!1),a=()=>s(O=>!O),[c,f]=w.useState({username:"",password:""}),u=((v=t.metadata)==null?void 0:v.input)||[],{username:d,password:g}=c,{providerName:m}=lt(e),b=O=>{const{name:S,value:N}=O.currentTarget;f(T=>({...T,[S]:N.trim()}))},y=di(u,c),p=r||!y,C=()=>{const O=Qs(u,c);n({user:d,pass:g,providerMetadata:O})},h=(I=t.basicOpts)==null?void 0:I.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[h&&l.jsx(so,{url:h,providerDisplayName:m||Vn(e),credentialName:"credentials"}),l.jsx(Jt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),u.map(O=>l.jsxs("div",{children:[O.docsURL&&l.jsx(so,{url:O.docsURL,providerDisplayName:m||Vn(e),credentialName:O.displayName||O.name}),l.jsx(Jt.Input,{id:O.name,name:O.name,type:"text",placeholder:O.displayName||O.name,onChange:b})]},O.name)),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:C,variant:o,children:"Next"})]})}function dw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(bn,{error:r}),l.jsx(Cu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function fw({...e}){return l.jsx(dw,{...e})}function pw({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>g(!1),b=()=>{g(!0),u(null)},y=(c==null?void 0:c.message)||f||null,p=async C=>{m(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:C.user,password:C.pass}}}},{onError:h=>{console.error(h),Ue(h,u)},onSuccess:()=>{b()}})}catch(h){console.error(h),Ue(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} credentials`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),y&&l.jsx(Ci,{children:`Error updating connection: ${y}`}),l.jsx(Cu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function xu({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var N;const[i,s]=w.useState(!1),[a,c]=w.useState({clientSecret:"",clientId:"",scopes:""}),[f,u]=w.useState(null),{data:d}=bo(e),g=((N=d==null?void 0:d.metadata)==null?void 0:N.input)||[],m=()=>s(T=>!T),b=T=>{const{name:A,value:D}=T.currentTarget;c(J=>({...J,[A]:D.trim()})),u(null)},{clientSecret:y,clientId:p,scopes:C}=a,h=y.length>0,v=p.length>0,I=di(g,a),O=n||!h||!v||!I,S=()=>{const T=Qs(g,a),A={clientId:p,clientSecret:y,providerMetadata:T};r&&C.length>0&&(A.scopes=wv(C)),t(A)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[l.jsx(Jt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:b}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:b}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:m,variant:o,children:i?"Hide":"Show"})]}),r&&l.jsx(Jt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:b}),g.map(T=>l.jsx(Jt.Input,{id:T.name,name:T.name,type:"text",placeholder:T.displayName||T.name,onChange:b},T.name))]}),l.jsx(bn,{error:f}),l.jsx("br",{}),l.jsx(Qe,{style:{width:"100%"},disabled:O,type:"button",onClick:S,variant:o,children:"Next"})]})}function hw({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${o} integration`}),l.jsx(bn,{error:n}),l.jsx("br",{}),l.jsx(xu,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function mw({provider:e}){var h;const{projectIdOrName:t}=Ne(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{providerName:o,data:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>{g(!1)},b=()=>{g(!0),u(null)},y=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,p=(c==null?void 0:c.message)||f||null,C=async v=>{m(),u(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}}}}),b()}catch(I){Ue(I,u)}};return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Re-authenticate to ${o}`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),p&&l.jsx(Ci,{children:`Error updating connection ${p}`}),l.jsx(xu,{provider:o||"",handleSubmit:C,isButtonDisabled:a||r,explicitScopesRequired:y,buttonVariant:"ghost"})]})]})}const cc=600,lc=600,gw="AUTHORIZATION_SUCCEEDED",yw="AUTHORIZATION_FAILED";function vw(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-cc)/2,i=window.screenY+(window.outerHeight-lc)/2.5,s=`width=${cc},height=${lc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function ww(e,t,n,r){const o=Le();return w.useCallback(i=>{var s,a;if(i.origin===Bl){if(i.data.eventType===gw){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===yw&&(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 bw({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=w.useState(null),[u,d]=w.useState(null),g=Le(),m=w.useRef(null),b=ww(f,u,r,i),y=vw(n,d,b,t);w.useEffect(()=>{t&&!u&&!c&&!o&&!s&&(r==null||r(null),y())},[t,u,y,c,o,s,r]);const p=w.useCallback(()=>{g.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,g]);return w.useEffect(()=>{if(u)return m.current=setInterval(()=>{u!=null&&u.closed&&(m.current&&clearInterval(m.current),m.current=null,p())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",b)}},[p,u,b]),l.jsx("div",{children:e})}const Iw=()=>{const e=it(),t=Le();return vn({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 Cw({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs("div",{style:{padding:"1rem 0"},children:[l.jsx("p",{children:`Re-authenticate to ${r}`}),l.jsx(bn,{error:t}),l.jsx(Qe,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function xw({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Xt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=Iw(),[f,u]=w.useState(null),[d,g]=w.useState(!1),[m,b]=w.useState(null),y=()=>{g(!1)},p=()=>{g(!0),u(null),b(null)},C=(c==null?void 0:c.message)||f||null,h=async()=>{y(),u(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});b(I)}catch(I){Ue(I,u)}},v=w.useCallback(I=>{u(I)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),d&&l.jsx(Io,{children:"Connection updated successfully"}),l.jsx(bw,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:v,error:C,isSuccessConnect:d,onSuccessConnect:p,children:l.jsx(Cw,{handleSubmit:h,error:C,providerName:i,isButtonDisabled:a||n||d})})]})}function Xs({provider:e}){var r;const{data:t}=bo(e);if((t==null?void 0:t.authType)===ec.Basic)return l.jsx(pw,{provider:e});if((t==null?void 0:t.authType)===ec.ApiKey)return l.jsx(uw,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Vo.AuthorizationCode||n===Vo.AuthorizationCodePkce)return l.jsx(xw,{provider:e});if(n===Vo.ClientCredentials)return l.jsx(mw,{provider:e})}return null}const Ow=()=>{const e=it(),t=Le();return vn({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function Ou({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ne(),{selectedConnection:a}=Xt(),c=Ow(),[f,u]=w.useState(!1),d=!s||!a||!a.id||f,g=async()=>{d||(u(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:y=>{Ue(y,i)},onSettled:()=>u(!1)}))},m=f?"Disconnecting...":e;return l.jsx(Qe,{type:"button",onClick:g,disabled:d,variant:t,style:n,children:m})}const _u=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Yr=()=>{const e=w.useContext(_u);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},_w=()=>{var f;const e=Le(),t=it(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{projectIdOrName:o}=Ne(),{integrationId:i,integrationObj:s}=ot(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return w.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Jn({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 Sw({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=ot(),{isError:o,removeError:i,setError:s}=Dt(),a=(r==null?void 0:r.name)||n,[c,f]=w.useState(null),[u,d]=w.useState(null),{data:g,isLoading:m,isError:b,error:y}=_w();w.useEffect(()=>{b?(s(ue.HYDRATED_REVISION,a),Ue(y,f)):(i(ue.HYDRATED_REVISION,a),f(null),d(null))},[b,a,s,i,y,f]);const p=w.useMemo(()=>{var h,v,I;return{hydratedRevision:g||null,loading:m,readAction:(h=g==null?void 0:g.content)==null?void 0:h.read,writeObjects:((I=(v=g==null?void 0:g.content)==null?void 0:v.write)==null?void 0:I.objects)||[]}},[g,m]);if(m)return l.jsx(Xr,{});const C=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",v=`${c?`: ${c}`:`Error retrieving objects from ${C} or integration details for ${h}`}`;return l.jsx(Wt,{message:v,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[l.jsx(Xs,{provider:C}),l.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),u&&l.jsx(Xl,{message:u}),l.jsx(Ou,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>d(I)})]})})}return l.jsx(_u.Provider,{value:p,children:e})}function gn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}function bs(e,t){return bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bs(e,t)}function Ew(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bs(e,t)}var Is={exports:{}},Bi={exports:{}},Ce={};/** @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})()})(vu);var Uv=vu.exports;const Pt=zs(Uv),Vv="_button_kwfiu_1",$v="_buttonError_kwfiu_28",Hv="_danger_kwfiu_42",Bv="_ghost_kwfiu_47",$o={button:Vv,buttonError:$v,danger:Hv,ghost:Bv};function Qe({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Pt($o.button,{[$o.danger]:o==="danger",[$o.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Jv={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 Ci({children:e,style:t}){return l.jsx(wn,{style:{...Jv,...t},children:e})}const bo=e=>{const t=it(),{provider:n}=ot(),r=e||n;return Jn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},lt=e=>{const t=bo(e),{data:n}=t,{provider:r}=ot(),o=n&&yv(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function bn({error:e}){return e?l.jsx(Ci,{style:{marginTop:"2em"},children:e}):null}const Wv="_input_1ymb7_1",zv="_inputError_1ymb7_27",Qv="_error_1ymb7_43",Ho={input:Wv,inputError:zv,error:Qv};function Gv({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Pt(Ho.inputError,Ho.input):Ho.input;return l.jsx("input",{id:e,type:t,className:Pt(i,n),...o})}const Xv="_textarea_18zl4_1",Yv="_textareaError_18zl4_14",Zv="_error_18zl4_29",Bo={textarea:Xv,textareaError:Yv,error:Zv};function ew({className:e,isError:t=!1,...n}){const r=t?Pt(Bo.textareaError,Bo.textarea):Bo.textarea;return l.jsx("textarea",{className:Pt(e,r),...n})}const Jt={Input:Gv,Textarea:ew},tw=()=>{const{project:e}=Ne(),t=e==null?void 0:e.id,n=it();return Jn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function wu(){var n,r;const{data:e}=tw();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function vr({children:e}){return l.jsx(Qr,{children:l.jsxs(wn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(wu,{})]})})}function wr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function nw({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const rw="_link_oo2kv_1",iw={link:rw};function bu({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Pt(iw.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function so({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(bu,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Qs(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 di(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Iu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var I,O;const[s,a]=w.useState(!1),c=()=>a(S=>!S),[f,u]=w.useState({apiKey:""}),d=((I=t.metadata)==null?void 0:I.input)||[],g=S=>{const{name:N,value:T}=S.currentTarget;u(A=>({...A,[N]:T.trim()}))},{apiKey:m}=f,{providerName:b}=lt(e),y=m.length>0,p=di(d,f),C=r||!y||!p,h=(O=t.apiKeyOpts)==null?void 0:O.docsURL,v=()=>{const S=Qs(d,f);n({apiKey:m,providerMetadata:S})};return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[h&&l.jsx(so,{url:h,providerDisplayName:b||Vn(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"apiKey",name:"apiKey",type:s?"text":"password",placeholder:"API Key",onChange:g}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:s?"Hide":"Show"})]}),d.map(S=>l.jsxs("div",{children:[S.docsURL&&l.jsx(so,{url:S.docsURL,providerDisplayName:b||Vn(e),credentialName:S.displayName||S.name}),l.jsx(Jt.Input,{id:S.name,name:S.name,type:"text",placeholder:S.displayName||S.name,onChange:g})]},S.name)),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:C,type:i||"submit",onClick:v,variant:o,children:"Next"})]})}function ow({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(bn,{error:r}),l.jsx(Iu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function sw({...e}){return l.jsx(ow,{...e})}const aw={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 Io({children:e,style:t}){return l.jsx(wn,{style:{...aw,...t},children:e})}const Gs=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},cw="_divider_1kmoj_1",ac={divider:cw};function Co({className:e,style:t}){return l.jsx("hr",{className:e?`${ac.divider} ${e}`:ac.divider,style:t})}function _t({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function lw({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>g(!1),b=()=>{g(!0),u(null)},y=(c==null?void 0:c.message)||f||null,p=async C=>{m(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:C.apiKey}}},{onError:h=>{console.error("Update connection error:",h),Ue(h,u)},onSuccess:()=>{b()}})}catch(h){console.error("Update connection caught error:",h),Ue(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} API Key`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),y&&l.jsx(Ci,{children:`Error updating connection ${y}`}),l.jsx(Iu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Cu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var v,I;const[i,s]=w.useState(!1),a=()=>s(O=>!O),[c,f]=w.useState({username:"",password:""}),u=((v=t.metadata)==null?void 0:v.input)||[],{username:d,password:g}=c,{providerName:m}=lt(e),b=O=>{const{name:S,value:N}=O.currentTarget;f(T=>({...T,[S]:N.trim()}))},y=di(u,c),p=r||!y,C=()=>{const O=Qs(u,c);n({user:d,pass:g,providerMetadata:O})},h=(I=t.basicOpts)==null?void 0:I.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[h&&l.jsx(so,{url:h,providerDisplayName:m||Vn(e),credentialName:"credentials"}),l.jsx(Jt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),u.map(O=>l.jsxs("div",{children:[O.docsURL&&l.jsx(so,{url:O.docsURL,providerDisplayName:m||Vn(e),credentialName:O.displayName||O.name}),l.jsx(Jt.Input,{id:O.name,name:O.name,type:"text",placeholder:O.displayName||O.name,onChange:b})]},O.name)),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:C,variant:o,children:"Next"})]})}function uw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(bn,{error:r}),l.jsx(Cu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function dw({...e}){return l.jsx(uw,{...e})}function fw({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>g(!1),b=()=>{g(!0),u(null)},y=(c==null?void 0:c.message)||f||null,p=async C=>{m(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:C.user,password:C.pass}}}},{onError:h=>{console.error(h),Ue(h,u)},onSuccess:()=>{b()}})}catch(h){console.error(h),Ue(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} credentials`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),y&&l.jsx(Ci,{children:`Error updating connection: ${y}`}),l.jsx(Cu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function xu({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var N;const[i,s]=w.useState(!1),[a,c]=w.useState({clientSecret:"",clientId:"",scopes:""}),[f,u]=w.useState(null),{data:d}=bo(e),g=((N=d==null?void 0:d.metadata)==null?void 0:N.input)||[],m=()=>s(T=>!T),b=T=>{const{name:A,value:D}=T.currentTarget;c(J=>({...J,[A]:D.trim()})),u(null)},{clientSecret:y,clientId:p,scopes:C}=a,h=y.length>0,v=p.length>0,I=di(g,a),O=n||!h||!v||!I,S=()=>{const T=Qs(g,a),A={clientId:p,clientSecret:y,providerMetadata:T};r&&C.length>0&&(A.scopes=vv(C)),t(A)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[l.jsx(Jt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:b}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Jt.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:b}),l.jsx(Qe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:m,variant:o,children:i?"Hide":"Show"})]}),r&&l.jsx(Jt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:b}),g.map(T=>l.jsx(Jt.Input,{id:T.name,name:T.name,type:"text",placeholder:T.displayName||T.name,onChange:b},T.name))]}),l.jsx(bn,{error:f}),l.jsx("br",{}),l.jsx(Qe,{style:{width:"100%"},disabled:O,type:"button",onClick:S,variant:o,children:"Next"})]})}function pw({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${o} integration`}),l.jsx(bn,{error:n}),l.jsx("br",{}),l.jsx(xu,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function hw({provider:e}){var h;const{projectIdOrName:t}=Ne(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{providerName:o,data:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=Gs(),[f,u]=w.useState(null),[d,g]=w.useState(!1),m=()=>{g(!1)},b=()=>{g(!0),u(null)},y=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,p=(c==null?void 0:c.message)||f||null,C=async v=>{m(),u(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}}}}),b()}catch(I){Ue(I,u)}};return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Re-authenticate to ${o}`}),d&&l.jsx(Io,{children:"Connection updated successfully"}),p&&l.jsx(Ci,{children:`Error updating connection ${p}`}),l.jsx(xu,{provider:o||"",handleSubmit:C,isButtonDisabled:a||r,explicitScopesRequired:y,buttonVariant:"ghost"})]})]})}const cc=600,lc=600,mw="AUTHORIZATION_SUCCEEDED",gw="AUTHORIZATION_FAILED";function yw(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-cc)/2,i=window.screenY+(window.outerHeight-lc)/2.5,s=`width=${cc},height=${lc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function vw(e,t,n,r){const o=Le();return w.useCallback(i=>{var s,a;if(i.origin===Bl){if(i.data.eventType===mw){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===gw&&(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 ww({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=w.useState(null),[u,d]=w.useState(null),g=Le(),m=w.useRef(null),b=vw(f,u,r,i),y=yw(n,d,b,t);w.useEffect(()=>{t&&!u&&!c&&!o&&!s&&(r==null||r(null),y())},[t,u,y,c,o,s,r]);const p=w.useCallback(()=>{g.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,g]);return w.useEffect(()=>{if(u)return m.current=setInterval(()=>{u!=null&&u.closed&&(m.current&&clearInterval(m.current),m.current=null,p())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",b)}},[p,u,b]),l.jsx("div",{children:e})}const bw=()=>{const e=it(),t=Le();return vn({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 Iw({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs("div",{style:{padding:"1rem 0"},children:[l.jsx("p",{children:`Re-authenticate to ${r}`}),l.jsx(bn,{error:t}),l.jsx(Qe,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Cw({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Xt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=bw(),[f,u]=w.useState(null),[d,g]=w.useState(!1),[m,b]=w.useState(null),y=()=>{g(!1)},p=()=>{g(!0),u(null),b(null)},C=(c==null?void 0:c.message)||f||null,h=async()=>{y(),u(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});b(I)}catch(I){Ue(I,u)}},v=w.useCallback(I=>{u(I)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Update connection"}),d&&l.jsx(Io,{children:"Connection updated successfully"}),l.jsx(ww,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:v,error:C,isSuccessConnect:d,onSuccessConnect:p,children:l.jsx(Iw,{handleSubmit:h,error:C,providerName:i,isButtonDisabled:a||n||d})})]})}function Xs({provider:e}){var r;const{data:t}=bo(e);if((t==null?void 0:t.authType)===ec.Basic)return l.jsx(fw,{provider:e});if((t==null?void 0:t.authType)===ec.ApiKey)return l.jsx(lw,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Vo.AuthorizationCode||n===Vo.AuthorizationCodePkce)return l.jsx(Cw,{provider:e});if(n===Vo.ClientCredentials)return l.jsx(hw,{provider:e})}return null}const xw=()=>{const e=it(),t=Le();return vn({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function Ou({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ne(),{selectedConnection:a}=Xt(),c=xw(),[f,u]=w.useState(!1),d=!s||!a||!a.id||f,g=async()=>{d||(u(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:y=>{Ue(y,i)},onSettled:()=>u(!1)}))},m=f?"Disconnecting...":e;return l.jsx(Qe,{type:"button",onClick:g,disabled:d,variant:t,style:n,children:m})}const _u=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Xr=()=>{const e=w.useContext(_u);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Ow=()=>{var f;const e=Le(),t=it(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{projectIdOrName:o}=Ne(),{integrationId:i,integrationObj:s}=ot(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return w.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Jn({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 _w({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=ot(),{isError:o,removeError:i,setError:s}=Dt(),a=(r==null?void 0:r.name)||n,[c,f]=w.useState(null),[u,d]=w.useState(null),{data:g,isLoading:m,isError:b,error:y}=Ow();w.useEffect(()=>{b?(s(ue.HYDRATED_REVISION,a),Ue(y,f)):(i(ue.HYDRATED_REVISION,a),f(null),d(null))},[b,a,s,i,y,f]);const p=w.useMemo(()=>{var h,v,I;return{hydratedRevision:g||null,loading:m,readAction:(h=g==null?void 0:g.content)==null?void 0:h.read,writeObjects:((I=(v=g==null?void 0:g.content)==null?void 0:v.write)==null?void 0:I.objects)||[]}},[g,m]);if(m)return l.jsx(Gr,{});const C=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",v=`${c?`: ${c}`:`Error retrieving objects from ${C} or integration details for ${h}`}`;return l.jsx(Wt,{message:v,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[l.jsx(Xs,{provider:C}),l.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),u&&l.jsx(Xl,{message:u}),l.jsx(Ou,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>d(I)})]})})}return l.jsx(_u.Provider,{value:p,children:e})}function gn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}function bs(e,t){return bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bs(e,t)}function Sw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bs(e,t)}var Is={exports:{}},Bi={exports:{}},Ce={};/** @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 uc;function
|
|
17
|
+
*/var uc;function Ew(){if(uc)return Ce;uc=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,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,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function v(O){if(typeof O=="object"&&O!==null){var S=O.$$typeof;switch(S){case t:switch(O=O.type,O){case c:case f:case r:case i:case o:case d:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case b:case m:case s:return O;default:return S}}case n:return S}}}function I(O){return v(O)===f}return Ce.AsyncMode=c,Ce.ConcurrentMode=f,Ce.ContextConsumer=a,Ce.ContextProvider=s,Ce.Element=t,Ce.ForwardRef=u,Ce.Fragment=r,Ce.Lazy=b,Ce.Memo=m,Ce.Portal=n,Ce.Profiler=i,Ce.StrictMode=o,Ce.Suspense=d,Ce.isAsyncMode=function(O){return I(O)||v(O)===c},Ce.isConcurrentMode=I,Ce.isContextConsumer=function(O){return v(O)===a},Ce.isContextProvider=function(O){return v(O)===s},Ce.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Ce.isForwardRef=function(O){return v(O)===u},Ce.isFragment=function(O){return v(O)===r},Ce.isLazy=function(O){return v(O)===b},Ce.isMemo=function(O){return v(O)===m},Ce.isPortal=function(O){return v(O)===n},Ce.isProfiler=function(O){return v(O)===i},Ce.isStrictMode=function(O){return v(O)===o},Ce.isSuspense=function(O){return v(O)===d},Ce.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===f||O===i||O===o||O===d||O===g||typeof O=="object"&&O!==null&&(O.$$typeof===b||O.$$typeof===m||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===p||O.$$typeof===C||O.$$typeof===h||O.$$typeof===y)},Ce.typeOf=v,Ce}var xe={};/** @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 dc;function
|
|
24
|
+
*/var dc;function Nw(){return dc||(dc=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,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function v(j){return typeof j=="string"||typeof j=="function"||j===r||j===f||j===i||j===o||j===d||j===g||typeof j=="object"&&j!==null&&(j.$$typeof===b||j.$$typeof===m||j.$$typeof===s||j.$$typeof===a||j.$$typeof===u||j.$$typeof===p||j.$$typeof===C||j.$$typeof===h||j.$$typeof===y)}function I(j){if(typeof j=="object"&&j!==null){var we=j.$$typeof;switch(we){case t:var z=j.type;switch(z){case c:case f:case r:case i:case o:case d:return z;default:var Ee=z&&z.$$typeof;switch(Ee){case a:case u:case b:case m:case s:return Ee;default:return we}}case n:return we}}}var O=c,S=f,N=a,T=s,A=t,D=u,J=r,K=b,$=m,B=n,ae=i,re=o,ne=d,ge=!1;function be(j){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(j)||I(j)===c}function F(j){return I(j)===f}function L(j){return I(j)===a}function H(j){return I(j)===s}function U(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function q(j){return I(j)===u}function M(j){return I(j)===r}function Z(j){return I(j)===b}function ee(j){return I(j)===m}function W(j){return I(j)===n}function te(j){return I(j)===i}function X(j){return I(j)===o}function de(j){return I(j)===d}xe.AsyncMode=O,xe.ConcurrentMode=S,xe.ContextConsumer=N,xe.ContextProvider=T,xe.Element=A,xe.ForwardRef=D,xe.Fragment=J,xe.Lazy=K,xe.Memo=$,xe.Portal=B,xe.Profiler=ae,xe.StrictMode=re,xe.Suspense=ne,xe.isAsyncMode=be,xe.isConcurrentMode=F,xe.isContextConsumer=L,xe.isContextProvider=H,xe.isElement=U,xe.isForwardRef=q,xe.isFragment=M,xe.isLazy=Z,xe.isMemo=ee,xe.isPortal=W,xe.isProfiler=te,xe.isStrictMode=X,xe.isSuspense=de,xe.isValidElementType=v,xe.typeOf=I}()),xe}var fc;function Su(){return fc||(fc=1,process.env.NODE_ENV==="production"?Bi.exports=Ew():Bi.exports=Nw()),Bi.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var Jo,pc;function
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,q,M,Z+"."+X,n);if(j)return j}return null}return p(L)}function B(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(B);if(F===null||a(F))return!0;var L=d(F);if(L){var H=L.call(F),U;if(L!==F.entries){for(;!(U=H.next()).done;)if(!B(U.value))return!1}else for(;!(U=H.next()).done;){var q=U.value;if(q&&!B(q[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,L){return F==="symbol"?!0:L?L["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&L instanceof Symbol:!1}function re(F){var L=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(L,F)?"symbol":L}function ne(F){if(typeof F>"u"||F===null)return""+F;var L=re(F);if(L==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return L}function ge(F){var L=ne(F);switch(L){case"array":case"object":return"an "+L;case"boolean":case"date":case"regexp":return"a "+L;default:return L}}function be(F){return!F.constructor||!F.constructor.name?g:F.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Go}var Xo,vc;function
|
|
28
|
+
*/var Jo,pc;function Tw(){if(pc)return Jo;pc=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(u){return s[u]});if(c.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(u){f[u]=u}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Jo=o()?Object.assign:function(i,s){for(var a,c=r(i),f,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)t.call(a,d)&&(c[d]=a[d]);if(e){f=e(a);for(var g=0;g<f.length;g++)n.call(a,f[g])&&(c[f[g]]=a[f[g]])}}return c},Jo}var Wo,hc;function Ys(){if(hc)return Wo;hc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Wo=e,Wo}var zo,mc;function Eu(){return mc||(mc=1,zo=Function.call.bind(Object.prototype.hasOwnProperty)),zo}var Qo,gc;function Rw(){if(gc)return Qo;gc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ys(),n={},r=Eu();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 u in i)if(r(i,u)){var d;try{if(typeof i[u]!="function"){var g=Error((c||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[u](s,u,c,a,null,t)}catch(b){d=b}if(d&&!(d instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+u+"` 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={})},Qo=o,Qo}var Go,yc;function Aw(){if(yc)return Go;yc=1;var e=Su(),t=Tw(),n=Ys(),r=Eu(),o=Rw(),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 Go=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(F){var L=F&&(f&&F[f]||F[u]);if(typeof L=="function")return L}var g="<<anonymous>>",m={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:h(),arrayOf:v,element:I(),elementType:O(),instanceOf:S,node:D(),objectOf:T,oneOf:N,oneOfType:A,shape:K,exact:$};function b(F,L){return F===L?F!==0||1/F===1/L:F!==F&&L!==L}function y(F,L){this.message=F,this.data=L&&typeof L=="object"?L:{},this.stack=""}y.prototype=Error.prototype;function p(F){if(process.env.NODE_ENV!=="production")var L={},H=0;function U(M,Z,ee,W,te,X,de){if(W=W||g,X=X||ee,de!==n){if(c){var j=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 j.name="Invariant Violation",j}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var we=W+":"+ee;!L[we]&&H<3&&(i("You are manually calling a React.PropTypes validation function for the `"+X+"` prop on `"+W+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),L[we]=!0,H++)}}return Z[ee]==null?M?Z[ee]===null?new y("The "+te+" `"+X+"` is marked as required "+("in `"+W+"`, but its value is `null`.")):new y("The "+te+" `"+X+"` is marked as required in "+("`"+W+"`, but its value is `undefined`.")):null:F(Z,ee,W,te,X)}var q=U.bind(null,!1);return q.isRequired=U.bind(null,!0),q}function C(F){function L(H,U,q,M,Z,ee){var W=H[U],te=re(W);if(te!==F){var X=ne(W);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+X+"` supplied to `"+q+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return p(L)}function h(){return p(s)}function v(F){function L(H,U,q,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var ee=H[U];if(!Array.isArray(ee)){var W=re(ee);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+q+"`, expected an array."))}for(var te=0;te<ee.length;te++){var X=F(ee,te,q,M,Z+"["+te+"]",n);if(X instanceof Error)return X}return null}return p(L)}function I(){function F(L,H,U,q,M){var Z=L[H];if(!a(Z)){var ee=re(Z);return new y("Invalid "+q+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return p(F)}function O(){function F(L,H,U,q,M){var Z=L[H];if(!e.isValidElementType(Z)){var ee=re(Z);return new y("Invalid "+q+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return p(F)}function S(F){function L(H,U,q,M,Z){if(!(H[U]instanceof F)){var ee=F.name||g,W=be(H[U]);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+q+"`, expected ")+("instance of `"+ee+"`."))}return null}return p(L)}function N(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function L(H,U,q,M,Z){for(var ee=H[U],W=0;W<F.length;W++)if(b(ee,F[W]))return null;var te=JSON.stringify(F,function(de,j){var we=ne(j);return we==="symbol"?String(j):j});return new y("Invalid "+M+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+q+"`, expected one of "+te+"."))}return p(L)}function T(F){function L(H,U,q,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+q+"`, expected an object."));for(var te in ee)if(r(ee,te)){var X=F(ee,te,q,M,Z+"."+te,n);if(X instanceof Error)return X}return null}return p(L)}function A(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var L=0;L<F.length;L++){var H=F[L];if(typeof H!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(H)+" at index "+L+"."),s}function U(q,M,Z,ee,W){for(var te=[],X=0;X<F.length;X++){var de=F[X],j=de(q,M,Z,ee,W,n);if(j==null)return null;j.data&&r(j.data,"expectedType")&&te.push(j.data.expectedType)}var we=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new y("Invalid "+ee+" `"+W+"` supplied to "+("`"+Z+"`"+we+"."))}return p(U)}function D(){function F(L,H,U,q,M){return B(L[H])?null:new y("Invalid "+q+" `"+M+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return p(F)}function J(F,L,H,U,q){return new y((F||"React class")+": "+L+" type `"+H+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function K(F){function L(H,U,q,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+q+"`, expected `object`."));for(var te in F){var X=F[te];if(typeof X!="function")return J(q,M,Z,te,ne(X));var de=X(ee,te,q,M,Z+"."+te,n);if(de)return de}return null}return p(L)}function $(F){function L(H,U,q,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+q+"`, expected `object`."));var te=t({},H[U],F);for(var X in te){var de=F[X];if(r(F,X)&&typeof de!="function")return J(q,M,Z,X,ne(de));if(!de)return new y("Invalid "+M+" `"+Z+"` key `"+X+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(H[U],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,q,M,Z+"."+X,n);if(j)return j}return null}return p(L)}function B(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(B);if(F===null||a(F))return!0;var L=d(F);if(L){var H=L.call(F),U;if(L!==F.entries){for(;!(U=H.next()).done;)if(!B(U.value))return!1}else for(;!(U=H.next()).done;){var q=U.value;if(q&&!B(q[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,L){return F==="symbol"?!0:L?L["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&L instanceof Symbol:!1}function re(F){var L=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(L,F)?"symbol":L}function ne(F){if(typeof F>"u"||F===null)return""+F;var L=re(F);if(L==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return L}function ge(F){var L=ne(F);switch(L){case"array":case"object":return"an "+L;case"boolean":case"date":case"regexp":return"a "+L;default:return L}}function be(F){return!F.constructor||!F.constructor.name?g:F.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Go}var Xo,vc;function Fw(){if(vc)return Xo;vc=1;var e=Ys();function t(){}function n(){}return n.resetWarningCache=t,Xo=function(){function r(s,a,c,f,u,d){if(d!==e){var g=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 g.name="Invariant Violation",g}}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},Xo}if(process.env.NODE_ENV!=="production"){var Pw=Su(),Dw=!0;Is.exports=Aw()(Pw.isElement,Dw)}else Is.exports=Fw()();var Mw=Is.exports;const V=zs(Mw);var Cs={exports:{}},Oe={};/**
|
|
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 j=de(ee,X,q,M,Z+"."+
|
|
|
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 wc;function
|
|
37
|
+
*/var wc;function kw(){if(wc)return Oe;wc=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"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function y(p){if(typeof p=="object"&&p!==null){var C=p.$$typeof;switch(C){case e:switch(p=p.type,p){case n:case o:case r:case f:case u:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case g:case d:case i:return p;default:return C}}case t:return C}}}return Oe.ContextConsumer=s,Oe.ContextProvider=i,Oe.Element=e,Oe.ForwardRef=c,Oe.Fragment=n,Oe.Lazy=g,Oe.Memo=d,Oe.Portal=t,Oe.Profiler=o,Oe.StrictMode=r,Oe.Suspense=f,Oe.SuspenseList=u,Oe.isAsyncMode=function(){return!1},Oe.isConcurrentMode=function(){return!1},Oe.isContextConsumer=function(p){return y(p)===s},Oe.isContextProvider=function(p){return y(p)===i},Oe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},Oe.isForwardRef=function(p){return y(p)===c},Oe.isFragment=function(p){return y(p)===n},Oe.isLazy=function(p){return y(p)===g},Oe.isMemo=function(p){return y(p)===d},Oe.isPortal=function(p){return y(p)===t},Oe.isProfiler=function(p){return y(p)===o},Oe.isStrictMode=function(p){return y(p)===r},Oe.isSuspense=function(p){return y(p)===f},Oe.isSuspenseList=function(p){return y(p)===u},Oe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===f||p===u||p===m||typeof p=="object"&&p!==null&&(p.$$typeof===g||p.$$typeof===d||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===b||p.getModuleId!==void 0)},Oe.typeOf=y,Oe}var _e={};/**
|
|
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 j=de(ee,X,q,M,Z+"."+
|
|
|
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 bc;function Lw(){return bc||(bc=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"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=!1,y=!1,p=!1,C=!1,h=!1,v;v=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||h||z===r||z===f||z===u||C||z===m||b||y||p||typeof z=="object"&&z!==null&&(z.$$typeof===g||z.$$typeof===d||z.$$typeof===i||z.$$typeof===s||z.$$typeof===c||z.$$typeof===v||z.getModuleId!==void 0))}function O(z){if(typeof z=="object"&&z!==null){var Ee=z.$$typeof;switch(Ee){case e:var Ve=z.type;switch(Ve){case n:case o:case r:case f:case u:return Ve;default:var Ze=Ve&&Ve.$$typeof;switch(Ze){case a:case s:case c:case g:case d:case i:return Ze;default:return Ee}}case t:return Ee}}}var S=s,N=i,T=e,A=c,D=n,J=g,K=d,$=t,B=o,ae=r,re=f,ne=u,ge=!1,be=!1;function F(z){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return O(z)===s}function U(z){return O(z)===i}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function M(z){return O(z)===c}function Z(z){return O(z)===n}function ee(z){return O(z)===g}function W(z){return O(z)===d}function te(z){return O(z)===t}function X(z){return O(z)===o}function de(z){return O(z)===r}function j(z){return O(z)===f}function we(z){return O(z)===u}_e.ContextConsumer=S,_e.ContextProvider=N,_e.Element=T,_e.ForwardRef=A,_e.Fragment=D,_e.Lazy=J,_e.Memo=K,_e.Portal=$,_e.Profiler=B,_e.StrictMode=ae,_e.Suspense=re,_e.SuspenseList=ne,_e.isAsyncMode=F,_e.isConcurrentMode=L,_e.isContextConsumer=H,_e.isContextProvider=U,_e.isElement=q,_e.isForwardRef=M,_e.isFragment=Z,_e.isLazy=ee,_e.isMemo=W,_e.isPortal=te,_e.isProfiler=X,_e.isStrictMode=de,_e.isSuspense=j,_e.isSuspenseList=we,_e.isValidElementType=I,_e.typeOf=O}()),_e}process.env.NODE_ENV==="production"?Cs.exports=jw():Cs.exports=Lw();var Ic=Cs.exports;const Cc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,xc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Yo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xc(n.overflowY,t)||xc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},Ji=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,qw=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Kw=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:f,skipOverflowHiddenElements:u}=t,d=typeof f=="function"?f:re=>re!==f;if(!Cc(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,m=[];let b=e;for(;Cc(b)&&d(b);){if(b=qw(b),b===g){m.push(b);break}b!=null&&b===document.body&&Yo(b)&&!Yo(document.documentElement)||b!=null&&Yo(b,u)&&m.push(b)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:C,scrollY:h}=window,{height:v,width:I,top:O,right:S,bottom:N,left:T}=e.getBoundingClientRect(),{top:A,right:D,bottom:J,left:K}=(re=>{const ne=window.getComputedStyle(re);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let $=a==="start"||a==="nearest"?O-A:a==="end"?N+J:O+v/2-A+J,B=c==="center"?T+I/2-K+D:c==="end"?S+D:T-K;const ae=[];for(let re=0;re<m.length;re++){const ne=m[re],{height:ge,width:be,top:F,right:L,bottom:H,left:U}=ne.getBoundingClientRect();if(s==="if-needed"&&O>=0&&T>=0&&N<=p&&S<=y&&O>=F&&N<=H&&T>=U&&S<=L)return ae;const q=getComputedStyle(ne),M=parseInt(q.borderLeftWidth,10),Z=parseInt(q.borderTopWidth,10),ee=parseInt(q.borderRightWidth,10),W=parseInt(q.borderBottomWidth,10);let te=0,X=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-M-ee:0,j="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-W:0,we="offsetWidth"in ne?ne.offsetWidth===0?0:be/ne.offsetWidth:0,z="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(g===ne)te=a==="start"?$:a==="end"?$-p:a==="nearest"?Ji(h,h+p,p,Z,W,h+$,h+$+v,v):$-p/2,X=c==="start"?B:c==="center"?B-y/2:c==="end"?B-y:Ji(C,C+y,y,M,ee,C+B,C+B+I,I),te=Math.max(0,te+h),X=Math.max(0,X+C);else{te=a==="start"?$-F-Z:a==="end"?$-H+W+j:a==="nearest"?Ji(F,H,ge,Z,W+j,$,$+v,v):$-(F+ge/2)+j/2,X=c==="start"?B-U-M:c==="center"?B-(U+be/2)+de/2:c==="end"?B-L+ee+de:Ji(U,L,be,M,ee+de,B,B+I,I);const{scrollLeft:Ee,scrollTop:Ve}=ne;te=z===0?0:Math.max(0,Math.min(Ve+te/z,ne.scrollHeight-ge/z+j)),X=we===0?0:Math.max(0,Math.min(Ee+X/we,ne.scrollWidth-be/we+de)),$+=Ve-te,B+=Ee-X}ae.push({el:ne,top:te,left:X})}return ae};var qr=function(){return qr=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},qr.apply(this,arguments)};var Uw=0;function Oc(e){return typeof e=="function"?e:xt}function xt(){}function Nu(e,t){if(e){var n=Kw(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function _c(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Zs(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 xr(){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 Tu(){return String(Uw++)}function Vw(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 Sc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Ru(e){return typeof e.type=="string"}function Au(e){return e.props}function $w(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Hw=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Wi(e){e===void 0&&(e={});var t={};return Hw.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function ao(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=co(t,r)?t[r]:e[r],n},{})}function co(e,t){return e[t]!==void 0}function xs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Bw(e){return Object.prototype.toString.call(e)==="[object Object]"}function er(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=Kr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Kr(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?Kr(t?i-1:0,t,n,r):-1}function lo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(_c(o,e,n)||r&&_c(o,n.document.activeElement,n))})}var ea=xt;process.env.NODE_ENV!=="production"&&(ea=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 Jw=Zs(function(e){Fu(e).textContent=""},500);function Fu(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 Pu(e,t){if(!(!e||!t)){var n=Fu(t);n.textContent=e,Jw(t)}}function Ww(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Du=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Mu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ku=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Yi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,ju=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,qu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Uu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Vu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,$u=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Hu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Os=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Bu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ju=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Wu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,zw=Object.freeze({__proto__:null,blurButton:Bu,blurInput:Vu,changeInput:$u,clickButton:Os,clickItem:Uu,controlledPropUpdatedSelectedItem:Ju,itemMouseEnter:ku,keyDownArrowDown:Zi,keyDownArrowUp:Yi,keyDownEnd:Ku,keyDownEnter:Lu,keyDownEscape:ju,keyDownHome:qu,keyDownSpaceButton:Hu,mouseUp:Mu,touchEnd:Wu,unknown:Du}),Qw=["refKey","ref"],Gw=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Xw=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Yw=["refKey","ref"],Zw=["onMouseMove","onMouseDown","onClick","onPress","index","item"],eb=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Tu(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,v){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(O){return O!==I}),h()},v);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,v){var I=i.getItemNodeFromIndex(v);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,v){h===void 0&&(h=i.props.defaultHighlightedIndex),v===void 0&&(v={}),v=Wi(v),i.internalSetState(he({highlightedIndex:h},v))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,v,I){v=Wi(v),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},v),I)},i.selectItemAtIndex=function(h,v,I){var O=i.items[h];O!=null&&i.selectItem(O,v,I)},i.selectHighlightedItem=function(h,v){return i.selectItemAtIndex(i.getState().highlightedIndex,h,v)},i.internalSetState=function(h,v){var I,O,S={},N=typeof h=="function";return!N&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,he({},i.getStateAndHelpers(),h)),i.setState(function(T){var A;T=i.getState(T);var D=N?h(T):h;D=i.props.stateReducer(T,D),I=D.hasOwnProperty("selectedItem");var J={};return I&&D.selectedItem!==T.selectedItem&&(O=D.selectedItem),(A=D).type||(A.type=Du),Object.keys(D).forEach(function(K){T[K]!==D[K]&&(S[K]=D[K]),K!=="type"&&(D[K],co(i.props,K)||(J[K]=D[K]))}),N&&D.hasOwnProperty("inputValue")&&i.props.onInputValueChange(D.inputValue,he({},i.getStateAndHelpers(),D)),J},function(){Oc(v)();var T=Object.keys(S).length>1;T&&i.props.onStateChange(S,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),O!==void 0&&i.props.onChange(O,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,v){var I,O=h===void 0?{}:h,S=O.refKey,N=S===void 0?"ref":S,T=O.ref,A=gn(O,Qw),D=v===void 0?{}:v,J=D.suppressRefError,K=J===void 0?!1:J;i.getRootProps.called=!0,i.getRootProps.refKey=N,i.getRootProps.suppressRefError=K;var $=i.getState(),B=$.isOpen;return he((I={},I[N]=xr(T,i.rootRef),I.role="combobox",I["aria-expanded"]=B,I["aria-haspopup"]="listbox",I["aria-owns"]=B?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),A)},i.keyDownHandlers={ArrowDown:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?5:1;this.moveHighlightedIndex(O,{type:Zi})}else this.internalSetState({isOpen:!0,type:Zi},function(){var S=I.getItemCount();if(S>0){var N=I.getState(),T=N.highlightedIndex,A=er(T,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:Zi})}})},ArrowUp:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:Yi})}else this.internalSetState({isOpen:!0,type:Yi},function(){var S=I.getItemCount();if(S>0){var N=I.getState(),T=N.highlightedIndex,A=er(T,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:Yi})}})},Enter:function(v){if(v.which!==229){var I=this.getState(),O=I.isOpen,S=I.highlightedIndex;if(O&&S!=null){v.preventDefault();var N=this.items[S],T=this.getItemNodeFromIndex(S);if(N==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Lu})}}},Escape:function(v){v.preventDefault(),this.reset(he({type:ju},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(v){v.preventDefault(),this.toggleMenu({type:Hu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var N=Kr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(N,{type:qu})}}},End:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var N=Kr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(N,{type:Ku})}}}}),i.getToggleButtonProps=function(h){var v=h===void 0?{}:h,I=v.onClick;v.onPress;var O=v.onKeyDown,S=v.onKeyUp,N=v.onBlur,T=gn(v,Gw),A=i.getState(),D=A.isOpen,J={onClick:We(I,i.buttonHandleClick),onKeyDown:We(O,i.buttonHandleKeyDown),onKeyUp:We(S,i.buttonHandleKeyUp),onBlur:We(N,i.buttonHandleBlur)},K=T.disabled?{}:J;return he({type:"button",role:"button","aria-label":D?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,T)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var v=xs(h);i.buttonKeyDownHandlers[v]&&i.buttonKeyDownHandlers[v].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var v=i.props.environment.document,I=v.body,O=v.activeElement;I&&I===O&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Os}):i.internalSetTimeout(function(){return i.toggleMenu({type:Os})})},i.buttonHandleBlur=function(h){var v=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==v&&i.reset({type:Bu})}})},i.getLabelProps=function(h){return he({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var v=h===void 0?{}:h,I=v.onKeyDown,O=v.onBlur,S=v.onChange,N=v.onInput;v.onChangeText;var T=gn(v,Xw),A,D={};A="onChange";var J=i.getState(),K=J.inputValue,$=J.isOpen,B=J.highlightedIndex;if(!T.disabled){var ae;D=(ae={},ae[A]=We(S,N,i.inputHandleChange),ae.onKeyDown=We(I,i.inputHandleKeyDown),ae.onBlur=We(O,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":$&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":$?i.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:i.labelId,autoComplete:"off",value:K,id:i.inputId},D,T)},i.inputHandleKeyDown=function(h){var v=xs(h);v&&i.inputKeyDownHandlers[v]&&i.inputKeyDownHandlers[v].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:$u,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var v=i.props.environment.document.activeElement,I=(v==null||(h=v.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(v);I||i.reset({type:Vu})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,v){var I,O=h===void 0?{}:h,S=O.refKey,N=S===void 0?"ref":S,T=O.ref,A=gn(O,Yw),D=v===void 0?{}:v,J=D.suppressRefError,K=J===void 0?!1:J;return i.getMenuProps.called=!0,i.getMenuProps.refKey=N,i.getMenuProps.suppressRefError=K,he((I={},I[N]=xr(T,i.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),A)},i.getItemProps=function(h){var v,I=h===void 0?{}:h,O=I.onMouseMove,S=I.onMouseDown,N=I.onClick;I.onPress;var T=I.index,A=I.item,D=A===void 0?process.env.NODE_ENV==="production"?void 0:$w("getItemProps","item"):A,J=gn(I,Zw);T===void 0?(i.items.push(D),T=i.items.indexOf(D)):i.items[T]=D;var K="onClick",$=N,B=(v={onMouseMove:We(O,function(){T!==i.getState().highlightedIndex&&(i.setHighlightedIndex(T,{type:ku}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:We(S,function(re){re.preventDefault()})},v[K]=We($,function(){i.selectItemAtIndex(T,{type:Uu})}),v),ae=J.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(T),role:"option","aria-selected":i.getState().highlightedIndex===T},ae,J)},i.clearItems=function(){i.items=[]},i.reset=function(h,v){h===void 0&&(h={}),h=Wi(h),i.internalSetState(function(I){var O=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(O)},h)},v)},i.toggleMenu=function(h,v){h===void 0&&(h={}),h=Wi(h),i.internalSetState(function(I){var O=I.isOpen;return he({isOpen:!O},O&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),O=I.isOpen,S=I.highlightedIndex;O&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,h),Oc(v)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=Zs(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var v=i.getState(),I=i.items[v.highlightedIndex],O=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:O,highlightedItem:I},v));i.previousResultCount=O,Pu(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,u=s.defaultIsOpen,d=s.initialIsOpen,g=d===void 0?u:d,m=s.initialInputValue,b=m===void 0?"":m,y=s.initialSelectedItem,p=y===void 0?null:y,C=i.getState({highlightedIndex:f,isOpen:g,inputValue:b,selectedItem:p});return C.selectedItem!=null&&i.props.initialInputValue===void 0&&(C.inputValue=i.props.itemToString(C.selectedItem)),i.state=C,i}Ew(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),ao(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 u=er(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,u=this.props.itemToString,d=this.id,g=this.getRootProps,m=this.getToggleButtonProps,b=this.getLabelProps,y=this.getMenuProps,p=this.getInputProps,C=this.getItemProps,h=this.openMenu,v=this.closeMenu,I=this.toggleMenu,O=this.selectItem,S=this.selectItemAtIndex,N=this.selectHighlightedItem,T=this.setHighlightedIndex,A=this.clearSelection,D=this.clearItems,J=this.reset,K=this.setItemCount,$=this.unsetItemCount,B=this.internalSetState;return{getRootProps:g,getToggleButtonProps:m,getLabelProps:b,getMenuProps:y,getInputProps:p,getItemProps:C,reset:J,openMenu:h,closeMenu:v,toggleMenu:I,selectItem:O,selectItemAtIndex:S,selectHighlightedItem:N,setHighlightedIndex:T,clearSelection:A,clearItems:D,setItemCount:K,unsetItemCount:$,setState:B,itemToString:u,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&&Ec(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 b=lo(m.target,[i._rootNode,i._menuNode],i.props.environment);!b&&i.getState().isOpen&&i.reset({type:Mu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},u=function(m){var b=lo(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!b&&i.getState().isOpen&&i.reset({type:Wu},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",u),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",u)}}},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,u=f.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,g=c!==u;return d||g},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(ea(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ec(this._menuNode,this.getMenuProps)),co(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ju,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=Sc(this.props.children,xt);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=Sc(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&&tb(s,this.getRootProps),s;if(Ru(s))return w.cloneElement(s,this.getRootProps(Au(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Vw,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Bw(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:xt,onInputValueChange:xt,onUserAction:xt,onChange:xt,onSelect:xt,onOuterClick:xt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Nu},e.stateChangeTypes=zw,e}();process.env.NODE_ENV!=="production"&&(eb.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function Ec(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 tb(e,t){var n=t.refKey,r=n!=="ref",o=!Ru(e);o&&!r&&!Ic.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+'"'),!Ic.isForwardRef(e)&&!Au(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var zu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function nb(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){rb(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function rb(e,t,n,r){var o=t.props,i=t.type,s="on"+ta(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function ib(e,t){return t.changes}var Nc=Zs(function(e,t){Pu(e,t)},200),ob=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,sb="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var f=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Tu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return f.current};function ab(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 ta(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Qu(e){var t=w.useRef(e);return t.current=e,t}function cb(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(m,b){i.current=b,m=ao(m,b.props);var y=e(m,b),p=b.props.stateReducer(m,he({},b,{changes:y}));return p},[e]),a=w.useReducer(s,t,n),c=a[0],f=a[1],u=Qu(t),d=w.useCallback(function(m){return f(he({props:u.current},m))},[u]),g=i.current;return w.useEffect(function(){var m=ao(o.current,g==null?void 0:g.props),b=g&&o.current&&!r(m,c);b&&nb(g,m,c),o.current=c},[c,g,r]),[c,d]}var si={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:ib,scrollIntoView:Nu,environment:typeof window>"u"?void 0:window};function Kn(e,t,n){n===void 0&&(n=zu);var r=e["default"+ta(t)];return r!==void 0?r:n[t]}function ai(e,t,n){n===void 0&&(n=zu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+ta(t)];return o!==void 0?o:Kn(e,t,n)}function lb(e){var t=ai(e,"selectedItem"),n=ai(e,"isOpen"),r=hb(e),o=ai(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function ci(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(u){return a(c)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function ub(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return xt;var o=n.map(function(u){return u.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,lo(u.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!lo(u.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 Gu=function(){return xt};process.env.NODE_ENV!=="production"&&(Gu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,f=a.refKey,u=a.elementRef;c||u!=null&&u.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=w.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function db(e,t,n,r){r===void 0&&(r={});var o=r.document,i=xo();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);Nc(s,o)}},n),w.useEffect(function(){return function(){Nc.cancel(),Ww(o)}},[o])}function fb(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return ob(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Xu=xt;process.env.NODE_ENV!=="production"&&(Xu=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=xo();w.useEffect(function(){i||(ea(r,o.current,n),o.current=n)},[r,n,i])});function Tc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:Kn(e,"isOpen"),highlightedIndex:Kn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function pb(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function xo(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function _s(e){var t=Kn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function hb(e){var t=ai(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var eo={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},Yu=he({},eo,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function mb(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ci(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ci(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:_s(o),isOpen:Kn(o,"isOpen"),selectedItem:Kn(o,"selectedItem"),inputValue:Kn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}qr(qr({},Yu),{items:V.array.isRequired,isItemDisabled:V.func});qr(qr({},si),{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 na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ra=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ia=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,oa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,sa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,aa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ca=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,la=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ua=process.env.NODE_ENV!=="production"?"__input_change__":8,uo=process.env.NODE_ENV!=="production"?"__input_blur__":9,da=process.env.NODE_ENV!=="production"?"__input_click__":10,Zu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,ed=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,fa=process.env.NODE_ENV!=="production"?"__item_click__":13,td=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,nd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,rd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,id=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,od=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,pa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,sd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ad=process.env.NODE_ENV!=="production"?"__function_reset__":21,ha=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,cd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ha,FunctionCloseMenu:id,FunctionOpenMenu:rd,FunctionReset:ad,FunctionSelectItem:pa,FunctionSetHighlightedIndex:od,FunctionSetInputValue:sd,FunctionToggleMenu:nd,InputBlur:uo,InputChange:ua,InputClick:da,InputKeyDownArrowDown:na,InputKeyDownArrowUp:ra,InputKeyDownEnd:sa,InputKeyDownEnter:la,InputKeyDownEscape:ia,InputKeyDownHome:oa,InputKeyDownPageDown:ca,InputKeyDownPageUp:aa,ItemClick:fa,ItemMouseMove:ed,MenuMouseLeave:Zu,ToggleButtonClick:td});function gb(e){var t=lb(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),he({},t,{inputValue:r})}var yb=he({},Yu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function vb(e,t,n,r){var o=w.useRef(),i=cb(e,t,n,r),s=i[0],a=i[1],c=xo();return w.useEffect(function(){if(co(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:ha,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[ao(s,t),a]}var ld=xt;process.env.NODE_ENV!=="production"&&(ld=function(t,n){V.checkPropTypes(yb,t,"prop",n.name)});var wb=he({},si,{isItemDisabled:function(){return!1}});function bb(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case fa:s={isOpen:Kn(o,"isOpen"),highlightedIndex:_s(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case na:e.isOpen?s={highlightedIndex:er(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ci(o,e,1),isOpen:o.items.length>=0};break;case ra:e.isOpen?i?s=Tc(o,e.highlightedIndex):s={highlightedIndex:er(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ci(o,e,-1),isOpen:o.items.length>=0};break;case la:s=Tc(o,e.highlightedIndex);break;case ia:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case aa:s={highlightedIndex:er(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ca:s={highlightedIndex:er(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case oa:s={highlightedIndex:Kr(0,!1,o.items,o.isItemDisabled)};break;case sa:s={highlightedIndex:Kr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case uo:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case ua:s={isOpen:!0,highlightedIndex:_s(o),inputValue:t.inputValue};break;case da:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ci(o,e,0)};break;case pa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ha:s={inputValue:t.inputValue};break;default:return mb(e,t,cd)}return he({},e,s)}var Ib=["onMouseLeave","refKey","ref"],Cb=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],xb=["onClick","onPress","refKey","ref"],Ob=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ma.stateChangeTypes=cd;function ma(e){e===void 0&&(e={}),ld(e,ma);var t=he({},wb,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=vb(bb,t,gb,pb),a=s[0],c=s[1],f=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,g=a.inputValue,m=w.useRef(null),b=w.useRef({}),y=w.useRef(null),p=w.useRef(null),C=xo(),h=sb(t),v=w.useRef(),I=Qu({state:a,props:t}),O=w.useCallback(function(H){return b.current[h.getItemId(H)]},[h]);db(i,a,[f,u,d,g],o);var S=fb({menuElement:m.current,highlightedIndex:u,isOpen:f,itemRefs:b,scrollIntoView:r,getItemNodeFromIndex:O});Xu({props:t,state:a}),w.useEffect(function(){var H=ai(t,"isOpen");H&&y.current&&y.current.focus()},[]),w.useEffect(function(){C||(v.current=n.length)});var N=ub(o,w.useCallback(function(){I.current.state.isOpen&&c({type:uo,selectItem:!1})},[c,I]),w.useMemo(function(){return[m,p,y]},[m.current,p.current,y.current])),T=Gu("getInputProps","getMenuProps");w.useEffect(function(){f||(b.current={})},[f]),w.useEffect(function(){var H;!f||!(o!=null&&o.document)||!(y!=null&&(H=y.current)!=null&&H.focus)||o.document.activeElement!==y.current&&y.current.focus()},[f,o]);var A=w.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),c({type:na,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),c({type:ra,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:oa}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:sa}))},Escape:function(U){var q=I.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),c({type:ia}))},Enter:function(U){var q=I.current.state;!q.isOpen||U.which===229||(U.preventDefault(),c({type:la}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:aa}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:ca}))}}},[c,I]),D=w.useCallback(function(H){return he({id:h.labelId,htmlFor:h.inputId},H)},[h]),J=w.useCallback(function(H,U){var q,M=H===void 0?{}:H,Z=M.onMouseLeave,ee=M.refKey,W=ee===void 0?"ref":ee,te=M.ref,X=gn(M,Ib),de=U===void 0?{}:U,j=de.suppressRefError,we=j===void 0?!1:j;return T("getMenuProps",we,W,m),he((q={},q[W]=xr(te,function(z){m.current=z}),q.id=h.menuId,q.role="listbox",q["aria-labelledby"]=X&&X["aria-label"]?void 0:""+h.labelId,q.onMouseLeave=We(Z,function(){c({type:Zu})}),q),X)},[c,T,h]),K=w.useCallback(function(H){var U,q,M=H===void 0?{}:H,Z=M.item,ee=M.index,W=M.refKey,te=W===void 0?"ref":W,X=M.ref,de=M.onMouseMove,j=M.onMouseDown,we=M.onClick;M.onPress;var z=M.disabled,Ee=gn(M,Cb);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=I.current,Ze=Ve.props,$e=Ve.state,Ie=ab(Z,ee,Ze.items,"Pass either item or index to getItemProps!"),Mt=Ie[0],et=Ie[1],bt=Ze.isItemDisabled(Mt,et),kt="onClick",jt=we,tt=function(){N.isTouchEnd||et===$e.highlightedIndex||(S.current=!1,c({type:ed,index:et,disabled:bt}))},Ge=function(){c({type:fa,index:et})},He=function(Lt){return Lt.preventDefault()};return he((U={},U[te]=xr(X,function(Fe){Fe&&(b.current[h.getItemId(et)]=Fe)}),U["aria-disabled"]=bt,U["aria-selected"]=et===$e.highlightedIndex,U.id=h.getItemId(et),U.role="option",U),!bt&&(q={},q[kt]=We(jt,Ge),q),{onMouseMove:We(de,tt),onMouseDown:We(j,He)},Ee)},[c,h,I,N,S]),$=w.useCallback(function(H){var U,q=H===void 0?{}:H,M=q.onClick;q.onPress;var Z=q.refKey,ee=Z===void 0?"ref":Z,W=q.ref,te=gn(q,xb),X=I.current.state,de=function(){c({type:td})};return he((U={},U[ee]=xr(W,function(j){p.current=j}),U["aria-controls"]=h.menuId,U["aria-expanded"]=X.isOpen,U.id=h.toggleButtonId,U.tabIndex=-1,U),!te.disabled&&he({},{onClick:We(M,de)}),te)},[c,I,h]),B=w.useCallback(function(H,U){var q,M=H===void 0?{}:H,Z=M.onKeyDown,ee=M.onChange,W=M.onInput,te=M.onBlur;M.onChangeText;var X=M.onClick,de=M.refKey,j=de===void 0?"ref":de,we=M.ref,z=gn(M,Ob),Ee=U===void 0?{}:U,Ve=Ee.suppressRefError,Ze=Ve===void 0?!1:Ve;T("getInputProps",Ze,j,y);var $e=I.current.state,Ie=function(He){var Fe=xs(He);Fe&&A[Fe]&&A[Fe](He)},Mt=function(He){c({type:ua,inputValue:He.target.value})},et=function(He){if(o!=null&&o.document&&$e.isOpen&&!N.isMouseDown){var Fe=He.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:uo,selectItem:!Fe})}},bt=function(){c({type:da})},kt="onChange",jt={};if(!z.disabled){var tt;jt=(tt={},tt[kt]=We(ee,W,Mt),tt.onKeyDown=We(Z,Ie),tt.onBlur=We(te,et),tt.onClick=We(X,bt),tt)}return he((q={},q[j]=xr(we,function(Ge){y.current=Ge}),q["aria-activedescendant"]=$e.isOpen&&$e.highlightedIndex>-1?h.getItemId($e.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=h.menuId,q["aria-expanded"]=$e.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:h.labelId,q.autoComplete="off",q.id=h.inputId,q.role="combobox",q.value=$e.inputValue,q),jt,z)},[c,h,o,A,I,N,T]),ae=w.useCallback(function(){c({type:nd})},[c]),re=w.useCallback(function(){c({type:id})},[c]),ne=w.useCallback(function(){c({type:rd})},[c]),ge=w.useCallback(function(H){c({type:od,highlightedIndex:H})},[c]),be=w.useCallback(function(H){c({type:pa,selectedItem:H})},[c]),F=w.useCallback(function(H){c({type:sd,inputValue:H})},[c]),L=w.useCallback(function(){c({type:ad})},[c]);return{getItemProps:K,getLabelProps:D,getMenuProps:J,getInputProps:B,getToggleButtonProps:$,toggleMenu:ae,openMenu:ne,closeMenu:re,setHighlightedIndex:ge,setInputValue:F,selectItem:be,reset:L,highlightedIndex:u,isOpen:f,selectedItem:d,inputValue:g}}eo.stateReducer,eo.itemToKey,eo.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;si.itemToKey,si.stateReducer,si.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 _b="_comboboxContainer_1lcc8_1",Sb="_label_1lcc8_8",Eb="_inputContainer_1lcc8_12",Nb="_input_1lcc8_12",Tb="_toggleButton_1lcc8_33",Rb="_menu_1lcc8_39",Ab="_menuBottom_1lcc8_55",Fb="_menuTop_1lcc8_61",Pb="_menuItem_1lcc8_66",Db="_highlighted_1lcc8_73",Mb="_selected_1lcc8_77",kb="_hidden_1lcc8_81",Vt={comboboxContainer:_b,label:Sb,inputContainer:Eb,input:Nb,toggleButton:Tb,menu:Rb,menuBottom:Ab,menuTop:Fb,menuItem:Pb,highlighted:Db,selected:Mb,hidden:kb};function jb(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function ud({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=w.useState(e),f=w.useRef(null);w.useEffect(()=>c(e),[e]);const u=w.useCallback(N=>{(N==null?void 0:N.length)>0?c(e.filter(jb(N))):c(e)},[e]),{isOpen:d,getToggleButtonProps:g,getMenuProps:m,getInputProps:b,highlightedIndex:y,getItemProps:p,setInputValue:C,selectedItem:h}=ma({items:a,selectedItem:t?e.find(N=>N.value===t):null,itemToString:N=>(N==null?void 0:N.label)||"",onInputValueChange:({inputValue:N})=>u(N),onSelectedItemChange:({selectedItem:N})=>{var T;n(N),(T=f.current)==null||T.blur()}}),v=()=>{C(""),c(e)},I=()=>v(),O=w.useMemo(()=>{var N;return(N=e.find(T=>T.value===t))==null?void 0:N.label},[e,t]),S=()=>{t&&O&&t!==(h==null?void 0:h.value)&&C(O||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:Vt.comboboxContainer,children:l.jsxs("div",{className:Vt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Vt.input,...b({onFocus:I,onBlur:S,ref:f})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Vt.toggleButton,type:"button",...g(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${Vt.menu} ${d&&e.length?"":Vt.hidden} ${s==="top"?Vt.menuTop:Vt.menuBottom}`,...m(),children:d&&a.map((N,T)=>l.jsx("li",{className:`${Vt.menuItem} ${y===T?Vt.highlighted:""} ${t===(N==null?void 0:N.value)?Vt.selected:""}`,...p({item:N,index:T}),children:l.jsx("span",{children:N.label})},N.id))})]})}const Ur=Math.min,lr=Math.max,fo=Math.round,zi=Math.floor,Hn=e=>({x:e,y:e}),Lb={left:"right",right:"left",bottom:"top",top:"bottom"},qb={start:"end",end:"start"};function Ss(e,t,n){return lr(e,Ur(t,n))}function xi(e,t){return typeof e=="function"?e(t):e}function hr(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function dd(e){return e==="x"?"y":"x"}function ga(e){return e==="y"?"height":"width"}function Vr(e){return["top","bottom"].includes(hr(e))?"y":"x"}function ya(e){return dd(Vr(e))}function Kb(e,t,n){n===void 0&&(n=!1);const r=Oi(e),o=ya(e),i=ga(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=po(s)),[s,po(s)]}function Ub(e){const t=po(e);return[Es(e),t,Es(t)]}function Es(e){return e.replace(/start|end/g,t=>qb[t])}function Vb(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 $b(e,t,n,r){const o=Oi(e);let i=Vb(hr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Es)))),i}function po(e){return e.replace(/left|right|bottom|top/g,t=>Lb[t])}function Hb(e){return{top:0,right:0,bottom:0,left:0,...e}}function fd(e){return typeof e!="number"?Hb(e):{top:e,right:e,bottom:e,left:e}}function ho(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 Rc(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=ya(t),a=ga(s),c=hr(t),f=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,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(Oi(t)){case"start":m[s]-=g*(n&&f?-1:1);break;case"end":m[s]+=g*(n&&f?-1:1);break}return m}const Bb=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:u,y:d}=Rc(f,r,c),g=r,m={},b=0;for(let y=0;y<a.length;y++){const{name:p,fn:C}=a[y],{x:h,y:v,data:I,reset:O}=await C({x:u,y:d,initialPlacement:r,placement:g,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});u=h??u,d=v??d,m={...m,[p]:{...m[p],...I}},O&&b<=50&&(b++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(f=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:u,y:d}=Rc(f,g,c)),y=-1)}return{x:u,y:d,placement:g,strategy:o,middlewareData:m}};async function pd(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:u="viewport",elementContext:d="floating",altBoundary:g=!1,padding:m=0}=xi(t,e),b=fd(m),p=a[g?d==="floating"?"reference":"floating":d],C=ho(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:u,strategy:c})),h=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},O=ho(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:v,strategy:c}):h);return{top:(C.top-O.top+b.top)/I.y,bottom:(O.bottom-C.bottom+b.bottom)/I.y,left:(C.left-O.left+b.left)/I.x,right:(O.right-C.right+b.right)/I.x}}const Jb=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:u=0}=xi(e,t)||{};if(f==null)return{};const d=fd(u),g={x:n,y:r},m=ya(o),b=ga(m),y=await s.getDimensions(f),p=m==="y",C=p?"top":"left",h=p?"bottom":"right",v=p?"clientHeight":"clientWidth",I=i.reference[b]+i.reference[m]-g[m]-i.floating[b],O=g[m]-i.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let N=S?S[v]:0;(!N||!await(s.isElement==null?void 0:s.isElement(S)))&&(N=a.floating[v]||i.floating[b]);const T=I/2-O/2,A=N/2-y[b]/2-1,D=Ur(d[C],A),J=Ur(d[h],A),K=D,$=N-y[b]-J,B=N/2-y[b]/2+T,ae=Ss(K,B,$),re=!c.arrow&&Oi(o)!=null&&B!==ae&&i.reference[b]/2-(B<K?D:J)-y[b]/2<0,ne=re?B<K?B-K:B-$:0;return{[m]:g[m]+ne,data:{[m]:ae,centerOffset:B-ae-ne,...re&&{alignmentOffset:ne}},reset:re}}}),Wb=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:u=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...p}=xi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=hr(o),h=Vr(a),v=hr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),O=g||(v||!y?[po(a)]:Ub(a)),S=b!=="none";!g&&S&&O.push(...$b(a,y,b,I));const N=[a,...O],T=await pd(t,p),A=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(T[C]),d){const B=Kb(o,s,I);A.push(T[B[0]],T[B[1]])}if(D=[...D,{placement:o,overflows:A}],!A.every(B=>B<=0)){var J,K;const B=(((J=i.flip)==null?void 0:J.index)||0)+1,ae=N[B];if(ae)return{data:{index:B,overflows:D},reset:{placement:ae}};let re=(K=D.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var $;const ne=($=D.filter(ge=>{if(S){const be=Vr(ge.placement);return be===h||be==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(be=>be>0).reduce((be,F)=>be+F,0)]).sort((ge,be)=>ge[1]-be[1])[0])==null?void 0:$[0];ne&&(re=ne);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function zb(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=hr(n),a=Oi(n),c=Vr(n)==="y",f=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,d=xi(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),c?{x:m*u,y:g*f}:{x:g*f,y:m*u}}const Qb=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 zb(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}}}}},Gb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:C,y:h}=p;return{x:C,y:h}}},...c}=xi(e,t),f={x:n,y:r},u=await pd(t,c),d=Vr(hr(o)),g=dd(d);let m=f[g],b=f[d];if(i){const p=g==="y"?"top":"left",C=g==="y"?"bottom":"right",h=m+u[p],v=m-u[C];m=Ss(h,m,v)}if(s){const p=d==="y"?"top":"left",C=d==="y"?"bottom":"right",h=b+u[p],v=b-u[C];b=Ss(h,b,v)}const y=a.fn({...t,[g]:m,[d]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[g]:i,[d]:s}}}}}};function Oo(){return typeof window<"u"}function Zr(e){return hd(e)?(e.nodeName||"").toLowerCase():"#document"}function Ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sn(e){var t;return(t=(hd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hd(e){return Oo()?e instanceof Node||e instanceof Ot(e).Node:!1}function Qt(e){return Oo()?e instanceof Element||e instanceof Ot(e).Element:!1}function on(e){return Oo()?e instanceof HTMLElement||e instanceof Ot(e).HTMLElement:!1}function Ac(e){return!Oo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ot(e).ShadowRoot}function _i(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Xb(e){return["table","td","th"].includes(Zr(e))}function _o(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function va(e){const t=wa(),n=Qt(e)?Gt(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 Yb(e){let t=Bn(e);for(;on(t)&&!$r(t);){if(va(t))return t;if(_o(t))return null;t=Bn(t)}return null}function wa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $r(e){return["html","body","#document"].includes(Zr(e))}function Gt(e){return Ot(e).getComputedStyle(e)}function So(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bn(e){if(Zr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ac(e)&&e.host||sn(e);return Ac(t)?t.host:t}function md(e){const t=Bn(e);return $r(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&_i(t)?t:md(t)}function fi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=md(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ot(o);if(i){const a=Ns(s);return t.concat(s,s.visualViewport||[],_i(o)?o:[],a&&n?fi(a):[])}return t.concat(o,fi(o,[],n))}function Ns(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gd(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=on(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=fo(n)!==i||fo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ba(e){return Qt(e)?e:e.contextElement}function _r(e){const t=ba(e);if(!on(t))return Hn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gd(t);let s=(i?fo(n.width):n.width)/r,a=(i?fo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Zb=Hn(0);function yd(e){const t=Ot(e);return!wa()||!t.visualViewport?Zb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ot(e)?!1:t}function mr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ba(e);let s=Hn(1);t&&(r?Qt(r)&&(s=_r(r)):s=_r(e));const a=eI(i,n,r)?yd(i):Hn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const g=Ot(i),m=r&&Qt(r)?Ot(r):r;let b=g,y=Ns(b);for(;y&&r&&m!==b;){const p=_r(y),C=y.getBoundingClientRect(),h=Gt(y),v=C.left+(y.clientLeft+parseFloat(h.paddingLeft))*p.x,I=C.top+(y.clientTop+parseFloat(h.paddingTop))*p.y;c*=p.x,f*=p.y,u*=p.x,d*=p.y,c+=v,f+=I,b=Ot(y),y=Ns(b)}}return ho({width:u,height:d,x:c,y:f})}function tI(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=sn(r),a=t?_o(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Hn(1);const u=Hn(0),d=on(r);if((d||!d&&!i)&&((Zr(r)!=="body"||_i(s))&&(c=So(r)),on(r))){const g=mr(r);f=_r(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x,y:n.y*f.y-c.scrollTop*f.y+u.y}}function nI(e){return Array.from(e.getClientRects())}function Ts(e,t){const n=So(e).scrollLeft;return t?t.left+n:mr(sn(e)).left+n}function rI(e){const t=sn(e),n=So(e),r=e.ownerDocument.body,o=lr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=lr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ts(e);const a=-n.scrollTop;return Gt(r).direction==="rtl"&&(s+=lr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function iI(e,t){const n=Ot(e),r=sn(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=wa();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function oI(e,t){const n=mr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=on(e)?_r(e):Hn(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 Fc(e,t,n){let r;if(t==="viewport")r=iI(e,n);else if(t==="document")r=rI(sn(e));else if(Qt(t))r=oI(t,n);else{const o=yd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ho(r)}function vd(e,t){const n=Bn(e);return n===t||!Qt(n)||$r(n)?!1:Gt(n).position==="fixed"||vd(n,t)}function sI(e,t){const n=t.get(e);if(n)return n;let r=fi(e,[],!1).filter(a=>Qt(a)&&Zr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?Bn(e):e;for(;Qt(s)&&!$r(s);){const a=Gt(s),c=va(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_i(s)&&!c&&vd(e,s))?r=r.filter(u=>u!==s):o=a,s=Bn(s)}return t.set(e,r),r}function aI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?_o(t)?[]:sI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,u)=>{const d=Fc(t,u,o);return f.top=lr(d.top,f.top),f.right=Ur(d.right,f.right),f.bottom=Ur(d.bottom,f.bottom),f.left=lr(d.left,f.left),f},Fc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function cI(e){const{width:t,height:n}=gd(e);return{width:t,height:n}}function lI(e,t,n){const r=on(t),o=sn(t),i=n==="fixed",s=mr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Hn(0);if(r||!r&&!i)if((Zr(t)!=="body"||_i(o))&&(a=So(t)),r){const m=mr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Ts(o));let f=0,u=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();u=m.top+a.scrollTop,f=m.left+a.scrollLeft-Ts(o,m)}const d=s.left+a.scrollLeft-c.x-f,g=s.top+a.scrollTop-c.y-u;return{x:d,y:g,width:s.width,height:s.height}}function Zo(e){return Gt(e).position==="static"}function Pc(e,t){if(!on(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return sn(e)===n&&(n=n.ownerDocument.body),n}function wd(e,t){const n=Ot(e);if(_o(e))return n;if(!on(e)){let o=Bn(e);for(;o&&!$r(o);){if(Qt(o)&&!Zo(o))return o;o=Bn(o)}return n}let r=Pc(e,t);for(;r&&Xb(r)&&Zo(r);)r=Pc(r,t);return r&&$r(r)&&Zo(r)&&!va(r)?n:r||Yb(e)||n}const uI=async function(e){const t=this.getOffsetParent||wd,n=this.getDimensions,r=await n(e.floating);return{reference:lI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dI(e){return Gt(e).direction==="rtl"}const fI={convertOffsetParentRelativeRectToViewportRelativeRect:tI,getDocumentElement:sn,getClippingRect:aI,getOffsetParent:wd,getElementRects:uI,getClientRects:nI,getDimensions:cI,getScale:_r,isElement:Qt,isRTL:dI};function pI(e,t){let n=null,r;const o=sn(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:u,width:d,height:g}=e.getBoundingClientRect();if(a||t(),!d||!g)return;const m=zi(u),b=zi(o.clientWidth-(f+d)),y=zi(o.clientHeight-(u+g)),p=zi(f),h={rootMargin:-m+"px "+-b+"px "+-y+"px "+-p+"px",threshold:lr(0,Ur(1,c))||1};let v=!0;function I(O){const S=O[0].intersectionRatio;if(S!==c){if(!v)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function hI(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=ba(e),u=o||i?[...f?fi(f):[],...fi(t)]:[];u.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const d=f&&a?pI(f,n):null;let g=-1,m=null;s&&(m=new ResizeObserver(C=>{let[h]=C;h&&h.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let b,y=c?mr(e):null;c&&p();function p(){const C=mr(e);y&&(C.x!==y.x||C.y!==y.y||C.width!==y.width||C.height!==y.height)&&n(),y=C,b=requestAnimationFrame(p)}return n(),()=>{var C;u.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),d==null||d(),(C=m)==null||C.disconnect(),m=null,c&&cancelAnimationFrame(b)}}const mI=Qb,gI=Gb,yI=Wb,vI=Jb,Dc=(e,t,n)=>{const r=new Map,o={platform:fI,...n},i={...o.platform,_c:r};return Bb(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var bc;function jw(){return bc||(bc=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"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=!1,y=!1,p=!1,C=!1,h=!1,v;v=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||h||z===r||z===f||z===u||C||z===m||b||y||p||typeof z=="object"&&z!==null&&(z.$$typeof===g||z.$$typeof===d||z.$$typeof===i||z.$$typeof===s||z.$$typeof===c||z.$$typeof===v||z.getModuleId!==void 0))}function O(z){if(typeof z=="object"&&z!==null){var Ee=z.$$typeof;switch(Ee){case e:var Ve=z.type;switch(Ve){case n:case o:case r:case f:case u:return Ve;default:var Ze=Ve&&Ve.$$typeof;switch(Ze){case a:case s:case c:case g:case d:case i:return Ze;default:return Ee}}case t:return Ee}}}var S=s,N=i,T=e,A=c,D=n,J=g,K=d,$=t,B=o,ae=r,re=f,ne=u,ge=!1,be=!1;function F(z){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return O(z)===s}function U(z){return O(z)===i}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function M(z){return O(z)===c}function Z(z){return O(z)===n}function ee(z){return O(z)===g}function W(z){return O(z)===d}function te(z){return O(z)===t}function X(z){return O(z)===o}function de(z){return O(z)===r}function j(z){return O(z)===f}function we(z){return O(z)===u}_e.ContextConsumer=S,_e.ContextProvider=N,_e.Element=T,_e.ForwardRef=A,_e.Fragment=D,_e.Lazy=J,_e.Memo=K,_e.Portal=$,_e.Profiler=B,_e.StrictMode=ae,_e.Suspense=re,_e.SuspenseList=ne,_e.isAsyncMode=F,_e.isConcurrentMode=L,_e.isContextConsumer=H,_e.isContextProvider=U,_e.isElement=q,_e.isForwardRef=M,_e.isFragment=Z,_e.isLazy=ee,_e.isMemo=W,_e.isPortal=te,_e.isProfiler=X,_e.isStrictMode=de,_e.isSuspense=j,_e.isSuspenseList=we,_e.isValidElementType=I,_e.typeOf=O}()),_e}process.env.NODE_ENV==="production"?Cs.exports=kw():Cs.exports=jw();var Ic=Cs.exports;const Cc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,xc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Yo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xc(n.overflowY,t)||xc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},Ji=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Lw=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},qw=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:f,skipOverflowHiddenElements:u}=t,d=typeof f=="function"?f:re=>re!==f;if(!Cc(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,m=[];let b=e;for(;Cc(b)&&d(b);){if(b=Lw(b),b===g){m.push(b);break}b!=null&&b===document.body&&Yo(b)&&!Yo(document.documentElement)||b!=null&&Yo(b,u)&&m.push(b)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:C,scrollY:h}=window,{height:v,width:I,top:O,right:S,bottom:N,left:T}=e.getBoundingClientRect(),{top:A,right:D,bottom:J,left:K}=(re=>{const ne=window.getComputedStyle(re);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let $=a==="start"||a==="nearest"?O-A:a==="end"?N+J:O+v/2-A+J,B=c==="center"?T+I/2-K+D:c==="end"?S+D:T-K;const ae=[];for(let re=0;re<m.length;re++){const ne=m[re],{height:ge,width:be,top:F,right:L,bottom:H,left:U}=ne.getBoundingClientRect();if(s==="if-needed"&&O>=0&&T>=0&&N<=p&&S<=y&&O>=F&&N<=H&&T>=U&&S<=L)return ae;const q=getComputedStyle(ne),M=parseInt(q.borderLeftWidth,10),Z=parseInt(q.borderTopWidth,10),ee=parseInt(q.borderRightWidth,10),W=parseInt(q.borderBottomWidth,10);let te=0,X=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-M-ee:0,j="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-W:0,we="offsetWidth"in ne?ne.offsetWidth===0?0:be/ne.offsetWidth:0,z="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(g===ne)te=a==="start"?$:a==="end"?$-p:a==="nearest"?Ji(h,h+p,p,Z,W,h+$,h+$+v,v):$-p/2,X=c==="start"?B:c==="center"?B-y/2:c==="end"?B-y:Ji(C,C+y,y,M,ee,C+B,C+B+I,I),te=Math.max(0,te+h),X=Math.max(0,X+C);else{te=a==="start"?$-F-Z:a==="end"?$-H+W+j:a==="nearest"?Ji(F,H,ge,Z,W+j,$,$+v,v):$-(F+ge/2)+j/2,X=c==="start"?B-U-M:c==="center"?B-(U+be/2)+de/2:c==="end"?B-L+ee+de:Ji(U,L,be,M,ee+de,B,B+I,I);const{scrollLeft:Ee,scrollTop:Ve}=ne;te=z===0?0:Math.max(0,Math.min(Ve+te/z,ne.scrollHeight-ge/z+j)),X=we===0?0:Math.max(0,Math.min(Ee+X/we,ne.scrollWidth-be/we+de)),$+=Ve-te,B+=Ee-X}ae.push({el:ne,top:te,left:X})}return ae};var Lr=function(){return Lr=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},Lr.apply(this,arguments)};var Kw=0;function Oc(e){return typeof e=="function"?e:xt}function xt(){}function Nu(e,t){if(e){var n=qw(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function _c(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Zs(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 Cr(){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 Tu(){return String(Kw++)}function Uw(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 Sc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Ru(e){return typeof e.type=="string"}function Au(e){return e.props}function Vw(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var $w=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Wi(e){e===void 0&&(e={});var t={};return $w.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function ao(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=co(t,r)?t[r]:e[r],n},{})}function co(e,t){return e[t]!==void 0}function xs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Hw(e){return Object.prototype.toString.call(e)==="[object Object]"}function er(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=qr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function qr(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?qr(t?i-1:0,t,n,r):-1}function lo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(_c(o,e,n)||r&&_c(o,n.document.activeElement,n))})}var ea=xt;process.env.NODE_ENV!=="production"&&(ea=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 Bw=Zs(function(e){Fu(e).textContent=""},500);function Fu(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 Pu(e,t){if(!(!e||!t)){var n=Fu(t);n.textContent=e,Bw(t)}}function Jw(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Du=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Mu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ku=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Yi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,ju=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,qu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Uu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Vu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,$u=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Hu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Os=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Bu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ju=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Wu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Ww=Object.freeze({__proto__:null,blurButton:Bu,blurInput:Vu,changeInput:$u,clickButton:Os,clickItem:Uu,controlledPropUpdatedSelectedItem:Ju,itemMouseEnter:ku,keyDownArrowDown:Zi,keyDownArrowUp:Yi,keyDownEnd:Ku,keyDownEnter:Lu,keyDownEscape:ju,keyDownHome:qu,keyDownSpaceButton:Hu,mouseUp:Mu,touchEnd:Wu,unknown:Du}),zw=["refKey","ref"],Qw=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Gw=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Xw=["refKey","ref"],Yw=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Zw=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Tu(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,v){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(O){return O!==I}),h()},v);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,v){var I=i.getItemNodeFromIndex(v);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,v){h===void 0&&(h=i.props.defaultHighlightedIndex),v===void 0&&(v={}),v=Wi(v),i.internalSetState(he({highlightedIndex:h},v))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,v,I){v=Wi(v),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},v),I)},i.selectItemAtIndex=function(h,v,I){var O=i.items[h];O!=null&&i.selectItem(O,v,I)},i.selectHighlightedItem=function(h,v){return i.selectItemAtIndex(i.getState().highlightedIndex,h,v)},i.internalSetState=function(h,v){var I,O,S={},N=typeof h=="function";return!N&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,he({},i.getStateAndHelpers(),h)),i.setState(function(T){var A;T=i.getState(T);var D=N?h(T):h;D=i.props.stateReducer(T,D),I=D.hasOwnProperty("selectedItem");var J={};return I&&D.selectedItem!==T.selectedItem&&(O=D.selectedItem),(A=D).type||(A.type=Du),Object.keys(D).forEach(function(K){T[K]!==D[K]&&(S[K]=D[K]),K!=="type"&&(D[K],co(i.props,K)||(J[K]=D[K]))}),N&&D.hasOwnProperty("inputValue")&&i.props.onInputValueChange(D.inputValue,he({},i.getStateAndHelpers(),D)),J},function(){Oc(v)();var T=Object.keys(S).length>1;T&&i.props.onStateChange(S,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),O!==void 0&&i.props.onChange(O,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,v){var I,O=h===void 0?{}:h,S=O.refKey,N=S===void 0?"ref":S,T=O.ref,A=gn(O,zw),D=v===void 0?{}:v,J=D.suppressRefError,K=J===void 0?!1:J;i.getRootProps.called=!0,i.getRootProps.refKey=N,i.getRootProps.suppressRefError=K;var $=i.getState(),B=$.isOpen;return he((I={},I[N]=Cr(T,i.rootRef),I.role="combobox",I["aria-expanded"]=B,I["aria-haspopup"]="listbox",I["aria-owns"]=B?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),A)},i.keyDownHandlers={ArrowDown:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?5:1;this.moveHighlightedIndex(O,{type:Zi})}else this.internalSetState({isOpen:!0,type:Zi},function(){var S=I.getItemCount();if(S>0){var N=I.getState(),T=N.highlightedIndex,A=er(T,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:Zi})}})},ArrowUp:function(v){var I=this;if(v.preventDefault(),this.getState().isOpen){var O=v.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:Yi})}else this.internalSetState({isOpen:!0,type:Yi},function(){var S=I.getItemCount();if(S>0){var N=I.getState(),T=N.highlightedIndex,A=er(T,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:Yi})}})},Enter:function(v){if(v.which!==229){var I=this.getState(),O=I.isOpen,S=I.highlightedIndex;if(O&&S!=null){v.preventDefault();var N=this.items[S],T=this.getItemNodeFromIndex(S);if(N==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Lu})}}},Escape:function(v){v.preventDefault(),this.reset(he({type:ju},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(v){v.preventDefault(),this.toggleMenu({type:Hu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var N=qr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(N,{type:qu})}}},End:function(v){var I=this.getState(),O=I.isOpen;if(O){v.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var N=qr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(N,{type:Ku})}}}}),i.getToggleButtonProps=function(h){var v=h===void 0?{}:h,I=v.onClick;v.onPress;var O=v.onKeyDown,S=v.onKeyUp,N=v.onBlur,T=gn(v,Qw),A=i.getState(),D=A.isOpen,J={onClick:We(I,i.buttonHandleClick),onKeyDown:We(O,i.buttonHandleKeyDown),onKeyUp:We(S,i.buttonHandleKeyUp),onBlur:We(N,i.buttonHandleBlur)},K=T.disabled?{}:J;return he({type:"button",role:"button","aria-label":D?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},K,T)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var v=xs(h);i.buttonKeyDownHandlers[v]&&i.buttonKeyDownHandlers[v].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var v=i.props.environment.document,I=v.body,O=v.activeElement;I&&I===O&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Os}):i.internalSetTimeout(function(){return i.toggleMenu({type:Os})})},i.buttonHandleBlur=function(h){var v=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==v&&i.reset({type:Bu})}})},i.getLabelProps=function(h){return he({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var v=h===void 0?{}:h,I=v.onKeyDown,O=v.onBlur,S=v.onChange,N=v.onInput;v.onChangeText;var T=gn(v,Gw),A,D={};A="onChange";var J=i.getState(),K=J.inputValue,$=J.isOpen,B=J.highlightedIndex;if(!T.disabled){var ae;D=(ae={},ae[A]=We(S,N,i.inputHandleChange),ae.onKeyDown=We(I,i.inputHandleKeyDown),ae.onBlur=We(O,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":$&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":$?i.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:i.labelId,autoComplete:"off",value:K,id:i.inputId},D,T)},i.inputHandleKeyDown=function(h){var v=xs(h);v&&i.inputKeyDownHandlers[v]&&i.inputKeyDownHandlers[v].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:$u,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var v=i.props.environment.document.activeElement,I=(v==null||(h=v.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(v);I||i.reset({type:Vu})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,v){var I,O=h===void 0?{}:h,S=O.refKey,N=S===void 0?"ref":S,T=O.ref,A=gn(O,Xw),D=v===void 0?{}:v,J=D.suppressRefError,K=J===void 0?!1:J;return i.getMenuProps.called=!0,i.getMenuProps.refKey=N,i.getMenuProps.suppressRefError=K,he((I={},I[N]=Cr(T,i.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),A)},i.getItemProps=function(h){var v,I=h===void 0?{}:h,O=I.onMouseMove,S=I.onMouseDown,N=I.onClick;I.onPress;var T=I.index,A=I.item,D=A===void 0?process.env.NODE_ENV==="production"?void 0:Vw("getItemProps","item"):A,J=gn(I,Yw);T===void 0?(i.items.push(D),T=i.items.indexOf(D)):i.items[T]=D;var K="onClick",$=N,B=(v={onMouseMove:We(O,function(){T!==i.getState().highlightedIndex&&(i.setHighlightedIndex(T,{type:ku}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:We(S,function(re){re.preventDefault()})},v[K]=We($,function(){i.selectItemAtIndex(T,{type:Uu})}),v),ae=J.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(T),role:"option","aria-selected":i.getState().highlightedIndex===T},ae,J)},i.clearItems=function(){i.items=[]},i.reset=function(h,v){h===void 0&&(h={}),h=Wi(h),i.internalSetState(function(I){var O=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(O)},h)},v)},i.toggleMenu=function(h,v){h===void 0&&(h={}),h=Wi(h),i.internalSetState(function(I){var O=I.isOpen;return he({isOpen:!O},O&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),O=I.isOpen,S=I.highlightedIndex;O&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,h),Oc(v)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=Zs(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var v=i.getState(),I=i.items[v.highlightedIndex],O=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:O,highlightedItem:I},v));i.previousResultCount=O,Pu(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,u=s.defaultIsOpen,d=s.initialIsOpen,g=d===void 0?u:d,m=s.initialInputValue,b=m===void 0?"":m,y=s.initialSelectedItem,p=y===void 0?null:y,C=i.getState({highlightedIndex:f,isOpen:g,inputValue:b,selectedItem:p});return C.selectedItem!=null&&i.props.initialInputValue===void 0&&(C.inputValue=i.props.itemToString(C.selectedItem)),i.state=C,i}Sw(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),ao(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 u=er(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,u=this.props.itemToString,d=this.id,g=this.getRootProps,m=this.getToggleButtonProps,b=this.getLabelProps,y=this.getMenuProps,p=this.getInputProps,C=this.getItemProps,h=this.openMenu,v=this.closeMenu,I=this.toggleMenu,O=this.selectItem,S=this.selectItemAtIndex,N=this.selectHighlightedItem,T=this.setHighlightedIndex,A=this.clearSelection,D=this.clearItems,J=this.reset,K=this.setItemCount,$=this.unsetItemCount,B=this.internalSetState;return{getRootProps:g,getToggleButtonProps:m,getLabelProps:b,getMenuProps:y,getInputProps:p,getItemProps:C,reset:J,openMenu:h,closeMenu:v,toggleMenu:I,selectItem:O,selectItemAtIndex:S,selectHighlightedItem:N,setHighlightedIndex:T,clearSelection:A,clearItems:D,setItemCount:K,unsetItemCount:$,setState:B,itemToString:u,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&&Ec(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 b=lo(m.target,[i._rootNode,i._menuNode],i.props.environment);!b&&i.getState().isOpen&&i.reset({type:Mu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},u=function(m){var b=lo(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!b&&i.getState().isOpen&&i.reset({type:Wu},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",u),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",u)}}},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,u=f.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,g=c!==u;return d||g},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(ea(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ec(this._menuNode,this.getMenuProps)),co(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ju,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=Sc(this.props.children,xt);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=Sc(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&&eb(s,this.getRootProps),s;if(Ru(s))return w.cloneElement(s,this.getRootProps(Au(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Uw,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Hw(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:xt,onInputValueChange:xt,onUserAction:xt,onChange:xt,onSelect:xt,onOuterClick:xt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Nu},e.stateChangeTypes=Ww,e}();process.env.NODE_ENV!=="production"&&(Zw.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function Ec(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 eb(e,t){var n=t.refKey,r=n!=="ref",o=!Ru(e);o&&!r&&!Ic.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+'"'),!Ic.isForwardRef(e)&&!Au(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var zu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function tb(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){nb(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function nb(e,t,n,r){var o=t.props,i=t.type,s="on"+ta(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function rb(e,t){return t.changes}var Nc=Zs(function(e,t){Pu(e,t)},200),ib=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,ob="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var f=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Tu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return f.current};function sb(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 ta(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Qu(e){var t=w.useRef(e);return t.current=e,t}function ab(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(m,b){i.current=b,m=ao(m,b.props);var y=e(m,b),p=b.props.stateReducer(m,he({},b,{changes:y}));return p},[e]),a=w.useReducer(s,t,n),c=a[0],f=a[1],u=Qu(t),d=w.useCallback(function(m){return f(he({props:u.current},m))},[u]),g=i.current;return w.useEffect(function(){var m=ao(o.current,g==null?void 0:g.props),b=g&&o.current&&!r(m,c);b&&tb(g,m,c),o.current=c},[c,g,r]),[c,d]}var si={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:rb,scrollIntoView:Nu,environment:typeof window>"u"?void 0:window};function Kn(e,t,n){n===void 0&&(n=zu);var r=e["default"+ta(t)];return r!==void 0?r:n[t]}function ai(e,t,n){n===void 0&&(n=zu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+ta(t)];return o!==void 0?o:Kn(e,t,n)}function cb(e){var t=ai(e,"selectedItem"),n=ai(e,"isOpen"),r=pb(e),o=ai(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function ci(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(u){return a(c)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function lb(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return xt;var o=n.map(function(u){return u.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,lo(u.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!lo(u.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 Gu=function(){return xt};process.env.NODE_ENV!=="production"&&(Gu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,f=a.refKey,u=a.elementRef;c||u!=null&&u.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=w.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function ub(e,t,n,r){r===void 0&&(r={});var o=r.document,i=xo();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);Nc(s,o)}},n),w.useEffect(function(){return function(){Nc.cancel(),Jw(o)}},[o])}function db(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return ib(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Xu=xt;process.env.NODE_ENV!=="production"&&(Xu=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=xo();w.useEffect(function(){i||(ea(r,o.current,n),o.current=n)},[r,n,i])});function Tc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:Kn(e,"isOpen"),highlightedIndex:Kn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function fb(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function xo(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function _s(e){var t=Kn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function pb(e){var t=ai(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var eo={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},Yu=he({},eo,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function hb(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ci(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ci(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:_s(o),isOpen:Kn(o,"isOpen"),selectedItem:Kn(o,"selectedItem"),inputValue:Kn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Lr(Lr({},Yu),{items:V.array.isRequired,isItemDisabled:V.func});Lr(Lr({},si),{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 na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ra=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ia=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,oa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,sa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,aa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ca=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,la=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ua=process.env.NODE_ENV!=="production"?"__input_change__":8,uo=process.env.NODE_ENV!=="production"?"__input_blur__":9,da=process.env.NODE_ENV!=="production"?"__input_click__":10,Zu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,ed=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,fa=process.env.NODE_ENV!=="production"?"__item_click__":13,td=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,nd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,rd=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,id=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,od=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,pa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,sd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ad=process.env.NODE_ENV!=="production"?"__function_reset__":21,ha=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,cd=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ha,FunctionCloseMenu:id,FunctionOpenMenu:rd,FunctionReset:ad,FunctionSelectItem:pa,FunctionSetHighlightedIndex:od,FunctionSetInputValue:sd,FunctionToggleMenu:nd,InputBlur:uo,InputChange:ua,InputClick:da,InputKeyDownArrowDown:na,InputKeyDownArrowUp:ra,InputKeyDownEnd:sa,InputKeyDownEnter:la,InputKeyDownEscape:ia,InputKeyDownHome:oa,InputKeyDownPageDown:ca,InputKeyDownPageUp:aa,ItemClick:fa,ItemMouseMove:ed,MenuMouseLeave:Zu,ToggleButtonClick:td});function mb(e){var t=cb(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),he({},t,{inputValue:r})}var gb=he({},Yu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function yb(e,t,n,r){var o=w.useRef(),i=ab(e,t,n,r),s=i[0],a=i[1],c=xo();return w.useEffect(function(){if(co(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:ha,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[ao(s,t),a]}var ld=xt;process.env.NODE_ENV!=="production"&&(ld=function(t,n){V.checkPropTypes(gb,t,"prop",n.name)});var vb=he({},si,{isItemDisabled:function(){return!1}});function wb(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case fa:s={isOpen:Kn(o,"isOpen"),highlightedIndex:_s(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case na:e.isOpen?s={highlightedIndex:er(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ci(o,e,1),isOpen:o.items.length>=0};break;case ra:e.isOpen?i?s=Tc(o,e.highlightedIndex):s={highlightedIndex:er(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ci(o,e,-1),isOpen:o.items.length>=0};break;case la:s=Tc(o,e.highlightedIndex);break;case ia:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case aa:s={highlightedIndex:er(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ca:s={highlightedIndex:er(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case oa:s={highlightedIndex:qr(0,!1,o.items,o.isItemDisabled)};break;case sa:s={highlightedIndex:qr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case uo:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case ua:s={isOpen:!0,highlightedIndex:_s(o),inputValue:t.inputValue};break;case da:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ci(o,e,0)};break;case pa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ha:s={inputValue:t.inputValue};break;default:return hb(e,t,cd)}return he({},e,s)}var bb=["onMouseLeave","refKey","ref"],Ib=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Cb=["onClick","onPress","refKey","ref"],xb=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ma.stateChangeTypes=cd;function ma(e){e===void 0&&(e={}),ld(e,ma);var t=he({},vb,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=yb(wb,t,mb,fb),a=s[0],c=s[1],f=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,g=a.inputValue,m=w.useRef(null),b=w.useRef({}),y=w.useRef(null),p=w.useRef(null),C=xo(),h=ob(t),v=w.useRef(),I=Qu({state:a,props:t}),O=w.useCallback(function(H){return b.current[h.getItemId(H)]},[h]);ub(i,a,[f,u,d,g],o);var S=db({menuElement:m.current,highlightedIndex:u,isOpen:f,itemRefs:b,scrollIntoView:r,getItemNodeFromIndex:O});Xu({props:t,state:a}),w.useEffect(function(){var H=ai(t,"isOpen");H&&y.current&&y.current.focus()},[]),w.useEffect(function(){C||(v.current=n.length)});var N=lb(o,w.useCallback(function(){I.current.state.isOpen&&c({type:uo,selectItem:!1})},[c,I]),w.useMemo(function(){return[m,p,y]},[m.current,p.current,y.current])),T=Gu("getInputProps","getMenuProps");w.useEffect(function(){f||(b.current={})},[f]),w.useEffect(function(){var H;!f||!(o!=null&&o.document)||!(y!=null&&(H=y.current)!=null&&H.focus)||o.document.activeElement!==y.current&&y.current.focus()},[f,o]);var A=w.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),c({type:na,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),c({type:ra,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:oa}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:sa}))},Escape:function(U){var q=I.current.state;(q.isOpen||q.inputValue||q.selectedItem||q.highlightedIndex>-1)&&(U.preventDefault(),c({type:ia}))},Enter:function(U){var q=I.current.state;!q.isOpen||U.which===229||(U.preventDefault(),c({type:la}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:aa}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:ca}))}}},[c,I]),D=w.useCallback(function(H){return he({id:h.labelId,htmlFor:h.inputId},H)},[h]),J=w.useCallback(function(H,U){var q,M=H===void 0?{}:H,Z=M.onMouseLeave,ee=M.refKey,W=ee===void 0?"ref":ee,te=M.ref,X=gn(M,bb),de=U===void 0?{}:U,j=de.suppressRefError,we=j===void 0?!1:j;return T("getMenuProps",we,W,m),he((q={},q[W]=Cr(te,function(z){m.current=z}),q.id=h.menuId,q.role="listbox",q["aria-labelledby"]=X&&X["aria-label"]?void 0:""+h.labelId,q.onMouseLeave=We(Z,function(){c({type:Zu})}),q),X)},[c,T,h]),K=w.useCallback(function(H){var U,q,M=H===void 0?{}:H,Z=M.item,ee=M.index,W=M.refKey,te=W===void 0?"ref":W,X=M.ref,de=M.onMouseMove,j=M.onMouseDown,we=M.onClick;M.onPress;var z=M.disabled,Ee=gn(M,Ib);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=I.current,Ze=Ve.props,$e=Ve.state,Ie=sb(Z,ee,Ze.items,"Pass either item or index to getItemProps!"),Mt=Ie[0],et=Ie[1],bt=Ze.isItemDisabled(Mt,et),kt="onClick",jt=we,tt=function(){N.isTouchEnd||et===$e.highlightedIndex||(S.current=!1,c({type:ed,index:et,disabled:bt}))},Ge=function(){c({type:fa,index:et})},He=function(Lt){return Lt.preventDefault()};return he((U={},U[te]=Cr(X,function(Fe){Fe&&(b.current[h.getItemId(et)]=Fe)}),U["aria-disabled"]=bt,U["aria-selected"]=et===$e.highlightedIndex,U.id=h.getItemId(et),U.role="option",U),!bt&&(q={},q[kt]=We(jt,Ge),q),{onMouseMove:We(de,tt),onMouseDown:We(j,He)},Ee)},[c,h,I,N,S]),$=w.useCallback(function(H){var U,q=H===void 0?{}:H,M=q.onClick;q.onPress;var Z=q.refKey,ee=Z===void 0?"ref":Z,W=q.ref,te=gn(q,Cb),X=I.current.state,de=function(){c({type:td})};return he((U={},U[ee]=Cr(W,function(j){p.current=j}),U["aria-controls"]=h.menuId,U["aria-expanded"]=X.isOpen,U.id=h.toggleButtonId,U.tabIndex=-1,U),!te.disabled&&he({},{onClick:We(M,de)}),te)},[c,I,h]),B=w.useCallback(function(H,U){var q,M=H===void 0?{}:H,Z=M.onKeyDown,ee=M.onChange,W=M.onInput,te=M.onBlur;M.onChangeText;var X=M.onClick,de=M.refKey,j=de===void 0?"ref":de,we=M.ref,z=gn(M,xb),Ee=U===void 0?{}:U,Ve=Ee.suppressRefError,Ze=Ve===void 0?!1:Ve;T("getInputProps",Ze,j,y);var $e=I.current.state,Ie=function(He){var Fe=xs(He);Fe&&A[Fe]&&A[Fe](He)},Mt=function(He){c({type:ua,inputValue:He.target.value})},et=function(He){if(o!=null&&o.document&&$e.isOpen&&!N.isMouseDown){var Fe=He.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:uo,selectItem:!Fe})}},bt=function(){c({type:da})},kt="onChange",jt={};if(!z.disabled){var tt;jt=(tt={},tt[kt]=We(ee,W,Mt),tt.onKeyDown=We(Z,Ie),tt.onBlur=We(te,et),tt.onClick=We(X,bt),tt)}return he((q={},q[j]=Cr(we,function(Ge){y.current=Ge}),q["aria-activedescendant"]=$e.isOpen&&$e.highlightedIndex>-1?h.getItemId($e.highlightedIndex):"",q["aria-autocomplete"]="list",q["aria-controls"]=h.menuId,q["aria-expanded"]=$e.isOpen,q["aria-labelledby"]=z&&z["aria-label"]?void 0:h.labelId,q.autoComplete="off",q.id=h.inputId,q.role="combobox",q.value=$e.inputValue,q),jt,z)},[c,h,o,A,I,N,T]),ae=w.useCallback(function(){c({type:nd})},[c]),re=w.useCallback(function(){c({type:id})},[c]),ne=w.useCallback(function(){c({type:rd})},[c]),ge=w.useCallback(function(H){c({type:od,highlightedIndex:H})},[c]),be=w.useCallback(function(H){c({type:pa,selectedItem:H})},[c]),F=w.useCallback(function(H){c({type:sd,inputValue:H})},[c]),L=w.useCallback(function(){c({type:ad})},[c]);return{getItemProps:K,getLabelProps:D,getMenuProps:J,getInputProps:B,getToggleButtonProps:$,toggleMenu:ae,openMenu:ne,closeMenu:re,setHighlightedIndex:ge,setInputValue:F,selectItem:be,reset:L,highlightedIndex:u,isOpen:f,selectedItem:d,inputValue:g}}eo.stateReducer,eo.itemToKey,eo.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;si.itemToKey,si.stateReducer,si.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 Ob="_comboboxContainer_1lcc8_1",_b="_label_1lcc8_8",Sb="_inputContainer_1lcc8_12",Eb="_input_1lcc8_12",Nb="_toggleButton_1lcc8_33",Tb="_menu_1lcc8_39",Rb="_menuBottom_1lcc8_55",Ab="_menuTop_1lcc8_61",Fb="_menuItem_1lcc8_66",Pb="_highlighted_1lcc8_73",Db="_selected_1lcc8_77",Mb="_hidden_1lcc8_81",Vt={comboboxContainer:Ob,label:_b,inputContainer:Sb,input:Eb,toggleButton:Nb,menu:Tb,menuBottom:Rb,menuTop:Ab,menuItem:Fb,highlighted:Pb,selected:Db,hidden:Mb};function kb(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function ud({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=w.useState(e),f=w.useRef(null);w.useEffect(()=>c(e),[e]);const u=w.useCallback(N=>{(N==null?void 0:N.length)>0?c(e.filter(kb(N))):c(e)},[e]),{isOpen:d,getToggleButtonProps:g,getMenuProps:m,getInputProps:b,highlightedIndex:y,getItemProps:p,setInputValue:C,selectedItem:h}=ma({items:a,selectedItem:t?e.find(N=>N.value===t):null,itemToString:N=>(N==null?void 0:N.label)||"",onInputValueChange:({inputValue:N})=>u(N),onSelectedItemChange:({selectedItem:N})=>{var T;n(N),(T=f.current)==null||T.blur()}}),v=()=>{C(""),c(e)},I=()=>v(),O=w.useMemo(()=>{var N;return(N=e.find(T=>T.value===t))==null?void 0:N.label},[e,t]),S=()=>{t&&O&&t!==(h==null?void 0:h.value)&&C(O||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:Vt.comboboxContainer,children:l.jsxs("div",{className:Vt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Vt.input,...b({onFocus:I,onBlur:S,ref:f})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Vt.toggleButton,type:"button",...g(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${Vt.menu} ${d&&e.length?"":Vt.hidden} ${s==="top"?Vt.menuTop:Vt.menuBottom}`,...m(),children:d&&a.map((N,T)=>l.jsx("li",{className:`${Vt.menuItem} ${y===T?Vt.highlighted:""} ${t===(N==null?void 0:N.value)?Vt.selected:""}`,...p({item:N,index:T}),children:l.jsx("span",{children:N.label})},N.id))})]})}const Kr=Math.min,lr=Math.max,fo=Math.round,zi=Math.floor,Hn=e=>({x:e,y:e}),jb={left:"right",right:"left",bottom:"top",top:"bottom"},Lb={start:"end",end:"start"};function Ss(e,t,n){return lr(e,Kr(t,n))}function xi(e,t){return typeof e=="function"?e(t):e}function hr(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function dd(e){return e==="x"?"y":"x"}function ga(e){return e==="y"?"height":"width"}function Ur(e){return["top","bottom"].includes(hr(e))?"y":"x"}function ya(e){return dd(Ur(e))}function qb(e,t,n){n===void 0&&(n=!1);const r=Oi(e),o=ya(e),i=ga(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=po(s)),[s,po(s)]}function Kb(e){const t=po(e);return[Es(e),t,Es(t)]}function Es(e){return e.replace(/start|end/g,t=>Lb[t])}function Ub(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 Vb(e,t,n,r){const o=Oi(e);let i=Ub(hr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Es)))),i}function po(e){return e.replace(/left|right|bottom|top/g,t=>jb[t])}function $b(e){return{top:0,right:0,bottom:0,left:0,...e}}function fd(e){return typeof e!="number"?$b(e):{top:e,right:e,bottom:e,left:e}}function ho(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 Rc(e,t,n){let{reference:r,floating:o}=e;const i=Ur(t),s=ya(t),a=ga(s),c=hr(t),f=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,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(Oi(t)){case"start":m[s]-=g*(n&&f?-1:1);break;case"end":m[s]+=g*(n&&f?-1:1);break}return m}const Hb=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:u,y:d}=Rc(f,r,c),g=r,m={},b=0;for(let y=0;y<a.length;y++){const{name:p,fn:C}=a[y],{x:h,y:v,data:I,reset:O}=await C({x:u,y:d,initialPlacement:r,placement:g,strategy:o,middlewareData:m,rects:f,platform:s,elements:{reference:e,floating:t}});u=h??u,d=v??d,m={...m,[p]:{...m[p],...I}},O&&b<=50&&(b++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(f=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:u,y:d}=Rc(f,g,c)),y=-1)}return{x:u,y:d,placement:g,strategy:o,middlewareData:m}};async function pd(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:u="viewport",elementContext:d="floating",altBoundary:g=!1,padding:m=0}=xi(t,e),b=fd(m),p=a[g?d==="floating"?"reference":"floating":d],C=ho(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:u,strategy:c})),h=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},O=ho(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:v,strategy:c}):h);return{top:(C.top-O.top+b.top)/I.y,bottom:(O.bottom-C.bottom+b.bottom)/I.y,left:(C.left-O.left+b.left)/I.x,right:(O.right-C.right+b.right)/I.x}}const Bb=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:u=0}=xi(e,t)||{};if(f==null)return{};const d=fd(u),g={x:n,y:r},m=ya(o),b=ga(m),y=await s.getDimensions(f),p=m==="y",C=p?"top":"left",h=p?"bottom":"right",v=p?"clientHeight":"clientWidth",I=i.reference[b]+i.reference[m]-g[m]-i.floating[b],O=g[m]-i.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let N=S?S[v]:0;(!N||!await(s.isElement==null?void 0:s.isElement(S)))&&(N=a.floating[v]||i.floating[b]);const T=I/2-O/2,A=N/2-y[b]/2-1,D=Kr(d[C],A),J=Kr(d[h],A),K=D,$=N-y[b]-J,B=N/2-y[b]/2+T,ae=Ss(K,B,$),re=!c.arrow&&Oi(o)!=null&&B!==ae&&i.reference[b]/2-(B<K?D:J)-y[b]/2<0,ne=re?B<K?B-K:B-$:0;return{[m]:g[m]+ne,data:{[m]:ae,centerOffset:B-ae-ne,...re&&{alignmentOffset:ne}},reset:re}}}),Jb=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:u=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...p}=xi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=hr(o),h=Ur(a),v=hr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(f.floating)),O=g||(v||!y?[po(a)]:Kb(a)),S=b!=="none";!g&&S&&O.push(...Vb(a,y,b,I));const N=[a,...O],T=await pd(t,p),A=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(T[C]),d){const B=qb(o,s,I);A.push(T[B[0]],T[B[1]])}if(D=[...D,{placement:o,overflows:A}],!A.every(B=>B<=0)){var J,K;const B=(((J=i.flip)==null?void 0:J.index)||0)+1,ae=N[B];if(ae)return{data:{index:B,overflows:D},reset:{placement:ae}};let re=(K=D.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:K.placement;if(!re)switch(m){case"bestFit":{var $;const ne=($=D.filter(ge=>{if(S){const be=Ur(ge.placement);return be===h||be==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(be=>be>0).reduce((be,F)=>be+F,0)]).sort((ge,be)=>ge[1]-be[1])[0])==null?void 0:$[0];ne&&(re=ne);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function Wb(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=hr(n),a=Oi(n),c=Ur(n)==="y",f=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,d=xi(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),c?{x:m*u,y:g*f}:{x:g*f,y:m*u}}const zb=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 Wb(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}}}}},Qb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:C,y:h}=p;return{x:C,y:h}}},...c}=xi(e,t),f={x:n,y:r},u=await pd(t,c),d=Ur(hr(o)),g=dd(d);let m=f[g],b=f[d];if(i){const p=g==="y"?"top":"left",C=g==="y"?"bottom":"right",h=m+u[p],v=m-u[C];m=Ss(h,m,v)}if(s){const p=d==="y"?"top":"left",C=d==="y"?"bottom":"right",h=b+u[p],v=b-u[C];b=Ss(h,b,v)}const y=a.fn({...t,[g]:m,[d]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[g]:i,[d]:s}}}}}};function Oo(){return typeof window<"u"}function Yr(e){return hd(e)?(e.nodeName||"").toLowerCase():"#document"}function Ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sn(e){var t;return(t=(hd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hd(e){return Oo()?e instanceof Node||e instanceof Ot(e).Node:!1}function Qt(e){return Oo()?e instanceof Element||e instanceof Ot(e).Element:!1}function on(e){return Oo()?e instanceof HTMLElement||e instanceof Ot(e).HTMLElement:!1}function Ac(e){return!Oo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ot(e).ShadowRoot}function _i(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Gb(e){return["table","td","th"].includes(Yr(e))}function _o(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function va(e){const t=wa(),n=Qt(e)?Gt(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 Xb(e){let t=Bn(e);for(;on(t)&&!Vr(t);){if(va(t))return t;if(_o(t))return null;t=Bn(t)}return null}function wa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vr(e){return["html","body","#document"].includes(Yr(e))}function Gt(e){return Ot(e).getComputedStyle(e)}function So(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bn(e){if(Yr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ac(e)&&e.host||sn(e);return Ac(t)?t.host:t}function md(e){const t=Bn(e);return Vr(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&_i(t)?t:md(t)}function fi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=md(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ot(o);if(i){const a=Ns(s);return t.concat(s,s.visualViewport||[],_i(o)?o:[],a&&n?fi(a):[])}return t.concat(o,fi(o,[],n))}function Ns(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gd(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=on(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=fo(n)!==i||fo(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ba(e){return Qt(e)?e:e.contextElement}function Or(e){const t=ba(e);if(!on(t))return Hn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gd(t);let s=(i?fo(n.width):n.width)/r,a=(i?fo(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Yb=Hn(0);function yd(e){const t=Ot(e);return!wa()||!t.visualViewport?Yb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ot(e)?!1:t}function mr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ba(e);let s=Hn(1);t&&(r?Qt(r)&&(s=Or(r)):s=Or(e));const a=Zb(i,n,r)?yd(i):Hn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const g=Ot(i),m=r&&Qt(r)?Ot(r):r;let b=g,y=Ns(b);for(;y&&r&&m!==b;){const p=Or(y),C=y.getBoundingClientRect(),h=Gt(y),v=C.left+(y.clientLeft+parseFloat(h.paddingLeft))*p.x,I=C.top+(y.clientTop+parseFloat(h.paddingTop))*p.y;c*=p.x,f*=p.y,u*=p.x,d*=p.y,c+=v,f+=I,b=Ot(y),y=Ns(b)}}return ho({width:u,height:d,x:c,y:f})}function eI(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=sn(r),a=t?_o(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Hn(1);const u=Hn(0),d=on(r);if((d||!d&&!i)&&((Yr(r)!=="body"||_i(s))&&(c=So(r)),on(r))){const g=mr(r);f=Or(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x,y:n.y*f.y-c.scrollTop*f.y+u.y}}function tI(e){return Array.from(e.getClientRects())}function Ts(e,t){const n=So(e).scrollLeft;return t?t.left+n:mr(sn(e)).left+n}function nI(e){const t=sn(e),n=So(e),r=e.ownerDocument.body,o=lr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=lr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ts(e);const a=-n.scrollTop;return Gt(r).direction==="rtl"&&(s+=lr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function rI(e,t){const n=Ot(e),r=sn(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=wa();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function iI(e,t){const n=mr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=on(e)?Or(e):Hn(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 Fc(e,t,n){let r;if(t==="viewport")r=rI(e,n);else if(t==="document")r=nI(sn(e));else if(Qt(t))r=iI(t,n);else{const o=yd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ho(r)}function vd(e,t){const n=Bn(e);return n===t||!Qt(n)||Vr(n)?!1:Gt(n).position==="fixed"||vd(n,t)}function oI(e,t){const n=t.get(e);if(n)return n;let r=fi(e,[],!1).filter(a=>Qt(a)&&Yr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?Bn(e):e;for(;Qt(s)&&!Vr(s);){const a=Gt(s),c=va(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_i(s)&&!c&&vd(e,s))?r=r.filter(u=>u!==s):o=a,s=Bn(s)}return t.set(e,r),r}function sI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?_o(t)?[]:oI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,u)=>{const d=Fc(t,u,o);return f.top=lr(d.top,f.top),f.right=Kr(d.right,f.right),f.bottom=Kr(d.bottom,f.bottom),f.left=lr(d.left,f.left),f},Fc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function aI(e){const{width:t,height:n}=gd(e);return{width:t,height:n}}function cI(e,t,n){const r=on(t),o=sn(t),i=n==="fixed",s=mr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Hn(0);if(r||!r&&!i)if((Yr(t)!=="body"||_i(o))&&(a=So(t)),r){const m=mr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Ts(o));let f=0,u=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();u=m.top+a.scrollTop,f=m.left+a.scrollLeft-Ts(o,m)}const d=s.left+a.scrollLeft-c.x-f,g=s.top+a.scrollTop-c.y-u;return{x:d,y:g,width:s.width,height:s.height}}function Zo(e){return Gt(e).position==="static"}function Pc(e,t){if(!on(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return sn(e)===n&&(n=n.ownerDocument.body),n}function wd(e,t){const n=Ot(e);if(_o(e))return n;if(!on(e)){let o=Bn(e);for(;o&&!Vr(o);){if(Qt(o)&&!Zo(o))return o;o=Bn(o)}return n}let r=Pc(e,t);for(;r&&Gb(r)&&Zo(r);)r=Pc(r,t);return r&&Vr(r)&&Zo(r)&&!va(r)?n:r||Xb(e)||n}const lI=async function(e){const t=this.getOffsetParent||wd,n=this.getDimensions,r=await n(e.floating);return{reference:cI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uI(e){return Gt(e).direction==="rtl"}const dI={convertOffsetParentRelativeRectToViewportRelativeRect:eI,getDocumentElement:sn,getClippingRect:sI,getOffsetParent:wd,getElementRects:lI,getClientRects:tI,getDimensions:aI,getScale:Or,isElement:Qt,isRTL:uI};function fI(e,t){let n=null,r;const o=sn(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:u,width:d,height:g}=e.getBoundingClientRect();if(a||t(),!d||!g)return;const m=zi(u),b=zi(o.clientWidth-(f+d)),y=zi(o.clientHeight-(u+g)),p=zi(f),h={rootMargin:-m+"px "+-b+"px "+-y+"px "+-p+"px",threshold:lr(0,Kr(1,c))||1};let v=!0;function I(O){const S=O[0].intersectionRatio;if(S!==c){if(!v)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function pI(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=ba(e),u=o||i?[...f?fi(f):[],...fi(t)]:[];u.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const d=f&&a?fI(f,n):null;let g=-1,m=null;s&&(m=new ResizeObserver(C=>{let[h]=C;h&&h.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let b,y=c?mr(e):null;c&&p();function p(){const C=mr(e);y&&(C.x!==y.x||C.y!==y.y||C.width!==y.width||C.height!==y.height)&&n(),y=C,b=requestAnimationFrame(p)}return n(),()=>{var C;u.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),d==null||d(),(C=m)==null||C.disconnect(),m=null,c&&cancelAnimationFrame(b)}}const hI=zb,mI=Qb,gI=Jb,yI=Bb,Dc=(e,t,n)=>{const r=new Map,o={platform:dI,...n},i={...o.platform,_c:r};return Hb(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 wI="react-tooltip-core-styles",bI="react-tooltip-base-styles",Mc={core:!1,base:!1};function kc({css:e,id:t=bI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Mc[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=wI),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)),Mc[n]=!0}const jc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[mI(Number(o)),yI({fallbackAxisSideDirection:"start"}),gI({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(vI({element:n,padding:5})),Dc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:f,y:u,placement:d,middlewareData:g})=>{var m,b;const y={left:`${f}px`,top:`${u}px`,border:a},{x:p,y:C}=(m=g.arrow)!==null&&m!==void 0?m:{x:0,y:0},h=(b={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&b!==void 0?b:"bottom",v=a&&{borderBottom:a,borderRight:a};let I=0;if(a){const O=`${a}`.match(/(\d+)px/);I=O!=null&&O[1]?Number(O[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...v,[h]:`-${4+I}px`},place:d}})):Dc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:f,y:u,placement:d})=>({tooltipStyles:{left:`${f}px`,top:`${u}px`},tooltipArrowStyles:{},place:d}))},Lc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),qc=(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},Kc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Rs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Rs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Kc(e)||!Kc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Rs(e[o],t[o]))},II=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"})},Uc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(II(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},CI=typeof window<"u"?w.useLayoutEffect:w.useEffect,Rt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},xI="DEFAULT_TOOLTIP_ID",OI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},_I=w.createContext({getTooltipData:()=>OI});function bd(e=xI){return w.useContext(_I).getTooltipData(e)}var Cr={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"},es={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 SI=({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:u=!1,positionStrategy:d="absolute",middlewares:g,wrapper:m,delayShow:b=0,delayHide:y=0,float:p=!1,hidden:C=!1,noArrow:h=!1,clickable:v=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:S=!1,openEvents:N,closeEvents:T,globalCloseEvents:A,imperativeModeOnly:D,style:J,position:K,afterShow:$,afterHide:B,disableTooltip:ae,content:re,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:L,setActiveAnchor:H,border:U,opacity:q,arrowColor:M,role:Z="tooltip"})=>{var ee;const W=w.useRef(null),te=w.useRef(null),X=w.useRef(null),de=w.useRef(null),j=w.useRef(null),[we,z]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=w.useState(!1),[Ze,$e]=w.useState(!1),[Ie,Mt]=w.useState(null),et=w.useRef(!1),bt=w.useRef(null),{anchorRefs:kt,setActiveAnchor:jt}=bd(t),tt=w.useRef(!1),[Ge,He]=w.useState([]),Fe=w.useRef(!1),Lt=u||f.includes("click"),pt=Lt||(N==null?void 0:N.click)||(N==null?void 0:N.dblclick)||(N==null?void 0:N.mousedown),an=N?{...N}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!N&&Lt&&Object.assign(an,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Zt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&Lt&&Object.assign(Zt,{mouseleave:!1,blur:!1,mouseout:!1});const It=A?{...A}:{escape:I||!1,scroll:O||!1,resize:S||!1,clickOutsideAnchor:pt||!1};D&&(Object.assign(an,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Zt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),CI(()=>(Fe.current=!0,()=>{Fe.current=!1}),[]);const Pe=Q=>{Fe.current&&(Q&&$e(!0),setTimeout(()=>{Fe.current&&(F==null||F(Q),ge===void 0&&Ve(Q))},10))};w.useEffect(()=>{if(ge===void 0)return()=>null;ge&&$e(!0);const Q=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(Q)}},[ge]),w.useEffect(()=>{if(Ee!==et.current)if(Rt(j),et.current=Ee,Ee)$==null||$();else{const Q=(ce=>{const le=ce.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,qe,Je]=le;return Number(qe)*(Je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));j.current=setTimeout(()=>{$e(!1),Mt(null),B==null||B()},Q+25)}},[Ee]);const cn=Q=>{z(ce=>Rs(ce,Q)?ce:Q)},Cn=(Q=b)=>{Rt(X),Ze?Pe(!0):X.current=setTimeout(()=>{Pe(!0)},Q)},ln=(Q=y)=>{Rt(de),de.current=setTimeout(()=>{tt.current||Pe(!1)},Q)},Wn=Q=>{var ce;if(!Q)return;const le=(ce=Q.currentTarget)!==null&&ce!==void 0?ce:Q.target;if(!(le!=null&&le.isConnected))return H(null),void jt({current:null});b?Cn():Pe(!0),H(le),jt({current:le}),Rt(de)},ht=()=>{v?ln(y||100):y?ln():Pe(!1),Rt(X)},un=({x:Q,y:ce})=>{var le;const qe={getBoundingClientRect:()=>({x:Q,y:ce,width:0,height:0,top:ce,left:Q,right:Q,bottom:ce})};jc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:qe,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:g,border:U}).then(Je=>{cn(Je)})},xn=Q=>{if(!Q)return;const ce=Q,le={x:ce.clientX,y:ce.clientY};un(le),bt.current=le},zn=Q=>{var ce;if(!Ee)return;const le=Q.target;le.isConnected&&(!((ce=W.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(qe=>qe==null?void 0:qe.contains(le))||(Pe(!1),Rt(X)))},On=qc(Wn,50),Ae=qc(ht,50),st=Q=>{Ae.cancel(),On(Q)},oe=()=>{On.cancel(),Ae()},me=w.useCallback(()=>{var Q,ce;const le=(Q=Ie==null?void 0:Ie.position)!==null&&Q!==void 0?Q:K;le?un(le):p?bt.current&&un(bt.current):L!=null&&L.isConnected&&jc({place:(ce=Ie==null?void 0:Ie.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:L,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:g,border:U}).then(qe=>{Fe.current&&cn(qe)})},[Ee,L,re,J,a,Ie==null?void 0:Ie.place,c,d,K,Ie==null?void 0:Ie.position,p]);w.useEffect(()=>{var Q,ce;const le=new Set(kt);Ge.forEach(ye=>{ae!=null&&ae(ye)||le.add({current:ye})});const qe=document.querySelector(`[id='${i}']`);qe&&!(ae!=null&&ae(qe))&&le.add({current:qe});const Je=()=>{Pe(!1)},mt=Uc(L),Xe=Uc(W.current);It.scroll&&(window.addEventListener("scroll",Je),mt==null||mt.addEventListener("scroll",Je),Xe==null||Xe.addEventListener("scroll",Je));let nt=null;It.resize?window.addEventListener("resize",Je):L&&W.current&&(nt=hI(L,W.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const gt=ye=>{ye.key==="Escape"&&Pe(!1)};It.escape&&window.addEventListener("keydown",gt),It.clickOutsideAnchor&&window.addEventListener("click",zn);const Te=[],_n=ye=>!!(ye!=null&&ye.target&&(L!=null&&L.contains(ye.target))),ko=ye=>{Ee&&_n(ye)||Wn(ye)},qt=ye=>{Ee&&_n(ye)&&ht()},Ni=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ti=["click","dblclick","mousedown","mouseup"];Object.entries(an).forEach(([ye,Kt])=>{Kt&&(Ni.includes(ye)?Te.push({event:ye,listener:st}):Ti.includes(ye)&&Te.push({event:ye,listener:ko}))}),Object.entries(Zt).forEach(([ye,Kt])=>{Kt&&(Ni.includes(ye)?Te.push({event:ye,listener:oe}):Ti.includes(ye)&&Te.push({event:ye,listener:qt}))}),p&&Te.push({event:"pointermove",listener:xn});const Ri=()=>{tt.current=!0},Ai=()=>{tt.current=!1,ht()},Fi=v&&(Zt.mouseout||Zt.mouseleave);return Fi&&((Q=W.current)===null||Q===void 0||Q.addEventListener("mouseover",Ri),(ce=W.current)===null||ce===void 0||ce.addEventListener("mouseout",Ai)),Te.forEach(({event:ye,listener:Kt})=>{le.forEach(ei=>{var Qn;(Qn=ei.current)===null||Qn===void 0||Qn.addEventListener(ye,Kt)})}),()=>{var ye,Kt;It.scroll&&(window.removeEventListener("scroll",Je),mt==null||mt.removeEventListener("scroll",Je),Xe==null||Xe.removeEventListener("scroll",Je)),It.resize?window.removeEventListener("resize",Je):nt==null||nt(),It.clickOutsideAnchor&&window.removeEventListener("click",zn),It.escape&&window.removeEventListener("keydown",gt),Fi&&((ye=W.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ri),(Kt=W.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ai)),Te.forEach(({event:ei,listener:Qn})=>{le.forEach(jo=>{var ti;(ti=jo.current)===null||ti===void 0||ti.removeEventListener(ei,Qn)})})}},[L,me,Ze,kt,Ge,N,T,A,Lt,b,y]),w.useEffect(()=>{var Q,ce;let le=(ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s)!==null&&ce!==void 0?ce:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const qe=new MutationObserver(Je=>{const mt=[],Xe=[];Je.forEach(nt=>{if(nt.type==="attributes"&&nt.attributeName==="data-tooltip-id"&&(nt.target.getAttribute("data-tooltip-id")===t?mt.push(nt.target):nt.oldValue===t&&Xe.push(nt.target)),nt.type==="childList"){if(L){const gt=[...nt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{Xe.push(...gt.filter(Te=>Te.matches(le))),Xe.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}gt.some(Te=>{var _n;return!!(!((_n=Te==null?void 0:Te.contains)===null||_n===void 0)&&_n.call(Te,L))&&($e(!1),Pe(!1),H(null),Rt(X),Rt(de),!0)})}if(le)try{const gt=[...nt.addedNodes].filter(Te=>Te.nodeType===1);mt.push(...gt.filter(Te=>Te.matches(le))),mt.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(mt.length||Xe.length)&&He(nt=>[...nt.filter(gt=>!Xe.includes(gt)),...mt])});return qe.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{qe.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,L]),w.useEffect(()=>{me()},[me]),w.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const Q=new ResizeObserver(()=>{setTimeout(()=>me())});return Q.observe(ne.current),()=>{Q.disconnect()}},[re,ne==null?void 0:ne.current]),w.useEffect(()=>{var Q;const ce=document.querySelector(`[id='${i}']`),le=[...Ge,ce];L&&le.includes(L)||H((Q=Ge[0])!==null&&Q!==void 0?Q:ce)},[i,Ge,L]),w.useEffect(()=>(be&&Pe(!0),()=>{Rt(X),Rt(de)}),[]),w.useEffect(()=>{var Q;let ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));He(le)}catch{He([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{X.current&&(Rt(X),Cn(b))},[b]);const Be=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,dn=Ee&&Object.keys(we.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:Q=>{if(Q!=null&&Q.anchorSelect)try{document.querySelector(Q.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${Q.anchorSelect}" is not a valid CSS selector`)}Mt(Q??null),Q!=null&&Q.delay?Cn(Q.delay):Pe(!0)},close:Q=>{Q!=null&&Q.delay?ln(Q.delay):Pe(!1)},activeAnchor:L,place:we.place,isOpen:!!(Ze&&!C&&Be&&dn)})),Ze&&!C&&Be?w.createElement(m,{id:t,role:Z,className:Pt("react-tooltip",Cr.tooltip,es.tooltip,es[o],n,`react-tooltip__place-${we.place}`,Cr[dn?"show":"closing"],dn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Cr.fixed,v&&Cr.clickable),onTransitionEnd:Q=>{Rt(j),Ee||Q.propertyName!=="opacity"||($e(!1),Mt(null),B==null||B())},style:{...J,...we.tooltipStyles,opacity:q!==void 0&&dn?q:void 0},ref:W},Be,w.createElement(m,{className:Pt("react-tooltip-arrow",Cr.arrow,es.arrow,r,h&&Cr.noArrow),style:{...we.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:te})):null},EI=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),NI=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:u=10,wrapper:d="div",children:g=null,events:m=["hover"],openOnClick:b=!1,positionStrategy:y="absolute",middlewares:p,delayShow:C=0,delayHide:h=0,float:v=!1,hidden:I=!1,noArrow:O=!1,clickable:S=!1,closeOnEsc:N=!1,closeOnScroll:T=!1,closeOnResize:A=!1,openEvents:D,closeEvents:J,globalCloseEvents:K,imperativeModeOnly:$=!1,style:B,position:ae,isOpen:re,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:be,opacity:F,arrowColor:L,setIsOpen:H,afterShow:U,afterHide:q,disableTooltip:M,role:Z="tooltip"},ee)=>{const[W,te]=w.useState(r),[X,de]=w.useState(o),[j,we]=w.useState(f),[z,Ee]=w.useState(c),[Ve,Ze]=w.useState(u),[$e,Ie]=w.useState(C),[Mt,et]=w.useState(h),[bt,kt]=w.useState(v),[jt,tt]=w.useState(I),[Ge,He]=w.useState(d),[Fe,Lt]=w.useState(m),[pt,an]=w.useState(y),[Zt,It]=w.useState(null),[Pe,cn]=w.useState(null),Cn=w.useRef(ge),{anchorRefs:ln,activeAnchor:Wn}=bd(e),ht=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((st,oe)=>{var me;return oe.startsWith("data-tooltip-")&&(st[oe.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(oe))!==null&&me!==void 0?me:null),st},{}),un=Ae=>{const st={place:oe=>{var me;we((me=oe)!==null&&me!==void 0?me:f)},content:oe=>{te(oe??r)},html:oe=>{de(oe??o)},variant:oe=>{var me;Ee((me=oe)!==null&&me!==void 0?me:c)},offset:oe=>{Ze(oe===null?u:Number(oe))},wrapper:oe=>{var me;He((me=oe)!==null&&me!==void 0?me:d)},events:oe=>{const me=oe==null?void 0:oe.split(" ");Lt(me??m)},"position-strategy":oe=>{var me;an((me=oe)!==null&&me!==void 0?me:y)},"delay-show":oe=>{Ie(oe===null?C:Number(oe))},"delay-hide":oe=>{et(oe===null?h:Number(oe))},float:oe=>{kt(oe===null?v:oe==="true")},hidden:oe=>{tt(oe===null?I:oe==="true")},"class-name":oe=>{It(oe)}};Object.values(st).forEach(oe=>oe(null)),Object.entries(Ae).forEach(([oe,me])=>{var Be;(Be=st[oe])===null||Be===void 0||Be.call(st,me)})};w.useEffect(()=>{te(r)},[r]),w.useEffect(()=>{de(o)},[o]),w.useEffect(()=>{we(f)},[f]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{Ze(u)},[u]),w.useEffect(()=>{Ie(C)},[C]),w.useEffect(()=>{et(h)},[h]),w.useEffect(()=>{kt(v)},[v]),w.useEffect(()=>{tt(I)},[I]),w.useEffect(()=>{an(y)},[y]),w.useEffect(()=>{Cn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),w.useEffect(()=>{var Ae;const st=new Set(ln);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ce=>{st.add({current:ce})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&st.add({current:me}),!st.size)return()=>null;const Be=(Ae=Pe??me)!==null&&Ae!==void 0?Ae:Wn.current,dn=new MutationObserver(ce=>{ce.forEach(le=>{var qe;if(!Be||le.type!=="attributes"||!(!((qe=le.attributeName)===null||qe===void 0)&&qe.startsWith("data-tooltip-")))return;const Je=ht(Be);un(Je)})}),Q={attributes:!0,childList:!1,subtree:!1};if(Be){const ce=ht(Be);un(ce),dn.observe(Be,Q)}return()=>{dn.disconnect()}},[ln,Wn,Pe,t,n]),w.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!Lc("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Lc("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let xn=g;const zn=w.useRef(null);if(i){const Ae=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||W||null,activeAnchor:Pe});xn=Ae?w.createElement("div",{ref:zn,className:"react-tooltip-content-wrapper"},Ae):null}else W&&(xn=W);X&&(xn=w.createElement(EI,{content:X}));const On={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Pt(s,Zt),classNameArrow:a,content:xn,contentWrapperRef:zn,place:j,variant:z,offset:Ve,wrapper:Ge,events:Fe,openOnClick:b,positionStrategy:pt,middlewares:p,delayShow:$e,delayHide:Mt,float:bt,hidden:jt,noArrow:O,clickable:S,closeOnEsc:N,closeOnScroll:T,closeOnResize:A,openEvents:D,closeEvents:J,globalCloseEvents:K,imperativeModeOnly:$,style:B,position:ae,isOpen:re,defaultIsOpen:ne,border:be,opacity:F,arrowColor:L,setIsOpen:H,afterShow:U,afterHide:q,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Ae=>cn(Ae),role:Z};return w.createElement(SI,{...On})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||kc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||kc({css:`
|
|
51
|
-
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function TI(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function RI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:TI()}),l.jsx(NI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Id=w.createContext(null);function Cd(){const e=w.useContext(Id);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const xd=w.createContext(()=>{});function AI(){const e=w.useContext(xd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Od=Symbol.for("immer-nothing"),Vc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state"),FI=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=FI[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 Hr=Object.getPrototypeOf;function Br(e){return!!e&&!!e[St]}function gr(e){var t;return e?_d(e)||Array.isArray(e)||!!e[Vc]||!!((t=e.constructor)!=null&&t[Vc])||No(e)||To(e):!1}var PI=Object.prototype.constructor.toString();function _d(e){if(!e||typeof e!="object")return!1;const t=Hr(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)===PI}function mo(e,t){Eo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Eo(e){const t=e[St];return t?t.type_:Array.isArray(e)?1:No(e)?2:To(e)?3:0}function As(e,t){return Eo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sd(e,t,n){const r=Eo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function DI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function No(e){return e instanceof Map}function To(e){return e instanceof Set}function Zn(e){return e.copy_||e.base_}function Fs(e,t){if(No(e))return new Map(e);if(To(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=_d(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[St];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(Hr(e),r)}else{const r=Hr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ia(e,t=!1){return Ro(e)||Br(e)||!gr(e)||(Eo(e)>1&&(e.set=e.add=e.clear=e.delete=MI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ia(r,!0))),e}function MI(){wt(2)}function Ro(e){return Object.isFrozen(e)}var kI={};function yr(e){const t=kI[e];return t||wt(0,e),t}var pi;function Ed(){return pi}function jI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $c(e,t){t&&(yr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ps(e){Ds(e),e.drafts_.forEach(LI),e.drafts_=null}function Ds(e){e===pi&&(pi=e.parent_)}function Hc(e){return pi=jI(pi,e)}function LI(e){const t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[St].modified_&&(Ps(t),wt(4)),gr(e)&&(e=go(t,e),t.parent_||yo(t,e)),t.patches_&&yr("Patches").generateReplacementPatches_(n[St].base_,e,t.patches_,t.inversePatches_)):e=go(t,n,[]),Ps(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Od?e:void 0}function go(e,t,n){if(Ro(t))return t;const r=t[St];if(!r)return mo(t,(o,i)=>Jc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return yo(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),mo(i,(a,c)=>Jc(e,r,o,a,c,n,s)),yo(e,o,!1),n&&e.patches_&&yr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Jc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&wt(5),Br(o)){const a=i&&t&&t.type_!==3&&!As(t.assigned_,r)?i.concat(r):void 0,c=go(e,o,a);if(Sd(n,r,c),Br(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(gr(o)&&!Ro(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;go(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&yo(e,o)}}function yo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ia(t,n)}function qI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ed(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ca;n&&(o=[r],i=hi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ca={get(e,t){if(t===St)return e;const n=Zn(e);if(!As(n,t))return KI(e,n,t);const r=n[t];return e.finalized_||!gr(r)?r:r===ts(e.base_,t)?(ns(e),e.copy_[t]=ks(r,e)):r},has(e,t){return t in Zn(e)},ownKeys(e){return Reflect.ownKeys(Zn(e))},set(e,t,n){const r=Nd(Zn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ts(Zn(e),t),i=o==null?void 0:o[St];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(DI(n,o)&&(n!==void 0||As(e.base_,t)))return!0;ns(e),Ms(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 ts(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ns(e),Ms(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Zn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return Hr(e.base_)},setPrototypeOf(){wt(12)}},hi={};mo(Ca,(e,t)=>{hi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});hi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),hi.set.call(this,e,t,void 0)};hi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),Ca.set.call(this,e[0],t,n,e[0])};function ts(e,t){const n=e[St];return(n?Zn(n):e)[t]}function KI(e,t,n){var o;const r=Nd(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Nd(e,t){if(!(t in e))return;let n=Hr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Hr(n)}}function Ms(e){e.modified_||(e.modified_=!0,e.parent_&&Ms(e.parent_))}function ns(e){e.copy_||(e.copy_=Fs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var UI=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,u=>n.call(this,u,...f))}}typeof n!="function"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let o;if(gr(t)){const i=Hc(this),s=ks(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ps(i):Ds(i)}return $c(i,r),Bc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Od&&(o=void 0),this.autoFreeze_&&Ia(o,!0),r){const i=[],s=[];yr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else wt(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){gr(e)||wt(8),Br(e)&&(e=VI(e));const t=Hc(this),n=ks(e,void 0);return n[St].isManual_=!0,Ds(t),n}finishDraft(e,t){const n=e&&e[St];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return $c(r,t),Bc(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=yr("Patches").applyPatches_;return Br(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ks(e,t){const n=No(e)?yr("MapSet").proxyMap_(e,t):To(e)?yr("MapSet").proxySet_(e,t):qI(e,t);return(t?t.scope_:Ed()).drafts_.push(n),n}function VI(e){return Br(e)||wt(10,e),Td(e)}function Td(e){if(!gr(e)||Ro(e))return e;const t=e[St];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fs(e,!0);return mo(n,(r,o)=>{Sd(n,r,Td(o))}),t&&(t.finalized_=!1),n}var Et=new UI,Ft=Et.produce;Et.produceWithPatches.bind(Et);Et.setAutoFreeze.bind(Et);Et.setUseStrictShallowCopy.bind(Et);Et.applyPatches.bind(Et);Et.createDraft.bind(Et);Et.finishDraft.bind(Et);const Rd=w.createContext(void 0),$I={};function xa(){const e=w.useContext(Rd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function HI({children:e}){const{installation:t}=ot(),{hydratedRevision:n,loading:r}=Yr(),[o,i]=w.useState($I),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Mv(n,s,i)},[n,r,s,o]);const a=w.useCallback((m,b)=>{i(y=>Ft(y,p=>{p[m]=Ft(p[m],b)}))},[i]),c=w.useCallback((m,b)=>{i(y=>Ft(y,p=>{p[m]=b}))},[i]),f=w.useCallback(()=>{i(Ft(m=>{const b=m.other.write;b&&(b.isWriteModified=!1)}))},[i]),u=w.useCallback(m=>{i(Ft(b=>{var p;const y=(p=b[m])==null?void 0:p.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1,y.isValueMappingsModified=!1)}))},[i]),d=w.useCallback(m=>{m===pr?f():u(m)},[u,f]),g=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,a]);return l.jsx(Rd.Provider,{value:g,children:e})}const Yt=()=>{const{appName:e}=Ne(),{objectConfigurationsState:t,setConfigureState:n}=xa(),{selectedObjectName:r}=Cd(),o=mu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function BI(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=!lu(o,n);e.read.isRequiredMapFieldsModified=s}}function mi(e,t,n){t(e,r=>BI(r,n))}const JI="Each field must be mapped to a unique value";function Oa({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Yt(),[s,a]=w.useState(!0),{isError:c,removeError:f,getError:u}=Dt(),d=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,g=d==null?void 0:d[e.mapToName];w.useEffect(()=>{e._default&&!g&&o&&r&&mi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,g,r]);const m=w.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),b=l.jsx(ud,{disabled:s,items:m,selectedValue:g||null,onSelectedItemChange:v=>{t({target:{name:e.mapToName,value:v==null?void 0:v.value}})},placeholder:"Please select one",style:{width:"100%"}}),y=w.useCallback(()=>{o&&(mi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:p,errorMessage:C}=w.useMemo(()=>{const v=u(ue.MAPPING,o),I=Array.isArray(v)&&v.length>0&&v.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?JI:""}},[o,u,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(RI,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,l.jsx(Qe,{type:"button",variant:"ghost",onClick:y,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",C," "]},e.mapToName)]})}const WI="_formControl_9qd8d_1",zI="_formLabel_9qd8d_5",QI="_formLabelRequired_9qd8d_11",GI="_formInput_9qd8d_16",XI="_formInputInvalid_9qd8d_20",YI="_formError_9qd8d_24",ZI="_disabled_9qd8d_30",Yn={formControl:WI,formLabel:zI,formLabelRequired:QI,formInput:GI,formInputInvalid:XI,formError:YI,disabled:ZI};function Ao({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Pt(Yn.formControl,{[Yn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Pt(Yn.formLabel,{[Yn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Pt(Yn.formInput,{[Yn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Yn.formError,role:"alert",children:i})]})}function Ad({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function eC({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(Ao,{id:r.mapToName,children:l.jsx(Oa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tC(){var b,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Dt(),s=((b=t==null?void 0:t.read)==null?void 0:b.allFields)||[],{fieldMapping:a}=ot(),c=(y=t==null?void 0:t.read)==null?void 0:y.selectedFieldMappings,f=p=>{const{value:C,name:h}=p.target;!C||Ad({selectedFieldMappings:c,selectedObjectName:e,fieldName:h,fieldValue:C,setError:i})||(e&&mi(e,n,[{field:h,value:C}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},u=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),d=w.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(v=>!u.some(I=>I.mapToName===v.mapToName))},[t,u]),g=u.length>0;return d.length>0||g?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(p=>l.jsx(Ao,{id:p.mapToName,children:l.jsx(Oa,{allFields:s,field:p,onSelectChange:f})},p.mapToName)),g&&l.jsx(eC,{dynamicFieldMappings:u,onSelectChange:f,allFields:s})]})]}):null}function nC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Dt(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=u=>{const{value:d,name:g}=u.target;!d||Ad({selectedFieldMappings:s,selectedObjectName:e,fieldName:g,fieldValue:d,setError:i})||(e&&mi(e,n,[{field:g,value:d}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=w.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(u=>{var d;return l.jsx(Ao,{id:u.mapToName,isInvalid:r(ue.MAPPING,u.mapToName),errorMessage:"* required",children:l.jsx(Oa,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const rC=(e,t)=>e.filter(n=>!t.has(n));function iC(){var g,m,b;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{fieldMapping:r}=ot(),o=((g=t==null?void 0:t.read)==null?void 0:g.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((b=t==null?void 0:t.read)==null?void 0:b.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(y=>!y.fieldName):[],f=s.concat(c,a).map(y=>y.mapToName),u=new Set(f),d=rC(i,u);w.useEffect(()=>{e&&d.length&&mi(e,n,d.map(y=>({field:y,value:null})))},[e,n,d])}const oC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function sC({children:e,style:t}){return l.jsx(wn,{style:{...oC,...t},children:e})}function aC(){var f,u,d;const{project:e}=Ne(),{hydratedRevision:t}=Yr(),{selectedObjectName:n}=Yt(),{providerName:r}=lt(),o=e==null?void 0:e.appName,i=(d=(u=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:u.objects)==null?void 0:d.find(g=>g.objectName===n),s=(i==null?void 0:i.displayName)||n&&Vn(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Vn(a);return c&&o&&r?l.jsx(sC,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to"," ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Wc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Wc(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():Wc(e[o],null)}}}}function Jr(...e){return k.useCallback(Fd(...e),e)}function Fo(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),c=n.length;n=[...n,s];const f=d=>{var C;const{scope:g,children:m,...b}=d,y=((C=g==null?void 0:g[e])==null?void 0:C[c])||a,p=k.useMemo(()=>b,Object.values(b));return l.jsx(y.Provider,{value:p,children:m})};f.displayName=i+"Provider";function u(d,g){var y;const m=((y=g==null?void 0:g[e])==null?void 0:y[c])||a,b=k.useContext(m);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[f,u]}const o=()=>{const i=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,cC(o,...t)]}function cC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:f})=>{const d=c(i)[`__scope${f}`];return{...a,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zt(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 gi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},lC=k[" useInsertionEffect ".trim().toString()]||gi;function _a({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=uC({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const u=k.useRef(e!==void 0);k.useEffect(()=>{const d=u.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.`),u.current=a},[a,r])}const f=k.useCallback(u=>{var d;if(a){const g=dC(u)?u(e):u;g!==e&&((d=s.current)==null||d.call(s,g))}else i(u)},[a,e,i,s]);return[c,f]}function uC({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return lC(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function dC(e){return typeof e=="function"}function fC(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function pC(e){const[t,n]=k.useState(void 0);return gi(()=>{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 hC(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Sa=e=>{const{present:t,children:n}=e,r=mC(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Jr(r.ref,gC(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};Sa.displayName="Presence";function mC(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=hC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const f=Qi(r.current);i.current=a==="mounted"?f:"none"},[a]),gi(()=>{const f=r.current,u=o.current;if(u!==e){const g=i.current,m=Qi(f);e?c("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(u&&g!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),gi(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,d=m=>{const y=Qi(r.current).includes(m.animationName);if(m.target===t&&y&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},g=m=>{m.target===t&&(i.current=Qi(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Qi(e){return(e==null?void 0:e.animationName)||"none"}function gC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function js(e){const t=yC(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),c=a.find(wC);if(c){const f=c.props.children,u=a.map(d=>d===c?k.Children.count(f)>1?k.Children.only(null):k.isValidElement(f)?f.props.children:null:d);return l.jsx(t,{...s,ref:o,children:k.isValidElement(f)?k.cloneElement(f,void 0,u):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function yC(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=IC(o),a=bC(i,o.props);return o.type!==k.Fragment&&(a.ref=r?Fd(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vC=Symbol("radix.slottable");function wC(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vC}function bC(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const 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 IC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var CC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],In=CC.reduce((e,t)=>{const n=js(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Po="Checkbox",[xC,j0]=Fo(Po),[OC,Ea]=xC(Po);function _C(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:u="on",internal_do_not_use_render:d}=e,[g,m]=_a({prop:n,defaultProp:o??!1,onChange:c,caller:Po}),[b,y]=k.useState(null),[p,C]=k.useState(null),h=k.useRef(!1),v=b?!!s||!!b.closest("form"):!0,I={checked:g,disabled:i,setChecked:m,control:b,setControl:y,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:h,required:f,defaultChecked:Un(o)?!1:o,isFormControl:v,bubbleInput:p,setBubbleInput:C};return l.jsx(OC,{scope:t,...I,children:SC(d)?d(I):r})}var Pd="CheckboxTrigger",Dd=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:g,isFormControl:m,bubbleInput:b}=Ea(Pd,e),y=Jr(o,u),p=k.useRef(c);return k.useEffect(()=>{const C=i==null?void 0:i.form;if(C){const h=()=>d(p.current);return C.addEventListener("reset",h),()=>C.removeEventListener("reset",h)}},[i,d]),l.jsx(In.button,{type:"button",role:"checkbox","aria-checked":Un(c)?"mixed":c,"aria-required":f,"data-state":Ld(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:y,onKeyDown:zt(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:zt(n,C=>{d(h=>Un(h)?!0:!h),b&&m&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})})});Dd.displayName=Pd;var Na=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:u,...d}=e;return l.jsx(_C,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Dd,{...d,ref:t,__scopeCheckbox:n}),g&&l.jsx(jd,{__scopeCheckbox:n})]})})});Na.displayName=Po;var Md="CheckboxIndicator",Ta=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Ea(Md,n);return l.jsx(Sa,{present:r||Un(i.checked)||i.checked===!0,children:l.jsx(In.span,{"data-state":Ld(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ta.displayName=Md;var kd="CheckboxBubbleInput",jd=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:u,form:d,bubbleInput:g,setBubbleInput:m}=Ea(kd,e),b=Jr(n,m),y=fC(i),p=pC(r);k.useEffect(()=>{const h=g;if(!h)return;const v=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(v,"checked").set,S=!o.current;if(y!==i&&O){const N=new Event("click",{bubbles:S});h.indeterminate=Un(i),O.call(h,Un(i)?!1:i),h.dispatchEvent(N)}},[g,y,i,o]);const C=k.useRef(Un(i)?!1:i);return l.jsx(In.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??C.current,required:a,disabled:c,name:f,value:u,form:d,...t,tabIndex:-1,ref:b,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});jd.displayName=kd;function SC(e){return typeof e=="function"}function Un(e){return e==="indeterminate"}function Ld(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function qd(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var EC=["color"],Kd=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=qd(e,EC);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),NC=["color"],TC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=qd(e,NC);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const RC="_checkboxGroupContainer_1ya1t_1",AC="_stack_1ya1t_6",FC="_selectAllContainer_1ya1t_11",PC="_fieldContainer_1ya1t_18",DC="_checkbox_1ya1t_1",Wr={checkboxGroupContainer:RC,stack:AC,selectAllContainer:FC,fieldContainer:PC,checkbox:DC};function Ud({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Wr.fieldContainer,children:[l.jsx(Na,{className:Wr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ta,{children:l.jsx(Kd,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Vd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Wr.selectAllContainer,children:[l.jsx(Na,{className:Wr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Ta,{children:[o&&l.jsx(TC,{}),t===!0&&l.jsx(Kd,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function $d({children:e}){return l.jsx("div",{className:Wr.checkboxGroupContainer,children:e})}function Hd({children:e}){return l.jsx("div",{className:Wr.stack,children:e})}function MC(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=!lu(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function zc(e,t,n,r){t(e,o=>MC(o,n,r))}function kC(){var d,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Yt(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(m,b)=>{m!=="indeterminate"&&r&&t&&zc(r,n,b,m)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,a=m=>{r&&s&&s.forEach(b=>{$n(b)||zc(r,n,b.fieldName,m)})},c=!!(s&&s.length>0),f=Object.keys(o||{}).length===(s==null?void 0:s.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`${e} reads the following optional fields`}),l.jsxs($d,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Vd,{id:"select-all-fields",isChecked:f,label:"Select all",onCheckedChange:a,isIndeterminate:u}),l.jsx(Hd,{children:s.map(m=>$n(m)?null:l.jsx(Ud,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:b=>i(b,m.fieldName)},m.fieldName))})]})]})}function jC(){return l.jsx(kC,{})}const LC={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 qC({children:e,style:t,...n}){return l.jsx("span",{style:{...LC,...t},...n,children:e})}function KC(){var n,r,o;const{configureState:e}=Yt(),{appName:t}=Ne();return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`${t} reads the following fields`}),l.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=>$n(i)?null:l.jsx(qC,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function UC(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 Bd(e,t,n,r,o){t(e,i=>UC(i,e,n,r,o))}function VC(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function $C({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function HC({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var O;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Yt(),[c,f]=w.useState(!0),{getError:u,setError:d,resetBoundary:g,isError:m,removeError:b}=Dt(),y=w.useMemo(()=>{var S,N;return((N=(S=i==null?void 0:i.read)==null?void 0:S.selectedValueMappings)==null?void 0:N[n])||{}},[(O=i==null?void 0:i.read)==null?void 0:O.selectedValueMappings,n]),p=w.useMemo(()=>y==null?void 0:y[e.mappedValue],[y,e.mappedValue]);w.useEffect(()=>{f(!1)},[e,a,s,p,i]);const C=w.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),h=w.useCallback(S=>{if(S){if(Object.values(y).some(N=>N===S.value&&N!==p)){const N=[...Object.entries(y).filter(([T,A])=>A===S.value&&A!==p).map(([T])=>T),e.mappedValue];d(ue.VALUE_MAPPING,n,N);return}u(ue.VALUE_MAPPING,n)&&g(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,y,p,n,e.mappedValue,g,d,u]),v=w.useMemo(()=>l.jsx(ud,{disabled:c,items:C,selectedValue:p||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,C,h,o]),I=w.useCallback(()=>{s&&(Bd(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&b(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,b]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,l.jsx(Qe,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function BC(){var m,b,y;const{fieldMapping:e}=ot(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),{isError:o,removeError:i,getError:s}=Dt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(b=n==null?void 0:n.read)==null?void 0:b.selectedValueMappings,f=(y=n==null?void 0:n.read)==null?void 0:y.isValueMappingsModified,u=w.useRef(!1),d=w.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(C=>C.mappedValues).map(C=>({...C})):[];if(a)for(let C=0;C<p.length;C+=1){const{mapToName:h}=p[C];a!=null&&a[h]&&(p[C].fieldName=a[h])}return p},[t,e,a]),g=w.useCallback(p=>{const{value:C,name:h,fieldName:v}=p.target;C&&(t&&Bd(t,r,h,C,v),o(ue.VALUE_MAPPING,h)&&i(ue.VALUE_MAPPING,h))},[t,r,o,i]);return w.useEffect(()=>{var p;if(t&&c){const C=((p=e==null?void 0:e[t])==null?void 0:p.filter(v=>v.fieldName&&v.mappedValues.length>0))||[];C.every(v=>{const I=c[v.fieldName]||{};return Object.keys(I).length===Object.keys(v.mappedValues).length})&&C.length>0?!f&&!u.current&&(VC(t,r,!0),u.current=!0):u.current=!1}},[c,d,t,r,e,f]),d!=null&&d.length?l.jsx(l.Fragment,{children:d.map(p=>{var S,N,T;if(!p.fieldName)return null;const C=(N=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:N[p.fieldName],h=C==null?void 0:C.valueType;if(!["singleSelect","multiSelect"].includes(h))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const v=C==null?void 0:C.values;if(!v)return null;const I=Object.keys(v).length,O=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==O?(console.error("field values and the values to be mapped are not of the same length",p,v),null):l.jsxs(l.Fragment,{children:[l.jsx($C,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(Ao,{id:p.mapToName||p.fieldName,children:(T=p==null?void 0:p.mappedValues)==null?void 0:T.map(A=>{var $,B,ae;const D=s(ue.VALUE_MAPPING,p.fieldName),J=Array.isArray(D)&&D.includes(A.mappedValue),K=((ae=(B=($=n==null?void 0:n.read)==null?void 0:$.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ae.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(HC,{allValueOptions:K,mappedValue:A,onSelectChange:g,fieldName:(p==null?void 0:p.fieldName)||"",hasError:J},`${A.mappedValue}-${p.fieldName}`),J&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},A.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function JC(){return iC(),l.jsxs(l.Fragment,{children:[l.jsx(aC,{}),l.jsx(KC,{}),l.jsx(nC,{}),l.jsx(tC,{}),l.jsx(BC,{}),l.jsx(jC,{})]})}function WC(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=!Fv(a,s);e.write.isWriteModified=f}}}function Qc(e,t,n,r){t(e,o=>{WC(o,n,r)})}function zC(){var d,g,m,b;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(y,p)=>{y!=="indeterminate"&&t&&n&&Qc(t,r,p,y)},a=y=>{var p,C;t&&n&&((C=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||C.forEach(h=>{Qc(t,r,h.objectName,y)}))},c=!!i,f=Object.keys(o||{}).length===((b=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:b.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`Allow ${e} to write to these objects`}),l.jsxs($d,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Vd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:u,isChecked:f,label:"Select all"}),l.jsx(Hd,{children:i.map(y=>l.jsx(Ud,{id:y.objectName,onCheckedChange:p=>s(p,y.objectName),isChecked:!!(o!=null&&o[y.objectName]),label:y.displayName},y.objectName))})]})]})}function QC(){return l.jsx(l.Fragment,{children:l.jsx(zC,{})})}const GC="_authenticationRow_cjz1t_1",XC="_field_cjz1t_8",YC="_value_cjz1t_12",rs={authenticationRow:GC,field:XC,value:YC};function Gc({label:e,value:t}){return l.jsxs("div",{className:rs.authenticationRow,children:[l.jsx("div",{className:rs.field,children:e}),l.jsx("div",{className:rs.value,children:t})]})}function ZC(){const{selectedConnection:e}=Xt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Connection details"}),l.jsxs("div",{style:{paddingBottom:"1rem"},children:[l.jsx(Gc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(Gc,{label:"Status",value:e==null?void 0:e.status})]})]})}const ex=()=>{const e=it(),t=Le();return vn({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."),Ue(n)}})};function Jd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ne(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=ot(),[c,f]=w.useState(!1),u=!r||!o||!(i!=null&&i.id)||c,d=ex(),g=async()=>{u||(f(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),d.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=c?"Uninstalling...":e,b=l.jsx(Qe,{type:"button",onClick:g,disabled:u,variant:t,style:n,children:m});return i!=null&&i.id?b:null}function tx(){const{installation:e}=ot(),{providerName:t}=lt();return e?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Uninstall entire integration"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?l.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."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Jd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function nx(){return l.jsxs(l.Fragment,{children:[l.jsx(ZC,{}),l.jsx(Xs,{}),l.jsx(tx,{})]})}function Wd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,N,T,A;const{installation:i}=ot(),{hydratedRevision:s,loading:a}=Yr(),{configureState:c,selectedObjectName:f}=Yt(),u=i==null?void 0:i.config,d=u&&f&&!!ou(u,f)||!1,g=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isRequiredMapFieldsModified)||((T=c==null?void 0:c.read)==null?void 0:T.isValueMappingsModified),m=(A=c==null?void 0:c.write)==null?void 0:A.isWriteModified,C=a||n||!c||!f||!(g||m||r||f!==pr&&!d),h=f===pr,v=f===oo,I=l.jsx(Qe,{type:"submit",disabled:C,children:r?"Install":"Save"}),O=l.jsx(Qe,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?l.jsx(ui,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!v&&l.jsxs(l.Fragment,{children:[I,O]})}),l.jsxs(wn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Ci,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ui,{}),s&&!h&&!v&&l.jsx(JC,{}),s&&h&&!v&&l.jsx(QC,{}),!a&&v&&l.jsx(nx,{})]})]})}const zd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=ot(),{hydratedRevision:s,loading:a}=Yr(),{selectedObjectName:c}=Cd(),{selectedConnection:f}=Xt(),u=xl(),{projectId:d}=Ne(),{resetBoundary:g,setErrors:m,setError:b,getError:y}=Dt(),{resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:h}=xa(),v=mu(c||"",C),{onNextIncompleteTab:I}=AI(),O=w.useCallback(()=>{g(ue.INSTALLATION_MUTATION)},[g]),S=w.useCallback(T=>T?A=>{b(ue.INSTALLATION_MUTATION,T,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[b]),N=w.useCallback(T=>T?y(ue.INSTALLATION_MUTATION,T):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:u,projectId:d,resetBoundary:g,setErrors:m,setMutateInstallationError:S,getMutateInstallationError:N,resetMutateInstallationErrorState:O,resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:h,configureState:v,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},rx=void 0;function ix(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:f,resetBoundary:u,setErrors:d,setMutateInstallationError:g,getMutateInstallationError:m,resetMutateInstallationErrorState:b,resetConfigureState:y,objectConfigurationsState:p,resetPendingConfigurationState:C,configureState:h,onInstallSuccess:v,onNextIncompleteTab:I}=zd(),[O,S]=w.useState(!1),N=s===pr,T=m(s),A=w.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&du(o,rx,s,y)},[u,o,i,s,y]);w.useEffect(()=>{!h&&(o!=null&&o.content)&&!i&&A()},[h,p,o,i,A]);const D=()=>{b();const{requiredMapFields:$,selectedFieldMappings:B}=(h==null?void 0:h.read)||{},{errorList:ae}=cu($,B,d);ae.length>0||(s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),Lv(f,e,t,n,a.id,s,c,o,h,g(s),r,v).finally(()=>{S(!1),C(s),I()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},J=()=>{b(),s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),Uv(f,e,t,n,a.id,c,o,h,g(s),r,v).finally(()=>{S(!1),C(s),I()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},K=$=>{$.preventDefault(),N?J():D()};return l.jsx(Wd,{errorMsg:T,isCreateMode:!0,isLoading:O,onSave:K,onReset:A})}function ox({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const f={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Iv(i)}`],installation:{config:e}}};return Hs().installationApi.updateInstallation(f,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(u=>{s(u),a==null||a(u.id,u.config)}).catch(u=>{Ue(u,c)})}const sx=(e,t,n,r,o,i)=>{const s=fu(e),a=pu(e),c=hu(e),f={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return Ii(o)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},ax=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=sx(i,r||"",a,a.schedule,c,a.backfill);return d?ox({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:f,setInstallation:s,onUpdateSuccess:u}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},cx=(e,t)=>{const r={content:{write:{objects:yu(e)}}};return Ii(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},lx=(e,t,n,r,o,i,s,a,c)=>{const f=cx(o,i);if(!f)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const u={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:f}}};return Hs().installationApi.updateInstallation(u,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{a(d),c==null||c(d.id,d.config)}).catch(d=>{Ue(d,s)})};function ux({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:f,setMutateInstallationError:u,getMutateInstallationError:d,resetConfigureState:g,resetPendingConfigurationState:m,configureState:b,onUpdateSuccess:y,onNextIncompleteTab:p}=zd(),[C,h]=w.useState(!1),v=i===pr,I=d(i),{config:O}=e,S=w.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&du(r,O,i,g)},[c,r,o,i,O,g]);w.useEffect(()=>{b||S()},[b,S]);const N=w.useMemo(()=>{var K,$,B;return(B=($=(K=r==null?void 0:r.content)==null?void 0:K.read)==null?void 0:$.objects)==null?void 0:B.find(ae=>(ae==null?void 0:ae.objectName)===i)},[r,i]),T=()=>{const{requiredMapFields:J,selectedFieldMappings:K}=(b==null?void 0:b.read)||{},{errorList:$}=cu(J,K,f);$.length>0||(r&&e&&i&&s&&a&&N?(h(!0),ax(a,t.id,e.id,i,s,b,n,N,r,u(i),y).finally(()=>{h(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},A=()=>{e&&i&&s&&a&&r?(h(!0),lx(a,t.id,e.id,s,b,r,u(i),n,y).finally(()=>{h(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},D=J=>{J.preventDefault(),v?A():T()};return l.jsx(Wd,{errorMsg:I,onSave:D,onReset:S,isLoading:C})}function dx(){const{integrationObj:e,installation:t}=ot();return e?t&&e?l.jsx(ux,{installation:t,integrationObj:e}):l.jsx(ix,{}):l.jsx(Yl,{message:"We can't load the integration"})}const Qd=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function fx(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ra({text:e,children:t}){return l.jsx(Gr,{children:l.jsxs(wn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(fx,{}),l.jsx("p",{children:e}),t]})})}function px({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Ra,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Jd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const hx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function mx({children:e}){var O;const t=w.useRef(!1),{projectId:n}=Ne(),{hydratedRevision:r,loading:o}=Yr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:u}=ot(),{mutate:d,isIdle:g,isPending:m,error:b,errorMsg:y}=Qd(),{selectedConnection:p,isConnectionsLoading:C}=Xt(),h=o||m||C,v=(O=r==null?void 0:r.content)==null?void 0:O.provider,I=hx(r);return w.useEffect(()=>{var S;if(!h&&!C&&r&&I&&!s&&p&&(i!=null&&i.id)&&!u&&v){const N={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:v}}}};Ii(r)===!0&&(N.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),g&&!t.current&&(d(N,{onSuccess:T=>{f==null||f(T==null?void 0:T.id,T.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,c,h,f,u,C,v,d,g]),I&&v&&s?l.jsx(px,{provider:v}):b?l.jsx(Wt,{message:y??"Create installation failed"}):i?h?l.jsx(Xr,{}):l.jsx("div",{children:e}):l.jsx(Wt,{message:"We can't load the integration"})}function Do(){const e=it(),t=Le();return vn({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"),Ue(n)}})}function gx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.useCallback(d=>{var y;const{apiKey:g,providerMetadata:m}=d,b={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(y=m==null?void 0:m.workspace)==null?void 0:y.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:g,...m&&{providerMetadata:m}}};f.mutate(b)},[c,i,o,r,n,e,f]);return a===null?l.jsx(aw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function yx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.useCallback(d=>{var p;const{user:g,pass:m,providerMetadata:b}=d,y={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=b==null?void 0:b.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:g,password:m},...b&&{providerMetadata:b}}};f.mutate(y)},[c,i,o,r,n,e,f]);return a===null?l.jsx(fw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function vx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(vr,{children:[l.jsx(wr,{children:i||`Set up ${r} integration`}),l.jsx(bn,{error:t}),o,l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function wx({...e}){return l.jsx(vx,{...e})}function bx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.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?l.jsx(wx,{handleSubmit:u,error:null,providerName:a}):i}const Ix=()=>{const e=it(),t=Le();return vn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function Cx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${r} integration`}),l.jsx(rw,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(bn,{error:t}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const xx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Ox({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:"Enter your Salesforce subdomain"}),l.jsx(bu,{href:xx,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(bn,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(Jt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function _x({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return l.jsxs(vr,{children:[l.jsxs(wr,{children:["Enter your ",o," workspace"]}),l.jsx(bn,{error:n}),l.jsx("br",{}),i.map(s=>l.jsx(Jt.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),l.jsx("br",{}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Xc=600,Yc=600,Zc="salesforce";function Sx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var J;const{projectId:s}=Ne(),a=Le(),c=w.useRef(null),[f,u]=w.useState(null),[d,g]=w.useState(""),[m,b]=w.useState({}),[y,p]=w.useState({}),{data:C}=bo(e),h=((J=C==null?void 0:C.metadata)==null?void 0:J.input)||[],{mutateAsync:v,isPending:I}=Ix(),{isFetching:O,refetch:S}=Js({groupRef:r,provider:e});w.useEffect(()=>{const K=$=>{var B,ae,re;$.origin===Bl&&(((B=$.data)==null?void 0:B.eventType)==="AUTHORIZATION_SUCCEEDED"?(u(null),console.debug("New connection:",$.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=$.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",$.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),u($.data.data.error||"An error occurred. Please try again.")),(re=c.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const N=K=>{g(K),b($=>({...$,workspace:K})),p($=>({...$,workspace:{value:K,source:"input"}}))},T=(K,$)=>{b(B=>({...B,[K]:$})),p(B=>({...B,[K]:{value:$,source:"input"}}))},A=async()=>{var K;u(null);try{const{data:$}=await S();if($&&$.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!di(h,m)){u("Please fill in all required fields");return}try{const $=await v({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s,consumerName:n,groupName:o,providerWorkspaceRef:e===Zc?d:(K=y==null?void 0:y.workspace)==null?void 0:K.value,providerMetadata:y}});if($){const B=window.screenX+(window.outerWidth-Xc)/2,ae=window.screenY+(window.outerHeight-Yc)/2.5,re=`width=${Xc},height=${Yc},left=${B},top=${ae}`;c.current=window.open($,"OAuthPopup",re)}}catch($){console.error($),u($ instanceof Error?$.message:String($)||"An error occurred. Please try again.")}},D=e===Zc?l.jsx(Ox,{handleSubmit:A,setWorkspace:N,error:f,isButtonDisabled:d.length===0||I||O}):h.length>0?l.jsx(_x,{handleSubmit:A,setFormData:T,error:f,isButtonDisabled:!di(h,m)||I||O,providerName:i,metadataFields:h}):l.jsx(Cx,{handleSubmit:A,error:f,providerName:i,isButtonDisabled:I||O});return l.jsx("div",{children:D})}function Ex({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),[u,d]=w.useState(null),g=w.useCallback(m=>{var y,p;d(null);const b={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(y=m.providerMetadata)==null?void 0:y.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(b,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?l.jsx(hw,{provider:e,providerName:t,handleSubmit:g,error:u,explicitScopesRequired:s}):l.jsx(ui,{})}function Nx({...e}){return l.jsx(Ex,{...e})}const Tx="authorizationCode",Rx="authorizationCodePKCE",Ax="clientCredentials";function Fx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=lt(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:u}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===Tx||f===Rx?l.jsx(Sx,{...d}):f===Ax?l.jsx(Nx,{...d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):f==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",f]})}function Px(e){const{selectedConnection:t}=Xt();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function Dx({onSuccess:e}){Px(e)}function Gd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:u,isError:d,error:g,providerName:m,selectedProvider:b}=lt(e),{provider:y,isIntegrationDeleted:p}=ot(),{selectedConnection:C,setSelectedConnection:h}=Xt();Dx({onSuccess:s});const v=Le();w.useEffect(()=>{d&&(console.error("Error loading provider info."),Ue(g))},[d,g]);const I=w.useCallback(()=>{v.clear(),c()},[c,v]);if(!e&&!y)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Ra,{text:"Integration successfully uninstalled.",children:l.jsx(Qe,{type:"button",onClick:I,style:{width:"100%"},children:"Reinstall Integration"})});if(C)return i;if(u)return l.jsx(Xr,{});if(f==null)return l.jsx(Wt,{message:"Provider info was not found."});const O={provider:b,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:C,setSelectedConnection:h,providerName:m,providerInfo:f,onDisconnectSuccess:a};return f.authType==="none"?l.jsx(bx,{...O,children:i}):f.authType==="basic"?l.jsx(yx,{...O,children:i}):f.authType==="apiKey"?l.jsx(gx,{...O,children:i}):l.jsx(Fx,{...O})}function Mx(e){const t=e+"CollectionProvider",[n,r]=Fo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:p,children:C}=y,h=w.useRef(null),v=w.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:v,collectionRef:h,children:C})};s.displayName=t;const a=e+"CollectionSlot",c=js(a),f=w.forwardRef((y,p)=>{const{scope:C,children:h}=y,v=i(a,C),I=Jr(p,v.collectionRef);return l.jsx(c,{ref:I,children:h})});f.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",g=js(u),m=w.forwardRef((y,p)=>{const{scope:C,children:h,...v}=y,I=w.useRef(null),O=Jr(p,I),S=i(u,C);return w.useEffect(()=>(S.itemMap.set(I,{ref:I,...v}),()=>void S.itemMap.delete(I))),l.jsx(g,{[d]:"",ref:O,children:h})});m.displayName=u;function b(y){const p=i(e+"CollectionConsumer",y);return w.useCallback(()=>{const h=p.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((S,N)=>v.indexOf(S.ref.current)-v.indexOf(N.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},b,r]}var kx=k[" useId ".trim().toString()]||(()=>{}),jx=0;function Xd(e){const[t,n]=k.useState(kx());return gi(()=>{e||n(r=>r??String(jx++))},[e]),e||(t?`radix-${t}`:"")}function Lx(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var qx=k.createContext(void 0);function Yd(e){const t=k.useContext(qx);return e||t||"ltr"}var is="rovingFocusGroup.onEntryFocus",Kx={bubbles:!1,cancelable:!0},Si="RovingFocusGroup",[Ls,Zd,Ux]=Mx(Si),[Vx,ef]=Fo(Si,[Ux]),[$x,Hx]=Vx(Si),tf=k.forwardRef((e,t)=>l.jsx(Ls.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ls.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Bx,{...e,ref:t})})}));tf.displayName=Si;var Bx=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=e,g=k.useRef(null),m=Jr(t,g),b=Yd(i),[y,p]=_a({prop:s,defaultProp:a??null,onChange:c,caller:Si}),[C,h]=k.useState(!1),v=Lx(f),I=Zd(n),O=k.useRef(!1),[S,N]=k.useState(0);return k.useEffect(()=>{const T=g.current;if(T)return T.addEventListener(is,v),()=>T.removeEventListener(is,v)},[v]),l.jsx($x,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:y,onItemFocus:k.useCallback(T=>p(T),[p]),onItemShiftTab:k.useCallback(()=>h(!0),[]),onFocusableItemAdd:k.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:k.useCallback(()=>N(T=>T-1),[]),children:l.jsx(In.div,{tabIndex:C||S===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:zt(e.onMouseDown,()=>{O.current=!0}),onFocus:zt(e.onFocus,T=>{const A=!O.current;if(T.target===T.currentTarget&&A&&!C){const D=new CustomEvent(is,Kx);if(T.currentTarget.dispatchEvent(D),!D.defaultPrevented){const J=I().filter(re=>re.focusable),K=J.find(re=>re.active),$=J.find(re=>re.id===y),ae=[K,$,...J].filter(Boolean).map(re=>re.ref.current);of(ae,u)}}O.current=!1}),onBlur:zt(e.onBlur,()=>h(!1))})})}),nf="RovingFocusGroupItem",rf=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Xd(),f=i||c,u=Hx(nf,n),d=u.currentTabStopId===f,g=Zd(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:y}=u;return k.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),l.jsx(Ls.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:l.jsx(In.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:zt(e.onMouseDown,p=>{r?u.onItemFocus(f):p.preventDefault()}),onFocus:zt(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:zt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const C=zx(p,u.orientation,u.dir);if(C!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let v=g().filter(I=>I.focusable).map(I=>I.ref.current);if(C==="last")v.reverse();else if(C==="prev"||C==="next"){C==="prev"&&v.reverse();const I=v.indexOf(p.currentTarget);v=u.loop?Qx(v,I+1):v.slice(I+1)}setTimeout(()=>of(v))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:y!=null}):s})})});rf.displayName=nf;var Jx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zx(e,t,n){const r=Wx(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Jx[r]}function of(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Qx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gx=tf,Xx=rf,Mo="Tabs",[Yx,L0]=Fo(Mo,[ef]),sf=ef(),[Zx,Aa]=Yx(Mo),af=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,u=Yd(a),[d,g]=_a({prop:r,onChange:o,defaultProp:i??"",caller:Mo});return l.jsx(Zx,{scope:n,baseId:Xd(),value:d,onValueChange:g,orientation:s,dir:u,activationMode:c,children:l.jsx(In.div,{dir:u,"data-orientation":s,...f,ref:t})})});af.displayName=Mo;var cf="TabsList",lf=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Aa(cf,n),s=sf(n);return l.jsx(Gx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(In.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});lf.displayName=cf;var uf="TabsTrigger",df=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Aa(uf,n),a=sf(n),c=pf(s.baseId,r),f=hf(s.baseId,r),u=r===s.value;return l.jsx(Xx,{asChild:!0,...a,focusable:!o,active:u,children:l.jsx(In.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:zt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:zt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:zt(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});df.displayName=uf;var ff="TabsContent",e0=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Aa(ff,n),c=pf(a.baseId,r),f=hf(a.baseId,r),u=r===a.value,d=k.useRef(u);return k.useEffect(()=>{const g=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Sa,{present:o||u,children:({present:g})=>l.jsx(In.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:g&&i})})});e0.displayName=ff;function pf(e,t){return`${e}-trigger-${t}`}function hf(e,t){return`${e}-content-${t}`}var t0=af,n0=lf,mf=df;const r0=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function i0(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?r0:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function o0(){return l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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 s0="_tabsRoot_ktpr0_1",a0="_tabsList_ktpr0_6",c0="_tabTrigger_ktpr0_12",l0="_danger_ktpr0_29",vo={tabsRoot:s0,tabsList:a0,tabTrigger:c0,danger:l0};function u0(){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(mf,{value:oo,className:vo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(o0,{}),l.jsx("span",{children:"Manage"})]})})]})}function gf({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(mf,{value:e,className:vo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[i0(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function d0({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(gf,{objectName:pr,completed:e,pending:t,displayName:n},"other-write")]})}function f0({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(t0,{value:e,className:vo.tabsRoot,onValueChange:n,children:l.jsxs(n0,{className:vo.tabsList,children:[t.map(a=>{var c,f,u,d,g,m;return l.jsx(gf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((f=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:f.isOptionalFieldsModified)||((d=(u=r==null?void 0:r[a.name])==null?void 0:u.read)==null?void 0:d.isRequiredMapFieldsModified)||((m=(g=r==null?void 0:r[a.name])==null?void 0:g.read)==null?void 0:m.isValueMappingsModified)||!1},a.name)}),o&&l.jsx(d0,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),l.jsx(u0,{})]})})}function p0(e,t){return t===oo?{name:oo,completed:!1}:e.find(n=>n.name===t)}function h0({children:e}){var C;const{project:t}=Ne(),{installation:n}=ot(),{providerName:r}=lt(),{hydratedRevision:o}=Yr(),{objectConfigurationsState:i}=xa(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,u=o&&su(f,o),d=u!==null,g=!!((C=o==null?void 0:o.content)!=null&&C.write),m=g?au(f):void 0,b=w.useMemo(()=>{const h=[...u||[]];return m&&g&&h.push(m),h},[u,m,g]),y=p0(b,s),p=w.useCallback(()=>{const h=b.find(v=>y!==v&&!v.completed);h&&a(h.name)},[b,y]);return w.useEffect(()=>{!s&&b.length>0&&a(b[0].name)},[b,s,p]),l.jsx(xd.Provider,{value:p,children:l.jsx(Id.Provider,{value:y==null?void 0:y.name,children:l.jsxs(Gr,{style:{maxWidth:"55rem"},children:[l.jsxs(wn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),d&&l.jsx(f0,{value:s,readNavObjects:u,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:m})]}),e]}),l.jsx(wu,{})]})})})}function m0({...e}){return l.jsx(h0,{...e})}const g0="_resetContainer_lkwv9_4",yf={resetContainer:g0};function y0({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:f,isLoading:u}=Ne(),{isLoading:d}=Bs(),{isError:g,errorState:m}=Dt(),{seed:b,reset:y}=ru();return u||d?l.jsx(Xr,{}):g(ue.PROJECT,f)?l.jsx(Wt,{message:`Error loading project ${f}`}):g(ue.INTEGRATION_LIST,f)?l.jsx(Wt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Wt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:yf.resetContainer,children:l.jsx(xv,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(nu,{children:l.jsx(Gd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:y,children:l.jsx(Sw,{resetComponent:y,children:l.jsx(mx,{children:l.jsx(HI,{children:l.jsx(m0,{children:l.jsx(dx,{})})})})})})})},b)})}function v0(){return l.jsxs(Gr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ui,{}),l.jsx("p",{children:"Redirecting"})]})}function w0({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(v0,{}):t}function b0({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=w.useState(!1);return l.jsxs(l.Fragment,{children:[r===!1&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Manage connection"}),l.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[l.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),l.jsx(Qe,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Xs,{provider:n}),l.jsx(_t,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(Ou,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function I0({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ne(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Ra,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(b0,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function C0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:u}=ru(),d=w.useCallback(g=>{s?s(g.id):c&&c(g)},[s,c]);return l.jsx("div",{className:yf.resetContainer,children:l.jsx(nu,{groupRef:r,provider:e,children:l.jsx(Gd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:l.jsx(w0,{redirectURL:i,children:l.jsx(I0,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},f)}const x0=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Ws(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 w.useEffect(()=>{o&&Ue(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};function Ei(){const{integrationNameOrId:e,groupRef:t}=br(),n=Ws(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 Fa=()=>{const{groupRef:e,integrationNameOrId:t}=br(),{provider:n}=Qr(t),r=Js({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}},vf=()=>{var g;const e=Le(),t=it(),{connection:n,isPending:r,isFetching:o}=Fa(),{projectIdOrName:i}=Ne(),{integrationNameOrId:s}=br(),{data:a}=Qr(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,u=(g=a==null?void 0:a.latestRevision)==null?void 0:g.id,d=r||o;return w.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Jn({queryKey:["amp","hydratedRevision",i,f,u,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:u,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!u&&!!c&&!d})};function wf(){var f;const e=vf(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=w.useMemo(()=>({getReadObject:u=>{var g,m;const d=(m=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:m.find(b=>b.objectName===u);return d?{object:d,getRequiredFields:()=>d.requiredFields??[],getOptionalFields:()=>d.optionalFields??[]}:(console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getCustomerFieldsForObject:u=>{var g,m;const d=(m=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:m.find(b=>b.objectName===u);return d?d.allFields??[]:(console.error(`Object ${u} not found`),null)},getCustomerFieldsMetadataForObject:u=>{var g,m;const d=(m=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:m.find(b=>b.objectName===u);return d?{allFieldsMetaData:d.allFieldsMetadata??{},getField:b=>{var p;const y=(p=d.allFieldsMetadata)==null?void 0:p[b];return y||(console.error(`Field ${b} not found`),null)}}:(console.error(`Object ${u} not found`),{allFieldsMetaData:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function O0(e){var d,g,m,b;const[t,n]=w.useState(e),{getReadObject:r,data:o}=wf(),{installation:i}=Ei(),s=w.useCallback(()=>t,[t]),a=w.useCallback((y,p)=>{var T,A,D,J;p.provider=p.provider||((T=o==null?void 0:o.content)==null?void 0:T.provider)||"";const C=p.read||{objects:{}},h=C.objects||{},v=h[y]||{},I=r(y),O=(A=I==null?void 0:I.object)==null?void 0:A.schedule,S=(D=I==null?void 0:I.object)==null?void 0:D.destination,N={};return(J=I==null?void 0:I.getRequiredFields())==null||J.forEach(K=>{"fieldName"in K&&(N[K.fieldName]=!0)}),v.objectName=v.objectName||y,v.schedule=v.schedule||O||"",v.destination=v.destination||S||"",v.selectedFields=v.selectedFields||N,h[y]=v,C.objects=h,p.read=C,{read:C,objects:h,obj:v}},[r,(d=o==null?void 0:o.content)==null?void 0:d.provider]),c=w.useCallback(y=>{var p,C;return{object:(C=(p=t.read)==null?void 0:p.objects)==null?void 0:C[y],getSelectedField:h=>{var v,I,O,S;return!!((S=(O=(I=(v=t.read)==null?void 0:v.objects)==null?void 0:I[y])==null?void 0:O.selectedFields)!=null&&S[h])},setSelectedField:({fieldName:h,selected:v})=>{n(I=>Ft(I,O=>{const{obj:S}=a(y,O);S.selectedFields=S.selectedFields||{},S.selectedFields[h]=v,S.selectedFields[h]===!1&&delete S.selectedFields[h]}))},getFieldMapping:h=>{var v,I,O,S;return(S=(O=(I=(v=t.read)==null?void 0:v.objects)==null?void 0:I[y])==null?void 0:O.selectedFieldMappings)==null?void 0:S[h]},setFieldMapping:({fieldName:h,mapToName:v})=>{n(I=>Ft(I,O=>{const{obj:S}=a(y,O);S.selectedFieldMappings=S.selectedFieldMappings||{},S.selectedFieldMappings[v]=h}))}}},[(g=t.read)==null?void 0:g.objects,a]),f=w.useCallback(y=>{var I,O;const p=(O=(I=t.write)==null?void 0:I.objects)==null?void 0:O[y],C=S=>{const N=S.write||{},T=N.objects||{},A=T[y]||{objectName:y};return T[y]=A,N.objects=T,S.write=N,{write:N,objects:T,obj:A}},h=(S,N)=>{var T,A;return(A=(T=p==null?void 0:p.selectedFieldSettings)==null?void 0:T[S])==null?void 0:A[N]},v=(S,N,T)=>{n(A=>Ft(A,D=>{var K;const{obj:J}=C(D);J.selectedFieldSettings={...J.selectedFieldSettings,[S]:{...(K=J.selectedFieldSettings)==null?void 0:K[S],[N]:T}}}))};return{object:p,setEnableWrite:()=>{n(S=>Ft(S,N=>{const{obj:T}=C(N);T.objectName=y}))},setDisableWrite:()=>{n(S=>Ft(S,N=>{const{objects:T}=C(N);delete T[y]}))},getWriteObject:()=>{var S,N;return(N=(S=t.write)==null?void 0:S.objects)==null?void 0:N[y]},getSelectedFieldSettings:S=>{var N;return(N=p==null?void 0:p.selectedFieldSettings)==null?void 0:N[S]},setSelectedFieldSettings:({fieldName:S,settings:N})=>{n(T=>Ft(T,A=>{const{obj:D}=C(A),J=D.selectedFieldSettings||{};D.selectedFieldSettings={...J,[S]:N},N===void 0&&delete D.selectedFieldSettings[S]}))},getDefaultValues:S=>h(S,"_default"),setDefaultValues:({fieldName:S,value:N})=>v(S,"_default",N),getWriteOnCreateSetting:S=>h(S,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:S,value:N})=>v(S,"writeOnCreate",N),getWriteOnUpdateSetting:S=>h(S,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:S,value:N})=>v(S,"writeOnUpdate",N)}},[(m=t.write)==null?void 0:m.objects]),u=w.useCallback(()=>{n(y=>Ft(y,p=>{var C;Object.assign(p,(C=i==null?void 0:i.config)==null?void 0:C.content)}))},[(b=i==null?void 0:i.config)==null?void 0:b.content]);return w.useEffect(()=>{console.debug("Installation found",{installation:i}),u()},[i,u]),{draft:t,get:s,reset:u,setDraft:n,readObject:c,writeObject:f}}const bf=w.createContext(null);function _0({children:e,initialConfig:t}){const n=O0(t);return l.jsx(bf.Provider,{value:n,children:e})}function S0(){const e=w.useContext(bf);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const If=w.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function br(){const e=w.useContext(If);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function E0({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=w.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return l.jsx(If.Provider,{value:s,children:l.jsx(_0,{initialConfig:{},children:e})})}function N0(e){return typeof e.provider=="string"}function T0(e){if(!N0(e))throw new Error("Config must have a provider field for creation");return e}function R0(){const{projectIdOrName:e}=Ne(),{groupRef:t,integrationNameOrId:n}=br(),{data:r}=Qr(n),{connection:o}=Fa(),{installation:i}=Ei(),s=Le(),{mutate:a,isIdle:c,isPending:f,error:u,errorMsg:d}=Qd();return{createInstallation:({config:m,onSuccess:b,onError:y,onSettled:p})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const C={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:T0(m)}}};return a(C,{onSuccess:h=>{b==null||b(h)},onError:h=>{y==null||y(h)},onSettled:()=>{p==null||p(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:u,errorMsg:d}}const A0=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function F0(){const{projectIdOrName:e}=Ne(),{integrationNameOrId:t}=br(),{data:n}=Qr(t),{installation:r}=Ei(),o=Le(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=A0();return{updateInstallation:({config:d,onSuccess:g,onError:m,onSettled:b})=>{var C,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const y=[];if((C=d==null?void 0:d.write)!=null&&C.objects&&Object.keys(d.write.objects).length>0&&y.push("config.content.write.objects"),(h=d==null?void 0:d.read)!=null&&h.objects){const v=Object.keys(d.read.objects);y.push(...v.map(I=>`config.content.read.objects.${I}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:y,installation:{config:{content:d}}}};return i(p,{onSuccess:v=>{g==null||g(v)},onError:v=>{m==null||m(v)},onSettled:()=>{b==null||b(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const P0=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function D0(){const{projectIdOrName:e}=Ne(),{integrationNameOrId:t}=br(),{data:n}=Qr(t),{installation:r}=Ei(),o=Le(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=P0();return{deleteInstallation:({onSuccess:d,onError:g,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:b=>{g==null||g(b)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}exports.AmpersandContext=Gl;exports.AmpersandProvider=iv;exports.ConnectProvider=C0;exports.InstallIntegration=y0;exports.InstallationProvider=E0;exports.useAmpersandProvider=ov;exports.useConfig=S0;exports.useConnection=Fa;exports.useCreateInstallation=R0;exports.useDeleteInstallation=D0;exports.useHydratedRevisionQuery=vf;exports.useInstallation=Ei;exports.useInstallationProps=br;exports.useIsIntegrationInstalled=x0;exports.useManifest=wf;exports.useUpdateInstallation=F0;
|
|
50
|
+
*/const vI="react-tooltip-core-styles",wI="react-tooltip-base-styles",Mc={core:!1,base:!1};function kc({css:e,id:t=wI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Mc[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=vI),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)),Mc[n]=!0}const jc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[hI(Number(o)),gI({fallbackAxisSideDirection:"start"}),mI({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(yI({element:n,padding:5})),Dc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:f,y:u,placement:d,middlewareData:g})=>{var m,b;const y={left:`${f}px`,top:`${u}px`,border:a},{x:p,y:C}=(m=g.arrow)!==null&&m!==void 0?m:{x:0,y:0},h=(b={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&b!==void 0?b:"bottom",v=a&&{borderBottom:a,borderRight:a};let I=0;if(a){const O=`${a}`.match(/(\d+)px/);I=O!=null&&O[1]?Number(O[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...v,[h]:`-${4+I}px`},place:d}})):Dc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:f,y:u,placement:d})=>({tooltipStyles:{left:`${f}px`,top:`${u}px`},tooltipArrowStyles:{},place:d}))},Lc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),qc=(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},Kc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Rs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Rs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Kc(e)||!Kc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Rs(e[o],t[o]))},bI=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"})},Uc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(bI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},II=typeof window<"u"?w.useLayoutEffect:w.useEffect,Rt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},CI="DEFAULT_TOOLTIP_ID",xI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},OI=w.createContext({getTooltipData:()=>xI});function bd(e=CI){return w.useContext(OI).getTooltipData(e)}var Ir={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"},es={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 _I=({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:u=!1,positionStrategy:d="absolute",middlewares:g,wrapper:m,delayShow:b=0,delayHide:y=0,float:p=!1,hidden:C=!1,noArrow:h=!1,clickable:v=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:S=!1,openEvents:N,closeEvents:T,globalCloseEvents:A,imperativeModeOnly:D,style:J,position:K,afterShow:$,afterHide:B,disableTooltip:ae,content:re,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:L,setActiveAnchor:H,border:U,opacity:q,arrowColor:M,role:Z="tooltip"})=>{var ee;const W=w.useRef(null),te=w.useRef(null),X=w.useRef(null),de=w.useRef(null),j=w.useRef(null),[we,z]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=w.useState(!1),[Ze,$e]=w.useState(!1),[Ie,Mt]=w.useState(null),et=w.useRef(!1),bt=w.useRef(null),{anchorRefs:kt,setActiveAnchor:jt}=bd(t),tt=w.useRef(!1),[Ge,He]=w.useState([]),Fe=w.useRef(!1),Lt=u||f.includes("click"),pt=Lt||(N==null?void 0:N.click)||(N==null?void 0:N.dblclick)||(N==null?void 0:N.mousedown),an=N?{...N}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!N&&Lt&&Object.assign(an,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Zt=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&Lt&&Object.assign(Zt,{mouseleave:!1,blur:!1,mouseout:!1});const It=A?{...A}:{escape:I||!1,scroll:O||!1,resize:S||!1,clickOutsideAnchor:pt||!1};D&&(Object.assign(an,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Zt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),II(()=>(Fe.current=!0,()=>{Fe.current=!1}),[]);const Pe=Q=>{Fe.current&&(Q&&$e(!0),setTimeout(()=>{Fe.current&&(F==null||F(Q),ge===void 0&&Ve(Q))},10))};w.useEffect(()=>{if(ge===void 0)return()=>null;ge&&$e(!0);const Q=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(Q)}},[ge]),w.useEffect(()=>{if(Ee!==et.current)if(Rt(j),et.current=Ee,Ee)$==null||$();else{const Q=(ce=>{const le=ce.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,qe,Je]=le;return Number(qe)*(Je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));j.current=setTimeout(()=>{$e(!1),Mt(null),B==null||B()},Q+25)}},[Ee]);const cn=Q=>{z(ce=>Rs(ce,Q)?ce:Q)},Cn=(Q=b)=>{Rt(X),Ze?Pe(!0):X.current=setTimeout(()=>{Pe(!0)},Q)},ln=(Q=y)=>{Rt(de),de.current=setTimeout(()=>{tt.current||Pe(!1)},Q)},Wn=Q=>{var ce;if(!Q)return;const le=(ce=Q.currentTarget)!==null&&ce!==void 0?ce:Q.target;if(!(le!=null&&le.isConnected))return H(null),void jt({current:null});b?Cn():Pe(!0),H(le),jt({current:le}),Rt(de)},ht=()=>{v?ln(y||100):y?ln():Pe(!1),Rt(X)},un=({x:Q,y:ce})=>{var le;const qe={getBoundingClientRect:()=>({x:Q,y:ce,width:0,height:0,top:ce,left:Q,right:Q,bottom:ce})};jc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:qe,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:g,border:U}).then(Je=>{cn(Je)})},xn=Q=>{if(!Q)return;const ce=Q,le={x:ce.clientX,y:ce.clientY};un(le),bt.current=le},zn=Q=>{var ce;if(!Ee)return;const le=Q.target;le.isConnected&&(!((ce=W.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(qe=>qe==null?void 0:qe.contains(le))||(Pe(!1),Rt(X)))},On=qc(Wn,50),Ae=qc(ht,50),st=Q=>{Ae.cancel(),On(Q)},oe=()=>{On.cancel(),Ae()},me=w.useCallback(()=>{var Q,ce;const le=(Q=Ie==null?void 0:Ie.position)!==null&&Q!==void 0?Q:K;le?un(le):p?bt.current&&un(bt.current):L!=null&&L.isConnected&&jc({place:(ce=Ie==null?void 0:Ie.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:L,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:d,middlewares:g,border:U}).then(qe=>{Fe.current&&cn(qe)})},[Ee,L,re,J,a,Ie==null?void 0:Ie.place,c,d,K,Ie==null?void 0:Ie.position,p]);w.useEffect(()=>{var Q,ce;const le=new Set(kt);Ge.forEach(ye=>{ae!=null&&ae(ye)||le.add({current:ye})});const qe=document.querySelector(`[id='${i}']`);qe&&!(ae!=null&&ae(qe))&&le.add({current:qe});const Je=()=>{Pe(!1)},mt=Uc(L),Xe=Uc(W.current);It.scroll&&(window.addEventListener("scroll",Je),mt==null||mt.addEventListener("scroll",Je),Xe==null||Xe.addEventListener("scroll",Je));let nt=null;It.resize?window.addEventListener("resize",Je):L&&W.current&&(nt=pI(L,W.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const gt=ye=>{ye.key==="Escape"&&Pe(!1)};It.escape&&window.addEventListener("keydown",gt),It.clickOutsideAnchor&&window.addEventListener("click",zn);const Te=[],_n=ye=>!!(ye!=null&&ye.target&&(L!=null&&L.contains(ye.target))),ko=ye=>{Ee&&_n(ye)||Wn(ye)},qt=ye=>{Ee&&_n(ye)&&ht()},Ni=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ti=["click","dblclick","mousedown","mouseup"];Object.entries(an).forEach(([ye,Kt])=>{Kt&&(Ni.includes(ye)?Te.push({event:ye,listener:st}):Ti.includes(ye)&&Te.push({event:ye,listener:ko}))}),Object.entries(Zt).forEach(([ye,Kt])=>{Kt&&(Ni.includes(ye)?Te.push({event:ye,listener:oe}):Ti.includes(ye)&&Te.push({event:ye,listener:qt}))}),p&&Te.push({event:"pointermove",listener:xn});const Ri=()=>{tt.current=!0},Ai=()=>{tt.current=!1,ht()},Fi=v&&(Zt.mouseout||Zt.mouseleave);return Fi&&((Q=W.current)===null||Q===void 0||Q.addEventListener("mouseover",Ri),(ce=W.current)===null||ce===void 0||ce.addEventListener("mouseout",Ai)),Te.forEach(({event:ye,listener:Kt})=>{le.forEach(ei=>{var Qn;(Qn=ei.current)===null||Qn===void 0||Qn.addEventListener(ye,Kt)})}),()=>{var ye,Kt;It.scroll&&(window.removeEventListener("scroll",Je),mt==null||mt.removeEventListener("scroll",Je),Xe==null||Xe.removeEventListener("scroll",Je)),It.resize?window.removeEventListener("resize",Je):nt==null||nt(),It.clickOutsideAnchor&&window.removeEventListener("click",zn),It.escape&&window.removeEventListener("keydown",gt),Fi&&((ye=W.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ri),(Kt=W.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ai)),Te.forEach(({event:ei,listener:Qn})=>{le.forEach(jo=>{var ti;(ti=jo.current)===null||ti===void 0||ti.removeEventListener(ei,Qn)})})}},[L,me,Ze,kt,Ge,N,T,A,Lt,b,y]),w.useEffect(()=>{var Q,ce;let le=(ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s)!==null&&ce!==void 0?ce:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const qe=new MutationObserver(Je=>{const mt=[],Xe=[];Je.forEach(nt=>{if(nt.type==="attributes"&&nt.attributeName==="data-tooltip-id"&&(nt.target.getAttribute("data-tooltip-id")===t?mt.push(nt.target):nt.oldValue===t&&Xe.push(nt.target)),nt.type==="childList"){if(L){const gt=[...nt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{Xe.push(...gt.filter(Te=>Te.matches(le))),Xe.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}gt.some(Te=>{var _n;return!!(!((_n=Te==null?void 0:Te.contains)===null||_n===void 0)&&_n.call(Te,L))&&($e(!1),Pe(!1),H(null),Rt(X),Rt(de),!0)})}if(le)try{const gt=[...nt.addedNodes].filter(Te=>Te.nodeType===1);mt.push(...gt.filter(Te=>Te.matches(le))),mt.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(mt.length||Xe.length)&&He(nt=>[...nt.filter(gt=>!Xe.includes(gt)),...mt])});return qe.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{qe.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,L]),w.useEffect(()=>{me()},[me]),w.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const Q=new ResizeObserver(()=>{setTimeout(()=>me())});return Q.observe(ne.current),()=>{Q.disconnect()}},[re,ne==null?void 0:ne.current]),w.useEffect(()=>{var Q;const ce=document.querySelector(`[id='${i}']`),le=[...Ge,ce];L&&le.includes(L)||H((Q=Ge[0])!==null&&Q!==void 0?Q:ce)},[i,Ge,L]),w.useEffect(()=>(be&&Pe(!0),()=>{Rt(X),Rt(de)}),[]),w.useEffect(()=>{var Q;let ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));He(le)}catch{He([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{X.current&&(Rt(X),Cn(b))},[b]);const Be=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,dn=Ee&&Object.keys(we.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:Q=>{if(Q!=null&&Q.anchorSelect)try{document.querySelector(Q.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${Q.anchorSelect}" is not a valid CSS selector`)}Mt(Q??null),Q!=null&&Q.delay?Cn(Q.delay):Pe(!0)},close:Q=>{Q!=null&&Q.delay?ln(Q.delay):Pe(!1)},activeAnchor:L,place:we.place,isOpen:!!(Ze&&!C&&Be&&dn)})),Ze&&!C&&Be?w.createElement(m,{id:t,role:Z,className:Pt("react-tooltip",Ir.tooltip,es.tooltip,es[o],n,`react-tooltip__place-${we.place}`,Ir[dn?"show":"closing"],dn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ir.fixed,v&&Ir.clickable),onTransitionEnd:Q=>{Rt(j),Ee||Q.propertyName!=="opacity"||($e(!1),Mt(null),B==null||B())},style:{...J,...we.tooltipStyles,opacity:q!==void 0&&dn?q:void 0},ref:W},Be,w.createElement(m,{className:Pt("react-tooltip-arrow",Ir.arrow,es.arrow,r,h&&Ir.noArrow),style:{...we.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:te})):null},SI=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),EI=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:u=10,wrapper:d="div",children:g=null,events:m=["hover"],openOnClick:b=!1,positionStrategy:y="absolute",middlewares:p,delayShow:C=0,delayHide:h=0,float:v=!1,hidden:I=!1,noArrow:O=!1,clickable:S=!1,closeOnEsc:N=!1,closeOnScroll:T=!1,closeOnResize:A=!1,openEvents:D,closeEvents:J,globalCloseEvents:K,imperativeModeOnly:$=!1,style:B,position:ae,isOpen:re,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:be,opacity:F,arrowColor:L,setIsOpen:H,afterShow:U,afterHide:q,disableTooltip:M,role:Z="tooltip"},ee)=>{const[W,te]=w.useState(r),[X,de]=w.useState(o),[j,we]=w.useState(f),[z,Ee]=w.useState(c),[Ve,Ze]=w.useState(u),[$e,Ie]=w.useState(C),[Mt,et]=w.useState(h),[bt,kt]=w.useState(v),[jt,tt]=w.useState(I),[Ge,He]=w.useState(d),[Fe,Lt]=w.useState(m),[pt,an]=w.useState(y),[Zt,It]=w.useState(null),[Pe,cn]=w.useState(null),Cn=w.useRef(ge),{anchorRefs:ln,activeAnchor:Wn}=bd(e),ht=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((st,oe)=>{var me;return oe.startsWith("data-tooltip-")&&(st[oe.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(oe))!==null&&me!==void 0?me:null),st},{}),un=Ae=>{const st={place:oe=>{var me;we((me=oe)!==null&&me!==void 0?me:f)},content:oe=>{te(oe??r)},html:oe=>{de(oe??o)},variant:oe=>{var me;Ee((me=oe)!==null&&me!==void 0?me:c)},offset:oe=>{Ze(oe===null?u:Number(oe))},wrapper:oe=>{var me;He((me=oe)!==null&&me!==void 0?me:d)},events:oe=>{const me=oe==null?void 0:oe.split(" ");Lt(me??m)},"position-strategy":oe=>{var me;an((me=oe)!==null&&me!==void 0?me:y)},"delay-show":oe=>{Ie(oe===null?C:Number(oe))},"delay-hide":oe=>{et(oe===null?h:Number(oe))},float:oe=>{kt(oe===null?v:oe==="true")},hidden:oe=>{tt(oe===null?I:oe==="true")},"class-name":oe=>{It(oe)}};Object.values(st).forEach(oe=>oe(null)),Object.entries(Ae).forEach(([oe,me])=>{var Be;(Be=st[oe])===null||Be===void 0||Be.call(st,me)})};w.useEffect(()=>{te(r)},[r]),w.useEffect(()=>{de(o)},[o]),w.useEffect(()=>{we(f)},[f]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{Ze(u)},[u]),w.useEffect(()=>{Ie(C)},[C]),w.useEffect(()=>{et(h)},[h]),w.useEffect(()=>{kt(v)},[v]),w.useEffect(()=>{tt(I)},[I]),w.useEffect(()=>{an(y)},[y]),w.useEffect(()=>{Cn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),w.useEffect(()=>{var Ae;const st=new Set(ln);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ce=>{st.add({current:ce})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&st.add({current:me}),!st.size)return()=>null;const Be=(Ae=Pe??me)!==null&&Ae!==void 0?Ae:Wn.current,dn=new MutationObserver(ce=>{ce.forEach(le=>{var qe;if(!Be||le.type!=="attributes"||!(!((qe=le.attributeName)===null||qe===void 0)&&qe.startsWith("data-tooltip-")))return;const Je=ht(Be);un(Je)})}),Q={attributes:!0,childList:!1,subtree:!1};if(Be){const ce=ht(Be);un(ce),dn.observe(Be,Q)}return()=>{dn.disconnect()}},[ln,Wn,Pe,t,n]),w.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!Lc("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Lc("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let xn=g;const zn=w.useRef(null);if(i){const Ae=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||W||null,activeAnchor:Pe});xn=Ae?w.createElement("div",{ref:zn,className:"react-tooltip-content-wrapper"},Ae):null}else W&&(xn=W);X&&(xn=w.createElement(SI,{content:X}));const On={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Pt(s,Zt),classNameArrow:a,content:xn,contentWrapperRef:zn,place:j,variant:z,offset:Ve,wrapper:Ge,events:Fe,openOnClick:b,positionStrategy:pt,middlewares:p,delayShow:$e,delayHide:Mt,float:bt,hidden:jt,noArrow:O,clickable:S,closeOnEsc:N,closeOnScroll:T,closeOnResize:A,openEvents:D,closeEvents:J,globalCloseEvents:K,imperativeModeOnly:$,style:B,position:ae,isOpen:re,defaultIsOpen:ne,border:be,opacity:F,arrowColor:L,setIsOpen:H,afterShow:U,afterHide:q,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Ae=>cn(Ae),role:Z};return w.createElement(_I,{...On})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||kc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||kc({css:`
|
|
51
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function NI(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function TI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:NI()}),l.jsx(EI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Id=w.createContext(null);function Cd(){const e=w.useContext(Id);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const xd=w.createContext(()=>{});function RI(){const e=w.useContext(xd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Od=Symbol.for("immer-nothing"),Vc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state"),AI=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=AI[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 $r=Object.getPrototypeOf;function Hr(e){return!!e&&!!e[St]}function gr(e){var t;return e?_d(e)||Array.isArray(e)||!!e[Vc]||!!((t=e.constructor)!=null&&t[Vc])||No(e)||To(e):!1}var FI=Object.prototype.constructor.toString();function _d(e){if(!e||typeof e!="object")return!1;const t=$r(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)===FI}function mo(e,t){Eo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Eo(e){const t=e[St];return t?t.type_:Array.isArray(e)?1:No(e)?2:To(e)?3:0}function As(e,t){return Eo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sd(e,t,n){const r=Eo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function PI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function No(e){return e instanceof Map}function To(e){return e instanceof Set}function Zn(e){return e.copy_||e.base_}function Fs(e,t){if(No(e))return new Map(e);if(To(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=_d(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[St];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($r(e),r)}else{const r=$r(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ia(e,t=!1){return Ro(e)||Hr(e)||!gr(e)||(Eo(e)>1&&(e.set=e.add=e.clear=e.delete=DI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ia(r,!0))),e}function DI(){wt(2)}function Ro(e){return Object.isFrozen(e)}var MI={};function yr(e){const t=MI[e];return t||wt(0,e),t}var pi;function Ed(){return pi}function kI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $c(e,t){t&&(yr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ps(e){Ds(e),e.drafts_.forEach(jI),e.drafts_=null}function Ds(e){e===pi&&(pi=e.parent_)}function Hc(e){return pi=kI(pi,e)}function jI(e){const t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[St].modified_&&(Ps(t),wt(4)),gr(e)&&(e=go(t,e),t.parent_||yo(t,e)),t.patches_&&yr("Patches").generateReplacementPatches_(n[St].base_,e,t.patches_,t.inversePatches_)):e=go(t,n,[]),Ps(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Od?e:void 0}function go(e,t,n){if(Ro(t))return t;const r=t[St];if(!r)return mo(t,(o,i)=>Jc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return yo(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),mo(i,(a,c)=>Jc(e,r,o,a,c,n,s)),yo(e,o,!1),n&&e.patches_&&yr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Jc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&wt(5),Hr(o)){const a=i&&t&&t.type_!==3&&!As(t.assigned_,r)?i.concat(r):void 0,c=go(e,o,a);if(Sd(n,r,c),Hr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(gr(o)&&!Ro(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;go(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&yo(e,o)}}function yo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ia(t,n)}function LI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ed(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ca;n&&(o=[r],i=hi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ca={get(e,t){if(t===St)return e;const n=Zn(e);if(!As(n,t))return qI(e,n,t);const r=n[t];return e.finalized_||!gr(r)?r:r===ts(e.base_,t)?(ns(e),e.copy_[t]=ks(r,e)):r},has(e,t){return t in Zn(e)},ownKeys(e){return Reflect.ownKeys(Zn(e))},set(e,t,n){const r=Nd(Zn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ts(Zn(e),t),i=o==null?void 0:o[St];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(PI(n,o)&&(n!==void 0||As(e.base_,t)))return!0;ns(e),Ms(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 ts(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ns(e),Ms(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Zn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return $r(e.base_)},setPrototypeOf(){wt(12)}},hi={};mo(Ca,(e,t)=>{hi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});hi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),hi.set.call(this,e,t,void 0)};hi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),Ca.set.call(this,e[0],t,n,e[0])};function ts(e,t){const n=e[St];return(n?Zn(n):e)[t]}function qI(e,t,n){var o;const r=Nd(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Nd(e,t){if(!(t in e))return;let n=$r(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=$r(n)}}function Ms(e){e.modified_||(e.modified_=!0,e.parent_&&Ms(e.parent_))}function ns(e){e.copy_||(e.copy_=Fs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var KI=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,u=>n.call(this,u,...f))}}typeof n!="function"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let o;if(gr(t)){const i=Hc(this),s=ks(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ps(i):Ds(i)}return $c(i,r),Bc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Od&&(o=void 0),this.autoFreeze_&&Ia(o,!0),r){const i=[],s=[];yr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else wt(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){gr(e)||wt(8),Hr(e)&&(e=UI(e));const t=Hc(this),n=ks(e,void 0);return n[St].isManual_=!0,Ds(t),n}finishDraft(e,t){const n=e&&e[St];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return $c(r,t),Bc(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=yr("Patches").applyPatches_;return Hr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ks(e,t){const n=No(e)?yr("MapSet").proxyMap_(e,t):To(e)?yr("MapSet").proxySet_(e,t):LI(e,t);return(t?t.scope_:Ed()).drafts_.push(n),n}function UI(e){return Hr(e)||wt(10,e),Td(e)}function Td(e){if(!gr(e)||Ro(e))return e;const t=e[St];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fs(e,!0);return mo(n,(r,o)=>{Sd(n,r,Td(o))}),t&&(t.finalized_=!1),n}var Et=new KI,Ft=Et.produce;Et.produceWithPatches.bind(Et);Et.setAutoFreeze.bind(Et);Et.setUseStrictShallowCopy.bind(Et);Et.applyPatches.bind(Et);Et.createDraft.bind(Et);Et.finishDraft.bind(Et);const Rd=w.createContext(void 0),VI={};function xa(){const e=w.useContext(Rd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function $I({children:e}){const{installation:t}=ot(),{hydratedRevision:n,loading:r}=Xr(),[o,i]=w.useState(VI),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Dv(n,s,i)},[n,r,s,o]);const a=w.useCallback((m,b)=>{i(y=>Ft(y,p=>{p[m]=Ft(p[m],b)}))},[i]),c=w.useCallback((m,b)=>{i(y=>Ft(y,p=>{p[m]=b}))},[i]),f=w.useCallback(()=>{i(Ft(m=>{const b=m.other.write;b&&(b.isWriteModified=!1)}))},[i]),u=w.useCallback(m=>{i(Ft(b=>{var p;const y=(p=b[m])==null?void 0:p.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1,y.isValueMappingsModified=!1)}))},[i]),d=w.useCallback(m=>{m===pr?f():u(m)},[u,f]),g=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,a]);return l.jsx(Rd.Provider,{value:g,children:e})}const Yt=()=>{const{appName:e}=Ne(),{objectConfigurationsState:t,setConfigureState:n}=xa(),{selectedObjectName:r}=Cd(),o=mu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function HI(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=!lu(o,n);e.read.isRequiredMapFieldsModified=s}}function mi(e,t,n){t(e,r=>HI(r,n))}const BI="Each field must be mapped to a unique value";function Oa({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Yt(),[s,a]=w.useState(!0),{isError:c,removeError:f,getError:u}=Dt(),d=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,g=d==null?void 0:d[e.mapToName];w.useEffect(()=>{e._default&&!g&&o&&r&&mi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,g,r]);const m=w.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),b=l.jsx(ud,{disabled:s,items:m,selectedValue:g||null,onSelectedItemChange:v=>{t({target:{name:e.mapToName,value:v==null?void 0:v.value}})},placeholder:"Please select one",style:{width:"100%"}}),y=w.useCallback(()=>{o&&(mi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:p,errorMessage:C}=w.useMemo(()=>{const v=u(ue.MAPPING,o),I=Array.isArray(v)&&v.length>0&&v.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?BI:""}},[o,u,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(TI,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,l.jsx(Qe,{type:"button",variant:"ghost",onClick:y,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",C," "]},e.mapToName)]})}const JI="_formControl_9qd8d_1",WI="_formLabel_9qd8d_5",zI="_formLabelRequired_9qd8d_11",QI="_formInput_9qd8d_16",GI="_formInputInvalid_9qd8d_20",XI="_formError_9qd8d_24",YI="_disabled_9qd8d_30",Yn={formControl:JI,formLabel:WI,formLabelRequired:zI,formInput:QI,formInputInvalid:GI,formError:XI,disabled:YI};function Ao({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Pt(Yn.formControl,{[Yn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Pt(Yn.formLabel,{[Yn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Pt(Yn.formInput,{[Yn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Yn.formError,role:"alert",children:i})]})}function Ad({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function ZI({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(Ao,{id:r.mapToName,children:l.jsx(Oa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function eC(){var b,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Dt(),s=((b=t==null?void 0:t.read)==null?void 0:b.allFields)||[],{fieldMapping:a}=ot(),c=(y=t==null?void 0:t.read)==null?void 0:y.selectedFieldMappings,f=p=>{const{value:C,name:h}=p.target;!C||Ad({selectedFieldMappings:c,selectedObjectName:e,fieldName:h,fieldValue:C,setError:i})||(e&&mi(e,n,[{field:h,value:C}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},u=w.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),d=w.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(v=>!u.some(I=>I.mapToName===v.mapToName))},[t,u]),g=u.length>0;return d.length>0||g?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(p=>l.jsx(Ao,{id:p.mapToName,children:l.jsx(Oa,{allFields:s,field:p,onSelectChange:f})},p.mapToName)),g&&l.jsx(ZI,{dynamicFieldMappings:u,onSelectChange:f,allFields:s})]})]}):null}function tC(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Dt(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=u=>{const{value:d,name:g}=u.target;!d||Ad({selectedFieldMappings:s,selectedObjectName:e,fieldName:g,fieldValue:d,setError:i})||(e&&mi(e,n,[{field:g,value:d}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=w.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(u=>{var d;return l.jsx(Ao,{id:u.mapToName,isInvalid:r(ue.MAPPING,u.mapToName),errorMessage:"* required",children:l.jsx(Oa,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const nC=(e,t)=>e.filter(n=>!t.has(n));function rC(){var g,m,b;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{fieldMapping:r}=ot(),o=((g=t==null?void 0:t.read)==null?void 0:g.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((b=t==null?void 0:t.read)==null?void 0:b.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(y=>!y.fieldName):[],f=s.concat(c,a).map(y=>y.mapToName),u=new Set(f),d=nC(i,u);w.useEffect(()=>{e&&d.length&&mi(e,n,d.map(y=>({field:y,value:null})))},[e,n,d])}const iC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function oC({children:e,style:t}){return l.jsx(wn,{style:{...iC,...t},children:e})}function sC(){var f,u,d;const{project:e}=Ne(),{hydratedRevision:t}=Xr(),{selectedObjectName:n}=Yt(),{providerName:r}=lt(),o=e==null?void 0:e.appName,i=(d=(u=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:u.objects)==null?void 0:d.find(g=>g.objectName===n),s=(i==null?void 0:i.displayName)||n&&Vn(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Vn(a);return c&&o&&r?l.jsx(oC,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to"," ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Wc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Wc(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():Wc(e[o],null)}}}}function Br(...e){return k.useCallback(Fd(...e),e)}function Fo(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),c=n.length;n=[...n,s];const f=d=>{var C;const{scope:g,children:m,...b}=d,y=((C=g==null?void 0:g[e])==null?void 0:C[c])||a,p=k.useMemo(()=>b,Object.values(b));return l.jsx(y.Provider,{value:p,children:m})};f.displayName=i+"Provider";function u(d,g){var y;const m=((y=g==null?void 0:g[e])==null?void 0:y[c])||a,b=k.useContext(m);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[f,u]}const o=()=>{const i=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,aC(o,...t)]}function aC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:f})=>{const d=c(i)[`__scope${f}`];return{...a,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zt(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 gi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},cC=k[" useInsertionEffect ".trim().toString()]||gi;function _a({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=lC({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const u=k.useRef(e!==void 0);k.useEffect(()=>{const d=u.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.`),u.current=a},[a,r])}const f=k.useCallback(u=>{var d;if(a){const g=uC(u)?u(e):u;g!==e&&((d=s.current)==null||d.call(s,g))}else i(u)},[a,e,i,s]);return[c,f]}function lC({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return cC(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function uC(e){return typeof e=="function"}function dC(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function fC(e){const[t,n]=k.useState(void 0);return gi(()=>{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 pC(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Sa=e=>{const{present:t,children:n}=e,r=hC(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Br(r.ref,mC(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};Sa.displayName="Presence";function hC(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=pC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const f=Qi(r.current);i.current=a==="mounted"?f:"none"},[a]),gi(()=>{const f=r.current,u=o.current;if(u!==e){const g=i.current,m=Qi(f);e?c("MOUNT"):m==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(u&&g!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),gi(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,d=m=>{const y=Qi(r.current).includes(m.animationName);if(m.target===t&&y&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},g=m=>{m.target===t&&(i.current=Qi(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Qi(e){return(e==null?void 0:e.animationName)||"none"}function mC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function js(e){const t=gC(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),c=a.find(vC);if(c){const f=c.props.children,u=a.map(d=>d===c?k.Children.count(f)>1?k.Children.only(null):k.isValidElement(f)?f.props.children:null:d);return l.jsx(t,{...s,ref:o,children:k.isValidElement(f)?k.cloneElement(f,void 0,u):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function gC(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=bC(o),a=wC(i,o.props);return o.type!==k.Fragment&&(a.ref=r?Fd(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yC=Symbol("radix.slottable");function vC(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yC}function wC(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const 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 bC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],In=IC.reduce((e,t)=>{const n=js(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Po="Checkbox",[CC,j0]=Fo(Po),[xC,Ea]=CC(Po);function OC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:u="on",internal_do_not_use_render:d}=e,[g,m]=_a({prop:n,defaultProp:o??!1,onChange:c,caller:Po}),[b,y]=k.useState(null),[p,C]=k.useState(null),h=k.useRef(!1),v=b?!!s||!!b.closest("form"):!0,I={checked:g,disabled:i,setChecked:m,control:b,setControl:y,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:h,required:f,defaultChecked:Un(o)?!1:o,isFormControl:v,bubbleInput:p,setBubbleInput:C};return l.jsx(xC,{scope:t,...I,children:_C(d)?d(I):r})}var Pd="CheckboxTrigger",Dd=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:g,isFormControl:m,bubbleInput:b}=Ea(Pd,e),y=Br(o,u),p=k.useRef(c);return k.useEffect(()=>{const C=i==null?void 0:i.form;if(C){const h=()=>d(p.current);return C.addEventListener("reset",h),()=>C.removeEventListener("reset",h)}},[i,d]),l.jsx(In.button,{type:"button",role:"checkbox","aria-checked":Un(c)?"mixed":c,"aria-required":f,"data-state":Ld(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:y,onKeyDown:zt(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:zt(n,C=>{d(h=>Un(h)?!0:!h),b&&m&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})})});Dd.displayName=Pd;var Na=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:u,...d}=e;return l.jsx(OC,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Dd,{...d,ref:t,__scopeCheckbox:n}),g&&l.jsx(jd,{__scopeCheckbox:n})]})})});Na.displayName=Po;var Md="CheckboxIndicator",Ta=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Ea(Md,n);return l.jsx(Sa,{present:r||Un(i.checked)||i.checked===!0,children:l.jsx(In.span,{"data-state":Ld(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ta.displayName=Md;var kd="CheckboxBubbleInput",jd=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:u,form:d,bubbleInput:g,setBubbleInput:m}=Ea(kd,e),b=Br(n,m),y=dC(i),p=fC(r);k.useEffect(()=>{const h=g;if(!h)return;const v=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(v,"checked").set,S=!o.current;if(y!==i&&O){const N=new Event("click",{bubbles:S});h.indeterminate=Un(i),O.call(h,Un(i)?!1:i),h.dispatchEvent(N)}},[g,y,i,o]);const C=k.useRef(Un(i)?!1:i);return l.jsx(In.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??C.current,required:a,disabled:c,name:f,value:u,form:d,...t,tabIndex:-1,ref:b,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});jd.displayName=kd;function _C(e){return typeof e=="function"}function Un(e){return e==="indeterminate"}function Ld(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function qd(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 SC=["color"],Kd=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=qd(e,SC);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),EC=["color"],NC=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=qd(e,EC);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const TC="_checkboxGroupContainer_1ya1t_1",RC="_stack_1ya1t_6",AC="_selectAllContainer_1ya1t_11",FC="_fieldContainer_1ya1t_18",PC="_checkbox_1ya1t_1",Jr={checkboxGroupContainer:TC,stack:RC,selectAllContainer:AC,fieldContainer:FC,checkbox:PC};function Ud({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Jr.fieldContainer,children:[l.jsx(Na,{className:Jr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ta,{children:l.jsx(Kd,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Vd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Jr.selectAllContainer,children:[l.jsx(Na,{className:Jr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Ta,{children:[o&&l.jsx(NC,{}),t===!0&&l.jsx(Kd,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function $d({children:e}){return l.jsx("div",{className:Jr.checkboxGroupContainer,children:e})}function Hd({children:e}){return l.jsx("div",{className:Jr.stack,children:e})}function DC(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=!lu(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function zc(e,t,n,r){t(e,o=>DC(o,n,r))}function MC(){var d,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Yt(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(m,b)=>{m!=="indeterminate"&&r&&t&&zc(r,n,b,m)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,a=m=>{r&&s&&s.forEach(b=>{$n(b)||zc(r,n,b.fieldName,m)})},c=!!(s&&s.length>0),f=Object.keys(o||{}).length===(s==null?void 0:s.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`${e} reads the following optional fields`}),l.jsxs($d,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Vd,{id:"select-all-fields",isChecked:f,label:"Select all",onCheckedChange:a,isIndeterminate:u}),l.jsx(Hd,{children:s.map(m=>$n(m)?null:l.jsx(Ud,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:b=>i(b,m.fieldName)},m.fieldName))})]})]})}function kC(){return l.jsx(MC,{})}const jC={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 LC({children:e,style:t,...n}){return l.jsx("span",{style:{...jC,...t},...n,children:e})}function qC(){var n,r,o;const{configureState:e}=Yt(),{appName:t}=Ne();return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`${t} reads the following fields`}),l.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=>$n(i)?null:l.jsx(LC,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function KC(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 Bd(e,t,n,r,o){t(e,i=>KC(i,e,n,r,o))}function UC(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function VC({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function $C({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var O;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Yt(),[c,f]=w.useState(!0),{getError:u,setError:d,resetBoundary:g,isError:m,removeError:b}=Dt(),y=w.useMemo(()=>{var S,N;return((N=(S=i==null?void 0:i.read)==null?void 0:S.selectedValueMappings)==null?void 0:N[n])||{}},[(O=i==null?void 0:i.read)==null?void 0:O.selectedValueMappings,n]),p=w.useMemo(()=>y==null?void 0:y[e.mappedValue],[y,e.mappedValue]);w.useEffect(()=>{f(!1)},[e,a,s,p,i]);const C=w.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),h=w.useCallback(S=>{if(S){if(Object.values(y).some(N=>N===S.value&&N!==p)){const N=[...Object.entries(y).filter(([T,A])=>A===S.value&&A!==p).map(([T])=>T),e.mappedValue];d(ue.VALUE_MAPPING,n,N);return}u(ue.VALUE_MAPPING,n)&&g(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,y,p,n,e.mappedValue,g,d,u]),v=w.useMemo(()=>l.jsx(ud,{disabled:c,items:C,selectedValue:p||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,C,h,o]),I=w.useCallback(()=>{s&&(Bd(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&b(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,b]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,l.jsx(Qe,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function HC(){var m,b,y;const{fieldMapping:e}=ot(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),{isError:o,removeError:i,getError:s}=Dt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(b=n==null?void 0:n.read)==null?void 0:b.selectedValueMappings,f=(y=n==null?void 0:n.read)==null?void 0:y.isValueMappingsModified,u=w.useRef(!1),d=w.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(C=>C.mappedValues).map(C=>({...C})):[];if(a)for(let C=0;C<p.length;C+=1){const{mapToName:h}=p[C];a!=null&&a[h]&&(p[C].fieldName=a[h])}return p},[t,e,a]),g=w.useCallback(p=>{const{value:C,name:h,fieldName:v}=p.target;C&&(t&&Bd(t,r,h,C,v),o(ue.VALUE_MAPPING,h)&&i(ue.VALUE_MAPPING,h))},[t,r,o,i]);return w.useEffect(()=>{var p;if(t&&c){const C=((p=e==null?void 0:e[t])==null?void 0:p.filter(v=>v.fieldName&&v.mappedValues.length>0))||[];C.every(v=>{const I=c[v.fieldName]||{};return Object.keys(I).length===Object.keys(v.mappedValues).length})&&C.length>0?!f&&!u.current&&(UC(t,r,!0),u.current=!0):u.current=!1}},[c,d,t,r,e,f]),d!=null&&d.length?l.jsx(l.Fragment,{children:d.map(p=>{var S,N,T;if(!p.fieldName)return null;const C=(N=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:N[p.fieldName],h=C==null?void 0:C.valueType;if(!["singleSelect","multiSelect"].includes(h))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const v=C==null?void 0:C.values;if(!v)return null;const I=Object.keys(v).length,O=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==O?(console.error("field values and the values to be mapped are not of the same length",p,v),null):l.jsxs(l.Fragment,{children:[l.jsx(VC,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(Ao,{id:p.mapToName||p.fieldName,children:(T=p==null?void 0:p.mappedValues)==null?void 0:T.map(A=>{var $,B,ae;const D=s(ue.VALUE_MAPPING,p.fieldName),J=Array.isArray(D)&&D.includes(A.mappedValue),K=((ae=(B=($=n==null?void 0:n.read)==null?void 0:$.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ae.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx($C,{allValueOptions:K,mappedValue:A,onSelectChange:g,fieldName:(p==null?void 0:p.fieldName)||"",hasError:J},`${A.mappedValue}-${p.fieldName}`),J&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},A.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function BC(){return rC(),l.jsxs(l.Fragment,{children:[l.jsx(sC,{}),l.jsx(qC,{}),l.jsx(tC,{}),l.jsx(eC,{}),l.jsx(HC,{}),l.jsx(kC,{})]})}function JC(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=!Av(a,s);e.write.isWriteModified=f}}}function Qc(e,t,n,r){t(e,o=>{JC(o,n,r)})}function WC(){var d,g,m,b;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(y,p)=>{y!=="indeterminate"&&t&&n&&Qc(t,r,p,y)},a=y=>{var p,C;t&&n&&((C=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||C.forEach(h=>{Qc(t,r,h.objectName,y)}))},c=!!i,f=Object.keys(o||{}).length===((b=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:b.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:`Allow ${e} to write to these objects`}),l.jsxs($d,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Vd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:u,isChecked:f,label:"Select all"}),l.jsx(Hd,{children:i.map(y=>l.jsx(Ud,{id:y.objectName,onCheckedChange:p=>s(p,y.objectName),isChecked:!!(o!=null&&o[y.objectName]),label:y.displayName},y.objectName))})]})]})}function zC(){return l.jsx(l.Fragment,{children:l.jsx(WC,{})})}const QC="_authenticationRow_cjz1t_1",GC="_field_cjz1t_8",XC="_value_cjz1t_12",rs={authenticationRow:QC,field:GC,value:XC};function Gc({label:e,value:t}){return l.jsxs("div",{className:rs.authenticationRow,children:[l.jsx("div",{className:rs.field,children:e}),l.jsx("div",{className:rs.value,children:t})]})}function YC(){const{selectedConnection:e}=Xt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Connection details"}),l.jsxs("div",{style:{paddingBottom:"1rem"},children:[l.jsx(Gc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(Gc,{label:"Status",value:e==null?void 0:e.status})]})]})}const ZC=()=>{const e=it(),t=Le();return vn({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."),Ue(n)}})};function Jd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ne(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=ot(),[c,f]=w.useState(!1),u=!r||!o||!(i!=null&&i.id)||c,d=ZC(),g=async()=>{u||(f(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),d.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>f(!1)}))},m=c?"Uninstalling...":e,b=l.jsx(Qe,{type:"button",onClick:g,disabled:u,variant:t,style:n,children:m});return i!=null&&i.id?b:null}function ex(){const{installation:e}=ot(),{providerName:t}=lt();return e?l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Uninstall entire integration"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?l.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."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Jd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function tx(){return l.jsxs(l.Fragment,{children:[l.jsx(YC,{}),l.jsx(Xs,{}),l.jsx(ex,{})]})}function Wd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,N,T,A;const{installation:i}=ot(),{hydratedRevision:s,loading:a}=Xr(),{configureState:c,selectedObjectName:f}=Yt(),u=i==null?void 0:i.config,d=u&&f&&!!ou(u,f)||!1,g=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isRequiredMapFieldsModified)||((T=c==null?void 0:c.read)==null?void 0:T.isValueMappingsModified),m=(A=c==null?void 0:c.write)==null?void 0:A.isWriteModified,C=a||n||!c||!f||!(g||m||r||f!==pr&&!d),h=f===pr,v=f===oo,I=l.jsx(Qe,{type:"submit",disabled:C,children:r?"Install":"Save"}),O=l.jsx(Qe,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?l.jsx(ui,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!v&&l.jsxs(l.Fragment,{children:[I,O]})}),l.jsxs(wn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Ci,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ui,{}),s&&!h&&!v&&l.jsx(BC,{}),s&&h&&!v&&l.jsx(zC,{}),!a&&v&&l.jsx(tx,{})]})]})}const zd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=ot(),{hydratedRevision:s,loading:a}=Xr(),{selectedObjectName:c}=Cd(),{selectedConnection:f}=Xt(),u=xl(),{projectId:d}=Ne(),{resetBoundary:g,setErrors:m,setError:b,getError:y}=Dt(),{resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:h}=xa(),v=mu(c||"",C),{onNextIncompleteTab:I}=RI(),O=w.useCallback(()=>{g(ue.INSTALLATION_MUTATION)},[g]),S=w.useCallback(T=>T?A=>{b(ue.INSTALLATION_MUTATION,T,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[b]),N=w.useCallback(T=>T?y(ue.INSTALLATION_MUTATION,T):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:u,projectId:d,resetBoundary:g,setErrors:m,setMutateInstallationError:S,getMutateInstallationError:N,resetMutateInstallationErrorState:O,resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:h,configureState:v,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},nx=void 0;function rx(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:f,resetBoundary:u,setErrors:d,setMutateInstallationError:g,getMutateInstallationError:m,resetMutateInstallationErrorState:b,resetConfigureState:y,objectConfigurationsState:p,resetPendingConfigurationState:C,configureState:h,onInstallSuccess:v,onNextIncompleteTab:I}=zd(),[O,S]=w.useState(!1),N=s===pr,T=m(s),A=w.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&du(o,nx,s,y)},[u,o,i,s,y]);w.useEffect(()=>{!h&&(o!=null&&o.content)&&!i&&A()},[h,p,o,i,A]);const D=()=>{b();const{requiredMapFields:$,selectedFieldMappings:B}=(h==null?void 0:h.read)||{},{errorList:ae}=cu($,B,d);ae.length>0||(s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),jv(f,e,t,n,a.id,s,c,o,h,g(s),r,v).finally(()=>{S(!1),C(s),I()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},J=()=>{b(),s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),Kv(f,e,t,n,a.id,c,o,h,g(s),r,v).finally(()=>{S(!1),C(s),I()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},K=$=>{$.preventDefault(),N?J():D()};return l.jsx(Wd,{errorMsg:T,isCreateMode:!0,isLoading:O,onSave:K,onReset:A})}function ix({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const f={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${bv(i)}`],installation:{config:e}}};return Hs().installationApi.updateInstallation(f,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(u=>{s(u),a==null||a(u.id,u.config)}).catch(u=>{Ue(u,c)})}const ox=(e,t,n,r,o,i)=>{const s=fu(e),a=pu(e),c=hu(e),f={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return Ii(o)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},sx=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=ox(i,r||"",a,a.schedule,c,a.backfill);return d?ix({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:f,setInstallation:s,onUpdateSuccess:u}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ax=(e,t)=>{const r={content:{write:{objects:yu(e)}}};return Ii(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},cx=(e,t,n,r,o,i,s,a,c)=>{const f=ax(o,i);if(!f)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const u={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:f}}};return Hs().installationApi.updateInstallation(u,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{a(d),c==null||c(d.id,d.config)}).catch(d=>{Ue(d,s)})};function lx({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:f,setMutateInstallationError:u,getMutateInstallationError:d,resetConfigureState:g,resetPendingConfigurationState:m,configureState:b,onUpdateSuccess:y,onNextIncompleteTab:p}=zd(),[C,h]=w.useState(!1),v=i===pr,I=d(i),{config:O}=e,S=w.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&du(r,O,i,g)},[c,r,o,i,O,g]);w.useEffect(()=>{b||S()},[b,S]);const N=w.useMemo(()=>{var K,$,B;return(B=($=(K=r==null?void 0:r.content)==null?void 0:K.read)==null?void 0:$.objects)==null?void 0:B.find(ae=>(ae==null?void 0:ae.objectName)===i)},[r,i]),T=()=>{const{requiredMapFields:J,selectedFieldMappings:K}=(b==null?void 0:b.read)||{},{errorList:$}=cu(J,K,f);$.length>0||(r&&e&&i&&s&&a&&N?(h(!0),sx(a,t.id,e.id,i,s,b,n,N,r,u(i),y).finally(()=>{h(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},A=()=>{e&&i&&s&&a&&r?(h(!0),cx(a,t.id,e.id,s,b,r,u(i),n,y).finally(()=>{h(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},D=J=>{J.preventDefault(),v?A():T()};return l.jsx(Wd,{errorMsg:I,onSave:D,onReset:S,isLoading:C})}function ux(){const{integrationObj:e,installation:t}=ot();return e?t&&e?l.jsx(lx,{installation:t,integrationObj:e}):l.jsx(rx,{}):l.jsx(Yl,{message:"We can't load the integration"})}const Qd=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function dx(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ra({text:e,children:t}){return l.jsx(Qr,{children:l.jsxs(wn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(dx,{}),l.jsx("p",{children:e}),t]})})}function fx({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Ra,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Jd,{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 hx({children:e}){var O;const t=w.useRef(!1),{projectId:n}=Ne(),{hydratedRevision:r,loading:o}=Xr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:u}=ot(),{mutate:d,isIdle:g,isPending:m,error:b,errorMsg:y}=Qd(),{selectedConnection:p,isConnectionsLoading:C}=Xt(),h=o||m||C,v=(O=r==null?void 0:r.content)==null?void 0:O.provider,I=px(r);return w.useEffect(()=>{var S;if(!h&&!C&&r&&I&&!s&&p&&(i!=null&&i.id)&&!u&&v){const N={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:v}}}};Ii(r)===!0&&(N.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),g&&!t.current&&(d(N,{onSuccess:T=>{f==null||f(T==null?void 0:T.id,T.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,c,h,f,u,C,v,d,g]),I&&v&&s?l.jsx(fx,{provider:v}):b?l.jsx(Wt,{message:y??"Create installation failed"}):i?h?l.jsx(Gr,{}):l.jsx("div",{children:e}):l.jsx(Wt,{message:"We can't load the integration"})}function Do(){const e=it(),t=Le();return vn({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"),Ue(n)}})}function mx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.useCallback(d=>{var y;const{apiKey:g,providerMetadata:m}=d,b={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(y=m==null?void 0:m.workspace)==null?void 0:y.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:g,...m&&{providerMetadata:m}}};f.mutate(b)},[c,i,o,r,n,e,f]);return a===null?l.jsx(sw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function gx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.useCallback(d=>{var p;const{user:g,pass:m,providerMetadata:b}=d,y={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=b==null?void 0:b.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:g,password:m},...b&&{providerMetadata:b}}};f.mutate(y)},[c,i,o,r,n,e,f]);return a===null?l.jsx(dw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function yx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(vr,{children:[l.jsx(wr,{children:i||`Set up ${r} integration`}),l.jsx(bn,{error:t}),o,l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function vx({...e}){return l.jsx(yx,{...e})}function wx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Ne(),f=Do(),u=w.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?l.jsx(vx,{handleSubmit:u,error:null,providerName:a}):i}const bx=()=>{const e=it(),t=Le();return vn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function Ix({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${r} integration`}),l.jsx(nw,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(bn,{error:t}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const Cx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function xx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:"Enter your Salesforce subdomain"}),l.jsx(bu,{href:Cx,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(bn,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(Jt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Ox({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return l.jsxs(vr,{children:[l.jsxs(wr,{children:["Enter your ",o," workspace"]}),l.jsx(bn,{error:n}),l.jsx("br",{}),i.map(s=>l.jsx(Jt.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),l.jsx("br",{}),l.jsx(Qe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Xc=600,Yc=600,Zc="salesforce";function _x({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var J;const{projectId:s}=Ne(),a=Le(),c=w.useRef(null),[f,u]=w.useState(null),[d,g]=w.useState(""),[m,b]=w.useState({}),[y,p]=w.useState({}),{data:C}=bo(e),h=((J=C==null?void 0:C.metadata)==null?void 0:J.input)||[],{mutateAsync:v,isPending:I}=bx(),{isFetching:O,refetch:S}=Js({groupRef:r,provider:e});w.useEffect(()=>{const K=$=>{var B,ae,re;$.origin===Bl&&(((B=$.data)==null?void 0:B.eventType)==="AUTHORIZATION_SUCCEEDED"?(u(null),console.debug("New connection:",$.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=$.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",$.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),u($.data.data.error||"An error occurred. Please try again.")),(re=c.current)==null||re.close())};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[a]);const N=K=>{g(K),b($=>({...$,workspace:K})),p($=>({...$,workspace:{value:K,source:"input"}}))},T=(K,$)=>{b(B=>({...B,[K]:$})),p(B=>({...B,[K]:{value:$,source:"input"}}))},A=async()=>{var K;u(null);try{const{data:$}=await S();if($&&$.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!di(h,m)){u("Please fill in all required fields");return}try{const $=await v({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s,consumerName:n,groupName:o,providerWorkspaceRef:e===Zc?d:(K=y==null?void 0:y.workspace)==null?void 0:K.value,providerMetadata:y}});if($){const B=window.screenX+(window.outerWidth-Xc)/2,ae=window.screenY+(window.outerHeight-Yc)/2.5,re=`width=${Xc},height=${Yc},left=${B},top=${ae}`;c.current=window.open($,"OAuthPopup",re)}}catch($){console.error($),u($ instanceof Error?$.message:String($)||"An error occurred. Please try again.")}},D=e===Zc?l.jsx(xx,{handleSubmit:A,setWorkspace:N,error:f,isButtonDisabled:d.length===0||I||O}):h.length>0?l.jsx(Ox,{handleSubmit:A,setFormData:T,error:f,isButtonDisabled:!di(h,m)||I||O,providerName:i,metadataFields:h}):l.jsx(Ix,{handleSubmit:A,error:f,providerName:i,isButtonDisabled:I||O});return l.jsx("div",{children:D})}function Sx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Do(),[u,d]=w.useState(null),g=w.useCallback(m=>{var y,p;d(null);const b={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(y=m.providerMetadata)==null?void 0:y.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};f.mutate(b,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?l.jsx(pw,{provider:e,providerName:t,handleSubmit:g,error:u,explicitScopesRequired:s}):l.jsx(ui,{})}function Ex({...e}){return l.jsx(Sx,{...e})}const Nx="authorizationCode",Tx="authorizationCodePKCE",Rx="clientCredentials";function Ax({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=lt(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:u}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===Nx||f===Tx?l.jsx(_x,{...d}):f===Rx?l.jsx(Ex,{...d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):f==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",f]})}function Fx(e){const{selectedConnection:t}=Xt();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function Px({onSuccess:e}){Fx(e)}function Gd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:u,isError:d,error:g,providerName:m,selectedProvider:b}=lt(e),{provider:y,isIntegrationDeleted:p}=ot(),{selectedConnection:C,setSelectedConnection:h}=Xt();Px({onSuccess:s});const v=Le();w.useEffect(()=>{d&&(console.error("Error loading provider info."),Ue(g))},[d,g]);const I=w.useCallback(()=>{v.clear(),c()},[c,v]);if(!e&&!y)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Ra,{text:"Integration successfully uninstalled.",children:l.jsx(Qe,{type:"button",onClick:I,style:{width:"100%"},children:"Reinstall Integration"})});if(C)return i;if(u)return l.jsx(Gr,{});if(f==null)return l.jsx(Wt,{message:"Provider info was not found."});const O={provider:b,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:C,setSelectedConnection:h,providerName:m,providerInfo:f,onDisconnectSuccess:a};return f.authType==="none"?l.jsx(wx,{...O,children:i}):f.authType==="basic"?l.jsx(gx,{...O,children:i}):f.authType==="apiKey"?l.jsx(mx,{...O,children:i}):l.jsx(Ax,{...O})}function Dx(e){const t=e+"CollectionProvider",[n,r]=Fo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:p,children:C}=y,h=w.useRef(null),v=w.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:v,collectionRef:h,children:C})};s.displayName=t;const a=e+"CollectionSlot",c=js(a),f=w.forwardRef((y,p)=>{const{scope:C,children:h}=y,v=i(a,C),I=Br(p,v.collectionRef);return l.jsx(c,{ref:I,children:h})});f.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",g=js(u),m=w.forwardRef((y,p)=>{const{scope:C,children:h,...v}=y,I=w.useRef(null),O=Br(p,I),S=i(u,C);return w.useEffect(()=>(S.itemMap.set(I,{ref:I,...v}),()=>void S.itemMap.delete(I))),l.jsx(g,{[d]:"",ref:O,children:h})});m.displayName=u;function b(y){const p=i(e+"CollectionConsumer",y);return w.useCallback(()=>{const h=p.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((S,N)=>v.indexOf(S.ref.current)-v.indexOf(N.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},b,r]}var Mx=k[" useId ".trim().toString()]||(()=>{}),kx=0;function Xd(e){const[t,n]=k.useState(Mx());return gi(()=>{e||n(r=>r??String(kx++))},[e]),e||(t?`radix-${t}`:"")}function jx(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var Lx=k.createContext(void 0);function Yd(e){const t=k.useContext(Lx);return e||t||"ltr"}var is="rovingFocusGroup.onEntryFocus",qx={bubbles:!1,cancelable:!0},Si="RovingFocusGroup",[Ls,Zd,Kx]=Dx(Si),[Ux,ef]=Fo(Si,[Kx]),[Vx,$x]=Ux(Si),tf=k.forwardRef((e,t)=>l.jsx(Ls.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ls.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Hx,{...e,ref:t})})}));tf.displayName=Si;var Hx=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=e,g=k.useRef(null),m=Br(t,g),b=Yd(i),[y,p]=_a({prop:s,defaultProp:a??null,onChange:c,caller:Si}),[C,h]=k.useState(!1),v=jx(f),I=Zd(n),O=k.useRef(!1),[S,N]=k.useState(0);return k.useEffect(()=>{const T=g.current;if(T)return T.addEventListener(is,v),()=>T.removeEventListener(is,v)},[v]),l.jsx(Vx,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:y,onItemFocus:k.useCallback(T=>p(T),[p]),onItemShiftTab:k.useCallback(()=>h(!0),[]),onFocusableItemAdd:k.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:k.useCallback(()=>N(T=>T-1),[]),children:l.jsx(In.div,{tabIndex:C||S===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:zt(e.onMouseDown,()=>{O.current=!0}),onFocus:zt(e.onFocus,T=>{const A=!O.current;if(T.target===T.currentTarget&&A&&!C){const D=new CustomEvent(is,qx);if(T.currentTarget.dispatchEvent(D),!D.defaultPrevented){const J=I().filter(re=>re.focusable),K=J.find(re=>re.active),$=J.find(re=>re.id===y),ae=[K,$,...J].filter(Boolean).map(re=>re.ref.current);of(ae,u)}}O.current=!1}),onBlur:zt(e.onBlur,()=>h(!1))})})}),nf="RovingFocusGroupItem",rf=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Xd(),f=i||c,u=$x(nf,n),d=u.currentTabStopId===f,g=Zd(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:y}=u;return k.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),l.jsx(Ls.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:l.jsx(In.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:zt(e.onMouseDown,p=>{r?u.onItemFocus(f):p.preventDefault()}),onFocus:zt(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:zt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const C=Wx(p,u.orientation,u.dir);if(C!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let v=g().filter(I=>I.focusable).map(I=>I.ref.current);if(C==="last")v.reverse();else if(C==="prev"||C==="next"){C==="prev"&&v.reverse();const I=v.indexOf(p.currentTarget);v=u.loop?zx(v,I+1):v.slice(I+1)}setTimeout(()=>of(v))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:y!=null}):s})})});rf.displayName=nf;var Bx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Wx(e,t,n){const r=Jx(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Bx[r]}function of(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Qx=tf,Gx=rf,Mo="Tabs",[Xx,L0]=Fo(Mo,[ef]),sf=ef(),[Yx,Aa]=Xx(Mo),af=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,u=Yd(a),[d,g]=_a({prop:r,onChange:o,defaultProp:i??"",caller:Mo});return l.jsx(Yx,{scope:n,baseId:Xd(),value:d,onValueChange:g,orientation:s,dir:u,activationMode:c,children:l.jsx(In.div,{dir:u,"data-orientation":s,...f,ref:t})})});af.displayName=Mo;var cf="TabsList",lf=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Aa(cf,n),s=sf(n);return l.jsx(Qx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(In.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});lf.displayName=cf;var uf="TabsTrigger",df=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Aa(uf,n),a=sf(n),c=pf(s.baseId,r),f=hf(s.baseId,r),u=r===s.value;return l.jsx(Gx,{asChild:!0,...a,focusable:!o,active:u,children:l.jsx(In.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:zt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:zt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:zt(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});df.displayName=uf;var ff="TabsContent",Zx=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Aa(ff,n),c=pf(a.baseId,r),f=hf(a.baseId,r),u=r===a.value,d=k.useRef(u);return k.useEffect(()=>{const g=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Sa,{present:o||u,children:({present:g})=>l.jsx(In.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:g&&i})})});Zx.displayName=ff;function pf(e,t){return`${e}-trigger-${t}`}function hf(e,t){return`${e}-content-${t}`}var e0=af,t0=lf,mf=df;const n0=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function r0(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?n0:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function i0(){return l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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 o0="_tabsRoot_ktpr0_1",s0="_tabsList_ktpr0_6",a0="_tabTrigger_ktpr0_12",c0="_danger_ktpr0_29",vo={tabsRoot:o0,tabsList:s0,tabTrigger:a0,danger:c0};function l0(){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(mf,{value:oo,className:vo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(i0,{}),l.jsx("span",{children:"Manage"})]})})]})}function gf({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(mf,{value:e,className:vo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[r0(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function u0({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(gf,{objectName:pr,completed:e,pending:t,displayName:n},"other-write")]})}function d0({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(e0,{value:e,className:vo.tabsRoot,onValueChange:n,children:l.jsxs(t0,{className:vo.tabsList,children:[t.map(a=>{var c,f,u,d,g,m;return l.jsx(gf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((f=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:f.isOptionalFieldsModified)||((d=(u=r==null?void 0:r[a.name])==null?void 0:u.read)==null?void 0:d.isRequiredMapFieldsModified)||((m=(g=r==null?void 0:r[a.name])==null?void 0:g.read)==null?void 0:m.isValueMappingsModified)||!1},a.name)}),o&&l.jsx(u0,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),l.jsx(l0,{})]})})}function f0(e,t){return t===oo?{name:oo,completed:!1}:e.find(n=>n.name===t)}function p0({children:e}){var C;const{project:t}=Ne(),{installation:n}=ot(),{providerName:r}=lt(),{hydratedRevision:o}=Xr(),{objectConfigurationsState:i}=xa(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,u=o&&su(f,o),d=u!==null,g=!!((C=o==null?void 0:o.content)!=null&&C.write),m=g?au(f):void 0,b=w.useMemo(()=>{const h=[...u||[]];return m&&g&&h.push(m),h},[u,m,g]),y=f0(b,s),p=w.useCallback(()=>{const h=b.find(v=>y!==v&&!v.completed);h&&a(h.name)},[b,y]);return w.useEffect(()=>{!s&&b.length>0&&a(b[0].name)},[b,s,p]),l.jsx(xd.Provider,{value:p,children:l.jsx(Id.Provider,{value:y==null?void 0:y.name,children:l.jsxs(Qr,{style:{maxWidth:"55rem"},children:[l.jsxs(wn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),d&&l.jsx(d0,{value:s,readNavObjects:u,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:m})]}),e]}),l.jsx(wu,{})]})})})}function h0({...e}){return l.jsx(p0,{...e})}const m0="_resetContainer_lkwv9_4",yf={resetContainer:m0};function g0({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:f,isLoading:u}=Ne(),{isLoading:d}=Bs(),{isError:g,errorState:m}=Dt(),{seed:b,reset:y}=ru();return u||d?l.jsx(Gr,{}):g(ue.PROJECT,f)?l.jsx(Wt,{message:`Error loading project ${f}`}):g(ue.INTEGRATION_LIST,f)?l.jsx(Wt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Wt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:yf.resetContainer,children:l.jsx(Cv,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(nu,{children:l.jsx(Gd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:y,children:l.jsx(_w,{resetComponent:y,children:l.jsx(hx,{children:l.jsx($I,{children:l.jsx(h0,{children:l.jsx(ux,{})})})})})})})},b)})}function y0(){return l.jsxs(Qr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ui,{}),l.jsx("p",{children:"Redirecting"})]})}function v0({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(y0,{}):t}function w0({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=w.useState(!1);return l.jsxs(l.Fragment,{children:[r===!1&&l.jsxs(l.Fragment,{children:[l.jsx(_t,{string:"Manage connection"}),l.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[l.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),l.jsx(Qe,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Xs,{provider:n}),l.jsx(_t,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(Ou,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function b0({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ne(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Ra,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(w0,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function I0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:u}=ru(),d=w.useCallback(g=>{s?s(g.id):c&&c(g)},[s,c]);return l.jsx("div",{className:yf.resetContainer,children:l.jsx(nu,{groupRef:r,provider:e,children:l.jsx(Gd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:l.jsx(v0,{redirectURL:i,children:l.jsx(b0,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},f)}const C0=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Ws(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 w.useEffect(()=>{o&&Ue(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};function Ei(){const{integrationNameOrId:e,groupRef:t}=Zr(),n=Ws(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 Fa=()=>{const{groupRef:e,integrationNameOrId:t}=Zr(),{provider:n}=zr(t),r=Js({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}},x0=()=>{var g;const e=Le(),t=it(),{connection:n,isPending:r,isFetching:o}=Fa(),{projectIdOrName:i}=Ne(),{integrationNameOrId:s}=Zr(),{data:a}=zr(s),c=n==null?void 0:n.id,f=a==null?void 0:a.id,u=(g=a==null?void 0:a.latestRevision)==null?void 0:g.id,d=r||o;return w.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Jn({queryKey:["amp","hydratedRevision",i,f,u,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!f)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:f,revisionId:u,connectionId:c})},retry:3,enabled:!!i&&!!f&&!!u&&!!c&&!d})};function vf(){var f;const e=x0(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=w.useMemo(()=>({getReadObject:u=>{var g,m;const d=(m=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:m.find(b=>b.objectName===u);return d?{object:d,getRequiredFields:()=>d.requiredFields??[],getOptionalFields:()=>d.optionalFields??[]}:(console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getCustomerFieldsForObject:u=>{var g,m;const d=(m=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:m.find(b=>b.objectName===u);return d?{allFields:d.allFieldsMetadata??{},getField:b=>{var p;const y=(p=d.allFieldsMetadata)==null?void 0:p[b];return y||(console.error(`Field ${b} not found`),null)}}:(console.error(`Object ${u} not found`),{allFields:null,getField:()=>null})}}),[(f=a==null?void 0:a.read)==null?void 0:f.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function O0(e){var d,g,m,b;const[t,n]=w.useState(e),{getReadObject:r,data:o}=vf(),{installation:i}=Ei(),s=w.useCallback(()=>t,[t]),a=w.useCallback((y,p)=>{var T,A,D,J;p.provider=p.provider||((T=o==null?void 0:o.content)==null?void 0:T.provider)||"";const C=p.read||{objects:{}},h=C.objects||{},v=h[y]||{},I=r(y),O=(A=I==null?void 0:I.object)==null?void 0:A.schedule,S=(D=I==null?void 0:I.object)==null?void 0:D.destination,N={};return(J=I==null?void 0:I.getRequiredFields())==null||J.forEach(K=>{"fieldName"in K&&(N[K.fieldName]=!0)}),v.objectName=v.objectName||y,v.schedule=v.schedule||O||"",v.destination=v.destination||S||"",v.selectedFields=v.selectedFields||N,h[y]=v,C.objects=h,p.read=C,{read:C,objects:h,obj:v}},[r,(d=o==null?void 0:o.content)==null?void 0:d.provider]),c=w.useCallback(y=>{var p,C;return{object:(C=(p=t.read)==null?void 0:p.objects)==null?void 0:C[y],getSelectedField:h=>{var v,I,O,S;return!!((S=(O=(I=(v=t.read)==null?void 0:v.objects)==null?void 0:I[y])==null?void 0:O.selectedFields)!=null&&S[h])},setSelectedField:({fieldName:h,selected:v})=>{n(I=>Ft(I,O=>{const{obj:S}=a(y,O);S.selectedFields=S.selectedFields||{},S.selectedFields[h]=v,S.selectedFields[h]===!1&&delete S.selectedFields[h]}))},getFieldMapping:h=>{var v,I,O,S;return(S=(O=(I=(v=t.read)==null?void 0:v.objects)==null?void 0:I[y])==null?void 0:O.selectedFieldMappings)==null?void 0:S[h]},setFieldMapping:({fieldName:h,mapToName:v})=>{n(I=>Ft(I,O=>{const{obj:S}=a(y,O);S.selectedFieldMappings=S.selectedFieldMappings||{},S.selectedFieldMappings[v]=h}))}}},[(g=t.read)==null?void 0:g.objects,a]),f=w.useCallback(y=>{var I,O;const p=(O=(I=t.write)==null?void 0:I.objects)==null?void 0:O[y],C=S=>{const N=S.write||{},T=N.objects||{},A=T[y]||{objectName:y};return T[y]=A,N.objects=T,S.write=N,{write:N,objects:T,obj:A}},h=(S,N)=>{var T,A;return(A=(T=p==null?void 0:p.selectedFieldSettings)==null?void 0:T[S])==null?void 0:A[N]},v=(S,N,T)=>{n(A=>Ft(A,D=>{var K;const{obj:J}=C(D);J.selectedFieldSettings={...J.selectedFieldSettings,[S]:{...(K=J.selectedFieldSettings)==null?void 0:K[S],[N]:T}}}))};return{object:p,setEnableWrite:()=>{n(S=>Ft(S,N=>{const{obj:T}=C(N);T.objectName=y}))},setDisableWrite:()=>{n(S=>Ft(S,N=>{const{objects:T}=C(N);delete T[y]}))},getWriteObject:()=>{var S,N;return(N=(S=t.write)==null?void 0:S.objects)==null?void 0:N[y]},getSelectedFieldSettings:S=>{var N;return(N=p==null?void 0:p.selectedFieldSettings)==null?void 0:N[S]},setSelectedFieldSettings:({fieldName:S,settings:N})=>{n(T=>Ft(T,A=>{const{obj:D}=C(A),J=D.selectedFieldSettings||{};D.selectedFieldSettings={...J,[S]:N},N===void 0&&delete D.selectedFieldSettings[S]}))},getDefaultValues:S=>h(S,"_default"),setDefaultValues:({fieldName:S,value:N})=>v(S,"_default",N),getWriteOnCreateSetting:S=>h(S,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:S,value:N})=>v(S,"writeOnCreate",N),getWriteOnUpdateSetting:S=>h(S,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:S,value:N})=>v(S,"writeOnUpdate",N)}},[(m=t.write)==null?void 0:m.objects]),u=w.useCallback(()=>{n(y=>Ft(y,p=>{var C;Object.assign(p,(C=i==null?void 0:i.config)==null?void 0:C.content)}))},[(b=i==null?void 0:i.config)==null?void 0:b.content]);return w.useEffect(()=>{console.debug("Installation found",{installation:i}),u()},[i,u]),{draft:t,get:s,reset:u,setDraft:n,readObject:c,writeObject:f}}const wf=w.createContext(null);function _0({children:e,initialConfig:t}){const n=O0(t);return l.jsx(wf.Provider,{value:n,children:e})}function S0(){const e=w.useContext(wf);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const bf=w.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Zr(){const e=w.useContext(bf);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function E0({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=w.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return l.jsx(bf.Provider,{value:s,children:l.jsx(_0,{initialConfig:{},children:e})})}function N0(e){return typeof e.provider=="string"}function T0(e){if(!N0(e))throw new Error("Config must have a provider field for creation");return e}function R0(){const{projectIdOrName:e}=Ne(),{groupRef:t,integrationNameOrId:n}=Zr(),{data:r}=zr(n),{connection:o}=Fa(),{installation:i}=Ei(),s=Le(),{mutate:a,isIdle:c,isPending:f,error:u,errorMsg:d}=Qd();return{createInstallation:({config:m,onSuccess:b,onError:y,onSettled:p})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const C={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:T0(m)}}};return a(C,{onSuccess:h=>{b==null||b(h)},onError:h=>{y==null||y(h)},onSettled:()=>{p==null||p(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:f,error:u,errorMsg:d}}const A0=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function F0(){const{projectIdOrName:e}=Ne(),{integrationNameOrId:t}=Zr(),{data:n}=zr(t),{installation:r}=Ei(),o=Le(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=A0();return{updateInstallation:({config:d,onSuccess:g,onError:m,onSettled:b})=>{var C,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const y=[];if((C=d==null?void 0:d.write)!=null&&C.objects&&Object.keys(d.write.objects).length>0&&y.push("config.content.write.objects"),(h=d==null?void 0:d.read)!=null&&h.objects){const v=Object.keys(d.read.objects);y.push(...v.map(I=>`config.content.read.objects.${I}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:y,installation:{config:{content:d}}}};return i(p,{onSuccess:v=>{g==null||g(v)},onError:v=>{m==null||m(v)},onSettled:()=>{b==null||b(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}const P0=()=>{const e=it(),t=Le(),[n,r]=w.useState(null);return{...vn({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"),Ue(i,r)}}),errorMsg:n}};function D0(){const{projectIdOrName:e}=Ne(),{integrationNameOrId:t}=Zr(),{data:n}=zr(t),{installation:r}=Ei(),o=Le(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:f}=P0();return{deleteInstallation:({onSuccess:d,onError:g,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:b=>{g==null||g(b)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:f}}exports.AmpersandContext=Gl;exports.AmpersandProvider=rv;exports.ConnectProvider=I0;exports.InstallIntegration=g0;exports.InstallationProvider=E0;exports.useAmpersandProvider=iv;exports.useConfig=S0;exports.useConnection=Fa;exports.useCreateInstallation=R0;exports.useDeleteInstallation=D0;exports.useInstallation=Ei;exports.useIsIntegrationInstalled=C0;exports.useManifest=vf;exports.useUpdateInstallation=F0;
|
|
52
52
|
//# sourceMappingURL=amp-react.cjs.js.map
|