@agentlang/lstudio 0.1.9 → 0.2.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/assets/{AwsJson1_1Protocol-wsbyAvre.js → AwsJson1_1Protocol-D8lQS-Rk.js} +1 -1
- package/assets/{index-Bzac4yPb.js → index-C29ElNmj.js} +1 -1
- package/assets/{index-CPpeTRZB.js → index-C_xZWFYS.js} +1 -1
- package/assets/{index-DcfSUfKC.js → index-D1kSoY9M.js} +7 -7
- package/assets/{index-D4z_hbl0-DMpNs09k.js → index-D4z_hbl0-BUXHDjnp.js} +1 -1
- package/assets/{index-BfWs6B7Z.js → index-D8iBh7cU.js} +1 -1
- package/assets/{index-CJzDmIha.js → index-tiMnGCkm.js} +1 -1
- package/assets/{index.browser-CSfSj68l.js → index.browser-BFl5jDO5.js} +3 -3
- package/assets/{loadCognitoIdentity-yMbT3vM8.js → loadCognitoIdentity-iRTOLCFD.js} +1 -1
- package/assets/{loadSts-D2KuE3Wg.js → loadSts-B4rFqvVX.js} +1 -1
- package/assets/{replService-BCjABThC.js → replService-db2RHQxf.js} +1 -1
- package/assets/{util-Cb5ErRuM.js → util-C6VsYPkJ.js} +1 -1
- package/assets/{winston-1qzyIKCb-CLvI85k0.js → winston-1qzyIKCb-_MjolKi7.js} +1 -1
- package/assets/{winston-CtxF18qc-1uz0_uFI.js → winston-CtxF18qc-DJ5_vcVM.js} +1 -1
- package/assets/{winston-CfAk0yN1.js → winston-CymGn6QT.js} +1 -1
- package/assets/{winston-DgHuUfbR.js → winston-utZxLNzu.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D8iBh7cU.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/winston-CymGn6QT.js","assets/util-C6VsYPkJ.js","assets/_commonjs-dynamic-modules-B7n8ZNar.js","assets/__vite-browser-external-DLjrMatA.js","assets/winston-utZxLNzu.js","assets/util-DZRIOW0Z-CproX86h.js","assets/util-CNqBjtt6-GUXK7Yxz.js","assets/inherits_browser-nmOknR35-Bp0mvRSL.js","assets/index-69shuAsh-DF18H7zf.js","assets/_commonjsHelpers-B4e78b8K-W3E8ocG7.js","assets/index-D4z_hbl0-BUXHDjnp.js","assets/winston-1qzyIKCb-_MjolKi7.js","assets/index-DsIu-45t-Bejjlpz4.js","assets/index-DSosZ5sh-Ceejs_jv.js","assets/index-6mKfgpcs-DsgiI2lM.js","assets/_commonjs-dynamic-modules-BpilXLfW-DfYEAvWy.js","assets/index-ChvoNxcO.js","assets/preload-helper-BlTxHScW.js","assets/index-BJBOx-Z---hbiLl7B.js","assets/index.browser-BHPvGrwi-6Mh8eUw-.js","assets/winston-CtxF18qc-DJ5_vcVM.js","assets/index-BGkQxT4m-C1mCQewh.js","assets/index-KGBiLwKE-Doz2tX9S.js","assets/index-Bto-kj6R-C0A_3Pwb.js","assets/index.browser-BFl5jDO5.js","assets/normalizeProvider-EC8cbfMc.js","assets/index-C29ElNmj.js","assets/index-C_xZWFYS.js","assets/AwsJson1_1Protocol-D8lQS-Rk.js","assets/index-BHDiPh0o.js","assets/index-3_2F9LQx.js","assets/replService-db2RHQxf.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{g as getDefaultExportFromCjs,c as commonjsGlobal,a as getAugmentedNamespace}from"./_commonjsHelpers-D6-XlEtG.js";import chalk from"./index-ChvoNxcO.js";import{_ as __vitePreload}from"./preload-helper-BlTxHScW.js";import{c as crypto$1}from"./__vite-browser-external-DLjrMatA.js";import{E as E$b,L as L$a}from"./inherits_browser-nmOknR35-Bp0mvRSL.js";import{f as f$j,u as u$j,l as l$b}from"./_commonjsHelpers-B4e78b8K-W3E8ocG7.js";import{Y as Yr$2}from"./index-6mKfgpcs-DsgiI2lM.js";import{S as Sr$1,L as Lr$2,D as Dr$2}from"./index-DsIu-45t-Bejjlpz4.js";import{F as Ft$5,G as Gt$3,J as J$8}from"./index-69shuAsh-DF18H7zf.js";import G$8 from"./index-BJBOx-Z---hbiLl7B.js";import{g as e$b}from"./index.browser-BHPvGrwi-6Mh8eUw-.js";import{r as r$f}from"./_commonjs-dynamic-modules-BpilXLfW-DfYEAvWy.js";import{I as I$c}from"./index-DSosZ5sh-Ceejs_jv.js";import{b as requireIeee754,a as requireBase64Js,r as require$$0$2,c as commonjsRequire}from"./_commonjs-dynamic-modules-B7n8ZNar.js";function _mergeNamespaces(pa,ha){for(var ma=0;ma<ha.length;ma++){const ja=ha[ma];if(typeof ja!="string"&&!Array.isArray(ja)){for(const La in ja)if(La!=="default"&&!(La in pa)){const Ba=Object.getOwnPropertyDescriptor(ja,La);Ba&&Object.defineProperty(pa,La,Ba.get?Ba:{enumerable:!0,get:()=>ja[La]})}}}return Object.freeze(Object.defineProperty(pa,Symbol.toStringTag,{value:"Module"}))}(function(){const ha=document.createElement("link").relList;if(ha&&ha.supports&&ha.supports("modulepreload"))return;for(const La of document.querySelectorAll('link[rel="modulepreload"]'))ja(La);new MutationObserver(La=>{for(const Ba of La)if(Ba.type==="childList")for(const hl of Ba.addedNodes)hl.tagName==="LINK"&&hl.rel==="modulepreload"&&ja(hl)}).observe(document,{childList:!0,subtree:!0});function ma(La){const Ba={};return La.integrity&&(Ba.integrity=La.integrity),La.referrerPolicy&&(Ba.referrerPolicy=La.referrerPolicy),La.crossOrigin==="use-credentials"?Ba.credentials="include":La.crossOrigin==="anonymous"?Ba.credentials="omit":Ba.credentials="same-origin",Ba}function ja(La){if(La.ep)return;La.ep=!0;const Ba=ma(La);fetch(La.href,Ba)}})();var jsxRuntime={exports:{}},reactJsxRuntime_production={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -69,7 +69,7 @@ Please change the parent <Route path="${ly}"> to <Route path="${ly==="/"?"*":`${
|
|
|
69
69
|
*/var hasRequiredReactIs_production_min;function requireReactIs_production_min(){if(hasRequiredReactIs_production_min)return reactIs_production_min;hasRequiredReactIs_production_min=1;var pa=typeof Symbol=="function"&&Symbol.for,ha=pa?Symbol.for("react.element"):60103,ma=pa?Symbol.for("react.portal"):60106,ja=pa?Symbol.for("react.fragment"):60107,La=pa?Symbol.for("react.strict_mode"):60108,Ba=pa?Symbol.for("react.profiler"):60114,hl=pa?Symbol.for("react.provider"):60109,Gl=pa?Symbol.for("react.context"):60110,zl=pa?Symbol.for("react.async_mode"):60111,Wl=pa?Symbol.for("react.concurrent_mode"):60111,Kl=pa?Symbol.for("react.forward_ref"):60112,su=pa?Symbol.for("react.suspense"):60113,au=pa?Symbol.for("react.suspense_list"):60120,ou=pa?Symbol.for("react.memo"):60115,$m=pa?Symbol.for("react.lazy"):60116,Nm=pa?Symbol.for("react.block"):60121,Mm=pa?Symbol.for("react.fundamental"):60117,Mg=pa?Symbol.for("react.responder"):60118,ly=pa?Symbol.for("react.scope"):60119;function uy(YE){if(typeof YE=="object"&&YE!==null){var JE=YE.$$typeof;switch(JE){case ha:switch(YE=YE.type,YE){case zl:case Wl:case ja:case Ba:case La:case su:return YE;default:switch(YE=YE&&YE.$$typeof,YE){case Gl:case Kl:case $m:case ou:case hl:return YE;default:return JE}}case ma:return JE}}}function GE(YE){return uy(YE)===Wl}return reactIs_production_min.AsyncMode=zl,reactIs_production_min.ConcurrentMode=Wl,reactIs_production_min.ContextConsumer=Gl,reactIs_production_min.ContextProvider=hl,reactIs_production_min.Element=ha,reactIs_production_min.ForwardRef=Kl,reactIs_production_min.Fragment=ja,reactIs_production_min.Lazy=$m,reactIs_production_min.Memo=ou,reactIs_production_min.Portal=ma,reactIs_production_min.Profiler=Ba,reactIs_production_min.StrictMode=La,reactIs_production_min.Suspense=su,reactIs_production_min.isAsyncMode=function(YE){return GE(YE)||uy(YE)===zl},reactIs_production_min.isConcurrentMode=GE,reactIs_production_min.isContextConsumer=function(YE){return uy(YE)===Gl},reactIs_production_min.isContextProvider=function(YE){return uy(YE)===hl},reactIs_production_min.isElement=function(YE){return typeof YE=="object"&&YE!==null&&YE.$$typeof===ha},reactIs_production_min.isForwardRef=function(YE){return uy(YE)===Kl},reactIs_production_min.isFragment=function(YE){return uy(YE)===ja},reactIs_production_min.isLazy=function(YE){return uy(YE)===$m},reactIs_production_min.isMemo=function(YE){return uy(YE)===ou},reactIs_production_min.isPortal=function(YE){return uy(YE)===ma},reactIs_production_min.isProfiler=function(YE){return uy(YE)===Ba},reactIs_production_min.isStrictMode=function(YE){return uy(YE)===La},reactIs_production_min.isSuspense=function(YE){return uy(YE)===su},reactIs_production_min.isValidElementType=function(YE){return typeof YE=="string"||typeof YE=="function"||YE===ja||YE===Wl||YE===Ba||YE===La||YE===su||YE===au||typeof YE=="object"&&YE!==null&&(YE.$$typeof===$m||YE.$$typeof===ou||YE.$$typeof===hl||YE.$$typeof===Gl||YE.$$typeof===Kl||YE.$$typeof===Mm||YE.$$typeof===Mg||YE.$$typeof===ly||YE.$$typeof===Nm)},reactIs_production_min.typeOf=uy,reactIs_production_min}var hasRequiredReactIs$1;function requireReactIs$1(){return hasRequiredReactIs$1||(hasRequiredReactIs$1=1,reactIs$1.exports=requireReactIs_production_min()),reactIs$1.exports}var hoistNonReactStatics_cjs,hasRequiredHoistNonReactStatics_cjs;function requireHoistNonReactStatics_cjs(){if(hasRequiredHoistNonReactStatics_cjs)return hoistNonReactStatics_cjs;hasRequiredHoistNonReactStatics_cjs=1;var pa=requireReactIs$1(),ha={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ma={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},ja={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},La={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ba={};Ba[pa.ForwardRef]=ja,Ba[pa.Memo]=La;function hl($m){return pa.isMemo($m)?La:Ba[$m.$$typeof]||ha}var Gl=Object.defineProperty,zl=Object.getOwnPropertyNames,Wl=Object.getOwnPropertySymbols,Kl=Object.getOwnPropertyDescriptor,su=Object.getPrototypeOf,au=Object.prototype;function ou($m,Nm,Mm){if(typeof Nm!="string"){if(au){var Mg=su(Nm);Mg&&Mg!==au&&ou($m,Mg,Mm)}var ly=zl(Nm);Wl&&(ly=ly.concat(Wl(Nm)));for(var uy=hl($m),GE=hl(Nm),YE=0;YE<ly.length;++YE){var JE=ly[YE];if(!ma[JE]&&!(Mm&&Mm[JE])&&!(GE&&GE[JE])&&!(uy&&uy[JE])){var XE=Kl(Nm,JE);try{Gl($m,JE,XE)}catch{}}}}return $m}return hoistNonReactStatics_cjs=ou,hoistNonReactStatics_cjs}var hoistNonReactStatics_cjsExports=requireHoistNonReactStatics_cjs();const hoistNonReactStatics$1=getDefaultExportFromCjs(hoistNonReactStatics_cjsExports);function _extends$1(){return _extends$1=Object.assign||function(pa){for(var ha=1;ha<arguments.length;ha++){var ma=arguments[ha];for(var ja in ma)Object.prototype.hasOwnProperty.call(ma,ja)&&(pa[ja]=ma[ja])}return pa},_extends$1.apply(this,arguments)}function _inheritsLoose$1(pa,ha){pa.prototype=Object.create(ha.prototype),pa.prototype.constructor=pa,pa.__proto__=ha}function _objectWithoutPropertiesLoose$2(pa,ha){if(pa==null)return{};var ma={},ja=Object.keys(pa),La,Ba;for(Ba=0;Ba<ja.length;Ba++)La=ja[Ba],!(ha.indexOf(La)>=0)&&(ma[La]=pa[La]);return ma}function _assertThisInitialized$1(pa){if(pa===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return pa}var FormikContext=reactExports.createContext(void 0);FormikContext.displayName="FormikContext";var FormikProvider=FormikContext.Provider,FormikConsumer=FormikContext.Consumer;function useFormikContext(){var pa=reactExports.useContext(FormikContext);return pa}var isEmptyArray=function(ha){return Array.isArray(ha)&&ha.length===0},isFunction$7=function(ha){return typeof ha=="function"},isObject$6=function(ha){return ha!==null&&typeof ha=="object"},isInteger$2=function(ha){return String(Math.floor(Number(ha)))===ha},isString$5=function(ha){return Object.prototype.toString.call(ha)==="[object String]"},isEmptyChildren=function(ha){return reactExports.Children.count(ha)===0},isPromise=function(ha){return isObject$6(ha)&&isFunction$7(ha.then)};function getIn$1(pa,ha,ma,ja){ja===void 0&&(ja=0);for(var La=toPath(ha);pa&&ja<La.length;)pa=pa[La[ja++]];return ja!==La.length&&!pa||pa===void 0?ma:pa}function setIn(pa,ha,ma){for(var ja=clone$4(pa),La=ja,Ba=0,hl=toPath(ha);Ba<hl.length-1;Ba++){var Gl=hl[Ba],zl=getIn$1(pa,hl.slice(0,Ba+1));if(zl&&(isObject$6(zl)||Array.isArray(zl)))La=La[Gl]=clone$4(zl);else{var Wl=hl[Ba+1];La=La[Gl]=isInteger$2(Wl)&&Number(Wl)>=0?[]:{}}}return(Ba===0?pa:La)[hl[Ba]]===ma?pa:(ma===void 0?delete La[hl[Ba]]:La[hl[Ba]]=ma,Ba===0&&ma===void 0&&delete ja[hl[Ba]],ja)}function setNestedObjectValues(pa,ha,ma,ja){ma===void 0&&(ma=new WeakMap),ja===void 0&&(ja={});for(var La=0,Ba=Object.keys(pa);La<Ba.length;La++){var hl=Ba[La],Gl=pa[hl];isObject$6(Gl)?ma.get(Gl)||(ma.set(Gl,!0),ja[hl]=Array.isArray(Gl)?[]:{},setNestedObjectValues(Gl,ha,ma,ja[hl])):ja[hl]=ha}return ja}function formikReducer(pa,ha){switch(ha.type){case"SET_VALUES":return _extends$1({},pa,{values:ha.payload});case"SET_TOUCHED":return _extends$1({},pa,{touched:ha.payload});case"SET_ERRORS":return isEqual(pa.errors,ha.payload)?pa:_extends$1({},pa,{errors:ha.payload});case"SET_STATUS":return _extends$1({},pa,{status:ha.payload});case"SET_ISSUBMITTING":return _extends$1({},pa,{isSubmitting:ha.payload});case"SET_ISVALIDATING":return _extends$1({},pa,{isValidating:ha.payload});case"SET_FIELD_VALUE":return _extends$1({},pa,{values:setIn(pa.values,ha.payload.field,ha.payload.value)});case"SET_FIELD_TOUCHED":return _extends$1({},pa,{touched:setIn(pa.touched,ha.payload.field,ha.payload.value)});case"SET_FIELD_ERROR":return _extends$1({},pa,{errors:setIn(pa.errors,ha.payload.field,ha.payload.value)});case"RESET_FORM":return _extends$1({},pa,ha.payload);case"SET_FORMIK_STATE":return ha.payload(pa);case"SUBMIT_ATTEMPT":return _extends$1({},pa,{touched:setNestedObjectValues(pa.values,!0),isSubmitting:!0,submitCount:pa.submitCount+1});case"SUBMIT_FAILURE":return _extends$1({},pa,{isSubmitting:!1});case"SUBMIT_SUCCESS":return _extends$1({},pa,{isSubmitting:!1});default:return pa}}var emptyErrors={},emptyTouched={};function useFormik(pa){var ha=pa.validateOnChange,ma=ha===void 0?!0:ha,ja=pa.validateOnBlur,La=ja===void 0?!0:ja,Ba=pa.validateOnMount,hl=Ba===void 0?!1:Ba,Gl=pa.isInitialValid,zl=pa.enableReinitialize,Wl=zl===void 0?!1:zl,Kl=pa.onSubmit,su=_objectWithoutPropertiesLoose$2(pa,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),au=_extends$1({validateOnChange:ma,validateOnBlur:La,validateOnMount:hl,onSubmit:Kl},su),ou=reactExports.useRef(au.initialValues),$m=reactExports.useRef(au.initialErrors||emptyErrors),Nm=reactExports.useRef(au.initialTouched||emptyTouched),Mm=reactExports.useRef(au.initialStatus),Mg=reactExports.useRef(!1),ly=reactExports.useRef({});reactExports.useEffect(function(){return Mg.current=!0,function(){Mg.current=!1}},[]);var uy=reactExports.useState(0),GE=uy[1],YE=reactExports.useRef({values:cloneDeep(au.initialValues),errors:cloneDeep(au.initialErrors)||emptyErrors,touched:cloneDeep(au.initialTouched)||emptyTouched,status:cloneDeep(au.initialStatus),isSubmitting:!1,isValidating:!1,submitCount:0}),JE=YE.current,XE=reactExports.useCallback(function(YQ){var mee=YE.current;YE.current=formikReducer(mee,YQ),mee!==YE.current&&GE(function(See){return See+1})},[]),cN=reactExports.useCallback(function(YQ,mee){return new Promise(function(See,Ree){var jee=au.validate(YQ,mee);jee==null?See(emptyErrors):isPromise(jee)?jee.then(function(AQ){See(AQ||emptyErrors)},function(AQ){Ree(AQ)}):See(jee)})},[au.validate]),pN=reactExports.useCallback(function(YQ,mee){var See=au.validationSchema,Ree=isFunction$7(See)?See(mee):See,jee=mee&&Ree.validateAt?Ree.validateAt(mee,YQ):validateYupSchema(YQ,Ree);return new Promise(function(AQ,$Z){jee.then(function(){AQ(emptyErrors)},function(LZ){LZ.name==="ValidationError"?AQ(yupToFormErrors(LZ)):$Z(LZ)})})},[au.validationSchema]),hN=reactExports.useCallback(function(YQ,mee){return new Promise(function(See){return See(ly.current[YQ].validate(mee))})},[]),lN=reactExports.useCallback(function(YQ){var mee=Object.keys(ly.current).filter(function(Ree){return isFunction$7(ly.current[Ree].validate)}),See=mee.length>0?mee.map(function(Ree){return hN(Ree,getIn$1(YQ,Ree))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(See).then(function(Ree){return Ree.reduce(function(jee,AQ,$Z){return AQ==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||AQ&&(jee=setIn(jee,mee[$Z],AQ)),jee},{})})},[hN]),rA=reactExports.useCallback(function(YQ){return Promise.all([lN(YQ),au.validationSchema?pN(YQ):{},au.validate?cN(YQ):{}]).then(function(mee){var See=mee[0],Ree=mee[1],jee=mee[2],AQ=deepmerge_1.all([See,Ree,jee],{arrayMerge});return AQ})},[au.validate,au.validationSchema,lN,cN,pN]),dN=useEventCallback$1(function(YQ){return YQ===void 0&&(YQ=JE.values),XE({type:"SET_ISVALIDATING",payload:!0}),rA(YQ).then(function(mee){return Mg.current&&(XE({type:"SET_ISVALIDATING",payload:!1}),XE({type:"SET_ERRORS",payload:mee})),mee})});reactExports.useEffect(function(){hl&&Mg.current===!0&&isEqual(ou.current,au.initialValues)&&dN(ou.current)},[hl,dN]);var uN=reactExports.useCallback(function(YQ){var mee=YQ&&YQ.values?YQ.values:ou.current,See=YQ&&YQ.errors?YQ.errors:$m.current?$m.current:au.initialErrors||{},Ree=YQ&&YQ.touched?YQ.touched:Nm.current?Nm.current:au.initialTouched||{},jee=YQ&&YQ.status?YQ.status:Mm.current?Mm.current:au.initialStatus;ou.current=mee,$m.current=See,Nm.current=Ree,Mm.current=jee;var AQ=function(){XE({type:"RESET_FORM",payload:{isSubmitting:!!YQ&&!!YQ.isSubmitting,errors:See,touched:Ree,status:jee,values:mee,isValidating:!!YQ&&!!YQ.isValidating,submitCount:YQ&&YQ.submitCount&&typeof YQ.submitCount=="number"?YQ.submitCount:0}})};if(au.onReset){var $Z=au.onReset(JE.values,FQ);isPromise($Z)?$Z.then(AQ):AQ()}else AQ()},[au.initialErrors,au.initialStatus,au.initialTouched,au.onReset]);reactExports.useEffect(function(){Mg.current===!0&&!isEqual(ou.current,au.initialValues)&&Wl&&(ou.current=au.initialValues,uN(),hl&&dN(ou.current))},[Wl,au.initialValues,uN,hl,dN]),reactExports.useEffect(function(){Wl&&Mg.current===!0&&!isEqual($m.current,au.initialErrors)&&($m.current=au.initialErrors||emptyErrors,XE({type:"SET_ERRORS",payload:au.initialErrors||emptyErrors}))},[Wl,au.initialErrors]),reactExports.useEffect(function(){Wl&&Mg.current===!0&&!isEqual(Nm.current,au.initialTouched)&&(Nm.current=au.initialTouched||emptyTouched,XE({type:"SET_TOUCHED",payload:au.initialTouched||emptyTouched}))},[Wl,au.initialTouched]),reactExports.useEffect(function(){Wl&&Mg.current===!0&&!isEqual(Mm.current,au.initialStatus)&&(Mm.current=au.initialStatus,XE({type:"SET_STATUS",payload:au.initialStatus}))},[Wl,au.initialStatus,au.initialTouched]);var gN=useEventCallback$1(function(YQ){if(ly.current[YQ]&&isFunction$7(ly.current[YQ].validate)){var mee=getIn$1(JE.values,YQ),See=ly.current[YQ].validate(mee);return isPromise(See)?(XE({type:"SET_ISVALIDATING",payload:!0}),See.then(function(Ree){return Ree}).then(function(Ree){XE({type:"SET_FIELD_ERROR",payload:{field:YQ,value:Ree}}),XE({type:"SET_ISVALIDATING",payload:!1})})):(XE({type:"SET_FIELD_ERROR",payload:{field:YQ,value:See}}),Promise.resolve(See))}else if(au.validationSchema)return XE({type:"SET_ISVALIDATING",payload:!0}),pN(JE.values,YQ).then(function(Ree){return Ree}).then(function(Ree){XE({type:"SET_FIELD_ERROR",payload:{field:YQ,value:getIn$1(Ree,YQ)}}),XE({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),mN=reactExports.useCallback(function(YQ,mee){var See=mee.validate;ly.current[YQ]={validate:See}},[]),bN=reactExports.useCallback(function(YQ){delete ly.current[YQ]},[]),xN=useEventCallback$1(function(YQ,mee){XE({type:"SET_TOUCHED",payload:YQ});var See=mee===void 0?La:mee;return See?dN(JE.values):Promise.resolve()}),vN=reactExports.useCallback(function(YQ){XE({type:"SET_ERRORS",payload:YQ})},[]),wN=useEventCallback$1(function(YQ,mee){var See=isFunction$7(YQ)?YQ(JE.values):YQ;XE({type:"SET_VALUES",payload:See});var Ree=mee===void 0?ma:mee;return Ree?dN(See):Promise.resolve()}),FZ=reactExports.useCallback(function(YQ,mee){XE({type:"SET_FIELD_ERROR",payload:{field:YQ,value:mee}})},[]),IZ=useEventCallback$1(function(YQ,mee,See){var Ree=isFunction$7(mee)?mee(getIn$1(JE.values,YQ)):mee;XE({type:"SET_FIELD_VALUE",payload:{field:YQ,value:Ree}});var jee=See===void 0?ma:See;return jee?dN(setIn(JE.values,YQ,Ree)):Promise.resolve()}),lQ=reactExports.useCallback(function(YQ,mee){var See=mee,Ree=YQ,jee;if(!isString$5(YQ)){YQ.persist&&YQ.persist();var AQ=YQ.target?YQ.target:YQ.currentTarget,$Z=AQ.type,LZ=AQ.name,NQ=AQ.id,bQ=AQ.value,pQ=AQ.checked;AQ.outerHTML;var cQ=AQ.options,SQ=AQ.multiple;See=mee||LZ||NQ,Ree=/number|range/.test($Z)?(jee=parseFloat(bQ),isNaN(jee)?"":jee):/checkbox/.test($Z)?getValueForCheckbox(getIn$1(JE.values,See),pQ,bQ):cQ&&SQ?getSelectedValues(cQ):bQ}See&&IZ(See,Ree)},[IZ,JE.values]),VZ=useEventCallback$1(function(YQ){if(isString$5(YQ))return function(mee){return lQ(mee,YQ)};lQ(YQ)}),$Q=useEventCallback$1(function(YQ,mee,See){mee===void 0&&(mee=!0),XE({type:"SET_FIELD_TOUCHED",payload:{field:YQ,value:mee}});var Ree=See===void 0?La:See;return Ree?dN(JE.values):Promise.resolve()}),gQ=reactExports.useCallback(function(YQ,mee){YQ.persist&&YQ.persist();var See=YQ.target,Ree=See.name,jee=See.id;See.outerHTML;var AQ=mee||Ree||jee;$Q(AQ,!0)},[$Q]),PQ=useEventCallback$1(function(YQ){if(isString$5(YQ))return function(mee){return gQ(mee,YQ)};gQ(YQ)}),MQ=reactExports.useCallback(function(YQ){isFunction$7(YQ)?XE({type:"SET_FORMIK_STATE",payload:YQ}):XE({type:"SET_FORMIK_STATE",payload:function(){return YQ}})},[]),GQ=reactExports.useCallback(function(YQ){XE({type:"SET_STATUS",payload:YQ})},[]),LQ=reactExports.useCallback(function(YQ){XE({type:"SET_ISSUBMITTING",payload:YQ})},[]),xQ=useEventCallback$1(function(){return XE({type:"SUBMIT_ATTEMPT"}),dN().then(function(YQ){var mee=YQ instanceof Error,See=!mee&&Object.keys(YQ).length===0;if(See){var Ree;try{if(Ree=jQ(),Ree===void 0)return}catch(jee){throw jee}return Promise.resolve(Ree).then(function(jee){return Mg.current&&XE({type:"SUBMIT_SUCCESS"}),jee}).catch(function(jee){if(Mg.current)throw XE({type:"SUBMIT_FAILURE"}),jee})}else if(Mg.current&&(XE({type:"SUBMIT_FAILURE"}),mee))throw YQ})}),RQ=useEventCallback$1(function(YQ){YQ&&YQ.preventDefault&&isFunction$7(YQ.preventDefault)&&YQ.preventDefault(),YQ&&YQ.stopPropagation&&isFunction$7(YQ.stopPropagation)&&YQ.stopPropagation(),xQ().catch(function(mee){console.warn("Warning: An unhandled error was caught from submitForm()",mee)})}),FQ={resetForm:uN,validateForm:dN,validateField:gN,setErrors:vN,setFieldError:FZ,setFieldTouched:$Q,setFieldValue:IZ,setStatus:GQ,setSubmitting:LQ,setTouched:xN,setValues:wN,setFormikState:MQ,submitForm:xQ},jQ=useEventCallback$1(function(){return Kl(JE.values,FQ)}),eee=useEventCallback$1(function(YQ){YQ&&YQ.preventDefault&&isFunction$7(YQ.preventDefault)&&YQ.preventDefault(),YQ&&YQ.stopPropagation&&isFunction$7(YQ.stopPropagation)&&YQ.stopPropagation(),uN()}),uee=reactExports.useCallback(function(YQ){return{value:getIn$1(JE.values,YQ),error:getIn$1(JE.errors,YQ),touched:!!getIn$1(JE.touched,YQ),initialValue:getIn$1(ou.current,YQ),initialTouched:!!getIn$1(Nm.current,YQ),initialError:getIn$1($m.current,YQ)}},[JE.errors,JE.touched,JE.values]),VQ=reactExports.useCallback(function(YQ){return{setValue:function(See,Ree){return IZ(YQ,See,Ree)},setTouched:function(See,Ree){return $Q(YQ,See,Ree)},setError:function(See){return FZ(YQ,See)}}},[IZ,$Q,FZ]),wee=reactExports.useCallback(function(YQ){var mee=isObject$6(YQ),See=mee?YQ.name:YQ,Ree=getIn$1(JE.values,See),jee={name:See,value:Ree,onChange:VZ,onBlur:PQ};if(mee){var AQ=YQ.type,$Z=YQ.value,LZ=YQ.as,NQ=YQ.multiple;AQ==="checkbox"?$Z===void 0?jee.checked=!!Ree:(jee.checked=!!(Array.isArray(Ree)&&~Ree.indexOf($Z)),jee.value=$Z):AQ==="radio"?(jee.checked=Ree===$Z,jee.value=$Z):LZ==="select"&&NQ&&(jee.value=jee.value||[],jee.multiple=!0)}return jee},[PQ,VZ,JE.values]),Tee=reactExports.useMemo(function(){return!isEqual(ou.current,JE.values)},[ou.current,JE.values]),Iee=reactExports.useMemo(function(){return typeof Gl<"u"?Tee?JE.errors&&Object.keys(JE.errors).length===0:Gl!==!1&&isFunction$7(Gl)?Gl(au):Gl:JE.errors&&Object.keys(JE.errors).length===0},[Gl,Tee,JE.errors,au]),vee=_extends$1({},JE,{initialValues:ou.current,initialErrors:$m.current,initialTouched:Nm.current,initialStatus:Mm.current,handleBlur:PQ,handleChange:VZ,handleReset:eee,handleSubmit:RQ,resetForm:uN,setErrors:vN,setFormikState:MQ,setFieldTouched:$Q,setFieldValue:IZ,setFieldError:FZ,setStatus:GQ,setSubmitting:LQ,setTouched:xN,setValues:wN,submitForm:xQ,validateForm:dN,validateField:gN,isValid:Iee,dirty:Tee,unregisterField:bN,registerField:mN,getFieldProps:wee,getFieldMeta:uee,getFieldHelpers:VQ,validateOnBlur:La,validateOnChange:ma,validateOnMount:hl});return vee}function Formik(pa){var ha=useFormik(pa),ma=pa.component,ja=pa.children,La=pa.render,Ba=pa.innerRef;return reactExports.useImperativeHandle(Ba,function(){return ha}),reactExports.createElement(FormikProvider,{value:ha},ma?reactExports.createElement(ma,ha):La?La(ha):ja?isFunction$7(ja)?ja(ha):isEmptyChildren(ja)?null:reactExports.Children.only(ja):null)}function yupToFormErrors(pa){var ha={};if(pa.inner){if(pa.inner.length===0)return setIn(ha,pa.path,pa.message);for(var La=pa.inner,ma=Array.isArray(La),ja=0,La=ma?La:La[Symbol.iterator]();;){var Ba;if(ma){if(ja>=La.length)break;Ba=La[ja++]}else{if(ja=La.next(),ja.done)break;Ba=ja.value}var hl=Ba;getIn$1(ha,hl.path)||(ha=setIn(ha,hl.path,hl.message))}}return ha}function validateYupSchema(pa,ha,ma,ja){ma===void 0&&(ma=!1);var La=prepareDataForValidation(pa);return ha[ma?"validateSync":"validate"](La,{abortEarly:!1,context:La})}function prepareDataForValidation(pa){var ha=Array.isArray(pa)?[]:{};for(var ma in pa)if(Object.prototype.hasOwnProperty.call(pa,ma)){var ja=String(ma);Array.isArray(pa[ja])===!0?ha[ja]=pa[ja].map(function(La){return Array.isArray(La)===!0||isPlainObject$4(La)?prepareDataForValidation(La):La!==""?La:void 0}):isPlainObject$4(pa[ja])?ha[ja]=prepareDataForValidation(pa[ja]):ha[ja]=pa[ja]!==""?pa[ja]:void 0}return ha}function arrayMerge(pa,ha,ma){var ja=pa.slice();return ha.forEach(function(Ba,hl){if(typeof ja[hl]>"u"){var Gl=ma.clone!==!1,zl=Gl&&ma.isMergeableObject(Ba);ja[hl]=zl?deepmerge_1(Array.isArray(Ba)?[]:{},Ba,ma):Ba}else ma.isMergeableObject(Ba)?ja[hl]=deepmerge_1(pa[hl],Ba,ma):pa.indexOf(Ba)===-1&&ja.push(Ba)}),ja}function getSelectedValues(pa){return Array.from(pa).filter(function(ha){return ha.selected}).map(function(ha){return ha.value})}function getValueForCheckbox(pa,ha,ma){if(typeof pa=="boolean")return!!ha;var ja=[],La=!1,Ba=-1;if(Array.isArray(pa))ja=pa,Ba=pa.indexOf(ma),La=Ba>=0;else if(!ma||ma=="true"||ma=="false")return!!ha;return ha&&ma&&!La?ja.concat(ma):La?ja.slice(0,Ba).concat(ja.slice(Ba+1)):ja}var useIsomorphicLayoutEffect$4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useEventCallback$1(pa){var ha=reactExports.useRef(pa);return useIsomorphicLayoutEffect$4(function(){ha.current=pa}),reactExports.useCallback(function(){for(var ma=arguments.length,ja=new Array(ma),La=0;La<ma;La++)ja[La]=arguments[La];return ha.current.apply(void 0,ja)},[])}function useField(pa){var ha=useFormikContext(),ma=ha.getFieldProps,ja=ha.getFieldMeta,La=ha.getFieldHelpers,Ba=ha.registerField,hl=ha.unregisterField,Gl=isObject$6(pa),zl=Gl?pa:{name:pa},Wl=zl.name,Kl=zl.validate;reactExports.useEffect(function(){return Wl&&Ba(Wl,{validate:Kl}),function(){Wl&&hl(Wl)}},[Ba,hl,Wl,Kl]);var su=reactExports.useMemo(function(){return La(Wl)},[La,Wl]);return[ma(zl),ja(Wl),su]}function Field(pa){var ha=pa.validate,ma=pa.name,ja=pa.render,La=pa.children,Ba=pa.as,hl=pa.component,Gl=pa.className,zl=_objectWithoutPropertiesLoose$2(pa,["validate","name","render","children","as","component","className"]),Wl=useFormikContext(),Kl=_objectWithoutPropertiesLoose$2(Wl,["validate","validationSchema"]),su=Kl.registerField,au=Kl.unregisterField;reactExports.useEffect(function(){return su(ma,{validate:ha}),function(){au(ma)}},[su,au,ma,ha]);var ou=Kl.getFieldProps(_extends$1({name:ma},zl)),$m=Kl.getFieldMeta(ma),Nm={field:ou,form:Kl};if(ja)return ja(_extends$1({},Nm,{meta:$m}));if(isFunction$7(La))return La(_extends$1({},Nm,{meta:$m}));if(hl){if(typeof hl=="string"){var Mm=zl.innerRef,Mg=_objectWithoutPropertiesLoose$2(zl,["innerRef"]);return reactExports.createElement(hl,_extends$1({ref:Mm},ou,Mg,{className:Gl}),La)}return reactExports.createElement(hl,_extends$1({field:ou,form:Kl},zl,{className:Gl}),La)}var ly=Ba||"input";if(typeof ly=="string"){var uy=zl.innerRef,GE=_objectWithoutPropertiesLoose$2(zl,["innerRef"]);return reactExports.createElement(ly,_extends$1({ref:uy},ou,GE,{className:Gl}),La)}return reactExports.createElement(ly,_extends$1({},ou,zl,{className:Gl}),La)}var Form$6=reactExports.forwardRef(function(pa,ha){var ma=pa.action,ja=_objectWithoutPropertiesLoose$2(pa,["action"]),La=ma??"#",Ba=useFormikContext(),hl=Ba.handleReset,Gl=Ba.handleSubmit;return reactExports.createElement("form",_extends$1({onSubmit:Gl,ref:ha,onReset:hl,action:La},ja))});Form$6.displayName="Form";function connect(pa){var ha=function(La){return reactExports.createElement(FormikConsumer,null,function(Ba){return reactExports.createElement(pa,_extends$1({},La,{formik:Ba}))})},ma=pa.displayName||pa.name||pa.constructor&&pa.constructor.name||"Component";return ha.WrappedComponent=pa,ha.displayName="FormikConnect("+ma+")",hoistNonReactStatics$1(ha,pa)}var move=function(ha,ma,ja){var La=copyArrayLike(ha),Ba=La[ma];return La.splice(ma,1),La.splice(ja,0,Ba),La},swap=function(ha,ma,ja){var La=copyArrayLike(ha),Ba=La[ma];return La[ma]=La[ja],La[ja]=Ba,La},insert=function(ha,ma,ja){var La=copyArrayLike(ha);return La.splice(ma,0,ja),La},replace$1=function(ha,ma,ja){var La=copyArrayLike(ha);return La[ma]=ja,La},copyArrayLike=function(ha){if(ha){if(Array.isArray(ha))return[].concat(ha);var ma=Object.keys(ha).map(function(ja){return parseInt(ja)}).reduce(function(ja,La){return La>ja?La:ja},0);return Array.from(_extends$1({},ha,{length:ma+1}))}else return[]},createAlterationHandler=function(ha,ma){var ja=typeof ha=="function"?ha:ma;return function(La){if(Array.isArray(La)||isObject$6(La)){var Ba=copyArrayLike(La);return ja(Ba)}return La}},FieldArrayInner=(function(pa){_inheritsLoose$1(ha,pa);function ha(ja){var La;return La=pa.call(this,ja)||this,La.updateArrayField=function(Ba,hl,Gl){var zl=La.props,Wl=zl.name,Kl=zl.formik.setFormikState;Kl(function(su){var au=createAlterationHandler(Gl,Ba),ou=createAlterationHandler(hl,Ba),$m=setIn(su.values,Wl,Ba(getIn$1(su.values,Wl))),Nm=Gl?au(getIn$1(su.errors,Wl)):void 0,Mm=hl?ou(getIn$1(su.touched,Wl)):void 0;return isEmptyArray(Nm)&&(Nm=void 0),isEmptyArray(Mm)&&(Mm=void 0),_extends$1({},su,{values:$m,errors:Gl?setIn(su.errors,Wl,Nm):su.errors,touched:hl?setIn(su.touched,Wl,Mm):su.touched})})},La.push=function(Ba){return La.updateArrayField(function(hl){return[].concat(copyArrayLike(hl),[cloneDeep(Ba)])},!1,!1)},La.handlePush=function(Ba){return function(){return La.push(Ba)}},La.swap=function(Ba,hl){return La.updateArrayField(function(Gl){return swap(Gl,Ba,hl)},!0,!0)},La.handleSwap=function(Ba,hl){return function(){return La.swap(Ba,hl)}},La.move=function(Ba,hl){return La.updateArrayField(function(Gl){return move(Gl,Ba,hl)},!0,!0)},La.handleMove=function(Ba,hl){return function(){return La.move(Ba,hl)}},La.insert=function(Ba,hl){return La.updateArrayField(function(Gl){return insert(Gl,Ba,hl)},function(Gl){return insert(Gl,Ba,null)},function(Gl){return insert(Gl,Ba,null)})},La.handleInsert=function(Ba,hl){return function(){return La.insert(Ba,hl)}},La.replace=function(Ba,hl){return La.updateArrayField(function(Gl){return replace$1(Gl,Ba,hl)},!1,!1)},La.handleReplace=function(Ba,hl){return function(){return La.replace(Ba,hl)}},La.unshift=function(Ba){var hl=-1;return La.updateArrayField(function(Gl){var zl=Gl?[Ba].concat(Gl):[Ba];return hl=zl.length,zl},function(Gl){return Gl?[null].concat(Gl):[null]},function(Gl){return Gl?[null].concat(Gl):[null]}),hl},La.handleUnshift=function(Ba){return function(){return La.unshift(Ba)}},La.handleRemove=function(Ba){return function(){return La.remove(Ba)}},La.handlePop=function(){return function(){return La.pop()}},La.remove=La.remove.bind(_assertThisInitialized$1(La)),La.pop=La.pop.bind(_assertThisInitialized$1(La)),La}var ma=ha.prototype;return ma.componentDidUpdate=function(La){this.props.validateOnChange&&this.props.formik.validateOnChange&&!isEqual(getIn$1(La.formik.values,La.name),getIn$1(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},ma.remove=function(La){var Ba;return this.updateArrayField(function(hl){var Gl=hl?copyArrayLike(hl):[];return Ba||(Ba=Gl[La]),isFunction$7(Gl.splice)&&Gl.splice(La,1),isFunction$7(Gl.every)&&Gl.every(function(zl){return zl===void 0})?[]:Gl},!0,!0),Ba},ma.pop=function(){var La;return this.updateArrayField(function(Ba){var hl=Ba.slice();return La||(La=hl&&hl.pop&&hl.pop()),hl},!0,!0),La},ma.render=function(){var La={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},Ba=this.props,hl=Ba.component,Gl=Ba.render,zl=Ba.children,Wl=Ba.name,Kl=Ba.formik,su=_objectWithoutPropertiesLoose$2(Kl,["validate","validationSchema"]),au=_extends$1({},La,{form:su,name:Wl});return hl?reactExports.createElement(hl,au):Gl?Gl(au):zl?typeof zl=="function"?zl(au):isEmptyChildren(zl)?null:reactExports.Children.only(zl):null},ha})(reactExports.Component);FieldArrayInner.defaultProps={validateOnChange:!0};var FieldArray=connect(FieldArrayInner),ErrorMessageImpl=(function(pa){_inheritsLoose$1(ha,pa);function ha(){return pa.apply(this,arguments)||this}var ma=ha.prototype;return ma.shouldComponentUpdate=function(La){return getIn$1(this.props.formik.errors,this.props.name)!==getIn$1(La.formik.errors,this.props.name)||getIn$1(this.props.formik.touched,this.props.name)!==getIn$1(La.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(La).length},ma.render=function(){var La=this.props,Ba=La.component,hl=La.formik,Gl=La.render,zl=La.children,Wl=La.name,Kl=_objectWithoutPropertiesLoose$2(La,["component","formik","render","children","name"]),su=getIn$1(hl.touched,Wl),au=getIn$1(hl.errors,Wl);return su&&au?Gl?isFunction$7(Gl)?Gl(au):null:zl?isFunction$7(zl)?zl(au):null:Ba?reactExports.createElement(Ba,Kl,au):au:null},ha})(reactExports.Component),ErrorMessage=connect(ErrorMessageImpl),propertyExpr,hasRequiredPropertyExpr;function requirePropertyExpr(){if(hasRequiredPropertyExpr)return propertyExpr;hasRequiredPropertyExpr=1;function pa(Mg){this._maxSize=Mg,this.clear()}pa.prototype.clear=function(){this._size=0,this._values=Object.create(null)},pa.prototype.get=function(Mg){return this._values[Mg]},pa.prototype.set=function(Mg,ly){return this._size>=this._maxSize&&this.clear(),Mg in this._values||this._size++,this._values[Mg]=ly};var ha=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ma=/^\d+$/,ja=/^\d/,La=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Ba=/^\s*(['"]?)(.*?)(\1)\s*$/,hl=512,Gl=new pa(hl),zl=new pa(hl),Wl=new pa(hl);propertyExpr={Cache:pa,split:su,normalizePath:Kl,setter:function(Mg){var ly=Kl(Mg);return zl.get(Mg)||zl.set(Mg,function(GE,YE){for(var JE=0,XE=ly.length,cN=GE;JE<XE-1;){var pN=ly[JE];if(pN==="__proto__"||pN==="constructor"||pN==="prototype")return GE;cN=cN[ly[JE++]]}cN[ly[JE]]=YE})},getter:function(Mg,ly){var uy=Kl(Mg);return Wl.get(Mg)||Wl.set(Mg,function(YE){for(var JE=0,XE=uy.length;JE<XE;)if(YE!=null||!ly)YE=YE[uy[JE++]];else return;return YE})},join:function(Mg){return Mg.reduce(function(ly,uy){return ly+(ou(uy)||ma.test(uy)?"["+uy+"]":(ly?".":"")+uy)},"")},forEach:function(Mg,ly,uy){au(Array.isArray(Mg)?Mg:su(Mg),ly,uy)}};function Kl(Mg){return Gl.get(Mg)||Gl.set(Mg,su(Mg).map(function(ly){return ly.replace(Ba,"$2")}))}function su(Mg){return Mg.match(ha)||[""]}function au(Mg,ly,uy){var GE=Mg.length,YE,JE,XE,cN;for(JE=0;JE<GE;JE++)YE=Mg[JE],YE&&(Mm(YE)&&(YE='"'+YE+'"'),cN=ou(YE),XE=!cN&&/^\d+$/.test(YE),ly.call(uy,YE,cN,XE,JE,Mg))}function ou(Mg){return typeof Mg=="string"&&Mg&&["'",'"'].indexOf(Mg.charAt(0))!==-1}function $m(Mg){return Mg.match(ja)&&!Mg.match(ma)}function Nm(Mg){return La.test(Mg)}function Mm(Mg){return!ou(Mg)&&($m(Mg)||Nm(Mg))}return propertyExpr}var propertyExprExports=requirePropertyExpr(),tinyCase,hasRequiredTinyCase;function requireTinyCase(){if(hasRequiredTinyCase)return tinyCase;hasRequiredTinyCase=1;const pa=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,ha=Kl=>Kl.match(pa)||[],ma=Kl=>Kl[0].toUpperCase()+Kl.slice(1),ja=(Kl,su)=>ha(Kl).join(su).toLowerCase(),La=Kl=>ha(Kl).reduce((su,au)=>`${su}${su?au[0].toUpperCase()+au.slice(1).toLowerCase():au.toLowerCase()}`,"");return tinyCase={words:ha,upperFirst:ma,camelCase:La,pascalCase:Kl=>ma(La(Kl)),snakeCase:Kl=>ja(Kl,"_"),kebabCase:Kl=>ja(Kl,"-"),sentenceCase:Kl=>ma(ja(Kl," ")),titleCase:Kl=>ha(Kl).map(ma).join(" ")},tinyCase}var tinyCaseExports=requireTinyCase(),toposort$1={exports:{}},hasRequiredToposort;function requireToposort(){if(hasRequiredToposort)return toposort$1.exports;hasRequiredToposort=1,toposort$1.exports=function(La){return pa(ha(La),La)},toposort$1.exports.array=pa;function pa(La,Ba){var hl=La.length,Gl=new Array(hl),zl={},Wl=hl,Kl=ma(Ba),su=ja(La);for(Ba.forEach(function(ou){if(!su.has(ou[0])||!su.has(ou[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});Wl--;)zl[Wl]||au(La[Wl],Wl,new Set);return Gl;function au(ou,$m,Nm){if(Nm.has(ou)){var Mm;try{Mm=", node was:"+JSON.stringify(ou)}catch{Mm=""}throw new Error("Cyclic dependency"+Mm)}if(!su.has(ou))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(ou));if(!zl[$m]){zl[$m]=!0;var Mg=Kl.get(ou)||new Set;if(Mg=Array.from(Mg),$m=Mg.length){Nm.add(ou);do{var ly=Mg[--$m];au(ly,su.get(ly),Nm)}while($m);Nm.delete(ou)}Gl[--hl]=ou}}}function ha(La){for(var Ba=new Set,hl=0,Gl=La.length;hl<Gl;hl++){var zl=La[hl];Ba.add(zl[0]),Ba.add(zl[1])}return Array.from(Ba)}function ma(La){for(var Ba=new Map,hl=0,Gl=La.length;hl<Gl;hl++){var zl=La[hl];Ba.has(zl[0])||Ba.set(zl[0],new Set),Ba.has(zl[1])||Ba.set(zl[1],new Set),Ba.get(zl[0]).add(zl[1])}return Ba}function ja(La){for(var Ba=new Map,hl=0,Gl=La.length;hl<Gl;hl++)Ba.set(La[hl],hl);return Ba}return toposort$1.exports}var toposortExports=requireToposort();const toposort=getDefaultExportFromCjs(toposortExports),toString$4=Object.prototype.toString,errorToString=Error.prototype.toString,regExpToString=RegExp.prototype.toString,symbolToString$1=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP=/^Symbol\((.*)\)(.*)$/;function printNumber(pa){return pa!=+pa?"NaN":pa===0&&1/pa<0?"-0":""+pa}function printSimpleValue(pa,ha=!1){if(pa==null||pa===!0||pa===!1)return""+pa;const ma=typeof pa;if(ma==="number")return printNumber(pa);if(ma==="string")return ha?`"${pa}"`:pa;if(ma==="function")return"[Function "+(pa.name||"anonymous")+"]";if(ma==="symbol")return symbolToString$1.call(pa).replace(SYMBOL_REGEXP,"Symbol($1)");const ja=toString$4.call(pa).slice(8,-1);return ja==="Date"?isNaN(pa.getTime())?""+pa:pa.toISOString(pa):ja==="Error"||pa instanceof Error?"["+errorToString.call(pa)+"]":ja==="RegExp"?regExpToString.call(pa):null}function printValue(pa,ha){let ma=printSimpleValue(pa,ha);return ma!==null?ma:JSON.stringify(pa,function(ja,La){let Ba=printSimpleValue(this[ja],ha);return Ba!==null?Ba:La},2)}function toArray$4(pa){return pa==null?[]:[].concat(pa)}let _Symbol$toStringTag,_Symbol$hasInstance,_Symbol$toStringTag2,strReg=/\$\{\s*(\w+)\s*\}/g;_Symbol$toStringTag=Symbol.toStringTag;class ValidationErrorNoStack{constructor(ha,ma,ja,La){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[_Symbol$toStringTag]="Error",this.name="ValidationError",this.value=ma,this.path=ja,this.type=La,this.errors=[],this.inner=[],toArray$4(ha).forEach(Ba=>{if(ValidationError.isError(Ba)){this.errors.push(...Ba.errors);const hl=Ba.inner.length?Ba.inner:[Ba];this.inner.push(...hl)}else this.errors.push(Ba)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}_Symbol$hasInstance=Symbol.hasInstance;_Symbol$toStringTag2=Symbol.toStringTag;class ValidationError extends Error{static formatError(ha,ma){const ja=ma.label||ma.path||"this";return ma=Object.assign({},ma,{path:ja,originalPath:ma.path}),typeof ha=="string"?ha.replace(strReg,(La,Ba)=>printValue(ma[Ba])):typeof ha=="function"?ha(ma):ha}static isError(ha){return ha&&ha.name==="ValidationError"}constructor(ha,ma,ja,La,Ba){const hl=new ValidationErrorNoStack(ha,ma,ja,La);if(Ba)return hl;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[_Symbol$toStringTag2]="Error",this.name=hl.name,this.message=hl.message,this.type=hl.type,this.value=hl.value,this.path=hl.path,this.errors=hl.errors,this.inner=hl.inner,Error.captureStackTrace&&Error.captureStackTrace(this,ValidationError)}static[_Symbol$hasInstance](ha){return ValidationErrorNoStack[Symbol.hasInstance](ha)||super[Symbol.hasInstance](ha)}}let mixed={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:pa,type:ha,value:ma,originalValue:ja})=>{const La=ja!=null&&ja!==ma?` (cast from the value \`${printValue(ja,!0)}\`).`:".";return ha!=="mixed"?`${pa} must be a \`${ha}\` type, but the final value was: \`${printValue(ma,!0)}\``+La:`${pa} must match the configured type. The validated value was: \`${printValue(ma,!0)}\``+La}},string={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number$1={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date$1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean={isValue:"${path} field must be ${value}"},object$1={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},array$1={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},tuple={notType:pa=>{const{path:ha,value:ma,spec:ja}=pa,La=ja.types.length;if(Array.isArray(ma)){if(ma.length<La)return`${ha} tuple value has too few items, expected a length of ${La} but got ${ma.length} for value: \`${printValue(ma,!0)}\``;if(ma.length>La)return`${ha} tuple value has too many items, expected a length of ${La} but got ${ma.length} for value: \`${printValue(ma,!0)}\``}return ValidationError.formatError(mixed.notType,pa)}};Object.assign(Object.create(null),{mixed,string,number:number$1,date:date$1,object:object$1,array:array$1,boolean,tuple});const isSchema=pa=>pa&&pa.__isYupSchema__;let Condition$2=class Jhe{static fromOptions(ha,ma){if(!ma.then&&!ma.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:ja,then:La,otherwise:Ba}=ma,hl=typeof ja=="function"?ja:(...Gl)=>Gl.every(zl=>zl===ja);return new Jhe(ha,(Gl,zl)=>{var Wl;let Kl=hl(...Gl)?La:Ba;return(Wl=Kl?.(zl))!=null?Wl:zl})}constructor(ha,ma){this.fn=void 0,this.refs=ha,this.refs=ha,this.fn=ma}resolve(ha,ma){let ja=this.refs.map(Ba=>Ba.getValue(ma?.value,ma?.parent,ma?.context)),La=this.fn(ja,ha,ma);if(La===void 0||La===ha)return ha;if(!isSchema(La))throw new TypeError("conditions must return a schema object");return La.resolve(ma)}};const prefixes={context:"$",value:"."};function create$9(pa,ha){return new Reference(pa,ha)}class Reference{constructor(ha,ma={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof ha!="string")throw new TypeError("ref must be a string, got: "+ha);if(this.key=ha.trim(),ha==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===prefixes.context,this.isValue=this.key[0]===prefixes.value,this.isSibling=!this.isContext&&!this.isValue;let ja=this.isContext?prefixes.context:this.isValue?prefixes.value:"";this.path=this.key.slice(ja.length),this.getter=this.path&&propertyExprExports.getter(this.path,!0),this.map=ma.map}getValue(ha,ma,ja){let La=this.isContext?ja:this.isValue?ha:ma;return this.getter&&(La=this.getter(La||{})),this.map&&(La=this.map(La)),La}cast(ha,ma){return this.getValue(ha,ma?.parent,ma?.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(ha){return ha&&ha.__isYupRef}}Reference.prototype.__isYupRef=!0;const isAbsent=pa=>pa==null;function createValidation(pa){function ha({value:ma,path:ja="",options:La,originalValue:Ba,schema:hl},Gl,zl){const{name:Wl,test:Kl,params:su,message:au,skipAbsent:ou}=pa;let{parent:$m,context:Nm,abortEarly:Mm=hl.spec.abortEarly,disableStackTrace:Mg=hl.spec.disableStackTrace}=La;const ly={value:ma,parent:$m,context:Nm};function uy(lN={}){const rA=resolveParams(Object.assign({value:ma,originalValue:Ba,label:hl.spec.label,path:lN.path||ja,spec:hl.spec,disableStackTrace:lN.disableStackTrace||Mg},su,lN.params),ly),dN=new ValidationError(ValidationError.formatError(lN.message||au,rA),ma,rA.path,lN.type||Wl,rA.disableStackTrace);return dN.params=rA,dN}const GE=Mm?Gl:zl;let YE={path:ja,parent:$m,type:Wl,from:La.from,createError:uy,resolve(lN){return resolveMaybeRef(lN,ly)},options:La,originalValue:Ba,schema:hl};const JE=lN=>{ValidationError.isError(lN)?GE(lN):lN?zl(null):GE(uy())},XE=lN=>{ValidationError.isError(lN)?GE(lN):Gl(lN)};if(ou&&isAbsent(ma))return JE(!0);let pN;try{var hN;if(pN=Kl.call(YE,ma,YE),typeof((hN=pN)==null?void 0:hN.then)=="function"){if(La.sync)throw new Error(`Validation test of type: "${YE.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(pN).then(JE,XE)}}catch(lN){XE(lN);return}JE(pN)}return ha.OPTIONS=pa,ha}function resolveParams(pa,ha){if(!pa)return pa;for(const ma of Object.keys(pa))pa[ma]=resolveMaybeRef(pa[ma],ha);return pa}function resolveMaybeRef(pa,ha){return Reference.isRef(pa)?pa.getValue(ha.value,ha.parent,ha.context):pa}function getIn(pa,ha,ma,ja=ma){let La,Ba,hl;return ha?(propertyExprExports.forEach(ha,(Gl,zl,Wl)=>{let Kl=zl?Gl.slice(1,Gl.length-1):Gl;pa=pa.resolve({context:ja,parent:La,value:ma});let su=pa.type==="tuple",au=Wl?parseInt(Kl,10):0;if(pa.innerType||su){if(su&&!Wl)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${hl}" must contain an index to the tuple element, e.g. "${hl}[0]"`);if(ma&&au>=ma.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${Gl}, in the path: ${ha}. because there is no value at that index. `);La=ma,ma=ma&&ma[au],pa=su?pa.spec.types[au]:pa.innerType}if(!Wl){if(!pa.fields||!pa.fields[Kl])throw new Error(`The schema does not contain the path: ${ha}. (failed at: ${hl} which is a type: "${pa.type}")`);La=ma,ma=ma&&ma[Kl],pa=pa.fields[Kl]}Ba=Kl,hl=zl?"["+Gl+"]":"."+Gl}),{schema:pa,parent:La,parentPath:Ba}):{parent:La,parentPath:ha,schema:pa}}class ReferenceSet extends Set{describe(){const ha=[];for(const ma of this.values())ha.push(Reference.isRef(ma)?ma.describe():ma);return ha}resolveAll(ha){let ma=[];for(const ja of this.values())ma.push(ha(ja));return ma}clone(){return new ReferenceSet(this.values())}merge(ha,ma){const ja=this.clone();return ha.forEach(La=>ja.add(La)),ma.forEach(La=>ja.delete(La)),ja}}function clone$3(pa,ha=new Map){if(isSchema(pa)||!pa||typeof pa!="object")return pa;if(ha.has(pa))return ha.get(pa);let ma;if(pa instanceof Date)ma=new Date(pa.getTime()),ha.set(pa,ma);else if(pa instanceof RegExp)ma=new RegExp(pa),ha.set(pa,ma);else if(Array.isArray(pa)){ma=new Array(pa.length),ha.set(pa,ma);for(let ja=0;ja<pa.length;ja++)ma[ja]=clone$3(pa[ja],ha)}else if(pa instanceof Map){ma=new Map,ha.set(pa,ma);for(const[ja,La]of pa.entries())ma.set(ja,clone$3(La,ha))}else if(pa instanceof Set){ma=new Set,ha.set(pa,ma);for(const ja of pa)ma.add(clone$3(ja,ha))}else if(pa instanceof Object){ma={},ha.set(pa,ma);for(const[ja,La]of Object.entries(pa))ma[ja]=clone$3(La,ha)}else throw Error(`Unable to clone ${pa}`);return ma}function createStandardPath(pa){if(!(pa!=null&&pa.length))return;const ha=[];let ma="",ja=!1,La=!1;for(let Ba=0;Ba<pa.length;Ba++){const hl=pa[Ba];if(hl==="["&&!La){ma&&(ha.push(...ma.split(".").filter(Boolean)),ma=""),ja=!0;continue}if(hl==="]"&&!La){ma&&(/^\d+$/.test(ma)?ha.push(ma):ha.push(ma.replace(/^"|"$/g,"")),ma=""),ja=!1;continue}if(hl==='"'){La=!La;continue}if(hl==="."&&!ja&&!La){ma&&(ha.push(ma),ma="");continue}ma+=hl}return ma&&ha.push(...ma.split(".").filter(Boolean)),ha}function createStandardIssues(pa,ha){const ma=ha?`${ha}.${pa.path}`:pa.path;return pa.errors.map(ja=>({message:ja,path:createStandardPath(ma)}))}function issuesFromValidationError(pa,ha){var ma;if(!((ma=pa.inner)!=null&&ma.length)&&pa.errors.length)return createStandardIssues(pa,ha);const ja=ha?`${ha}.${pa.path}`:pa.path;return pa.inner.flatMap(La=>issuesFromValidationError(La,ja))}class Schema{constructor(ha){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new ReferenceSet,this._blacklist=new ReferenceSet,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(mixed.notType)}),this.type=ha.type,this._typeCheck=ha.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},ha?.spec),this.withMutation(ma=>{ma.nonNullable()})}get _type(){return this.type}clone(ha){if(this._mutate)return ha&&Object.assign(this.spec,ha),this;const ma=Object.create(Object.getPrototypeOf(this));return ma.type=this.type,ma._typeCheck=this._typeCheck,ma._whitelist=this._whitelist.clone(),ma._blacklist=this._blacklist.clone(),ma.internalTests=Object.assign({},this.internalTests),ma.exclusiveTests=Object.assign({},this.exclusiveTests),ma.deps=[...this.deps],ma.conditions=[...this.conditions],ma.tests=[...this.tests],ma.transforms=[...this.transforms],ma.spec=clone$3(Object.assign({},this.spec,ha)),ma}label(ha){let ma=this.clone();return ma.spec.label=ha,ma}meta(...ha){if(ha.length===0)return this.spec.meta;let ma=this.clone();return ma.spec.meta=Object.assign(ma.spec.meta||{},ha[0]),ma}withMutation(ha){let ma=this._mutate;this._mutate=!0;let ja=ha(this);return this._mutate=ma,ja}concat(ha){if(!ha||ha===this)return this;if(ha.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${ha.type}`);let ma=this,ja=ha.clone();const La=Object.assign({},ma.spec,ja.spec);return ja.spec=La,ja.internalTests=Object.assign({},ma.internalTests,ja.internalTests),ja._whitelist=ma._whitelist.merge(ha._whitelist,ha._blacklist),ja._blacklist=ma._blacklist.merge(ha._blacklist,ha._whitelist),ja.tests=ma.tests,ja.exclusiveTests=ma.exclusiveTests,ja.withMutation(Ba=>{ha.tests.forEach(hl=>{Ba.test(hl.OPTIONS)})}),ja.transforms=[...ma.transforms,...ja.transforms],ja}isType(ha){return ha==null?!!(this.spec.nullable&&ha===null||this.spec.optional&&ha===void 0):this._typeCheck(ha)}resolve(ha){let ma=this;if(ma.conditions.length){let ja=ma.conditions;ma=ma.clone(),ma.conditions=[],ma=ja.reduce((La,Ba)=>Ba.resolve(La,ha),ma),ma=ma.resolve(ha)}return ma}resolveOptions(ha){var ma,ja,La,Ba;return Object.assign({},ha,{from:ha.from||[],strict:(ma=ha.strict)!=null?ma:this.spec.strict,abortEarly:(ja=ha.abortEarly)!=null?ja:this.spec.abortEarly,recursive:(La=ha.recursive)!=null?La:this.spec.recursive,disableStackTrace:(Ba=ha.disableStackTrace)!=null?Ba:this.spec.disableStackTrace})}cast(ha,ma={}){let ja=this.resolve(Object.assign({},ma,{value:ha})),La=ma.assert==="ignore-optionality",Ba=ja._cast(ha,ma);if(ma.assert!==!1&&!ja.isType(Ba)){if(La&&isAbsent(Ba))return Ba;let hl=printValue(ha),Gl=printValue(Ba);throw new TypeError(`The value of ${ma.path||"field"} could not be cast to a value that satisfies the schema type: "${ja.type}".
|
|
70
70
|
|
|
71
71
|
attempted value: ${hl}
|
|
72
|
-
`+(Gl!==hl?`result of cast: ${Gl}`:""))}return Ba}_cast(ha,ma){let ja=ha===void 0?ha:this.transforms.reduce((La,Ba)=>Ba.call(this,La,ha,this,ma),ha);return ja===void 0&&(ja=this.getDefault(ma)),ja}_validate(ha,ma={},ja,La){let{path:Ba,originalValue:hl=ha,strict:Gl=this.spec.strict}=ma,zl=ha;Gl||(zl=this._cast(zl,Object.assign({assert:!1},ma)));let Wl=[];for(let Kl of Object.values(this.internalTests))Kl&&Wl.push(Kl);this.runTests({path:Ba,value:zl,originalValue:hl,options:ma,tests:Wl},ja,Kl=>{if(Kl.length)return La(Kl,zl);this.runTests({path:Ba,value:zl,originalValue:hl,options:ma,tests:this.tests},ja,La)})}runTests(ha,ma,ja){let La=!1,{tests:Ba,value:hl,originalValue:Gl,path:zl,options:Wl}=ha,Kl=Nm=>{La||(La=!0,ma(Nm,hl))},su=Nm=>{La||(La=!0,ja(Nm,hl))},au=Ba.length,ou=[];if(!au)return su([]);let $m={value:hl,originalValue:Gl,path:zl,options:Wl,schema:this};for(let Nm=0;Nm<Ba.length;Nm++){const Mm=Ba[Nm];Mm($m,Kl,function(ly){ly&&(Array.isArray(ly)?ou.push(...ly):ou.push(ly)),--au<=0&&su(ou)})}}asNestedTest({key:ha,index:ma,parent:ja,parentPath:La,originalParent:Ba,options:hl}){const Gl=ha??ma;if(Gl==null)throw TypeError("Must include `key` or `index` for nested validations");const zl=typeof Gl=="number";let Wl=ja[Gl];const Kl=Object.assign({},hl,{strict:!0,parent:ja,value:Wl,originalValue:Ba[Gl],key:void 0,[zl?"index":"key"]:Gl,path:zl||Gl.includes(".")?`${La||""}[${zl?Gl:`"${Gl}"`}]`:(La?`${La}.`:"")+ha});return(su,au,ou)=>this.resolve(Kl)._validate(Wl,Kl,au,ou)}validate(ha,ma){var ja;let La=this.resolve(Object.assign({},ma,{value:ha})),Ba=(ja=ma?.disableStackTrace)!=null?ja:La.spec.disableStackTrace;return new Promise((hl,Gl)=>La._validate(ha,ma,(zl,Wl)=>{ValidationError.isError(zl)&&(zl.value=Wl),Gl(zl)},(zl,Wl)=>{zl.length?Gl(new ValidationError(zl,Wl,void 0,void 0,Ba)):hl(Wl)}))}validateSync(ha,ma){var ja;let La=this.resolve(Object.assign({},ma,{value:ha})),Ba,hl=(ja=ma?.disableStackTrace)!=null?ja:La.spec.disableStackTrace;return La._validate(ha,Object.assign({},ma,{sync:!0}),(Gl,zl)=>{throw ValidationError.isError(Gl)&&(Gl.value=zl),Gl},(Gl,zl)=>{if(Gl.length)throw new ValidationError(Gl,ha,void 0,void 0,hl);Ba=zl}),Ba}isValid(ha,ma){return this.validate(ha,ma).then(()=>!0,ja=>{if(ValidationError.isError(ja))return!1;throw ja})}isValidSync(ha,ma){try{return this.validateSync(ha,ma),!0}catch(ja){if(ValidationError.isError(ja))return!1;throw ja}}_getDefault(ha){let ma=this.spec.default;return ma==null?ma:typeof ma=="function"?ma.call(this,ha):clone$3(ma)}getDefault(ha){return this.resolve(ha||{})._getDefault(ha)}default(ha){return arguments.length===0?this._getDefault():this.clone({default:ha})}strict(ha=!0){return this.clone({strict:ha})}nullability(ha,ma){const ja=this.clone({nullable:ha});return ja.internalTests.nullable=createValidation({message:ma,name:"nullable",test(La){return La===null?this.schema.spec.nullable:!0}}),ja}optionality(ha,ma){const ja=this.clone({optional:ha});return ja.internalTests.optionality=createValidation({message:ma,name:"optionality",test(La){return La===void 0?this.schema.spec.optional:!0}}),ja}optional(){return this.optionality(!0)}defined(ha=mixed.defined){return this.optionality(!1,ha)}nullable(){return this.nullability(!0)}nonNullable(ha=mixed.notNull){return this.nullability(!1,ha)}required(ha=mixed.required){return this.clone().withMutation(ma=>ma.nonNullable(ha).defined(ha))}notRequired(){return this.clone().withMutation(ha=>ha.nullable().optional())}transform(ha){let ma=this.clone();return ma.transforms.push(ha),ma}test(...ha){let ma;if(ha.length===1?typeof ha[0]=="function"?ma={test:ha[0]}:ma=ha[0]:ha.length===2?ma={name:ha[0],test:ha[1]}:ma={name:ha[0],message:ha[1],test:ha[2]},ma.message===void 0&&(ma.message=mixed.default),typeof ma.test!="function")throw new TypeError("`test` is a required parameters");let ja=this.clone(),La=createValidation(ma),Ba=ma.exclusive||ma.name&&ja.exclusiveTests[ma.name]===!0;if(ma.exclusive&&!ma.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return ma.name&&(ja.exclusiveTests[ma.name]=!!ma.exclusive),ja.tests=ja.tests.filter(hl=>!(hl.OPTIONS.name===ma.name&&(Ba||hl.OPTIONS.test===La.OPTIONS.test))),ja.tests.push(La),ja}when(ha,ma){!Array.isArray(ha)&&typeof ha!="string"&&(ma=ha,ha=".");let ja=this.clone(),La=toArray$4(ha).map(Ba=>new Reference(Ba));return La.forEach(Ba=>{Ba.isSibling&&ja.deps.push(Ba.key)}),ja.conditions.push(typeof ma=="function"?new Condition$2(La,ma):Condition$2.fromOptions(La,ma)),ja}typeError(ha){let ma=this.clone();return ma.internalTests.typeError=createValidation({message:ha,name:"typeError",skipAbsent:!0,test(ja){return this.schema._typeCheck(ja)?!0:this.createError({params:{type:this.schema.type}})}}),ma}oneOf(ha,ma=mixed.oneOf){let ja=this.clone();return ha.forEach(La=>{ja._whitelist.add(La),ja._blacklist.delete(La)}),ja.internalTests.whiteList=createValidation({message:ma,name:"oneOf",skipAbsent:!0,test(La){let Ba=this.schema._whitelist,hl=Ba.resolveAll(this.resolve);return hl.includes(La)?!0:this.createError({params:{values:Array.from(Ba).join(", "),resolved:hl}})}}),ja}notOneOf(ha,ma=mixed.notOneOf){let ja=this.clone();return ha.forEach(La=>{ja._blacklist.add(La),ja._whitelist.delete(La)}),ja.internalTests.blacklist=createValidation({message:ma,name:"notOneOf",test(La){let Ba=this.schema._blacklist,hl=Ba.resolveAll(this.resolve);return hl.includes(La)?this.createError({params:{values:Array.from(Ba).join(", "),resolved:hl}}):!0}}),ja}strip(ha=!0){let ma=this.clone();return ma.spec.strip=ha,ma}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),{label:ja,meta:La,optional:Ba,nullable:hl}=ma.spec;return{meta:La,label:ja,optional:Ba,nullable:hl,default:ma.getDefault(ha),type:ma.type,oneOf:ma._whitelist.describe(),notOneOf:ma._blacklist.describe(),tests:ma.tests.filter((zl,Wl,Kl)=>Kl.findIndex(su=>su.OPTIONS.name===zl.OPTIONS.name)===Wl).map(zl=>{const Wl=zl.OPTIONS.params&&ha?resolveParams(Object.assign({},zl.OPTIONS.params),ha):zl.OPTIONS.params;return{name:zl.OPTIONS.name,params:Wl}})}}get"~standard"(){const ha=this;return{version:1,vendor:"yup",async validate(ja){try{return{value:await ha.validate(ja,{abortEarly:!1})}}catch(La){if(La instanceof ValidationError)return{issues:issuesFromValidationError(La)};throw La}}}}}Schema.prototype.__isYupSchema__=!0;for(const pa of["validate","validateSync"])Schema.prototype[`${pa}At`]=function(ha,ma,ja={}){const{parent:La,parentPath:Ba,schema:hl}=getIn(this,ha,ma,ja.context);return hl[pa](La&&La[Ba],Object.assign({},ja,{parent:La,path:ha}))};for(const pa of["equals","is"])Schema.prototype[pa]=Schema.prototype.oneOf;for(const pa of["not","nope"])Schema.prototype[pa]=Schema.prototype.notOneOf;const returnsTrue=()=>!0;function create$8(pa){return new MixedSchema(pa)}class MixedSchema extends Schema{constructor(ha){super(typeof ha=="function"?{type:"mixed",check:ha}:Object.assign({type:"mixed",check:returnsTrue},ha))}}create$8.prototype=MixedSchema.prototype;function create$7(){return new BooleanSchema}class BooleanSchema extends Schema{constructor(){super({type:"boolean",check(ha){return ha instanceof Boolean&&(ha=ha.valueOf()),typeof ha=="boolean"}}),this.withMutation(()=>{this.transform((ha,ma)=>{if(this.spec.coerce&&!this.isType(ha)){if(/^(true|1)$/i.test(String(ha)))return!0;if(/^(false|0)$/i.test(String(ha)))return!1}return ha})})}isTrue(ha=boolean.isValue){return this.test({message:ha,name:"is-value",exclusive:!0,params:{value:"true"},test(ma){return isAbsent(ma)||ma===!0}})}isFalse(ha=boolean.isValue){return this.test({message:ha,name:"is-value",exclusive:!0,params:{value:"false"},test(ma){return isAbsent(ma)||ma===!1}})}default(ha){return super.default(ha)}defined(ha){return super.defined(ha)}optional(){return super.optional()}required(ha){return super.required(ha)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(ha){return super.nonNullable(ha)}strip(ha){return super.strip(ha)}}create$7.prototype=BooleanSchema.prototype;const isoReg=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function parseIsoDate(pa){const ha=parseDateStruct(pa);if(!ha)return Date.parse?Date.parse(pa):Number.NaN;if(ha.z===void 0&&ha.plusMinus===void 0)return new Date(ha.year,ha.month,ha.day,ha.hour,ha.minute,ha.second,ha.millisecond).valueOf();let ma=0;return ha.z!=="Z"&&ha.plusMinus!==void 0&&(ma=ha.hourOffset*60+ha.minuteOffset,ha.plusMinus==="+"&&(ma=0-ma)),Date.UTC(ha.year,ha.month,ha.day,ha.hour,ha.minute+ma,ha.second,ha.millisecond)}function parseDateStruct(pa){var ha,ma;const ja=isoReg.exec(pa);return ja?{year:toNumber$2(ja[1]),month:toNumber$2(ja[2],1)-1,day:toNumber$2(ja[3],1),hour:toNumber$2(ja[4]),minute:toNumber$2(ja[5]),second:toNumber$2(ja[6]),millisecond:ja[7]?toNumber$2(ja[7].substring(0,3)):0,precision:(ha=(ma=ja[7])==null?void 0:ma.length)!=null?ha:void 0,z:ja[8]||void 0,plusMinus:ja[9]||void 0,hourOffset:toNumber$2(ja[10]),minuteOffset:toNumber$2(ja[11])}:null}function toNumber$2(pa,ha=0){return Number(pa)||ha}let rEmail=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rUrl=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rUUID=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,yearMonthDay="^\\d{4}-\\d{2}-\\d{2}",hourMinuteSecond="\\d{2}:\\d{2}:\\d{2}",zOrOffset="(([+-]\\d{2}(:?\\d{2})?)|Z)",rIsoDateTime=new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`),isTrimmed=pa=>isAbsent(pa)||pa===pa.trim(),objStringTag={}.toString();function create$6(){return new StringSchema}class StringSchema extends Schema{constructor(){super({type:"string",check(ha){return ha instanceof String&&(ha=ha.valueOf()),typeof ha=="string"}}),this.withMutation(()=>{this.transform((ha,ma)=>{if(!this.spec.coerce||this.isType(ha)||Array.isArray(ha))return ha;const ja=ha!=null&&ha.toString?ha.toString():ha;return ja===objStringTag?ha:ja})})}required(ha){return super.required(ha).withMutation(ma=>ma.test({message:ha||mixed.required,name:"required",skipAbsent:!0,test:ja=>!!ja.length}))}notRequired(){return super.notRequired().withMutation(ha=>(ha.tests=ha.tests.filter(ma=>ma.OPTIONS.name!=="required"),ha))}length(ha,ma=string.length){return this.test({message:ma,name:"length",exclusive:!0,params:{length:ha},skipAbsent:!0,test(ja){return ja.length===this.resolve(ha)}})}min(ha,ma=string.min){return this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(ja){return ja.length>=this.resolve(ha)}})}max(ha,ma=string.max){return this.test({name:"max",exclusive:!0,message:ma,params:{max:ha},skipAbsent:!0,test(ja){return ja.length<=this.resolve(ha)}})}matches(ha,ma){let ja=!1,La,Ba;return ma&&(typeof ma=="object"?{excludeEmptyString:ja=!1,message:La,name:Ba}=ma:La=ma),this.test({name:Ba||"matches",message:La||string.matches,params:{regex:ha},skipAbsent:!0,test:hl=>hl===""&&ja||hl.search(ha)!==-1})}email(ha=string.email){return this.matches(rEmail,{name:"email",message:ha,excludeEmptyString:!0})}url(ha=string.url){return this.matches(rUrl,{name:"url",message:ha,excludeEmptyString:!0})}uuid(ha=string.uuid){return this.matches(rUUID,{name:"uuid",message:ha,excludeEmptyString:!1})}datetime(ha){let ma="",ja,La;return ha&&(typeof ha=="object"?{message:ma="",allowOffset:ja=!1,precision:La=void 0}=ha:ma=ha),this.matches(rIsoDateTime,{name:"datetime",message:ma||string.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:ma||string.datetime_offset,params:{allowOffset:ja},skipAbsent:!0,test:Ba=>{if(!Ba||ja)return!0;const hl=parseDateStruct(Ba);return hl?!!hl.z:!1}}).test({name:"datetime_precision",message:ma||string.datetime_precision,params:{precision:La},skipAbsent:!0,test:Ba=>{if(!Ba||La==null)return!0;const hl=parseDateStruct(Ba);return hl?hl.precision===La:!1}})}ensure(){return this.default("").transform(ha=>ha===null?"":ha)}trim(ha=string.trim){return this.transform(ma=>ma!=null?ma.trim():ma).test({message:ha,name:"trim",test:isTrimmed})}lowercase(ha=string.lowercase){return this.transform(ma=>isAbsent(ma)?ma:ma.toLowerCase()).test({message:ha,name:"string_case",exclusive:!0,skipAbsent:!0,test:ma=>isAbsent(ma)||ma===ma.toLowerCase()})}uppercase(ha=string.uppercase){return this.transform(ma=>isAbsent(ma)?ma:ma.toUpperCase()).test({message:ha,name:"string_case",exclusive:!0,skipAbsent:!0,test:ma=>isAbsent(ma)||ma===ma.toUpperCase()})}}create$6.prototype=StringSchema.prototype;let invalidDate=new Date(""),isDate$1=pa=>Object.prototype.toString.call(pa)==="[object Date]";class DateSchema extends Schema{constructor(){super({type:"date",check(ha){return isDate$1(ha)&&!isNaN(ha.getTime())}}),this.withMutation(()=>{this.transform((ha,ma)=>!this.spec.coerce||this.isType(ha)||ha===null?ha:(ha=parseIsoDate(ha),isNaN(ha)?DateSchema.INVALID_DATE:new Date(ha)))})}prepareParam(ha,ma){let ja;if(Reference.isRef(ha))ja=ha;else{let La=this.cast(ha);if(!this._typeCheck(La))throw new TypeError(`\`${ma}\` must be a Date or a value that can be \`cast()\` to a Date`);ja=La}return ja}min(ha,ma=date$1.min){let ja=this.prepareParam(ha,"min");return this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(La){return La>=this.resolve(ja)}})}max(ha,ma=date$1.max){let ja=this.prepareParam(ha,"max");return this.test({message:ma,name:"max",exclusive:!0,params:{max:ha},skipAbsent:!0,test(La){return La<=this.resolve(ja)}})}}DateSchema.INVALID_DATE=invalidDate;function sortFields(pa,ha=[]){let ma=[],ja=new Set,La=new Set(ha.map(([hl,Gl])=>`${hl}-${Gl}`));function Ba(hl,Gl){let zl=propertyExprExports.split(hl)[0];ja.add(zl),La.has(`${Gl}-${zl}`)||ma.push([Gl,zl])}for(const hl of Object.keys(pa)){let Gl=pa[hl];ja.add(hl),Reference.isRef(Gl)&&Gl.isSibling?Ba(Gl.path,hl):isSchema(Gl)&&"deps"in Gl&&Gl.deps.forEach(zl=>Ba(zl,hl))}return toposort.array(Array.from(ja),ma).reverse()}function findIndex$2(pa,ha){let ma=1/0;return pa.some((ja,La)=>{var Ba;if((Ba=ha.path)!=null&&Ba.includes(ja))return ma=La,!0}),ma}function sortByKeyOrder(pa){return(ha,ma)=>findIndex$2(pa,ha)-findIndex$2(pa,ma)}const parseJson=(pa,ha,ma)=>{if(typeof pa!="string")return pa;let ja=pa;try{ja=JSON.parse(pa)}catch{}return ma.isType(ja)?ja:pa};function deepPartial(pa){if("fields"in pa){const ha={};for(const[ma,ja]of Object.entries(pa.fields))ha[ma]=deepPartial(ja);return pa.setFields(ha)}if(pa.type==="array"){const ha=pa.optional();return ha.innerType&&(ha.innerType=deepPartial(ha.innerType)),ha}return pa.type==="tuple"?pa.optional().clone({types:pa.spec.types.map(deepPartial)}):"optional"in pa?pa.optional():pa}const deepHas=(pa,ha)=>{const ma=[...propertyExprExports.normalizePath(ha)];if(ma.length===1)return ma[0]in pa;let ja=ma.pop(),La=propertyExprExports.getter(propertyExprExports.join(ma),!0)(pa);return!!(La&&ja in La)};let isObject$5=pa=>Object.prototype.toString.call(pa)==="[object Object]";function unknown(pa,ha){let ma=Object.keys(pa.fields);return Object.keys(ha).filter(ja=>ma.indexOf(ja)===-1)}const defaultSort=sortByKeyOrder([]);function create$3(pa){return new ObjectSchema(pa)}class ObjectSchema extends Schema{constructor(ha){super({type:"object",check(ma){return isObject$5(ma)||typeof ma=="function"}}),this.fields=Object.create(null),this._sortErrors=defaultSort,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{ha&&this.shape(ha)})}_cast(ha,ma={}){var ja;let La=super._cast(ha,ma);if(La===void 0)return this.getDefault(ma);if(!this._typeCheck(La))return La;let Ba=this.fields,hl=(ja=ma.stripUnknown)!=null?ja:this.spec.noUnknown,Gl=[].concat(this._nodes,Object.keys(La).filter(su=>!this._nodes.includes(su))),zl={},Wl=Object.assign({},ma,{parent:zl,__validating:ma.__validating||!1}),Kl=!1;for(const su of Gl){let au=Ba[su],ou=su in La,$m=La[su];if(au){let Nm;Wl.path=(ma.path?`${ma.path}.`:"")+su,au=au.resolve({value:$m,context:ma.context,parent:zl});let Mm=au instanceof Schema?au.spec:void 0,Mg=Mm?.strict;if(Mm!=null&&Mm.strip){Kl=Kl||su in La;continue}Nm=!ma.__validating||!Mg?au.cast($m,Wl):$m,Nm!==void 0&&(zl[su]=Nm)}else ou&&!hl&&(zl[su]=$m);(ou!==su in zl||zl[su]!==$m)&&(Kl=!0)}return Kl?zl:La}_validate(ha,ma={},ja,La){let{from:Ba=[],originalValue:hl=ha,recursive:Gl=this.spec.recursive}=ma;ma.from=[{schema:this,value:hl},...Ba],ma.__validating=!0,ma.originalValue=hl,super._validate(ha,ma,ja,(zl,Wl)=>{if(!Gl||!isObject$5(Wl)){La(zl,Wl);return}hl=hl||Wl;let Kl=[];for(let su of this._nodes){let au=this.fields[su];!au||Reference.isRef(au)||Kl.push(au.asNestedTest({options:ma,key:su,parent:Wl,parentPath:ma.path,originalParent:hl}))}this.runTests({tests:Kl,value:Wl,originalValue:hl,options:ma},ja,su=>{La(su.sort(this._sortErrors).concat(zl),Wl)})})}clone(ha){const ma=super.clone(ha);return ma.fields=Object.assign({},this.fields),ma._nodes=this._nodes,ma._excludedEdges=this._excludedEdges,ma._sortErrors=this._sortErrors,ma}concat(ha){let ma=super.concat(ha),ja=ma.fields;for(let[La,Ba]of Object.entries(this.fields)){const hl=ja[La];ja[La]=hl===void 0?Ba:hl}return ma.withMutation(La=>La.setFields(ja,[...this._excludedEdges,...ha._excludedEdges]))}_getDefault(ha){if("default"in this.spec)return super._getDefault(ha);if(!this._nodes.length)return;let ma={};return this._nodes.forEach(ja=>{var La;const Ba=this.fields[ja];let hl=ha;(La=hl)!=null&&La.value&&(hl=Object.assign({},hl,{parent:hl.value,value:hl.value[ja]})),ma[ja]=Ba&&"getDefault"in Ba?Ba.getDefault(hl):void 0}),ma}setFields(ha,ma){let ja=this.clone();return ja.fields=ha,ja._nodes=sortFields(ha,ma),ja._sortErrors=sortByKeyOrder(Object.keys(ha)),ma&&(ja._excludedEdges=ma),ja}shape(ha,ma=[]){return this.clone().withMutation(ja=>{let La=ja._excludedEdges;return ma.length&&(Array.isArray(ma[0])||(ma=[ma]),La=[...ja._excludedEdges,...ma]),ja.setFields(Object.assign(ja.fields,ha),La)})}partial(){const ha={};for(const[ma,ja]of Object.entries(this.fields))ha[ma]="optional"in ja&&ja.optional instanceof Function?ja.optional():ja;return this.setFields(ha)}deepPartial(){return deepPartial(this)}pick(ha){const ma={};for(const ja of ha)this.fields[ja]&&(ma[ja]=this.fields[ja]);return this.setFields(ma,this._excludedEdges.filter(([ja,La])=>ha.includes(ja)&&ha.includes(La)))}omit(ha){const ma=[];for(const ja of Object.keys(this.fields))ha.includes(ja)||ma.push(ja);return this.pick(ma)}from(ha,ma,ja){let La=propertyExprExports.getter(ha,!0);return this.transform(Ba=>{if(!Ba)return Ba;let hl=Ba;return deepHas(Ba,ha)&&(hl=Object.assign({},Ba),ja||delete hl[ha],hl[ma]=La(Ba)),hl})}json(){return this.transform(parseJson)}exact(ha){return this.test({name:"exact",exclusive:!0,message:ha||object$1.exact,test(ma){if(ma==null)return!0;const ja=unknown(this.schema,ma);return ja.length===0||this.createError({params:{properties:ja.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(ha=!0,ma=object$1.noUnknown){typeof ha!="boolean"&&(ma=ha,ha=!0);let ja=this.test({name:"noUnknown",exclusive:!0,message:ma,test(La){if(La==null)return!0;const Ba=unknown(this.schema,La);return!ha||Ba.length===0||this.createError({params:{unknown:Ba.join(", ")}})}});return ja.spec.noUnknown=ha,ja}unknown(ha=!0,ma=object$1.noUnknown){return this.noUnknown(!ha,ma)}transformKeys(ha){return this.transform(ma=>{if(!ma)return ma;const ja={};for(const La of Object.keys(ma))ja[ha(La)]=ma[La];return ja})}camelCase(){return this.transformKeys(tinyCaseExports.camelCase)}snakeCase(){return this.transformKeys(tinyCaseExports.snakeCase)}constantCase(){return this.transformKeys(ha=>tinyCaseExports.snakeCase(ha).toUpperCase())}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),ja=super.describe(ha);ja.fields={};for(const[Ba,hl]of Object.entries(ma.fields)){var La;let Gl=ha;(La=Gl)!=null&&La.value&&(Gl=Object.assign({},Gl,{parent:Gl.value,value:Gl.value[Ba]})),ja.fields[Ba]=hl.describe(Gl)}return ja}}create$3.prototype=ObjectSchema.prototype;function create$2$1(pa){return new ArraySchema(pa)}class ArraySchema extends Schema{constructor(ha){super({type:"array",spec:{types:ha},check(ma){return Array.isArray(ma)}}),this.innerType=void 0,this.innerType=ha}_cast(ha,ma){const ja=super._cast(ha,ma);if(!this._typeCheck(ja)||!this.innerType)return ja;let La=!1;const Ba=ja.map((hl,Gl)=>{const zl=this.innerType.cast(hl,Object.assign({},ma,{path:`${ma.path||""}[${Gl}]`,parent:ja,originalValue:hl,value:hl,index:Gl}));return zl!==hl&&(La=!0),zl});return La?Ba:ja}_validate(ha,ma={},ja,La){var Ba;let hl=this.innerType,Gl=(Ba=ma.recursive)!=null?Ba:this.spec.recursive;ma.originalValue!=null&&ma.originalValue,super._validate(ha,ma,ja,(zl,Wl)=>{var Kl;if(!Gl||!hl||!this._typeCheck(Wl)){La(zl,Wl);return}let su=new Array(Wl.length);for(let ou=0;ou<Wl.length;ou++){var au;su[ou]=hl.asNestedTest({options:ma,index:ou,parent:Wl,parentPath:ma.path,originalParent:(au=ma.originalValue)!=null?au:ha})}this.runTests({value:Wl,tests:su,originalValue:(Kl=ma.originalValue)!=null?Kl:ha,options:ma},ja,ou=>La(ou.concat(zl),Wl))})}clone(ha){const ma=super.clone(ha);return ma.innerType=this.innerType,ma}json(){return this.transform(parseJson)}concat(ha){let ma=super.concat(ha);return ma.innerType=this.innerType,ha.innerType&&(ma.innerType=ma.innerType?ma.innerType.concat(ha.innerType):ha.innerType),ma}of(ha){let ma=this.clone();if(!isSchema(ha))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+printValue(ha));return ma.innerType=ha,ma.spec=Object.assign({},ma.spec,{types:ha}),ma}length(ha,ma=array$1.length){return this.test({message:ma,name:"length",exclusive:!0,params:{length:ha},skipAbsent:!0,test(ja){return ja.length===this.resolve(ha)}})}min(ha,ma){return ma=ma||array$1.min,this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(ja){return ja.length>=this.resolve(ha)}})}max(ha,ma){return ma=ma||array$1.max,this.test({message:ma,name:"max",exclusive:!0,params:{max:ha},skipAbsent:!0,test(ja){return ja.length<=this.resolve(ha)}})}ensure(){return this.default(()=>[]).transform((ha,ma)=>this._typeCheck(ha)?ha:ma==null?[]:[].concat(ma))}compact(ha){let ma=ha?(ja,La,Ba)=>!ha(ja,La,Ba):ja=>!!ja;return this.transform(ja=>ja!=null?ja.filter(ma):ja)}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),ja=super.describe(ha);if(ma.innerType){var La;let Ba=ha;(La=Ba)!=null&&La.value&&(Ba=Object.assign({},Ba,{parent:Ba.value,value:Ba.value[0]})),ja.innerType=ma.innerType.describe(Ba)}return ja}}create$2$1.prototype=ArraySchema.prototype;function Ce$5(pa,ha){const ma=pa.icons,ja=pa.aliases||Object.create(null),La=Object.create(null);function Ba(hl){if(ma[hl])return La[hl]=[];if(!(hl in La)){La[hl]=null;const Gl=ja[hl]&&ja[hl].parent,zl=Gl&&Ba(Gl);zl&&(La[hl]=[Gl].concat(zl))}return La[hl]}return Object.keys(ma).concat(Object.keys(ja)).forEach(Ba),La}const ae$3=Object.freeze({left:0,top:0,width:16,height:16}),M$9=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),B$a=Object.freeze({...ae$3,...M$9}),$$9=Object.freeze({...B$a,body:"",hidden:!1});function je$4(pa,ha){const ma={};!pa.hFlip!=!ha.hFlip&&(ma.hFlip=!0),!pa.vFlip!=!ha.vFlip&&(ma.vFlip=!0);const ja=((pa.rotate||0)+(ha.rotate||0))%4;return ja&&(ma.rotate=ja),ma}function X$6(pa,ha){const ma=je$4(pa,ha);for(const ja in $$9)ja in M$9?ja in pa&&!(ja in ma)&&(ma[ja]=M$9[ja]):ja in ha?ma[ja]=ha[ja]:ja in pa&&(ma[ja]=pa[ja]);return ma}function Ae$2(pa,ha,ma){const ja=pa.icons,La=pa.aliases||Object.create(null);let Ba={};function hl(Gl){Ba=X$6(ja[Gl]||La[Gl],Ba)}return hl(ha),ma.forEach(hl),X$6(pa,Ba)}function ue$3(pa,ha){const ma=[];if(typeof pa!="object"||typeof pa.icons!="object")return ma;pa.not_found instanceof Array&&pa.not_found.forEach(La=>{ha(La,null),ma.push(La)});const ja=Ce$5(pa);for(const La in ja){const Ba=ja[La];Ba&&(ha(La,Ae$2(pa,La,Ba)),ma.push(La))}return ma}const Ee$4={provider:"",aliases:{},not_found:{},...ae$3};function _$b(pa,ha){for(const ma in ha)if(ma in pa&&typeof pa[ma]!=typeof ha[ma])return!1;return!0}function fe$4(pa){if(typeof pa!="object"||pa===null)return null;const ha=pa;if(typeof ha.prefix!="string"||!pa.icons||typeof pa.icons!="object"||!_$b(pa,Ee$4))return null;const ma=ha.icons;for(const La in ma){const Ba=ma[La];if(!La||typeof Ba.body!="string"||!_$b(Ba,$$9))return null}const ja=ha.aliases||Object.create(null);for(const La in ja){const Ba=ja[La],hl=Ba.parent;if(!La||typeof hl!="string"||!ma[hl]&&!ja[hl]||!_$b(Ba,$$9))return null}return ha}const Y$4=Object.create(null);function Oe$7(pa,ha){return{provider:pa,prefix:ha,icons:Object.create(null),missing:new Set}}function T$d(pa,ha){const ma=Y$4[pa]||(Y$4[pa]=Object.create(null));return ma[ha]||(ma[ha]=Oe$7(pa,ha))}function de$4(pa,ha){return fe$4(ha)?ue$3(ha,(ma,ja)=>{ja?pa.icons[ma]=ja:pa.missing.add(ma)}):[]}function Fe$4(pa,ha,ma){try{if(typeof ma.body=="string")return pa.icons[ha]={...ma},!0}catch{}return!1}const he$4=/^[a-z0-9]+(-[a-z0-9]+)*$/,R$5=(pa,ha,ma,ja="")=>{const La=pa.split(":");if(pa.slice(0,1)==="@"){if(La.length<2||La.length>3)return null;ja=La.shift().slice(1)}if(La.length>3||!La.length)return null;if(La.length>1){const Gl=La.pop(),zl=La.pop(),Wl={provider:La.length>0?La[0]:ja,prefix:zl,name:Gl};return ha&&!F$b(Wl)?null:Wl}const Ba=La[0],hl=Ba.split("-");if(hl.length>1){const Gl={provider:ja,prefix:hl.shift(),name:hl.join("-")};return ha&&!F$b(Gl)?null:Gl}if(ma&&ja===""){const Gl={provider:ja,prefix:"",name:Ba};return ha&&!F$b(Gl,ma)?null:Gl}return null},F$b=(pa,ha)=>pa?!!((ha&&pa.prefix===""||pa.prefix)&&pa.name):!1;let E$a=!1;function pe$4(pa){return typeof pa=="boolean"&&(E$a=pa),E$a}function Z$8(pa){const ha=typeof pa=="string"?R$5(pa,!0,E$a):pa;if(ha){const ma=T$d(ha.provider,ha.prefix),ja=ha.name;return ma.icons[ja]||(ma.missing.has(ja)?null:void 0)}}function Le$3(pa,ha){const ma=R$5(pa,!0,E$a);if(!ma)return!1;const ja=T$d(ma.provider,ma.prefix);return ha?Fe$4(ja,ma.name,ha):(ja.missing.add(ma.name),!0)}function Me$3(pa,ha){if(typeof pa!="object")return!1;if(typeof ha!="string"&&(ha=pa.provider||""),E$a&&!ha&&!pa.prefix){let La=!1;return fe$4(pa)&&(pa.prefix="",ue$3(pa,(Ba,hl)=>{Le$3(Ba,hl)&&(La=!0)})),La}const ma=pa.prefix;if(!F$b({prefix:ma,name:"a"}))return!1;const ja=T$d(ha,ma);return!!de$4(ja,pa)}const ge$5=Object.freeze({width:null,height:null}),me$3=Object.freeze({...ge$5,...M$9}),Re$3=/(-?[0-9.]*[0-9]+[0-9.]*)/g,De$5=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ee$5(pa,ha,ma){if(ha===1)return pa;if(ma=ma||100,typeof pa=="number")return Math.ceil(pa*ha*ma)/ma;if(typeof pa!="string")return pa;const ja=pa.split(Re$3);if(ja===null||!ja.length)return pa;const La=[];let Ba=ja.shift(),hl=De$5.test(Ba);for(;;){if(hl){const Gl=parseFloat(Ba);isNaN(Gl)?La.push(Ba):La.push(Math.ceil(Gl*ha*ma)/ma)}else La.push(Ba);if(Ba=ja.shift(),Ba===void 0)return La.join("");hl=!hl}}function Ue$3(pa,ha="defs"){let ma="";const ja=pa.indexOf("<"+ha);for(;ja>=0;){const La=pa.indexOf(">",ja),Ba=pa.indexOf("</"+ha);if(La===-1||Ba===-1)break;const hl=pa.indexOf(">",Ba);if(hl===-1)break;ma+=pa.slice(La+1,Ba).trim(),pa=pa.slice(0,ja).trim()+pa.slice(hl+1)}return{defs:ma,content:pa}}function _e$3(pa,ha){return pa?"<defs>"+pa+"</defs>"+ha:ha}function qe$2(pa,ha,ma){const ja=Ue$3(pa);return _e$3(ja.defs,ha+ja.content+ma)}const He$4=pa=>pa==="unset"||pa==="undefined"||pa==="none";function $e$1(pa,ha){const ma={...B$a,...pa},ja={...me$3,...ha},La={left:ma.left,top:ma.top,width:ma.width,height:ma.height};let Ba=ma.body;[ma,ja].forEach(Nm=>{const Mm=[],Mg=Nm.hFlip,ly=Nm.vFlip;let uy=Nm.rotate;Mg?ly?uy+=2:(Mm.push("translate("+(La.width+La.left).toString()+" "+(0-La.top).toString()+")"),Mm.push("scale(-1 1)"),La.top=La.left=0):ly&&(Mm.push("translate("+(0-La.left).toString()+" "+(La.height+La.top).toString()+")"),Mm.push("scale(1 -1)"),La.top=La.left=0);let GE;switch(uy<0&&(uy-=Math.floor(uy/4)*4),uy=uy%4,uy){case 1:GE=La.height/2+La.top,Mm.unshift("rotate(90 "+GE.toString()+" "+GE.toString()+")");break;case 2:Mm.unshift("rotate(180 "+(La.width/2+La.left).toString()+" "+(La.height/2+La.top).toString()+")");break;case 3:GE=La.width/2+La.left,Mm.unshift("rotate(-90 "+GE.toString()+" "+GE.toString()+")");break}uy%2===1&&(La.left!==La.top&&(GE=La.left,La.left=La.top,La.top=GE),La.width!==La.height&&(GE=La.width,La.width=La.height,La.height=GE)),Mm.length&&(Ba=qe$2(Ba,'<g transform="'+Mm.join(" ")+'">',"</g>"))});const hl=ja.width,Gl=ja.height,zl=La.width,Wl=La.height;let Kl,su;hl===null?(su=Gl===null?"1em":Gl==="auto"?Wl:Gl,Kl=ee$5(su,zl/Wl)):(Kl=hl==="auto"?zl:hl,su=Gl===null?ee$5(Kl,Wl/zl):Gl==="auto"?Wl:Gl);const au={},ou=(Nm,Mm)=>{He$4(Mm)||(au[Nm]=Mm.toString())};ou("width",Kl),ou("height",su);const $m=[La.left,La.top,zl,Wl];return au.viewBox=$m.join(" "),{attributes:au,viewBox:$m,body:Ba}}const ze$2=/\sid="(\S+)"/g,Qe$1="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ve$2=0;function Be$2(pa,ha=Qe$1){const ma=[];let ja;for(;ja=ze$2.exec(pa);)ma.push(ja[1]);if(!ma.length)return pa;const La="suffix"+(Math.random()*16777216|Date.now()).toString(16);return ma.forEach(Ba=>{const hl=typeof ha=="function"?ha(Ba):ha+(Ve$2++).toString(),Gl=Ba.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");pa=pa.replace(new RegExp('([#;"])('+Gl+')([")]|\\.[a-z])',"g"),"$1"+hl+La+"$3")}),pa=pa.replace(new RegExp(La,"g"),""),pa}const z$b=Object.create(null);function Ge$3(pa,ha){z$b[pa]=ha}function Q$7(pa){return z$b[pa]||z$b[""]}function G$7(pa){let ha;if(typeof pa.resources=="string")ha=[pa.resources];else if(ha=pa.resources,!(ha instanceof Array)||!ha.length)return null;return{resources:ha,path:pa.path||"/",maxURL:pa.maxURL||500,rotate:pa.rotate||750,timeout:pa.timeout||5e3,random:pa.random===!0,index:pa.index||0,dataAfterTimeout:pa.dataAfterTimeout!==!1}}const W$7=Object.create(null),C$e=["https://api.simplesvg.com","https://api.unisvg.com"],L$9=[];for(;C$e.length>0;)C$e.length===1||Math.random()>.5?L$9.push(C$e.shift()):L$9.push(C$e.pop());W$7[""]=G$7({resources:["https://api.iconify.design"].concat(L$9)});function We$2(pa,ha){const ma=G$7(ha);return ma===null?!1:(W$7[pa]=ma,!0)}function J$7(pa){return W$7[pa]}const Je$2=()=>{let pa;try{if(pa=fetch,typeof pa=="function")return pa}catch{}};let te$5=Je$2();function Ke$3(pa,ha){const ma=J$7(pa);if(!ma)return 0;let ja;if(!ma.maxURL)ja=0;else{let La=0;ma.resources.forEach(hl=>{La=Math.max(La,hl.length)});const Ba=ha+".json?icons=";ja=ma.maxURL-La-ma.path.length-Ba.length}return ja}function Xe$2(pa){return pa===404}const Ye$2=(pa,ha,ma)=>{const ja=[],La=Ke$3(pa,ha),Ba="icons";let hl={type:Ba,provider:pa,prefix:ha,icons:[]},Gl=0;return ma.forEach((zl,Wl)=>{Gl+=zl.length+1,Gl>=La&&Wl>0&&(ja.push(hl),hl={type:Ba,provider:pa,prefix:ha,icons:[]},Gl=zl.length),hl.icons.push(zl)}),ja.push(hl),ja};function Ze$3(pa){if(typeof pa=="string"){const ha=J$7(pa);if(ha)return ha.path}return"/"}const et$3=(pa,ha,ma)=>{if(!te$5){ma("abort",424);return}let ja=Ze$3(ha.provider);switch(ha.type){case"icons":{const Ba=ha.prefix,hl=ha.icons.join(","),Gl=new URLSearchParams({icons:hl});ja+=Ba+".json?"+Gl.toString();break}case"custom":{const Ba=ha.uri;ja+=Ba.slice(0,1)==="/"?Ba.slice(1):Ba;break}default:ma("abort",400);return}let La=503;te$5(pa+ja).then(Ba=>{const hl=Ba.status;if(hl!==200){setTimeout(()=>{ma(Xe$2(hl)?"abort":"next",hl)});return}return La=501,Ba.json()}).then(Ba=>{if(typeof Ba!="object"||Ba===null){setTimeout(()=>{Ba===404?ma("abort",Ba):ma("next",La)});return}setTimeout(()=>{ma("success",Ba)})}).catch(()=>{ma("next",La)})},tt$3={prepare:Ye$2,send:et$3};function be$5(pa,ha){pa.forEach(ma=>{const ja=ma.loaderCallbacks;ja&&(ma.loaderCallbacks=ja.filter(La=>La.id!==ha))})}function nt$4(pa){pa.pendingCallbacksFlag||(pa.pendingCallbacksFlag=!0,setTimeout(()=>{pa.pendingCallbacksFlag=!1;const ha=pa.loaderCallbacks?pa.loaderCallbacks.slice(0):[];if(!ha.length)return;let ma=!1;const ja=pa.provider,La=pa.prefix;ha.forEach(Ba=>{const hl=Ba.icons,Gl=hl.pending.length;hl.pending=hl.pending.filter(zl=>{if(zl.prefix!==La)return!0;const Wl=zl.name;if(pa.icons[Wl])hl.loaded.push({provider:ja,prefix:La,name:Wl});else if(pa.missing.has(Wl))hl.missing.push({provider:ja,prefix:La,name:Wl});else return ma=!0,!0;return!1}),hl.pending.length!==Gl&&(ma||be$5([pa],Ba.id),Ba.callback(hl.loaded.slice(0),hl.missing.slice(0),hl.pending.slice(0),Ba.abort))})}))}let ot$2=0;function it$3(pa,ha,ma){const ja=ot$2++,La=be$5.bind(null,ma,ja);if(!ha.pending.length)return La;const Ba={id:ja,icons:ha,callback:pa,abort:La};return ma.forEach(hl=>{(hl.loaderCallbacks||(hl.loaderCallbacks=[])).push(Ba)}),La}function rt$4(pa){const ha={loaded:[],missing:[],pending:[]},ma=Object.create(null);pa.sort((La,Ba)=>La.provider!==Ba.provider?La.provider.localeCompare(Ba.provider):La.prefix!==Ba.prefix?La.prefix.localeCompare(Ba.prefix):La.name.localeCompare(Ba.name));let ja={provider:"",prefix:"",name:""};return pa.forEach(La=>{if(ja.name===La.name&&ja.prefix===La.prefix&&ja.provider===La.provider)return;ja=La;const Ba=La.provider,hl=La.prefix,Gl=La.name,zl=ma[Ba]||(ma[Ba]=Object.create(null)),Wl=zl[hl]||(zl[hl]=T$d(Ba,hl));let Kl;Gl in Wl.icons?Kl=ha.loaded:hl===""||Wl.missing.has(Gl)?Kl=ha.missing:Kl=ha.pending;const su={provider:Ba,prefix:hl,name:Gl};Kl.push(su)}),ha}function st$4(pa,ha=!0,ma=!1){const ja=[];return pa.forEach(La=>{const Ba=typeof La=="string"?R$5(La,ha,ma):La;Ba&&ja.push(Ba)}),ja}const ct$3={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function lt$4(pa,ha,ma,ja){const La=pa.resources.length,Ba=pa.random?Math.floor(Math.random()*La):pa.index;let hl;if(pa.random){let JE=pa.resources.slice(0);for(hl=[];JE.length>1;){const XE=Math.floor(Math.random()*JE.length);hl.push(JE[XE]),JE=JE.slice(0,XE).concat(JE.slice(XE+1))}hl=hl.concat(JE)}else hl=pa.resources.slice(Ba).concat(pa.resources.slice(0,Ba));const Gl=Date.now();let zl="pending",Wl=0,Kl,su=null,au=[],ou=[];typeof ja=="function"&&ou.push(ja);function $m(){su&&(clearTimeout(su),su=null)}function Nm(){zl==="pending"&&(zl="aborted"),$m(),au.forEach(JE=>{JE.status==="pending"&&(JE.status="aborted")}),au=[]}function Mm(JE,XE){XE&&(ou=[]),typeof JE=="function"&&ou.push(JE)}function Mg(){return{startTime:Gl,payload:ha,status:zl,queriesSent:Wl,queriesPending:au.length,subscribe:Mm,abort:Nm}}function ly(){zl="failed",ou.forEach(JE=>{JE(void 0,Kl)})}function uy(){au.forEach(JE=>{JE.status==="pending"&&(JE.status="aborted")}),au=[]}function GE(JE,XE,cN){const pN=XE!=="success";switch(au=au.filter(hN=>hN!==JE),zl){case"pending":break;case"failed":if(pN||!pa.dataAfterTimeout)return;break;default:return}if(XE==="abort"){Kl=cN,ly();return}if(pN){Kl=cN,au.length||(hl.length?YE():ly());return}if($m(),uy(),!pa.random){const hN=pa.resources.indexOf(JE.resource);hN!==-1&&hN!==pa.index&&(pa.index=hN)}zl="completed",ou.forEach(hN=>{hN(cN)})}function YE(){if(zl!=="pending")return;$m();const JE=hl.shift();if(JE===void 0){if(au.length){su=setTimeout(()=>{$m(),zl==="pending"&&(uy(),ly())},pa.timeout);return}ly();return}const XE={status:"pending",resource:JE,callback:(cN,pN)=>{GE(XE,cN,pN)}};au.push(XE),Wl++,su=setTimeout(YE,pa.rotate),ma(JE,ha,XE.callback)}return setTimeout(YE),Mg}function ye$5(pa){const ha={...ct$3,...pa};let ma=[];function ja(){ma=ma.filter(hl=>hl().status==="pending")}function La(hl,Gl,zl){const Wl=lt$4(ha,hl,Gl,(Kl,su)=>{ja(),zl&&zl(Kl,su)});return ma.push(Wl),Wl}function Ba(hl){return ma.find(Gl=>hl(Gl))||null}return{query:La,find:Ba,setIndex:hl=>{ha.index=hl},getIndex:()=>ha.index,cleanup:ja}}function ne$3(){}const q$7=Object.create(null);function at$4(pa){if(!q$7[pa]){const ha=J$7(pa);if(!ha)return;const ma=ye$5(ha),ja={config:ha,redundancy:ma};q$7[pa]=ja}return q$7[pa]}function ut$3(pa,ha,ma){let ja,La;if(typeof pa=="string"){const Ba=Q$7(pa);if(!Ba)return ma(void 0,424),ne$3;La=Ba.send;const hl=at$4(pa);hl&&(ja=hl.redundancy)}else{const Ba=G$7(pa);if(Ba){ja=ye$5(Ba);const hl=pa.resources?pa.resources[0]:"",Gl=Q$7(hl);Gl&&(La=Gl.send)}}return!ja||!La?(ma(void 0,424),ne$3):ja.query(ha,La,ma)().abort}function oe$3(){}function ft$2(pa){pa.iconsLoaderFlag||(pa.iconsLoaderFlag=!0,setTimeout(()=>{pa.iconsLoaderFlag=!1,nt$4(pa)}))}function dt$4(pa){const ha=[],ma=[];return pa.forEach(ja=>{(ja.match(he$4)?ha:ma).push(ja)}),{valid:ha,invalid:ma}}function j$d(pa,ha,ma){function ja(){const La=pa.pendingIcons;ha.forEach(Ba=>{La&&La.delete(Ba),pa.icons[Ba]||pa.missing.add(Ba)})}if(ma&&typeof ma=="object")try{if(!de$4(pa,ma).length){ja();return}}catch(La){console.error(La)}ja(),ft$2(pa)}function ie$5(pa,ha){pa instanceof Promise?pa.then(ma=>{ha(ma)}).catch(()=>{ha(null)}):ha(pa)}function ht$4(pa,ha){pa.iconsToLoad?pa.iconsToLoad=pa.iconsToLoad.concat(ha).sort():pa.iconsToLoad=ha,pa.iconsQueueFlag||(pa.iconsQueueFlag=!0,setTimeout(()=>{pa.iconsQueueFlag=!1;const{provider:ma,prefix:ja}=pa,La=pa.iconsToLoad;if(delete pa.iconsToLoad,!La||!La.length)return;const Ba=pa.loadIcon;if(pa.loadIcons&&(La.length>1||!Ba)){ie$5(pa.loadIcons(La,ja,ma),Wl=>{j$d(pa,La,Wl)});return}if(Ba){La.forEach(Wl=>{const Kl=Ba(Wl,ja,ma);ie$5(Kl,su=>{const au=su?{prefix:ja,icons:{[Wl]:su}}:null;j$d(pa,[Wl],au)})});return}const{valid:hl,invalid:Gl}=dt$4(La);if(Gl.length&&j$d(pa,Gl,null),!hl.length)return;const zl=ja.match(he$4)?Q$7(ma):null;if(!zl){j$d(pa,hl,null);return}zl.prepare(ma,ja,hl).forEach(Wl=>{ut$3(ma,Wl,Kl=>{j$d(pa,Wl.icons,Kl)})})}))}const pt$4=(pa,ha)=>{const ma=st$4(pa,!0,pe$4()),ja=rt$4(ma);if(!ja.pending.length){let zl=!0;return ha&&setTimeout(()=>{zl&&ha(ja.loaded,ja.missing,ja.pending,oe$3)}),()=>{zl=!1}}const La=Object.create(null),Ba=[];let hl,Gl;return ja.pending.forEach(zl=>{const{provider:Wl,prefix:Kl}=zl;if(Kl===Gl&&Wl===hl)return;hl=Wl,Gl=Kl,Ba.push(T$d(Wl,Kl));const su=La[Wl]||(La[Wl]=Object.create(null));su[Kl]||(su[Kl]=[])}),ja.pending.forEach(zl=>{const{provider:Wl,prefix:Kl,name:su}=zl,au=T$d(Wl,Kl),ou=au.pendingIcons||(au.pendingIcons=new Set);ou.has(su)||(ou.add(su),La[Wl][Kl].push(su))}),Ba.forEach(zl=>{const Wl=La[zl.provider][zl.prefix];Wl.length&&ht$4(zl,Wl)}),ha?it$3(ha,ja,Ba):oe$3};function gt$5(pa,ha){const ma={...pa};for(const ja in ha){const La=ha[ja],Ba=typeof La;ja in ge$5?(La===null||La&&(Ba==="string"||Ba==="number"))&&(ma[ja]=La):Ba===typeof ma[ja]&&(ma[ja]=ja==="rotate"?La%4:La)}return ma}const mt$4=/[\s,]+/;function bt$2(pa,ha){ha.split(mt$4).forEach(ma=>{switch(ma.trim()){case"horizontal":pa.hFlip=!0;break;case"vertical":pa.vFlip=!0;break}})}function yt$4(pa,ha=0){const ma=pa.replace(/^-?[0-9.]*/,"");function ja(La){for(;La<0;)La+=4;return La%4}if(ma===""){const La=parseInt(pa);return isNaN(La)?0:ja(La)}else if(ma!==pa){let La=0;switch(ma){case"%":La=25;break;case"deg":La=90}if(La){let Ba=parseFloat(pa.slice(0,pa.length-ma.length));return isNaN(Ba)?0:(Ba=Ba/La,Ba%1===0?ja(Ba):0)}}return ha}function xt$3(pa,ha){let ma=pa.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const ja in ha)ma+=" "+ja+'="'+ha[ja]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+ma+">"+pa+"</svg>"}function vt$4(pa){return pa.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function wt$4(pa){return"data:image/svg+xml,"+vt$4(pa)}function kt$3(pa){return'url("'+wt$4(pa)+'")'}let A$b;function It$4(){try{A$b=window.trustedTypes.createPolicy("iconify",{createHTML:pa=>pa})}catch{A$b=null}}function St$3(pa){return A$b===void 0&&It$4(),A$b?A$b.createHTML(pa):pa}const xe$3={...me$3,inline:!1},Nt$2={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Tt$3={display:"inline-block"},V$9={backgroundColor:"currentColor"},ve$4={backgroundColor:"transparent"},re$4={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},se$4={WebkitMask:V$9,mask:V$9,background:ve$4};for(const pa in se$4){const ha=se$4[pa];for(const ma in re$4)ha[pa+ma]=re$4[ma]}const Pt$4={...xe$3,inline:!0};function ce$4(pa){return pa+(pa.match(/^[-0-9.]+$/)?"px":"")}const Ct$4=(pa,ha,ma)=>{const ja=ha.inline?Pt$4:xe$3,La=gt$5(ja,ha),Ba=ha.mode||"svg",hl={},Gl=ha.style||{},zl={...Ba==="svg"?Nt$2:{}};if(ma){const Mm=R$5(ma,!1,!0);if(Mm){const Mg=["iconify"],ly=["provider","prefix"];for(const uy of ly)Mm[uy]&&Mg.push("iconify--"+Mm[uy]);zl.className=Mg.join(" ")}}for(let Mm in ha){const Mg=ha[Mm];if(Mg!==void 0)switch(Mm){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":zl.ref=Mg;break;case"className":zl[Mm]=(zl[Mm]?zl[Mm]+" ":"")+Mg;break;case"inline":case"hFlip":case"vFlip":La[Mm]=Mg===!0||Mg==="true"||Mg===1;break;case"flip":typeof Mg=="string"&&bt$2(La,Mg);break;case"color":hl.color=Mg;break;case"rotate":typeof Mg=="string"?La[Mm]=yt$4(Mg):typeof Mg=="number"&&(La[Mm]=Mg);break;case"ariaHidden":case"aria-hidden":Mg!==!0&&Mg!=="true"&&delete zl["aria-hidden"];break;default:ja[Mm]===void 0&&(zl[Mm]=Mg)}}const Wl=$e$1(pa,La),Kl=Wl.attributes;if(La.inline&&(hl.verticalAlign="-0.125em"),Ba==="svg"){zl.style={...hl,...Gl},Object.assign(zl,Kl);let Mm=0,Mg=ha.id;return typeof Mg=="string"&&(Mg=Mg.replace(/-/g,"_")),zl.dangerouslySetInnerHTML={__html:St$3(Be$2(Wl.body,Mg?()=>Mg+"ID"+Mm++:"iconifyReact"))},reactExports.createElement("svg",zl)}const{body:su,width:au,height:ou}=pa,$m=Ba==="mask"||(Ba==="bg"?!1:su.indexOf("currentColor")!==-1),Nm=xt$3(su,{...Kl,width:au+"",height:ou+""});return zl.style={...hl,"--svg":kt$3(Nm),width:ce$4(Kl.width),height:ce$4(Kl.height),...Tt$3,...$m?V$9:ve$4,...Gl},reactExports.createElement("span",zl)};pe$4(!0);Ge$3("",tt$3);if(typeof document<"u"&&typeof window<"u"){const pa=window;if(pa.IconifyPreload!==void 0){const ha=pa.IconifyPreload,ma="Invalid IconifyPreload syntax.";typeof ha=="object"&&ha!==null&&(ha instanceof Array?ha:[ha]).forEach(ja=>{try{(typeof ja!="object"||ja===null||ja instanceof Array||typeof ja.icons!="object"||typeof ja.prefix!="string"||!Me$3(ja))&&console.error(ma)}catch{console.error(ma)}})}if(pa.IconifyProviders!==void 0){const ha=pa.IconifyProviders;if(typeof ha=="object"&&ha!==null)for(let ma in ha){const ja="IconifyProviders["+ma+"] is invalid.";try{const La=ha[ma];if(typeof La!="object"||!La||La.resources===void 0)continue;We$2(ma,La)||console.error(ja)}catch{console.error(ja)}}}}function we$5(pa){const[ha,ma]=reactExports.useState(!!pa.ssr),[ja,La]=reactExports.useState({});function Ba(ou){if(ou){const $m=pa.icon;if(typeof $m=="object")return{name:"",data:$m};const Nm=Z$8($m);if(Nm)return{name:$m,data:Nm}}return{name:""}}const[hl,Gl]=reactExports.useState(Ba(!!pa.ssr));function zl(){const ou=ja.callback;ou&&(ou(),La({}))}function Wl(ou){if(JSON.stringify(hl)!==JSON.stringify(ou))return zl(),Gl(ou),!0}function Kl(){var ou;const $m=pa.icon;if(typeof $m=="object"){Wl({name:"",data:$m});return}const Nm=Z$8($m);if(Wl({name:$m,data:Nm}))if(Nm===void 0){const Mm=pt$4([$m],Kl);La({callback:Mm})}else Nm&&((ou=pa.onLoad)===null||ou===void 0||ou.call(pa,$m))}reactExports.useEffect(()=>(ma(!0),zl),[]),reactExports.useEffect(()=>{ha&&Kl()},[pa.icon,ha]);const{name:su,data:au}=hl;return au?Ct$4({...B$a,...au},pa,su):pa.children?pa.children:pa.fallback?pa.fallback:reactExports.createElement("span",{})}const ke$5=reactExports.forwardRef((pa,ha)=>we$5({...pa,_ref:ha}));reactExports.forwardRef((pa,ha)=>we$5({inline:!0,...pa,_ref:ha}));const Ie$3={git:"tabler:brand-github-filled",google:"devicon:google",microsoft:"logos:microsoft-icon",linkedin:"devicon:linkedin"},Ot$3={setting:"tabler:settings",checkbox:"mdi:checkbox-blank-outline",checkboxSelected:"mdi:checkbox-marked",entity:"bi:card-list",logout:"tabler:logout",drag:"icon-park-outline:drag",agent:"fluent:bot-sparkle-24-regular",llm:"hugeicons:ai-brain-05",error:"material-symbols:error",input:"ph:arrow-circle-down-left-bold",output:"ph:arrow-circle-up-right-bold",plan:"icon-park-outline:plan",instruction:"octicon:checklist-24",tool:"tabler:tool"};function Ft$4(pa){return pa.charAt(0).toUpperCase()+pa.slice(1)}const Lt$3=pa=>{const ha=pa.split("/").filter(Boolean),ma=ha[ha.length-1];return{pathParts:ha,renderPath:ma}},Mt$4=pa=>pa==="edit"||pa==="new",Se$3=()=>{const pa=useNavigate(),{pathname:ha}=useLocation(),ma=useParams();return{customNavigate:ja=>{if(ha.includes("/design/ui/")){const La=ha.split("/"),Ba=La.findIndex(hl=>hl==="ui");if(Ba!==-1){const hl=`${La.slice(0,Ba+4).join("/")}${ja}`;pa(hl)}else pa(ja)}else pa(ja)},params:ma}},Dt$3=({navigationItems:pa,schema:ha})=>{const{customNavigate:ma}=Se$3();return!ha||!ha.header||!ha.socialNetworks||!ha.form?null:jsxRuntimeExports.jsxs("div",{className:"auth-screen",children:[jsxRuntimeExports.jsxs("div",{className:"auth-header",children:[jsxRuntimeExports.jsx("div",{className:"title",children:ha.header.title}),ha.header.subTitle&&jsxRuntimeExports.jsx("div",{className:"subtitle",children:ha.header.subTitle})]}),jsxRuntimeExports.jsxs("form",{className:"auth-form",onSubmit:ja=>{ja.preventDefault(),ma("/dashboard")},children:[jsxRuntimeExports.jsx("div",{children:ha.socialNetworks.label}),jsxRuntimeExports.jsx("div",{className:"auth-social-networks",children:ha.socialNetworks.icons.map(ja=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(ke$5,{icon:Ie$3[ja],className:"w-6 h-6"})},ja))}),jsxRuntimeExports.jsxs("div",{className:"auth-separator",children:[jsxRuntimeExports.jsx("div",{className:"fx-divider"}),jsxRuntimeExports.jsx("div",{children:"OR"}),jsxRuntimeExports.jsx("div",{className:"fx-divider"})]}),jsxRuntimeExports.jsx("input",{type:"email",placeholder:ha.form.placeholder.email}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:ha.form.placeholder.password}),jsxRuntimeExports.jsx("button",{type:"submit",className:"fx-button w-full",children:"Sign In"}),jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:["Don't have an account ?"," ",jsxRuntimeExports.jsx("span",{className:"auth-link",onClick:()=>ma("/signup"),children:"Create an account"})]})]})]})},Ut$2=({schema:pa})=>{const{customNavigate:ha}=Se$3();return!pa||!pa.header||!pa.socialNetworks||!pa.form?null:jsxRuntimeExports.jsxs("div",{className:"auth-screen",children:[jsxRuntimeExports.jsxs("div",{className:"auth-header",children:[jsxRuntimeExports.jsx("div",{className:"title",children:pa.header.title}),pa.header.subTitle&&jsxRuntimeExports.jsx("div",{className:"subtitle",children:pa.header.subTitle})]}),jsxRuntimeExports.jsxs("form",{className:"auth-form",children:[jsxRuntimeExports.jsx("div",{children:pa.socialNetworks.label}),jsxRuntimeExports.jsx("div",{className:"auth-social-networks",children:pa.socialNetworks.icons.map(ma=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(ke$5,{icon:Ie$3[ma],className:"w-6 h-6"})},ma))}),jsxRuntimeExports.jsxs("div",{className:"auth-separator",children:[jsxRuntimeExports.jsx("div",{className:"fx-divider"}),jsxRuntimeExports.jsx("div",{children:"OR"}),jsxRuntimeExports.jsx("div",{className:"fx-divider"})]}),jsxRuntimeExports.jsx("input",{type:"email",placeholder:pa.form.placeholder.email}),jsxRuntimeExports.jsx("input",{type:"text",placeholder:pa.form.placeholder.username}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:pa.form.placeholder.password}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:pa.form.placeholder.confirmPassword}),jsxRuntimeExports.jsx("button",{type:"submit",className:"fx-button w-full",children:"Create Account"}),jsxRuntimeExports.jsxs("div",{children:["Already have an account ?"," ",jsxRuntimeExports.jsx("span",{className:"auth-link",onClick:()=>ha("/"),children:"Sign In"})]})]})]})};var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(pa){return this.listeners.add(pa),this.onSubscribe(),()=>{this.listeners.delete(pa),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},defaultTimeoutProvider={setTimeout:(pa,ha)=>setTimeout(pa,ha),clearTimeout:pa=>clearTimeout(pa),setInterval:(pa,ha)=>setInterval(pa,ha),clearInterval:pa=>clearInterval(pa)},TimeoutManager=class{#e=defaultTimeoutProvider;#t=!1;setTimeoutProvider(pa){this.#e=pa}setTimeout(pa,ha){return this.#e.setTimeout(pa,ha)}clearTimeout(pa){this.#e.clearTimeout(pa)}setInterval(pa,ha){return this.#e.setInterval(pa,ha)}clearInterval(pa){this.#e.clearInterval(pa)}},timeoutManager=new TimeoutManager;function systemSetTimeoutZero(pa){setTimeout(pa,0)}var isServer=typeof window>"u"||"Deno"in globalThis;function noop$b(){}function functionalUpdate(pa,ha){return typeof pa=="function"?pa(ha):pa}function isValidTimeout(pa){return typeof pa=="number"&&pa>=0&&pa!==1/0}function timeUntilStale(pa,ha){return Math.max(pa+(ha||0)-Date.now(),0)}function resolveStaleTime(pa,ha){return typeof pa=="function"?pa(ha):pa}function resolveEnabled(pa,ha){return typeof pa=="function"?pa(ha):pa}function matchQuery(pa,ha){const{type:ma="all",exact:ja,fetchStatus:La,predicate:Ba,queryKey:hl,stale:Gl}=pa;if(hl){if(ja){if(ha.queryHash!==hashQueryKeyByOptions(hl,ha.options))return!1}else if(!partialMatchKey(ha.queryKey,hl))return!1}if(ma!=="all"){const zl=ha.isActive();if(ma==="active"&&!zl||ma==="inactive"&&zl)return!1}return!(typeof Gl=="boolean"&&ha.isStale()!==Gl||La&&La!==ha.state.fetchStatus||Ba&&!Ba(ha))}function matchMutation(pa,ha){const{exact:ma,status:ja,predicate:La,mutationKey:Ba}=pa;if(Ba){if(!ha.options.mutationKey)return!1;if(ma){if(hashKey(ha.options.mutationKey)!==hashKey(Ba))return!1}else if(!partialMatchKey(ha.options.mutationKey,Ba))return!1}return!(ja&&ha.state.status!==ja||La&&!La(ha))}function hashQueryKeyByOptions(pa,ha){return(ha?.queryKeyHashFn||hashKey)(pa)}function hashKey(pa){return JSON.stringify(pa,(ha,ma)=>isPlainObject$3(ma)?Object.keys(ma).sort().reduce((ja,La)=>(ja[La]=ma[La],ja),{}):ma)}function partialMatchKey(pa,ha){return pa===ha?!0:typeof pa!=typeof ha?!1:pa&&ha&&typeof pa=="object"&&typeof ha=="object"?Object.keys(ha).every(ma=>partialMatchKey(pa[ma],ha[ma])):!1}var hasOwn$4=Object.prototype.hasOwnProperty;function replaceEqualDeep(pa,ha){if(pa===ha)return pa;const ma=isPlainArray(pa)&&isPlainArray(ha);if(!ma&&!(isPlainObject$3(pa)&&isPlainObject$3(ha)))return ha;const La=(ma?pa:Object.keys(pa)).length,Ba=ma?ha:Object.keys(ha),hl=Ba.length,Gl=ma?new Array(hl):{};let zl=0;for(let Wl=0;Wl<hl;Wl++){const Kl=ma?Wl:Ba[Wl],su=pa[Kl],au=ha[Kl];if(su===au){Gl[Kl]=su,(ma?Wl<La:hasOwn$4.call(pa,Kl))&&zl++;continue}if(su===null||au===null||typeof su!="object"||typeof au!="object"){Gl[Kl]=au;continue}const ou=replaceEqualDeep(su,au);Gl[Kl]=ou,ou===su&&zl++}return La===hl&&zl===La?pa:Gl}function shallowEqualObjects$1(pa,ha){if(!ha||Object.keys(pa).length!==Object.keys(ha).length)return!1;for(const ma in pa)if(pa[ma]!==ha[ma])return!1;return!0}function isPlainArray(pa){return Array.isArray(pa)&&pa.length===Object.keys(pa).length}function isPlainObject$3(pa){if(!hasObjectPrototype(pa))return!1;const ha=pa.constructor;if(ha===void 0)return!0;const ma=ha.prototype;return!(!hasObjectPrototype(ma)||!ma.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(pa)!==Object.prototype)}function hasObjectPrototype(pa){return Object.prototype.toString.call(pa)==="[object Object]"}function sleep$4(pa){return new Promise(ha=>{timeoutManager.setTimeout(ha,pa)})}function replaceData(pa,ha,ma){return typeof ma.structuralSharing=="function"?ma.structuralSharing(pa,ha):ma.structuralSharing!==!1?replaceEqualDeep(pa,ha):ha}function addToEnd(pa,ha,ma=0){const ja=[...pa,ha];return ma&&ja.length>ma?ja.slice(1):ja}function addToStart(pa,ha,ma=0){const ja=[ha,...pa];return ma&&ja.length>ma?ja.slice(0,-1):ja}var skipToken=Symbol();function ensureQueryFn(pa,ha){return!pa.queryFn&&ha?.initialPromise?()=>ha.initialPromise:!pa.queryFn||pa.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${pa.queryHash}'`)):pa.queryFn}function shouldThrowError(pa,ha){return typeof pa=="function"?pa(...ha):!!pa}var FocusManager=class extends Subscribable{#e;#t;#r;constructor(){super(),this.#r=pa=>{if(!isServer&&window.addEventListener){const ha=()=>pa();return window.addEventListener("visibilitychange",ha,!1),()=>{window.removeEventListener("visibilitychange",ha)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(pa){this.#r=pa,this.#t?.(),this.#t=pa(ha=>{typeof ha=="boolean"?this.setFocused(ha):this.onFocus()})}setFocused(pa){this.#e!==pa&&(this.#e=pa,this.onFocus())}onFocus(){const pa=this.isFocused();this.listeners.forEach(ha=>{ha(pa)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},focusManager=new FocusManager;function pendingThenable(){let pa,ha;const ma=new Promise((La,Ba)=>{pa=La,ha=Ba});ma.status="pending",ma.catch(()=>{});function ja(La){Object.assign(ma,La),delete ma.resolve,delete ma.reject}return ma.resolve=La=>{ja({status:"fulfilled",value:La}),pa(La)},ma.reject=La=>{ja({status:"rejected",reason:La}),ha(La)},ma}function tryResolveSync(pa){let ha;if(pa.then(ma=>(ha=ma,ma),noop$b)?.catch(noop$b),ha!==void 0)return{data:ha}}function defaultTransformerFn(pa){return pa}function dehydrateMutation(pa){return{mutationKey:pa.options.mutationKey,state:pa.state,...pa.options.scope&&{scope:pa.options.scope},...pa.meta&&{meta:pa.meta}}}function dehydrateQuery(pa,ha,ma){const ja=()=>{const La=pa.promise?.then(ha).catch(Ba=>ma(Ba)?Promise.reject(new Error("redacted")):Promise.reject(Ba));return La?.catch(noop$b),La};return{dehydratedAt:Date.now(),state:{...pa.state,...pa.state.data!==void 0&&{data:ha(pa.state.data)}},queryKey:pa.queryKey,queryHash:pa.queryHash,...pa.state.status==="pending"&&{promise:ja()},...pa.meta&&{meta:pa.meta}}}function defaultShouldDehydrateMutation(pa){return pa.state.isPaused}function defaultShouldDehydrateQuery(pa){return pa.state.status==="success"}function defaultShouldRedactErrors(pa){return!0}function dehydrate(pa,ha={}){const ma=ha.shouldDehydrateMutation??pa.getDefaultOptions().dehydrate?.shouldDehydrateMutation??defaultShouldDehydrateMutation,ja=pa.getMutationCache().getAll().flatMap(zl=>ma(zl)?[dehydrateMutation(zl)]:[]),La=ha.shouldDehydrateQuery??pa.getDefaultOptions().dehydrate?.shouldDehydrateQuery??defaultShouldDehydrateQuery,Ba=ha.shouldRedactErrors??pa.getDefaultOptions().dehydrate?.shouldRedactErrors??defaultShouldRedactErrors,hl=ha.serializeData??pa.getDefaultOptions().dehydrate?.serializeData??defaultTransformerFn,Gl=pa.getQueryCache().getAll().flatMap(zl=>La(zl)?[dehydrateQuery(zl,hl,Ba)]:[]);return{mutations:ja,queries:Gl}}function hydrate(pa,ha,ma){if(typeof ha!="object"||ha===null)return;const ja=pa.getMutationCache(),La=pa.getQueryCache(),Ba=ma?.defaultOptions?.deserializeData??pa.getDefaultOptions().hydrate?.deserializeData??defaultTransformerFn,hl=ha.mutations||[],Gl=ha.queries||[];hl.forEach(({state:zl,...Wl})=>{ja.build(pa,{...pa.getDefaultOptions().hydrate?.mutations,...ma?.defaultOptions?.mutations,...Wl},zl)}),Gl.forEach(({queryKey:zl,state:Wl,queryHash:Kl,meta:su,promise:au,dehydratedAt:ou})=>{const $m=au?tryResolveSync(au):void 0,Nm=Wl.data===void 0?$m?.data:Wl.data,Mm=Nm===void 0?Nm:Ba(Nm);let Mg=La.get(Kl);const ly=Mg?.state.status==="pending",uy=Mg?.state.fetchStatus==="fetching";if(Mg){const GE=$m&&ou!==void 0&&ou>Mg.state.dataUpdatedAt;if(Wl.dataUpdatedAt>Mg.state.dataUpdatedAt||GE){const{fetchStatus:YE,...JE}=Wl;Mg.setState({...JE,data:Mm})}}else Mg=La.build(pa,{...pa.getDefaultOptions().hydrate?.queries,...ma?.defaultOptions?.queries,queryKey:zl,queryHash:Kl,meta:su},{...Wl,data:Mm,fetchStatus:"idle",status:Mm!==void 0?"success":Wl.status});au&&!ly&&!uy&&(ou===void 0||ou>Mg.state.dataUpdatedAt)&&Mg.fetch(void 0,{initialPromise:Promise.resolve(au).then(Ba)}).catch(noop$b)})}var defaultScheduler=systemSetTimeoutZero;function createNotifyManager(){let pa=[],ha=0,ma=Gl=>{Gl()},ja=Gl=>{Gl()},La=defaultScheduler;const Ba=Gl=>{ha?pa.push(Gl):La(()=>{ma(Gl)})},hl=()=>{const Gl=pa;pa=[],Gl.length&&La(()=>{ja(()=>{Gl.forEach(zl=>{ma(zl)})})})};return{batch:Gl=>{let zl;ha++;try{zl=Gl()}finally{ha--,ha||hl()}return zl},batchCalls:Gl=>(...zl)=>{Ba(()=>{Gl(...zl)})},schedule:Ba,setNotifyFunction:Gl=>{ma=Gl},setBatchNotifyFunction:Gl=>{ja=Gl},setScheduler:Gl=>{La=Gl}}}var notifyManager=createNotifyManager(),OnlineManager=class extends Subscribable{#e=!0;#t;#r;constructor(){super(),this.#r=pa=>{if(!isServer&&window.addEventListener){const ha=()=>pa(!0),ma=()=>pa(!1);return window.addEventListener("online",ha,!1),window.addEventListener("offline",ma,!1),()=>{window.removeEventListener("online",ha),window.removeEventListener("offline",ma)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(pa){this.#r=pa,this.#t?.(),this.#t=pa(this.setOnline.bind(this))}setOnline(pa){this.#e!==pa&&(this.#e=pa,this.listeners.forEach(ma=>{ma(pa)}))}isOnline(){return this.#e}},onlineManager=new OnlineManager;function defaultRetryDelay(pa){return Math.min(1e3*2**pa,3e4)}function canFetch(pa){return(pa??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(pa){super("CancelledError"),this.revert=pa?.revert,this.silent=pa?.silent}};function createRetryer(pa){let ha=!1,ma=0,ja;const La=pendingThenable(),Ba=()=>La.status!=="pending",hl=Nm=>{if(!Ba()){const Mm=new CancelledError(Nm);au(Mm),pa.onCancel?.(Mm)}},Gl=()=>{ha=!0},zl=()=>{ha=!1},Wl=()=>focusManager.isFocused()&&(pa.networkMode==="always"||onlineManager.isOnline())&&pa.canRun(),Kl=()=>canFetch(pa.networkMode)&&pa.canRun(),su=Nm=>{Ba()||(ja?.(),La.resolve(Nm))},au=Nm=>{Ba()||(ja?.(),La.reject(Nm))},ou=()=>new Promise(Nm=>{ja=Mm=>{(Ba()||Wl())&&Nm(Mm)},pa.onPause?.()}).then(()=>{ja=void 0,Ba()||pa.onContinue?.()}),$m=()=>{if(Ba())return;let Nm;const Mm=ma===0?pa.initialPromise:void 0;try{Nm=Mm??pa.fn()}catch(Mg){Nm=Promise.reject(Mg)}Promise.resolve(Nm).then(su).catch(Mg=>{if(Ba())return;const ly=pa.retry??(isServer?0:3),uy=pa.retryDelay??defaultRetryDelay,GE=typeof uy=="function"?uy(ma,Mg):uy,YE=ly===!0||typeof ly=="number"&&ma<ly||typeof ly=="function"&&ly(ma,Mg);if(ha||!YE){au(Mg);return}ma++,pa.onFail?.(ma,Mg),sleep$4(GE).then(()=>Wl()?void 0:ou()).then(()=>{ha?au(Mg):$m()})})};return{promise:La,status:()=>La.status,cancel:hl,continue:()=>(ja?.(),La),cancelRetry:Gl,continueRetry:zl,canStart:Kl,start:()=>(Kl()?$m():ou().then($m),La)}}var Removable=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&(this.#e=timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(pa){this.gcTime=Math.max(this.gcTime||0,pa??(isServer?1/0:300*1e3))}clearGcTimeout(){this.#e&&(timeoutManager.clearTimeout(this.#e),this.#e=void 0)}},Query$1=class extends Removable{#e;#t;#r;#n;#s;#o;#i;constructor(ha){super(),this.#i=!1,this.#o=ha.defaultOptions,this.setOptions(ha.options),this.observers=[],this.#n=ha.client,this.#r=this.#n.getQueryCache(),this.queryKey=ha.queryKey,this.queryHash=ha.queryHash,this.#e=getDefaultState$2(this.options),this.state=ha.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(ha){if(this.options={...this.#o,...ha},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const ma=getDefaultState$2(this.options);ma.data!==void 0&&(this.setState(successState(ma.data,ma.dataUpdatedAt)),this.#e=ma)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(ha,ma){const ja=replaceData(this.state.data,ha,this.options);return this.#a({data:ja,type:"success",dataUpdatedAt:ma?.updatedAt,manual:ma?.manual}),ja}setState(ha,ma){this.#a({type:"setState",state:ha,setStateOptions:ma})}cancel(ha){const ma=this.#s?.promise;return this.#s?.cancel(ha),ma?ma.then(noop$b).catch(noop$b):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(ha=>resolveEnabled(ha.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(ha=>resolveStaleTime(ha.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(ha=>ha.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(ha=0){return this.state.data===void 0?!0:ha==="static"?!1:this.state.isInvalidated?!0:!timeUntilStale(this.state.dataUpdatedAt,ha)}onFocus(){this.observers.find(ma=>ma.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(ma=>ma.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(ha){this.observers.includes(ha)||(this.observers.push(ha),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:ha}))}removeObserver(ha){this.observers.includes(ha)&&(this.observers=this.observers.filter(ma=>ma!==ha),this.observers.length||(this.#s&&(this.#i?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:ha}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}async fetch(ha,ma){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&ma?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(ha&&this.setOptions(ha),!this.options.queryFn){const zl=this.observers.find(Wl=>Wl.options.queryFn);zl&&this.setOptions(zl.options)}const ja=new AbortController,La=zl=>{Object.defineProperty(zl,"signal",{enumerable:!0,get:()=>(this.#i=!0,ja.signal)})},Ba=()=>{const zl=ensureQueryFn(this.options,ma),Kl=(()=>{const su={client:this.#n,queryKey:this.queryKey,meta:this.meta};return La(su),su})();return this.#i=!1,this.options.persister?this.options.persister(zl,Kl,this):zl(Kl)},Gl=(()=>{const zl={fetchOptions:ma,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:Ba};return La(zl),zl})();this.options.behavior?.onFetch(Gl,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==Gl.fetchOptions?.meta)&&this.#a({type:"fetch",meta:Gl.fetchOptions?.meta}),this.#s=createRetryer({initialPromise:ma?.initialPromise,fn:Gl.fetchFn,onCancel:zl=>{zl instanceof CancelledError&&zl.revert&&this.setState({...this.#t,fetchStatus:"idle"}),ja.abort()},onFail:(zl,Wl)=>{this.#a({type:"failed",failureCount:zl,error:Wl})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:Gl.options.retry,retryDelay:Gl.options.retryDelay,networkMode:Gl.options.networkMode,canRun:()=>!0});try{const zl=await this.#s.start();if(zl===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(zl),this.#r.config.onSuccess?.(zl,this),this.#r.config.onSettled?.(zl,this.state.error,this),zl}catch(zl){if(zl instanceof CancelledError){if(zl.silent)return this.#s.promise;if(zl.revert){if(this.state.data===void 0)throw zl;return this.state.data}}throw this.#a({type:"error",error:zl}),this.#r.config.onError?.(zl,this),this.#r.config.onSettled?.(this.state.data,zl,this),zl}finally{this.scheduleGc()}}#a(ha){const ma=ja=>{switch(ha.type){case"failed":return{...ja,fetchFailureCount:ha.failureCount,fetchFailureReason:ha.error};case"pause":return{...ja,fetchStatus:"paused"};case"continue":return{...ja,fetchStatus:"fetching"};case"fetch":return{...ja,...fetchState(ja.data,this.options),fetchMeta:ha.meta??null};case"success":const La={...ja,...successState(ha.data,ha.dataUpdatedAt),dataUpdateCount:ja.dataUpdateCount+1,...!ha.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=ha.manual?La:void 0,La;case"error":const Ba=ha.error;return{...ja,error:Ba,errorUpdateCount:ja.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:ja.fetchFailureCount+1,fetchFailureReason:Ba,fetchStatus:"idle",status:"error"};case"invalidate":return{...ja,isInvalidated:!0};case"setState":return{...ja,...ha.state}}};this.state=ma(this.state),notifyManager.batch(()=>{this.observers.forEach(ja=>{ja.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:ha})})}};function fetchState(pa,ha){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(ha.networkMode)?"fetching":"paused",...pa===void 0&&{error:null,status:"pending"}}}function successState(pa,ha){return{data:pa,dataUpdatedAt:ha??Date.now(),error:null,isInvalidated:!1,status:"success"}}function getDefaultState$2(pa){const ha=typeof pa.initialData=="function"?pa.initialData():pa.initialData,ma=ha!==void 0,ja=ma?typeof pa.initialDataUpdatedAt=="function"?pa.initialDataUpdatedAt():pa.initialDataUpdatedAt:0;return{data:ha,dataUpdateCount:0,dataUpdatedAt:ma?ja??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:ma?"success":"pending",fetchStatus:"idle"}}var QueryObserver=class extends Subscribable{constructor(pa,ha){super(),this.options=ha,this.#e=pa,this.#a=null,this.#i=pendingThenable(),this.bindMethods(),this.setOptions(ha)}#e;#t=void 0;#r=void 0;#n=void 0;#s;#o;#i;#a;#l;#p;#c;#h;#u;#d;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),shouldFetchOnMount(this.#t,this.options)?this.#f():this.updateResult(),this.#_())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#$(),this.#g(),this.#t.removeObserver(this)}setOptions(pa){const ha=this.options,ma=this.#t;if(this.options=this.#e.defaultQueryOptions(pa),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),ha._defaulted&&!shallowEqualObjects$1(this.options,ha)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const ja=this.hasListeners();ja&&shouldFetchOptionally(this.#t,ma,this.options,ha)&&this.#f(),this.updateResult(),ja&&(this.#t!==ma||resolveEnabled(this.options.enabled,this.#t)!==resolveEnabled(ha.enabled,this.#t)||resolveStaleTime(this.options.staleTime,this.#t)!==resolveStaleTime(ha.staleTime,this.#t))&&this.#v();const La=this.#E();ja&&(this.#t!==ma||resolveEnabled(this.options.enabled,this.#t)!==resolveEnabled(ha.enabled,this.#t)||La!==this.#d)&&this.#b(La)}getOptimisticResult(pa){const ha=this.#e.getQueryCache().build(this.#e,pa),ma=this.createResult(ha,pa);return shouldAssignObserverCurrentProperties(this,ma)&&(this.#n=ma,this.#o=this.options,this.#s=this.#t.state),ma}getCurrentResult(){return this.#n}trackResult(pa,ha){return new Proxy(pa,{get:(ma,ja)=>(this.trackProp(ja),ha?.(ja),ja==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(ma,ja))})}trackProp(pa){this.#m.add(pa)}getCurrentQuery(){return this.#t}refetch({...pa}={}){return this.fetch({...pa})}fetchOptimistic(pa){const ha=this.#e.defaultQueryOptions(pa),ma=this.#e.getQueryCache().build(this.#e,ha);return ma.fetch().then(()=>this.createResult(ma,ha))}fetch(pa){return this.#f({...pa,cancelRefetch:pa.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(pa){this.#x();let ha=this.#t.fetch(this.options,pa);return pa?.throwOnError||(ha=ha.catch(noop$b)),ha}#v(){this.#$();const pa=resolveStaleTime(this.options.staleTime,this.#t);if(isServer||this.#n.isStale||!isValidTimeout(pa))return;const ma=timeUntilStale(this.#n.dataUpdatedAt,pa)+1;this.#h=timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},ma)}#E(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#b(pa){this.#g(),this.#d=pa,!(isServer||resolveEnabled(this.options.enabled,this.#t)===!1||!isValidTimeout(this.#d)||this.#d===0)&&(this.#u=timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&this.#f()},this.#d))}#_(){this.#v(),this.#b(this.#E())}#$(){this.#h&&(timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#g(){this.#u&&(timeoutManager.clearInterval(this.#u),this.#u=void 0)}createResult(pa,ha){const ma=this.#t,ja=this.options,La=this.#n,Ba=this.#s,hl=this.#o,zl=pa!==ma?pa.state:this.#r,{state:Wl}=pa;let Kl={...Wl},su=!1,au;if(ha._optimisticResults){const cN=this.hasListeners(),pN=!cN&&shouldFetchOnMount(pa,ha),hN=cN&&shouldFetchOptionally(pa,ma,ha,ja);(pN||hN)&&(Kl={...Kl,...fetchState(Wl.data,pa.options)}),ha._optimisticResults==="isRestoring"&&(Kl.fetchStatus="idle")}let{error:ou,errorUpdatedAt:$m,status:Nm}=Kl;au=Kl.data;let Mm=!1;if(ha.placeholderData!==void 0&&au===void 0&&Nm==="pending"){let cN;La?.isPlaceholderData&&ha.placeholderData===hl?.placeholderData?(cN=La.data,Mm=!0):cN=typeof ha.placeholderData=="function"?ha.placeholderData(this.#c?.state.data,this.#c):ha.placeholderData,cN!==void 0&&(Nm="success",au=replaceData(La?.data,cN,ha),su=!0)}if(ha.select&&au!==void 0&&!Mm)if(La&&au===Ba?.data&&ha.select===this.#l)au=this.#p;else try{this.#l=ha.select,au=ha.select(au),au=replaceData(La?.data,au,ha),this.#p=au,this.#a=null}catch(cN){this.#a=cN}this.#a&&(ou=this.#a,au=this.#p,$m=Date.now(),Nm="error");const Mg=Kl.fetchStatus==="fetching",ly=Nm==="pending",uy=Nm==="error",GE=ly&&Mg,YE=au!==void 0,XE={status:Nm,fetchStatus:Kl.fetchStatus,isPending:ly,isSuccess:Nm==="success",isError:uy,isInitialLoading:GE,isLoading:GE,data:au,dataUpdatedAt:Kl.dataUpdatedAt,error:ou,errorUpdatedAt:$m,failureCount:Kl.fetchFailureCount,failureReason:Kl.fetchFailureReason,errorUpdateCount:Kl.errorUpdateCount,isFetched:Kl.dataUpdateCount>0||Kl.errorUpdateCount>0,isFetchedAfterMount:Kl.dataUpdateCount>zl.dataUpdateCount||Kl.errorUpdateCount>zl.errorUpdateCount,isFetching:Mg,isRefetching:Mg&&!ly,isLoadingError:uy&&!YE,isPaused:Kl.fetchStatus==="paused",isPlaceholderData:su,isRefetchError:uy&&YE,isStale:isStale(pa,ha),refetch:this.refetch,promise:this.#i,isEnabled:resolveEnabled(ha.enabled,pa)!==!1};if(this.options.experimental_prefetchInRender){const cN=lN=>{XE.status==="error"?lN.reject(XE.error):XE.data!==void 0&&lN.resolve(XE.data)},pN=()=>{const lN=this.#i=XE.promise=pendingThenable();cN(lN)},hN=this.#i;switch(hN.status){case"pending":pa.queryHash===ma.queryHash&&cN(hN);break;case"fulfilled":(XE.status==="error"||XE.data!==hN.value)&&pN();break;case"rejected":(XE.status!=="error"||XE.error!==hN.reason)&&pN();break}}return XE}updateResult(){const pa=this.#n,ha=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#o=this.options,this.#s.data!==void 0&&(this.#c=this.#t),shallowEqualObjects$1(ha,pa))return;this.#n=ha;const ma=()=>{if(!pa)return!0;const{notifyOnChangeProps:ja}=this.options,La=typeof ja=="function"?ja():ja;if(La==="all"||!La&&!this.#m.size)return!0;const Ba=new Set(La??this.#m);return this.options.throwOnError&&Ba.add("error"),Object.keys(this.#n).some(hl=>{const Gl=hl;return this.#n[Gl]!==pa[Gl]&&Ba.has(Gl)})};this.#y({listeners:ma()})}#x(){const pa=this.#e.getQueryCache().build(this.#e,this.options);if(pa===this.#t)return;const ha=this.#t;this.#t=pa,this.#r=pa.state,this.hasListeners()&&(ha?.removeObserver(this),pa.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#_()}#y(pa){notifyManager.batch(()=>{pa.listeners&&this.listeners.forEach(ha=>{ha(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function shouldLoadOnMount(pa,ha){return resolveEnabled(ha.enabled,pa)!==!1&&pa.state.data===void 0&&!(pa.state.status==="error"&&ha.retryOnMount===!1)}function shouldFetchOnMount(pa,ha){return shouldLoadOnMount(pa,ha)||pa.state.data!==void 0&&shouldFetchOn(pa,ha,ha.refetchOnMount)}function shouldFetchOn(pa,ha,ma){if(resolveEnabled(ha.enabled,pa)!==!1&&resolveStaleTime(ha.staleTime,pa)!=="static"){const ja=typeof ma=="function"?ma(pa):ma;return ja==="always"||ja!==!1&&isStale(pa,ha)}return!1}function shouldFetchOptionally(pa,ha,ma,ja){return(pa!==ha||resolveEnabled(ja.enabled,pa)===!1)&&(!ma.suspense||pa.state.status!=="error")&&isStale(pa,ma)}function isStale(pa,ha){return resolveEnabled(ha.enabled,pa)!==!1&&pa.isStaleByTime(resolveStaleTime(ha.staleTime,pa))}function shouldAssignObserverCurrentProperties(pa,ha){return!shallowEqualObjects$1(pa.getCurrentResult(),ha)}function infiniteQueryBehavior(pa){return{onFetch:(ha,ma)=>{const ja=ha.options,La=ha.fetchOptions?.meta?.fetchMore?.direction,Ba=ha.state.data?.pages||[],hl=ha.state.data?.pageParams||[];let Gl={pages:[],pageParams:[]},zl=0;const Wl=async()=>{let Kl=!1;const su=$m=>{Object.defineProperty($m,"signal",{enumerable:!0,get:()=>(ha.signal.aborted?Kl=!0:ha.signal.addEventListener("abort",()=>{Kl=!0}),ha.signal)})},au=ensureQueryFn(ha.options,ha.fetchOptions),ou=async($m,Nm,Mm)=>{if(Kl)return Promise.reject();if(Nm==null&&$m.pages.length)return Promise.resolve($m);const ly=(()=>{const JE={client:ha.client,queryKey:ha.queryKey,pageParam:Nm,direction:Mm?"backward":"forward",meta:ha.options.meta};return su(JE),JE})(),uy=await au(ly),{maxPages:GE}=ha.options,YE=Mm?addToStart:addToEnd;return{pages:YE($m.pages,uy,GE),pageParams:YE($m.pageParams,Nm,GE)}};if(La&&Ba.length){const $m=La==="backward",Nm=$m?getPreviousPageParam:getNextPageParam,Mm={pages:Ba,pageParams:hl},Mg=Nm(ja,Mm);Gl=await ou(Mm,Mg,$m)}else{const $m=pa??Ba.length;do{const Nm=zl===0?hl[0]??ja.initialPageParam:getNextPageParam(ja,Gl);if(zl>0&&Nm==null)break;Gl=await ou(Gl,Nm),zl++}while(zl<$m)}return Gl};ha.options.persister?ha.fetchFn=()=>ha.options.persister?.(Wl,{client:ha.client,queryKey:ha.queryKey,meta:ha.options.meta,signal:ha.signal},ma):ha.fetchFn=Wl}}}function getNextPageParam(pa,{pages:ha,pageParams:ma}){const ja=ha.length-1;return ha.length>0?pa.getNextPageParam(ha[ja],ha,ma[ja],ma):void 0}function getPreviousPageParam(pa,{pages:ha,pageParams:ma}){return ha.length>0?pa.getPreviousPageParam?.(ha[0],ha,ma[0],ma):void 0}var Mutation=class extends Removable{#e;#t;#r;#n;constructor(pa){super(),this.#e=pa.client,this.mutationId=pa.mutationId,this.#r=pa.mutationCache,this.#t=[],this.state=pa.state||getDefaultState$1(),this.setOptions(pa.options),this.scheduleGc()}setOptions(pa){this.options=pa,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(pa){this.#t.includes(pa)||(this.#t.push(pa),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:pa}))}removeObserver(pa){this.#t=this.#t.filter(ha=>ha!==pa),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:pa})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(pa){const ha=()=>{this.#s({type:"continue"})},ma={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(pa,ma):Promise.reject(new Error("No mutationFn found")),onFail:(Ba,hl)=>{this.#s({type:"failed",failureCount:Ba,error:hl})},onPause:()=>{this.#s({type:"pause"})},onContinue:ha,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const ja=this.state.status==="pending",La=!this.#n.canStart();try{if(ja)ha();else{this.#s({type:"pending",variables:pa,isPaused:La}),await this.#r.config.onMutate?.(pa,this,ma);const hl=await this.options.onMutate?.(pa,ma);hl!==this.state.context&&this.#s({type:"pending",context:hl,variables:pa,isPaused:La})}const Ba=await this.#n.start();return await this.#r.config.onSuccess?.(Ba,pa,this.state.context,this,ma),await this.options.onSuccess?.(Ba,pa,this.state.context,ma),await this.#r.config.onSettled?.(Ba,null,this.state.variables,this.state.context,this,ma),await this.options.onSettled?.(Ba,null,pa,this.state.context,ma),this.#s({type:"success",data:Ba}),Ba}catch(Ba){try{throw await this.#r.config.onError?.(Ba,pa,this.state.context,this,ma),await this.options.onError?.(Ba,pa,this.state.context,ma),await this.#r.config.onSettled?.(void 0,Ba,this.state.variables,this.state.context,this,ma),await this.options.onSettled?.(void 0,Ba,pa,this.state.context,ma),Ba}finally{this.#s({type:"error",error:Ba})}}finally{this.#r.runNext(this)}}#s(pa){const ha=ma=>{switch(pa.type){case"failed":return{...ma,failureCount:pa.failureCount,failureReason:pa.error};case"pause":return{...ma,isPaused:!0};case"continue":return{...ma,isPaused:!1};case"pending":return{...ma,context:pa.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:pa.isPaused,status:"pending",variables:pa.variables,submittedAt:Date.now()};case"success":return{...ma,data:pa.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...ma,data:void 0,error:pa.error,failureCount:ma.failureCount+1,failureReason:pa.error,isPaused:!1,status:"error"}}};this.state=ha(this.state),notifyManager.batch(()=>{this.#t.forEach(ma=>{ma.onMutationUpdate(pa)}),this.#r.notify({mutation:this,type:"updated",action:pa})})}};function getDefaultState$1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var MutationCache=class extends Subscribable{constructor(pa={}){super(),this.config=pa,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(pa,ha,ma){const ja=new Mutation({client:pa,mutationCache:this,mutationId:++this.#r,options:pa.defaultMutationOptions(ha),state:ma});return this.add(ja),ja}add(pa){this.#e.add(pa);const ha=scopeFor(pa);if(typeof ha=="string"){const ma=this.#t.get(ha);ma?ma.push(pa):this.#t.set(ha,[pa])}this.notify({type:"added",mutation:pa})}remove(pa){if(this.#e.delete(pa)){const ha=scopeFor(pa);if(typeof ha=="string"){const ma=this.#t.get(ha);if(ma)if(ma.length>1){const ja=ma.indexOf(pa);ja!==-1&&ma.splice(ja,1)}else ma[0]===pa&&this.#t.delete(ha)}}this.notify({type:"removed",mutation:pa})}canRun(pa){const ha=scopeFor(pa);if(typeof ha=="string"){const ja=this.#t.get(ha)?.find(La=>La.state.status==="pending");return!ja||ja===pa}else return!0}runNext(pa){const ha=scopeFor(pa);return typeof ha=="string"?this.#t.get(ha)?.find(ja=>ja!==pa&&ja.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){notifyManager.batch(()=>{this.#e.forEach(pa=>{this.notify({type:"removed",mutation:pa})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(pa){const ha={exact:!0,...pa};return this.getAll().find(ma=>matchMutation(ha,ma))}findAll(pa={}){return this.getAll().filter(ha=>matchMutation(pa,ha))}notify(pa){notifyManager.batch(()=>{this.listeners.forEach(ha=>{ha(pa)})})}resumePausedMutations(){const pa=this.getAll().filter(ha=>ha.state.isPaused);return notifyManager.batch(()=>Promise.all(pa.map(ha=>ha.continue().catch(noop$b))))}};function scopeFor(pa){return pa.options.scope?.id}var MutationObserver$1=class extends Subscribable{#e;#t=void 0;#r;#n;constructor(ha,ma){super(),this.#e=ha,this.setOptions(ma),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(ha){const ma=this.options;this.options=this.#e.defaultMutationOptions(ha),shallowEqualObjects$1(this.options,ma)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),ma?.mutationKey&&this.options.mutationKey&&hashKey(ma.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(ha){this.#s(),this.#o(ha)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#o()}mutate(ha,ma){return this.#n=ma,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(ha)}#s(){const ha=this.#r?.state??getDefaultState$1();this.#t={...ha,isPending:ha.status==="pending",isSuccess:ha.status==="success",isError:ha.status==="error",isIdle:ha.status==="idle",mutate:this.mutate,reset:this.reset}}#o(ha){notifyManager.batch(()=>{if(this.#n&&this.hasListeners()){const ma=this.#t.variables,ja=this.#t.context,La={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};ha?.type==="success"?(this.#n.onSuccess?.(ha.data,ma,ja,La),this.#n.onSettled?.(ha.data,null,ma,ja,La)):ha?.type==="error"&&(this.#n.onError?.(ha.error,ma,ja,La),this.#n.onSettled?.(void 0,ha.error,ma,ja,La))}this.listeners.forEach(ma=>{ma(this.#t)})})}},QueryCache=class extends Subscribable{constructor(pa={}){super(),this.config=pa,this.#e=new Map}#e;build(pa,ha,ma){const ja=ha.queryKey,La=ha.queryHash??hashQueryKeyByOptions(ja,ha);let Ba=this.get(La);return Ba||(Ba=new Query$1({client:pa,queryKey:ja,queryHash:La,options:pa.defaultQueryOptions(ha),state:ma,defaultOptions:pa.getQueryDefaults(ja)}),this.add(Ba)),Ba}add(pa){this.#e.has(pa.queryHash)||(this.#e.set(pa.queryHash,pa),this.notify({type:"added",query:pa}))}remove(pa){const ha=this.#e.get(pa.queryHash);ha&&(pa.destroy(),ha===pa&&this.#e.delete(pa.queryHash),this.notify({type:"removed",query:pa}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{this.remove(pa)})})}get(pa){return this.#e.get(pa)}getAll(){return[...this.#e.values()]}find(pa){const ha={exact:!0,...pa};return this.getAll().find(ma=>matchQuery(ha,ma))}findAll(pa={}){const ha=this.getAll();return Object.keys(pa).length>0?ha.filter(ma=>matchQuery(pa,ma)):ha}notify(pa){notifyManager.batch(()=>{this.listeners.forEach(ha=>{ha(pa)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{pa.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{pa.onOnline()})})}},QueryClient=class{#e;#t;#r;#n;#s;#o;#i;#a;constructor(pa={}){this.#e=pa.queryCache||new QueryCache,this.#t=pa.mutationCache||new MutationCache,this.#r=pa.defaultOptions||{},this.#n=new Map,this.#s=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#i=focusManager.subscribe(async pa=>{pa&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=onlineManager.subscribe(async pa=>{pa&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#i?.(),this.#i=void 0,this.#a?.(),this.#a=void 0)}isFetching(pa){return this.#e.findAll({...pa,fetchStatus:"fetching"}).length}isMutating(pa){return this.#t.findAll({...pa,status:"pending"}).length}getQueryData(pa){const ha=this.defaultQueryOptions({queryKey:pa});return this.#e.get(ha.queryHash)?.state.data}ensureQueryData(pa){const ha=this.defaultQueryOptions(pa),ma=this.#e.build(this,ha),ja=ma.state.data;return ja===void 0?this.fetchQuery(pa):(pa.revalidateIfStale&&ma.isStaleByTime(resolveStaleTime(ha.staleTime,ma))&&this.prefetchQuery(ha),Promise.resolve(ja))}getQueriesData(pa){return this.#e.findAll(pa).map(({queryKey:ha,state:ma})=>{const ja=ma.data;return[ha,ja]})}setQueryData(pa,ha,ma){const ja=this.defaultQueryOptions({queryKey:pa}),Ba=this.#e.get(ja.queryHash)?.state.data,hl=functionalUpdate(ha,Ba);if(hl!==void 0)return this.#e.build(this,ja).setData(hl,{...ma,manual:!0})}setQueriesData(pa,ha,ma){return notifyManager.batch(()=>this.#e.findAll(pa).map(({queryKey:ja})=>[ja,this.setQueryData(ja,ha,ma)]))}getQueryState(pa){const ha=this.defaultQueryOptions({queryKey:pa});return this.#e.get(ha.queryHash)?.state}removeQueries(pa){const ha=this.#e;notifyManager.batch(()=>{ha.findAll(pa).forEach(ma=>{ha.remove(ma)})})}resetQueries(pa,ha){const ma=this.#e;return notifyManager.batch(()=>(ma.findAll(pa).forEach(ja=>{ja.reset()}),this.refetchQueries({type:"active",...pa},ha)))}cancelQueries(pa,ha={}){const ma={revert:!0,...ha},ja=notifyManager.batch(()=>this.#e.findAll(pa).map(La=>La.cancel(ma)));return Promise.all(ja).then(noop$b).catch(noop$b)}invalidateQueries(pa,ha={}){return notifyManager.batch(()=>(this.#e.findAll(pa).forEach(ma=>{ma.invalidate()}),pa?.refetchType==="none"?Promise.resolve():this.refetchQueries({...pa,type:pa?.refetchType??pa?.type??"active"},ha)))}refetchQueries(pa,ha={}){const ma={...ha,cancelRefetch:ha.cancelRefetch??!0},ja=notifyManager.batch(()=>this.#e.findAll(pa).filter(La=>!La.isDisabled()&&!La.isStatic()).map(La=>{let Ba=La.fetch(void 0,ma);return ma.throwOnError||(Ba=Ba.catch(noop$b)),La.state.fetchStatus==="paused"?Promise.resolve():Ba}));return Promise.all(ja).then(noop$b)}fetchQuery(pa){const ha=this.defaultQueryOptions(pa);ha.retry===void 0&&(ha.retry=!1);const ma=this.#e.build(this,ha);return ma.isStaleByTime(resolveStaleTime(ha.staleTime,ma))?ma.fetch(ha):Promise.resolve(ma.state.data)}prefetchQuery(pa){return this.fetchQuery(pa).then(noop$b).catch(noop$b)}fetchInfiniteQuery(pa){return pa.behavior=infiniteQueryBehavior(pa.pages),this.fetchQuery(pa)}prefetchInfiniteQuery(pa){return this.fetchInfiniteQuery(pa).then(noop$b).catch(noop$b)}ensureInfiniteQueryData(pa){return pa.behavior=infiniteQueryBehavior(pa.pages),this.ensureQueryData(pa)}resumePausedMutations(){return onlineManager.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(pa){this.#r=pa}setQueryDefaults(pa,ha){this.#n.set(hashKey(pa),{queryKey:pa,defaultOptions:ha})}getQueryDefaults(pa){const ha=[...this.#n.values()],ma={};return ha.forEach(ja=>{partialMatchKey(pa,ja.queryKey)&&Object.assign(ma,ja.defaultOptions)}),ma}setMutationDefaults(pa,ha){this.#s.set(hashKey(pa),{mutationKey:pa,defaultOptions:ha})}getMutationDefaults(pa){const ha=[...this.#s.values()],ma={};return ha.forEach(ja=>{partialMatchKey(pa,ja.mutationKey)&&Object.assign(ma,ja.defaultOptions)}),ma}defaultQueryOptions(pa){if(pa._defaulted)return pa;const ha={...this.#r.queries,...this.getQueryDefaults(pa.queryKey),...pa,_defaulted:!0};return ha.queryHash||(ha.queryHash=hashQueryKeyByOptions(ha.queryKey,ha)),ha.refetchOnReconnect===void 0&&(ha.refetchOnReconnect=ha.networkMode!=="always"),ha.throwOnError===void 0&&(ha.throwOnError=!!ha.suspense),!ha.networkMode&&ha.persister&&(ha.networkMode="offlineFirst"),ha.queryFn===skipToken&&(ha.enabled=!1),ha}defaultMutationOptions(pa){return pa?._defaulted?pa:{...this.#r.mutations,...pa?.mutationKey&&this.getMutationDefaults(pa.mutationKey),...pa,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},QueryClientContext=reactExports.createContext(void 0),useQueryClient=pa=>{const ha=reactExports.useContext(QueryClientContext);if(!ha)throw new Error("No QueryClient set, use QueryClientProvider to set one");return ha},QueryClientProvider=({client:pa,children:ha})=>(reactExports.useEffect(()=>(pa.mount(),()=>{pa.unmount()}),[pa]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:pa,children:ha})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let pa=!1;return{clearReset:()=>{pa=!1},reset:()=>{pa=!0},isReset:()=>pa}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext),ensurePreventErrorBoundaryRetry=(pa,ha)=>{(pa.suspense||pa.throwOnError||pa.experimental_prefetchInRender)&&(ha.isReset()||(pa.retryOnMount=!1))},useClearResetErrorBoundary=pa=>{reactExports.useEffect(()=>{pa.clearReset()},[pa])},getHasError=({result:pa,errorResetBoundary:ha,throwOnError:ma,query:ja,suspense:La})=>pa.isError&&!ha.isReset()&&!pa.isFetching&&ja&&(La&&pa.data===void 0||shouldThrowError(ma,[pa.error,ja])),ensureSuspenseTimers=pa=>{if(pa.suspense){const ma=La=>La==="static"?La:Math.max(La??1e3,1e3),ja=pa.staleTime;pa.staleTime=typeof ja=="function"?(...La)=>ma(ja(...La)):ma(ja),typeof pa.gcTime=="number"&&(pa.gcTime=Math.max(pa.gcTime,1e3))}},willFetch=(pa,ha)=>pa.isLoading&&pa.isFetching&&!ha,shouldSuspend=(pa,ha)=>pa?.suspense&&ha.isPending,fetchOptimistic=(pa,ha,ma)=>ha.fetchOptimistic(pa).catch(()=>{ma.clearReset()});function useBaseQuery(pa,ha,ma){const ja=useIsRestoring(),La=useQueryErrorResetBoundary(),Ba=useQueryClient(),hl=Ba.defaultQueryOptions(pa);Ba.getDefaultOptions().queries?._experimental_beforeQuery?.(hl),hl._optimisticResults=ja?"isRestoring":"optimistic",ensureSuspenseTimers(hl),ensurePreventErrorBoundaryRetry(hl,La),useClearResetErrorBoundary(La);const Gl=!Ba.getQueryCache().get(hl.queryHash),[zl]=reactExports.useState(()=>new ha(Ba,hl)),Wl=zl.getOptimisticResult(hl),Kl=!ja&&pa.subscribed!==!1;if(reactExports.useSyncExternalStore(reactExports.useCallback(su=>{const au=Kl?zl.subscribe(notifyManager.batchCalls(su)):noop$b;return zl.updateResult(),au},[zl,Kl]),()=>zl.getCurrentResult(),()=>zl.getCurrentResult()),reactExports.useEffect(()=>{zl.setOptions(hl)},[hl,zl]),shouldSuspend(hl,Wl))throw fetchOptimistic(hl,zl,La);if(getHasError({result:Wl,errorResetBoundary:La,throwOnError:hl.throwOnError,query:Ba.getQueryCache().get(hl.queryHash),suspense:hl.suspense}))throw Wl.error;return Ba.getDefaultOptions().queries?._experimental_afterQuery?.(hl,Wl),hl.experimental_prefetchInRender&&!isServer&&willFetch(Wl,ja)&&(Gl?fetchOptimistic(hl,zl,La):Ba.getQueryCache().get(hl.queryHash)?.promise)?.catch(noop$b).finally(()=>{zl.updateResult()}),hl.notifyOnChangeProps?Wl:zl.trackResult(Wl)}function useQuery(pa,ha){return useBaseQuery(pa,QueryObserver)}function useMutation(pa,ha){const ma=useQueryClient(),[ja]=reactExports.useState(()=>new MutationObserver$1(ma,pa));reactExports.useEffect(()=>{ja.setOptions(pa)},[ja,pa]);const La=reactExports.useSyncExternalStore(reactExports.useCallback(hl=>ja.subscribe(notifyManager.batchCalls(hl)),[ja]),()=>ja.getCurrentResult(),()=>ja.getCurrentResult()),Ba=reactExports.useCallback((hl,Gl)=>{ja.mutate(hl,Gl).catch(noop$b)},[ja]);if(La.error&&shouldThrowError(ja.options.throwOnError,[La.error]))throw La.error;return{...La,mutate:Ba,mutateAsync:La.mutate}}var reactDomExports=requireReactDom();const ReactDOM=getDefaultExportFromCjs(reactDomExports),dy=pa=>{let ha;const ma=new Set,ja=(Gl,zl)=>{const Wl=typeof Gl=="function"?Gl(ha):Gl;if(!Object.is(Wl,ha)){const Kl=ha;ha=zl??(typeof Wl!="object"||Wl===null)?Wl:Object.assign({},ha,Wl),ma.forEach(su=>su(ha,Kl))}},La=()=>ha,Ba={setState:ja,getState:La,getInitialState:()=>hl,subscribe:Gl=>(ma.add(Gl),()=>ma.delete(Gl))},hl=ha=pa(ja,La,Ba);return Ba},EN=(pa=>pa?dy(pa):dy),CN=pa=>pa;function TN(pa,ha=CN){const ma=React.useSyncExternalStore(pa.subscribe,React.useCallback(()=>ha(pa.getState()),[pa,ha]),React.useCallback(()=>ha(pa.getInitialState()),[pa,ha]));return React.useDebugValue(ma),ma}const fy=pa=>{const ha=EN(pa),ma=ja=>TN(ha,ja);return Object.assign(ma,ha),ma},AN=(pa=>pa?fy(pa):fy),uo$1=AN(pa=>({showAppSettings:!1,selectedInstanceKey:null,uiSchema:null,setShowAppSettings:ha=>pa({showAppSettings:ha}),setUiSchema:ha=>pa({uiSchema:ha}),setSelectedInstanceKey:ha=>pa({selectedInstanceKey:ha})})),RN=()=>uo$1(pa=>pa.showAppSettings),ZE=()=>uo$1(pa=>pa.setShowAppSettings),pt$3=()=>uo$1(pa=>pa.uiSchema),BZ=()=>uo$1(pa=>pa.setUiSchema),ON=()=>uo$1(pa=>pa.selectedInstanceKey),_N=()=>uo$1(pa=>pa.setSelectedInstanceKey),QE=()=>{const{"*":pa}=useParams(),{customNavigate:ha}=Se$3(),ma=pt$3(),ja=ma?.relationships,La=pa?.split("/").filter(Boolean)??[],Ba=La[1],hl=La.slice(2).filter(Wl=>!ja?.some(Kl=>Kl.name===Wl)),Gl=Wl=>{const Kl=`/view/${Ba}/${hl.slice(0,Wl+1).join("/")}`;ha(Kl)},zl=Wl=>{const Kl=ma?.[`${Ba}/${Wl}`];if(Wl.includes("-"))return Wl.split("-")[0];switch(Wl){case"new":return"Create";case"edit":return"Edit";default:return Kl?.displayName||Wl}};return jsxRuntimeExports.jsx("div",{className:"breadcrumbs",children:hl.filter(Wl=>Wl!==Ba).map((Wl,Kl)=>{const su=Wl===La[La.length-1];return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"link","data-selected":su,onClick:()=>Gl(Kl),children:zl(Wl)}),Kl!==hl.length-1&&jsxRuntimeExports.jsx(ke$5,{icon:"ph:caret-right-bold"})]},Wl)})})},eC=({viewSpec:pa})=>{const{showBreadcrumbs:ha}=pa;return jsxRuntimeExports.jsx("div",{className:"header-component",children:ha&&jsxRuntimeExports.jsx(QE,{})})},Va=()=>{const pa=pt$3(),ha=pa?.entities,ma=pa?.agents,ja=hl=>ha?.some(Gl=>Gl===hl),La=hl=>ma?.some(Gl=>Gl===hl),Ba=(hl,Gl)=>{for(let zl=hl.length-1;zl>=0;zl--)if(ja(`${Gl}/${hl[zl]}`)||La(`${Gl}/${hl[zl]}`))return zl;return-1};return{isEntity:ja,isAgent:La,getActiveEntityorAgent:hl=>{if(!hl||hl==="signin"||hl==="signup")return!1;const Gl=hl.split("/").filter(Boolean);if(Gl.length===0)return!1;const zl=Gl[1],Wl=Ba(Gl,zl);if(Wl===-1)return!1;const Kl=Gl[Wl];return`${zl}/${Kl}`}}},tC=()=>{const pa=pt$3()?.relationships;return{getRelationship:ha=>!pa||!ha?void 0:pa.find(ma=>ma.parent===ha||ma.child===ha)?.name}},PN=({data:pa,entityName:ha,isRelationship:ma=!1,relationshipName:ja,uiSpec:La})=>reactExports.useMemo(()=>{if(!pa)return[];const Ba=ha.split("/")[1];let hl,Gl;if(ma&&ja&&La){const zl=La?.relationships?.find(Wl=>Wl.name===ja);if(zl){Gl=zl.type;const[Wl]=ha.split("/");hl=`${Wl}/${ja}`}}return pa.flatMap(zl=>{if(ma&&Gl==="between"&&hl&&zl){const Wl=Object.keys(zl).find(Kl=>Kl!==hl&&typeof zl[Kl]=="object"&&zl[Kl]!==null&&!Kl.startsWith("__"));if(Wl&&zl[Wl]&&zl[Wl][hl]){const Kl=zl[Wl][hl];if(Array.isArray(Kl))return Kl.map(su=>{const au=Object.keys(su).find(ou=>typeof su[ou]=="object"&&su[ou]!==null&&!ou.startsWith("__")&&ou!==hl);return au?su[au]:su})}if(zl[hl]&&Array.isArray(zl[hl]))return zl[hl].flatMap(Kl=>{const su=Object.keys(Kl).find(au=>typeof Kl[au]=="object"&&Kl[au]!==null&&!au.startsWith("__"));return su?Kl[su]:Kl})}return zl&&zl[Ba]?zl[Ba]:zl})},[pa,ha,ma,ja,La]),NN=({entityName:pa,createAction:ha,relationship:ma})=>{const ja=useNavigate(),{pathname:La}=useLocation(),{getRelationship:Ba}=tC(),hl=ma||Ba(pa.split("/")[1]);return jsxRuntimeExports.jsxs("div",{className:"fx-button",onClick:()=>{const Gl=pa.split("/")[1];let zl=La;hl&&!La.includes(hl)&&(zl+=`/${hl}/${Gl}`),zl+="/new",ja(zl)},children:[jsxRuntimeExports.jsx(ke$5,{icon:ha?.icon||"material-symbols:add"}),jsxRuntimeExports.jsx("span",{className:"grow text-center text-sm font-semibold",children:ha?.text||`Add ${pa.split("/")[1]}`})]})},km=reactExports.createContext({});function Dm(pa){const ha=reactExports.useRef(null);return ha.current===null&&(ha.current=pa()),ha.current}const Im=typeof window<"u",nC=Im?reactExports.useLayoutEffect:reactExports.useEffect,Yl=reactExports.createContext(null);function Fm(pa,ha){pa.indexOf(ha)===-1&&pa.push(ha)}function Lm(pa,ha){const ma=pa.indexOf(ha);ma>-1&&pa.splice(ma,1)}const qn=(pa,ha,ma)=>ma>ha?ha:ma<pa?pa:ma;function pp(pa,ha){return ha?`${pa}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${ha}`:pa}var MN={};let fo$1=()=>{},Un=()=>{};MN.NODE_ENV!=="production"&&(fo$1=(pa,ha,ma)=>{!pa&&typeof console<"u"&&console.warn(pp(ha,ma))},Un=(pa,ha,ma)=>{if(!pa)throw new Error(pp(ha,ma))});const Hn={},rC=pa=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(pa);function iC(pa){return typeof pa=="object"&&pa!==null}const oC=pa=>/^0[^.\s]+$/u.test(pa);function jm(pa){let ha;return()=>(ha===void 0&&(ha=pa()),ha)}const Kt$1=pa=>pa,$N=(pa,ha)=>ma=>ha(pa(ma)),qa=(...pa)=>pa.reduce($N),ga=(pa,ha,ma)=>{const ja=ha-pa;return ja===0?1:(ma-pa)/ja};class Bm{constructor(){this.subscriptions=[]}add(ha){return Fm(this.subscriptions,ha),()=>Lm(this.subscriptions,ha)}notify(ha,ma,ja){const La=this.subscriptions.length;if(La)if(La===1)this.subscriptions[0](ha,ma,ja);else for(let Ba=0;Ba<La;Ba++){const hl=this.subscriptions[Ba];hl&&hl(ha,ma,ja)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const on$2=pa=>pa*1e3,Gt$2=pa=>pa/1e3;function aC(pa,ha){return ha?pa*(1e3/ha):0}const hy=new Set;function Vm(pa,ha,ma){pa||hy.has(ha)||(console.warn(pp(ha,ma)),hy.add(ha))}const sC=(pa,ha,ma)=>(((1-3*ma+3*ha)*pa+(3*ma-6*ha))*pa+3*ha)*pa,kN=1e-7,DN=12;function IN$2(pa,ha,ma,ja,La){let Ba,hl,Gl=0;do hl=ha+(ma-ha)/2,Ba=sC(hl,ja,La)-pa,Ba>0?ma=hl:ha=hl;while(Math.abs(Ba)>kN&&++Gl<DN);return hl}function Ua(pa,ha,ma,ja){if(pa===ha&&ma===ja)return Kt$1;const La=Ba=>IN$2(Ba,0,1,pa,ma);return Ba=>Ba===0||Ba===1?Ba:sC(La(Ba),ha,ja)}const lC=pa=>ha=>ha<=.5?pa(2*ha)/2:(2-pa(2*(1-ha)))/2,cC=pa=>ha=>1-pa(1-ha),uC=Ua(.33,1.53,.69,.99),qm=cC(uC),dC=lC(qm),fC=pa=>(pa*=2)<1?.5*qm(pa):.5*(2-Math.pow(2,-10*(pa-1))),Um=pa=>1-Math.sin(Math.acos(pa)),hC=cC(Um),pC=lC(Um),FN=Ua(.42,0,1,1),LN=Ua(0,0,.58,1),mC=Ua(.42,0,.58,1),jN=pa=>Array.isArray(pa)&&typeof pa[0]!="number",gC=pa=>Array.isArray(pa)&&typeof pa[0]=="number",py={linear:Kt$1,easeIn:FN,easeInOut:mC,easeOut:LN,circIn:Um,circInOut:pC,circOut:hC,backIn:qm,backInOut:dC,backOut:uC,anticipate:fC},BN=pa=>typeof pa=="string",my=pa=>{if(gC(pa)){Un(pa.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[ha,ma,ja,La]=pa;return Ua(ha,ma,ja,La)}else if(BN(pa))return Un(py[pa]!==void 0,`Invalid easing type '${pa}'`,"invalid-easing-type"),py[pa];return pa},vs$1=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function VN(pa,ha){let ma=new Set,ja=new Set,La=!1,Ba=!1;const hl=new WeakSet;let Gl={delta:0,timestamp:0,isProcessing:!1};function zl(Kl){hl.has(Kl)&&(Wl.schedule(Kl),pa()),Kl(Gl)}const Wl={schedule:(Kl,su=!1,au=!1)=>{const ou=au&&La?ma:ja;return su&&hl.add(Kl),ou.has(Kl)||ou.add(Kl),Kl},cancel:Kl=>{ja.delete(Kl),hl.delete(Kl)},process:Kl=>{if(Gl=Kl,La){Ba=!0;return}La=!0,[ma,ja]=[ja,ma],ma.forEach(zl),ma.clear(),La=!1,Ba&&(Ba=!1,Wl.process(Kl))}};return Wl}const qN=40;function vC(pa,ha){let ma=!1,ja=!0;const La={delta:0,timestamp:0,isProcessing:!1},Ba=()=>ma=!0,hl=vs$1.reduce((Mg,ly)=>(Mg[ly]=VN(Ba),Mg),{}),{setup:Gl,read:zl,resolveKeyframes:Wl,preUpdate:Kl,update:su,preRender:au,render:ou,postRender:$m}=hl,Nm=()=>{const Mg=Hn.useManualTiming?La.timestamp:performance.now();ma=!1,Hn.useManualTiming||(La.delta=ja?1e3/60:Math.max(Math.min(Mg-La.timestamp,qN),1)),La.timestamp=Mg,La.isProcessing=!0,Gl.process(La),zl.process(La),Wl.process(La),Kl.process(La),su.process(La),au.process(La),ou.process(La),$m.process(La),La.isProcessing=!1,ma&&ha&&(ja=!1,pa(Nm))},Mm=()=>{ma=!0,ja=!0,La.isProcessing||pa(Nm)};return{schedule:vs$1.reduce((Mg,ly)=>{const uy=hl[ly];return Mg[ly]=(GE,YE=!1,JE=!1)=>(ma||Mm(),uy.schedule(GE,YE,JE)),Mg},{}),cancel:Mg=>{for(let ly=0;ly<vs$1.length;ly++)hl[vs$1[ly]].cancel(Mg)},state:La,steps:hl}}const{schedule:Fe$3,cancel:dr$1,state:rt$3,steps:lu}=vC(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kt$1,!0);let Gs$1;function UN(){Gs$1=void 0}const St$2={now:()=>(Gs$1===void 0&&St$2.set(rt$3.isProcessing||Hn.useManualTiming?rt$3.timestamp:performance.now()),Gs$1),set:pa=>{Gs$1=pa,queueMicrotask(UN)}},yC=pa=>ha=>typeof ha=="string"&&ha.startsWith(pa),bC=yC("--"),HN=yC("var(--"),Hm=pa=>HN(pa)?zN.test(pa.split("/*")[0].trim()):!1,zN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ho$1={test:pa=>typeof pa=="number",parse:parseFloat,transform:pa=>pa},va={...ho$1,transform:pa=>qn(0,1,pa)},ys$1={...ho$1,default:1},ra=pa=>Math.round(pa*1e5)/1e5,zm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function WN(pa){return pa==null}const GN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wm=(pa,ha)=>ma=>!!(typeof ma=="string"&&GN.test(ma)&&ma.startsWith(pa)||ha&&!WN(ma)&&Object.prototype.hasOwnProperty.call(ma,ha)),xC=(pa,ha,ma)=>ja=>{if(typeof ja!="string")return ja;const[La,Ba,hl,Gl]=ja.match(zm);return{[pa]:parseFloat(La),[ha]:parseFloat(Ba),[ma]:parseFloat(hl),alpha:Gl!==void 0?parseFloat(Gl):1}},KN=pa=>qn(0,255,pa),cu={...ho$1,transform:pa=>Math.round(KN(pa))},Mr$1={test:Wm("rgb","red"),parse:xC("red","green","blue"),transform:({red:pa,green:ha,blue:ma,alpha:ja=1})=>"rgba("+cu.transform(pa)+", "+cu.transform(ha)+", "+cu.transform(ma)+", "+ra(va.transform(ja))+")"};function YN(pa){let ha="",ma="",ja="",La="";return pa.length>5?(ha=pa.substring(1,3),ma=pa.substring(3,5),ja=pa.substring(5,7),La=pa.substring(7,9)):(ha=pa.substring(1,2),ma=pa.substring(2,3),ja=pa.substring(3,4),La=pa.substring(4,5),ha+=ha,ma+=ma,ja+=ja,La+=La),{red:parseInt(ha,16),green:parseInt(ma,16),blue:parseInt(ja,16),alpha:La?parseInt(La,16)/255:1}}const mp={test:Wm("#"),parse:YN,transform:Mr$1.transform},Ha=pa=>({test:ha=>typeof ha=="string"&&ha.endsWith(pa)&&ha.split(" ").length===1,parse:parseFloat,transform:ha=>`${ha}${pa}`}),or$1=Ha("deg"),Tn$1=Ha("%"),ue$2=Ha("px"),XN=Ha("vh"),JN=Ha("vw"),gy={...Tn$1,parse:pa=>Tn$1.parse(pa)/100,transform:pa=>Tn$1.transform(pa*100)},Bi$1={test:Wm("hsl","hue"),parse:xC("hue","saturation","lightness"),transform:({hue:pa,saturation:ha,lightness:ma,alpha:ja=1})=>"hsla("+Math.round(pa)+", "+Tn$1.transform(ra(ha))+", "+Tn$1.transform(ra(ma))+", "+ra(va.transform(ja))+")"},Ye$1={test:pa=>Mr$1.test(pa)||mp.test(pa)||Bi$1.test(pa),parse:pa=>Mr$1.test(pa)?Mr$1.parse(pa):Bi$1.test(pa)?Bi$1.parse(pa):mp.parse(pa),transform:pa=>typeof pa=="string"?pa:pa.hasOwnProperty("red")?Mr$1.transform(pa):Bi$1.transform(pa),getAnimatableNone:pa=>{const ha=Ye$1.parse(pa);return ha.alpha=0,Ye$1.transform(ha)}},ZN=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QN(pa){return isNaN(pa)&&typeof pa=="string"&&(pa.match(zm)?.length||0)+(pa.match(ZN)?.length||0)>0}const wC="number",SC="color",eM="var",tM="var(",vy="${}",nM=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ya(pa){const ha=pa.toString(),ma=[],ja={color:[],number:[],var:[]},La=[];let Ba=0;const hl=ha.replace(nM,Gl=>(Ye$1.test(Gl)?(ja.color.push(Ba),La.push(SC),ma.push(Ye$1.parse(Gl))):Gl.startsWith(tM)?(ja.var.push(Ba),La.push(eM),ma.push(Gl)):(ja.number.push(Ba),La.push(wC),ma.push(parseFloat(Gl))),++Ba,vy)).split(vy);return{values:ma,split:hl,indexes:ja,types:La}}function EC(pa){return ya(pa).values}function CC(pa){const{split:ha,types:ma}=ya(pa),ja=ha.length;return La=>{let Ba="";for(let hl=0;hl<ja;hl++)if(Ba+=ha[hl],La[hl]!==void 0){const Gl=ma[hl];Gl===wC?Ba+=ra(La[hl]):Gl===SC?Ba+=Ye$1.transform(La[hl]):Ba+=La[hl]}return Ba}}const rM=pa=>typeof pa=="number"?0:Ye$1.test(pa)?Ye$1.getAnimatableNone(pa):pa;function iM(pa){const ha=EC(pa);return CC(pa)(ha.map(rM))}const fr$1={test:QN,parse:EC,createTransformer:CC,getAnimatableNone:iM};function uu(pa,ha,ma){return ma<0&&(ma+=1),ma>1&&(ma-=1),ma<1/6?pa+(ha-pa)*6*ma:ma<1/2?ha:ma<2/3?pa+(ha-pa)*(2/3-ma)*6:pa}function oM({hue:pa,saturation:ha,lightness:ma,alpha:ja}){pa/=360,ha/=100,ma/=100;let La=0,Ba=0,hl=0;if(!ha)La=Ba=hl=ma;else{const Gl=ma<.5?ma*(1+ha):ma+ha-ma*ha,zl=2*ma-Gl;La=uu(zl,Gl,pa+1/3),Ba=uu(zl,Gl,pa),hl=uu(zl,Gl,pa-1/3)}return{red:Math.round(La*255),green:Math.round(Ba*255),blue:Math.round(hl*255),alpha:ja}}function pl(pa,ha){return ma=>ma>0?ha:pa}const je$3=(pa,ha,ma)=>pa+(ha-pa)*ma,du=(pa,ha,ma)=>{const ja=pa*pa,La=ma*(ha*ha-ja)+ja;return La<0?0:Math.sqrt(La)},aM=[mp,Mr$1,Bi$1],sM=pa=>aM.find(ha=>ha.test(pa));function yy(pa){const ha=sM(pa);if(fo$1(!!ha,`'${pa}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!ha)return!1;let ma=ha.parse(pa);return ha===Bi$1&&(ma=oM(ma)),ma}const by=(pa,ha)=>{const ma=yy(pa),ja=yy(ha);if(!ma||!ja)return pl(pa,ha);const La={...ma};return Ba=>(La.red=du(ma.red,ja.red,Ba),La.green=du(ma.green,ja.green,Ba),La.blue=du(ma.blue,ja.blue,Ba),La.alpha=je$3(ma.alpha,ja.alpha,Ba),Mr$1.transform(La))},gp=new Set(["none","hidden"]);function lM(pa,ha){return gp.has(pa)?ma=>ma<=0?pa:ha:ma=>ma>=1?ha:pa}function cM(pa,ha){return ma=>je$3(pa,ha,ma)}function Gm(pa){return typeof pa=="number"?cM:typeof pa=="string"?Hm(pa)?pl:Ye$1.test(pa)?by:fM:Array.isArray(pa)?TC:typeof pa=="object"?Ye$1.test(pa)?by:uM:pl}function TC(pa,ha){const ma=[...pa],ja=ma.length,La=pa.map((Ba,hl)=>Gm(Ba)(Ba,ha[hl]));return Ba=>{for(let hl=0;hl<ja;hl++)ma[hl]=La[hl](Ba);return ma}}function uM(pa,ha){const ma={...pa,...ha},ja={};for(const La in ma)pa[La]!==void 0&&ha[La]!==void 0&&(ja[La]=Gm(pa[La])(pa[La],ha[La]));return La=>{for(const Ba in ja)ma[Ba]=ja[Ba](La);return ma}}function dM(pa,ha){const ma=[],ja={color:0,var:0,number:0};for(let La=0;La<ha.values.length;La++){const Ba=ha.types[La],hl=pa.indexes[Ba][ja[Ba]],Gl=pa.values[hl]??0;ma[La]=Gl,ja[Ba]++}return ma}const fM=(pa,ha)=>{const ma=fr$1.createTransformer(ha),ja=ya(pa),La=ya(ha);return ja.indexes.var.length===La.indexes.var.length&&ja.indexes.color.length===La.indexes.color.length&&ja.indexes.number.length>=La.indexes.number.length?gp.has(pa)&&!La.values.length||gp.has(ha)&&!ja.values.length?lM(pa,ha):qa(TC(dM(ja,La),La.values),ma):(fo$1(!0,`Complex values '${pa}' and '${ha}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),pl(pa,ha))};function AC(pa,ha,ma){return typeof pa=="number"&&typeof ha=="number"&&typeof ma=="number"?je$3(pa,ha,ma):Gm(pa)(pa,ha)}const hM=pa=>{const ha=({timestamp:ma})=>pa(ma);return{start:(ma=!0)=>Fe$3.update(ha,ma),stop:()=>dr$1(ha),now:()=>rt$3.isProcessing?rt$3.timestamp:St$2.now()}},RC=(pa,ha,ma=10)=>{let ja="";const La=Math.max(Math.round(ha/ma),2);for(let Ba=0;Ba<La;Ba++)ja+=Math.round(pa(Ba/(La-1))*1e4)/1e4+", ";return`linear(${ja.substring(0,ja.length-2)})`},ml=2e4;function Km(pa){let ha=0;const ma=50;let ja=pa.next(ha);for(;!ja.done&&ha<ml;)ha+=ma,ja=pa.next(ha);return ha>=ml?1/0:ha}function pM(pa,ha=100,ma){const ja=ma({...pa,keyframes:[0,ha]}),La=Math.min(Km(ja),ml);return{type:"keyframes",ease:Ba=>ja.next(La*Ba).value/ha,duration:Gt$2(La)}}const mM=5;function OC(pa,ha,ma){const ja=Math.max(ha-mM,0);return aC(ma-pa(ja),ha-ja)}const Le$2={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fu=.001;function gM({duration:pa=Le$2.duration,bounce:ha=Le$2.bounce,velocity:ma=Le$2.velocity,mass:ja=Le$2.mass}){let La,Ba;fo$1(pa<=on$2(Le$2.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let hl=1-ha;hl=qn(Le$2.minDamping,Le$2.maxDamping,hl),pa=qn(Le$2.minDuration,Le$2.maxDuration,Gt$2(pa)),hl<1?(La=Wl=>{const Kl=Wl*hl,su=Kl*pa,au=Kl-ma,ou=vp(Wl,hl),$m=Math.exp(-su);return fu-au/ou*$m},Ba=Wl=>{const Kl=Wl*hl*pa,su=Kl*ma+ma,au=Math.pow(hl,2)*Math.pow(Wl,2)*pa,ou=Math.exp(-Kl),$m=vp(Math.pow(Wl,2),hl);return(-La(Wl)+fu>0?-1:1)*((su-au)*ou)/$m}):(La=Wl=>{const Kl=Math.exp(-Wl*pa),su=(Wl-ma)*pa+1;return-fu+Kl*su},Ba=Wl=>{const Kl=Math.exp(-Wl*pa),su=(ma-Wl)*(pa*pa);return Kl*su});const Gl=5/pa,zl=yM(La,Ba,Gl);if(pa=on$2(pa),isNaN(zl))return{stiffness:Le$2.stiffness,damping:Le$2.damping,duration:pa};{const Wl=Math.pow(zl,2)*ja;return{stiffness:Wl,damping:hl*2*Math.sqrt(ja*Wl),duration:pa}}}const vM=12;function yM(pa,ha,ma){let ja=ma;for(let La=1;La<vM;La++)ja=ja-pa(ja)/ha(ja);return ja}function vp(pa,ha){return pa*Math.sqrt(1-ha*ha)}const bM=["duration","bounce"],xM=["stiffness","damping","mass"];function xy(pa,ha){return ha.some(ma=>pa[ma]!==void 0)}function wM(pa){let ha={velocity:Le$2.velocity,stiffness:Le$2.stiffness,damping:Le$2.damping,mass:Le$2.mass,isResolvedFromDuration:!1,...pa};if(!xy(pa,xM)&&xy(pa,bM))if(pa.visualDuration){const ma=pa.visualDuration,ja=2*Math.PI/(ma*1.2),La=ja*ja,Ba=2*qn(.05,1,1-(pa.bounce||0))*Math.sqrt(La);ha={...ha,mass:Le$2.mass,stiffness:La,damping:Ba}}else{const ma=gM(pa);ha={...ha,...ma,mass:Le$2.mass},ha.isResolvedFromDuration=!0}return ha}function gl(pa=Le$2.visualDuration,ha=Le$2.bounce){const ma=typeof pa!="object"?{visualDuration:pa,keyframes:[0,1],bounce:ha}:pa;let{restSpeed:ja,restDelta:La}=ma;const Ba=ma.keyframes[0],hl=ma.keyframes[ma.keyframes.length-1],Gl={done:!1,value:Ba},{stiffness:zl,damping:Wl,mass:Kl,duration:su,velocity:au,isResolvedFromDuration:ou}=wM({...ma,velocity:-Gt$2(ma.velocity||0)}),$m=au||0,Nm=Wl/(2*Math.sqrt(zl*Kl)),Mm=hl-Ba,Mg=Gt$2(Math.sqrt(zl/Kl)),ly=Math.abs(Mm)<5;ja||(ja=ly?Le$2.restSpeed.granular:Le$2.restSpeed.default),La||(La=ly?Le$2.restDelta.granular:Le$2.restDelta.default);let uy;if(Nm<1){const YE=vp(Mg,Nm);uy=JE=>{const XE=Math.exp(-Nm*Mg*JE);return hl-XE*(($m+Nm*Mg*Mm)/YE*Math.sin(YE*JE)+Mm*Math.cos(YE*JE))}}else if(Nm===1)uy=YE=>hl-Math.exp(-Mg*YE)*(Mm+($m+Mg*Mm)*YE);else{const YE=Mg*Math.sqrt(Nm*Nm-1);uy=JE=>{const XE=Math.exp(-Nm*Mg*JE),cN=Math.min(YE*JE,300);return hl-XE*(($m+Nm*Mg*Mm)*Math.sinh(cN)+YE*Mm*Math.cosh(cN))/YE}}const GE={calculatedDuration:ou&&su||null,next:YE=>{const JE=uy(YE);if(ou)Gl.done=YE>=su;else{let XE=YE===0?$m:0;Nm<1&&(XE=YE===0?on$2($m):OC(uy,YE,JE));const cN=Math.abs(XE)<=ja,pN=Math.abs(hl-JE)<=La;Gl.done=cN&&pN}return Gl.value=Gl.done?hl:JE,Gl},toString:()=>{const YE=Math.min(Km(GE),ml),JE=RC(XE=>GE.next(YE*XE).value,YE,30);return YE+"ms "+JE},toTransition:()=>{}};return GE}gl.applyToOptions=pa=>{const ha=pM(pa,100,gl);return pa.ease=ha.ease,pa.duration=on$2(ha.duration),pa.type="keyframes",pa};function yp({keyframes:pa,velocity:ha=0,power:ma=.8,timeConstant:ja=325,bounceDamping:La=10,bounceStiffness:Ba=500,modifyTarget:hl,min:Gl,max:zl,restDelta:Wl=.5,restSpeed:Kl}){const su=pa[0],au={done:!1,value:su},ou=cN=>Gl!==void 0&&cN<Gl||zl!==void 0&&cN>zl,$m=cN=>Gl===void 0?zl:zl===void 0||Math.abs(Gl-cN)<Math.abs(zl-cN)?Gl:zl;let Nm=ma*ha;const Mm=su+Nm,Mg=hl===void 0?Mm:hl(Mm);Mg!==Mm&&(Nm=Mg-su);const ly=cN=>-Nm*Math.exp(-cN/ja),uy=cN=>Mg+ly(cN),GE=cN=>{const pN=ly(cN),hN=uy(cN);au.done=Math.abs(pN)<=Wl,au.value=au.done?Mg:hN};let YE,JE;const XE=cN=>{ou(au.value)&&(YE=cN,JE=gl({keyframes:[au.value,$m(au.value)],velocity:OC(uy,cN,au.value),damping:La,stiffness:Ba,restDelta:Wl,restSpeed:Kl}))};return XE(0),{calculatedDuration:null,next:cN=>{let pN=!1;return!JE&&YE===void 0&&(pN=!0,GE(cN),XE(cN)),YE!==void 0&&cN>=YE?JE.next(cN-YE):(!pN&&GE(cN),au)}}}function SM(pa,ha,ma){const ja=[],La=ma||Hn.mix||AC,Ba=pa.length-1;for(let hl=0;hl<Ba;hl++){let Gl=La(pa[hl],pa[hl+1]);if(ha){const zl=Array.isArray(ha)?ha[hl]||Kt$1:ha;Gl=qa(zl,Gl)}ja.push(Gl)}return ja}function EM(pa,ha,{clamp:ma=!0,ease:ja,mixer:La}={}){const Ba=pa.length;if(Un(Ba===ha.length,"Both input and output ranges must be the same length","range-length"),Ba===1)return()=>ha[0];if(Ba===2&&ha[0]===ha[1])return()=>ha[1];const hl=pa[0]===pa[1];pa[0]>pa[Ba-1]&&(pa=[...pa].reverse(),ha=[...ha].reverse());const Gl=SM(ha,ja,La),zl=Gl.length,Wl=Kl=>{if(hl&&Kl<pa[0])return ha[0];let su=0;if(zl>1)for(;su<pa.length-2&&!(Kl<pa[su+1]);su++);const au=ga(pa[su],pa[su+1],Kl);return Gl[su](au)};return ma?Kl=>Wl(qn(pa[0],pa[Ba-1],Kl)):Wl}function CM(pa,ha){const ma=pa[pa.length-1];for(let ja=1;ja<=ha;ja++){const La=ga(0,ha,ja);pa.push(je$3(ma,1,La))}}function TM(pa){const ha=[0];return CM(ha,pa.length-1),ha}function AM(pa,ha){return pa.map(ma=>ma*ha)}function RM(pa,ha){return pa.map(()=>ha||mC).splice(0,pa.length-1)}function Vi$1({duration:pa=300,keyframes:ha,times:ma,ease:ja="easeInOut"}){const La=jN(ja)?ja.map(my):my(ja),Ba={done:!1,value:ha[0]},hl=AM(ma&&ma.length===ha.length?ma:TM(ha),pa),Gl=EM(hl,ha,{ease:Array.isArray(La)?La:RM(ha,La)});return{calculatedDuration:pa,next:zl=>(Ba.value=Gl(zl),Ba.done=zl>=pa,Ba)}}const OM=pa=>pa!==null;function Ym(pa,{repeat:ha,repeatType:ma="loop"},ja,La=1){const Ba=pa.filter(OM),hl=La<0||ha&&ma!=="loop"&&ha%2===1?0:Ba.length-1;return!hl||ja===void 0?Ba[hl]:ja}const _M={decay:yp,inertia:yp,tween:Vi$1,keyframes:Vi$1,spring:gl};function _C(pa){typeof pa.type=="string"&&(pa.type=_M[pa.type])}class Xm{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(ha=>{this.resolve=ha})}notifyFinished(){this.resolve()}then(ha,ma){return this.finished.then(ha,ma)}}var PM={};const NM=pa=>pa/100;class Jm extends Xm{constructor(ha){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:ma}=this.options;ma&&ma.updatedAt!==St$2.now()&&this.tick(St$2.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=ha,this.initAnimation(),this.play(),ha.autoplay===!1&&this.pause()}initAnimation(){const{options:ha}=this;_C(ha);const{type:ma=Vi$1,repeat:ja=0,repeatDelay:La=0,repeatType:Ba,velocity:hl=0}=ha;let{keyframes:Gl}=ha;const zl=ma||Vi$1;PM.NODE_ENV!=="production"&&zl!==Vi$1&&Un(Gl.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${Gl}`,"spring-two-frames"),zl!==Vi$1&&typeof Gl[0]!="number"&&(this.mixKeyframes=qa(NM,AC(Gl[0],Gl[1])),Gl=[0,100]);const Wl=zl({...ha,keyframes:Gl});Ba==="mirror"&&(this.mirroredGenerator=zl({...ha,keyframes:[...Gl].reverse(),velocity:-hl})),Wl.calculatedDuration===null&&(Wl.calculatedDuration=Km(Wl));const{calculatedDuration:Kl}=Wl;this.calculatedDuration=Kl,this.resolvedDuration=Kl+La,this.totalDuration=this.resolvedDuration*(ja+1)-La,this.generator=Wl}updateTime(ha){const ma=Math.round(ha-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=ma}tick(ha,ma=!1){const{generator:ja,totalDuration:La,mixKeyframes:Ba,mirroredGenerator:hl,resolvedDuration:Gl,calculatedDuration:zl}=this;if(this.startTime===null)return ja.next(0);const{delay:Wl=0,keyframes:Kl,repeat:su,repeatType:au,repeatDelay:ou,type:$m,onUpdate:Nm,finalKeyframe:Mm}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,ha):this.speed<0&&(this.startTime=Math.min(ha-La/this.speed,this.startTime)),ma?this.currentTime=ha:this.updateTime(ha);const Mg=this.currentTime-Wl*(this.playbackSpeed>=0?1:-1),ly=this.playbackSpeed>=0?Mg<0:Mg>La;this.currentTime=Math.max(Mg,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=La);let uy=this.currentTime,GE=ja;if(su){const cN=Math.min(this.currentTime,La)/Gl;let pN=Math.floor(cN),hN=cN%1;!hN&&cN>=1&&(hN=1),hN===1&&pN--,pN=Math.min(pN,su+1),pN%2&&(au==="reverse"?(hN=1-hN,ou&&(hN-=ou/Gl)):au==="mirror"&&(GE=hl)),uy=qn(0,1,hN)*Gl}const YE=ly?{done:!1,value:Kl[0]}:GE.next(uy);Ba&&(YE.value=Ba(YE.value));let{done:JE}=YE;!ly&&zl!==null&&(JE=this.playbackSpeed>=0?this.currentTime>=La:this.currentTime<=0);const XE=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&JE);return XE&&$m!==yp&&(YE.value=Ym(Kl,this.options,Mm,this.speed)),Nm&&Nm(YE.value),XE&&this.finish(),YE}then(ha,ma){return this.finished.then(ha,ma)}get duration(){return Gt$2(this.calculatedDuration)}get iterationDuration(){const{delay:ha=0}=this.options||{};return this.duration+Gt$2(ha)}get time(){return Gt$2(this.currentTime)}set time(ha){ha=on$2(ha),this.currentTime=ha,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=ha:this.driver&&(this.startTime=this.driver.now()-ha/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(ha){this.updateTime(St$2.now());const ma=this.playbackSpeed!==ha;this.playbackSpeed=ha,ma&&(this.time=Gt$2(this.currentTime))}play(){if(this.isStopped)return;const{driver:ha=hM,startTime:ma}=this.options;this.driver||(this.driver=ha(La=>this.tick(La))),this.options.onPlay?.();const ja=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=ja):this.holdTime!==null?this.startTime=ja-this.holdTime:this.startTime||(this.startTime=ma??ja),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(St$2.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(ha){return this.startTime=0,this.tick(ha,!0)}attachTimeline(ha){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),ha.observe(this)}}function MM(pa){for(let ha=1;ha<pa.length;ha++)pa[ha]??(pa[ha]=pa[ha-1])}const $r$1=pa=>pa*180/Math.PI,bp=pa=>{const ha=$r$1(Math.atan2(pa[1],pa[0]));return xp(ha)},$M={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:pa=>(Math.abs(pa[0])+Math.abs(pa[3]))/2,rotate:bp,rotateZ:bp,skewX:pa=>$r$1(Math.atan(pa[1])),skewY:pa=>$r$1(Math.atan(pa[2])),skew:pa=>(Math.abs(pa[1])+Math.abs(pa[2]))/2},xp=pa=>(pa=pa%360,pa<0&&(pa+=360),pa),wy=bp,Sy=pa=>Math.sqrt(pa[0]*pa[0]+pa[1]*pa[1]),Ey=pa=>Math.sqrt(pa[4]*pa[4]+pa[5]*pa[5]),kM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Sy,scaleY:Ey,scale:pa=>(Sy(pa)+Ey(pa))/2,rotateX:pa=>xp($r$1(Math.atan2(pa[6],pa[5]))),rotateY:pa=>xp($r$1(Math.atan2(-pa[2],pa[0]))),rotateZ:wy,rotate:wy,skewX:pa=>$r$1(Math.atan(pa[4])),skewY:pa=>$r$1(Math.atan(pa[1])),skew:pa=>(Math.abs(pa[1])+Math.abs(pa[4]))/2};function wp(pa){return pa.includes("scale")?1:0}function Sp(pa,ha){if(!pa||pa==="none")return wp(ha);const ma=pa.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let ja,La;if(ma)ja=kM,La=ma;else{const Gl=pa.match(/^matrix\(([-\d.e\s,]+)\)$/u);ja=$M,La=Gl}if(!La)return wp(ha);const Ba=ja[ha],hl=La[1].split(",").map(IM);return typeof Ba=="function"?Ba(hl):hl[Ba]}const DM=(pa,ha)=>{const{transform:ma="none"}=getComputedStyle(pa);return Sp(ma,ha)};function IM(pa){return parseFloat(pa.trim())}const po$1=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mo$1=new Set(po$1),Cy=pa=>pa===ho$1||pa===ue$2,FM=new Set(["x","y","z"]),LM=po$1.filter(pa=>!FM.has(pa));function jM(pa){const ha=[];return LM.forEach(ma=>{const ja=pa.getValue(ma);ja!==void 0&&(ha.push([ma,ja.get()]),ja.set(ma.startsWith("scale")?1:0))}),ha}const Br$1={width:({x:pa},{paddingLeft:ha="0",paddingRight:ma="0"})=>pa.max-pa.min-parseFloat(ha)-parseFloat(ma),height:({y:pa},{paddingTop:ha="0",paddingBottom:ma="0"})=>pa.max-pa.min-parseFloat(ha)-parseFloat(ma),top:(pa,{top:ha})=>parseFloat(ha),left:(pa,{left:ha})=>parseFloat(ha),bottom:({y:pa},{top:ha})=>parseFloat(ha)+(pa.max-pa.min),right:({x:pa},{left:ha})=>parseFloat(ha)+(pa.max-pa.min),x:(pa,{transform:ha})=>Sp(ha,"x"),y:(pa,{transform:ha})=>Sp(ha,"y")};Br$1.translateX=Br$1.x;Br$1.translateY=Br$1.y;const Vr$1=new Set;let Ep=!1,Cp=!1,Tp=!1;function PC(){if(Cp){const pa=Array.from(Vr$1).filter(ja=>ja.needsMeasurement),ha=new Set(pa.map(ja=>ja.element)),ma=new Map;ha.forEach(ja=>{const La=jM(ja);La.length&&(ma.set(ja,La),ja.render())}),pa.forEach(ja=>ja.measureInitialState()),ha.forEach(ja=>{ja.render();const La=ma.get(ja);La&&La.forEach(([Ba,hl])=>{ja.getValue(Ba)?.set(hl)})}),pa.forEach(ja=>ja.measureEndState()),pa.forEach(ja=>{ja.suspendedScrollY!==void 0&&window.scrollTo(0,ja.suspendedScrollY)})}Cp=!1,Ep=!1,Vr$1.forEach(pa=>pa.complete(Tp)),Vr$1.clear()}function NC(){Vr$1.forEach(pa=>{pa.readKeyframes(),pa.needsMeasurement&&(Cp=!0)})}function BM(){Tp=!0,NC(),PC(),Tp=!1}class Zm{constructor(ha,ma,ja,La,Ba,hl=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...ha],this.onComplete=ma,this.name=ja,this.motionValue=La,this.element=Ba,this.isAsync=hl}scheduleResolve(){this.state="scheduled",this.isAsync?(Vr$1.add(this),Ep||(Ep=!0,Fe$3.read(NC),Fe$3.resolveKeyframes(PC))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:ha,name:ma,element:ja,motionValue:La}=this;if(ha[0]===null){const Ba=La?.get(),hl=ha[ha.length-1];if(Ba!==void 0)ha[0]=Ba;else if(ja&&ma){const Gl=ja.readValue(ma,hl);Gl!=null&&(ha[0]=Gl)}ha[0]===void 0&&(ha[0]=hl),La&&Ba===void 0&&La.set(ha[0])}MM(ha)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(ha=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,ha),Vr$1.delete(this)}cancel(){this.state==="scheduled"&&(Vr$1.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const VM=pa=>pa.startsWith("--");function qM(pa,ha,ma){VM(ha)?pa.style.setProperty(ha,ma):pa.style[ha]=ma}const UM=jm(()=>window.ScrollTimeline!==void 0),HM={};function zM(pa,ha){const ma=jm(pa);return()=>HM[ha]??ma()}const MC=zM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),zo$1=([pa,ha,ma,ja])=>`cubic-bezier(${pa}, ${ha}, ${ma}, ${ja})`,Ty={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:zo$1([0,.65,.55,1]),circOut:zo$1([.55,0,1,.45]),backIn:zo$1([.31,.01,.66,-.59]),backOut:zo$1([.33,1.53,.69,.99])};function $C(pa,ha){if(pa)return typeof pa=="function"?MC()?RC(pa,ha):"ease-out":gC(pa)?zo$1(pa):Array.isArray(pa)?pa.map(ma=>$C(ma,ha)||Ty.easeOut):Ty[pa]}function WM(pa,ha,ma,{delay:ja=0,duration:La=300,repeat:Ba=0,repeatType:hl="loop",ease:Gl="easeOut",times:zl}={},Wl=void 0){const Kl={[ha]:ma};zl&&(Kl.offset=zl);const su=$C(Gl,La);Array.isArray(su)&&(Kl.easing=su);const au={delay:ja,duration:La,easing:Array.isArray(su)?"linear":su,fill:"both",iterations:Ba+1,direction:hl==="reverse"?"alternate":"normal"};return Wl&&(au.pseudoElement=Wl),pa.animate(Kl,au)}function kC(pa){return typeof pa=="function"&&"applyToOptions"in pa}function GM({type:pa,...ha}){return kC(pa)&&MC()?pa.applyToOptions(ha):(ha.duration??(ha.duration=300),ha.ease??(ha.ease="easeOut"),ha)}class KM extends Xm{constructor(ha){if(super(),this.finishedTime=null,this.isStopped=!1,!ha)return;const{element:ma,name:ja,keyframes:La,pseudoElement:Ba,allowFlatten:hl=!1,finalKeyframe:Gl,onComplete:zl}=ha;this.isPseudoElement=!!Ba,this.allowFlatten=hl,this.options=ha,Un(typeof ha.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const Wl=GM(ha);this.animation=WM(ma,ja,La,Wl,Ba),Wl.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!Ba){const Kl=Ym(La,this.options,Gl,this.speed);this.updateMotionValue?this.updateMotionValue(Kl):qM(ma,ja,Kl),this.animation.cancel()}zl?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:ha}=this;ha==="idle"||ha==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const ha=this.animation.effect?.getComputedTiming?.().duration||0;return Gt$2(Number(ha))}get iterationDuration(){const{delay:ha=0}=this.options||{};return this.duration+Gt$2(ha)}get time(){return Gt$2(Number(this.animation.currentTime)||0)}set time(ha){this.finishedTime=null,this.animation.currentTime=on$2(ha)}get speed(){return this.animation.playbackRate}set speed(ha){ha<0&&(this.finishedTime=null),this.animation.playbackRate=ha}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(ha){this.animation.startTime=ha}attachTimeline({timeline:ha,observe:ma}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,ha&&UM()?(this.animation.timeline=ha,Kt$1):ma(this)}}const DC={anticipate:fC,backInOut:dC,circInOut:pC};function YM(pa){return pa in DC}function XM(pa){typeof pa.ease=="string"&&YM(pa.ease)&&(pa.ease=DC[pa.ease])}const Ay=10;class JM extends KM{constructor(ha){XM(ha),_C(ha),super(ha),ha.startTime&&(this.startTime=ha.startTime),this.options=ha}updateMotionValue(ha){const{motionValue:ma,onUpdate:ja,onComplete:La,element:Ba,...hl}=this.options;if(!ma)return;if(ha!==void 0){ma.set(ha);return}const Gl=new Jm({...hl,autoplay:!1}),zl=on$2(this.finishedTime??this.time);ma.setWithVelocity(Gl.sample(zl-Ay).value,Gl.sample(zl).value,Ay),Gl.stop()}}const Ry=(pa,ha)=>ha==="zIndex"?!1:!!(typeof pa=="number"||Array.isArray(pa)||typeof pa=="string"&&(fr$1.test(pa)||pa==="0")&&!pa.startsWith("url("));function ZM(pa){const ha=pa[0];if(pa.length===1)return!0;for(let ma=0;ma<pa.length;ma++)if(pa[ma]!==ha)return!0}function QM(pa,ha,ma,ja){const La=pa[0];if(La===null)return!1;if(ha==="display"||ha==="visibility")return!0;const Ba=pa[pa.length-1],hl=Ry(La,ha),Gl=Ry(Ba,ha);return fo$1(hl===Gl,`You are trying to animate ${ha} from "${La}" to "${Ba}". "${hl?Ba:La}" is not an animatable value.`,"value-not-animatable"),!hl||!Gl?!1:ZM(pa)||(ma==="spring"||kC(ma))&&ja}function Ap(pa){pa.duration=0,pa.type="keyframes"}const e$=new Set(["opacity","clipPath","filter","transform"]),t$=jm(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function n$(pa){const{motionValue:ha,name:ma,repeatDelay:ja,repeatType:La,damping:Ba,type:hl}=pa;if(!(ha?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:Gl,transformTemplate:zl}=ha.owner.getProps();return t$()&&ma&&e$.has(ma)&&(ma!=="transform"||!zl)&&!Gl&&!ja&&La!=="mirror"&&Ba!==0&&hl!=="inertia"}const r$=40;class i$ extends Xm{constructor({autoplay:ha=!0,delay:ma=0,type:ja="keyframes",repeat:La=0,repeatDelay:Ba=0,repeatType:hl="loop",keyframes:Gl,name:zl,motionValue:Wl,element:Kl,...su}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=St$2.now();const au={autoplay:ha,delay:ma,type:ja,repeat:La,repeatDelay:Ba,repeatType:hl,name:zl,motionValue:Wl,element:Kl,...su},ou=Kl?.KeyframeResolver||Zm;this.keyframeResolver=new ou(Gl,($m,Nm,Mm)=>this.onKeyframesResolved($m,Nm,au,!Mm),zl,Wl,Kl),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(ha,ma,ja,La){this.keyframeResolver=void 0;const{name:Ba,type:hl,velocity:Gl,delay:zl,isHandoff:Wl,onUpdate:Kl}=ja;this.resolvedAt=St$2.now(),QM(ha,Ba,hl,Gl)||((Hn.instantAnimations||!zl)&&Kl?.(Ym(ha,ja,ma)),ha[0]=ha[ha.length-1],Ap(ja),ja.repeat=0);const su={startTime:La?this.resolvedAt?this.resolvedAt-this.createdAt>r$?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:ma,...ja,keyframes:ha},au=!Wl&&n$(su)?new JM({...su,element:su.motionValue.owner.current}):new Jm(su);au.finished.then(()=>this.notifyFinished()).catch(Kt$1),this.pendingTimeline&&(this.stopTimeline=au.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=au}get finished(){return this._animation?this.animation.finished:this._finished}then(ha,ma){return this.finished.finally(ha).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),BM()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(ha){this.animation.time=ha}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(ha){this.animation.speed=ha}get startTime(){return this.animation.startTime}attachTimeline(ha){return this._animation?this.stopTimeline=this.animation.attachTimeline(ha):this.pendingTimeline=ha,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const o$=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function a$(pa){const ha=o$.exec(pa);if(!ha)return[,];const[,ma,ja,La]=ha;return[`--${ma??ja}`,La]}const s$=4;function IC(pa,ha,ma=1){Un(ma<=s$,`Max CSS variable fallback depth detected in property "${pa}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[ja,La]=a$(pa);if(!ja)return;const Ba=window.getComputedStyle(ha).getPropertyValue(ja);if(Ba){const hl=Ba.trim();return rC(hl)?parseFloat(hl):hl}return Hm(La)?IC(La,ha,ma+1):La}function Qm(pa,ha){return pa?.[ha]??pa?.default??pa}const FC=new Set(["width","height","top","left","right","bottom",...po$1]),l$={test:pa=>pa==="auto",parse:pa=>pa},LC=pa=>ha=>ha.test(pa),jC=[ho$1,ue$2,Tn$1,or$1,JN,XN,l$],Oy=pa=>jC.find(LC(pa));function c$(pa){return typeof pa=="number"?pa===0:pa!==null?pa==="none"||pa==="0"||oC(pa):!0}const u$=new Set(["brightness","contrast","saturate","opacity"]);function d$(pa){const[ha,ma]=pa.slice(0,-1).split("(");if(ha==="drop-shadow")return pa;const[ja]=ma.match(zm)||[];if(!ja)return pa;const La=ma.replace(ja,"");let Ba=u$.has(ha)?1:0;return ja!==ma&&(Ba*=100),ha+"("+Ba+La+")"}const f$=/\b([a-z-]*)\(.*?\)/gu,Rp={...fr$1,getAnimatableNone:pa=>{const ha=pa.match(f$);return ha?ha.map(d$).join(" "):pa}},_y={...ho$1,transform:Math.round},h$={rotate:or$1,rotateX:or$1,rotateY:or$1,rotateZ:or$1,scale:ys$1,scaleX:ys$1,scaleY:ys$1,scaleZ:ys$1,skew:or$1,skewX:or$1,skewY:or$1,distance:ue$2,translateX:ue$2,translateY:ue$2,translateZ:ue$2,x:ue$2,y:ue$2,z:ue$2,perspective:ue$2,transformPerspective:ue$2,opacity:va,originX:gy,originY:gy,originZ:ue$2},eg={borderWidth:ue$2,borderTopWidth:ue$2,borderRightWidth:ue$2,borderBottomWidth:ue$2,borderLeftWidth:ue$2,borderRadius:ue$2,radius:ue$2,borderTopLeftRadius:ue$2,borderTopRightRadius:ue$2,borderBottomRightRadius:ue$2,borderBottomLeftRadius:ue$2,width:ue$2,maxWidth:ue$2,height:ue$2,maxHeight:ue$2,top:ue$2,right:ue$2,bottom:ue$2,left:ue$2,padding:ue$2,paddingTop:ue$2,paddingRight:ue$2,paddingBottom:ue$2,paddingLeft:ue$2,margin:ue$2,marginTop:ue$2,marginRight:ue$2,marginBottom:ue$2,marginLeft:ue$2,backgroundPositionX:ue$2,backgroundPositionY:ue$2,...h$,zIndex:_y,fillOpacity:va,strokeOpacity:va,numOctaves:_y},p$={...eg,color:Ye$1,backgroundColor:Ye$1,outlineColor:Ye$1,fill:Ye$1,stroke:Ye$1,borderColor:Ye$1,borderTopColor:Ye$1,borderRightColor:Ye$1,borderBottomColor:Ye$1,borderLeftColor:Ye$1,filter:Rp,WebkitFilter:Rp},BC=pa=>p$[pa];function VC(pa,ha){let ma=BC(pa);return ma!==Rp&&(ma=fr$1),ma.getAnimatableNone?ma.getAnimatableNone(ha):void 0}const m$=new Set(["auto","none","0"]);function g$(pa,ha,ma){let ja=0,La;for(;ja<pa.length&&!La;){const Ba=pa[ja];typeof Ba=="string"&&!m$.has(Ba)&&ya(Ba).values.length&&(La=pa[ja]),ja++}if(La&&ma)for(const Ba of ha)pa[Ba]=VC(ma,La)}class v$ extends Zm{constructor(ha,ma,ja,La,Ba){super(ha,ma,ja,La,Ba,!0)}readKeyframes(){const{unresolvedKeyframes:ha,element:ma,name:ja}=this;if(!ma||!ma.current)return;super.readKeyframes();for(let zl=0;zl<ha.length;zl++){let Wl=ha[zl];if(typeof Wl=="string"&&(Wl=Wl.trim(),Hm(Wl))){const Kl=IC(Wl,ma.current);Kl!==void 0&&(ha[zl]=Kl),zl===ha.length-1&&(this.finalKeyframe=Wl)}}if(this.resolveNoneKeyframes(),!FC.has(ja)||ha.length!==2)return;const[La,Ba]=ha,hl=Oy(La),Gl=Oy(Ba);if(hl!==Gl)if(Cy(hl)&&Cy(Gl))for(let zl=0;zl<ha.length;zl++){const Wl=ha[zl];typeof Wl=="string"&&(ha[zl]=parseFloat(Wl))}else Br$1[ja]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:ha,name:ma}=this,ja=[];for(let La=0;La<ha.length;La++)(ha[La]===null||c$(ha[La]))&&ja.push(La);ja.length&&g$(ha,ja,ma)}measureInitialState(){const{element:ha,unresolvedKeyframes:ma,name:ja}=this;if(!ha||!ha.current)return;ja==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Br$1[ja](ha.measureViewportBox(),window.getComputedStyle(ha.current)),ma[0]=this.measuredOrigin;const La=ma[ma.length-1];La!==void 0&&ha.getValue(ja,La).jump(La,!1)}measureEndState(){const{element:ha,name:ma,unresolvedKeyframes:ja}=this;if(!ha||!ha.current)return;const La=ha.getValue(ma);La&&La.jump(this.measuredOrigin,!1);const Ba=ja.length-1,hl=ja[Ba];ja[Ba]=Br$1[ma](ha.measureViewportBox(),window.getComputedStyle(ha.current)),hl!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=hl),this.removedTransforms?.length&&this.removedTransforms.forEach(([Gl,zl])=>{ha.getValue(Gl).set(zl)}),this.resolveNoneKeyframes()}}function y$(pa,ha,ma){if(pa instanceof EventTarget)return[pa];if(typeof pa=="string"){const La=document.querySelectorAll(pa);return La?Array.from(La):[]}return Array.from(pa)}const qC=(pa,ha)=>ha&&typeof pa=="number"?ha.transform(pa):pa;function UC(pa){return iC(pa)&&"offsetHeight"in pa}var b$={};const Py=30,x$=pa=>!isNaN(parseFloat(pa));class w${constructor(ha,ma={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=ja=>{const La=St$2.now();if(this.updatedAt!==La&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(ja),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const Ba of this.dependents)Ba.dirty()},this.hasAnimated=!1,this.setCurrent(ha),this.owner=ma.owner}setCurrent(ha){this.current=ha,this.updatedAt=St$2.now(),this.canTrackVelocity===null&&ha!==void 0&&(this.canTrackVelocity=x$(this.current))}setPrevFrameValue(ha=this.current){this.prevFrameValue=ha,this.prevUpdatedAt=this.updatedAt}onChange(ha){return b$.NODE_ENV!=="production"&&Vm(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",ha)}on(ha,ma){this.events[ha]||(this.events[ha]=new Bm);const ja=this.events[ha].add(ma);return ha==="change"?()=>{ja(),Fe$3.read(()=>{this.events.change.getSize()||this.stop()})}:ja}clearListeners(){for(const ha in this.events)this.events[ha].clear()}attach(ha,ma){this.passiveEffect=ha,this.stopPassiveEffect=ma}set(ha){this.passiveEffect?this.passiveEffect(ha,this.updateAndNotify):this.updateAndNotify(ha)}setWithVelocity(ha,ma,ja){this.set(ma),this.prev=void 0,this.prevFrameValue=ha,this.prevUpdatedAt=this.updatedAt-ja}jump(ha,ma=!0){this.updateAndNotify(ha),this.prev=ha,this.prevUpdatedAt=this.prevFrameValue=void 0,ma&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(ha){this.dependents||(this.dependents=new Set),this.dependents.add(ha)}removeDependent(ha){this.dependents&&this.dependents.delete(ha)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const ha=St$2.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||ha-this.updatedAt>Py)return 0;const ma=Math.min(this.updatedAt-this.prevUpdatedAt,Py);return aC(parseFloat(this.current)-parseFloat(this.prevFrameValue),ma)}start(ha){return this.stop(),new Promise(ma=>{this.hasAnimated=!0,this.animation=ha(ma),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function to$1(pa,ha){return new w$(pa,ha)}const{schedule:tg}=vC(queueMicrotask,!1),nn$2={x:!1,y:!1};function HC(){return nn$2.x||nn$2.y}function S$(pa){return pa==="x"||pa==="y"?nn$2[pa]?null:(nn$2[pa]=!0,()=>{nn$2[pa]=!1}):nn$2.x||nn$2.y?null:(nn$2.x=nn$2.y=!0,()=>{nn$2.x=nn$2.y=!1})}function zC(pa,ha){const ma=y$(pa),ja=new AbortController,La={passive:!0,...ha,signal:ja.signal};return[ma,La,()=>ja.abort()]}function Ny(pa){return!(pa.pointerType==="touch"||HC())}function E$(pa,ha,ma={}){const[ja,La,Ba]=zC(pa,ma),hl=Gl=>{if(!Ny(Gl))return;const{target:zl}=Gl,Wl=ha(zl,Gl);if(typeof Wl!="function"||!zl)return;const Kl=su=>{Ny(su)&&(Wl(su),zl.removeEventListener("pointerleave",Kl))};zl.addEventListener("pointerleave",Kl,La)};return ja.forEach(Gl=>{Gl.addEventListener("pointerenter",hl,La)}),Ba}const WC=(pa,ha)=>ha?pa===ha?!0:WC(pa,ha.parentElement):!1,ng=pa=>pa.pointerType==="mouse"?typeof pa.button!="number"||pa.button<=0:pa.isPrimary!==!1,C$=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function T$(pa){return C$.has(pa.tagName)||pa.tabIndex!==-1}const Ks$1=new WeakSet;function My(pa){return ha=>{ha.key==="Enter"&&pa(ha)}}function hu(pa,ha){pa.dispatchEvent(new PointerEvent("pointer"+ha,{isPrimary:!0,bubbles:!0}))}const A$=(pa,ha)=>{const ma=pa.currentTarget;if(!ma)return;const ja=My(()=>{if(Ks$1.has(ma))return;hu(ma,"down");const La=My(()=>{hu(ma,"up")}),Ba=()=>hu(ma,"cancel");ma.addEventListener("keyup",La,ha),ma.addEventListener("blur",Ba,ha)});ma.addEventListener("keydown",ja,ha),ma.addEventListener("blur",()=>ma.removeEventListener("keydown",ja),ha)};function $y(pa){return ng(pa)&&!HC()}function R$(pa,ha,ma={}){const[ja,La,Ba]=zC(pa,ma),hl=Gl=>{const zl=Gl.currentTarget;if(!$y(Gl))return;Ks$1.add(zl);const Wl=ha(zl,Gl),Kl=(ou,$m)=>{window.removeEventListener("pointerup",su),window.removeEventListener("pointercancel",au),Ks$1.has(zl)&&Ks$1.delete(zl),$y(ou)&&typeof Wl=="function"&&Wl(ou,{success:$m})},su=ou=>{Kl(ou,zl===window||zl===document||ma.useGlobalTarget||WC(zl,ou.target))},au=ou=>{Kl(ou,!1)};window.addEventListener("pointerup",su,La),window.addEventListener("pointercancel",au,La)};return ja.forEach(Gl=>{(ma.useGlobalTarget?window:Gl).addEventListener("pointerdown",hl,La),UC(Gl)&&(Gl.addEventListener("focus",zl=>A$(zl,La)),!T$(Gl)&&!Gl.hasAttribute("tabindex")&&(Gl.tabIndex=0))}),Ba}function GC(pa){return iC(pa)&&"ownerSVGElement"in pa}function O$(pa){return GC(pa)&&pa.tagName==="svg"}const ut$2=pa=>!!(pa&&pa.getVelocity),_$=[...jC,Ye$1,fr$1],P$=pa=>_$.find(LC(pa)),rg=reactExports.createContext({transformPagePoint:pa=>pa,isStatic:!1,reducedMotion:"never"});function ky(pa,ha){if(typeof pa=="function")return pa(ha);pa!=null&&(pa.current=ha)}function N$(...pa){return ha=>{let ma=!1;const ja=pa.map(La=>{const Ba=ky(La,ha);return!ma&&typeof Ba=="function"&&(ma=!0),Ba});if(ma)return()=>{for(let La=0;La<ja.length;La++){const Ba=ja[La];typeof Ba=="function"?Ba():ky(pa[La],null)}}}}function M$(...pa){return reactExports.useCallback(N$(...pa),pa)}class $$ extends reactExports.Component{getSnapshotBeforeUpdate(ha){const ma=this.props.childRef.current;if(ma&&ha.isPresent&&!this.props.isPresent){const ja=ma.offsetParent,La=UC(ja)&&ja.offsetWidth||0,Ba=this.props.sizeRef.current;Ba.height=ma.offsetHeight||0,Ba.width=ma.offsetWidth||0,Ba.top=ma.offsetTop,Ba.left=ma.offsetLeft,Ba.right=La-Ba.width-Ba.left}return null}componentDidUpdate(){}render(){return this.props.children}}function k$({children:pa,isPresent:ha,anchorX:ma,root:ja}){const La=reactExports.useId(),Ba=reactExports.useRef(null),hl=reactExports.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:Gl}=reactExports.useContext(rg),zl=M$(Ba,pa?.ref);return reactExports.useInsertionEffect(()=>{const{width:Wl,height:Kl,top:su,left:au,right:ou}=hl.current;if(ha||!Ba.current||!Wl||!Kl)return;const $m=ma==="left"?`left: ${au}`:`right: ${ou}`;Ba.current.dataset.motionPopId=La;const Nm=document.createElement("style");Gl&&(Nm.nonce=Gl);const Mm=ja??document.head;return Mm.appendChild(Nm),Nm.sheet&&Nm.sheet.insertRule(`
|
|
72
|
+
`+(Gl!==hl?`result of cast: ${Gl}`:""))}return Ba}_cast(ha,ma){let ja=ha===void 0?ha:this.transforms.reduce((La,Ba)=>Ba.call(this,La,ha,this,ma),ha);return ja===void 0&&(ja=this.getDefault(ma)),ja}_validate(ha,ma={},ja,La){let{path:Ba,originalValue:hl=ha,strict:Gl=this.spec.strict}=ma,zl=ha;Gl||(zl=this._cast(zl,Object.assign({assert:!1},ma)));let Wl=[];for(let Kl of Object.values(this.internalTests))Kl&&Wl.push(Kl);this.runTests({path:Ba,value:zl,originalValue:hl,options:ma,tests:Wl},ja,Kl=>{if(Kl.length)return La(Kl,zl);this.runTests({path:Ba,value:zl,originalValue:hl,options:ma,tests:this.tests},ja,La)})}runTests(ha,ma,ja){let La=!1,{tests:Ba,value:hl,originalValue:Gl,path:zl,options:Wl}=ha,Kl=Nm=>{La||(La=!0,ma(Nm,hl))},su=Nm=>{La||(La=!0,ja(Nm,hl))},au=Ba.length,ou=[];if(!au)return su([]);let $m={value:hl,originalValue:Gl,path:zl,options:Wl,schema:this};for(let Nm=0;Nm<Ba.length;Nm++){const Mm=Ba[Nm];Mm($m,Kl,function(ly){ly&&(Array.isArray(ly)?ou.push(...ly):ou.push(ly)),--au<=0&&su(ou)})}}asNestedTest({key:ha,index:ma,parent:ja,parentPath:La,originalParent:Ba,options:hl}){const Gl=ha??ma;if(Gl==null)throw TypeError("Must include `key` or `index` for nested validations");const zl=typeof Gl=="number";let Wl=ja[Gl];const Kl=Object.assign({},hl,{strict:!0,parent:ja,value:Wl,originalValue:Ba[Gl],key:void 0,[zl?"index":"key"]:Gl,path:zl||Gl.includes(".")?`${La||""}[${zl?Gl:`"${Gl}"`}]`:(La?`${La}.`:"")+ha});return(su,au,ou)=>this.resolve(Kl)._validate(Wl,Kl,au,ou)}validate(ha,ma){var ja;let La=this.resolve(Object.assign({},ma,{value:ha})),Ba=(ja=ma?.disableStackTrace)!=null?ja:La.spec.disableStackTrace;return new Promise((hl,Gl)=>La._validate(ha,ma,(zl,Wl)=>{ValidationError.isError(zl)&&(zl.value=Wl),Gl(zl)},(zl,Wl)=>{zl.length?Gl(new ValidationError(zl,Wl,void 0,void 0,Ba)):hl(Wl)}))}validateSync(ha,ma){var ja;let La=this.resolve(Object.assign({},ma,{value:ha})),Ba,hl=(ja=ma?.disableStackTrace)!=null?ja:La.spec.disableStackTrace;return La._validate(ha,Object.assign({},ma,{sync:!0}),(Gl,zl)=>{throw ValidationError.isError(Gl)&&(Gl.value=zl),Gl},(Gl,zl)=>{if(Gl.length)throw new ValidationError(Gl,ha,void 0,void 0,hl);Ba=zl}),Ba}isValid(ha,ma){return this.validate(ha,ma).then(()=>!0,ja=>{if(ValidationError.isError(ja))return!1;throw ja})}isValidSync(ha,ma){try{return this.validateSync(ha,ma),!0}catch(ja){if(ValidationError.isError(ja))return!1;throw ja}}_getDefault(ha){let ma=this.spec.default;return ma==null?ma:typeof ma=="function"?ma.call(this,ha):clone$3(ma)}getDefault(ha){return this.resolve(ha||{})._getDefault(ha)}default(ha){return arguments.length===0?this._getDefault():this.clone({default:ha})}strict(ha=!0){return this.clone({strict:ha})}nullability(ha,ma){const ja=this.clone({nullable:ha});return ja.internalTests.nullable=createValidation({message:ma,name:"nullable",test(La){return La===null?this.schema.spec.nullable:!0}}),ja}optionality(ha,ma){const ja=this.clone({optional:ha});return ja.internalTests.optionality=createValidation({message:ma,name:"optionality",test(La){return La===void 0?this.schema.spec.optional:!0}}),ja}optional(){return this.optionality(!0)}defined(ha=mixed.defined){return this.optionality(!1,ha)}nullable(){return this.nullability(!0)}nonNullable(ha=mixed.notNull){return this.nullability(!1,ha)}required(ha=mixed.required){return this.clone().withMutation(ma=>ma.nonNullable(ha).defined(ha))}notRequired(){return this.clone().withMutation(ha=>ha.nullable().optional())}transform(ha){let ma=this.clone();return ma.transforms.push(ha),ma}test(...ha){let ma;if(ha.length===1?typeof ha[0]=="function"?ma={test:ha[0]}:ma=ha[0]:ha.length===2?ma={name:ha[0],test:ha[1]}:ma={name:ha[0],message:ha[1],test:ha[2]},ma.message===void 0&&(ma.message=mixed.default),typeof ma.test!="function")throw new TypeError("`test` is a required parameters");let ja=this.clone(),La=createValidation(ma),Ba=ma.exclusive||ma.name&&ja.exclusiveTests[ma.name]===!0;if(ma.exclusive&&!ma.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return ma.name&&(ja.exclusiveTests[ma.name]=!!ma.exclusive),ja.tests=ja.tests.filter(hl=>!(hl.OPTIONS.name===ma.name&&(Ba||hl.OPTIONS.test===La.OPTIONS.test))),ja.tests.push(La),ja}when(ha,ma){!Array.isArray(ha)&&typeof ha!="string"&&(ma=ha,ha=".");let ja=this.clone(),La=toArray$4(ha).map(Ba=>new Reference(Ba));return La.forEach(Ba=>{Ba.isSibling&&ja.deps.push(Ba.key)}),ja.conditions.push(typeof ma=="function"?new Condition$2(La,ma):Condition$2.fromOptions(La,ma)),ja}typeError(ha){let ma=this.clone();return ma.internalTests.typeError=createValidation({message:ha,name:"typeError",skipAbsent:!0,test(ja){return this.schema._typeCheck(ja)?!0:this.createError({params:{type:this.schema.type}})}}),ma}oneOf(ha,ma=mixed.oneOf){let ja=this.clone();return ha.forEach(La=>{ja._whitelist.add(La),ja._blacklist.delete(La)}),ja.internalTests.whiteList=createValidation({message:ma,name:"oneOf",skipAbsent:!0,test(La){let Ba=this.schema._whitelist,hl=Ba.resolveAll(this.resolve);return hl.includes(La)?!0:this.createError({params:{values:Array.from(Ba).join(", "),resolved:hl}})}}),ja}notOneOf(ha,ma=mixed.notOneOf){let ja=this.clone();return ha.forEach(La=>{ja._blacklist.add(La),ja._whitelist.delete(La)}),ja.internalTests.blacklist=createValidation({message:ma,name:"notOneOf",test(La){let Ba=this.schema._blacklist,hl=Ba.resolveAll(this.resolve);return hl.includes(La)?this.createError({params:{values:Array.from(Ba).join(", "),resolved:hl}}):!0}}),ja}strip(ha=!0){let ma=this.clone();return ma.spec.strip=ha,ma}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),{label:ja,meta:La,optional:Ba,nullable:hl}=ma.spec;return{meta:La,label:ja,optional:Ba,nullable:hl,default:ma.getDefault(ha),type:ma.type,oneOf:ma._whitelist.describe(),notOneOf:ma._blacklist.describe(),tests:ma.tests.filter((zl,Wl,Kl)=>Kl.findIndex(su=>su.OPTIONS.name===zl.OPTIONS.name)===Wl).map(zl=>{const Wl=zl.OPTIONS.params&&ha?resolveParams(Object.assign({},zl.OPTIONS.params),ha):zl.OPTIONS.params;return{name:zl.OPTIONS.name,params:Wl}})}}get"~standard"(){const ha=this;return{version:1,vendor:"yup",async validate(ja){try{return{value:await ha.validate(ja,{abortEarly:!1})}}catch(La){if(La instanceof ValidationError)return{issues:issuesFromValidationError(La)};throw La}}}}}Schema.prototype.__isYupSchema__=!0;for(const pa of["validate","validateSync"])Schema.prototype[`${pa}At`]=function(ha,ma,ja={}){const{parent:La,parentPath:Ba,schema:hl}=getIn(this,ha,ma,ja.context);return hl[pa](La&&La[Ba],Object.assign({},ja,{parent:La,path:ha}))};for(const pa of["equals","is"])Schema.prototype[pa]=Schema.prototype.oneOf;for(const pa of["not","nope"])Schema.prototype[pa]=Schema.prototype.notOneOf;const returnsTrue=()=>!0;function create$8(pa){return new MixedSchema(pa)}class MixedSchema extends Schema{constructor(ha){super(typeof ha=="function"?{type:"mixed",check:ha}:Object.assign({type:"mixed",check:returnsTrue},ha))}}create$8.prototype=MixedSchema.prototype;function create$7(){return new BooleanSchema}class BooleanSchema extends Schema{constructor(){super({type:"boolean",check(ha){return ha instanceof Boolean&&(ha=ha.valueOf()),typeof ha=="boolean"}}),this.withMutation(()=>{this.transform((ha,ma)=>{if(this.spec.coerce&&!this.isType(ha)){if(/^(true|1)$/i.test(String(ha)))return!0;if(/^(false|0)$/i.test(String(ha)))return!1}return ha})})}isTrue(ha=boolean.isValue){return this.test({message:ha,name:"is-value",exclusive:!0,params:{value:"true"},test(ma){return isAbsent(ma)||ma===!0}})}isFalse(ha=boolean.isValue){return this.test({message:ha,name:"is-value",exclusive:!0,params:{value:"false"},test(ma){return isAbsent(ma)||ma===!1}})}default(ha){return super.default(ha)}defined(ha){return super.defined(ha)}optional(){return super.optional()}required(ha){return super.required(ha)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(ha){return super.nonNullable(ha)}strip(ha){return super.strip(ha)}}create$7.prototype=BooleanSchema.prototype;const isoReg=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function parseIsoDate(pa){const ha=parseDateStruct(pa);if(!ha)return Date.parse?Date.parse(pa):Number.NaN;if(ha.z===void 0&&ha.plusMinus===void 0)return new Date(ha.year,ha.month,ha.day,ha.hour,ha.minute,ha.second,ha.millisecond).valueOf();let ma=0;return ha.z!=="Z"&&ha.plusMinus!==void 0&&(ma=ha.hourOffset*60+ha.minuteOffset,ha.plusMinus==="+"&&(ma=0-ma)),Date.UTC(ha.year,ha.month,ha.day,ha.hour,ha.minute+ma,ha.second,ha.millisecond)}function parseDateStruct(pa){var ha,ma;const ja=isoReg.exec(pa);return ja?{year:toNumber$2(ja[1]),month:toNumber$2(ja[2],1)-1,day:toNumber$2(ja[3],1),hour:toNumber$2(ja[4]),minute:toNumber$2(ja[5]),second:toNumber$2(ja[6]),millisecond:ja[7]?toNumber$2(ja[7].substring(0,3)):0,precision:(ha=(ma=ja[7])==null?void 0:ma.length)!=null?ha:void 0,z:ja[8]||void 0,plusMinus:ja[9]||void 0,hourOffset:toNumber$2(ja[10]),minuteOffset:toNumber$2(ja[11])}:null}function toNumber$2(pa,ha=0){return Number(pa)||ha}let rEmail=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rUrl=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rUUID=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,yearMonthDay="^\\d{4}-\\d{2}-\\d{2}",hourMinuteSecond="\\d{2}:\\d{2}:\\d{2}",zOrOffset="(([+-]\\d{2}(:?\\d{2})?)|Z)",rIsoDateTime=new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`),isTrimmed=pa=>isAbsent(pa)||pa===pa.trim(),objStringTag={}.toString();function create$6(){return new StringSchema}class StringSchema extends Schema{constructor(){super({type:"string",check(ha){return ha instanceof String&&(ha=ha.valueOf()),typeof ha=="string"}}),this.withMutation(()=>{this.transform((ha,ma)=>{if(!this.spec.coerce||this.isType(ha)||Array.isArray(ha))return ha;const ja=ha!=null&&ha.toString?ha.toString():ha;return ja===objStringTag?ha:ja})})}required(ha){return super.required(ha).withMutation(ma=>ma.test({message:ha||mixed.required,name:"required",skipAbsent:!0,test:ja=>!!ja.length}))}notRequired(){return super.notRequired().withMutation(ha=>(ha.tests=ha.tests.filter(ma=>ma.OPTIONS.name!=="required"),ha))}length(ha,ma=string.length){return this.test({message:ma,name:"length",exclusive:!0,params:{length:ha},skipAbsent:!0,test(ja){return ja.length===this.resolve(ha)}})}min(ha,ma=string.min){return this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(ja){return ja.length>=this.resolve(ha)}})}max(ha,ma=string.max){return this.test({name:"max",exclusive:!0,message:ma,params:{max:ha},skipAbsent:!0,test(ja){return ja.length<=this.resolve(ha)}})}matches(ha,ma){let ja=!1,La,Ba;return ma&&(typeof ma=="object"?{excludeEmptyString:ja=!1,message:La,name:Ba}=ma:La=ma),this.test({name:Ba||"matches",message:La||string.matches,params:{regex:ha},skipAbsent:!0,test:hl=>hl===""&&ja||hl.search(ha)!==-1})}email(ha=string.email){return this.matches(rEmail,{name:"email",message:ha,excludeEmptyString:!0})}url(ha=string.url){return this.matches(rUrl,{name:"url",message:ha,excludeEmptyString:!0})}uuid(ha=string.uuid){return this.matches(rUUID,{name:"uuid",message:ha,excludeEmptyString:!1})}datetime(ha){let ma="",ja,La;return ha&&(typeof ha=="object"?{message:ma="",allowOffset:ja=!1,precision:La=void 0}=ha:ma=ha),this.matches(rIsoDateTime,{name:"datetime",message:ma||string.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:ma||string.datetime_offset,params:{allowOffset:ja},skipAbsent:!0,test:Ba=>{if(!Ba||ja)return!0;const hl=parseDateStruct(Ba);return hl?!!hl.z:!1}}).test({name:"datetime_precision",message:ma||string.datetime_precision,params:{precision:La},skipAbsent:!0,test:Ba=>{if(!Ba||La==null)return!0;const hl=parseDateStruct(Ba);return hl?hl.precision===La:!1}})}ensure(){return this.default("").transform(ha=>ha===null?"":ha)}trim(ha=string.trim){return this.transform(ma=>ma!=null?ma.trim():ma).test({message:ha,name:"trim",test:isTrimmed})}lowercase(ha=string.lowercase){return this.transform(ma=>isAbsent(ma)?ma:ma.toLowerCase()).test({message:ha,name:"string_case",exclusive:!0,skipAbsent:!0,test:ma=>isAbsent(ma)||ma===ma.toLowerCase()})}uppercase(ha=string.uppercase){return this.transform(ma=>isAbsent(ma)?ma:ma.toUpperCase()).test({message:ha,name:"string_case",exclusive:!0,skipAbsent:!0,test:ma=>isAbsent(ma)||ma===ma.toUpperCase()})}}create$6.prototype=StringSchema.prototype;let invalidDate=new Date(""),isDate$1=pa=>Object.prototype.toString.call(pa)==="[object Date]";class DateSchema extends Schema{constructor(){super({type:"date",check(ha){return isDate$1(ha)&&!isNaN(ha.getTime())}}),this.withMutation(()=>{this.transform((ha,ma)=>!this.spec.coerce||this.isType(ha)||ha===null?ha:(ha=parseIsoDate(ha),isNaN(ha)?DateSchema.INVALID_DATE:new Date(ha)))})}prepareParam(ha,ma){let ja;if(Reference.isRef(ha))ja=ha;else{let La=this.cast(ha);if(!this._typeCheck(La))throw new TypeError(`\`${ma}\` must be a Date or a value that can be \`cast()\` to a Date`);ja=La}return ja}min(ha,ma=date$1.min){let ja=this.prepareParam(ha,"min");return this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(La){return La>=this.resolve(ja)}})}max(ha,ma=date$1.max){let ja=this.prepareParam(ha,"max");return this.test({message:ma,name:"max",exclusive:!0,params:{max:ha},skipAbsent:!0,test(La){return La<=this.resolve(ja)}})}}DateSchema.INVALID_DATE=invalidDate;function sortFields(pa,ha=[]){let ma=[],ja=new Set,La=new Set(ha.map(([hl,Gl])=>`${hl}-${Gl}`));function Ba(hl,Gl){let zl=propertyExprExports.split(hl)[0];ja.add(zl),La.has(`${Gl}-${zl}`)||ma.push([Gl,zl])}for(const hl of Object.keys(pa)){let Gl=pa[hl];ja.add(hl),Reference.isRef(Gl)&&Gl.isSibling?Ba(Gl.path,hl):isSchema(Gl)&&"deps"in Gl&&Gl.deps.forEach(zl=>Ba(zl,hl))}return toposort.array(Array.from(ja),ma).reverse()}function findIndex$2(pa,ha){let ma=1/0;return pa.some((ja,La)=>{var Ba;if((Ba=ha.path)!=null&&Ba.includes(ja))return ma=La,!0}),ma}function sortByKeyOrder(pa){return(ha,ma)=>findIndex$2(pa,ha)-findIndex$2(pa,ma)}const parseJson=(pa,ha,ma)=>{if(typeof pa!="string")return pa;let ja=pa;try{ja=JSON.parse(pa)}catch{}return ma.isType(ja)?ja:pa};function deepPartial(pa){if("fields"in pa){const ha={};for(const[ma,ja]of Object.entries(pa.fields))ha[ma]=deepPartial(ja);return pa.setFields(ha)}if(pa.type==="array"){const ha=pa.optional();return ha.innerType&&(ha.innerType=deepPartial(ha.innerType)),ha}return pa.type==="tuple"?pa.optional().clone({types:pa.spec.types.map(deepPartial)}):"optional"in pa?pa.optional():pa}const deepHas=(pa,ha)=>{const ma=[...propertyExprExports.normalizePath(ha)];if(ma.length===1)return ma[0]in pa;let ja=ma.pop(),La=propertyExprExports.getter(propertyExprExports.join(ma),!0)(pa);return!!(La&&ja in La)};let isObject$5=pa=>Object.prototype.toString.call(pa)==="[object Object]";function unknown(pa,ha){let ma=Object.keys(pa.fields);return Object.keys(ha).filter(ja=>ma.indexOf(ja)===-1)}const defaultSort=sortByKeyOrder([]);function create$3(pa){return new ObjectSchema(pa)}class ObjectSchema extends Schema{constructor(ha){super({type:"object",check(ma){return isObject$5(ma)||typeof ma=="function"}}),this.fields=Object.create(null),this._sortErrors=defaultSort,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{ha&&this.shape(ha)})}_cast(ha,ma={}){var ja;let La=super._cast(ha,ma);if(La===void 0)return this.getDefault(ma);if(!this._typeCheck(La))return La;let Ba=this.fields,hl=(ja=ma.stripUnknown)!=null?ja:this.spec.noUnknown,Gl=[].concat(this._nodes,Object.keys(La).filter(su=>!this._nodes.includes(su))),zl={},Wl=Object.assign({},ma,{parent:zl,__validating:ma.__validating||!1}),Kl=!1;for(const su of Gl){let au=Ba[su],ou=su in La,$m=La[su];if(au){let Nm;Wl.path=(ma.path?`${ma.path}.`:"")+su,au=au.resolve({value:$m,context:ma.context,parent:zl});let Mm=au instanceof Schema?au.spec:void 0,Mg=Mm?.strict;if(Mm!=null&&Mm.strip){Kl=Kl||su in La;continue}Nm=!ma.__validating||!Mg?au.cast($m,Wl):$m,Nm!==void 0&&(zl[su]=Nm)}else ou&&!hl&&(zl[su]=$m);(ou!==su in zl||zl[su]!==$m)&&(Kl=!0)}return Kl?zl:La}_validate(ha,ma={},ja,La){let{from:Ba=[],originalValue:hl=ha,recursive:Gl=this.spec.recursive}=ma;ma.from=[{schema:this,value:hl},...Ba],ma.__validating=!0,ma.originalValue=hl,super._validate(ha,ma,ja,(zl,Wl)=>{if(!Gl||!isObject$5(Wl)){La(zl,Wl);return}hl=hl||Wl;let Kl=[];for(let su of this._nodes){let au=this.fields[su];!au||Reference.isRef(au)||Kl.push(au.asNestedTest({options:ma,key:su,parent:Wl,parentPath:ma.path,originalParent:hl}))}this.runTests({tests:Kl,value:Wl,originalValue:hl,options:ma},ja,su=>{La(su.sort(this._sortErrors).concat(zl),Wl)})})}clone(ha){const ma=super.clone(ha);return ma.fields=Object.assign({},this.fields),ma._nodes=this._nodes,ma._excludedEdges=this._excludedEdges,ma._sortErrors=this._sortErrors,ma}concat(ha){let ma=super.concat(ha),ja=ma.fields;for(let[La,Ba]of Object.entries(this.fields)){const hl=ja[La];ja[La]=hl===void 0?Ba:hl}return ma.withMutation(La=>La.setFields(ja,[...this._excludedEdges,...ha._excludedEdges]))}_getDefault(ha){if("default"in this.spec)return super._getDefault(ha);if(!this._nodes.length)return;let ma={};return this._nodes.forEach(ja=>{var La;const Ba=this.fields[ja];let hl=ha;(La=hl)!=null&&La.value&&(hl=Object.assign({},hl,{parent:hl.value,value:hl.value[ja]})),ma[ja]=Ba&&"getDefault"in Ba?Ba.getDefault(hl):void 0}),ma}setFields(ha,ma){let ja=this.clone();return ja.fields=ha,ja._nodes=sortFields(ha,ma),ja._sortErrors=sortByKeyOrder(Object.keys(ha)),ma&&(ja._excludedEdges=ma),ja}shape(ha,ma=[]){return this.clone().withMutation(ja=>{let La=ja._excludedEdges;return ma.length&&(Array.isArray(ma[0])||(ma=[ma]),La=[...ja._excludedEdges,...ma]),ja.setFields(Object.assign(ja.fields,ha),La)})}partial(){const ha={};for(const[ma,ja]of Object.entries(this.fields))ha[ma]="optional"in ja&&ja.optional instanceof Function?ja.optional():ja;return this.setFields(ha)}deepPartial(){return deepPartial(this)}pick(ha){const ma={};for(const ja of ha)this.fields[ja]&&(ma[ja]=this.fields[ja]);return this.setFields(ma,this._excludedEdges.filter(([ja,La])=>ha.includes(ja)&&ha.includes(La)))}omit(ha){const ma=[];for(const ja of Object.keys(this.fields))ha.includes(ja)||ma.push(ja);return this.pick(ma)}from(ha,ma,ja){let La=propertyExprExports.getter(ha,!0);return this.transform(Ba=>{if(!Ba)return Ba;let hl=Ba;return deepHas(Ba,ha)&&(hl=Object.assign({},Ba),ja||delete hl[ha],hl[ma]=La(Ba)),hl})}json(){return this.transform(parseJson)}exact(ha){return this.test({name:"exact",exclusive:!0,message:ha||object$1.exact,test(ma){if(ma==null)return!0;const ja=unknown(this.schema,ma);return ja.length===0||this.createError({params:{properties:ja.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(ha=!0,ma=object$1.noUnknown){typeof ha!="boolean"&&(ma=ha,ha=!0);let ja=this.test({name:"noUnknown",exclusive:!0,message:ma,test(La){if(La==null)return!0;const Ba=unknown(this.schema,La);return!ha||Ba.length===0||this.createError({params:{unknown:Ba.join(", ")}})}});return ja.spec.noUnknown=ha,ja}unknown(ha=!0,ma=object$1.noUnknown){return this.noUnknown(!ha,ma)}transformKeys(ha){return this.transform(ma=>{if(!ma)return ma;const ja={};for(const La of Object.keys(ma))ja[ha(La)]=ma[La];return ja})}camelCase(){return this.transformKeys(tinyCaseExports.camelCase)}snakeCase(){return this.transformKeys(tinyCaseExports.snakeCase)}constantCase(){return this.transformKeys(ha=>tinyCaseExports.snakeCase(ha).toUpperCase())}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),ja=super.describe(ha);ja.fields={};for(const[Ba,hl]of Object.entries(ma.fields)){var La;let Gl=ha;(La=Gl)!=null&&La.value&&(Gl=Object.assign({},Gl,{parent:Gl.value,value:Gl.value[Ba]})),ja.fields[Ba]=hl.describe(Gl)}return ja}}create$3.prototype=ObjectSchema.prototype;function create$2$1(pa){return new ArraySchema(pa)}class ArraySchema extends Schema{constructor(ha){super({type:"array",spec:{types:ha},check(ma){return Array.isArray(ma)}}),this.innerType=void 0,this.innerType=ha}_cast(ha,ma){const ja=super._cast(ha,ma);if(!this._typeCheck(ja)||!this.innerType)return ja;let La=!1;const Ba=ja.map((hl,Gl)=>{const zl=this.innerType.cast(hl,Object.assign({},ma,{path:`${ma.path||""}[${Gl}]`,parent:ja,originalValue:hl,value:hl,index:Gl}));return zl!==hl&&(La=!0),zl});return La?Ba:ja}_validate(ha,ma={},ja,La){var Ba;let hl=this.innerType,Gl=(Ba=ma.recursive)!=null?Ba:this.spec.recursive;ma.originalValue!=null&&ma.originalValue,super._validate(ha,ma,ja,(zl,Wl)=>{var Kl;if(!Gl||!hl||!this._typeCheck(Wl)){La(zl,Wl);return}let su=new Array(Wl.length);for(let ou=0;ou<Wl.length;ou++){var au;su[ou]=hl.asNestedTest({options:ma,index:ou,parent:Wl,parentPath:ma.path,originalParent:(au=ma.originalValue)!=null?au:ha})}this.runTests({value:Wl,tests:su,originalValue:(Kl=ma.originalValue)!=null?Kl:ha,options:ma},ja,ou=>La(ou.concat(zl),Wl))})}clone(ha){const ma=super.clone(ha);return ma.innerType=this.innerType,ma}json(){return this.transform(parseJson)}concat(ha){let ma=super.concat(ha);return ma.innerType=this.innerType,ha.innerType&&(ma.innerType=ma.innerType?ma.innerType.concat(ha.innerType):ha.innerType),ma}of(ha){let ma=this.clone();if(!isSchema(ha))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+printValue(ha));return ma.innerType=ha,ma.spec=Object.assign({},ma.spec,{types:ha}),ma}length(ha,ma=array$1.length){return this.test({message:ma,name:"length",exclusive:!0,params:{length:ha},skipAbsent:!0,test(ja){return ja.length===this.resolve(ha)}})}min(ha,ma){return ma=ma||array$1.min,this.test({message:ma,name:"min",exclusive:!0,params:{min:ha},skipAbsent:!0,test(ja){return ja.length>=this.resolve(ha)}})}max(ha,ma){return ma=ma||array$1.max,this.test({message:ma,name:"max",exclusive:!0,params:{max:ha},skipAbsent:!0,test(ja){return ja.length<=this.resolve(ha)}})}ensure(){return this.default(()=>[]).transform((ha,ma)=>this._typeCheck(ha)?ha:ma==null?[]:[].concat(ma))}compact(ha){let ma=ha?(ja,La,Ba)=>!ha(ja,La,Ba):ja=>!!ja;return this.transform(ja=>ja!=null?ja.filter(ma):ja)}describe(ha){const ma=(ha?this.resolve(ha):this).clone(),ja=super.describe(ha);if(ma.innerType){var La;let Ba=ha;(La=Ba)!=null&&La.value&&(Ba=Object.assign({},Ba,{parent:Ba.value,value:Ba.value[0]})),ja.innerType=ma.innerType.describe(Ba)}return ja}}create$2$1.prototype=ArraySchema.prototype;function Ce$5(pa,ha){const ma=pa.icons,ja=pa.aliases||Object.create(null),La=Object.create(null);function Ba(hl){if(ma[hl])return La[hl]=[];if(!(hl in La)){La[hl]=null;const Gl=ja[hl]&&ja[hl].parent,zl=Gl&&Ba(Gl);zl&&(La[hl]=[Gl].concat(zl))}return La[hl]}return Object.keys(ma).concat(Object.keys(ja)).forEach(Ba),La}const ae$3=Object.freeze({left:0,top:0,width:16,height:16}),M$9=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),B$a=Object.freeze({...ae$3,...M$9}),$$9=Object.freeze({...B$a,body:"",hidden:!1});function je$4(pa,ha){const ma={};!pa.hFlip!=!ha.hFlip&&(ma.hFlip=!0),!pa.vFlip!=!ha.vFlip&&(ma.vFlip=!0);const ja=((pa.rotate||0)+(ha.rotate||0))%4;return ja&&(ma.rotate=ja),ma}function X$6(pa,ha){const ma=je$4(pa,ha);for(const ja in $$9)ja in M$9?ja in pa&&!(ja in ma)&&(ma[ja]=M$9[ja]):ja in ha?ma[ja]=ha[ja]:ja in pa&&(ma[ja]=pa[ja]);return ma}function Ae$2(pa,ha,ma){const ja=pa.icons,La=pa.aliases||Object.create(null);let Ba={};function hl(Gl){Ba=X$6(ja[Gl]||La[Gl],Ba)}return hl(ha),ma.forEach(hl),X$6(pa,Ba)}function ue$3(pa,ha){const ma=[];if(typeof pa!="object"||typeof pa.icons!="object")return ma;pa.not_found instanceof Array&&pa.not_found.forEach(La=>{ha(La,null),ma.push(La)});const ja=Ce$5(pa);for(const La in ja){const Ba=ja[La];Ba&&(ha(La,Ae$2(pa,La,Ba)),ma.push(La))}return ma}const Ee$4={provider:"",aliases:{},not_found:{},...ae$3};function _$b(pa,ha){for(const ma in ha)if(ma in pa&&typeof pa[ma]!=typeof ha[ma])return!1;return!0}function fe$4(pa){if(typeof pa!="object"||pa===null)return null;const ha=pa;if(typeof ha.prefix!="string"||!pa.icons||typeof pa.icons!="object"||!_$b(pa,Ee$4))return null;const ma=ha.icons;for(const La in ma){const Ba=ma[La];if(!La||typeof Ba.body!="string"||!_$b(Ba,$$9))return null}const ja=ha.aliases||Object.create(null);for(const La in ja){const Ba=ja[La],hl=Ba.parent;if(!La||typeof hl!="string"||!ma[hl]&&!ja[hl]||!_$b(Ba,$$9))return null}return ha}const Y$4=Object.create(null);function Oe$7(pa,ha){return{provider:pa,prefix:ha,icons:Object.create(null),missing:new Set}}function T$d(pa,ha){const ma=Y$4[pa]||(Y$4[pa]=Object.create(null));return ma[ha]||(ma[ha]=Oe$7(pa,ha))}function de$4(pa,ha){return fe$4(ha)?ue$3(ha,(ma,ja)=>{ja?pa.icons[ma]=ja:pa.missing.add(ma)}):[]}function Fe$4(pa,ha,ma){try{if(typeof ma.body=="string")return pa.icons[ha]={...ma},!0}catch{}return!1}const he$4=/^[a-z0-9]+(-[a-z0-9]+)*$/,R$5=(pa,ha,ma,ja="")=>{const La=pa.split(":");if(pa.slice(0,1)==="@"){if(La.length<2||La.length>3)return null;ja=La.shift().slice(1)}if(La.length>3||!La.length)return null;if(La.length>1){const Gl=La.pop(),zl=La.pop(),Wl={provider:La.length>0?La[0]:ja,prefix:zl,name:Gl};return ha&&!F$b(Wl)?null:Wl}const Ba=La[0],hl=Ba.split("-");if(hl.length>1){const Gl={provider:ja,prefix:hl.shift(),name:hl.join("-")};return ha&&!F$b(Gl)?null:Gl}if(ma&&ja===""){const Gl={provider:ja,prefix:"",name:Ba};return ha&&!F$b(Gl,ma)?null:Gl}return null},F$b=(pa,ha)=>pa?!!((ha&&pa.prefix===""||pa.prefix)&&pa.name):!1;let E$a=!1;function pe$4(pa){return typeof pa=="boolean"&&(E$a=pa),E$a}function Z$8(pa){const ha=typeof pa=="string"?R$5(pa,!0,E$a):pa;if(ha){const ma=T$d(ha.provider,ha.prefix),ja=ha.name;return ma.icons[ja]||(ma.missing.has(ja)?null:void 0)}}function Le$3(pa,ha){const ma=R$5(pa,!0,E$a);if(!ma)return!1;const ja=T$d(ma.provider,ma.prefix);return ha?Fe$4(ja,ma.name,ha):(ja.missing.add(ma.name),!0)}function Me$3(pa,ha){if(typeof pa!="object")return!1;if(typeof ha!="string"&&(ha=pa.provider||""),E$a&&!ha&&!pa.prefix){let La=!1;return fe$4(pa)&&(pa.prefix="",ue$3(pa,(Ba,hl)=>{Le$3(Ba,hl)&&(La=!0)})),La}const ma=pa.prefix;if(!F$b({prefix:ma,name:"a"}))return!1;const ja=T$d(ha,ma);return!!de$4(ja,pa)}const ge$5=Object.freeze({width:null,height:null}),me$3=Object.freeze({...ge$5,...M$9}),Re$3=/(-?[0-9.]*[0-9]+[0-9.]*)/g,De$5=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ee$5(pa,ha,ma){if(ha===1)return pa;if(ma=ma||100,typeof pa=="number")return Math.ceil(pa*ha*ma)/ma;if(typeof pa!="string")return pa;const ja=pa.split(Re$3);if(ja===null||!ja.length)return pa;const La=[];let Ba=ja.shift(),hl=De$5.test(Ba);for(;;){if(hl){const Gl=parseFloat(Ba);isNaN(Gl)?La.push(Ba):La.push(Math.ceil(Gl*ha*ma)/ma)}else La.push(Ba);if(Ba=ja.shift(),Ba===void 0)return La.join("");hl=!hl}}function Ue$3(pa,ha="defs"){let ma="";const ja=pa.indexOf("<"+ha);for(;ja>=0;){const La=pa.indexOf(">",ja),Ba=pa.indexOf("</"+ha);if(La===-1||Ba===-1)break;const hl=pa.indexOf(">",Ba);if(hl===-1)break;ma+=pa.slice(La+1,Ba).trim(),pa=pa.slice(0,ja).trim()+pa.slice(hl+1)}return{defs:ma,content:pa}}function _e$3(pa,ha){return pa?"<defs>"+pa+"</defs>"+ha:ha}function qe$2(pa,ha,ma){const ja=Ue$3(pa);return _e$3(ja.defs,ha+ja.content+ma)}const He$4=pa=>pa==="unset"||pa==="undefined"||pa==="none";function $e$1(pa,ha){const ma={...B$a,...pa},ja={...me$3,...ha},La={left:ma.left,top:ma.top,width:ma.width,height:ma.height};let Ba=ma.body;[ma,ja].forEach(Nm=>{const Mm=[],Mg=Nm.hFlip,ly=Nm.vFlip;let uy=Nm.rotate;Mg?ly?uy+=2:(Mm.push("translate("+(La.width+La.left).toString()+" "+(0-La.top).toString()+")"),Mm.push("scale(-1 1)"),La.top=La.left=0):ly&&(Mm.push("translate("+(0-La.left).toString()+" "+(La.height+La.top).toString()+")"),Mm.push("scale(1 -1)"),La.top=La.left=0);let GE;switch(uy<0&&(uy-=Math.floor(uy/4)*4),uy=uy%4,uy){case 1:GE=La.height/2+La.top,Mm.unshift("rotate(90 "+GE.toString()+" "+GE.toString()+")");break;case 2:Mm.unshift("rotate(180 "+(La.width/2+La.left).toString()+" "+(La.height/2+La.top).toString()+")");break;case 3:GE=La.width/2+La.left,Mm.unshift("rotate(-90 "+GE.toString()+" "+GE.toString()+")");break}uy%2===1&&(La.left!==La.top&&(GE=La.left,La.left=La.top,La.top=GE),La.width!==La.height&&(GE=La.width,La.width=La.height,La.height=GE)),Mm.length&&(Ba=qe$2(Ba,'<g transform="'+Mm.join(" ")+'">',"</g>"))});const hl=ja.width,Gl=ja.height,zl=La.width,Wl=La.height;let Kl,su;hl===null?(su=Gl===null?"1em":Gl==="auto"?Wl:Gl,Kl=ee$5(su,zl/Wl)):(Kl=hl==="auto"?zl:hl,su=Gl===null?ee$5(Kl,Wl/zl):Gl==="auto"?Wl:Gl);const au={},ou=(Nm,Mm)=>{He$4(Mm)||(au[Nm]=Mm.toString())};ou("width",Kl),ou("height",su);const $m=[La.left,La.top,zl,Wl];return au.viewBox=$m.join(" "),{attributes:au,viewBox:$m,body:Ba}}const ze$2=/\sid="(\S+)"/g,Qe$1="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ve$2=0;function Be$2(pa,ha=Qe$1){const ma=[];let ja;for(;ja=ze$2.exec(pa);)ma.push(ja[1]);if(!ma.length)return pa;const La="suffix"+(Math.random()*16777216|Date.now()).toString(16);return ma.forEach(Ba=>{const hl=typeof ha=="function"?ha(Ba):ha+(Ve$2++).toString(),Gl=Ba.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");pa=pa.replace(new RegExp('([#;"])('+Gl+')([")]|\\.[a-z])',"g"),"$1"+hl+La+"$3")}),pa=pa.replace(new RegExp(La,"g"),""),pa}const z$b=Object.create(null);function Ge$3(pa,ha){z$b[pa]=ha}function Q$7(pa){return z$b[pa]||z$b[""]}function G$7(pa){let ha;if(typeof pa.resources=="string")ha=[pa.resources];else if(ha=pa.resources,!(ha instanceof Array)||!ha.length)return null;return{resources:ha,path:pa.path||"/",maxURL:pa.maxURL||500,rotate:pa.rotate||750,timeout:pa.timeout||5e3,random:pa.random===!0,index:pa.index||0,dataAfterTimeout:pa.dataAfterTimeout!==!1}}const W$7=Object.create(null),C$e=["https://api.simplesvg.com","https://api.unisvg.com"],L$9=[];for(;C$e.length>0;)C$e.length===1||Math.random()>.5?L$9.push(C$e.shift()):L$9.push(C$e.pop());W$7[""]=G$7({resources:["https://api.iconify.design"].concat(L$9)});function We$2(pa,ha){const ma=G$7(ha);return ma===null?!1:(W$7[pa]=ma,!0)}function J$7(pa){return W$7[pa]}const Je$2=()=>{let pa;try{if(pa=fetch,typeof pa=="function")return pa}catch{}};let te$5=Je$2();function Ke$3(pa,ha){const ma=J$7(pa);if(!ma)return 0;let ja;if(!ma.maxURL)ja=0;else{let La=0;ma.resources.forEach(hl=>{La=Math.max(La,hl.length)});const Ba=ha+".json?icons=";ja=ma.maxURL-La-ma.path.length-Ba.length}return ja}function Xe$2(pa){return pa===404}const Ye$2=(pa,ha,ma)=>{const ja=[],La=Ke$3(pa,ha),Ba="icons";let hl={type:Ba,provider:pa,prefix:ha,icons:[]},Gl=0;return ma.forEach((zl,Wl)=>{Gl+=zl.length+1,Gl>=La&&Wl>0&&(ja.push(hl),hl={type:Ba,provider:pa,prefix:ha,icons:[]},Gl=zl.length),hl.icons.push(zl)}),ja.push(hl),ja};function Ze$3(pa){if(typeof pa=="string"){const ha=J$7(pa);if(ha)return ha.path}return"/"}const et$3=(pa,ha,ma)=>{if(!te$5){ma("abort",424);return}let ja=Ze$3(ha.provider);switch(ha.type){case"icons":{const Ba=ha.prefix,hl=ha.icons.join(","),Gl=new URLSearchParams({icons:hl});ja+=Ba+".json?"+Gl.toString();break}case"custom":{const Ba=ha.uri;ja+=Ba.slice(0,1)==="/"?Ba.slice(1):Ba;break}default:ma("abort",400);return}let La=503;te$5(pa+ja).then(Ba=>{const hl=Ba.status;if(hl!==200){setTimeout(()=>{ma(Xe$2(hl)?"abort":"next",hl)});return}return La=501,Ba.json()}).then(Ba=>{if(typeof Ba!="object"||Ba===null){setTimeout(()=>{Ba===404?ma("abort",Ba):ma("next",La)});return}setTimeout(()=>{ma("success",Ba)})}).catch(()=>{ma("next",La)})},tt$3={prepare:Ye$2,send:et$3};function be$5(pa,ha){pa.forEach(ma=>{const ja=ma.loaderCallbacks;ja&&(ma.loaderCallbacks=ja.filter(La=>La.id!==ha))})}function nt$4(pa){pa.pendingCallbacksFlag||(pa.pendingCallbacksFlag=!0,setTimeout(()=>{pa.pendingCallbacksFlag=!1;const ha=pa.loaderCallbacks?pa.loaderCallbacks.slice(0):[];if(!ha.length)return;let ma=!1;const ja=pa.provider,La=pa.prefix;ha.forEach(Ba=>{const hl=Ba.icons,Gl=hl.pending.length;hl.pending=hl.pending.filter(zl=>{if(zl.prefix!==La)return!0;const Wl=zl.name;if(pa.icons[Wl])hl.loaded.push({provider:ja,prefix:La,name:Wl});else if(pa.missing.has(Wl))hl.missing.push({provider:ja,prefix:La,name:Wl});else return ma=!0,!0;return!1}),hl.pending.length!==Gl&&(ma||be$5([pa],Ba.id),Ba.callback(hl.loaded.slice(0),hl.missing.slice(0),hl.pending.slice(0),Ba.abort))})}))}let ot$2=0;function it$3(pa,ha,ma){const ja=ot$2++,La=be$5.bind(null,ma,ja);if(!ha.pending.length)return La;const Ba={id:ja,icons:ha,callback:pa,abort:La};return ma.forEach(hl=>{(hl.loaderCallbacks||(hl.loaderCallbacks=[])).push(Ba)}),La}function rt$4(pa){const ha={loaded:[],missing:[],pending:[]},ma=Object.create(null);pa.sort((La,Ba)=>La.provider!==Ba.provider?La.provider.localeCompare(Ba.provider):La.prefix!==Ba.prefix?La.prefix.localeCompare(Ba.prefix):La.name.localeCompare(Ba.name));let ja={provider:"",prefix:"",name:""};return pa.forEach(La=>{if(ja.name===La.name&&ja.prefix===La.prefix&&ja.provider===La.provider)return;ja=La;const Ba=La.provider,hl=La.prefix,Gl=La.name,zl=ma[Ba]||(ma[Ba]=Object.create(null)),Wl=zl[hl]||(zl[hl]=T$d(Ba,hl));let Kl;Gl in Wl.icons?Kl=ha.loaded:hl===""||Wl.missing.has(Gl)?Kl=ha.missing:Kl=ha.pending;const su={provider:Ba,prefix:hl,name:Gl};Kl.push(su)}),ha}function st$4(pa,ha=!0,ma=!1){const ja=[];return pa.forEach(La=>{const Ba=typeof La=="string"?R$5(La,ha,ma):La;Ba&&ja.push(Ba)}),ja}const ct$3={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function lt$4(pa,ha,ma,ja){const La=pa.resources.length,Ba=pa.random?Math.floor(Math.random()*La):pa.index;let hl;if(pa.random){let JE=pa.resources.slice(0);for(hl=[];JE.length>1;){const XE=Math.floor(Math.random()*JE.length);hl.push(JE[XE]),JE=JE.slice(0,XE).concat(JE.slice(XE+1))}hl=hl.concat(JE)}else hl=pa.resources.slice(Ba).concat(pa.resources.slice(0,Ba));const Gl=Date.now();let zl="pending",Wl=0,Kl,su=null,au=[],ou=[];typeof ja=="function"&&ou.push(ja);function $m(){su&&(clearTimeout(su),su=null)}function Nm(){zl==="pending"&&(zl="aborted"),$m(),au.forEach(JE=>{JE.status==="pending"&&(JE.status="aborted")}),au=[]}function Mm(JE,XE){XE&&(ou=[]),typeof JE=="function"&&ou.push(JE)}function Mg(){return{startTime:Gl,payload:ha,status:zl,queriesSent:Wl,queriesPending:au.length,subscribe:Mm,abort:Nm}}function ly(){zl="failed",ou.forEach(JE=>{JE(void 0,Kl)})}function uy(){au.forEach(JE=>{JE.status==="pending"&&(JE.status="aborted")}),au=[]}function GE(JE,XE,cN){const pN=XE!=="success";switch(au=au.filter(hN=>hN!==JE),zl){case"pending":break;case"failed":if(pN||!pa.dataAfterTimeout)return;break;default:return}if(XE==="abort"){Kl=cN,ly();return}if(pN){Kl=cN,au.length||(hl.length?YE():ly());return}if($m(),uy(),!pa.random){const hN=pa.resources.indexOf(JE.resource);hN!==-1&&hN!==pa.index&&(pa.index=hN)}zl="completed",ou.forEach(hN=>{hN(cN)})}function YE(){if(zl!=="pending")return;$m();const JE=hl.shift();if(JE===void 0){if(au.length){su=setTimeout(()=>{$m(),zl==="pending"&&(uy(),ly())},pa.timeout);return}ly();return}const XE={status:"pending",resource:JE,callback:(cN,pN)=>{GE(XE,cN,pN)}};au.push(XE),Wl++,su=setTimeout(YE,pa.rotate),ma(JE,ha,XE.callback)}return setTimeout(YE),Mg}function ye$5(pa){const ha={...ct$3,...pa};let ma=[];function ja(){ma=ma.filter(hl=>hl().status==="pending")}function La(hl,Gl,zl){const Wl=lt$4(ha,hl,Gl,(Kl,su)=>{ja(),zl&&zl(Kl,su)});return ma.push(Wl),Wl}function Ba(hl){return ma.find(Gl=>hl(Gl))||null}return{query:La,find:Ba,setIndex:hl=>{ha.index=hl},getIndex:()=>ha.index,cleanup:ja}}function ne$3(){}const q$7=Object.create(null);function at$4(pa){if(!q$7[pa]){const ha=J$7(pa);if(!ha)return;const ma=ye$5(ha),ja={config:ha,redundancy:ma};q$7[pa]=ja}return q$7[pa]}function ut$3(pa,ha,ma){let ja,La;if(typeof pa=="string"){const Ba=Q$7(pa);if(!Ba)return ma(void 0,424),ne$3;La=Ba.send;const hl=at$4(pa);hl&&(ja=hl.redundancy)}else{const Ba=G$7(pa);if(Ba){ja=ye$5(Ba);const hl=pa.resources?pa.resources[0]:"",Gl=Q$7(hl);Gl&&(La=Gl.send)}}return!ja||!La?(ma(void 0,424),ne$3):ja.query(ha,La,ma)().abort}function oe$3(){}function ft$2(pa){pa.iconsLoaderFlag||(pa.iconsLoaderFlag=!0,setTimeout(()=>{pa.iconsLoaderFlag=!1,nt$4(pa)}))}function dt$4(pa){const ha=[],ma=[];return pa.forEach(ja=>{(ja.match(he$4)?ha:ma).push(ja)}),{valid:ha,invalid:ma}}function j$d(pa,ha,ma){function ja(){const La=pa.pendingIcons;ha.forEach(Ba=>{La&&La.delete(Ba),pa.icons[Ba]||pa.missing.add(Ba)})}if(ma&&typeof ma=="object")try{if(!de$4(pa,ma).length){ja();return}}catch(La){console.error(La)}ja(),ft$2(pa)}function ie$5(pa,ha){pa instanceof Promise?pa.then(ma=>{ha(ma)}).catch(()=>{ha(null)}):ha(pa)}function ht$4(pa,ha){pa.iconsToLoad?pa.iconsToLoad=pa.iconsToLoad.concat(ha).sort():pa.iconsToLoad=ha,pa.iconsQueueFlag||(pa.iconsQueueFlag=!0,setTimeout(()=>{pa.iconsQueueFlag=!1;const{provider:ma,prefix:ja}=pa,La=pa.iconsToLoad;if(delete pa.iconsToLoad,!La||!La.length)return;const Ba=pa.loadIcon;if(pa.loadIcons&&(La.length>1||!Ba)){ie$5(pa.loadIcons(La,ja,ma),Wl=>{j$d(pa,La,Wl)});return}if(Ba){La.forEach(Wl=>{const Kl=Ba(Wl,ja,ma);ie$5(Kl,su=>{const au=su?{prefix:ja,icons:{[Wl]:su}}:null;j$d(pa,[Wl],au)})});return}const{valid:hl,invalid:Gl}=dt$4(La);if(Gl.length&&j$d(pa,Gl,null),!hl.length)return;const zl=ja.match(he$4)?Q$7(ma):null;if(!zl){j$d(pa,hl,null);return}zl.prepare(ma,ja,hl).forEach(Wl=>{ut$3(ma,Wl,Kl=>{j$d(pa,Wl.icons,Kl)})})}))}const pt$4=(pa,ha)=>{const ma=st$4(pa,!0,pe$4()),ja=rt$4(ma);if(!ja.pending.length){let zl=!0;return ha&&setTimeout(()=>{zl&&ha(ja.loaded,ja.missing,ja.pending,oe$3)}),()=>{zl=!1}}const La=Object.create(null),Ba=[];let hl,Gl;return ja.pending.forEach(zl=>{const{provider:Wl,prefix:Kl}=zl;if(Kl===Gl&&Wl===hl)return;hl=Wl,Gl=Kl,Ba.push(T$d(Wl,Kl));const su=La[Wl]||(La[Wl]=Object.create(null));su[Kl]||(su[Kl]=[])}),ja.pending.forEach(zl=>{const{provider:Wl,prefix:Kl,name:su}=zl,au=T$d(Wl,Kl),ou=au.pendingIcons||(au.pendingIcons=new Set);ou.has(su)||(ou.add(su),La[Wl][Kl].push(su))}),Ba.forEach(zl=>{const Wl=La[zl.provider][zl.prefix];Wl.length&&ht$4(zl,Wl)}),ha?it$3(ha,ja,Ba):oe$3};function gt$5(pa,ha){const ma={...pa};for(const ja in ha){const La=ha[ja],Ba=typeof La;ja in ge$5?(La===null||La&&(Ba==="string"||Ba==="number"))&&(ma[ja]=La):Ba===typeof ma[ja]&&(ma[ja]=ja==="rotate"?La%4:La)}return ma}const mt$4=/[\s,]+/;function bt$2(pa,ha){ha.split(mt$4).forEach(ma=>{switch(ma.trim()){case"horizontal":pa.hFlip=!0;break;case"vertical":pa.vFlip=!0;break}})}function yt$4(pa,ha=0){const ma=pa.replace(/^-?[0-9.]*/,"");function ja(La){for(;La<0;)La+=4;return La%4}if(ma===""){const La=parseInt(pa);return isNaN(La)?0:ja(La)}else if(ma!==pa){let La=0;switch(ma){case"%":La=25;break;case"deg":La=90}if(La){let Ba=parseFloat(pa.slice(0,pa.length-ma.length));return isNaN(Ba)?0:(Ba=Ba/La,Ba%1===0?ja(Ba):0)}}return ha}function xt$3(pa,ha){let ma=pa.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const ja in ha)ma+=" "+ja+'="'+ha[ja]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+ma+">"+pa+"</svg>"}function vt$4(pa){return pa.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function wt$4(pa){return"data:image/svg+xml,"+vt$4(pa)}function kt$3(pa){return'url("'+wt$4(pa)+'")'}let A$b;function It$4(){try{A$b=window.trustedTypes.createPolicy("iconify",{createHTML:pa=>pa})}catch{A$b=null}}function St$3(pa){return A$b===void 0&&It$4(),A$b?A$b.createHTML(pa):pa}const xe$3={...me$3,inline:!1},Nt$2={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Tt$3={display:"inline-block"},V$9={backgroundColor:"currentColor"},ve$4={backgroundColor:"transparent"},re$4={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},se$4={WebkitMask:V$9,mask:V$9,background:ve$4};for(const pa in se$4){const ha=se$4[pa];for(const ma in re$4)ha[pa+ma]=re$4[ma]}const Pt$4={...xe$3,inline:!0};function ce$4(pa){return pa+(pa.match(/^[-0-9.]+$/)?"px":"")}const Ct$4=(pa,ha,ma)=>{const ja=ha.inline?Pt$4:xe$3,La=gt$5(ja,ha),Ba=ha.mode||"svg",hl={},Gl=ha.style||{},zl={...Ba==="svg"?Nt$2:{}};if(ma){const Mm=R$5(ma,!1,!0);if(Mm){const Mg=["iconify"],ly=["provider","prefix"];for(const uy of ly)Mm[uy]&&Mg.push("iconify--"+Mm[uy]);zl.className=Mg.join(" ")}}for(let Mm in ha){const Mg=ha[Mm];if(Mg!==void 0)switch(Mm){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":zl.ref=Mg;break;case"className":zl[Mm]=(zl[Mm]?zl[Mm]+" ":"")+Mg;break;case"inline":case"hFlip":case"vFlip":La[Mm]=Mg===!0||Mg==="true"||Mg===1;break;case"flip":typeof Mg=="string"&&bt$2(La,Mg);break;case"color":hl.color=Mg;break;case"rotate":typeof Mg=="string"?La[Mm]=yt$4(Mg):typeof Mg=="number"&&(La[Mm]=Mg);break;case"ariaHidden":case"aria-hidden":Mg!==!0&&Mg!=="true"&&delete zl["aria-hidden"];break;default:ja[Mm]===void 0&&(zl[Mm]=Mg)}}const Wl=$e$1(pa,La),Kl=Wl.attributes;if(La.inline&&(hl.verticalAlign="-0.125em"),Ba==="svg"){zl.style={...hl,...Gl},Object.assign(zl,Kl);let Mm=0,Mg=ha.id;return typeof Mg=="string"&&(Mg=Mg.replace(/-/g,"_")),zl.dangerouslySetInnerHTML={__html:St$3(Be$2(Wl.body,Mg?()=>Mg+"ID"+Mm++:"iconifyReact"))},reactExports.createElement("svg",zl)}const{body:su,width:au,height:ou}=pa,$m=Ba==="mask"||(Ba==="bg"?!1:su.indexOf("currentColor")!==-1),Nm=xt$3(su,{...Kl,width:au+"",height:ou+""});return zl.style={...hl,"--svg":kt$3(Nm),width:ce$4(Kl.width),height:ce$4(Kl.height),...Tt$3,...$m?V$9:ve$4,...Gl},reactExports.createElement("span",zl)};pe$4(!0);Ge$3("",tt$3);if(typeof document<"u"&&typeof window<"u"){const pa=window;if(pa.IconifyPreload!==void 0){const ha=pa.IconifyPreload,ma="Invalid IconifyPreload syntax.";typeof ha=="object"&&ha!==null&&(ha instanceof Array?ha:[ha]).forEach(ja=>{try{(typeof ja!="object"||ja===null||ja instanceof Array||typeof ja.icons!="object"||typeof ja.prefix!="string"||!Me$3(ja))&&console.error(ma)}catch{console.error(ma)}})}if(pa.IconifyProviders!==void 0){const ha=pa.IconifyProviders;if(typeof ha=="object"&&ha!==null)for(let ma in ha){const ja="IconifyProviders["+ma+"] is invalid.";try{const La=ha[ma];if(typeof La!="object"||!La||La.resources===void 0)continue;We$2(ma,La)||console.error(ja)}catch{console.error(ja)}}}}function we$5(pa){const[ha,ma]=reactExports.useState(!!pa.ssr),[ja,La]=reactExports.useState({});function Ba(ou){if(ou){const $m=pa.icon;if(typeof $m=="object")return{name:"",data:$m};const Nm=Z$8($m);if(Nm)return{name:$m,data:Nm}}return{name:""}}const[hl,Gl]=reactExports.useState(Ba(!!pa.ssr));function zl(){const ou=ja.callback;ou&&(ou(),La({}))}function Wl(ou){if(JSON.stringify(hl)!==JSON.stringify(ou))return zl(),Gl(ou),!0}function Kl(){var ou;const $m=pa.icon;if(typeof $m=="object"){Wl({name:"",data:$m});return}const Nm=Z$8($m);if(Wl({name:$m,data:Nm}))if(Nm===void 0){const Mm=pt$4([$m],Kl);La({callback:Mm})}else Nm&&((ou=pa.onLoad)===null||ou===void 0||ou.call(pa,$m))}reactExports.useEffect(()=>(ma(!0),zl),[]),reactExports.useEffect(()=>{ha&&Kl()},[pa.icon,ha]);const{name:su,data:au}=hl;return au?Ct$4({...B$a,...au},pa,su):pa.children?pa.children:pa.fallback?pa.fallback:reactExports.createElement("span",{})}const ke$5=reactExports.forwardRef((pa,ha)=>we$5({...pa,_ref:ha}));reactExports.forwardRef((pa,ha)=>we$5({inline:!0,...pa,_ref:ha}));const Ie$3={git:"tabler:brand-github-filled",google:"devicon:google",microsoft:"logos:microsoft-icon",linkedin:"devicon:linkedin"},Ot$3={setting:"tabler:settings",checkbox:"mdi:checkbox-blank-outline",checkboxSelected:"mdi:checkbox-marked",entity:"bi:card-list",logout:"tabler:logout",drag:"icon-park-outline:drag",agent:"fluent:bot-sparkle-24-regular",llm:"hugeicons:ai-brain-05",error:"material-symbols:error",input:"ph:arrow-circle-down-left-bold",output:"ph:arrow-circle-up-right-bold",plan:"icon-park-outline:plan",instruction:"octicon:checklist-24",tool:"tabler:tool"};function Ft$4(pa){return pa.charAt(0).toUpperCase()+pa.slice(1)}const Lt$3=pa=>{const ha=pa.split("/").filter(Boolean),ma=ha[ha.length-1];return{pathParts:ha,renderPath:ma}},Mt$4=pa=>pa==="edit"||pa==="new",Se$3=()=>{const pa=useNavigate(),{pathname:ha}=useLocation(),ma=useParams();return{customNavigate:ja=>{if(ha.includes("/design/ui/")){const La=ha.split("/"),Ba=La.findIndex(hl=>hl==="ui");if(Ba!==-1){const hl=`${La.slice(0,Ba+4).join("/")}${ja}`;pa(hl)}else pa(ja)}else pa(ja)},params:ma}},Dt$3=({navigationItems:pa,schema:ha})=>{const{customNavigate:ma}=Se$3();return!ha||!ha.header||!ha.socialNetworks||!ha.form?null:jsxRuntimeExports.jsxs("div",{className:"auth-screen",children:[jsxRuntimeExports.jsxs("div",{className:"auth-header",children:[jsxRuntimeExports.jsx("div",{className:"title",children:ha.header.title}),ha.header.subTitle&&jsxRuntimeExports.jsx("div",{className:"subtitle",children:ha.header.subTitle})]}),jsxRuntimeExports.jsxs("form",{className:"auth-form",onSubmit:ja=>{ja.preventDefault(),ma("/dashboard")},children:[jsxRuntimeExports.jsx("div",{children:ha.socialNetworks.label}),jsxRuntimeExports.jsx("div",{className:"auth-social-networks",children:ha.socialNetworks.icons.map(ja=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(ke$5,{icon:Ie$3[ja],className:"w-6 h-6"})},ja))}),jsxRuntimeExports.jsxs("div",{className:"auth-separator",children:[jsxRuntimeExports.jsx("div",{className:"fx-divider"}),jsxRuntimeExports.jsx("div",{children:"OR"}),jsxRuntimeExports.jsx("div",{className:"fx-divider"})]}),jsxRuntimeExports.jsx("input",{type:"email",placeholder:ha.form.placeholder.email}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:ha.form.placeholder.password}),jsxRuntimeExports.jsx("button",{type:"submit",className:"fx-button w-full",children:"Sign In"}),jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:["Don't have an account ?"," ",jsxRuntimeExports.jsx("span",{className:"auth-link",onClick:()=>ma("/signup"),children:"Create an account"})]})]})]})},Ut$2=({schema:pa})=>{const{customNavigate:ha}=Se$3();return!pa||!pa.header||!pa.socialNetworks||!pa.form?null:jsxRuntimeExports.jsxs("div",{className:"auth-screen",children:[jsxRuntimeExports.jsxs("div",{className:"auth-header",children:[jsxRuntimeExports.jsx("div",{className:"title",children:pa.header.title}),pa.header.subTitle&&jsxRuntimeExports.jsx("div",{className:"subtitle",children:pa.header.subTitle})]}),jsxRuntimeExports.jsxs("form",{className:"auth-form",children:[jsxRuntimeExports.jsx("div",{children:pa.socialNetworks.label}),jsxRuntimeExports.jsx("div",{className:"auth-social-networks",children:pa.socialNetworks.icons.map(ma=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(ke$5,{icon:Ie$3[ma],className:"w-6 h-6"})},ma))}),jsxRuntimeExports.jsxs("div",{className:"auth-separator",children:[jsxRuntimeExports.jsx("div",{className:"fx-divider"}),jsxRuntimeExports.jsx("div",{children:"OR"}),jsxRuntimeExports.jsx("div",{className:"fx-divider"})]}),jsxRuntimeExports.jsx("input",{type:"email",placeholder:pa.form.placeholder.email}),jsxRuntimeExports.jsx("input",{type:"text",placeholder:pa.form.placeholder.username}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:pa.form.placeholder.password}),jsxRuntimeExports.jsx("input",{type:"password",placeholder:pa.form.placeholder.confirmPassword}),jsxRuntimeExports.jsx("button",{type:"submit",className:"fx-button w-full",children:"Create Account"}),jsxRuntimeExports.jsxs("div",{children:["Already have an account ?"," ",jsxRuntimeExports.jsx("span",{className:"auth-link",onClick:()=>ha("/"),children:"Sign In"})]})]})]})};var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(pa){return this.listeners.add(pa),this.onSubscribe(),()=>{this.listeners.delete(pa),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},defaultTimeoutProvider={setTimeout:(pa,ha)=>setTimeout(pa,ha),clearTimeout:pa=>clearTimeout(pa),setInterval:(pa,ha)=>setInterval(pa,ha),clearInterval:pa=>clearInterval(pa)},TimeoutManager=class{#e=defaultTimeoutProvider;#t=!1;setTimeoutProvider(pa){this.#e=pa}setTimeout(pa,ha){return this.#e.setTimeout(pa,ha)}clearTimeout(pa){this.#e.clearTimeout(pa)}setInterval(pa,ha){return this.#e.setInterval(pa,ha)}clearInterval(pa){this.#e.clearInterval(pa)}},timeoutManager=new TimeoutManager;function systemSetTimeoutZero(pa){setTimeout(pa,0)}var isServer=typeof window>"u"||"Deno"in globalThis;function noop$b(){}function functionalUpdate(pa,ha){return typeof pa=="function"?pa(ha):pa}function isValidTimeout(pa){return typeof pa=="number"&&pa>=0&&pa!==1/0}function timeUntilStale(pa,ha){return Math.max(pa+(ha||0)-Date.now(),0)}function resolveStaleTime(pa,ha){return typeof pa=="function"?pa(ha):pa}function resolveEnabled(pa,ha){return typeof pa=="function"?pa(ha):pa}function matchQuery(pa,ha){const{type:ma="all",exact:ja,fetchStatus:La,predicate:Ba,queryKey:hl,stale:Gl}=pa;if(hl){if(ja){if(ha.queryHash!==hashQueryKeyByOptions(hl,ha.options))return!1}else if(!partialMatchKey(ha.queryKey,hl))return!1}if(ma!=="all"){const zl=ha.isActive();if(ma==="active"&&!zl||ma==="inactive"&&zl)return!1}return!(typeof Gl=="boolean"&&ha.isStale()!==Gl||La&&La!==ha.state.fetchStatus||Ba&&!Ba(ha))}function matchMutation(pa,ha){const{exact:ma,status:ja,predicate:La,mutationKey:Ba}=pa;if(Ba){if(!ha.options.mutationKey)return!1;if(ma){if(hashKey(ha.options.mutationKey)!==hashKey(Ba))return!1}else if(!partialMatchKey(ha.options.mutationKey,Ba))return!1}return!(ja&&ha.state.status!==ja||La&&!La(ha))}function hashQueryKeyByOptions(pa,ha){return(ha?.queryKeyHashFn||hashKey)(pa)}function hashKey(pa){return JSON.stringify(pa,(ha,ma)=>isPlainObject$3(ma)?Object.keys(ma).sort().reduce((ja,La)=>(ja[La]=ma[La],ja),{}):ma)}function partialMatchKey(pa,ha){return pa===ha?!0:typeof pa!=typeof ha?!1:pa&&ha&&typeof pa=="object"&&typeof ha=="object"?Object.keys(ha).every(ma=>partialMatchKey(pa[ma],ha[ma])):!1}var hasOwn$4=Object.prototype.hasOwnProperty;function replaceEqualDeep(pa,ha){if(pa===ha)return pa;const ma=isPlainArray(pa)&&isPlainArray(ha);if(!ma&&!(isPlainObject$3(pa)&&isPlainObject$3(ha)))return ha;const La=(ma?pa:Object.keys(pa)).length,Ba=ma?ha:Object.keys(ha),hl=Ba.length,Gl=ma?new Array(hl):{};let zl=0;for(let Wl=0;Wl<hl;Wl++){const Kl=ma?Wl:Ba[Wl],su=pa[Kl],au=ha[Kl];if(su===au){Gl[Kl]=su,(ma?Wl<La:hasOwn$4.call(pa,Kl))&&zl++;continue}if(su===null||au===null||typeof su!="object"||typeof au!="object"){Gl[Kl]=au;continue}const ou=replaceEqualDeep(su,au);Gl[Kl]=ou,ou===su&&zl++}return La===hl&&zl===La?pa:Gl}function shallowEqualObjects$1(pa,ha){if(!ha||Object.keys(pa).length!==Object.keys(ha).length)return!1;for(const ma in pa)if(pa[ma]!==ha[ma])return!1;return!0}function isPlainArray(pa){return Array.isArray(pa)&&pa.length===Object.keys(pa).length}function isPlainObject$3(pa){if(!hasObjectPrototype(pa))return!1;const ha=pa.constructor;if(ha===void 0)return!0;const ma=ha.prototype;return!(!hasObjectPrototype(ma)||!ma.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(pa)!==Object.prototype)}function hasObjectPrototype(pa){return Object.prototype.toString.call(pa)==="[object Object]"}function sleep$4(pa){return new Promise(ha=>{timeoutManager.setTimeout(ha,pa)})}function replaceData(pa,ha,ma){return typeof ma.structuralSharing=="function"?ma.structuralSharing(pa,ha):ma.structuralSharing!==!1?replaceEqualDeep(pa,ha):ha}function addToEnd(pa,ha,ma=0){const ja=[...pa,ha];return ma&&ja.length>ma?ja.slice(1):ja}function addToStart(pa,ha,ma=0){const ja=[ha,...pa];return ma&&ja.length>ma?ja.slice(0,-1):ja}var skipToken=Symbol();function ensureQueryFn(pa,ha){return!pa.queryFn&&ha?.initialPromise?()=>ha.initialPromise:!pa.queryFn||pa.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${pa.queryHash}'`)):pa.queryFn}function shouldThrowError(pa,ha){return typeof pa=="function"?pa(...ha):!!pa}var FocusManager=class extends Subscribable{#e;#t;#r;constructor(){super(),this.#r=pa=>{if(!isServer&&window.addEventListener){const ha=()=>pa();return window.addEventListener("visibilitychange",ha,!1),()=>{window.removeEventListener("visibilitychange",ha)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(pa){this.#r=pa,this.#t?.(),this.#t=pa(ha=>{typeof ha=="boolean"?this.setFocused(ha):this.onFocus()})}setFocused(pa){this.#e!==pa&&(this.#e=pa,this.onFocus())}onFocus(){const pa=this.isFocused();this.listeners.forEach(ha=>{ha(pa)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},focusManager=new FocusManager;function pendingThenable(){let pa,ha;const ma=new Promise((La,Ba)=>{pa=La,ha=Ba});ma.status="pending",ma.catch(()=>{});function ja(La){Object.assign(ma,La),delete ma.resolve,delete ma.reject}return ma.resolve=La=>{ja({status:"fulfilled",value:La}),pa(La)},ma.reject=La=>{ja({status:"rejected",reason:La}),ha(La)},ma}function tryResolveSync(pa){let ha;if(pa.then(ma=>(ha=ma,ma),noop$b)?.catch(noop$b),ha!==void 0)return{data:ha}}function defaultTransformerFn(pa){return pa}function dehydrateMutation(pa){return{mutationKey:pa.options.mutationKey,state:pa.state,...pa.options.scope&&{scope:pa.options.scope},...pa.meta&&{meta:pa.meta}}}function dehydrateQuery(pa,ha,ma){const ja=()=>{const La=pa.promise?.then(ha).catch(Ba=>ma(Ba)?Promise.reject(new Error("redacted")):Promise.reject(Ba));return La?.catch(noop$b),La};return{dehydratedAt:Date.now(),state:{...pa.state,...pa.state.data!==void 0&&{data:ha(pa.state.data)}},queryKey:pa.queryKey,queryHash:pa.queryHash,...pa.state.status==="pending"&&{promise:ja()},...pa.meta&&{meta:pa.meta}}}function defaultShouldDehydrateMutation(pa){return pa.state.isPaused}function defaultShouldDehydrateQuery(pa){return pa.state.status==="success"}function defaultShouldRedactErrors(pa){return!0}function dehydrate(pa,ha={}){const ma=ha.shouldDehydrateMutation??pa.getDefaultOptions().dehydrate?.shouldDehydrateMutation??defaultShouldDehydrateMutation,ja=pa.getMutationCache().getAll().flatMap(zl=>ma(zl)?[dehydrateMutation(zl)]:[]),La=ha.shouldDehydrateQuery??pa.getDefaultOptions().dehydrate?.shouldDehydrateQuery??defaultShouldDehydrateQuery,Ba=ha.shouldRedactErrors??pa.getDefaultOptions().dehydrate?.shouldRedactErrors??defaultShouldRedactErrors,hl=ha.serializeData??pa.getDefaultOptions().dehydrate?.serializeData??defaultTransformerFn,Gl=pa.getQueryCache().getAll().flatMap(zl=>La(zl)?[dehydrateQuery(zl,hl,Ba)]:[]);return{mutations:ja,queries:Gl}}function hydrate(pa,ha,ma){if(typeof ha!="object"||ha===null)return;const ja=pa.getMutationCache(),La=pa.getQueryCache(),Ba=ma?.defaultOptions?.deserializeData??pa.getDefaultOptions().hydrate?.deserializeData??defaultTransformerFn,hl=ha.mutations||[],Gl=ha.queries||[];hl.forEach(({state:zl,...Wl})=>{ja.build(pa,{...pa.getDefaultOptions().hydrate?.mutations,...ma?.defaultOptions?.mutations,...Wl},zl)}),Gl.forEach(({queryKey:zl,state:Wl,queryHash:Kl,meta:su,promise:au,dehydratedAt:ou})=>{const $m=au?tryResolveSync(au):void 0,Nm=Wl.data===void 0?$m?.data:Wl.data,Mm=Nm===void 0?Nm:Ba(Nm);let Mg=La.get(Kl);const ly=Mg?.state.status==="pending",uy=Mg?.state.fetchStatus==="fetching";if(Mg){const GE=$m&&ou!==void 0&&ou>Mg.state.dataUpdatedAt;if(Wl.dataUpdatedAt>Mg.state.dataUpdatedAt||GE){const{fetchStatus:YE,...JE}=Wl;Mg.setState({...JE,data:Mm})}}else Mg=La.build(pa,{...pa.getDefaultOptions().hydrate?.queries,...ma?.defaultOptions?.queries,queryKey:zl,queryHash:Kl,meta:su},{...Wl,data:Mm,fetchStatus:"idle",status:Mm!==void 0?"success":Wl.status});au&&!ly&&!uy&&(ou===void 0||ou>Mg.state.dataUpdatedAt)&&Mg.fetch(void 0,{initialPromise:Promise.resolve(au).then(Ba)}).catch(noop$b)})}var defaultScheduler=systemSetTimeoutZero;function createNotifyManager(){let pa=[],ha=0,ma=Gl=>{Gl()},ja=Gl=>{Gl()},La=defaultScheduler;const Ba=Gl=>{ha?pa.push(Gl):La(()=>{ma(Gl)})},hl=()=>{const Gl=pa;pa=[],Gl.length&&La(()=>{ja(()=>{Gl.forEach(zl=>{ma(zl)})})})};return{batch:Gl=>{let zl;ha++;try{zl=Gl()}finally{ha--,ha||hl()}return zl},batchCalls:Gl=>(...zl)=>{Ba(()=>{Gl(...zl)})},schedule:Ba,setNotifyFunction:Gl=>{ma=Gl},setBatchNotifyFunction:Gl=>{ja=Gl},setScheduler:Gl=>{La=Gl}}}var notifyManager=createNotifyManager(),OnlineManager=class extends Subscribable{#e=!0;#t;#r;constructor(){super(),this.#r=pa=>{if(!isServer&&window.addEventListener){const ha=()=>pa(!0),ma=()=>pa(!1);return window.addEventListener("online",ha,!1),window.addEventListener("offline",ma,!1),()=>{window.removeEventListener("online",ha),window.removeEventListener("offline",ma)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(pa){this.#r=pa,this.#t?.(),this.#t=pa(this.setOnline.bind(this))}setOnline(pa){this.#e!==pa&&(this.#e=pa,this.listeners.forEach(ma=>{ma(pa)}))}isOnline(){return this.#e}},onlineManager=new OnlineManager;function defaultRetryDelay(pa){return Math.min(1e3*2**pa,3e4)}function canFetch(pa){return(pa??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(pa){super("CancelledError"),this.revert=pa?.revert,this.silent=pa?.silent}};function createRetryer(pa){let ha=!1,ma=0,ja;const La=pendingThenable(),Ba=()=>La.status!=="pending",hl=Nm=>{if(!Ba()){const Mm=new CancelledError(Nm);au(Mm),pa.onCancel?.(Mm)}},Gl=()=>{ha=!0},zl=()=>{ha=!1},Wl=()=>focusManager.isFocused()&&(pa.networkMode==="always"||onlineManager.isOnline())&&pa.canRun(),Kl=()=>canFetch(pa.networkMode)&&pa.canRun(),su=Nm=>{Ba()||(ja?.(),La.resolve(Nm))},au=Nm=>{Ba()||(ja?.(),La.reject(Nm))},ou=()=>new Promise(Nm=>{ja=Mm=>{(Ba()||Wl())&&Nm(Mm)},pa.onPause?.()}).then(()=>{ja=void 0,Ba()||pa.onContinue?.()}),$m=()=>{if(Ba())return;let Nm;const Mm=ma===0?pa.initialPromise:void 0;try{Nm=Mm??pa.fn()}catch(Mg){Nm=Promise.reject(Mg)}Promise.resolve(Nm).then(su).catch(Mg=>{if(Ba())return;const ly=pa.retry??(isServer?0:3),uy=pa.retryDelay??defaultRetryDelay,GE=typeof uy=="function"?uy(ma,Mg):uy,YE=ly===!0||typeof ly=="number"&&ma<ly||typeof ly=="function"&&ly(ma,Mg);if(ha||!YE){au(Mg);return}ma++,pa.onFail?.(ma,Mg),sleep$4(GE).then(()=>Wl()?void 0:ou()).then(()=>{ha?au(Mg):$m()})})};return{promise:La,status:()=>La.status,cancel:hl,continue:()=>(ja?.(),La),cancelRetry:Gl,continueRetry:zl,canStart:Kl,start:()=>(Kl()?$m():ou().then($m),La)}}var Removable=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&(this.#e=timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(pa){this.gcTime=Math.max(this.gcTime||0,pa??(isServer?1/0:300*1e3))}clearGcTimeout(){this.#e&&(timeoutManager.clearTimeout(this.#e),this.#e=void 0)}},Query$1=class extends Removable{#e;#t;#r;#n;#s;#o;#i;constructor(ha){super(),this.#i=!1,this.#o=ha.defaultOptions,this.setOptions(ha.options),this.observers=[],this.#n=ha.client,this.#r=this.#n.getQueryCache(),this.queryKey=ha.queryKey,this.queryHash=ha.queryHash,this.#e=getDefaultState$2(this.options),this.state=ha.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(ha){if(this.options={...this.#o,...ha},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const ma=getDefaultState$2(this.options);ma.data!==void 0&&(this.setState(successState(ma.data,ma.dataUpdatedAt)),this.#e=ma)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(ha,ma){const ja=replaceData(this.state.data,ha,this.options);return this.#a({data:ja,type:"success",dataUpdatedAt:ma?.updatedAt,manual:ma?.manual}),ja}setState(ha,ma){this.#a({type:"setState",state:ha,setStateOptions:ma})}cancel(ha){const ma=this.#s?.promise;return this.#s?.cancel(ha),ma?ma.then(noop$b).catch(noop$b):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(ha=>resolveEnabled(ha.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(ha=>resolveStaleTime(ha.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(ha=>ha.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(ha=0){return this.state.data===void 0?!0:ha==="static"?!1:this.state.isInvalidated?!0:!timeUntilStale(this.state.dataUpdatedAt,ha)}onFocus(){this.observers.find(ma=>ma.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(ma=>ma.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(ha){this.observers.includes(ha)||(this.observers.push(ha),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:ha}))}removeObserver(ha){this.observers.includes(ha)&&(this.observers=this.observers.filter(ma=>ma!==ha),this.observers.length||(this.#s&&(this.#i?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:ha}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}async fetch(ha,ma){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&ma?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(ha&&this.setOptions(ha),!this.options.queryFn){const zl=this.observers.find(Wl=>Wl.options.queryFn);zl&&this.setOptions(zl.options)}const ja=new AbortController,La=zl=>{Object.defineProperty(zl,"signal",{enumerable:!0,get:()=>(this.#i=!0,ja.signal)})},Ba=()=>{const zl=ensureQueryFn(this.options,ma),Kl=(()=>{const su={client:this.#n,queryKey:this.queryKey,meta:this.meta};return La(su),su})();return this.#i=!1,this.options.persister?this.options.persister(zl,Kl,this):zl(Kl)},Gl=(()=>{const zl={fetchOptions:ma,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:Ba};return La(zl),zl})();this.options.behavior?.onFetch(Gl,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==Gl.fetchOptions?.meta)&&this.#a({type:"fetch",meta:Gl.fetchOptions?.meta}),this.#s=createRetryer({initialPromise:ma?.initialPromise,fn:Gl.fetchFn,onCancel:zl=>{zl instanceof CancelledError&&zl.revert&&this.setState({...this.#t,fetchStatus:"idle"}),ja.abort()},onFail:(zl,Wl)=>{this.#a({type:"failed",failureCount:zl,error:Wl})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:Gl.options.retry,retryDelay:Gl.options.retryDelay,networkMode:Gl.options.networkMode,canRun:()=>!0});try{const zl=await this.#s.start();if(zl===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(zl),this.#r.config.onSuccess?.(zl,this),this.#r.config.onSettled?.(zl,this.state.error,this),zl}catch(zl){if(zl instanceof CancelledError){if(zl.silent)return this.#s.promise;if(zl.revert){if(this.state.data===void 0)throw zl;return this.state.data}}throw this.#a({type:"error",error:zl}),this.#r.config.onError?.(zl,this),this.#r.config.onSettled?.(this.state.data,zl,this),zl}finally{this.scheduleGc()}}#a(ha){const ma=ja=>{switch(ha.type){case"failed":return{...ja,fetchFailureCount:ha.failureCount,fetchFailureReason:ha.error};case"pause":return{...ja,fetchStatus:"paused"};case"continue":return{...ja,fetchStatus:"fetching"};case"fetch":return{...ja,...fetchState(ja.data,this.options),fetchMeta:ha.meta??null};case"success":const La={...ja,...successState(ha.data,ha.dataUpdatedAt),dataUpdateCount:ja.dataUpdateCount+1,...!ha.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=ha.manual?La:void 0,La;case"error":const Ba=ha.error;return{...ja,error:Ba,errorUpdateCount:ja.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:ja.fetchFailureCount+1,fetchFailureReason:Ba,fetchStatus:"idle",status:"error"};case"invalidate":return{...ja,isInvalidated:!0};case"setState":return{...ja,...ha.state}}};this.state=ma(this.state),notifyManager.batch(()=>{this.observers.forEach(ja=>{ja.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:ha})})}};function fetchState(pa,ha){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(ha.networkMode)?"fetching":"paused",...pa===void 0&&{error:null,status:"pending"}}}function successState(pa,ha){return{data:pa,dataUpdatedAt:ha??Date.now(),error:null,isInvalidated:!1,status:"success"}}function getDefaultState$2(pa){const ha=typeof pa.initialData=="function"?pa.initialData():pa.initialData,ma=ha!==void 0,ja=ma?typeof pa.initialDataUpdatedAt=="function"?pa.initialDataUpdatedAt():pa.initialDataUpdatedAt:0;return{data:ha,dataUpdateCount:0,dataUpdatedAt:ma?ja??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:ma?"success":"pending",fetchStatus:"idle"}}var QueryObserver=class extends Subscribable{constructor(pa,ha){super(),this.options=ha,this.#e=pa,this.#a=null,this.#i=pendingThenable(),this.bindMethods(),this.setOptions(ha)}#e;#t=void 0;#r=void 0;#n=void 0;#s;#o;#i;#a;#l;#p;#c;#h;#u;#d;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),shouldFetchOnMount(this.#t,this.options)?this.#f():this.updateResult(),this.#_())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#$(),this.#g(),this.#t.removeObserver(this)}setOptions(pa){const ha=this.options,ma=this.#t;if(this.options=this.#e.defaultQueryOptions(pa),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),ha._defaulted&&!shallowEqualObjects$1(this.options,ha)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const ja=this.hasListeners();ja&&shouldFetchOptionally(this.#t,ma,this.options,ha)&&this.#f(),this.updateResult(),ja&&(this.#t!==ma||resolveEnabled(this.options.enabled,this.#t)!==resolveEnabled(ha.enabled,this.#t)||resolveStaleTime(this.options.staleTime,this.#t)!==resolveStaleTime(ha.staleTime,this.#t))&&this.#v();const La=this.#E();ja&&(this.#t!==ma||resolveEnabled(this.options.enabled,this.#t)!==resolveEnabled(ha.enabled,this.#t)||La!==this.#d)&&this.#b(La)}getOptimisticResult(pa){const ha=this.#e.getQueryCache().build(this.#e,pa),ma=this.createResult(ha,pa);return shouldAssignObserverCurrentProperties(this,ma)&&(this.#n=ma,this.#o=this.options,this.#s=this.#t.state),ma}getCurrentResult(){return this.#n}trackResult(pa,ha){return new Proxy(pa,{get:(ma,ja)=>(this.trackProp(ja),ha?.(ja),ja==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(ma,ja))})}trackProp(pa){this.#m.add(pa)}getCurrentQuery(){return this.#t}refetch({...pa}={}){return this.fetch({...pa})}fetchOptimistic(pa){const ha=this.#e.defaultQueryOptions(pa),ma=this.#e.getQueryCache().build(this.#e,ha);return ma.fetch().then(()=>this.createResult(ma,ha))}fetch(pa){return this.#f({...pa,cancelRefetch:pa.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(pa){this.#x();let ha=this.#t.fetch(this.options,pa);return pa?.throwOnError||(ha=ha.catch(noop$b)),ha}#v(){this.#$();const pa=resolveStaleTime(this.options.staleTime,this.#t);if(isServer||this.#n.isStale||!isValidTimeout(pa))return;const ma=timeUntilStale(this.#n.dataUpdatedAt,pa)+1;this.#h=timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},ma)}#E(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#b(pa){this.#g(),this.#d=pa,!(isServer||resolveEnabled(this.options.enabled,this.#t)===!1||!isValidTimeout(this.#d)||this.#d===0)&&(this.#u=timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&this.#f()},this.#d))}#_(){this.#v(),this.#b(this.#E())}#$(){this.#h&&(timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#g(){this.#u&&(timeoutManager.clearInterval(this.#u),this.#u=void 0)}createResult(pa,ha){const ma=this.#t,ja=this.options,La=this.#n,Ba=this.#s,hl=this.#o,zl=pa!==ma?pa.state:this.#r,{state:Wl}=pa;let Kl={...Wl},su=!1,au;if(ha._optimisticResults){const cN=this.hasListeners(),pN=!cN&&shouldFetchOnMount(pa,ha),hN=cN&&shouldFetchOptionally(pa,ma,ha,ja);(pN||hN)&&(Kl={...Kl,...fetchState(Wl.data,pa.options)}),ha._optimisticResults==="isRestoring"&&(Kl.fetchStatus="idle")}let{error:ou,errorUpdatedAt:$m,status:Nm}=Kl;au=Kl.data;let Mm=!1;if(ha.placeholderData!==void 0&&au===void 0&&Nm==="pending"){let cN;La?.isPlaceholderData&&ha.placeholderData===hl?.placeholderData?(cN=La.data,Mm=!0):cN=typeof ha.placeholderData=="function"?ha.placeholderData(this.#c?.state.data,this.#c):ha.placeholderData,cN!==void 0&&(Nm="success",au=replaceData(La?.data,cN,ha),su=!0)}if(ha.select&&au!==void 0&&!Mm)if(La&&au===Ba?.data&&ha.select===this.#l)au=this.#p;else try{this.#l=ha.select,au=ha.select(au),au=replaceData(La?.data,au,ha),this.#p=au,this.#a=null}catch(cN){this.#a=cN}this.#a&&(ou=this.#a,au=this.#p,$m=Date.now(),Nm="error");const Mg=Kl.fetchStatus==="fetching",ly=Nm==="pending",uy=Nm==="error",GE=ly&&Mg,YE=au!==void 0,XE={status:Nm,fetchStatus:Kl.fetchStatus,isPending:ly,isSuccess:Nm==="success",isError:uy,isInitialLoading:GE,isLoading:GE,data:au,dataUpdatedAt:Kl.dataUpdatedAt,error:ou,errorUpdatedAt:$m,failureCount:Kl.fetchFailureCount,failureReason:Kl.fetchFailureReason,errorUpdateCount:Kl.errorUpdateCount,isFetched:Kl.dataUpdateCount>0||Kl.errorUpdateCount>0,isFetchedAfterMount:Kl.dataUpdateCount>zl.dataUpdateCount||Kl.errorUpdateCount>zl.errorUpdateCount,isFetching:Mg,isRefetching:Mg&&!ly,isLoadingError:uy&&!YE,isPaused:Kl.fetchStatus==="paused",isPlaceholderData:su,isRefetchError:uy&&YE,isStale:isStale(pa,ha),refetch:this.refetch,promise:this.#i,isEnabled:resolveEnabled(ha.enabled,pa)!==!1};if(this.options.experimental_prefetchInRender){const cN=lN=>{XE.status==="error"?lN.reject(XE.error):XE.data!==void 0&&lN.resolve(XE.data)},pN=()=>{const lN=this.#i=XE.promise=pendingThenable();cN(lN)},hN=this.#i;switch(hN.status){case"pending":pa.queryHash===ma.queryHash&&cN(hN);break;case"fulfilled":(XE.status==="error"||XE.data!==hN.value)&&pN();break;case"rejected":(XE.status!=="error"||XE.error!==hN.reason)&&pN();break}}return XE}updateResult(){const pa=this.#n,ha=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#o=this.options,this.#s.data!==void 0&&(this.#c=this.#t),shallowEqualObjects$1(ha,pa))return;this.#n=ha;const ma=()=>{if(!pa)return!0;const{notifyOnChangeProps:ja}=this.options,La=typeof ja=="function"?ja():ja;if(La==="all"||!La&&!this.#m.size)return!0;const Ba=new Set(La??this.#m);return this.options.throwOnError&&Ba.add("error"),Object.keys(this.#n).some(hl=>{const Gl=hl;return this.#n[Gl]!==pa[Gl]&&Ba.has(Gl)})};this.#y({listeners:ma()})}#x(){const pa=this.#e.getQueryCache().build(this.#e,this.options);if(pa===this.#t)return;const ha=this.#t;this.#t=pa,this.#r=pa.state,this.hasListeners()&&(ha?.removeObserver(this),pa.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#_()}#y(pa){notifyManager.batch(()=>{pa.listeners&&this.listeners.forEach(ha=>{ha(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function shouldLoadOnMount(pa,ha){return resolveEnabled(ha.enabled,pa)!==!1&&pa.state.data===void 0&&!(pa.state.status==="error"&&ha.retryOnMount===!1)}function shouldFetchOnMount(pa,ha){return shouldLoadOnMount(pa,ha)||pa.state.data!==void 0&&shouldFetchOn(pa,ha,ha.refetchOnMount)}function shouldFetchOn(pa,ha,ma){if(resolveEnabled(ha.enabled,pa)!==!1&&resolveStaleTime(ha.staleTime,pa)!=="static"){const ja=typeof ma=="function"?ma(pa):ma;return ja==="always"||ja!==!1&&isStale(pa,ha)}return!1}function shouldFetchOptionally(pa,ha,ma,ja){return(pa!==ha||resolveEnabled(ja.enabled,pa)===!1)&&(!ma.suspense||pa.state.status!=="error")&&isStale(pa,ma)}function isStale(pa,ha){return resolveEnabled(ha.enabled,pa)!==!1&&pa.isStaleByTime(resolveStaleTime(ha.staleTime,pa))}function shouldAssignObserverCurrentProperties(pa,ha){return!shallowEqualObjects$1(pa.getCurrentResult(),ha)}function infiniteQueryBehavior(pa){return{onFetch:(ha,ma)=>{const ja=ha.options,La=ha.fetchOptions?.meta?.fetchMore?.direction,Ba=ha.state.data?.pages||[],hl=ha.state.data?.pageParams||[];let Gl={pages:[],pageParams:[]},zl=0;const Wl=async()=>{let Kl=!1;const su=$m=>{Object.defineProperty($m,"signal",{enumerable:!0,get:()=>(ha.signal.aborted?Kl=!0:ha.signal.addEventListener("abort",()=>{Kl=!0}),ha.signal)})},au=ensureQueryFn(ha.options,ha.fetchOptions),ou=async($m,Nm,Mm)=>{if(Kl)return Promise.reject();if(Nm==null&&$m.pages.length)return Promise.resolve($m);const ly=(()=>{const JE={client:ha.client,queryKey:ha.queryKey,pageParam:Nm,direction:Mm?"backward":"forward",meta:ha.options.meta};return su(JE),JE})(),uy=await au(ly),{maxPages:GE}=ha.options,YE=Mm?addToStart:addToEnd;return{pages:YE($m.pages,uy,GE),pageParams:YE($m.pageParams,Nm,GE)}};if(La&&Ba.length){const $m=La==="backward",Nm=$m?getPreviousPageParam:getNextPageParam,Mm={pages:Ba,pageParams:hl},Mg=Nm(ja,Mm);Gl=await ou(Mm,Mg,$m)}else{const $m=pa??Ba.length;do{const Nm=zl===0?hl[0]??ja.initialPageParam:getNextPageParam(ja,Gl);if(zl>0&&Nm==null)break;Gl=await ou(Gl,Nm),zl++}while(zl<$m)}return Gl};ha.options.persister?ha.fetchFn=()=>ha.options.persister?.(Wl,{client:ha.client,queryKey:ha.queryKey,meta:ha.options.meta,signal:ha.signal},ma):ha.fetchFn=Wl}}}function getNextPageParam(pa,{pages:ha,pageParams:ma}){const ja=ha.length-1;return ha.length>0?pa.getNextPageParam(ha[ja],ha,ma[ja],ma):void 0}function getPreviousPageParam(pa,{pages:ha,pageParams:ma}){return ha.length>0?pa.getPreviousPageParam?.(ha[0],ha,ma[0],ma):void 0}var Mutation=class extends Removable{#e;#t;#r;#n;constructor(pa){super(),this.#e=pa.client,this.mutationId=pa.mutationId,this.#r=pa.mutationCache,this.#t=[],this.state=pa.state||getDefaultState$1(),this.setOptions(pa.options),this.scheduleGc()}setOptions(pa){this.options=pa,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(pa){this.#t.includes(pa)||(this.#t.push(pa),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:pa}))}removeObserver(pa){this.#t=this.#t.filter(ha=>ha!==pa),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:pa})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(pa){const ha=()=>{this.#s({type:"continue"})},ma={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(pa,ma):Promise.reject(new Error("No mutationFn found")),onFail:(Ba,hl)=>{this.#s({type:"failed",failureCount:Ba,error:hl})},onPause:()=>{this.#s({type:"pause"})},onContinue:ha,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const ja=this.state.status==="pending",La=!this.#n.canStart();try{if(ja)ha();else{this.#s({type:"pending",variables:pa,isPaused:La}),await this.#r.config.onMutate?.(pa,this,ma);const hl=await this.options.onMutate?.(pa,ma);hl!==this.state.context&&this.#s({type:"pending",context:hl,variables:pa,isPaused:La})}const Ba=await this.#n.start();return await this.#r.config.onSuccess?.(Ba,pa,this.state.context,this,ma),await this.options.onSuccess?.(Ba,pa,this.state.context,ma),await this.#r.config.onSettled?.(Ba,null,this.state.variables,this.state.context,this,ma),await this.options.onSettled?.(Ba,null,pa,this.state.context,ma),this.#s({type:"success",data:Ba}),Ba}catch(Ba){try{throw await this.#r.config.onError?.(Ba,pa,this.state.context,this,ma),await this.options.onError?.(Ba,pa,this.state.context,ma),await this.#r.config.onSettled?.(void 0,Ba,this.state.variables,this.state.context,this,ma),await this.options.onSettled?.(void 0,Ba,pa,this.state.context,ma),Ba}finally{this.#s({type:"error",error:Ba})}}finally{this.#r.runNext(this)}}#s(pa){const ha=ma=>{switch(pa.type){case"failed":return{...ma,failureCount:pa.failureCount,failureReason:pa.error};case"pause":return{...ma,isPaused:!0};case"continue":return{...ma,isPaused:!1};case"pending":return{...ma,context:pa.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:pa.isPaused,status:"pending",variables:pa.variables,submittedAt:Date.now()};case"success":return{...ma,data:pa.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...ma,data:void 0,error:pa.error,failureCount:ma.failureCount+1,failureReason:pa.error,isPaused:!1,status:"error"}}};this.state=ha(this.state),notifyManager.batch(()=>{this.#t.forEach(ma=>{ma.onMutationUpdate(pa)}),this.#r.notify({mutation:this,type:"updated",action:pa})})}};function getDefaultState$1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var MutationCache=class extends Subscribable{constructor(pa={}){super(),this.config=pa,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(pa,ha,ma){const ja=new Mutation({client:pa,mutationCache:this,mutationId:++this.#r,options:pa.defaultMutationOptions(ha),state:ma});return this.add(ja),ja}add(pa){this.#e.add(pa);const ha=scopeFor(pa);if(typeof ha=="string"){const ma=this.#t.get(ha);ma?ma.push(pa):this.#t.set(ha,[pa])}this.notify({type:"added",mutation:pa})}remove(pa){if(this.#e.delete(pa)){const ha=scopeFor(pa);if(typeof ha=="string"){const ma=this.#t.get(ha);if(ma)if(ma.length>1){const ja=ma.indexOf(pa);ja!==-1&&ma.splice(ja,1)}else ma[0]===pa&&this.#t.delete(ha)}}this.notify({type:"removed",mutation:pa})}canRun(pa){const ha=scopeFor(pa);if(typeof ha=="string"){const ja=this.#t.get(ha)?.find(La=>La.state.status==="pending");return!ja||ja===pa}else return!0}runNext(pa){const ha=scopeFor(pa);return typeof ha=="string"?this.#t.get(ha)?.find(ja=>ja!==pa&&ja.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){notifyManager.batch(()=>{this.#e.forEach(pa=>{this.notify({type:"removed",mutation:pa})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(pa){const ha={exact:!0,...pa};return this.getAll().find(ma=>matchMutation(ha,ma))}findAll(pa={}){return this.getAll().filter(ha=>matchMutation(pa,ha))}notify(pa){notifyManager.batch(()=>{this.listeners.forEach(ha=>{ha(pa)})})}resumePausedMutations(){const pa=this.getAll().filter(ha=>ha.state.isPaused);return notifyManager.batch(()=>Promise.all(pa.map(ha=>ha.continue().catch(noop$b))))}};function scopeFor(pa){return pa.options.scope?.id}var MutationObserver$1=class extends Subscribable{#e;#t=void 0;#r;#n;constructor(ha,ma){super(),this.#e=ha,this.setOptions(ma),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(ha){const ma=this.options;this.options=this.#e.defaultMutationOptions(ha),shallowEqualObjects$1(this.options,ma)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),ma?.mutationKey&&this.options.mutationKey&&hashKey(ma.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(ha){this.#s(),this.#o(ha)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#o()}mutate(ha,ma){return this.#n=ma,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(ha)}#s(){const ha=this.#r?.state??getDefaultState$1();this.#t={...ha,isPending:ha.status==="pending",isSuccess:ha.status==="success",isError:ha.status==="error",isIdle:ha.status==="idle",mutate:this.mutate,reset:this.reset}}#o(ha){notifyManager.batch(()=>{if(this.#n&&this.hasListeners()){const ma=this.#t.variables,ja=this.#t.context,La={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};ha?.type==="success"?(this.#n.onSuccess?.(ha.data,ma,ja,La),this.#n.onSettled?.(ha.data,null,ma,ja,La)):ha?.type==="error"&&(this.#n.onError?.(ha.error,ma,ja,La),this.#n.onSettled?.(void 0,ha.error,ma,ja,La))}this.listeners.forEach(ma=>{ma(this.#t)})})}},QueryCache=class extends Subscribable{constructor(pa={}){super(),this.config=pa,this.#e=new Map}#e;build(pa,ha,ma){const ja=ha.queryKey,La=ha.queryHash??hashQueryKeyByOptions(ja,ha);let Ba=this.get(La);return Ba||(Ba=new Query$1({client:pa,queryKey:ja,queryHash:La,options:pa.defaultQueryOptions(ha),state:ma,defaultOptions:pa.getQueryDefaults(ja)}),this.add(Ba)),Ba}add(pa){this.#e.has(pa.queryHash)||(this.#e.set(pa.queryHash,pa),this.notify({type:"added",query:pa}))}remove(pa){const ha=this.#e.get(pa.queryHash);ha&&(pa.destroy(),ha===pa&&this.#e.delete(pa.queryHash),this.notify({type:"removed",query:pa}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{this.remove(pa)})})}get(pa){return this.#e.get(pa)}getAll(){return[...this.#e.values()]}find(pa){const ha={exact:!0,...pa};return this.getAll().find(ma=>matchQuery(ha,ma))}findAll(pa={}){const ha=this.getAll();return Object.keys(pa).length>0?ha.filter(ma=>matchQuery(pa,ma)):ha}notify(pa){notifyManager.batch(()=>{this.listeners.forEach(ha=>{ha(pa)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{pa.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(pa=>{pa.onOnline()})})}},QueryClient=class{#e;#t;#r;#n;#s;#o;#i;#a;constructor(pa={}){this.#e=pa.queryCache||new QueryCache,this.#t=pa.mutationCache||new MutationCache,this.#r=pa.defaultOptions||{},this.#n=new Map,this.#s=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#i=focusManager.subscribe(async pa=>{pa&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=onlineManager.subscribe(async pa=>{pa&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#i?.(),this.#i=void 0,this.#a?.(),this.#a=void 0)}isFetching(pa){return this.#e.findAll({...pa,fetchStatus:"fetching"}).length}isMutating(pa){return this.#t.findAll({...pa,status:"pending"}).length}getQueryData(pa){const ha=this.defaultQueryOptions({queryKey:pa});return this.#e.get(ha.queryHash)?.state.data}ensureQueryData(pa){const ha=this.defaultQueryOptions(pa),ma=this.#e.build(this,ha),ja=ma.state.data;return ja===void 0?this.fetchQuery(pa):(pa.revalidateIfStale&&ma.isStaleByTime(resolveStaleTime(ha.staleTime,ma))&&this.prefetchQuery(ha),Promise.resolve(ja))}getQueriesData(pa){return this.#e.findAll(pa).map(({queryKey:ha,state:ma})=>{const ja=ma.data;return[ha,ja]})}setQueryData(pa,ha,ma){const ja=this.defaultQueryOptions({queryKey:pa}),Ba=this.#e.get(ja.queryHash)?.state.data,hl=functionalUpdate(ha,Ba);if(hl!==void 0)return this.#e.build(this,ja).setData(hl,{...ma,manual:!0})}setQueriesData(pa,ha,ma){return notifyManager.batch(()=>this.#e.findAll(pa).map(({queryKey:ja})=>[ja,this.setQueryData(ja,ha,ma)]))}getQueryState(pa){const ha=this.defaultQueryOptions({queryKey:pa});return this.#e.get(ha.queryHash)?.state}removeQueries(pa){const ha=this.#e;notifyManager.batch(()=>{ha.findAll(pa).forEach(ma=>{ha.remove(ma)})})}resetQueries(pa,ha){const ma=this.#e;return notifyManager.batch(()=>(ma.findAll(pa).forEach(ja=>{ja.reset()}),this.refetchQueries({type:"active",...pa},ha)))}cancelQueries(pa,ha={}){const ma={revert:!0,...ha},ja=notifyManager.batch(()=>this.#e.findAll(pa).map(La=>La.cancel(ma)));return Promise.all(ja).then(noop$b).catch(noop$b)}invalidateQueries(pa,ha={}){return notifyManager.batch(()=>(this.#e.findAll(pa).forEach(ma=>{ma.invalidate()}),pa?.refetchType==="none"?Promise.resolve():this.refetchQueries({...pa,type:pa?.refetchType??pa?.type??"active"},ha)))}refetchQueries(pa,ha={}){const ma={...ha,cancelRefetch:ha.cancelRefetch??!0},ja=notifyManager.batch(()=>this.#e.findAll(pa).filter(La=>!La.isDisabled()&&!La.isStatic()).map(La=>{let Ba=La.fetch(void 0,ma);return ma.throwOnError||(Ba=Ba.catch(noop$b)),La.state.fetchStatus==="paused"?Promise.resolve():Ba}));return Promise.all(ja).then(noop$b)}fetchQuery(pa){const ha=this.defaultQueryOptions(pa);ha.retry===void 0&&(ha.retry=!1);const ma=this.#e.build(this,ha);return ma.isStaleByTime(resolveStaleTime(ha.staleTime,ma))?ma.fetch(ha):Promise.resolve(ma.state.data)}prefetchQuery(pa){return this.fetchQuery(pa).then(noop$b).catch(noop$b)}fetchInfiniteQuery(pa){return pa.behavior=infiniteQueryBehavior(pa.pages),this.fetchQuery(pa)}prefetchInfiniteQuery(pa){return this.fetchInfiniteQuery(pa).then(noop$b).catch(noop$b)}ensureInfiniteQueryData(pa){return pa.behavior=infiniteQueryBehavior(pa.pages),this.ensureQueryData(pa)}resumePausedMutations(){return onlineManager.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(pa){this.#r=pa}setQueryDefaults(pa,ha){this.#n.set(hashKey(pa),{queryKey:pa,defaultOptions:ha})}getQueryDefaults(pa){const ha=[...this.#n.values()],ma={};return ha.forEach(ja=>{partialMatchKey(pa,ja.queryKey)&&Object.assign(ma,ja.defaultOptions)}),ma}setMutationDefaults(pa,ha){this.#s.set(hashKey(pa),{mutationKey:pa,defaultOptions:ha})}getMutationDefaults(pa){const ha=[...this.#s.values()],ma={};return ha.forEach(ja=>{partialMatchKey(pa,ja.mutationKey)&&Object.assign(ma,ja.defaultOptions)}),ma}defaultQueryOptions(pa){if(pa._defaulted)return pa;const ha={...this.#r.queries,...this.getQueryDefaults(pa.queryKey),...pa,_defaulted:!0};return ha.queryHash||(ha.queryHash=hashQueryKeyByOptions(ha.queryKey,ha)),ha.refetchOnReconnect===void 0&&(ha.refetchOnReconnect=ha.networkMode!=="always"),ha.throwOnError===void 0&&(ha.throwOnError=!!ha.suspense),!ha.networkMode&&ha.persister&&(ha.networkMode="offlineFirst"),ha.queryFn===skipToken&&(ha.enabled=!1),ha}defaultMutationOptions(pa){return pa?._defaulted?pa:{...this.#r.mutations,...pa?.mutationKey&&this.getMutationDefaults(pa.mutationKey),...pa,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},QueryClientContext=reactExports.createContext(void 0),useQueryClient=pa=>{const ha=reactExports.useContext(QueryClientContext);if(!ha)throw new Error("No QueryClient set, use QueryClientProvider to set one");return ha},QueryClientProvider=({client:pa,children:ha})=>(reactExports.useEffect(()=>(pa.mount(),()=>{pa.unmount()}),[pa]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:pa,children:ha})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let pa=!1;return{clearReset:()=>{pa=!1},reset:()=>{pa=!0},isReset:()=>pa}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext),ensurePreventErrorBoundaryRetry=(pa,ha)=>{(pa.suspense||pa.throwOnError||pa.experimental_prefetchInRender)&&(ha.isReset()||(pa.retryOnMount=!1))},useClearResetErrorBoundary=pa=>{reactExports.useEffect(()=>{pa.clearReset()},[pa])},getHasError=({result:pa,errorResetBoundary:ha,throwOnError:ma,query:ja,suspense:La})=>pa.isError&&!ha.isReset()&&!pa.isFetching&&ja&&(La&&pa.data===void 0||shouldThrowError(ma,[pa.error,ja])),ensureSuspenseTimers=pa=>{if(pa.suspense){const ma=La=>La==="static"?La:Math.max(La??1e3,1e3),ja=pa.staleTime;pa.staleTime=typeof ja=="function"?(...La)=>ma(ja(...La)):ma(ja),typeof pa.gcTime=="number"&&(pa.gcTime=Math.max(pa.gcTime,1e3))}},willFetch=(pa,ha)=>pa.isLoading&&pa.isFetching&&!ha,shouldSuspend=(pa,ha)=>pa?.suspense&&ha.isPending,fetchOptimistic=(pa,ha,ma)=>ha.fetchOptimistic(pa).catch(()=>{ma.clearReset()});function useBaseQuery(pa,ha,ma){const ja=useIsRestoring(),La=useQueryErrorResetBoundary(),Ba=useQueryClient(),hl=Ba.defaultQueryOptions(pa);Ba.getDefaultOptions().queries?._experimental_beforeQuery?.(hl),hl._optimisticResults=ja?"isRestoring":"optimistic",ensureSuspenseTimers(hl),ensurePreventErrorBoundaryRetry(hl,La),useClearResetErrorBoundary(La);const Gl=!Ba.getQueryCache().get(hl.queryHash),[zl]=reactExports.useState(()=>new ha(Ba,hl)),Wl=zl.getOptimisticResult(hl),Kl=!ja&&pa.subscribed!==!1;if(reactExports.useSyncExternalStore(reactExports.useCallback(su=>{const au=Kl?zl.subscribe(notifyManager.batchCalls(su)):noop$b;return zl.updateResult(),au},[zl,Kl]),()=>zl.getCurrentResult(),()=>zl.getCurrentResult()),reactExports.useEffect(()=>{zl.setOptions(hl)},[hl,zl]),shouldSuspend(hl,Wl))throw fetchOptimistic(hl,zl,La);if(getHasError({result:Wl,errorResetBoundary:La,throwOnError:hl.throwOnError,query:Ba.getQueryCache().get(hl.queryHash),suspense:hl.suspense}))throw Wl.error;return Ba.getDefaultOptions().queries?._experimental_afterQuery?.(hl,Wl),hl.experimental_prefetchInRender&&!isServer&&willFetch(Wl,ja)&&(Gl?fetchOptimistic(hl,zl,La):Ba.getQueryCache().get(hl.queryHash)?.promise)?.catch(noop$b).finally(()=>{zl.updateResult()}),hl.notifyOnChangeProps?Wl:zl.trackResult(Wl)}function useQuery(pa,ha){return useBaseQuery(pa,QueryObserver)}function useMutation(pa,ha){const ma=useQueryClient(),[ja]=reactExports.useState(()=>new MutationObserver$1(ma,pa));reactExports.useEffect(()=>{ja.setOptions(pa)},[ja,pa]);const La=reactExports.useSyncExternalStore(reactExports.useCallback(hl=>ja.subscribe(notifyManager.batchCalls(hl)),[ja]),()=>ja.getCurrentResult(),()=>ja.getCurrentResult()),Ba=reactExports.useCallback((hl,Gl)=>{ja.mutate(hl,Gl).catch(noop$b)},[ja]);if(La.error&&shouldThrowError(ja.options.throwOnError,[La.error]))throw La.error;return{...La,mutate:Ba,mutateAsync:La.mutate}}var reactDomExports=requireReactDom();const ReactDOM=getDefaultExportFromCjs(reactDomExports),dy=pa=>{let ha;const ma=new Set,ja=(Gl,zl)=>{const Wl=typeof Gl=="function"?Gl(ha):Gl;if(!Object.is(Wl,ha)){const Kl=ha;ha=zl??(typeof Wl!="object"||Wl===null)?Wl:Object.assign({},ha,Wl),ma.forEach(su=>su(ha,Kl))}},La=()=>ha,Ba={setState:ja,getState:La,getInitialState:()=>hl,subscribe:Gl=>(ma.add(Gl),()=>ma.delete(Gl))},hl=ha=pa(ja,La,Ba);return Ba},EN=(pa=>pa?dy(pa):dy),CN=pa=>pa;function TN(pa,ha=CN){const ma=React.useSyncExternalStore(pa.subscribe,React.useCallback(()=>ha(pa.getState()),[pa,ha]),React.useCallback(()=>ha(pa.getInitialState()),[pa,ha]));return React.useDebugValue(ma),ma}const fy=pa=>{const ha=EN(pa),ma=ja=>TN(ha,ja);return Object.assign(ma,ha),ma},AN=(pa=>pa?fy(pa):fy),uo$1=AN(pa=>({showAppSettings:!1,selectedInstanceKey:null,uiSchema:null,setShowAppSettings:ha=>pa({showAppSettings:ha}),setUiSchema:ha=>pa({uiSchema:ha}),setSelectedInstanceKey:ha=>pa({selectedInstanceKey:ha})})),RN=()=>uo$1(pa=>pa.showAppSettings),ZE=()=>uo$1(pa=>pa.setShowAppSettings),pt$3=()=>uo$1(pa=>pa.uiSchema),BZ=()=>uo$1(pa=>pa.setUiSchema),ON=()=>uo$1(pa=>pa.selectedInstanceKey),_N=()=>uo$1(pa=>pa.setSelectedInstanceKey),QE=()=>{const{"*":pa}=useParams(),{customNavigate:ha}=Se$3(),ma=pt$3(),ja=ma?.relationships,La=pa?.split("/").filter(Boolean)??[],Ba=La[1],hl=La.slice(2).filter(Wl=>!ja?.some(Kl=>Kl.name===Wl)),Gl=Wl=>{const Kl=`/view/${Ba}/${hl.slice(0,Wl+1).join("/")}`;ha(Kl)},zl=Wl=>{const Kl=ma?.[`${Ba}/${Wl}`];if(Wl.includes("-"))return Wl.split("-")[0];switch(Wl){case"new":return"Create";case"edit":return"Edit";default:return Kl?.displayName||Wl}};return jsxRuntimeExports.jsx("div",{className:"breadcrumbs",children:hl.filter(Wl=>Wl!==Ba).map((Wl,Kl)=>{const su=Wl===La[La.length-1];return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"link","data-selected":su,onClick:()=>Gl(Kl),children:zl(Wl)}),Kl!==hl.length-1&&jsxRuntimeExports.jsx(ke$5,{icon:"ph:caret-right-bold"})]},Wl)})})},eC=({viewSpec:pa})=>{const{showBreadcrumbs:ha}=pa;return jsxRuntimeExports.jsx("div",{className:"header-component",children:ha&&jsxRuntimeExports.jsx(QE,{})})},Va=()=>{const pa=pt$3(),ha=pa?.entities,ma=pa?.agents,ja=hl=>ha?.some(Gl=>Gl===hl),La=hl=>ma?.some(Gl=>Gl===hl),Ba=(hl,Gl)=>{for(let zl=hl.length-1;zl>=0;zl--)if(ja(`${Gl}/${hl[zl]}`)||La(`${Gl}/${hl[zl]}`))return zl;return-1};return{isEntity:ja,isAgent:La,getActiveEntityorAgent:hl=>{if(!hl||hl==="signin"||hl==="signup")return!1;const Gl=hl.split("/").filter(Boolean);if(Gl.length===0)return!1;const zl=Gl[1],Wl=Ba(Gl,zl);if(Wl===-1)return!1;const Kl=Gl[Wl];return`${zl}/${Kl}`}}},tC=()=>{const pa=pt$3()?.relationships;return{getRelationship:ha=>!pa||!ha?void 0:pa.find(ma=>ma.parent===ha||ma.child===ha)?.name}},PN=({data:pa,entityName:ha,isRelationship:ma=!1,relationshipName:ja,uiSpec:La})=>reactExports.useMemo(()=>{if(!pa)return[];const Ba=ha.split("/")[1];let hl,Gl;if(ma&&ja&&La){const zl=La?.relationships?.find(Wl=>Wl.name===ja);if(zl){Gl=zl.type;const[Wl]=ha.split("/");hl=`${Wl}/${ja}`}}return pa.flatMap(zl=>{if(ma&&Gl==="between"&&hl&&zl){const Wl=Object.keys(zl).find(Kl=>Kl!==hl&&typeof zl[Kl]=="object"&&zl[Kl]!==null&&!Kl.startsWith("__"));if(Wl&&zl[Wl]&&zl[Wl][hl]){const Kl=zl[Wl][hl];if(Array.isArray(Kl))return Kl.map(su=>{const au=Object.keys(su).find(ou=>typeof su[ou]=="object"&&su[ou]!==null&&!ou.startsWith("__")&&ou!==hl);return au?su[au]:su})}if(zl[hl]&&Array.isArray(zl[hl]))return zl[hl].flatMap(Kl=>{const su=Object.keys(Kl).find(au=>typeof Kl[au]=="object"&&Kl[au]!==null&&!au.startsWith("__"));return su?Kl[su]:Kl})}return zl&&zl[Ba]?zl[Ba]:zl})},[pa,ha,ma,ja,La]),NN=({entityName:pa,isRelationship:ha=!1,createAction:ma,relationship:ja})=>{const La=useNavigate(),{pathname:Ba}=useLocation(),{getRelationship:hl}=tC(),Gl=ja||hl(pa.split("/")[1]);return jsxRuntimeExports.jsxs("div",{className:"fx-button",onClick:()=>{const zl=pa.split("/")[1];let Wl=Ba;ha&&Gl&&!Ba.includes(Gl)&&(Wl+=`/${Gl}/${zl}`),Wl+="/new",La(Wl)},children:[jsxRuntimeExports.jsx(ke$5,{icon:ma?.icon||"material-symbols:add"}),jsxRuntimeExports.jsx("span",{className:"grow text-center text-sm font-semibold",children:ma?.text||`Add ${pa.split("/")[1]}`})]})},km=reactExports.createContext({});function Dm(pa){const ha=reactExports.useRef(null);return ha.current===null&&(ha.current=pa()),ha.current}const Im=typeof window<"u",nC=Im?reactExports.useLayoutEffect:reactExports.useEffect,Yl=reactExports.createContext(null);function Fm(pa,ha){pa.indexOf(ha)===-1&&pa.push(ha)}function Lm(pa,ha){const ma=pa.indexOf(ha);ma>-1&&pa.splice(ma,1)}const qn=(pa,ha,ma)=>ma>ha?ha:ma<pa?pa:ma;function pp(pa,ha){return ha?`${pa}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${ha}`:pa}var MN={};let fo$1=()=>{},Un=()=>{};MN.NODE_ENV!=="production"&&(fo$1=(pa,ha,ma)=>{!pa&&typeof console<"u"&&console.warn(pp(ha,ma))},Un=(pa,ha,ma)=>{if(!pa)throw new Error(pp(ha,ma))});const Hn={},rC=pa=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(pa);function iC(pa){return typeof pa=="object"&&pa!==null}const oC=pa=>/^0[^.\s]+$/u.test(pa);function jm(pa){let ha;return()=>(ha===void 0&&(ha=pa()),ha)}const Kt$1=pa=>pa,$N=(pa,ha)=>ma=>ha(pa(ma)),qa=(...pa)=>pa.reduce($N),ga=(pa,ha,ma)=>{const ja=ha-pa;return ja===0?1:(ma-pa)/ja};class Bm{constructor(){this.subscriptions=[]}add(ha){return Fm(this.subscriptions,ha),()=>Lm(this.subscriptions,ha)}notify(ha,ma,ja){const La=this.subscriptions.length;if(La)if(La===1)this.subscriptions[0](ha,ma,ja);else for(let Ba=0;Ba<La;Ba++){const hl=this.subscriptions[Ba];hl&&hl(ha,ma,ja)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const on$2=pa=>pa*1e3,Gt$2=pa=>pa/1e3;function aC(pa,ha){return ha?pa*(1e3/ha):0}const hy=new Set;function Vm(pa,ha,ma){pa||hy.has(ha)||(console.warn(pp(ha,ma)),hy.add(ha))}const sC=(pa,ha,ma)=>(((1-3*ma+3*ha)*pa+(3*ma-6*ha))*pa+3*ha)*pa,kN=1e-7,DN=12;function IN$2(pa,ha,ma,ja,La){let Ba,hl,Gl=0;do hl=ha+(ma-ha)/2,Ba=sC(hl,ja,La)-pa,Ba>0?ma=hl:ha=hl;while(Math.abs(Ba)>kN&&++Gl<DN);return hl}function Ua(pa,ha,ma,ja){if(pa===ha&&ma===ja)return Kt$1;const La=Ba=>IN$2(Ba,0,1,pa,ma);return Ba=>Ba===0||Ba===1?Ba:sC(La(Ba),ha,ja)}const lC=pa=>ha=>ha<=.5?pa(2*ha)/2:(2-pa(2*(1-ha)))/2,cC=pa=>ha=>1-pa(1-ha),uC=Ua(.33,1.53,.69,.99),qm=cC(uC),dC=lC(qm),fC=pa=>(pa*=2)<1?.5*qm(pa):.5*(2-Math.pow(2,-10*(pa-1))),Um=pa=>1-Math.sin(Math.acos(pa)),hC=cC(Um),pC=lC(Um),FN=Ua(.42,0,1,1),LN=Ua(0,0,.58,1),mC=Ua(.42,0,.58,1),jN=pa=>Array.isArray(pa)&&typeof pa[0]!="number",gC=pa=>Array.isArray(pa)&&typeof pa[0]=="number",py={linear:Kt$1,easeIn:FN,easeInOut:mC,easeOut:LN,circIn:Um,circInOut:pC,circOut:hC,backIn:qm,backInOut:dC,backOut:uC,anticipate:fC},BN=pa=>typeof pa=="string",my=pa=>{if(gC(pa)){Un(pa.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[ha,ma,ja,La]=pa;return Ua(ha,ma,ja,La)}else if(BN(pa))return Un(py[pa]!==void 0,`Invalid easing type '${pa}'`,"invalid-easing-type"),py[pa];return pa},vs$1=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function VN(pa,ha){let ma=new Set,ja=new Set,La=!1,Ba=!1;const hl=new WeakSet;let Gl={delta:0,timestamp:0,isProcessing:!1};function zl(Kl){hl.has(Kl)&&(Wl.schedule(Kl),pa()),Kl(Gl)}const Wl={schedule:(Kl,su=!1,au=!1)=>{const ou=au&&La?ma:ja;return su&&hl.add(Kl),ou.has(Kl)||ou.add(Kl),Kl},cancel:Kl=>{ja.delete(Kl),hl.delete(Kl)},process:Kl=>{if(Gl=Kl,La){Ba=!0;return}La=!0,[ma,ja]=[ja,ma],ma.forEach(zl),ma.clear(),La=!1,Ba&&(Ba=!1,Wl.process(Kl))}};return Wl}const qN=40;function vC(pa,ha){let ma=!1,ja=!0;const La={delta:0,timestamp:0,isProcessing:!1},Ba=()=>ma=!0,hl=vs$1.reduce((Mg,ly)=>(Mg[ly]=VN(Ba),Mg),{}),{setup:Gl,read:zl,resolveKeyframes:Wl,preUpdate:Kl,update:su,preRender:au,render:ou,postRender:$m}=hl,Nm=()=>{const Mg=Hn.useManualTiming?La.timestamp:performance.now();ma=!1,Hn.useManualTiming||(La.delta=ja?1e3/60:Math.max(Math.min(Mg-La.timestamp,qN),1)),La.timestamp=Mg,La.isProcessing=!0,Gl.process(La),zl.process(La),Wl.process(La),Kl.process(La),su.process(La),au.process(La),ou.process(La),$m.process(La),La.isProcessing=!1,ma&&ha&&(ja=!1,pa(Nm))},Mm=()=>{ma=!0,ja=!0,La.isProcessing||pa(Nm)};return{schedule:vs$1.reduce((Mg,ly)=>{const uy=hl[ly];return Mg[ly]=(GE,YE=!1,JE=!1)=>(ma||Mm(),uy.schedule(GE,YE,JE)),Mg},{}),cancel:Mg=>{for(let ly=0;ly<vs$1.length;ly++)hl[vs$1[ly]].cancel(Mg)},state:La,steps:hl}}const{schedule:Fe$3,cancel:dr$1,state:rt$3,steps:lu}=vC(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kt$1,!0);let Gs$1;function UN(){Gs$1=void 0}const St$2={now:()=>(Gs$1===void 0&&St$2.set(rt$3.isProcessing||Hn.useManualTiming?rt$3.timestamp:performance.now()),Gs$1),set:pa=>{Gs$1=pa,queueMicrotask(UN)}},yC=pa=>ha=>typeof ha=="string"&&ha.startsWith(pa),bC=yC("--"),HN=yC("var(--"),Hm=pa=>HN(pa)?zN.test(pa.split("/*")[0].trim()):!1,zN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ho$1={test:pa=>typeof pa=="number",parse:parseFloat,transform:pa=>pa},va={...ho$1,transform:pa=>qn(0,1,pa)},ys$1={...ho$1,default:1},ra=pa=>Math.round(pa*1e5)/1e5,zm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function WN(pa){return pa==null}const GN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wm=(pa,ha)=>ma=>!!(typeof ma=="string"&&GN.test(ma)&&ma.startsWith(pa)||ha&&!WN(ma)&&Object.prototype.hasOwnProperty.call(ma,ha)),xC=(pa,ha,ma)=>ja=>{if(typeof ja!="string")return ja;const[La,Ba,hl,Gl]=ja.match(zm);return{[pa]:parseFloat(La),[ha]:parseFloat(Ba),[ma]:parseFloat(hl),alpha:Gl!==void 0?parseFloat(Gl):1}},KN=pa=>qn(0,255,pa),cu={...ho$1,transform:pa=>Math.round(KN(pa))},Mr$1={test:Wm("rgb","red"),parse:xC("red","green","blue"),transform:({red:pa,green:ha,blue:ma,alpha:ja=1})=>"rgba("+cu.transform(pa)+", "+cu.transform(ha)+", "+cu.transform(ma)+", "+ra(va.transform(ja))+")"};function YN(pa){let ha="",ma="",ja="",La="";return pa.length>5?(ha=pa.substring(1,3),ma=pa.substring(3,5),ja=pa.substring(5,7),La=pa.substring(7,9)):(ha=pa.substring(1,2),ma=pa.substring(2,3),ja=pa.substring(3,4),La=pa.substring(4,5),ha+=ha,ma+=ma,ja+=ja,La+=La),{red:parseInt(ha,16),green:parseInt(ma,16),blue:parseInt(ja,16),alpha:La?parseInt(La,16)/255:1}}const mp={test:Wm("#"),parse:YN,transform:Mr$1.transform},Ha=pa=>({test:ha=>typeof ha=="string"&&ha.endsWith(pa)&&ha.split(" ").length===1,parse:parseFloat,transform:ha=>`${ha}${pa}`}),or$1=Ha("deg"),Tn$1=Ha("%"),ue$2=Ha("px"),XN=Ha("vh"),JN=Ha("vw"),gy={...Tn$1,parse:pa=>Tn$1.parse(pa)/100,transform:pa=>Tn$1.transform(pa*100)},Bi$1={test:Wm("hsl","hue"),parse:xC("hue","saturation","lightness"),transform:({hue:pa,saturation:ha,lightness:ma,alpha:ja=1})=>"hsla("+Math.round(pa)+", "+Tn$1.transform(ra(ha))+", "+Tn$1.transform(ra(ma))+", "+ra(va.transform(ja))+")"},Ye$1={test:pa=>Mr$1.test(pa)||mp.test(pa)||Bi$1.test(pa),parse:pa=>Mr$1.test(pa)?Mr$1.parse(pa):Bi$1.test(pa)?Bi$1.parse(pa):mp.parse(pa),transform:pa=>typeof pa=="string"?pa:pa.hasOwnProperty("red")?Mr$1.transform(pa):Bi$1.transform(pa),getAnimatableNone:pa=>{const ha=Ye$1.parse(pa);return ha.alpha=0,Ye$1.transform(ha)}},ZN=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QN(pa){return isNaN(pa)&&typeof pa=="string"&&(pa.match(zm)?.length||0)+(pa.match(ZN)?.length||0)>0}const wC="number",SC="color",eM="var",tM="var(",vy="${}",nM=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ya(pa){const ha=pa.toString(),ma=[],ja={color:[],number:[],var:[]},La=[];let Ba=0;const hl=ha.replace(nM,Gl=>(Ye$1.test(Gl)?(ja.color.push(Ba),La.push(SC),ma.push(Ye$1.parse(Gl))):Gl.startsWith(tM)?(ja.var.push(Ba),La.push(eM),ma.push(Gl)):(ja.number.push(Ba),La.push(wC),ma.push(parseFloat(Gl))),++Ba,vy)).split(vy);return{values:ma,split:hl,indexes:ja,types:La}}function EC(pa){return ya(pa).values}function CC(pa){const{split:ha,types:ma}=ya(pa),ja=ha.length;return La=>{let Ba="";for(let hl=0;hl<ja;hl++)if(Ba+=ha[hl],La[hl]!==void 0){const Gl=ma[hl];Gl===wC?Ba+=ra(La[hl]):Gl===SC?Ba+=Ye$1.transform(La[hl]):Ba+=La[hl]}return Ba}}const rM=pa=>typeof pa=="number"?0:Ye$1.test(pa)?Ye$1.getAnimatableNone(pa):pa;function iM(pa){const ha=EC(pa);return CC(pa)(ha.map(rM))}const fr$1={test:QN,parse:EC,createTransformer:CC,getAnimatableNone:iM};function uu(pa,ha,ma){return ma<0&&(ma+=1),ma>1&&(ma-=1),ma<1/6?pa+(ha-pa)*6*ma:ma<1/2?ha:ma<2/3?pa+(ha-pa)*(2/3-ma)*6:pa}function oM({hue:pa,saturation:ha,lightness:ma,alpha:ja}){pa/=360,ha/=100,ma/=100;let La=0,Ba=0,hl=0;if(!ha)La=Ba=hl=ma;else{const Gl=ma<.5?ma*(1+ha):ma+ha-ma*ha,zl=2*ma-Gl;La=uu(zl,Gl,pa+1/3),Ba=uu(zl,Gl,pa),hl=uu(zl,Gl,pa-1/3)}return{red:Math.round(La*255),green:Math.round(Ba*255),blue:Math.round(hl*255),alpha:ja}}function pl(pa,ha){return ma=>ma>0?ha:pa}const je$3=(pa,ha,ma)=>pa+(ha-pa)*ma,du=(pa,ha,ma)=>{const ja=pa*pa,La=ma*(ha*ha-ja)+ja;return La<0?0:Math.sqrt(La)},aM=[mp,Mr$1,Bi$1],sM=pa=>aM.find(ha=>ha.test(pa));function yy(pa){const ha=sM(pa);if(fo$1(!!ha,`'${pa}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!ha)return!1;let ma=ha.parse(pa);return ha===Bi$1&&(ma=oM(ma)),ma}const by=(pa,ha)=>{const ma=yy(pa),ja=yy(ha);if(!ma||!ja)return pl(pa,ha);const La={...ma};return Ba=>(La.red=du(ma.red,ja.red,Ba),La.green=du(ma.green,ja.green,Ba),La.blue=du(ma.blue,ja.blue,Ba),La.alpha=je$3(ma.alpha,ja.alpha,Ba),Mr$1.transform(La))},gp=new Set(["none","hidden"]);function lM(pa,ha){return gp.has(pa)?ma=>ma<=0?pa:ha:ma=>ma>=1?ha:pa}function cM(pa,ha){return ma=>je$3(pa,ha,ma)}function Gm(pa){return typeof pa=="number"?cM:typeof pa=="string"?Hm(pa)?pl:Ye$1.test(pa)?by:fM:Array.isArray(pa)?TC:typeof pa=="object"?Ye$1.test(pa)?by:uM:pl}function TC(pa,ha){const ma=[...pa],ja=ma.length,La=pa.map((Ba,hl)=>Gm(Ba)(Ba,ha[hl]));return Ba=>{for(let hl=0;hl<ja;hl++)ma[hl]=La[hl](Ba);return ma}}function uM(pa,ha){const ma={...pa,...ha},ja={};for(const La in ma)pa[La]!==void 0&&ha[La]!==void 0&&(ja[La]=Gm(pa[La])(pa[La],ha[La]));return La=>{for(const Ba in ja)ma[Ba]=ja[Ba](La);return ma}}function dM(pa,ha){const ma=[],ja={color:0,var:0,number:0};for(let La=0;La<ha.values.length;La++){const Ba=ha.types[La],hl=pa.indexes[Ba][ja[Ba]],Gl=pa.values[hl]??0;ma[La]=Gl,ja[Ba]++}return ma}const fM=(pa,ha)=>{const ma=fr$1.createTransformer(ha),ja=ya(pa),La=ya(ha);return ja.indexes.var.length===La.indexes.var.length&&ja.indexes.color.length===La.indexes.color.length&&ja.indexes.number.length>=La.indexes.number.length?gp.has(pa)&&!La.values.length||gp.has(ha)&&!ja.values.length?lM(pa,ha):qa(TC(dM(ja,La),La.values),ma):(fo$1(!0,`Complex values '${pa}' and '${ha}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),pl(pa,ha))};function AC(pa,ha,ma){return typeof pa=="number"&&typeof ha=="number"&&typeof ma=="number"?je$3(pa,ha,ma):Gm(pa)(pa,ha)}const hM=pa=>{const ha=({timestamp:ma})=>pa(ma);return{start:(ma=!0)=>Fe$3.update(ha,ma),stop:()=>dr$1(ha),now:()=>rt$3.isProcessing?rt$3.timestamp:St$2.now()}},RC=(pa,ha,ma=10)=>{let ja="";const La=Math.max(Math.round(ha/ma),2);for(let Ba=0;Ba<La;Ba++)ja+=Math.round(pa(Ba/(La-1))*1e4)/1e4+", ";return`linear(${ja.substring(0,ja.length-2)})`},ml=2e4;function Km(pa){let ha=0;const ma=50;let ja=pa.next(ha);for(;!ja.done&&ha<ml;)ha+=ma,ja=pa.next(ha);return ha>=ml?1/0:ha}function pM(pa,ha=100,ma){const ja=ma({...pa,keyframes:[0,ha]}),La=Math.min(Km(ja),ml);return{type:"keyframes",ease:Ba=>ja.next(La*Ba).value/ha,duration:Gt$2(La)}}const mM=5;function OC(pa,ha,ma){const ja=Math.max(ha-mM,0);return aC(ma-pa(ja),ha-ja)}const Le$2={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fu=.001;function gM({duration:pa=Le$2.duration,bounce:ha=Le$2.bounce,velocity:ma=Le$2.velocity,mass:ja=Le$2.mass}){let La,Ba;fo$1(pa<=on$2(Le$2.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let hl=1-ha;hl=qn(Le$2.minDamping,Le$2.maxDamping,hl),pa=qn(Le$2.minDuration,Le$2.maxDuration,Gt$2(pa)),hl<1?(La=Wl=>{const Kl=Wl*hl,su=Kl*pa,au=Kl-ma,ou=vp(Wl,hl),$m=Math.exp(-su);return fu-au/ou*$m},Ba=Wl=>{const Kl=Wl*hl*pa,su=Kl*ma+ma,au=Math.pow(hl,2)*Math.pow(Wl,2)*pa,ou=Math.exp(-Kl),$m=vp(Math.pow(Wl,2),hl);return(-La(Wl)+fu>0?-1:1)*((su-au)*ou)/$m}):(La=Wl=>{const Kl=Math.exp(-Wl*pa),su=(Wl-ma)*pa+1;return-fu+Kl*su},Ba=Wl=>{const Kl=Math.exp(-Wl*pa),su=(ma-Wl)*(pa*pa);return Kl*su});const Gl=5/pa,zl=yM(La,Ba,Gl);if(pa=on$2(pa),isNaN(zl))return{stiffness:Le$2.stiffness,damping:Le$2.damping,duration:pa};{const Wl=Math.pow(zl,2)*ja;return{stiffness:Wl,damping:hl*2*Math.sqrt(ja*Wl),duration:pa}}}const vM=12;function yM(pa,ha,ma){let ja=ma;for(let La=1;La<vM;La++)ja=ja-pa(ja)/ha(ja);return ja}function vp(pa,ha){return pa*Math.sqrt(1-ha*ha)}const bM=["duration","bounce"],xM=["stiffness","damping","mass"];function xy(pa,ha){return ha.some(ma=>pa[ma]!==void 0)}function wM(pa){let ha={velocity:Le$2.velocity,stiffness:Le$2.stiffness,damping:Le$2.damping,mass:Le$2.mass,isResolvedFromDuration:!1,...pa};if(!xy(pa,xM)&&xy(pa,bM))if(pa.visualDuration){const ma=pa.visualDuration,ja=2*Math.PI/(ma*1.2),La=ja*ja,Ba=2*qn(.05,1,1-(pa.bounce||0))*Math.sqrt(La);ha={...ha,mass:Le$2.mass,stiffness:La,damping:Ba}}else{const ma=gM(pa);ha={...ha,...ma,mass:Le$2.mass},ha.isResolvedFromDuration=!0}return ha}function gl(pa=Le$2.visualDuration,ha=Le$2.bounce){const ma=typeof pa!="object"?{visualDuration:pa,keyframes:[0,1],bounce:ha}:pa;let{restSpeed:ja,restDelta:La}=ma;const Ba=ma.keyframes[0],hl=ma.keyframes[ma.keyframes.length-1],Gl={done:!1,value:Ba},{stiffness:zl,damping:Wl,mass:Kl,duration:su,velocity:au,isResolvedFromDuration:ou}=wM({...ma,velocity:-Gt$2(ma.velocity||0)}),$m=au||0,Nm=Wl/(2*Math.sqrt(zl*Kl)),Mm=hl-Ba,Mg=Gt$2(Math.sqrt(zl/Kl)),ly=Math.abs(Mm)<5;ja||(ja=ly?Le$2.restSpeed.granular:Le$2.restSpeed.default),La||(La=ly?Le$2.restDelta.granular:Le$2.restDelta.default);let uy;if(Nm<1){const YE=vp(Mg,Nm);uy=JE=>{const XE=Math.exp(-Nm*Mg*JE);return hl-XE*(($m+Nm*Mg*Mm)/YE*Math.sin(YE*JE)+Mm*Math.cos(YE*JE))}}else if(Nm===1)uy=YE=>hl-Math.exp(-Mg*YE)*(Mm+($m+Mg*Mm)*YE);else{const YE=Mg*Math.sqrt(Nm*Nm-1);uy=JE=>{const XE=Math.exp(-Nm*Mg*JE),cN=Math.min(YE*JE,300);return hl-XE*(($m+Nm*Mg*Mm)*Math.sinh(cN)+YE*Mm*Math.cosh(cN))/YE}}const GE={calculatedDuration:ou&&su||null,next:YE=>{const JE=uy(YE);if(ou)Gl.done=YE>=su;else{let XE=YE===0?$m:0;Nm<1&&(XE=YE===0?on$2($m):OC(uy,YE,JE));const cN=Math.abs(XE)<=ja,pN=Math.abs(hl-JE)<=La;Gl.done=cN&&pN}return Gl.value=Gl.done?hl:JE,Gl},toString:()=>{const YE=Math.min(Km(GE),ml),JE=RC(XE=>GE.next(YE*XE).value,YE,30);return YE+"ms "+JE},toTransition:()=>{}};return GE}gl.applyToOptions=pa=>{const ha=pM(pa,100,gl);return pa.ease=ha.ease,pa.duration=on$2(ha.duration),pa.type="keyframes",pa};function yp({keyframes:pa,velocity:ha=0,power:ma=.8,timeConstant:ja=325,bounceDamping:La=10,bounceStiffness:Ba=500,modifyTarget:hl,min:Gl,max:zl,restDelta:Wl=.5,restSpeed:Kl}){const su=pa[0],au={done:!1,value:su},ou=cN=>Gl!==void 0&&cN<Gl||zl!==void 0&&cN>zl,$m=cN=>Gl===void 0?zl:zl===void 0||Math.abs(Gl-cN)<Math.abs(zl-cN)?Gl:zl;let Nm=ma*ha;const Mm=su+Nm,Mg=hl===void 0?Mm:hl(Mm);Mg!==Mm&&(Nm=Mg-su);const ly=cN=>-Nm*Math.exp(-cN/ja),uy=cN=>Mg+ly(cN),GE=cN=>{const pN=ly(cN),hN=uy(cN);au.done=Math.abs(pN)<=Wl,au.value=au.done?Mg:hN};let YE,JE;const XE=cN=>{ou(au.value)&&(YE=cN,JE=gl({keyframes:[au.value,$m(au.value)],velocity:OC(uy,cN,au.value),damping:La,stiffness:Ba,restDelta:Wl,restSpeed:Kl}))};return XE(0),{calculatedDuration:null,next:cN=>{let pN=!1;return!JE&&YE===void 0&&(pN=!0,GE(cN),XE(cN)),YE!==void 0&&cN>=YE?JE.next(cN-YE):(!pN&&GE(cN),au)}}}function SM(pa,ha,ma){const ja=[],La=ma||Hn.mix||AC,Ba=pa.length-1;for(let hl=0;hl<Ba;hl++){let Gl=La(pa[hl],pa[hl+1]);if(ha){const zl=Array.isArray(ha)?ha[hl]||Kt$1:ha;Gl=qa(zl,Gl)}ja.push(Gl)}return ja}function EM(pa,ha,{clamp:ma=!0,ease:ja,mixer:La}={}){const Ba=pa.length;if(Un(Ba===ha.length,"Both input and output ranges must be the same length","range-length"),Ba===1)return()=>ha[0];if(Ba===2&&ha[0]===ha[1])return()=>ha[1];const hl=pa[0]===pa[1];pa[0]>pa[Ba-1]&&(pa=[...pa].reverse(),ha=[...ha].reverse());const Gl=SM(ha,ja,La),zl=Gl.length,Wl=Kl=>{if(hl&&Kl<pa[0])return ha[0];let su=0;if(zl>1)for(;su<pa.length-2&&!(Kl<pa[su+1]);su++);const au=ga(pa[su],pa[su+1],Kl);return Gl[su](au)};return ma?Kl=>Wl(qn(pa[0],pa[Ba-1],Kl)):Wl}function CM(pa,ha){const ma=pa[pa.length-1];for(let ja=1;ja<=ha;ja++){const La=ga(0,ha,ja);pa.push(je$3(ma,1,La))}}function TM(pa){const ha=[0];return CM(ha,pa.length-1),ha}function AM(pa,ha){return pa.map(ma=>ma*ha)}function RM(pa,ha){return pa.map(()=>ha||mC).splice(0,pa.length-1)}function Vi$1({duration:pa=300,keyframes:ha,times:ma,ease:ja="easeInOut"}){const La=jN(ja)?ja.map(my):my(ja),Ba={done:!1,value:ha[0]},hl=AM(ma&&ma.length===ha.length?ma:TM(ha),pa),Gl=EM(hl,ha,{ease:Array.isArray(La)?La:RM(ha,La)});return{calculatedDuration:pa,next:zl=>(Ba.value=Gl(zl),Ba.done=zl>=pa,Ba)}}const OM=pa=>pa!==null;function Ym(pa,{repeat:ha,repeatType:ma="loop"},ja,La=1){const Ba=pa.filter(OM),hl=La<0||ha&&ma!=="loop"&&ha%2===1?0:Ba.length-1;return!hl||ja===void 0?Ba[hl]:ja}const _M={decay:yp,inertia:yp,tween:Vi$1,keyframes:Vi$1,spring:gl};function _C(pa){typeof pa.type=="string"&&(pa.type=_M[pa.type])}class Xm{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(ha=>{this.resolve=ha})}notifyFinished(){this.resolve()}then(ha,ma){return this.finished.then(ha,ma)}}var PM={};const NM=pa=>pa/100;class Jm extends Xm{constructor(ha){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:ma}=this.options;ma&&ma.updatedAt!==St$2.now()&&this.tick(St$2.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=ha,this.initAnimation(),this.play(),ha.autoplay===!1&&this.pause()}initAnimation(){const{options:ha}=this;_C(ha);const{type:ma=Vi$1,repeat:ja=0,repeatDelay:La=0,repeatType:Ba,velocity:hl=0}=ha;let{keyframes:Gl}=ha;const zl=ma||Vi$1;PM.NODE_ENV!=="production"&&zl!==Vi$1&&Un(Gl.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${Gl}`,"spring-two-frames"),zl!==Vi$1&&typeof Gl[0]!="number"&&(this.mixKeyframes=qa(NM,AC(Gl[0],Gl[1])),Gl=[0,100]);const Wl=zl({...ha,keyframes:Gl});Ba==="mirror"&&(this.mirroredGenerator=zl({...ha,keyframes:[...Gl].reverse(),velocity:-hl})),Wl.calculatedDuration===null&&(Wl.calculatedDuration=Km(Wl));const{calculatedDuration:Kl}=Wl;this.calculatedDuration=Kl,this.resolvedDuration=Kl+La,this.totalDuration=this.resolvedDuration*(ja+1)-La,this.generator=Wl}updateTime(ha){const ma=Math.round(ha-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=ma}tick(ha,ma=!1){const{generator:ja,totalDuration:La,mixKeyframes:Ba,mirroredGenerator:hl,resolvedDuration:Gl,calculatedDuration:zl}=this;if(this.startTime===null)return ja.next(0);const{delay:Wl=0,keyframes:Kl,repeat:su,repeatType:au,repeatDelay:ou,type:$m,onUpdate:Nm,finalKeyframe:Mm}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,ha):this.speed<0&&(this.startTime=Math.min(ha-La/this.speed,this.startTime)),ma?this.currentTime=ha:this.updateTime(ha);const Mg=this.currentTime-Wl*(this.playbackSpeed>=0?1:-1),ly=this.playbackSpeed>=0?Mg<0:Mg>La;this.currentTime=Math.max(Mg,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=La);let uy=this.currentTime,GE=ja;if(su){const cN=Math.min(this.currentTime,La)/Gl;let pN=Math.floor(cN),hN=cN%1;!hN&&cN>=1&&(hN=1),hN===1&&pN--,pN=Math.min(pN,su+1),pN%2&&(au==="reverse"?(hN=1-hN,ou&&(hN-=ou/Gl)):au==="mirror"&&(GE=hl)),uy=qn(0,1,hN)*Gl}const YE=ly?{done:!1,value:Kl[0]}:GE.next(uy);Ba&&(YE.value=Ba(YE.value));let{done:JE}=YE;!ly&&zl!==null&&(JE=this.playbackSpeed>=0?this.currentTime>=La:this.currentTime<=0);const XE=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&JE);return XE&&$m!==yp&&(YE.value=Ym(Kl,this.options,Mm,this.speed)),Nm&&Nm(YE.value),XE&&this.finish(),YE}then(ha,ma){return this.finished.then(ha,ma)}get duration(){return Gt$2(this.calculatedDuration)}get iterationDuration(){const{delay:ha=0}=this.options||{};return this.duration+Gt$2(ha)}get time(){return Gt$2(this.currentTime)}set time(ha){ha=on$2(ha),this.currentTime=ha,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=ha:this.driver&&(this.startTime=this.driver.now()-ha/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(ha){this.updateTime(St$2.now());const ma=this.playbackSpeed!==ha;this.playbackSpeed=ha,ma&&(this.time=Gt$2(this.currentTime))}play(){if(this.isStopped)return;const{driver:ha=hM,startTime:ma}=this.options;this.driver||(this.driver=ha(La=>this.tick(La))),this.options.onPlay?.();const ja=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=ja):this.holdTime!==null?this.startTime=ja-this.holdTime:this.startTime||(this.startTime=ma??ja),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(St$2.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(ha){return this.startTime=0,this.tick(ha,!0)}attachTimeline(ha){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),ha.observe(this)}}function MM(pa){for(let ha=1;ha<pa.length;ha++)pa[ha]??(pa[ha]=pa[ha-1])}const $r$1=pa=>pa*180/Math.PI,bp=pa=>{const ha=$r$1(Math.atan2(pa[1],pa[0]));return xp(ha)},$M={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:pa=>(Math.abs(pa[0])+Math.abs(pa[3]))/2,rotate:bp,rotateZ:bp,skewX:pa=>$r$1(Math.atan(pa[1])),skewY:pa=>$r$1(Math.atan(pa[2])),skew:pa=>(Math.abs(pa[1])+Math.abs(pa[2]))/2},xp=pa=>(pa=pa%360,pa<0&&(pa+=360),pa),wy=bp,Sy=pa=>Math.sqrt(pa[0]*pa[0]+pa[1]*pa[1]),Ey=pa=>Math.sqrt(pa[4]*pa[4]+pa[5]*pa[5]),kM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Sy,scaleY:Ey,scale:pa=>(Sy(pa)+Ey(pa))/2,rotateX:pa=>xp($r$1(Math.atan2(pa[6],pa[5]))),rotateY:pa=>xp($r$1(Math.atan2(-pa[2],pa[0]))),rotateZ:wy,rotate:wy,skewX:pa=>$r$1(Math.atan(pa[4])),skewY:pa=>$r$1(Math.atan(pa[1])),skew:pa=>(Math.abs(pa[1])+Math.abs(pa[4]))/2};function wp(pa){return pa.includes("scale")?1:0}function Sp(pa,ha){if(!pa||pa==="none")return wp(ha);const ma=pa.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let ja,La;if(ma)ja=kM,La=ma;else{const Gl=pa.match(/^matrix\(([-\d.e\s,]+)\)$/u);ja=$M,La=Gl}if(!La)return wp(ha);const Ba=ja[ha],hl=La[1].split(",").map(IM);return typeof Ba=="function"?Ba(hl):hl[Ba]}const DM=(pa,ha)=>{const{transform:ma="none"}=getComputedStyle(pa);return Sp(ma,ha)};function IM(pa){return parseFloat(pa.trim())}const po$1=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mo$1=new Set(po$1),Cy=pa=>pa===ho$1||pa===ue$2,FM=new Set(["x","y","z"]),LM=po$1.filter(pa=>!FM.has(pa));function jM(pa){const ha=[];return LM.forEach(ma=>{const ja=pa.getValue(ma);ja!==void 0&&(ha.push([ma,ja.get()]),ja.set(ma.startsWith("scale")?1:0))}),ha}const Br$1={width:({x:pa},{paddingLeft:ha="0",paddingRight:ma="0"})=>pa.max-pa.min-parseFloat(ha)-parseFloat(ma),height:({y:pa},{paddingTop:ha="0",paddingBottom:ma="0"})=>pa.max-pa.min-parseFloat(ha)-parseFloat(ma),top:(pa,{top:ha})=>parseFloat(ha),left:(pa,{left:ha})=>parseFloat(ha),bottom:({y:pa},{top:ha})=>parseFloat(ha)+(pa.max-pa.min),right:({x:pa},{left:ha})=>parseFloat(ha)+(pa.max-pa.min),x:(pa,{transform:ha})=>Sp(ha,"x"),y:(pa,{transform:ha})=>Sp(ha,"y")};Br$1.translateX=Br$1.x;Br$1.translateY=Br$1.y;const Vr$1=new Set;let Ep=!1,Cp=!1,Tp=!1;function PC(){if(Cp){const pa=Array.from(Vr$1).filter(ja=>ja.needsMeasurement),ha=new Set(pa.map(ja=>ja.element)),ma=new Map;ha.forEach(ja=>{const La=jM(ja);La.length&&(ma.set(ja,La),ja.render())}),pa.forEach(ja=>ja.measureInitialState()),ha.forEach(ja=>{ja.render();const La=ma.get(ja);La&&La.forEach(([Ba,hl])=>{ja.getValue(Ba)?.set(hl)})}),pa.forEach(ja=>ja.measureEndState()),pa.forEach(ja=>{ja.suspendedScrollY!==void 0&&window.scrollTo(0,ja.suspendedScrollY)})}Cp=!1,Ep=!1,Vr$1.forEach(pa=>pa.complete(Tp)),Vr$1.clear()}function NC(){Vr$1.forEach(pa=>{pa.readKeyframes(),pa.needsMeasurement&&(Cp=!0)})}function BM(){Tp=!0,NC(),PC(),Tp=!1}class Zm{constructor(ha,ma,ja,La,Ba,hl=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...ha],this.onComplete=ma,this.name=ja,this.motionValue=La,this.element=Ba,this.isAsync=hl}scheduleResolve(){this.state="scheduled",this.isAsync?(Vr$1.add(this),Ep||(Ep=!0,Fe$3.read(NC),Fe$3.resolveKeyframes(PC))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:ha,name:ma,element:ja,motionValue:La}=this;if(ha[0]===null){const Ba=La?.get(),hl=ha[ha.length-1];if(Ba!==void 0)ha[0]=Ba;else if(ja&&ma){const Gl=ja.readValue(ma,hl);Gl!=null&&(ha[0]=Gl)}ha[0]===void 0&&(ha[0]=hl),La&&Ba===void 0&&La.set(ha[0])}MM(ha)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(ha=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,ha),Vr$1.delete(this)}cancel(){this.state==="scheduled"&&(Vr$1.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const VM=pa=>pa.startsWith("--");function qM(pa,ha,ma){VM(ha)?pa.style.setProperty(ha,ma):pa.style[ha]=ma}const UM=jm(()=>window.ScrollTimeline!==void 0),HM={};function zM(pa,ha){const ma=jm(pa);return()=>HM[ha]??ma()}const MC=zM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),zo$1=([pa,ha,ma,ja])=>`cubic-bezier(${pa}, ${ha}, ${ma}, ${ja})`,Ty={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:zo$1([0,.65,.55,1]),circOut:zo$1([.55,0,1,.45]),backIn:zo$1([.31,.01,.66,-.59]),backOut:zo$1([.33,1.53,.69,.99])};function $C(pa,ha){if(pa)return typeof pa=="function"?MC()?RC(pa,ha):"ease-out":gC(pa)?zo$1(pa):Array.isArray(pa)?pa.map(ma=>$C(ma,ha)||Ty.easeOut):Ty[pa]}function WM(pa,ha,ma,{delay:ja=0,duration:La=300,repeat:Ba=0,repeatType:hl="loop",ease:Gl="easeOut",times:zl}={},Wl=void 0){const Kl={[ha]:ma};zl&&(Kl.offset=zl);const su=$C(Gl,La);Array.isArray(su)&&(Kl.easing=su);const au={delay:ja,duration:La,easing:Array.isArray(su)?"linear":su,fill:"both",iterations:Ba+1,direction:hl==="reverse"?"alternate":"normal"};return Wl&&(au.pseudoElement=Wl),pa.animate(Kl,au)}function kC(pa){return typeof pa=="function"&&"applyToOptions"in pa}function GM({type:pa,...ha}){return kC(pa)&&MC()?pa.applyToOptions(ha):(ha.duration??(ha.duration=300),ha.ease??(ha.ease="easeOut"),ha)}class KM extends Xm{constructor(ha){if(super(),this.finishedTime=null,this.isStopped=!1,!ha)return;const{element:ma,name:ja,keyframes:La,pseudoElement:Ba,allowFlatten:hl=!1,finalKeyframe:Gl,onComplete:zl}=ha;this.isPseudoElement=!!Ba,this.allowFlatten=hl,this.options=ha,Un(typeof ha.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const Wl=GM(ha);this.animation=WM(ma,ja,La,Wl,Ba),Wl.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!Ba){const Kl=Ym(La,this.options,Gl,this.speed);this.updateMotionValue?this.updateMotionValue(Kl):qM(ma,ja,Kl),this.animation.cancel()}zl?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:ha}=this;ha==="idle"||ha==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const ha=this.animation.effect?.getComputedTiming?.().duration||0;return Gt$2(Number(ha))}get iterationDuration(){const{delay:ha=0}=this.options||{};return this.duration+Gt$2(ha)}get time(){return Gt$2(Number(this.animation.currentTime)||0)}set time(ha){this.finishedTime=null,this.animation.currentTime=on$2(ha)}get speed(){return this.animation.playbackRate}set speed(ha){ha<0&&(this.finishedTime=null),this.animation.playbackRate=ha}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(ha){this.animation.startTime=ha}attachTimeline({timeline:ha,observe:ma}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,ha&&UM()?(this.animation.timeline=ha,Kt$1):ma(this)}}const DC={anticipate:fC,backInOut:dC,circInOut:pC};function YM(pa){return pa in DC}function XM(pa){typeof pa.ease=="string"&&YM(pa.ease)&&(pa.ease=DC[pa.ease])}const Ay=10;class JM extends KM{constructor(ha){XM(ha),_C(ha),super(ha),ha.startTime&&(this.startTime=ha.startTime),this.options=ha}updateMotionValue(ha){const{motionValue:ma,onUpdate:ja,onComplete:La,element:Ba,...hl}=this.options;if(!ma)return;if(ha!==void 0){ma.set(ha);return}const Gl=new Jm({...hl,autoplay:!1}),zl=on$2(this.finishedTime??this.time);ma.setWithVelocity(Gl.sample(zl-Ay).value,Gl.sample(zl).value,Ay),Gl.stop()}}const Ry=(pa,ha)=>ha==="zIndex"?!1:!!(typeof pa=="number"||Array.isArray(pa)||typeof pa=="string"&&(fr$1.test(pa)||pa==="0")&&!pa.startsWith("url("));function ZM(pa){const ha=pa[0];if(pa.length===1)return!0;for(let ma=0;ma<pa.length;ma++)if(pa[ma]!==ha)return!0}function QM(pa,ha,ma,ja){const La=pa[0];if(La===null)return!1;if(ha==="display"||ha==="visibility")return!0;const Ba=pa[pa.length-1],hl=Ry(La,ha),Gl=Ry(Ba,ha);return fo$1(hl===Gl,`You are trying to animate ${ha} from "${La}" to "${Ba}". "${hl?Ba:La}" is not an animatable value.`,"value-not-animatable"),!hl||!Gl?!1:ZM(pa)||(ma==="spring"||kC(ma))&&ja}function Ap(pa){pa.duration=0,pa.type="keyframes"}const e$=new Set(["opacity","clipPath","filter","transform"]),t$=jm(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function n$(pa){const{motionValue:ha,name:ma,repeatDelay:ja,repeatType:La,damping:Ba,type:hl}=pa;if(!(ha?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:Gl,transformTemplate:zl}=ha.owner.getProps();return t$()&&ma&&e$.has(ma)&&(ma!=="transform"||!zl)&&!Gl&&!ja&&La!=="mirror"&&Ba!==0&&hl!=="inertia"}const r$=40;class i$ extends Xm{constructor({autoplay:ha=!0,delay:ma=0,type:ja="keyframes",repeat:La=0,repeatDelay:Ba=0,repeatType:hl="loop",keyframes:Gl,name:zl,motionValue:Wl,element:Kl,...su}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=St$2.now();const au={autoplay:ha,delay:ma,type:ja,repeat:La,repeatDelay:Ba,repeatType:hl,name:zl,motionValue:Wl,element:Kl,...su},ou=Kl?.KeyframeResolver||Zm;this.keyframeResolver=new ou(Gl,($m,Nm,Mm)=>this.onKeyframesResolved($m,Nm,au,!Mm),zl,Wl,Kl),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(ha,ma,ja,La){this.keyframeResolver=void 0;const{name:Ba,type:hl,velocity:Gl,delay:zl,isHandoff:Wl,onUpdate:Kl}=ja;this.resolvedAt=St$2.now(),QM(ha,Ba,hl,Gl)||((Hn.instantAnimations||!zl)&&Kl?.(Ym(ha,ja,ma)),ha[0]=ha[ha.length-1],Ap(ja),ja.repeat=0);const su={startTime:La?this.resolvedAt?this.resolvedAt-this.createdAt>r$?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:ma,...ja,keyframes:ha},au=!Wl&&n$(su)?new JM({...su,element:su.motionValue.owner.current}):new Jm(su);au.finished.then(()=>this.notifyFinished()).catch(Kt$1),this.pendingTimeline&&(this.stopTimeline=au.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=au}get finished(){return this._animation?this.animation.finished:this._finished}then(ha,ma){return this.finished.finally(ha).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),BM()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(ha){this.animation.time=ha}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(ha){this.animation.speed=ha}get startTime(){return this.animation.startTime}attachTimeline(ha){return this._animation?this.stopTimeline=this.animation.attachTimeline(ha):this.pendingTimeline=ha,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const o$=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function a$(pa){const ha=o$.exec(pa);if(!ha)return[,];const[,ma,ja,La]=ha;return[`--${ma??ja}`,La]}const s$=4;function IC(pa,ha,ma=1){Un(ma<=s$,`Max CSS variable fallback depth detected in property "${pa}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[ja,La]=a$(pa);if(!ja)return;const Ba=window.getComputedStyle(ha).getPropertyValue(ja);if(Ba){const hl=Ba.trim();return rC(hl)?parseFloat(hl):hl}return Hm(La)?IC(La,ha,ma+1):La}function Qm(pa,ha){return pa?.[ha]??pa?.default??pa}const FC=new Set(["width","height","top","left","right","bottom",...po$1]),l$={test:pa=>pa==="auto",parse:pa=>pa},LC=pa=>ha=>ha.test(pa),jC=[ho$1,ue$2,Tn$1,or$1,JN,XN,l$],Oy=pa=>jC.find(LC(pa));function c$(pa){return typeof pa=="number"?pa===0:pa!==null?pa==="none"||pa==="0"||oC(pa):!0}const u$=new Set(["brightness","contrast","saturate","opacity"]);function d$(pa){const[ha,ma]=pa.slice(0,-1).split("(");if(ha==="drop-shadow")return pa;const[ja]=ma.match(zm)||[];if(!ja)return pa;const La=ma.replace(ja,"");let Ba=u$.has(ha)?1:0;return ja!==ma&&(Ba*=100),ha+"("+Ba+La+")"}const f$=/\b([a-z-]*)\(.*?\)/gu,Rp={...fr$1,getAnimatableNone:pa=>{const ha=pa.match(f$);return ha?ha.map(d$).join(" "):pa}},_y={...ho$1,transform:Math.round},h$={rotate:or$1,rotateX:or$1,rotateY:or$1,rotateZ:or$1,scale:ys$1,scaleX:ys$1,scaleY:ys$1,scaleZ:ys$1,skew:or$1,skewX:or$1,skewY:or$1,distance:ue$2,translateX:ue$2,translateY:ue$2,translateZ:ue$2,x:ue$2,y:ue$2,z:ue$2,perspective:ue$2,transformPerspective:ue$2,opacity:va,originX:gy,originY:gy,originZ:ue$2},eg={borderWidth:ue$2,borderTopWidth:ue$2,borderRightWidth:ue$2,borderBottomWidth:ue$2,borderLeftWidth:ue$2,borderRadius:ue$2,radius:ue$2,borderTopLeftRadius:ue$2,borderTopRightRadius:ue$2,borderBottomRightRadius:ue$2,borderBottomLeftRadius:ue$2,width:ue$2,maxWidth:ue$2,height:ue$2,maxHeight:ue$2,top:ue$2,right:ue$2,bottom:ue$2,left:ue$2,padding:ue$2,paddingTop:ue$2,paddingRight:ue$2,paddingBottom:ue$2,paddingLeft:ue$2,margin:ue$2,marginTop:ue$2,marginRight:ue$2,marginBottom:ue$2,marginLeft:ue$2,backgroundPositionX:ue$2,backgroundPositionY:ue$2,...h$,zIndex:_y,fillOpacity:va,strokeOpacity:va,numOctaves:_y},p$={...eg,color:Ye$1,backgroundColor:Ye$1,outlineColor:Ye$1,fill:Ye$1,stroke:Ye$1,borderColor:Ye$1,borderTopColor:Ye$1,borderRightColor:Ye$1,borderBottomColor:Ye$1,borderLeftColor:Ye$1,filter:Rp,WebkitFilter:Rp},BC=pa=>p$[pa];function VC(pa,ha){let ma=BC(pa);return ma!==Rp&&(ma=fr$1),ma.getAnimatableNone?ma.getAnimatableNone(ha):void 0}const m$=new Set(["auto","none","0"]);function g$(pa,ha,ma){let ja=0,La;for(;ja<pa.length&&!La;){const Ba=pa[ja];typeof Ba=="string"&&!m$.has(Ba)&&ya(Ba).values.length&&(La=pa[ja]),ja++}if(La&&ma)for(const Ba of ha)pa[Ba]=VC(ma,La)}class v$ extends Zm{constructor(ha,ma,ja,La,Ba){super(ha,ma,ja,La,Ba,!0)}readKeyframes(){const{unresolvedKeyframes:ha,element:ma,name:ja}=this;if(!ma||!ma.current)return;super.readKeyframes();for(let zl=0;zl<ha.length;zl++){let Wl=ha[zl];if(typeof Wl=="string"&&(Wl=Wl.trim(),Hm(Wl))){const Kl=IC(Wl,ma.current);Kl!==void 0&&(ha[zl]=Kl),zl===ha.length-1&&(this.finalKeyframe=Wl)}}if(this.resolveNoneKeyframes(),!FC.has(ja)||ha.length!==2)return;const[La,Ba]=ha,hl=Oy(La),Gl=Oy(Ba);if(hl!==Gl)if(Cy(hl)&&Cy(Gl))for(let zl=0;zl<ha.length;zl++){const Wl=ha[zl];typeof Wl=="string"&&(ha[zl]=parseFloat(Wl))}else Br$1[ja]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:ha,name:ma}=this,ja=[];for(let La=0;La<ha.length;La++)(ha[La]===null||c$(ha[La]))&&ja.push(La);ja.length&&g$(ha,ja,ma)}measureInitialState(){const{element:ha,unresolvedKeyframes:ma,name:ja}=this;if(!ha||!ha.current)return;ja==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Br$1[ja](ha.measureViewportBox(),window.getComputedStyle(ha.current)),ma[0]=this.measuredOrigin;const La=ma[ma.length-1];La!==void 0&&ha.getValue(ja,La).jump(La,!1)}measureEndState(){const{element:ha,name:ma,unresolvedKeyframes:ja}=this;if(!ha||!ha.current)return;const La=ha.getValue(ma);La&&La.jump(this.measuredOrigin,!1);const Ba=ja.length-1,hl=ja[Ba];ja[Ba]=Br$1[ma](ha.measureViewportBox(),window.getComputedStyle(ha.current)),hl!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=hl),this.removedTransforms?.length&&this.removedTransforms.forEach(([Gl,zl])=>{ha.getValue(Gl).set(zl)}),this.resolveNoneKeyframes()}}function y$(pa,ha,ma){if(pa instanceof EventTarget)return[pa];if(typeof pa=="string"){const La=document.querySelectorAll(pa);return La?Array.from(La):[]}return Array.from(pa)}const qC=(pa,ha)=>ha&&typeof pa=="number"?ha.transform(pa):pa;function UC(pa){return iC(pa)&&"offsetHeight"in pa}var b$={};const Py=30,x$=pa=>!isNaN(parseFloat(pa));class w${constructor(ha,ma={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=ja=>{const La=St$2.now();if(this.updatedAt!==La&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(ja),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const Ba of this.dependents)Ba.dirty()},this.hasAnimated=!1,this.setCurrent(ha),this.owner=ma.owner}setCurrent(ha){this.current=ha,this.updatedAt=St$2.now(),this.canTrackVelocity===null&&ha!==void 0&&(this.canTrackVelocity=x$(this.current))}setPrevFrameValue(ha=this.current){this.prevFrameValue=ha,this.prevUpdatedAt=this.updatedAt}onChange(ha){return b$.NODE_ENV!=="production"&&Vm(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",ha)}on(ha,ma){this.events[ha]||(this.events[ha]=new Bm);const ja=this.events[ha].add(ma);return ha==="change"?()=>{ja(),Fe$3.read(()=>{this.events.change.getSize()||this.stop()})}:ja}clearListeners(){for(const ha in this.events)this.events[ha].clear()}attach(ha,ma){this.passiveEffect=ha,this.stopPassiveEffect=ma}set(ha){this.passiveEffect?this.passiveEffect(ha,this.updateAndNotify):this.updateAndNotify(ha)}setWithVelocity(ha,ma,ja){this.set(ma),this.prev=void 0,this.prevFrameValue=ha,this.prevUpdatedAt=this.updatedAt-ja}jump(ha,ma=!0){this.updateAndNotify(ha),this.prev=ha,this.prevUpdatedAt=this.prevFrameValue=void 0,ma&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(ha){this.dependents||(this.dependents=new Set),this.dependents.add(ha)}removeDependent(ha){this.dependents&&this.dependents.delete(ha)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const ha=St$2.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||ha-this.updatedAt>Py)return 0;const ma=Math.min(this.updatedAt-this.prevUpdatedAt,Py);return aC(parseFloat(this.current)-parseFloat(this.prevFrameValue),ma)}start(ha){return this.stop(),new Promise(ma=>{this.hasAnimated=!0,this.animation=ha(ma),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function to$1(pa,ha){return new w$(pa,ha)}const{schedule:tg}=vC(queueMicrotask,!1),nn$2={x:!1,y:!1};function HC(){return nn$2.x||nn$2.y}function S$(pa){return pa==="x"||pa==="y"?nn$2[pa]?null:(nn$2[pa]=!0,()=>{nn$2[pa]=!1}):nn$2.x||nn$2.y?null:(nn$2.x=nn$2.y=!0,()=>{nn$2.x=nn$2.y=!1})}function zC(pa,ha){const ma=y$(pa),ja=new AbortController,La={passive:!0,...ha,signal:ja.signal};return[ma,La,()=>ja.abort()]}function Ny(pa){return!(pa.pointerType==="touch"||HC())}function E$(pa,ha,ma={}){const[ja,La,Ba]=zC(pa,ma),hl=Gl=>{if(!Ny(Gl))return;const{target:zl}=Gl,Wl=ha(zl,Gl);if(typeof Wl!="function"||!zl)return;const Kl=su=>{Ny(su)&&(Wl(su),zl.removeEventListener("pointerleave",Kl))};zl.addEventListener("pointerleave",Kl,La)};return ja.forEach(Gl=>{Gl.addEventListener("pointerenter",hl,La)}),Ba}const WC=(pa,ha)=>ha?pa===ha?!0:WC(pa,ha.parentElement):!1,ng=pa=>pa.pointerType==="mouse"?typeof pa.button!="number"||pa.button<=0:pa.isPrimary!==!1,C$=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function T$(pa){return C$.has(pa.tagName)||pa.tabIndex!==-1}const Ks$1=new WeakSet;function My(pa){return ha=>{ha.key==="Enter"&&pa(ha)}}function hu(pa,ha){pa.dispatchEvent(new PointerEvent("pointer"+ha,{isPrimary:!0,bubbles:!0}))}const A$=(pa,ha)=>{const ma=pa.currentTarget;if(!ma)return;const ja=My(()=>{if(Ks$1.has(ma))return;hu(ma,"down");const La=My(()=>{hu(ma,"up")}),Ba=()=>hu(ma,"cancel");ma.addEventListener("keyup",La,ha),ma.addEventListener("blur",Ba,ha)});ma.addEventListener("keydown",ja,ha),ma.addEventListener("blur",()=>ma.removeEventListener("keydown",ja),ha)};function $y(pa){return ng(pa)&&!HC()}function R$(pa,ha,ma={}){const[ja,La,Ba]=zC(pa,ma),hl=Gl=>{const zl=Gl.currentTarget;if(!$y(Gl))return;Ks$1.add(zl);const Wl=ha(zl,Gl),Kl=(ou,$m)=>{window.removeEventListener("pointerup",su),window.removeEventListener("pointercancel",au),Ks$1.has(zl)&&Ks$1.delete(zl),$y(ou)&&typeof Wl=="function"&&Wl(ou,{success:$m})},su=ou=>{Kl(ou,zl===window||zl===document||ma.useGlobalTarget||WC(zl,ou.target))},au=ou=>{Kl(ou,!1)};window.addEventListener("pointerup",su,La),window.addEventListener("pointercancel",au,La)};return ja.forEach(Gl=>{(ma.useGlobalTarget?window:Gl).addEventListener("pointerdown",hl,La),UC(Gl)&&(Gl.addEventListener("focus",zl=>A$(zl,La)),!T$(Gl)&&!Gl.hasAttribute("tabindex")&&(Gl.tabIndex=0))}),Ba}function GC(pa){return iC(pa)&&"ownerSVGElement"in pa}function O$(pa){return GC(pa)&&pa.tagName==="svg"}const ut$2=pa=>!!(pa&&pa.getVelocity),_$=[...jC,Ye$1,fr$1],P$=pa=>_$.find(LC(pa)),rg=reactExports.createContext({transformPagePoint:pa=>pa,isStatic:!1,reducedMotion:"never"});function ky(pa,ha){if(typeof pa=="function")return pa(ha);pa!=null&&(pa.current=ha)}function N$(...pa){return ha=>{let ma=!1;const ja=pa.map(La=>{const Ba=ky(La,ha);return!ma&&typeof Ba=="function"&&(ma=!0),Ba});if(ma)return()=>{for(let La=0;La<ja.length;La++){const Ba=ja[La];typeof Ba=="function"?Ba():ky(pa[La],null)}}}}function M$(...pa){return reactExports.useCallback(N$(...pa),pa)}class $$ extends reactExports.Component{getSnapshotBeforeUpdate(ha){const ma=this.props.childRef.current;if(ma&&ha.isPresent&&!this.props.isPresent){const ja=ma.offsetParent,La=UC(ja)&&ja.offsetWidth||0,Ba=this.props.sizeRef.current;Ba.height=ma.offsetHeight||0,Ba.width=ma.offsetWidth||0,Ba.top=ma.offsetTop,Ba.left=ma.offsetLeft,Ba.right=La-Ba.width-Ba.left}return null}componentDidUpdate(){}render(){return this.props.children}}function k$({children:pa,isPresent:ha,anchorX:ma,root:ja}){const La=reactExports.useId(),Ba=reactExports.useRef(null),hl=reactExports.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:Gl}=reactExports.useContext(rg),zl=M$(Ba,pa?.ref);return reactExports.useInsertionEffect(()=>{const{width:Wl,height:Kl,top:su,left:au,right:ou}=hl.current;if(ha||!Ba.current||!Wl||!Kl)return;const $m=ma==="left"?`left: ${au}`:`right: ${ou}`;Ba.current.dataset.motionPopId=La;const Nm=document.createElement("style");Gl&&(Nm.nonce=Gl);const Mm=ja??document.head;return Mm.appendChild(Nm),Nm.sheet&&Nm.sheet.insertRule(`
|
|
73
73
|
[data-motion-pop-id="${La}"] {
|
|
74
74
|
position: absolute !important;
|
|
75
75
|
width: ${Wl}px !important;
|
|
@@ -180,7 +180,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${ha}Chan
|
|
|
180
180
|
Copyright (c) 2018 Jed Watson.
|
|
181
181
|
Licensed under the MIT License (MIT), see
|
|
182
182
|
http://jedwatson.github.io/classnames
|
|
183
|
-
*/var N0;function jj(){return N0||(N0=1,(function(pa){(function(){var ha={}.hasOwnProperty;function ma(){for(var Ba="",hl=0;hl<arguments.length;hl++){var Gl=arguments[hl];Gl&&(Ba=La(Ba,ja(Gl)))}return Ba}function ja(Ba){if(typeof Ba=="string"||typeof Ba=="number")return Ba;if(typeof Ba!="object")return"";if(Array.isArray(Ba))return ma.apply(null,Ba);if(Ba.toString!==Object.prototype.toString&&!Ba.toString.toString().includes("[native code]"))return Ba.toString();var hl="";for(var Gl in Ba)ha.call(Ba,Gl)&&Ba[Gl]&&(hl=La(hl,Gl));return hl}function La(Ba,hl){return hl?Ba?Ba+" "+hl:Ba+hl:Ba}pa.exports?(ma.default=ma,pa.exports=ma):window.classNames=ma})()})(Lu)),Lu.exports}var Bj=jj();const gr$1=bo$1(Bj),HA=({entityName:pa,entityId:ha,urlPath:ma,relationship:ja,unqualifiedEntityName:La,deployedApiUrl:Ba,buttonConfig:hl})=>{const[Gl,zl]=reactExports.useState(!1),Wl=useQueryClient(),Kl=useMutation({mutationFn:async su=>{if(Ba){const au=`${ma}${ja?`/${ja}/${La}`:""}`;await _e$2.delete(`${Ba}/${au}/${su}`)}else await Dr$1.deleteEntityInstance(pa,su)},onSuccess:()=>{Wl.invalidateQueries({queryKey:["entityData",pa]}),zl(!1)}});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[hl?jsxRuntimeExports.jsxs("button",{className:gr$1("fx-button",`fx-button--${hl.style}`,"hover:brightness-125"),onClick:su=>{su.stopPropagation(),zl(!0)},children:[jsxRuntimeExports.jsx(ke$5,{icon:hl.icon}),jsxRuntimeExports.jsx("span",{children:hl.text})]}):jsxRuntimeExports.jsx(ke$5,{icon:"lucide:trash-2",className:"text-red-500 cursor-pointer transition-colors hover:text-red-700",onClick:su=>{su.stopPropagation(),zl(!0)}}),Gl&&jsxRuntimeExports.jsx(Lj,{closeHandler:()=>zl(!1),onConfirm:()=>Kl.mutate(ha),title:"Delete Entity",message:"Are you sure you want to delete this entity? This action cannot be undone.",isLoading:Kl.isPending,itemName:La})]})},zA=({queryKey:pa,url:ha})=>{const ma=pt$3()?.appInfo?.apiUrl,ja=useQueryClient(),La=ma?`${ma}/${ha}`:ha;return reactExports.useEffect(()=>{const Ba=hl=>{const Gl=hl,{entityName:zl,componentName:Wl}=Gl.detail,Kl=`${Wl}/${zl}`;(ha.includes(zl)||ha===zl||ha===Kl||ha.endsWith(`/${zl}`))&&(console.log(`🔄 Invalidating cache for ${ha} due to ${Gl.detail.operation} on ${Kl}`),ja.invalidateQueries({queryKey:pa}))};return ma||window.addEventListener("agentlang-data-change",Ba),()=>{ma||window.removeEventListener("agentlang-data-change",Ba)}},[ha,ma,ja]),useQuery({queryKey:pa,queryFn:async()=>{if(ma)return(await _e$2.get(La)).data;{const Ba=ha.split("/").filter(hl=>!hl.match(/^\d+$/))[0];return Dr$1.fetchEntityInstancesByUrl(ha,Ba)}},enabled:!0,retry:(Ba,hl)=>hl?.message?.includes("cooldown")||hl?.message?.includes("Query queue is full")||hl?.message?.includes("out of memory")||hl?.message?.includes("System is currently recovering")?!1:Ba<1,retryDelay:Ba=>Math.min(1e3*2**Ba,3e3),staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!0,refetchOnReconnect:!!ma,refetchOnWindowFocus:!!ma})},Vj=pa=>{const{data:ha,isLoading:ma,isError:ja,error:La}=zA({queryKey:["entityData",pa],url:pa});return{count:Array.isArray(ha)?ha.length:0,isLoading:ma,isError:ja,error:La?.message,data:ha}},WA=({entityName:pa,viewSpec:ha,viewType:ma,isRelationship:ja=!1})=>{const{getRelationship:La}=tC(),{customNavigate:Ba}=Se$3(),{"*":hl}=useParams(),{pathParts:Gl}=Lt$3(hl),zl=Gl.slice(1).join("/"),Wl=pt$3()?.appInfo?.apiUrl,Kl=pa.split("/")[1],su=ja?La(Kl):void 0;console.log("unqualifiedEntityName",Kl),console.log("relationship",su);const au=pt$3(),ou=au?.[pa],$m=ou?.attributes,Nm=`${pa}.ui.dashboard.body`,Mm=au?.[Nm]?.actions?.create,Mg=$m?Object.keys($m).find(wN=>$m[wN].id):"id",ly=ja?`${zl}/${su}/${Kl}`:zl,{data:uy,isLoading:GE,isError:YE,error:JE,refetch:XE}=zA({queryKey:["entityData",ly],url:ly}),cN=PN({data:uy,entityName:pa,isRelationship:ja,relationshipName:su,uiSpec:au}),[pN]=reactExports.useState([]),[hN,lN]=reactExports.useState({}),[rA,dN]=reactExports.useState(!1),[uN,gN]=reactExports.useState("");if(GE)return jsxRuntimeExports.jsx("div",{className:"table-container",children:jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center py-20",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-blue-50 rounded-full mb-4",children:jsxRuntimeExports.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-2 border-blue-300 border-t-blue-600"})}),jsxRuntimeExports.jsx("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Loading data..."}),jsxRuntimeExports.jsxs("p",{className:"text-xs text-gray-500",children:["Fetching ",Kl," records"]})]})})});const mN=cN.filter(wN=>{if(uN&&!ha.fields.some(FZ=>String(wN[FZ]).toLowerCase().includes(uN.toLowerCase())))return!1;for(const[FZ,IZ]of Object.entries(hN))if(IZ&&!String(wN[FZ]).toLowerCase().includes(IZ.toLowerCase()))return!1;return!0}),bN=(wN,FZ)=>{const IZ=pa.split("/")[1];let lQ=`/${hl}/${ja?`${su}/${IZ}/`:""}${wN}`;FZ==="edit"&&(lQ+="/edit"),Ba(lQ)},xN=()=>jsxRuntimeExports.jsx("div",{className:"overflow-x-auto thin-scrollbar",children:jsxRuntimeExports.jsxs("table",{className:"w-full",children:[jsxRuntimeExports.jsx("thead",{className:"border-b border-border bg-table-header",children:jsxRuntimeExports.jsxs("tr",{children:[ha.fields.map(wN=>jsxRuntimeExports.jsxs("th",{className:"px-6 py-3 text-left text-xs font-semibold text-font-table-header uppercase tracking-wider",children:[jsxRuntimeExports.jsx("div",{className:"flex gap-2 items-center",children:Ft$4(wN)}),jsxRuntimeExports.jsx(Vn$1.div,{initial:{height:0,opacity:0},animate:{height:rA?"auto":0,opacity:rA?1:0},className:"overflow-hidden",children:jsxRuntimeExports.jsxs("div",{className:"relative mt-1",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"absolute left-2 top-1/2 -translate-y-1/2 text-font-secondary"}),jsxRuntimeExports.jsx("input",{className:"w-full pl-8! pr-4 py-1 border border-gray-600 rounded-md bg-secondary text-sm",type:"text",placeholder:`Search ${wN}...`,value:hN[wN]||"",onChange:FZ=>{lN(IZ=>({...IZ,[wN]:FZ.target.value}))}})]})})]},wN)),jsxRuntimeExports.jsx("th",{className:"px-6 py-3 text-right text-xs font-semibold text-font-table-header uppercase tracking-wider",children:"Actions"})]})}),jsxRuntimeExports.jsx("tbody",{className:"divide-y divide-gray-700",children:YE?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsxs("td",{colSpan:ha.fields.length+1,className:"text-center py-12 text-red-400 px-6",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:alert-circle-outline",className:"text-4xl text-red-400 mb-2 mx-auto"}),JE?.message||"Error fetching data",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("button",{onClick:()=>XE(),className:"mt-2 inline-flex items-center px-3 py-1.5 bg-primary text-white text-xs rounded-md hover:bg-primary/90 transition-colors",children:[jsxRuntimeExports.jsx(ke$5,{icon:"material-symbols:refresh",className:"mr-1.5 text-xs"}),"Retry"]})]})}):mN.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsxs("td",{colSpan:ha.fields.length+1,className:"text-center py-12 text-gray-400",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:database-off",className:"text-4xl text-gray-500 mb-2 mx-auto"}),"No data available"]})}):mN.map((wN,FZ)=>jsxRuntimeExports.jsxs("tr",{className:"hover:bg-gray-800 transition-colors cursor-pointer",onClick:()=>{const IZ=wN[Mg||"id"];bN(IZ)},children:[ha.fields.map(IZ=>jsxRuntimeExports.jsx("td",{className:"px-6 py-4 text-sm text-gray-300 whitespace-nowrap",children:String(wN[IZ]||"")},IZ)),jsxRuntimeExports.jsx("td",{className:"px-6 py-4 text-right whitespace-nowrap",onClick:IZ=>IZ.stopPropagation(),children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end gap-2 items-center",children:[jsxRuntimeExports.jsx("button",{onClick:IZ=>{IZ.stopPropagation(),bN(wN[Mg||"id"],"edit")},className:"p-2 text-blue-400 hover:bg-gray-700 rounded-lg transition-colors cursor-pointer",title:"Edit",children:jsxRuntimeExports.jsx(ke$5,{icon:"lucide:edit",className:"text-lg"})}),jsxRuntimeExports.jsx("div",{className:"p-2 text-red-400 hover:bg-gray-700 rounded-lg transition-colors cursor-pointer",children:jsxRuntimeExports.jsx(HA,{entityName:pa,entityId:wN[Mg||"id"],urlPath:zl,relationship:su||void 0,unqualifiedEntityName:Kl,deployedApiUrl:Wl})})]})})]},FZ))})]})}),vN=()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[rA&&jsxRuntimeExports.jsx("div",{className:"cards-grid mb-2",children:ha.fields.map(wN=>jsxRuntimeExports.jsxs("div",{className:"column-filter-container",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"search-icon"}),jsxRuntimeExports.jsx("input",{className:"search-input",type:"text",placeholder:`Search ${wN}...`,value:hN[wN]||"",onChange:FZ=>{lN(IZ=>({...IZ,[wN]:FZ.target.value}))}}),jsxRuntimeExports.jsx(ke$5,{icon:"mdi:close-thick",className:"cancel-search",onClick:()=>{lN(FZ=>{const IZ={...FZ};return delete IZ[wN],IZ})}})]},wN))}),jsxRuntimeExports.jsx("div",{className:"cards-grid",children:YE?jsxRuntimeExports.jsxs("div",{className:"no-records bg-red-900/20 text-red-400 border border-red-700 rounded-md",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:alert-circle-outline",className:"text-4xl text-red-400 mb-2 mx-auto"}),JE?.message||"Error fetching data",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("button",{onClick:()=>XE(),className:"mt-2 inline-flex items-center px-3 py-1.5 bg-primary text-white text-xs rounded-md hover:bg-primary/90 transition-colors",children:[jsxRuntimeExports.jsx(ke$5,{icon:"material-symbols:refresh",className:"mr-1.5 text-xs"}),"Retry"]})]}):mN.length>0?mN.map((wN,FZ)=>jsxRuntimeExports.jsx("div",{className:"card-component",onClick:()=>{const IZ=wN[Mg||"id"];bN(IZ)},children:ha.fields.map(IZ=>jsxRuntimeExports.jsxs("div",{className:"form-item gap-0.5",children:[jsxRuntimeExports.jsx("span",{className:"label",children:Ft$4(IZ)}),jsxRuntimeExports.jsx("span",{children:String(wN[IZ]||"")})]},IZ))},FZ)):jsxRuntimeExports.jsx("div",{className:"no-records bg-white/5 rounded-md",children:"No records to display"})})]});return jsxRuntimeExports.jsxs("div",{className:"bg-gray-900/50 rounded-lg shadow-sm border border-gray-700",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-gray-700",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntimeExports.jsx(ke$5,{icon:ou?.icon||Ot$3.entity,style:{color:ou?.color},className:"w-6 h-6 shrink-0"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold text-white",children:ou?.displayName||pa.split("/")[1]}),ou?.description&&jsxRuntimeExports.jsx("p",{className:"text-xs text-font-secondary",children:ou.description})]})]}),jsxRuntimeExports.jsxs("div",{className:"flex gap-3 items-center",children:[ha.showGlobalFilter&&jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"absolute left-3 top-1/2 -translate-y-1/2 text-font-secondary"}),jsxRuntimeExports.jsx("input",{placeholder:"Search...",className:"pl-8! pr-4 py-2 border border-gray-600 rounded-lg w-64 bg-secondary focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:uN,onChange:wN=>{gN(wN.target.value)}})]}),ha.showColumnFilter&&jsxRuntimeExports.jsx("button",{className:"p-2 text-font-secondary hover:bg-gray-700 rounded-lg transition-colors",onClick:()=>dN(!rA),children:jsxRuntimeExports.jsx(ke$5,{icon:rA?"material-symbols:filter-list-off-rounded":"material-symbols:filter-list-rounded",className:"text-lg"})}),jsxRuntimeExports.jsx(NN,{entityName:pa,createAction:Mm,relationship:su})]})]}),ma==="Table"?xN():vN(),jsxRuntimeExports.jsx("div",{className:"table-footer",children:ha.enableSelection&&ha.actions&&pN.length>0&&ha.actions?.map(wN=>jsxRuntimeExports.jsx("div",{className:"fx-button",children:wN},wN))})]})},qj=({entityName:pa,schema:ha})=>{const ma=`${pa}.ui.dashboard`,ja=ha[ma];return jsxRuntimeExports.jsx("div",{className:"fx-dashboard-container",children:ja.map(La=>{const Ba=ha[La];if(Array.isArray(Ba)||typeof Ba!="object"||Ba===null)return null;const hl=Ba.view,Gl=Object.keys(hl)[0],zl=Object.values(hl)[0];return jsxRuntimeExports.jsx("div",{children:Gl==="Heading"?jsxRuntimeExports.jsx(eC,{viewSpec:zl}):Gl==="Table"||Gl==="Cards"?jsxRuntimeExports.jsx(WA,{entityName:pa,viewSpec:zl,viewType:Gl}):null},La)})})},nt$3=[];for(let pa=0;pa<256;++pa)nt$3.push((pa+256).toString(16).slice(1));function Uj(pa,ha=0){return(nt$3[pa[ha+0]]+nt$3[pa[ha+1]]+nt$3[pa[ha+2]]+nt$3[pa[ha+3]]+"-"+nt$3[pa[ha+4]]+nt$3[pa[ha+5]]+"-"+nt$3[pa[ha+6]]+nt$3[pa[ha+7]]+"-"+nt$3[pa[ha+8]]+nt$3[pa[ha+9]]+"-"+nt$3[pa[ha+10]]+nt$3[pa[ha+11]]+nt$3[pa[ha+12]]+nt$3[pa[ha+13]]+nt$3[pa[ha+14]]+nt$3[pa[ha+15]]).toLowerCase()}let ju;const Hj=new Uint8Array(16);function zj(){if(!ju){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ju=crypto.getRandomValues.bind(crypto)}return ju(Hj)}const Wj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),M0={randomUUID:Wj};function GA(pa,ha,ma){if(M0.randomUUID&&!pa)return M0.randomUUID();pa=pa||{};const ja=pa.random??pa.rng?.()??zj();if(ja.length<16)throw new Error("Random bytes length must be >= 16");return ja[6]=ja[6]&15|64,ja[8]=ja[8]&63|128,Uj(ja)}const KA=async pa=>(await _e$2.get(pa)).data,Gj=({entityName:pa,schema:ha})=>{const{"*":ma}=useParams(),{customNavigate:ja}=Se$3(),{pathParts:La}=Lt$3(ma),Ba=La.slice(1).join("/"),hl=La[La.length-1],Gl=pt$3()?.appInfo?.apiUrl,zl=`${Gl}/${Ba}`,Wl=pa.split("/")[1],{actions:Kl,view:su}=ha,{Card:au}=su,{fields:ou,layout:$m="list",columns:Nm=1}=au,Mm=Kl?.edit,Mg=Kl?.delete,ly=pt$3()?.[pa],uy=ly?.attributes,GE=uy?Object.keys(uy).find(lN=>uy[lN].id):"id",{data:YE,isLoading:JE,isError:XE,error:cN}=useQuery({queryKey:["entityInstance",pa,hl],queryFn:()=>Gl?KA(zl):Dr$1.fetchEntityInstance(pa,hl)});if(JE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsxs("div",{className:"animate-pulse",children:[jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"}),jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"}),jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"})]})});if(XE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsxs("div",{className:"text-red-600 p-4",children:[jsxRuntimeExports.jsx("h3",{className:"font-semibold mb-2",children:"Error loading data"}),jsxRuntimeExports.jsx("p",{className:"text-sm",children:cN instanceof Error?cN.message:"An unexpected error occurred"})]})});if(!YE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsx("div",{className:"text-gray-500 p-4",children:jsxRuntimeExports.jsx("p",{children:"No data available"})})});const pN=Array.isArray(YE)?YE[0][Wl]:YE,hN=lN=>lN==null?"N/A":typeof lN=="boolean"?lN?"Yes":"No":typeof lN=="object"?JSON.stringify(lN):String(lN);return jsxRuntimeExports.jsxs("div",{className:"bg-gray-900/50 rounded-lg shadow-sm border border-gray-700 p-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center w-full mb-4",children:[jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold text-white",children:ly?.displayName||Wl}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[Mm&&jsxRuntimeExports.jsxs("button",{className:gr$1("fx-button",`fx-button--${Mm.style}`),onClick:()=>ja(`/${ma}/edit`),children:[jsxRuntimeExports.jsx(ke$5,{icon:Mm.icon}),jsxRuntimeExports.jsx("span",{children:Mm.text})]}),Mg&&jsxRuntimeExports.jsx(HA,{entityName:pa,entityId:GE?String(pN[GE]):hl,urlPath:Ba,unqualifiedEntityName:Wl,deployedApiUrl:Gl,buttonConfig:Mg})]})]}),jsxRuntimeExports.jsx("div",{className:gr$1("w-full gap-6",{grid:$m==="grid","flex flex-col":$m==="list"}),style:{gridTemplateColumns:$m==="grid"?`repeat(${Nm}, 1fr)`:void 0},children:ou.map(lN=>jsxRuntimeExports.jsxs("div",{className:"border-b border-gray-700 pb-3",children:[jsxRuntimeExports.jsx("dt",{className:"text-sm font-medium text-gray-400 mb-1",children:Ft$4(lN)}),jsxRuntimeExports.jsx("dd",{className:"text-base text-white",children:hN(pN[lN])})]},lN))})]})},Kj=({fieldCount:pa=5})=>jsxRuntimeExports.jsx("div",{className:"fx-dashboard-container animate-pulse",children:jsxRuntimeExports.jsxs("div",{className:"fx-form",children:[jsxRuntimeExports.jsxs("div",{className:"fx-form-body",children:[jsxRuntimeExports.jsx("div",{className:"title h-8 bg-gray-300/20 rounded w-1/3 mb-6"}),[...Array(pa)].map((ha,ma)=>jsxRuntimeExports.jsxs("div",{className:"form-item mb-4",children:[jsxRuntimeExports.jsx("div",{className:"label h-4 bg-gray-300/20 rounded w-1/4 mb-2"}),jsxRuntimeExports.jsx("div",{className:"form-input h-10 bg-gray-300/20 rounded"})]},ma))]}),jsxRuntimeExports.jsx("div",{className:"h-10 bg-gray-300/20 rounded w-28 mt-4"})]})}),Ng=({fieldName:pa})=>jsxRuntimeExports.jsx(ErrorMessage,{name:pa,children:ha=>jsxRuntimeExports.jsxs("div",{className:"formik-error-message",children:[jsxRuntimeExports.jsx(ke$5,{icon:"bi:exclamation-circle-fill"}),jsxRuntimeExports.jsx("span",{children:ha})]})}),aQ=({name:pa,label:ha,placeholder:ma,type:ja="text",isFloating:La=!0,ref:Ba,disabled:hl=!1})=>jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1",children:[!La&&ha&&jsxRuntimeExports.jsx("label",{className:"font-bold text-xs",children:ha}),jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[jsxRuntimeExports.jsx(Field,{type:ja,name:pa,placeholder:ma||"",className:"floating-input outline-none appearance-none w-full",ref:Ba,disabled:hl}),La&&ha&&jsxRuntimeExports.jsx("label",{htmlFor:"floating-input",className:"floating-label",children:ha})]}),jsxRuntimeExports.jsx(Ng,{fieldName:pa})]}),YA=typeof document<"u"?React.useLayoutEffect:()=>{};var Bu;const Yj=(Bu=React.useInsertionEffect)!==null&&Bu!==void 0?Bu:YA;function Xj(pa){const ha=reactExports.useRef(null);return Yj(()=>{ha.current=pa},[pa]),reactExports.useCallback((...ma)=>{const ja=ha.current;return ja?.(...ma)},[])}const Tr$1=pa=>{var ha;return(ha=pa?.ownerDocument)!==null&&ha!==void 0?ha:document},Fr$1=pa=>pa&&"window"in pa&&pa.window===pa?pa:Tr$1(pa).defaultView||window;function XA(pa,ha){return ha&&pa?pa.contains(ha):!1}const Zp=(pa=document)=>pa.activeElement;function JA(pa){return pa.target}var eB={};function tB(pa){var ha;if(typeof window>"u"||window.navigator==null)return!1;let ma=(ha=window.navigator.userAgentData)===null||ha===void 0?void 0:ha.brands;return Array.isArray(ma)&&ma.some(ja=>pa.test(ja.brand))||pa.test(window.navigator.userAgent)}function nB(pa){var ha;return typeof window<"u"&&window.navigator!=null?pa.test(((ha=window.navigator.userAgentData)===null||ha===void 0?void 0:ha.platform)||window.navigator.platform):!1}function ZA(pa){if(eB.NODE_ENV==="test")return pa;let ha=null;return()=>(ha==null&&(ha=pa()),ha)}const rB=ZA(function(){return nB(/^Mac/i)}),iB=ZA(function(){return tB(/Android/i)});function QA(){let pa=reactExports.useRef(new Map),ha=reactExports.useCallback((La,Ba,hl,Gl)=>{let zl=Gl?.once?(...Wl)=>{pa.current.delete(hl),hl(...Wl)}:hl;pa.current.set(hl,{type:Ba,eventTarget:La,fn:zl,options:Gl}),La.addEventListener(Ba,zl,Gl)},[]),ma=reactExports.useCallback((La,Ba,hl,Gl)=>{var zl;let Wl=((zl=pa.current.get(hl))===null||zl===void 0?void 0:zl.fn)||hl;La.removeEventListener(Ba,Wl,Gl),pa.current.delete(hl)},[]),ja=reactExports.useCallback(()=>{pa.current.forEach((La,Ba)=>{ma(La.eventTarget,La.type,Ba,La.options)})},[ma]);return reactExports.useEffect(()=>ja,[ja]),{addGlobalListener:ha,removeGlobalListener:ma,removeAllGlobalListeners:ja}}function oB(pa){return pa.pointerType===""&&pa.isTrusted?!0:iB()&&pa.pointerType?pa.type==="click"&&pa.buttons===1:pa.detail===0&&!pa.pointerType}function eR(pa){let ha=pa;return ha.nativeEvent=pa,ha.isDefaultPrevented=()=>ha.defaultPrevented,ha.isPropagationStopped=()=>ha.cancelBubble,ha.persist=()=>{},ha}function aB(pa,ha){Object.defineProperty(pa,"target",{value:ha}),Object.defineProperty(pa,"currentTarget",{value:ha})}function tR(pa){let ha=reactExports.useRef({isFocused:!1,observer:null});YA(()=>{const ja=ha.current;return()=>{ja.observer&&(ja.observer.disconnect(),ja.observer=null)}},[]);let ma=Xj(ja=>{pa?.(ja)});return reactExports.useCallback(ja=>{if(ja.target instanceof HTMLButtonElement||ja.target instanceof HTMLInputElement||ja.target instanceof HTMLTextAreaElement||ja.target instanceof HTMLSelectElement){ha.current.isFocused=!0;let La=ja.target,Ba=hl=>{if(ha.current.isFocused=!1,La.disabled){let Gl=eR(hl);ma(Gl)}ha.current.observer&&(ha.current.observer.disconnect(),ha.current.observer=null)};La.addEventListener("focusout",Ba,{once:!0}),ha.current.observer=new MutationObserver(()=>{if(ha.current.isFocused&&La.disabled){var hl;(hl=ha.current.observer)===null||hl===void 0||hl.disconnect();let Gl=La===document.activeElement?null:document.activeElement;La.dispatchEvent(new FocusEvent("blur",{relatedTarget:Gl})),La.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:Gl}))}}),ha.current.observer.observe(La,{attributes:!0,attributeFilter:["disabled"]})}},[ma])}let sB=!1;var nR={};let es$1=null,Qp=new Set,sa=new Map,Gr$1=!1,em=!1;const lB={Tab:!0,Escape:!0};function $g(pa,ha){for(let ma of Qp)ma(pa,ha)}function cB(pa){return!(pa.metaKey||!rB()&&pa.altKey||pa.ctrlKey||pa.key==="Control"||pa.key==="Shift"||pa.key==="Meta")}function Cl(pa){Gr$1=!0,cB(pa)&&(es$1="keyboard",$g("keyboard",pa))}function Wt$2(pa){es$1="pointer",(pa.type==="mousedown"||pa.type==="pointerdown")&&(Gr$1=!0,$g("pointer",pa))}function rR(pa){oB(pa)&&(Gr$1=!0,es$1="virtual")}function iR(pa){pa.target===window||pa.target===document||sB||!pa.isTrusted||(!Gr$1&&!em&&(es$1="virtual",$g("virtual",pa)),Gr$1=!1,em=!1)}function oR(){Gr$1=!1,em=!0}function tm(pa){if(typeof window>"u"||typeof document>"u"||sa.get(Fr$1(pa)))return;const ha=Fr$1(pa),ma=Tr$1(pa);let ja=ha.HTMLElement.prototype.focus;ha.HTMLElement.prototype.focus=function(){Gr$1=!0,ja.apply(this,arguments)},ma.addEventListener("keydown",Cl,!0),ma.addEventListener("keyup",Cl,!0),ma.addEventListener("click",rR,!0),ha.addEventListener("focus",iR,!0),ha.addEventListener("blur",oR,!1),typeof PointerEvent<"u"?(ma.addEventListener("pointerdown",Wt$2,!0),ma.addEventListener("pointermove",Wt$2,!0),ma.addEventListener("pointerup",Wt$2,!0)):nR.NODE_ENV==="test"&&(ma.addEventListener("mousedown",Wt$2,!0),ma.addEventListener("mousemove",Wt$2,!0),ma.addEventListener("mouseup",Wt$2,!0)),ha.addEventListener("beforeunload",()=>{aR(pa)},{once:!0}),sa.set(ha,{focus:ja})}const aR=(pa,ha)=>{const ma=Fr$1(pa),ja=Tr$1(pa);ha&&ja.removeEventListener("DOMContentLoaded",ha),sa.has(ma)&&(ma.HTMLElement.prototype.focus=sa.get(ma).focus,ja.removeEventListener("keydown",Cl,!0),ja.removeEventListener("keyup",Cl,!0),ja.removeEventListener("click",rR,!0),ma.removeEventListener("focus",iR,!0),ma.removeEventListener("blur",oR,!1),typeof PointerEvent<"u"?(ja.removeEventListener("pointerdown",Wt$2,!0),ja.removeEventListener("pointermove",Wt$2,!0),ja.removeEventListener("pointerup",Wt$2,!0)):nR.NODE_ENV==="test"&&(ja.removeEventListener("mousedown",Wt$2,!0),ja.removeEventListener("mousemove",Wt$2,!0),ja.removeEventListener("mouseup",Wt$2,!0)),sa.delete(ma))};function uB(pa){const ha=Tr$1(pa);let ma;return ha.readyState!=="loading"?tm(pa):(ma=()=>{tm(pa)},ha.addEventListener("DOMContentLoaded",ma)),()=>aR(pa,ma)}typeof document<"u"&&uB();function sR(){return es$1!=="pointer"}const dB=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function fB(pa,ha,ma){let ja=Tr$1(ma?.target);const La=typeof window<"u"?Fr$1(ma?.target).HTMLInputElement:HTMLInputElement,Ba=typeof window<"u"?Fr$1(ma?.target).HTMLTextAreaElement:HTMLTextAreaElement,hl=typeof window<"u"?Fr$1(ma?.target).HTMLElement:HTMLElement,Gl=typeof window<"u"?Fr$1(ma?.target).KeyboardEvent:KeyboardEvent;return pa=pa||ja.activeElement instanceof La&&!dB.has(ja.activeElement.type)||ja.activeElement instanceof Ba||ja.activeElement instanceof hl&&ja.activeElement.isContentEditable,!(pa&&ha==="keyboard"&&ma instanceof Gl&&!lB[ma.key])}function hB(pa,ha,ma){tm(),reactExports.useEffect(()=>{let ja=(La,Ba)=>{fB(!!ma?.isTextInput,La,Ba)&&pa(sR())};return Qp.add(ja),()=>{Qp.delete(ja)}},ha)}function pB(pa){let{isDisabled:ha,onFocus:ma,onBlur:ja,onFocusChange:La}=pa;const Ba=reactExports.useCallback(zl=>{if(zl.target===zl.currentTarget)return ja&&ja(zl),La&&La(!1),!0},[ja,La]),hl=tR(Ba),Gl=reactExports.useCallback(zl=>{const Wl=Tr$1(zl.target),Kl=Wl?Zp(Wl):Zp();zl.target===zl.currentTarget&&Kl===JA(zl.nativeEvent)&&(ma&&ma(zl),La&&La(!0),hl(zl))},[La,ma,hl]);return{focusProps:{onFocus:!ha&&(ma||La||ja)?Gl:void 0,onBlur:!ha&&(ja||La)?Ba:void 0}}}function mB(pa){let{isDisabled:ha,onBlurWithin:ma,onFocusWithin:ja,onFocusWithinChange:La}=pa,Ba=reactExports.useRef({isFocusWithin:!1}),{addGlobalListener:hl,removeAllGlobalListeners:Gl}=QA(),zl=reactExports.useCallback(su=>{su.currentTarget.contains(su.target)&&Ba.current.isFocusWithin&&!su.currentTarget.contains(su.relatedTarget)&&(Ba.current.isFocusWithin=!1,Gl(),ma&&ma(su),La&&La(!1))},[ma,La,Ba,Gl]),Wl=tR(zl),Kl=reactExports.useCallback(su=>{if(!su.currentTarget.contains(su.target))return;const au=Tr$1(su.target),ou=Zp(au);if(!Ba.current.isFocusWithin&&ou===JA(su.nativeEvent)){ja&&ja(su),La&&La(!0),Ba.current.isFocusWithin=!0,Wl(su);let $m=su.currentTarget;hl(au,"focus",Nm=>{if(Ba.current.isFocusWithin&&!XA($m,Nm.target)){let Mm=new au.defaultView.FocusEvent("blur",{relatedTarget:Nm.target});aB(Mm,$m);let Mg=eR(Mm);zl(Mg)}},{capture:!0})}},[ja,La,Wl,hl,zl]);return ha?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:Kl,onBlur:zl}}}var nm={};let Tl=!1,_s$1=0;function rm(){Tl=!0,setTimeout(()=>{Tl=!1},50)}function $0(pa){pa.pointerType==="touch"&&rm()}function gB(){if(!(typeof document>"u"))return _s$1===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",$0):nm.NODE_ENV==="test"&&document.addEventListener("touchend",rm)),_s$1++,()=>{_s$1--,!(_s$1>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",$0):nm.NODE_ENV==="test"&&document.removeEventListener("touchend",rm))}}function lR(pa){let{onHoverStart:ha,onHoverChange:ma,onHoverEnd:ja,isDisabled:La}=pa,[Ba,hl]=reactExports.useState(!1),Gl=reactExports.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;reactExports.useEffect(gB,[]);let{addGlobalListener:zl,removeAllGlobalListeners:Wl}=QA(),{hoverProps:Kl,triggerHoverEnd:su}=reactExports.useMemo(()=>{let au=(Nm,Mm)=>{if(Gl.pointerType=Mm,La||Mm==="touch"||Gl.isHovered||!Nm.currentTarget.contains(Nm.target))return;Gl.isHovered=!0;let Mg=Nm.currentTarget;Gl.target=Mg,zl(Tr$1(Nm.target),"pointerover",ly=>{Gl.isHovered&&Gl.target&&!XA(Gl.target,ly.target)&&ou(ly,ly.pointerType)},{capture:!0}),ha&&ha({type:"hoverstart",target:Mg,pointerType:Mm}),ma&&ma(!0),hl(!0)},ou=(Nm,Mm)=>{let Mg=Gl.target;Gl.pointerType="",Gl.target=null,!(Mm==="touch"||!Gl.isHovered||!Mg)&&(Gl.isHovered=!1,Wl(),ja&&ja({type:"hoverend",target:Mg,pointerType:Mm}),ma&&ma(!1),hl(!1))},$m={};return typeof PointerEvent<"u"?($m.onPointerEnter=Nm=>{Tl&&Nm.pointerType==="mouse"||au(Nm,Nm.pointerType)},$m.onPointerLeave=Nm=>{!La&&Nm.currentTarget.contains(Nm.target)&&ou(Nm,Nm.pointerType)}):nm.NODE_ENV==="test"&&($m.onTouchStart=()=>{Gl.ignoreEmulatedMouseEvents=!0},$m.onMouseEnter=Nm=>{!Gl.ignoreEmulatedMouseEvents&&!Tl&&au(Nm,"mouse"),Gl.ignoreEmulatedMouseEvents=!1},$m.onMouseLeave=Nm=>{!La&&Nm.currentTarget.contains(Nm.target)&&ou(Nm,"mouse")}),{hoverProps:$m,triggerHoverEnd:ou}},[ha,ma,ja,La,Gl,zl,Wl]);return reactExports.useEffect(()=>{La&&su({currentTarget:Gl.target},Gl.pointerType)},[La]),{hoverProps:Kl,isHovered:Ba}}function cR(pa={}){let{autoFocus:ha=!1,isTextInput:ma,within:ja}=pa,La=reactExports.useRef({isFocused:!1,isFocusVisible:ha||sR()}),[Ba,hl]=reactExports.useState(!1),[Gl,zl]=reactExports.useState(()=>La.current.isFocused&&La.current.isFocusVisible),Wl=reactExports.useCallback(()=>zl(La.current.isFocused&&La.current.isFocusVisible),[]),Kl=reactExports.useCallback(ou=>{La.current.isFocused=ou,hl(ou),Wl()},[Wl]);hB(ou=>{La.current.isFocusVisible=ou,Wl()},[],{isTextInput:ma});let{focusProps:su}=pB({isDisabled:ja,onFocusChange:Kl}),{focusWithinProps:au}=mB({isDisabled:!ja,onFocusWithinChange:Kl});return{isFocused:Ba,isFocusVisible:Gl,focusProps:ja?au:su}}var vB=Object.defineProperty,yB=(pa,ha,ma)=>ha in pa?vB(pa,ha,{enumerable:!0,configurable:!0,writable:!0,value:ma}):pa[ha]=ma,Vu=(pa,ha,ma)=>(yB(pa,typeof ha!="symbol"?ha+"":ha,ma),ma);let bB=class{constructor(){Vu(this,"current",this.detect()),Vu(this,"handoffState","pending"),Vu(this,"currentId",0)}set(pa){this.current!==pa&&(this.handoffState="pending",this.currentId=0,this.current=pa)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Hr$1=new bB;function Sc(pa){var ha;return Hr$1.isServer?null:pa==null?document:(ha=pa?.ownerDocument)!=null?ha:document}function Al(pa){var ha,ma;return Hr$1.isServer?null:pa==null?document:(ma=(ha=pa?.getRootNode)==null?void 0:ha.call(pa))!=null?ma:document}function uR(pa){var ha,ma;return(ma=(ha=Al(pa))==null?void 0:ha.activeElement)!=null?ma:null}function xB(pa){return uR(pa)===pa}function dR(pa){typeof queueMicrotask=="function"?queueMicrotask(pa):Promise.resolve().then(pa).catch(ha=>setTimeout(()=>{throw ha}))}function jt$1(){let pa=[],ha={addEventListener(ma,ja,La,Ba){return ma.addEventListener(ja,La,Ba),ha.add(()=>ma.removeEventListener(ja,La,Ba))},requestAnimationFrame(...ma){let ja=requestAnimationFrame(...ma);return ha.add(()=>cancelAnimationFrame(ja))},nextFrame(...ma){return ha.requestAnimationFrame(()=>ha.requestAnimationFrame(...ma))},setTimeout(...ma){let ja=setTimeout(...ma);return ha.add(()=>clearTimeout(ja))},microTask(...ma){let ja={current:!0};return dR(()=>{ja.current&&ma[0]()}),ha.add(()=>{ja.current=!1})},style(ma,ja,La){let Ba=ma.style.getPropertyValue(ja);return Object.assign(ma.style,{[ja]:La}),this.add(()=>{Object.assign(ma.style,{[ja]:Ba})})},group(ma){let ja=jt$1();return ma(ja),this.add(()=>ja.dispose())},add(ma){return pa.includes(ma)||pa.push(ma),()=>{let ja=pa.indexOf(ma);if(ja>=0)for(let La of pa.splice(ja,1))La()}},dispose(){for(let ma of pa.splice(0))ma()}};return ha}function Jr$1(){let[pa]=reactExports.useState(jt$1);return reactExports.useEffect(()=>()=>pa.dispose(),[pa]),pa}let mt$3=(pa,ha)=>{Hr$1.isServer?reactExports.useEffect(pa,ha):reactExports.useLayoutEffect(pa,ha)};function wo$1(pa){let ha=reactExports.useRef(pa);return mt$3(()=>{ha.current=pa},[pa]),ha}let Te$3=function(pa){let ha=wo$1(pa);return React.useCallback((...ma)=>ha.current(...ma),[ha])};function wB(pa){let ha=pa.width/2,ma=pa.height/2;return{top:pa.clientY-ma,right:pa.clientX+ha,bottom:pa.clientY+ma,left:pa.clientX-ha}}function SB(pa,ha){return!(!pa||!ha||pa.right<ha.left||pa.left>ha.right||pa.bottom<ha.top||pa.top>ha.bottom)}function fR({disabled:pa=!1}={}){let ha=reactExports.useRef(null),[ma,ja]=reactExports.useState(!1),La=Jr$1(),Ba=Te$3(()=>{ha.current=null,ja(!1),La.dispose()}),hl=Te$3(Gl=>{if(La.dispose(),ha.current===null){ha.current=Gl.currentTarget,ja(!0);{let zl=Sc(Gl.currentTarget);La.addEventListener(zl,"pointerup",Ba,!1),La.addEventListener(zl,"pointermove",Wl=>{if(ha.current){let Kl=wB(Wl);ja(SB(Kl,ha.current.getBoundingClientRect()))}},!1),La.addEventListener(zl,"pointercancel",Ba,!1)}}});return{pressed:ma,pressProps:pa?{}:{onPointerDown:hl,onPointerUp:Ba,onClick:Ba}}}function Wn$1(pa){return reactExports.useMemo(()=>pa,Object.values(pa))}let EB=reactExports.createContext(void 0);function Ec(){return reactExports.useContext(EB)}function k0(...pa){return Array.from(new Set(pa.flatMap(ha=>typeof ha=="string"?ha.split(" "):[]))).filter(Boolean).join(" ")}function _n$1(pa,ha,...ma){if(pa in ha){let La=ha[pa];return typeof La=="function"?La(...ma):La}let ja=new Error(`Tried to handle "${pa}" but there is no handler defined. Only defined handlers are: ${Object.keys(ha).map(La=>`"${La}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(ja,_n$1),ja}var im=(pa=>(pa[pa.None=0]="None",pa[pa.RenderStrategy=1]="RenderStrategy",pa[pa.Static=2]="Static",pa))(im||{}),CB=(pa=>(pa[pa.Unmount=0]="Unmount",pa[pa.Hidden=1]="Hidden",pa))(CB||{});function Bt$2(){let pa=AB();return reactExports.useCallback(ha=>TB({mergeRefs:pa,...ha}),[pa])}function TB({ourProps:pa,theirProps:ha,slot:ma,defaultTag:ja,features:La,visible:Ba=!0,name:hl,mergeRefs:Gl}){Gl=Gl??RB;let zl=hR(ha,pa);if(Ba)return Ps$1(zl,ma,ja,hl,Gl);let Wl=La??0;if(Wl&2){let{static:Kl=!1,...su}=zl;if(Kl)return Ps$1(su,ma,ja,hl,Gl)}if(Wl&1){let{unmount:Kl=!0,...su}=zl;return _n$1(Kl?0:1,{0(){return null},1(){return Ps$1({...su,hidden:!0,style:{display:"none"}},ma,ja,hl,Gl)}})}return Ps$1(zl,ma,ja,hl,Gl)}function Ps$1(pa,ha={},ma,ja,La){let{as:Ba=ma,children:hl,refName:Gl="ref",...zl}=qu(pa,["unmount","static"]),Wl=pa.ref!==void 0?{[Gl]:pa.ref}:{},Kl=typeof hl=="function"?hl(ha):hl;"className"in zl&&zl.className&&typeof zl.className=="function"&&(zl.className=zl.className(ha)),zl["aria-labelledby"]&&zl["aria-labelledby"]===zl.id&&(zl["aria-labelledby"]=void 0);let su={};if(ha){let au=!1,ou=[];for(let[$m,Nm]of Object.entries(ha))typeof Nm=="boolean"&&(au=!0),Nm===!0&&ou.push($m.replace(/([A-Z])/g,Mm=>`-${Mm.toLowerCase()}`));if(au){su["data-headlessui-state"]=ou.join(" ");for(let $m of ou)su[`data-${$m}`]=""}}if(il(Ba)&&(Object.keys(Nr$1(zl)).length>0||Object.keys(Nr$1(su)).length>0))if(!reactExports.isValidElement(Kl)||Array.isArray(Kl)&&Kl.length>1||_B(Kl)){if(Object.keys(Nr$1(zl)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${ja} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Nr$1(zl)).concat(Object.keys(Nr$1(su))).map(au=>` - ${au}`).join(`
|
|
183
|
+
*/var N0;function jj(){return N0||(N0=1,(function(pa){(function(){var ha={}.hasOwnProperty;function ma(){for(var Ba="",hl=0;hl<arguments.length;hl++){var Gl=arguments[hl];Gl&&(Ba=La(Ba,ja(Gl)))}return Ba}function ja(Ba){if(typeof Ba=="string"||typeof Ba=="number")return Ba;if(typeof Ba!="object")return"";if(Array.isArray(Ba))return ma.apply(null,Ba);if(Ba.toString!==Object.prototype.toString&&!Ba.toString.toString().includes("[native code]"))return Ba.toString();var hl="";for(var Gl in Ba)ha.call(Ba,Gl)&&Ba[Gl]&&(hl=La(hl,Gl));return hl}function La(Ba,hl){return hl?Ba?Ba+" "+hl:Ba+hl:Ba}pa.exports?(ma.default=ma,pa.exports=ma):window.classNames=ma})()})(Lu)),Lu.exports}var Bj=jj();const gr$1=bo$1(Bj),HA=({entityName:pa,entityId:ha,urlPath:ma,relationship:ja,unqualifiedEntityName:La,deployedApiUrl:Ba,buttonConfig:hl})=>{const[Gl,zl]=reactExports.useState(!1),Wl=useQueryClient(),Kl=useMutation({mutationFn:async su=>{if(Ba){const au=`${ma}${ja?`/${ja}/${La}`:""}`;await _e$2.delete(`${Ba}/${au}/${su}`)}else await Dr$1.deleteEntityInstance(pa,su)},onSuccess:()=>{Wl.invalidateQueries({queryKey:["entityData",pa]}),zl(!1)}});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[hl?jsxRuntimeExports.jsxs("button",{className:gr$1("fx-button",`fx-button--${hl.style}`,"hover:brightness-125"),onClick:su=>{su.stopPropagation(),zl(!0)},children:[jsxRuntimeExports.jsx(ke$5,{icon:hl.icon}),jsxRuntimeExports.jsx("span",{children:hl.text})]}):jsxRuntimeExports.jsx(ke$5,{icon:"lucide:trash-2",className:"text-red-500 cursor-pointer transition-colors hover:text-red-700",onClick:su=>{su.stopPropagation(),zl(!0)}}),Gl&&jsxRuntimeExports.jsx(Lj,{closeHandler:()=>zl(!1),onConfirm:()=>Kl.mutate(ha),title:"Delete Entity",message:"Are you sure you want to delete this entity? This action cannot be undone.",isLoading:Kl.isPending,itemName:La})]})},zA=({queryKey:pa,url:ha})=>{const ma=pt$3()?.appInfo?.apiUrl,ja=useQueryClient(),La=ma?`${ma}/${ha}`:ha;return reactExports.useEffect(()=>{const Ba=hl=>{const Gl=hl,{entityName:zl,componentName:Wl}=Gl.detail,Kl=`${Wl}/${zl}`;(ha.includes(zl)||ha===zl||ha===Kl||ha.endsWith(`/${zl}`))&&(console.log(`🔄 Invalidating cache for ${ha} due to ${Gl.detail.operation} on ${Kl}`),ja.invalidateQueries({queryKey:pa}))};return ma||window.addEventListener("agentlang-data-change",Ba),()=>{ma||window.removeEventListener("agentlang-data-change",Ba)}},[ha,ma,ja]),useQuery({queryKey:pa,queryFn:async()=>{if(ma)return(await _e$2.get(La)).data;{const Ba=ha.split("/").filter(hl=>!hl.match(/^\d+$/))[0];return Dr$1.fetchEntityInstancesByUrl(ha,Ba)}},enabled:!0,retry:(Ba,hl)=>hl?.message?.includes("cooldown")||hl?.message?.includes("Query queue is full")||hl?.message?.includes("out of memory")||hl?.message?.includes("System is currently recovering")?!1:Ba<1,retryDelay:Ba=>Math.min(1e3*2**Ba,3e3),staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!0,refetchOnReconnect:!!ma,refetchOnWindowFocus:!!ma})},Vj=pa=>{const{data:ha,isLoading:ma,isError:ja,error:La}=zA({queryKey:["entityData",pa],url:pa});return{count:Array.isArray(ha)?ha.length:0,isLoading:ma,isError:ja,error:La?.message,data:ha}},WA=({entityName:pa,viewSpec:ha,viewType:ma,isRelationship:ja=!1})=>{const{getRelationship:La}=tC(),{customNavigate:Ba}=Se$3(),{"*":hl}=useParams(),{pathParts:Gl}=Lt$3(hl),zl=Gl.slice(1).join("/"),Wl=pt$3()?.appInfo?.apiUrl,Kl=pa.split("/")[1],su=ja?La(Kl):void 0,au=pt$3(),ou=au?.[pa],$m=ou?.attributes,Nm=`${pa}.ui.dashboard.body`,Mm=au?.[Nm]?.actions?.create,Mg=$m?Object.keys($m).find(wN=>$m[wN].id):"id",ly=ja?`${zl}/${su}/${Kl}`:zl,{data:uy,isLoading:GE,isError:YE,error:JE,refetch:XE}=zA({queryKey:["entityData",ly],url:ly}),cN=PN({data:uy,entityName:pa,isRelationship:ja,relationshipName:su,uiSpec:au}),[pN]=reactExports.useState([]),[hN,lN]=reactExports.useState({}),[rA,dN]=reactExports.useState(!1),[uN,gN]=reactExports.useState("");if(GE)return jsxRuntimeExports.jsx("div",{className:"table-container",children:jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center py-20",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-blue-50 rounded-full mb-4",children:jsxRuntimeExports.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-2 border-blue-300 border-t-blue-600"})}),jsxRuntimeExports.jsx("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Loading data..."}),jsxRuntimeExports.jsxs("p",{className:"text-xs text-gray-500",children:["Fetching ",Kl," records"]})]})})});const mN=cN.filter(wN=>{if(uN&&!ha.fields.some(FZ=>String(wN[FZ]).toLowerCase().includes(uN.toLowerCase())))return!1;for(const[FZ,IZ]of Object.entries(hN))if(IZ&&!String(wN[FZ]).toLowerCase().includes(IZ.toLowerCase()))return!1;return!0}),bN=(wN,FZ)=>{const IZ=pa.split("/")[1];let lQ=`/${hl}/${ja?`${su}/${IZ}/`:""}${wN}`;FZ==="edit"&&(lQ+="/edit"),Ba(lQ)},xN=()=>jsxRuntimeExports.jsx("div",{className:"overflow-x-auto thin-scrollbar",children:jsxRuntimeExports.jsxs("table",{className:"w-full",children:[jsxRuntimeExports.jsx("thead",{className:"border-b border-border bg-table-header",children:jsxRuntimeExports.jsxs("tr",{children:[ha.fields.map(wN=>jsxRuntimeExports.jsxs("th",{className:"px-6 py-3 text-left text-xs font-semibold text-font-table-header uppercase tracking-wider",children:[jsxRuntimeExports.jsx("div",{className:"flex gap-2 items-center",children:Ft$4(wN)}),jsxRuntimeExports.jsx(Vn$1.div,{initial:{height:0,opacity:0},animate:{height:rA?"auto":0,opacity:rA?1:0},className:"overflow-hidden",children:jsxRuntimeExports.jsxs("div",{className:"relative mt-1",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"absolute left-2 top-1/2 -translate-y-1/2 text-font-secondary"}),jsxRuntimeExports.jsx("input",{className:"w-full pl-8! pr-4 py-1 border border-gray-600 rounded-md bg-secondary text-sm",type:"text",placeholder:`Search ${wN}...`,value:hN[wN]||"",onChange:FZ=>{lN(IZ=>({...IZ,[wN]:FZ.target.value}))}})]})})]},wN)),jsxRuntimeExports.jsx("th",{className:"px-6 py-3 text-right text-xs font-semibold text-font-table-header uppercase tracking-wider",children:"Actions"})]})}),jsxRuntimeExports.jsx("tbody",{className:"divide-y divide-gray-700",children:YE?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsxs("td",{colSpan:ha.fields.length+1,className:"text-center py-12 text-red-400 px-6",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:alert-circle-outline",className:"text-4xl text-red-400 mb-2 mx-auto"}),JE?.message||"Error fetching data",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("button",{onClick:()=>XE(),className:"mt-2 inline-flex items-center px-3 py-1.5 bg-primary text-white text-xs rounded-md hover:bg-primary/90 transition-colors",children:[jsxRuntimeExports.jsx(ke$5,{icon:"material-symbols:refresh",className:"mr-1.5 text-xs"}),"Retry"]})]})}):mN.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsxs("td",{colSpan:ha.fields.length+1,className:"text-center py-12 text-gray-400",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:database-off",className:"text-4xl text-gray-500 mb-2 mx-auto"}),"No data available"]})}):mN.map((wN,FZ)=>jsxRuntimeExports.jsxs("tr",{className:"hover:bg-gray-800 transition-colors cursor-pointer",onClick:()=>{const IZ=wN[Mg||"id"];bN(IZ)},children:[ha.fields.map(IZ=>jsxRuntimeExports.jsx("td",{className:"px-6 py-4 text-sm text-gray-300 whitespace-nowrap",children:String(wN[IZ]||"")},IZ)),jsxRuntimeExports.jsx("td",{className:"px-6 py-4 text-right whitespace-nowrap",onClick:IZ=>IZ.stopPropagation(),children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end gap-2 items-center",children:[jsxRuntimeExports.jsx("button",{onClick:IZ=>{IZ.stopPropagation(),bN(wN[Mg||"id"],"edit")},className:"p-2 text-blue-400 hover:bg-gray-700 rounded-lg transition-colors cursor-pointer",title:"Edit",children:jsxRuntimeExports.jsx(ke$5,{icon:"lucide:edit",className:"text-lg"})}),jsxRuntimeExports.jsx("div",{className:"p-2 text-red-400 hover:bg-gray-700 rounded-lg transition-colors cursor-pointer",children:jsxRuntimeExports.jsx(HA,{entityName:pa,entityId:wN[Mg||"id"],urlPath:zl,relationship:su||void 0,unqualifiedEntityName:Kl,deployedApiUrl:Wl})})]})})]},FZ))})]})}),vN=()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[rA&&jsxRuntimeExports.jsx("div",{className:"cards-grid mb-2",children:ha.fields.map(wN=>jsxRuntimeExports.jsxs("div",{className:"column-filter-container",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"search-icon"}),jsxRuntimeExports.jsx("input",{className:"search-input",type:"text",placeholder:`Search ${wN}...`,value:hN[wN]||"",onChange:FZ=>{lN(IZ=>({...IZ,[wN]:FZ.target.value}))}}),jsxRuntimeExports.jsx(ke$5,{icon:"mdi:close-thick",className:"cancel-search",onClick:()=>{lN(FZ=>{const IZ={...FZ};return delete IZ[wN],IZ})}})]},wN))}),jsxRuntimeExports.jsx("div",{className:"cards-grid",children:YE?jsxRuntimeExports.jsxs("div",{className:"no-records bg-red-900/20 text-red-400 border border-red-700 rounded-md",children:[jsxRuntimeExports.jsx(ke$5,{icon:"mdi:alert-circle-outline",className:"text-4xl text-red-400 mb-2 mx-auto"}),JE?.message||"Error fetching data",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("button",{onClick:()=>XE(),className:"mt-2 inline-flex items-center px-3 py-1.5 bg-primary text-white text-xs rounded-md hover:bg-primary/90 transition-colors",children:[jsxRuntimeExports.jsx(ke$5,{icon:"material-symbols:refresh",className:"mr-1.5 text-xs"}),"Retry"]})]}):mN.length>0?mN.map((wN,FZ)=>jsxRuntimeExports.jsx("div",{className:"card-component",onClick:()=>{const IZ=wN[Mg||"id"];bN(IZ)},children:ha.fields.map(IZ=>jsxRuntimeExports.jsxs("div",{className:"form-item gap-0.5",children:[jsxRuntimeExports.jsx("span",{className:"label",children:Ft$4(IZ)}),jsxRuntimeExports.jsx("span",{children:String(wN[IZ]||"")})]},IZ))},FZ)):jsxRuntimeExports.jsx("div",{className:"no-records bg-white/5 rounded-md",children:"No records to display"})})]});return jsxRuntimeExports.jsxs("div",{className:"bg-gray-900/50 rounded-lg shadow-sm border border-gray-700",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-gray-700",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntimeExports.jsx(ke$5,{icon:ou?.icon||Ot$3.entity,style:{color:ou?.color},className:"w-6 h-6 shrink-0"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold text-white",children:ou?.displayName||pa.split("/")[1]}),ou?.description&&jsxRuntimeExports.jsx("p",{className:"text-xs text-font-secondary",children:ou.description})]})]}),jsxRuntimeExports.jsxs("div",{className:"flex gap-3 items-center",children:[ha.showGlobalFilter&&jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(ke$5,{icon:"tabler:search",className:"absolute left-3 top-1/2 -translate-y-1/2 text-font-secondary"}),jsxRuntimeExports.jsx("input",{placeholder:"Search...",className:"pl-8! pr-4 py-2 border border-gray-600 rounded-lg w-64 bg-secondary focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:uN,onChange:wN=>{gN(wN.target.value)}})]}),ha.showColumnFilter&&jsxRuntimeExports.jsx("button",{className:"p-2 text-font-secondary hover:bg-gray-700 rounded-lg transition-colors",onClick:()=>dN(!rA),children:jsxRuntimeExports.jsx(ke$5,{icon:rA?"material-symbols:filter-list-off-rounded":"material-symbols:filter-list-rounded",className:"text-lg"})}),jsxRuntimeExports.jsx(NN,{entityName:pa,createAction:Mm,isRelationship:ja,relationship:su})]})]}),ma==="Table"?xN():vN(),jsxRuntimeExports.jsx("div",{className:"table-footer",children:ha.enableSelection&&ha.actions&&pN.length>0&&ha.actions?.map(wN=>jsxRuntimeExports.jsx("div",{className:"fx-button",children:wN},wN))})]})},qj=({entityName:pa,schema:ha})=>{const ma=`${pa}.ui.dashboard`,ja=ha[ma];return jsxRuntimeExports.jsx("div",{className:"fx-dashboard-container",children:ja.map(La=>{const Ba=ha[La];if(Array.isArray(Ba)||typeof Ba!="object"||Ba===null)return null;const hl=Ba.view,Gl=Object.keys(hl)[0],zl=Object.values(hl)[0];return jsxRuntimeExports.jsx("div",{children:Gl==="Heading"?jsxRuntimeExports.jsx(eC,{viewSpec:zl}):Gl==="Table"||Gl==="Cards"?jsxRuntimeExports.jsx(WA,{entityName:pa,viewSpec:zl,viewType:Gl}):null},La)})})},nt$3=[];for(let pa=0;pa<256;++pa)nt$3.push((pa+256).toString(16).slice(1));function Uj(pa,ha=0){return(nt$3[pa[ha+0]]+nt$3[pa[ha+1]]+nt$3[pa[ha+2]]+nt$3[pa[ha+3]]+"-"+nt$3[pa[ha+4]]+nt$3[pa[ha+5]]+"-"+nt$3[pa[ha+6]]+nt$3[pa[ha+7]]+"-"+nt$3[pa[ha+8]]+nt$3[pa[ha+9]]+"-"+nt$3[pa[ha+10]]+nt$3[pa[ha+11]]+nt$3[pa[ha+12]]+nt$3[pa[ha+13]]+nt$3[pa[ha+14]]+nt$3[pa[ha+15]]).toLowerCase()}let ju;const Hj=new Uint8Array(16);function zj(){if(!ju){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ju=crypto.getRandomValues.bind(crypto)}return ju(Hj)}const Wj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),M0={randomUUID:Wj};function GA(pa,ha,ma){if(M0.randomUUID&&!pa)return M0.randomUUID();pa=pa||{};const ja=pa.random??pa.rng?.()??zj();if(ja.length<16)throw new Error("Random bytes length must be >= 16");return ja[6]=ja[6]&15|64,ja[8]=ja[8]&63|128,Uj(ja)}const KA=async pa=>(await _e$2.get(pa)).data,Gj=({entityName:pa,schema:ha})=>{const{"*":ma}=useParams(),{customNavigate:ja}=Se$3(),{pathParts:La}=Lt$3(ma),Ba=La.slice(1).join("/"),hl=La[La.length-1],Gl=pt$3()?.appInfo?.apiUrl,zl=`${Gl}/${Ba}`,Wl=pa.split("/")[1],{actions:Kl,view:su}=ha,{Card:au}=su,{fields:ou,layout:$m="list",columns:Nm=1}=au,Mm=Kl?.edit,Mg=Kl?.delete,ly=pt$3()?.[pa],uy=ly?.attributes,GE=uy?Object.keys(uy).find(lN=>uy[lN].id):"id",{data:YE,isLoading:JE,isError:XE,error:cN}=useQuery({queryKey:["entityInstance",pa,hl],queryFn:()=>Gl?KA(zl):Dr$1.fetchEntityInstance(pa,hl)});if(JE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsxs("div",{className:"animate-pulse",children:[jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"}),jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"}),jsxRuntimeExports.jsx("div",{className:"h-4 bg-gray-200 rounded mb-2"})]})});if(XE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsxs("div",{className:"text-red-600 p-4",children:[jsxRuntimeExports.jsx("h3",{className:"font-semibold mb-2",children:"Error loading data"}),jsxRuntimeExports.jsx("p",{className:"text-sm",children:cN instanceof Error?cN.message:"An unexpected error occurred"})]})});if(!YE)return jsxRuntimeExports.jsx("div",{className:"card-component",children:jsxRuntimeExports.jsx("div",{className:"text-gray-500 p-4",children:jsxRuntimeExports.jsx("p",{children:"No data available"})})});const pN=Array.isArray(YE)?YE[0][Wl]:YE,hN=lN=>lN==null?"N/A":typeof lN=="boolean"?lN?"Yes":"No":typeof lN=="object"?JSON.stringify(lN):String(lN);return jsxRuntimeExports.jsxs("div",{className:"bg-gray-900/50 rounded-lg shadow-sm border border-gray-700 p-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center w-full mb-4",children:[jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold text-white",children:ly?.displayName||Wl}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[Mm&&jsxRuntimeExports.jsxs("button",{className:gr$1("fx-button",`fx-button--${Mm.style}`),onClick:()=>ja(`/${ma}/edit`),children:[jsxRuntimeExports.jsx(ke$5,{icon:Mm.icon}),jsxRuntimeExports.jsx("span",{children:Mm.text})]}),Mg&&jsxRuntimeExports.jsx(HA,{entityName:pa,entityId:GE?String(pN[GE]):hl,urlPath:Ba,unqualifiedEntityName:Wl,deployedApiUrl:Gl,buttonConfig:Mg})]})]}),jsxRuntimeExports.jsx("div",{className:gr$1("w-full gap-6",{grid:$m==="grid","flex flex-col":$m==="list"}),style:{gridTemplateColumns:$m==="grid"?`repeat(${Nm}, 1fr)`:void 0},children:ou.map(lN=>jsxRuntimeExports.jsxs("div",{className:"border-b border-gray-700 pb-3",children:[jsxRuntimeExports.jsx("dt",{className:"text-sm font-medium text-gray-400 mb-1",children:Ft$4(lN)}),jsxRuntimeExports.jsx("dd",{className:"text-base text-white",children:hN(pN[lN])})]},lN))})]})},Kj=({fieldCount:pa=5})=>jsxRuntimeExports.jsx("div",{className:"fx-dashboard-container animate-pulse",children:jsxRuntimeExports.jsxs("div",{className:"fx-form",children:[jsxRuntimeExports.jsxs("div",{className:"fx-form-body",children:[jsxRuntimeExports.jsx("div",{className:"title h-8 bg-gray-300/20 rounded w-1/3 mb-6"}),[...Array(pa)].map((ha,ma)=>jsxRuntimeExports.jsxs("div",{className:"form-item mb-4",children:[jsxRuntimeExports.jsx("div",{className:"label h-4 bg-gray-300/20 rounded w-1/4 mb-2"}),jsxRuntimeExports.jsx("div",{className:"form-input h-10 bg-gray-300/20 rounded"})]},ma))]}),jsxRuntimeExports.jsx("div",{className:"h-10 bg-gray-300/20 rounded w-28 mt-4"})]})}),Ng=({fieldName:pa})=>jsxRuntimeExports.jsx(ErrorMessage,{name:pa,children:ha=>jsxRuntimeExports.jsxs("div",{className:"formik-error-message",children:[jsxRuntimeExports.jsx(ke$5,{icon:"bi:exclamation-circle-fill"}),jsxRuntimeExports.jsx("span",{children:ha})]})}),aQ=({name:pa,label:ha,placeholder:ma,type:ja="text",isFloating:La=!0,ref:Ba,disabled:hl=!1})=>jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1",children:[!La&&ha&&jsxRuntimeExports.jsx("label",{className:"font-bold text-xs",children:ha}),jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[jsxRuntimeExports.jsx(Field,{type:ja,name:pa,placeholder:ma||"",className:"floating-input outline-none appearance-none w-full",ref:Ba,disabled:hl}),La&&ha&&jsxRuntimeExports.jsx("label",{htmlFor:"floating-input",className:"floating-label",children:ha})]}),jsxRuntimeExports.jsx(Ng,{fieldName:pa})]}),YA=typeof document<"u"?React.useLayoutEffect:()=>{};var Bu;const Yj=(Bu=React.useInsertionEffect)!==null&&Bu!==void 0?Bu:YA;function Xj(pa){const ha=reactExports.useRef(null);return Yj(()=>{ha.current=pa},[pa]),reactExports.useCallback((...ma)=>{const ja=ha.current;return ja?.(...ma)},[])}const Tr$1=pa=>{var ha;return(ha=pa?.ownerDocument)!==null&&ha!==void 0?ha:document},Fr$1=pa=>pa&&"window"in pa&&pa.window===pa?pa:Tr$1(pa).defaultView||window;function XA(pa,ha){return ha&&pa?pa.contains(ha):!1}const Zp=(pa=document)=>pa.activeElement;function JA(pa){return pa.target}var eB={};function tB(pa){var ha;if(typeof window>"u"||window.navigator==null)return!1;let ma=(ha=window.navigator.userAgentData)===null||ha===void 0?void 0:ha.brands;return Array.isArray(ma)&&ma.some(ja=>pa.test(ja.brand))||pa.test(window.navigator.userAgent)}function nB(pa){var ha;return typeof window<"u"&&window.navigator!=null?pa.test(((ha=window.navigator.userAgentData)===null||ha===void 0?void 0:ha.platform)||window.navigator.platform):!1}function ZA(pa){if(eB.NODE_ENV==="test")return pa;let ha=null;return()=>(ha==null&&(ha=pa()),ha)}const rB=ZA(function(){return nB(/^Mac/i)}),iB=ZA(function(){return tB(/Android/i)});function QA(){let pa=reactExports.useRef(new Map),ha=reactExports.useCallback((La,Ba,hl,Gl)=>{let zl=Gl?.once?(...Wl)=>{pa.current.delete(hl),hl(...Wl)}:hl;pa.current.set(hl,{type:Ba,eventTarget:La,fn:zl,options:Gl}),La.addEventListener(Ba,zl,Gl)},[]),ma=reactExports.useCallback((La,Ba,hl,Gl)=>{var zl;let Wl=((zl=pa.current.get(hl))===null||zl===void 0?void 0:zl.fn)||hl;La.removeEventListener(Ba,Wl,Gl),pa.current.delete(hl)},[]),ja=reactExports.useCallback(()=>{pa.current.forEach((La,Ba)=>{ma(La.eventTarget,La.type,Ba,La.options)})},[ma]);return reactExports.useEffect(()=>ja,[ja]),{addGlobalListener:ha,removeGlobalListener:ma,removeAllGlobalListeners:ja}}function oB(pa){return pa.pointerType===""&&pa.isTrusted?!0:iB()&&pa.pointerType?pa.type==="click"&&pa.buttons===1:pa.detail===0&&!pa.pointerType}function eR(pa){let ha=pa;return ha.nativeEvent=pa,ha.isDefaultPrevented=()=>ha.defaultPrevented,ha.isPropagationStopped=()=>ha.cancelBubble,ha.persist=()=>{},ha}function aB(pa,ha){Object.defineProperty(pa,"target",{value:ha}),Object.defineProperty(pa,"currentTarget",{value:ha})}function tR(pa){let ha=reactExports.useRef({isFocused:!1,observer:null});YA(()=>{const ja=ha.current;return()=>{ja.observer&&(ja.observer.disconnect(),ja.observer=null)}},[]);let ma=Xj(ja=>{pa?.(ja)});return reactExports.useCallback(ja=>{if(ja.target instanceof HTMLButtonElement||ja.target instanceof HTMLInputElement||ja.target instanceof HTMLTextAreaElement||ja.target instanceof HTMLSelectElement){ha.current.isFocused=!0;let La=ja.target,Ba=hl=>{if(ha.current.isFocused=!1,La.disabled){let Gl=eR(hl);ma(Gl)}ha.current.observer&&(ha.current.observer.disconnect(),ha.current.observer=null)};La.addEventListener("focusout",Ba,{once:!0}),ha.current.observer=new MutationObserver(()=>{if(ha.current.isFocused&&La.disabled){var hl;(hl=ha.current.observer)===null||hl===void 0||hl.disconnect();let Gl=La===document.activeElement?null:document.activeElement;La.dispatchEvent(new FocusEvent("blur",{relatedTarget:Gl})),La.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:Gl}))}}),ha.current.observer.observe(La,{attributes:!0,attributeFilter:["disabled"]})}},[ma])}let sB=!1;var nR={};let es$1=null,Qp=new Set,sa=new Map,Gr$1=!1,em=!1;const lB={Tab:!0,Escape:!0};function $g(pa,ha){for(let ma of Qp)ma(pa,ha)}function cB(pa){return!(pa.metaKey||!rB()&&pa.altKey||pa.ctrlKey||pa.key==="Control"||pa.key==="Shift"||pa.key==="Meta")}function Cl(pa){Gr$1=!0,cB(pa)&&(es$1="keyboard",$g("keyboard",pa))}function Wt$2(pa){es$1="pointer",(pa.type==="mousedown"||pa.type==="pointerdown")&&(Gr$1=!0,$g("pointer",pa))}function rR(pa){oB(pa)&&(Gr$1=!0,es$1="virtual")}function iR(pa){pa.target===window||pa.target===document||sB||!pa.isTrusted||(!Gr$1&&!em&&(es$1="virtual",$g("virtual",pa)),Gr$1=!1,em=!1)}function oR(){Gr$1=!1,em=!0}function tm(pa){if(typeof window>"u"||typeof document>"u"||sa.get(Fr$1(pa)))return;const ha=Fr$1(pa),ma=Tr$1(pa);let ja=ha.HTMLElement.prototype.focus;ha.HTMLElement.prototype.focus=function(){Gr$1=!0,ja.apply(this,arguments)},ma.addEventListener("keydown",Cl,!0),ma.addEventListener("keyup",Cl,!0),ma.addEventListener("click",rR,!0),ha.addEventListener("focus",iR,!0),ha.addEventListener("blur",oR,!1),typeof PointerEvent<"u"?(ma.addEventListener("pointerdown",Wt$2,!0),ma.addEventListener("pointermove",Wt$2,!0),ma.addEventListener("pointerup",Wt$2,!0)):nR.NODE_ENV==="test"&&(ma.addEventListener("mousedown",Wt$2,!0),ma.addEventListener("mousemove",Wt$2,!0),ma.addEventListener("mouseup",Wt$2,!0)),ha.addEventListener("beforeunload",()=>{aR(pa)},{once:!0}),sa.set(ha,{focus:ja})}const aR=(pa,ha)=>{const ma=Fr$1(pa),ja=Tr$1(pa);ha&&ja.removeEventListener("DOMContentLoaded",ha),sa.has(ma)&&(ma.HTMLElement.prototype.focus=sa.get(ma).focus,ja.removeEventListener("keydown",Cl,!0),ja.removeEventListener("keyup",Cl,!0),ja.removeEventListener("click",rR,!0),ma.removeEventListener("focus",iR,!0),ma.removeEventListener("blur",oR,!1),typeof PointerEvent<"u"?(ja.removeEventListener("pointerdown",Wt$2,!0),ja.removeEventListener("pointermove",Wt$2,!0),ja.removeEventListener("pointerup",Wt$2,!0)):nR.NODE_ENV==="test"&&(ja.removeEventListener("mousedown",Wt$2,!0),ja.removeEventListener("mousemove",Wt$2,!0),ja.removeEventListener("mouseup",Wt$2,!0)),sa.delete(ma))};function uB(pa){const ha=Tr$1(pa);let ma;return ha.readyState!=="loading"?tm(pa):(ma=()=>{tm(pa)},ha.addEventListener("DOMContentLoaded",ma)),()=>aR(pa,ma)}typeof document<"u"&&uB();function sR(){return es$1!=="pointer"}const dB=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function fB(pa,ha,ma){let ja=Tr$1(ma?.target);const La=typeof window<"u"?Fr$1(ma?.target).HTMLInputElement:HTMLInputElement,Ba=typeof window<"u"?Fr$1(ma?.target).HTMLTextAreaElement:HTMLTextAreaElement,hl=typeof window<"u"?Fr$1(ma?.target).HTMLElement:HTMLElement,Gl=typeof window<"u"?Fr$1(ma?.target).KeyboardEvent:KeyboardEvent;return pa=pa||ja.activeElement instanceof La&&!dB.has(ja.activeElement.type)||ja.activeElement instanceof Ba||ja.activeElement instanceof hl&&ja.activeElement.isContentEditable,!(pa&&ha==="keyboard"&&ma instanceof Gl&&!lB[ma.key])}function hB(pa,ha,ma){tm(),reactExports.useEffect(()=>{let ja=(La,Ba)=>{fB(!!ma?.isTextInput,La,Ba)&&pa(sR())};return Qp.add(ja),()=>{Qp.delete(ja)}},ha)}function pB(pa){let{isDisabled:ha,onFocus:ma,onBlur:ja,onFocusChange:La}=pa;const Ba=reactExports.useCallback(zl=>{if(zl.target===zl.currentTarget)return ja&&ja(zl),La&&La(!1),!0},[ja,La]),hl=tR(Ba),Gl=reactExports.useCallback(zl=>{const Wl=Tr$1(zl.target),Kl=Wl?Zp(Wl):Zp();zl.target===zl.currentTarget&&Kl===JA(zl.nativeEvent)&&(ma&&ma(zl),La&&La(!0),hl(zl))},[La,ma,hl]);return{focusProps:{onFocus:!ha&&(ma||La||ja)?Gl:void 0,onBlur:!ha&&(ja||La)?Ba:void 0}}}function mB(pa){let{isDisabled:ha,onBlurWithin:ma,onFocusWithin:ja,onFocusWithinChange:La}=pa,Ba=reactExports.useRef({isFocusWithin:!1}),{addGlobalListener:hl,removeAllGlobalListeners:Gl}=QA(),zl=reactExports.useCallback(su=>{su.currentTarget.contains(su.target)&&Ba.current.isFocusWithin&&!su.currentTarget.contains(su.relatedTarget)&&(Ba.current.isFocusWithin=!1,Gl(),ma&&ma(su),La&&La(!1))},[ma,La,Ba,Gl]),Wl=tR(zl),Kl=reactExports.useCallback(su=>{if(!su.currentTarget.contains(su.target))return;const au=Tr$1(su.target),ou=Zp(au);if(!Ba.current.isFocusWithin&&ou===JA(su.nativeEvent)){ja&&ja(su),La&&La(!0),Ba.current.isFocusWithin=!0,Wl(su);let $m=su.currentTarget;hl(au,"focus",Nm=>{if(Ba.current.isFocusWithin&&!XA($m,Nm.target)){let Mm=new au.defaultView.FocusEvent("blur",{relatedTarget:Nm.target});aB(Mm,$m);let Mg=eR(Mm);zl(Mg)}},{capture:!0})}},[ja,La,Wl,hl,zl]);return ha?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:Kl,onBlur:zl}}}var nm={};let Tl=!1,_s$1=0;function rm(){Tl=!0,setTimeout(()=>{Tl=!1},50)}function $0(pa){pa.pointerType==="touch"&&rm()}function gB(){if(!(typeof document>"u"))return _s$1===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",$0):nm.NODE_ENV==="test"&&document.addEventListener("touchend",rm)),_s$1++,()=>{_s$1--,!(_s$1>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",$0):nm.NODE_ENV==="test"&&document.removeEventListener("touchend",rm))}}function lR(pa){let{onHoverStart:ha,onHoverChange:ma,onHoverEnd:ja,isDisabled:La}=pa,[Ba,hl]=reactExports.useState(!1),Gl=reactExports.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;reactExports.useEffect(gB,[]);let{addGlobalListener:zl,removeAllGlobalListeners:Wl}=QA(),{hoverProps:Kl,triggerHoverEnd:su}=reactExports.useMemo(()=>{let au=(Nm,Mm)=>{if(Gl.pointerType=Mm,La||Mm==="touch"||Gl.isHovered||!Nm.currentTarget.contains(Nm.target))return;Gl.isHovered=!0;let Mg=Nm.currentTarget;Gl.target=Mg,zl(Tr$1(Nm.target),"pointerover",ly=>{Gl.isHovered&&Gl.target&&!XA(Gl.target,ly.target)&&ou(ly,ly.pointerType)},{capture:!0}),ha&&ha({type:"hoverstart",target:Mg,pointerType:Mm}),ma&&ma(!0),hl(!0)},ou=(Nm,Mm)=>{let Mg=Gl.target;Gl.pointerType="",Gl.target=null,!(Mm==="touch"||!Gl.isHovered||!Mg)&&(Gl.isHovered=!1,Wl(),ja&&ja({type:"hoverend",target:Mg,pointerType:Mm}),ma&&ma(!1),hl(!1))},$m={};return typeof PointerEvent<"u"?($m.onPointerEnter=Nm=>{Tl&&Nm.pointerType==="mouse"||au(Nm,Nm.pointerType)},$m.onPointerLeave=Nm=>{!La&&Nm.currentTarget.contains(Nm.target)&&ou(Nm,Nm.pointerType)}):nm.NODE_ENV==="test"&&($m.onTouchStart=()=>{Gl.ignoreEmulatedMouseEvents=!0},$m.onMouseEnter=Nm=>{!Gl.ignoreEmulatedMouseEvents&&!Tl&&au(Nm,"mouse"),Gl.ignoreEmulatedMouseEvents=!1},$m.onMouseLeave=Nm=>{!La&&Nm.currentTarget.contains(Nm.target)&&ou(Nm,"mouse")}),{hoverProps:$m,triggerHoverEnd:ou}},[ha,ma,ja,La,Gl,zl,Wl]);return reactExports.useEffect(()=>{La&&su({currentTarget:Gl.target},Gl.pointerType)},[La]),{hoverProps:Kl,isHovered:Ba}}function cR(pa={}){let{autoFocus:ha=!1,isTextInput:ma,within:ja}=pa,La=reactExports.useRef({isFocused:!1,isFocusVisible:ha||sR()}),[Ba,hl]=reactExports.useState(!1),[Gl,zl]=reactExports.useState(()=>La.current.isFocused&&La.current.isFocusVisible),Wl=reactExports.useCallback(()=>zl(La.current.isFocused&&La.current.isFocusVisible),[]),Kl=reactExports.useCallback(ou=>{La.current.isFocused=ou,hl(ou),Wl()},[Wl]);hB(ou=>{La.current.isFocusVisible=ou,Wl()},[],{isTextInput:ma});let{focusProps:su}=pB({isDisabled:ja,onFocusChange:Kl}),{focusWithinProps:au}=mB({isDisabled:!ja,onFocusWithinChange:Kl});return{isFocused:Ba,isFocusVisible:Gl,focusProps:ja?au:su}}var vB=Object.defineProperty,yB=(pa,ha,ma)=>ha in pa?vB(pa,ha,{enumerable:!0,configurable:!0,writable:!0,value:ma}):pa[ha]=ma,Vu=(pa,ha,ma)=>(yB(pa,typeof ha!="symbol"?ha+"":ha,ma),ma);let bB=class{constructor(){Vu(this,"current",this.detect()),Vu(this,"handoffState","pending"),Vu(this,"currentId",0)}set(pa){this.current!==pa&&(this.handoffState="pending",this.currentId=0,this.current=pa)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Hr$1=new bB;function Sc(pa){var ha;return Hr$1.isServer?null:pa==null?document:(ha=pa?.ownerDocument)!=null?ha:document}function Al(pa){var ha,ma;return Hr$1.isServer?null:pa==null?document:(ma=(ha=pa?.getRootNode)==null?void 0:ha.call(pa))!=null?ma:document}function uR(pa){var ha,ma;return(ma=(ha=Al(pa))==null?void 0:ha.activeElement)!=null?ma:null}function xB(pa){return uR(pa)===pa}function dR(pa){typeof queueMicrotask=="function"?queueMicrotask(pa):Promise.resolve().then(pa).catch(ha=>setTimeout(()=>{throw ha}))}function jt$1(){let pa=[],ha={addEventListener(ma,ja,La,Ba){return ma.addEventListener(ja,La,Ba),ha.add(()=>ma.removeEventListener(ja,La,Ba))},requestAnimationFrame(...ma){let ja=requestAnimationFrame(...ma);return ha.add(()=>cancelAnimationFrame(ja))},nextFrame(...ma){return ha.requestAnimationFrame(()=>ha.requestAnimationFrame(...ma))},setTimeout(...ma){let ja=setTimeout(...ma);return ha.add(()=>clearTimeout(ja))},microTask(...ma){let ja={current:!0};return dR(()=>{ja.current&&ma[0]()}),ha.add(()=>{ja.current=!1})},style(ma,ja,La){let Ba=ma.style.getPropertyValue(ja);return Object.assign(ma.style,{[ja]:La}),this.add(()=>{Object.assign(ma.style,{[ja]:Ba})})},group(ma){let ja=jt$1();return ma(ja),this.add(()=>ja.dispose())},add(ma){return pa.includes(ma)||pa.push(ma),()=>{let ja=pa.indexOf(ma);if(ja>=0)for(let La of pa.splice(ja,1))La()}},dispose(){for(let ma of pa.splice(0))ma()}};return ha}function Jr$1(){let[pa]=reactExports.useState(jt$1);return reactExports.useEffect(()=>()=>pa.dispose(),[pa]),pa}let mt$3=(pa,ha)=>{Hr$1.isServer?reactExports.useEffect(pa,ha):reactExports.useLayoutEffect(pa,ha)};function wo$1(pa){let ha=reactExports.useRef(pa);return mt$3(()=>{ha.current=pa},[pa]),ha}let Te$3=function(pa){let ha=wo$1(pa);return React.useCallback((...ma)=>ha.current(...ma),[ha])};function wB(pa){let ha=pa.width/2,ma=pa.height/2;return{top:pa.clientY-ma,right:pa.clientX+ha,bottom:pa.clientY+ma,left:pa.clientX-ha}}function SB(pa,ha){return!(!pa||!ha||pa.right<ha.left||pa.left>ha.right||pa.bottom<ha.top||pa.top>ha.bottom)}function fR({disabled:pa=!1}={}){let ha=reactExports.useRef(null),[ma,ja]=reactExports.useState(!1),La=Jr$1(),Ba=Te$3(()=>{ha.current=null,ja(!1),La.dispose()}),hl=Te$3(Gl=>{if(La.dispose(),ha.current===null){ha.current=Gl.currentTarget,ja(!0);{let zl=Sc(Gl.currentTarget);La.addEventListener(zl,"pointerup",Ba,!1),La.addEventListener(zl,"pointermove",Wl=>{if(ha.current){let Kl=wB(Wl);ja(SB(Kl,ha.current.getBoundingClientRect()))}},!1),La.addEventListener(zl,"pointercancel",Ba,!1)}}});return{pressed:ma,pressProps:pa?{}:{onPointerDown:hl,onPointerUp:Ba,onClick:Ba}}}function Wn$1(pa){return reactExports.useMemo(()=>pa,Object.values(pa))}let EB=reactExports.createContext(void 0);function Ec(){return reactExports.useContext(EB)}function k0(...pa){return Array.from(new Set(pa.flatMap(ha=>typeof ha=="string"?ha.split(" "):[]))).filter(Boolean).join(" ")}function _n$1(pa,ha,...ma){if(pa in ha){let La=ha[pa];return typeof La=="function"?La(...ma):La}let ja=new Error(`Tried to handle "${pa}" but there is no handler defined. Only defined handlers are: ${Object.keys(ha).map(La=>`"${La}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(ja,_n$1),ja}var im=(pa=>(pa[pa.None=0]="None",pa[pa.RenderStrategy=1]="RenderStrategy",pa[pa.Static=2]="Static",pa))(im||{}),CB=(pa=>(pa[pa.Unmount=0]="Unmount",pa[pa.Hidden=1]="Hidden",pa))(CB||{});function Bt$2(){let pa=AB();return reactExports.useCallback(ha=>TB({mergeRefs:pa,...ha}),[pa])}function TB({ourProps:pa,theirProps:ha,slot:ma,defaultTag:ja,features:La,visible:Ba=!0,name:hl,mergeRefs:Gl}){Gl=Gl??RB;let zl=hR(ha,pa);if(Ba)return Ps$1(zl,ma,ja,hl,Gl);let Wl=La??0;if(Wl&2){let{static:Kl=!1,...su}=zl;if(Kl)return Ps$1(su,ma,ja,hl,Gl)}if(Wl&1){let{unmount:Kl=!0,...su}=zl;return _n$1(Kl?0:1,{0(){return null},1(){return Ps$1({...su,hidden:!0,style:{display:"none"}},ma,ja,hl,Gl)}})}return Ps$1(zl,ma,ja,hl,Gl)}function Ps$1(pa,ha={},ma,ja,La){let{as:Ba=ma,children:hl,refName:Gl="ref",...zl}=qu(pa,["unmount","static"]),Wl=pa.ref!==void 0?{[Gl]:pa.ref}:{},Kl=typeof hl=="function"?hl(ha):hl;"className"in zl&&zl.className&&typeof zl.className=="function"&&(zl.className=zl.className(ha)),zl["aria-labelledby"]&&zl["aria-labelledby"]===zl.id&&(zl["aria-labelledby"]=void 0);let su={};if(ha){let au=!1,ou=[];for(let[$m,Nm]of Object.entries(ha))typeof Nm=="boolean"&&(au=!0),Nm===!0&&ou.push($m.replace(/([A-Z])/g,Mm=>`-${Mm.toLowerCase()}`));if(au){su["data-headlessui-state"]=ou.join(" ");for(let $m of ou)su[`data-${$m}`]=""}}if(il(Ba)&&(Object.keys(Nr$1(zl)).length>0||Object.keys(Nr$1(su)).length>0))if(!reactExports.isValidElement(Kl)||Array.isArray(Kl)&&Kl.length>1||_B(Kl)){if(Object.keys(Nr$1(zl)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${ja} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Nr$1(zl)).concat(Object.keys(Nr$1(su))).map(au=>` - ${au}`).join(`
|
|
184
184
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(au=>` - ${au}`).join(`
|
|
185
185
|
`)].join(`
|
|
186
186
|
`))}else{let au=Kl.props,ou=au?.className,$m=typeof ou=="function"?(...Mg)=>k0(ou(...Mg),zl.className):k0(ou,zl.className),Nm=$m?{className:$m}:{},Mm=hR(Kl.props,Nr$1(qu(zl,["ref"])));for(let Mg in su)Mg in Mm&&delete su[Mg];return reactExports.cloneElement(Kl,Object.assign({},Mm,su,Wl,{ref:La(OB(Kl),Wl.ref)},Nm))}return reactExports.createElement(Ba,Object.assign({},qu(zl,["ref"]),!il(Ba)&&Wl,!il(Ba)&&su),Kl)}function AB(){let pa=reactExports.useRef([]),ha=reactExports.useCallback(ma=>{for(let ja of pa.current)ja!=null&&(typeof ja=="function"?ja(ma):ja.current=ma)},[]);return(...ma)=>{if(!ma.every(ja=>ja==null))return pa.current=ma,ha}}function RB(...pa){return pa.every(ha=>ha==null)?void 0:ha=>{for(let ma of pa)ma!=null&&(typeof ma=="function"?ma(ha):ma.current=ha)}}function hR(...pa){if(pa.length===0)return{};if(pa.length===1)return pa[0];let ha={},ma={};for(let ja of pa)for(let La in ja)La.startsWith("on")&&typeof ja[La]=="function"?(ma[La]!=null||(ma[La]=[]),ma[La].push(ja[La])):ha[La]=ja[La];if(ha.disabled||ha["aria-disabled"])for(let ja in ma)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(ja)&&(ma[ja]=[La=>{var Ba;return(Ba=La?.preventDefault)==null?void 0:Ba.call(La)}]);for(let ja in ma)Object.assign(ha,{[ja](La,...Ba){let hl=ma[ja];for(let Gl of hl){if((La instanceof Event||La?.nativeEvent instanceof Event)&&La.defaultPrevented)return;Gl(La,...Ba)}}});return ha}function kg(...pa){if(pa.length===0)return{};if(pa.length===1)return pa[0];let ha={},ma={};for(let ja of pa)for(let La in ja)La.startsWith("on")&&typeof ja[La]=="function"?(ma[La]!=null||(ma[La]=[]),ma[La].push(ja[La])):ha[La]=ja[La];for(let ja in ma)Object.assign(ha,{[ja](...La){let Ba=ma[ja];for(let hl of Ba)hl?.(...La)}});return ha}function Zt$1(pa){var ha;return Object.assign(reactExports.forwardRef(pa),{displayName:(ha=pa.displayName)!=null?ha:pa.name})}function Nr$1(pa){let ha=Object.assign({},pa);for(let ma in ha)ha[ma]===void 0&&delete ha[ma];return ha}function qu(pa,ha=[]){let ma=Object.assign({},pa);for(let ja of ha)ja in ma&&delete ma[ja];return ma}function OB(pa){return React.version.split(".")[0]>="19"?pa.props.ref:pa.ref}function il(pa){return pa===reactExports.Fragment||pa===Symbol.for("react.fragment")}function _B(pa){return il(pa.type)}function pR(pa,ha,ma){let[ja,La]=reactExports.useState(ma),Ba=pa!==void 0,hl=reactExports.useRef(Ba),Gl=reactExports.useRef(!1),zl=reactExports.useRef(!1);return Ba&&!hl.current&&!Gl.current?(Gl.current=!0,hl.current=Ba,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!Ba&&hl.current&&!zl.current&&(zl.current=!0,hl.current=Ba,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[Ba?pa:ja,Te$3(Wl=>(Ba||reactDomExports.flushSync(()=>La(Wl)),ha?.(Wl)))]}function mR(pa){let[ha]=reactExports.useState(pa);return ha}function gR(pa={},ha=null,ma=[]){for(let[ja,La]of Object.entries(pa))yR(ma,vR(ha,ja),La);return ma}function vR(pa,ha){return pa?pa+"["+ha+"]":ha}function yR(pa,ha,ma){if(Array.isArray(ma))for(let[ja,La]of ma.entries())yR(pa,vR(ha,ja.toString()),La);else ma instanceof Date?pa.push([ha,ma.toISOString()]):typeof ma=="boolean"?pa.push([ha,ma?"1":"0"]):typeof ma=="string"?pa.push([ha,ma]):typeof ma=="number"?pa.push([ha,`${ma}`]):ma==null?pa.push([ha,""]):PB(ma)&&!reactExports.isValidElement(ma)&&gR(ma,ha,pa)}function bR(pa){var ha,ma;let ja=(ha=pa?.form)!=null?ha:pa.closest("form");if(ja){for(let La of ja.elements)if(La!==pa&&(La.tagName==="INPUT"&&La.type==="submit"||La.tagName==="BUTTON"&&La.type==="submit"||La.nodeName==="INPUT"&&La.type==="image")){La.click();return}(ma=ja.requestSubmit)==null||ma.call(ja)}}function PB(pa){if(Object.prototype.toString.call(pa)!=="[object Object]")return!1;let ha=Object.getPrototypeOf(pa);return ha===null||Object.getPrototypeOf(ha)===null}let NB="span";var Dg=(pa=>(pa[pa.None=1]="None",pa[pa.Focusable=2]="Focusable",pa[pa.Hidden=4]="Hidden",pa))(Dg||{});function MB(pa,ha){var ma;let{features:ja=1,...La}=pa,Ba={ref:ha,"aria-hidden":(ja&2)===2?!0:(ma=La["aria-hidden"])!=null?ma:void 0,hidden:(ja&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(ja&4)===4&&(ja&2)!==2&&{display:"none"}}};return Bt$2()({ourProps:Ba,theirProps:La,slot:{},defaultTag:NB,name:"Hidden"})}let xR=Zt$1(MB),$B=reactExports.createContext(null);function kB({children:pa}){let ha=reactExports.useContext($B);if(!ha)return React.createElement(React.Fragment,null,pa);let{target:ma}=ha;return ma?reactDomExports.createPortal(React.createElement(React.Fragment,null,pa),ma):null}function wR({data:pa,form:ha,disabled:ma,onReset:ja,overrides:La}){let[Ba,hl]=reactExports.useState(null),Gl=Jr$1();return reactExports.useEffect(()=>{if(ja&&Ba)return Gl.addEventListener(Ba,"reset",ja)},[Ba,ha,ja]),React.createElement(kB,null,React.createElement(DB,{setForm:hl,formId:ha}),gR(pa).map(([zl,Wl])=>React.createElement(xR,{features:Dg.Hidden,...Nr$1({key:zl,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:ha,disabled:ma,name:zl,value:Wl,...La})})))}function DB({setForm:pa,formId:ha}){return reactExports.useEffect(()=>{if(ha){let ma=document.getElementById(ha);ma&&pa(ma)}},[pa,ha]),ha?null:React.createElement(xR,{features:Dg.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:ma=>{if(!ma)return;let ja=ma.closest("form");ja&&pa(ja)}})}let IB=reactExports.createContext(void 0);function Ig(){return reactExports.useContext(IB)}function SR(pa){return typeof pa!="object"||pa===null?!1:"nodeType"in pa}function Cc(pa){return SR(pa)&&"tagName"in pa}function Xn$1(pa){return Cc(pa)&&"accessKey"in pa}function Wi$1(pa){return Cc(pa)&&"tabIndex"in pa}function FB(pa){return Cc(pa)&&"style"in pa}function LB(pa){return Xn$1(pa)&&pa.nodeName==="IFRAME"}function ER(pa){return Xn$1(pa)&&pa.nodeName==="INPUT"}function om(pa){return Xn$1(pa)&&pa.nodeName==="LABEL"}function jB(pa){return Xn$1(pa)&&pa.nodeName==="FIELDSET"}function CR(pa){return Xn$1(pa)&&pa.nodeName==="LEGEND"}function BB(pa){return Cc(pa)?pa.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function am(pa){let ha=pa.parentElement,ma=null;for(;ha&&!jB(ha);)CR(ha)&&(ma=ha),ha=ha.parentElement;let ja=ha?.getAttribute("disabled")==="";return ja&&VB(ma)?!1:ja}function VB(pa){if(!pa)return!1;let ha=pa.previousElementSibling;for(;ha!==null;){if(CR(ha))return!1;ha=ha.previousElementSibling}return!0}let TR=Symbol();function qB(pa,ha=!0){return Object.assign(pa,{[TR]:ha})}function dn$1(...pa){let ha=reactExports.useRef(pa);reactExports.useEffect(()=>{ha.current=pa},[pa]);let ma=Te$3(ja=>{for(let La of ha.current)La!=null&&(typeof La=="function"?La(ja):La.current=ja)});return pa.every(ja=>ja==null||ja?.[TR])?void 0:ma}let Tc=reactExports.createContext(null);Tc.displayName="DescriptionContext";function AR(){let pa=reactExports.useContext(Tc);if(pa===null){let ha=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(ha,AR),ha}return pa}function RR(){var pa,ha;return(ha=(pa=reactExports.useContext(Tc))==null?void 0:pa.value)!=null?ha:void 0}function UB(){let[pa,ha]=reactExports.useState([]);return[pa.length>0?pa.join(" "):void 0,reactExports.useMemo(()=>function(ma){let ja=Te$3(Ba=>(ha(hl=>[...hl,Ba]),()=>ha(hl=>{let Gl=hl.slice(),zl=Gl.indexOf(Ba);return zl!==-1&&Gl.splice(zl,1),Gl}))),La=reactExports.useMemo(()=>({register:ja,slot:ma.slot,name:ma.name,props:ma.props,value:ma.value}),[ja,ma.slot,ma.name,ma.props,ma.value]);return React.createElement(Tc.Provider,{value:La},ma.children)},[ha])]}let HB="p";function zB(pa,ha){let ma=reactExports.useId(),ja=Ec(),{id:La=`headlessui-description-${ma}`,...Ba}=pa,hl=AR(),Gl=dn$1(ha);mt$3(()=>hl.register(La),[La,hl.register]);let zl=Wn$1({...hl.slot,disabled:ja||!1}),Wl={ref:Gl,...hl.props,id:La};return Bt$2()({ourProps:Wl,theirProps:Ba,slot:zl,defaultTag:HB,name:hl.name||"Description"})}let WB=Zt$1(zB),GB=Object.assign(WB,{});var Ke$2=(pa=>(pa.Space=" ",pa.Enter="Enter",pa.Escape="Escape",pa.Backspace="Backspace",pa.Delete="Delete",pa.ArrowLeft="ArrowLeft",pa.ArrowUp="ArrowUp",pa.ArrowRight="ArrowRight",pa.ArrowDown="ArrowDown",pa.Home="Home",pa.End="End",pa.PageUp="PageUp",pa.PageDown="PageDown",pa.Tab="Tab",pa))(Ke$2||{});let Ac=reactExports.createContext(null);Ac.displayName="LabelContext";function OR(){let pa=reactExports.useContext(Ac);if(pa===null){let ha=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(ha,OR),ha}return pa}function Fg(pa){var ha,ma,ja;let La=(ma=(ha=reactExports.useContext(Ac))==null?void 0:ha.value)!=null?ma:void 0;return((ja=pa?.length)!=null?ja:0)>0?[La,...pa].filter(Boolean).join(" "):La}function _R({inherit:pa=!1}={}){let ha=Fg(),[ma,ja]=reactExports.useState([]),La=pa?[ha,...ma].filter(Boolean):ma;return[La.length>0?La.join(" "):void 0,reactExports.useMemo(()=>function(Ba){let hl=Te$3(zl=>(ja(Wl=>[...Wl,zl]),()=>ja(Wl=>{let Kl=Wl.slice(),su=Kl.indexOf(zl);return su!==-1&&Kl.splice(su,1),Kl}))),Gl=reactExports.useMemo(()=>({register:hl,slot:Ba.slot,name:Ba.name,props:Ba.props,value:Ba.value}),[hl,Ba.slot,Ba.name,Ba.props,Ba.value]);return React.createElement(Ac.Provider,{value:Gl},Ba.children)},[ja])]}let KB="label";function YB(pa,ha){var ma;let ja=reactExports.useId(),La=OR(),Ba=Ig(),hl=Ec(),{id:Gl=`headlessui-label-${ja}`,htmlFor:zl=Ba??((ma=La.props)==null?void 0:ma.htmlFor),passive:Wl=!1,...Kl}=pa,su=dn$1(ha);mt$3(()=>La.register(Gl),[Gl,La.register]);let au=Te$3(Nm=>{let Mm=Nm.currentTarget;if(!(Nm.target!==Nm.currentTarget&&BB(Nm.target))&&(om(Mm)&&Nm.preventDefault(),La.props&&"onClick"in La.props&&typeof La.props.onClick=="function"&&La.props.onClick(Nm),om(Mm))){let Mg=document.getElementById(Mm.htmlFor);if(Mg){let ly=Mg.getAttribute("disabled");if(ly==="true"||ly==="")return;let uy=Mg.getAttribute("aria-disabled");if(uy==="true"||uy==="")return;(ER(Mg)&&(Mg.type==="file"||Mg.type==="radio"||Mg.type==="checkbox")||Mg.role==="radio"||Mg.role==="checkbox"||Mg.role==="switch")&&Mg.click(),Mg.focus({preventScroll:!0})}}}),ou=Wn$1({...La.slot,disabled:hl||!1}),$m={ref:su,...La.props,id:Gl,htmlFor:zl,onClick:au};return Wl&&("onClick"in $m&&(delete $m.htmlFor,delete $m.onClick),"onClick"in Kl&&delete Kl.onClick),Bt$2()({ourProps:$m,theirProps:Kl,slot:ou,defaultTag:zl?KB:"div",name:La.name||"Label"})}let XB=Zt$1(YB),PR=Object.assign(XB,{});function pi$1(pa,ha,ma){let ja=ma.initialDeps??[],La,Ba=!0;function hl(){var Gl,zl,Wl;let Kl;ma.key&&(Gl=ma.debug)!=null&&Gl.call(ma)&&(Kl=Date.now());const su=pa();if(!(su.length!==ja.length||su.some((ou,$m)=>ja[$m]!==ou)))return La;ja=su;let au;if(ma.key&&(zl=ma.debug)!=null&&zl.call(ma)&&(au=Date.now()),La=ha(...su),ma.key&&(Wl=ma.debug)!=null&&Wl.call(ma)){const ou=Math.round((Date.now()-Kl)*100)/100,$m=Math.round((Date.now()-au)*100)/100,Nm=$m/16,Mm=(Mg,ly)=>{for(Mg=String(Mg);Mg.length<ly;)Mg=" "+Mg;return Mg};console.info(`%c⏱ ${Mm($m,5)} /${Mm(ou,5)} ms`,`
|
|
@@ -7343,7 +7343,7 @@ workflow TempEvent { ${pa} }`);if(isWorkflowDefinition$1(ma.defs[0]))ha=ma.defs[
|
|
|
7343
7343
|
*
|
|
7344
7344
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
7345
7345
|
* @license MIT
|
|
7346
|
-
*/var hasRequiredBuffer;function requireBuffer(){return hasRequiredBuffer||(hasRequiredBuffer=1,(function(pa){const ha=requireBase64Js(),ma=requireIeee754(),ja=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pa.Buffer=Gl,pa.SlowBuffer=ly,pa.INSPECT_MAX_BYTES=50;const La=2147483647;pa.kMaxLength=La,Gl.TYPED_ARRAY_SUPPORT=Ba(),!Gl.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ba(){try{const AQ=new Uint8Array(1),$Z={foo:function(){return 42}};return Object.setPrototypeOf($Z,Uint8Array.prototype),Object.setPrototypeOf(AQ,$Z),AQ.foo()===42}catch{return!1}}Object.defineProperty(Gl.prototype,"parent",{enumerable:!0,get:function(){if(Gl.isBuffer(this))return this.buffer}}),Object.defineProperty(Gl.prototype,"offset",{enumerable:!0,get:function(){if(Gl.isBuffer(this))return this.byteOffset}});function hl(AQ){if(AQ>La)throw new RangeError('The value "'+AQ+'" is invalid for option "size"');const $Z=new Uint8Array(AQ);return Object.setPrototypeOf($Z,Gl.prototype),$Z}function Gl(AQ,$Z,LZ){if(typeof AQ=="number"){if(typeof $Z=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return su(AQ)}return zl(AQ,$Z,LZ)}Gl.poolSize=8192;function zl(AQ,$Z,LZ){if(typeof AQ=="string")return au(AQ,$Z);if(ArrayBuffer.isView(AQ))return $m(AQ);if(AQ==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof AQ);if(YQ(AQ,ArrayBuffer)||AQ&&YQ(AQ.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(YQ(AQ,SharedArrayBuffer)||AQ&&YQ(AQ.buffer,SharedArrayBuffer)))return Nm(AQ,$Z,LZ);if(typeof AQ=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const NQ=AQ.valueOf&&AQ.valueOf();if(NQ!=null&&NQ!==AQ)return Gl.from(NQ,$Z,LZ);const bQ=Mm(AQ);if(bQ)return bQ;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof AQ[Symbol.toPrimitive]=="function")return Gl.from(AQ[Symbol.toPrimitive]("string"),$Z,LZ);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof AQ)}Gl.from=function(AQ,$Z,LZ){return zl(AQ,$Z,LZ)},Object.setPrototypeOf(Gl.prototype,Uint8Array.prototype),Object.setPrototypeOf(Gl,Uint8Array);function Wl(AQ){if(typeof AQ!="number")throw new TypeError('"size" argument must be of type number');if(AQ<0)throw new RangeError('The value "'+AQ+'" is invalid for option "size"')}function Kl(AQ,$Z,LZ){return Wl(AQ),AQ<=0?hl(AQ):$Z!==void 0?typeof LZ=="string"?hl(AQ).fill($Z,LZ):hl(AQ).fill($Z):hl(AQ)}Gl.alloc=function(AQ,$Z,LZ){return Kl(AQ,$Z,LZ)};function su(AQ){return Wl(AQ),hl(AQ<0?0:Mg(AQ)|0)}Gl.allocUnsafe=function(AQ){return su(AQ)},Gl.allocUnsafeSlow=function(AQ){return su(AQ)};function au(AQ,$Z){if((typeof $Z!="string"||$Z==="")&&($Z="utf8"),!Gl.isEncoding($Z))throw new TypeError("Unknown encoding: "+$Z);const LZ=uy(AQ,$Z)|0;let NQ=hl(LZ);const bQ=NQ.write(AQ,$Z);return bQ!==LZ&&(NQ=NQ.slice(0,bQ)),NQ}function ou(AQ){const $Z=AQ.length<0?0:Mg(AQ.length)|0,LZ=hl($Z);for(let NQ=0;NQ<$Z;NQ+=1)LZ[NQ]=AQ[NQ]&255;return LZ}function $m(AQ){if(YQ(AQ,Uint8Array)){const $Z=new Uint8Array(AQ);return Nm($Z.buffer,$Z.byteOffset,$Z.byteLength)}return ou(AQ)}function Nm(AQ,$Z,LZ){if($Z<0||AQ.byteLength<$Z)throw new RangeError('"offset" is outside of buffer bounds');if(AQ.byteLength<$Z+(LZ||0))throw new RangeError('"length" is outside of buffer bounds');let NQ;return $Z===void 0&&LZ===void 0?NQ=new Uint8Array(AQ):LZ===void 0?NQ=new Uint8Array(AQ,$Z):NQ=new Uint8Array(AQ,$Z,LZ),Object.setPrototypeOf(NQ,Gl.prototype),NQ}function Mm(AQ){if(Gl.isBuffer(AQ)){const $Z=Mg(AQ.length)|0,LZ=hl($Z);return LZ.length===0||AQ.copy(LZ,0,0,$Z),LZ}if(AQ.length!==void 0)return typeof AQ.length!="number"||mee(AQ.length)?hl(0):ou(AQ);if(AQ.type==="Buffer"&&Array.isArray(AQ.data))return ou(AQ.data)}function Mg(AQ){if(AQ>=La)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+La.toString(16)+" bytes");return AQ|0}function ly(AQ){return+AQ!=AQ&&(AQ=0),Gl.alloc(+AQ)}Gl.isBuffer=function($Z){return $Z!=null&&$Z._isBuffer===!0&&$Z!==Gl.prototype},Gl.compare=function($Z,LZ){if(YQ($Z,Uint8Array)&&($Z=Gl.from($Z,$Z.offset,$Z.byteLength)),YQ(LZ,Uint8Array)&&(LZ=Gl.from(LZ,LZ.offset,LZ.byteLength)),!Gl.isBuffer($Z)||!Gl.isBuffer(LZ))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($Z===LZ)return 0;let NQ=$Z.length,bQ=LZ.length;for(let pQ=0,cQ=Math.min(NQ,bQ);pQ<cQ;++pQ)if($Z[pQ]!==LZ[pQ]){NQ=$Z[pQ],bQ=LZ[pQ];break}return NQ<bQ?-1:bQ<NQ?1:0},Gl.isEncoding=function($Z){switch(String($Z).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Gl.concat=function($Z,LZ){if(!Array.isArray($Z))throw new TypeError('"list" argument must be an Array of Buffers');if($Z.length===0)return Gl.alloc(0);let NQ;if(LZ===void 0)for(LZ=0,NQ=0;NQ<$Z.length;++NQ)LZ+=$Z[NQ].length;const bQ=Gl.allocUnsafe(LZ);let pQ=0;for(NQ=0;NQ<$Z.length;++NQ){let cQ=$Z[NQ];if(YQ(cQ,Uint8Array))pQ+cQ.length>bQ.length?(Gl.isBuffer(cQ)||(cQ=Gl.from(cQ)),cQ.copy(bQ,pQ)):Uint8Array.prototype.set.call(bQ,cQ,pQ);else if(Gl.isBuffer(cQ))cQ.copy(bQ,pQ);else throw new TypeError('"list" argument must be an Array of Buffers');pQ+=cQ.length}return bQ};function uy(AQ,$Z){if(Gl.isBuffer(AQ))return AQ.length;if(ArrayBuffer.isView(AQ)||YQ(AQ,ArrayBuffer))return AQ.byteLength;if(typeof AQ!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof AQ);const LZ=AQ.length,NQ=arguments.length>2&&arguments[2]===!0;if(!NQ&&LZ===0)return 0;let bQ=!1;for(;;)switch($Z){case"ascii":case"latin1":case"binary":return LZ;case"utf8":case"utf-8":return VQ(AQ).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return LZ*2;case"hex":return LZ>>>1;case"base64":return Iee(AQ).length;default:if(bQ)return NQ?-1:VQ(AQ).length;$Z=(""+$Z).toLowerCase(),bQ=!0}}Gl.byteLength=uy;function GE(AQ,$Z,LZ){let NQ=!1;if(($Z===void 0||$Z<0)&&($Z=0),$Z>this.length||((LZ===void 0||LZ>this.length)&&(LZ=this.length),LZ<=0)||(LZ>>>=0,$Z>>>=0,LZ<=$Z))return"";for(AQ||(AQ="utf8");;)switch(AQ){case"hex":return vN(this,$Z,LZ);case"utf8":case"utf-8":return uN(this,$Z,LZ);case"ascii":return bN(this,$Z,LZ);case"latin1":case"binary":return xN(this,$Z,LZ);case"base64":return dN(this,$Z,LZ);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wN(this,$Z,LZ);default:if(NQ)throw new TypeError("Unknown encoding: "+AQ);AQ=(AQ+"").toLowerCase(),NQ=!0}}Gl.prototype._isBuffer=!0;function YE(AQ,$Z,LZ){const NQ=AQ[$Z];AQ[$Z]=AQ[LZ],AQ[LZ]=NQ}Gl.prototype.swap16=function(){const $Z=this.length;if($Z%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let LZ=0;LZ<$Z;LZ+=2)YE(this,LZ,LZ+1);return this},Gl.prototype.swap32=function(){const $Z=this.length;if($Z%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let LZ=0;LZ<$Z;LZ+=4)YE(this,LZ,LZ+3),YE(this,LZ+1,LZ+2);return this},Gl.prototype.swap64=function(){const $Z=this.length;if($Z%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let LZ=0;LZ<$Z;LZ+=8)YE(this,LZ,LZ+7),YE(this,LZ+1,LZ+6),YE(this,LZ+2,LZ+5),YE(this,LZ+3,LZ+4);return this},Gl.prototype.toString=function(){const $Z=this.length;return $Z===0?"":arguments.length===0?uN(this,0,$Z):GE.apply(this,arguments)},Gl.prototype.toLocaleString=Gl.prototype.toString,Gl.prototype.equals=function($Z){if(!Gl.isBuffer($Z))throw new TypeError("Argument must be a Buffer");return this===$Z?!0:Gl.compare(this,$Z)===0},Gl.prototype.inspect=function(){let $Z="";const LZ=pa.INSPECT_MAX_BYTES;return $Z=this.toString("hex",0,LZ).replace(/(.{2})/g,"$1 ").trim(),this.length>LZ&&($Z+=" ... "),"<Buffer "+$Z+">"},ja&&(Gl.prototype[ja]=Gl.prototype.inspect),Gl.prototype.compare=function($Z,LZ,NQ,bQ,pQ){if(YQ($Z,Uint8Array)&&($Z=Gl.from($Z,$Z.offset,$Z.byteLength)),!Gl.isBuffer($Z))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $Z);if(LZ===void 0&&(LZ=0),NQ===void 0&&(NQ=$Z?$Z.length:0),bQ===void 0&&(bQ=0),pQ===void 0&&(pQ=this.length),LZ<0||NQ>$Z.length||bQ<0||pQ>this.length)throw new RangeError("out of range index");if(bQ>=pQ&&LZ>=NQ)return 0;if(bQ>=pQ)return-1;if(LZ>=NQ)return 1;if(LZ>>>=0,NQ>>>=0,bQ>>>=0,pQ>>>=0,this===$Z)return 0;let cQ=pQ-bQ,SQ=NQ-LZ;const CQ=Math.min(cQ,SQ),BQ=this.slice(bQ,pQ),_Q=$Z.slice(LZ,NQ);for(let QY=0;QY<CQ;++QY)if(BQ[QY]!==_Q[QY]){cQ=BQ[QY],SQ=_Q[QY];break}return cQ<SQ?-1:SQ<cQ?1:0};function JE(AQ,$Z,LZ,NQ,bQ){if(AQ.length===0)return-1;if(typeof LZ=="string"?(NQ=LZ,LZ=0):LZ>2147483647?LZ=2147483647:LZ<-2147483648&&(LZ=-2147483648),LZ=+LZ,mee(LZ)&&(LZ=bQ?0:AQ.length-1),LZ<0&&(LZ=AQ.length+LZ),LZ>=AQ.length){if(bQ)return-1;LZ=AQ.length-1}else if(LZ<0)if(bQ)LZ=0;else return-1;if(typeof $Z=="string"&&($Z=Gl.from($Z,NQ)),Gl.isBuffer($Z))return $Z.length===0?-1:XE(AQ,$Z,LZ,NQ,bQ);if(typeof $Z=="number")return $Z=$Z&255,typeof Uint8Array.prototype.indexOf=="function"?bQ?Uint8Array.prototype.indexOf.call(AQ,$Z,LZ):Uint8Array.prototype.lastIndexOf.call(AQ,$Z,LZ):XE(AQ,[$Z],LZ,NQ,bQ);throw new TypeError("val must be string, number or Buffer")}function XE(AQ,$Z,LZ,NQ,bQ){let pQ=1,cQ=AQ.length,SQ=$Z.length;if(NQ!==void 0&&(NQ=String(NQ).toLowerCase(),NQ==="ucs2"||NQ==="ucs-2"||NQ==="utf16le"||NQ==="utf-16le")){if(AQ.length<2||$Z.length<2)return-1;pQ=2,cQ/=2,SQ/=2,LZ/=2}function CQ(_Q,QY){return pQ===1?_Q[QY]:_Q.readUInt16BE(QY*pQ)}let BQ;if(bQ){let _Q=-1;for(BQ=LZ;BQ<cQ;BQ++)if(CQ(AQ,BQ)===CQ($Z,_Q===-1?0:BQ-_Q)){if(_Q===-1&&(_Q=BQ),BQ-_Q+1===SQ)return _Q*pQ}else _Q!==-1&&(BQ-=BQ-_Q),_Q=-1}else for(LZ+SQ>cQ&&(LZ=cQ-SQ),BQ=LZ;BQ>=0;BQ--){let _Q=!0;for(let QY=0;QY<SQ;QY++)if(CQ(AQ,BQ+QY)!==CQ($Z,QY)){_Q=!1;break}if(_Q)return BQ}return-1}Gl.prototype.includes=function($Z,LZ,NQ){return this.indexOf($Z,LZ,NQ)!==-1},Gl.prototype.indexOf=function($Z,LZ,NQ){return JE(this,$Z,LZ,NQ,!0)},Gl.prototype.lastIndexOf=function($Z,LZ,NQ){return JE(this,$Z,LZ,NQ,!1)};function cN(AQ,$Z,LZ,NQ){LZ=Number(LZ)||0;const bQ=AQ.length-LZ;NQ?(NQ=Number(NQ),NQ>bQ&&(NQ=bQ)):NQ=bQ;const pQ=$Z.length;NQ>pQ/2&&(NQ=pQ/2);let cQ;for(cQ=0;cQ<NQ;++cQ){const SQ=parseInt($Z.substr(cQ*2,2),16);if(mee(SQ))return cQ;AQ[LZ+cQ]=SQ}return cQ}function pN(AQ,$Z,LZ,NQ){return vee(VQ($Z,AQ.length-LZ),AQ,LZ,NQ)}function hN(AQ,$Z,LZ,NQ){return vee(wee($Z),AQ,LZ,NQ)}function lN(AQ,$Z,LZ,NQ){return vee(Iee($Z),AQ,LZ,NQ)}function rA(AQ,$Z,LZ,NQ){return vee(Tee($Z,AQ.length-LZ),AQ,LZ,NQ)}Gl.prototype.write=function($Z,LZ,NQ,bQ){if(LZ===void 0)bQ="utf8",NQ=this.length,LZ=0;else if(NQ===void 0&&typeof LZ=="string")bQ=LZ,NQ=this.length,LZ=0;else if(isFinite(LZ))LZ=LZ>>>0,isFinite(NQ)?(NQ=NQ>>>0,bQ===void 0&&(bQ="utf8")):(bQ=NQ,NQ=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pQ=this.length-LZ;if((NQ===void 0||NQ>pQ)&&(NQ=pQ),$Z.length>0&&(NQ<0||LZ<0)||LZ>this.length)throw new RangeError("Attempt to write outside buffer bounds");bQ||(bQ="utf8");let cQ=!1;for(;;)switch(bQ){case"hex":return cN(this,$Z,LZ,NQ);case"utf8":case"utf-8":return pN(this,$Z,LZ,NQ);case"ascii":case"latin1":case"binary":return hN(this,$Z,LZ,NQ);case"base64":return lN(this,$Z,LZ,NQ);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rA(this,$Z,LZ,NQ);default:if(cQ)throw new TypeError("Unknown encoding: "+bQ);bQ=(""+bQ).toLowerCase(),cQ=!0}},Gl.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dN(AQ,$Z,LZ){return $Z===0&&LZ===AQ.length?ha.fromByteArray(AQ):ha.fromByteArray(AQ.slice($Z,LZ))}function uN(AQ,$Z,LZ){LZ=Math.min(AQ.length,LZ);const NQ=[];let bQ=$Z;for(;bQ<LZ;){const pQ=AQ[bQ];let cQ=null,SQ=pQ>239?4:pQ>223?3:pQ>191?2:1;if(bQ+SQ<=LZ){let CQ,BQ,_Q,QY;switch(SQ){case 1:pQ<128&&(cQ=pQ);break;case 2:CQ=AQ[bQ+1],(CQ&192)===128&&(QY=(pQ&31)<<6|CQ&63,QY>127&&(cQ=QY));break;case 3:CQ=AQ[bQ+1],BQ=AQ[bQ+2],(CQ&192)===128&&(BQ&192)===128&&(QY=(pQ&15)<<12|(CQ&63)<<6|BQ&63,QY>2047&&(QY<55296||QY>57343)&&(cQ=QY));break;case 4:CQ=AQ[bQ+1],BQ=AQ[bQ+2],_Q=AQ[bQ+3],(CQ&192)===128&&(BQ&192)===128&&(_Q&192)===128&&(QY=(pQ&15)<<18|(CQ&63)<<12|(BQ&63)<<6|_Q&63,QY>65535&&QY<1114112&&(cQ=QY))}}cQ===null?(cQ=65533,SQ=1):cQ>65535&&(cQ-=65536,NQ.push(cQ>>>10&1023|55296),cQ=56320|cQ&1023),NQ.push(cQ),bQ+=SQ}return mN(NQ)}const gN=4096;function mN(AQ){const $Z=AQ.length;if($Z<=gN)return String.fromCharCode.apply(String,AQ);let LZ="",NQ=0;for(;NQ<$Z;)LZ+=String.fromCharCode.apply(String,AQ.slice(NQ,NQ+=gN));return LZ}function bN(AQ,$Z,LZ){let NQ="";LZ=Math.min(AQ.length,LZ);for(let bQ=$Z;bQ<LZ;++bQ)NQ+=String.fromCharCode(AQ[bQ]&127);return NQ}function xN(AQ,$Z,LZ){let NQ="";LZ=Math.min(AQ.length,LZ);for(let bQ=$Z;bQ<LZ;++bQ)NQ+=String.fromCharCode(AQ[bQ]);return NQ}function vN(AQ,$Z,LZ){const NQ=AQ.length;(!$Z||$Z<0)&&($Z=0),(!LZ||LZ<0||LZ>NQ)&&(LZ=NQ);let bQ="";for(let pQ=$Z;pQ<LZ;++pQ)bQ+=See[AQ[pQ]];return bQ}function wN(AQ,$Z,LZ){const NQ=AQ.slice($Z,LZ);let bQ="";for(let pQ=0;pQ<NQ.length-1;pQ+=2)bQ+=String.fromCharCode(NQ[pQ]+NQ[pQ+1]*256);return bQ}Gl.prototype.slice=function($Z,LZ){const NQ=this.length;$Z=~~$Z,LZ=LZ===void 0?NQ:~~LZ,$Z<0?($Z+=NQ,$Z<0&&($Z=0)):$Z>NQ&&($Z=NQ),LZ<0?(LZ+=NQ,LZ<0&&(LZ=0)):LZ>NQ&&(LZ=NQ),LZ<$Z&&(LZ=$Z);const bQ=this.subarray($Z,LZ);return Object.setPrototypeOf(bQ,Gl.prototype),bQ};function FZ(AQ,$Z,LZ){if(AQ%1!==0||AQ<0)throw new RangeError("offset is not uint");if(AQ+$Z>LZ)throw new RangeError("Trying to access beyond buffer length")}Gl.prototype.readUintLE=Gl.prototype.readUIntLE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z],pQ=1,cQ=0;for(;++cQ<LZ&&(pQ*=256);)bQ+=this[$Z+cQ]*pQ;return bQ},Gl.prototype.readUintBE=Gl.prototype.readUIntBE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z+--LZ],pQ=1;for(;LZ>0&&(pQ*=256);)bQ+=this[$Z+--LZ]*pQ;return bQ},Gl.prototype.readUint8=Gl.prototype.readUInt8=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,1,this.length),this[$Z]},Gl.prototype.readUint16LE=Gl.prototype.readUInt16LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,2,this.length),this[$Z]|this[$Z+1]<<8},Gl.prototype.readUint16BE=Gl.prototype.readUInt16BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,2,this.length),this[$Z]<<8|this[$Z+1]},Gl.prototype.readUint32LE=Gl.prototype.readUInt32LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),(this[$Z]|this[$Z+1]<<8|this[$Z+2]<<16)+this[$Z+3]*16777216},Gl.prototype.readUint32BE=Gl.prototype.readUInt32BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]*16777216+(this[$Z+1]<<16|this[$Z+2]<<8|this[$Z+3])},Gl.prototype.readBigUInt64LE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=LZ+this[++$Z]*2**8+this[++$Z]*2**16+this[++$Z]*2**24,pQ=this[++$Z]+this[++$Z]*2**8+this[++$Z]*2**16+NQ*2**24;return BigInt(bQ)+(BigInt(pQ)<<BigInt(32))}),Gl.prototype.readBigUInt64BE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=LZ*2**24+this[++$Z]*2**16+this[++$Z]*2**8+this[++$Z],pQ=this[++$Z]*2**24+this[++$Z]*2**16+this[++$Z]*2**8+NQ;return(BigInt(bQ)<<BigInt(32))+BigInt(pQ)}),Gl.prototype.readIntLE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z],pQ=1,cQ=0;for(;++cQ<LZ&&(pQ*=256);)bQ+=this[$Z+cQ]*pQ;return pQ*=128,bQ>=pQ&&(bQ-=Math.pow(2,8*LZ)),bQ},Gl.prototype.readIntBE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=LZ,pQ=1,cQ=this[$Z+--bQ];for(;bQ>0&&(pQ*=256);)cQ+=this[$Z+--bQ]*pQ;return pQ*=128,cQ>=pQ&&(cQ-=Math.pow(2,8*LZ)),cQ},Gl.prototype.readInt8=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,1,this.length),this[$Z]&128?(255-this[$Z]+1)*-1:this[$Z]},Gl.prototype.readInt16LE=function($Z,LZ){$Z=$Z>>>0,LZ||FZ($Z,2,this.length);const NQ=this[$Z]|this[$Z+1]<<8;return NQ&32768?NQ|4294901760:NQ},Gl.prototype.readInt16BE=function($Z,LZ){$Z=$Z>>>0,LZ||FZ($Z,2,this.length);const NQ=this[$Z+1]|this[$Z]<<8;return NQ&32768?NQ|4294901760:NQ},Gl.prototype.readInt32LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]|this[$Z+1]<<8|this[$Z+2]<<16|this[$Z+3]<<24},Gl.prototype.readInt32BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]<<24|this[$Z+1]<<16|this[$Z+2]<<8|this[$Z+3]},Gl.prototype.readBigInt64LE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=this[$Z+4]+this[$Z+5]*2**8+this[$Z+6]*2**16+(NQ<<24);return(BigInt(bQ)<<BigInt(32))+BigInt(LZ+this[++$Z]*2**8+this[++$Z]*2**16+this[++$Z]*2**24)}),Gl.prototype.readBigInt64BE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=(LZ<<24)+this[++$Z]*2**16+this[++$Z]*2**8+this[++$Z];return(BigInt(bQ)<<BigInt(32))+BigInt(this[++$Z]*2**24+this[++$Z]*2**16+this[++$Z]*2**8+NQ)}),Gl.prototype.readFloatLE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),ma.read(this,$Z,!0,23,4)},Gl.prototype.readFloatBE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),ma.read(this,$Z,!1,23,4)},Gl.prototype.readDoubleLE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,8,this.length),ma.read(this,$Z,!0,52,8)},Gl.prototype.readDoubleBE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,8,this.length),ma.read(this,$Z,!1,52,8)};function IZ(AQ,$Z,LZ,NQ,bQ,pQ){if(!Gl.isBuffer(AQ))throw new TypeError('"buffer" argument must be a Buffer instance');if($Z>bQ||$Z<pQ)throw new RangeError('"value" argument is out of bounds');if(LZ+NQ>AQ.length)throw new RangeError("Index out of range")}Gl.prototype.writeUintLE=Gl.prototype.writeUIntLE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,NQ=NQ>>>0,!bQ){const SQ=Math.pow(2,8*NQ)-1;IZ(this,$Z,LZ,NQ,SQ,0)}let pQ=1,cQ=0;for(this[LZ]=$Z&255;++cQ<NQ&&(pQ*=256);)this[LZ+cQ]=$Z/pQ&255;return LZ+NQ},Gl.prototype.writeUintBE=Gl.prototype.writeUIntBE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,NQ=NQ>>>0,!bQ){const SQ=Math.pow(2,8*NQ)-1;IZ(this,$Z,LZ,NQ,SQ,0)}let pQ=NQ-1,cQ=1;for(this[LZ+pQ]=$Z&255;--pQ>=0&&(cQ*=256);)this[LZ+pQ]=$Z/cQ&255;return LZ+NQ},Gl.prototype.writeUint8=Gl.prototype.writeUInt8=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,1,255,0),this[LZ]=$Z&255,LZ+1},Gl.prototype.writeUint16LE=Gl.prototype.writeUInt16LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,65535,0),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,LZ+2},Gl.prototype.writeUint16BE=Gl.prototype.writeUInt16BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,65535,0),this[LZ]=$Z>>>8,this[LZ+1]=$Z&255,LZ+2},Gl.prototype.writeUint32LE=Gl.prototype.writeUInt32LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,4294967295,0),this[LZ+3]=$Z>>>24,this[LZ+2]=$Z>>>16,this[LZ+1]=$Z>>>8,this[LZ]=$Z&255,LZ+4},Gl.prototype.writeUint32BE=Gl.prototype.writeUInt32BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,4294967295,0),this[LZ]=$Z>>>24,this[LZ+1]=$Z>>>16,this[LZ+2]=$Z>>>8,this[LZ+3]=$Z&255,LZ+4};function lQ(AQ,$Z,LZ,NQ,bQ){RQ($Z,NQ,bQ,AQ,LZ,7);let pQ=Number($Z&BigInt(4294967295));AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ;let cQ=Number($Z>>BigInt(32)&BigInt(4294967295));return AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,LZ}function VZ(AQ,$Z,LZ,NQ,bQ){RQ($Z,NQ,bQ,AQ,LZ,7);let pQ=Number($Z&BigInt(4294967295));AQ[LZ+7]=pQ,pQ=pQ>>8,AQ[LZ+6]=pQ,pQ=pQ>>8,AQ[LZ+5]=pQ,pQ=pQ>>8,AQ[LZ+4]=pQ;let cQ=Number($Z>>BigInt(32)&BigInt(4294967295));return AQ[LZ+3]=cQ,cQ=cQ>>8,AQ[LZ+2]=cQ,cQ=cQ>>8,AQ[LZ+1]=cQ,cQ=cQ>>8,AQ[LZ]=cQ,LZ+8}Gl.prototype.writeBigUInt64LE=Ree(function($Z,LZ=0){return lQ(this,$Z,LZ,BigInt(0),BigInt("0xffffffffffffffff"))}),Gl.prototype.writeBigUInt64BE=Ree(function($Z,LZ=0){return VZ(this,$Z,LZ,BigInt(0),BigInt("0xffffffffffffffff"))}),Gl.prototype.writeIntLE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,!bQ){const CQ=Math.pow(2,8*NQ-1);IZ(this,$Z,LZ,NQ,CQ-1,-CQ)}let pQ=0,cQ=1,SQ=0;for(this[LZ]=$Z&255;++pQ<NQ&&(cQ*=256);)$Z<0&&SQ===0&&this[LZ+pQ-1]!==0&&(SQ=1),this[LZ+pQ]=($Z/cQ>>0)-SQ&255;return LZ+NQ},Gl.prototype.writeIntBE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,!bQ){const CQ=Math.pow(2,8*NQ-1);IZ(this,$Z,LZ,NQ,CQ-1,-CQ)}let pQ=NQ-1,cQ=1,SQ=0;for(this[LZ+pQ]=$Z&255;--pQ>=0&&(cQ*=256);)$Z<0&&SQ===0&&this[LZ+pQ+1]!==0&&(SQ=1),this[LZ+pQ]=($Z/cQ>>0)-SQ&255;return LZ+NQ},Gl.prototype.writeInt8=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,1,127,-128),$Z<0&&($Z=255+$Z+1),this[LZ]=$Z&255,LZ+1},Gl.prototype.writeInt16LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,32767,-32768),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,LZ+2},Gl.prototype.writeInt16BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,32767,-32768),this[LZ]=$Z>>>8,this[LZ+1]=$Z&255,LZ+2},Gl.prototype.writeInt32LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,2147483647,-2147483648),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,this[LZ+2]=$Z>>>16,this[LZ+3]=$Z>>>24,LZ+4},Gl.prototype.writeInt32BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,2147483647,-2147483648),$Z<0&&($Z=4294967295+$Z+1),this[LZ]=$Z>>>24,this[LZ+1]=$Z>>>16,this[LZ+2]=$Z>>>8,this[LZ+3]=$Z&255,LZ+4},Gl.prototype.writeBigInt64LE=Ree(function($Z,LZ=0){return lQ(this,$Z,LZ,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Gl.prototype.writeBigInt64BE=Ree(function($Z,LZ=0){return VZ(this,$Z,LZ,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $Q(AQ,$Z,LZ,NQ,bQ,pQ){if(LZ+NQ>AQ.length)throw new RangeError("Index out of range");if(LZ<0)throw new RangeError("Index out of range")}function gQ(AQ,$Z,LZ,NQ,bQ){return $Z=+$Z,LZ=LZ>>>0,bQ||$Q(AQ,$Z,LZ,4),ma.write(AQ,$Z,LZ,NQ,23,4),LZ+4}Gl.prototype.writeFloatLE=function($Z,LZ,NQ){return gQ(this,$Z,LZ,!0,NQ)},Gl.prototype.writeFloatBE=function($Z,LZ,NQ){return gQ(this,$Z,LZ,!1,NQ)};function PQ(AQ,$Z,LZ,NQ,bQ){return $Z=+$Z,LZ=LZ>>>0,bQ||$Q(AQ,$Z,LZ,8),ma.write(AQ,$Z,LZ,NQ,52,8),LZ+8}Gl.prototype.writeDoubleLE=function($Z,LZ,NQ){return PQ(this,$Z,LZ,!0,NQ)},Gl.prototype.writeDoubleBE=function($Z,LZ,NQ){return PQ(this,$Z,LZ,!1,NQ)},Gl.prototype.copy=function($Z,LZ,NQ,bQ){if(!Gl.isBuffer($Z))throw new TypeError("argument should be a Buffer");if(NQ||(NQ=0),!bQ&&bQ!==0&&(bQ=this.length),LZ>=$Z.length&&(LZ=$Z.length),LZ||(LZ=0),bQ>0&&bQ<NQ&&(bQ=NQ),bQ===NQ||$Z.length===0||this.length===0)return 0;if(LZ<0)throw new RangeError("targetStart out of bounds");if(NQ<0||NQ>=this.length)throw new RangeError("Index out of range");if(bQ<0)throw new RangeError("sourceEnd out of bounds");bQ>this.length&&(bQ=this.length),$Z.length-LZ<bQ-NQ&&(bQ=$Z.length-LZ+NQ);const pQ=bQ-NQ;return this===$Z&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(LZ,NQ,bQ):Uint8Array.prototype.set.call($Z,this.subarray(NQ,bQ),LZ),pQ},Gl.prototype.fill=function($Z,LZ,NQ,bQ){if(typeof $Z=="string"){if(typeof LZ=="string"?(bQ=LZ,LZ=0,NQ=this.length):typeof NQ=="string"&&(bQ=NQ,NQ=this.length),bQ!==void 0&&typeof bQ!="string")throw new TypeError("encoding must be a string");if(typeof bQ=="string"&&!Gl.isEncoding(bQ))throw new TypeError("Unknown encoding: "+bQ);if($Z.length===1){const cQ=$Z.charCodeAt(0);(bQ==="utf8"&&cQ<128||bQ==="latin1")&&($Z=cQ)}}else typeof $Z=="number"?$Z=$Z&255:typeof $Z=="boolean"&&($Z=Number($Z));if(LZ<0||this.length<LZ||this.length<NQ)throw new RangeError("Out of range index");if(NQ<=LZ)return this;LZ=LZ>>>0,NQ=NQ===void 0?this.length:NQ>>>0,$Z||($Z=0);let pQ;if(typeof $Z=="number")for(pQ=LZ;pQ<NQ;++pQ)this[pQ]=$Z;else{const cQ=Gl.isBuffer($Z)?$Z:Gl.from($Z,bQ),SQ=cQ.length;if(SQ===0)throw new TypeError('The value "'+$Z+'" is invalid for argument "value"');for(pQ=0;pQ<NQ-LZ;++pQ)this[pQ+LZ]=cQ[pQ%SQ]}return this};const MQ={};function GQ(AQ,$Z,LZ){MQ[AQ]=class extends LZ{constructor(){super(),Object.defineProperty(this,"message",{value:$Z.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${AQ}]`,this.stack,delete this.name}get code(){return AQ}set code(bQ){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:bQ,writable:!0})}toString(){return`${this.name} [${AQ}]: ${this.message}`}}}GQ("ERR_BUFFER_OUT_OF_BOUNDS",function(AQ){return AQ?`${AQ} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),GQ("ERR_INVALID_ARG_TYPE",function(AQ,$Z){return`The "${AQ}" argument must be of type number. Received type ${typeof $Z}`},TypeError),GQ("ERR_OUT_OF_RANGE",function(AQ,$Z,LZ){let NQ=`The value of "${AQ}" is out of range.`,bQ=LZ;return Number.isInteger(LZ)&&Math.abs(LZ)>2**32?bQ=LQ(String(LZ)):typeof LZ=="bigint"&&(bQ=String(LZ),(LZ>BigInt(2)**BigInt(32)||LZ<-(BigInt(2)**BigInt(32)))&&(bQ=LQ(bQ)),bQ+="n"),NQ+=` It must be ${$Z}. Received ${bQ}`,NQ},RangeError);function LQ(AQ){let $Z="",LZ=AQ.length;const NQ=AQ[0]==="-"?1:0;for(;LZ>=NQ+4;LZ-=3)$Z=`_${AQ.slice(LZ-3,LZ)}${$Z}`;return`${AQ.slice(0,LZ)}${$Z}`}function xQ(AQ,$Z,LZ){FQ($Z,"offset"),(AQ[$Z]===void 0||AQ[$Z+LZ]===void 0)&&jQ($Z,AQ.length-(LZ+1))}function RQ(AQ,$Z,LZ,NQ,bQ,pQ){if(AQ>LZ||AQ<$Z){const cQ=typeof $Z=="bigint"?"n":"";let SQ;throw $Z===0||$Z===BigInt(0)?SQ=`>= 0${cQ} and < 2${cQ} ** ${(pQ+1)*8}${cQ}`:SQ=`>= -(2${cQ} ** ${(pQ+1)*8-1}${cQ}) and < 2 ** ${(pQ+1)*8-1}${cQ}`,new MQ.ERR_OUT_OF_RANGE("value",SQ,AQ)}xQ(NQ,bQ,pQ)}function FQ(AQ,$Z){if(typeof AQ!="number")throw new MQ.ERR_INVALID_ARG_TYPE($Z,"number",AQ)}function jQ(AQ,$Z,LZ){throw Math.floor(AQ)!==AQ?(FQ(AQ,LZ),new MQ.ERR_OUT_OF_RANGE("offset","an integer",AQ)):$Z<0?new MQ.ERR_BUFFER_OUT_OF_BOUNDS:new MQ.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${$Z}`,AQ)}const eee=/[^+/0-9A-Za-z-_]/g;function uee(AQ){if(AQ=AQ.split("=")[0],AQ=AQ.trim().replace(eee,""),AQ.length<2)return"";for(;AQ.length%4!==0;)AQ=AQ+"=";return AQ}function VQ(AQ,$Z){$Z=$Z||1/0;let LZ;const NQ=AQ.length;let bQ=null;const pQ=[];for(let cQ=0;cQ<NQ;++cQ){if(LZ=AQ.charCodeAt(cQ),LZ>55295&&LZ<57344){if(!bQ){if(LZ>56319){($Z-=3)>-1&&pQ.push(239,191,189);continue}else if(cQ+1===NQ){($Z-=3)>-1&&pQ.push(239,191,189);continue}bQ=LZ;continue}if(LZ<56320){($Z-=3)>-1&&pQ.push(239,191,189),bQ=LZ;continue}LZ=(bQ-55296<<10|LZ-56320)+65536}else bQ&&($Z-=3)>-1&&pQ.push(239,191,189);if(bQ=null,LZ<128){if(($Z-=1)<0)break;pQ.push(LZ)}else if(LZ<2048){if(($Z-=2)<0)break;pQ.push(LZ>>6|192,LZ&63|128)}else if(LZ<65536){if(($Z-=3)<0)break;pQ.push(LZ>>12|224,LZ>>6&63|128,LZ&63|128)}else if(LZ<1114112){if(($Z-=4)<0)break;pQ.push(LZ>>18|240,LZ>>12&63|128,LZ>>6&63|128,LZ&63|128)}else throw new Error("Invalid code point")}return pQ}function wee(AQ){const $Z=[];for(let LZ=0;LZ<AQ.length;++LZ)$Z.push(AQ.charCodeAt(LZ)&255);return $Z}function Tee(AQ,$Z){let LZ,NQ,bQ;const pQ=[];for(let cQ=0;cQ<AQ.length&&!(($Z-=2)<0);++cQ)LZ=AQ.charCodeAt(cQ),NQ=LZ>>8,bQ=LZ%256,pQ.push(bQ),pQ.push(NQ);return pQ}function Iee(AQ){return ha.toByteArray(uee(AQ))}function vee(AQ,$Z,LZ,NQ){let bQ;for(bQ=0;bQ<NQ&&!(bQ+LZ>=$Z.length||bQ>=AQ.length);++bQ)$Z[bQ+LZ]=AQ[bQ];return bQ}function YQ(AQ,$Z){return AQ instanceof $Z||AQ!=null&&AQ.constructor!=null&&AQ.constructor.name!=null&&AQ.constructor.name===$Z.name}function mee(AQ){return AQ!==AQ}const See=(function(){const AQ="0123456789abcdef",$Z=new Array(256);for(let LZ=0;LZ<16;++LZ){const NQ=LZ*16;for(let bQ=0;bQ<16;++bQ)$Z[NQ+bQ]=AQ[LZ]+AQ[bQ]}return $Z})();function Ree(AQ){return typeof BigInt>"u"?jee:AQ}function jee(){throw new Error("BigInt not supported")}})(buffer)),buffer}var safeBuffer={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var hasRequiredSafeBuffer;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,(function(pa,ha){var ma=requireBuffer(),ja=ma.Buffer;function La(hl,Gl){for(var zl in hl)Gl[zl]=hl[zl]}ja.from&&ja.alloc&&ja.allocUnsafe&&ja.allocUnsafeSlow?pa.exports=ma:(La(ma,ha),ha.Buffer=Ba);function Ba(hl,Gl,zl){return ja(hl,Gl,zl)}Ba.prototype=Object.create(ja.prototype),La(ja,Ba),Ba.from=function(hl,Gl,zl){if(typeof hl=="number")throw new TypeError("Argument must not be a number");return ja(hl,Gl,zl)},Ba.alloc=function(hl,Gl,zl){if(typeof hl!="number")throw new TypeError("Argument must be a number");var Wl=ja(hl);return Gl!==void 0?typeof zl=="string"?Wl.fill(Gl,zl):Wl.fill(Gl):Wl.fill(0),Wl},Ba.allocUnsafe=function(hl){if(typeof hl!="number")throw new TypeError("Argument must be a number");return ja(hl)},Ba.allocUnsafeSlow=function(hl){if(typeof hl!="number")throw new TypeError("Argument must be a number");return ma.SlowBuffer(hl)}})(safeBuffer,safeBuffer.exports)),safeBuffer.exports}let DailyRotateFile$1,winston$1;isNodeEnv$1&&(await __vitePreload(()=>import("./index-BfWs6B7Z.js").then(pa=>pa.i),__vite__mapDeps([0,1,2,3,4,5])).then(pa=>{DailyRotateFile$1=pa.default}),await __vitePreload(()=>import("./winston-DgHuUfbR.js").then(pa=>pa.w),__vite__mapDeps([6,1,2,3,4,5])).then(pa=>{winston$1=pa.default}));let logger$3;if(isNodeEnv$1){const pa=new DailyRotateFile$1({level:"debug",filename:"logs/app-%DATE%.log",datePattern:"YYYY-MM-DD",maxSize:"20m",maxFiles:"7d"});logger$3=winston$1.createLogger({format:winston$1.format.combine(winston$1.format.timestamp(),winston$1.format.printf(({timestamp:ha,level:ma,message:ja})=>`[${ha}] ${ma}: ${ja}`)),transports:[pa]})}else{let pa=function(ha){return ma=>{console.log(`${ha}: ${ma}`)}};logger$3={debug:pa("DEBUG"),info:pa("INFO"),warn:pa("WARN"),error:pa("ERROR")}}const PlannerInstructions$1=`Agentlang is a very-high-level declarative language that makes it easy to define business applications as 'models'.
|
|
7346
|
+
*/var hasRequiredBuffer;function requireBuffer(){return hasRequiredBuffer||(hasRequiredBuffer=1,(function(pa){const ha=requireBase64Js(),ma=requireIeee754(),ja=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pa.Buffer=Gl,pa.SlowBuffer=ly,pa.INSPECT_MAX_BYTES=50;const La=2147483647;pa.kMaxLength=La,Gl.TYPED_ARRAY_SUPPORT=Ba(),!Gl.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ba(){try{const AQ=new Uint8Array(1),$Z={foo:function(){return 42}};return Object.setPrototypeOf($Z,Uint8Array.prototype),Object.setPrototypeOf(AQ,$Z),AQ.foo()===42}catch{return!1}}Object.defineProperty(Gl.prototype,"parent",{enumerable:!0,get:function(){if(Gl.isBuffer(this))return this.buffer}}),Object.defineProperty(Gl.prototype,"offset",{enumerable:!0,get:function(){if(Gl.isBuffer(this))return this.byteOffset}});function hl(AQ){if(AQ>La)throw new RangeError('The value "'+AQ+'" is invalid for option "size"');const $Z=new Uint8Array(AQ);return Object.setPrototypeOf($Z,Gl.prototype),$Z}function Gl(AQ,$Z,LZ){if(typeof AQ=="number"){if(typeof $Z=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return su(AQ)}return zl(AQ,$Z,LZ)}Gl.poolSize=8192;function zl(AQ,$Z,LZ){if(typeof AQ=="string")return au(AQ,$Z);if(ArrayBuffer.isView(AQ))return $m(AQ);if(AQ==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof AQ);if(YQ(AQ,ArrayBuffer)||AQ&&YQ(AQ.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(YQ(AQ,SharedArrayBuffer)||AQ&&YQ(AQ.buffer,SharedArrayBuffer)))return Nm(AQ,$Z,LZ);if(typeof AQ=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const NQ=AQ.valueOf&&AQ.valueOf();if(NQ!=null&&NQ!==AQ)return Gl.from(NQ,$Z,LZ);const bQ=Mm(AQ);if(bQ)return bQ;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof AQ[Symbol.toPrimitive]=="function")return Gl.from(AQ[Symbol.toPrimitive]("string"),$Z,LZ);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof AQ)}Gl.from=function(AQ,$Z,LZ){return zl(AQ,$Z,LZ)},Object.setPrototypeOf(Gl.prototype,Uint8Array.prototype),Object.setPrototypeOf(Gl,Uint8Array);function Wl(AQ){if(typeof AQ!="number")throw new TypeError('"size" argument must be of type number');if(AQ<0)throw new RangeError('The value "'+AQ+'" is invalid for option "size"')}function Kl(AQ,$Z,LZ){return Wl(AQ),AQ<=0?hl(AQ):$Z!==void 0?typeof LZ=="string"?hl(AQ).fill($Z,LZ):hl(AQ).fill($Z):hl(AQ)}Gl.alloc=function(AQ,$Z,LZ){return Kl(AQ,$Z,LZ)};function su(AQ){return Wl(AQ),hl(AQ<0?0:Mg(AQ)|0)}Gl.allocUnsafe=function(AQ){return su(AQ)},Gl.allocUnsafeSlow=function(AQ){return su(AQ)};function au(AQ,$Z){if((typeof $Z!="string"||$Z==="")&&($Z="utf8"),!Gl.isEncoding($Z))throw new TypeError("Unknown encoding: "+$Z);const LZ=uy(AQ,$Z)|0;let NQ=hl(LZ);const bQ=NQ.write(AQ,$Z);return bQ!==LZ&&(NQ=NQ.slice(0,bQ)),NQ}function ou(AQ){const $Z=AQ.length<0?0:Mg(AQ.length)|0,LZ=hl($Z);for(let NQ=0;NQ<$Z;NQ+=1)LZ[NQ]=AQ[NQ]&255;return LZ}function $m(AQ){if(YQ(AQ,Uint8Array)){const $Z=new Uint8Array(AQ);return Nm($Z.buffer,$Z.byteOffset,$Z.byteLength)}return ou(AQ)}function Nm(AQ,$Z,LZ){if($Z<0||AQ.byteLength<$Z)throw new RangeError('"offset" is outside of buffer bounds');if(AQ.byteLength<$Z+(LZ||0))throw new RangeError('"length" is outside of buffer bounds');let NQ;return $Z===void 0&&LZ===void 0?NQ=new Uint8Array(AQ):LZ===void 0?NQ=new Uint8Array(AQ,$Z):NQ=new Uint8Array(AQ,$Z,LZ),Object.setPrototypeOf(NQ,Gl.prototype),NQ}function Mm(AQ){if(Gl.isBuffer(AQ)){const $Z=Mg(AQ.length)|0,LZ=hl($Z);return LZ.length===0||AQ.copy(LZ,0,0,$Z),LZ}if(AQ.length!==void 0)return typeof AQ.length!="number"||mee(AQ.length)?hl(0):ou(AQ);if(AQ.type==="Buffer"&&Array.isArray(AQ.data))return ou(AQ.data)}function Mg(AQ){if(AQ>=La)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+La.toString(16)+" bytes");return AQ|0}function ly(AQ){return+AQ!=AQ&&(AQ=0),Gl.alloc(+AQ)}Gl.isBuffer=function($Z){return $Z!=null&&$Z._isBuffer===!0&&$Z!==Gl.prototype},Gl.compare=function($Z,LZ){if(YQ($Z,Uint8Array)&&($Z=Gl.from($Z,$Z.offset,$Z.byteLength)),YQ(LZ,Uint8Array)&&(LZ=Gl.from(LZ,LZ.offset,LZ.byteLength)),!Gl.isBuffer($Z)||!Gl.isBuffer(LZ))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($Z===LZ)return 0;let NQ=$Z.length,bQ=LZ.length;for(let pQ=0,cQ=Math.min(NQ,bQ);pQ<cQ;++pQ)if($Z[pQ]!==LZ[pQ]){NQ=$Z[pQ],bQ=LZ[pQ];break}return NQ<bQ?-1:bQ<NQ?1:0},Gl.isEncoding=function($Z){switch(String($Z).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Gl.concat=function($Z,LZ){if(!Array.isArray($Z))throw new TypeError('"list" argument must be an Array of Buffers');if($Z.length===0)return Gl.alloc(0);let NQ;if(LZ===void 0)for(LZ=0,NQ=0;NQ<$Z.length;++NQ)LZ+=$Z[NQ].length;const bQ=Gl.allocUnsafe(LZ);let pQ=0;for(NQ=0;NQ<$Z.length;++NQ){let cQ=$Z[NQ];if(YQ(cQ,Uint8Array))pQ+cQ.length>bQ.length?(Gl.isBuffer(cQ)||(cQ=Gl.from(cQ)),cQ.copy(bQ,pQ)):Uint8Array.prototype.set.call(bQ,cQ,pQ);else if(Gl.isBuffer(cQ))cQ.copy(bQ,pQ);else throw new TypeError('"list" argument must be an Array of Buffers');pQ+=cQ.length}return bQ};function uy(AQ,$Z){if(Gl.isBuffer(AQ))return AQ.length;if(ArrayBuffer.isView(AQ)||YQ(AQ,ArrayBuffer))return AQ.byteLength;if(typeof AQ!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof AQ);const LZ=AQ.length,NQ=arguments.length>2&&arguments[2]===!0;if(!NQ&&LZ===0)return 0;let bQ=!1;for(;;)switch($Z){case"ascii":case"latin1":case"binary":return LZ;case"utf8":case"utf-8":return VQ(AQ).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return LZ*2;case"hex":return LZ>>>1;case"base64":return Iee(AQ).length;default:if(bQ)return NQ?-1:VQ(AQ).length;$Z=(""+$Z).toLowerCase(),bQ=!0}}Gl.byteLength=uy;function GE(AQ,$Z,LZ){let NQ=!1;if(($Z===void 0||$Z<0)&&($Z=0),$Z>this.length||((LZ===void 0||LZ>this.length)&&(LZ=this.length),LZ<=0)||(LZ>>>=0,$Z>>>=0,LZ<=$Z))return"";for(AQ||(AQ="utf8");;)switch(AQ){case"hex":return vN(this,$Z,LZ);case"utf8":case"utf-8":return uN(this,$Z,LZ);case"ascii":return bN(this,$Z,LZ);case"latin1":case"binary":return xN(this,$Z,LZ);case"base64":return dN(this,$Z,LZ);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wN(this,$Z,LZ);default:if(NQ)throw new TypeError("Unknown encoding: "+AQ);AQ=(AQ+"").toLowerCase(),NQ=!0}}Gl.prototype._isBuffer=!0;function YE(AQ,$Z,LZ){const NQ=AQ[$Z];AQ[$Z]=AQ[LZ],AQ[LZ]=NQ}Gl.prototype.swap16=function(){const $Z=this.length;if($Z%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let LZ=0;LZ<$Z;LZ+=2)YE(this,LZ,LZ+1);return this},Gl.prototype.swap32=function(){const $Z=this.length;if($Z%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let LZ=0;LZ<$Z;LZ+=4)YE(this,LZ,LZ+3),YE(this,LZ+1,LZ+2);return this},Gl.prototype.swap64=function(){const $Z=this.length;if($Z%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let LZ=0;LZ<$Z;LZ+=8)YE(this,LZ,LZ+7),YE(this,LZ+1,LZ+6),YE(this,LZ+2,LZ+5),YE(this,LZ+3,LZ+4);return this},Gl.prototype.toString=function(){const $Z=this.length;return $Z===0?"":arguments.length===0?uN(this,0,$Z):GE.apply(this,arguments)},Gl.prototype.toLocaleString=Gl.prototype.toString,Gl.prototype.equals=function($Z){if(!Gl.isBuffer($Z))throw new TypeError("Argument must be a Buffer");return this===$Z?!0:Gl.compare(this,$Z)===0},Gl.prototype.inspect=function(){let $Z="";const LZ=pa.INSPECT_MAX_BYTES;return $Z=this.toString("hex",0,LZ).replace(/(.{2})/g,"$1 ").trim(),this.length>LZ&&($Z+=" ... "),"<Buffer "+$Z+">"},ja&&(Gl.prototype[ja]=Gl.prototype.inspect),Gl.prototype.compare=function($Z,LZ,NQ,bQ,pQ){if(YQ($Z,Uint8Array)&&($Z=Gl.from($Z,$Z.offset,$Z.byteLength)),!Gl.isBuffer($Z))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $Z);if(LZ===void 0&&(LZ=0),NQ===void 0&&(NQ=$Z?$Z.length:0),bQ===void 0&&(bQ=0),pQ===void 0&&(pQ=this.length),LZ<0||NQ>$Z.length||bQ<0||pQ>this.length)throw new RangeError("out of range index");if(bQ>=pQ&&LZ>=NQ)return 0;if(bQ>=pQ)return-1;if(LZ>=NQ)return 1;if(LZ>>>=0,NQ>>>=0,bQ>>>=0,pQ>>>=0,this===$Z)return 0;let cQ=pQ-bQ,SQ=NQ-LZ;const CQ=Math.min(cQ,SQ),BQ=this.slice(bQ,pQ),_Q=$Z.slice(LZ,NQ);for(let QY=0;QY<CQ;++QY)if(BQ[QY]!==_Q[QY]){cQ=BQ[QY],SQ=_Q[QY];break}return cQ<SQ?-1:SQ<cQ?1:0};function JE(AQ,$Z,LZ,NQ,bQ){if(AQ.length===0)return-1;if(typeof LZ=="string"?(NQ=LZ,LZ=0):LZ>2147483647?LZ=2147483647:LZ<-2147483648&&(LZ=-2147483648),LZ=+LZ,mee(LZ)&&(LZ=bQ?0:AQ.length-1),LZ<0&&(LZ=AQ.length+LZ),LZ>=AQ.length){if(bQ)return-1;LZ=AQ.length-1}else if(LZ<0)if(bQ)LZ=0;else return-1;if(typeof $Z=="string"&&($Z=Gl.from($Z,NQ)),Gl.isBuffer($Z))return $Z.length===0?-1:XE(AQ,$Z,LZ,NQ,bQ);if(typeof $Z=="number")return $Z=$Z&255,typeof Uint8Array.prototype.indexOf=="function"?bQ?Uint8Array.prototype.indexOf.call(AQ,$Z,LZ):Uint8Array.prototype.lastIndexOf.call(AQ,$Z,LZ):XE(AQ,[$Z],LZ,NQ,bQ);throw new TypeError("val must be string, number or Buffer")}function XE(AQ,$Z,LZ,NQ,bQ){let pQ=1,cQ=AQ.length,SQ=$Z.length;if(NQ!==void 0&&(NQ=String(NQ).toLowerCase(),NQ==="ucs2"||NQ==="ucs-2"||NQ==="utf16le"||NQ==="utf-16le")){if(AQ.length<2||$Z.length<2)return-1;pQ=2,cQ/=2,SQ/=2,LZ/=2}function CQ(_Q,QY){return pQ===1?_Q[QY]:_Q.readUInt16BE(QY*pQ)}let BQ;if(bQ){let _Q=-1;for(BQ=LZ;BQ<cQ;BQ++)if(CQ(AQ,BQ)===CQ($Z,_Q===-1?0:BQ-_Q)){if(_Q===-1&&(_Q=BQ),BQ-_Q+1===SQ)return _Q*pQ}else _Q!==-1&&(BQ-=BQ-_Q),_Q=-1}else for(LZ+SQ>cQ&&(LZ=cQ-SQ),BQ=LZ;BQ>=0;BQ--){let _Q=!0;for(let QY=0;QY<SQ;QY++)if(CQ(AQ,BQ+QY)!==CQ($Z,QY)){_Q=!1;break}if(_Q)return BQ}return-1}Gl.prototype.includes=function($Z,LZ,NQ){return this.indexOf($Z,LZ,NQ)!==-1},Gl.prototype.indexOf=function($Z,LZ,NQ){return JE(this,$Z,LZ,NQ,!0)},Gl.prototype.lastIndexOf=function($Z,LZ,NQ){return JE(this,$Z,LZ,NQ,!1)};function cN(AQ,$Z,LZ,NQ){LZ=Number(LZ)||0;const bQ=AQ.length-LZ;NQ?(NQ=Number(NQ),NQ>bQ&&(NQ=bQ)):NQ=bQ;const pQ=$Z.length;NQ>pQ/2&&(NQ=pQ/2);let cQ;for(cQ=0;cQ<NQ;++cQ){const SQ=parseInt($Z.substr(cQ*2,2),16);if(mee(SQ))return cQ;AQ[LZ+cQ]=SQ}return cQ}function pN(AQ,$Z,LZ,NQ){return vee(VQ($Z,AQ.length-LZ),AQ,LZ,NQ)}function hN(AQ,$Z,LZ,NQ){return vee(wee($Z),AQ,LZ,NQ)}function lN(AQ,$Z,LZ,NQ){return vee(Iee($Z),AQ,LZ,NQ)}function rA(AQ,$Z,LZ,NQ){return vee(Tee($Z,AQ.length-LZ),AQ,LZ,NQ)}Gl.prototype.write=function($Z,LZ,NQ,bQ){if(LZ===void 0)bQ="utf8",NQ=this.length,LZ=0;else if(NQ===void 0&&typeof LZ=="string")bQ=LZ,NQ=this.length,LZ=0;else if(isFinite(LZ))LZ=LZ>>>0,isFinite(NQ)?(NQ=NQ>>>0,bQ===void 0&&(bQ="utf8")):(bQ=NQ,NQ=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pQ=this.length-LZ;if((NQ===void 0||NQ>pQ)&&(NQ=pQ),$Z.length>0&&(NQ<0||LZ<0)||LZ>this.length)throw new RangeError("Attempt to write outside buffer bounds");bQ||(bQ="utf8");let cQ=!1;for(;;)switch(bQ){case"hex":return cN(this,$Z,LZ,NQ);case"utf8":case"utf-8":return pN(this,$Z,LZ,NQ);case"ascii":case"latin1":case"binary":return hN(this,$Z,LZ,NQ);case"base64":return lN(this,$Z,LZ,NQ);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rA(this,$Z,LZ,NQ);default:if(cQ)throw new TypeError("Unknown encoding: "+bQ);bQ=(""+bQ).toLowerCase(),cQ=!0}},Gl.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dN(AQ,$Z,LZ){return $Z===0&&LZ===AQ.length?ha.fromByteArray(AQ):ha.fromByteArray(AQ.slice($Z,LZ))}function uN(AQ,$Z,LZ){LZ=Math.min(AQ.length,LZ);const NQ=[];let bQ=$Z;for(;bQ<LZ;){const pQ=AQ[bQ];let cQ=null,SQ=pQ>239?4:pQ>223?3:pQ>191?2:1;if(bQ+SQ<=LZ){let CQ,BQ,_Q,QY;switch(SQ){case 1:pQ<128&&(cQ=pQ);break;case 2:CQ=AQ[bQ+1],(CQ&192)===128&&(QY=(pQ&31)<<6|CQ&63,QY>127&&(cQ=QY));break;case 3:CQ=AQ[bQ+1],BQ=AQ[bQ+2],(CQ&192)===128&&(BQ&192)===128&&(QY=(pQ&15)<<12|(CQ&63)<<6|BQ&63,QY>2047&&(QY<55296||QY>57343)&&(cQ=QY));break;case 4:CQ=AQ[bQ+1],BQ=AQ[bQ+2],_Q=AQ[bQ+3],(CQ&192)===128&&(BQ&192)===128&&(_Q&192)===128&&(QY=(pQ&15)<<18|(CQ&63)<<12|(BQ&63)<<6|_Q&63,QY>65535&&QY<1114112&&(cQ=QY))}}cQ===null?(cQ=65533,SQ=1):cQ>65535&&(cQ-=65536,NQ.push(cQ>>>10&1023|55296),cQ=56320|cQ&1023),NQ.push(cQ),bQ+=SQ}return mN(NQ)}const gN=4096;function mN(AQ){const $Z=AQ.length;if($Z<=gN)return String.fromCharCode.apply(String,AQ);let LZ="",NQ=0;for(;NQ<$Z;)LZ+=String.fromCharCode.apply(String,AQ.slice(NQ,NQ+=gN));return LZ}function bN(AQ,$Z,LZ){let NQ="";LZ=Math.min(AQ.length,LZ);for(let bQ=$Z;bQ<LZ;++bQ)NQ+=String.fromCharCode(AQ[bQ]&127);return NQ}function xN(AQ,$Z,LZ){let NQ="";LZ=Math.min(AQ.length,LZ);for(let bQ=$Z;bQ<LZ;++bQ)NQ+=String.fromCharCode(AQ[bQ]);return NQ}function vN(AQ,$Z,LZ){const NQ=AQ.length;(!$Z||$Z<0)&&($Z=0),(!LZ||LZ<0||LZ>NQ)&&(LZ=NQ);let bQ="";for(let pQ=$Z;pQ<LZ;++pQ)bQ+=See[AQ[pQ]];return bQ}function wN(AQ,$Z,LZ){const NQ=AQ.slice($Z,LZ);let bQ="";for(let pQ=0;pQ<NQ.length-1;pQ+=2)bQ+=String.fromCharCode(NQ[pQ]+NQ[pQ+1]*256);return bQ}Gl.prototype.slice=function($Z,LZ){const NQ=this.length;$Z=~~$Z,LZ=LZ===void 0?NQ:~~LZ,$Z<0?($Z+=NQ,$Z<0&&($Z=0)):$Z>NQ&&($Z=NQ),LZ<0?(LZ+=NQ,LZ<0&&(LZ=0)):LZ>NQ&&(LZ=NQ),LZ<$Z&&(LZ=$Z);const bQ=this.subarray($Z,LZ);return Object.setPrototypeOf(bQ,Gl.prototype),bQ};function FZ(AQ,$Z,LZ){if(AQ%1!==0||AQ<0)throw new RangeError("offset is not uint");if(AQ+$Z>LZ)throw new RangeError("Trying to access beyond buffer length")}Gl.prototype.readUintLE=Gl.prototype.readUIntLE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z],pQ=1,cQ=0;for(;++cQ<LZ&&(pQ*=256);)bQ+=this[$Z+cQ]*pQ;return bQ},Gl.prototype.readUintBE=Gl.prototype.readUIntBE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z+--LZ],pQ=1;for(;LZ>0&&(pQ*=256);)bQ+=this[$Z+--LZ]*pQ;return bQ},Gl.prototype.readUint8=Gl.prototype.readUInt8=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,1,this.length),this[$Z]},Gl.prototype.readUint16LE=Gl.prototype.readUInt16LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,2,this.length),this[$Z]|this[$Z+1]<<8},Gl.prototype.readUint16BE=Gl.prototype.readUInt16BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,2,this.length),this[$Z]<<8|this[$Z+1]},Gl.prototype.readUint32LE=Gl.prototype.readUInt32LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),(this[$Z]|this[$Z+1]<<8|this[$Z+2]<<16)+this[$Z+3]*16777216},Gl.prototype.readUint32BE=Gl.prototype.readUInt32BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]*16777216+(this[$Z+1]<<16|this[$Z+2]<<8|this[$Z+3])},Gl.prototype.readBigUInt64LE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=LZ+this[++$Z]*2**8+this[++$Z]*2**16+this[++$Z]*2**24,pQ=this[++$Z]+this[++$Z]*2**8+this[++$Z]*2**16+NQ*2**24;return BigInt(bQ)+(BigInt(pQ)<<BigInt(32))}),Gl.prototype.readBigUInt64BE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=LZ*2**24+this[++$Z]*2**16+this[++$Z]*2**8+this[++$Z],pQ=this[++$Z]*2**24+this[++$Z]*2**16+this[++$Z]*2**8+NQ;return(BigInt(bQ)<<BigInt(32))+BigInt(pQ)}),Gl.prototype.readIntLE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=this[$Z],pQ=1,cQ=0;for(;++cQ<LZ&&(pQ*=256);)bQ+=this[$Z+cQ]*pQ;return pQ*=128,bQ>=pQ&&(bQ-=Math.pow(2,8*LZ)),bQ},Gl.prototype.readIntBE=function($Z,LZ,NQ){$Z=$Z>>>0,LZ=LZ>>>0,NQ||FZ($Z,LZ,this.length);let bQ=LZ,pQ=1,cQ=this[$Z+--bQ];for(;bQ>0&&(pQ*=256);)cQ+=this[$Z+--bQ]*pQ;return pQ*=128,cQ>=pQ&&(cQ-=Math.pow(2,8*LZ)),cQ},Gl.prototype.readInt8=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,1,this.length),this[$Z]&128?(255-this[$Z]+1)*-1:this[$Z]},Gl.prototype.readInt16LE=function($Z,LZ){$Z=$Z>>>0,LZ||FZ($Z,2,this.length);const NQ=this[$Z]|this[$Z+1]<<8;return NQ&32768?NQ|4294901760:NQ},Gl.prototype.readInt16BE=function($Z,LZ){$Z=$Z>>>0,LZ||FZ($Z,2,this.length);const NQ=this[$Z+1]|this[$Z]<<8;return NQ&32768?NQ|4294901760:NQ},Gl.prototype.readInt32LE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]|this[$Z+1]<<8|this[$Z+2]<<16|this[$Z+3]<<24},Gl.prototype.readInt32BE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),this[$Z]<<24|this[$Z+1]<<16|this[$Z+2]<<8|this[$Z+3]},Gl.prototype.readBigInt64LE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=this[$Z+4]+this[$Z+5]*2**8+this[$Z+6]*2**16+(NQ<<24);return(BigInt(bQ)<<BigInt(32))+BigInt(LZ+this[++$Z]*2**8+this[++$Z]*2**16+this[++$Z]*2**24)}),Gl.prototype.readBigInt64BE=Ree(function($Z){$Z=$Z>>>0,FQ($Z,"offset");const LZ=this[$Z],NQ=this[$Z+7];(LZ===void 0||NQ===void 0)&&jQ($Z,this.length-8);const bQ=(LZ<<24)+this[++$Z]*2**16+this[++$Z]*2**8+this[++$Z];return(BigInt(bQ)<<BigInt(32))+BigInt(this[++$Z]*2**24+this[++$Z]*2**16+this[++$Z]*2**8+NQ)}),Gl.prototype.readFloatLE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),ma.read(this,$Z,!0,23,4)},Gl.prototype.readFloatBE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,4,this.length),ma.read(this,$Z,!1,23,4)},Gl.prototype.readDoubleLE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,8,this.length),ma.read(this,$Z,!0,52,8)},Gl.prototype.readDoubleBE=function($Z,LZ){return $Z=$Z>>>0,LZ||FZ($Z,8,this.length),ma.read(this,$Z,!1,52,8)};function IZ(AQ,$Z,LZ,NQ,bQ,pQ){if(!Gl.isBuffer(AQ))throw new TypeError('"buffer" argument must be a Buffer instance');if($Z>bQ||$Z<pQ)throw new RangeError('"value" argument is out of bounds');if(LZ+NQ>AQ.length)throw new RangeError("Index out of range")}Gl.prototype.writeUintLE=Gl.prototype.writeUIntLE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,NQ=NQ>>>0,!bQ){const SQ=Math.pow(2,8*NQ)-1;IZ(this,$Z,LZ,NQ,SQ,0)}let pQ=1,cQ=0;for(this[LZ]=$Z&255;++cQ<NQ&&(pQ*=256);)this[LZ+cQ]=$Z/pQ&255;return LZ+NQ},Gl.prototype.writeUintBE=Gl.prototype.writeUIntBE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,NQ=NQ>>>0,!bQ){const SQ=Math.pow(2,8*NQ)-1;IZ(this,$Z,LZ,NQ,SQ,0)}let pQ=NQ-1,cQ=1;for(this[LZ+pQ]=$Z&255;--pQ>=0&&(cQ*=256);)this[LZ+pQ]=$Z/cQ&255;return LZ+NQ},Gl.prototype.writeUint8=Gl.prototype.writeUInt8=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,1,255,0),this[LZ]=$Z&255,LZ+1},Gl.prototype.writeUint16LE=Gl.prototype.writeUInt16LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,65535,0),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,LZ+2},Gl.prototype.writeUint16BE=Gl.prototype.writeUInt16BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,65535,0),this[LZ]=$Z>>>8,this[LZ+1]=$Z&255,LZ+2},Gl.prototype.writeUint32LE=Gl.prototype.writeUInt32LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,4294967295,0),this[LZ+3]=$Z>>>24,this[LZ+2]=$Z>>>16,this[LZ+1]=$Z>>>8,this[LZ]=$Z&255,LZ+4},Gl.prototype.writeUint32BE=Gl.prototype.writeUInt32BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,4294967295,0),this[LZ]=$Z>>>24,this[LZ+1]=$Z>>>16,this[LZ+2]=$Z>>>8,this[LZ+3]=$Z&255,LZ+4};function lQ(AQ,$Z,LZ,NQ,bQ){RQ($Z,NQ,bQ,AQ,LZ,7);let pQ=Number($Z&BigInt(4294967295));AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ,pQ=pQ>>8,AQ[LZ++]=pQ;let cQ=Number($Z>>BigInt(32)&BigInt(4294967295));return AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,cQ=cQ>>8,AQ[LZ++]=cQ,LZ}function VZ(AQ,$Z,LZ,NQ,bQ){RQ($Z,NQ,bQ,AQ,LZ,7);let pQ=Number($Z&BigInt(4294967295));AQ[LZ+7]=pQ,pQ=pQ>>8,AQ[LZ+6]=pQ,pQ=pQ>>8,AQ[LZ+5]=pQ,pQ=pQ>>8,AQ[LZ+4]=pQ;let cQ=Number($Z>>BigInt(32)&BigInt(4294967295));return AQ[LZ+3]=cQ,cQ=cQ>>8,AQ[LZ+2]=cQ,cQ=cQ>>8,AQ[LZ+1]=cQ,cQ=cQ>>8,AQ[LZ]=cQ,LZ+8}Gl.prototype.writeBigUInt64LE=Ree(function($Z,LZ=0){return lQ(this,$Z,LZ,BigInt(0),BigInt("0xffffffffffffffff"))}),Gl.prototype.writeBigUInt64BE=Ree(function($Z,LZ=0){return VZ(this,$Z,LZ,BigInt(0),BigInt("0xffffffffffffffff"))}),Gl.prototype.writeIntLE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,!bQ){const CQ=Math.pow(2,8*NQ-1);IZ(this,$Z,LZ,NQ,CQ-1,-CQ)}let pQ=0,cQ=1,SQ=0;for(this[LZ]=$Z&255;++pQ<NQ&&(cQ*=256);)$Z<0&&SQ===0&&this[LZ+pQ-1]!==0&&(SQ=1),this[LZ+pQ]=($Z/cQ>>0)-SQ&255;return LZ+NQ},Gl.prototype.writeIntBE=function($Z,LZ,NQ,bQ){if($Z=+$Z,LZ=LZ>>>0,!bQ){const CQ=Math.pow(2,8*NQ-1);IZ(this,$Z,LZ,NQ,CQ-1,-CQ)}let pQ=NQ-1,cQ=1,SQ=0;for(this[LZ+pQ]=$Z&255;--pQ>=0&&(cQ*=256);)$Z<0&&SQ===0&&this[LZ+pQ+1]!==0&&(SQ=1),this[LZ+pQ]=($Z/cQ>>0)-SQ&255;return LZ+NQ},Gl.prototype.writeInt8=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,1,127,-128),$Z<0&&($Z=255+$Z+1),this[LZ]=$Z&255,LZ+1},Gl.prototype.writeInt16LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,32767,-32768),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,LZ+2},Gl.prototype.writeInt16BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,2,32767,-32768),this[LZ]=$Z>>>8,this[LZ+1]=$Z&255,LZ+2},Gl.prototype.writeInt32LE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,2147483647,-2147483648),this[LZ]=$Z&255,this[LZ+1]=$Z>>>8,this[LZ+2]=$Z>>>16,this[LZ+3]=$Z>>>24,LZ+4},Gl.prototype.writeInt32BE=function($Z,LZ,NQ){return $Z=+$Z,LZ=LZ>>>0,NQ||IZ(this,$Z,LZ,4,2147483647,-2147483648),$Z<0&&($Z=4294967295+$Z+1),this[LZ]=$Z>>>24,this[LZ+1]=$Z>>>16,this[LZ+2]=$Z>>>8,this[LZ+3]=$Z&255,LZ+4},Gl.prototype.writeBigInt64LE=Ree(function($Z,LZ=0){return lQ(this,$Z,LZ,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Gl.prototype.writeBigInt64BE=Ree(function($Z,LZ=0){return VZ(this,$Z,LZ,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $Q(AQ,$Z,LZ,NQ,bQ,pQ){if(LZ+NQ>AQ.length)throw new RangeError("Index out of range");if(LZ<0)throw new RangeError("Index out of range")}function gQ(AQ,$Z,LZ,NQ,bQ){return $Z=+$Z,LZ=LZ>>>0,bQ||$Q(AQ,$Z,LZ,4),ma.write(AQ,$Z,LZ,NQ,23,4),LZ+4}Gl.prototype.writeFloatLE=function($Z,LZ,NQ){return gQ(this,$Z,LZ,!0,NQ)},Gl.prototype.writeFloatBE=function($Z,LZ,NQ){return gQ(this,$Z,LZ,!1,NQ)};function PQ(AQ,$Z,LZ,NQ,bQ){return $Z=+$Z,LZ=LZ>>>0,bQ||$Q(AQ,$Z,LZ,8),ma.write(AQ,$Z,LZ,NQ,52,8),LZ+8}Gl.prototype.writeDoubleLE=function($Z,LZ,NQ){return PQ(this,$Z,LZ,!0,NQ)},Gl.prototype.writeDoubleBE=function($Z,LZ,NQ){return PQ(this,$Z,LZ,!1,NQ)},Gl.prototype.copy=function($Z,LZ,NQ,bQ){if(!Gl.isBuffer($Z))throw new TypeError("argument should be a Buffer");if(NQ||(NQ=0),!bQ&&bQ!==0&&(bQ=this.length),LZ>=$Z.length&&(LZ=$Z.length),LZ||(LZ=0),bQ>0&&bQ<NQ&&(bQ=NQ),bQ===NQ||$Z.length===0||this.length===0)return 0;if(LZ<0)throw new RangeError("targetStart out of bounds");if(NQ<0||NQ>=this.length)throw new RangeError("Index out of range");if(bQ<0)throw new RangeError("sourceEnd out of bounds");bQ>this.length&&(bQ=this.length),$Z.length-LZ<bQ-NQ&&(bQ=$Z.length-LZ+NQ);const pQ=bQ-NQ;return this===$Z&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(LZ,NQ,bQ):Uint8Array.prototype.set.call($Z,this.subarray(NQ,bQ),LZ),pQ},Gl.prototype.fill=function($Z,LZ,NQ,bQ){if(typeof $Z=="string"){if(typeof LZ=="string"?(bQ=LZ,LZ=0,NQ=this.length):typeof NQ=="string"&&(bQ=NQ,NQ=this.length),bQ!==void 0&&typeof bQ!="string")throw new TypeError("encoding must be a string");if(typeof bQ=="string"&&!Gl.isEncoding(bQ))throw new TypeError("Unknown encoding: "+bQ);if($Z.length===1){const cQ=$Z.charCodeAt(0);(bQ==="utf8"&&cQ<128||bQ==="latin1")&&($Z=cQ)}}else typeof $Z=="number"?$Z=$Z&255:typeof $Z=="boolean"&&($Z=Number($Z));if(LZ<0||this.length<LZ||this.length<NQ)throw new RangeError("Out of range index");if(NQ<=LZ)return this;LZ=LZ>>>0,NQ=NQ===void 0?this.length:NQ>>>0,$Z||($Z=0);let pQ;if(typeof $Z=="number")for(pQ=LZ;pQ<NQ;++pQ)this[pQ]=$Z;else{const cQ=Gl.isBuffer($Z)?$Z:Gl.from($Z,bQ),SQ=cQ.length;if(SQ===0)throw new TypeError('The value "'+$Z+'" is invalid for argument "value"');for(pQ=0;pQ<NQ-LZ;++pQ)this[pQ+LZ]=cQ[pQ%SQ]}return this};const MQ={};function GQ(AQ,$Z,LZ){MQ[AQ]=class extends LZ{constructor(){super(),Object.defineProperty(this,"message",{value:$Z.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${AQ}]`,this.stack,delete this.name}get code(){return AQ}set code(bQ){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:bQ,writable:!0})}toString(){return`${this.name} [${AQ}]: ${this.message}`}}}GQ("ERR_BUFFER_OUT_OF_BOUNDS",function(AQ){return AQ?`${AQ} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),GQ("ERR_INVALID_ARG_TYPE",function(AQ,$Z){return`The "${AQ}" argument must be of type number. Received type ${typeof $Z}`},TypeError),GQ("ERR_OUT_OF_RANGE",function(AQ,$Z,LZ){let NQ=`The value of "${AQ}" is out of range.`,bQ=LZ;return Number.isInteger(LZ)&&Math.abs(LZ)>2**32?bQ=LQ(String(LZ)):typeof LZ=="bigint"&&(bQ=String(LZ),(LZ>BigInt(2)**BigInt(32)||LZ<-(BigInt(2)**BigInt(32)))&&(bQ=LQ(bQ)),bQ+="n"),NQ+=` It must be ${$Z}. Received ${bQ}`,NQ},RangeError);function LQ(AQ){let $Z="",LZ=AQ.length;const NQ=AQ[0]==="-"?1:0;for(;LZ>=NQ+4;LZ-=3)$Z=`_${AQ.slice(LZ-3,LZ)}${$Z}`;return`${AQ.slice(0,LZ)}${$Z}`}function xQ(AQ,$Z,LZ){FQ($Z,"offset"),(AQ[$Z]===void 0||AQ[$Z+LZ]===void 0)&&jQ($Z,AQ.length-(LZ+1))}function RQ(AQ,$Z,LZ,NQ,bQ,pQ){if(AQ>LZ||AQ<$Z){const cQ=typeof $Z=="bigint"?"n":"";let SQ;throw $Z===0||$Z===BigInt(0)?SQ=`>= 0${cQ} and < 2${cQ} ** ${(pQ+1)*8}${cQ}`:SQ=`>= -(2${cQ} ** ${(pQ+1)*8-1}${cQ}) and < 2 ** ${(pQ+1)*8-1}${cQ}`,new MQ.ERR_OUT_OF_RANGE("value",SQ,AQ)}xQ(NQ,bQ,pQ)}function FQ(AQ,$Z){if(typeof AQ!="number")throw new MQ.ERR_INVALID_ARG_TYPE($Z,"number",AQ)}function jQ(AQ,$Z,LZ){throw Math.floor(AQ)!==AQ?(FQ(AQ,LZ),new MQ.ERR_OUT_OF_RANGE("offset","an integer",AQ)):$Z<0?new MQ.ERR_BUFFER_OUT_OF_BOUNDS:new MQ.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${$Z}`,AQ)}const eee=/[^+/0-9A-Za-z-_]/g;function uee(AQ){if(AQ=AQ.split("=")[0],AQ=AQ.trim().replace(eee,""),AQ.length<2)return"";for(;AQ.length%4!==0;)AQ=AQ+"=";return AQ}function VQ(AQ,$Z){$Z=$Z||1/0;let LZ;const NQ=AQ.length;let bQ=null;const pQ=[];for(let cQ=0;cQ<NQ;++cQ){if(LZ=AQ.charCodeAt(cQ),LZ>55295&&LZ<57344){if(!bQ){if(LZ>56319){($Z-=3)>-1&&pQ.push(239,191,189);continue}else if(cQ+1===NQ){($Z-=3)>-1&&pQ.push(239,191,189);continue}bQ=LZ;continue}if(LZ<56320){($Z-=3)>-1&&pQ.push(239,191,189),bQ=LZ;continue}LZ=(bQ-55296<<10|LZ-56320)+65536}else bQ&&($Z-=3)>-1&&pQ.push(239,191,189);if(bQ=null,LZ<128){if(($Z-=1)<0)break;pQ.push(LZ)}else if(LZ<2048){if(($Z-=2)<0)break;pQ.push(LZ>>6|192,LZ&63|128)}else if(LZ<65536){if(($Z-=3)<0)break;pQ.push(LZ>>12|224,LZ>>6&63|128,LZ&63|128)}else if(LZ<1114112){if(($Z-=4)<0)break;pQ.push(LZ>>18|240,LZ>>12&63|128,LZ>>6&63|128,LZ&63|128)}else throw new Error("Invalid code point")}return pQ}function wee(AQ){const $Z=[];for(let LZ=0;LZ<AQ.length;++LZ)$Z.push(AQ.charCodeAt(LZ)&255);return $Z}function Tee(AQ,$Z){let LZ,NQ,bQ;const pQ=[];for(let cQ=0;cQ<AQ.length&&!(($Z-=2)<0);++cQ)LZ=AQ.charCodeAt(cQ),NQ=LZ>>8,bQ=LZ%256,pQ.push(bQ),pQ.push(NQ);return pQ}function Iee(AQ){return ha.toByteArray(uee(AQ))}function vee(AQ,$Z,LZ,NQ){let bQ;for(bQ=0;bQ<NQ&&!(bQ+LZ>=$Z.length||bQ>=AQ.length);++bQ)$Z[bQ+LZ]=AQ[bQ];return bQ}function YQ(AQ,$Z){return AQ instanceof $Z||AQ!=null&&AQ.constructor!=null&&AQ.constructor.name!=null&&AQ.constructor.name===$Z.name}function mee(AQ){return AQ!==AQ}const See=(function(){const AQ="0123456789abcdef",$Z=new Array(256);for(let LZ=0;LZ<16;++LZ){const NQ=LZ*16;for(let bQ=0;bQ<16;++bQ)$Z[NQ+bQ]=AQ[LZ]+AQ[bQ]}return $Z})();function Ree(AQ){return typeof BigInt>"u"?jee:AQ}function jee(){throw new Error("BigInt not supported")}})(buffer)),buffer}var safeBuffer={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var hasRequiredSafeBuffer;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,(function(pa,ha){var ma=requireBuffer(),ja=ma.Buffer;function La(hl,Gl){for(var zl in hl)Gl[zl]=hl[zl]}ja.from&&ja.alloc&&ja.allocUnsafe&&ja.allocUnsafeSlow?pa.exports=ma:(La(ma,ha),ha.Buffer=Ba);function Ba(hl,Gl,zl){return ja(hl,Gl,zl)}Ba.prototype=Object.create(ja.prototype),La(ja,Ba),Ba.from=function(hl,Gl,zl){if(typeof hl=="number")throw new TypeError("Argument must not be a number");return ja(hl,Gl,zl)},Ba.alloc=function(hl,Gl,zl){if(typeof hl!="number")throw new TypeError("Argument must be a number");var Wl=ja(hl);return Gl!==void 0?typeof zl=="string"?Wl.fill(Gl,zl):Wl.fill(Gl):Wl.fill(0),Wl},Ba.allocUnsafe=function(hl){if(typeof hl!="number")throw new TypeError("Argument must be a number");return ja(hl)},Ba.allocUnsafeSlow=function(hl){if(typeof hl!="number")throw new TypeError("Argument must be a number");return ma.SlowBuffer(hl)}})(safeBuffer,safeBuffer.exports)),safeBuffer.exports}let DailyRotateFile$1,winston$1;isNodeEnv$1&&(await __vitePreload(()=>import("./index-D8iBh7cU.js").then(pa=>pa.i),__vite__mapDeps([0,1,2,3,4,5])).then(pa=>{DailyRotateFile$1=pa.default}),await __vitePreload(()=>import("./winston-utZxLNzu.js").then(pa=>pa.w),__vite__mapDeps([6,1,2,3,4,5])).then(pa=>{winston$1=pa.default}));let logger$3;if(isNodeEnv$1){const pa=new DailyRotateFile$1({level:"debug",filename:"logs/app-%DATE%.log",datePattern:"YYYY-MM-DD",maxSize:"20m",maxFiles:"7d"});logger$3=winston$1.createLogger({format:winston$1.format.combine(winston$1.format.timestamp(),winston$1.format.printf(({timestamp:ha,level:ma,message:ja})=>`[${ha}] ${ma}: ${ja}`)),transports:[pa]})}else{let pa=function(ha){return ma=>{console.log(`${ha}: ${ma}`)}};logger$3={debug:pa("DEBUG"),info:pa("INFO"),warn:pa("WARN"),error:pa("ERROR")}}const PlannerInstructions$1=`Agentlang is a very-high-level declarative language that makes it easy to define business applications as 'models'.
|
|
7347
7347
|
The model of a business application consists of entity definitions and workflows defined in "modules".
|
|
7348
7348
|
A module is be encoded in a syntax inspired by JavaScript and JSON. Example of a simple module follows:
|
|
7349
7349
|
|
|
@@ -14872,7 +14872,7 @@ workflow TempEvent { ${pa} }`);if(isWorkflowDefinition(ma.defs[0]))ha=ma.defs[0]
|
|
|
14872
14872
|
`));const ja=((ma=pa.diagnostics)!==null&&ma!==void 0?ma:[]).filter(hl=>hl.severity===1),La=new Set,Ba=new Set;if(ja.length>0){for(const hl of ja)if(!La.has(hl.range.start.line)&&!Ba.has(hl.range.start.character)){const Gl=pa.textDocument.getText(hl.range),zl=`(${hl.range.start.line+1}:${hl.range.start.character+1}) unexpected token(s) '${Gl}'`,Wl=ha[hl.range.start.line];Wl.indexOf(ErrorIndicator)>0?ha[hl.range.start.line]=`${Wl}, ${zl}`:ha[hl.range.start.line]=`${Wl} ${ErrorIndicator} ${zl}`,La.add(hl.range.start.line),Ba.add(hl.range.start.character)}return trimErrorLines(ha)}else return}function trimErrorLines(pa){let ha=0;for(let ja=0;ja<pa.length;++ja)if(pa[ja].indexOf(ErrorIndicator)>0){ha=ja;break}let ma=ha;for(let ja=ha+1;ja<pa.length;++ja)if(pa[ja].indexOf(ErrorIndicator)>0){ma=ja;break}return ha>0&&--ha,ma!=pa.length&&++ma,pa.slice(ha,ma)}function trimErrorMessage(pa){if(pa.indexOf("Expecting:")>=0){const ha=pa.indexOf("but found:");if(ha>0)return`Expecting a valid token sequence, ${pa.substring(ha)}`}return pa}function maybeRaiseParserErrors(pa){const ha=pa.textDocument.getText().split(`
|
|
14873
14873
|
`);let ma=!1;const ja=new Set;pa.parseResult.lexerErrors.length>0&&(pa.parseResult.lexerErrors.forEach(Ba=>{if(!ja.has(Ba.line)){const hl=trimErrorMessage(Ba.message),Gl=`${ErrorIndicator} (${Ba.line}:${Ba.column}) ${hl}`;ha[Ba.line-1]=`${ha[Ba.line-1]} ${Gl}`,ja.add(Ba.line)}}),ma=!0),pa.parseResult.parserErrors.length>0&&(pa.parseResult.parserErrors.forEach(Ba=>{const hl=trimErrorMessage(Ba.message);if(Ba.token.startLine&&Ba.token.endLine){if(!ja.has(Ba.token.startLine)){const Gl=`${ErrorIndicator} (${Ba.token.startLine}:${Ba.token.startColumn}) ${hl}`;ha[Ba.token.endLine-1]=`${ha[Ba.token.endLine-1]} ${Gl}`,ha.join(`
|
|
14874
14874
|
`),ja.add(Ba.token.startLine)}}else ha.push(`ERROR: ${hl}`)}),ma=!0);const La=maybeGetValidationErrors(pa,ha);if(ma||La!==void 0)throw new Error(ha.join(`
|
|
14875
|
-
`))}async function introspect(pa){let ha=[];const ma=await parse$2$1(`module Temp workflow Test {${pa}}`);if(maybeRaiseParserErrors(ma),isWorkflowDefinition(ma.parseResult.value.defs[0]))ha=introspectHelper(ma.parseResult.value.defs[0].statements);else throw new Error("Failed to parse statements");return ha}function introspectHelper(pa){const ha=[];return pa.forEach(ma=>{ha.push(introspectStatement(ma))}),ha}function introspectStatement(pa){const ha=introspectPattern(pa.pattern),ma=firstAliasSpec(pa);ma&&(ma.alias?ha.setAlias(ma.alias):ma.aliases.length>0&&ha.setAliases(ma.aliases));const ja=firstCatchSpec(pa);return ja&&ja.handlers.forEach(La=>{ha.addHandler(La.except,introspectStatement(La.stmt))}),ha}function introspectPattern(pa){let ha;if(pa.crudMap?(isQueryPattern(pa)?ha=introspectQueryPattern(pa.crudMap):ha=introspectCreatePattern(pa.crudMap),pa.crudMap.into&&(ha=introspectInto(pa.crudMap.into,ha))):pa.expr?ha=introspectExpression(pa.expr):pa.forEach?ha=introspectForEach(pa.forEach):pa.if?ha=introspectIf(pa.if):pa.delete?ha=introspectDelete(pa.delete):pa.return?ha=introspectReturn(pa.return):pa.fullTextSearch&&(ha=introspectFullTextSearch(pa.fullTextSearch)),ha)return ha;throw new Error(`Failed to introspect pattern: ${pa}`)}function introspectInto(pa,ha){return pa.entries.forEach(ma=>{ha.addInto(ma.alias,ma.attribute)}),ha}function isQueryPattern(pa){if(pa.crudMap){const ha=pa.crudMap,ma=ha.name.endsWith(QuerySuffix);return!ma&&ha.body?ha.body.attributes.length>0&&ha.body.attributes.every(ja=>ja.name.endsWith(QuerySuffix)):ma}return!1}function introspectGroup(pa){return new GroupExpressionPattern(introspectExpression(pa.ge))}function introspectNegExpr(pa){return new NegExpressionPattern(introspectExpression(pa.ne))}function introspectNotExpr(pa){return new NotExpressionPattern(introspectExpression(pa.ne))}function introspectPrimExpr(pa){if(isLiteral(pa))return introspectLiteral(pa);if(isGroup(pa))return introspectGroup(pa);if(isNegExpr(pa))return introspectNegExpr(pa);if(isNotExpr(pa))return introspectNotExpr(pa);throw new Error(`Not a PrimExpr - ${pa}`)}function introspectExpression(pa){if(isPrimExpr(pa))return introspectPrimExpr(pa);if(pa.$cstNode)return new ExpressionPattern(pa.$cstNode.text);throw new Error("Failed to introspect expression - "+pa)}function introspectQueryPattern(pa){var ha;if(pa){const ma=new CrudPattern(pa.name);return(ha=pa.body)===null||ha===void 0||ha.attributes.forEach(ja=>{ma.addAttribute(ja.name,introspectExpression(ja.value),ja.op)}),pa.relationships.forEach(ja=>{ma.addRelationship(ja.name,introspectPattern(ja.pattern))}),ma.isCreate=!1,ma.isQueryUpdate=!1,ma.isQuery=!0,ma}throw new Error(`Failed to introspect query-pattern: ${pa}`)}function introspectCreatePattern(pa){var ha;if(pa){const ma=new CrudPattern(pa.name);ma.isCreate=!1,ma.isQuery=!1;let ja=!1;return(ha=pa.body)===null||ha===void 0||ha.attributes.forEach(La=>{!ja&&La.name.endsWith(QuerySuffix)&&(ja=!0),ma.addAttribute(La.name,introspectExpression(La.value),La.op)}),pa.relationships.forEach(La=>{ma.addRelationship(La.name,introspectPattern(La.pattern))}),ma.isQueryUpdate=ja,ja?(ma.isCreate=!1,ma.isQuery=!1):(ma.isCreate=!0,ma.isQuery=!1),ma}throw new Error(`Failed to introspect create-pattern: ${pa}`)}function asFnCallPattern(pa){return new FunctionCallPattern(pa.name,pa.args.map(ha=>isExpr(ha)?introspectExpression(ha):introspectLiteral(ha)))}function introspectLiteral(pa){if(pa.id)return LiteralPattern.Id(pa.id);if(pa.num)return LiteralPattern.Number(pa.num);if(pa.ref)return LiteralPattern.Reference(pa.ref);if(pa.str!==void 0)return LiteralPattern.String(pa.str);if(pa.bool)return LiteralPattern.Boolean(pa.bool=="true");if(pa.fnCall)return asFnCallPattern(pa.fnCall);if(pa.asyncFnCall)return asFnCallPattern(pa.asyncFnCall.fnCall).asAsync();if(pa.array)return LiteralPattern.Array(pa.array.vals.map(ha=>introspectStatement(ha)));if(pa.map)return introspectMapLiteral(pa.map);throw new Error(`Invalid literal - ${pa}`)}function introspectMapLiteral(pa){const ha=new Map;return pa.entries.forEach(ma=>{ha.set(ma.key,introspectExpression(ma.value))}),LiteralPattern.Map(ha)}function introspectForEach(pa){const ha=new ForEachPattern(pa.var,introspectPattern(pa.src));return pa.statements.forEach(ma=>{ha.addPattern(introspectStatement(ma))}),ha}function introspectIf(pa){const ha=new IfPattern(introspectExpression(pa.cond));return pa.statements.forEach(ma=>{ha.addPattern(introspectStatement(ma))}),pa.else&&ha.setElse(pa.else.statements.map(ma=>introspectStatement(ma))),ha}function introspectDelete(pa){return new DeletePattern(introspectPattern(pa.pattern))}function introspectReturn(pa){return new ReturnPattern(introspectPattern(pa.pattern))}function introspectFullTextSearch(pa){let ha;return pa.options&&(ha=introspectMapLiteral(pa.options)),new FullTextSearchPattern(pa.name,introspectLiteral(pa.query),ha)}var util$1$1;(function(pa){pa.assertEqual=La=>{};function ha(La){}pa.assertIs=ha;function ma(La){throw new Error}pa.assertNever=ma,pa.arrayToEnum=La=>{const Ba={};for(const hl of La)Ba[hl]=hl;return Ba},pa.getValidEnumValues=La=>{const Ba=pa.objectKeys(La).filter(Gl=>typeof La[La[Gl]]!="number"),hl={};for(const Gl of Ba)hl[Gl]=La[Gl];return pa.objectValues(hl)},pa.objectValues=La=>pa.objectKeys(La).map(function(Ba){return La[Ba]}),pa.objectKeys=typeof Object.keys=="function"?La=>Object.keys(La):La=>{const Ba=[];for(const hl in La)Object.prototype.hasOwnProperty.call(La,hl)&&Ba.push(hl);return Ba},pa.find=(La,Ba)=>{for(const hl of La)if(Ba(hl))return hl},pa.isInteger=typeof Number.isInteger=="function"?La=>Number.isInteger(La):La=>typeof La=="number"&&Number.isFinite(La)&&Math.floor(La)===La;function ja(La,Ba=" | "){return La.map(hl=>typeof hl=="string"?`'${hl}'`:hl).join(Ba)}pa.joinValues=ja,pa.jsonStringifyReplacer=(La,Ba)=>typeof Ba=="bigint"?Ba.toString():Ba})(util$1$1||(util$1$1={}));var objectUtil;(function(pa){pa.mergeShapes=(ha,ma)=>({...ha,...ma})})(objectUtil||(objectUtil={}));const ZodParsedType=util$1$1.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=pa=>{switch(typeof pa){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return Number.isNaN(pa)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(pa)?ZodParsedType.array:pa===null?ZodParsedType.null:pa.then&&typeof pa.then=="function"&&pa.catch&&typeof pa.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&pa instanceof Map?ZodParsedType.map:typeof Set<"u"&&pa instanceof Set?ZodParsedType.set:typeof Date<"u"&&pa instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$1$1.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{get errors(){return this.issues}constructor(ha){super(),this.issues=[],this.addIssue=ja=>{this.issues=[...this.issues,ja]},this.addIssues=(ja=[])=>{this.issues=[...this.issues,...ja]};const ma=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,ma):this.__proto__=ma,this.name="ZodError",this.issues=ha}format(ha){const ma=ha||function(Ba){return Ba.message},ja={_errors:[]},La=Ba=>{for(const hl of Ba.issues)if(hl.code==="invalid_union")hl.unionErrors.map(La);else if(hl.code==="invalid_return_type")La(hl.returnTypeError);else if(hl.code==="invalid_arguments")La(hl.argumentsError);else if(hl.path.length===0)ja._errors.push(ma(hl));else{let Gl=ja,zl=0;for(;zl<hl.path.length;){const Wl=hl.path[zl];zl===hl.path.length-1?(Gl[Wl]=Gl[Wl]||{_errors:[]},Gl[Wl]._errors.push(ma(hl))):Gl[Wl]=Gl[Wl]||{_errors:[]},Gl=Gl[Wl],zl++}}};return La(this),ja}static assert(ha){if(!(ha instanceof ZodError))throw new Error(`Not a ZodError: ${ha}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$1$1.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(ha=ma=>ma.message){const ma={},ja=[];for(const La of this.issues)if(La.path.length>0){const Ba=La.path[0];ma[Ba]=ma[Ba]||[],ma[Ba].push(ha(La))}else ja.push(ha(La));return{formErrors:ja,fieldErrors:ma}}get formErrors(){return this.flatten()}}ZodError.create=pa=>new ZodError(pa);const errorMap=(pa,ha)=>{let ma;switch(pa.code){case ZodIssueCode.invalid_type:pa.received===ZodParsedType.undefined?ma="Required":ma=`Expected ${pa.expected}, received ${pa.received}`;break;case ZodIssueCode.invalid_literal:ma=`Invalid literal value, expected ${JSON.stringify(pa.expected,util$1$1.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:ma=`Unrecognized key(s) in object: ${util$1$1.joinValues(pa.keys,", ")}`;break;case ZodIssueCode.invalid_union:ma="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:ma=`Invalid discriminator value. Expected ${util$1$1.joinValues(pa.options)}`;break;case ZodIssueCode.invalid_enum_value:ma=`Invalid enum value. Expected ${util$1$1.joinValues(pa.options)}, received '${pa.received}'`;break;case ZodIssueCode.invalid_arguments:ma="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:ma="Invalid function return type";break;case ZodIssueCode.invalid_date:ma="Invalid date";break;case ZodIssueCode.invalid_string:typeof pa.validation=="object"?"includes"in pa.validation?(ma=`Invalid input: must include "${pa.validation.includes}"`,typeof pa.validation.position=="number"&&(ma=`${ma} at one or more positions greater than or equal to ${pa.validation.position}`)):"startsWith"in pa.validation?ma=`Invalid input: must start with "${pa.validation.startsWith}"`:"endsWith"in pa.validation?ma=`Invalid input: must end with "${pa.validation.endsWith}"`:util$1$1.assertNever(pa.validation):pa.validation!=="regex"?ma=`Invalid ${pa.validation}`:ma="Invalid";break;case ZodIssueCode.too_small:pa.type==="array"?ma=`Array must contain ${pa.exact?"exactly":pa.inclusive?"at least":"more than"} ${pa.minimum} element(s)`:pa.type==="string"?ma=`String must contain ${pa.exact?"exactly":pa.inclusive?"at least":"over"} ${pa.minimum} character(s)`:pa.type==="number"?ma=`Number must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${pa.minimum}`:pa.type==="bigint"?ma=`Number must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${pa.minimum}`:pa.type==="date"?ma=`Date must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(pa.minimum))}`:ma="Invalid input";break;case ZodIssueCode.too_big:pa.type==="array"?ma=`Array must contain ${pa.exact?"exactly":pa.inclusive?"at most":"less than"} ${pa.maximum} element(s)`:pa.type==="string"?ma=`String must contain ${pa.exact?"exactly":pa.inclusive?"at most":"under"} ${pa.maximum} character(s)`:pa.type==="number"?ma=`Number must be ${pa.exact?"exactly":pa.inclusive?"less than or equal to":"less than"} ${pa.maximum}`:pa.type==="bigint"?ma=`BigInt must be ${pa.exact?"exactly":pa.inclusive?"less than or equal to":"less than"} ${pa.maximum}`:pa.type==="date"?ma=`Date must be ${pa.exact?"exactly":pa.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(pa.maximum))}`:ma="Invalid input";break;case ZodIssueCode.custom:ma="Invalid input";break;case ZodIssueCode.invalid_intersection_types:ma="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:ma=`Number must be a multiple of ${pa.multipleOf}`;break;case ZodIssueCode.not_finite:ma="Number must be finite";break;default:ma=ha.defaultError,util$1$1.assertNever(pa)}return{message:ma}};let overrideErrorMap=errorMap;function getErrorMap(){return overrideErrorMap}const makeIssue=pa=>{const{data:ha,path:ma,errorMaps:ja,issueData:La}=pa,Ba=[...ma,...La.path||[]],hl={...La,path:Ba};if(La.message!==void 0)return{...La,path:Ba,message:La.message};let Gl="";const zl=ja.filter(Wl=>!!Wl).slice().reverse();for(const Wl of zl)Gl=Wl(hl,{data:ha,defaultError:Gl}).message;return{...La,path:Ba,message:Gl}};function addIssueToContext(pa,ha){const ma=getErrorMap(),ja=makeIssue({issueData:ha,data:pa.data,path:pa.path,errorMaps:[pa.common.contextualErrorMap,pa.schemaErrorMap,ma,ma===errorMap?void 0:errorMap].filter(La=>!!La)});pa.common.issues.push(ja)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(ha,ma){const ja=[];for(const La of ma){if(La.status==="aborted")return INVALID;La.status==="dirty"&&ha.dirty(),ja.push(La.value)}return{status:ha.value,value:ja}}static async mergeObjectAsync(ha,ma){const ja=[];for(const La of ma){const Ba=await La.key,hl=await La.value;ja.push({key:Ba,value:hl})}return ParseStatus.mergeObjectSync(ha,ja)}static mergeObjectSync(ha,ma){const ja={};for(const La of ma){const{key:Ba,value:hl}=La;if(Ba.status==="aborted"||hl.status==="aborted")return INVALID;Ba.status==="dirty"&&ha.dirty(),hl.status==="dirty"&&ha.dirty(),Ba.value!=="__proto__"&&(typeof hl.value<"u"||La.alwaysSet)&&(ja[Ba.value]=hl.value)}return{status:ha.value,value:ja}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=pa=>({status:"dirty",value:pa}),OK=pa=>({status:"valid",value:pa}),isAborted=pa=>pa.status==="aborted",isDirty=pa=>pa.status==="dirty",isValid=pa=>pa.status==="valid",isAsync=pa=>typeof Promise<"u"&&pa instanceof Promise;var errorUtil;(function(pa){pa.errToObj=ha=>typeof ha=="string"?{message:ha}:ha||{},pa.toString=ha=>typeof ha=="string"?ha:ha?.message})(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(ha,ma,ja,La){this._cachedPath=[],this.parent=ha,this.data=ma,this._path=ja,this._key=La}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(pa,ha)=>{if(isValid(ha))return{success:!0,data:ha.value};if(!pa.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const ma=new ZodError(pa.common.issues);return this._error=ma,this._error}}};function processCreateParams(pa){if(!pa)return{};const{errorMap:ha,invalid_type_error:ma,required_error:ja,description:La}=pa;if(ha&&(ma||ja))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return ha?{errorMap:ha,description:La}:{errorMap:(Ba,hl)=>{const{message:Gl}=pa;return Ba.code==="invalid_enum_value"?{message:Gl??hl.defaultError}:typeof hl.data>"u"?{message:Gl??ja??hl.defaultError}:Ba.code!=="invalid_type"?{message:hl.defaultError}:{message:Gl??ma??hl.defaultError}},description:La}}class ZodType{get description(){return this._def.description}_getType(ha){return getParsedType(ha.data)}_getOrReturnCtx(ha,ma){return ma||{common:ha.parent.common,data:ha.data,parsedType:getParsedType(ha.data),schemaErrorMap:this._def.errorMap,path:ha.path,parent:ha.parent}}_processInputParams(ha){return{status:new ParseStatus,ctx:{common:ha.parent.common,data:ha.data,parsedType:getParsedType(ha.data),schemaErrorMap:this._def.errorMap,path:ha.path,parent:ha.parent}}}_parseSync(ha){const ma=this._parse(ha);if(isAsync(ma))throw new Error("Synchronous parse encountered promise.");return ma}_parseAsync(ha){const ma=this._parse(ha);return Promise.resolve(ma)}parse(ha,ma){const ja=this.safeParse(ha,ma);if(ja.success)return ja.data;throw ja.error}safeParse(ha,ma){const ja={common:{issues:[],async:ma?.async??!1,contextualErrorMap:ma?.errorMap},path:ma?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)},La=this._parseSync({data:ha,path:ja.path,parent:ja});return handleResult(ja,La)}"~validate"(ha){const ma={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)};if(!this["~standard"].async)try{const ja=this._parseSync({data:ha,path:[],parent:ma});return isValid(ja)?{value:ja.value}:{issues:ma.common.issues}}catch(ja){ja?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),ma.common={issues:[],async:!0}}return this._parseAsync({data:ha,path:[],parent:ma}).then(ja=>isValid(ja)?{value:ja.value}:{issues:ma.common.issues})}async parseAsync(ha,ma){const ja=await this.safeParseAsync(ha,ma);if(ja.success)return ja.data;throw ja.error}async safeParseAsync(ha,ma){const ja={common:{issues:[],contextualErrorMap:ma?.errorMap,async:!0},path:ma?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)},La=this._parse({data:ha,path:ja.path,parent:ja}),Ba=await(isAsync(La)?La:Promise.resolve(La));return handleResult(ja,Ba)}refine(ha,ma){const ja=La=>typeof ma=="string"||typeof ma>"u"?{message:ma}:typeof ma=="function"?ma(La):ma;return this._refinement((La,Ba)=>{const hl=ha(La),Gl=()=>Ba.addIssue({code:ZodIssueCode.custom,...ja(La)});return typeof Promise<"u"&&hl instanceof Promise?hl.then(zl=>zl?!0:(Gl(),!1)):hl?!0:(Gl(),!1)})}refinement(ha,ma){return this._refinement((ja,La)=>ha(ja)?!0:(La.addIssue(typeof ma=="function"?ma(ja,La):ma),!1))}_refinement(ha){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:ha}})}superRefine(ha){return this._refinement(ha)}constructor(ha){this.spa=this.safeParseAsync,this._def=ha,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:ma=>this["~validate"](ma)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(ha){return ZodUnion.create([this,ha],this._def)}and(ha){return ZodIntersection.create(this,ha,this._def)}transform(ha){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:ha}})}default(ha){const ma=typeof ha=="function"?ha:()=>ha;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:ma,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(ha){const ma=typeof ha=="function"?ha:()=>ha;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:ma,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(ha){const ma=this.constructor;return new ma({...this._def,description:ha})}pipe(ha){return ZodPipeline.create(this,ha)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex$2;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4CidrRegex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(pa){let ha="[0-5]\\d";pa.precision?ha=`${ha}\\.\\d{${pa.precision}}`:pa.precision==null&&(ha=`${ha}(\\.\\d+)?`);const ma=pa.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${ha})${ma}`}function timeRegex(pa){return new RegExp(`^${timeRegexSource(pa)}$`)}function datetimeRegex(pa){let ha=`${dateRegexSource}T${timeRegexSource(pa)}`;const ma=[];return ma.push(pa.local?"Z?":"Z"),pa.offset&&ma.push("([+-]\\d{2}:?\\d{2})"),ha=`${ha}(${ma.join("|")})`,new RegExp(`^${ha}$`)}function isValidIP(pa,ha){return!!((ha==="v4"||!ha)&&ipv4Regex.test(pa)||(ha==="v6"||!ha)&&ipv6Regex.test(pa))}function isValidJWT(pa,ha){if(!jwtRegex.test(pa))return!1;try{const[ma]=pa.split(".");if(!ma)return!1;const ja=ma.replace(/-/g,"+").replace(/_/g,"/").padEnd(ma.length+(4-ma.length%4)%4,"="),La=JSON.parse(atob(ja));return!(typeof La!="object"||La===null||"typ"in La&&La?.typ!=="JWT"||!La.alg||ha&&La.alg!==ha)}catch{return!1}}function isValidCidr(pa,ha){return!!((ha==="v4"||!ha)&&ipv4CidrRegex.test(pa)||(ha==="v6"||!ha)&&ipv6CidrRegex.test(pa))}class ZodString extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=String(ha.data)),this._getType(ha)!==ZodParsedType.string){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:La.parsedType}),INVALID}const ma=new ParseStatus;let ja;for(const La of this._def.checks)if(La.kind==="min")ha.data.length<La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.value,type:"string",inclusive:!0,exact:!1,message:La.message}),ma.dirty());else if(La.kind==="max")ha.data.length>La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.value,type:"string",inclusive:!0,exact:!1,message:La.message}),ma.dirty());else if(La.kind==="length"){const Ba=ha.data.length>La.value,hl=ha.data.length<La.value;(Ba||hl)&&(ja=this._getOrReturnCtx(ha,ja),Ba?addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.value,type:"string",inclusive:!0,exact:!0,message:La.message}):hl&&addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.value,type:"string",inclusive:!0,exact:!0,message:La.message}),ma.dirty())}else if(La.kind==="email")emailRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"email",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="emoji")emojiRegex$2||(emojiRegex$2=new RegExp(_emojiRegex,"u")),emojiRegex$2.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"emoji",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="uuid")uuidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"uuid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="nanoid")nanoidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="cuid")cuidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cuid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="cuid2")cuid2Regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="ulid")ulidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"ulid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="url")try{new URL(ha.data)}catch{ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"url",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()}else La.kind==="regex"?(La.regex.lastIndex=0,La.regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"regex",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty())):La.kind==="trim"?ha.data=ha.data.trim():La.kind==="includes"?ha.data.includes(La.value,La.position)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{includes:La.value,position:La.position},message:La.message}),ma.dirty()):La.kind==="toLowerCase"?ha.data=ha.data.toLowerCase():La.kind==="toUpperCase"?ha.data=ha.data.toUpperCase():La.kind==="startsWith"?ha.data.startsWith(La.value)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{startsWith:La.value},message:La.message}),ma.dirty()):La.kind==="endsWith"?ha.data.endsWith(La.value)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{endsWith:La.value},message:La.message}),ma.dirty()):La.kind==="datetime"?datetimeRegex(La).test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"datetime",message:La.message}),ma.dirty()):La.kind==="date"?dateRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"date",message:La.message}),ma.dirty()):La.kind==="time"?timeRegex(La).test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"time",message:La.message}),ma.dirty()):La.kind==="duration"?durationRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"duration",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="ip"?isValidIP(ha.data,La.version)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"ip",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="jwt"?isValidJWT(ha.data,La.alg)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"jwt",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="cidr"?isValidCidr(ha.data,La.version)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cidr",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="base64"?base64Regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"base64",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="base64url"?base64urlRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"base64url",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):util$1$1.assertNever(La);return{status:ma.value,value:ha.data}}_regex(ha,ma,ja){return this.refinement(La=>ha.test(La),{validation:ma,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(ja)})}_addCheck(ha){return new ZodString({...this._def,checks:[...this._def.checks,ha]})}email(ha){return this._addCheck({kind:"email",...errorUtil.errToObj(ha)})}url(ha){return this._addCheck({kind:"url",...errorUtil.errToObj(ha)})}emoji(ha){return this._addCheck({kind:"emoji",...errorUtil.errToObj(ha)})}uuid(ha){return this._addCheck({kind:"uuid",...errorUtil.errToObj(ha)})}nanoid(ha){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(ha)})}cuid(ha){return this._addCheck({kind:"cuid",...errorUtil.errToObj(ha)})}cuid2(ha){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(ha)})}ulid(ha){return this._addCheck({kind:"ulid",...errorUtil.errToObj(ha)})}base64(ha){return this._addCheck({kind:"base64",...errorUtil.errToObj(ha)})}base64url(ha){return this._addCheck({kind:"base64url",...errorUtil.errToObj(ha)})}jwt(ha){return this._addCheck({kind:"jwt",...errorUtil.errToObj(ha)})}ip(ha){return this._addCheck({kind:"ip",...errorUtil.errToObj(ha)})}cidr(ha){return this._addCheck({kind:"cidr",...errorUtil.errToObj(ha)})}datetime(ha){return typeof ha=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:ha}):this._addCheck({kind:"datetime",precision:typeof ha?.precision>"u"?null:ha?.precision,offset:ha?.offset??!1,local:ha?.local??!1,...errorUtil.errToObj(ha?.message)})}date(ha){return this._addCheck({kind:"date",message:ha})}time(ha){return typeof ha=="string"?this._addCheck({kind:"time",precision:null,message:ha}):this._addCheck({kind:"time",precision:typeof ha?.precision>"u"?null:ha?.precision,...errorUtil.errToObj(ha?.message)})}duration(ha){return this._addCheck({kind:"duration",...errorUtil.errToObj(ha)})}regex(ha,ma){return this._addCheck({kind:"regex",regex:ha,...errorUtil.errToObj(ma)})}includes(ha,ma){return this._addCheck({kind:"includes",value:ha,position:ma?.position,...errorUtil.errToObj(ma?.message)})}startsWith(ha,ma){return this._addCheck({kind:"startsWith",value:ha,...errorUtil.errToObj(ma)})}endsWith(ha,ma){return this._addCheck({kind:"endsWith",value:ha,...errorUtil.errToObj(ma)})}min(ha,ma){return this._addCheck({kind:"min",value:ha,...errorUtil.errToObj(ma)})}max(ha,ma){return this._addCheck({kind:"max",value:ha,...errorUtil.errToObj(ma)})}length(ha,ma){return this._addCheck({kind:"length",value:ha,...errorUtil.errToObj(ma)})}nonempty(ha){return this.min(1,errorUtil.errToObj(ha))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(ha=>ha.kind==="datetime")}get isDate(){return!!this._def.checks.find(ha=>ha.kind==="date")}get isTime(){return!!this._def.checks.find(ha=>ha.kind==="time")}get isDuration(){return!!this._def.checks.find(ha=>ha.kind==="duration")}get isEmail(){return!!this._def.checks.find(ha=>ha.kind==="email")}get isURL(){return!!this._def.checks.find(ha=>ha.kind==="url")}get isEmoji(){return!!this._def.checks.find(ha=>ha.kind==="emoji")}get isUUID(){return!!this._def.checks.find(ha=>ha.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(ha=>ha.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(ha=>ha.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(ha=>ha.kind==="cuid2")}get isULID(){return!!this._def.checks.find(ha=>ha.kind==="ulid")}get isIP(){return!!this._def.checks.find(ha=>ha.kind==="ip")}get isCIDR(){return!!this._def.checks.find(ha=>ha.kind==="cidr")}get isBase64(){return!!this._def.checks.find(ha=>ha.kind==="base64")}get isBase64url(){return!!this._def.checks.find(ha=>ha.kind==="base64url")}get minLength(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxLength(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}}ZodString.create=pa=>new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:pa?.coerce??!1,...processCreateParams(pa)});function floatSafeRemainder(pa,ha){const ma=(pa.toString().split(".")[1]||"").length,ja=(ha.toString().split(".")[1]||"").length,La=ma>ja?ma:ja,Ba=Number.parseInt(pa.toFixed(La).replace(".","")),hl=Number.parseInt(ha.toFixed(La).replace(".",""));return Ba%hl/10**La}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(ha){if(this._def.coerce&&(ha.data=Number(ha.data)),this._getType(ha)!==ZodParsedType.number){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:La.parsedType}),INVALID}let ma;const ja=new ParseStatus;for(const La of this._def.checks)La.kind==="int"?util$1$1.isInteger(ha.data)||(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:La.message}),ja.dirty()):La.kind==="min"?(La.inclusive?ha.data<La.value:ha.data<=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_small,minimum:La.value,type:"number",inclusive:La.inclusive,exact:!1,message:La.message}),ja.dirty()):La.kind==="max"?(La.inclusive?ha.data>La.value:ha.data>=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_big,maximum:La.value,type:"number",inclusive:La.inclusive,exact:!1,message:La.message}),ja.dirty()):La.kind==="multipleOf"?floatSafeRemainder(ha.data,La.value)!==0&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_multiple_of,multipleOf:La.value,message:La.message}),ja.dirty()):La.kind==="finite"?Number.isFinite(ha.data)||(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_finite,message:La.message}),ja.dirty()):util$1$1.assertNever(La);return{status:ja.value,value:ha.data}}gte(ha,ma){return this.setLimit("min",ha,!0,errorUtil.toString(ma))}gt(ha,ma){return this.setLimit("min",ha,!1,errorUtil.toString(ma))}lte(ha,ma){return this.setLimit("max",ha,!0,errorUtil.toString(ma))}lt(ha,ma){return this.setLimit("max",ha,!1,errorUtil.toString(ma))}setLimit(ha,ma,ja,La){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:ha,value:ma,inclusive:ja,message:errorUtil.toString(La)}]})}_addCheck(ha){return new ZodNumber({...this._def,checks:[...this._def.checks,ha]})}int(ha){return this._addCheck({kind:"int",message:errorUtil.toString(ha)})}positive(ha){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(ha)})}negative(ha){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(ha)})}nonpositive(ha){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(ha)})}nonnegative(ha){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(ha)})}multipleOf(ha,ma){return this._addCheck({kind:"multipleOf",value:ha,message:errorUtil.toString(ma)})}finite(ha){return this._addCheck({kind:"finite",message:errorUtil.toString(ha)})}safe(ha){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(ha)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(ha)})}get minValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}get isInt(){return!!this._def.checks.find(ha=>ha.kind==="int"||ha.kind==="multipleOf"&&util$1$1.isInteger(ha.value))}get isFinite(){let ha=null,ma=null;for(const ja of this._def.checks){if(ja.kind==="finite"||ja.kind==="int"||ja.kind==="multipleOf")return!0;ja.kind==="min"?(ma===null||ja.value>ma)&&(ma=ja.value):ja.kind==="max"&&(ha===null||ja.value<ha)&&(ha=ja.value)}return Number.isFinite(ma)&&Number.isFinite(ha)}}ZodNumber.create=pa=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:pa?.coerce||!1,...processCreateParams(pa)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(ha){if(this._def.coerce)try{ha.data=BigInt(ha.data)}catch{return this._getInvalidInput(ha)}if(this._getType(ha)!==ZodParsedType.bigint)return this._getInvalidInput(ha);let ma;const ja=new ParseStatus;for(const La of this._def.checks)La.kind==="min"?(La.inclusive?ha.data<La.value:ha.data<=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_small,type:"bigint",minimum:La.value,inclusive:La.inclusive,message:La.message}),ja.dirty()):La.kind==="max"?(La.inclusive?ha.data>La.value:ha.data>=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_big,type:"bigint",maximum:La.value,inclusive:La.inclusive,message:La.message}),ja.dirty()):La.kind==="multipleOf"?ha.data%La.value!==BigInt(0)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_multiple_of,multipleOf:La.value,message:La.message}),ja.dirty()):util$1$1.assertNever(La);return{status:ja.value,value:ha.data}}_getInvalidInput(ha){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:ma.parsedType}),INVALID}gte(ha,ma){return this.setLimit("min",ha,!0,errorUtil.toString(ma))}gt(ha,ma){return this.setLimit("min",ha,!1,errorUtil.toString(ma))}lte(ha,ma){return this.setLimit("max",ha,!0,errorUtil.toString(ma))}lt(ha,ma){return this.setLimit("max",ha,!1,errorUtil.toString(ma))}setLimit(ha,ma,ja,La){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:ha,value:ma,inclusive:ja,message:errorUtil.toString(La)}]})}_addCheck(ha){return new ZodBigInt({...this._def,checks:[...this._def.checks,ha]})}positive(ha){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ha)})}negative(ha){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ha)})}nonpositive(ha){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ha)})}nonnegative(ha){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ha)})}multipleOf(ha,ma){return this._addCheck({kind:"multipleOf",value:ha,message:errorUtil.toString(ma)})}get minValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}}ZodBigInt.create=pa=>new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:pa?.coerce??!1,...processCreateParams(pa)});class ZodBoolean extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=!!ha.data),this._getType(ha)!==ZodParsedType.boolean){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodBoolean.create=pa=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:pa?.coerce||!1,...processCreateParams(pa)});class ZodDate extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=new Date(ha.data)),this._getType(ha)!==ZodParsedType.date){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:La.parsedType}),INVALID}if(Number.isNaN(ha.data.getTime())){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_date}),INVALID}const ma=new ParseStatus;let ja;for(const La of this._def.checks)La.kind==="min"?ha.data.getTime()<La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_small,message:La.message,inclusive:!0,exact:!1,minimum:La.value,type:"date"}),ma.dirty()):La.kind==="max"?ha.data.getTime()>La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_big,message:La.message,inclusive:!0,exact:!1,maximum:La.value,type:"date"}),ma.dirty()):util$1$1.assertNever(La);return{status:ma.value,value:new Date(ha.data.getTime())}}_addCheck(ha){return new ZodDate({...this._def,checks:[...this._def.checks,ha]})}min(ha,ma){return this._addCheck({kind:"min",value:ha.getTime(),message:errorUtil.toString(ma)})}max(ha,ma){return this._addCheck({kind:"max",value:ha.getTime(),message:errorUtil.toString(ma)})}get minDate(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha!=null?new Date(ha):null}get maxDate(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha!=null?new Date(ha):null}}ZodDate.create=pa=>new ZodDate({checks:[],coerce:pa?.coerce||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(pa)});class ZodSymbol extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.symbol){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodSymbol.create=pa=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(pa)});class ZodUndefined extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.undefined){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodUndefined.create=pa=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(pa)});class ZodNull extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.null){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodNull.create=pa=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(pa)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(ha){return OK(ha.data)}}ZodAny.create=pa=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(pa)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(ha){return OK(ha.data)}}ZodUnknown.create=pa=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(pa)});class ZodNever extends ZodType{_parse(ha){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:ma.parsedType}),INVALID}}ZodNever.create=pa=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(pa)});class ZodVoid extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.undefined){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodVoid.create=pa=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(pa)});class ZodArray extends ZodType{_parse(ha){const{ctx:ma,status:ja}=this._processInputParams(ha),La=this._def;if(ma.parsedType!==ZodParsedType.array)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ma.parsedType}),INVALID;if(La.exactLength!==null){const hl=ma.data.length>La.exactLength.value,Gl=ma.data.length<La.exactLength.value;(hl||Gl)&&(addIssueToContext(ma,{code:hl?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:Gl?La.exactLength.value:void 0,maximum:hl?La.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:La.exactLength.message}),ja.dirty())}if(La.minLength!==null&&ma.data.length<La.minLength.value&&(addIssueToContext(ma,{code:ZodIssueCode.too_small,minimum:La.minLength.value,type:"array",inclusive:!0,exact:!1,message:La.minLength.message}),ja.dirty()),La.maxLength!==null&&ma.data.length>La.maxLength.value&&(addIssueToContext(ma,{code:ZodIssueCode.too_big,maximum:La.maxLength.value,type:"array",inclusive:!0,exact:!1,message:La.maxLength.message}),ja.dirty()),ma.common.async)return Promise.all([...ma.data].map((hl,Gl)=>La.type._parseAsync(new ParseInputLazyPath(ma,hl,ma.path,Gl)))).then(hl=>ParseStatus.mergeArray(ja,hl));const Ba=[...ma.data].map((hl,Gl)=>La.type._parseSync(new ParseInputLazyPath(ma,hl,ma.path,Gl)));return ParseStatus.mergeArray(ja,Ba)}get element(){return this._def.type}min(ha,ma){return new ZodArray({...this._def,minLength:{value:ha,message:errorUtil.toString(ma)}})}max(ha,ma){return new ZodArray({...this._def,maxLength:{value:ha,message:errorUtil.toString(ma)}})}length(ha,ma){return new ZodArray({...this._def,exactLength:{value:ha,message:errorUtil.toString(ma)}})}nonempty(ha){return this.min(1,ha)}}ZodArray.create=(pa,ha)=>new ZodArray({type:pa,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(ha)});function deepPartialify(pa){if(pa instanceof ZodObject){const ha={};for(const ma in pa.shape){const ja=pa.shape[ma];ha[ma]=ZodOptional.create(deepPartialify(ja))}return new ZodObject({...pa._def,shape:()=>ha})}else return pa instanceof ZodArray?new ZodArray({...pa._def,type:deepPartialify(pa.element)}):pa instanceof ZodOptional?ZodOptional.create(deepPartialify(pa.unwrap())):pa instanceof ZodNullable?ZodNullable.create(deepPartialify(pa.unwrap())):pa instanceof ZodTuple?ZodTuple.create(pa.items.map(ha=>deepPartialify(ha))):pa}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const ha=this._def.shape(),ma=util$1$1.objectKeys(ha);return this._cached={shape:ha,keys:ma},this._cached}_parse(ha){if(this._getType(ha)!==ZodParsedType.object){const zl=this._getOrReturnCtx(ha);return addIssueToContext(zl,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:zl.parsedType}),INVALID}const{status:ma,ctx:ja}=this._processInputParams(ha),{shape:La,keys:Ba}=this._getCached(),hl=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const zl in ja.data)Ba.includes(zl)||hl.push(zl);const Gl=[];for(const zl of Ba){const Wl=La[zl],Kl=ja.data[zl];Gl.push({key:{status:"valid",value:zl},value:Wl._parse(new ParseInputLazyPath(ja,Kl,ja.path,zl)),alwaysSet:zl in ja.data})}if(this._def.catchall instanceof ZodNever){const zl=this._def.unknownKeys;if(zl==="passthrough")for(const Wl of hl)Gl.push({key:{status:"valid",value:Wl},value:{status:"valid",value:ja.data[Wl]}});else if(zl==="strict")hl.length>0&&(addIssueToContext(ja,{code:ZodIssueCode.unrecognized_keys,keys:hl}),ma.dirty());else if(zl!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const zl=this._def.catchall;for(const Wl of hl){const Kl=ja.data[Wl];Gl.push({key:{status:"valid",value:Wl},value:zl._parse(new ParseInputLazyPath(ja,Kl,ja.path,Wl)),alwaysSet:Wl in ja.data})}}return ja.common.async?Promise.resolve().then(async()=>{const zl=[];for(const Wl of Gl){const Kl=await Wl.key,su=await Wl.value;zl.push({key:Kl,value:su,alwaysSet:Wl.alwaysSet})}return zl}).then(zl=>ParseStatus.mergeObjectSync(ma,zl)):ParseStatus.mergeObjectSync(ma,Gl)}get shape(){return this._def.shape()}strict(ha){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...ha!==void 0?{errorMap:(ma,ja)=>{const La=this._def.errorMap?.(ma,ja).message??ja.defaultError;return ma.code==="unrecognized_keys"?{message:errorUtil.errToObj(ha).message??La}:{message:La}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(ha){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...ha})})}merge(ha){return new ZodObject({unknownKeys:ha._def.unknownKeys,catchall:ha._def.catchall,shape:()=>({...this._def.shape(),...ha._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(ha,ma){return this.augment({[ha]:ma})}catchall(ha){return new ZodObject({...this._def,catchall:ha})}pick(ha){const ma={};for(const ja of util$1$1.objectKeys(ha))ha[ja]&&this.shape[ja]&&(ma[ja]=this.shape[ja]);return new ZodObject({...this._def,shape:()=>ma})}omit(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape))ha[ja]||(ma[ja]=this.shape[ja]);return new ZodObject({...this._def,shape:()=>ma})}deepPartial(){return deepPartialify(this)}partial(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape)){const La=this.shape[ja];ha&&!ha[ja]?ma[ja]=La:ma[ja]=La.optional()}return new ZodObject({...this._def,shape:()=>ma})}required(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape))if(ha&&!ha[ja])ma[ja]=this.shape[ja];else{let La=this.shape[ja];for(;La instanceof ZodOptional;)La=La._def.innerType;ma[ja]=La}return new ZodObject({...this._def,shape:()=>ma})}keyof(){return createZodEnum(util$1$1.objectKeys(this.shape))}}ZodObject.create=(pa,ha)=>new ZodObject({shape:()=>pa,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});ZodObject.strictCreate=(pa,ha)=>new ZodObject({shape:()=>pa,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});ZodObject.lazycreate=(pa,ha)=>new ZodObject({shape:pa,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});class ZodUnion extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja=this._def.options;function La(Ba){for(const Gl of Ba)if(Gl.result.status==="valid")return Gl.result;for(const Gl of Ba)if(Gl.result.status==="dirty")return ma.common.issues.push(...Gl.ctx.common.issues),Gl.result;const hl=Ba.map(Gl=>new ZodError(Gl.ctx.common.issues));return addIssueToContext(ma,{code:ZodIssueCode.invalid_union,unionErrors:hl}),INVALID}if(ma.common.async)return Promise.all(ja.map(async Ba=>{const hl={...ma,common:{...ma.common,issues:[]},parent:null};return{result:await Ba._parseAsync({data:ma.data,path:ma.path,parent:hl}),ctx:hl}})).then(La);{let Ba;const hl=[];for(const zl of ja){const Wl={...ma,common:{...ma.common,issues:[]},parent:null},Kl=zl._parseSync({data:ma.data,path:ma.path,parent:Wl});if(Kl.status==="valid")return Kl;Kl.status==="dirty"&&!Ba&&(Ba={result:Kl,ctx:Wl}),Wl.common.issues.length&&hl.push(Wl.common.issues)}if(Ba)return ma.common.issues.push(...Ba.ctx.common.issues),Ba.result;const Gl=hl.map(zl=>new ZodError(zl));return addIssueToContext(ma,{code:ZodIssueCode.invalid_union,unionErrors:Gl}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(pa,ha)=>new ZodUnion({options:pa,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(ha)});const getDiscriminator=pa=>pa instanceof ZodLazy?getDiscriminator(pa.schema):pa instanceof ZodEffects?getDiscriminator(pa.innerType()):pa instanceof ZodLiteral?[pa.value]:pa instanceof ZodEnum?pa.options:pa instanceof ZodNativeEnum?util$1$1.objectValues(pa.enum):pa instanceof ZodDefault?getDiscriminator(pa._def.innerType):pa instanceof ZodUndefined?[void 0]:pa instanceof ZodNull?[null]:pa instanceof ZodOptional?[void 0,...getDiscriminator(pa.unwrap())]:pa instanceof ZodNullable?[null,...getDiscriminator(pa.unwrap())]:pa instanceof ZodBranded||pa instanceof ZodReadonly?getDiscriminator(pa.unwrap()):pa instanceof ZodCatch?getDiscriminator(pa._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha);if(ma.parsedType!==ZodParsedType.object)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ma.parsedType}),INVALID;const ja=this.discriminator,La=ma.data[ja],Ba=this.optionsMap.get(La);return Ba?ma.common.async?Ba._parseAsync({data:ma.data,path:ma.path,parent:ma}):Ba._parseSync({data:ma.data,path:ma.path,parent:ma}):(addIssueToContext(ma,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ja]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(ha,ma,ja){const La=new Map;for(const Ba of ma){const hl=getDiscriminator(Ba.shape[ha]);if(!hl.length)throw new Error(`A discriminator value for key \`${ha}\` could not be extracted from all schema options`);for(const Gl of hl){if(La.has(Gl))throw new Error(`Discriminator property ${String(ha)} has duplicate value ${String(Gl)}`);La.set(Gl,Ba)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:ha,options:ma,optionsMap:La,...processCreateParams(ja)})}}function mergeValues(pa,ha){const ma=getParsedType(pa),ja=getParsedType(ha);if(pa===ha)return{valid:!0,data:pa};if(ma===ZodParsedType.object&&ja===ZodParsedType.object){const La=util$1$1.objectKeys(ha),Ba=util$1$1.objectKeys(pa).filter(Gl=>La.indexOf(Gl)!==-1),hl={...pa,...ha};for(const Gl of Ba){const zl=mergeValues(pa[Gl],ha[Gl]);if(!zl.valid)return{valid:!1};hl[Gl]=zl.data}return{valid:!0,data:hl}}else if(ma===ZodParsedType.array&&ja===ZodParsedType.array){if(pa.length!==ha.length)return{valid:!1};const La=[];for(let Ba=0;Ba<pa.length;Ba++){const hl=pa[Ba],Gl=ha[Ba],zl=mergeValues(hl,Gl);if(!zl.valid)return{valid:!1};La.push(zl.data)}return{valid:!0,data:La}}else return ma===ZodParsedType.date&&ja===ZodParsedType.date&&+pa==+ha?{valid:!0,data:pa}:{valid:!1}}class ZodIntersection extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha),La=(Ba,hl)=>{if(isAborted(Ba)||isAborted(hl))return INVALID;const Gl=mergeValues(Ba.value,hl.value);return Gl.valid?((isDirty(Ba)||isDirty(hl))&&ma.dirty(),{status:ma.value,value:Gl.data}):(addIssueToContext(ja,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return ja.common.async?Promise.all([this._def.left._parseAsync({data:ja.data,path:ja.path,parent:ja}),this._def.right._parseAsync({data:ja.data,path:ja.path,parent:ja})]).then(([Ba,hl])=>La(Ba,hl)):La(this._def.left._parseSync({data:ja.data,path:ja.path,parent:ja}),this._def.right._parseSync({data:ja.data,path:ja.path,parent:ja}))}}ZodIntersection.create=(pa,ha,ma)=>new ZodIntersection({left:pa,right:ha,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(ma)});class ZodTuple extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.array)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ja.parsedType}),INVALID;if(ja.data.length<this._def.items.length)return addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&ja.data.length>this._def.items.length&&(addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ma.dirty());const La=[...ja.data].map((Ba,hl)=>{const Gl=this._def.items[hl]||this._def.rest;return Gl?Gl._parse(new ParseInputLazyPath(ja,Ba,ja.path,hl)):null}).filter(Ba=>!!Ba);return ja.common.async?Promise.all(La).then(Ba=>ParseStatus.mergeArray(ma,Ba)):ParseStatus.mergeArray(ma,La)}get items(){return this._def.items}rest(ha){return new ZodTuple({...this._def,rest:ha})}}ZodTuple.create=(pa,ha)=>{if(!Array.isArray(pa))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:pa,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(ha)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.object)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ja.parsedType}),INVALID;const La=[],Ba=this._def.keyType,hl=this._def.valueType;for(const Gl in ja.data)La.push({key:Ba._parse(new ParseInputLazyPath(ja,Gl,ja.path,Gl)),value:hl._parse(new ParseInputLazyPath(ja,ja.data[Gl],ja.path,Gl)),alwaysSet:Gl in ja.data});return ja.common.async?ParseStatus.mergeObjectAsync(ma,La):ParseStatus.mergeObjectSync(ma,La)}get element(){return this._def.valueType}static create(ha,ma,ja){return ma instanceof ZodType?new ZodRecord({keyType:ha,valueType:ma,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ja)}):new ZodRecord({keyType:ZodString.create(),valueType:ha,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ma)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.map)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:ja.parsedType}),INVALID;const La=this._def.keyType,Ba=this._def.valueType,hl=[...ja.data.entries()].map(([Gl,zl],Wl)=>({key:La._parse(new ParseInputLazyPath(ja,Gl,ja.path,[Wl,"key"])),value:Ba._parse(new ParseInputLazyPath(ja,zl,ja.path,[Wl,"value"]))}));if(ja.common.async){const Gl=new Map;return Promise.resolve().then(async()=>{for(const zl of hl){const Wl=await zl.key,Kl=await zl.value;if(Wl.status==="aborted"||Kl.status==="aborted")return INVALID;(Wl.status==="dirty"||Kl.status==="dirty")&&ma.dirty(),Gl.set(Wl.value,Kl.value)}return{status:ma.value,value:Gl}})}else{const Gl=new Map;for(const zl of hl){const Wl=zl.key,Kl=zl.value;if(Wl.status==="aborted"||Kl.status==="aborted")return INVALID;(Wl.status==="dirty"||Kl.status==="dirty")&&ma.dirty(),Gl.set(Wl.value,Kl.value)}return{status:ma.value,value:Gl}}}}ZodMap.create=(pa,ha,ma)=>new ZodMap({valueType:ha,keyType:pa,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(ma)});class ZodSet extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.set)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:ja.parsedType}),INVALID;const La=this._def;La.minSize!==null&&ja.data.size<La.minSize.value&&(addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.minSize.value,type:"set",inclusive:!0,exact:!1,message:La.minSize.message}),ma.dirty()),La.maxSize!==null&&ja.data.size>La.maxSize.value&&(addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.maxSize.value,type:"set",inclusive:!0,exact:!1,message:La.maxSize.message}),ma.dirty());const Ba=this._def.valueType;function hl(zl){const Wl=new Set;for(const Kl of zl){if(Kl.status==="aborted")return INVALID;Kl.status==="dirty"&&ma.dirty(),Wl.add(Kl.value)}return{status:ma.value,value:Wl}}const Gl=[...ja.data.values()].map((zl,Wl)=>Ba._parse(new ParseInputLazyPath(ja,zl,ja.path,Wl)));return ja.common.async?Promise.all(Gl).then(zl=>hl(zl)):hl(Gl)}min(ha,ma){return new ZodSet({...this._def,minSize:{value:ha,message:errorUtil.toString(ma)}})}max(ha,ma){return new ZodSet({...this._def,maxSize:{value:ha,message:errorUtil.toString(ma)}})}size(ha,ma){return this.min(ha,ma).max(ha,ma)}nonempty(ha){return this.min(1,ha)}}ZodSet.create=(pa,ha)=>new ZodSet({valueType:pa,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(ha)});class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(ha){const{ctx:ma}=this._processInputParams(ha);return this._def.getter()._parse({data:ma.data,path:ma.path,parent:ma})}}ZodLazy.create=(pa,ha)=>new ZodLazy({getter:pa,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(ha)});class ZodLiteral extends ZodType{_parse(ha){if(ha.data!==this._def.value){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{received:ma.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:ha.data}}get value(){return this._def.value}}ZodLiteral.create=(pa,ha)=>new ZodLiteral({value:pa,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(ha)});function createZodEnum(pa,ha){return new ZodEnum({values:pa,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(ha)})}class ZodEnum extends ZodType{_parse(ha){if(typeof ha.data!="string"){const ma=this._getOrReturnCtx(ha),ja=this._def.values;return addIssueToContext(ma,{expected:util$1$1.joinValues(ja),received:ma.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(ha.data)){const ma=this._getOrReturnCtx(ha),ja=this._def.values;return addIssueToContext(ma,{received:ma.data,code:ZodIssueCode.invalid_enum_value,options:ja}),INVALID}return OK(ha.data)}get options(){return this._def.values}get enum(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}get Values(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}get Enum(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}extract(ha,ma=this._def){return ZodEnum.create(ha,{...this._def,...ma})}exclude(ha,ma=this._def){return ZodEnum.create(this.options.filter(ja=>!ha.includes(ja)),{...this._def,...ma})}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(ha){const ma=util$1$1.getValidEnumValues(this._def.values),ja=this._getOrReturnCtx(ha);if(ja.parsedType!==ZodParsedType.string&&ja.parsedType!==ZodParsedType.number){const La=util$1$1.objectValues(ma);return addIssueToContext(ja,{expected:util$1$1.joinValues(La),received:ja.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||(this._cache=new Set(util$1$1.getValidEnumValues(this._def.values))),!this._cache.has(ha.data)){const La=util$1$1.objectValues(ma);return addIssueToContext(ja,{received:ja.data,code:ZodIssueCode.invalid_enum_value,options:La}),INVALID}return OK(ha.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(pa,ha)=>new ZodNativeEnum({values:pa,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(ha)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(ha){const{ctx:ma}=this._processInputParams(ha);if(ma.parsedType!==ZodParsedType.promise&&ma.common.async===!1)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:ma.parsedType}),INVALID;const ja=ma.parsedType===ZodParsedType.promise?ma.data:Promise.resolve(ma.data);return OK(ja.then(La=>this._def.type.parseAsync(La,{path:ma.path,errorMap:ma.common.contextualErrorMap})))}}ZodPromise.create=(pa,ha)=>new ZodPromise({type:pa,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(ha)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha),La=this._def.effect||null,Ba={addIssue:hl=>{addIssueToContext(ja,hl),hl.fatal?ma.abort():ma.dirty()},get path(){return ja.path}};if(Ba.addIssue=Ba.addIssue.bind(Ba),La.type==="preprocess"){const hl=La.transform(ja.data,Ba);if(ja.common.async)return Promise.resolve(hl).then(async Gl=>{if(ma.value==="aborted")return INVALID;const zl=await this._def.schema._parseAsync({data:Gl,path:ja.path,parent:ja});return zl.status==="aborted"?INVALID:zl.status==="dirty"||ma.value==="dirty"?DIRTY(zl.value):zl});{if(ma.value==="aborted")return INVALID;const Gl=this._def.schema._parseSync({data:hl,path:ja.path,parent:ja});return Gl.status==="aborted"?INVALID:Gl.status==="dirty"||ma.value==="dirty"?DIRTY(Gl.value):Gl}}if(La.type==="refinement"){const hl=Gl=>{const zl=La.refinement(Gl,Ba);if(ja.common.async)return Promise.resolve(zl);if(zl instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Gl};if(ja.common.async===!1){const Gl=this._def.schema._parseSync({data:ja.data,path:ja.path,parent:ja});return Gl.status==="aborted"?INVALID:(Gl.status==="dirty"&&ma.dirty(),hl(Gl.value),{status:ma.value,value:Gl.value})}else return this._def.schema._parseAsync({data:ja.data,path:ja.path,parent:ja}).then(Gl=>Gl.status==="aborted"?INVALID:(Gl.status==="dirty"&&ma.dirty(),hl(Gl.value).then(()=>({status:ma.value,value:Gl.value}))))}if(La.type==="transform")if(ja.common.async===!1){const hl=this._def.schema._parseSync({data:ja.data,path:ja.path,parent:ja});if(!isValid(hl))return INVALID;const Gl=La.transform(hl.value,Ba);if(Gl instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:ma.value,value:Gl}}else return this._def.schema._parseAsync({data:ja.data,path:ja.path,parent:ja}).then(hl=>isValid(hl)?Promise.resolve(La.transform(hl.value,Ba)).then(Gl=>({status:ma.value,value:Gl})):INVALID);util$1$1.assertNever(La)}}ZodEffects.create=(pa,ha,ma)=>new ZodEffects({schema:pa,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:ha,...processCreateParams(ma)});ZodEffects.createWithPreprocess=(pa,ha,ma)=>new ZodEffects({schema:ha,effect:{type:"preprocess",transform:pa},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(ma)});class ZodOptional extends ZodType{_parse(ha){return this._getType(ha)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(ha)}unwrap(){return this._def.innerType}}ZodOptional.create=(pa,ha)=>new ZodOptional({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(ha)});class ZodNullable extends ZodType{_parse(ha){return this._getType(ha)===ZodParsedType.null?OK(null):this._def.innerType._parse(ha)}unwrap(){return this._def.innerType}}ZodNullable.create=(pa,ha)=>new ZodNullable({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(ha)});class ZodDefault extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha);let ja=ma.data;return ma.parsedType===ZodParsedType.undefined&&(ja=this._def.defaultValue()),this._def.innerType._parse({data:ja,path:ma.path,parent:ma})}removeDefault(){return this._def.innerType}}ZodDefault.create=(pa,ha)=>new ZodDefault({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof ha.default=="function"?ha.default:()=>ha.default,...processCreateParams(ha)});class ZodCatch extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja={...ma,common:{...ma.common,issues:[]}},La=this._def.innerType._parse({data:ja.data,path:ja.path,parent:{...ja}});return isAsync(La)?La.then(Ba=>({status:"valid",value:Ba.status==="valid"?Ba.value:this._def.catchValue({get error(){return new ZodError(ja.common.issues)},input:ja.data})})):{status:"valid",value:La.status==="valid"?La.value:this._def.catchValue({get error(){return new ZodError(ja.common.issues)},input:ja.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(pa,ha)=>new ZodCatch({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof ha.catch=="function"?ha.catch:()=>ha.catch,...processCreateParams(ha)});class ZodNaN extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.nan){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:ma.parsedType}),INVALID}return{status:"valid",value:ha.data}}}ZodNaN.create=pa=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(pa)});class ZodBranded extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja=ma.data;return this._def.type._parse({data:ja,path:ma.path,parent:ma})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.common.async)return(async()=>{const La=await this._def.in._parseAsync({data:ja.data,path:ja.path,parent:ja});return La.status==="aborted"?INVALID:La.status==="dirty"?(ma.dirty(),DIRTY(La.value)):this._def.out._parseAsync({data:La.value,path:ja.path,parent:ja})})();{const La=this._def.in._parseSync({data:ja.data,path:ja.path,parent:ja});return La.status==="aborted"?INVALID:La.status==="dirty"?(ma.dirty(),{status:"dirty",value:La.value}):this._def.out._parseSync({data:La.value,path:ja.path,parent:ja})}}static create(ha,ma){return new ZodPipeline({in:ha,out:ma,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(ha){const ma=this._def.innerType._parse(ha),ja=La=>(isValid(La)&&(La.value=Object.freeze(La.value)),La);return isAsync(ma)?ma.then(La=>ja(La)):ja(ma)}unwrap(){return this._def.innerType}}ZodReadonly.create=(pa,ha)=>new ZodReadonly({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(ha)});var ZodFirstPartyTypeKind;(function(pa){pa.ZodString="ZodString",pa.ZodNumber="ZodNumber",pa.ZodNaN="ZodNaN",pa.ZodBigInt="ZodBigInt",pa.ZodBoolean="ZodBoolean",pa.ZodDate="ZodDate",pa.ZodSymbol="ZodSymbol",pa.ZodUndefined="ZodUndefined",pa.ZodNull="ZodNull",pa.ZodAny="ZodAny",pa.ZodUnknown="ZodUnknown",pa.ZodNever="ZodNever",pa.ZodVoid="ZodVoid",pa.ZodArray="ZodArray",pa.ZodObject="ZodObject",pa.ZodUnion="ZodUnion",pa.ZodDiscriminatedUnion="ZodDiscriminatedUnion",pa.ZodIntersection="ZodIntersection",pa.ZodTuple="ZodTuple",pa.ZodRecord="ZodRecord",pa.ZodMap="ZodMap",pa.ZodSet="ZodSet",pa.ZodFunction="ZodFunction",pa.ZodLazy="ZodLazy",pa.ZodLiteral="ZodLiteral",pa.ZodEnum="ZodEnum",pa.ZodEffects="ZodEffects",pa.ZodNativeEnum="ZodNativeEnum",pa.ZodOptional="ZodOptional",pa.ZodNullable="ZodNullable",pa.ZodDefault="ZodDefault",pa.ZodCatch="ZodCatch",pa.ZodPromise="ZodPromise",pa.ZodBranded="ZodBranded",pa.ZodPipeline="ZodPipeline",pa.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const stringType=ZodString.create,numberType=ZodNumber.create,booleanType=ZodBoolean.create,anyType=ZodAny.create;ZodNever.create;const arrayType=ZodArray.create,objectType=ZodObject.create;ZodUnion.create;const discriminatedUnionType=ZodDiscriminatedUnion.create;ZodIntersection.create;ZodTuple.create;const recordType=ZodRecord.create,literalType=ZodLiteral.create;ZodEnum.create;ZodPromise.create;ZodOptional.create;ZodNullable.create;objectType({service:objectType({port:numberType(),host:stringType().optional(),httpFileHandling:booleanType().default(!1)}).default({port:8080,host:"localhost",httpFileHandling:!1}),store:discriminatedUnionType("type",[objectType({type:literalType("postgres"),host:stringType().default("localhost"),username:stringType().default("postgres"),password:stringType().default("postgres"),dbname:stringType().default("postgres"),port:numberType().default(5432)}),objectType({type:literalType("mysql"),host:stringType().default("localhost"),username:stringType().default("mysql"),password:stringType().default("mysql"),dbname:stringType().default("mysql"),port:numberType().default(3306)}),objectType({type:literalType("sqlite"),dbname:stringType().optional()})]).optional(),integrations:objectType({host:stringType(),username:stringType().optional(),password:stringType().optional(),connections:recordType(stringType(),stringType())}).optional(),graphql:objectType({enabled:booleanType().default(!1)}).optional(),rbac:objectType({enabled:booleanType().default(!1),roles:arrayType(stringType()).optional()}).optional(),auth:objectType({enabled:booleanType().default(!1)}).optional(),auditTrail:objectType({enabled:booleanType().default(!1)}).optional(),monitoring:objectType({enabled:booleanType().default(!1)}).optional(),authentication:discriminatedUnionType("service",[objectType({service:literalType("okta"),superuserEmail:stringType(),domain:stringType(),cookieDomain:stringType().optional(),authServer:stringType().default("default"),clientSecret:stringType(),apiToken:stringType(),scope:stringType().default("openid offline_access"),cookieTtlMs:numberType().default(12096e5),introspect:booleanType().default(!0),authorizeRedirectUrl:stringType(),clientUrl:stringType(),roleClaim:stringType().default("roles"),defaultRole:stringType().default("user"),clientId:stringType()}),objectType({service:literalType("cognito"),superuserEmail:stringType(),superuserPassword:stringType().optional(),isIdentityStore:booleanType().default(!1),userPoolId:stringType(),clientId:stringType(),whitelistEnabled:booleanType().default(!1),disableUserSessions:booleanType().default(!1)})]).optional(),openapi:arrayType(objectType({specUrl:stringType(),baseUrl:stringType().optional(),name:stringType()})).optional()});function isMonitoringEnabled(){var pa;return((pa=void 0)===null||pa===void 0?void 0:pa.enabled)===!0}const AdminUserId="00000000-0000-0000-0000-000000000000";function isAuthEnabled(){var pa;return((pa=void 0)===null||pa===void 0?void 0:pa.enabled)==!0}function isRbacEnabled(){var pa;return isAuthEnabled()&&((pa=void 0)===null||pa===void 0?void 0:pa.enabled)==!0}const AdminSession={sessionId:crypto.randomUUID(),userId:AdminUserId},LocalEnv=new Map;function getLocalEnv$1(pa){return LocalEnv.get(pa)}const PathAttributeName="__path__",PathAttributeNameQuery="__path__?",ParentAttributeName="__parent__",DeletedFlagAttributeName="__is_deleted__";function asUnauthMessage(pa){return typeof pa=="string"?pa:`User not authorised to perform '${pa.opr}' on ${pa.entity}`}class UnauthorisedError extends Error{constructor(ha,ma){super(ha?asUnauthMessage(ha):"User not authorised to perform this operation",ma)}}let BadRequestError$2=class extends Error{constructor(pa,ha){super(pa?asUnauthMessage(pa):"BadRequest",ha)}};class UserNotFoundError extends Error{constructor(ha,ma){super(ha||"User not found",ma)}}class UserNotConfirmedError extends Error{constructor(ha,ma){super(ha||"User account is not confirmed. Please check your email for verification code.",ma)}}class PasswordResetRequiredError extends Error{constructor(ha,ma){super(ha||"Password reset is required for this account",ma)}}class TooManyRequestsError extends Error{constructor(ha,ma){super(ha||"Too many requests. Please try again later.",ma)}}class InvalidParameterError extends Error{constructor(ha,ma){super(ha||"Invalid parameters provided",ma)}}class ExpiredCodeError extends Error{constructor(ha,ma){super(ha||"The verification code has expired. Please request a new one.",ma)}}class CodeMismatchError extends Error{constructor(ha,ma){super(ha||"The verification code is incorrect. Please try again.",ma)}}let FetchModuleFn;function setModuleFnFetcher(pa){FetchModuleFn=pa}const ForceReadPermFlag="f-r-f",FlowSuspensionTag="--";var SubGraphType;(function(pa){pa[pa.EVENT=0]="EVENT",pa[pa.IF=1]="IF",pa[pa.FOR_EACH=2]="FOR_EACH",pa[pa.DELETE=3]="DELETE",pa[pa.PURGE=4]="PURGE",pa[pa.RETURN=5]="RETURN",pa[pa.AGENT=6]="AGENT",pa[pa.NONE=7]="NONE"})(SubGraphType||(SubGraphType={}));class ExecGraph{static isEmpty(ha){return Object.is(ExecGraph.Empty,ha)}constructor(){this.parentGraph=void 0,this.hasAgentsFlag=!1,this.loopBody=!1,this.rootNodes=new Array,this.subGraphs=new Array}pushNode(ha){return this.rootNodes.push(ha),this}pushSubGraph(ha){return ha.parentGraph=this,this.subGraphs.push(ha),this}getSubGraphsLength(){return this.subGraphs.length}getLastSubGraphIndex(){return this.subGraphs.length-1}fetchSubGraphAt(ha){if(ha<0||ha>=this.subGraphs.length)throw new Error(`Invalid sub-graph index: ${ha}`);return this.subGraphs[ha]}fetchForEachBodySubGraph(){return this.fetchSubGraphAt(this.subGraphs.length-1)}fetchIfConsequentSubGraph(){return this.subGraphs.length>=2?this.fetchSubGraphAt(this.subGraphs.length-2):this.fetchSubGraphAt(this.subGraphs.length-1)}fetchIfAlternativeSubGraph(){if(this.subGraphs.length>=2)return this.fetchSubGraphAt(this.subGraphs.length-1)}getRootNodes(){return this.rootNodes}setActiveModuleName(ha){return ha&&(this.activeModuleName=ha),this}getActiveModuleName(){return this.activeModuleName}getParentGraph(){return this.parentGraph}setEventName(ha){return ha!==void 0&&(this.eventName=ha),this}getEventName(){return this.eventName}setHasAgents(ha){return this.hasAgentsFlag=ha,this.parentGraph&&this.parentGraph.setHasAgents(ha),this}hasAgents(){return this.hasAgentsFlag}canCache(){return!this.hasAgentsFlag}setIsLoopBody(){return this.loopBody=!0,this}isLoopBody(){return this.loopBody}asObject(){const ha=new Array;return this.rootNodes.forEach(ma=>{var ja;const La=ma.asObject();if(ma.subGraphIndex>=0){const Ba=this.subGraphs[ma.subGraphIndex],hl=Ba.asObject();if(ma.subGraphType==SubGraphType.FOR_EACH){const Gl=ma.code;La.var=(ja=Gl.pattern.forEach)===null||ja===void 0?void 0:ja.var,La.source=hl,La.body=Ba.fetchForEachBodySubGraph().asObject()}else if(ma.subGraphType==SubGraphType.IF){La.condition=hl,La.body=Ba.fetchIfConsequentSubGraph().asObject();const Gl=Ba.fetchIfAlternativeSubGraph();Gl&&(La.else=Gl.asObject())}else La.subGraph=hl}ha.push(La)}),ha}}ExecGraph.Empty=new ExecGraph;var RuntimeModeTag;(function(pa){pa[pa.DEV=0]="DEV",pa[pa.PROD=1]="PROD",pa[pa.INIT_SCHEMA=2]="INIT_SCHEMA",pa[pa.RUN_MIGRATION=3]="RUN_MIGRATION",pa[pa.UNDO_MIGRATION=4]="UNDO_MIGRATION",pa[pa.GENERATE_MIGRATION=5]="GENERATE_MIGRATION"})(RuntimeModeTag||(RuntimeModeTag={}));RuntimeModeTag.DEV;let DailyRotateFile,winston;isNodeEnv&&(await __vitePreload(()=>import("./index-D4z_hbl0-DMpNs09k.js"),__vite__mapDeps([12,11,13,1,3,9,5,14,15,16,17,18,19,10,20,21,4])).then(pa=>pa.i).then(pa=>{DailyRotateFile=pa.default}),await __vitePreload(()=>import("./winston-CtxF18qc-1uz0_uFI.js"),__vite__mapDeps([22,11,13,1,3,9,5,14,15,16,18,19,10,20,21,17,4])).then(pa=>pa.w).then(pa=>{winston=pa.default}));let logger$1;if(isNodeEnv){const pa=new DailyRotateFile({level:"debug",filename:"logs/app-%DATE%.log",datePattern:"YYYY-MM-DD",maxSize:"20m",maxFiles:"7d"});logger$1=winston.createLogger({format:winston.format.combine(winston.format.timestamp(),winston.format.printf(({timestamp:ha,level:ma,message:ja})=>`[${ha}] ${ma}: ${ja}`)),transports:[pa]})}else{let pa=function(ha){return ma=>{console.log(`${ha}: ${ma}`)}};logger$1={debug:pa("DEBUG"),info:pa("INFO"),warn:pa("WARN"),error:pa("ERROR")}}const PlannerInstructions=`Agentlang is a very-high-level declarative language that makes it easy to define business applications as 'models'.
|
|
14875
|
+
`))}async function introspect(pa){let ha=[];const ma=await parse$2$1(`module Temp workflow Test {${pa}}`);if(maybeRaiseParserErrors(ma),isWorkflowDefinition(ma.parseResult.value.defs[0]))ha=introspectHelper(ma.parseResult.value.defs[0].statements);else throw new Error("Failed to parse statements");return ha}function introspectHelper(pa){const ha=[];return pa.forEach(ma=>{ha.push(introspectStatement(ma))}),ha}function introspectStatement(pa){const ha=introspectPattern(pa.pattern),ma=firstAliasSpec(pa);ma&&(ma.alias?ha.setAlias(ma.alias):ma.aliases.length>0&&ha.setAliases(ma.aliases));const ja=firstCatchSpec(pa);return ja&&ja.handlers.forEach(La=>{ha.addHandler(La.except,introspectStatement(La.stmt))}),ha}function introspectPattern(pa){let ha;if(pa.crudMap?(isQueryPattern(pa)?ha=introspectQueryPattern(pa.crudMap):ha=introspectCreatePattern(pa.crudMap),pa.crudMap.into&&(ha=introspectInto(pa.crudMap.into,ha))):pa.expr?ha=introspectExpression(pa.expr):pa.forEach?ha=introspectForEach(pa.forEach):pa.if?ha=introspectIf(pa.if):pa.delete?ha=introspectDelete(pa.delete):pa.return?ha=introspectReturn(pa.return):pa.fullTextSearch&&(ha=introspectFullTextSearch(pa.fullTextSearch)),ha)return ha;throw new Error(`Failed to introspect pattern: ${pa}`)}function introspectInto(pa,ha){return pa.entries.forEach(ma=>{ha.addInto(ma.alias,ma.attribute)}),ha}function isQueryPattern(pa){if(pa.crudMap){const ha=pa.crudMap,ma=ha.name.endsWith(QuerySuffix);return!ma&&ha.body?ha.body.attributes.length>0&&ha.body.attributes.every(ja=>ja.name.endsWith(QuerySuffix)):ma}return!1}function introspectGroup(pa){return new GroupExpressionPattern(introspectExpression(pa.ge))}function introspectNegExpr(pa){return new NegExpressionPattern(introspectExpression(pa.ne))}function introspectNotExpr(pa){return new NotExpressionPattern(introspectExpression(pa.ne))}function introspectPrimExpr(pa){if(isLiteral(pa))return introspectLiteral(pa);if(isGroup(pa))return introspectGroup(pa);if(isNegExpr(pa))return introspectNegExpr(pa);if(isNotExpr(pa))return introspectNotExpr(pa);throw new Error(`Not a PrimExpr - ${pa}`)}function introspectExpression(pa){if(isPrimExpr(pa))return introspectPrimExpr(pa);if(pa.$cstNode)return new ExpressionPattern(pa.$cstNode.text);throw new Error("Failed to introspect expression - "+pa)}function introspectQueryPattern(pa){var ha;if(pa){const ma=new CrudPattern(pa.name);return(ha=pa.body)===null||ha===void 0||ha.attributes.forEach(ja=>{ma.addAttribute(ja.name,introspectExpression(ja.value),ja.op)}),pa.relationships.forEach(ja=>{ma.addRelationship(ja.name,introspectPattern(ja.pattern))}),ma.isCreate=!1,ma.isQueryUpdate=!1,ma.isQuery=!0,ma}throw new Error(`Failed to introspect query-pattern: ${pa}`)}function introspectCreatePattern(pa){var ha;if(pa){const ma=new CrudPattern(pa.name);ma.isCreate=!1,ma.isQuery=!1;let ja=!1;return(ha=pa.body)===null||ha===void 0||ha.attributes.forEach(La=>{!ja&&La.name.endsWith(QuerySuffix)&&(ja=!0),ma.addAttribute(La.name,introspectExpression(La.value),La.op)}),pa.relationships.forEach(La=>{ma.addRelationship(La.name,introspectPattern(La.pattern))}),ma.isQueryUpdate=ja,ja?(ma.isCreate=!1,ma.isQuery=!1):(ma.isCreate=!0,ma.isQuery=!1),ma}throw new Error(`Failed to introspect create-pattern: ${pa}`)}function asFnCallPattern(pa){return new FunctionCallPattern(pa.name,pa.args.map(ha=>isExpr(ha)?introspectExpression(ha):introspectLiteral(ha)))}function introspectLiteral(pa){if(pa.id)return LiteralPattern.Id(pa.id);if(pa.num)return LiteralPattern.Number(pa.num);if(pa.ref)return LiteralPattern.Reference(pa.ref);if(pa.str!==void 0)return LiteralPattern.String(pa.str);if(pa.bool)return LiteralPattern.Boolean(pa.bool=="true");if(pa.fnCall)return asFnCallPattern(pa.fnCall);if(pa.asyncFnCall)return asFnCallPattern(pa.asyncFnCall.fnCall).asAsync();if(pa.array)return LiteralPattern.Array(pa.array.vals.map(ha=>introspectStatement(ha)));if(pa.map)return introspectMapLiteral(pa.map);throw new Error(`Invalid literal - ${pa}`)}function introspectMapLiteral(pa){const ha=new Map;return pa.entries.forEach(ma=>{ha.set(ma.key,introspectExpression(ma.value))}),LiteralPattern.Map(ha)}function introspectForEach(pa){const ha=new ForEachPattern(pa.var,introspectPattern(pa.src));return pa.statements.forEach(ma=>{ha.addPattern(introspectStatement(ma))}),ha}function introspectIf(pa){const ha=new IfPattern(introspectExpression(pa.cond));return pa.statements.forEach(ma=>{ha.addPattern(introspectStatement(ma))}),pa.else&&ha.setElse(pa.else.statements.map(ma=>introspectStatement(ma))),ha}function introspectDelete(pa){return new DeletePattern(introspectPattern(pa.pattern))}function introspectReturn(pa){return new ReturnPattern(introspectPattern(pa.pattern))}function introspectFullTextSearch(pa){let ha;return pa.options&&(ha=introspectMapLiteral(pa.options)),new FullTextSearchPattern(pa.name,introspectLiteral(pa.query),ha)}var util$1$1;(function(pa){pa.assertEqual=La=>{};function ha(La){}pa.assertIs=ha;function ma(La){throw new Error}pa.assertNever=ma,pa.arrayToEnum=La=>{const Ba={};for(const hl of La)Ba[hl]=hl;return Ba},pa.getValidEnumValues=La=>{const Ba=pa.objectKeys(La).filter(Gl=>typeof La[La[Gl]]!="number"),hl={};for(const Gl of Ba)hl[Gl]=La[Gl];return pa.objectValues(hl)},pa.objectValues=La=>pa.objectKeys(La).map(function(Ba){return La[Ba]}),pa.objectKeys=typeof Object.keys=="function"?La=>Object.keys(La):La=>{const Ba=[];for(const hl in La)Object.prototype.hasOwnProperty.call(La,hl)&&Ba.push(hl);return Ba},pa.find=(La,Ba)=>{for(const hl of La)if(Ba(hl))return hl},pa.isInteger=typeof Number.isInteger=="function"?La=>Number.isInteger(La):La=>typeof La=="number"&&Number.isFinite(La)&&Math.floor(La)===La;function ja(La,Ba=" | "){return La.map(hl=>typeof hl=="string"?`'${hl}'`:hl).join(Ba)}pa.joinValues=ja,pa.jsonStringifyReplacer=(La,Ba)=>typeof Ba=="bigint"?Ba.toString():Ba})(util$1$1||(util$1$1={}));var objectUtil;(function(pa){pa.mergeShapes=(ha,ma)=>({...ha,...ma})})(objectUtil||(objectUtil={}));const ZodParsedType=util$1$1.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=pa=>{switch(typeof pa){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return Number.isNaN(pa)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(pa)?ZodParsedType.array:pa===null?ZodParsedType.null:pa.then&&typeof pa.then=="function"&&pa.catch&&typeof pa.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&pa instanceof Map?ZodParsedType.map:typeof Set<"u"&&pa instanceof Set?ZodParsedType.set:typeof Date<"u"&&pa instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$1$1.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{get errors(){return this.issues}constructor(ha){super(),this.issues=[],this.addIssue=ja=>{this.issues=[...this.issues,ja]},this.addIssues=(ja=[])=>{this.issues=[...this.issues,...ja]};const ma=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,ma):this.__proto__=ma,this.name="ZodError",this.issues=ha}format(ha){const ma=ha||function(Ba){return Ba.message},ja={_errors:[]},La=Ba=>{for(const hl of Ba.issues)if(hl.code==="invalid_union")hl.unionErrors.map(La);else if(hl.code==="invalid_return_type")La(hl.returnTypeError);else if(hl.code==="invalid_arguments")La(hl.argumentsError);else if(hl.path.length===0)ja._errors.push(ma(hl));else{let Gl=ja,zl=0;for(;zl<hl.path.length;){const Wl=hl.path[zl];zl===hl.path.length-1?(Gl[Wl]=Gl[Wl]||{_errors:[]},Gl[Wl]._errors.push(ma(hl))):Gl[Wl]=Gl[Wl]||{_errors:[]},Gl=Gl[Wl],zl++}}};return La(this),ja}static assert(ha){if(!(ha instanceof ZodError))throw new Error(`Not a ZodError: ${ha}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$1$1.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(ha=ma=>ma.message){const ma={},ja=[];for(const La of this.issues)if(La.path.length>0){const Ba=La.path[0];ma[Ba]=ma[Ba]||[],ma[Ba].push(ha(La))}else ja.push(ha(La));return{formErrors:ja,fieldErrors:ma}}get formErrors(){return this.flatten()}}ZodError.create=pa=>new ZodError(pa);const errorMap=(pa,ha)=>{let ma;switch(pa.code){case ZodIssueCode.invalid_type:pa.received===ZodParsedType.undefined?ma="Required":ma=`Expected ${pa.expected}, received ${pa.received}`;break;case ZodIssueCode.invalid_literal:ma=`Invalid literal value, expected ${JSON.stringify(pa.expected,util$1$1.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:ma=`Unrecognized key(s) in object: ${util$1$1.joinValues(pa.keys,", ")}`;break;case ZodIssueCode.invalid_union:ma="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:ma=`Invalid discriminator value. Expected ${util$1$1.joinValues(pa.options)}`;break;case ZodIssueCode.invalid_enum_value:ma=`Invalid enum value. Expected ${util$1$1.joinValues(pa.options)}, received '${pa.received}'`;break;case ZodIssueCode.invalid_arguments:ma="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:ma="Invalid function return type";break;case ZodIssueCode.invalid_date:ma="Invalid date";break;case ZodIssueCode.invalid_string:typeof pa.validation=="object"?"includes"in pa.validation?(ma=`Invalid input: must include "${pa.validation.includes}"`,typeof pa.validation.position=="number"&&(ma=`${ma} at one or more positions greater than or equal to ${pa.validation.position}`)):"startsWith"in pa.validation?ma=`Invalid input: must start with "${pa.validation.startsWith}"`:"endsWith"in pa.validation?ma=`Invalid input: must end with "${pa.validation.endsWith}"`:util$1$1.assertNever(pa.validation):pa.validation!=="regex"?ma=`Invalid ${pa.validation}`:ma="Invalid";break;case ZodIssueCode.too_small:pa.type==="array"?ma=`Array must contain ${pa.exact?"exactly":pa.inclusive?"at least":"more than"} ${pa.minimum} element(s)`:pa.type==="string"?ma=`String must contain ${pa.exact?"exactly":pa.inclusive?"at least":"over"} ${pa.minimum} character(s)`:pa.type==="number"?ma=`Number must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${pa.minimum}`:pa.type==="bigint"?ma=`Number must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${pa.minimum}`:pa.type==="date"?ma=`Date must be ${pa.exact?"exactly equal to ":pa.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(pa.minimum))}`:ma="Invalid input";break;case ZodIssueCode.too_big:pa.type==="array"?ma=`Array must contain ${pa.exact?"exactly":pa.inclusive?"at most":"less than"} ${pa.maximum} element(s)`:pa.type==="string"?ma=`String must contain ${pa.exact?"exactly":pa.inclusive?"at most":"under"} ${pa.maximum} character(s)`:pa.type==="number"?ma=`Number must be ${pa.exact?"exactly":pa.inclusive?"less than or equal to":"less than"} ${pa.maximum}`:pa.type==="bigint"?ma=`BigInt must be ${pa.exact?"exactly":pa.inclusive?"less than or equal to":"less than"} ${pa.maximum}`:pa.type==="date"?ma=`Date must be ${pa.exact?"exactly":pa.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(pa.maximum))}`:ma="Invalid input";break;case ZodIssueCode.custom:ma="Invalid input";break;case ZodIssueCode.invalid_intersection_types:ma="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:ma=`Number must be a multiple of ${pa.multipleOf}`;break;case ZodIssueCode.not_finite:ma="Number must be finite";break;default:ma=ha.defaultError,util$1$1.assertNever(pa)}return{message:ma}};let overrideErrorMap=errorMap;function getErrorMap(){return overrideErrorMap}const makeIssue=pa=>{const{data:ha,path:ma,errorMaps:ja,issueData:La}=pa,Ba=[...ma,...La.path||[]],hl={...La,path:Ba};if(La.message!==void 0)return{...La,path:Ba,message:La.message};let Gl="";const zl=ja.filter(Wl=>!!Wl).slice().reverse();for(const Wl of zl)Gl=Wl(hl,{data:ha,defaultError:Gl}).message;return{...La,path:Ba,message:Gl}};function addIssueToContext(pa,ha){const ma=getErrorMap(),ja=makeIssue({issueData:ha,data:pa.data,path:pa.path,errorMaps:[pa.common.contextualErrorMap,pa.schemaErrorMap,ma,ma===errorMap?void 0:errorMap].filter(La=>!!La)});pa.common.issues.push(ja)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(ha,ma){const ja=[];for(const La of ma){if(La.status==="aborted")return INVALID;La.status==="dirty"&&ha.dirty(),ja.push(La.value)}return{status:ha.value,value:ja}}static async mergeObjectAsync(ha,ma){const ja=[];for(const La of ma){const Ba=await La.key,hl=await La.value;ja.push({key:Ba,value:hl})}return ParseStatus.mergeObjectSync(ha,ja)}static mergeObjectSync(ha,ma){const ja={};for(const La of ma){const{key:Ba,value:hl}=La;if(Ba.status==="aborted"||hl.status==="aborted")return INVALID;Ba.status==="dirty"&&ha.dirty(),hl.status==="dirty"&&ha.dirty(),Ba.value!=="__proto__"&&(typeof hl.value<"u"||La.alwaysSet)&&(ja[Ba.value]=hl.value)}return{status:ha.value,value:ja}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=pa=>({status:"dirty",value:pa}),OK=pa=>({status:"valid",value:pa}),isAborted=pa=>pa.status==="aborted",isDirty=pa=>pa.status==="dirty",isValid=pa=>pa.status==="valid",isAsync=pa=>typeof Promise<"u"&&pa instanceof Promise;var errorUtil;(function(pa){pa.errToObj=ha=>typeof ha=="string"?{message:ha}:ha||{},pa.toString=ha=>typeof ha=="string"?ha:ha?.message})(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(ha,ma,ja,La){this._cachedPath=[],this.parent=ha,this.data=ma,this._path=ja,this._key=La}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(pa,ha)=>{if(isValid(ha))return{success:!0,data:ha.value};if(!pa.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const ma=new ZodError(pa.common.issues);return this._error=ma,this._error}}};function processCreateParams(pa){if(!pa)return{};const{errorMap:ha,invalid_type_error:ma,required_error:ja,description:La}=pa;if(ha&&(ma||ja))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return ha?{errorMap:ha,description:La}:{errorMap:(Ba,hl)=>{const{message:Gl}=pa;return Ba.code==="invalid_enum_value"?{message:Gl??hl.defaultError}:typeof hl.data>"u"?{message:Gl??ja??hl.defaultError}:Ba.code!=="invalid_type"?{message:hl.defaultError}:{message:Gl??ma??hl.defaultError}},description:La}}class ZodType{get description(){return this._def.description}_getType(ha){return getParsedType(ha.data)}_getOrReturnCtx(ha,ma){return ma||{common:ha.parent.common,data:ha.data,parsedType:getParsedType(ha.data),schemaErrorMap:this._def.errorMap,path:ha.path,parent:ha.parent}}_processInputParams(ha){return{status:new ParseStatus,ctx:{common:ha.parent.common,data:ha.data,parsedType:getParsedType(ha.data),schemaErrorMap:this._def.errorMap,path:ha.path,parent:ha.parent}}}_parseSync(ha){const ma=this._parse(ha);if(isAsync(ma))throw new Error("Synchronous parse encountered promise.");return ma}_parseAsync(ha){const ma=this._parse(ha);return Promise.resolve(ma)}parse(ha,ma){const ja=this.safeParse(ha,ma);if(ja.success)return ja.data;throw ja.error}safeParse(ha,ma){const ja={common:{issues:[],async:ma?.async??!1,contextualErrorMap:ma?.errorMap},path:ma?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)},La=this._parseSync({data:ha,path:ja.path,parent:ja});return handleResult(ja,La)}"~validate"(ha){const ma={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)};if(!this["~standard"].async)try{const ja=this._parseSync({data:ha,path:[],parent:ma});return isValid(ja)?{value:ja.value}:{issues:ma.common.issues}}catch(ja){ja?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),ma.common={issues:[],async:!0}}return this._parseAsync({data:ha,path:[],parent:ma}).then(ja=>isValid(ja)?{value:ja.value}:{issues:ma.common.issues})}async parseAsync(ha,ma){const ja=await this.safeParseAsync(ha,ma);if(ja.success)return ja.data;throw ja.error}async safeParseAsync(ha,ma){const ja={common:{issues:[],contextualErrorMap:ma?.errorMap,async:!0},path:ma?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:ha,parsedType:getParsedType(ha)},La=this._parse({data:ha,path:ja.path,parent:ja}),Ba=await(isAsync(La)?La:Promise.resolve(La));return handleResult(ja,Ba)}refine(ha,ma){const ja=La=>typeof ma=="string"||typeof ma>"u"?{message:ma}:typeof ma=="function"?ma(La):ma;return this._refinement((La,Ba)=>{const hl=ha(La),Gl=()=>Ba.addIssue({code:ZodIssueCode.custom,...ja(La)});return typeof Promise<"u"&&hl instanceof Promise?hl.then(zl=>zl?!0:(Gl(),!1)):hl?!0:(Gl(),!1)})}refinement(ha,ma){return this._refinement((ja,La)=>ha(ja)?!0:(La.addIssue(typeof ma=="function"?ma(ja,La):ma),!1))}_refinement(ha){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:ha}})}superRefine(ha){return this._refinement(ha)}constructor(ha){this.spa=this.safeParseAsync,this._def=ha,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:ma=>this["~validate"](ma)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(ha){return ZodUnion.create([this,ha],this._def)}and(ha){return ZodIntersection.create(this,ha,this._def)}transform(ha){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:ha}})}default(ha){const ma=typeof ha=="function"?ha:()=>ha;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:ma,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(ha){const ma=typeof ha=="function"?ha:()=>ha;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:ma,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(ha){const ma=this.constructor;return new ma({...this._def,description:ha})}pipe(ha){return ZodPipeline.create(this,ha)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex$2;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4CidrRegex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(pa){let ha="[0-5]\\d";pa.precision?ha=`${ha}\\.\\d{${pa.precision}}`:pa.precision==null&&(ha=`${ha}(\\.\\d+)?`);const ma=pa.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${ha})${ma}`}function timeRegex(pa){return new RegExp(`^${timeRegexSource(pa)}$`)}function datetimeRegex(pa){let ha=`${dateRegexSource}T${timeRegexSource(pa)}`;const ma=[];return ma.push(pa.local?"Z?":"Z"),pa.offset&&ma.push("([+-]\\d{2}:?\\d{2})"),ha=`${ha}(${ma.join("|")})`,new RegExp(`^${ha}$`)}function isValidIP(pa,ha){return!!((ha==="v4"||!ha)&&ipv4Regex.test(pa)||(ha==="v6"||!ha)&&ipv6Regex.test(pa))}function isValidJWT(pa,ha){if(!jwtRegex.test(pa))return!1;try{const[ma]=pa.split(".");if(!ma)return!1;const ja=ma.replace(/-/g,"+").replace(/_/g,"/").padEnd(ma.length+(4-ma.length%4)%4,"="),La=JSON.parse(atob(ja));return!(typeof La!="object"||La===null||"typ"in La&&La?.typ!=="JWT"||!La.alg||ha&&La.alg!==ha)}catch{return!1}}function isValidCidr(pa,ha){return!!((ha==="v4"||!ha)&&ipv4CidrRegex.test(pa)||(ha==="v6"||!ha)&&ipv6CidrRegex.test(pa))}class ZodString extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=String(ha.data)),this._getType(ha)!==ZodParsedType.string){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:La.parsedType}),INVALID}const ma=new ParseStatus;let ja;for(const La of this._def.checks)if(La.kind==="min")ha.data.length<La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.value,type:"string",inclusive:!0,exact:!1,message:La.message}),ma.dirty());else if(La.kind==="max")ha.data.length>La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.value,type:"string",inclusive:!0,exact:!1,message:La.message}),ma.dirty());else if(La.kind==="length"){const Ba=ha.data.length>La.value,hl=ha.data.length<La.value;(Ba||hl)&&(ja=this._getOrReturnCtx(ha,ja),Ba?addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.value,type:"string",inclusive:!0,exact:!0,message:La.message}):hl&&addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.value,type:"string",inclusive:!0,exact:!0,message:La.message}),ma.dirty())}else if(La.kind==="email")emailRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"email",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="emoji")emojiRegex$2||(emojiRegex$2=new RegExp(_emojiRegex,"u")),emojiRegex$2.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"emoji",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="uuid")uuidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"uuid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="nanoid")nanoidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="cuid")cuidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cuid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="cuid2")cuid2Regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="ulid")ulidRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"ulid",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty());else if(La.kind==="url")try{new URL(ha.data)}catch{ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"url",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()}else La.kind==="regex"?(La.regex.lastIndex=0,La.regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"regex",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty())):La.kind==="trim"?ha.data=ha.data.trim():La.kind==="includes"?ha.data.includes(La.value,La.position)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{includes:La.value,position:La.position},message:La.message}),ma.dirty()):La.kind==="toLowerCase"?ha.data=ha.data.toLowerCase():La.kind==="toUpperCase"?ha.data=ha.data.toUpperCase():La.kind==="startsWith"?ha.data.startsWith(La.value)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{startsWith:La.value},message:La.message}),ma.dirty()):La.kind==="endsWith"?ha.data.endsWith(La.value)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:{endsWith:La.value},message:La.message}),ma.dirty()):La.kind==="datetime"?datetimeRegex(La).test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"datetime",message:La.message}),ma.dirty()):La.kind==="date"?dateRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"date",message:La.message}),ma.dirty()):La.kind==="time"?timeRegex(La).test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.invalid_string,validation:"time",message:La.message}),ma.dirty()):La.kind==="duration"?durationRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"duration",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="ip"?isValidIP(ha.data,La.version)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"ip",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="jwt"?isValidJWT(ha.data,La.alg)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"jwt",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="cidr"?isValidCidr(ha.data,La.version)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"cidr",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="base64"?base64Regex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"base64",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):La.kind==="base64url"?base64urlRegex.test(ha.data)||(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{validation:"base64url",code:ZodIssueCode.invalid_string,message:La.message}),ma.dirty()):util$1$1.assertNever(La);return{status:ma.value,value:ha.data}}_regex(ha,ma,ja){return this.refinement(La=>ha.test(La),{validation:ma,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(ja)})}_addCheck(ha){return new ZodString({...this._def,checks:[...this._def.checks,ha]})}email(ha){return this._addCheck({kind:"email",...errorUtil.errToObj(ha)})}url(ha){return this._addCheck({kind:"url",...errorUtil.errToObj(ha)})}emoji(ha){return this._addCheck({kind:"emoji",...errorUtil.errToObj(ha)})}uuid(ha){return this._addCheck({kind:"uuid",...errorUtil.errToObj(ha)})}nanoid(ha){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(ha)})}cuid(ha){return this._addCheck({kind:"cuid",...errorUtil.errToObj(ha)})}cuid2(ha){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(ha)})}ulid(ha){return this._addCheck({kind:"ulid",...errorUtil.errToObj(ha)})}base64(ha){return this._addCheck({kind:"base64",...errorUtil.errToObj(ha)})}base64url(ha){return this._addCheck({kind:"base64url",...errorUtil.errToObj(ha)})}jwt(ha){return this._addCheck({kind:"jwt",...errorUtil.errToObj(ha)})}ip(ha){return this._addCheck({kind:"ip",...errorUtil.errToObj(ha)})}cidr(ha){return this._addCheck({kind:"cidr",...errorUtil.errToObj(ha)})}datetime(ha){return typeof ha=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:ha}):this._addCheck({kind:"datetime",precision:typeof ha?.precision>"u"?null:ha?.precision,offset:ha?.offset??!1,local:ha?.local??!1,...errorUtil.errToObj(ha?.message)})}date(ha){return this._addCheck({kind:"date",message:ha})}time(ha){return typeof ha=="string"?this._addCheck({kind:"time",precision:null,message:ha}):this._addCheck({kind:"time",precision:typeof ha?.precision>"u"?null:ha?.precision,...errorUtil.errToObj(ha?.message)})}duration(ha){return this._addCheck({kind:"duration",...errorUtil.errToObj(ha)})}regex(ha,ma){return this._addCheck({kind:"regex",regex:ha,...errorUtil.errToObj(ma)})}includes(ha,ma){return this._addCheck({kind:"includes",value:ha,position:ma?.position,...errorUtil.errToObj(ma?.message)})}startsWith(ha,ma){return this._addCheck({kind:"startsWith",value:ha,...errorUtil.errToObj(ma)})}endsWith(ha,ma){return this._addCheck({kind:"endsWith",value:ha,...errorUtil.errToObj(ma)})}min(ha,ma){return this._addCheck({kind:"min",value:ha,...errorUtil.errToObj(ma)})}max(ha,ma){return this._addCheck({kind:"max",value:ha,...errorUtil.errToObj(ma)})}length(ha,ma){return this._addCheck({kind:"length",value:ha,...errorUtil.errToObj(ma)})}nonempty(ha){return this.min(1,errorUtil.errToObj(ha))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(ha=>ha.kind==="datetime")}get isDate(){return!!this._def.checks.find(ha=>ha.kind==="date")}get isTime(){return!!this._def.checks.find(ha=>ha.kind==="time")}get isDuration(){return!!this._def.checks.find(ha=>ha.kind==="duration")}get isEmail(){return!!this._def.checks.find(ha=>ha.kind==="email")}get isURL(){return!!this._def.checks.find(ha=>ha.kind==="url")}get isEmoji(){return!!this._def.checks.find(ha=>ha.kind==="emoji")}get isUUID(){return!!this._def.checks.find(ha=>ha.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(ha=>ha.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(ha=>ha.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(ha=>ha.kind==="cuid2")}get isULID(){return!!this._def.checks.find(ha=>ha.kind==="ulid")}get isIP(){return!!this._def.checks.find(ha=>ha.kind==="ip")}get isCIDR(){return!!this._def.checks.find(ha=>ha.kind==="cidr")}get isBase64(){return!!this._def.checks.find(ha=>ha.kind==="base64")}get isBase64url(){return!!this._def.checks.find(ha=>ha.kind==="base64url")}get minLength(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxLength(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}}ZodString.create=pa=>new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:pa?.coerce??!1,...processCreateParams(pa)});function floatSafeRemainder(pa,ha){const ma=(pa.toString().split(".")[1]||"").length,ja=(ha.toString().split(".")[1]||"").length,La=ma>ja?ma:ja,Ba=Number.parseInt(pa.toFixed(La).replace(".","")),hl=Number.parseInt(ha.toFixed(La).replace(".",""));return Ba%hl/10**La}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(ha){if(this._def.coerce&&(ha.data=Number(ha.data)),this._getType(ha)!==ZodParsedType.number){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:La.parsedType}),INVALID}let ma;const ja=new ParseStatus;for(const La of this._def.checks)La.kind==="int"?util$1$1.isInteger(ha.data)||(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:La.message}),ja.dirty()):La.kind==="min"?(La.inclusive?ha.data<La.value:ha.data<=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_small,minimum:La.value,type:"number",inclusive:La.inclusive,exact:!1,message:La.message}),ja.dirty()):La.kind==="max"?(La.inclusive?ha.data>La.value:ha.data>=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_big,maximum:La.value,type:"number",inclusive:La.inclusive,exact:!1,message:La.message}),ja.dirty()):La.kind==="multipleOf"?floatSafeRemainder(ha.data,La.value)!==0&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_multiple_of,multipleOf:La.value,message:La.message}),ja.dirty()):La.kind==="finite"?Number.isFinite(ha.data)||(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_finite,message:La.message}),ja.dirty()):util$1$1.assertNever(La);return{status:ja.value,value:ha.data}}gte(ha,ma){return this.setLimit("min",ha,!0,errorUtil.toString(ma))}gt(ha,ma){return this.setLimit("min",ha,!1,errorUtil.toString(ma))}lte(ha,ma){return this.setLimit("max",ha,!0,errorUtil.toString(ma))}lt(ha,ma){return this.setLimit("max",ha,!1,errorUtil.toString(ma))}setLimit(ha,ma,ja,La){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:ha,value:ma,inclusive:ja,message:errorUtil.toString(La)}]})}_addCheck(ha){return new ZodNumber({...this._def,checks:[...this._def.checks,ha]})}int(ha){return this._addCheck({kind:"int",message:errorUtil.toString(ha)})}positive(ha){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(ha)})}negative(ha){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(ha)})}nonpositive(ha){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(ha)})}nonnegative(ha){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(ha)})}multipleOf(ha,ma){return this._addCheck({kind:"multipleOf",value:ha,message:errorUtil.toString(ma)})}finite(ha){return this._addCheck({kind:"finite",message:errorUtil.toString(ha)})}safe(ha){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(ha)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(ha)})}get minValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}get isInt(){return!!this._def.checks.find(ha=>ha.kind==="int"||ha.kind==="multipleOf"&&util$1$1.isInteger(ha.value))}get isFinite(){let ha=null,ma=null;for(const ja of this._def.checks){if(ja.kind==="finite"||ja.kind==="int"||ja.kind==="multipleOf")return!0;ja.kind==="min"?(ma===null||ja.value>ma)&&(ma=ja.value):ja.kind==="max"&&(ha===null||ja.value<ha)&&(ha=ja.value)}return Number.isFinite(ma)&&Number.isFinite(ha)}}ZodNumber.create=pa=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:pa?.coerce||!1,...processCreateParams(pa)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(ha){if(this._def.coerce)try{ha.data=BigInt(ha.data)}catch{return this._getInvalidInput(ha)}if(this._getType(ha)!==ZodParsedType.bigint)return this._getInvalidInput(ha);let ma;const ja=new ParseStatus;for(const La of this._def.checks)La.kind==="min"?(La.inclusive?ha.data<La.value:ha.data<=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_small,type:"bigint",minimum:La.value,inclusive:La.inclusive,message:La.message}),ja.dirty()):La.kind==="max"?(La.inclusive?ha.data>La.value:ha.data>=La.value)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.too_big,type:"bigint",maximum:La.value,inclusive:La.inclusive,message:La.message}),ja.dirty()):La.kind==="multipleOf"?ha.data%La.value!==BigInt(0)&&(ma=this._getOrReturnCtx(ha,ma),addIssueToContext(ma,{code:ZodIssueCode.not_multiple_of,multipleOf:La.value,message:La.message}),ja.dirty()):util$1$1.assertNever(La);return{status:ja.value,value:ha.data}}_getInvalidInput(ha){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:ma.parsedType}),INVALID}gte(ha,ma){return this.setLimit("min",ha,!0,errorUtil.toString(ma))}gt(ha,ma){return this.setLimit("min",ha,!1,errorUtil.toString(ma))}lte(ha,ma){return this.setLimit("max",ha,!0,errorUtil.toString(ma))}lt(ha,ma){return this.setLimit("max",ha,!1,errorUtil.toString(ma))}setLimit(ha,ma,ja,La){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:ha,value:ma,inclusive:ja,message:errorUtil.toString(La)}]})}_addCheck(ha){return new ZodBigInt({...this._def,checks:[...this._def.checks,ha]})}positive(ha){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ha)})}negative(ha){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ha)})}nonpositive(ha){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ha)})}nonnegative(ha){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ha)})}multipleOf(ha,ma){return this._addCheck({kind:"multipleOf",value:ha,message:errorUtil.toString(ma)})}get minValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha}get maxValue(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha}}ZodBigInt.create=pa=>new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:pa?.coerce??!1,...processCreateParams(pa)});class ZodBoolean extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=!!ha.data),this._getType(ha)!==ZodParsedType.boolean){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodBoolean.create=pa=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:pa?.coerce||!1,...processCreateParams(pa)});class ZodDate extends ZodType{_parse(ha){if(this._def.coerce&&(ha.data=new Date(ha.data)),this._getType(ha)!==ZodParsedType.date){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:La.parsedType}),INVALID}if(Number.isNaN(ha.data.getTime())){const La=this._getOrReturnCtx(ha);return addIssueToContext(La,{code:ZodIssueCode.invalid_date}),INVALID}const ma=new ParseStatus;let ja;for(const La of this._def.checks)La.kind==="min"?ha.data.getTime()<La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_small,message:La.message,inclusive:!0,exact:!1,minimum:La.value,type:"date"}),ma.dirty()):La.kind==="max"?ha.data.getTime()>La.value&&(ja=this._getOrReturnCtx(ha,ja),addIssueToContext(ja,{code:ZodIssueCode.too_big,message:La.message,inclusive:!0,exact:!1,maximum:La.value,type:"date"}),ma.dirty()):util$1$1.assertNever(La);return{status:ma.value,value:new Date(ha.data.getTime())}}_addCheck(ha){return new ZodDate({...this._def,checks:[...this._def.checks,ha]})}min(ha,ma){return this._addCheck({kind:"min",value:ha.getTime(),message:errorUtil.toString(ma)})}max(ha,ma){return this._addCheck({kind:"max",value:ha.getTime(),message:errorUtil.toString(ma)})}get minDate(){let ha=null;for(const ma of this._def.checks)ma.kind==="min"&&(ha===null||ma.value>ha)&&(ha=ma.value);return ha!=null?new Date(ha):null}get maxDate(){let ha=null;for(const ma of this._def.checks)ma.kind==="max"&&(ha===null||ma.value<ha)&&(ha=ma.value);return ha!=null?new Date(ha):null}}ZodDate.create=pa=>new ZodDate({checks:[],coerce:pa?.coerce||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(pa)});class ZodSymbol extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.symbol){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodSymbol.create=pa=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(pa)});class ZodUndefined extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.undefined){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodUndefined.create=pa=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(pa)});class ZodNull extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.null){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodNull.create=pa=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(pa)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(ha){return OK(ha.data)}}ZodAny.create=pa=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(pa)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(ha){return OK(ha.data)}}ZodUnknown.create=pa=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(pa)});class ZodNever extends ZodType{_parse(ha){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:ma.parsedType}),INVALID}}ZodNever.create=pa=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(pa)});class ZodVoid extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.undefined){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:ma.parsedType}),INVALID}return OK(ha.data)}}ZodVoid.create=pa=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(pa)});class ZodArray extends ZodType{_parse(ha){const{ctx:ma,status:ja}=this._processInputParams(ha),La=this._def;if(ma.parsedType!==ZodParsedType.array)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ma.parsedType}),INVALID;if(La.exactLength!==null){const hl=ma.data.length>La.exactLength.value,Gl=ma.data.length<La.exactLength.value;(hl||Gl)&&(addIssueToContext(ma,{code:hl?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:Gl?La.exactLength.value:void 0,maximum:hl?La.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:La.exactLength.message}),ja.dirty())}if(La.minLength!==null&&ma.data.length<La.minLength.value&&(addIssueToContext(ma,{code:ZodIssueCode.too_small,minimum:La.minLength.value,type:"array",inclusive:!0,exact:!1,message:La.minLength.message}),ja.dirty()),La.maxLength!==null&&ma.data.length>La.maxLength.value&&(addIssueToContext(ma,{code:ZodIssueCode.too_big,maximum:La.maxLength.value,type:"array",inclusive:!0,exact:!1,message:La.maxLength.message}),ja.dirty()),ma.common.async)return Promise.all([...ma.data].map((hl,Gl)=>La.type._parseAsync(new ParseInputLazyPath(ma,hl,ma.path,Gl)))).then(hl=>ParseStatus.mergeArray(ja,hl));const Ba=[...ma.data].map((hl,Gl)=>La.type._parseSync(new ParseInputLazyPath(ma,hl,ma.path,Gl)));return ParseStatus.mergeArray(ja,Ba)}get element(){return this._def.type}min(ha,ma){return new ZodArray({...this._def,minLength:{value:ha,message:errorUtil.toString(ma)}})}max(ha,ma){return new ZodArray({...this._def,maxLength:{value:ha,message:errorUtil.toString(ma)}})}length(ha,ma){return new ZodArray({...this._def,exactLength:{value:ha,message:errorUtil.toString(ma)}})}nonempty(ha){return this.min(1,ha)}}ZodArray.create=(pa,ha)=>new ZodArray({type:pa,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(ha)});function deepPartialify(pa){if(pa instanceof ZodObject){const ha={};for(const ma in pa.shape){const ja=pa.shape[ma];ha[ma]=ZodOptional.create(deepPartialify(ja))}return new ZodObject({...pa._def,shape:()=>ha})}else return pa instanceof ZodArray?new ZodArray({...pa._def,type:deepPartialify(pa.element)}):pa instanceof ZodOptional?ZodOptional.create(deepPartialify(pa.unwrap())):pa instanceof ZodNullable?ZodNullable.create(deepPartialify(pa.unwrap())):pa instanceof ZodTuple?ZodTuple.create(pa.items.map(ha=>deepPartialify(ha))):pa}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const ha=this._def.shape(),ma=util$1$1.objectKeys(ha);return this._cached={shape:ha,keys:ma},this._cached}_parse(ha){if(this._getType(ha)!==ZodParsedType.object){const zl=this._getOrReturnCtx(ha);return addIssueToContext(zl,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:zl.parsedType}),INVALID}const{status:ma,ctx:ja}=this._processInputParams(ha),{shape:La,keys:Ba}=this._getCached(),hl=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const zl in ja.data)Ba.includes(zl)||hl.push(zl);const Gl=[];for(const zl of Ba){const Wl=La[zl],Kl=ja.data[zl];Gl.push({key:{status:"valid",value:zl},value:Wl._parse(new ParseInputLazyPath(ja,Kl,ja.path,zl)),alwaysSet:zl in ja.data})}if(this._def.catchall instanceof ZodNever){const zl=this._def.unknownKeys;if(zl==="passthrough")for(const Wl of hl)Gl.push({key:{status:"valid",value:Wl},value:{status:"valid",value:ja.data[Wl]}});else if(zl==="strict")hl.length>0&&(addIssueToContext(ja,{code:ZodIssueCode.unrecognized_keys,keys:hl}),ma.dirty());else if(zl!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const zl=this._def.catchall;for(const Wl of hl){const Kl=ja.data[Wl];Gl.push({key:{status:"valid",value:Wl},value:zl._parse(new ParseInputLazyPath(ja,Kl,ja.path,Wl)),alwaysSet:Wl in ja.data})}}return ja.common.async?Promise.resolve().then(async()=>{const zl=[];for(const Wl of Gl){const Kl=await Wl.key,su=await Wl.value;zl.push({key:Kl,value:su,alwaysSet:Wl.alwaysSet})}return zl}).then(zl=>ParseStatus.mergeObjectSync(ma,zl)):ParseStatus.mergeObjectSync(ma,Gl)}get shape(){return this._def.shape()}strict(ha){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...ha!==void 0?{errorMap:(ma,ja)=>{const La=this._def.errorMap?.(ma,ja).message??ja.defaultError;return ma.code==="unrecognized_keys"?{message:errorUtil.errToObj(ha).message??La}:{message:La}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(ha){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...ha})})}merge(ha){return new ZodObject({unknownKeys:ha._def.unknownKeys,catchall:ha._def.catchall,shape:()=>({...this._def.shape(),...ha._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(ha,ma){return this.augment({[ha]:ma})}catchall(ha){return new ZodObject({...this._def,catchall:ha})}pick(ha){const ma={};for(const ja of util$1$1.objectKeys(ha))ha[ja]&&this.shape[ja]&&(ma[ja]=this.shape[ja]);return new ZodObject({...this._def,shape:()=>ma})}omit(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape))ha[ja]||(ma[ja]=this.shape[ja]);return new ZodObject({...this._def,shape:()=>ma})}deepPartial(){return deepPartialify(this)}partial(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape)){const La=this.shape[ja];ha&&!ha[ja]?ma[ja]=La:ma[ja]=La.optional()}return new ZodObject({...this._def,shape:()=>ma})}required(ha){const ma={};for(const ja of util$1$1.objectKeys(this.shape))if(ha&&!ha[ja])ma[ja]=this.shape[ja];else{let La=this.shape[ja];for(;La instanceof ZodOptional;)La=La._def.innerType;ma[ja]=La}return new ZodObject({...this._def,shape:()=>ma})}keyof(){return createZodEnum(util$1$1.objectKeys(this.shape))}}ZodObject.create=(pa,ha)=>new ZodObject({shape:()=>pa,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});ZodObject.strictCreate=(pa,ha)=>new ZodObject({shape:()=>pa,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});ZodObject.lazycreate=(pa,ha)=>new ZodObject({shape:pa,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ha)});class ZodUnion extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja=this._def.options;function La(Ba){for(const Gl of Ba)if(Gl.result.status==="valid")return Gl.result;for(const Gl of Ba)if(Gl.result.status==="dirty")return ma.common.issues.push(...Gl.ctx.common.issues),Gl.result;const hl=Ba.map(Gl=>new ZodError(Gl.ctx.common.issues));return addIssueToContext(ma,{code:ZodIssueCode.invalid_union,unionErrors:hl}),INVALID}if(ma.common.async)return Promise.all(ja.map(async Ba=>{const hl={...ma,common:{...ma.common,issues:[]},parent:null};return{result:await Ba._parseAsync({data:ma.data,path:ma.path,parent:hl}),ctx:hl}})).then(La);{let Ba;const hl=[];for(const zl of ja){const Wl={...ma,common:{...ma.common,issues:[]},parent:null},Kl=zl._parseSync({data:ma.data,path:ma.path,parent:Wl});if(Kl.status==="valid")return Kl;Kl.status==="dirty"&&!Ba&&(Ba={result:Kl,ctx:Wl}),Wl.common.issues.length&&hl.push(Wl.common.issues)}if(Ba)return ma.common.issues.push(...Ba.ctx.common.issues),Ba.result;const Gl=hl.map(zl=>new ZodError(zl));return addIssueToContext(ma,{code:ZodIssueCode.invalid_union,unionErrors:Gl}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(pa,ha)=>new ZodUnion({options:pa,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(ha)});const getDiscriminator=pa=>pa instanceof ZodLazy?getDiscriminator(pa.schema):pa instanceof ZodEffects?getDiscriminator(pa.innerType()):pa instanceof ZodLiteral?[pa.value]:pa instanceof ZodEnum?pa.options:pa instanceof ZodNativeEnum?util$1$1.objectValues(pa.enum):pa instanceof ZodDefault?getDiscriminator(pa._def.innerType):pa instanceof ZodUndefined?[void 0]:pa instanceof ZodNull?[null]:pa instanceof ZodOptional?[void 0,...getDiscriminator(pa.unwrap())]:pa instanceof ZodNullable?[null,...getDiscriminator(pa.unwrap())]:pa instanceof ZodBranded||pa instanceof ZodReadonly?getDiscriminator(pa.unwrap()):pa instanceof ZodCatch?getDiscriminator(pa._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha);if(ma.parsedType!==ZodParsedType.object)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ma.parsedType}),INVALID;const ja=this.discriminator,La=ma.data[ja],Ba=this.optionsMap.get(La);return Ba?ma.common.async?Ba._parseAsync({data:ma.data,path:ma.path,parent:ma}):Ba._parseSync({data:ma.data,path:ma.path,parent:ma}):(addIssueToContext(ma,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[ja]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(ha,ma,ja){const La=new Map;for(const Ba of ma){const hl=getDiscriminator(Ba.shape[ha]);if(!hl.length)throw new Error(`A discriminator value for key \`${ha}\` could not be extracted from all schema options`);for(const Gl of hl){if(La.has(Gl))throw new Error(`Discriminator property ${String(ha)} has duplicate value ${String(Gl)}`);La.set(Gl,Ba)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:ha,options:ma,optionsMap:La,...processCreateParams(ja)})}}function mergeValues(pa,ha){const ma=getParsedType(pa),ja=getParsedType(ha);if(pa===ha)return{valid:!0,data:pa};if(ma===ZodParsedType.object&&ja===ZodParsedType.object){const La=util$1$1.objectKeys(ha),Ba=util$1$1.objectKeys(pa).filter(Gl=>La.indexOf(Gl)!==-1),hl={...pa,...ha};for(const Gl of Ba){const zl=mergeValues(pa[Gl],ha[Gl]);if(!zl.valid)return{valid:!1};hl[Gl]=zl.data}return{valid:!0,data:hl}}else if(ma===ZodParsedType.array&&ja===ZodParsedType.array){if(pa.length!==ha.length)return{valid:!1};const La=[];for(let Ba=0;Ba<pa.length;Ba++){const hl=pa[Ba],Gl=ha[Ba],zl=mergeValues(hl,Gl);if(!zl.valid)return{valid:!1};La.push(zl.data)}return{valid:!0,data:La}}else return ma===ZodParsedType.date&&ja===ZodParsedType.date&&+pa==+ha?{valid:!0,data:pa}:{valid:!1}}class ZodIntersection extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha),La=(Ba,hl)=>{if(isAborted(Ba)||isAborted(hl))return INVALID;const Gl=mergeValues(Ba.value,hl.value);return Gl.valid?((isDirty(Ba)||isDirty(hl))&&ma.dirty(),{status:ma.value,value:Gl.data}):(addIssueToContext(ja,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return ja.common.async?Promise.all([this._def.left._parseAsync({data:ja.data,path:ja.path,parent:ja}),this._def.right._parseAsync({data:ja.data,path:ja.path,parent:ja})]).then(([Ba,hl])=>La(Ba,hl)):La(this._def.left._parseSync({data:ja.data,path:ja.path,parent:ja}),this._def.right._parseSync({data:ja.data,path:ja.path,parent:ja}))}}ZodIntersection.create=(pa,ha,ma)=>new ZodIntersection({left:pa,right:ha,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(ma)});class ZodTuple extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.array)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:ja.parsedType}),INVALID;if(ja.data.length<this._def.items.length)return addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&ja.data.length>this._def.items.length&&(addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ma.dirty());const La=[...ja.data].map((Ba,hl)=>{const Gl=this._def.items[hl]||this._def.rest;return Gl?Gl._parse(new ParseInputLazyPath(ja,Ba,ja.path,hl)):null}).filter(Ba=>!!Ba);return ja.common.async?Promise.all(La).then(Ba=>ParseStatus.mergeArray(ma,Ba)):ParseStatus.mergeArray(ma,La)}get items(){return this._def.items}rest(ha){return new ZodTuple({...this._def,rest:ha})}}ZodTuple.create=(pa,ha)=>{if(!Array.isArray(pa))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:pa,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(ha)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.object)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ja.parsedType}),INVALID;const La=[],Ba=this._def.keyType,hl=this._def.valueType;for(const Gl in ja.data)La.push({key:Ba._parse(new ParseInputLazyPath(ja,Gl,ja.path,Gl)),value:hl._parse(new ParseInputLazyPath(ja,ja.data[Gl],ja.path,Gl)),alwaysSet:Gl in ja.data});return ja.common.async?ParseStatus.mergeObjectAsync(ma,La):ParseStatus.mergeObjectSync(ma,La)}get element(){return this._def.valueType}static create(ha,ma,ja){return ma instanceof ZodType?new ZodRecord({keyType:ha,valueType:ma,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ja)}):new ZodRecord({keyType:ZodString.create(),valueType:ha,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(ma)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.map)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:ja.parsedType}),INVALID;const La=this._def.keyType,Ba=this._def.valueType,hl=[...ja.data.entries()].map(([Gl,zl],Wl)=>({key:La._parse(new ParseInputLazyPath(ja,Gl,ja.path,[Wl,"key"])),value:Ba._parse(new ParseInputLazyPath(ja,zl,ja.path,[Wl,"value"]))}));if(ja.common.async){const Gl=new Map;return Promise.resolve().then(async()=>{for(const zl of hl){const Wl=await zl.key,Kl=await zl.value;if(Wl.status==="aborted"||Kl.status==="aborted")return INVALID;(Wl.status==="dirty"||Kl.status==="dirty")&&ma.dirty(),Gl.set(Wl.value,Kl.value)}return{status:ma.value,value:Gl}})}else{const Gl=new Map;for(const zl of hl){const Wl=zl.key,Kl=zl.value;if(Wl.status==="aborted"||Kl.status==="aborted")return INVALID;(Wl.status==="dirty"||Kl.status==="dirty")&&ma.dirty(),Gl.set(Wl.value,Kl.value)}return{status:ma.value,value:Gl}}}}ZodMap.create=(pa,ha,ma)=>new ZodMap({valueType:ha,keyType:pa,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(ma)});class ZodSet extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.parsedType!==ZodParsedType.set)return addIssueToContext(ja,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:ja.parsedType}),INVALID;const La=this._def;La.minSize!==null&&ja.data.size<La.minSize.value&&(addIssueToContext(ja,{code:ZodIssueCode.too_small,minimum:La.minSize.value,type:"set",inclusive:!0,exact:!1,message:La.minSize.message}),ma.dirty()),La.maxSize!==null&&ja.data.size>La.maxSize.value&&(addIssueToContext(ja,{code:ZodIssueCode.too_big,maximum:La.maxSize.value,type:"set",inclusive:!0,exact:!1,message:La.maxSize.message}),ma.dirty());const Ba=this._def.valueType;function hl(zl){const Wl=new Set;for(const Kl of zl){if(Kl.status==="aborted")return INVALID;Kl.status==="dirty"&&ma.dirty(),Wl.add(Kl.value)}return{status:ma.value,value:Wl}}const Gl=[...ja.data.values()].map((zl,Wl)=>Ba._parse(new ParseInputLazyPath(ja,zl,ja.path,Wl)));return ja.common.async?Promise.all(Gl).then(zl=>hl(zl)):hl(Gl)}min(ha,ma){return new ZodSet({...this._def,minSize:{value:ha,message:errorUtil.toString(ma)}})}max(ha,ma){return new ZodSet({...this._def,maxSize:{value:ha,message:errorUtil.toString(ma)}})}size(ha,ma){return this.min(ha,ma).max(ha,ma)}nonempty(ha){return this.min(1,ha)}}ZodSet.create=(pa,ha)=>new ZodSet({valueType:pa,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(ha)});class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(ha){const{ctx:ma}=this._processInputParams(ha);return this._def.getter()._parse({data:ma.data,path:ma.path,parent:ma})}}ZodLazy.create=(pa,ha)=>new ZodLazy({getter:pa,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(ha)});class ZodLiteral extends ZodType{_parse(ha){if(ha.data!==this._def.value){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{received:ma.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:ha.data}}get value(){return this._def.value}}ZodLiteral.create=(pa,ha)=>new ZodLiteral({value:pa,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(ha)});function createZodEnum(pa,ha){return new ZodEnum({values:pa,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(ha)})}class ZodEnum extends ZodType{_parse(ha){if(typeof ha.data!="string"){const ma=this._getOrReturnCtx(ha),ja=this._def.values;return addIssueToContext(ma,{expected:util$1$1.joinValues(ja),received:ma.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(ha.data)){const ma=this._getOrReturnCtx(ha),ja=this._def.values;return addIssueToContext(ma,{received:ma.data,code:ZodIssueCode.invalid_enum_value,options:ja}),INVALID}return OK(ha.data)}get options(){return this._def.values}get enum(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}get Values(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}get Enum(){const ha={};for(const ma of this._def.values)ha[ma]=ma;return ha}extract(ha,ma=this._def){return ZodEnum.create(ha,{...this._def,...ma})}exclude(ha,ma=this._def){return ZodEnum.create(this.options.filter(ja=>!ha.includes(ja)),{...this._def,...ma})}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(ha){const ma=util$1$1.getValidEnumValues(this._def.values),ja=this._getOrReturnCtx(ha);if(ja.parsedType!==ZodParsedType.string&&ja.parsedType!==ZodParsedType.number){const La=util$1$1.objectValues(ma);return addIssueToContext(ja,{expected:util$1$1.joinValues(La),received:ja.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||(this._cache=new Set(util$1$1.getValidEnumValues(this._def.values))),!this._cache.has(ha.data)){const La=util$1$1.objectValues(ma);return addIssueToContext(ja,{received:ja.data,code:ZodIssueCode.invalid_enum_value,options:La}),INVALID}return OK(ha.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(pa,ha)=>new ZodNativeEnum({values:pa,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(ha)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(ha){const{ctx:ma}=this._processInputParams(ha);if(ma.parsedType!==ZodParsedType.promise&&ma.common.async===!1)return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:ma.parsedType}),INVALID;const ja=ma.parsedType===ZodParsedType.promise?ma.data:Promise.resolve(ma.data);return OK(ja.then(La=>this._def.type.parseAsync(La,{path:ma.path,errorMap:ma.common.contextualErrorMap})))}}ZodPromise.create=(pa,ha)=>new ZodPromise({type:pa,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(ha)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha),La=this._def.effect||null,Ba={addIssue:hl=>{addIssueToContext(ja,hl),hl.fatal?ma.abort():ma.dirty()},get path(){return ja.path}};if(Ba.addIssue=Ba.addIssue.bind(Ba),La.type==="preprocess"){const hl=La.transform(ja.data,Ba);if(ja.common.async)return Promise.resolve(hl).then(async Gl=>{if(ma.value==="aborted")return INVALID;const zl=await this._def.schema._parseAsync({data:Gl,path:ja.path,parent:ja});return zl.status==="aborted"?INVALID:zl.status==="dirty"||ma.value==="dirty"?DIRTY(zl.value):zl});{if(ma.value==="aborted")return INVALID;const Gl=this._def.schema._parseSync({data:hl,path:ja.path,parent:ja});return Gl.status==="aborted"?INVALID:Gl.status==="dirty"||ma.value==="dirty"?DIRTY(Gl.value):Gl}}if(La.type==="refinement"){const hl=Gl=>{const zl=La.refinement(Gl,Ba);if(ja.common.async)return Promise.resolve(zl);if(zl instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Gl};if(ja.common.async===!1){const Gl=this._def.schema._parseSync({data:ja.data,path:ja.path,parent:ja});return Gl.status==="aborted"?INVALID:(Gl.status==="dirty"&&ma.dirty(),hl(Gl.value),{status:ma.value,value:Gl.value})}else return this._def.schema._parseAsync({data:ja.data,path:ja.path,parent:ja}).then(Gl=>Gl.status==="aborted"?INVALID:(Gl.status==="dirty"&&ma.dirty(),hl(Gl.value).then(()=>({status:ma.value,value:Gl.value}))))}if(La.type==="transform")if(ja.common.async===!1){const hl=this._def.schema._parseSync({data:ja.data,path:ja.path,parent:ja});if(!isValid(hl))return INVALID;const Gl=La.transform(hl.value,Ba);if(Gl instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:ma.value,value:Gl}}else return this._def.schema._parseAsync({data:ja.data,path:ja.path,parent:ja}).then(hl=>isValid(hl)?Promise.resolve(La.transform(hl.value,Ba)).then(Gl=>({status:ma.value,value:Gl})):INVALID);util$1$1.assertNever(La)}}ZodEffects.create=(pa,ha,ma)=>new ZodEffects({schema:pa,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:ha,...processCreateParams(ma)});ZodEffects.createWithPreprocess=(pa,ha,ma)=>new ZodEffects({schema:ha,effect:{type:"preprocess",transform:pa},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(ma)});class ZodOptional extends ZodType{_parse(ha){return this._getType(ha)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(ha)}unwrap(){return this._def.innerType}}ZodOptional.create=(pa,ha)=>new ZodOptional({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(ha)});class ZodNullable extends ZodType{_parse(ha){return this._getType(ha)===ZodParsedType.null?OK(null):this._def.innerType._parse(ha)}unwrap(){return this._def.innerType}}ZodNullable.create=(pa,ha)=>new ZodNullable({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(ha)});class ZodDefault extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha);let ja=ma.data;return ma.parsedType===ZodParsedType.undefined&&(ja=this._def.defaultValue()),this._def.innerType._parse({data:ja,path:ma.path,parent:ma})}removeDefault(){return this._def.innerType}}ZodDefault.create=(pa,ha)=>new ZodDefault({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof ha.default=="function"?ha.default:()=>ha.default,...processCreateParams(ha)});class ZodCatch extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja={...ma,common:{...ma.common,issues:[]}},La=this._def.innerType._parse({data:ja.data,path:ja.path,parent:{...ja}});return isAsync(La)?La.then(Ba=>({status:"valid",value:Ba.status==="valid"?Ba.value:this._def.catchValue({get error(){return new ZodError(ja.common.issues)},input:ja.data})})):{status:"valid",value:La.status==="valid"?La.value:this._def.catchValue({get error(){return new ZodError(ja.common.issues)},input:ja.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(pa,ha)=>new ZodCatch({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof ha.catch=="function"?ha.catch:()=>ha.catch,...processCreateParams(ha)});class ZodNaN extends ZodType{_parse(ha){if(this._getType(ha)!==ZodParsedType.nan){const ma=this._getOrReturnCtx(ha);return addIssueToContext(ma,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:ma.parsedType}),INVALID}return{status:"valid",value:ha.data}}}ZodNaN.create=pa=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(pa)});class ZodBranded extends ZodType{_parse(ha){const{ctx:ma}=this._processInputParams(ha),ja=ma.data;return this._def.type._parse({data:ja,path:ma.path,parent:ma})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(ha){const{status:ma,ctx:ja}=this._processInputParams(ha);if(ja.common.async)return(async()=>{const La=await this._def.in._parseAsync({data:ja.data,path:ja.path,parent:ja});return La.status==="aborted"?INVALID:La.status==="dirty"?(ma.dirty(),DIRTY(La.value)):this._def.out._parseAsync({data:La.value,path:ja.path,parent:ja})})();{const La=this._def.in._parseSync({data:ja.data,path:ja.path,parent:ja});return La.status==="aborted"?INVALID:La.status==="dirty"?(ma.dirty(),{status:"dirty",value:La.value}):this._def.out._parseSync({data:La.value,path:ja.path,parent:ja})}}static create(ha,ma){return new ZodPipeline({in:ha,out:ma,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(ha){const ma=this._def.innerType._parse(ha),ja=La=>(isValid(La)&&(La.value=Object.freeze(La.value)),La);return isAsync(ma)?ma.then(La=>ja(La)):ja(ma)}unwrap(){return this._def.innerType}}ZodReadonly.create=(pa,ha)=>new ZodReadonly({innerType:pa,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(ha)});var ZodFirstPartyTypeKind;(function(pa){pa.ZodString="ZodString",pa.ZodNumber="ZodNumber",pa.ZodNaN="ZodNaN",pa.ZodBigInt="ZodBigInt",pa.ZodBoolean="ZodBoolean",pa.ZodDate="ZodDate",pa.ZodSymbol="ZodSymbol",pa.ZodUndefined="ZodUndefined",pa.ZodNull="ZodNull",pa.ZodAny="ZodAny",pa.ZodUnknown="ZodUnknown",pa.ZodNever="ZodNever",pa.ZodVoid="ZodVoid",pa.ZodArray="ZodArray",pa.ZodObject="ZodObject",pa.ZodUnion="ZodUnion",pa.ZodDiscriminatedUnion="ZodDiscriminatedUnion",pa.ZodIntersection="ZodIntersection",pa.ZodTuple="ZodTuple",pa.ZodRecord="ZodRecord",pa.ZodMap="ZodMap",pa.ZodSet="ZodSet",pa.ZodFunction="ZodFunction",pa.ZodLazy="ZodLazy",pa.ZodLiteral="ZodLiteral",pa.ZodEnum="ZodEnum",pa.ZodEffects="ZodEffects",pa.ZodNativeEnum="ZodNativeEnum",pa.ZodOptional="ZodOptional",pa.ZodNullable="ZodNullable",pa.ZodDefault="ZodDefault",pa.ZodCatch="ZodCatch",pa.ZodPromise="ZodPromise",pa.ZodBranded="ZodBranded",pa.ZodPipeline="ZodPipeline",pa.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const stringType=ZodString.create,numberType=ZodNumber.create,booleanType=ZodBoolean.create,anyType=ZodAny.create;ZodNever.create;const arrayType=ZodArray.create,objectType=ZodObject.create;ZodUnion.create;const discriminatedUnionType=ZodDiscriminatedUnion.create;ZodIntersection.create;ZodTuple.create;const recordType=ZodRecord.create,literalType=ZodLiteral.create;ZodEnum.create;ZodPromise.create;ZodOptional.create;ZodNullable.create;objectType({service:objectType({port:numberType(),host:stringType().optional(),httpFileHandling:booleanType().default(!1)}).default({port:8080,host:"localhost",httpFileHandling:!1}),store:discriminatedUnionType("type",[objectType({type:literalType("postgres"),host:stringType().default("localhost"),username:stringType().default("postgres"),password:stringType().default("postgres"),dbname:stringType().default("postgres"),port:numberType().default(5432)}),objectType({type:literalType("mysql"),host:stringType().default("localhost"),username:stringType().default("mysql"),password:stringType().default("mysql"),dbname:stringType().default("mysql"),port:numberType().default(3306)}),objectType({type:literalType("sqlite"),dbname:stringType().optional()})]).optional(),integrations:objectType({host:stringType(),username:stringType().optional(),password:stringType().optional(),connections:recordType(stringType(),stringType())}).optional(),graphql:objectType({enabled:booleanType().default(!1)}).optional(),rbac:objectType({enabled:booleanType().default(!1),roles:arrayType(stringType()).optional()}).optional(),auth:objectType({enabled:booleanType().default(!1)}).optional(),auditTrail:objectType({enabled:booleanType().default(!1)}).optional(),monitoring:objectType({enabled:booleanType().default(!1)}).optional(),authentication:discriminatedUnionType("service",[objectType({service:literalType("okta"),superuserEmail:stringType(),domain:stringType(),cookieDomain:stringType().optional(),authServer:stringType().default("default"),clientSecret:stringType(),apiToken:stringType(),scope:stringType().default("openid offline_access"),cookieTtlMs:numberType().default(12096e5),introspect:booleanType().default(!0),authorizeRedirectUrl:stringType(),clientUrl:stringType(),roleClaim:stringType().default("roles"),defaultRole:stringType().default("user"),clientId:stringType()}),objectType({service:literalType("cognito"),superuserEmail:stringType(),superuserPassword:stringType().optional(),isIdentityStore:booleanType().default(!1),userPoolId:stringType(),clientId:stringType(),whitelistEnabled:booleanType().default(!1),disableUserSessions:booleanType().default(!1)})]).optional(),openapi:arrayType(objectType({specUrl:stringType(),baseUrl:stringType().optional(),name:stringType()})).optional()});function isMonitoringEnabled(){var pa;return((pa=void 0)===null||pa===void 0?void 0:pa.enabled)===!0}const AdminUserId="00000000-0000-0000-0000-000000000000";function isAuthEnabled(){var pa;return((pa=void 0)===null||pa===void 0?void 0:pa.enabled)==!0}function isRbacEnabled(){var pa;return isAuthEnabled()&&((pa=void 0)===null||pa===void 0?void 0:pa.enabled)==!0}const AdminSession={sessionId:crypto.randomUUID(),userId:AdminUserId},LocalEnv=new Map;function getLocalEnv$1(pa){return LocalEnv.get(pa)}const PathAttributeName="__path__",PathAttributeNameQuery="__path__?",ParentAttributeName="__parent__",DeletedFlagAttributeName="__is_deleted__";function asUnauthMessage(pa){return typeof pa=="string"?pa:`User not authorised to perform '${pa.opr}' on ${pa.entity}`}class UnauthorisedError extends Error{constructor(ha,ma){super(ha?asUnauthMessage(ha):"User not authorised to perform this operation",ma)}}let BadRequestError$2=class extends Error{constructor(pa,ha){super(pa?asUnauthMessage(pa):"BadRequest",ha)}};class UserNotFoundError extends Error{constructor(ha,ma){super(ha||"User not found",ma)}}class UserNotConfirmedError extends Error{constructor(ha,ma){super(ha||"User account is not confirmed. Please check your email for verification code.",ma)}}class PasswordResetRequiredError extends Error{constructor(ha,ma){super(ha||"Password reset is required for this account",ma)}}class TooManyRequestsError extends Error{constructor(ha,ma){super(ha||"Too many requests. Please try again later.",ma)}}class InvalidParameterError extends Error{constructor(ha,ma){super(ha||"Invalid parameters provided",ma)}}class ExpiredCodeError extends Error{constructor(ha,ma){super(ha||"The verification code has expired. Please request a new one.",ma)}}class CodeMismatchError extends Error{constructor(ha,ma){super(ha||"The verification code is incorrect. Please try again.",ma)}}let FetchModuleFn;function setModuleFnFetcher(pa){FetchModuleFn=pa}const ForceReadPermFlag="f-r-f",FlowSuspensionTag="--";var SubGraphType;(function(pa){pa[pa.EVENT=0]="EVENT",pa[pa.IF=1]="IF",pa[pa.FOR_EACH=2]="FOR_EACH",pa[pa.DELETE=3]="DELETE",pa[pa.PURGE=4]="PURGE",pa[pa.RETURN=5]="RETURN",pa[pa.AGENT=6]="AGENT",pa[pa.NONE=7]="NONE"})(SubGraphType||(SubGraphType={}));class ExecGraph{static isEmpty(ha){return Object.is(ExecGraph.Empty,ha)}constructor(){this.parentGraph=void 0,this.hasAgentsFlag=!1,this.loopBody=!1,this.rootNodes=new Array,this.subGraphs=new Array}pushNode(ha){return this.rootNodes.push(ha),this}pushSubGraph(ha){return ha.parentGraph=this,this.subGraphs.push(ha),this}getSubGraphsLength(){return this.subGraphs.length}getLastSubGraphIndex(){return this.subGraphs.length-1}fetchSubGraphAt(ha){if(ha<0||ha>=this.subGraphs.length)throw new Error(`Invalid sub-graph index: ${ha}`);return this.subGraphs[ha]}fetchForEachBodySubGraph(){return this.fetchSubGraphAt(this.subGraphs.length-1)}fetchIfConsequentSubGraph(){return this.subGraphs.length>=2?this.fetchSubGraphAt(this.subGraphs.length-2):this.fetchSubGraphAt(this.subGraphs.length-1)}fetchIfAlternativeSubGraph(){if(this.subGraphs.length>=2)return this.fetchSubGraphAt(this.subGraphs.length-1)}getRootNodes(){return this.rootNodes}setActiveModuleName(ha){return ha&&(this.activeModuleName=ha),this}getActiveModuleName(){return this.activeModuleName}getParentGraph(){return this.parentGraph}setEventName(ha){return ha!==void 0&&(this.eventName=ha),this}getEventName(){return this.eventName}setHasAgents(ha){return this.hasAgentsFlag=ha,this.parentGraph&&this.parentGraph.setHasAgents(ha),this}hasAgents(){return this.hasAgentsFlag}canCache(){return!this.hasAgentsFlag}setIsLoopBody(){return this.loopBody=!0,this}isLoopBody(){return this.loopBody}asObject(){const ha=new Array;return this.rootNodes.forEach(ma=>{var ja;const La=ma.asObject();if(ma.subGraphIndex>=0){const Ba=this.subGraphs[ma.subGraphIndex],hl=Ba.asObject();if(ma.subGraphType==SubGraphType.FOR_EACH){const Gl=ma.code;La.var=(ja=Gl.pattern.forEach)===null||ja===void 0?void 0:ja.var,La.source=hl,La.body=Ba.fetchForEachBodySubGraph().asObject()}else if(ma.subGraphType==SubGraphType.IF){La.condition=hl,La.body=Ba.fetchIfConsequentSubGraph().asObject();const Gl=Ba.fetchIfAlternativeSubGraph();Gl&&(La.else=Gl.asObject())}else La.subGraph=hl}ha.push(La)}),ha}}ExecGraph.Empty=new ExecGraph;var RuntimeModeTag;(function(pa){pa[pa.DEV=0]="DEV",pa[pa.PROD=1]="PROD",pa[pa.INIT_SCHEMA=2]="INIT_SCHEMA",pa[pa.RUN_MIGRATION=3]="RUN_MIGRATION",pa[pa.UNDO_MIGRATION=4]="UNDO_MIGRATION",pa[pa.GENERATE_MIGRATION=5]="GENERATE_MIGRATION"})(RuntimeModeTag||(RuntimeModeTag={}));RuntimeModeTag.DEV;let DailyRotateFile,winston;isNodeEnv&&(await __vitePreload(()=>import("./index-D4z_hbl0-BUXHDjnp.js"),__vite__mapDeps([12,11,13,1,3,9,5,14,15,16,17,18,19,10,20,21,4])).then(pa=>pa.i).then(pa=>{DailyRotateFile=pa.default}),await __vitePreload(()=>import("./winston-CtxF18qc-DJ5_vcVM.js"),__vite__mapDeps([22,11,13,1,3,9,5,14,15,16,18,19,10,20,21,17,4])).then(pa=>pa.w).then(pa=>{winston=pa.default}));let logger$1;if(isNodeEnv){const pa=new DailyRotateFile({level:"debug",filename:"logs/app-%DATE%.log",datePattern:"YYYY-MM-DD",maxSize:"20m",maxFiles:"7d"});logger$1=winston.createLogger({format:winston.format.combine(winston.format.timestamp(),winston.format.printf(({timestamp:ha,level:ma,message:ja})=>`[${ha}] ${ma}: ${ja}`)),transports:[pa]})}else{let pa=function(ha){return ma=>{console.log(`${ha}: ${ma}`)}};logger$1={debug:pa("DEBUG"),info:pa("INFO"),warn:pa("WARN"),error:pa("ERROR")}}const PlannerInstructions=`Agentlang is a very-high-level declarative language that makes it easy to define business applications as 'models'.
|
|
14876
14876
|
The model of a business application consists of entity definitions and workflows defined in "modules".
|
|
14877
14877
|
A module is be encoded in a syntax inspired by JavaScript and JSON. Example of a simple module follows:
|
|
14878
14878
|
|
|
@@ -16087,7 +16087,7 @@ ${Mg}`),Gl=`${Gl}
|
|
|
16087
16087
|
${hl} --> ${Mg}
|
|
16088
16088
|
`,ou?hl=await preprocessStep(Mg.trim(),ja):(ja.setFlowContext(Gl),await agentInvoke(ha,`${Ba}
|
|
16089
16089
|
${Gl}`,ja),hl=await preprocessStep(ja.getLastResult().trim(),ja))}}finally{ja.decrementMonitor().revokeLastResult().setMonitorFlowResult()}console.debug(`No more flow steps, completed iteration ${Wl} on flow:
|
|
16090
|
-
${pa}`)}async function preprocessStep(pa,ha){if(pa.startsWith("{")){const ja=(await parseStatement$1(pa)).pattern.crudMap;if(ja){ha.resetTemplateMappings();const La=ja.name;return ja.body&&ja.body.attributes.forEach(Ba=>{var hl;const Gl=(hl=Ba.value.$cstNode)===null||hl===void 0?void 0:hl.text;Gl&&ha.setTemplateMapping(Ba.name,Gl)}),La}else throw new Error(`Invalid step - ${pa}`)}else return pa}async function handleOpenApiEvent(pa,ha){const ma=await invokeOpenApiEvent(pa.moduleName,pa.name,pa.attributesAsObject());ha.setLastResult(ma)}async function evaluateUpsert(pa,ha){ha.setInUpsertMode(!0);try{await evaluateCrudMap(pa,ha)}finally{ha.setInUpsertMode(!1)}}async function evaluateForEach(pa,ha){const ma=pa.var;await evaluatePattern(pa.src,ha);const ja=ha.getLastResult();if(ja instanceof Array&&ja.length>0){const La=Environment.from(ha),Ba=new Array;for(let hl=0;hl<ja.length;++hl)La.bind(ma,ja[hl]),await evaluateStatements(pa.statements,La),Ba.push(La.getLastResult());ha.setLastResult(Ba)}else ha.setLastResult(EmptyResult)}async function evaluateIf(pa,ha){await evaluateExpression(pa.cond,ha),ha.getLastResult()?await evaluateStatements(pa.statements,ha):pa.else!==void 0&&await evaluateStatements(pa.else.statements,ha)}async function evaluateDeleteHelper(pa,ha,ma){const ja=Environment.from(ma).setInDeleteMode(!0);await evaluatePattern(pa,ja),await maybeDeleteQueriedInstances(ja,ma,ha)}async function maybeDeleteQueriedInstances(pa,ha,ma=!1){const ja=pa.getLastResult();let La=Resolver.Default;if(ja instanceof Array)if(ja.length>0){La=await getResolverForPath(ja[0].name,ja[0].moduleName,pa);const Ba=new Array;for(let hl=0;hl<ja.length;++hl){await runPreDeleteEvents(ja[hl],ha);const Gl=await La.deleteInstance(ja[hl],ma);await runPostDeleteEvents(ja[hl],ha),Ba.push(Gl)}pa.setLastResult(Ba)}else pa.setLastResult(ja);else{La=await getResolverForPath(ja.name,ja.moduleName,pa),await runPreDeleteEvents(ja,ha);const Ba=await La.deleteInstance(ja,ma);await runPostDeleteEvents(ja,ha),pa.setLastResult(Ba)}ha.setLastResult(pa.getLastResult())}async function evaluateDelete(pa,ha){await evaluateDeleteHelper(pa.pattern,!1,ha)}async function evaluatePurge(pa,ha){await evaluateDeleteHelper(pa.pattern,!0,ha)}async function evaluateExpression(pa,ha){let ma=EmptyResult;if(isBinExpr$1(pa)){await evaluateExpression(pa.e1,ha);const ja=ha.getLastResult();if(pa.op=="or"){if(ja)return;await evaluateExpression(pa.e2,ha);return}else if(pa.op=="and"){if(!ja)return;await evaluateExpression(pa.e2,ha);return}if(ja==null){ha.setLastResult(void 0);return}await evaluateExpression(pa.e2,ha);const La=ha.getLastResult();if(La==null){ha.setLastResult(void 0);return}switch(pa.op){case"+":ma=ja+La;break;case"-":ma=ja-La;break;case"*":ma=ja*La;break;case"/":ma=ja/La;break;case"==":ma=ja==La;break;case"<":ma=ja<La;break;case">":ma=ja>La;break;case"<=":ma=ja<=La;break;case">=":ma=ja>=La;break;case"<>":case"!=":ma=ja!=La;break;case"like":ma=ja.startsWith(La);break;case"in":ma=La.find(Ba=>{});break;default:throw new Error(`Unrecognized binary operator: ${pa.op}`)}}else if(isNegExpr$1(pa))await evaluateExpression(pa.ne,ha),ma=-1*ha.getLastResult();else if(isGroup$2(pa))await evaluateExpression(pa.ge,ha),ma=ha.getLastResult();else if(isLiteral$1(pa)){await evaluateLiteral(pa,ha);return}else isNotExpr$1(pa)&&(await evaluateExpression(pa.ne,ha),ma=!ha.getLastResult());ha.setLastResult(ma)}async function getRef(pa,ha,ma){return Instance$1.IsInstance(ha)?ha.lookup(pa):ha instanceof Map?ha.get(pa):ha instanceof Object?ha[pa]:isPath$1(ha)?await getRef(pa,await dereferencePath(ha,ma),ma):void 0}async function followReference(pa,ha){const ma=splitRefs$1(ha);let ja=EmptyResult,La=pa;for(let Ba=0;Ba<ma.length;++Ba){const hl=ma[Ba],Gl=await getRef(hl,La,pa);if(Gl===void 0)return EmptyResult;ja=Gl,La=ja}return ja}async function dereferencePath(pa,ha){const ma=fqNameFromPath$1(pa);if(ma===void 0)throw new Error(`Failed to deduce entry-name from path - ${pa}`);const ja=new Environment("path-deref",ha);await parseAndEvaluateStatement(`{${ma} {${PathAttributeNameQuery$1} "${pa}"}}`,ha.getAuthContextUserId(),ja);const La=ja.getLastResult();if(La&&La instanceof Array&&La.length>0)return La[0]}async function applyFn(pa,ha,ma){const ja=pa.name;if(ja!==void 0){let La=null;if(pa.args!==void 0){La=new Array;for(let hl=0;hl<pa.args.length;++hl){const Gl=pa.args[hl];isLiteral$1(Gl)?await evaluateLiteral(Gl,ha):await evaluateExpression(Gl,ha),La.push(ha.getLastResult())}La.push(ha)}const Ba=await invokeModuleFn(ja,La,ma);ha.setLastResult(Ba)}}async function realizeArray(pa,ha){const ma=new Array;for(let ja=0;ja<pa.vals.length;++ja)await evaluateStatement(pa.vals[ja],ha),ma.push(ha.getLastResult());ha.setLastResult(ma)}async function realizeMap(pa,ha){const ma=new Map;for(let ja=0;ja<pa.entries.length;++ja){const La=pa.entries[ja],Ba=getMapKey(La.key);await evaluateExpression(La.value,ha),ma.set(Ba,ha.getLastResult())}ha.setLastResult(Object.fromEntries(ma.entries()))}async function callPostEventOnSubscription(pa,ha,ma){const ja=ma===void 0,La=new Environment("onSubs.env");try{return await runPrePostEvents(pa,!1,ha,La),ja&&await La.commitAllTransactions(),La.getLastResult()}catch(Ba){await La.rollbackAllTransactions(),logger$3.error(`callPostEventOnSubscription failed for ${pa} ${ha.getFqName()} - ${Ba}`)}}async function runPrePostEvents(pa,ha,ma,ja){const La=ha?ma.record.getPreTriggerInfo(pa):ma.record.getPostTriggerInfo(pa);if(La){const Ba=nameToPath$1(La.eventName),hl=Ba.hasModule()?Ba.getModuleName():ma.record.moduleName,Gl=makeInstance$1(hl,Ba.getEntryName(),newInstanceAttributes$1().set(ma.record.name,ma)),zl=ja.getActiveAuthContext();zl&&Gl.setAuthContext(zl);const Wl=`${ha?"Pre":"Post"}-${CrudType$1[pa]} ${ma.record.getFqName()}`,Kl=au=>{logger$3.debug(`${Wl}: ${au}`)},su=au=>{throw ja.hasHandlers()?au:new Error(`${Wl}: ${au}`)};La.async?evaluate$1(Gl,Kl,bindAliasesForPrePost(ja,ma,Wl)).catch(su):await evaluate$1(Gl,Kl,bindAliasesForPrePost(ja,ma,Wl)).catch(su)}}function bindAliasesForPrePost(pa,ha,ma){const ja=new Environment(`${ma}.env`,pa),La=ha.getFqName();return ja.bind("this",ha),ja.bind(La,ha),ja.bind(ha.name,ha),ja}async function runPreCreateEvents(pa,ha){await runPrePostEvents(CrudType$1.CREATE,!0,pa,ha)}async function runPostCreateEvents(pa,ha){pa.requireAudit()&&await addCreateAudit(pa.getPath(),ha),await runPrePostEvents(CrudType$1.CREATE,!1,pa,ha)}async function runPreUpdateEvents(pa,ha){await runPrePostEvents(CrudType$1.UPDATE,!0,pa,ha)}async function runPostUpdateEvents(pa,ha,ma){pa.requireAudit()&&await addUpdateAudit(pa.getPath(),ha,ma),await runPrePostEvents(CrudType$1.UPDATE,!1,pa,ma)}async function runPreDeleteEvents(pa,ha){await runPrePostEvents(CrudType$1.DELETE,!0,pa,ha)}async function runPostDeleteEvents(pa,ha){pa.requireAudit()&&await addDeleteAudit(pa.getPath(),pa,ha),await runPrePostEvents(CrudType$1.DELETE,!1,pa,ha)}const interpreter=Object.freeze(Object.defineProperty({__proto__:null,DocEventName,Environment,GlobalEnvironment,PatternHandler,callPostEventOnSubscription,evaluate:evaluate$1,evaluateAsEvent,evaluateExpression,evaluatePattern,evaluateStatement,evaluateStatements,handleAgentInvocation,handleOpenApiEvent,makeEventEvaluator,maybeBindStatementResultToAlias,maybeDeleteQueriedInstances,parseAndEvaluateStatement,restartFlow,runPostCreateEvents,runPostDeleteEvents,runPostUpdateEvents},Symbol.toStringTag,{value:"Module"}));class JwtBaseError extends Error{}class FailedAssertionError extends JwtBaseError{constructor(ha,ma,ja){super(ha),this.failedAssertion={actual:ma,expected:ja}}}class JwtParseError extends JwtBaseError{constructor(ha,ma){const ja=ma!=null?`${ha}: ${ma}`:ha;super(ja)}}class ParameterValidationError extends JwtBaseError{}class JwtInvalidSignatureError extends JwtBaseError{}class JwtInvalidSignatureAlgorithmError extends FailedAssertionError{}class JwtInvalidClaimError extends FailedAssertionError{withRawJwt({header:ha,payload:ma}){return this.rawJwt={header:ha,payload:ma},this}}class JwtInvalidIssuerError extends JwtInvalidClaimError{}class JwtInvalidAudienceError extends JwtInvalidClaimError{}class JwtInvalidScopeError extends JwtInvalidClaimError{}class JwtExpiredError extends JwtInvalidClaimError{}class JwtNotBeforeError extends JwtInvalidClaimError{}class CognitoJwtInvalidGroupError extends JwtInvalidClaimError{}class CognitoJwtInvalidTokenUseError extends JwtInvalidClaimError{}class CognitoJwtInvalidClientIdError extends JwtInvalidClaimError{}class JwksValidationError extends JwtBaseError{}class JwkValidationError extends JwtBaseError{}class JwtWithoutValidKidError extends JwtBaseError{}class KidNotFoundInJwksError extends JwtBaseError{}class WaitPeriodNotYetEndedJwkError extends JwtBaseError{}class JwksNotAvailableInCacheError extends JwtBaseError{}class JwkInvalidUseError extends FailedAssertionError{}class JwkInvalidKtyError extends FailedAssertionError{}class FetchError extends JwtBaseError{constructor(ha,ma){super(`Failed to fetch ${ha}: ${ma}`)}}class NonRetryableFetchError extends FetchError{}class NotSupportedError extends JwtBaseError{}var NamedCurvesWebCrypto;(function(pa){pa.ES256="P-256",pa.ES384="P-384",pa.ES512="P-521"})(NamedCurvesWebCrypto||(NamedCurvesWebCrypto={}));const nodeWebCompat={fetch:async(pa,ha,ma)=>{const ja=Number(ha?.responseTimeout);if(ja){const Ba=new AbortController;setTimeout(()=>Ba.abort(new FetchError(pa,`Response time-out (after ${ja} ms.)`)),ja),ha={signal:Ba.signal,...ha}}const La=await fetch(pa,{...ha,body:ma}).catch(Ba=>{throw new FetchError(pa,Ba.message)});if(La.status!==200)throw new NonRetryableFetchError(pa,`Status code is ${La.status}, expected 200`);return La.arrayBuffer()},defaultFetchTimeouts:{response:3e3},transformJwkToKeyObjectSync:()=>{throw new NotSupportedError("Synchronously transforming a JWK into a key object is not supported in the browser")},transformJwkToKeyObjectAsync:(pa,ha)=>{const ma=pa.alg??ha;if(!ma)throw new JwtInvalidSignatureAlgorithmError("Missing alg on both JWK and JWT header",ma);const ja=ma.startsWith("RS")?{name:"RSASSA-PKCS1-v1_5",hash:`SHA-${ma.slice(2)}`}:ma.startsWith("ES")?{name:"ECDSA",namedCurve:NamedCurvesWebCrypto[ma]}:pa.crv;return crypto.subtle.importKey("jwk",pa,ja,!1,["verify"]).then(La=>({key:La,jwk:pa}))},verifySignatureSync:()=>{throw new NotSupportedError("Synchronously verifying a JWT signature is not supported in the browser")},verifySignatureAsync:({jwsSigningInput:pa,keyObject:ha,signature:ma,alg:ja})=>crypto.subtle.verify(ja.startsWith("RS")?{name:"RSASSA-PKCS1-v1_5"}:ja.startsWith("ES")?{name:"ECDSA",hash:`SHA-${ja.slice(2)}`}:{name:ha.jwk.crv},ha.key,bufferFromBase64url(ma),new TextEncoder().encode(pa)),parseB64UrlString:pa=>new TextDecoder().decode(bufferFromBase64url(pa)),setTimeoutUnref:setTimeout.bind(void 0),transformPemToJwk:async(pa,ha)=>{let ma;switch(ha){case"RS256":case"RS384":case"RS512":ma={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${ha.slice(2)}`};break;case"ES256":case"ES384":case"ES512":ma={name:"ECDSA",namedCurve:NamedCurvesWebCrypto[ha]};break;default:throw new JwtInvalidSignatureAlgorithmError("Unsupported signature algorithm",ha)}const ja=await crypto.subtle.importKey("spki",bufferFromBase64(new TextDecoder().decode(pa).replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,"")),ma,!0,["verify"]);return crypto.subtle.exportKey("jwk",ja)}};function _bufferFromBase64(pa){const ha=pa.split("").reduce((ma,ja,La)=>Object.assign(ma,{[ja.charCodeAt(0)]:La}),{});return function(ma){ma=ma.replace(/={1,2}$/,"");let ja,La,Ba,hl;return ma.match(/.{1,4}/g).reduce((Gl,zl,Wl)=>(ja=ha[zl.charCodeAt(0)],La=ha[zl.charCodeAt(1)],Ba=ha[zl.charCodeAt(2)],hl=ha[zl.charCodeAt(3)],Gl[3*Wl]=ja<<2|La>>4,Gl[3*Wl+1]=(La&15)<<4|Ba>>2,Gl[3*Wl+2]=(Ba&3)<<6|hl,Gl),new Uint8Array(ma.length*3/4))}}const bufferFromBase64url=_bufferFromBase64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),bufferFromBase64=_bufferFromBase64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),fetch$1=nodeWebCompat.fetch.bind(void 0);class SimpleFetcher{constructor(ha){this.defaultRequestOptions={timeout:nodeWebCompat.defaultFetchTimeouts.socketIdle,responseTimeout:nodeWebCompat.defaultFetchTimeouts.response,...ha?.defaultRequestOptions}}async fetch(ha,ma,ja){ma={...this.defaultRequestOptions,...ma};try{return await fetch$1(ha,ma,ja)}catch(La){if(La instanceof NonRetryableFetchError)throw La;return fetch$1(ha,ma,ja)}}}function isJsonObject(pa){return typeof pa=="object"&&!Array.isArray(pa)&&pa!==null}function safeJsonParse(pa){return JSON.parse(pa,(ha,ma)=>(typeof ma=="object"&&!Array.isArray(ma)&&ma!==null&&(delete ma.__proto__,delete ma.constructor),ma))}function assertStringEquals(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. Expected: ${ma}`,ha,ma);if(typeof ha!="string")throw new ja(`${pa} is not of type string`,ha,ma);if(ma!==ha)throw new ja(`${pa} not allowed: ${ha}. Expected: ${ma}`,ha,ma)}function assertStringArrayContainsString(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. ${expectationMessage(ma)}`,ha,ma);if(typeof ha!="string")throw new ja(`${pa} is not of type string`,ha,ma);return assertStringArraysOverlap(pa,ha,ma,ja)}function assertStringArraysOverlap(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. ${expectationMessage(ma)}`,ha,ma);const La=new Set(Array.isArray(ma)?ma:[ma]);if(typeof ha=="string"&&(ha=[ha]),!Array.isArray(ha))throw new ja(`${pa} is not an array`,ha,ma);if(!ha.some(hl=>{if(typeof hl!="string")throw new ja(`${pa} includes elements that are not of type string`,ha,ma);return La.has(hl)}))throw new ja(`${pa} not allowed: ${ha.join(", ")}. ${expectationMessage(ma)}`,ha,ma)}function expectationMessage(pa){return Array.isArray(pa)?pa.length>1?`Expected one of: ${pa.join(", ")}`:`Expected: ${pa[0]}`:`Expected: ${pa}`}function assertIsNotPromise(pa,ha){if(pa&&typeof pa.then=="function")throw ha()}const optionalJwkFieldNames=["use","alg","kid","n","e","x","y","crv"],mandatoryJwkFieldNames=["kty"];function findJwkInJwks(pa,ha){return pa.keys.find(ma=>ma.kid!=null&&ma.kid===ha)}const parseJwks=function(pa){let ha;try{const ma=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(pa);ha=safeJsonParse(ma)}catch(ma){throw new JwksValidationError(`JWKS could not be parsed as JSON: ${ma}`)}return assertIsJwks(ha),ha};function assertIsJwks(pa){if(!pa)throw new JwksValidationError("JWKS empty");if(!isJsonObject(pa))throw new JwksValidationError("JWKS should be an object");if(!Object.keys(pa).includes("keys"))throw new JwksValidationError("JWKS does not include keys");if(!Array.isArray(pa.keys))throw new JwksValidationError("JWKS keys should be an array");for(const ha of pa.keys)assertIsJwk(ha)}function assertIsSignatureJwk(pa){assertStringArrayContainsString("JWK kty",pa.kty,["EC","RSA","OKP"],JwkInvalidKtyError),pa.kty==="EC"?assertIsEsSignatureJwk(pa):pa.kty==="RSA"?assertIsRsaSignatureJwk(pa):pa.kty==="OKP"&&assertIsEdDSASignatureJwk(pa)}function assertIsEdDSASignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"OKP",JwkInvalidKtyError),!pa.crv)throw new JwkValidationError("Missing Curve (crv)");if(!pa.x)throw new JwkValidationError("Missing X Coordinate (x)")}function assertIsEsSignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"EC",JwkInvalidKtyError),!pa.crv)throw new JwkValidationError("Missing Curve (crv)");if(!pa.x)throw new JwkValidationError("Missing X Coordinate (x)");if(!pa.y)throw new JwkValidationError("Missing Y Coordinate (y)")}function assertIsRsaSignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"RSA",JwkInvalidKtyError),!pa.n)throw new JwkValidationError("Missing modulus (n)");if(!pa.e)throw new JwkValidationError("Missing exponent (e)")}function assertIsJwk(pa){if(!pa)throw new JwkValidationError("JWK empty");if(!isJsonObject(pa))throw new JwkValidationError("JWK should be an object");for(const ha of mandatoryJwkFieldNames)if(typeof pa[ha]!="string")throw new JwkValidationError(`JWK ${ha} should be a string`);for(const ha of optionalJwkFieldNames)if(ha in pa&&typeof pa[ha]!="string")throw new JwkValidationError(`JWK ${ha} should be a string`)}function isJwks(pa){try{return assertIsJwks(pa),!0}catch{return!1}}function isJwk(pa){try{return assertIsJwk(pa),!0}catch{return!1}}class SimplePenaltyBox{constructor(ha){this.waitingUris=new Map,this.waitSeconds=ha?.waitSeconds??10}async wait(ha){if(this.waitingUris.has(ha))throw new WaitPeriodNotYetEndedJwkError("Not allowed to fetch JWKS yet, still waiting for back off period to end")}release(ha){const ma=this.waitingUris.get(ha);ma&&(clearTimeout(ma),this.waitingUris.delete(ha))}registerFailedAttempt(ha){const ma=nodeWebCompat.setTimeoutUnref(()=>{this.waitingUris.delete(ha)},this.waitSeconds*1e3);this.waitingUris.set(ha,ma)}registerSuccessfulAttempt(ha){this.release(ha)}}class SimpleJwksCache{constructor(ha){this.jwksCache=new Map,this.fetchingJwks=new Map,this.penaltyBox=ha?.penaltyBox??new SimplePenaltyBox,this.fetcher=ha?.fetcher??new SimpleFetcher,this.jwksParser=ha?.jwksParser??parseJwks}addJwks(ha,ma){this.jwksCache.set(ha,ma)}async getJwks(ha){const ma=this.fetchingJwks.get(ha);if(ma)return ma;const ja=this.fetcher.fetch(ha).then(this.jwksParser);this.fetchingJwks.set(ha,ja);let La;try{La=await ja}finally{this.fetchingJwks.delete(ha)}return this.jwksCache.set(ha,La),La}getCachedJwk(ha,ma){if(typeof ma.header.kid!="string")throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");if(!this.jwksCache.has(ha))throw new JwksNotAvailableInCacheError(`JWKS for uri ${ha} not yet available in cache`);const ja=findJwkInJwks(this.jwksCache.get(ha),ma.header.kid);if(!ja)throw new KidNotFoundInJwksError(`JWK for kid ${ma.header.kid} not found in the JWKS`);return ja}async getJwk(ha,ma){if(typeof ma.header.kid!="string")throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");const ja=this.jwksCache.get(ha);if(ja){const hl=findJwkInJwks(ja,ma.header.kid);if(hl)return hl}await this.penaltyBox.wait(ha,ma.header.kid);const La=await this.getJwks(ha),Ba=findJwkInJwks(La,ma.header.kid);if(Ba)this.penaltyBox.registerSuccessfulAttempt(ha,ma.header.kid);else throw this.penaltyBox.registerFailedAttempt(ha,ma.header.kid),new KidNotFoundInJwksError(`JWK for kid "${ma.header.kid}" not found in the JWKS`);return Ba}}function assertJwtHeader(pa){if(!isJsonObject(pa))throw new JwtParseError("JWT header is not an object");if(pa.alg!==void 0&&typeof pa.alg!="string")throw new JwtParseError("JWT header alg claim is not a string");if(pa.kid!==void 0&&typeof pa.kid!="string")throw new JwtParseError("JWT header kid claim is not a string")}function assertJwtPayload(pa){if(!isJsonObject(pa))throw new JwtParseError("JWT payload is not an object");if(pa.exp!==void 0&&!Number.isFinite(pa.exp))throw new JwtParseError("JWT payload exp claim is not a number");if(pa.iss!==void 0&&typeof pa.iss!="string")throw new JwtParseError("JWT payload iss claim is not a string");if(pa.sub!==void 0&&typeof pa.sub!="string")throw new JwtParseError("JWT payload sub claim is not a string");if(pa.aud!==void 0&&typeof pa.aud!="string"&&(!Array.isArray(pa.aud)||pa.aud.some(ha=>typeof ha!="string")))throw new JwtParseError("JWT payload aud claim is not a string or array of strings");if(pa.nbf!==void 0&&!Number.isFinite(pa.nbf))throw new JwtParseError("JWT payload nbf claim is not a number");if(pa.iat!==void 0&&!Number.isFinite(pa.iat))throw new JwtParseError("JWT payload iat claim is not a number");if(pa.scope!==void 0&&typeof pa.scope!="string")throw new JwtParseError("JWT payload scope claim is not a string");if(pa.jti!==void 0&&typeof pa.jti!="string")throw new JwtParseError("JWT payload jti claim is not a string")}const JWT_REGEX=/^[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}$/;function decomposeUnverifiedJwt(pa){if(!pa)throw new JwtParseError("Empty JWT");if(typeof pa!="string")throw new JwtParseError("JWT is not a string");if(!JWT_REGEX.test(pa))throw new JwtParseError("JWT string does not consist of exactly 3 parts (header, payload, signature)");const[ha,ma,ja]=pa.split("."),[La,Ba]=[ha,ma].map(nodeWebCompat.parseB64UrlString);let hl;try{hl=safeJsonParse(La)}catch(zl){throw new JwtParseError("Invalid JWT. Header is not a valid JSON object",zl)}assertJwtHeader(hl);let Gl;try{Gl=safeJsonParse(Ba)}catch(zl){throw new JwtParseError("Invalid JWT. Payload is not a valid JSON object",zl)}return assertJwtPayload(Gl),{header:hl,headerB64:ha,payload:Gl,payloadB64:ma,signatureB64:ja}}function validateJwtFields(pa,ha){if(pa.exp!==void 0&&pa.exp+(ha.graceSeconds??0)<Date.now()/1e3)throw new JwtExpiredError(`Token expired at ${new Date(pa.exp*1e3).toISOString()}`,pa.exp);if(pa.nbf!==void 0&&pa.nbf-(ha.graceSeconds??0)>Date.now()/1e3)throw new JwtNotBeforeError(`Token can't be used before ${new Date(pa.nbf*1e3).toISOString()}`,pa.nbf);if(ha.issuer!==null){if(ha.issuer===void 0)throw new ParameterValidationError("issuer must be provided or set to null explicitly");assertStringArrayContainsString("Issuer",pa.iss,ha.issuer,JwtInvalidIssuerError)}if(ha.audience!==null){if(ha.audience===void 0)throw new ParameterValidationError("audience must be provided or set to null explicitly");assertStringArraysOverlap("Audience",pa.aud,ha.audience,JwtInvalidAudienceError)}ha.scope!=null&&assertStringArraysOverlap("Scope",pa.scope?.split(" "),ha.scope,JwtInvalidScopeError)}const supportedSignatureAlgorithms=["RS256","RS384","RS512","ES256","ES384","ES512","EdDSA"];function validateJwtHeaderAndJwk(pa,ha){assertIsSignatureJwk(ha),ha.alg&&assertStringEquals("JWT signature algorithm",pa.alg,ha.alg,JwtInvalidSignatureAlgorithmError),assertStringArrayContainsString("JWT signature algorithm",pa.alg,supportedSignatureAlgorithms,JwtInvalidSignatureAlgorithmError)}async function verifyDecomposedJwt(pa,ha,ma,ja,La){const{header:Ba,headerB64:hl,payload:Gl,payloadB64:zl,signatureB64:Wl}=pa,Kl=await ja(ha,pa);validateJwtHeaderAndJwk(pa.header,Kl);const su=await La(Kl,Ba.alg,Gl.iss);if(!await nodeWebCompat.verifySignatureAsync({jwsSigningInput:`${hl}.${zl}`,signature:Wl,alg:Ba.alg,keyObject:su}))throw new JwtInvalidSignatureError("Invalid signature");try{validateJwtFields(Gl,ma),ma.customJwtCheck&&await ma.customJwtCheck({header:Ba,payload:Gl,jwk:Kl})}catch(ou){throw ma.includeRawJwtInErrors&&ou instanceof JwtInvalidClaimError?ou.withRawJwt(pa):ou}return Gl}function verifyDecomposedJwtSync(pa,ha,ma,ja){const{header:La,headerB64:Ba,payload:hl,payloadB64:Gl,signatureB64:zl}=pa;let Wl;if(isJwk(ha))Wl=ha;else if(isJwks(ha)){const au=La.kid?findJwkInJwks(ha,La.kid):void 0;if(!au)throw new KidNotFoundInJwksError(`JWK for kid ${La.kid} not found in the JWKS`);Wl=au}else throw new ParameterValidationError([`Expected a valid JWK or JWKS (parsed as JavaScript object), but received: ${ha}.`,"If you're passing a JWKS URI, use the async verify() method instead, it will download and parse the JWKS for you"].join());validateJwtHeaderAndJwk(pa.header,Wl);const Kl=ja(Wl,La.alg,hl.iss);if(!nodeWebCompat.verifySignatureSync({jwsSigningInput:`${Ba}.${Gl}`,signature:zl,alg:La.alg,keyObject:Kl}))throw new JwtInvalidSignatureError("Invalid signature");try{if(validateJwtFields(hl,ma),ma.customJwtCheck){const au=ma.customJwtCheck({header:La,payload:hl,jwk:Wl});assertIsNotPromise(au,()=>new ParameterValidationError("Custom JWT checks must be synchronous but a promise was returned"))}}catch(au){throw ma.includeRawJwtInErrors&&au instanceof JwtInvalidClaimError?au.withRawJwt(pa):au}return hl}class JwtVerifierBase{constructor(ha,ma=new SimpleJwksCache){if(this.jwksCache=ma,this.issuersConfig=new Map,this.publicKeyCache=new KeyObjectCache,Array.isArray(ha)){if(!ha.length)throw new ParameterValidationError("Provide at least one issuer configuration");ha.forEach((ja,La)=>{if(this.issuersConfig.has(ja.issuer))throw new ParameterValidationError(`issuer ${ja.issuer} supplied multiple times`);if(ja.issuer===null&&ha.length>=2)throw new ParameterValidationError(`issuer cannot be null when multiple issuers are supplied (at issuer: ${La})`);this.issuersConfig.set(ja.issuer,this.withJwksUri(ja))})}else this.issuersConfig.set(ha.issuer,this.withJwksUri(ha))}getIssuerConfig(ha){if(this.issuersConfig.size===1&&(ha=this.issuersConfig.keys().next().value),ha===void 0)throw new ParameterValidationError("issuer must be provided");const ma=this.issuersConfig.get(ha);if(!ma)throw new ParameterValidationError(`issuer not configured: ${ha}`);return ma}cacheJwks(...[ha,ma]){const ja=this.getIssuerConfig(ma);this.jwksCache.addJwks(ja.jwksUri,ha),this.publicKeyCache.clearCache(ja.issuer)}async hydrate(){const ha=Array.from(this.issuersConfig.values()).map(({jwksUri:ma})=>this.jwksCache.getJwks(ma));await Promise.all(ha)}verifySync(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);return this.verifyDecomposedJwtSync(ja,La,Ba)}verifyDecomposedJwtSync(ha,ma,ja){const La=this.jwksCache.getCachedJwk(ma,ha);return verifyDecomposedJwtSync(ha,La,ja,this.publicKeyCache.transformJwkToKeyObjectSync.bind(this.publicKeyCache))}async verify(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);return this.verifyDecomposedJwt(ja,La,Ba)}verifyDecomposedJwt(ha,ma,ja){return verifyDecomposedJwt(ha,ma,ja,this.jwksCache.getJwk.bind(this.jwksCache),this.publicKeyCache.transformJwkToKeyObjectAsync.bind(this.publicKeyCache))}getVerifyParameters(ha,ma){const ja=decomposeUnverifiedJwt(ha),La=this.getIssuerConfig(ja.payload.iss);return{decomposedJwt:ja,jwksUri:La.jwksUri,verifyProperties:{...La,...ma}}}withJwksUri(ha){if(ha.jwksUri)return ha;const ma=ha.issuer;if(!ma)throw new ParameterValidationError("jwksUri must be provided for issuer null");const ja=new URL(ma).pathname.replace(/\/$/,"");return{jwksUri:new URL(`${ja}/.well-known/jwks.json`,ma).href,...ha}}}class KeyObjectCache{constructor(ha=nodeWebCompat.transformJwkToKeyObjectSync,ma=nodeWebCompat.transformJwkToKeyObjectAsync){this.transformJwkToKeyObjectSyncFn=ha,this.transformJwkToKeyObjectAsyncFn=ma,this.publicKeys=new Map}transformJwkToKeyObjectSync(ha,ma,ja){const La=ha.alg??ma;if(!ja||!ha.kid||!La)return this.transformJwkToKeyObjectSyncFn(ha,La,ja);const Ba=this.publicKeys.get(ja)?.get(ha.kid)?.get(La);if(Ba)return Ba;const hl=this.transformJwkToKeyObjectSyncFn(ha,La,ja);return this.putKeyObjectInCache(ja,ha.kid,La,hl),hl}async transformJwkToKeyObjectAsync(ha,ma,ja){const La=ha.alg??ma;if(!ja||!ha.kid||!La)return this.transformJwkToKeyObjectAsyncFn(ha,La,ja);const Ba=this.publicKeys.get(ja)?.get(ha.kid)?.get(La);if(Ba)return Ba;const hl=await this.transformJwkToKeyObjectAsyncFn(ha,La,ja);return this.putKeyObjectInCache(ja,ha.kid,La,hl),hl}putKeyObjectInCache(ha,ma,ja,La){const Ba=this.publicKeys.get(ha),hl=Ba?.get(ma);hl?hl.set(ja,La):Ba?Ba.set(ma,new Map([[ja,La]])):this.publicKeys.set(ha,new Map([[ma,new Map([[ja,La]])]]))}clearCache(ha){this.publicKeys.delete(ha)}}function validateCognitoJwtFields(pa,ha){if(ha.groups!=null&&assertStringArraysOverlap("Cognito group",pa["cognito:groups"],ha.groups,CognitoJwtInvalidGroupError),assertStringArrayContainsString("Token use",pa.token_use,["id","access"],CognitoJwtInvalidTokenUseError),ha.tokenUse!==null){if(ha.tokenUse===void 0)throw new ParameterValidationError("tokenUse must be provided or set to null explicitly");assertStringEquals("Token use",pa.token_use,ha.tokenUse,CognitoJwtInvalidTokenUseError)}if(ha.clientId!==null){if(ha.clientId===void 0)throw new ParameterValidationError("clientId must be provided or set to null explicitly");pa.token_use==="id"?assertStringArrayContainsString('Client ID ("audience")',pa.aud,ha.clientId,CognitoJwtInvalidClientIdError):assertStringArrayContainsString("Client ID",pa.client_id,ha.clientId,CognitoJwtInvalidClientIdError)}}class CognitoJwtVerifier extends JwtVerifierBase{constructor(ha,ma){const ja=Array.isArray(ha)?ha.map(La=>({...La,...CognitoJwtVerifier.parseUserPoolId(La.userPoolId),audience:null})):{...ha,...CognitoJwtVerifier.parseUserPoolId(ha.userPoolId),audience:null};super(ja,ma)}static parseUserPoolId(ha){const ma=ha.match(this.USER_POOL_ID_REGEX);if(!ma)throw new ParameterValidationError(`Invalid Cognito User Pool ID: ${ha}`);const La=`https://cognito-idp.${ma.groups.region}.amazonaws.com/${ha}`;return{issuer:La,jwksUri:`${La}/.well-known/jwks.json`}}static create(ha,ma){return new this(ha,ma?.jwksCache)}verifySync(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);this.verifyDecomposedJwtSync(ja,La,Ba);try{validateCognitoJwtFields(ja.payload,Ba)}catch(hl){throw Ba.includeRawJwtInErrors&&hl instanceof JwtInvalidClaimError?hl.withRawJwt(ja):hl}return ja.payload}async verify(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);await this.verifyDecomposedJwt(ja,La,Ba);try{validateCognitoJwtFields(ja.payload,Ba)}catch(hl){throw Ba.includeRawJwtInErrors&&hl instanceof JwtInvalidClaimError?hl.withRawJwt(ja):hl}return ja.payload}cacheJwks(...[ha,ma]){let ja;if(ma!==void 0)ja=CognitoJwtVerifier.parseUserPoolId(ma).issuer;else if(Array.from(this.issuersConfig).length>1)throw new ParameterValidationError("userPoolId must be provided");const La=this.getIssuerConfig(ja);super.cacheJwks(ha,La.issuer)}}CognitoJwtVerifier.USER_POOL_ID_REGEX=/^(?<region>[a-z]{2}-(gov-)?[a-z]+-\d)_[a-zA-Z0-9]+$/;var __assign=function(){return __assign=Object.assign||function(ha){for(var ma,ja=1,La=arguments.length;ja<La;ja++){ma=arguments[ja];for(var Ba in ma)Object.prototype.hasOwnProperty.call(ma,Ba)&&(ha[Ba]=ma[Ba])}return ha},__assign.apply(this,arguments)};function __rest(pa,ha){var ma={};for(var ja in pa)Object.prototype.hasOwnProperty.call(pa,ja)&&ha.indexOf(ja)<0&&(ma[ja]=pa[ja]);if(pa!=null&&typeof Object.getOwnPropertySymbols=="function")for(var La=0,ja=Object.getOwnPropertySymbols(pa);La<ja.length;La++)ha.indexOf(ja[La])<0&&Object.prototype.propertyIsEnumerable.call(pa,ja[La])&&(ma[ja[La]]=pa[ja[La]]);return ma}function __awaiter(pa,ha,ma,ja){function La(Ba){return Ba instanceof ma?Ba:new ma(function(hl){hl(Ba)})}return new(ma||(ma=Promise))(function(Ba,hl){function Gl(Kl){try{Wl(ja.next(Kl))}catch(su){hl(su)}}function zl(Kl){try{Wl(ja.throw(Kl))}catch(su){hl(su)}}function Wl(Kl){Kl.done?Ba(Kl.value):La(Kl.value).then(Gl,zl)}Wl((ja=ja.apply(pa,ha||[])).next())})}function __generator(pa,ha){var ma={label:0,sent:function(){if(Ba[0]&1)throw Ba[1];return Ba[1]},trys:[],ops:[]},ja,La,Ba,hl=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return hl.next=Gl(0),hl.throw=Gl(1),hl.return=Gl(2),typeof Symbol=="function"&&(hl[Symbol.iterator]=function(){return this}),hl;function Gl(Wl){return function(Kl){return zl([Wl,Kl])}}function zl(Wl){if(ja)throw new TypeError("Generator is already executing.");for(;hl&&(hl=0,Wl[0]&&(ma=0)),ma;)try{if(ja=1,La&&(Ba=Wl[0]&2?La.return:Wl[0]?La.throw||((Ba=La.return)&&Ba.call(La),0):La.next)&&!(Ba=Ba.call(La,Wl[1])).done)return Ba;switch(La=0,Ba&&(Wl=[Wl[0]&2,Ba.value]),Wl[0]){case 0:case 1:Ba=Wl;break;case 4:return ma.label++,{value:Wl[1],done:!1};case 5:ma.label++,La=Wl[1],Wl=[0];continue;case 7:Wl=ma.ops.pop(),ma.trys.pop();continue;default:if(Ba=ma.trys,!(Ba=Ba.length>0&&Ba[Ba.length-1])&&(Wl[0]===6||Wl[0]===2)){ma=0;continue}if(Wl[0]===3&&(!Ba||Wl[1]>Ba[0]&&Wl[1]<Ba[3])){ma.label=Wl[1];break}if(Wl[0]===6&&ma.label<Ba[1]){ma.label=Ba[1],Ba=Wl;break}if(Ba&&ma.label<Ba[2]){ma.label=Ba[2],ma.ops.push(Wl);break}Ba[2]&&ma.ops.pop(),ma.trys.pop();continue}Wl=ha.call(pa,ma)}catch(Kl){Wl=[6,Kl],La=0}finally{ja=Ba=0}if(Wl[0]&5)throw Wl[1];return{value:Wl[0]?Wl[1]:void 0,done:!0}}}function __spreadArray(pa,ha,ma){if(ma||arguments.length===2)for(var ja=0,La=ha.length,Ba;ja<La;ja++)(Ba||!(ja in ha))&&(Ba||(Ba=Array.prototype.slice.call(ha,0,ja)),Ba[ja]=ha[ja]);return pa.concat(Ba||Array.prototype.slice.call(ha))}typeof SuppressedError=="function"&&SuppressedError;var define_process_env_default$2={};let fromEnv,CognitoIdentityProviderClient,SignUpCommand,ConfirmSignUp,ResendConfirmationCodeCommand,ForgotPasswordCommand,ConfirmForgotPasswordCommand,AdminGetUserCommand,InitiateAuthCommand,AdminCreateUserCommand,AdminDisableUserCommand,AdminEnableUserCommand,AdminDeleteUserCommand,RespondToAuthChallengeCommand,AuthenticationDetails,CognitoUser,CognitoUserPool,CognitoUserSession,CognitoIdToken,CognitoAccessToken,CognitoRefreshToken;if(isNodeEnv$1){fromEnv=(await __vitePreload(()=>import("./index.browser-CSfSj68l.js"),__vite__mapDeps([26,19,27]))).fromEnv;const ha=await __vitePreload(()=>import("./index-Bzac4yPb.js"),__vite__mapDeps([28,29,27,19,30,1,18,5,9,11,16,14,15,10,20,21,17,4]));CognitoIdentityProviderClient=ha.CognitoIdentityProviderClient,SignUpCommand=ha.SignUpCommand,ConfirmSignUp=ha.ConfirmSignUpCommand,ResendConfirmationCodeCommand=ha.ResendConfirmationCodeCommand,ForgotPasswordCommand=ha.ForgotPasswordCommand,ConfirmForgotPasswordCommand=ha.ConfirmForgotPasswordCommand,AdminGetUserCommand=ha.AdminGetUserCommand,InitiateAuthCommand=ha.InitiateAuthCommand,AdminCreateUserCommand=ha.AdminCreateUserCommand,AdminDisableUserCommand=ha.AdminDisableUserCommand,AdminEnableUserCommand=ha.AdminEnableUserCommand,AdminDeleteUserCommand=ha.AdminDeleteUserCommand,RespondToAuthChallengeCommand=ha.RespondToAuthChallengeCommand;const ma=await __vitePreload(()=>import("./index-BHDiPh0o.js"),__vite__mapDeps([31,1,4,5]));AuthenticationDetails=ma.AuthenticationDetails,CognitoUser=ma.CognitoUser,CognitoUserPool=ma.CognitoUserPool,CognitoUserSession=ma.CognitoUserSession,CognitoIdToken=ma.CognitoIdToken,CognitoAccessToken=ma.CognitoAccessToken,CognitoRefreshToken=ma.CognitoRefreshToken}const defaultConfig$1=isNodeEnv$1?new Map().set("UserPoolId",define_process_env_default$2.COGNITO_USER_POOL_ID).set("ClientId",define_process_env_default$2.COGNITO_CLIENT_ID):new Map;function handleCognitoError(pa,ha){var ma;const ja=sanitizeErrorMessage(pa.message||"");switch(logger$3.error(`Cognito error in ${ha}: ${pa.name} - ${ja}`,{errorName:pa.name,errorCode:pa.code,context:ha,statusCode:(ma=pa.$metadata)===null||ma===void 0?void 0:ma.httpStatusCode}),pa.name){case"UserNotFoundException":throw logger$3.debug(`User not found in context: ${ha}`),new UserNotFoundError$1("User account not found. Please check your email or sign up.");case"NotAuthorizedException":throw pa.message&&pa.message.includes("password")?(logger$3.debug(`Invalid password attempt in context: ${ha}`),new UnauthorisedError$1("Invalid password. Please try again.")):pa.message&&pa.message.includes("not confirmed")?(logger$3.debug(`User not confirmed in context: ${ha}`),new UserNotConfirmedError$1):(logger$3.debug(`Authentication failed in context: ${ha}`),new UnauthorisedError$1("Authentication failed. Please check your credentials."));case"UserNotConfirmedException":throw logger$3.debug(`User not confirmed in context: ${ha}`),new UserNotConfirmedError$1;case"PasswordResetRequiredException":throw logger$3.debug(`Password reset required in context: ${ha}`),new PasswordResetRequiredError$1;case"TooManyRequestsException":throw logger$3.warn(`Rate limit exceeded in context: ${ha}`),new TooManyRequestsError$1;case"TooManyFailedAttemptsException":throw logger$3.warn(`Too many failed attempts in context: ${ha}`),new TooManyRequestsError$1("Too many failed login attempts. Please try again later.");case"InvalidParameterException":throw logger$3.debug(`Invalid parameters in context: ${ha}`),new InvalidParameterError$1(sanitizeErrorMessage(pa.message)||"Invalid parameters provided");case"ExpiredCodeException":throw logger$3.debug(`Expired code in context: ${ha}`),new ExpiredCodeError$1;case"CodeMismatchException":throw logger$3.debug(`Code mismatch in context: ${ha}`),new CodeMismatchError$1;case"UsernameExistsException":throw logger$3.debug(`Username exists in context: ${ha}`),new BadRequestError$4("An account with this email already exists.");case"InvalidPasswordException":throw logger$3.debug(`Invalid password format in context: ${ha}`),new BadRequestError$4("Password does not meet requirements. It must be at least 8 characters long and contain uppercase, lowercase, numbers, and special characters.");case"LimitExceededException":throw logger$3.warn(`Service limit exceeded in context: ${ha}`),new TooManyRequestsError$1("Service limit exceeded. Please try again later.");case"InternalErrorException":throw logger$3.error(`Internal Cognito error in context: ${ha}`),new Error("Authentication service is temporarily unavailable. Please try again later.");case"ResourceNotFoundException":throw logger$3.error(`Resource not found in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");case"AliasExistsException":throw logger$3.debug(`Alias exists in context: ${ha}`),new BadRequestError$4("An account with this email already exists.");case"InvalidEmailRoleAccessPolicyException":throw logger$3.error(`Invalid email role access policy in context: ${ha}`),new Error("Email service configuration error. Please contact support.");case"UserLambdaValidationException":throw logger$3.error(`User lambda validation error in context: ${ha}`),new BadRequestError$4("User validation failed. Please check your input and try again.");case"UnsupportedUserStateException":throw logger$3.debug(`Unsupported user state in context: ${ha}`),new UserNotConfirmedError$1("User account is in an unsupported state. Please contact support.");case"MFAMethodNotFoundException":throw logger$3.debug(`MFA method not found in context: ${ha}`),new BadRequestError$4("MFA method not found. Please set up MFA and try again.");case"CodeDeliveryFailureException":throw logger$3.error(`Code delivery failure in context: ${ha}`),new Error("Unable to deliver verification code. Please try again later.");case"DuplicateProviderException":throw logger$3.error(`Duplicate provider in context: ${ha}`),new BadRequestError$4("Authentication provider already exists.");case"EnableSoftwareTokenMFAException":throw logger$3.debug(`Software token MFA required in context: ${ha}`),new BadRequestError$4("Software token MFA setup required.");case"ForbiddenException":throw logger$3.warn(`Forbidden access in context: ${ha}`),new UnauthorisedError$1("Access forbidden. Please check your permissions.");case"GroupExistsException":throw logger$3.debug(`Group exists in context: ${ha}`),new BadRequestError$4("Group already exists.");case"InvalidLambdaResponseException":throw logger$3.error(`Invalid lambda response in context: ${ha}`),new Error("Authentication service error. Please try again later.");case"InvalidOAuthFlowException":throw logger$3.error(`Invalid OAuth flow in context: ${ha}`),new BadRequestError$4("Invalid OAuth flow. Please try again.");case"InvalidSmsRoleAccessPolicyException":throw logger$3.error(`Invalid SMS role access policy in context: ${ha}`),new Error("SMS service configuration error. Please contact support.");case"InvalidSmsRoleTrustRelationshipException":throw logger$3.error(`Invalid SMS role trust relationship in context: ${ha}`),new Error("SMS service configuration error. Please contact support.");case"InvalidUserPoolConfigurationException":throw logger$3.error(`Invalid user pool configuration in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");case"PreconditionNotMetException":throw logger$3.debug(`Precondition not met in context: ${ha}`),new BadRequestError$4("Precondition not met. Please check your request and try again.");case"ScopeDoesNotExistException":throw logger$3.error(`Scope does not exist in context: ${ha}`),new BadRequestError$4("Invalid scope. Please check your request.");case"UnexpectedLambdaException":throw logger$3.error(`Unexpected lambda exception in context: ${ha}`),new Error("Authentication service error. Please try again later.");case"UserImportInProgressException":throw logger$3.warn(`User import in progress in context: ${ha}`),new TooManyRequestsError$1("User import in progress. Please try again later.");case"UserPoolTaggingException":throw logger$3.error(`User pool tagging exception in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");default:throw logger$3.error(`Unhandled Cognito error: ${pa.name}`,{errorName:pa.name,errorCode:pa.code,context:ha}),new Error(`Authentication error: ${sanitizeErrorMessage(pa.message)||"An unexpected error occurred"}`)}}function sanitizeErrorMessage(pa){return pa?pa.replace(/password/gi,"[REDACTED]").replace(/token/gi,"[REDACTED]").replace(/secret/gi,"[REDACTED]").replace(/key/gi,"[REDACTED]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[EMAIL_REDACTED]").replace(/\b[A-Fa-f0-9]{32,}\b/g,"[TOKEN_REDACTED]").replace(/\b\d{4,}\b/g,"[NUMBER_REDACTED]"):""}class CognitoAuth{constructor(ha){this.config=ha||defaultConfig$1;const ma=this.config.get("UserPoolId");ma&&(this.userPool=new CognitoUserPool({UserPoolId:ma,ClientId:this.fetchClientId()}))}fetchUserPoolId(){return this.fetchConfig("UserPoolId")}fetchClientId(){return this.fetchConfig("ClientId")}fetchConfig(ha){const ma=this.config.get(ha);if(ma)return ma;throw new Error(`${ha} is not set`)}async signUp(ha,ma,ja,La,Ba,hl,Gl){const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Wl=[{Name:"email",Value:ja},{Name:"name",Value:ja},{Name:"given_name",Value:ha},{Name:"family_name",Value:ma}];Ba&&Ba.forEach((au,ou)=>{Wl.push({Name:ou,Value:au})});const Kl={ClientId:this.config.get("ClientId"),Username:ja,Password:La,UserAttributes:Wl,ValidationData:Wl},su=new SignUpCommand(Kl);try{logger$3.debug(`Attempting signup for user: ${ja}`);const au=await zl.send(su);if(au.$metadata.httpStatusCode==200){logger$3.info(`Signup successful for user: ${ja}`);const ou=await ensureUser(ja,ha,ma,hl,"Active"),$m={username:ja,firstName:ha,lastName:ma,id:ou.id,systemUserInfo:au.UserSub};Gl($m)}else throw logger$3.error(`Signup failed with HTTP status ${au.$metadata.httpStatusCode}`,{username:ja,statusCode:au.$metadata.httpStatusCode}),new BadRequestError$4(`Signup failed with status ${au.$metadata.httpStatusCode}`)}catch(au){if(au instanceof BadRequestError$4)throw au;logger$3.error(`Signup error for user ${ja}:`,{errorName:au.name,errorMessage:sanitizeErrorMessage(au.message)}),handleCognitoError(au,"signUp")}}async confirmSignup(ha,ma,ja){try{const La=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Ba=new ConfirmSignUp({ClientId:this.config.get("ClientId"),Username:ha,ConfirmationCode:ma});await La.send(Ba)}catch(La){logger$3.error(`Failed to confirm signup: ${La.message}`),handleCognitoError(La,"confirmSignup")}}async resendConfirmationCode(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new ResendConfirmationCodeCommand({ClientId:this.config.get("ClientId"),Username:ha});await ja.send(La)}catch(ja){logger$3.error(`Failed to resend confirmation code: ${ja.message}`),handleCognitoError(ja,"resendConfirmationCode")}}async forgotPassword(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new ForgotPasswordCommand({ClientId:this.fetchClientId(),Username:ha});await ja.send(La)}catch(ja){logger$3.error(`Forgot password failed for ${ha}: ${sanitizeErrorMessage(ja.message)}`),handleCognitoError(ja,"forgotPassword")}}async confirmForgotPassword(ha,ma,ja,La){try{const Ba=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),hl=new ConfirmForgotPasswordCommand({ClientId:this.fetchClientId(),Username:ha,ConfirmationCode:ma,Password:ja});await Ba.send(hl)}catch(Ba){logger$3.error(`Confirm forgot password failed for ${ha}: ${sanitizeErrorMessage(Ba.message)}`),handleCognitoError(Ba,"confirmForgotPassword")}}async login(ha,ma,ja,La){if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID){const hl=new CognitoUser({Username:ha,Pool:this.fetchUserPool()}),Gl=new AuthenticationDetails({Username:ha,Password:ma});let zl,Wl;for(hl.authenticateUser(Gl,{onSuccess:Kl=>{zl=Kl},onFailure:Kl=>{logger$3.debug(`Cognito authentication failed for user ${ha}:`,{errorName:Kl.name,errorMessage:sanitizeErrorMessage(Kl.message)}),Wl=Kl},mfaRequired:(Kl,su)=>{logger$3.info(`MFA required for user ${ha}: ${Kl}`),Wl=new Error("MFA authentication required")},newPasswordRequired:(Kl,su)=>{logger$3.info(`New password required for user ${ha}`),Wl=new PasswordResetRequiredError$1("New password required. Please reset your password.")}});zl===void 0&&Wl===void 0;)await sleepMilliseconds$1(100);if(Wl){if(Wl instanceof PasswordResetRequiredError$1)throw Wl;logger$3.error(`Login failed for user ${ha}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),handleCognitoError(Wl,"login")}if(zl){const Kl=zl.getIdToken(),su=Kl.getJwtToken(),au=Kl.decodePayload(),ou=au.given_name||au.name||"",$m=au.family_name||"",Nm=au["cognito:groups"];let Mm=await findUserByEmail(ha,ja);Mm||(Mm=await ensureUser(ha,ou,$m,ja));const Mg=Mm.lookup("id");Nm&&await ensureUserRoles(Mg,Nm,ja);const ly=zl.getAccessToken().getJwtToken(),uy=zl.getRefreshToken().getToken(),YE={sessionId:(await ensureUserSession(Mg,su,ly,uy,ja)).lookup("id"),userId:Mg,authToken:su,idToken:su,accessToken:ly,refreshToken:uy,systemSesionInfo:zl};La(YE)}else throw logger$3.error(`Login failed for ${ha} - no result received`),new UnauthorisedError$1("Login failed. Please try again.")}else{let hl=await findUserByEmail(ha,ja);hl||(logger$3.warn(`User ${ha} not found in local store`),hl=await ensureUser(ha,"","",ja));const Gl=new CognitoUser({Username:ha,Pool:this.fetchUserPool()}),zl=new AuthenticationDetails({Username:ha,Password:ma});let Wl,Kl;for(Gl.authenticateUser(zl,{onSuccess:su=>{Wl=su},onFailure:su=>{logger$3.debug(`Cognito authentication failed for user ${ha}:`,{errorName:su.name,errorMessage:sanitizeErrorMessage(su.message)}),Kl=su},mfaRequired:(su,au)=>{logger$3.info(`MFA required for user ${ha}: ${su}`),Kl=new Error("MFA authentication required")},newPasswordRequired:(su,au)=>{logger$3.info(`New password required for user ${ha}`),Kl=new PasswordResetRequiredError$1("New password required. Please reset your password.")}});Wl===void 0&&Kl===void 0;)await sleepMilliseconds$1(100);if(Kl){if(Kl instanceof PasswordResetRequiredError$1)throw Kl;logger$3.error(`Login failed for user ${ha}:`,{errorName:Kl.name,errorMessage:sanitizeErrorMessage(Kl.message)}),handleCognitoError(Kl,"login")}if(Wl){const su=hl.lookup("id"),au=Wl.getIdToken().getJwtToken(),ou=Wl.getAccessToken().getJwtToken(),$m=Wl.getRefreshToken().getToken(),Mm={sessionId:(await ensureUserSession(su,au,ou,$m,ja)).lookup("id"),userId:su,authToken:au,idToken:au,accessToken:ou,refreshToken:$m,systemSesionInfo:Wl};La(Mm)}else throw logger$3.error(`Login failed for ${ha} - no result received`),new UnauthorisedError$1("Login failed. Please try again.")}}async logout(ha,ma,ja){try{const La=await findUser(ha.userId,ma);if(!La){logger$3.warn(`User ${ha.userId} not found during logout`),ja&&ja(!0);return}const Ba=new CognitoUser({Username:La.lookup("email"),Pool:this.fetchUserPool()});let hl=!1,Gl;const zl=new CognitoUserSession({IdToken:new CognitoIdToken({IdToken:ha.idToken}),AccessToken:new CognitoAccessToken({AccessToken:ha.accessToken}),RefreshToken:new CognitoRefreshToken({RefreshToken:ha.refreshToken})});for(Ba.setSignInUserSession(zl),Ba.globalSignOut({onSuccess:function(){hl=!0},onFailure:function(Wl){hl=!0,logger$3.error(`Cognito signOut error for user ${ha.userId}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),Gl=Wl}});!hl;)await sleepMilliseconds$1(100);Gl&&logger$3.error(`Error during Cognito logout for user ${ha.userId}: ${Gl.message}`),logger$3.debug(`Successfully logged out user ${ha.userId}`),ja&&ja(!0)}catch(La){throw logger$3.error(`Logout failed for user ${ha.userId}: ${La.message}`),ja&&ja(!1),La}}async changePassword(ha,ma,ja,La){const Ba=await findUser(ha.userId,La);if(!Ba)return logger$3.warn(`User ${ha.userId} not found for password-change`),!1;const hl=Ba.lookup("email"),Gl=new CognitoUser({Username:hl,Pool:this.fetchUserPool()}),zl=new CognitoUserSession({IdToken:new CognitoIdToken({IdToken:ha.idToken}),AccessToken:new CognitoAccessToken({AccessToken:ha.accessToken}),RefreshToken:new CognitoRefreshToken({RefreshToken:ha.refreshToken})});Gl.setSignInUserSession(zl);let Wl=!1,Kl;for(Gl.changePassword(ja,ma,(su,au)=>{su?(Wl=!0,Kl=su):Wl=!0});!Wl;)await sleepMilliseconds$1(100);return Kl?(logger$3.warn(`Failed to change the password for ${hl} - ${Kl.message}`),!1):!0}fetchUserPool(){if(this.userPool)return this.userPool;throw new Error("UserPool not initialized")}async verifyToken(ha){try{const ja=await CognitoJwtVerifier.create({userPoolId:this.fetchUserPoolId(),tokenUse:"id",clientId:this.fetchClientId()}).verify(ha);logger$3.debug(`Decoded JWT for ${ja.email}`)}catch(ma){throw logger$3.error("Token verification failed:",{errorName:ma.name,errorMessage:sanitizeErrorMessage(ma.message)}),ma.message&&ma.message.includes("expired")?new UnauthorisedError$1("Token has expired. Please login again."):ma.message&&ma.message.includes("invalid")?new UnauthorisedError$1("Invalid token format."):ma.message&&ma.message.includes("not before")?new UnauthorisedError$1("Token is not yet valid."):ma.message&&ma.message.includes("audience")?new UnauthorisedError$1("Token audience mismatch."):new UnauthorisedError$1(`Token verification failed: ${sanitizeErrorMessage(ma.message)||"Invalid token"}`)}}async getUser(ha,ma){const ja=await findUser(ha,ma);if(!ja)throw new UserNotFoundError$1(`User ${ha} not found in local database`);const La=ja.lookup("email"),Ba=ja.lookup("firstName"),hl=ja.lookup("lastName");if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID&&La)try{const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Wl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:La}),Kl=await zl.send(Wl);return{id:ha,username:La,firstName:Ba,lastName:hl,systemUserInfo:{localUser:ja,cognitoData:{userAttributes:Kl.UserAttributes,userCreateDate:Kl.UserCreateDate,userLastModifiedDate:Kl.UserLastModifiedDate,userStatus:Kl.UserStatus,enabled:Kl.Enabled,preferredMfaSetting:Kl.PreferredMfaSetting,userMFASettingList:Kl.UserMFASettingList}}}}catch(zl){return logger$3.warn(`Failed to get Cognito user info for ${La}, using local data only:`,{errorName:zl.name,errorMessage:sanitizeErrorMessage(zl.message)}),{id:ha,username:La,firstName:Ba,lastName:hl,systemUserInfo:ja}}else return{id:ha,username:La||ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}async getUserByEmail(ha,ma){const ja=await findUserByEmail(ha,ma);if(!ja)throw new UserNotFoundError$1(`User with email ${ha} not found in local database`);const La=ja.lookup("id"),Ba=ja.lookup("firstName"),hl=ja.lookup("lastName");if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID)try{const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),Wl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),ClientId:this.fetchClientId(),Username:ha}),Kl=await zl.send(Wl);return{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:{localUser:ja,cognitoData:{userAttributes:Kl.UserAttributes,userCreateDate:Kl.UserCreateDate,userLastModifiedDate:Kl.UserLastModifiedDate,userStatus:Kl.UserStatus,enabled:Kl.Enabled,preferredMfaSetting:Kl.PreferredMfaSetting,userMFASettingList:Kl.UserMFASettingList}}}}catch(zl){return console.log(`Failed to get Cognito user info for email ${ha}, using local data only:`,{errorName:zl.name,errorMessage:sanitizeErrorMessage(zl.message)}),{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}else return{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}async refreshToken(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new InitiateAuthCommand({AuthFlow:"REFRESH_TOKEN_AUTH",ClientId:this.fetchClientId(),AuthParameters:{REFRESH_TOKEN:ha}}),Ba=await ja.send(La);if(!Ba.AuthenticationResult)throw new UnauthorisedError$1("Token refresh failed");const hl=Ba.AuthenticationResult.IdToken,Gl=Ba.AuthenticationResult.AccessToken,zl=Ba.AuthenticationResult.RefreshToken||ha,Kl=JSON.parse(atob(hl.split(".")[1])).email;let su=await findUserByEmail(Kl,ma);su||(su=await ensureUser(Kl,"","",ma));const au=su.lookup("id");return{sessionId:(await ensureUserSession(au,hl,Gl,zl,ma)).lookup("id"),userId:au,authToken:hl,idToken:hl,accessToken:Gl,refreshToken:zl,systemSesionInfo:Ba.AuthenticationResult}}catch(ja){throw logger$3.error(`Refresh token operation failed: ${ja.message}`),ja.name==="NotAuthorizedException"?new UnauthorisedError$1("Invalid or expired refresh token"):(handleCognitoError(ja,"refreshToken"),ja)}}async inviteUser(ha,ma,ja,La,Ba,hl,Gl){var zl;try{const Wl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),Kl=[{Name:"email",Value:ha},{Name:"email_verified",Value:"true"},{Name:"given_name",Value:ma},{Name:"family_name",Value:ja}];La&&La.forEach(($m,Nm)=>{Kl.push({Name:Nm,Value:String($m)})});let su=!1;try{const $m=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});await Wl.send($m),su=!0,logger$3.debug(`User ${ha} already exists, will resend invitation`)}catch($m){if($m.name!=="UserNotFoundException")throw $m;logger$3.debug(`User ${ha} does not exist, will create new user`)}const au=new AdminCreateUserCommand(Object.assign({UserPoolId:this.fetchUserPoolId(),Username:ha,UserAttributes:Kl,DesiredDeliveryMediums:["EMAIL"],TemporaryPassword:generateUrlSafePassword$1()},su?{MessageAction:"RESEND"}:{}));logger$3.debug(`Attempting to invite user: ${ha}`);const ou=await Wl.send(au);if(ou.$metadata.httpStatusCode===200){logger$3.info(`User invitation successful for: ${ha}`);const Nm=(await ensureUser(ha,ma,ja,hl,"Invited")).lookup("id");await ensureUserRoles(Nm,[Ba||"user"],hl);const Mm={email:ha,firstName:ma,lastName:ja,invitationId:(zl=ou.User)===null||zl===void 0?void 0:zl.Username,systemInvitationInfo:ou};Gl(Mm)}else throw logger$3.error(`User invitation failed with HTTP status ${ou.$metadata.httpStatusCode}`,{email:ha,statusCode:ou.$metadata.httpStatusCode}),new BadRequestError$4(`User invitation failed with status ${ou.$metadata.httpStatusCode}`)}catch(Wl){if(Wl instanceof BadRequestError$4)throw Wl;logger$3.error(`User invitation error for ${ha}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),handleCognitoError(Wl,"inviteUser")}}async resendInvitation(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"});try{const hl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});await ja.send(hl)}catch(hl){throw hl.name==="UserNotFoundException"?new UserNotFoundError$1(`User ${ha} not found. Cannot resend invitation.`):hl}const La=new AdminCreateUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha,DesiredDeliveryMediums:["EMAIL"],MessageAction:"RESEND"});logger$3.debug(`Attempting to resend invitation for user: ${ha}`);const Ba=await ja.send(La);if(Ba.$metadata.httpStatusCode===200)logger$3.info(`Invitation resent successfully for: ${ha}`);else throw logger$3.error(`Failed to resend invitation with HTTP status ${Ba.$metadata.httpStatusCode}`,{email:ha,statusCode:Ba.$metadata.httpStatusCode}),new BadRequestError$4(`Failed to resend invitation with status ${Ba.$metadata.httpStatusCode}`)}catch(ja){if(ja instanceof BadRequestError$4||ja instanceof UserNotFoundError$1)throw ja;logger$3.error(`Resend invitation error for ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"resendInvitation")}}async acceptInvitation(ha,ma,ja,La){try{const Ba=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),hl=new InitiateAuthCommand({AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.fetchClientId(),AuthParameters:{USERNAME:ha,PASSWORD:ma}}),Gl=await Ba.send(hl);if(Gl.ChallengeName==="NEW_PASSWORD_REQUIRED"){const zl=new RespondToAuthChallengeCommand({ClientId:this.fetchClientId(),ChallengeName:"NEW_PASSWORD_REQUIRED",Session:Gl.Session,ChallengeResponses:{USERNAME:ha,NEW_PASSWORD:ja}});await Ba.send(zl),logger$3.info(`User invitation accepted successfully for: ${ha}`)}else throw new Error(`Unexpected challenge: ${Gl.ChallengeName}`)}catch(Ba){logger$3.error(`Accept invitation failed for ${ha}: ${sanitizeErrorMessage(Ba.message)}`),handleCognitoError(Ba,"acceptInvitation")}}async callback(ha,ma,ja){try{if(!isNodeEnv$1)throw new Error("Callback authentication is only supported in Node.js environment");const La=this.fetchConfig("ClientId"),Ba=define_process_env_default$2.AWS_REGION||"us-east-1",hl=define_process_env_default$2.COGNITO_REDIRECT_URI||"http://localhost:3000/auth/callback",zl=`https://${define_process_env_default$2.COGNITO_HOSTED_DOMAIN}.auth.${Ba}.amazoncognito.com/oauth2/token`,Wl=new URLSearchParams({grant_type:"authorization_code",client_id:La,code:ha,redirect_uri:hl});logger$3.debug("Exchanging authorization code for tokens via OAuth2 endpoint"),console.log("te",zl,Wl.toString());const Kl=await fetch(zl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Wl.toString()});if(!Kl.ok){const cN=await Kl.text();throw new Error(`Token exchange failed: ${Kl.status} ${cN}`)}const su=await Kl.json();if(!su.access_token||!su.id_token||!su.refresh_token)throw new Error("Missing required tokens in response");const{access_token:au,id_token:ou,refresh_token:$m}=su,Nm=this.decodeJwtPayload(ou),Mm=Nm.email,Mg=Nm.given_name||Nm.name||"",ly=Nm.family_name||"",uy=Nm["cognito:groups"];if(!Mm)throw new Error("Email not found in ID attributes");let GE=await findUserByEmail(Mm,ma);GE||(GE=await ensureUser(Mm,Mg,ly,ma));const YE=GE.lookup("id");uy&&await ensureUserRoles(YE,uy,ma);const XE={sessionId:(await ensureUserSession(YE,ou,au,$m,ma)).lookup("id"),userId:YE,authToken:ou,idToken:ou,accessToken:au,refreshToken:$m,systemSesionInfo:su};logger$3.info(`Auth callback successful for user ${Mm}`),ja(XE)}catch(La){console.log(La),logger$3.error(`Auth callback failed: ${sanitizeErrorMessage(La.message)}`),handleCognitoError(La,"callback")}}decodeJwtPayload(ha){try{const ja=ha.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),La=decodeURIComponent(atob(ja).split("").map(Ba=>"%"+("00"+Ba.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(La)}catch(ma){throw logger$3.error(`Failed to decode JWT payload: ${ma}`),new Error("Invalid JWT token")}}async deleteUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminDeleteUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to delete user: ${ha}`),await ja.send(La),logger$3.info(`User deleted successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to delete user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"deleteUser")}}async disableUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminDisableUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to disable user: ${ha}`),await ja.send(La),logger$3.info(`User disabled successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to disable user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"disableUser")}}async enableUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminEnableUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to enable user: ${ha}`),await ja.send(La),logger$3.info(`User enabled successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to enable user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"enableUser")}}}const CoreAuthModuleName=makeCoreModuleName$1("auth"),auth=`module ${CoreAuthModuleName}
|
|
16090
|
+
${pa}`)}async function preprocessStep(pa,ha){if(pa.startsWith("{")){const ja=(await parseStatement$1(pa)).pattern.crudMap;if(ja){ha.resetTemplateMappings();const La=ja.name;return ja.body&&ja.body.attributes.forEach(Ba=>{var hl;const Gl=(hl=Ba.value.$cstNode)===null||hl===void 0?void 0:hl.text;Gl&&ha.setTemplateMapping(Ba.name,Gl)}),La}else throw new Error(`Invalid step - ${pa}`)}else return pa}async function handleOpenApiEvent(pa,ha){const ma=await invokeOpenApiEvent(pa.moduleName,pa.name,pa.attributesAsObject());ha.setLastResult(ma)}async function evaluateUpsert(pa,ha){ha.setInUpsertMode(!0);try{await evaluateCrudMap(pa,ha)}finally{ha.setInUpsertMode(!1)}}async function evaluateForEach(pa,ha){const ma=pa.var;await evaluatePattern(pa.src,ha);const ja=ha.getLastResult();if(ja instanceof Array&&ja.length>0){const La=Environment.from(ha),Ba=new Array;for(let hl=0;hl<ja.length;++hl)La.bind(ma,ja[hl]),await evaluateStatements(pa.statements,La),Ba.push(La.getLastResult());ha.setLastResult(Ba)}else ha.setLastResult(EmptyResult)}async function evaluateIf(pa,ha){await evaluateExpression(pa.cond,ha),ha.getLastResult()?await evaluateStatements(pa.statements,ha):pa.else!==void 0&&await evaluateStatements(pa.else.statements,ha)}async function evaluateDeleteHelper(pa,ha,ma){const ja=Environment.from(ma).setInDeleteMode(!0);await evaluatePattern(pa,ja),await maybeDeleteQueriedInstances(ja,ma,ha)}async function maybeDeleteQueriedInstances(pa,ha,ma=!1){const ja=pa.getLastResult();let La=Resolver.Default;if(ja instanceof Array)if(ja.length>0){La=await getResolverForPath(ja[0].name,ja[0].moduleName,pa);const Ba=new Array;for(let hl=0;hl<ja.length;++hl){await runPreDeleteEvents(ja[hl],ha);const Gl=await La.deleteInstance(ja[hl],ma);await runPostDeleteEvents(ja[hl],ha),Ba.push(Gl)}pa.setLastResult(Ba)}else pa.setLastResult(ja);else{La=await getResolverForPath(ja.name,ja.moduleName,pa),await runPreDeleteEvents(ja,ha);const Ba=await La.deleteInstance(ja,ma);await runPostDeleteEvents(ja,ha),pa.setLastResult(Ba)}ha.setLastResult(pa.getLastResult())}async function evaluateDelete(pa,ha){await evaluateDeleteHelper(pa.pattern,!1,ha)}async function evaluatePurge(pa,ha){await evaluateDeleteHelper(pa.pattern,!0,ha)}async function evaluateExpression(pa,ha){let ma=EmptyResult;if(isBinExpr$1(pa)){await evaluateExpression(pa.e1,ha);const ja=ha.getLastResult();if(pa.op=="or"){if(ja)return;await evaluateExpression(pa.e2,ha);return}else if(pa.op=="and"){if(!ja)return;await evaluateExpression(pa.e2,ha);return}if(ja==null){ha.setLastResult(void 0);return}await evaluateExpression(pa.e2,ha);const La=ha.getLastResult();if(La==null){ha.setLastResult(void 0);return}switch(pa.op){case"+":ma=ja+La;break;case"-":ma=ja-La;break;case"*":ma=ja*La;break;case"/":ma=ja/La;break;case"==":ma=ja==La;break;case"<":ma=ja<La;break;case">":ma=ja>La;break;case"<=":ma=ja<=La;break;case">=":ma=ja>=La;break;case"<>":case"!=":ma=ja!=La;break;case"like":ma=ja.startsWith(La);break;case"in":ma=La.find(Ba=>{});break;default:throw new Error(`Unrecognized binary operator: ${pa.op}`)}}else if(isNegExpr$1(pa))await evaluateExpression(pa.ne,ha),ma=-1*ha.getLastResult();else if(isGroup$2(pa))await evaluateExpression(pa.ge,ha),ma=ha.getLastResult();else if(isLiteral$1(pa)){await evaluateLiteral(pa,ha);return}else isNotExpr$1(pa)&&(await evaluateExpression(pa.ne,ha),ma=!ha.getLastResult());ha.setLastResult(ma)}async function getRef(pa,ha,ma){return Instance$1.IsInstance(ha)?ha.lookup(pa):ha instanceof Map?ha.get(pa):ha instanceof Object?ha[pa]:isPath$1(ha)?await getRef(pa,await dereferencePath(ha,ma),ma):void 0}async function followReference(pa,ha){const ma=splitRefs$1(ha);let ja=EmptyResult,La=pa;for(let Ba=0;Ba<ma.length;++Ba){const hl=ma[Ba],Gl=await getRef(hl,La,pa);if(Gl===void 0)return EmptyResult;ja=Gl,La=ja}return ja}async function dereferencePath(pa,ha){const ma=fqNameFromPath$1(pa);if(ma===void 0)throw new Error(`Failed to deduce entry-name from path - ${pa}`);const ja=new Environment("path-deref",ha);await parseAndEvaluateStatement(`{${ma} {${PathAttributeNameQuery$1} "${pa}"}}`,ha.getAuthContextUserId(),ja);const La=ja.getLastResult();if(La&&La instanceof Array&&La.length>0)return La[0]}async function applyFn(pa,ha,ma){const ja=pa.name;if(ja!==void 0){let La=null;if(pa.args!==void 0){La=new Array;for(let hl=0;hl<pa.args.length;++hl){const Gl=pa.args[hl];isLiteral$1(Gl)?await evaluateLiteral(Gl,ha):await evaluateExpression(Gl,ha),La.push(ha.getLastResult())}La.push(ha)}const Ba=await invokeModuleFn(ja,La,ma);ha.setLastResult(Ba)}}async function realizeArray(pa,ha){const ma=new Array;for(let ja=0;ja<pa.vals.length;++ja)await evaluateStatement(pa.vals[ja],ha),ma.push(ha.getLastResult());ha.setLastResult(ma)}async function realizeMap(pa,ha){const ma=new Map;for(let ja=0;ja<pa.entries.length;++ja){const La=pa.entries[ja],Ba=getMapKey(La.key);await evaluateExpression(La.value,ha),ma.set(Ba,ha.getLastResult())}ha.setLastResult(Object.fromEntries(ma.entries()))}async function callPostEventOnSubscription(pa,ha,ma){const ja=ma===void 0,La=new Environment("onSubs.env");try{return await runPrePostEvents(pa,!1,ha,La),ja&&await La.commitAllTransactions(),La.getLastResult()}catch(Ba){await La.rollbackAllTransactions(),logger$3.error(`callPostEventOnSubscription failed for ${pa} ${ha.getFqName()} - ${Ba}`)}}async function runPrePostEvents(pa,ha,ma,ja){const La=ha?ma.record.getPreTriggerInfo(pa):ma.record.getPostTriggerInfo(pa);if(La){const Ba=nameToPath$1(La.eventName),hl=Ba.hasModule()?Ba.getModuleName():ma.record.moduleName,Gl=makeInstance$1(hl,Ba.getEntryName(),newInstanceAttributes$1().set(ma.record.name,ma)),zl=ja.getActiveAuthContext();zl&&Gl.setAuthContext(zl);const Wl=`${ha?"Pre":"Post"}-${CrudType$1[pa]} ${ma.record.getFqName()}`,Kl=au=>{logger$3.debug(`${Wl}: ${au}`)},su=au=>{throw ja.hasHandlers()?au:new Error(`${Wl}: ${au}`)};La.async?evaluate$1(Gl,Kl,bindAliasesForPrePost(ja,ma,Wl)).catch(su):await evaluate$1(Gl,Kl,bindAliasesForPrePost(ja,ma,Wl)).catch(su)}}function bindAliasesForPrePost(pa,ha,ma){const ja=new Environment(`${ma}.env`,pa),La=ha.getFqName();return ja.bind("this",ha),ja.bind(La,ha),ja.bind(ha.name,ha),ja}async function runPreCreateEvents(pa,ha){await runPrePostEvents(CrudType$1.CREATE,!0,pa,ha)}async function runPostCreateEvents(pa,ha){pa.requireAudit()&&await addCreateAudit(pa.getPath(),ha),await runPrePostEvents(CrudType$1.CREATE,!1,pa,ha)}async function runPreUpdateEvents(pa,ha){await runPrePostEvents(CrudType$1.UPDATE,!0,pa,ha)}async function runPostUpdateEvents(pa,ha,ma){pa.requireAudit()&&await addUpdateAudit(pa.getPath(),ha,ma),await runPrePostEvents(CrudType$1.UPDATE,!1,pa,ma)}async function runPreDeleteEvents(pa,ha){await runPrePostEvents(CrudType$1.DELETE,!0,pa,ha)}async function runPostDeleteEvents(pa,ha){pa.requireAudit()&&await addDeleteAudit(pa.getPath(),pa,ha),await runPrePostEvents(CrudType$1.DELETE,!1,pa,ha)}const interpreter=Object.freeze(Object.defineProperty({__proto__:null,DocEventName,Environment,GlobalEnvironment,PatternHandler,callPostEventOnSubscription,evaluate:evaluate$1,evaluateAsEvent,evaluateExpression,evaluatePattern,evaluateStatement,evaluateStatements,handleAgentInvocation,handleOpenApiEvent,makeEventEvaluator,maybeBindStatementResultToAlias,maybeDeleteQueriedInstances,parseAndEvaluateStatement,restartFlow,runPostCreateEvents,runPostDeleteEvents,runPostUpdateEvents},Symbol.toStringTag,{value:"Module"}));class JwtBaseError extends Error{}class FailedAssertionError extends JwtBaseError{constructor(ha,ma,ja){super(ha),this.failedAssertion={actual:ma,expected:ja}}}class JwtParseError extends JwtBaseError{constructor(ha,ma){const ja=ma!=null?`${ha}: ${ma}`:ha;super(ja)}}class ParameterValidationError extends JwtBaseError{}class JwtInvalidSignatureError extends JwtBaseError{}class JwtInvalidSignatureAlgorithmError extends FailedAssertionError{}class JwtInvalidClaimError extends FailedAssertionError{withRawJwt({header:ha,payload:ma}){return this.rawJwt={header:ha,payload:ma},this}}class JwtInvalidIssuerError extends JwtInvalidClaimError{}class JwtInvalidAudienceError extends JwtInvalidClaimError{}class JwtInvalidScopeError extends JwtInvalidClaimError{}class JwtExpiredError extends JwtInvalidClaimError{}class JwtNotBeforeError extends JwtInvalidClaimError{}class CognitoJwtInvalidGroupError extends JwtInvalidClaimError{}class CognitoJwtInvalidTokenUseError extends JwtInvalidClaimError{}class CognitoJwtInvalidClientIdError extends JwtInvalidClaimError{}class JwksValidationError extends JwtBaseError{}class JwkValidationError extends JwtBaseError{}class JwtWithoutValidKidError extends JwtBaseError{}class KidNotFoundInJwksError extends JwtBaseError{}class WaitPeriodNotYetEndedJwkError extends JwtBaseError{}class JwksNotAvailableInCacheError extends JwtBaseError{}class JwkInvalidUseError extends FailedAssertionError{}class JwkInvalidKtyError extends FailedAssertionError{}class FetchError extends JwtBaseError{constructor(ha,ma){super(`Failed to fetch ${ha}: ${ma}`)}}class NonRetryableFetchError extends FetchError{}class NotSupportedError extends JwtBaseError{}var NamedCurvesWebCrypto;(function(pa){pa.ES256="P-256",pa.ES384="P-384",pa.ES512="P-521"})(NamedCurvesWebCrypto||(NamedCurvesWebCrypto={}));const nodeWebCompat={fetch:async(pa,ha,ma)=>{const ja=Number(ha?.responseTimeout);if(ja){const Ba=new AbortController;setTimeout(()=>Ba.abort(new FetchError(pa,`Response time-out (after ${ja} ms.)`)),ja),ha={signal:Ba.signal,...ha}}const La=await fetch(pa,{...ha,body:ma}).catch(Ba=>{throw new FetchError(pa,Ba.message)});if(La.status!==200)throw new NonRetryableFetchError(pa,`Status code is ${La.status}, expected 200`);return La.arrayBuffer()},defaultFetchTimeouts:{response:3e3},transformJwkToKeyObjectSync:()=>{throw new NotSupportedError("Synchronously transforming a JWK into a key object is not supported in the browser")},transformJwkToKeyObjectAsync:(pa,ha)=>{const ma=pa.alg??ha;if(!ma)throw new JwtInvalidSignatureAlgorithmError("Missing alg on both JWK and JWT header",ma);const ja=ma.startsWith("RS")?{name:"RSASSA-PKCS1-v1_5",hash:`SHA-${ma.slice(2)}`}:ma.startsWith("ES")?{name:"ECDSA",namedCurve:NamedCurvesWebCrypto[ma]}:pa.crv;return crypto.subtle.importKey("jwk",pa,ja,!1,["verify"]).then(La=>({key:La,jwk:pa}))},verifySignatureSync:()=>{throw new NotSupportedError("Synchronously verifying a JWT signature is not supported in the browser")},verifySignatureAsync:({jwsSigningInput:pa,keyObject:ha,signature:ma,alg:ja})=>crypto.subtle.verify(ja.startsWith("RS")?{name:"RSASSA-PKCS1-v1_5"}:ja.startsWith("ES")?{name:"ECDSA",hash:`SHA-${ja.slice(2)}`}:{name:ha.jwk.crv},ha.key,bufferFromBase64url(ma),new TextEncoder().encode(pa)),parseB64UrlString:pa=>new TextDecoder().decode(bufferFromBase64url(pa)),setTimeoutUnref:setTimeout.bind(void 0),transformPemToJwk:async(pa,ha)=>{let ma;switch(ha){case"RS256":case"RS384":case"RS512":ma={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${ha.slice(2)}`};break;case"ES256":case"ES384":case"ES512":ma={name:"ECDSA",namedCurve:NamedCurvesWebCrypto[ha]};break;default:throw new JwtInvalidSignatureAlgorithmError("Unsupported signature algorithm",ha)}const ja=await crypto.subtle.importKey("spki",bufferFromBase64(new TextDecoder().decode(pa).replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,"")),ma,!0,["verify"]);return crypto.subtle.exportKey("jwk",ja)}};function _bufferFromBase64(pa){const ha=pa.split("").reduce((ma,ja,La)=>Object.assign(ma,{[ja.charCodeAt(0)]:La}),{});return function(ma){ma=ma.replace(/={1,2}$/,"");let ja,La,Ba,hl;return ma.match(/.{1,4}/g).reduce((Gl,zl,Wl)=>(ja=ha[zl.charCodeAt(0)],La=ha[zl.charCodeAt(1)],Ba=ha[zl.charCodeAt(2)],hl=ha[zl.charCodeAt(3)],Gl[3*Wl]=ja<<2|La>>4,Gl[3*Wl+1]=(La&15)<<4|Ba>>2,Gl[3*Wl+2]=(Ba&3)<<6|hl,Gl),new Uint8Array(ma.length*3/4))}}const bufferFromBase64url=_bufferFromBase64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),bufferFromBase64=_bufferFromBase64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),fetch$1=nodeWebCompat.fetch.bind(void 0);class SimpleFetcher{constructor(ha){this.defaultRequestOptions={timeout:nodeWebCompat.defaultFetchTimeouts.socketIdle,responseTimeout:nodeWebCompat.defaultFetchTimeouts.response,...ha?.defaultRequestOptions}}async fetch(ha,ma,ja){ma={...this.defaultRequestOptions,...ma};try{return await fetch$1(ha,ma,ja)}catch(La){if(La instanceof NonRetryableFetchError)throw La;return fetch$1(ha,ma,ja)}}}function isJsonObject(pa){return typeof pa=="object"&&!Array.isArray(pa)&&pa!==null}function safeJsonParse(pa){return JSON.parse(pa,(ha,ma)=>(typeof ma=="object"&&!Array.isArray(ma)&&ma!==null&&(delete ma.__proto__,delete ma.constructor),ma))}function assertStringEquals(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. Expected: ${ma}`,ha,ma);if(typeof ha!="string")throw new ja(`${pa} is not of type string`,ha,ma);if(ma!==ha)throw new ja(`${pa} not allowed: ${ha}. Expected: ${ma}`,ha,ma)}function assertStringArrayContainsString(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. ${expectationMessage(ma)}`,ha,ma);if(typeof ha!="string")throw new ja(`${pa} is not of type string`,ha,ma);return assertStringArraysOverlap(pa,ha,ma,ja)}function assertStringArraysOverlap(pa,ha,ma,ja=FailedAssertionError){if(!ha)throw new ja(`Missing ${pa}. ${expectationMessage(ma)}`,ha,ma);const La=new Set(Array.isArray(ma)?ma:[ma]);if(typeof ha=="string"&&(ha=[ha]),!Array.isArray(ha))throw new ja(`${pa} is not an array`,ha,ma);if(!ha.some(hl=>{if(typeof hl!="string")throw new ja(`${pa} includes elements that are not of type string`,ha,ma);return La.has(hl)}))throw new ja(`${pa} not allowed: ${ha.join(", ")}. ${expectationMessage(ma)}`,ha,ma)}function expectationMessage(pa){return Array.isArray(pa)?pa.length>1?`Expected one of: ${pa.join(", ")}`:`Expected: ${pa[0]}`:`Expected: ${pa}`}function assertIsNotPromise(pa,ha){if(pa&&typeof pa.then=="function")throw ha()}const optionalJwkFieldNames=["use","alg","kid","n","e","x","y","crv"],mandatoryJwkFieldNames=["kty"];function findJwkInJwks(pa,ha){return pa.keys.find(ma=>ma.kid!=null&&ma.kid===ha)}const parseJwks=function(pa){let ha;try{const ma=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(pa);ha=safeJsonParse(ma)}catch(ma){throw new JwksValidationError(`JWKS could not be parsed as JSON: ${ma}`)}return assertIsJwks(ha),ha};function assertIsJwks(pa){if(!pa)throw new JwksValidationError("JWKS empty");if(!isJsonObject(pa))throw new JwksValidationError("JWKS should be an object");if(!Object.keys(pa).includes("keys"))throw new JwksValidationError("JWKS does not include keys");if(!Array.isArray(pa.keys))throw new JwksValidationError("JWKS keys should be an array");for(const ha of pa.keys)assertIsJwk(ha)}function assertIsSignatureJwk(pa){assertStringArrayContainsString("JWK kty",pa.kty,["EC","RSA","OKP"],JwkInvalidKtyError),pa.kty==="EC"?assertIsEsSignatureJwk(pa):pa.kty==="RSA"?assertIsRsaSignatureJwk(pa):pa.kty==="OKP"&&assertIsEdDSASignatureJwk(pa)}function assertIsEdDSASignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"OKP",JwkInvalidKtyError),!pa.crv)throw new JwkValidationError("Missing Curve (crv)");if(!pa.x)throw new JwkValidationError("Missing X Coordinate (x)")}function assertIsEsSignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"EC",JwkInvalidKtyError),!pa.crv)throw new JwkValidationError("Missing Curve (crv)");if(!pa.x)throw new JwkValidationError("Missing X Coordinate (x)");if(!pa.y)throw new JwkValidationError("Missing Y Coordinate (y)")}function assertIsRsaSignatureJwk(pa){if(pa.use&&assertStringEquals("JWK use",pa.use,"sig",JwkInvalidUseError),assertStringEquals("JWK kty",pa.kty,"RSA",JwkInvalidKtyError),!pa.n)throw new JwkValidationError("Missing modulus (n)");if(!pa.e)throw new JwkValidationError("Missing exponent (e)")}function assertIsJwk(pa){if(!pa)throw new JwkValidationError("JWK empty");if(!isJsonObject(pa))throw new JwkValidationError("JWK should be an object");for(const ha of mandatoryJwkFieldNames)if(typeof pa[ha]!="string")throw new JwkValidationError(`JWK ${ha} should be a string`);for(const ha of optionalJwkFieldNames)if(ha in pa&&typeof pa[ha]!="string")throw new JwkValidationError(`JWK ${ha} should be a string`)}function isJwks(pa){try{return assertIsJwks(pa),!0}catch{return!1}}function isJwk(pa){try{return assertIsJwk(pa),!0}catch{return!1}}class SimplePenaltyBox{constructor(ha){this.waitingUris=new Map,this.waitSeconds=ha?.waitSeconds??10}async wait(ha){if(this.waitingUris.has(ha))throw new WaitPeriodNotYetEndedJwkError("Not allowed to fetch JWKS yet, still waiting for back off period to end")}release(ha){const ma=this.waitingUris.get(ha);ma&&(clearTimeout(ma),this.waitingUris.delete(ha))}registerFailedAttempt(ha){const ma=nodeWebCompat.setTimeoutUnref(()=>{this.waitingUris.delete(ha)},this.waitSeconds*1e3);this.waitingUris.set(ha,ma)}registerSuccessfulAttempt(ha){this.release(ha)}}class SimpleJwksCache{constructor(ha){this.jwksCache=new Map,this.fetchingJwks=new Map,this.penaltyBox=ha?.penaltyBox??new SimplePenaltyBox,this.fetcher=ha?.fetcher??new SimpleFetcher,this.jwksParser=ha?.jwksParser??parseJwks}addJwks(ha,ma){this.jwksCache.set(ha,ma)}async getJwks(ha){const ma=this.fetchingJwks.get(ha);if(ma)return ma;const ja=this.fetcher.fetch(ha).then(this.jwksParser);this.fetchingJwks.set(ha,ja);let La;try{La=await ja}finally{this.fetchingJwks.delete(ha)}return this.jwksCache.set(ha,La),La}getCachedJwk(ha,ma){if(typeof ma.header.kid!="string")throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");if(!this.jwksCache.has(ha))throw new JwksNotAvailableInCacheError(`JWKS for uri ${ha} not yet available in cache`);const ja=findJwkInJwks(this.jwksCache.get(ha),ma.header.kid);if(!ja)throw new KidNotFoundInJwksError(`JWK for kid ${ma.header.kid} not found in the JWKS`);return ja}async getJwk(ha,ma){if(typeof ma.header.kid!="string")throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");const ja=this.jwksCache.get(ha);if(ja){const hl=findJwkInJwks(ja,ma.header.kid);if(hl)return hl}await this.penaltyBox.wait(ha,ma.header.kid);const La=await this.getJwks(ha),Ba=findJwkInJwks(La,ma.header.kid);if(Ba)this.penaltyBox.registerSuccessfulAttempt(ha,ma.header.kid);else throw this.penaltyBox.registerFailedAttempt(ha,ma.header.kid),new KidNotFoundInJwksError(`JWK for kid "${ma.header.kid}" not found in the JWKS`);return Ba}}function assertJwtHeader(pa){if(!isJsonObject(pa))throw new JwtParseError("JWT header is not an object");if(pa.alg!==void 0&&typeof pa.alg!="string")throw new JwtParseError("JWT header alg claim is not a string");if(pa.kid!==void 0&&typeof pa.kid!="string")throw new JwtParseError("JWT header kid claim is not a string")}function assertJwtPayload(pa){if(!isJsonObject(pa))throw new JwtParseError("JWT payload is not an object");if(pa.exp!==void 0&&!Number.isFinite(pa.exp))throw new JwtParseError("JWT payload exp claim is not a number");if(pa.iss!==void 0&&typeof pa.iss!="string")throw new JwtParseError("JWT payload iss claim is not a string");if(pa.sub!==void 0&&typeof pa.sub!="string")throw new JwtParseError("JWT payload sub claim is not a string");if(pa.aud!==void 0&&typeof pa.aud!="string"&&(!Array.isArray(pa.aud)||pa.aud.some(ha=>typeof ha!="string")))throw new JwtParseError("JWT payload aud claim is not a string or array of strings");if(pa.nbf!==void 0&&!Number.isFinite(pa.nbf))throw new JwtParseError("JWT payload nbf claim is not a number");if(pa.iat!==void 0&&!Number.isFinite(pa.iat))throw new JwtParseError("JWT payload iat claim is not a number");if(pa.scope!==void 0&&typeof pa.scope!="string")throw new JwtParseError("JWT payload scope claim is not a string");if(pa.jti!==void 0&&typeof pa.jti!="string")throw new JwtParseError("JWT payload jti claim is not a string")}const JWT_REGEX=/^[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}$/;function decomposeUnverifiedJwt(pa){if(!pa)throw new JwtParseError("Empty JWT");if(typeof pa!="string")throw new JwtParseError("JWT is not a string");if(!JWT_REGEX.test(pa))throw new JwtParseError("JWT string does not consist of exactly 3 parts (header, payload, signature)");const[ha,ma,ja]=pa.split("."),[La,Ba]=[ha,ma].map(nodeWebCompat.parseB64UrlString);let hl;try{hl=safeJsonParse(La)}catch(zl){throw new JwtParseError("Invalid JWT. Header is not a valid JSON object",zl)}assertJwtHeader(hl);let Gl;try{Gl=safeJsonParse(Ba)}catch(zl){throw new JwtParseError("Invalid JWT. Payload is not a valid JSON object",zl)}return assertJwtPayload(Gl),{header:hl,headerB64:ha,payload:Gl,payloadB64:ma,signatureB64:ja}}function validateJwtFields(pa,ha){if(pa.exp!==void 0&&pa.exp+(ha.graceSeconds??0)<Date.now()/1e3)throw new JwtExpiredError(`Token expired at ${new Date(pa.exp*1e3).toISOString()}`,pa.exp);if(pa.nbf!==void 0&&pa.nbf-(ha.graceSeconds??0)>Date.now()/1e3)throw new JwtNotBeforeError(`Token can't be used before ${new Date(pa.nbf*1e3).toISOString()}`,pa.nbf);if(ha.issuer!==null){if(ha.issuer===void 0)throw new ParameterValidationError("issuer must be provided or set to null explicitly");assertStringArrayContainsString("Issuer",pa.iss,ha.issuer,JwtInvalidIssuerError)}if(ha.audience!==null){if(ha.audience===void 0)throw new ParameterValidationError("audience must be provided or set to null explicitly");assertStringArraysOverlap("Audience",pa.aud,ha.audience,JwtInvalidAudienceError)}ha.scope!=null&&assertStringArraysOverlap("Scope",pa.scope?.split(" "),ha.scope,JwtInvalidScopeError)}const supportedSignatureAlgorithms=["RS256","RS384","RS512","ES256","ES384","ES512","EdDSA"];function validateJwtHeaderAndJwk(pa,ha){assertIsSignatureJwk(ha),ha.alg&&assertStringEquals("JWT signature algorithm",pa.alg,ha.alg,JwtInvalidSignatureAlgorithmError),assertStringArrayContainsString("JWT signature algorithm",pa.alg,supportedSignatureAlgorithms,JwtInvalidSignatureAlgorithmError)}async function verifyDecomposedJwt(pa,ha,ma,ja,La){const{header:Ba,headerB64:hl,payload:Gl,payloadB64:zl,signatureB64:Wl}=pa,Kl=await ja(ha,pa);validateJwtHeaderAndJwk(pa.header,Kl);const su=await La(Kl,Ba.alg,Gl.iss);if(!await nodeWebCompat.verifySignatureAsync({jwsSigningInput:`${hl}.${zl}`,signature:Wl,alg:Ba.alg,keyObject:su}))throw new JwtInvalidSignatureError("Invalid signature");try{validateJwtFields(Gl,ma),ma.customJwtCheck&&await ma.customJwtCheck({header:Ba,payload:Gl,jwk:Kl})}catch(ou){throw ma.includeRawJwtInErrors&&ou instanceof JwtInvalidClaimError?ou.withRawJwt(pa):ou}return Gl}function verifyDecomposedJwtSync(pa,ha,ma,ja){const{header:La,headerB64:Ba,payload:hl,payloadB64:Gl,signatureB64:zl}=pa;let Wl;if(isJwk(ha))Wl=ha;else if(isJwks(ha)){const au=La.kid?findJwkInJwks(ha,La.kid):void 0;if(!au)throw new KidNotFoundInJwksError(`JWK for kid ${La.kid} not found in the JWKS`);Wl=au}else throw new ParameterValidationError([`Expected a valid JWK or JWKS (parsed as JavaScript object), but received: ${ha}.`,"If you're passing a JWKS URI, use the async verify() method instead, it will download and parse the JWKS for you"].join());validateJwtHeaderAndJwk(pa.header,Wl);const Kl=ja(Wl,La.alg,hl.iss);if(!nodeWebCompat.verifySignatureSync({jwsSigningInput:`${Ba}.${Gl}`,signature:zl,alg:La.alg,keyObject:Kl}))throw new JwtInvalidSignatureError("Invalid signature");try{if(validateJwtFields(hl,ma),ma.customJwtCheck){const au=ma.customJwtCheck({header:La,payload:hl,jwk:Wl});assertIsNotPromise(au,()=>new ParameterValidationError("Custom JWT checks must be synchronous but a promise was returned"))}}catch(au){throw ma.includeRawJwtInErrors&&au instanceof JwtInvalidClaimError?au.withRawJwt(pa):au}return hl}class JwtVerifierBase{constructor(ha,ma=new SimpleJwksCache){if(this.jwksCache=ma,this.issuersConfig=new Map,this.publicKeyCache=new KeyObjectCache,Array.isArray(ha)){if(!ha.length)throw new ParameterValidationError("Provide at least one issuer configuration");ha.forEach((ja,La)=>{if(this.issuersConfig.has(ja.issuer))throw new ParameterValidationError(`issuer ${ja.issuer} supplied multiple times`);if(ja.issuer===null&&ha.length>=2)throw new ParameterValidationError(`issuer cannot be null when multiple issuers are supplied (at issuer: ${La})`);this.issuersConfig.set(ja.issuer,this.withJwksUri(ja))})}else this.issuersConfig.set(ha.issuer,this.withJwksUri(ha))}getIssuerConfig(ha){if(this.issuersConfig.size===1&&(ha=this.issuersConfig.keys().next().value),ha===void 0)throw new ParameterValidationError("issuer must be provided");const ma=this.issuersConfig.get(ha);if(!ma)throw new ParameterValidationError(`issuer not configured: ${ha}`);return ma}cacheJwks(...[ha,ma]){const ja=this.getIssuerConfig(ma);this.jwksCache.addJwks(ja.jwksUri,ha),this.publicKeyCache.clearCache(ja.issuer)}async hydrate(){const ha=Array.from(this.issuersConfig.values()).map(({jwksUri:ma})=>this.jwksCache.getJwks(ma));await Promise.all(ha)}verifySync(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);return this.verifyDecomposedJwtSync(ja,La,Ba)}verifyDecomposedJwtSync(ha,ma,ja){const La=this.jwksCache.getCachedJwk(ma,ha);return verifyDecomposedJwtSync(ha,La,ja,this.publicKeyCache.transformJwkToKeyObjectSync.bind(this.publicKeyCache))}async verify(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);return this.verifyDecomposedJwt(ja,La,Ba)}verifyDecomposedJwt(ha,ma,ja){return verifyDecomposedJwt(ha,ma,ja,this.jwksCache.getJwk.bind(this.jwksCache),this.publicKeyCache.transformJwkToKeyObjectAsync.bind(this.publicKeyCache))}getVerifyParameters(ha,ma){const ja=decomposeUnverifiedJwt(ha),La=this.getIssuerConfig(ja.payload.iss);return{decomposedJwt:ja,jwksUri:La.jwksUri,verifyProperties:{...La,...ma}}}withJwksUri(ha){if(ha.jwksUri)return ha;const ma=ha.issuer;if(!ma)throw new ParameterValidationError("jwksUri must be provided for issuer null");const ja=new URL(ma).pathname.replace(/\/$/,"");return{jwksUri:new URL(`${ja}/.well-known/jwks.json`,ma).href,...ha}}}class KeyObjectCache{constructor(ha=nodeWebCompat.transformJwkToKeyObjectSync,ma=nodeWebCompat.transformJwkToKeyObjectAsync){this.transformJwkToKeyObjectSyncFn=ha,this.transformJwkToKeyObjectAsyncFn=ma,this.publicKeys=new Map}transformJwkToKeyObjectSync(ha,ma,ja){const La=ha.alg??ma;if(!ja||!ha.kid||!La)return this.transformJwkToKeyObjectSyncFn(ha,La,ja);const Ba=this.publicKeys.get(ja)?.get(ha.kid)?.get(La);if(Ba)return Ba;const hl=this.transformJwkToKeyObjectSyncFn(ha,La,ja);return this.putKeyObjectInCache(ja,ha.kid,La,hl),hl}async transformJwkToKeyObjectAsync(ha,ma,ja){const La=ha.alg??ma;if(!ja||!ha.kid||!La)return this.transformJwkToKeyObjectAsyncFn(ha,La,ja);const Ba=this.publicKeys.get(ja)?.get(ha.kid)?.get(La);if(Ba)return Ba;const hl=await this.transformJwkToKeyObjectAsyncFn(ha,La,ja);return this.putKeyObjectInCache(ja,ha.kid,La,hl),hl}putKeyObjectInCache(ha,ma,ja,La){const Ba=this.publicKeys.get(ha),hl=Ba?.get(ma);hl?hl.set(ja,La):Ba?Ba.set(ma,new Map([[ja,La]])):this.publicKeys.set(ha,new Map([[ma,new Map([[ja,La]])]]))}clearCache(ha){this.publicKeys.delete(ha)}}function validateCognitoJwtFields(pa,ha){if(ha.groups!=null&&assertStringArraysOverlap("Cognito group",pa["cognito:groups"],ha.groups,CognitoJwtInvalidGroupError),assertStringArrayContainsString("Token use",pa.token_use,["id","access"],CognitoJwtInvalidTokenUseError),ha.tokenUse!==null){if(ha.tokenUse===void 0)throw new ParameterValidationError("tokenUse must be provided or set to null explicitly");assertStringEquals("Token use",pa.token_use,ha.tokenUse,CognitoJwtInvalidTokenUseError)}if(ha.clientId!==null){if(ha.clientId===void 0)throw new ParameterValidationError("clientId must be provided or set to null explicitly");pa.token_use==="id"?assertStringArrayContainsString('Client ID ("audience")',pa.aud,ha.clientId,CognitoJwtInvalidClientIdError):assertStringArrayContainsString("Client ID",pa.client_id,ha.clientId,CognitoJwtInvalidClientIdError)}}class CognitoJwtVerifier extends JwtVerifierBase{constructor(ha,ma){const ja=Array.isArray(ha)?ha.map(La=>({...La,...CognitoJwtVerifier.parseUserPoolId(La.userPoolId),audience:null})):{...ha,...CognitoJwtVerifier.parseUserPoolId(ha.userPoolId),audience:null};super(ja,ma)}static parseUserPoolId(ha){const ma=ha.match(this.USER_POOL_ID_REGEX);if(!ma)throw new ParameterValidationError(`Invalid Cognito User Pool ID: ${ha}`);const La=`https://cognito-idp.${ma.groups.region}.amazonaws.com/${ha}`;return{issuer:La,jwksUri:`${La}/.well-known/jwks.json`}}static create(ha,ma){return new this(ha,ma?.jwksCache)}verifySync(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);this.verifyDecomposedJwtSync(ja,La,Ba);try{validateCognitoJwtFields(ja.payload,Ba)}catch(hl){throw Ba.includeRawJwtInErrors&&hl instanceof JwtInvalidClaimError?hl.withRawJwt(ja):hl}return ja.payload}async verify(...[ha,ma]){const{decomposedJwt:ja,jwksUri:La,verifyProperties:Ba}=this.getVerifyParameters(ha,ma);await this.verifyDecomposedJwt(ja,La,Ba);try{validateCognitoJwtFields(ja.payload,Ba)}catch(hl){throw Ba.includeRawJwtInErrors&&hl instanceof JwtInvalidClaimError?hl.withRawJwt(ja):hl}return ja.payload}cacheJwks(...[ha,ma]){let ja;if(ma!==void 0)ja=CognitoJwtVerifier.parseUserPoolId(ma).issuer;else if(Array.from(this.issuersConfig).length>1)throw new ParameterValidationError("userPoolId must be provided");const La=this.getIssuerConfig(ja);super.cacheJwks(ha,La.issuer)}}CognitoJwtVerifier.USER_POOL_ID_REGEX=/^(?<region>[a-z]{2}-(gov-)?[a-z]+-\d)_[a-zA-Z0-9]+$/;var __assign=function(){return __assign=Object.assign||function(ha){for(var ma,ja=1,La=arguments.length;ja<La;ja++){ma=arguments[ja];for(var Ba in ma)Object.prototype.hasOwnProperty.call(ma,Ba)&&(ha[Ba]=ma[Ba])}return ha},__assign.apply(this,arguments)};function __rest(pa,ha){var ma={};for(var ja in pa)Object.prototype.hasOwnProperty.call(pa,ja)&&ha.indexOf(ja)<0&&(ma[ja]=pa[ja]);if(pa!=null&&typeof Object.getOwnPropertySymbols=="function")for(var La=0,ja=Object.getOwnPropertySymbols(pa);La<ja.length;La++)ha.indexOf(ja[La])<0&&Object.prototype.propertyIsEnumerable.call(pa,ja[La])&&(ma[ja[La]]=pa[ja[La]]);return ma}function __awaiter(pa,ha,ma,ja){function La(Ba){return Ba instanceof ma?Ba:new ma(function(hl){hl(Ba)})}return new(ma||(ma=Promise))(function(Ba,hl){function Gl(Kl){try{Wl(ja.next(Kl))}catch(su){hl(su)}}function zl(Kl){try{Wl(ja.throw(Kl))}catch(su){hl(su)}}function Wl(Kl){Kl.done?Ba(Kl.value):La(Kl.value).then(Gl,zl)}Wl((ja=ja.apply(pa,ha||[])).next())})}function __generator(pa,ha){var ma={label:0,sent:function(){if(Ba[0]&1)throw Ba[1];return Ba[1]},trys:[],ops:[]},ja,La,Ba,hl=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return hl.next=Gl(0),hl.throw=Gl(1),hl.return=Gl(2),typeof Symbol=="function"&&(hl[Symbol.iterator]=function(){return this}),hl;function Gl(Wl){return function(Kl){return zl([Wl,Kl])}}function zl(Wl){if(ja)throw new TypeError("Generator is already executing.");for(;hl&&(hl=0,Wl[0]&&(ma=0)),ma;)try{if(ja=1,La&&(Ba=Wl[0]&2?La.return:Wl[0]?La.throw||((Ba=La.return)&&Ba.call(La),0):La.next)&&!(Ba=Ba.call(La,Wl[1])).done)return Ba;switch(La=0,Ba&&(Wl=[Wl[0]&2,Ba.value]),Wl[0]){case 0:case 1:Ba=Wl;break;case 4:return ma.label++,{value:Wl[1],done:!1};case 5:ma.label++,La=Wl[1],Wl=[0];continue;case 7:Wl=ma.ops.pop(),ma.trys.pop();continue;default:if(Ba=ma.trys,!(Ba=Ba.length>0&&Ba[Ba.length-1])&&(Wl[0]===6||Wl[0]===2)){ma=0;continue}if(Wl[0]===3&&(!Ba||Wl[1]>Ba[0]&&Wl[1]<Ba[3])){ma.label=Wl[1];break}if(Wl[0]===6&&ma.label<Ba[1]){ma.label=Ba[1],Ba=Wl;break}if(Ba&&ma.label<Ba[2]){ma.label=Ba[2],ma.ops.push(Wl);break}Ba[2]&&ma.ops.pop(),ma.trys.pop();continue}Wl=ha.call(pa,ma)}catch(Kl){Wl=[6,Kl],La=0}finally{ja=Ba=0}if(Wl[0]&5)throw Wl[1];return{value:Wl[0]?Wl[1]:void 0,done:!0}}}function __spreadArray(pa,ha,ma){if(ma||arguments.length===2)for(var ja=0,La=ha.length,Ba;ja<La;ja++)(Ba||!(ja in ha))&&(Ba||(Ba=Array.prototype.slice.call(ha,0,ja)),Ba[ja]=ha[ja]);return pa.concat(Ba||Array.prototype.slice.call(ha))}typeof SuppressedError=="function"&&SuppressedError;var define_process_env_default$2={};let fromEnv,CognitoIdentityProviderClient,SignUpCommand,ConfirmSignUp,ResendConfirmationCodeCommand,ForgotPasswordCommand,ConfirmForgotPasswordCommand,AdminGetUserCommand,InitiateAuthCommand,AdminCreateUserCommand,AdminDisableUserCommand,AdminEnableUserCommand,AdminDeleteUserCommand,RespondToAuthChallengeCommand,AuthenticationDetails,CognitoUser,CognitoUserPool,CognitoUserSession,CognitoIdToken,CognitoAccessToken,CognitoRefreshToken;if(isNodeEnv$1){fromEnv=(await __vitePreload(()=>import("./index.browser-BFl5jDO5.js"),__vite__mapDeps([26,19,27]))).fromEnv;const ha=await __vitePreload(()=>import("./index-C29ElNmj.js"),__vite__mapDeps([28,29,27,19,30,1,18,5,9,11,16,14,15,10,20,21,17,4]));CognitoIdentityProviderClient=ha.CognitoIdentityProviderClient,SignUpCommand=ha.SignUpCommand,ConfirmSignUp=ha.ConfirmSignUpCommand,ResendConfirmationCodeCommand=ha.ResendConfirmationCodeCommand,ForgotPasswordCommand=ha.ForgotPasswordCommand,ConfirmForgotPasswordCommand=ha.ConfirmForgotPasswordCommand,AdminGetUserCommand=ha.AdminGetUserCommand,InitiateAuthCommand=ha.InitiateAuthCommand,AdminCreateUserCommand=ha.AdminCreateUserCommand,AdminDisableUserCommand=ha.AdminDisableUserCommand,AdminEnableUserCommand=ha.AdminEnableUserCommand,AdminDeleteUserCommand=ha.AdminDeleteUserCommand,RespondToAuthChallengeCommand=ha.RespondToAuthChallengeCommand;const ma=await __vitePreload(()=>import("./index-BHDiPh0o.js"),__vite__mapDeps([31,1,4,5]));AuthenticationDetails=ma.AuthenticationDetails,CognitoUser=ma.CognitoUser,CognitoUserPool=ma.CognitoUserPool,CognitoUserSession=ma.CognitoUserSession,CognitoIdToken=ma.CognitoIdToken,CognitoAccessToken=ma.CognitoAccessToken,CognitoRefreshToken=ma.CognitoRefreshToken}const defaultConfig$1=isNodeEnv$1?new Map().set("UserPoolId",define_process_env_default$2.COGNITO_USER_POOL_ID).set("ClientId",define_process_env_default$2.COGNITO_CLIENT_ID):new Map;function handleCognitoError(pa,ha){var ma;const ja=sanitizeErrorMessage(pa.message||"");switch(logger$3.error(`Cognito error in ${ha}: ${pa.name} - ${ja}`,{errorName:pa.name,errorCode:pa.code,context:ha,statusCode:(ma=pa.$metadata)===null||ma===void 0?void 0:ma.httpStatusCode}),pa.name){case"UserNotFoundException":throw logger$3.debug(`User not found in context: ${ha}`),new UserNotFoundError$1("User account not found. Please check your email or sign up.");case"NotAuthorizedException":throw pa.message&&pa.message.includes("password")?(logger$3.debug(`Invalid password attempt in context: ${ha}`),new UnauthorisedError$1("Invalid password. Please try again.")):pa.message&&pa.message.includes("not confirmed")?(logger$3.debug(`User not confirmed in context: ${ha}`),new UserNotConfirmedError$1):(logger$3.debug(`Authentication failed in context: ${ha}`),new UnauthorisedError$1("Authentication failed. Please check your credentials."));case"UserNotConfirmedException":throw logger$3.debug(`User not confirmed in context: ${ha}`),new UserNotConfirmedError$1;case"PasswordResetRequiredException":throw logger$3.debug(`Password reset required in context: ${ha}`),new PasswordResetRequiredError$1;case"TooManyRequestsException":throw logger$3.warn(`Rate limit exceeded in context: ${ha}`),new TooManyRequestsError$1;case"TooManyFailedAttemptsException":throw logger$3.warn(`Too many failed attempts in context: ${ha}`),new TooManyRequestsError$1("Too many failed login attempts. Please try again later.");case"InvalidParameterException":throw logger$3.debug(`Invalid parameters in context: ${ha}`),new InvalidParameterError$1(sanitizeErrorMessage(pa.message)||"Invalid parameters provided");case"ExpiredCodeException":throw logger$3.debug(`Expired code in context: ${ha}`),new ExpiredCodeError$1;case"CodeMismatchException":throw logger$3.debug(`Code mismatch in context: ${ha}`),new CodeMismatchError$1;case"UsernameExistsException":throw logger$3.debug(`Username exists in context: ${ha}`),new BadRequestError$4("An account with this email already exists.");case"InvalidPasswordException":throw logger$3.debug(`Invalid password format in context: ${ha}`),new BadRequestError$4("Password does not meet requirements. It must be at least 8 characters long and contain uppercase, lowercase, numbers, and special characters.");case"LimitExceededException":throw logger$3.warn(`Service limit exceeded in context: ${ha}`),new TooManyRequestsError$1("Service limit exceeded. Please try again later.");case"InternalErrorException":throw logger$3.error(`Internal Cognito error in context: ${ha}`),new Error("Authentication service is temporarily unavailable. Please try again later.");case"ResourceNotFoundException":throw logger$3.error(`Resource not found in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");case"AliasExistsException":throw logger$3.debug(`Alias exists in context: ${ha}`),new BadRequestError$4("An account with this email already exists.");case"InvalidEmailRoleAccessPolicyException":throw logger$3.error(`Invalid email role access policy in context: ${ha}`),new Error("Email service configuration error. Please contact support.");case"UserLambdaValidationException":throw logger$3.error(`User lambda validation error in context: ${ha}`),new BadRequestError$4("User validation failed. Please check your input and try again.");case"UnsupportedUserStateException":throw logger$3.debug(`Unsupported user state in context: ${ha}`),new UserNotConfirmedError$1("User account is in an unsupported state. Please contact support.");case"MFAMethodNotFoundException":throw logger$3.debug(`MFA method not found in context: ${ha}`),new BadRequestError$4("MFA method not found. Please set up MFA and try again.");case"CodeDeliveryFailureException":throw logger$3.error(`Code delivery failure in context: ${ha}`),new Error("Unable to deliver verification code. Please try again later.");case"DuplicateProviderException":throw logger$3.error(`Duplicate provider in context: ${ha}`),new BadRequestError$4("Authentication provider already exists.");case"EnableSoftwareTokenMFAException":throw logger$3.debug(`Software token MFA required in context: ${ha}`),new BadRequestError$4("Software token MFA setup required.");case"ForbiddenException":throw logger$3.warn(`Forbidden access in context: ${ha}`),new UnauthorisedError$1("Access forbidden. Please check your permissions.");case"GroupExistsException":throw logger$3.debug(`Group exists in context: ${ha}`),new BadRequestError$4("Group already exists.");case"InvalidLambdaResponseException":throw logger$3.error(`Invalid lambda response in context: ${ha}`),new Error("Authentication service error. Please try again later.");case"InvalidOAuthFlowException":throw logger$3.error(`Invalid OAuth flow in context: ${ha}`),new BadRequestError$4("Invalid OAuth flow. Please try again.");case"InvalidSmsRoleAccessPolicyException":throw logger$3.error(`Invalid SMS role access policy in context: ${ha}`),new Error("SMS service configuration error. Please contact support.");case"InvalidSmsRoleTrustRelationshipException":throw logger$3.error(`Invalid SMS role trust relationship in context: ${ha}`),new Error("SMS service configuration error. Please contact support.");case"InvalidUserPoolConfigurationException":throw logger$3.error(`Invalid user pool configuration in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");case"PreconditionNotMetException":throw logger$3.debug(`Precondition not met in context: ${ha}`),new BadRequestError$4("Precondition not met. Please check your request and try again.");case"ScopeDoesNotExistException":throw logger$3.error(`Scope does not exist in context: ${ha}`),new BadRequestError$4("Invalid scope. Please check your request.");case"UnexpectedLambdaException":throw logger$3.error(`Unexpected lambda exception in context: ${ha}`),new Error("Authentication service error. Please try again later.");case"UserImportInProgressException":throw logger$3.warn(`User import in progress in context: ${ha}`),new TooManyRequestsError$1("User import in progress. Please try again later.");case"UserPoolTaggingException":throw logger$3.error(`User pool tagging exception in context: ${ha}`),new Error("Authentication service configuration error. Please contact support.");default:throw logger$3.error(`Unhandled Cognito error: ${pa.name}`,{errorName:pa.name,errorCode:pa.code,context:ha}),new Error(`Authentication error: ${sanitizeErrorMessage(pa.message)||"An unexpected error occurred"}`)}}function sanitizeErrorMessage(pa){return pa?pa.replace(/password/gi,"[REDACTED]").replace(/token/gi,"[REDACTED]").replace(/secret/gi,"[REDACTED]").replace(/key/gi,"[REDACTED]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[EMAIL_REDACTED]").replace(/\b[A-Fa-f0-9]{32,}\b/g,"[TOKEN_REDACTED]").replace(/\b\d{4,}\b/g,"[NUMBER_REDACTED]"):""}class CognitoAuth{constructor(ha){this.config=ha||defaultConfig$1;const ma=this.config.get("UserPoolId");ma&&(this.userPool=new CognitoUserPool({UserPoolId:ma,ClientId:this.fetchClientId()}))}fetchUserPoolId(){return this.fetchConfig("UserPoolId")}fetchClientId(){return this.fetchConfig("ClientId")}fetchConfig(ha){const ma=this.config.get(ha);if(ma)return ma;throw new Error(`${ha} is not set`)}async signUp(ha,ma,ja,La,Ba,hl,Gl){const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Wl=[{Name:"email",Value:ja},{Name:"name",Value:ja},{Name:"given_name",Value:ha},{Name:"family_name",Value:ma}];Ba&&Ba.forEach((au,ou)=>{Wl.push({Name:ou,Value:au})});const Kl={ClientId:this.config.get("ClientId"),Username:ja,Password:La,UserAttributes:Wl,ValidationData:Wl},su=new SignUpCommand(Kl);try{logger$3.debug(`Attempting signup for user: ${ja}`);const au=await zl.send(su);if(au.$metadata.httpStatusCode==200){logger$3.info(`Signup successful for user: ${ja}`);const ou=await ensureUser(ja,ha,ma,hl,"Active"),$m={username:ja,firstName:ha,lastName:ma,id:ou.id,systemUserInfo:au.UserSub};Gl($m)}else throw logger$3.error(`Signup failed with HTTP status ${au.$metadata.httpStatusCode}`,{username:ja,statusCode:au.$metadata.httpStatusCode}),new BadRequestError$4(`Signup failed with status ${au.$metadata.httpStatusCode}`)}catch(au){if(au instanceof BadRequestError$4)throw au;logger$3.error(`Signup error for user ${ja}:`,{errorName:au.name,errorMessage:sanitizeErrorMessage(au.message)}),handleCognitoError(au,"signUp")}}async confirmSignup(ha,ma,ja){try{const La=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Ba=new ConfirmSignUp({ClientId:this.config.get("ClientId"),Username:ha,ConfirmationCode:ma});await La.send(Ba)}catch(La){logger$3.error(`Failed to confirm signup: ${La.message}`),handleCognitoError(La,"confirmSignup")}}async resendConfirmationCode(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new ResendConfirmationCodeCommand({ClientId:this.config.get("ClientId"),Username:ha});await ja.send(La)}catch(ja){logger$3.error(`Failed to resend confirmation code: ${ja.message}`),handleCognitoError(ja,"resendConfirmationCode")}}async forgotPassword(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new ForgotPasswordCommand({ClientId:this.fetchClientId(),Username:ha});await ja.send(La)}catch(ja){logger$3.error(`Forgot password failed for ${ha}: ${sanitizeErrorMessage(ja.message)}`),handleCognitoError(ja,"forgotPassword")}}async confirmForgotPassword(ha,ma,ja,La){try{const Ba=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),hl=new ConfirmForgotPasswordCommand({ClientId:this.fetchClientId(),Username:ha,ConfirmationCode:ma,Password:ja});await Ba.send(hl)}catch(Ba){logger$3.error(`Confirm forgot password failed for ${ha}: ${sanitizeErrorMessage(Ba.message)}`),handleCognitoError(Ba,"confirmForgotPassword")}}async login(ha,ma,ja,La){if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID){const hl=new CognitoUser({Username:ha,Pool:this.fetchUserPool()}),Gl=new AuthenticationDetails({Username:ha,Password:ma});let zl,Wl;for(hl.authenticateUser(Gl,{onSuccess:Kl=>{zl=Kl},onFailure:Kl=>{logger$3.debug(`Cognito authentication failed for user ${ha}:`,{errorName:Kl.name,errorMessage:sanitizeErrorMessage(Kl.message)}),Wl=Kl},mfaRequired:(Kl,su)=>{logger$3.info(`MFA required for user ${ha}: ${Kl}`),Wl=new Error("MFA authentication required")},newPasswordRequired:(Kl,su)=>{logger$3.info(`New password required for user ${ha}`),Wl=new PasswordResetRequiredError$1("New password required. Please reset your password.")}});zl===void 0&&Wl===void 0;)await sleepMilliseconds$1(100);if(Wl){if(Wl instanceof PasswordResetRequiredError$1)throw Wl;logger$3.error(`Login failed for user ${ha}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),handleCognitoError(Wl,"login")}if(zl){const Kl=zl.getIdToken(),su=Kl.getJwtToken(),au=Kl.decodePayload(),ou=au.given_name||au.name||"",$m=au.family_name||"",Nm=au["cognito:groups"];let Mm=await findUserByEmail(ha,ja);Mm||(Mm=await ensureUser(ha,ou,$m,ja));const Mg=Mm.lookup("id");Nm&&await ensureUserRoles(Mg,Nm,ja);const ly=zl.getAccessToken().getJwtToken(),uy=zl.getRefreshToken().getToken(),YE={sessionId:(await ensureUserSession(Mg,su,ly,uy,ja)).lookup("id"),userId:Mg,authToken:su,idToken:su,accessToken:ly,refreshToken:uy,systemSesionInfo:zl};La(YE)}else throw logger$3.error(`Login failed for ${ha} - no result received`),new UnauthorisedError$1("Login failed. Please try again.")}else{let hl=await findUserByEmail(ha,ja);hl||(logger$3.warn(`User ${ha} not found in local store`),hl=await ensureUser(ha,"","",ja));const Gl=new CognitoUser({Username:ha,Pool:this.fetchUserPool()}),zl=new AuthenticationDetails({Username:ha,Password:ma});let Wl,Kl;for(Gl.authenticateUser(zl,{onSuccess:su=>{Wl=su},onFailure:su=>{logger$3.debug(`Cognito authentication failed for user ${ha}:`,{errorName:su.name,errorMessage:sanitizeErrorMessage(su.message)}),Kl=su},mfaRequired:(su,au)=>{logger$3.info(`MFA required for user ${ha}: ${su}`),Kl=new Error("MFA authentication required")},newPasswordRequired:(su,au)=>{logger$3.info(`New password required for user ${ha}`),Kl=new PasswordResetRequiredError$1("New password required. Please reset your password.")}});Wl===void 0&&Kl===void 0;)await sleepMilliseconds$1(100);if(Kl){if(Kl instanceof PasswordResetRequiredError$1)throw Kl;logger$3.error(`Login failed for user ${ha}:`,{errorName:Kl.name,errorMessage:sanitizeErrorMessage(Kl.message)}),handleCognitoError(Kl,"login")}if(Wl){const su=hl.lookup("id"),au=Wl.getIdToken().getJwtToken(),ou=Wl.getAccessToken().getJwtToken(),$m=Wl.getRefreshToken().getToken(),Mm={sessionId:(await ensureUserSession(su,au,ou,$m,ja)).lookup("id"),userId:su,authToken:au,idToken:au,accessToken:ou,refreshToken:$m,systemSesionInfo:Wl};La(Mm)}else throw logger$3.error(`Login failed for ${ha} - no result received`),new UnauthorisedError$1("Login failed. Please try again.")}}async logout(ha,ma,ja){try{const La=await findUser(ha.userId,ma);if(!La){logger$3.warn(`User ${ha.userId} not found during logout`),ja&&ja(!0);return}const Ba=new CognitoUser({Username:La.lookup("email"),Pool:this.fetchUserPool()});let hl=!1,Gl;const zl=new CognitoUserSession({IdToken:new CognitoIdToken({IdToken:ha.idToken}),AccessToken:new CognitoAccessToken({AccessToken:ha.accessToken}),RefreshToken:new CognitoRefreshToken({RefreshToken:ha.refreshToken})});for(Ba.setSignInUserSession(zl),Ba.globalSignOut({onSuccess:function(){hl=!0},onFailure:function(Wl){hl=!0,logger$3.error(`Cognito signOut error for user ${ha.userId}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),Gl=Wl}});!hl;)await sleepMilliseconds$1(100);Gl&&logger$3.error(`Error during Cognito logout for user ${ha.userId}: ${Gl.message}`),logger$3.debug(`Successfully logged out user ${ha.userId}`),ja&&ja(!0)}catch(La){throw logger$3.error(`Logout failed for user ${ha.userId}: ${La.message}`),ja&&ja(!1),La}}async changePassword(ha,ma,ja,La){const Ba=await findUser(ha.userId,La);if(!Ba)return logger$3.warn(`User ${ha.userId} not found for password-change`),!1;const hl=Ba.lookup("email"),Gl=new CognitoUser({Username:hl,Pool:this.fetchUserPool()}),zl=new CognitoUserSession({IdToken:new CognitoIdToken({IdToken:ha.idToken}),AccessToken:new CognitoAccessToken({AccessToken:ha.accessToken}),RefreshToken:new CognitoRefreshToken({RefreshToken:ha.refreshToken})});Gl.setSignInUserSession(zl);let Wl=!1,Kl;for(Gl.changePassword(ja,ma,(su,au)=>{su?(Wl=!0,Kl=su):Wl=!0});!Wl;)await sleepMilliseconds$1(100);return Kl?(logger$3.warn(`Failed to change the password for ${hl} - ${Kl.message}`),!1):!0}fetchUserPool(){if(this.userPool)return this.userPool;throw new Error("UserPool not initialized")}async verifyToken(ha){try{const ja=await CognitoJwtVerifier.create({userPoolId:this.fetchUserPoolId(),tokenUse:"id",clientId:this.fetchClientId()}).verify(ha);logger$3.debug(`Decoded JWT for ${ja.email}`)}catch(ma){throw logger$3.error("Token verification failed:",{errorName:ma.name,errorMessage:sanitizeErrorMessage(ma.message)}),ma.message&&ma.message.includes("expired")?new UnauthorisedError$1("Token has expired. Please login again."):ma.message&&ma.message.includes("invalid")?new UnauthorisedError$1("Invalid token format."):ma.message&&ma.message.includes("not before")?new UnauthorisedError$1("Token is not yet valid."):ma.message&&ma.message.includes("audience")?new UnauthorisedError$1("Token audience mismatch."):new UnauthorisedError$1(`Token verification failed: ${sanitizeErrorMessage(ma.message)||"Invalid token"}`)}}async getUser(ha,ma){const ja=await findUser(ha,ma);if(!ja)throw new UserNotFoundError$1(`User ${ha} not found in local database`);const La=ja.lookup("email"),Ba=ja.lookup("firstName"),hl=ja.lookup("lastName");if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID&&La)try{const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),Wl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:La}),Kl=await zl.send(Wl);return{id:ha,username:La,firstName:Ba,lastName:hl,systemUserInfo:{localUser:ja,cognitoData:{userAttributes:Kl.UserAttributes,userCreateDate:Kl.UserCreateDate,userLastModifiedDate:Kl.UserLastModifiedDate,userStatus:Kl.UserStatus,enabled:Kl.Enabled,preferredMfaSetting:Kl.PreferredMfaSetting,userMFASettingList:Kl.UserMFASettingList}}}}catch(zl){return logger$3.warn(`Failed to get Cognito user info for ${La}, using local data only:`,{errorName:zl.name,errorMessage:sanitizeErrorMessage(zl.message)}),{id:ha,username:La,firstName:Ba,lastName:hl,systemUserInfo:ja}}else return{id:ha,username:La||ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}async getUserByEmail(ha,ma){const ja=await findUserByEmail(ha,ma);if(!ja)throw new UserNotFoundError$1(`User with email ${ha} not found in local database`);const La=ja.lookup("id"),Ba=ja.lookup("firstName"),hl=ja.lookup("lastName");if(define_process_env_default$2.COGNITO_USER_POOL_ID&&define_process_env_default$2.COGNITO_CLIENT_ID)try{const zl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),Wl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),ClientId:this.fetchClientId(),Username:ha}),Kl=await zl.send(Wl);return{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:{localUser:ja,cognitoData:{userAttributes:Kl.UserAttributes,userCreateDate:Kl.UserCreateDate,userLastModifiedDate:Kl.UserLastModifiedDate,userStatus:Kl.UserStatus,enabled:Kl.Enabled,preferredMfaSetting:Kl.PreferredMfaSetting,userMFASettingList:Kl.UserMFASettingList}}}}catch(zl){return console.log(`Failed to get Cognito user info for email ${ha}, using local data only:`,{errorName:zl.name,errorMessage:sanitizeErrorMessage(zl.message)}),{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}else return{id:La,username:ha,firstName:Ba,lastName:hl,systemUserInfo:ja}}async refreshToken(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),La=new InitiateAuthCommand({AuthFlow:"REFRESH_TOKEN_AUTH",ClientId:this.fetchClientId(),AuthParameters:{REFRESH_TOKEN:ha}}),Ba=await ja.send(La);if(!Ba.AuthenticationResult)throw new UnauthorisedError$1("Token refresh failed");const hl=Ba.AuthenticationResult.IdToken,Gl=Ba.AuthenticationResult.AccessToken,zl=Ba.AuthenticationResult.RefreshToken||ha,Kl=JSON.parse(atob(hl.split(".")[1])).email;let su=await findUserByEmail(Kl,ma);su||(su=await ensureUser(Kl,"","",ma));const au=su.lookup("id");return{sessionId:(await ensureUserSession(au,hl,Gl,zl,ma)).lookup("id"),userId:au,authToken:hl,idToken:hl,accessToken:Gl,refreshToken:zl,systemSesionInfo:Ba.AuthenticationResult}}catch(ja){throw logger$3.error(`Refresh token operation failed: ${ja.message}`),ja.name==="NotAuthorizedException"?new UnauthorisedError$1("Invalid or expired refresh token"):(handleCognitoError(ja,"refreshToken"),ja)}}async inviteUser(ha,ma,ja,La,Ba,hl,Gl){var zl;try{const Wl=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),Kl=[{Name:"email",Value:ha},{Name:"email_verified",Value:"true"},{Name:"given_name",Value:ma},{Name:"family_name",Value:ja}];La&&La.forEach(($m,Nm)=>{Kl.push({Name:Nm,Value:String($m)})});let su=!1;try{const $m=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});await Wl.send($m),su=!0,logger$3.debug(`User ${ha} already exists, will resend invitation`)}catch($m){if($m.name!=="UserNotFoundException")throw $m;logger$3.debug(`User ${ha} does not exist, will create new user`)}const au=new AdminCreateUserCommand(Object.assign({UserPoolId:this.fetchUserPoolId(),Username:ha,UserAttributes:Kl,DesiredDeliveryMediums:["EMAIL"],TemporaryPassword:generateUrlSafePassword$1()},su?{MessageAction:"RESEND"}:{}));logger$3.debug(`Attempting to invite user: ${ha}`);const ou=await Wl.send(au);if(ou.$metadata.httpStatusCode===200){logger$3.info(`User invitation successful for: ${ha}`);const Nm=(await ensureUser(ha,ma,ja,hl,"Invited")).lookup("id");await ensureUserRoles(Nm,[Ba||"user"],hl);const Mm={email:ha,firstName:ma,lastName:ja,invitationId:(zl=ou.User)===null||zl===void 0?void 0:zl.Username,systemInvitationInfo:ou};Gl(Mm)}else throw logger$3.error(`User invitation failed with HTTP status ${ou.$metadata.httpStatusCode}`,{email:ha,statusCode:ou.$metadata.httpStatusCode}),new BadRequestError$4(`User invitation failed with status ${ou.$metadata.httpStatusCode}`)}catch(Wl){if(Wl instanceof BadRequestError$4)throw Wl;logger$3.error(`User invitation error for ${ha}:`,{errorName:Wl.name,errorMessage:sanitizeErrorMessage(Wl.message)}),handleCognitoError(Wl,"inviteUser")}}async resendInvitation(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"});try{const hl=new AdminGetUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});await ja.send(hl)}catch(hl){throw hl.name==="UserNotFoundException"?new UserNotFoundError$1(`User ${ha} not found. Cannot resend invitation.`):hl}const La=new AdminCreateUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha,DesiredDeliveryMediums:["EMAIL"],MessageAction:"RESEND"});logger$3.debug(`Attempting to resend invitation for user: ${ha}`);const Ba=await ja.send(La);if(Ba.$metadata.httpStatusCode===200)logger$3.info(`Invitation resent successfully for: ${ha}`);else throw logger$3.error(`Failed to resend invitation with HTTP status ${Ba.$metadata.httpStatusCode}`,{email:ha,statusCode:Ba.$metadata.httpStatusCode}),new BadRequestError$4(`Failed to resend invitation with status ${Ba.$metadata.httpStatusCode}`)}catch(ja){if(ja instanceof BadRequestError$4||ja instanceof UserNotFoundError$1)throw ja;logger$3.error(`Resend invitation error for ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"resendInvitation")}}async acceptInvitation(ha,ma,ja,La){try{const Ba=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2",credentials:fromEnv()}),hl=new InitiateAuthCommand({AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.fetchClientId(),AuthParameters:{USERNAME:ha,PASSWORD:ma}}),Gl=await Ba.send(hl);if(Gl.ChallengeName==="NEW_PASSWORD_REQUIRED"){const zl=new RespondToAuthChallengeCommand({ClientId:this.fetchClientId(),ChallengeName:"NEW_PASSWORD_REQUIRED",Session:Gl.Session,ChallengeResponses:{USERNAME:ha,NEW_PASSWORD:ja}});await Ba.send(zl),logger$3.info(`User invitation accepted successfully for: ${ha}`)}else throw new Error(`Unexpected challenge: ${Gl.ChallengeName}`)}catch(Ba){logger$3.error(`Accept invitation failed for ${ha}: ${sanitizeErrorMessage(Ba.message)}`),handleCognitoError(Ba,"acceptInvitation")}}async callback(ha,ma,ja){try{if(!isNodeEnv$1)throw new Error("Callback authentication is only supported in Node.js environment");const La=this.fetchConfig("ClientId"),Ba=define_process_env_default$2.AWS_REGION||"us-east-1",hl=define_process_env_default$2.COGNITO_REDIRECT_URI||"http://localhost:3000/auth/callback",zl=`https://${define_process_env_default$2.COGNITO_HOSTED_DOMAIN}.auth.${Ba}.amazoncognito.com/oauth2/token`,Wl=new URLSearchParams({grant_type:"authorization_code",client_id:La,code:ha,redirect_uri:hl});logger$3.debug("Exchanging authorization code for tokens via OAuth2 endpoint"),console.log("te",zl,Wl.toString());const Kl=await fetch(zl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Wl.toString()});if(!Kl.ok){const cN=await Kl.text();throw new Error(`Token exchange failed: ${Kl.status} ${cN}`)}const su=await Kl.json();if(!su.access_token||!su.id_token||!su.refresh_token)throw new Error("Missing required tokens in response");const{access_token:au,id_token:ou,refresh_token:$m}=su,Nm=this.decodeJwtPayload(ou),Mm=Nm.email,Mg=Nm.given_name||Nm.name||"",ly=Nm.family_name||"",uy=Nm["cognito:groups"];if(!Mm)throw new Error("Email not found in ID attributes");let GE=await findUserByEmail(Mm,ma);GE||(GE=await ensureUser(Mm,Mg,ly,ma));const YE=GE.lookup("id");uy&&await ensureUserRoles(YE,uy,ma);const XE={sessionId:(await ensureUserSession(YE,ou,au,$m,ma)).lookup("id"),userId:YE,authToken:ou,idToken:ou,accessToken:au,refreshToken:$m,systemSesionInfo:su};logger$3.info(`Auth callback successful for user ${Mm}`),ja(XE)}catch(La){console.log(La),logger$3.error(`Auth callback failed: ${sanitizeErrorMessage(La.message)}`),handleCognitoError(La,"callback")}}decodeJwtPayload(ha){try{const ja=ha.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),La=decodeURIComponent(atob(ja).split("").map(Ba=>"%"+("00"+Ba.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(La)}catch(ma){throw logger$3.error(`Failed to decode JWT payload: ${ma}`),new Error("Invalid JWT token")}}async deleteUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminDeleteUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to delete user: ${ha}`),await ja.send(La),logger$3.info(`User deleted successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to delete user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"deleteUser")}}async disableUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminDisableUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to disable user: ${ha}`),await ja.send(La),logger$3.info(`User disabled successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to disable user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"disableUser")}}async enableUser(ha,ma){try{const ja=new CognitoIdentityProviderClient({region:define_process_env_default$2.AWS_REGION||"us-west-2"}),La=new AdminEnableUserCommand({UserPoolId:this.fetchUserPoolId(),Username:ha});logger$3.debug(`Attempting to enable user: ${ha}`),await ja.send(La),logger$3.info(`User enabled successfully: ${ha}`)}catch(ja){logger$3.error(`Failed to enable user ${ha}:`,{errorName:ja.name,errorMessage:sanitizeErrorMessage(ja.message)}),handleCognitoError(ja,"enableUser")}}}const CoreAuthModuleName=makeCoreModuleName$1("auth"),auth=`module ${CoreAuthModuleName}
|
|
16091
16091
|
|
|
16092
16092
|
import "./modules/auth.js" @as Auth
|
|
16093
16093
|
|
|
@@ -18040,7 +18040,7 @@ workflow generateAgentlangResolver {
|
|
|
18040
18040
|
"monitoring": {
|
|
18041
18041
|
"enabled": true
|
|
18042
18042
|
}
|
|
18043
|
-
}`),await commitChanges(cN,"config.al","Add config.al",{name:La,email:La});const pN="src/core.al";await writeRepoFile(Mg,pN,`module ${Mm.toLowerCase()}.core`),await commitChanges(cN,pN,"Add core.al ",{name:La,email:La}),Wl("pushing-changes"),su("Pushing changes to GitHub..."),await pushChanges(cN,"origin",ly,ma),Wl("loading-module"),su("Loading module...");try{await flushAllAndLoad(`/${Mm}`,{name:"studio"});const hN=getUserModuleNames();Wl("adding-workspace"),su("Adding to workspace...");const lN={name:$m,type:"App",gitHubOrg:ja,gitHubRepo:Mm,branch:ly,description:"",owner:localStorage.getItem("username")||"",version:"0.0.1",isEditable:!0};await pa(lN),Gl(!1),Ba(`/design/data-model/${ja}/${Mm}/${hN[0]}`,{state:{isNewTeam:!0}})}catch(hN){console.error(`Failed to load ${Mm}:`,hN);try{await pathExists(Mg)&&(console.log(`Cleaning up failed clone: removing ${Mg} from IndexedDB`),await removeDirectory(Mg))}catch(lN){console.error("Error cleaning up failed clone:",lN)}Gl(!1)}}catch(Mg){console.error(`Failed to clone repository: ${Mg}`);try{const ly=`/${Mm}`;await pathExists(ly)&&(console.log(`Cleaning up failed clone: removing ${ly} from IndexedDB`),await removeDirectory(ly))}catch(ly){console.error("Error cleaning up failed clone:",ly)}Gl(!1)}}catch(Nm){console.error("Failed to create GitHub Repository:",Nm),Gl(!1)}},isLoading:hl,currentStep:zl,statusMessage:Kl,loadingSteps:[{id:"creating-repo",label:"Creating GitHub repository"},{id:"cloning-repo",label:"Cloning repository"},{id:"adding-files",label:"Adding initial files"},{id:"committing-changes",label:"Committing changes"},{id:"pushing-changes",label:"Pushing to GitHub"},{id:"loading-module",label:"Loading module"},{id:"adding-workspace",label:"Adding to workspace"}]}},getDependenciesRecursive=async(pa,ha,ma=new Set)=>{const ja=Object.entries(ha).filter(([Ba,hl])=>{const Gl=typeof hl=="string"&&hl.startsWith("git+http"),zl=!ma.has(Ba);return Gl&&zl&&ma.add(Ba),Gl&&zl});return ja.length===0?[]:(await Promise.all(ja.map(async([Ba])=>{const hl=Ba.split(".")[0],Gl=[hl];try{const zl=await readDependencyPackageJsonFromGit(pa,hl);if(zl.dependencies){const Wl=await getDependenciesRecursive(pa,zl.dependencies,ma);Gl.push(...Wl)}}catch(zl){console.error(`Failed to process dependency ${hl}:`,zl)}return Gl}))).flat()},fetchDependencies=async pa=>{const ma=(await readPackageJsonFromGit(pa)).dependencies||{},ja=Object.entries(ma).filter(([,Ba])=>typeof Ba=="string"&&Ba.startsWith("git+http")).map(([Ba])=>Ba.split(".")[0]),La=await getDependenciesRecursive(pa,ma,new Set(ja));return Array.from(new Set([...ja,...La]))},useDependencies=()=>{const{currentTeam:pa}=useTeams(),ha=pa?.GitHubRepo,{data:ma=[],isLoading:ja}=useQuery({queryKey:["dependencies",ha],queryFn:()=>fetchDependencies(ha),enabled:!!ha}),La=getUserModuleNames(),Ba=[ha,...ma].map(Wl=>({label:Wl||"",value:Wl||""})),hl=Wl=>{const Kl=Wl.toLowerCase(),su=Kl.replace(/_/g,"");return La.filter(au=>{const ou=au.toLowerCase(),$m=ou.split(".")[0];return ou.startsWith(Kl)||$m===su})},Gl=ha||"",zl=Gl?hl(Gl)[0]:"";return{dependencies:ma,dependenciesOptions:Ba,loading:ja,getDependenciesModule:hl,defaultDependency:Gl,defaultModule:zl}},useDoubleClick=(pa,ha,ma=300)=>{const ja=reactExports.useRef(null),La=reactExports.useRef(0),Ba=reactExports.useCallback(hl=>{hl.stopPropagation(),hl.preventDefault(),La.current+=1,La.current===1?ja.current=setTimeout(()=>{La.current===1&&pa(hl),La.current=0,ja.current=null},ma):La.current===2&&(ja.current&&(clearTimeout(ja.current),ja.current=null),ha(hl),La.current=0)},[pa,ha,ma]);return reactExports.useEffect(()=>()=>{ja.current&&clearTimeout(ja.current)},[]),Ba};var I$8=Object.defineProperty,E$7=(pa,ha,ma)=>ha in pa?I$8(pa,ha,{enumerable:!0,configurable:!0,writable:!0,value:ma}):pa[ha]=ma,w$9=(pa,ha,ma)=>E$7(pa,typeof ha!="symbol"?ha+"":ha,ma);function T$a(pa,ha){for(var ma=0;ma<ha.length;ma++){const ja=ha[ma];if(typeof ja!="string"&&!Array.isArray(ja)){for(const La in ja)if(La!=="default"&&!(La in pa)){const Ba=Object.getOwnPropertyDescriptor(ja,La);Ba&&Object.defineProperty(pa,La,Ba.get?Ba:{enumerable:!0,get:()=>ja[La]})}}}return Object.freeze(Object.defineProperty(pa,Symbol.toStringTag,{value:"Module"}))}function z$5(pa){return{isFile:()=>pa.isFile(),isDirectory:()=>pa.isDirectory(),isSymbolicLink:()=>pa.isSymbolicLink(),size:pa.size,mtime:pa.mtime}}let j$a=class{async readFile(ha){return(void 0)(ha,"utf8")}async readFileBuffer(ha){return(void 0)(ha)}async writeFile(ha,ma){const ja=(void 0)(ha);return await this.ensureDir(ja),(void 0)(ha,ma)}async exists(ha){try{return await(void 0)(ha),!0}catch{return!1}}async mkdir(ha){try{await(void 0)(ha)}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async readdir(ha){return(void 0)(ha)}async stat(ha){const ma=await(void 0)(ha);return z$5(ma)}async lstat(ha){const ma=await(void 0)(ha);return z$5(ma)}async unlink(ha){return(void 0)(ha)}async rmdir(ha){return(void 0)(ha)}async copyFile(ha,ma){const ja=(void 0)(ma);return await this.ensureDir(ja),(void 0)(ha,ma)}async moveFile(ha,ma){const ja=(void 0)(ma);return await this.ensureDir(ja),(void 0)(ha,ma)}async ensureDir(ha){try{await(void 0)(ha,{recursive:!0})}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async removeDir(ha){return(void 0)(ha,{recursive:!0,force:!0})}async readDirectory(ha){return(void 0)(ha)}async writeFileSystemFromTree(ha,ma,ja){for(const La of ha){const Ba=(void 0)(ma,La.path);if(La.type==="directory")await this.ensureDir(Ba),La.children&&await this.writeFileSystemFromTree(La.children,ma,ja);else{const hl=await ja(La.path);await this.writeFile(Ba,hl)}}}};function p$c(){return new j$a}function _$7(pa){return pa&&pa.__esModule&&Object.prototype.hasOwnProperty.call(pa,"default")?pa.default:pa}var b$8,S$a;function x$6(){if(S$a)return b$8;S$a=1;function pa(La){if(typeof La!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(La))}function ha(La,Ba){for(var hl="",Gl=0,zl=-1,Wl=0,Kl,su=0;su<=La.length;++su){if(su<La.length)Kl=La.charCodeAt(su);else{if(Kl===47)break;Kl=47}if(Kl===47){if(!(zl===su-1||Wl===1))if(zl!==su-1&&Wl===2){if(hl.length<2||Gl!==2||hl.charCodeAt(hl.length-1)!==46||hl.charCodeAt(hl.length-2)!==46){if(hl.length>2){var au=hl.lastIndexOf("/");if(au!==hl.length-1){au===-1?(hl="",Gl=0):(hl=hl.slice(0,au),Gl=hl.length-1-hl.lastIndexOf("/")),zl=su,Wl=0;continue}}else if(hl.length===2||hl.length===1){hl="",Gl=0,zl=su,Wl=0;continue}}Ba&&(hl.length>0?hl+="/..":hl="..",Gl=2)}else hl.length>0?hl+="/"+La.slice(zl+1,su):hl=La.slice(zl+1,su),Gl=su-zl-1;zl=su,Wl=0}else Kl===46&&Wl!==-1?++Wl:Wl=-1}return hl}function ma(La,Ba){var hl=Ba.dir||Ba.root,Gl=Ba.base||(Ba.name||"")+(Ba.ext||"");return hl?hl===Ba.root?hl+Gl:hl+La+Gl:Gl}var ja={resolve:function(){for(var La="",Ba=!1,hl,Gl=arguments.length-1;Gl>=-1&&!Ba;Gl--){var zl;Gl>=0?zl=arguments[Gl]:(hl===void 0&&(hl=process.cwd()),zl=hl),pa(zl),zl.length!==0&&(La=zl+"/"+La,Ba=zl.charCodeAt(0)===47)}return La=ha(La,!Ba),Ba?La.length>0?"/"+La:"/":La.length>0?La:"."},normalize:function(La){if(pa(La),La.length===0)return".";var Ba=La.charCodeAt(0)===47,hl=La.charCodeAt(La.length-1)===47;return La=ha(La,!Ba),La.length===0&&!Ba&&(La="."),La.length>0&&hl&&(La+="/"),Ba?"/"+La:La},isAbsolute:function(La){return pa(La),La.length>0&&La.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var La,Ba=0;Ba<arguments.length;++Ba){var hl=arguments[Ba];pa(hl),hl.length>0&&(La===void 0?La=hl:La+="/"+hl)}return La===void 0?".":ja.normalize(La)},relative:function(La,Ba){if(pa(La),pa(Ba),La===Ba||(La=ja.resolve(La),Ba=ja.resolve(Ba),La===Ba))return"";for(var hl=1;hl<La.length&&La.charCodeAt(hl)===47;++hl);for(var Gl=La.length,zl=Gl-hl,Wl=1;Wl<Ba.length&&Ba.charCodeAt(Wl)===47;++Wl);for(var Kl=Ba.length,su=Kl-Wl,au=zl<su?zl:su,ou=-1,$m=0;$m<=au;++$m){if($m===au){if(su>au){if(Ba.charCodeAt(Wl+$m)===47)return Ba.slice(Wl+$m+1);if($m===0)return Ba.slice(Wl+$m)}else zl>au&&(La.charCodeAt(hl+$m)===47?ou=$m:$m===0&&(ou=0));break}var Nm=La.charCodeAt(hl+$m),Mm=Ba.charCodeAt(Wl+$m);if(Nm!==Mm)break;Nm===47&&(ou=$m)}var Mg="";for($m=hl+ou+1;$m<=Gl;++$m)($m===Gl||La.charCodeAt($m)===47)&&(Mg.length===0?Mg+="..":Mg+="/..");return Mg.length>0?Mg+Ba.slice(Wl+ou):(Wl+=ou,Ba.charCodeAt(Wl)===47&&++Wl,Ba.slice(Wl))},_makeLong:function(La){return La},dirname:function(La){if(pa(La),La.length===0)return".";for(var Ba=La.charCodeAt(0),hl=Ba===47,Gl=-1,zl=!0,Wl=La.length-1;Wl>=1;--Wl)if(Ba=La.charCodeAt(Wl),Ba===47){if(!zl){Gl=Wl;break}}else zl=!1;return Gl===-1?hl?"/":".":hl&&Gl===1?"//":La.slice(0,Gl)},basename:function(La,Ba){if(Ba!==void 0&&typeof Ba!="string")throw new TypeError('"ext" argument must be a string');pa(La);var hl=0,Gl=-1,zl=!0,Wl;if(Ba!==void 0&&Ba.length>0&&Ba.length<=La.length){if(Ba.length===La.length&&Ba===La)return"";var Kl=Ba.length-1,su=-1;for(Wl=La.length-1;Wl>=0;--Wl){var au=La.charCodeAt(Wl);if(au===47){if(!zl){hl=Wl+1;break}}else su===-1&&(zl=!1,su=Wl+1),Kl>=0&&(au===Ba.charCodeAt(Kl)?--Kl===-1&&(Gl=Wl):(Kl=-1,Gl=su))}return hl===Gl?Gl=su:Gl===-1&&(Gl=La.length),La.slice(hl,Gl)}else{for(Wl=La.length-1;Wl>=0;--Wl)if(La.charCodeAt(Wl)===47){if(!zl){hl=Wl+1;break}}else Gl===-1&&(zl=!1,Gl=Wl+1);return Gl===-1?"":La.slice(hl,Gl)}},extname:function(La){pa(La);for(var Ba=-1,hl=0,Gl=-1,zl=!0,Wl=0,Kl=La.length-1;Kl>=0;--Kl){var su=La.charCodeAt(Kl);if(su===47){if(!zl){hl=Kl+1;break}continue}Gl===-1&&(zl=!1,Gl=Kl+1),su===46?Ba===-1?Ba=Kl:Wl!==1&&(Wl=1):Ba!==-1&&(Wl=-1)}return Ba===-1||Gl===-1||Wl===0||Wl===1&&Ba===Gl-1&&Ba===hl+1?"":La.slice(Ba,Gl)},format:function(La){if(La===null||typeof La!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof La);return ma("/",La)},parse:function(La){pa(La);var Ba={root:"",dir:"",base:"",ext:"",name:""};if(La.length===0)return Ba;var hl=La.charCodeAt(0),Gl=hl===47,zl;Gl?(Ba.root="/",zl=1):zl=0;for(var Wl=-1,Kl=0,su=-1,au=!0,ou=La.length-1,$m=0;ou>=zl;--ou){if(hl=La.charCodeAt(ou),hl===47){if(!au){Kl=ou+1;break}continue}su===-1&&(au=!1,su=ou+1),hl===46?Wl===-1?Wl=ou:$m!==1&&($m=1):Wl!==-1&&($m=-1)}return Wl===-1||su===-1||$m===0||$m===1&&Wl===su-1&&Wl===Kl+1?su!==-1&&(Kl===0&&Gl?Ba.base=Ba.name=La.slice(1,su):Ba.base=Ba.name=La.slice(Kl,su)):(Kl===0&&Gl?(Ba.name=La.slice(1,Wl),Ba.base=La.slice(1,su)):(Ba.name=La.slice(Kl,Wl),Ba.base=La.slice(Kl,su)),Ba.ext=La.slice(Wl,su)),Kl>0?Ba.dir=La.slice(0,Kl-1):Gl&&(Ba.dir="/"),Ba},sep:"/",delimiter:":",win32:null,posix:null};return ja.posix=ja,b$8=ja,b$8}var A$7=x$6();const B$5=_$7(A$7),O$5=T$a({__proto__:null,default:B$5},[A$7]);function k$a(pa){if(pa&&typeof pa=="object"){const ha=pa,ma=typeof ha.isFile=="function"?ha.isFile():typeof ha.isFile=="boolean"?ha.isFile:ha.type==="file"||!ha.type&&!ha.isDirectory,ja=typeof ha.isDirectory=="function"?ha.isDirectory():typeof ha.isDirectory=="boolean"?ha.isDirectory:ha.type==="dir"||ha.type==="directory",La=typeof ha.size=="number"?ha.size:0;let Ba;return ha.mtime instanceof Date?Ba=ha.mtime:typeof ha.mtime=="number"?Ba=new Date(ha.mtime):typeof ha.mtimeMs=="number"?Ba=new Date(ha.mtimeMs):Ba=new Date,{isFile:()=>ma,isDirectory:()=>ja,isSymbolicLink:()=>!1,size:La,mtime:Ba}}return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:0,mtime:new Date}}let P$9=class{constructor(){w$9(this,"fs"),w$9(this,"initialized",!1),w$9(this,"path",O$5)}async initialize(ha={}){if(this.initialized)return;const ma=ha.name||"fs",ja=new L$8(ma,{wipe:ha.wipe});this.fs=ja.promises,this.initialized=!0}ensureInitialized(){if(!this.initialized)throw new Error("LightningFileSystem is not initialized. Call initialize() first.")}async readFile(ha){return this.ensureInitialized(),(await this.fs.readFile(ha,{encoding:"utf8"})).toString()}async readFileBuffer(ha){return this.ensureInitialized(),this.fs.readFile(ha)}async writeFile(ha,ma){this.ensureInitialized();const ja=ha.substring(0,ha.lastIndexOf("/"));return ja&&await this.ensureDir(ja),this.fs.writeFile(ha,ma)}async exists(ha){this.ensureInitialized();try{return await this.fs.stat(ha),!0}catch{return!1}}async mkdir(ha,ma){this.ensureInitialized();try{return await this.fs.mkdir(ha,ma)}catch(ja){if(ja&&typeof ja=="object"&&"code"in ja&&ja.code!=="EEXIST")throw ja}}async readdir(ha){return this.ensureInitialized(),this.fs.readdir(ha)}async stat(ha){this.ensureInitialized();const ma=await this.fs.stat(ha);return k$a(ma)}async lstat(ha){this.ensureInitialized();const ma=await this.fs.stat(ha);return k$a(ma)}async unlink(ha){return this.ensureInitialized(),this.fs.unlink(ha)}async rmdir(ha){return this.ensureInitialized(),this.fs.rmdir(ha)}async copyFile(ha,ma){this.ensureInitialized();const ja=ma.substring(0,ma.lastIndexOf("/"));ja&&await this.ensureDir(ja);const La=await this.readFileBuffer(ha);return this.writeFile(ma,La)}async moveFile(ha,ma){this.ensureInitialized();const ja=ma.substring(0,ma.lastIndexOf("/"));ja&&await this.ensureDir(ja),await this.copyFile(ha,ma),await this.unlink(ha)}async ensureDir(ha){if(this.ensureInitialized(),!await this.exists(ha))try{await this.fs.mkdir(ha,{recursive:!0})}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async removeDir(ha){if(this.ensureInitialized(),!await this.exists(ha))return;if((await this.stat(ha)).isFile())return this.unlink(ha);const ma=await this.readdir(ha);for(const ja of ma){const La=`${ha}/${ja}`;await this.removeDir(La)}return this.rmdir(ha)}async readDirectory(ha){return this.ensureInitialized(),this.fs.readdir(ha)}async writeFileSystemFromTree(ha,ma,ja){for(const La of ha){const Ba=this.path.join(ma,La.path);if(La.type==="directory")await this.mkdir(Ba,{recursive:!0}),La.children&&await this.writeFileSystemFromTree(La.children,ma,ja);else{const hl=await ja(La.path);await this.writeFile(Ba,hl)}}}};async function M$6(pa){const ha=new P$9;return await ha.initialize(pa),ha}async function $$6(pa){return typeof window>"u"?p$c():M$6(pa)}let fsInstance=null;const getFS=async()=>(fsInstance||(fsInstance=await $$6({name:"studio",wipe:!0})),fsInstance),useDependencyProcessor=()=>{const pa=reactExports.useCallback(ma=>{if(!ma.dependencies)return[];const ja=[];for(const[La,Ba]of Object.entries(ma.dependencies))typeof Ba=="string"&&Ba.startsWith("git+http")&&ja.push({appName:La,url:Ba});return ja},[]),ha=reactExports.useCallback(async(ma,ja,La,Ba)=>{const hl=await readRepoFile(ma,"package.json"),Gl=JSON.parse(hl),zl=pa(Gl);if(zl.length===0)return[];Ba&&Ba(`Installing ${zl.length} dependencies...`,0,zl.length);let Wl;Wl=await fetchDependenciesFromLocalServer(ma,zl,(au,ou,$m)=>{Ba&&Ba(`[${ou}/${$m}] ${au}`,ou,$m)});const Kl=Wl.filter(au=>!au.success),su=Wl.filter(au=>au.success);if(su.length>0&&console.log(`✓ Successfully fetched ${su.length} dependencies:`,su.map(au=>au.appName).join(", ")),Kl.length>0&&console.warn(`⚠ Failed to install ${Kl.length} of ${zl.length} dependencies:`,Kl.map(au=>`${au.appName} (${au.message})`).join(", ")),su.length>0){const au=await getFS();for(const ou of su)if(ou.path)try{const $m=`${ou.path}/package.json`;await au.exists($m)?console.log(`✓ ${ou.appName}: Verified package.json exists`):console.error(`✗ ${ou.appName}: package.json missing at ${$m}`)}catch($m){console.error(`✗ ${ou.appName}: Verification failed:`,$m)}}return Wl},[pa]);return{extractGitDependencies:pa,processDependencies:ha}},useConfigLoader=()=>{const pa=useAppStore(ma=>ma.setAppConfig);return{loadConfig:reactExports.useCallback(async ma=>{try{const ja=await readRepoFile(ma,"config.al"),La=parseAppConfig(ja);return pa(La),La}catch(ja){console.warn("Failed to manually load/parse config.al, falling back to runtime loader:",ja);try{const La=await loadAppConfig(ma);return pa(La),La}catch(La){return console.error("Failed to load app config via runtime loader:",La),pa({}),{}}}},[pa])}},accessedKeys=new Map,getLocalEnv=pa=>{const ha=getLocalEnv$2(pa);return console.log(`🔍 getLocalEnv("${pa}") called, returning:`,ha?`${ha.substring(0,10)}...`:"undefined"),accessedKeys.set(pa,{value:ha,timestamp:Date.now()}),ha||console.warn(`⚠️ Key "${pa}" not found in LocalEnv`),ha};typeof window<"u"&&(window.debugResolverKeys={getAccessedKeys:()=>Array.from(accessedKeys.entries()),listAccessedKeys:()=>{console.log("📋 Keys accessed by resolvers:"),accessedKeys.forEach(({value:pa},ha)=>{console.log(` ${ha}: ${pa?"found":"NOT FOUND"}`)})}});const API_DOMAIN_TO_PROVIDER={"api.hubapi.com":"hubspot","slack.com":"slack","api.github.com":"github","api.stripe.com":"stripe","api.airtable.com":"airtable","api.notion.com":"notion","api.openai.com":"openai","api.anthropic.com":"anthropic","www.googleapis.com":"google"};function createProxiedAxios(){const pa=getURL("api-cors-proxy"),ha=axios.create({timeout:3e4});return ha.interceptors.request.use(ma=>{const ja=ma.url;if(ja&&(ja.startsWith("http://")||ja.startsWith("https://")))try{const La=new URL(ja),Ba=La.hostname,hl=La.pathname+La.search,Gl=API_DOMAIN_TO_PROVIDER[Ba];if(!Gl)return console.warn(`⚠️ No CORS proxy provider configured for domain: ${Ba}`),console.warn(` Add '${Ba}' to API_DOMAIN_TO_PROVIDER in browserResolvers.ts`),ma;console.log(`🔄 Proxying API call: ${ja}`),console.log(` → Provider: ${Gl}`),console.log(" → Original headers:",ma.headers),ma.url=`${pa}/proxy/${Gl}${hl}`,console.log(` → New URL: ${ma.url}`),console.log(" → Final headers:",ma.headers)}catch(La){console.error("Failed to parse URL for proxying:",ja,La)}return ma}),ha.interceptors.response.use(ma=>ma,ma=>(ma.code==="ERR_NETWORK"?console.error("❌ Network error - Check if CORS proxy is running on",pa):ma.response?.status===401?console.error("❌ 401 Unauthorized - Check API credentials"):ma.response?.status===403&&console.error("❌ 403 Forbidden - Check API permissions"),Promise.reject(ma))),ha}const proxiedAxios=createProxiedAxios(),COMMON_DEPENDENCIES=new Map([["agentlang",{...agentlangRuntimeUtil,asInstance,makeInstance:makeInstance$1,getLocalEnv}],["@fractl/agentlang",{...agentlangRuntimeUtil,asInstance,makeInstance:makeInstance$1,getLocalEnv}],["agentlang/out/runtime/module.js",{makeInstance:makeInstance$1}],["agentlang/out/runtime/auth/defs.js",{getLocalEnv}],["axios",{default:proxiedAxios}]]);function asInstance(pa,ha){const ma=ha.split("/"),ja=ma.length===2?ma[0]:"hubspot",La=ma.length===2?ma[1]:ha,Ba=new Map(Object.entries(pa));return makeInstance$1(ja,La,Ba)}function getDependency(pa){if(COMMON_DEPENDENCIES.has(pa))return COMMON_DEPENDENCIES.get(pa);for(const[ha,ma]of COMMON_DEPENDENCIES)if(pa.includes(`/${ha}`)||pa.endsWith(`/${ha}`))return ma}const BUILTIN_MODULE_PATHS=["./modules/core.js","./modules/auth.js"];async function setupResolverLoader(pa){try{console.log("⚙️ Configuring AgentLang module loader for:",pa),setModuleLoader({fileReader:async ma=>{if(console.log(`📖 Reading file: ${ma}`),BUILTIN_MODULE_PATHS.includes(ma))return console.log(`📦 Built-in module: ${ma} (using global registration)`),"";let ja=ma;return ma.startsWith(pa+"/")?ja=ma.substring(pa.length+1):ma.startsWith(pa)&&(ja=ma.substring(pa.length)),ja.startsWith("/")&&(ja=ja.substring(1)),console.log(`📖 Resolved to relative path: ${ja}`),await readRepoFile(pa,ja)},dependencyProvider:ma=>{const ja=getDependency(ma);return ja?console.log(`✅ Resolved dependency: ${ma}`):console.warn(`⚠️ Unknown dependency: ${ma}`),ja},basePath:""}),console.log("✅ Module loader configured successfully"),console.log("ℹ️ Resolvers will be loaded automatically when AgentLang parses .al files")}catch(ha){console.error("❌ Failed to setup resolver loader:",ha)}}const RESOLVER_CONFIGS={hsr:{initFunctionName:"initializeHubSpotConfig",envKeyMapping:{HUBSPOT_ACCESS_TOKEN:"accessToken"},configBuilder:pa=>({accessToken:pa.HUBSPOT_ACCESS_TOKEN})},gmr:{initFunctionName:"initializeGmailConfig",envKeyMapping:{GMAIL_CLIENT_ID:"clientId",GMAIL_CLIENT_SECRET:"clientSecret",GMAIL_REFRESH_TOKEN:"refreshToken",GMAIL_POLL_INTERVAL_MINUTES:"pollIntervalMinutes"},configBuilder:pa=>({clientId:pa.GMAIL_CLIENT_ID,clientSecret:pa.GMAIL_CLIENT_SECRET,refreshToken:pa.GMAIL_REFRESH_TOKEN,pollIntervalMinutes:pa.GMAIL_POLL_INTERVAL_MINUTES})},gsr:{initFunctionName:"initializeGoogleConfig",envKeyMapping:{GOOGLE_API_KEY:"apiKey",GOOGLE_CLIENT_ID:"clientId",GOOGLE_CLIENT_SECRET:"clientSecret"},configBuilder:pa=>({apiKey:pa.GOOGLE_API_KEY,clientId:pa.GOOGLE_CLIENT_ID,clientSecret:pa.GOOGLE_CLIENT_SECRET})},slackr:{initFunctionName:"initializeSlackConfig",envKeyMapping:{SLACK_BOT_TOKEN:"botToken",SLACK_APP_TOKEN:"appToken"},configBuilder:pa=>({botToken:pa.SLACK_BOT_TOKEN,appToken:pa.SLACK_APP_TOKEN})},ghr:{initFunctionName:"initializeGitHubConfig",envKeyMapping:{GITHUB_TOKEN:"token",GITHUB_API_KEY:"apiKey"},configBuilder:pa=>({token:pa.GITHUB_TOKEN||pa.GITHUB_API_KEY})}};async function initializeResolverConfigs(){try{const{getEnvironmentKeysAsObject:pa}=await __vitePreload(async()=>{const{getEnvironmentKeysAsObject:ja}=await Promise.resolve().then(()=>playgroundEnvKeys);return{getEnvironmentKeysAsObject:ja}},void 0),ha=pa();console.log("🔑 Available environment keys:",Object.keys(ha));const ma=getImportedModuleNames();console.log("📦 Imported modules:",ma);for(const[ja,La]of Object.entries(RESOLVER_CONFIGS)){const Ba=getImportedModule(ja);if(!Ba){console.log(`ℹ️ Resolver "${ja}" not loaded - skipping initialization`);continue}console.log(`📋 Found resolver module: ${ja}`);const hl=Ba[La.initFunctionName];if(typeof hl!="function"){console.warn(`⚠️ Resolver "${ja}" found but "${La.initFunctionName}" function is missing`);continue}const Gl=Object.keys(La.envKeyMapping);if(Gl.filter(su=>ha[su]).length===0){console.warn(`⚠️ No environment keys found for resolver "${ja}". Expected: ${Gl.join(", ")}`);continue}const Wl=La.configBuilder(ha),Kl=Object.fromEntries(Object.entries(Wl).filter(([su,au])=>au!==void 0));if(Object.keys(Kl).length===0){console.warn(`⚠️ No valid configuration could be built for resolver "${ja}"`);continue}console.log(`🔑 Initializing resolver "${ja}" with config:`,{...Kl,...Object.keys(Kl).reduce((su,au)=>{const ou=Kl[au],$m=typeof ou=="string"?`***${ou.slice(-4)}`:"***";return{...su,[au]:$m}},{})});try{await hl(Kl),console.log(`✅ Resolver "${ja}" configured successfully`),Ba.config&&console.log(" Configuration stored in resolver.config")}catch(su){console.error(`❌ Failed to initialize resolver "${ja}":`,su)}}console.log("✅ Resolver initialization complete")}catch(pa){console.error("❌ Failed to initialize resolver configs:",pa)}}const browserResolvers=Object.freeze(Object.defineProperty({__proto__:null,initializeResolverConfigs,setupResolverLoader},Symbol.toStringTag,{value:"Module"})),useRepositoryClone=()=>{const pa=useNavigate(),[ha,ma]=reactExports.useState(!1),[ja,La]=reactExports.useState(""),[Ba,hl]=reactExports.useState(""),Gl=BZ();useAppStore(Mm=>Mm.user);const{processDependencies:zl}=useDependencyProcessor(),{loadConfig:Wl}=useConfigLoader(),Kl="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",su="hamza@fractl.io",au=reactExports.useCallback(()=>{const Mm=su.trim().length>0,Mg=Kl.trim().length>0;(!Mm||!Mg)&&console.warn("GitHub credentials missing - clone may fail for private repositories")},[Kl,su]),ou=reactExports.useCallback(async(Mm,Mg,ly,uy,GE)=>{await zl(Mm,su,Kl,uN=>{La(uN)}),La("Loading application modules..."),La("Initializing runtime with environment keys...");{const{inBrowserREPL:uN}=await __vitePreload(async()=>{const{inBrowserREPL:gN}=await Promise.resolve().then(()=>inBrowserREPL$1);return{inBrowserREPL:gN}},void 0);await uN.initializeRuntime()}La("Configuring resolver loader..."),await setupResolverLoader(Mm),La("Loading AgentLang modules..."),await flushAllAndLoad(Mm,{name:"studio"}),La("Registering agents and initializing modules..."),await runInitFunctions(),await runStandaloneStatements(),La("Initializing resolver configurations..."),await initializeResolverConfigs(),await Wl(Mm);const YE=await readRepoFile(Mm,"package.json"),JE=JSON.parse(YE),XE=getUserModuleNames().filter(uN=>uN.includes(Mg)),cN=XE.flatMap(uN=>{try{const gN=fetchModule$2(uN);return gN?gN.getAgentNames().filter(mN=>gN.getAgent(mN)?.isPublic()??!1).map(mN=>`${uN}/${mN}`):[]}catch(gN){return console.warn(`Failed to fetch module ${uN} for public agents:`,gN),[]}});console.log(`[LOCAL] Found ${XE.length} modules:`,XE),console.log(`[LOCAL] Found ${cN.length} public agents:`,cN);const pN=XE.flatMap(uN=>fetchModule$2(uN).getEntityNames().map(gN=>`${uN}/${gN}`)),hN=XE.flatMap(uN=>buildGraph(uN).getRoots().map(mN=>`${mN.entity.getModuleName()}/${mN.entity.getEntryName()}`)),lN={Name:ly,Description:JE.description||"An application generated from "+ly},rA=await loadUISchema(ly,Mm,pN,hN,cN,lN);rA.appInfo||(rA.appInfo={}),rA.appInfo.apiUrl="http://localhost:8080",Gl(rA);const dN={githubOrg:uy,teamName:ly,branch:GE,projectPath:Mm};return __vitePreload(()=>import("./replService-BCjABThC.js"),__vite__mapDeps([33,1,18,19,5,9,11,16,14,15,10,20,21,17,4])).then(async({default:uN})=>{try{await uN.ensureReplSession(dN),await uN.initializeFileTracking(Mm)}catch(gN){console.error("❌ Failed to setup REPL deployment:",gN)}}),XE[0]},[su,Kl,La,Gl,zl,Wl]),$m=reactExports.useCallback(async Mm=>{ma(!0),hl("");try{au();const{GitHubOrg:Mg,GitHubRepo:ly,Name:uy,Branch:GE}=Mm,YE=`/${ly}`,JE=generateGitHubUrl(Mg,ly,su,Kl);await pathExists(YE)?La("Repository already exists. Loading modules..."):(La("Cloning repository..."),await cloneRepository(JE,YE,GE,Kl)),await ou(YE,ly,uy,Mg,GE)}catch(Mg){const ly=Mg instanceof Error?Mg.message:"Failed to clone repository";hl(ly),console.error("Error during repository clone:",Mg);try{const uy=`/${Mm.GitHubRepo}`;await pathExists(uy)&&(console.log(`Cleaning up failed clone: removing ${uy} from IndexedDB`),await removeDirectory(uy))}catch(uy){console.error("Error cleaning up failed clone:",uy)}}finally{ma(!1)}},[au,su,Kl,ou]),Nm=reactExports.useCallback((Mm,Mg,ly,uy,GE)=>{const YE=`/design/${Mm?"agents":"data-model"}/${Mg}/${ly}/${uy}`;GE?pa(YE,GE):pa(YE)},[pa]);return{isCloning:ha,error:Ba,loadingMessage:ja,cloneAndProcess:$m,navigateToDesign:Nm,processRepository:ou}},CLI_URL="http://localhost:4000";async function fetchFileTree(){const pa=await fetch(`${CLI_URL}/files`);if(!pa.ok)throw new Error("Failed to fetch file tree");return pa.json()}async function fetchFileContent(pa){const ha=await fetch(`${CLI_URL}/file?path=${encodeURIComponent(pa)}`);if(!ha.ok)throw new Error(`Failed to fetch file: ${pa}`);const{content:ma}=await ha.json();return ma}async function fetchPackageInfo(){const pa=await fetch(`${CLI_URL}/info`);return pa.ok?pa.json():{}}async function fetchDependencyTree(pa){const ha=await fetch(`${CLI_URL}/files?path=${encodeURIComponent(`node_modules/${pa}`)}`);if(ha.status===404)return[];if(!ha.ok)throw new Error(`Failed to fetch dependency tree for ${pa}`);return ha.json()}async function fetchDependencyFileContent(pa){const ha=await fetch(`${CLI_URL}/file?path=${encodeURIComponent(pa)}`);if(!ha.ok)throw new Error(`Failed to fetch file: ${pa}`);const{content:ma}=await ha.json();return ma}async function ensurePackageJson(pa,ha,ma,ja){if(ha.some(Gl=>Gl.type==="file"&&Gl.path==="package.json"))return;const Ba=`node_modules/${pa}/package.json`,hl=await fetchDependencyFileContent(Ba);await ja.writeFile(`${ma}/package.json`,hl)}async function verifyPackageJson(pa,ha,ma){const ja=`${pa}/package.json`;if(!await ma.exists(ja))try{await ma.readFile(ja)}catch{throw new Error(`package.json not found for ${ha} at ${ja}`)}}async function writeDependencyTree(pa,ha,ma,ja){await ja.writeFileSystemFromTree(ha,ma,async La=>{const Ba=`node_modules/${pa}/${La}`;return await fetchDependencyFileContent(Ba)})}async function processDependency(pa,ha,ma,ja,La,Ba){const hl=`${ha}/${pa.appName}`;try{ja&&La!==void 0&&Ba!==void 0&&ja(`Fetching ${pa.appName}...`,La+1,Ba);const Gl=await fetchDependencyTree(pa.appName);if(Gl.length===0)return{appName:pa.appName,success:!1,message:"Dependency not found on local server"};try{await ma.mkdir(hl)}catch(zl){if(zl.code!=="EEXIST")throw zl}return await ensurePackageJson(pa.appName,Gl,hl,ma),await writeDependencyTree(pa.appName,Gl,hl,ma),await verifyPackageJson(hl,pa.appName,ma),{appName:pa.appName,success:!0,message:"Successfully fetched from local server",path:hl}}catch(Gl){return{appName:pa.appName,success:!1,message:Gl.message||"Failed to fetch dependency",error:Gl}}}async function fetchDependenciesFromLocalServer(pa,ha,ma){const ja=await getFS(),La=`${pa}/node_modules`;try{await ja.mkdir(La)}catch(zl){return console.error(`Failed to create node_modules: ${zl.message}`),ha.map(Wl=>({appName:Wl.appName,success:!1,message:"Could not create node_modules directory",error:zl}))}const Ba=await Promise.all(ha.map((zl,Wl)=>processDependency(zl,La,ja,ma,Wl,ha.length))),hl=Ba.filter(zl=>zl.success),Gl=Ba.filter(zl=>!zl.success);return hl.length>0&&console.log(`✓ Fetched ${hl.length} dependencies:`,hl.map(zl=>zl.appName).join(", ")),Gl.length>0&&console.warn(`⚠ Failed to fetch ${Gl.length} dependencies:`,Gl.map(zl=>zl.appName).join(", ")),Ba}function parsePackageName(pa){if(!pa?.name)return{org:"file",name:""};const ha=pa.name;if(ha.startsWith("@")){const ma=ha.substring(1).split("/");if(ma.length===2)return{org:ma[0],name:ma[1]}}return{org:"file",name:ha}}function isDesignPage(pa){return pa?["data-model","marketplace-data-model","agents","workflow","security","ui","settings"].includes(pa):!1}const useServeMode=()=>{const pa=useNavigate(),ha=useMatches(),{processRepository:ma}=useRepositoryClone(),[ja,La]=reactExports.useState(""),[Ba,hl]=reactExports.useState(null);return{initializeServeMode:reactExports.useCallback(async()=>{La("Connecting to local server..."),hl(null);try{const[zl,Wl]=await Promise.all([fetchFileTree(),fetchPackageInfo()]),{org:Kl,name:su}=parsePackageName(Wl),au=`/${su}`;La("Loading file system..."),await(await getFS()).writeFileSystemFromTree(zl,au,fetchFileContent),La("Processing project...");const $m=await ma(au,su,su,Kl,"main"),Nm=ha[ha.length-1];if(isDesignPage(Nm?.id))return;const Mm=`/design/agents/${Kl}/${su}`;pa($m?`${Mm}/${$m}`:Mm)}catch(zl){const Wl=zl instanceof Error?zl.message:"An unknown error occurred";hl(Wl),console.error("Failed to initialize serve mode:",zl)}finally{La("")}},[ma,pa,ha]),loadingMessage:ja,error:Ba}},validationScehma=create$3().shape({email:create$6().email("Invalid email").required("Email is required"),password:create$6().required("Password is required")}),SignIn=()=>{const{login:pa}=useAuth(),ha=useNavigate();return reactExports.useEffect(()=>{{ha("/design/dashboard");return}},[ha]),jsxRuntimeExports.jsx(Formik,{initialValues:{email:"",password:""},validationSchema:validationScehma,onSubmit:ma=>{const{email:ja,password:La}=ma;pa(ja,La)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Sign In"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Get started with building your team of AI Agents"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx("div",{className:"auth-link text-right",onClick:()=>ha("/forgot-password"),children:"Forgot password?"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Sign in"}),jsxRuntimeExports.jsxs("p",{className:"flex justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"No account ?"}),jsxRuntimeExports.jsx(Link,{className:"auth-link font-bold",to:"/signup",children:"Sign Up"})]})]})})},uppercaseRegex=/[A-Z]/,lowercaseRegex=/[a-z]/,numberRegex=/[0-9]/,specialCharRegex=/[!@#$%^&*(),.?":{}|<>]/,validationSchema$e=create$3().shape({firstName:create$6().required("First Name is required").min(2,"First Name must be at least 2 characters").max(50,"First Name must be less than 50 characters"),lastName:create$6().required("Last Name is required").min(2,"Last Name must be at least 2 characters").max(50,"Last Name must be less than 50 characters"),email:create$6().required("Email is required").email("Invalid email address"),password:create$6().required("Password is required").min(8,"Password must be at least 8 characters").matches(uppercaseRegex,"Password must contain at least one uppercase letter").matches(lowercaseRegex,"Password must contain at least one lowercase letter").matches(numberRegex,"Password must contain at least one number").matches(specialCharRegex,"Password must contain at least one special character"),confirmPassword:create$6().required("Confirm Password is required").oneOf([create$9("password")],"Passwords don't match")}),SignUp=()=>{const pa=useNavigate(),{signUp:ha,isSigningUp:ma}=useSignUp(),[ja,La]=reactExports.useState(null);return jsxRuntimeExports.jsx(Formik,{initialValues:{firstName:"",lastName:"",email:"",password:"",confirmPassword:""},validationSchema:validationSchema$e,onSubmit:async(Ba,{setSubmitting:hl})=>{La(null);try{const Gl=await ha({firstName:Ba.firstName,lastName:Ba.lastName,email:Ba.email,password:Ba.password});!Gl.success&&Gl.error&&La(Gl.error)}catch{La("An unexpected error occurred. Please try again.")}finally{hl(!1)}},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Sign Up"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Get started with building your team of AI Agents"})]}),jsxRuntimeExports.jsxs("div",{className:"md:grid flex flex-col md:grid-cols-2 gap-2",children:[jsxRuntimeExports.jsx(aQ,{name:"firstName",placeholder:"First Name"}),jsxRuntimeExports.jsx(aQ,{name:"lastName",placeholder:"Last Name"}),jsxRuntimeExports.jsx("div",{className:"col-span-2",children:jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"})}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx(uQ,{name:"confirmPassword",placeholder:"Confirm Password"})]}),ja&&jsxRuntimeExports.jsx("div",{className:"text-red-500 text-sm text-center p-2",children:ja}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",disabled:ma,children:ma?"Creating Account...":"Create Account"}),jsxRuntimeExports.jsxs("p",{className:"flex justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already have an account ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})},validationSchema$d=create$3().shape({email:create$6().required("Email is required").email("Invalid email address")}),ForgotPassword=()=>{const pa=useNavigate();return jsxRuntimeExports.jsx(Formik,{initialValues:{email:""},validationSchema:validationSchema$d,onSubmit:ha=>{const{email:ma}=ha;console.log(ma)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Reset Password"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Send confirmation code to your email"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Send confirmation code"}),jsxRuntimeExports.jsxs("p",{className:"flex flex-col md:flex-row justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already recovered your password ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})},numberOnlyRegex=/^[0-9]+$/,validationSchema$c=create$3().shape({email:create$6().required("Email is required").email("Invalid email address"),password:create$6().required("Password is required"),code:create$6().matches(numberOnlyRegex,"Code must contain only numbers")}),RecoverPassword=()=>{const pa=useNavigate();return jsxRuntimeExports.jsx(Formik,{validationSchema:validationSchema$c,initialValues:{email:"",password:"",code:""},onSubmit:ha=>{const{email:ma,password:ja,code:La}=ha;console.log(ma,ja,La)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Reset Password"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Set new password"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx(uQ,{name:"code",placeholder:"Code"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Set new password"}),jsxRuntimeExports.jsxs("p",{className:"flex flex-col md:flex-row justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already recovered your password ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})};var classnames={exports:{}};/*!
|
|
18043
|
+
}`),await commitChanges(cN,"config.al","Add config.al",{name:La,email:La});const pN="src/core.al";await writeRepoFile(Mg,pN,`module ${Mm.toLowerCase()}.core`),await commitChanges(cN,pN,"Add core.al ",{name:La,email:La}),Wl("pushing-changes"),su("Pushing changes to GitHub..."),await pushChanges(cN,"origin",ly,ma),Wl("loading-module"),su("Loading module...");try{await flushAllAndLoad(`/${Mm}`,{name:"studio"});const hN=getUserModuleNames();Wl("adding-workspace"),su("Adding to workspace...");const lN={name:$m,type:"App",gitHubOrg:ja,gitHubRepo:Mm,branch:ly,description:"",owner:localStorage.getItem("username")||"",version:"0.0.1",isEditable:!0};await pa(lN),Gl(!1),Ba(`/design/data-model/${ja}/${Mm}/${hN[0]}`,{state:{isNewTeam:!0}})}catch(hN){console.error(`Failed to load ${Mm}:`,hN);try{await pathExists(Mg)&&(console.log(`Cleaning up failed clone: removing ${Mg} from IndexedDB`),await removeDirectory(Mg))}catch(lN){console.error("Error cleaning up failed clone:",lN)}Gl(!1)}}catch(Mg){console.error(`Failed to clone repository: ${Mg}`);try{const ly=`/${Mm}`;await pathExists(ly)&&(console.log(`Cleaning up failed clone: removing ${ly} from IndexedDB`),await removeDirectory(ly))}catch(ly){console.error("Error cleaning up failed clone:",ly)}Gl(!1)}}catch(Nm){console.error("Failed to create GitHub Repository:",Nm),Gl(!1)}},isLoading:hl,currentStep:zl,statusMessage:Kl,loadingSteps:[{id:"creating-repo",label:"Creating GitHub repository"},{id:"cloning-repo",label:"Cloning repository"},{id:"adding-files",label:"Adding initial files"},{id:"committing-changes",label:"Committing changes"},{id:"pushing-changes",label:"Pushing to GitHub"},{id:"loading-module",label:"Loading module"},{id:"adding-workspace",label:"Adding to workspace"}]}},getDependenciesRecursive=async(pa,ha,ma=new Set)=>{const ja=Object.entries(ha).filter(([Ba,hl])=>{const Gl=typeof hl=="string"&&hl.startsWith("git+http"),zl=!ma.has(Ba);return Gl&&zl&&ma.add(Ba),Gl&&zl});return ja.length===0?[]:(await Promise.all(ja.map(async([Ba])=>{const hl=Ba.split(".")[0],Gl=[hl];try{const zl=await readDependencyPackageJsonFromGit(pa,hl);if(zl.dependencies){const Wl=await getDependenciesRecursive(pa,zl.dependencies,ma);Gl.push(...Wl)}}catch(zl){console.error(`Failed to process dependency ${hl}:`,zl)}return Gl}))).flat()},fetchDependencies=async pa=>{const ma=(await readPackageJsonFromGit(pa)).dependencies||{},ja=Object.entries(ma).filter(([,Ba])=>typeof Ba=="string"&&Ba.startsWith("git+http")).map(([Ba])=>Ba.split(".")[0]),La=await getDependenciesRecursive(pa,ma,new Set(ja));return Array.from(new Set([...ja,...La]))},useDependencies=()=>{const{currentTeam:pa}=useTeams(),ha=pa?.GitHubRepo,{data:ma=[],isLoading:ja}=useQuery({queryKey:["dependencies",ha],queryFn:()=>fetchDependencies(ha),enabled:!!ha}),La=getUserModuleNames(),Ba=[ha,...ma].map(Wl=>({label:Wl||"",value:Wl||""})),hl=Wl=>{const Kl=Wl.toLowerCase(),su=Kl.replace(/_/g,"");return La.filter(au=>{const ou=au.toLowerCase(),$m=ou.split(".")[0];return ou.startsWith(Kl)||$m===su})},Gl=ha||"",zl=Gl?hl(Gl)[0]:"";return{dependencies:ma,dependenciesOptions:Ba,loading:ja,getDependenciesModule:hl,defaultDependency:Gl,defaultModule:zl}},useDoubleClick=(pa,ha,ma=300)=>{const ja=reactExports.useRef(null),La=reactExports.useRef(0),Ba=reactExports.useCallback(hl=>{hl.stopPropagation(),hl.preventDefault(),La.current+=1,La.current===1?ja.current=setTimeout(()=>{La.current===1&&pa(hl),La.current=0,ja.current=null},ma):La.current===2&&(ja.current&&(clearTimeout(ja.current),ja.current=null),ha(hl),La.current=0)},[pa,ha,ma]);return reactExports.useEffect(()=>()=>{ja.current&&clearTimeout(ja.current)},[]),Ba};var I$8=Object.defineProperty,E$7=(pa,ha,ma)=>ha in pa?I$8(pa,ha,{enumerable:!0,configurable:!0,writable:!0,value:ma}):pa[ha]=ma,w$9=(pa,ha,ma)=>E$7(pa,typeof ha!="symbol"?ha+"":ha,ma);function T$a(pa,ha){for(var ma=0;ma<ha.length;ma++){const ja=ha[ma];if(typeof ja!="string"&&!Array.isArray(ja)){for(const La in ja)if(La!=="default"&&!(La in pa)){const Ba=Object.getOwnPropertyDescriptor(ja,La);Ba&&Object.defineProperty(pa,La,Ba.get?Ba:{enumerable:!0,get:()=>ja[La]})}}}return Object.freeze(Object.defineProperty(pa,Symbol.toStringTag,{value:"Module"}))}function z$5(pa){return{isFile:()=>pa.isFile(),isDirectory:()=>pa.isDirectory(),isSymbolicLink:()=>pa.isSymbolicLink(),size:pa.size,mtime:pa.mtime}}let j$a=class{async readFile(ha){return(void 0)(ha,"utf8")}async readFileBuffer(ha){return(void 0)(ha)}async writeFile(ha,ma){const ja=(void 0)(ha);return await this.ensureDir(ja),(void 0)(ha,ma)}async exists(ha){try{return await(void 0)(ha),!0}catch{return!1}}async mkdir(ha){try{await(void 0)(ha)}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async readdir(ha){return(void 0)(ha)}async stat(ha){const ma=await(void 0)(ha);return z$5(ma)}async lstat(ha){const ma=await(void 0)(ha);return z$5(ma)}async unlink(ha){return(void 0)(ha)}async rmdir(ha){return(void 0)(ha)}async copyFile(ha,ma){const ja=(void 0)(ma);return await this.ensureDir(ja),(void 0)(ha,ma)}async moveFile(ha,ma){const ja=(void 0)(ma);return await this.ensureDir(ja),(void 0)(ha,ma)}async ensureDir(ha){try{await(void 0)(ha,{recursive:!0})}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async removeDir(ha){return(void 0)(ha,{recursive:!0,force:!0})}async readDirectory(ha){return(void 0)(ha)}async writeFileSystemFromTree(ha,ma,ja){for(const La of ha){const Ba=(void 0)(ma,La.path);if(La.type==="directory")await this.ensureDir(Ba),La.children&&await this.writeFileSystemFromTree(La.children,ma,ja);else{const hl=await ja(La.path);await this.writeFile(Ba,hl)}}}};function p$c(){return new j$a}function _$7(pa){return pa&&pa.__esModule&&Object.prototype.hasOwnProperty.call(pa,"default")?pa.default:pa}var b$8,S$a;function x$6(){if(S$a)return b$8;S$a=1;function pa(La){if(typeof La!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(La))}function ha(La,Ba){for(var hl="",Gl=0,zl=-1,Wl=0,Kl,su=0;su<=La.length;++su){if(su<La.length)Kl=La.charCodeAt(su);else{if(Kl===47)break;Kl=47}if(Kl===47){if(!(zl===su-1||Wl===1))if(zl!==su-1&&Wl===2){if(hl.length<2||Gl!==2||hl.charCodeAt(hl.length-1)!==46||hl.charCodeAt(hl.length-2)!==46){if(hl.length>2){var au=hl.lastIndexOf("/");if(au!==hl.length-1){au===-1?(hl="",Gl=0):(hl=hl.slice(0,au),Gl=hl.length-1-hl.lastIndexOf("/")),zl=su,Wl=0;continue}}else if(hl.length===2||hl.length===1){hl="",Gl=0,zl=su,Wl=0;continue}}Ba&&(hl.length>0?hl+="/..":hl="..",Gl=2)}else hl.length>0?hl+="/"+La.slice(zl+1,su):hl=La.slice(zl+1,su),Gl=su-zl-1;zl=su,Wl=0}else Kl===46&&Wl!==-1?++Wl:Wl=-1}return hl}function ma(La,Ba){var hl=Ba.dir||Ba.root,Gl=Ba.base||(Ba.name||"")+(Ba.ext||"");return hl?hl===Ba.root?hl+Gl:hl+La+Gl:Gl}var ja={resolve:function(){for(var La="",Ba=!1,hl,Gl=arguments.length-1;Gl>=-1&&!Ba;Gl--){var zl;Gl>=0?zl=arguments[Gl]:(hl===void 0&&(hl=process.cwd()),zl=hl),pa(zl),zl.length!==0&&(La=zl+"/"+La,Ba=zl.charCodeAt(0)===47)}return La=ha(La,!Ba),Ba?La.length>0?"/"+La:"/":La.length>0?La:"."},normalize:function(La){if(pa(La),La.length===0)return".";var Ba=La.charCodeAt(0)===47,hl=La.charCodeAt(La.length-1)===47;return La=ha(La,!Ba),La.length===0&&!Ba&&(La="."),La.length>0&&hl&&(La+="/"),Ba?"/"+La:La},isAbsolute:function(La){return pa(La),La.length>0&&La.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var La,Ba=0;Ba<arguments.length;++Ba){var hl=arguments[Ba];pa(hl),hl.length>0&&(La===void 0?La=hl:La+="/"+hl)}return La===void 0?".":ja.normalize(La)},relative:function(La,Ba){if(pa(La),pa(Ba),La===Ba||(La=ja.resolve(La),Ba=ja.resolve(Ba),La===Ba))return"";for(var hl=1;hl<La.length&&La.charCodeAt(hl)===47;++hl);for(var Gl=La.length,zl=Gl-hl,Wl=1;Wl<Ba.length&&Ba.charCodeAt(Wl)===47;++Wl);for(var Kl=Ba.length,su=Kl-Wl,au=zl<su?zl:su,ou=-1,$m=0;$m<=au;++$m){if($m===au){if(su>au){if(Ba.charCodeAt(Wl+$m)===47)return Ba.slice(Wl+$m+1);if($m===0)return Ba.slice(Wl+$m)}else zl>au&&(La.charCodeAt(hl+$m)===47?ou=$m:$m===0&&(ou=0));break}var Nm=La.charCodeAt(hl+$m),Mm=Ba.charCodeAt(Wl+$m);if(Nm!==Mm)break;Nm===47&&(ou=$m)}var Mg="";for($m=hl+ou+1;$m<=Gl;++$m)($m===Gl||La.charCodeAt($m)===47)&&(Mg.length===0?Mg+="..":Mg+="/..");return Mg.length>0?Mg+Ba.slice(Wl+ou):(Wl+=ou,Ba.charCodeAt(Wl)===47&&++Wl,Ba.slice(Wl))},_makeLong:function(La){return La},dirname:function(La){if(pa(La),La.length===0)return".";for(var Ba=La.charCodeAt(0),hl=Ba===47,Gl=-1,zl=!0,Wl=La.length-1;Wl>=1;--Wl)if(Ba=La.charCodeAt(Wl),Ba===47){if(!zl){Gl=Wl;break}}else zl=!1;return Gl===-1?hl?"/":".":hl&&Gl===1?"//":La.slice(0,Gl)},basename:function(La,Ba){if(Ba!==void 0&&typeof Ba!="string")throw new TypeError('"ext" argument must be a string');pa(La);var hl=0,Gl=-1,zl=!0,Wl;if(Ba!==void 0&&Ba.length>0&&Ba.length<=La.length){if(Ba.length===La.length&&Ba===La)return"";var Kl=Ba.length-1,su=-1;for(Wl=La.length-1;Wl>=0;--Wl){var au=La.charCodeAt(Wl);if(au===47){if(!zl){hl=Wl+1;break}}else su===-1&&(zl=!1,su=Wl+1),Kl>=0&&(au===Ba.charCodeAt(Kl)?--Kl===-1&&(Gl=Wl):(Kl=-1,Gl=su))}return hl===Gl?Gl=su:Gl===-1&&(Gl=La.length),La.slice(hl,Gl)}else{for(Wl=La.length-1;Wl>=0;--Wl)if(La.charCodeAt(Wl)===47){if(!zl){hl=Wl+1;break}}else Gl===-1&&(zl=!1,Gl=Wl+1);return Gl===-1?"":La.slice(hl,Gl)}},extname:function(La){pa(La);for(var Ba=-1,hl=0,Gl=-1,zl=!0,Wl=0,Kl=La.length-1;Kl>=0;--Kl){var su=La.charCodeAt(Kl);if(su===47){if(!zl){hl=Kl+1;break}continue}Gl===-1&&(zl=!1,Gl=Kl+1),su===46?Ba===-1?Ba=Kl:Wl!==1&&(Wl=1):Ba!==-1&&(Wl=-1)}return Ba===-1||Gl===-1||Wl===0||Wl===1&&Ba===Gl-1&&Ba===hl+1?"":La.slice(Ba,Gl)},format:function(La){if(La===null||typeof La!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof La);return ma("/",La)},parse:function(La){pa(La);var Ba={root:"",dir:"",base:"",ext:"",name:""};if(La.length===0)return Ba;var hl=La.charCodeAt(0),Gl=hl===47,zl;Gl?(Ba.root="/",zl=1):zl=0;for(var Wl=-1,Kl=0,su=-1,au=!0,ou=La.length-1,$m=0;ou>=zl;--ou){if(hl=La.charCodeAt(ou),hl===47){if(!au){Kl=ou+1;break}continue}su===-1&&(au=!1,su=ou+1),hl===46?Wl===-1?Wl=ou:$m!==1&&($m=1):Wl!==-1&&($m=-1)}return Wl===-1||su===-1||$m===0||$m===1&&Wl===su-1&&Wl===Kl+1?su!==-1&&(Kl===0&&Gl?Ba.base=Ba.name=La.slice(1,su):Ba.base=Ba.name=La.slice(Kl,su)):(Kl===0&&Gl?(Ba.name=La.slice(1,Wl),Ba.base=La.slice(1,su)):(Ba.name=La.slice(Kl,Wl),Ba.base=La.slice(Kl,su)),Ba.ext=La.slice(Wl,su)),Kl>0?Ba.dir=La.slice(0,Kl-1):Gl&&(Ba.dir="/"),Ba},sep:"/",delimiter:":",win32:null,posix:null};return ja.posix=ja,b$8=ja,b$8}var A$7=x$6();const B$5=_$7(A$7),O$5=T$a({__proto__:null,default:B$5},[A$7]);function k$a(pa){if(pa&&typeof pa=="object"){const ha=pa,ma=typeof ha.isFile=="function"?ha.isFile():typeof ha.isFile=="boolean"?ha.isFile:ha.type==="file"||!ha.type&&!ha.isDirectory,ja=typeof ha.isDirectory=="function"?ha.isDirectory():typeof ha.isDirectory=="boolean"?ha.isDirectory:ha.type==="dir"||ha.type==="directory",La=typeof ha.size=="number"?ha.size:0;let Ba;return ha.mtime instanceof Date?Ba=ha.mtime:typeof ha.mtime=="number"?Ba=new Date(ha.mtime):typeof ha.mtimeMs=="number"?Ba=new Date(ha.mtimeMs):Ba=new Date,{isFile:()=>ma,isDirectory:()=>ja,isSymbolicLink:()=>!1,size:La,mtime:Ba}}return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:0,mtime:new Date}}let P$9=class{constructor(){w$9(this,"fs"),w$9(this,"initialized",!1),w$9(this,"path",O$5)}async initialize(ha={}){if(this.initialized)return;const ma=ha.name||"fs",ja=new L$8(ma,{wipe:ha.wipe});this.fs=ja.promises,this.initialized=!0}ensureInitialized(){if(!this.initialized)throw new Error("LightningFileSystem is not initialized. Call initialize() first.")}async readFile(ha){return this.ensureInitialized(),(await this.fs.readFile(ha,{encoding:"utf8"})).toString()}async readFileBuffer(ha){return this.ensureInitialized(),this.fs.readFile(ha)}async writeFile(ha,ma){this.ensureInitialized();const ja=ha.substring(0,ha.lastIndexOf("/"));return ja&&await this.ensureDir(ja),this.fs.writeFile(ha,ma)}async exists(ha){this.ensureInitialized();try{return await this.fs.stat(ha),!0}catch{return!1}}async mkdir(ha,ma){this.ensureInitialized();try{return await this.fs.mkdir(ha,ma)}catch(ja){if(ja&&typeof ja=="object"&&"code"in ja&&ja.code!=="EEXIST")throw ja}}async readdir(ha){return this.ensureInitialized(),this.fs.readdir(ha)}async stat(ha){this.ensureInitialized();const ma=await this.fs.stat(ha);return k$a(ma)}async lstat(ha){this.ensureInitialized();const ma=await this.fs.stat(ha);return k$a(ma)}async unlink(ha){return this.ensureInitialized(),this.fs.unlink(ha)}async rmdir(ha){return this.ensureInitialized(),this.fs.rmdir(ha)}async copyFile(ha,ma){this.ensureInitialized();const ja=ma.substring(0,ma.lastIndexOf("/"));ja&&await this.ensureDir(ja);const La=await this.readFileBuffer(ha);return this.writeFile(ma,La)}async moveFile(ha,ma){this.ensureInitialized();const ja=ma.substring(0,ma.lastIndexOf("/"));ja&&await this.ensureDir(ja),await this.copyFile(ha,ma),await this.unlink(ha)}async ensureDir(ha){if(this.ensureInitialized(),!await this.exists(ha))try{await this.fs.mkdir(ha,{recursive:!0})}catch(ma){if(ma&&typeof ma=="object"&&"code"in ma&&ma.code!=="EEXIST")throw ma}}async removeDir(ha){if(this.ensureInitialized(),!await this.exists(ha))return;if((await this.stat(ha)).isFile())return this.unlink(ha);const ma=await this.readdir(ha);for(const ja of ma){const La=`${ha}/${ja}`;await this.removeDir(La)}return this.rmdir(ha)}async readDirectory(ha){return this.ensureInitialized(),this.fs.readdir(ha)}async writeFileSystemFromTree(ha,ma,ja){for(const La of ha){const Ba=this.path.join(ma,La.path);if(La.type==="directory")await this.mkdir(Ba,{recursive:!0}),La.children&&await this.writeFileSystemFromTree(La.children,ma,ja);else{const hl=await ja(La.path);await this.writeFile(Ba,hl)}}}};async function M$6(pa){const ha=new P$9;return await ha.initialize(pa),ha}async function $$6(pa){return typeof window>"u"?p$c():M$6(pa)}let fsInstance=null;const getFS=async()=>(fsInstance||(fsInstance=await $$6({name:"studio",wipe:!0})),fsInstance),useDependencyProcessor=()=>{const pa=reactExports.useCallback(ma=>{if(!ma.dependencies)return[];const ja=[];for(const[La,Ba]of Object.entries(ma.dependencies))typeof Ba=="string"&&Ba.startsWith("git+http")&&ja.push({appName:La,url:Ba});return ja},[]),ha=reactExports.useCallback(async(ma,ja,La,Ba)=>{const hl=await readRepoFile(ma,"package.json"),Gl=JSON.parse(hl),zl=pa(Gl);if(zl.length===0)return[];Ba&&Ba(`Installing ${zl.length} dependencies...`,0,zl.length);let Wl;Wl=await fetchDependenciesFromLocalServer(ma,zl,(au,ou,$m)=>{Ba&&Ba(`[${ou}/${$m}] ${au}`,ou,$m)});const Kl=Wl.filter(au=>!au.success),su=Wl.filter(au=>au.success);if(su.length>0&&console.log(`✓ Successfully fetched ${su.length} dependencies:`,su.map(au=>au.appName).join(", ")),Kl.length>0&&console.warn(`⚠ Failed to install ${Kl.length} of ${zl.length} dependencies:`,Kl.map(au=>`${au.appName} (${au.message})`).join(", ")),su.length>0){const au=await getFS();for(const ou of su)if(ou.path)try{const $m=`${ou.path}/package.json`;await au.exists($m)?console.log(`✓ ${ou.appName}: Verified package.json exists`):console.error(`✗ ${ou.appName}: package.json missing at ${$m}`)}catch($m){console.error(`✗ ${ou.appName}: Verification failed:`,$m)}}return Wl},[pa]);return{extractGitDependencies:pa,processDependencies:ha}},useConfigLoader=()=>{const pa=useAppStore(ma=>ma.setAppConfig);return{loadConfig:reactExports.useCallback(async ma=>{try{const ja=await readRepoFile(ma,"config.al"),La=parseAppConfig(ja);return pa(La),La}catch(ja){console.warn("Failed to manually load/parse config.al, falling back to runtime loader:",ja);try{const La=await loadAppConfig(ma);return pa(La),La}catch(La){return console.error("Failed to load app config via runtime loader:",La),pa({}),{}}}},[pa])}},accessedKeys=new Map,getLocalEnv=pa=>{const ha=getLocalEnv$2(pa);return console.log(`🔍 getLocalEnv("${pa}") called, returning:`,ha?`${ha.substring(0,10)}...`:"undefined"),accessedKeys.set(pa,{value:ha,timestamp:Date.now()}),ha||console.warn(`⚠️ Key "${pa}" not found in LocalEnv`),ha};typeof window<"u"&&(window.debugResolverKeys={getAccessedKeys:()=>Array.from(accessedKeys.entries()),listAccessedKeys:()=>{console.log("📋 Keys accessed by resolvers:"),accessedKeys.forEach(({value:pa},ha)=>{console.log(` ${ha}: ${pa?"found":"NOT FOUND"}`)})}});const API_DOMAIN_TO_PROVIDER={"api.hubapi.com":"hubspot","slack.com":"slack","api.github.com":"github","api.stripe.com":"stripe","api.airtable.com":"airtable","api.notion.com":"notion","api.openai.com":"openai","api.anthropic.com":"anthropic","www.googleapis.com":"google"};function createProxiedAxios(){const pa=getURL("api-cors-proxy"),ha=axios.create({timeout:3e4});return ha.interceptors.request.use(ma=>{const ja=ma.url;if(ja&&(ja.startsWith("http://")||ja.startsWith("https://")))try{const La=new URL(ja),Ba=La.hostname,hl=La.pathname+La.search,Gl=API_DOMAIN_TO_PROVIDER[Ba];if(!Gl)return console.warn(`⚠️ No CORS proxy provider configured for domain: ${Ba}`),console.warn(` Add '${Ba}' to API_DOMAIN_TO_PROVIDER in browserResolvers.ts`),ma;console.log(`🔄 Proxying API call: ${ja}`),console.log(` → Provider: ${Gl}`),console.log(" → Original headers:",ma.headers),ma.url=`${pa}/proxy/${Gl}${hl}`,console.log(` → New URL: ${ma.url}`),console.log(" → Final headers:",ma.headers)}catch(La){console.error("Failed to parse URL for proxying:",ja,La)}return ma}),ha.interceptors.response.use(ma=>ma,ma=>(ma.code==="ERR_NETWORK"?console.error("❌ Network error - Check if CORS proxy is running on",pa):ma.response?.status===401?console.error("❌ 401 Unauthorized - Check API credentials"):ma.response?.status===403&&console.error("❌ 403 Forbidden - Check API permissions"),Promise.reject(ma))),ha}const proxiedAxios=createProxiedAxios(),COMMON_DEPENDENCIES=new Map([["agentlang",{...agentlangRuntimeUtil,asInstance,makeInstance:makeInstance$1,getLocalEnv}],["@fractl/agentlang",{...agentlangRuntimeUtil,asInstance,makeInstance:makeInstance$1,getLocalEnv}],["agentlang/out/runtime/module.js",{makeInstance:makeInstance$1}],["agentlang/out/runtime/auth/defs.js",{getLocalEnv}],["axios",{default:proxiedAxios}]]);function asInstance(pa,ha){const ma=ha.split("/"),ja=ma.length===2?ma[0]:"hubspot",La=ma.length===2?ma[1]:ha,Ba=new Map(Object.entries(pa));return makeInstance$1(ja,La,Ba)}function getDependency(pa){if(COMMON_DEPENDENCIES.has(pa))return COMMON_DEPENDENCIES.get(pa);for(const[ha,ma]of COMMON_DEPENDENCIES)if(pa.includes(`/${ha}`)||pa.endsWith(`/${ha}`))return ma}const BUILTIN_MODULE_PATHS=["./modules/core.js","./modules/auth.js"];async function setupResolverLoader(pa){try{console.log("⚙️ Configuring AgentLang module loader for:",pa),setModuleLoader({fileReader:async ma=>{if(console.log(`📖 Reading file: ${ma}`),BUILTIN_MODULE_PATHS.includes(ma))return console.log(`📦 Built-in module: ${ma} (using global registration)`),"";let ja=ma;return ma.startsWith(pa+"/")?ja=ma.substring(pa.length+1):ma.startsWith(pa)&&(ja=ma.substring(pa.length)),ja.startsWith("/")&&(ja=ja.substring(1)),console.log(`📖 Resolved to relative path: ${ja}`),await readRepoFile(pa,ja)},dependencyProvider:ma=>{const ja=getDependency(ma);return ja?console.log(`✅ Resolved dependency: ${ma}`):console.warn(`⚠️ Unknown dependency: ${ma}`),ja},basePath:""}),console.log("✅ Module loader configured successfully"),console.log("ℹ️ Resolvers will be loaded automatically when AgentLang parses .al files")}catch(ha){console.error("❌ Failed to setup resolver loader:",ha)}}const RESOLVER_CONFIGS={hsr:{initFunctionName:"initializeHubSpotConfig",envKeyMapping:{HUBSPOT_ACCESS_TOKEN:"accessToken"},configBuilder:pa=>({accessToken:pa.HUBSPOT_ACCESS_TOKEN})},gmr:{initFunctionName:"initializeGmailConfig",envKeyMapping:{GMAIL_CLIENT_ID:"clientId",GMAIL_CLIENT_SECRET:"clientSecret",GMAIL_REFRESH_TOKEN:"refreshToken",GMAIL_POLL_INTERVAL_MINUTES:"pollIntervalMinutes"},configBuilder:pa=>({clientId:pa.GMAIL_CLIENT_ID,clientSecret:pa.GMAIL_CLIENT_SECRET,refreshToken:pa.GMAIL_REFRESH_TOKEN,pollIntervalMinutes:pa.GMAIL_POLL_INTERVAL_MINUTES})},gsr:{initFunctionName:"initializeGoogleConfig",envKeyMapping:{GOOGLE_API_KEY:"apiKey",GOOGLE_CLIENT_ID:"clientId",GOOGLE_CLIENT_SECRET:"clientSecret"},configBuilder:pa=>({apiKey:pa.GOOGLE_API_KEY,clientId:pa.GOOGLE_CLIENT_ID,clientSecret:pa.GOOGLE_CLIENT_SECRET})},slackr:{initFunctionName:"initializeSlackConfig",envKeyMapping:{SLACK_BOT_TOKEN:"botToken",SLACK_APP_TOKEN:"appToken"},configBuilder:pa=>({botToken:pa.SLACK_BOT_TOKEN,appToken:pa.SLACK_APP_TOKEN})},ghr:{initFunctionName:"initializeGitHubConfig",envKeyMapping:{GITHUB_TOKEN:"token",GITHUB_API_KEY:"apiKey"},configBuilder:pa=>({token:pa.GITHUB_TOKEN||pa.GITHUB_API_KEY})}};async function initializeResolverConfigs(){try{const{getEnvironmentKeysAsObject:pa}=await __vitePreload(async()=>{const{getEnvironmentKeysAsObject:ja}=await Promise.resolve().then(()=>playgroundEnvKeys);return{getEnvironmentKeysAsObject:ja}},void 0),ha=pa();console.log("🔑 Available environment keys:",Object.keys(ha));const ma=getImportedModuleNames();console.log("📦 Imported modules:",ma);for(const[ja,La]of Object.entries(RESOLVER_CONFIGS)){const Ba=getImportedModule(ja);if(!Ba){console.log(`ℹ️ Resolver "${ja}" not loaded - skipping initialization`);continue}console.log(`📋 Found resolver module: ${ja}`);const hl=Ba[La.initFunctionName];if(typeof hl!="function"){console.warn(`⚠️ Resolver "${ja}" found but "${La.initFunctionName}" function is missing`);continue}const Gl=Object.keys(La.envKeyMapping);if(Gl.filter(su=>ha[su]).length===0){console.warn(`⚠️ No environment keys found for resolver "${ja}". Expected: ${Gl.join(", ")}`);continue}const Wl=La.configBuilder(ha),Kl=Object.fromEntries(Object.entries(Wl).filter(([su,au])=>au!==void 0));if(Object.keys(Kl).length===0){console.warn(`⚠️ No valid configuration could be built for resolver "${ja}"`);continue}console.log(`🔑 Initializing resolver "${ja}" with config:`,{...Kl,...Object.keys(Kl).reduce((su,au)=>{const ou=Kl[au],$m=typeof ou=="string"?`***${ou.slice(-4)}`:"***";return{...su,[au]:$m}},{})});try{await hl(Kl),console.log(`✅ Resolver "${ja}" configured successfully`),Ba.config&&console.log(" Configuration stored in resolver.config")}catch(su){console.error(`❌ Failed to initialize resolver "${ja}":`,su)}}console.log("✅ Resolver initialization complete")}catch(pa){console.error("❌ Failed to initialize resolver configs:",pa)}}const browserResolvers=Object.freeze(Object.defineProperty({__proto__:null,initializeResolverConfigs,setupResolverLoader},Symbol.toStringTag,{value:"Module"})),useRepositoryClone=()=>{const pa=useNavigate(),[ha,ma]=reactExports.useState(!1),[ja,La]=reactExports.useState(""),[Ba,hl]=reactExports.useState(""),Gl=BZ();useAppStore(Mm=>Mm.user);const{processDependencies:zl}=useDependencyProcessor(),{loadConfig:Wl}=useConfigLoader(),Kl="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",su="hamza@fractl.io",au=reactExports.useCallback(()=>{const Mm=su.trim().length>0,Mg=Kl.trim().length>0;(!Mm||!Mg)&&console.warn("GitHub credentials missing - clone may fail for private repositories")},[Kl,su]),ou=reactExports.useCallback(async(Mm,Mg,ly,uy,GE)=>{await zl(Mm,su,Kl,uN=>{La(uN)}),La("Loading application modules..."),La("Initializing runtime with environment keys...");{const{inBrowserREPL:uN}=await __vitePreload(async()=>{const{inBrowserREPL:gN}=await Promise.resolve().then(()=>inBrowserREPL$1);return{inBrowserREPL:gN}},void 0);await uN.initializeRuntime()}La("Configuring resolver loader..."),await setupResolverLoader(Mm),La("Loading AgentLang modules..."),await flushAllAndLoad(Mm,{name:"studio"}),La("Registering agents and initializing modules..."),await runInitFunctions(),await runStandaloneStatements(),La("Initializing resolver configurations..."),await initializeResolverConfigs(),await Wl(Mm);const YE=await readRepoFile(Mm,"package.json"),JE=JSON.parse(YE),XE=getUserModuleNames().filter(uN=>uN.includes(Mg)),cN=XE.flatMap(uN=>{try{const gN=fetchModule$2(uN);return gN?gN.getAgentNames().filter(mN=>gN.getAgent(mN)?.isPublic()??!1).map(mN=>`${uN}/${mN}`):[]}catch(gN){return console.warn(`Failed to fetch module ${uN} for public agents:`,gN),[]}});console.log(`[LOCAL] Found ${XE.length} modules:`,XE),console.log(`[LOCAL] Found ${cN.length} public agents:`,cN);const pN=XE.flatMap(uN=>fetchModule$2(uN).getEntityNames().map(gN=>`${uN}/${gN}`)),hN=XE.flatMap(uN=>buildGraph(uN).getRoots().map(mN=>`${mN.entity.getModuleName()}/${mN.entity.getEntryName()}`)),lN={Name:ly,Description:JE.description||"An application generated from "+ly},rA=await loadUISchema(ly,Mm,pN,hN,cN,lN);rA.appInfo||(rA.appInfo={}),rA.appInfo.apiUrl="http://localhost:8080",Gl(rA);const dN={githubOrg:uy,teamName:ly,branch:GE,projectPath:Mm};return __vitePreload(()=>import("./replService-db2RHQxf.js"),__vite__mapDeps([33,1,18,19,5,9,11,16,14,15,10,20,21,17,4])).then(async({default:uN})=>{try{await uN.ensureReplSession(dN),await uN.initializeFileTracking(Mm)}catch(gN){console.error("❌ Failed to setup REPL deployment:",gN)}}),XE[0]},[su,Kl,La,Gl,zl,Wl]),$m=reactExports.useCallback(async Mm=>{ma(!0),hl("");try{au();const{GitHubOrg:Mg,GitHubRepo:ly,Name:uy,Branch:GE}=Mm,YE=`/${ly}`,JE=generateGitHubUrl(Mg,ly,su,Kl);await pathExists(YE)?La("Repository already exists. Loading modules..."):(La("Cloning repository..."),await cloneRepository(JE,YE,GE,Kl)),await ou(YE,ly,uy,Mg,GE)}catch(Mg){const ly=Mg instanceof Error?Mg.message:"Failed to clone repository";hl(ly),console.error("Error during repository clone:",Mg);try{const uy=`/${Mm.GitHubRepo}`;await pathExists(uy)&&(console.log(`Cleaning up failed clone: removing ${uy} from IndexedDB`),await removeDirectory(uy))}catch(uy){console.error("Error cleaning up failed clone:",uy)}}finally{ma(!1)}},[au,su,Kl,ou]),Nm=reactExports.useCallback((Mm,Mg,ly,uy,GE)=>{const YE=`/design/${Mm?"agents":"data-model"}/${Mg}/${ly}/${uy}`;GE?pa(YE,GE):pa(YE)},[pa]);return{isCloning:ha,error:Ba,loadingMessage:ja,cloneAndProcess:$m,navigateToDesign:Nm,processRepository:ou}},CLI_URL="http://localhost:4000";async function fetchFileTree(){const pa=await fetch(`${CLI_URL}/files`);if(!pa.ok)throw new Error("Failed to fetch file tree");return pa.json()}async function fetchFileContent(pa){const ha=await fetch(`${CLI_URL}/file?path=${encodeURIComponent(pa)}`);if(!ha.ok)throw new Error(`Failed to fetch file: ${pa}`);const{content:ma}=await ha.json();return ma}async function fetchPackageInfo(){const pa=await fetch(`${CLI_URL}/info`);return pa.ok?pa.json():{}}async function fetchDependencyTree(pa){const ha=await fetch(`${CLI_URL}/files?path=${encodeURIComponent(`node_modules/${pa}`)}`);if(ha.status===404)return[];if(!ha.ok)throw new Error(`Failed to fetch dependency tree for ${pa}`);return ha.json()}async function fetchDependencyFileContent(pa){const ha=await fetch(`${CLI_URL}/file?path=${encodeURIComponent(pa)}`);if(!ha.ok)throw new Error(`Failed to fetch file: ${pa}`);const{content:ma}=await ha.json();return ma}async function ensurePackageJson(pa,ha,ma,ja){if(ha.some(Gl=>Gl.type==="file"&&Gl.path==="package.json"))return;const Ba=`node_modules/${pa}/package.json`,hl=await fetchDependencyFileContent(Ba);await ja.writeFile(`${ma}/package.json`,hl)}async function verifyPackageJson(pa,ha,ma){const ja=`${pa}/package.json`;if(!await ma.exists(ja))try{await ma.readFile(ja)}catch{throw new Error(`package.json not found for ${ha} at ${ja}`)}}async function writeDependencyTree(pa,ha,ma,ja){await ja.writeFileSystemFromTree(ha,ma,async La=>{const Ba=`node_modules/${pa}/${La}`;return await fetchDependencyFileContent(Ba)})}async function processDependency(pa,ha,ma,ja,La,Ba){const hl=`${ha}/${pa.appName}`;try{ja&&La!==void 0&&Ba!==void 0&&ja(`Fetching ${pa.appName}...`,La+1,Ba);const Gl=await fetchDependencyTree(pa.appName);if(Gl.length===0)return{appName:pa.appName,success:!1,message:"Dependency not found on local server"};try{await ma.mkdir(hl)}catch(zl){if(zl.code!=="EEXIST")throw zl}return await ensurePackageJson(pa.appName,Gl,hl,ma),await writeDependencyTree(pa.appName,Gl,hl,ma),await verifyPackageJson(hl,pa.appName,ma),{appName:pa.appName,success:!0,message:"Successfully fetched from local server",path:hl}}catch(Gl){return{appName:pa.appName,success:!1,message:Gl.message||"Failed to fetch dependency",error:Gl}}}async function fetchDependenciesFromLocalServer(pa,ha,ma){const ja=await getFS(),La=`${pa}/node_modules`;try{await ja.mkdir(La)}catch(zl){return console.error(`Failed to create node_modules: ${zl.message}`),ha.map(Wl=>({appName:Wl.appName,success:!1,message:"Could not create node_modules directory",error:zl}))}const Ba=await Promise.all(ha.map((zl,Wl)=>processDependency(zl,La,ja,ma,Wl,ha.length))),hl=Ba.filter(zl=>zl.success),Gl=Ba.filter(zl=>!zl.success);return hl.length>0&&console.log(`✓ Fetched ${hl.length} dependencies:`,hl.map(zl=>zl.appName).join(", ")),Gl.length>0&&console.warn(`⚠ Failed to fetch ${Gl.length} dependencies:`,Gl.map(zl=>zl.appName).join(", ")),Ba}function parsePackageName(pa){if(!pa?.name)return{org:"file",name:""};const ha=pa.name;if(ha.startsWith("@")){const ma=ha.substring(1).split("/");if(ma.length===2)return{org:ma[0],name:ma[1]}}return{org:"file",name:ha}}function isDesignPage(pa){return pa?["data-model","marketplace-data-model","agents","workflow","security","ui","settings"].includes(pa):!1}const useServeMode=()=>{const pa=useNavigate(),ha=useMatches(),{processRepository:ma}=useRepositoryClone(),[ja,La]=reactExports.useState(""),[Ba,hl]=reactExports.useState(null);return{initializeServeMode:reactExports.useCallback(async()=>{La("Connecting to local server..."),hl(null);try{const[zl,Wl]=await Promise.all([fetchFileTree(),fetchPackageInfo()]),{org:Kl,name:su}=parsePackageName(Wl),au=`/${su}`;La("Loading file system..."),await(await getFS()).writeFileSystemFromTree(zl,au,fetchFileContent),La("Processing project...");const $m=await ma(au,su,su,Kl,"main"),Nm=ha[ha.length-1];if(isDesignPage(Nm?.id))return;const Mm=`/design/agents/${Kl}/${su}`;pa($m?`${Mm}/${$m}`:Mm)}catch(zl){const Wl=zl instanceof Error?zl.message:"An unknown error occurred";hl(Wl),console.error("Failed to initialize serve mode:",zl)}finally{La("")}},[ma,pa,ha]),loadingMessage:ja,error:Ba}},validationScehma=create$3().shape({email:create$6().email("Invalid email").required("Email is required"),password:create$6().required("Password is required")}),SignIn=()=>{const{login:pa}=useAuth(),ha=useNavigate();return reactExports.useEffect(()=>{{ha("/design/dashboard");return}},[ha]),jsxRuntimeExports.jsx(Formik,{initialValues:{email:"",password:""},validationSchema:validationScehma,onSubmit:ma=>{const{email:ja,password:La}=ma;pa(ja,La)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Sign In"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Get started with building your team of AI Agents"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx("div",{className:"auth-link text-right",onClick:()=>ha("/forgot-password"),children:"Forgot password?"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Sign in"}),jsxRuntimeExports.jsxs("p",{className:"flex justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"No account ?"}),jsxRuntimeExports.jsx(Link,{className:"auth-link font-bold",to:"/signup",children:"Sign Up"})]})]})})},uppercaseRegex=/[A-Z]/,lowercaseRegex=/[a-z]/,numberRegex=/[0-9]/,specialCharRegex=/[!@#$%^&*(),.?":{}|<>]/,validationSchema$e=create$3().shape({firstName:create$6().required("First Name is required").min(2,"First Name must be at least 2 characters").max(50,"First Name must be less than 50 characters"),lastName:create$6().required("Last Name is required").min(2,"Last Name must be at least 2 characters").max(50,"Last Name must be less than 50 characters"),email:create$6().required("Email is required").email("Invalid email address"),password:create$6().required("Password is required").min(8,"Password must be at least 8 characters").matches(uppercaseRegex,"Password must contain at least one uppercase letter").matches(lowercaseRegex,"Password must contain at least one lowercase letter").matches(numberRegex,"Password must contain at least one number").matches(specialCharRegex,"Password must contain at least one special character"),confirmPassword:create$6().required("Confirm Password is required").oneOf([create$9("password")],"Passwords don't match")}),SignUp=()=>{const pa=useNavigate(),{signUp:ha,isSigningUp:ma}=useSignUp(),[ja,La]=reactExports.useState(null);return jsxRuntimeExports.jsx(Formik,{initialValues:{firstName:"",lastName:"",email:"",password:"",confirmPassword:""},validationSchema:validationSchema$e,onSubmit:async(Ba,{setSubmitting:hl})=>{La(null);try{const Gl=await ha({firstName:Ba.firstName,lastName:Ba.lastName,email:Ba.email,password:Ba.password});!Gl.success&&Gl.error&&La(Gl.error)}catch{La("An unexpected error occurred. Please try again.")}finally{hl(!1)}},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Sign Up"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Get started with building your team of AI Agents"})]}),jsxRuntimeExports.jsxs("div",{className:"md:grid flex flex-col md:grid-cols-2 gap-2",children:[jsxRuntimeExports.jsx(aQ,{name:"firstName",placeholder:"First Name"}),jsxRuntimeExports.jsx(aQ,{name:"lastName",placeholder:"Last Name"}),jsxRuntimeExports.jsx("div",{className:"col-span-2",children:jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"})}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx(uQ,{name:"confirmPassword",placeholder:"Confirm Password"})]}),ja&&jsxRuntimeExports.jsx("div",{className:"text-red-500 text-sm text-center p-2",children:ja}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",disabled:ma,children:ma?"Creating Account...":"Create Account"}),jsxRuntimeExports.jsxs("p",{className:"flex justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already have an account ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})},validationSchema$d=create$3().shape({email:create$6().required("Email is required").email("Invalid email address")}),ForgotPassword=()=>{const pa=useNavigate();return jsxRuntimeExports.jsx(Formik,{initialValues:{email:""},validationSchema:validationSchema$d,onSubmit:ha=>{const{email:ma}=ha;console.log(ma)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Reset Password"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Send confirmation code to your email"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Send confirmation code"}),jsxRuntimeExports.jsxs("p",{className:"flex flex-col md:flex-row justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already recovered your password ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})},numberOnlyRegex=/^[0-9]+$/,validationSchema$c=create$3().shape({email:create$6().required("Email is required").email("Invalid email address"),password:create$6().required("Password is required"),code:create$6().matches(numberOnlyRegex,"Code must contain only numbers")}),RecoverPassword=()=>{const pa=useNavigate();return jsxRuntimeExports.jsx(Formik,{validationSchema:validationSchema$c,initialValues:{email:"",password:"",code:""},onSubmit:ha=>{const{email:ma,password:ja,code:La}=ha;console.log(ma,ja,La)},children:jsxRuntimeExports.jsxs(Form$6,{className:"auth-input-container",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntimeExports.jsx("h1",{className:"text-center",children:"Reset Password"}),jsxRuntimeExports.jsx("p",{className:"text-center",children:"Set new password"})]}),jsxRuntimeExports.jsx(aQ,{name:"email",placeholder:"Email",type:"email"}),jsxRuntimeExports.jsx(uQ,{name:"password",placeholder:"Password"}),jsxRuntimeExports.jsx(uQ,{name:"code",placeholder:"Code"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"submit-button",children:"Set new password"}),jsxRuntimeExports.jsxs("p",{className:"flex flex-col md:flex-row justify-center items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"Already recovered your password ?"}),jsxRuntimeExports.jsx("span",{className:"auth-link font-bold",onClick:()=>pa("/"),children:"Sign In"})]})]})})};var classnames={exports:{}};/*!
|
|
18044
18044
|
Copyright (c) 2018 Jed Watson.
|
|
18045
18045
|
Licensed under the MIT License (MIT), see
|
|
18046
18046
|
http://jedwatson.github.io/classnames
|