UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

395 lines 1.65 MB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/JsonSchemaForm-BRm6fUTZ.js","assets/TextareaWidget-CZG2muYB.js","assets/index-BK2vhgNc.js"])))=>i.map(i=>d[i]);
var LX=Object.defineProperty;var Y3=e=>{throw TypeError(e)};var FX=(e,t,n)=>t in e?LX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>FX(e,typeof t!="symbol"?t+"":t,n),O2=(e,t,n)=>t.has(e)||Y3("Cannot "+n);var G=(e,t,n)=>(O2(e,t,"read from private field"),n?n.call(e):t.get(e)),Fe=(e,t,n)=>t.has(e)?Y3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Be=(e,t,n,r)=>(O2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),it=(e,t,n)=>(O2(e,t,"access private method"),n);var J3=(e,t,n,r)=>({set _(s){Be(e,t,s,n)},get _(){return G(e,t,r)}});function BX(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var _Pe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ki(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var j2={exports:{}},pm={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var X3;function zX(){if(X3)return pm;X3=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var a in s)a!=="key"&&(i[a]=s[a])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:o,ref:s!==void 0?s:null,props:i}}return pm.Fragment=t,pm.jsx=n,pm.jsxs=n,pm}var K3;function VX(){return K3||(K3=1,j2.exports=zX()),j2.exports}var p=VX(),A2={exports:{}},mt={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Q3;function UX(){if(Q3)return mt;Q3=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.iterator;function m(k){return k===null||typeof k!="object"?null:(k=h&&k[h]||k["@@iterator"],typeof k=="function"?k:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,x={};function E(k,W,X){this.props=k,this.context=W,this.refs=x,this.updater=X||y}E.prototype.isReactComponent={},E.prototype.setState=function(k,W){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,W,"setState")},E.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function N(){}N.prototype=E.prototype;function _(k,W,X){this.props=k,this.context=W,this.refs=x,this.updater=X||y}var C=_.prototype=new N;C.constructor=_,v(C,E.prototype),C.isPureReactComponent=!0;var j=Array.isArray,A={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function R(k,W,X,ne,re,se){return X=se.ref,{$$typeof:e,type:k,key:W,ref:X!==void 0?X:null,props:se}}function M(k,W){return R(k.type,W,void 0,void 0,void 0,k.props)}function D(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function P(k){var W={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(X){return W[X]})}var F=/\/+/g;function V(k,W){return typeof k=="object"&&k!==null&&k.key!=null?P(""+k.key):W.toString(36)}function H(){}function I(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(H,H):(k.status="pending",k.then(function(W){k.status==="pending"&&(k.status="fulfilled",k.value=W)},function(W){k.status==="pending"&&(k.status="rejected",k.reason=W)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function B(k,W,X,ne,re){var se=typeof k;(se==="undefined"||se==="boolean")&&(k=null);var fe=!1;if(k===null)fe=!0;else switch(se){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(k.$$typeof){case e:case t:fe=!0;break;case f:return fe=k._init,B(fe(k._payload),W,X,ne,re)}}if(fe)return re=re(k),fe=ne===""?"."+V(k,0):ne,j(re)?(X="",fe!=null&&(X=fe.replace(F,"$&/")+"/"),B(re,W,X,"",function(ve){return ve})):re!=null&&(D(re)&&(re=M(re,X+(re.key==null||k&&k.key===re.key?"":(""+re.key).replace(F,"$&/")+"/")+fe)),W.push(re)),1;fe=0;var he=ne===""?".":ne+":";if(j(k))for(var ue=0;ue<k.length;ue++)ne=k[ue],se=he+V(ne,ue),fe+=B(ne,W,X,se,re);else if(ue=m(k),typeof ue=="function")for(k=ue.call(k),ue=0;!(ne=k.next()).done;)ne=ne.value,se=he+V(ne,ue++),fe+=B(ne,W,X,se,re);else if(se==="object"){if(typeof k.then=="function")return B(I(k),W,X,ne,re);throw W=String(k),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return fe}function T(k,W,X){if(k==null)return k;var ne=[],re=0;return B(k,ne,"","",function(se){return W.call(X,se,re++)}),ne}function L(k){if(k._status===-1){var W=k._result;W=W(),W.then(function(X){(k._status===0||k._status===-1)&&(k._status=1,k._result=X)},function(X){(k._status===0||k._status===-1)&&(k._status=2,k._result=X)}),k._status===-1&&(k._status=0,k._result=W)}if(k._status===1)return k._result.default;throw k._result}var z=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)};function q(){}return mt.Children={map:T,forEach:function(k,W,X){T(k,function(){W.apply(this,arguments)},X)},count:function(k){var W=0;return T(k,function(){W++}),W},toArray:function(k){return T(k,function(W){return W})||[]},only:function(k){if(!D(k))throw Error("React.Children.only expected to receive a single React element child.");return k}},mt.Component=E,mt.Fragment=n,mt.Profiler=s,mt.PureComponent=_,mt.StrictMode=r,mt.Suspense=c,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,mt.act=function(){throw Error("act(...) is not supported in production builds of React.")},mt.cache=function(k){return function(){return k.apply(null,arguments)}},mt.cloneElement=function(k,W,X){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var ne=v({},k.props),re=k.key,se=void 0;if(W!=null)for(fe in W.ref!==void 0&&(se=void 0),W.key!==void 0&&(re=""+W.key),W)!$.call(W,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&W.ref===void 0||(ne[fe]=W[fe]);var fe=arguments.length-2;if(fe===1)ne.children=X;else if(1<fe){for(var he=Array(fe),ue=0;ue<fe;ue++)he[ue]=arguments[ue+2];ne.children=he}return R(k.type,re,void 0,void 0,se,ne)},mt.createContext=function(k){return k={$$typeof:o,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:i,_context:k},k},mt.createElement=function(k,W,X){var ne,re={},se=null;if(W!=null)for(ne in W.key!==void 0&&(se=""+W.key),W)$.call(W,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(re[ne]=W[ne]);var fe=arguments.length-2;if(fe===1)re.children=X;else if(1<fe){for(var he=Array(fe),ue=0;ue<fe;ue++)he[ue]=arguments[ue+2];re.children=he}if(k&&k.defaultProps)for(ne in fe=k.defaultProps,fe)re[ne]===void 0&&(re[ne]=fe[ne]);return R(k,se,void 0,void 0,null,re)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(k){return{$$typeof:a,render:k}},mt.isValidElement=D,mt.lazy=function(k){return{$$typeof:f,_payload:{_status:-1,_result:k},_init:L}},mt.memo=function(k,W){return{$$typeof:u,type:k,compare:W===void 0?null:W}},mt.startTransition=function(k){var W=A.T,X={};A.T=X;try{var ne=k(),re=A.S;re!==null&&re(X,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(q,z)}catch(se){z(se)}finally{A.T=W}},mt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},mt.use=function(k){return A.H.use(k)},mt.useActionState=function(k,W,X){return A.H.useActionState(k,W,X)},mt.useCallback=function(k,W){return A.H.useCallback(k,W)},mt.useContext=function(k){return A.H.useContext(k)},mt.useDebugValue=function(){},mt.useDeferredValue=function(k,W){return A.H.useDeferredValue(k,W)},mt.useEffect=function(k,W){return A.H.useEffect(k,W)},mt.useId=function(){return A.H.useId()},mt.useImperativeHandle=function(k,W,X){return A.H.useImperativeHandle(k,W,X)},mt.useInsertionEffect=function(k,W){return A.H.useInsertionEffect(k,W)},mt.useLayoutEffect=function(k,W){return A.H.useLayoutEffect(k,W)},mt.useMemo=function(k,W){return A.H.useMemo(k,W)},mt.useOptimistic=function(k,W){return A.H.useOptimistic(k,W)},mt.useReducer=function(k,W,X){return A.H.useReducer(k,W,X)},mt.useRef=function(k){return A.H.useRef(k)},mt.useState=function(k){return A.H.useState(k)},mt.useSyncExternalStore=function(k,W,X){return A.H.useSyncExternalStore(k,W,X)},mt.useTransition=function(){return A.H.useTransition()},mt.version="19.0.0",mt}var Z3;function Hh(){return Z3||(Z3=1,A2.exports=UX()),A2.exports}var w=Hh();const Re=Ki(w),t8=BX({__proto__:null,default:Re},[w]);var $2={exports:{}},mm={},T2={exports:{}},R2={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var eM;function qX(){return eM||(eM=1,function(e){function t(T,L){var z=T.length;T.push(L);e:for(;0<z;){var q=z-1>>>1,k=T[q];if(0<s(k,L))T[q]=L,T[z]=k,z=q;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var L=T[0],z=T.pop();if(z!==L){T[0]=z;e:for(var q=0,k=T.length,W=k>>>1;q<W;){var X=2*(q+1)-1,ne=T[X],re=X+1,se=T[re];if(0>s(ne,z))re<k&&0>s(se,ne)?(T[q]=se,T[re]=z,q=re):(T[q]=ne,T[X]=z,q=X);else if(re<k&&0>s(se,z))T[q]=se,T[re]=z,q=re;else break e}}return L}function s(T,L){var z=T.sortIndex-L.sortIndex;return z!==0?z:T.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],f=1,h=null,m=3,y=!1,v=!1,x=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function C(T){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=T)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function j(T){if(x=!1,C(T),!v)if(n(c)!==null)v=!0,I();else{var L=n(u);L!==null&&B(j,L.startTime-T)}}var A=!1,$=-1,R=5,M=-1;function D(){return!(e.unstable_now()-M<R)}function P(){if(A){var T=e.unstable_now();M=T;var L=!0;try{e:{v=!1,x&&(x=!1,N($),$=-1),y=!0;var z=m;try{t:{for(C(T),h=n(c);h!==null&&!(h.expirationTime>T&&D());){var q=h.callback;if(typeof q=="function"){h.callback=null,m=h.priorityLevel;var k=q(h.expirationTime<=T);if(T=e.unstable_now(),typeof k=="function"){h.callback=k,C(T),L=!0;break t}h===n(c)&&r(c),C(T)}else r(c);h=n(c)}if(h!==null)L=!0;else{var W=n(u);W!==null&&B(j,W.startTime-T),L=!1}}break e}finally{h=null,m=z,y=!1}L=void 0}}finally{L?F():A=!1}}}var F;if(typeof _=="function")F=function(){_(P)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,H=V.port2;V.port1.onmessage=P,F=function(){H.postMessage(null)}}else F=function(){E(P,0)};function I(){A||(A=!0,F())}function B(T,L){$=E(function(){T(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_continueExecution=function(){v||y||(v=!0,I())},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(T){switch(m){case 1:case 2:case 3:var L=3;break;default:L=m}var z=m;m=L;try{return T()}finally{m=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,L){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var z=m;m=T;try{return L()}finally{m=z}},e.unstable_scheduleCallback=function(T,L,z){var q=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?q+z:q):z=q,T){case 1:var k=-1;break;case 2:k=250;break;case 5:k=1073741823;break;case 4:k=1e4;break;default:k=5e3}return k=z+k,T={id:f++,callback:L,priorityLevel:T,startTime:z,expirationTime:k,sortIndex:-1},z>q?(T.sortIndex=z,t(u,T),n(c)===null&&T===n(u)&&(x?(N($),$=-1):x=!0,B(j,z-q))):(T.sortIndex=k,t(c,T),v||y||(v=!0,I())),T},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(T){var L=m;return function(){var z=m;m=L;try{return T.apply(this,arguments)}finally{m=z}}}}(R2)),R2}var tM;function HX(){return tM||(tM=1,T2.exports=qX()),T2.exports}var M2={exports:{}},gr={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var nM;function WX(){if(nM)return gr;nM=1;var e=Hh();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)u+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function i(c,u,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:h==null?null:""+h,children:c,containerInfo:u,implementation:f}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,gr.createPortal=function(c,u){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return i(c,u,null,f)},gr.flushSync=function(c){var u=o.T,f=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=u,r.p=f,r.d.f()}},gr.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},gr.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},gr.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var f=u.as,h=a(f,u.crossOrigin),m=typeof u.integrity=="string"?u.integrity:void 0,y=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;f==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:h,integrity:m,fetchPriority:y}):f==="script"&&r.d.X(c,{crossOrigin:h,integrity:m,fetchPriority:y,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},gr.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var f=a(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},gr.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var f=u.as,h=a(f,u.crossOrigin);r.d.L(c,f,{crossOrigin:h,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},gr.preloadModule=function(c,u){if(typeof c=="string")if(u){var f=a(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},gr.requestFormReset=function(c){r.d.r(c)},gr.unstable_batchedUpdates=function(c,u){return c(u)},gr.useFormState=function(c,u,f){return o.H.useFormState(c,u,f)},gr.useFormStatus=function(){return o.H.useHostTransitionStatus()},gr.version="19.0.0",gr}var rM;function n8(){if(rM)return M2.exports;rM=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),M2.exports=WX(),M2.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var sM;function GX(){if(sM)return mm;sM=1;var e=HX(),t=Hh(),n=n8();function r(l){var d="https://react.dev/errors/"+l;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+l+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}var i=Symbol.for("react.element"),o=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),m=Symbol.for("react.consumer"),y=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),j=Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function $(l){return l===null||typeof l!="object"?null:(l=A&&l[A]||l["@@iterator"],typeof l=="function"?l:null)}var R=Symbol.for("react.client.reference");function M(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===R?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case c:return"Fragment";case a:return"Portal";case f:return"Profiler";case u:return"StrictMode";case x:return"Suspense";case E:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case y:return(l.displayName||"Context")+".Provider";case m:return(l._context.displayName||"Context")+".Consumer";case v:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case N:return d=l.displayName||null,d!==null?d:M(l.type)||"Memo";case _:d=l._payload,l=l._init;try{return M(l(d))}catch{}}return null}var D=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.assign,F,V;function H(l){if(F===void 0)try{throw Error()}catch(g){var d=g.stack.trim().match(/\n( *(at )?)/);F=d&&d[1]||"",V=-1<g.stack.indexOf(`
    at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
`+F+l+V}var I=!1;function B(l,d){if(!l||I)return"";I=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(d){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(we){var ge=we}Reflect.construct(l,[],je)}else{try{je.call()}catch(we){ge=we}l.call(je.prototype)}}else{try{throw Error()}catch(we){ge=we}(je=l())&&typeof je.catch=="function"&&je.catch(function(){})}}catch(we){if(we&&ge&&typeof we.stack=="string")return[we.stack,ge.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var S=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");S&&S.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=b.DetermineComponentFrameRoot(),U=O[0],Y=O[1];if(U&&Y){var Z=U.split(`
`),le=Y.split(`
`);for(S=b=0;b<Z.length&&!Z[b].includes("DetermineComponentFrameRoot");)b++;for(;S<le.length&&!le[S].includes("DetermineComponentFrameRoot");)S++;if(b===Z.length||S===le.length)for(b=Z.length-1,S=le.length-1;1<=b&&0<=S&&Z[b]!==le[S];)S--;for(;1<=b&&0<=S;b--,S--)if(Z[b]!==le[S]){if(b!==1||S!==1)do if(b--,S--,0>S||Z[b]!==le[S]){var Ee=`
`+Z[b].replace(" at new "," at ");return l.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",l.displayName)),Ee}while(1<=b&&0<=S);break}}}finally{I=!1,Error.prepareStackTrace=g}return(g=l?l.displayName||l.name:"")?H(g):""}function T(l){switch(l.tag){case 26:case 27:case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 15:return l=B(l.type,!1),l;case 11:return l=B(l.type.render,!1),l;case 1:return l=B(l.type,!0),l;default:return""}}function L(l){try{var d="";do d+=T(l),l=l.return;while(l);return d}catch(g){return`
Error generating stack: `+g.message+`
`+g.stack}}function z(l){var d=l,g=l;if(l.alternate)for(;d.return;)d=d.return;else{l=d;do d=l,(d.flags&4098)!==0&&(g=d.return),l=d.return;while(l)}return d.tag===3?g:null}function q(l){if(l.tag===13){var d=l.memoizedState;if(d===null&&(l=l.alternate,l!==null&&(d=l.memoizedState)),d!==null)return d.dehydrated}return null}function k(l){if(z(l)!==l)throw Error(r(188))}function W(l){var d=l.alternate;if(!d){if(d=z(l),d===null)throw Error(r(188));return d!==l?null:l}for(var g=l,b=d;;){var S=g.return;if(S===null)break;var O=S.alternate;if(O===null){if(b=S.return,b!==null){g=b;continue}break}if(S.child===O.child){for(O=S.child;O;){if(O===g)return k(S),l;if(O===b)return k(S),d;O=O.sibling}throw Error(r(188))}if(g.return!==b.return)g=S,b=O;else{for(var U=!1,Y=S.child;Y;){if(Y===g){U=!0,g=S,b=O;break}if(Y===b){U=!0,b=S,g=O;break}Y=Y.sibling}if(!U){for(Y=O.child;Y;){if(Y===g){U=!0,g=O,b=S;break}if(Y===b){U=!0,b=O,g=S;break}Y=Y.sibling}if(!U)throw Error(r(189))}}if(g.alternate!==b)throw Error(r(190))}if(g.tag!==3)throw Error(r(188));return g.stateNode.current===g?l:d}function X(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l;for(l=l.child;l!==null;){if(d=X(l),d!==null)return d;l=l.sibling}return null}var ne=Array.isArray,re=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},fe=[],he=-1;function ue(l){return{current:l}}function ve(l){0>he||(l.current=fe[he],fe[he]=null,he--)}function Se(l,d){he++,fe[he]=l.current,l.current=d}var ke=ue(null),Oe=ue(null),Ce=ue(null),Me=ue(null);function Ve(l,d){switch(Se(Ce,d),Se(Oe,l),Se(ke,null),l=d.nodeType,l){case 9:case 11:d=(d=d.documentElement)&&(d=d.namespaceURI)?E3(d):0;break;default:if(l=l===8?d.parentNode:d,d=l.tagName,l=l.namespaceURI)l=E3(l),d=N3(l,d);else switch(d){case"svg":d=1;break;case"math":d=2;break;default:d=0}}ve(ke),Se(ke,d)}function We(){ve(ke),ve(Oe),ve(Ce)}function $e(l){l.memoizedState!==null&&Se(Me,l);var d=ke.current,g=N3(d,l.type);d!==g&&(Se(Oe,l),Se(ke,g))}function J(l){Oe.current===l&&(ve(ke),ve(Oe)),Me.current===l&&(ve(Me),cm._currentValue=se)}var te=Object.prototype.hasOwnProperty,Q=e.unstable_scheduleCallback,ye=e.unstable_cancelCallback,ce=e.unstable_shouldYield,ae=e.unstable_requestPaint,ie=e.unstable_now,de=e.unstable_getCurrentPriorityLevel,be=e.unstable_ImmediatePriority,Ae=e.unstable_UserBlockingPriority,Ie=e.unstable_NormalPriority,ht=e.unstable_LowPriority,Vt=e.unstable_IdlePriority,_t=e.log,no=e.unstable_setDisableYieldValue,Ut=null,Bt=null;function Rs(l){if(Bt&&typeof Bt.onCommitFiberRoot=="function")try{Bt.onCommitFiberRoot(Ut,l,void 0,(l.current.flags&128)===128)}catch{}}function Ms(l){if(typeof _t=="function"&&no(l),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(Ut,l)}catch{}}var Gn=Math.clz32?Math.clz32:vp,zc=Math.log,Od=Math.LN2;function vp(l){return l>>>=0,l===0?32:31-(zc(l)/Od|0)|0}var Fo=128,nl=4194304;function Yn(l){var d=l&42;if(d!==0)return d;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Bo(l,d){var g=l.pendingLanes;if(g===0)return 0;var b=0,S=l.suspendedLanes,O=l.pingedLanes,U=l.warmLanes;l=l.finishedLanes!==0;var Y=g&134217727;return Y!==0?(g=Y&~S,g!==0?b=Yn(g):(O&=Y,O!==0?b=Yn(O):l||(U=Y&~U,U!==0&&(b=Yn(U))))):(Y=g&~S,Y!==0?b=Yn(Y):O!==0?b=Yn(O):l||(U=g&~U,U!==0&&(b=Yn(U)))),b===0?0:d!==0&&d!==b&&(d&S)===0&&(S=b&-b,U=d&-d,S>=U||S===32&&(U&4194176)!==0)?d:b}function rl(l,d){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&d)===0}function xp(l,d){switch(l){case 1:case 2:case 4:case 8:return d+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jd(){var l=Fo;return Fo<<=1,(Fo&4194176)===0&&(Fo=128),l}function dn(){var l=nl;return nl<<=1,(nl&62914560)===0&&(nl=4194304),l}function cs(l){for(var d=[],g=0;31>g;g++)d.push(l);return d}function Er(l,d){l.pendingLanes|=d,d!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function ro(l,d,g,b,S,O){var U=l.pendingLanes;l.pendingLanes=g,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=g,l.entangledLanes&=g,l.errorRecoveryDisabledLanes&=g,l.shellSuspendCounter=0;var Y=l.entanglements,Z=l.expirationTimes,le=l.hiddenUpdates;for(g=U&~g;0<g;){var Ee=31-Gn(g),je=1<<Ee;Y[Ee]=0,Z[Ee]=-1;var ge=le[Ee];if(ge!==null)for(le[Ee]=null,Ee=0;Ee<ge.length;Ee++){var we=ge[Ee];we!==null&&(we.lane&=-536870913)}g&=~je}b!==0&&sl(l,b,0),O!==0&&S===0&&l.tag!==0&&(l.suspendedLanes|=O&~(U&~d))}function sl(l,d,g){l.pendingLanes|=d,l.suspendedLanes&=~d;var b=31-Gn(d);l.entangledLanes|=d,l.entanglements[b]=l.entanglements[b]|1073741824|g&4194218}function Vc(l,d){var g=l.entangledLanes|=d;for(l=l.entanglements;g;){var b=31-Gn(g),S=1<<b;S&d|l[b]&d&&(l[b]|=d),g&=~S}}function Uc(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function qc(){var l=re.p;return l!==0?l:(l=window.event,l===void 0?32:V3(l.type))}function wp(l,d){var g=re.p;try{return re.p=l,d()}finally{re.p=g}}var ks=Math.random().toString(36).slice(2),Tn="__reactFiber$"+ks,Jn="__reactProps$"+ks,dt="__reactContainer$"+ks,Xn="__reactEvents$"+ks,Is="__reactListeners$"+ks,u0="__reactHandles$"+ks,d0="__reactResources$"+ks,Hc="__reactMarker$"+ks;function Sp(l){delete l[Tn],delete l[Jn],delete l[Xn],delete l[Is],delete l[u0]}function zo(l){var d=l[Tn];if(d)return d;for(var g=l.parentNode;g;){if(d=g[dt]||g[Tn]){if(g=d.alternate,d.child!==null||g!==null&&g.child!==null)for(l=O3(l);l!==null;){if(g=l[Tn])return g;l=O3(l)}return d}l=g,g=l.parentNode}return null}function il(l){if(l=l[Tn]||l[dt]){var d=l.tag;if(d===5||d===6||d===13||d===26||d===27||d===3)return l}return null}function ol(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l.stateNode;throw Error(r(33))}function al(l){var d=l[d0];return d||(d=l[d0]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function Rn(l){l[Hc]=!0}var f0=new Set,h0={};function Vo(l,d){ll(l,d),ll(l+"Capture",d)}function ll(l,d){for(h0[l]=d,l=0;l<d.length;l++)f0.add(d[l])}var vi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),m0={},g0={};function SS(l){return te.call(g0,l)?!0:te.call(m0,l)?!1:p0.test(l)?g0[l]=!0:(m0[l]=!0,!1)}function Ad(l,d,g){if(SS(d))if(g===null)l.removeAttribute(d);else{switch(typeof g){case"undefined":case"function":case"symbol":l.removeAttribute(d);return;case"boolean":var b=d.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){l.removeAttribute(d);return}}l.setAttribute(d,""+g)}}function $d(l,d,g){if(g===null)l.removeAttribute(d);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(d);return}l.setAttribute(d,""+g)}}function xi(l,d,g,b){if(b===null)l.removeAttribute(g);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(g);return}l.setAttributeNS(d,g,""+b)}}function Wr(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Wc(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ES(l){var d=Wc(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),b=""+l[d];if(!l.hasOwnProperty(d)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var S=g.get,O=g.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return S.call(this)},set:function(U){b=""+U,O.call(this,U)}}),Object.defineProperty(l,d,{enumerable:g.enumerable}),{getValue:function(){return b},setValue:function(U){b=""+U},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Td(l){l._valueTracker||(l._valueTracker=ES(l))}function Rd(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var g=d.getValue(),b="";return l&&(b=Wc(l)?l.checked?"true":"false":l.value),l=b,l!==g?(d.setValue(l),!0):!1}function Md(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var NS=/[\n"\\]/g;function Nr(l){return l.replace(NS,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function _S(l,d,g,b,S,O,U,Y){l.name="",U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?l.type=U:l.removeAttribute("type"),d!=null?U==="number"?(d===0&&l.value===""||l.value!=d)&&(l.value=""+Wr(d)):l.value!==""+Wr(d)&&(l.value=""+Wr(d)):U!=="submit"&&U!=="reset"||l.removeAttribute("value"),d!=null?CS(l,U,Wr(d)):g!=null?CS(l,U,Wr(g)):b!=null&&l.removeAttribute("value"),S==null&&O!=null&&(l.defaultChecked=!!O),S!=null&&(l.checked=S&&typeof S!="function"&&typeof S!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?l.name=""+Wr(Y):l.removeAttribute("name")}function j5(l,d,g,b,S,O,U,Y){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(l.type=O),d!=null||g!=null){if(!(O!=="submit"&&O!=="reset"||d!=null))return;g=g!=null?""+Wr(g):"",d=d!=null?""+Wr(d):g,Y||d===l.value||(l.value=d),l.defaultValue=d}b=b??S,b=typeof b!="function"&&typeof b!="symbol"&&!!b,l.checked=Y?l.checked:!!b,l.defaultChecked=!!b,U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"&&(l.name=U)}function CS(l,d,g){d==="number"&&Md(l.ownerDocument)===l||l.defaultValue===""+g||(l.defaultValue=""+g)}function kd(l,d,g,b){if(l=l.options,d){d={};for(var S=0;S<g.length;S++)d["$"+g[S]]=!0;for(g=0;g<l.length;g++)S=d.hasOwnProperty("$"+l[g].value),l[g].selected!==S&&(l[g].selected=S),S&&b&&(l[g].defaultSelected=!0)}else{for(g=""+Wr(g),d=null,S=0;S<l.length;S++){if(l[S].value===g){l[S].selected=!0,b&&(l[S].defaultSelected=!0);return}d!==null||l[S].disabled||(d=l[S])}d!==null&&(d.selected=!0)}}function A5(l,d,g){if(d!=null&&(d=""+Wr(d),d!==l.value&&(l.value=d),g==null)){l.defaultValue!==d&&(l.defaultValue=d);return}l.defaultValue=g!=null?""+Wr(g):""}function $5(l,d,g,b){if(d==null){if(b!=null){if(g!=null)throw Error(r(92));if(ne(b)){if(1<b.length)throw Error(r(93));b=b[0]}g=b}g==null&&(g=""),d=g}g=Wr(d),l.defaultValue=g,b=l.textContent,b===g&&b!==""&&b!==null&&(l.value=b)}function Id(l,d){if(d){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=d;return}}l.textContent=d}var IY=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function T5(l,d,g){var b=d.indexOf("--")===0;g==null||typeof g=="boolean"||g===""?b?l.setProperty(d,""):d==="float"?l.cssFloat="":l[d]="":b?l.setProperty(d,g):typeof g!="number"||g===0||IY.has(d)?d==="float"?l.cssFloat=g:l[d]=(""+g).trim():l[d]=g+"px"}function R5(l,d,g){if(d!=null&&typeof d!="object")throw Error(r(62));if(l=l.style,g!=null){for(var b in g)!g.hasOwnProperty(b)||d!=null&&d.hasOwnProperty(b)||(b.indexOf("--")===0?l.setProperty(b,""):b==="float"?l.cssFloat="":l[b]="");for(var S in d)b=d[S],d.hasOwnProperty(S)&&g[S]!==b&&T5(l,S,b)}else for(var O in d)d.hasOwnProperty(O)&&T5(l,O,d[O])}function OS(l){if(l.indexOf("-")===-1)return!1;switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var DY=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),PY=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function y0(l){return PY.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}var jS=null;function AS(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Dd=null,Pd=null;function M5(l){var d=il(l);if(d&&(l=d.stateNode)){var g=l[Jn]||null;e:switch(l=d.stateNode,d.type){case"input":if(_S(l,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name),d=g.name,g.type==="radio"&&d!=null){for(g=l;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll('input[name="'+Nr(""+d)+'"][type="radio"]'),d=0;d<g.length;d++){var b=g[d];if(b!==l&&b.form===l.form){var S=b[Jn]||null;if(!S)throw Error(r(90));_S(b,S.value,S.defaultValue,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name)}}for(d=0;d<g.length;d++)b=g[d],b.form===l.form&&Rd(b)}break e;case"textarea":A5(l,g.value,g.defaultValue);break e;case"select":d=g.value,d!=null&&kd(l,!!g.multiple,d,!1)}}}var $S=!1;function k5(l,d,g){if($S)return l(d,g);$S=!0;try{var b=l(d);return b}finally{if($S=!1,(Dd!==null||Pd!==null)&&(eb(),Dd&&(d=Dd,l=Pd,Pd=Dd=null,M5(d),l)))for(d=0;d<l.length;d++)M5(l[d])}}function Ep(l,d){var g=l.stateNode;if(g===null)return null;var b=g[Jn]||null;if(b===null)return null;g=b[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(l=l.type,b=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!b;break e;default:l=!1}if(l)return null;if(g&&typeof g!="function")throw Error(r(231,d,typeof g));return g}var TS=!1;if(vi)try{var Np={};Object.defineProperty(Np,"passive",{get:function(){TS=!0}}),window.addEventListener("test",Np,Np),window.removeEventListener("test",Np,Np)}catch{TS=!1}var cl=null,RS=null,b0=null;function I5(){if(b0)return b0;var l,d=RS,g=d.length,b,S="value"in cl?cl.value:cl.textContent,O=S.length;for(l=0;l<g&&d[l]===S[l];l++);var U=g-l;for(b=1;b<=U&&d[g-b]===S[O-b];b++);return b0=S.slice(l,1<b?1-b:void 0)}function v0(l){var d=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&d===13&&(l=13)):l=d,l===10&&(l=13),32<=l||l===13?l:0}function x0(){return!0}function D5(){return!1}function Gr(l){function d(g,b,S,O,U){this._reactName=g,this._targetInst=S,this.type=b,this.nativeEvent=O,this.target=U,this.currentTarget=null;for(var Y in l)l.hasOwnProperty(Y)&&(g=l[Y],this[Y]=g?g(O):O[Y]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?x0:D5,this.isPropagationStopped=D5,this}return P(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=x0)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=x0)},persist:function(){},isPersistent:x0}),d}var Gc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},w0=Gr(Gc),_p=P({},Gc,{view:0,detail:0}),LY=Gr(_p),MS,kS,Cp,S0=P({},_p,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:DS,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Cp&&(Cp&&l.type==="mousemove"?(MS=l.screenX-Cp.screenX,kS=l.screenY-Cp.screenY):kS=MS=0,Cp=l),MS)},movementY:function(l){return"movementY"in l?l.movementY:kS}}),P5=Gr(S0),FY=P({},S0,{dataTransfer:0}),BY=Gr(FY),zY=P({},_p,{relatedTarget:0}),IS=Gr(zY),VY=P({},Gc,{animationName:0,elapsedTime:0,pseudoElement:0}),UY=Gr(VY),qY=P({},Gc,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),HY=Gr(qY),WY=P({},Gc,{data:0}),L5=Gr(WY),GY={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},YY={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},JY={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XY(l){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(l):(l=JY[l])?!!d[l]:!1}function DS(){return XY}var KY=P({},_p,{key:function(l){if(l.key){var d=GY[l.key]||l.key;if(d!=="Unidentified")return d}return l.type==="keypress"?(l=v0(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?YY[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:DS,charCode:function(l){return l.type==="keypress"?v0(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?v0(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),QY=Gr(KY),ZY=P({},S0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),F5=Gr(ZY),eJ=P({},_p,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:DS}),tJ=Gr(eJ),nJ=P({},Gc,{propertyName:0,elapsedTime:0,pseudoElement:0}),rJ=Gr(nJ),sJ=P({},S0,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),iJ=Gr(sJ),oJ=P({},Gc,{newState:0,oldState:0}),aJ=Gr(oJ),lJ=[9,13,27,32],PS=vi&&"CompositionEvent"in window,Op=null;vi&&"documentMode"in document&&(Op=document.documentMode);var cJ=vi&&"TextEvent"in window&&!Op,B5=vi&&(!PS||Op&&8<Op&&11>=Op),z5=" ",V5=!1;function U5(l,d){switch(l){case"keyup":return lJ.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q5(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Ld=!1;function uJ(l,d){switch(l){case"compositionend":return q5(d);case"keypress":return d.which!==32?null:(V5=!0,z5);case"textInput":return l=d.data,l===z5&&V5?null:l;default:return null}}function dJ(l,d){if(Ld)return l==="compositionend"||!PS&&U5(l,d)?(l=I5(),b0=RS=cl=null,Ld=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return B5&&d.locale!=="ko"?null:d.data;default:return null}}var fJ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function H5(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d==="input"?!!fJ[l.type]:d==="textarea"}function W5(l,d,g,b){Dd?Pd?Pd.push(b):Pd=[b]:Dd=b,d=ib(d,"onChange"),0<d.length&&(g=new w0("onChange","change",null,g,b),l.push({event:g,listeners:d}))}var jp=null,Ap=null;function hJ(l){b3(l,0)}function E0(l){var d=ol(l);if(Rd(d))return l}function G5(l,d){if(l==="change")return d}var Y5=!1;if(vi){var LS;if(vi){var FS="oninput"in document;if(!FS){var J5=document.createElement("div");J5.setAttribute("oninput","return;"),FS=typeof J5.oninput=="function"}LS=FS}else LS=!1;Y5=LS&&(!document.documentMode||9<document.documentMode)}function X5(){jp&&(jp.detachEvent("onpropertychange",K5),Ap=jp=null)}function K5(l){if(l.propertyName==="value"&&E0(Ap)){var d=[];W5(d,Ap,l,AS(l)),k5(hJ,d)}}function pJ(l,d,g){l==="focusin"?(X5(),jp=d,Ap=g,jp.attachEvent("onpropertychange",K5)):l==="focusout"&&X5()}function mJ(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return E0(Ap)}function gJ(l,d){if(l==="click")return E0(d)}function yJ(l,d){if(l==="input"||l==="change")return E0(d)}function bJ(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var us=typeof Object.is=="function"?Object.is:bJ;function $p(l,d){if(us(l,d))return!0;if(typeof l!="object"||l===null||typeof d!="object"||d===null)return!1;var g=Object.keys(l),b=Object.keys(d);if(g.length!==b.length)return!1;for(b=0;b<g.length;b++){var S=g[b];if(!te.call(d,S)||!us(l[S],d[S]))return!1}return!0}function Q5(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Z5(l,d){var g=Q5(l);l=0;for(var b;g;){if(g.nodeType===3){if(b=l+g.textContent.length,l<=d&&b>=d)return{node:g,offset:d-l};l=b}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=Q5(g)}}function e4(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?e4(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function t4(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var d=Md(l.document);d instanceof l.HTMLIFrameElement;){try{var g=typeof d.contentWindow.location.href=="string"}catch{g=!1}if(g)l=d.contentWindow;else break;d=Md(l.document)}return d}function BS(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function vJ(l,d){var g=t4(d);d=l.focusedElem;var b=l.selectionRange;if(g!==d&&d&&d.ownerDocument&&e4(d.ownerDocument.documentElement,d)){if(b!==null&&BS(d)){if(l=b.start,g=b.end,g===void 0&&(g=l),"selectionStart"in d)d.selectionStart=l,d.selectionEnd=Math.min(g,d.value.length);else if(g=(l=d.ownerDocument||document)&&l.defaultView||window,g.getSelection){g=g.getSelection();var S=d.textContent.length,O=Math.min(b.start,S);b=b.end===void 0?O:Math.min(b.end,S),!g.extend&&O>b&&(S=b,b=O,O=S),S=Z5(d,O);var U=Z5(d,b);S&&U&&(g.rangeCount!==1||g.anchorNode!==S.node||g.anchorOffset!==S.offset||g.focusNode!==U.node||g.focusOffset!==U.offset)&&(l=l.createRange(),l.setStart(S.node,S.offset),g.removeAllRanges(),O>b?(g.addRange(l),g.extend(U.node,U.offset)):(l.setEnd(U.node,U.offset),g.addRange(l)))}}for(l=[],g=d;g=g.parentNode;)g.nodeType===1&&l.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<l.length;d++)g=l[d],g.element.scrollLeft=g.left,g.element.scrollTop=g.top}}var xJ=vi&&"documentMode"in document&&11>=document.documentMode,Fd=null,zS=null,Tp=null,VS=!1;function n4(l,d,g){var b=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;VS||Fd==null||Fd!==Md(b)||(b=Fd,"selectionStart"in b&&BS(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Tp&&$p(Tp,b)||(Tp=b,b=ib(zS,"onSelect"),0<b.length&&(d=new w0("onSelect","select",null,d,g),l.push({event:d,listeners:b}),d.target=Fd)))}function Yc(l,d){var g={};return g[l.toLowerCase()]=d.toLowerCase(),g["Webkit"+l]="webkit"+d,g["Moz"+l]="moz"+d,g}var Bd={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionrun:Yc("Transition","TransitionRun"),transitionstart:Yc("Transition","TransitionStart"),transitioncancel:Yc("Transition","TransitionCancel"),transitionend:Yc("Transition","TransitionEnd")},US={},r4={};vi&&(r4=document.createElement("div").style,"AnimationEvent"in window||(delete Bd.animationend.animation,delete Bd.animationiteration.animation,delete Bd.animationstart.animation),"TransitionEvent"in window||delete Bd.transitionend.transition);function Jc(l){if(US[l])return US[l];if(!Bd[l])return l;var d=Bd[l],g;for(g in d)if(d.hasOwnProperty(g)&&g in r4)return US[l]=d[g];return l}var s4=Jc("animationend"),i4=Jc("animationiteration"),o4=Jc("animationstart"),wJ=Jc("transitionrun"),SJ=Jc("transitionstart"),EJ=Jc("transitioncancel"),a4=Jc("transitionend"),l4=new Map,c4="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function wi(l,d){l4.set(l,d),Vo(d,[l])}var Ds=[],zd=0,qS=0;function N0(){for(var l=zd,d=qS=zd=0;d<l;){var g=Ds[d];Ds[d++]=null;var b=Ds[d];Ds[d++]=null;var S=Ds[d];Ds[d++]=null;var O=Ds[d];if(Ds[d++]=null,b!==null&&S!==null){var U=b.pending;U===null?S.next=S:(S.next=U.next,U.next=S),b.pending=S}O!==0&&u4(g,S,O)}}function _0(l,d,g,b){Ds[zd++]=l,Ds[zd++]=d,Ds[zd++]=g,Ds[zd++]=b,qS|=b,l.lanes|=b,l=l.alternate,l!==null&&(l.lanes|=b)}function HS(l,d,g,b){return _0(l,d,g,b),C0(l)}function ul(l,d){return _0(l,null,null,d),C0(l)}function u4(l,d,g){l.lanes|=g;var b=l.alternate;b!==null&&(b.lanes|=g);for(var S=!1,O=l.return;O!==null;)O.childLanes|=g,b=O.alternate,b!==null&&(b.childLanes|=g),O.tag===22&&(l=O.stateNode,l===null||l._visibility&1||(S=!0)),l=O,O=O.return;S&&d!==null&&l.tag===3&&(O=l.stateNode,S=31-Gn(g),O=O.hiddenUpdates,l=O[S],l===null?O[S]=[d]:l.push(d),d.lane=g|536870912)}function C0(l){if(50<nm)throw nm=0,KE=null,Error(r(185));for(var d=l.return;d!==null;)l=d,d=l.return;return l.tag===3?l.stateNode:null}var Vd={},d4=new WeakMap;function Ps(l,d){if(typeof l=="object"&&l!==null){var g=d4.get(l);return g!==void 0?g:(d={value:l,source:d,stack:L(d)},d4.set(l,d),d)}return{value:l,source:d,stack:L(d)}}var Ud=[],qd=0,O0=null,j0=0,Ls=[],Fs=0,Xc=null,Uo=1,qo="";function Kc(l,d){Ud[qd++]=j0,Ud[qd++]=O0,O0=l,j0=d}function f4(l,d,g){Ls[Fs++]=Uo,Ls[Fs++]=qo,Ls[Fs++]=Xc,Xc=l;var b=Uo;l=qo;var S=32-Gn(b)-1;b&=~(1<<S),g+=1;var O=32-Gn(d)+S;if(30<O){var U=S-S%5;O=(b&(1<<U)-1).toString(32),b>>=U,S-=U,Uo=1<<32-Gn(d)+S|g<<S|b,qo=O+l}else Uo=1<<O|g<<S|b,qo=l}function WS(l){l.return!==null&&(Kc(l,1),f4(l,1,0))}function GS(l){for(;l===O0;)O0=Ud[--qd],Ud[qd]=null,j0=Ud[--qd],Ud[qd]=null;for(;l===Xc;)Xc=Ls[--Fs],Ls[Fs]=null,qo=Ls[--Fs],Ls[Fs]=null,Uo=Ls[--Fs],Ls[Fs]=null}var _r=null,ar=null,It=!1,Si=null,so=!1,YS=Error(r(519));function Qc(l){var d=Error(r(418,""));throw kp(Ps(d,l)),YS}function h4(l){var d=l.stateNode,g=l.type,b=l.memoizedProps;switch(d[Tn]=l,d[Jn]=b,g){case"dialog":Nt("cancel",d),Nt("close",d);break;case"iframe":case"object":case"embed":Nt("load",d);break;case"video":case"audio":for(g=0;g<sm.length;g++)Nt(sm[g],d);break;case"source":Nt("error",d);break;case"img":case"image":case"link":Nt("error",d),Nt("load",d);break;case"details":Nt("toggle",d);break;case"input":Nt("invalid",d),j5(d,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0),Td(d);break;case"select":Nt("invalid",d);break;case"textarea":Nt("invalid",d),$5(d,b.value,b.defaultValue,b.children),Td(d)}g=b.children,typeof g!="string"&&typeof g!="number"&&typeof g!="bigint"||d.textContent===""+g||b.suppressHydrationWarning===!0||S3(d.textContent,g)?(b.popover!=null&&(Nt("beforetoggle",d),Nt("toggle",d)),b.onScroll!=null&&Nt("scroll",d),b.onScrollEnd!=null&&Nt("scrollend",d),b.onClick!=null&&(d.onclick=ob),d=!0):d=!1,d||Qc(l)}function p4(l){for(_r=l.return;_r;)switch(_r.tag){case 3:case 27:so=!0;return;case 5:case 13:so=!1;return;default:_r=_r.return}}function Rp(l){if(l!==_r)return!1;if(!It)return p4(l),It=!0,!1;var d=!1,g;if((g=l.tag!==3&&l.tag!==27)&&((g=l.tag===5)&&(g=l.type,g=!(g!=="form"&&g!=="button")||p2(l.type,l.memoizedProps)),g=!g),g&&(d=!0),d&&ar&&Qc(l),p4(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));e:{for(l=l.nextSibling,d=0;l;){if(l.nodeType===8)if(g=l.data,g==="/$"){if(d===0){ar=Ni(l.nextSibling);break e}d--}else g!=="$"&&g!=="$!"&&g!=="$?"||d++;l=l.nextSibling}ar=null}}else ar=_r?Ni(l.stateNode.nextSibling):null;return!0}function Mp(){ar=_r=null,It=!1}function kp(l){Si===null?Si=[l]:Si.push(l)}var Ip=Error(r(460)),m4=Error(r(474)),JS={then:function(){}};function g4(l){return l=l.status,l==="fulfilled"||l==="rejected"}function A0(){}function y4(l,d,g){switch(g=l[g],g===void 0?l.push(d):g!==d&&(d.then(A0,A0),d=g),d.status){case"fulfilled":return d.value;case"rejected":throw l=d.reason,l===Ip?Error(r(483)):l;default:if(typeof d.status=="string")d.then(A0,A0);else{if(l=en,l!==null&&100<l.shellSuspendCounter)throw Error(r(482));l=d,l.status="pending",l.then(function(b){if(d.status==="pending"){var S=d;S.status="fulfilled",S.value=b}},function(b){if(d.status==="pending"){var S=d;S.status="rejected",S.reason=b}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw l=d.reason,l===Ip?Error(r(483)):l}throw Dp=d,Ip}}var Dp=null;function b4(){if(Dp===null)throw Error(r(459));var l=Dp;return Dp=null,l}var Hd=null,Pp=0;function $0(l){var d=Pp;return Pp+=1,Hd===null&&(Hd=[]),y4(Hd,l,d)}function Lp(l,d){d=d.props.ref,l.ref=d!==void 0?d:null}function T0(l,d){throw d.$$typeof===i?Error(r(525)):(l=Object.prototype.toString.call(d),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":l)))}function v4(l){var d=l._init;return d(l._payload)}function x4(l){function d(pe,oe){if(l){var me=pe.deletions;me===null?(pe.deletions=[oe],pe.flags|=16):me.push(oe)}}function g(pe,oe){if(!l)return null;for(;oe!==null;)d(pe,oe),oe=oe.sibling;return null}function b(pe){for(var oe=new Map;pe!==null;)pe.key!==null?oe.set(pe.key,pe):oe.set(pe.index,pe),pe=pe.sibling;return oe}function S(pe,oe){return pe=Sl(pe,oe),pe.index=0,pe.sibling=null,pe}function O(pe,oe,me){return pe.index=me,l?(me=pe.alternate,me!==null?(me=me.index,me<oe?(pe.flags|=33554434,oe):me):(pe.flags|=33554434,oe)):(pe.flags|=1048576,oe)}function U(pe){return l&&pe.alternate===null&&(pe.flags|=33554434),pe}function Y(pe,oe,me,Ne){return oe===null||oe.tag!==6?(oe=UE(me,pe.mode,Ne),oe.return=pe,oe):(oe=S(oe,me),oe.return=pe,oe)}function Z(pe,oe,me,Ne){var He=me.type;return He===c?Ee(pe,oe,me.props.children,Ne,me.key):oe!==null&&(oe.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===_&&v4(He)===oe.type)?(oe=S(oe,me.props),Lp(oe,me),oe.return=pe,oe):(oe=J0(me.type,me.key,me.props,null,pe.mode,Ne),Lp(oe,me),oe.return=pe,oe)}function le(pe,oe,me,Ne){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==me.containerInfo||oe.stateNode.implementation!==me.implementation?(oe=qE(me,pe.mode,Ne),oe.return=pe,oe):(oe=S(oe,me.children||[]),oe.return=pe,oe)}function Ee(pe,oe,me,Ne,He){return oe===null||oe.tag!==7?(oe=lu(me,pe.mode,Ne,He),oe.return=pe,oe):(oe=S(oe,me),oe.return=pe,oe)}function je(pe,oe,me){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return oe=UE(""+oe,pe.mode,me),oe.return=pe,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case o:return me=J0(oe.type,oe.key,oe.props,null,pe.mode,me),Lp(me,oe),me.return=pe,me;case a:return oe=qE(oe,pe.mode,me),oe.return=pe,oe;case _:var Ne=oe._init;return oe=Ne(oe._payload),je(pe,oe,me)}if(ne(oe)||$(oe))return oe=lu(oe,pe.mode,me,null),oe.return=pe,oe;if(typeof oe.then=="function")return je(pe,$0(oe),me);if(oe.$$typeof===y)return je(pe,W0(pe,oe),me);T0(pe,oe)}return null}function ge(pe,oe,me,Ne){var He=oe!==null?oe.key:null;if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return He!==null?null:Y(pe,oe,""+me,Ne);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case o:return me.key===He?Z(pe,oe,me,Ne):null;case a:return me.key===He?le(pe,oe,me,Ne):null;case _:return He=me._init,me=He(me._payload),ge(pe,oe,me,Ne)}if(ne(me)||$(me))return He!==null?null:Ee(pe,oe,me,Ne,null);if(typeof me.then=="function")return ge(pe,oe,$0(me),Ne);if(me.$$typeof===y)return ge(pe,oe,W0(pe,me),Ne);T0(pe,me)}return null}function we(pe,oe,me,Ne,He){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return pe=pe.get(me)||null,Y(oe,pe,""+Ne,He);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case o:return pe=pe.get(Ne.key===null?me:Ne.key)||null,Z(oe,pe,Ne,He);case a:return pe=pe.get(Ne.key===null?me:Ne.key)||null,le(oe,pe,Ne,He);case _:var xt=Ne._init;return Ne=xt(Ne._payload),we(pe,oe,me,Ne,He)}if(ne(Ne)||$(Ne))return pe=pe.get(me)||null,Ee(oe,pe,Ne,He,null);if(typeof Ne.then=="function")return we(pe,oe,me,$0(Ne),He);if(Ne.$$typeof===y)return we(pe,oe,me,W0(oe,Ne),He);T0(oe,Ne)}return null}function Ze(pe,oe,me,Ne){for(var He=null,xt=null,nt=oe,at=oe=0,Zn=null;nt!==null&&at<me.length;at++){nt.index>at?(Zn=nt,nt=null):Zn=nt.sibling;var Dt=ge(pe,nt,me[at],Ne);if(Dt===null){nt===null&&(nt=Zn);break}l&&nt&&Dt.alternate===null&&d(pe,nt),oe=O(Dt,oe,at),xt===null?He=Dt:xt.sibling=Dt,xt=Dt,nt=Zn}if(at===me.length)return g(pe,nt),It&&Kc(pe,at),He;if(nt===null){for(;at<me.length;at++)nt=je(pe,me[at],Ne),nt!==null&&(oe=O(nt,oe,at),xt===null?He=nt:xt.sibling=nt,xt=nt);return It&&Kc(pe,at),He}for(nt=b(nt);at<me.length;at++)Zn=we(nt,pe,at,me[at],Ne),Zn!==null&&(l&&Zn.alternate!==null&&nt.delete(Zn.key===null?at:Zn.key),oe=O(Zn,oe,at),xt===null?He=Zn:xt.sibling=Zn,xt=Zn);return l&&nt.forEach(function(Al){return d(pe,Al)}),It&&Kc(pe,at),He}function ft(pe,oe,me,Ne){if(me==null)throw Error(r(151));for(var He=null,xt=null,nt=oe,at=oe=0,Zn=null,Dt=me.next();nt!==null&&!Dt.done;at++,Dt=me.next()){nt.index>at?(Zn=nt,nt=null):Zn=nt.sibling;var Al=ge(pe,nt,Dt.value,Ne);if(Al===null){nt===null&&(nt=Zn);break}l&&nt&&Al.alternate===null&&d(pe,nt),oe=O(Al,oe,at),xt===null?He=Al:xt.sibling=Al,xt=Al,nt=Zn}if(Dt.done)return g(pe,nt),It&&Kc(pe,at),He;if(nt===null){for(;!Dt.done;at++,Dt=me.next())Dt=je(pe,Dt.value,Ne),Dt!==null&&(oe=O(Dt,oe,at),xt===null?He=Dt:xt.sibling=Dt,xt=Dt);return It&&Kc(pe,at),He}for(nt=b(nt);!Dt.done;at++,Dt=me.next())Dt=we(nt,pe,at,Dt.value,Ne),Dt!==null&&(l&&Dt.alternate!==null&&nt.delete(Dt.key===null?at:Dt.key),oe=O(Dt,oe,at),xt===null?He=Dt:xt.sibling=Dt,xt=Dt);return l&&nt.forEach(function(PX){return d(pe,PX)}),It&&Kc(pe,at),He}function Sn(pe,oe,me,Ne){if(typeof me=="object"&&me!==null&&me.type===c&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case o:e:{for(var He=me.key;oe!==null;){if(oe.key===He){if(He=me.type,He===c){if(oe.tag===7){g(pe,oe.sibling),Ne=S(oe,me.props.children),Ne.return=pe,pe=Ne;break e}}else if(oe.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===_&&v4(He)===oe.type){g(pe,oe.sibling),Ne=S(oe,me.props),Lp(Ne,me),Ne.return=pe,pe=Ne;break e}g(pe,oe);break}else d(pe,oe);oe=oe.sibling}me.type===c?(Ne=lu(me.props.children,pe.mode,Ne,me.key),Ne.return=pe,pe=Ne):(Ne=J0(me.type,me.key,me.props,null,pe.mode,Ne),Lp(Ne,me),Ne.return=pe,pe=Ne)}return U(pe);case a:e:{for(He=me.key;oe!==null;){if(oe.key===He)if(oe.tag===4&&oe.stateNode.containerInfo===me.containerInfo&&oe.stateNode.implementation===me.implementation){g(pe,oe.sibling),Ne=S(oe,me.children||[]),Ne.return=pe,pe=Ne;break e}else{g(pe,oe);break}else d(pe,oe);oe=oe.sibling}Ne=qE(me,pe.mode,Ne),Ne.return=pe,pe=Ne}return U(pe);case _:return He=me._init,me=He(me._payload),Sn(pe,oe,me,Ne)}if(ne(me))return Ze(pe,oe,me,Ne);if($(me)){if(He=$(me),typeof He!="function")throw Error(r(150));return me=He.call(me),ft(pe,oe,me,Ne)}if(typeof me.then=="function")return Sn(pe,oe,$0(me),Ne);if(me.$$typeof===y)return Sn(pe,oe,W0(pe,me),Ne);T0(pe,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,oe!==null&&oe.tag===6?(g(pe,oe.sibling),Ne=S(oe,me),Ne.return=pe,pe=Ne):(g(pe,oe),Ne=UE(me,pe.mode,Ne),Ne.return=pe,pe=Ne),U(pe)):g(pe,oe)}return function(pe,oe,me,Ne){try{Pp=0;var He=Sn(pe,oe,me,Ne);return Hd=null,He}catch(nt){if(nt===Ip)throw nt;var xt=Us(29,nt,null,pe.mode);return xt.lanes=Ne,xt.return=pe,xt}finally{}}}var Zc=x4(!0),w4=x4(!1),Wd=ue(null),R0=ue(0);function S4(l,d){l=ta,Se(R0,l),Se(Wd,d),ta=l|d.baseLanes}function XS(){Se(R0,ta),Se(Wd,Wd.current)}function KS(){ta=R0.current,ve(Wd),ve(R0)}var Bs=ue(null),io=null;function dl(l){var d=l.alternate;Se(Bn,Bn.current&1),Se(Bs,l),io===null&&(d===null||Wd.current!==null||d.memoizedState!==null)&&(io=l)}function E4(l){if(l.tag===22){if(Se(Bn,Bn.current),Se(Bs,l),io===null){var d=l.alternate;d!==null&&d.memoizedState!==null&&(io=l)}}else fl()}function fl(){Se(Bn,Bn.current),Se(Bs,Bs.current)}function Ho(l){ve(Bs),io===l&&(io=null),ve(Bn)}var Bn=ue(0);function M0(l){for(var d=l;d!==null;){if(d.tag===13){var g=d.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||g.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var NJ=typeof AbortController<"u"?AbortController:function(){var l=[],d=this.signal={aborted:!1,addEventListener:function(g,b){l.push(b)}};this.abort=function(){d.aborted=!0,l.forEach(function(g){return g()})}},_J=e.unstable_scheduleCallback,CJ=e.unstable_NormalPriority,zn={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function QS(){return{controller:new NJ,data:new Map,refCount:0}}function Fp(l){l.refCount--,l.refCount===0&&_J(CJ,function(){l.controller.abort()})}var Bp=null,ZS=0,Gd=0,Yd=null;function OJ(l,d){if(Bp===null){var g=Bp=[];ZS=0,Gd=i2(),Yd={status:"pending",value:void 0,then:function(b){g.push(b)}}}return ZS++,d.then(N4,N4),d}function N4(){if(--ZS===0&&Bp!==null){Yd!==null&&(Yd.status="fulfilled");var l=Bp;Bp=null,Gd=0,Yd=null;for(var d=0;d<l.length;d++)(0,l[d])()}}function jJ(l,d){var g=[],b={status:"pending",value:null,reason:null,then:function(S){g.push(S)}};return l.then(function(){b.status="fulfilled",b.value=d;for(var S=0;S<g.length;S++)(0,g[S])(d)},function(S){for(b.status="rejected",b.reason=S,S=0;S<g.length;S++)(0,g[S])(void 0)}),b}var _4=D.S;D.S=function(l,d){typeof d=="object"&&d!==null&&typeof d.then=="function"&&OJ(l,d),_4!==null&&_4(l,d)};var eu=ue(null);function eE(){var l=eu.current;return l!==null?l:en.pooledCache}function k0(l,d){d===null?Se(eu,eu.current):Se(eu,d.pool)}function C4(){var l=eE();return l===null?null:{parent:zn._currentValue,pool:l}}var hl=0,vt=null,Gt=null,Mn=null,I0=!1,Jd=!1,tu=!1,D0=0,zp=0,Xd=null,AJ=0;function Cn(){throw Error(r(321))}function tE(l,d){if(d===null)return!1;for(var g=0;g<d.length&&g<l.length;g++)if(!us(l[g],d[g]))return!1;return!0}function nE(l,d,g,b,S,O){return hl=O,vt=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,D.H=l===null||l.memoizedState===null?nu:pl,tu=!1,O=g(b,S),tu=!1,Jd&&(O=j4(d,g,b,S)),O4(l),O}function O4(l){D.H=oo;var d=Gt!==null&&Gt.next!==null;if(hl=0,Mn=Gt=vt=null,I0=!1,zp=0,Xd=null,d)throw Error(r(300));l===null||Kn||(l=l.dependencies,l!==null&&H0(l)&&(Kn=!0))}function j4(l,d,g,b){vt=l;var S=0;do{if(Jd&&(Xd=null),zp=0,Jd=!1,25<=S)throw Error(r(301));if(S+=1,Mn=Gt=null,l.updateQueue!=null){var O=l.updateQueue;O.lastEffect=null,O.events=null,O.stores=null,O.memoCache!=null&&(O.memoCache.index=0)}D.H=ru,O=d(g,b)}while(Jd);return O}function $J(){var l=D.H,d=l.useState()[0];return d=typeof d.then=="function"?Vp(d):d,l=l.useState()[0],(Gt!==null?Gt.memoizedState:null)!==l&&(vt.flags|=1024),d}function rE(){var l=D0!==0;return D0=0,l}function sE(l,d,g){d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~g}function iE(l){if(I0){for(l=l.memoizedState;l!==null;){var d=l.queue;d!==null&&(d.pending=null),l=l.next}I0=!1}hl=0,Mn=Gt=vt=null,Jd=!1,zp=D0=0,Xd=null}function Yr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?vt.memoizedState=Mn=l:Mn=Mn.next=l,Mn}function kn(){if(Gt===null){var l=vt.alternate;l=l!==null?l.memoizedState:null}else l=Gt.next;var d=Mn===null?vt.memoizedState:Mn.next;if(d!==null)Mn=d,Gt=l;else{if(l===null)throw vt.alternate===null?Error(r(467)):Error(r(310));Gt=l,l={memoizedState:Gt.memoizedState,baseState:Gt.baseState,baseQueue:Gt.baseQueue,queue:Gt.queue,next:null},Mn===null?vt.memoizedState=Mn=l:Mn=Mn.next=l}return Mn}var P0;P0=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}};function Vp(l){var d=zp;return zp+=1,Xd===null&&(Xd=[]),l=y4(Xd,l,d),d=vt,(Mn===null?d.memoizedState:Mn.next)===null&&(d=d.alternate,D.H=d===null||d.memoizedState===null?nu:pl),l}function L0(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return Vp(l);if(l.$$typeof===y)return mr(l)}throw Error(r(438,String(l)))}function oE(l){var d=null,g=vt.updateQueue;if(g!==null&&(d=g.memoCache),d==null){var b=vt.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(d={data:b.data.map(function(S){return S.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),g===null&&(g=P0(),vt.updateQueue=g),g.memoCache=d,g=d.data[d.index],g===void 0)for(g=d.data[d.index]=Array(l),b=0;b<l;b++)g[b]=j;return d.index++,g}function Wo(l,d){return typeof d=="function"?d(l):d}function F0(l){var d=kn();return aE(d,Gt,l)}function aE(l,d,g){var b=l.queue;if(b===null)throw Error(r(311));b.lastRenderedReducer=g;var S=l.baseQueue,O=b.pending;if(O!==null){if(S!==null){var U=S.next;S.next=O.next,O.next=U}d.baseQueue=S=O,b.pending=null}if(O=l.baseState,S===null)l.memoizedState=O;else{d=S.next;var Y=U=null,Z=null,le=d,Ee=!1;do{var je=le.lane&-536870913;if(je!==le.lane?(Ct&je)===je:(hl&je)===je){var ge=le.revertLane;if(ge===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),je===Gd&&(Ee=!0);else if((hl&ge)===ge){le=le.next,ge===Gd&&(Ee=!0);continue}else je={lane:0,revertLane:le.revertLane,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Z===null?(Y=Z=je,U=O):Z=Z.next=je,vt.lanes|=ge,El|=ge;je=le.action,tu&&g(O,je),O=le.hasEagerState?le.eagerState:g(O,je)}else ge={lane:je,revertLane:le.revertLane,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Z===null?(Y=Z=ge,U=O):Z=Z.next=ge,vt.lanes|=je,El|=je;le=le.next}while(le!==null&&le!==d);if(Z===null?U=O:Z.next=Y,!us(O,l.memoizedState)&&(Kn=!0,Ee&&(g=Yd,g!==null)))throw g;l.memoizedState=O,l.baseState=U,l.baseQueue=Z,b.lastRenderedState=O}return S===null&&(b.lanes=0),[l.memoizedState,b.dispatch]}function lE(l){var d=kn(),g=d.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=l;var b=g.dispatch,S=g.pending,O=d.memoizedState;if(S!==null){g.pending=null;var U=S=S.next;do O=l(O,U.action),U=U.next;while(U!==S);us(O,d.memoizedState)||(Kn=!0),d.memoizedState=O,d.baseQueue===null&&(d.baseState=O),g.lastRenderedState=O}return[O,b]}function A4(l,d,g){var b=vt,S=kn(),O=It;if(O){if(g===void 0)throw Error(r(407));g=g()}else g=d();var U=!us((Gt||S).memoizedState,g);if(U&&(S.memoizedState=g,Kn=!0),S=S.queue,dE(R4.bind(null,b,S,l),[l]),S.getSnapshot!==d||U||Mn!==null&&Mn.memoizedState.tag&1){if(b.flags|=2048,Kd(9,T4.bind(null,b,S,g,d),{destroy:void 0},null),en===null)throw Error(r(349));O||(hl&60)!==0||$4(b,d,g)}return g}function $4(l,d,g){l.flags|=16384,l={getSnapshot:d,value:g},d=vt.updateQueue,d===null?(d=P0(),vt.updateQueue=d,d.stores=[l]):(g=d.stores,g===null?d.stores=[l]:g.push(l))}function T4(l,d,g,b){d.value=g,d.getSnapshot=b,M4(d)&&k4(l)}function R4(l,d,g){return g(function(){M4(d)&&k4(l)})}function M4(l){var d=l.getSnapshot;l=l.value;try{var g=d();return!us(l,g)}catch{return!0}}function k4(l){var d=ul(l,2);d!==null&&Cr(d,l,2)}function cE(l){var d=Yr();if(typeof l=="function"){var g=l;if(l=g(),tu){Ms(!0);try{g()}finally{Ms(!1)}}}return d.memoizedState=d.baseState=l,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:l},d}function I4(l,d,g,b){return l.baseState=g,aE(l,Gt,typeof b=="function"?b:Wo)}function TJ(l,d,g,b,S){if(V0(l))throw Error(r(485));if(l=d.action,l!==null){var O={payload:S,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(U){O.listeners.push(U)}};D.T!==null?g(!0):O.isTransition=!1,b(O),g=d.pending,g===null?(O.next=d.pending=O,D4(d,O)):(O.next=g.next,d.pending=g.next=O)}}function D4(l,d){var g=d.action,b=d.payload,S=l.state;if(d.isTransition){var O=D.T,U={};D.T=U;try{var Y=g(S,b),Z=D.S;Z!==null&&Z(U,Y),P4(l,d,Y)}catch(le){uE(l,d,le)}finally{D.T=O}}else try{O=g(S,b),P4(l,d,O)}catch(le){uE(l,d,le)}}function P4(l,d,g){g!==null&&typeof g=="object"&&typeof g.then=="function"?g.then(function(b){L4(l,d,b)},function(b){return uE(l,d,b)}):L4(l,d,g)}function L4(l,d,g){d.status="fulfilled",d.value=g,F4(d),l.state=g,d=l.pending,d!==null&&(g=d.next,g===d?l.pending=null:(g=g.next,d.next=g,D4(l,g)))}function uE(l,d,g){var b=l.pending;if(l.pending=null,b!==null){b=b.next;do d.status="rejected",d.reason=g,F4(d),d=d.next;while(d!==b)}l.action=null}function F4(l){l=l.listeners;for(var d=0;d<l.length;d++)(0,l[d])()}function B4(l,d){return d}function z4(l,d){if(It){var g=en.formState;if(g!==null){e:{var b=vt;if(It){if(ar){t:{for(var S=ar,O=so;S.nodeType!==8;){if(!O){S=null;break t}if(S=Ni(S.nextSibling),S===null){S=null;break t}}O=S.data,S=O==="F!"||O==="F"?S:null}if(S){ar=Ni(S.nextSibling),b=S.data==="F!";break e}}Qc(b)}b=!1}b&&(d=g[0])}}return g=Yr(),g.memoizedState=g.baseState=d,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B4,lastRenderedState:d},g.queue=b,g=iR.bind(null,vt,b),b.dispatch=g,b=cE(!1),O=gE.bind(null,vt,!1,b.queue),b=Yr(),S={state:d,dispatch:null,action:l,pending:null},b.queue=S,g=TJ.bind(null,vt,S,O,g),S.dispatch=g,b.memoizedState=l,[d,g,!1]}function V4(l){var d=kn();return U4(d,Gt,l)}function U4(l,d,g){d=aE(l,d,B4)[0],l=F0(Wo)[0],d=typeof d=="object"&&d!==null&&typeof d.then=="function"?Vp(d):d;var b=kn(),S=b.queue,O=S.dispatch;return g!==b.memoizedState&&(vt.flags|=2048,Kd(9,RJ.bind(null,S,g),{destroy:void 0},null)),[d,O,l]}function RJ(l,d){l.action=d}function q4(l){var d=kn(),g=Gt;if(g!==null)return U4(d,g,l);kn(),d=d.memoizedState,g=kn();var b=g.queue.dispatch;return g.memoizedState=l,[d,b,!1]}function Kd(l,d,g,b){return l={tag:l,create:d,inst:g,deps:b,next:null},d=vt.updateQueue,d===null&&(d=P0(),vt.updateQueue=d),g=d.lastEffect,g===null?d.lastEffect=l.next=l:(b=g.next,g.next=l,l.next=b,d.lastEffect=l),l}function H4(){return kn().memoizedState}function B0(l,d,g,b){var S=Yr();vt.flags|=l,S.memoizedState=Kd(1|d,g,{destroy:void 0},b===void 0?null:b)}function z0(l,d,g,b){var S=kn();b=b===void 0?null:b;var O=S.memoizedState.inst;Gt!==null&&b!==null&&tE(b,Gt.memoizedState.deps)?S.memoizedState=Kd(d,g,O,b):(vt.flags|=l,S.memoizedState=Kd(1|d,g,O,b))}function W4(l,d){B0(8390656,8,l,d)}function dE(l,d){z0(2048,8,l,d)}function G4(l,d){return z0(4,2,l,d)}function Y4(l,d){return z0(4,4,l,d)}function J4(l,d){if(typeof d=="function"){l=l();var g=d(l);return function(){typeof g=="function"?g():d(null)}}if(d!=null)return l=l(),d.current=l,function(){d.current=null}}function X4(l,d,g){g=g!=null?g.concat([l]):null,z0(4,4,J4.bind(null,d,l),g)}function fE(){}function K4(l,d){var g=kn();d=d===void 0?null:d;var b=g.memoizedState;return d!==null&&tE(d,b[1])?b[0]:(g.memoizedState=[l,d],l)}function Q4(l,d){var g=kn();d=d===void 0?null:d;var b=g.memoizedState;if(d!==null&&tE(d,b[1]))return b[0];if(b=l(),tu){Ms(!0);try{l()}finally{Ms(!1)}}return g.memoizedState=[b,d],b}function hE(l,d,g){return g===void 0||(hl&1073741824)!==0?l.memoizedState=d:(l.memoizedState=g,l=e3(),vt.lanes|=l,El|=l,g)}function Z4(l,d,g,b){return us(g,d)?g:Wd.current!==null?(l=hE(l,g,b),us(l,d)||(Kn=!0),l):(hl&42)===0?(Kn=!0,l.memoizedState=g):(l=e3(),vt.lanes|=l,El|=l,d)}function eR(l,d,g,b,S){var O=re.p;re.p=O!==0&&8>O?O:8;var U=D.T,Y={};D.T=Y,gE(l,!1,d,g);try{var Z=S(),le=D.S;if(le!==null&&le(Y,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var Ee=jJ(Z,b);Up(l,d,Ee,ps(l))}else Up(l,d,b,ps(l))}catch(je){Up(l,d,{then:function(){},status:"rejected",reason:je},ps())}finally{re.p=O,D.T=U}}function MJ(){}function pE(l,d,g,b){if(l.tag!==5)throw Error(r(476));var S=tR(l).queue;eR(l,S,d,se,g===null?MJ:function(){return nR(l),g(b)})}function tR(l){var d=l.memoizedState;if(d!==null)return d;d={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:se},next:null};var g={};return d.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:g},next:null},l.memoizedState=d,l=l.alternate,l!==null&&(l.memoizedState=d),d}function nR(l){var d=tR(l).next.queue;Up(l,d,{},ps())}function mE(){return mr(cm)}function rR(){return kn().memoizedState}function sR(){return kn().memoizedState}function kJ(l){for(var d=l.return;d!==null;){switch(d.tag){case 24:case 3:var g=ps();l=yl(g);var b=bl(d,l,g);b!==null&&(Cr(b,d,g),Wp(b,d,g)),d={cache:QS()},l.payload=d;return}d=d.return}}function IJ(l,d,g){var b=ps();g={lane:b,revertLane:0,action:g,hasEagerState:!1,eagerState:null,next:null},V0(l)?oR(d,g):(g=HS(l,d,g,b),g!==null&&(Cr(g,l,b),aR(g,d,b)))}function iR(l,d,g){var b=ps();Up(l,d,g,b)}function Up(l,d,g,b){var S={lane:b,revertLane:0,action:g,hasEagerState:!1,eagerState:null,next:null};if(V0(l))oR(d,S);else{var O=l.alternate;if(l.lanes===0&&(O===null||O.lanes===0)&&(O=d.lastRenderedReducer,O!==null))try{var U=d.lastRenderedState,Y=O(U,g);if(S.hasEagerState=!0,S.eagerState=Y,us(Y,U))return _0(l,d,S,0),en===null&&N0(),!1}catch{}finally{}if(g=HS(l,d,S,b),g!==null)return Cr(g,l,b),aR(g,d,b),!0}return!1}function gE(l,d,g,b){if(b={lane:2,revertLane:i2(),action:b,hasEagerState:!1,eagerState:null,next:null},V0(l)){if(d)throw Error(r(479))}else d=HS(l,g,b,2),d!==null&&Cr(d,l,2)}function V0(l){var d=l.alternate;return l===vt||d!==null&&d===vt}function oR(l,d){Jd=I0=!0;var g=l.pending;g===null?d.next=d:(d.next=g.next,g.next=d),l.pending=d}function aR(l,d,g){if((g&4194176)!==0){var b=d.lanes;b&=l.pendingLanes,g|=b,d.lanes=g,Vc(l,g)}}var oo={readContext:mr,use:L0,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn};oo.useCacheRefresh=Cn,oo.useMemoCache=Cn,oo.useHostTransitionStatus=Cn,oo.useFormState=Cn,oo.useActionState=Cn,oo.useOptimistic=Cn;var nu={readContext:mr,use:L0,useCallback:function(l,d){return Yr().memoizedState=[l,d===void 0?null:d],l},useContext:mr,useEffect:W4,useImperativeHandle:function(l,d,g){g=g!=null?g.concat([l]):null,B0(4194308,4,J4.bind(null,d,l),g)},useLayoutEffect:function(l,d){return B0(4194308,4,l,d)},useInsertionEffect:function(l,d){B0(4,2,l,d)},useMemo:function(l,d){var g=Yr();d=d===void 0?null:d;var b=l();if(tu){Ms(!0);try{l()}finally{Ms(!1)}}return g.memoizedState=[b,d],b},useReducer:function(l,d,g){var b=Yr();if(g!==void 0){var S=g(d);if(tu){Ms(!0);try{g(d)}finally{Ms(!1)}}}else S=d;return b.memoizedState=b.baseState=S,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:S},b.queue=l,l=l.dispatch=IJ.bind(null,vt,l),[b.memoizedState,l]},useRef:function(l){var d=Yr();return l={current:l},d.memoizedState=l},useState:function(l){l=cE(l);var d=l.queue,g=iR.bind(null,vt,d);return d.dispatch=g,[l.memoizedState,g]},useDebugValue:fE,useDeferredValue:function(l,d){var g=Yr();return hE(g,l,d)},useTransition:function(){var l=cE(!1);return l=eR.bind(null,vt,l.queue,!0,!1),Yr().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,d,g){var b=vt,S=Yr();if(It){if(g===void 0)throw Error(r(407));g=g()}else{if(g=d(),en===null)throw Error(r(349));(Ct&60)!==0||$4(b,d,g)}S.memoizedState=g;var O={value:g,getSnapshot:d};return S.queue=O,W4(R4.bind(null,b,O,l),[l]),b.flags|=2048,Kd(9,T4.bind(null,b,O,g,d),{destroy:void 0},null),g},useId:function(){var l=Yr(),d=en.identifierPrefix;if(It){var g=qo,b=Uo;g=(b&~(1<<32-Gn(b)-1)).toString(32)+g,d=":"+d+"R"+g,g=D0++,0<g&&(d+="H"+g.toString(32)),d+=":"}else g=AJ++,d=":"+d+"r"+g.toString(32)+":";return l.memoizedState=d},useCacheRefresh:function(){return Yr().memoizedState=kJ.bind(null,vt)}};nu.useMemoCache=oE,nu.useHostTransitionStatus=mE,nu.useFormState=z4,nu.useActionState=z4,nu.useOptimistic=function(l){var d=Yr();d.memoizedState=d.baseState=l;var g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=g,d=gE.bind(null,vt,!0,g),g.dispatch=d,[l,d]};var pl={readContext:mr,use:L0,useCallback:K4,useContext:mr,useEffect:dE,useImperativeHandle:X4,useInsertionEffect:G4,useLayoutEffect:Y4,useMemo:Q4,useReducer:F0,useRef:H4,useState:function(){return F0(Wo)},useDebugValue:fE,useDeferredValue:function(l,d){var g=kn();return Z4(g,Gt.memoizedState,l,d)},useTransition:function(){var l=F0(Wo)[0],d=kn().memoizedState;return[typeof l=="boolean"?l:Vp(l),d]},useSyncExternalStore:A4,useId:rR};pl.useCacheRefresh=sR,pl.useMemoCache=oE,pl.useHostTransitionStatus=mE,pl.useFormState=V4,pl.useActionState=V4,pl.useOptimistic=function(l,d){var g=kn();return I4(g,Gt,l,d)};var ru={readContext:mr,use:L0,useCallback:K4,useContext:mr,useEffect:dE,useImperativeHandle:X4,useInsertionEffect:G4,useLayoutEffect:Y4,useMemo:Q4,useReducer:lE,useRef:H4,useState:function(){return lE(Wo)},useDebugValue:fE,useDeferredValue:function(l,d){var g=kn();return Gt===null?hE(g,l,d):Z4(g,Gt.memoizedState,l,d)},useTransition:function(){var l=lE(Wo)[0],d=kn().memoizedState;return[typeof l=="boolean"?l:Vp(l),d]},useSyncExternalStore:A4,useId:rR};ru.useCacheRefresh=sR,ru.useMemoCache=oE,ru.useHostTransitionStatus=mE,ru.useFormState=q4,ru.useActionState=q4,ru.useOptimistic=function(l,d){var g=kn();return Gt!==null?I4(g,Gt,l,d):(g.baseState=l,[l,g.queue.dispatch])};function yE(l,d,g,b){d=l.memoizedState,g=g(b,d),g=g==null?d:P({},d,g),l.memoizedState=g,l.lanes===0&&(l.updateQueue.baseState=g)}var bE={isMounted:function(l){return(l=l._reactInternals)?z(l)===l:!1},enqueueSetState:function(l,d,g){l=l._reactInternals;var b=ps(),S=yl(b);S.payload=d,g!=null&&(S.callback=g),d=bl(l,S,b),d!==null&&(Cr(d,l,b),Wp(d,l,b))},enqueueReplaceState:function(l,d,g){l=l._reactInternals;var b=ps(),S=yl(b);S.tag=1,S.payload=d,g!=null&&(S.callback=g),d=bl(l,S,b),d!==null&&(Cr(d,l,b),Wp(d,l,b))},enqueueForceUpdate:function(l,d){l=l._reactInternals;var g=ps(),b=yl(g);b.tag=2,d!=null&&(b.callback=d),d=bl(l,b,g),d!==null&&(Cr(d,l,g),Wp(d,l,g))}};function lR(l,d,g,b,S,O,U){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(b,O,U):d.prototype&&d.prototype.isPureReactComponent?!$p(g,b)||!$p(S,O):!0}function cR(l,d,g,b){l=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(g,b),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(g,b),d.state!==l&&bE.enqueueReplaceState(d,d.state,null)}function su(l,d){var g=d;if("ref"in d){g={};for(var b in d)b!=="ref"&&(g[b]=d[b])}if(l=l.defaultProps){g===d&&(g=P({},g));for(var S in l)g[S]===void 0&&(g[S]=l[S])}return g}var U0=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(d))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",l);return}console.error(l)};function uR(l){U0(l)}function dR(l){console.error(l)}function fR(l){U0(l)}function q0(l,d){try{var g=l.onUncaughtError;g(d.value,{componentStack:d.stack})}catch(b){setTimeout(function(){throw b})}}function hR(l,d,g){try{var b=l.onCaughtError;b(g.value,{componentStack:g.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(S){setTimeout(function(){throw S})}}function vE(l,d,g){return g=yl(g),g.tag=3,g.payload={element:null},g.callback=function(){q0(l,d)},g}function pR(l){return l=yl(l),l.tag=3,l}function mR(l,d,g,b){var S=g.type.getDerivedStateFromError;if(typeof S=="function"){var O=b.value;l.payload=function(){return S(O)},l.callback=function(){hR(d,g,b)}}var U=g.stateNode;U!==null&&typeof U.componentDidCatch=="function"&&(l.callback=function(){hR(d,g,b),typeof S!="function"&&(Nl===null?Nl=new Set([this]):Nl.add(this));var Y=b.stack;this.componentDidCatch(b.value,{componentStack:Y!==null?Y:""})})}function DJ(l,d,g,b,S){if(g.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(d=g.alternate,d!==null&&Hp(d,g,S,!0),g=Bs.current,g!==null){switch(g.tag){case 13:return io===null?e2():g.alternate===null&&wn===0&&(wn=3),g.flags&=-257,g.flags|=65536,g.lanes=S,b===JS?g.flags|=16384:(d=g.updateQueue,d===null?g.updateQueue=new Set([b]):d.add(b),n2(l,b,S)),!1;case 22:return g.flags|=65536,b===JS?g.flags|=16384:(d=g.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([b])},g.updateQueue=d):(g=d.retryQueue,g===null?d.retryQueue=new Set([b]):g.add(b)),n2(l,b,S)),!1}throw Error(r(435,g.tag))}return n2(l,b,S),e2(),!1}if(It)return d=Bs.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=S,b!==YS&&(l=Error(r(422),{cause:b}),kp(Ps(l,g)))):(b!==YS&&(d=Error(r(423),{cause:b}),kp(Ps(d,g))),l=l.current.alternate,l.flags|=65536,S&=-S,l.lanes|=S,b=Ps(b,g),S=vE(l.stateNode,b,S),kE(l,S),wn!==4&&(wn=2)),!1;var O=Error(r(520),{cause:b});if(O=Ps(O,g),em===null?em=[O]:em.push(O),wn!==4&&(wn=2),d===null)return!0;b=Ps(b,g),g=d;do{switch(g.tag){case 3:return g.flags|=65536,l=S&-S,g.lanes|=l,l=vE(g.stateNode,b,l),kE(g,l),!1;case 1:if(d=g.type,O=g.stateNode,(g.flags&128)===0&&(typeof d.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(Nl===null||!Nl.has(O))))return g.flags|=65536,S&=-S,g.lanes|=S,S=pR(S),mR(S,l,g,b),kE(g,S),!1}g=g.return}while(g!==null);return!1}var gR=Error(r(461)),Kn=!1;function lr(l,d,g,b){d.child=l===null?w4(d,null,g,b):Zc(d,l.child,g,b)}function yR(l,d,g,b,S){g=g.render;var O=d.ref;if("ref"in b){var U={};for(var Y in b)Y!=="ref"&&(U[Y]=b[Y])}else U=b;return ou(d),b=nE(l,d,g,U,O,S),Y=rE(),l!==null&&!Kn?(sE(l,d,S),Go(l,d,S)):(It&&Y&&WS(d),d.flags|=1,lr(l,d,b,S),d.child)}function bR(l,d,g,b,S){if(l===null){var O=g.type;return typeof O=="function"&&!VE(O)&&O.defaultProps===void 0&&g.compare===null?(d.tag=15,d.type=O,vR(l,d,O,b,S)):(l=J0(g.type,null,b,d,d.mode,S),l.ref=d.ref,l.return=d,d.child=l)}if(O=l.child,!jE(l,S)){var U=O.memoizedProps;if(g=g.compare,g=g!==null?g:$p,g(U,b)&&l.ref===d.ref)return Go(l,d,S)}return d.flags|=1,l=Sl(O,b),l.ref=d.ref,l.return=d,d.child=l}function vR(l,d,g,b,S){if(l!==null){var O=l.memoizedProps;if($p(O,b)&&l.ref===d.ref)if(Kn=!1,d.pendingProps=b=O,jE(l,S))(l.flags&131072)!==0&&(Kn=!0);else return d.lanes=l.lanes,Go(l,d,S)}return xE(l,d,g,b,S)}function xR(l,d,g){var b=d.pendingProps,S=b.children,O=(d.stateNode._pendingVisibility&2)!==0,U=l!==null?l.memoizedState:null;if(qp(l,d),b.mode==="hidden"||O){if((d.flags&128)!==0){if(b=U!==null?U.baseLanes|g:g,l!==null){for(S=d.child=l.child,O=0;S!==null;)O=O|S.lanes|S.childLanes,S=S.sibling;d.childLanes=O&~b}else d.childLanes=0,d.child=null;return wR(l,d,b,g)}if((g&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},l!==null&&k0(d,U!==null?U.cachePool:null),U!==null?S4(d,U):XS(),E4(d);else return d.lanes=d.childLanes=536870912,wR(l,d,U!==null?U.baseLanes|g:g,g)}else U!==null?(k0(d,U.cachePool),S4(d,U),fl(),d.memoizedState=null):(l!==null&&k0(d,null),XS(),fl());return lr(l,d,S,g),d.child}function wR(l,d,g,b){var S=eE();return S=S===null?null:{parent:zn._currentValue,pool:S},d.memoizedState={baseLanes:g,cachePool:S},l!==null&&k0(d,null),XS(),E4(d),l!==null&&Hp(l,d,b,!0),null}function qp(l,d){var g=d.ref;if(g===null)l!==null&&l.ref!==null&&(d.flags|=2097664);else{if(typeof g!="function"&&typeof g!="object")throw Error(r(284));(l===null||l.ref!==g)&&(d.flags|=2097664)}}function xE(l,d,g,b,S){return ou(d),g=nE(l,d,g,b,void 0,S),b=rE(),l!==null&&!Kn?(sE(l,d,S),Go(l,d,S)):(It&&b&&WS(d),d.flags|=1,lr(l,d,g,S),d.child)}function SR(l,d,g,b,S,O){return ou(d),d.updateQueue=null,g=j4(d,b,g,S),O4(l),b=rE(),l!==null&&!Kn?(sE(l,d,O),Go(l,d,O)):(It&&b&&WS(d),d.flags|=1,lr(l,d,g,O),d.child)}function ER(l,d,g,b,S){if(ou(d),d.stateNode===null){var O=Vd,U=g.contextType;typeof U=="object"&&U!==null&&(O=mr(U)),O=new g(b,O),d.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=bE,d.stateNode=O,O._reactInternals=d,O=d.stateNode,O.props=b,O.state=d.memoizedState,O.refs={},RE(d),U=g.contextType,O.context=typeof U=="object"&&U!==null?mr(U):Vd,O.state=d.memoizedState,U=g.getDerivedStateFromProps,typeof U=="function"&&(yE(d,g,U,b),O.state=d.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(U=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),U!==O.state&&bE.enqueueReplaceState(O,O.state,null),Yp(d,b,O,S),Gp(),O.state=d.memoizedState),typeof O.componentDidMount=="function"&&(d.flags|=4194308),b=!0}else if(l===null){O=d.stateNode;var Y=d.memoizedProps,Z=su(g,Y);O.props=Z;var le=O.context,Ee=g.contextType;U=Vd,typeof Ee=="object"&&Ee!==null&&(U=mr(Ee));var je=g.getDerivedStateFromProps;Ee=typeof je=="function"||typeof O.getSnapshotBeforeUpdate=="function",Y=d.pendingProps!==Y,Ee||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(Y||le!==U)&&cR(d,O,b,U),gl=!1;var ge=d.memoizedState;O.state=ge,Yp(d,b,O,S),Gp(),le=d.memoizedState,Y||ge!==le||gl?(typeof je=="function"&&(yE(d,g,je,b),le=d.memoizedState),(Z=gl||lR(d,g,Z,b,ge,le,U))?(Ee||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(d.flags|=4194308)):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=b,d.memoizedState=le),O.props=b,O.state=le,O.context=U,b=Z):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),b=!1)}else{O=d.stateNode,ME(l,d),U=d.memoizedProps,Ee=su(g,U),O.props=Ee,je=d.pendingProps,ge=O.context,le=g.contextType,Z=Vd,typeof le=="object"&&le!==null&&(Z=mr(le)),Y=g.getDerivedStateFromProps,(le=typeof Y=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(U!==je||ge!==Z)&&cR(d,O,b,Z),gl=!1,ge=d.memoizedState,O.state=ge,Yp(d,b,O,S),Gp();var we=d.memoizedState;U!==je||ge!==we||gl||l!==null&&l.dependencies!==null&&H0(l.dependencies)?(typeof Y=="function"&&(yE(d,g,Y,b),we=d.memoizedState),(Ee=gl||lR(d,g,Ee,b,ge,we,Z)||l!==null&&l.dependencies!==null&&H0(l.dependencies))?(le||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(b,we,Z),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(b,we,Z)),typeof O.componentDidUpdate=="function"&&(d.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof O.componentDidUpdate!="function"||U===l.memoizedProps&&ge===l.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||U===l.memoizedProps&&ge===l.memoizedState||(d.flags|=1024),d.memoizedProps=b,d.memoizedState=we),O.props=b,O.state=we,O.context=Z,b=Ee):(typeof O.componentDidUpdate!="function"||U===l.memoizedProps&&ge===l.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||U===l.memoizedProps&&ge===l.memoizedState||(d.flags|=1024),b=!1)}return O=b,qp(l,d),b=(d.flags&128)!==0,O||b?(O=d.stateNode,g=b&&typeof g.getDerivedStateFromError!="function"?null:O.render(),d.flags|=1,l!==null&&b?(d.child=Zc(d,l.child,null,S),d.child=Zc(d,null,g,S)):lr(l,d,g,S),d.memoizedState=O.state,l=d.child):l=Go(l,d,S),l}function NR(l,d,g,b){return Mp(),d.flags|=256,lr(l,d,g,b),d.child}var wE={dehydrated:null,treeContext:null,retryLane:0};function SE(l){return{baseLanes:l,cachePool:C4()}}function EE(l,d,g){return l=l!==null?l.childLanes&~g:0,d&&(l|=qs),l}function _R(l,d,g){var b=d.pendingProps,S=!1,O=(d.flags&128)!==0,U;if((U=O)||(U=l!==null&&l.memoizedState===null?!1:(Bn.current&2)!==0),U&&(S=!0,d.flags&=-129),U=(d.flags&32)!==0,d.flags&=-33,l===null){if(It){if(S?dl(d):fl(),It){var Y=ar,Z;if(Z=Y){e:{for(Z=Y,Y=so;Z.nodeType!==8;){if(!Y){Y=null;break e}if(Z=Ni(Z.nextSibling),Z===null){Y=null;break e}}Y=Z}Y!==null?(d.memoizedState={dehydrated:Y,treeContext:Xc!==null?{id:Uo,overflow:qo}:null,retryLane:536870912},Z=Us(18,null,null,0),Z.stateNode=Y,Z.return=d,d.child=Z,_r=d,ar=null,Z=!0):Z=!1}Z||Qc(d)}if(Y=d.memoizedState,Y!==null&&(Y=Y.dehydrated,Y!==null))return Y.data==="$!"?d.lanes=16:d.lanes=536870912,null;Ho(d)}return Y=b.children,b=b.fallback,S?(fl(),S=d.mode,Y=_E({mode:"hidden",children:Y},S),b=lu(b,S,g,null),Y.return=d,b.return=d,Y.sibling=b,d.child=Y,S=d.child,S.memoizedState=SE(g),S.childLanes=EE(l,U,g),d.memoizedState=wE,b):(dl(d),NE(d,Y))}if(Z=l.memoizedState,Z!==null&&(Y=Z.dehydrated,Y!==null)){if(O)d.flags&256?(dl(d),d.flags&=-257,d=CE(l,d,g)):d.memoizedState!==null?(fl(),d.child=l.child,d.flags|=128,d=null):(fl(),S=b.fallback,Y=d.mode,b=_E({mode:"visible",children:b.children},Y),S=lu(S,Y,g,null),S.flags|=2,b.return=d,S.return=d,b.sibling=S,d.child=b,Zc(d,l.child,null,g),b=d.child,b.memoizedState=SE(g),b.childLanes=EE(l,U,g),d.memoizedState=wE,d=S);else if(dl(d),Y.data==="$!"){if(U=Y.nextSibling&&Y.nextSibling.dataset,U)var le=U.dgst;U=le,b=Error(r(419)),b.stack="",b.digest=U,kp({value:b,source:null,stack:null}),d=CE(l,d,g)}else if(Kn||Hp(l,d,g,!1),U=(g&l.childLanes)!==0,Kn||U){if(U=en,U!==null){if(b=g&-g,(b&42)!==0)b=1;else switch(b){case 2:b=1;break;case 8:b=4;break;case 32:b=16;break;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:b=64;break;case 268435456:b=134217728;break;default:b=0}if(b=(b&(U.suspendedLanes|g))!==0?0:b,b!==0&&b!==Z.retryLane)throw Z.retryLane=b,ul(l,b),Cr(U,l,b),gR}Y.data==="$?"||e2(),d=CE(l,d,g)}else Y.data==="$?"?(d.flags|=128,d.child=l.child,d=KJ.bind(null,l),Y._reactRetry=d,d=null):(l=Z.treeContext,ar=Ni(Y.nextSibling),_r=d,It=!0,Si=null,so=!1,l!==null&&(Ls[Fs++]=Uo,Ls[Fs++]=qo,Ls[Fs++]=Xc,Uo=l.id,qo=l.overflow,Xc=d),d=NE(d,b.children),d.flags|=4096);return d}return S?(fl(),S=b.fallback,Y=d.mode,Z=l.child,le=Z.sibling,b=Sl(Z,{mode:"hidden",children:b.children}),b.subtreeFlags=Z.subtreeFlags&31457280,le!==null?S=Sl(le,S):(S=lu(S,Y,g,null),S.flags|=2),S.return=d,b.return=d,b.sibling=S,d.child=b,b=S,S=d.child,Y=l.child.memoizedState,Y===null?Y=SE(g):(Z=Y.cachePool,Z!==null?(le=zn._currentValue,Z=Z.parent!==le?{parent:le,pool:le}:Z):Z=C4(),Y={baseLanes:Y.baseLanes|g,cachePool:Z}),S.memoizedState=Y,S.childLanes=EE(l,U,g),d.memoizedState=wE,b):(dl(d),g=l.child,l=g.sibling,g=Sl(g,{mode:"visible",children:b.children}),g.return=d,g.sibling=null,l!==null&&(U=d.deletions,U===null?(d.deletions=[l],d.flags|=16):U.push(l)),d.child=g,d.memoizedState=null,g)}function NE(l,d){return d=_E({mode:"visible",children:d},l.mode),d.return=l,l.child=d}function _E(l,d){return KR(l,d,0,null)}function CE(l,d,g){return Zc(d,l.child,null,g),l=NE(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function CR(l,d,g){l.lanes|=d;var b=l.alternate;b!==null&&(b.lanes|=d),$E(l.return,d,g)}function OE(l,d,g,b,S){var O=l.memoizedState;O===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:b,tail:g,tailMode:S}:(O.isBackwards=d,O.rendering=null,O.renderingStartTime=0,O.last=b,O.tail=g,O.tailMode=S)}function OR(l,d,g){var b=d.pendingProps,S=b.revealOrder,O=b.tail;if(lr(l,d,b.children,g),b=Bn.current,(b&2)!==0)b=b&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&CR(l,g,d);else if(l.tag===19)CR(l,g,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}b&=1}switch(Se(Bn,b),S){case"forwards":for(g=d.child,S=null;g!==null;)l=g.alternate,l!==null&&M0(l)===null&&(S=g),g=g.sibling;g=S,g===null?(S=d.child,d.child=null):(S=g.sibling,g.sibling=null),OE(d,!1,S,g,O);break;case"backwards":for(g=null,S=d.child,d.child=null;S!==null;){if(l=S.alternate,l!==null&&M0(l)===null){d.child=S;break}l=S.sibling,S.sibling=g,g=S,S=l}OE(d,!0,g,null,O);break;case"together":OE(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Go(l,d,g){if(l!==null&&(d.dependencies=l.dependencies),El|=d.lanes,(g&d.childLanes)===0)if(l!==null){if(Hp(l,d,g,!1),(g&d.childLanes)===0)return null}else return null;if(l!==null&&d.child!==l.child)throw Error(r(153));if(d.child!==null){for(l=d.child,g=Sl(l,l.pendingProps),d.child=g,g.return=d;l.sibling!==null;)l=l.sibling,g=g.sibling=Sl(l,l.pendingProps),g.return=d;g.sibling=null}return d.child}function jE(l,d){return(l.lanes&d)!==0?!0:(l=l.dependencies,!!(l!==null&&H0(l)))}function PJ(l,d,g){switch(d.tag){case 3:Ve(d,d.stateNode.containerInfo),ml(d,zn,l.memoizedState.cache),Mp();break;case 27:case 5:$e(d);break;case 4:Ve(d,d.stateNode.containerInfo);break;case 10:ml(d,d.type,d.memoizedProps.value);break;case 13:var b=d.memoizedState;if(b!==null)return b.dehydrated!==null?(dl(d),d.flags|=128,null):(g&d.child.childLanes)!==0?_R(l,d,g):(dl(d),l=Go(l,d,g),l!==null?l.sibling:null);dl(d);break;case 19:var S=(l.flags&128)!==0;if(b=(g&d.childLanes)!==0,b||(Hp(l,d,g,!1),b=(g&d.childLanes)!==0),S){if(b)return OR(l,d,g);d.flags|=128}if(S=d.memoizedState,S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),Se(Bn,Bn.current),b)break;return null;case 22:case 23:return d.lanes=0,xR(l,d,g);case 24:ml(d,zn,l.memoizedState.cache)}return Go(l,d,g)}function jR(l,d,g){if(l!==null)if(l.memoizedProps!==d.pendingProps)Kn=!0;else{if(!jE(l,g)&&(d.flags&128)===0)return Kn=!1,PJ(l,d,g);Kn=(l.flags&131072)!==0}else Kn=!1,It&&(d.flags&1048576)!==0&&f4(d,j0,d.index);switch(d.lanes=0,d.tag){case 16:e:{l=d.pendingProps;var b=d.elementType,S=b._init;if(b=S(b._payload),d.type=b,typeof b=="function")VE(b)?(l=su(b,l),d.tag=1,d=ER(null,d,b,l,g)):(d.tag=0,d=xE(null,d,b,l,g));else{if(b!=null){if(S=b.$$typeof,S===v){d.tag=11,d=yR(null,d,b,l,g);break e}else if(S===N){d.tag=14,d=bR(null,d,b,l,g);break e}}throw d=M(b)||b,Error(r(306,d,""))}}return d;case 0:return xE(l,d,d.type,d.pendingProps,g);case 1:return b=d.type,S=su(b,d.pendingProps),ER(l,d,b,S,g);case 3:e:{if(Ve(d,d.stateNode.containerInfo),l===null)throw Error(r(387));var O=d.pendingProps;S=d.memoizedState,b=S.element,ME(l,d),Yp(d,O,null,g);var U=d.memoizedState;if(O=U.cache,ml(d,zn,O),O!==S.cache&&TE(d,[zn],g,!0),Gp(),O=U.element,S.isDehydrated)if(S={element:O,isDehydrated:!1,cache:U.cache},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){d=NR(l,d,O,g);break e}else if(O!==b){b=Ps(Error(r(424)),d),kp(b),d=NR(l,d,O,g);break e}else for(ar=Ni(d.stateNode.containerInfo.firstChild),_r=d,It=!0,Si=null,so=!0,g=w4(d,null,O,g),d.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Mp(),O===b){d=Go(l,d,g);break e}lr(l,d,O,g)}d=d.child}return d;case 26:return qp(l,d),l===null?(g=T3(d.type,null,d.pendingProps,null))?d.memoizedState=g:It||(g=d.type,l=d.pendingProps,b=ab(Ce.current).createElement(g),b[Tn]=d,b[Jn]=l,cr(b,g,l),Rn(b),d.stateNode=b):d.memoizedState=T3(d.type,l.memoizedProps,d.pendingProps,l.memoizedState),null;case 27:return $e(d),l===null&&It&&(b=d.stateNode=j3(d.type,d.pendingProps,Ce.current),_r=d,so=!0,ar=Ni(b.firstChild)),b=d.pendingProps.children,l!==null||It?lr(l,d,b,g):d.child=Zc(d,null,b,g),qp(l,d),d.child;case 5:return l===null&&It&&((S=b=ar)&&(b=hX(b,d.type,d.pendingProps,so),b!==null?(d.stateNode=b,_r=d,ar=Ni(b.firstChild),so=!1,S=!0):S=!1),S||Qc(d)),$e(d),S=d.type,O=d.pendingProps,U=l!==null?l.memoizedProps:null,b=O.children,p2(S,O)?b=null:U!==null&&p2(S,U)&&(d.flags|=32),d.memoizedState!==null&&(S=nE(l,d,$J,null,null,g),cm._currentValue=S),qp(l,d),lr(l,d,b,g),d.child;case 6:return l===null&&It&&((l=g=ar)&&(g=pX(g,d.pendingProps,so),g!==null?(d.stateNode=g,_r=d,ar=null,l=!0):l=!1),l||Qc(d)),null;case 13:return _R(l,d,g);case 4:return Ve(d,d.stateNode.containerInfo),b=d.pendingProps,l===null?d.child=Zc(d,null,b,g):lr(l,d,b,g),d.child;case 11:return yR(l,d,d.type,d.pendingProps,g);case 7:return lr(l,d,d.pendingProps,g),d.child;case 8:return lr(l,d,d.pendingProps.children,g),d.child;case 12:return lr(l,d,d.pendingProps.children,g),d.child;case 10:return b=d.pendingProps,ml(d,d.type,b.value),lr(l,d,b.children,g),d.child;case 9:return S=d.type._context,b=d.pendingProps.children,ou(d),S=mr(S),b=b(S),d.flags|=1,lr(l,d,b,g),d.child;case 14:return bR(l,d,d.type,d.pendingProps,g);case 15:return vR(l,d,d.type,d.pendingProps,g);case 19:return OR(l,d,g);case 22:return xR(l,d,g);case 24:return ou(d),b=mr(zn),l===null?(S=eE(),S===null&&(S=en,O=QS(),S.pooledCache=O,O.refCount++,O!==null&&(S.pooledCacheLanes|=g),S=O),d.memoizedState={parent:b,cache:S},RE(d),ml(d,zn,S)):((l.lanes&g)!==0&&(ME(l,d),Yp(d,null,null,g),Gp()),S=l.memoizedState,O=d.memoizedState,S.parent!==b?(S={parent:b,cache:b},d.memoizedState=S,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=S),ml(d,zn,b)):(b=O.cache,ml(d,zn,b),b!==S.cache&&TE(d,[zn],g,!0))),lr(l,d,d.pendingProps.children,g),d.child;case 29:throw d.pendingProps}throw Error(r(156,d.tag))}var AE=ue(null),iu=null,Yo=null;function ml(l,d,g){Se(AE,d._currentValue),d._currentValue=g}function Jo(l){l._currentValue=AE.current,ve(AE)}function $E(l,d,g){for(;l!==null;){var b=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,b!==null&&(b.childLanes|=d)):b!==null&&(b.childLanes&d)!==d&&(b.childLanes|=d),l===g)break;l=l.return}}function TE(l,d,g,b){var S=l.child;for(S!==null&&(S.return=l);S!==null;){var O=S.dependencies;if(O!==null){var U=S.child;O=O.firstContext;e:for(;O!==null;){var Y=O;O=S;for(var Z=0;Z<d.length;Z++)if(Y.context===d[Z]){O.lanes|=g,Y=O.alternate,Y!==null&&(Y.lanes|=g),$E(O.return,g,l),b||(U=null);break e}O=Y.next}}else if(S.tag===18){if(U=S.return,U===null)throw Error(r(341));U.lanes|=g,O=U.alternate,O!==null&&(O.lanes|=g),$E(U,g,l),U=null}else U=S.child;if(U!==null)U.return=S;else for(U=S;U!==null;){if(U===l){U=null;break}if(S=U.sibling,S!==null){S.return=U.return,U=S;break}U=U.return}S=U}}function Hp(l,d,g,b){l=null;for(var S=d,O=!1;S!==null;){if(!O){if((S.flags&524288)!==0)O=!0;else if((S.flags&262144)!==0)break}if(S.tag===10){var U=S.alternate;if(U===null)throw Error(r(387));if(U=U.memoizedProps,U!==null){var Y=S.type;us(S.pendingProps.value,U.value)||(l!==null?l.push(Y):l=[Y])}}else if(S===Me.current){if(U=S.alternate,U===null)throw Error(r(387));U.memoizedState.memoizedState!==S.memoizedState.memoizedState&&(l!==null?l.push(cm):l=[cm])}S=S.return}l!==null&&TE(d,l,g,b),d.flags|=262144}function H0(l){for(l=l.firstContext;l!==null;){if(!us(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function ou(l){iu=l,Yo=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function mr(l){return AR(iu,l)}function W0(l,d){return iu===null&&ou(l),AR(l,d)}function AR(l,d){var g=d._currentValue;if(d={context:d,memoizedValue:g,next:null},Yo===null){if(l===null)throw Error(r(308));Yo=d,l.dependencies={lanes:0,firstContext:d},l.flags|=524288}else Yo=Yo.next=d;return g}var gl=!1;function RE(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ME(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function yl(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function bl(l,d,g){var b=l.updateQueue;if(b===null)return null;if(b=b.shared,(gn&2)!==0){var S=b.pending;return S===null?d.next=d:(d.next=S.next,S.next=d),b.pending=d,d=C0(l),u4(l,null,g),d}return _0(l,b,d,g),C0(l)}function Wp(l,d,g){if(d=d.updateQueue,d!==null&&(d=d.shared,(g&4194176)!==0)){var b=d.lanes;b&=l.pendingLanes,g|=b,d.lanes=g,Vc(l,g)}}function kE(l,d){var g=l.updateQueue,b=l.alternate;if(b!==null&&(b=b.updateQueue,g===b)){var S=null,O=null;if(g=g.firstBaseUpdate,g!==null){do{var U={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};O===null?S=O=U:O=O.next=U,g=g.next}while(g!==null);O===null?S=O=d:O=O.next=d}else S=O=d;g={baseState:b.baseState,firstBaseUpdate:S,lastBaseUpdate:O,shared:b.shared,callbacks:b.callbacks},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=d:l.next=d,g.lastBaseUpdate=d}var IE=!1;function Gp(){if(IE){var l=Yd;if(l!==null)throw l}}function Yp(l,d,g,b){IE=!1;var S=l.updateQueue;gl=!1;var O=S.firstBaseUpdate,U=S.lastBaseUpdate,Y=S.shared.pending;if(Y!==null){S.shared.pending=null;var Z=Y,le=Z.next;Z.next=null,U===null?O=le:U.next=le,U=Z;var Ee=l.alternate;Ee!==null&&(Ee=Ee.updateQueue,Y=Ee.lastBaseUpdate,Y!==U&&(Y===null?Ee.firstBaseUpdate=le:Y.next=le,Ee.lastBaseUpdate=Z))}if(O!==null){var je=S.baseState;U=0,Ee=le=Z=null,Y=O;do{var ge=Y.lane&-536870913,we=ge!==Y.lane;if(we?(Ct&ge)===ge:(b&ge)===ge){ge!==0&&ge===Gd&&(IE=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var Ze=l,ft=Y;ge=d;var Sn=g;switch(ft.tag){case 1:if(Ze=ft.payload,typeof Ze=="function"){je=Ze.call(Sn,je,ge);break e}je=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=ft.payload,ge=typeof Ze=="function"?Ze.call(Sn,je,ge):Ze,ge==null)break e;je=P({},je,ge);break e;case 2:gl=!0}}ge=Y.callback,ge!==null&&(l.flags|=64,we&&(l.flags|=8192),we=S.callbacks,we===null?S.callbacks=[ge]:we.push(ge))}else we={lane:ge,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},Ee===null?(le=Ee=we,Z=je):Ee=Ee.next=we,U|=ge;if(Y=Y.next,Y===null){if(Y=S.shared.pending,Y===null)break;we=Y,Y=we.next,we.next=null,S.lastBaseUpdate=we,S.shared.pending=null}}while(!0);Ee===null&&(Z=je),S.baseState=Z,S.firstBaseUpdate=le,S.lastBaseUpdate=Ee,O===null&&(S.shared.lanes=0),El|=U,l.lanes=U,l.memoizedState=je}}function $R(l,d){if(typeof l!="function")throw Error(r(191,l));l.call(d)}function TR(l,d){var g=l.callbacks;if(g!==null)for(l.callbacks=null,l=0;l<g.length;l++)$R(g[l],d)}function Jp(l,d){try{var g=d.updateQueue,b=g!==null?g.lastEffect:null;if(b!==null){var S=b.next;g=S;do{if((g.tag&l)===l){b=void 0;var O=g.create,U=g.inst;b=O(),U.destroy=b}g=g.next}while(g!==S)}}catch(Y){Xt(d,d.return,Y)}}function vl(l,d,g){try{var b=d.updateQueue,S=b!==null?b.lastEffect:null;if(S!==null){var O=S.next;b=O;do{if((b.tag&l)===l){var U=b.inst,Y=U.destroy;if(Y!==void 0){U.destroy=void 0,S=d;var Z=g;try{Y()}catch(le){Xt(S,Z,le)}}}b=b.next}while(b!==O)}}catch(le){Xt(d,d.return,le)}}function RR(l){var d=l.updateQueue;if(d!==null){var g=l.stateNode;try{TR(d,g)}catch(b){Xt(l,l.return,b)}}}function MR(l,d,g){g.props=su(l.type,l.memoizedProps),g.state=l.memoizedState;try{g.componentWillUnmount()}catch(b){Xt(l,d,b)}}function au(l,d){try{var g=l.ref;if(g!==null){var b=l.stateNode;switch(l.tag){case 26:case 27:case 5:var S=b;break;default:S=b}typeof g=="function"?l.refCleanup=g(S):g.current=S}}catch(O){Xt(l,d,O)}}function ds(l,d){var g=l.ref,b=l.refCleanup;if(g!==null)if(typeof b=="function")try{b()}catch(S){Xt(l,d,S)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(S){Xt(l,d,S)}else g.current=null}function kR(l){var d=l.type,g=l.memoizedProps,b=l.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":g.autoFocus&&b.focus();break e;case"img":g.src?b.src=g.src:g.srcSet&&(b.srcset=g.srcSet)}}catch(S){Xt(l,l.return,S)}}function IR(l,d,g){try{var b=l.stateNode;lX(b,l.type,g,d),b[Jn]=d}catch(S){Xt(l,l.return,S)}}function DR(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27||l.tag===4}function DE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||DR(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==27&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function PE(l,d,g){var b=l.tag;if(b===5||b===6)l=l.stateNode,d?g.nodeType===8?g.parentNode.insertBefore(l,d):g.insertBefore(l,d):(g.nodeType===8?(d=g.parentNode,d.insertBefore(l,g)):(d=g,d.appendChild(l)),g=g._reactRootContainer,g!=null||d.onclick!==null||(d.onclick=ob));else if(b!==4&&b!==27&&(l=l.child,l!==null))for(PE(l,d,g),l=l.sibling;l!==null;)PE(l,d,g),l=l.sibling}function G0(l,d,g){var b=l.tag;if(b===5||b===6)l=l.stateNode,d?g.insertBefore(l,d):g.appendChild(l);else if(b!==4&&b!==27&&(l=l.child,l!==null))for(G0(l,d,g),l=l.sibling;l!==null;)G0(l,d,g),l=l.sibling}var Xo=!1,xn=!1,LE=!1,PR=typeof WeakSet=="function"?WeakSet:Set,Qn=null,LR=!1;function LJ(l,d){if(l=l.containerInfo,f2=hb,l=t4(l),BS(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var b=g.getSelection&&g.getSelection();if(b&&b.rangeCount!==0){g=b.anchorNode;var S=b.anchorOffset,O=b.focusNode;b=b.focusOffset;try{g.nodeType,O.nodeType}catch{g=null;break e}var U=0,Y=-1,Z=-1,le=0,Ee=0,je=l,ge=null;t:for(;;){for(var we;je!==g||S!==0&&je.nodeType!==3||(Y=U+S),je!==O||b!==0&&je.nodeType!==3||(Z=U+b),je.nodeType===3&&(U+=je.nodeValue.length),(we=je.firstChild)!==null;)ge=je,je=we;for(;;){if(je===l)break t;if(ge===g&&++le===S&&(Y=U),ge===O&&++Ee===b&&(Z=U),(we=je.nextSibling)!==null)break;je=ge,ge=je.parentNode}je=we}g=Y===-1||Z===-1?null:{start:Y,end:Z}}else g=null}g=g||{start:0,end:0}}else g=null;for(h2={focusedElem:l,selectionRange:g},hb=!1,Qn=d;Qn!==null;)if(d=Qn,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Qn=l;else for(;Qn!==null;){switch(d=Qn,O=d.alternate,l=d.flags,d.tag){case 0:break;case 11:case 15:break;case 1:if((l&1024)!==0&&O!==null){l=void 0,g=d,S=O.memoizedProps,O=O.memoizedState,b=g.stateNode;try{var Ze=su(g.type,S,g.elementType===g.type);l=b.getSnapshotBeforeUpdate(Ze,O),b.__reactInternalSnapshotBeforeUpdate=l}catch(ft){Xt(g,g.return,ft)}}break;case 3:if((l&1024)!==0){if(l=d.stateNode.containerInfo,g=l.nodeType,g===9)y2(l);else if(g===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":y2(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(r(163))}if(l=d.sibling,l!==null){l.return=d.return,Qn=l;break}Qn=d.return}return Ze=LR,LR=!1,Ze}function FR(l,d,g){var b=g.flags;switch(g.tag){case 0:case 11:case 15:Qo(l,g),b&4&&Jp(5,g);break;case 1:if(Qo(l,g),b&4)if(l=g.stateNode,d===null)try{l.componentDidMount()}catch(Y){Xt(g,g.return,Y)}else{var S=su(g.type,d.memoizedProps);d=d.memoizedState;try{l.componentDidUpdate(S,d,l.__reactInternalSnapshotBeforeUpdate)}catch(Y){Xt(g,g.return,Y)}}b&64&&RR(g),b&512&&au(g,g.return);break;case 3:if(Qo(l,g),b&64&&(b=g.updateQueue,b!==null)){if(l=null,g.child!==null)switch(g.child.tag){case 27:case 5:l=g.child.stateNode;break;case 1:l=g.child.stateNode}try{TR(b,l)}catch(Y){Xt(g,g.return,Y)}}break;case 26:Qo(l,g),b&512&&au(g,g.return);break;case 27:case 5:Qo(l,g),d===null&&b&4&&kR(g),b&512&&au(g,g.return);break;case 12:Qo(l,g);break;case 13:Qo(l,g),b&4&&VR(l,g);break;case 22:if(S=g.memoizedState!==null||Xo,!S){d=d!==null&&d.memoizedState!==null||xn;var O=Xo,U=xn;Xo=S,(xn=d)&&!U?xl(l,g,(g.subtreeFlags&8772)!==0):Qo(l,g),Xo=O,xn=U}b&512&&(g.memoizedProps.mode==="manual"?au(g,g.return):ds(g,g.return));break;default:Qo(l,g)}}function BR(l){var d=l.alternate;d!==null&&(l.alternate=null,BR(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&Sp(d)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var In=null,fs=!1;function Ko(l,d,g){for(g=g.child;g!==null;)zR(l,d,g),g=g.sibling}function zR(l,d,g){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(Ut,g)}catch{}switch(g.tag){case 26:xn||ds(g,d),Ko(l,d,g),g.memoizedState?g.memoizedState.count--:g.stateNode&&(g=g.stateNode,g.parentNode.removeChild(g));break;case 27:xn||ds(g,d);var b=In,S=fs;for(In=g.stateNode,Ko(l,d,g),g=g.stateNode,d=g.attributes;d.length;)g.removeAttributeNode(d[0]);Sp(g),In=b,fs=S;break;case 5:xn||ds(g,d);case 6:S=In;var O=fs;if(In=null,Ko(l,d,g),In=S,fs=O,In!==null)if(fs)try{l=In,b=g.stateNode,l.nodeType===8?l.parentNode.removeChild(b):l.removeChild(b)}catch(U){Xt(g,d,U)}else try{In.removeChild(g.stateNode)}catch(U){Xt(g,d,U)}break;case 18:In!==null&&(fs?(d=In,g=g.stateNode,d.nodeType===8?g2(d.parentNode,g):d.nodeType===1&&g2(d,g),hm(d)):g2(In,g.stateNode));break;case 4:b=In,S=fs,In=g.stateNode.containerInfo,fs=!0,Ko(l,d,g),In=b,fs=S;break;case 0:case 11:case 14:case 15:xn||vl(2,g,d),xn||vl(4,g,d),Ko(l,d,g);break;case 1:xn||(ds(g,d),b=g.stateNode,typeof b.componentWillUnmount=="function"&&MR(g,d,b)),Ko(l,d,g);break;case 21:Ko(l,d,g);break;case 22:xn||ds(g,d),xn=(b=xn)||g.memoizedState!==null,Ko(l,d,g),xn=b;break;default:Ko(l,d,g)}}function VR(l,d){if(d.memoizedState===null&&(l=d.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{hm(l)}catch(g){Xt(d,d.return,g)}}function FJ(l){switch(l.tag){case 13:case 19:var d=l.stateNode;return d===null&&(d=l.stateNode=new PR),d;case 22:return l=l.stateNode,d=l._retryCache,d===null&&(d=l._retryCache=new PR),d;default:throw Error(r(435,l.tag))}}function FE(l,d){var g=FJ(l);d.forEach(function(b){var S=QJ.bind(null,l,b);g.has(b)||(g.add(b),b.then(S,S))})}function zs(l,d){var g=d.deletions;if(g!==null)for(var b=0;b<g.length;b++){var S=g[b],O=l,U=d,Y=U;e:for(;Y!==null;){switch(Y.tag){case 27:case 5:In=Y.stateNode,fs=!1;break e;case 3:In=Y.stateNode.containerInfo,fs=!0;break e;case 4:In=Y.stateNode.containerInfo,fs=!0;break e}Y=Y.return}if(In===null)throw Error(r(160));zR(O,U,S),In=null,fs=!1,O=S.alternate,O!==null&&(O.return=null),S.return=null}if(d.subtreeFlags&13878)for(d=d.child;d!==null;)UR(d,l),d=d.sibling}var Ei=null;function UR(l,d){var g=l.alternate,b=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:zs(d,l),Vs(l),b&4&&(vl(3,l,l.return),Jp(3,l),vl(5,l,l.return));break;case 1:zs(d,l),Vs(l),b&512&&(xn||g===null||ds(g,g.return)),b&64&&Xo&&(l=l.updateQueue,l!==null&&(b=l.callbacks,b!==null&&(g=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=g===null?b:g.concat(b))));break;case 26:var S=Ei;if(zs(d,l),Vs(l),b&512&&(xn||g===null||ds(g,g.return)),b&4){var O=g!==null?g.memoizedState:null;if(b=l.memoizedState,g===null)if(b===null)if(l.stateNode===null){e:{b=l.type,g=l.memoizedProps,S=S.ownerDocument||S;t:switch(b){case"title":O=S.getElementsByTagName("title")[0],(!O||O[Hc]||O[Tn]||O.namespaceURI==="http://www.w3.org/2000/svg"||O.hasAttribute("itemprop"))&&(O=S.createElement(b),S.head.insertBefore(O,S.querySelector("head > title"))),cr(O,b,g),O[Tn]=l,Rn(O),b=O;break e;case"link":var U=k3("link","href",S).get(b+(g.href||""));if(U){for(var Y=0;Y<U.length;Y++)if(O=U[Y],O.getAttribute("href")===(g.href==null?null:g.href)&&O.getAttribute("rel")===(g.rel==null?null:g.rel)&&O.getAttribute("title")===(g.title==null?null:g.title)&&O.getAttribute("crossorigin")===(g.crossOrigin==null?null:g.crossOrigin)){U.splice(Y,1);break t}}O=S.createElement(b),cr(O,b,g),S.head.appendChild(O);break;case"meta":if(U=k3("meta","content",S).get(b+(g.content||""))){for(Y=0;Y<U.length;Y++)if(O=U[Y],O.getAttribute("content")===(g.content==null?null:""+g.content)&&O.getAttribute("name")===(g.name==null?null:g.name)&&O.getAttribute("property")===(g.property==null?null:g.property)&&O.getAttribute("http-equiv")===(g.httpEquiv==null?null:g.httpEquiv)&&O.getAttribute("charset")===(g.charSet==null?null:g.charSet)){U.splice(Y,1);break t}}O=S.createElement(b),cr(O,b,g),S.head.appendChild(O);break;default:throw Error(r(468,b))}O[Tn]=l,Rn(O),b=O}l.stateNode=b}else I3(S,l.type,l.stateNode);else l.stateNode=M3(S,b,l.memoizedProps);else O!==b?(O===null?g.stateNode!==null&&(g=g.stateNode,g.parentNode.removeChild(g)):O.count--,b===null?I3(S,l.type,l.stateNode):M3(S,b,l.memoizedProps)):b===null&&l.stateNode!==null&&IR(l,l.memoizedProps,g.memoizedProps)}break;case 27:if(b&4&&l.alternate===null){S=l.stateNode,O=l.memoizedProps;try{for(var Z=S.firstChild;Z;){var le=Z.nextSibling,Ee=Z.nodeName;Z[Hc]||Ee==="HEAD"||Ee==="BODY"||Ee==="SCRIPT"||Ee==="STYLE"||Ee==="LINK"&&Z.rel.toLowerCase()==="stylesheet"||S.removeChild(Z),Z=le}for(var je=l.type,ge=S.attributes;ge.length;)S.removeAttributeNode(ge[0]);cr(S,je,O),S[Tn]=l,S[Jn]=O}catch(Ze){Xt(l,l.return,Ze)}}case 5:if(zs(d,l),Vs(l),b&512&&(xn||g===null||ds(g,g.return)),l.flags&32){S=l.stateNode;try{Id(S,"")}catch(Ze){Xt(l,l.return,Ze)}}b&4&&l.stateNode!=null&&(S=l.memoizedProps,IR(l,S,g!==null?g.memoizedProps:S)),b&1024&&(LE=!0);break;case 6:if(zs(d,l),Vs(l),b&4){if(l.stateNode===null)throw Error(r(162));b=l.memoizedProps,g=l.stateNode;try{g.nodeValue=b}catch(Ze){Xt(l,l.return,Ze)}}break;case 3:if(ub=null,S=Ei,Ei=lb(d.containerInfo),zs(d,l),Ei=S,Vs(l),b&4&&g!==null&&g.memoizedState.isDehydrated)try{hm(d.containerInfo)}catch(Ze){Xt(l,l.return,Ze)}LE&&(LE=!1,qR(l));break;case 4:b=Ei,Ei=lb(l.stateNode.containerInfo),zs(d,l),Vs(l),Ei=b;break;case 12:zs(d,l),Vs(l);break;case 13:zs(d,l),Vs(l),l.child.flags&8192&&l.memoizedState!==null!=(g!==null&&g.memoizedState!==null)&&(YE=ie()),b&4&&(b=l.updateQueue,b!==null&&(l.updateQueue=null,FE(l,b)));break;case 22:if(b&512&&(xn||g===null||ds(g,g.return)),Z=l.memoizedState!==null,le=g!==null&&g.memoizedState!==null,Ee=Xo,je=xn,Xo=Ee||Z,xn=je||le,zs(d,l),xn=je,Xo=Ee,Vs(l),d=l.stateNode,d._current=l,d._visibility&=-3,d._visibility|=d._pendingVisibility&2,b&8192&&(d._visibility=Z?d._visibility&-2:d._visibility|1,Z&&(d=Xo||xn,g===null||le||d||Qd(l)),l.memoizedProps===null||l.memoizedProps.mode!=="manual"))e:for(g=null,d=l;;){if(d.tag===5||d.tag===26||d.tag===27){if(g===null){le=g=d;try{if(S=le.stateNode,Z)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{U=le.stateNode,Y=le.memoizedProps.style;var we=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;U.style.display=we==null||typeof we=="boolean"?"":(""+we).trim()}}catch(Ze){Xt(le,le.return,Ze)}}}else if(d.tag===6){if(g===null){le=d;try{le.stateNode.nodeValue=Z?"":le.memoizedProps}catch(Ze){Xt(le,le.return,Ze)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===l)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break e;for(;d.sibling===null;){if(d.return===null||d.return===l)break e;g===d&&(g=null),d=d.return}g===d&&(g=null),d.sibling.return=d.return,d=d.sibling}b&4&&(b=l.updateQueue,b!==null&&(g=b.retryQueue,g!==null&&(b.retryQueue=null,FE(l,g))));break;case 19:zs(d,l),Vs(l),b&4&&(b=l.updateQueue,b!==null&&(l.updateQueue=null,FE(l,b)));break;case 21:break;default:zs(d,l),Vs(l)}}function Vs(l){var d=l.flags;if(d&2){try{if(l.tag!==27){e:{for(var g=l.return;g!==null;){if(DR(g)){var b=g;break e}g=g.return}throw Error(r(160))}switch(b.tag){case 27:var S=b.stateNode,O=DE(l);G0(l,O,S);break;case 5:var U=b.stateNode;b.flags&32&&(Id(U,""),b.flags&=-33);var Y=DE(l);G0(l,Y,U);break;case 3:case 4:var Z=b.stateNode.containerInfo,le=DE(l);PE(l,le,Z);break;default:throw Error(r(161))}}}catch(Ee){Xt(l,l.return,Ee)}l.flags&=-3}d&4096&&(l.flags&=-4097)}function qR(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var d=l;qR(d),d.tag===5&&d.flags&1024&&d.stateNode.reset(),l=l.sibling}}function Qo(l,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)FR(l,d.alternate,d),d=d.sibling}function Qd(l){for(l=l.child;l!==null;){var d=l;switch(d.tag){case 0:case 11:case 14:case 15:vl(4,d,d.return),Qd(d);break;case 1:ds(d,d.return);var g=d.stateNode;typeof g.componentWillUnmount=="function"&&MR(d,d.return,g),Qd(d);break;case 26:case 27:case 5:ds(d,d.return),Qd(d);break;case 22:ds(d,d.return),d.memoizedState===null&&Qd(d);break;default:Qd(d)}l=l.sibling}}function xl(l,d,g){for(g=g&&(d.subtreeFlags&8772)!==0,d=d.child;d!==null;){var b=d.alternate,S=l,O=d,U=O.flags;switch(O.tag){case 0:case 11:case 15:xl(S,O,g),Jp(4,O);break;case 1:if(xl(S,O,g),b=O,S=b.stateNode,typeof S.componentDidMount=="function")try{S.componentDidMount()}catch(le){Xt(b,b.return,le)}if(b=O,S=b.updateQueue,S!==null){var Y=b.stateNode;try{var Z=S.shared.hiddenCallbacks;if(Z!==null)for(S.shared.hiddenCallbacks=null,S=0;S<Z.length;S++)$R(Z[S],Y)}catch(le){Xt(b,b.return,le)}}g&&U&64&&RR(O),au(O,O.return);break;case 26:case 27:case 5:xl(S,O,g),g&&b===null&&U&4&&kR(O),au(O,O.return);break;case 12:xl(S,O,g);break;case 13:xl(S,O,g),g&&U&4&&VR(S,O);break;case 22:O.memoizedState===null&&xl(S,O,g),au(O,O.return);break;default:xl(S,O,g)}d=d.sibling}}function BE(l,d){var g=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(g=l.memoizedState.cachePool.pool),l=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(l=d.memoizedState.cachePool.pool),l!==g&&(l!=null&&l.refCount++,g!=null&&Fp(g))}function zE(l,d){l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==l&&(d.refCount++,l!=null&&Fp(l))}function wl(l,d,g,b){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)HR(l,d,g,b),d=d.sibling}function HR(l,d,g,b){var S=d.flags;switch(d.tag){case 0:case 11:case 15:wl(l,d,g,b),S&2048&&Jp(9,d);break;case 3:wl(l,d,g,b),S&2048&&(l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==l&&(d.refCount++,l!=null&&Fp(l)));break;case 12:if(S&2048){wl(l,d,g,b),l=d.stateNode;try{var O=d.memoizedProps,U=O.id,Y=O.onPostCommit;typeof Y=="function"&&Y(U,d.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(Z){Xt(d,d.return,Z)}}else wl(l,d,g,b);break;case 23:break;case 22:O=d.stateNode,d.memoizedState!==null?O._visibility&4?wl(l,d,g,b):Xp(l,d):O._visibility&4?wl(l,d,g,b):(O._visibility|=4,Zd(l,d,g,b,(d.subtreeFlags&10256)!==0)),S&2048&&BE(d.alternate,d);break;case 24:wl(l,d,g,b),S&2048&&zE(d.alternate,d);break;default:wl(l,d,g,b)}}function Zd(l,d,g,b,S){for(S=S&&(d.subtreeFlags&10256)!==0,d=d.child;d!==null;){var O=l,U=d,Y=g,Z=b,le=U.flags;switch(U.tag){case 0:case 11:case 15:Zd(O,U,Y,Z,S),Jp(8,U);break;case 23:break;case 22:var Ee=U.stateNode;U.memoizedState!==null?Ee._visibility&4?Zd(O,U,Y,Z,S):Xp(O,U):(Ee._visibility|=4,Zd(O,U,Y,Z,S)),S&&le&2048&&BE(U.alternate,U);break;case 24:Zd(O,U,Y,Z,S),S&&le&2048&&zE(U.alternate,U);break;default:Zd(O,U,Y,Z,S)}d=d.sibling}}function Xp(l,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var g=l,b=d,S=b.flags;switch(b.tag){case 22:Xp(g,b),S&2048&&BE(b.alternate,b);break;case 24:Xp(g,b),S&2048&&zE(b.alternate,b);break;default:Xp(g,b)}d=d.sibling}}var Kp=8192;function ef(l){if(l.subtreeFlags&Kp)for(l=l.child;l!==null;)WR(l),l=l.sibling}function WR(l){switch(l.tag){case 26:ef(l),l.flags&Kp&&l.memoizedState!==null&&OX(Ei,l.memoizedState,l.memoizedProps);break;case 5:ef(l);break;case 3:case 4:var d=Ei;Ei=lb(l.stateNode.containerInfo),ef(l),Ei=d;break;case 22:l.memoizedState===null&&(d=l.alternate,d!==null&&d.memoizedState!==null?(d=Kp,Kp=16777216,ef(l),Kp=d):ef(l));break;default:ef(l)}}function GR(l){var d=l.alternate;if(d!==null&&(l=d.child,l!==null)){d.child=null;do d=l.sibling,l.sibling=null,l=d;while(l!==null)}}function Qp(l){var d=l.deletions;if((l.flags&16)!==0){if(d!==null)for(var g=0;g<d.length;g++){var b=d[g];Qn=b,JR(b,l)}GR(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)YR(l),l=l.sibling}function YR(l){switch(l.tag){case 0:case 11:case 15:Qp(l),l.flags&2048&&vl(9,l,l.return);break;case 3:Qp(l);break;case 12:Qp(l);break;case 22:var d=l.stateNode;l.memoizedState!==null&&d._visibility&4&&(l.return===null||l.return.tag!==13)?(d._visibility&=-5,Y0(l)):Qp(l);break;default:Qp(l)}}function Y0(l){var d=l.deletions;if((l.flags&16)!==0){if(d!==null)for(var g=0;g<d.length;g++){var b=d[g];Qn=b,JR(b,l)}GR(l)}for(l=l.child;l!==null;){switch(d=l,d.tag){case 0:case 11:case 15:vl(8,d,d.return),Y0(d);break;case 22:g=d.stateNode,g._visibility&4&&(g._visibility&=-5,Y0(d));break;default:Y0(d)}l=l.sibling}}function JR(l,d){for(;Qn!==null;){var g=Qn;switch(g.tag){case 0:case 11:case 15:vl(8,g,d);break;case 23:case 22:if(g.memoizedState!==null&&g.memoizedState.cachePool!==null){var b=g.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:Fp(g.memoizedState.cache)}if(b=g.child,b!==null)b.return=g,Qn=b;else e:for(g=l;Qn!==null;){b=Qn;var S=b.sibling,O=b.return;if(BR(b),b===g){Qn=null;break e}if(S!==null){S.return=O,Qn=S;break e}Qn=O}}}function BJ(l,d,g,b){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Us(l,d,g,b){return new BJ(l,d,g,b)}function VE(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Sl(l,d){var g=l.alternate;return g===null?(g=Us(l.tag,d,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=d,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&31457280,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,d=l.dependencies,g.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g.refCleanup=l.refCleanup,g}function XR(l,d){l.flags&=31457282;var g=l.alternate;return g===null?(l.childLanes=0,l.lanes=d,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=g.childLanes,l.lanes=g.lanes,l.child=g.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=g.memoizedProps,l.memoizedState=g.memoizedState,l.updateQueue=g.updateQueue,l.type=g.type,d=g.dependencies,l.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),l}function J0(l,d,g,b,S,O){var U=0;if(b=l,typeof l=="function")VE(l)&&(U=1);else if(typeof l=="string")U=_X(l,g,ke.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case c:return lu(g.children,S,O,d);case u:U=8,S|=24;break;case f:return l=Us(12,g,d,S|2),l.elementType=f,l.lanes=O,l;case x:return l=Us(13,g,d,S),l.elementType=x,l.lanes=O,l;case E:return l=Us(19,g,d,S),l.elementType=E,l.lanes=O,l;case C:return KR(g,S,O,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case h:case y:U=10;break e;case m:U=9;break e;case v:U=11;break e;case N:U=14;break e;case _:U=16,b=null;break e}U=29,g=Error(r(130,l===null?"null":typeof l,"")),b=null}return d=Us(U,g,d,S),d.elementType=l,d.type=b,d.lanes=O,d}function lu(l,d,g,b){return l=Us(7,l,b,d),l.lanes=g,l}function KR(l,d,g,b){l=Us(22,l,b,d),l.elementType=C,l.lanes=g;var S={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var O=S._current;if(O===null)throw Error(r(456));if((S._pendingVisibility&2)===0){var U=ul(O,2);U!==null&&(S._pendingVisibility|=2,Cr(U,O,2))}},attach:function(){var O=S._current;if(O===null)throw Error(r(456));if((S._pendingVisibility&2)!==0){var U=ul(O,2);U!==null&&(S._pendingVisibility&=-3,Cr(U,O,2))}}};return l.stateNode=S,l}function UE(l,d,g){return l=Us(6,l,null,d),l.lanes=g,l}function qE(l,d,g){return d=Us(4,l.children!==null?l.children:[],l.key,d),d.lanes=g,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function Zo(l){l.flags|=4}function QR(l,d){if(d.type!=="stylesheet"||(d.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!D3(d)){if(d=Bs.current,d!==null&&((Ct&4194176)===Ct?io!==null:(Ct&62914560)!==Ct&&(Ct&536870912)===0||d!==io))throw Dp=JS,m4;l.flags|=8192}}function X0(l,d){d!==null&&(l.flags|=4),l.flags&16384&&(d=l.tag!==22?dn():536870912,l.lanes|=d,nf|=d)}function Zp(l,d){if(!It)switch(l.tailMode){case"hidden":d=l.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?l.tail=null:g.sibling=null;break;case"collapsed":g=l.tail;for(var b=null;g!==null;)g.alternate!==null&&(b=g),g=g.sibling;b===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:b.sibling=null}}function mn(l){var d=l.alternate!==null&&l.alternate.child===l.child,g=0,b=0;if(d)for(var S=l.child;S!==null;)g|=S.lanes|S.childLanes,b|=S.subtreeFlags&31457280,b|=S.flags&31457280,S.return=l,S=S.sibling;else for(S=l.child;S!==null;)g|=S.lanes|S.childLanes,b|=S.subtreeFlags,b|=S.flags,S.return=l,S=S.sibling;return l.subtreeFlags|=b,l.childLanes=g,d}function zJ(l,d,g){var b=d.pendingProps;switch(GS(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(d),null;case 1:return mn(d),null;case 3:return g=d.stateNode,b=null,l!==null&&(b=l.memoizedState.cache),d.memoizedState.cache!==b&&(d.flags|=2048),Jo(zn),We(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(l===null||l.child===null)&&(Rp(d)?Zo(d):l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Si!==null&&(QE(Si),Si=null))),mn(d),null;case 26:return g=d.memoizedState,l===null?(Zo(d),g!==null?(mn(d),QR(d,g)):(mn(d),d.flags&=-16777217)):g?g!==l.memoizedState?(Zo(d),mn(d),QR(d,g)):(mn(d),d.flags&=-16777217):(l.memoizedProps!==b&&Zo(d),mn(d),d.flags&=-16777217),null;case 27:J(d),g=Ce.current;var S=d.type;if(l!==null&&d.stateNode!=null)l.memoizedProps!==b&&Zo(d);else{if(!b){if(d.stateNode===null)throw Error(r(166));return mn(d),null}l=ke.current,Rp(d)?h4(d):(l=j3(S,b,g),d.stateNode=l,Zo(d))}return mn(d),null;case 5:if(J(d),g=d.type,l!==null&&d.stateNode!=null)l.memoizedProps!==b&&Zo(d);else{if(!b){if(d.stateNode===null)throw Error(r(166));return mn(d),null}if(l=ke.current,Rp(d))h4(d);else{switch(S=ab(Ce.current),l){case 1:l=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:l=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":l=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":l=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":l=S.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof b.is=="string"?S.createElement("select",{is:b.is}):S.createElement("select"),b.multiple?l.multiple=!0:b.size&&(l.size=b.size);break;default:l=typeof b.is=="string"?S.createElement(g,{is:b.is}):S.createElement(g)}}l[Tn]=d,l[Jn]=b;e:for(S=d.child;S!==null;){if(S.tag===5||S.tag===6)l.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===d)break e;for(;S.sibling===null;){if(S.return===null||S.return===d)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}d.stateNode=l;e:switch(cr(l,g,b),g){case"button":case"input":case"select":case"textarea":l=!!b.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Zo(d)}}return mn(d),d.flags&=-16777217,null;case 6:if(l&&d.stateNode!=null)l.memoizedProps!==b&&Zo(d);else{if(typeof b!="string"&&d.stateNode===null)throw Error(r(166));if(l=Ce.current,Rp(d)){if(l=d.stateNode,g=d.memoizedProps,b=null,S=_r,S!==null)switch(S.tag){case 27:case 5:b=S.memoizedProps}l[Tn]=d,l=!!(l.nodeValue===g||b!==null&&b.suppressHydrationWarning===!0||S3(l.nodeValue,g)),l||Qc(d)}else l=ab(l).createTextNode(b),l[Tn]=d,d.stateNode=l}return mn(d),null;case 13:if(b=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(S=Rp(d),b!==null&&b.dehydrated!==null){if(l===null){if(!S)throw Error(r(318));if(S=d.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[Tn]=d}else Mp(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;mn(d),S=!1}else Si!==null&&(QE(Si),Si=null),S=!0;if(!S)return d.flags&256?(Ho(d),d):(Ho(d),null)}if(Ho(d),(d.flags&128)!==0)return d.lanes=g,d;if(g=b!==null,l=l!==null&&l.memoizedState!==null,g){b=d.child,S=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(S=b.alternate.memoizedState.cachePool.pool);var O=null;b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(O=b.memoizedState.cachePool.pool),O!==S&&(b.flags|=2048)}return g!==l&&g&&(d.child.flags|=8192),X0(d,d.updateQueue),mn(d),null;case 4:return We(),l===null&&c2(d.stateNode.containerInfo),mn(d),null;case 10:return Jo(d.type),mn(d),null;case 19:if(ve(Bn),S=d.memoizedState,S===null)return mn(d),null;if(b=(d.flags&128)!==0,O=S.rendering,O===null)if(b)Zp(S,!1);else{if(wn!==0||l!==null&&(l.flags&128)!==0)for(l=d.child;l!==null;){if(O=M0(l),O!==null){for(d.flags|=128,Zp(S,!1),l=O.updateQueue,d.updateQueue=l,X0(d,l),d.subtreeFlags=0,l=g,g=d.child;g!==null;)XR(g,l),g=g.sibling;return Se(Bn,Bn.current&1|2),d.child}l=l.sibling}S.tail!==null&&ie()>K0&&(d.flags|=128,b=!0,Zp(S,!1),d.lanes=4194304)}else{if(!b)if(l=M0(O),l!==null){if(d.flags|=128,b=!0,l=l.updateQueue,d.updateQueue=l,X0(d,l),Zp(S,!0),S.tail===null&&S.tailMode==="hidden"&&!O.alternate&&!It)return mn(d),null}else 2*ie()-S.renderingStartTime>K0&&g!==536870912&&(d.flags|=128,b=!0,Zp(S,!1),d.lanes=4194304);S.isBackwards?(O.sibling=d.child,d.child=O):(l=S.last,l!==null?l.sibling=O:d.child=O,S.last=O)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=ie(),d.sibling=null,l=Bn.current,Se(Bn,b?l&1|2:l&1),d):(mn(d),null);case 22:case 23:return Ho(d),KS(),b=d.memoizedState!==null,l!==null?l.memoizedState!==null!==b&&(d.flags|=8192):b&&(d.flags|=8192),b?(g&536870912)!==0&&(d.flags&128)===0&&(mn(d),d.subtreeFlags&6&&(d.flags|=8192)):mn(d),g=d.updateQueue,g!==null&&X0(d,g.retryQueue),g=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(g=l.memoizedState.cachePool.pool),b=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),b!==g&&(d.flags|=2048),l!==null&&ve(eu),null;case 24:return g=null,l!==null&&(g=l.memoizedState.cache),d.memoizedState.cache!==g&&(d.flags|=2048),Jo(zn),mn(d),null;case 25:return null}throw Error(r(156,d.tag))}function VJ(l,d){switch(GS(d),d.tag){case 1:return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Jo(zn),We(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 26:case 27:case 5:return J(d),null;case 13:if(Ho(d),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Mp()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return ve(Bn),null;case 4:return We(),null;case 10:return Jo(d.type),null;case 22:case 23:return Ho(d),KS(),l!==null&&ve(eu),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 24:return Jo(zn),null;case 25:return null;default:return null}}function ZR(l,d){switch(GS(d),d.tag){case 3:Jo(zn),We();break;case 26:case 27:case 5:J(d);break;case 4:We();break;case 13:Ho(d);break;case 19:ve(Bn);break;case 10:Jo(d.type);break;case 22:case 23:Ho(d),KS(),l!==null&&ve(eu);break;case 24:Jo(zn)}}var UJ={getCacheForType:function(l){var d=mr(zn),g=d.data.get(l);return g===void 0&&(g=l(),d.data.set(l,g)),g}},qJ=typeof WeakMap=="function"?WeakMap:Map,gn=0,en=null,wt=null,Ct=0,tn=0,hs=null,ea=!1,tf=!1,HE=!1,ta=0,wn=0,El=0,cu=0,WE=0,qs=0,nf=0,em=null,ao=null,GE=!1,YE=0,K0=1/0,Q0=null,Nl=null,Z0=!1,uu=null,tm=0,JE=0,XE=null,nm=0,KE=null;function ps(){if((gn&2)!==0&&Ct!==0)return Ct&-Ct;if(D.T!==null){var l=Gd;return l!==0?l:i2()}return qc()}function e3(){qs===0&&(qs=(Ct&536870912)===0||It?jd():536870912);var l=Bs.current;return l!==null&&(l.flags|=32),qs}function Cr(l,d,g){(l===en&&tn===2||l.cancelPendingCommit!==null)&&(rf(l,0),na(l,Ct,qs,!1)),Er(l,g),((gn&2)===0||l!==en)&&(l===en&&((gn&2)===0&&(cu|=g),wn===4&&na(l,Ct,qs,!1)),lo(l))}function t3(l,d,g){if((gn&6)!==0)throw Error(r(327));var b=!g&&(d&60)===0&&(d&l.expiredLanes)===0||rl(l,d),S=b?GJ(l,d):t2(l,d,!0),O=b;do{if(S===0){tf&&!b&&na(l,d,0,!1);break}else if(S===6)na(l,d,0,!ea);else{if(g=l.current.alternate,O&&!HJ(g)){S=t2(l,d,!1),O=!1;continue}if(S===2){if(O=d,l.errorRecoveryDisabledLanes&O)var U=0;else U=l.pendingLanes&-536870913,U=U!==0?U:U&536870912?536870912:0;if(U!==0){d=U;e:{var Y=l;S=em;var Z=Y.current.memoizedState.isDehydrated;if(Z&&(rf(Y,U).flags|=256),U=t2(Y,U,!1),U!==2){if(HE&&!Z){Y.errorRecoveryDisabledLanes|=O,cu|=O,S=4;break e}O=ao,ao=S,O!==null&&QE(O)}S=U}if(O=!1,S!==2)continue}}if(S===1){rf(l,0),na(l,d,0,!0);break}e:{switch(b=l,S){case 0:case 1:throw Error(r(345));case 4:if((d&4194176)===d){na(b,d,qs,!ea);break e}break;case 2:ao=null;break;case 3:case 5:break;default:throw Error(r(329))}if(b.finishedWork=g,b.finishedLanes=d,(d&62914560)===d&&(O=YE+300-ie(),10<O)){if(na(b,d,qs,!ea),Bo(b,0)!==0)break e;b.timeoutHandle=_3(n3.bind(null,b,g,ao,Q0,GE,d,qs,cu,nf,ea,2,-0,0),O);break e}n3(b,g,ao,Q0,GE,d,qs,cu,nf,ea,0,-0,0)}}break}while(!0);lo(l)}function QE(l){ao===null?ao=l:ao.push.apply(ao,l)}function n3(l,d,g,b,S,O,U,Y,Z,le,Ee,je,ge){var we=d.subtreeFlags;if((we&8192||(we&16785408)===16785408)&&(lm={stylesheets:null,count:0,unsuspend:CX},WR(d),d=jX(),d!==null)){l.cancelPendingCommit=d(c3.bind(null,l,g,b,S,U,Y,Z,1,je,ge)),na(l,O,U,!le);return}c3(l,g,b,S,U,Y,Z,Ee,je,ge)}function HJ(l){for(var d=l;;){var g=d.tag;if((g===0||g===11||g===15)&&d.flags&16384&&(g=d.updateQueue,g!==null&&(g=g.stores,g!==null)))for(var b=0;b<g.length;b++){var S=g[b],O=S.getSnapshot;S=S.value;try{if(!us(O(),S))return!1}catch{return!1}}if(g=d.child,d.subtreeFlags&16384&&g!==null)g.return=d,d=g;else{if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function na(l,d,g,b){d&=~WE,d&=~cu,l.suspendedLanes|=d,l.pingedLanes&=~d,b&&(l.warmLanes|=d),b=l.expirationTimes;for(var S=d;0<S;){var O=31-Gn(S),U=1<<O;b[O]=-1,S&=~U}g!==0&&sl(l,g,d)}function eb(){return(gn&6)===0?(rm(0),!1):!0}function ZE(){if(wt!==null){if(tn===0)var l=wt.return;else l=wt,Yo=iu=null,iE(l),Hd=null,Pp=0,l=wt;for(;l!==null;)ZR(l.alternate,l),l=l.return;wt=null}}function rf(l,d){l.finishedWork=null,l.finishedLanes=0;var g=l.timeoutHandle;g!==-1&&(l.timeoutHandle=-1,uX(g)),g=l.cancelPendingCommit,g!==null&&(l.cancelPendingCommit=null,g()),ZE(),en=l,wt=g=Sl(l.current,null),Ct=d,tn=0,hs=null,ea=!1,tf=rl(l,d),HE=!1,nf=qs=WE=cu=El=wn=0,ao=em=null,GE=!1,(d&8)!==0&&(d|=d&32);var b=l.entangledLanes;if(b!==0)for(l=l.entanglements,b&=d;0<b;){var S=31-Gn(b),O=1<<S;d|=l[S],b&=~O}return ta=d,N0(),g}function r3(l,d){vt=null,D.H=oo,d===Ip?(d=b4(),tn=3):d===m4?(d=b4(),tn=4):tn=d===gR?8:d!==null&&typeof d=="object"&&typeof d.then=="function"?6:1,hs=d,wt===null&&(wn=1,q0(l,Ps(d,l.current)))}function s3(){var l=D.H;return D.H=oo,l===null?oo:l}function i3(){var l=D.A;return D.A=UJ,l}function e2(){wn=4,ea||(Ct&4194176)!==Ct&&Bs.current!==null||(tf=!0),(El&134217727)===0&&(cu&134217727)===0||en===null||na(en,Ct,qs,!1)}function t2(l,d,g){var b=gn;gn|=2;var S=s3(),O=i3();(en!==l||Ct!==d)&&(Q0=null,rf(l,d)),d=!1;var U=wn;e:do try{if(tn!==0&&wt!==null){var Y=wt,Z=hs;switch(tn){case 8:ZE(),U=6;break e;case 3:case 2:case 6:Bs.current===null&&(d=!0);var le=tn;if(tn=0,hs=null,sf(l,Y,Z,le),g&&tf){U=0;break e}break;default:le=tn,tn=0,hs=null,sf(l,Y,Z,le)}}WJ(),U=wn;break}catch(Ee){r3(l,Ee)}while(!0);return d&&l.shellSuspendCounter++,Yo=iu=null,gn=b,D.H=S,D.A=O,wt===null&&(en=null,Ct=0,N0()),U}function WJ(){for(;wt!==null;)o3(wt)}function GJ(l,d){var g=gn;gn|=2;var b=s3(),S=i3();en!==l||Ct!==d?(Q0=null,K0=ie()+500,rf(l,d)):tf=rl(l,d);e:do try{if(tn!==0&&wt!==null){d=wt;var O=hs;t:switch(tn){case 1:tn=0,hs=null,sf(l,d,O,1);break;case 2:if(g4(O)){tn=0,hs=null,a3(d);break}d=function(){tn===2&&en===l&&(tn=7),lo(l)},O.then(d,d);break e;case 3:tn=7;break e;case 4:tn=5;break e;case 7:g4(O)?(tn=0,hs=null,a3(d)):(tn=0,hs=null,sf(l,d,O,7));break;case 5:var U=null;switch(wt.tag){case 26:U=wt.memoizedState;case 5:case 27:var Y=wt;if(!U||D3(U)){tn=0,hs=null;var Z=Y.sibling;if(Z!==null)wt=Z;else{var le=Y.return;le!==null?(wt=le,tb(le)):wt=null}break t}}tn=0,hs=null,sf(l,d,O,5);break;case 6:tn=0,hs=null,sf(l,d,O,6);break;case 8:ZE(),wn=6;break e;default:throw Error(r(462))}}YJ();break}catch(Ee){r3(l,Ee)}while(!0);return Yo=iu=null,D.H=b,D.A=S,gn=g,wt!==null?0:(en=null,Ct=0,N0(),wn)}function YJ(){for(;wt!==null&&!ce();)o3(wt)}function o3(l){var d=jR(l.alternate,l,ta);l.memoizedProps=l.pendingProps,d===null?tb(l):wt=d}function a3(l){var d=l,g=d.alternate;switch(d.tag){case 15:case 0:d=SR(g,d,d.pendingProps,d.type,void 0,Ct);break;case 11:d=SR(g,d,d.pendingProps,d.type.render,d.ref,Ct);break;case 5:iE(d);default:ZR(g,d),d=wt=XR(d,ta),d=jR(g,d,ta)}l.memoizedProps=l.pendingProps,d===null?tb(l):wt=d}function sf(l,d,g,b){Yo=iu=null,iE(d),Hd=null,Pp=0;var S=d.return;try{if(DJ(l,S,d,g,Ct)){wn=1,q0(l,Ps(g,l.current)),wt=null;return}}catch(O){if(S!==null)throw wt=S,O;wn=1,q0(l,Ps(g,l.current)),wt=null;return}d.flags&32768?(It||b===1?l=!0:tf||(Ct&536870912)!==0?l=!1:(ea=l=!0,(b===2||b===3||b===6)&&(b=Bs.current,b!==null&&b.tag===13&&(b.flags|=16384))),l3(d,l)):tb(d)}function tb(l){var d=l;do{if((d.flags&32768)!==0){l3(d,ea);return}l=d.return;var g=zJ(d.alternate,d,ta);if(g!==null){wt=g;return}if(d=d.sibling,d!==null){wt=d;return}wt=d=l}while(d!==null);wn===0&&(wn=5)}function l3(l,d){do{var g=VJ(l.alternate,l);if(g!==null){g.flags&=32767,wt=g;return}if(g=l.return,g!==null&&(g.flags|=32768,g.subtreeFlags=0,g.deletions=null),!d&&(l=l.sibling,l!==null)){wt=l;return}wt=l=g}while(l!==null);wn=6,wt=null}function c3(l,d,g,b,S,O,U,Y,Z,le){var Ee=D.T,je=re.p;try{re.p=2,D.T=null,JJ(l,d,g,b,je,S,O,U,Y,Z,le)}finally{D.T=Ee,re.p=je}}function JJ(l,d,g,b,S,O,U,Y){do of();while(uu!==null);if((gn&6)!==0)throw Error(r(327));var Z=l.finishedWork;if(b=l.finishedLanes,Z===null)return null;if(l.finishedWork=null,l.finishedLanes=0,Z===l.current)throw Error(r(177));l.callbackNode=null,l.callbackPriority=0,l.cancelPendingCommit=null;var le=Z.lanes|Z.childLanes;if(le|=qS,ro(l,b,le,O,U,Y),l===en&&(wt=en=null,Ct=0),(Z.subtreeFlags&10256)===0&&(Z.flags&10256)===0||Z0||(Z0=!0,JE=le,XE=g,ZJ(Ie,function(){return of(),null})),g=(Z.flags&15990)!==0,(Z.subtreeFlags&15990)!==0||g?(g=D.T,D.T=null,O=re.p,re.p=2,U=gn,gn|=4,LJ(l,Z),UR(Z,l),vJ(h2,l.containerInfo),hb=!!f2,h2=f2=null,l.current=Z,FR(l,Z.alternate,Z),ae(),gn=U,re.p=O,D.T=g):l.current=Z,Z0?(Z0=!1,uu=l,tm=b):u3(l,le),le=l.pendingLanes,le===0&&(Nl=null),Rs(Z.stateNode),lo(l),d!==null)for(S=l.onRecoverableError,Z=0;Z<d.length;Z++)le=d[Z],S(le.value,{componentStack:le.stack});return(tm&3)!==0&&of(),le=l.pendingLanes,(b&4194218)!==0&&(le&42)!==0?l===KE?nm++:(nm=0,KE=l):nm=0,rm(0),null}function u3(l,d){(l.pooledCacheLanes&=d)===0&&(d=l.pooledCache,d!=null&&(l.pooledCache=null,Fp(d)))}function of(){if(uu!==null){var l=uu,d=JE;JE=0;var g=Uc(tm),b=D.T,S=re.p;try{if(re.p=32>g?32:g,D.T=null,uu===null)var O=!1;else{g=XE,XE=null;var U=uu,Y=tm;if(uu=null,tm=0,(gn&6)!==0)throw Error(r(331));var Z=gn;if(gn|=4,YR(U.current),HR(U,U.current,Y,g),gn=Z,rm(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(Ut,U)}catch{}O=!0}return O}finally{re.p=S,D.T=b,u3(l,d)}}return!1}function d3(l,d,g){d=Ps(g,d),d=vE(l.stateNode,d,2),l=bl(l,d,2),l!==null&&(Er(l,2),lo(l))}function Xt(l,d,g){if(l.tag===3)d3(l,l,g);else for(;d!==null;){if(d.tag===3){d3(d,l,g);break}else if(d.tag===1){var b=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Nl===null||!Nl.has(b))){l=Ps(g,l),g=pR(2),b=bl(d,g,2),b!==null&&(mR(g,b,d,l),Er(b,2),lo(b));break}}d=d.return}}function n2(l,d,g){var b=l.pingCache;if(b===null){b=l.pingCache=new qJ;var S=new Set;b.set(d,S)}else S=b.get(d),S===void 0&&(S=new Set,b.set(d,S));S.has(g)||(HE=!0,S.add(g),l=XJ.bind(null,l,d,g),d.then(l,l))}function XJ(l,d,g){var b=l.pingCache;b!==null&&b.delete(d),l.pingedLanes|=l.suspendedLanes&g,l.warmLanes&=~g,en===l&&(Ct&g)===g&&(wn===4||wn===3&&(Ct&62914560)===Ct&&300>ie()-YE?(gn&2)===0&&rf(l,0):WE|=g,nf===Ct&&(nf=0)),lo(l)}function f3(l,d){d===0&&(d=dn()),l=ul(l,d),l!==null&&(Er(l,d),lo(l))}function KJ(l){var d=l.memoizedState,g=0;d!==null&&(g=d.retryLane),f3(l,g)}function QJ(l,d){var g=0;switch(l.tag){case 13:var b=l.stateNode,S=l.memoizedState;S!==null&&(g=S.retryLane);break;case 19:b=l.stateNode;break;case 22:b=l.stateNode._retryCache;break;default:throw Error(r(314))}b!==null&&b.delete(d),f3(l,g)}function ZJ(l,d){return Q(l,d)}var nb=null,af=null,r2=!1,rb=!1,s2=!1,du=0;function lo(l){l!==af&&l.next===null&&(af===null?nb=af=l:af=af.next=l),rb=!0,r2||(r2=!0,tX(eX))}function rm(l,d){if(!s2&&rb){s2=!0;do for(var g=!1,b=nb;b!==null;){if(l!==0){var S=b.pendingLanes;if(S===0)var O=0;else{var U=b.suspendedLanes,Y=b.pingedLanes;O=(1<<31-Gn(42|l)+1)-1,O&=S&~(U&~Y),O=O&201326677?O&201326677|1:O?O|2:0}O!==0&&(g=!0,m3(b,O))}else O=Ct,O=Bo(b,b===en?O:0),(O&3)===0||rl(b,O)||(g=!0,m3(b,O));b=b.next}while(g);s2=!1}}function eX(){rb=r2=!1;var l=0;du!==0&&(cX()&&(l=du),du=0);for(var d=ie(),g=null,b=nb;b!==null;){var S=b.next,O=h3(b,d);O===0?(b.next=null,g===null?nb=S:g.next=S,S===null&&(af=g)):(g=b,(l!==0||(O&3)!==0)&&(rb=!0)),b=S}rm(l)}function h3(l,d){for(var g=l.suspendedLanes,b=l.pingedLanes,S=l.expirationTimes,O=l.pendingLanes&-62914561;0<O;){var U=31-Gn(O),Y=1<<U,Z=S[U];Z===-1?((Y&g)===0||(Y&b)!==0)&&(S[U]=xp(Y,d)):Z<=d&&(l.expiredLanes|=Y),O&=~Y}if(d=en,g=Ct,g=Bo(l,l===d?g:0),b=l.callbackNode,g===0||l===d&&tn===2||l.cancelPendingCommit!==null)return b!==null&&b!==null&&ye(b),l.callbackNode=null,l.callbackPriority=0;if((g&3)===0||rl(l,g)){if(d=g&-g,d===l.callbackPriority)return d;switch(b!==null&&ye(b),Uc(g)){case 2:case 8:g=Ae;break;case 32:g=Ie;break;case 268435456:g=Vt;break;default:g=Ie}return b=p3.bind(null,l),g=Q(g,b),l.callbackPriority=d,l.callbackNode=g,d}return b!==null&&b!==null&&ye(b),l.callbackPriority=2,l.callbackNode=null,2}function p3(l,d){var g=l.callbackNode;if(of()&&l.callbackNode!==g)return null;var b=Ct;return b=Bo(l,l===en?b:0),b===0?null:(t3(l,b,d),h3(l,ie()),l.callbackNode!=null&&l.callbackNode===g?p3.bind(null,l):null)}function m3(l,d){if(of())return null;t3(l,d,!0)}function tX(l){dX(function(){(gn&6)!==0?Q(be,l):l()})}function i2(){return du===0&&(du=jd()),du}function g3(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:y0(""+l)}function y3(l,d){var g=d.ownerDocument.createElement("input");return g.name=d.name,g.value=d.value,l.id&&g.setAttribute("form",l.id),d.parentNode.insertBefore(g,d),l=new FormData(l),g.parentNode.removeChild(g),l}function nX(l,d,g,b,S){if(d==="submit"&&g&&g.stateNode===S){var O=g3((S[Jn]||null).action),U=b.submitter;U&&(d=(d=U[Jn]||null)?g3(d.formAction):U.getAttribute("formAction"),d!==null&&(O=d,U=null));var Y=new w0("action","action",null,b,S);l.push({event:Y,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(du!==0){var Z=U?y3(S,U):new FormData(S);pE(g,{pending:!0,data:Z,method:S.method,action:O},null,Z)}}else typeof O=="function"&&(Y.preventDefault(),Z=U?y3(S,U):new FormData(S),pE(g,{pending:!0,data:Z,method:S.method,action:O},O,Z))},currentTarget:S}]})}}for(var o2=0;o2<c4.length;o2++){var a2=c4[o2],rX=a2.toLowerCase(),sX=a2[0].toUpperCase()+a2.slice(1);wi(rX,"on"+sX)}wi(s4,"onAnimationEnd"),wi(i4,"onAnimationIteration"),wi(o4,"onAnimationStart"),wi("dblclick","onDoubleClick"),wi("focusin","onFocus"),wi("focusout","onBlur"),wi(wJ,"onTransitionRun"),wi(SJ,"onTransitionStart"),wi(EJ,"onTransitionCancel"),wi(a4,"onTransitionEnd"),ll("onMouseEnter",["mouseout","mouseover"]),ll("onMouseLeave",["mouseout","mouseover"]),ll("onPointerEnter",["pointerout","pointerover"]),ll("onPointerLeave",["pointerout","pointerover"]),Vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sm="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),iX=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sm));function b3(l,d){d=(d&4)!==0;for(var g=0;g<l.length;g++){var b=l[g],S=b.event;b=b.listeners;e:{var O=void 0;if(d)for(var U=b.length-1;0<=U;U--){var Y=b[U],Z=Y.instance,le=Y.currentTarget;if(Y=Y.listener,Z!==O&&S.isPropagationStopped())break e;O=Y,S.currentTarget=le;try{O(S)}catch(Ee){U0(Ee)}S.currentTarget=null,O=Z}else for(U=0;U<b.length;U++){if(Y=b[U],Z=Y.instance,le=Y.currentTarget,Y=Y.listener,Z!==O&&S.isPropagationStopped())break e;O=Y,S.currentTarget=le;try{O(S)}catch(Ee){U0(Ee)}S.currentTarget=null,O=Z}}}}function Nt(l,d){var g=d[Xn];g===void 0&&(g=d[Xn]=new Set);var b=l+"__bubble";g.has(b)||(v3(d,l,2,!1),g.add(b))}function l2(l,d,g){var b=0;d&&(b|=4),v3(g,l,b,d)}var sb="_reactListening"+Math.random().toString(36).slice(2);function c2(l){if(!l[sb]){l[sb]=!0,f0.forEach(function(g){g!=="selectionchange"&&(iX.has(g)||l2(g,!1,l),l2(g,!0,l))});var d=l.nodeType===9?l:l.ownerDocument;d===null||d[sb]||(d[sb]=!0,l2("selectionchange",!1,d))}}function v3(l,d,g,b){switch(V3(d)){case 2:var S=TX;break;case 8:S=RX;break;default:S=S2}g=S.bind(null,d,g,l),S=void 0,!TS||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(S=!0),b?S!==void 0?l.addEventListener(d,g,{capture:!0,passive:S}):l.addEventListener(d,g,!0):S!==void 0?l.addEventListener(d,g,{passive:S}):l.addEventListener(d,g,!1)}function u2(l,d,g,b,S){var O=b;if((d&1)===0&&(d&2)===0&&b!==null)e:for(;;){if(b===null)return;var U=b.tag;if(U===3||U===4){var Y=b.stateNode.containerInfo;if(Y===S||Y.nodeType===8&&Y.parentNode===S)break;if(U===4)for(U=b.return;U!==null;){var Z=U.tag;if((Z===3||Z===4)&&(Z=U.stateNode.containerInfo,Z===S||Z.nodeType===8&&Z.parentNode===S))return;U=U.return}for(;Y!==null;){if(U=zo(Y),U===null)return;if(Z=U.tag,Z===5||Z===6||Z===26||Z===27){b=O=U;continue e}Y=Y.parentNode}}b=b.return}k5(function(){var le=O,Ee=AS(g),je=[];e:{var ge=l4.get(l);if(ge!==void 0){var we=w0,Ze=l;switch(l){case"keypress":if(v0(g)===0)break e;case"keydown":case"keyup":we=QY;break;case"focusin":Ze="focus",we=IS;break;case"focusout":Ze="blur",we=IS;break;case"beforeblur":case"afterblur":we=IS;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=P5;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=BY;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=tJ;break;case s4:case i4:case o4:we=UY;break;case a4:we=rJ;break;case"scroll":case"scrollend":we=LY;break;case"wheel":we=iJ;break;case"copy":case"cut":case"paste":we=HY;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=F5;break;case"toggle":case"beforetoggle":we=aJ}var ft=(d&4)!==0,Sn=!ft&&(l==="scroll"||l==="scrollend"),pe=ft?ge!==null?ge+"Capture":null:ge;ft=[];for(var oe=le,me;oe!==null;){var Ne=oe;if(me=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||me===null||pe===null||(Ne=Ep(oe,pe),Ne!=null&&ft.push(im(oe,Ne,me))),Sn)break;oe=oe.return}0<ft.length&&(ge=new we(ge,Ze,null,g,Ee),je.push({event:ge,listeners:ft}))}}if((d&7)===0){e:{if(ge=l==="mouseover"||l==="pointerover",we=l==="mouseout"||l==="pointerout",ge&&g!==jS&&(Ze=g.relatedTarget||g.fromElement)&&(zo(Ze)||Ze[dt]))break e;if((we||ge)&&(ge=Ee.window===Ee?Ee:(ge=Ee.ownerDocument)?ge.defaultView||ge.parentWindow:window,we?(Ze=g.relatedTarget||g.toElement,we=le,Ze=Ze?zo(Ze):null,Ze!==null&&(Sn=z(Ze),ft=Ze.tag,Ze!==Sn||ft!==5&&ft!==27&&ft!==6)&&(Ze=null)):(we=null,Ze=le),we!==Ze)){if(ft=P5,Ne="onMouseLeave",pe="onMouseEnter",oe="mouse",(l==="pointerout"||l==="pointerover")&&(ft=F5,Ne="onPointerLeave",pe="onPointerEnter",oe="pointer"),Sn=we==null?ge:ol(we),me=Ze==null?ge:ol(Ze),ge=new ft(Ne,oe+"leave",we,g,Ee),ge.target=Sn,ge.relatedTarget=me,Ne=null,zo(Ee)===le&&(ft=new ft(pe,oe+"enter",Ze,g,Ee),ft.target=me,ft.relatedTarget=Sn,Ne=ft),Sn=Ne,we&&Ze)t:{for(ft=we,pe=Ze,oe=0,me=ft;me;me=lf(me))oe++;for(me=0,Ne=pe;Ne;Ne=lf(Ne))me++;for(;0<oe-me;)ft=lf(ft),oe--;for(;0<me-oe;)pe=lf(pe),me--;for(;oe--;){if(ft===pe||pe!==null&&ft===pe.alternate)break t;ft=lf(ft),pe=lf(pe)}ft=null}else ft=null;we!==null&&x3(je,ge,we,ft,!1),Ze!==null&&Sn!==null&&x3(je,Sn,Ze,ft,!0)}}e:{if(ge=le?ol(le):window,we=ge.nodeName&&ge.nodeName.toLowerCase(),we==="select"||we==="input"&&ge.type==="file")var He=G5;else if(H5(ge))if(Y5)He=yJ;else{He=mJ;var xt=pJ}else we=ge.nodeName,!we||we.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?le&&OS(le.elementType)&&(He=G5):He=gJ;if(He&&(He=He(l,le))){W5(je,He,g,Ee);break e}xt&&xt(l,ge,le),l==="focusout"&&le&&ge.type==="number"&&le.memoizedProps.value!=null&&CS(ge,"number",ge.value)}switch(xt=le?ol(le):window,l){case"focusin":(H5(xt)||xt.contentEditable==="true")&&(Fd=xt,zS=le,Tp=null);break;case"focusout":Tp=zS=Fd=null;break;case"mousedown":VS=!0;break;case"contextmenu":case"mouseup":case"dragend":VS=!1,n4(je,g,Ee);break;case"selectionchange":if(xJ)break;case"keydown":case"keyup":n4(je,g,Ee)}var nt;if(PS)e:{switch(l){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else Ld?U5(l,g)&&(at="onCompositionEnd"):l==="keydown"&&g.keyCode===229&&(at="onCompositionStart");at&&(B5&&g.locale!=="ko"&&(Ld||at!=="onCompositionStart"?at==="onCompositionEnd"&&Ld&&(nt=I5()):(cl=Ee,RS="value"in cl?cl.value:cl.textContent,Ld=!0)),xt=ib(le,at),0<xt.length&&(at=new L5(at,l,null,g,Ee),je.push({event:at,listeners:xt}),nt?at.data=nt:(nt=q5(g),nt!==null&&(at.data=nt)))),(nt=cJ?uJ(l,g):dJ(l,g))&&(at=ib(le,"onBeforeInput"),0<at.length&&(xt=new L5("onBeforeInput","beforeinput",null,g,Ee),je.push({event:xt,listeners:at}),xt.data=nt)),nX(je,l,le,g,Ee)}b3(je,d)})}function im(l,d,g){return{instance:l,listener:d,currentTarget:g}}function ib(l,d){for(var g=d+"Capture",b=[];l!==null;){var S=l,O=S.stateNode;S=S.tag,S!==5&&S!==26&&S!==27||O===null||(S=Ep(l,g),S!=null&&b.unshift(im(l,S,O)),S=Ep(l,d),S!=null&&b.push(im(l,S,O))),l=l.return}return b}function lf(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function x3(l,d,g,b,S){for(var O=d._reactName,U=[];g!==null&&g!==b;){var Y=g,Z=Y.alternate,le=Y.stateNode;if(Y=Y.tag,Z!==null&&Z===b)break;Y!==5&&Y!==26&&Y!==27||le===null||(Z=le,S?(le=Ep(g,O),le!=null&&U.unshift(im(g,le,Z))):S||(le=Ep(g,O),le!=null&&U.push(im(g,le,Z)))),g=g.return}U.length!==0&&l.push({event:d,listeners:U})}var oX=/\r\n?/g,aX=/\u0000|\uFFFD/g;function w3(l){return(typeof l=="string"?l:""+l).replace(oX,`
`).replace(aX,"")}function S3(l,d){return d=w3(d),w3(l)===d}function ob(){}function Yt(l,d,g,b,S,O){switch(g){case"children":typeof b=="string"?d==="body"||d==="textarea"&&b===""||Id(l,b):(typeof b=="number"||typeof b=="bigint")&&d!=="body"&&Id(l,""+b);break;case"className":$d(l,"class",b);break;case"tabIndex":$d(l,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":$d(l,g,b);break;case"style":R5(l,b,O);break;case"data":if(d!=="object"){$d(l,"data",b);break}case"src":case"href":if(b===""&&(d!=="a"||g!=="href")){l.removeAttribute(g);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){l.removeAttribute(g);break}b=y0(""+b),l.setAttribute(g,b);break;case"action":case"formAction":if(typeof b=="function"){l.setAttribute(g,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof O=="function"&&(g==="formAction"?(d!=="input"&&Yt(l,d,"name",S.name,S,null),Yt(l,d,"formEncType",S.formEncType,S,null),Yt(l,d,"formMethod",S.formMethod,S,null),Yt(l,d,"formTarget",S.formTarget,S,null)):(Yt(l,d,"encType",S.encType,S,null),Yt(l,d,"method",S.method,S,null),Yt(l,d,"target",S.target,S,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){l.removeAttribute(g);break}b=y0(""+b),l.setAttribute(g,b);break;case"onClick":b!=null&&(l.onclick=ob);break;case"onScroll":b!=null&&Nt("scroll",l);break;case"onScrollEnd":b!=null&&Nt("scrollend",l);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(r(61));if(g=b.__html,g!=null){if(S.children!=null)throw Error(r(60));l.innerHTML=g}}break;case"multiple":l.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":l.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){l.removeAttribute("xlink:href");break}g=y0(""+b),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(g,""+b):l.removeAttribute(g);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(g,""):l.removeAttribute(g);break;case"capture":case"download":b===!0?l.setAttribute(g,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(g,b):l.removeAttribute(g);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?l.setAttribute(g,b):l.removeAttribute(g);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?l.removeAttribute(g):l.setAttribute(g,b);break;case"popover":Nt("beforetoggle",l),Nt("toggle",l),Ad(l,"popover",b);break;case"xlinkActuate":xi(l,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":xi(l,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":xi(l,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":xi(l,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":xi(l,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":xi(l,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":xi(l,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":xi(l,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":xi(l,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":Ad(l,"is",b);break;case"innerText":case"textContent":break;default:(!(2<g.length)||g[0]!=="o"&&g[0]!=="O"||g[1]!=="n"&&g[1]!=="N")&&(g=DY.get(g)||g,Ad(l,g,b))}}function d2(l,d,g,b,S,O){switch(g){case"style":R5(l,b,O);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(r(61));if(g=b.__html,g!=null){if(S.children!=null)throw Error(r(60));l.innerHTML=g}}break;case"children":typeof b=="string"?Id(l,b):(typeof b=="number"||typeof b=="bigint")&&Id(l,""+b);break;case"onScroll":b!=null&&Nt("scroll",l);break;case"onScrollEnd":b!=null&&Nt("scrollend",l);break;case"onClick":b!=null&&(l.onclick=ob);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!h0.hasOwnProperty(g))e:{if(g[0]==="o"&&g[1]==="n"&&(S=g.endsWith("Capture"),d=g.slice(2,S?g.length-7:void 0),O=l[Jn]||null,O=O!=null?O[g]:null,typeof O=="function"&&l.removeEventListener(d,O,S),typeof b=="function")){typeof O!="function"&&O!==null&&(g in l?l[g]=null:l.hasAttribute(g)&&l.removeAttribute(g)),l.addEventListener(d,b,S);break e}g in l?l[g]=b:b===!0?l.setAttribute(g,""):Ad(l,g,b)}}}function cr(l,d,g){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nt("error",l),Nt("load",l);var b=!1,S=!1,O;for(O in g)if(g.hasOwnProperty(O)){var U=g[O];if(U!=null)switch(O){case"src":b=!0;break;case"srcSet":S=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Yt(l,d,O,U,g,null)}}S&&Yt(l,d,"srcSet",g.srcSet,g,null),b&&Yt(l,d,"src",g.src,g,null);return;case"input":Nt("invalid",l);var Y=O=U=S=null,Z=null,le=null;for(b in g)if(g.hasOwnProperty(b)){var Ee=g[b];if(Ee!=null)switch(b){case"name":S=Ee;break;case"type":U=Ee;break;case"checked":Z=Ee;break;case"defaultChecked":le=Ee;break;case"value":O=Ee;break;case"defaultValue":Y=Ee;break;case"children":case"dangerouslySetInnerHTML":if(Ee!=null)throw Error(r(137,d));break;default:Yt(l,d,b,Ee,g,null)}}j5(l,O,Y,Z,le,U,S,!1),Td(l);return;case"select":Nt("invalid",l),b=U=O=null;for(S in g)if(g.hasOwnProperty(S)&&(Y=g[S],Y!=null))switch(S){case"value":O=Y;break;case"defaultValue":U=Y;break;case"multiple":b=Y;default:Yt(l,d,S,Y,g,null)}d=O,g=U,l.multiple=!!b,d!=null?kd(l,!!b,d,!1):g!=null&&kd(l,!!b,g,!0);return;case"textarea":Nt("invalid",l),O=S=b=null;for(U in g)if(g.hasOwnProperty(U)&&(Y=g[U],Y!=null))switch(U){case"value":b=Y;break;case"defaultValue":S=Y;break;case"children":O=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(91));break;default:Yt(l,d,U,Y,g,null)}$5(l,b,S,O),Td(l);return;case"option":for(Z in g)if(g.hasOwnProperty(Z)&&(b=g[Z],b!=null))switch(Z){case"selected":l.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:Yt(l,d,Z,b,g,null)}return;case"dialog":Nt("cancel",l),Nt("close",l);break;case"iframe":case"object":Nt("load",l);break;case"video":case"audio":for(b=0;b<sm.length;b++)Nt(sm[b],l);break;case"image":Nt("error",l),Nt("load",l);break;case"details":Nt("toggle",l);break;case"embed":case"source":case"link":Nt("error",l),Nt("load",l);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in g)if(g.hasOwnProperty(le)&&(b=g[le],b!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Yt(l,d,le,b,g,null)}return;default:if(OS(d)){for(Ee in g)g.hasOwnProperty(Ee)&&(b=g[Ee],b!==void 0&&d2(l,d,Ee,b,g,void 0));return}}for(Y in g)g.hasOwnProperty(Y)&&(b=g[Y],b!=null&&Yt(l,d,Y,b,g,null))}function lX(l,d,g,b){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var S=null,O=null,U=null,Y=null,Z=null,le=null,Ee=null;for(we in g){var je=g[we];if(g.hasOwnProperty(we)&&je!=null)switch(we){case"checked":break;case"value":break;case"defaultValue":Z=je;default:b.hasOwnProperty(we)||Yt(l,d,we,null,b,je)}}for(var ge in b){var we=b[ge];if(je=g[ge],b.hasOwnProperty(ge)&&(we!=null||je!=null))switch(ge){case"type":O=we;break;case"name":S=we;break;case"checked":le=we;break;case"defaultChecked":Ee=we;break;case"value":U=we;break;case"defaultValue":Y=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,d));break;default:we!==je&&Yt(l,d,ge,we,b,je)}}_S(l,U,Y,Z,le,Ee,O,S);return;case"select":we=U=Y=ge=null;for(O in g)if(Z=g[O],g.hasOwnProperty(O)&&Z!=null)switch(O){case"value":break;case"multiple":we=Z;default:b.hasOwnProperty(O)||Yt(l,d,O,null,b,Z)}for(S in b)if(O=b[S],Z=g[S],b.hasOwnProperty(S)&&(O!=null||Z!=null))switch(S){case"value":ge=O;break;case"defaultValue":Y=O;break;case"multiple":U=O;default:O!==Z&&Yt(l,d,S,O,b,Z)}d=Y,g=U,b=we,ge!=null?kd(l,!!g,ge,!1):!!b!=!!g&&(d!=null?kd(l,!!g,d,!0):kd(l,!!g,g?[]:"",!1));return;case"textarea":we=ge=null;for(Y in g)if(S=g[Y],g.hasOwnProperty(Y)&&S!=null&&!b.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:Yt(l,d,Y,null,b,S)}for(U in b)if(S=b[U],O=g[U],b.hasOwnProperty(U)&&(S!=null||O!=null))switch(U){case"value":ge=S;break;case"defaultValue":we=S;break;case"children":break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:S!==O&&Yt(l,d,U,S,b,O)}A5(l,ge,we);return;case"option":for(var Ze in g)if(ge=g[Ze],g.hasOwnProperty(Ze)&&ge!=null&&!b.hasOwnProperty(Ze))switch(Ze){case"selected":l.selected=!1;break;default:Yt(l,d,Ze,null,b,ge)}for(Z in b)if(ge=b[Z],we=g[Z],b.hasOwnProperty(Z)&&ge!==we&&(ge!=null||we!=null))switch(Z){case"selected":l.selected=ge&&typeof ge!="function"&&typeof ge!="symbol";break;default:Yt(l,d,Z,ge,b,we)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ft in g)ge=g[ft],g.hasOwnProperty(ft)&&ge!=null&&!b.hasOwnProperty(ft)&&Yt(l,d,ft,null,b,ge);for(le in b)if(ge=b[le],we=g[le],b.hasOwnProperty(le)&&ge!==we&&(ge!=null||we!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,d));break;default:Yt(l,d,le,ge,b,we)}return;default:if(OS(d)){for(var Sn in g)ge=g[Sn],g.hasOwnProperty(Sn)&&ge!==void 0&&!b.hasOwnProperty(Sn)&&d2(l,d,Sn,void 0,b,ge);for(Ee in b)ge=b[Ee],we=g[Ee],!b.hasOwnProperty(Ee)||ge===we||ge===void 0&&we===void 0||d2(l,d,Ee,ge,b,we);return}}for(var pe in g)ge=g[pe],g.hasOwnProperty(pe)&&ge!=null&&!b.hasOwnProperty(pe)&&Yt(l,d,pe,null,b,ge);for(je in b)ge=b[je],we=g[je],!b.hasOwnProperty(je)||ge===we||ge==null&&we==null||Yt(l,d,je,ge,b,we)}var f2=null,h2=null;function ab(l){return l.nodeType===9?l:l.ownerDocument}function E3(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function N3(l,d){if(l===0)switch(d){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&d==="foreignObject"?0:l}function p2(l,d){return l==="textarea"||l==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.children=="bigint"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var m2=null;function cX(){var l=window.event;return l&&l.type==="popstate"?l===m2?!1:(m2=l,!0):(m2=null,!1)}var _3=typeof setTimeout=="function"?setTimeout:void 0,uX=typeof clearTimeout=="function"?clearTimeout:void 0,C3=typeof Promise=="function"?Promise:void 0,dX=typeof queueMicrotask=="function"?queueMicrotask:typeof C3<"u"?function(l){return C3.resolve(null).then(l).catch(fX)}:_3;function fX(l){setTimeout(function(){throw l})}function g2(l,d){var g=d,b=0;do{var S=g.nextSibling;if(l.removeChild(g),S&&S.nodeType===8)if(g=S.data,g==="/$"){if(b===0){l.removeChild(S),hm(d);return}b--}else g!=="$"&&g!=="$?"&&g!=="$!"||b++;g=S}while(g);hm(d)}function y2(l){var d=l.firstChild;for(d&&d.nodeType===10&&(d=d.nextSibling);d;){var g=d;switch(d=d.nextSibling,g.nodeName){case"HTML":case"HEAD":case"BODY":y2(g),Sp(g);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(g.rel.toLowerCase()==="stylesheet")continue}l.removeChild(g)}}function hX(l,d,g,b){for(;l.nodeType===1;){var S=g;if(l.nodeName.toLowerCase()!==d.toLowerCase()){if(!b&&(l.nodeName!=="INPUT"||l.type!=="hidden"))break}else if(b){if(!l[Hc])switch(d){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(O=l.getAttribute("rel"),O==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(O!==S.rel||l.getAttribute("href")!==(S.href==null?null:S.href)||l.getAttribute("crossorigin")!==(S.crossOrigin==null?null:S.crossOrigin)||l.getAttribute("title")!==(S.title==null?null:S.title))break;return l;case"style":if(l.hasAttribute("data-precedence"))break;return l;case"script":if(O=l.getAttribute("src"),(O!==(S.src==null?null:S.src)||l.getAttribute("type")!==(S.type==null?null:S.type)||l.getAttribute("crossorigin")!==(S.crossOrigin==null?null:S.crossOrigin))&&O&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(d==="input"&&l.type==="hidden"){var O=S.name==null?null:""+S.name;if(S.type==="hidden"&&l.getAttribute("name")===O)return l}else return l;if(l=Ni(l.nextSibling),l===null)break}return null}function pX(l,d,g){if(d==="")return null;for(;l.nodeType!==3;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!g||(l=Ni(l.nextSibling),l===null))return null;return l}function Ni(l){for(;l!=null;l=l.nextSibling){var d=l.nodeType;if(d===1||d===3)break;if(d===8){if(d=l.data,d==="$"||d==="$!"||d==="$?"||d==="F!"||d==="F")break;if(d==="/$")return null}}return l}function O3(l){l=l.previousSibling;for(var d=0;l;){if(l.nodeType===8){var g=l.data;if(g==="$"||g==="$!"||g==="$?"){if(d===0)return l;d--}else g==="/$"&&d++}l=l.previousSibling}return null}function j3(l,d,g){switch(d=ab(g),l){case"html":if(l=d.documentElement,!l)throw Error(r(452));return l;case"head":if(l=d.head,!l)throw Error(r(453));return l;case"body":if(l=d.body,!l)throw Error(r(454));return l;default:throw Error(r(451))}}var Hs=new Map,A3=new Set;function lb(l){return typeof l.getRootNode=="function"?l.getRootNode():l.ownerDocument}var ra=re.d;re.d={f:mX,r:gX,D:yX,C:bX,L:vX,m:xX,X:SX,S:wX,M:EX};function mX(){var l=ra.f(),d=eb();return l||d}function gX(l){var d=il(l);d!==null&&d.tag===5&&d.type==="form"?nR(d):ra.r(l)}var cf=typeof document>"u"?null:document;function $3(l,d,g){var b=cf;if(b&&typeof d=="string"&&d){var S=Nr(d);S='link[rel="'+l+'"][href="'+S+'"]',typeof g=="string"&&(S+='[crossorigin="'+g+'"]'),A3.has(S)||(A3.add(S),l={rel:l,crossOrigin:g,href:d},b.querySelector(S)===null&&(d=b.createElement("link"),cr(d,"link",l),Rn(d),b.head.appendChild(d)))}}function yX(l){ra.D(l),$3("dns-prefetch",l,null)}function bX(l,d){ra.C(l,d),$3("preconnect",l,d)}function vX(l,d,g){ra.L(l,d,g);var b=cf;if(b&&l&&d){var S='link[rel="preload"][as="'+Nr(d)+'"]';d==="image"&&g&&g.imageSrcSet?(S+='[imagesrcset="'+Nr(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(S+='[imagesizes="'+Nr(g.imageSizes)+'"]')):S+='[href="'+Nr(l)+'"]';var O=S;switch(d){case"style":O=uf(l);break;case"script":O=df(l)}Hs.has(O)||(l=P({rel:"preload",href:d==="image"&&g&&g.imageSrcSet?void 0:l,as:d},g),Hs.set(O,l),b.querySelector(S)!==null||d==="style"&&b.querySelector(om(O))||d==="script"&&b.querySelector(am(O))||(d=b.createElement("link"),cr(d,"link",l),Rn(d),b.head.appendChild(d)))}}function xX(l,d){ra.m(l,d);var g=cf;if(g&&l){var b=d&&typeof d.as=="string"?d.as:"script",S='link[rel="modulepreload"][as="'+Nr(b)+'"][href="'+Nr(l)+'"]',O=S;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=df(l)}if(!Hs.has(O)&&(l=P({rel:"modulepreload",href:l},d),Hs.set(O,l),g.querySelector(S)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(am(O)))return}b=g.createElement("link"),cr(b,"link",l),Rn(b),g.head.appendChild(b)}}}function wX(l,d,g){ra.S(l,d,g);var b=cf;if(b&&l){var S=al(b).hoistableStyles,O=uf(l);d=d||"default";var U=S.get(O);if(!U){var Y={loading:0,preload:null};if(U=b.querySelector(om(O)))Y.loading=5;else{l=P({rel:"stylesheet",href:l,"data-precedence":d},g),(g=Hs.get(O))&&b2(l,g);var Z=U=b.createElement("link");Rn(Z),cr(Z,"link",l),Z._p=new Promise(function(le,Ee){Z.onload=le,Z.onerror=Ee}),Z.addEventListener("load",function(){Y.loading|=1}),Z.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,cb(U,d,b)}U={type:"stylesheet",instance:U,count:1,state:Y},S.set(O,U)}}}function SX(l,d){ra.X(l,d);var g=cf;if(g&&l){var b=al(g).hoistableScripts,S=df(l),O=b.get(S);O||(O=g.querySelector(am(S)),O||(l=P({src:l,async:!0},d),(d=Hs.get(S))&&v2(l,d),O=g.createElement("script"),Rn(O),cr(O,"link",l),g.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(S,O))}}function EX(l,d){ra.M(l,d);var g=cf;if(g&&l){var b=al(g).hoistableScripts,S=df(l),O=b.get(S);O||(O=g.querySelector(am(S)),O||(l=P({src:l,async:!0,type:"module"},d),(d=Hs.get(S))&&v2(l,d),O=g.createElement("script"),Rn(O),cr(O,"link",l),g.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(S,O))}}function T3(l,d,g,b){var S=(S=Ce.current)?lb(S):null;if(!S)throw Error(r(446));switch(l){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(d=uf(g.href),g=al(S).hoistableStyles,b=g.get(d),b||(b={type:"style",instance:null,count:0,state:null},g.set(d,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){l=uf(g.href);var O=al(S).hoistableStyles,U=O.get(l);if(U||(S=S.ownerDocument||S,U={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(l,U),(O=S.querySelector(om(l)))&&!O._p&&(U.instance=O,U.state.loading=5),Hs.has(l)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},Hs.set(l,g),O||NX(S,l,g,U.state))),d&&b===null)throw Error(r(528,""));return U}if(d&&b!==null)throw Error(r(529,""));return null;case"script":return d=g.async,g=g.src,typeof g=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=df(g),g=al(S).hoistableScripts,b=g.get(d),b||(b={type:"script",instance:null,count:0,state:null},g.set(d,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,l))}}function uf(l){return'href="'+Nr(l)+'"'}function om(l){return'link[rel="stylesheet"]['+l+"]"}function R3(l){return P({},l,{"data-precedence":l.precedence,precedence:null})}function NX(l,d,g,b){l.querySelector('link[rel="preload"][as="style"]['+d+"]")?b.loading=1:(d=l.createElement("link"),b.preload=d,d.addEventListener("load",function(){return b.loading|=1}),d.addEventListener("error",function(){return b.loading|=2}),cr(d,"link",g),Rn(d),l.head.appendChild(d))}function df(l){return'[src="'+Nr(l)+'"]'}function am(l){return"script[async]"+l}function M3(l,d,g){if(d.count++,d.instance===null)switch(d.type){case"style":var b=l.querySelector('style[data-href~="'+Nr(g.href)+'"]');if(b)return d.instance=b,Rn(b),b;var S=P({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return b=(l.ownerDocument||l).createElement("style"),Rn(b),cr(b,"style",S),cb(b,g.precedence,l),d.instance=b;case"stylesheet":S=uf(g.href);var O=l.querySelector(om(S));if(O)return d.state.loading|=4,d.instance=O,Rn(O),O;b=R3(g),(S=Hs.get(S))&&b2(b,S),O=(l.ownerDocument||l).createElement("link"),Rn(O);var U=O;return U._p=new Promise(function(Y,Z){U.onload=Y,U.onerror=Z}),cr(O,"link",b),d.state.loading|=4,cb(O,g.precedence,l),d.instance=O;case"script":return O=df(g.src),(S=l.querySelector(am(O)))?(d.instance=S,Rn(S),S):(b=g,(S=Hs.get(O))&&(b=P({},g),v2(b,S)),l=l.ownerDocument||l,S=l.createElement("script"),Rn(S),cr(S,"link",b),l.head.appendChild(S),d.instance=S);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(b=d.instance,d.state.loading|=4,cb(b,g.precedence,l));return d.instance}function cb(l,d,g){for(var b=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=b.length?b[b.length-1]:null,O=S,U=0;U<b.length;U++){var Y=b[U];if(Y.dataset.precedence===d)O=Y;else if(O!==S)break}O?O.parentNode.insertBefore(l,O.nextSibling):(d=g.nodeType===9?g.head:g,d.insertBefore(l,d.firstChild))}function b2(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.title==null&&(l.title=d.title)}function v2(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.integrity==null&&(l.integrity=d.integrity)}var ub=null;function k3(l,d,g){if(ub===null){var b=new Map,S=ub=new Map;S.set(g,b)}else S=ub,b=S.get(g),b||(b=new Map,S.set(g,b));if(b.has(l))return b;for(b.set(l,null),g=g.getElementsByTagName(l),S=0;S<g.length;S++){var O=g[S];if(!(O[Hc]||O[Tn]||l==="link"&&O.getAttribute("rel")==="stylesheet")&&O.namespaceURI!=="http://www.w3.org/2000/svg"){var U=O.getAttribute(d)||"";U=l+U;var Y=b.get(U);Y?Y.push(O):b.set(U,[O])}}return b}function I3(l,d,g){l=l.ownerDocument||l,l.head.insertBefore(g,d==="title"?l.querySelector("head > title"):null)}function _X(l,d,g){if(g===1||d.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return l=d.disabled,typeof d.precedence=="string"&&l==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function D3(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}var lm=null;function CX(){}function OX(l,d,g){if(lm===null)throw Error(r(475));var b=lm;if(d.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var S=uf(g.href),O=l.querySelector(om(S));if(O){l=O._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(b.count++,b=db.bind(b),l.then(b,b)),d.state.loading|=4,d.instance=O,Rn(O);return}O=l.ownerDocument||l,g=R3(g),(S=Hs.get(S))&&b2(g,S),O=O.createElement("link"),Rn(O);var U=O;U._p=new Promise(function(Y,Z){U.onload=Y,U.onerror=Z}),cr(O,"link",g),d.instance=O}b.stylesheets===null&&(b.stylesheets=new Map),b.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(b.count++,d=db.bind(b),l.addEventListener("load",d),l.addEventListener("error",d))}}function jX(){if(lm===null)throw Error(r(475));var l=lm;return l.stylesheets&&l.count===0&&x2(l,l.stylesheets),0<l.count?function(d){var g=setTimeout(function(){if(l.stylesheets&&x2(l,l.stylesheets),l.unsuspend){var b=l.unsuspend;l.unsuspend=null,b()}},6e4);return l.unsuspend=d,function(){l.unsuspend=null,clearTimeout(g)}}:null}function db(){if(this.count--,this.count===0){if(this.stylesheets)x2(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var fb=null;function x2(l,d){l.stylesheets=null,l.unsuspend!==null&&(l.count++,fb=new Map,d.forEach(AX,l),fb=null,db.call(l))}function AX(l,d){if(!(d.state.loading&4)){var g=fb.get(l);if(g)var b=g.get(null);else{g=new Map,fb.set(l,g);for(var S=l.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O<S.length;O++){var U=S[O];(U.nodeName==="LINK"||U.getAttribute("media")!=="not all")&&(g.set(U.dataset.precedence,U),b=U)}b&&g.set(null,b)}S=d.instance,U=S.getAttribute("data-precedence"),O=g.get(U)||b,O===b&&g.set(null,S),g.set(U,S),this.count++,b=db.bind(this),S.addEventListener("load",b),S.addEventListener("error",b),O?O.parentNode.insertBefore(S,O.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(S,l.firstChild)),d.state.loading|=4}}var cm={$$typeof:y,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function $X(l,d,g,b,S,O,U,Y){this.tag=1,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=cs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cs(0),this.hiddenUpdates=cs(null),this.identifierPrefix=b,this.onUncaughtError=S,this.onCaughtError=O,this.onRecoverableError=U,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function P3(l,d,g,b,S,O,U,Y,Z,le,Ee,je){return l=new $X(l,d,g,U,Y,Z,le,je),d=1,O===!0&&(d|=24),O=Us(3,null,null,d),l.current=O,O.stateNode=l,d=QS(),d.refCount++,l.pooledCache=d,d.refCount++,O.memoizedState={element:b,isDehydrated:g,cache:d},RE(O),l}function L3(l){return l?(l=Vd,l):Vd}function F3(l,d,g,b,S,O){S=L3(S),b.context===null?b.context=S:b.pendingContext=S,b=yl(d),b.payload={element:g},O=O===void 0?null:O,O!==null&&(b.callback=O),g=bl(l,b,d),g!==null&&(Cr(g,l,d),Wp(g,l,d))}function B3(l,d){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g<d?g:d}}function w2(l,d){B3(l,d),(l=l.alternate)&&B3(l,d)}function z3(l){if(l.tag===13){var d=ul(l,67108864);d!==null&&Cr(d,l,67108864),w2(l,67108864)}}var hb=!0;function TX(l,d,g,b){var S=D.T;D.T=null;var O=re.p;try{re.p=2,S2(l,d,g,b)}finally{re.p=O,D.T=S}}function RX(l,d,g,b){var S=D.T;D.T=null;var O=re.p;try{re.p=8,S2(l,d,g,b)}finally{re.p=O,D.T=S}}function S2(l,d,g,b){if(hb){var S=E2(b);if(S===null)u2(l,d,b,pb,g),U3(l,b);else if(kX(S,l,d,g,b))b.stopPropagation();else if(U3(l,b),d&4&&-1<MX.indexOf(l)){for(;S!==null;){var O=il(S);if(O!==null)switch(O.tag){case 3:if(O=O.stateNode,O.current.memoizedState.isDehydrated){var U=Yn(O.pendingLanes);if(U!==0){var Y=O;for(Y.pendingLanes|=2,Y.entangledLanes|=2;U;){var Z=1<<31-Gn(U);Y.entanglements[1]|=Z,U&=~Z}lo(O),(gn&6)===0&&(K0=ie()+500,rm(0))}}break;case 13:Y=ul(O,2),Y!==null&&Cr(Y,O,2),eb(),w2(O,2)}if(O=E2(b),O===null&&u2(l,d,b,pb,g),O===S)break;S=O}S!==null&&b.stopPropagation()}else u2(l,d,b,null,g)}}function E2(l){return l=AS(l),N2(l)}var pb=null;function N2(l){if(pb=null,l=zo(l),l!==null){var d=z(l);if(d===null)l=null;else{var g=d.tag;if(g===13){if(l=q(d),l!==null)return l;l=null}else if(g===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;l=null}else d!==l&&(l=null)}}return pb=l,null}function V3(l){switch(l){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(de()){case be:return 2;case Ae:return 8;case Ie:case ht:return 32;case Vt:return 268435456;default:return 32}default:return 32}}var _2=!1,_l=null,Cl=null,Ol=null,um=new Map,dm=new Map,jl=[],MX="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function U3(l,d){switch(l){case"focusin":case"focusout":_l=null;break;case"dragenter":case"dragleave":Cl=null;break;case"mouseover":case"mouseout":Ol=null;break;case"pointerover":case"pointerout":um.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":dm.delete(d.pointerId)}}function fm(l,d,g,b,S,O){return l===null||l.nativeEvent!==O?(l={blockedOn:d,domEventName:g,eventSystemFlags:b,nativeEvent:O,targetContainers:[S]},d!==null&&(d=il(d),d!==null&&z3(d)),l):(l.eventSystemFlags|=b,d=l.targetContainers,S!==null&&d.indexOf(S)===-1&&d.push(S),l)}function kX(l,d,g,b,S){switch(d){case"focusin":return _l=fm(_l,l,d,g,b,S),!0;case"dragenter":return Cl=fm(Cl,l,d,g,b,S),!0;case"mouseover":return Ol=fm(Ol,l,d,g,b,S),!0;case"pointerover":var O=S.pointerId;return um.set(O,fm(um.get(O)||null,l,d,g,b,S)),!0;case"gotpointercapture":return O=S.pointerId,dm.set(O,fm(dm.get(O)||null,l,d,g,b,S)),!0}return!1}function q3(l){var d=zo(l.target);if(d!==null){var g=z(d);if(g!==null){if(d=g.tag,d===13){if(d=q(g),d!==null){l.blockedOn=d,wp(l.priority,function(){if(g.tag===13){var b=ps(),S=ul(g,b);S!==null&&Cr(S,g,b),w2(g,b)}});return}}else if(d===3&&g.stateNode.current.memoizedState.isDehydrated){l.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}l.blockedOn=null}function mb(l){if(l.blockedOn!==null)return!1;for(var d=l.targetContainers;0<d.length;){var g=E2(l.nativeEvent);if(g===null){g=l.nativeEvent;var b=new g.constructor(g.type,g);jS=b,g.target.dispatchEvent(b),jS=null}else return d=il(g),d!==null&&z3(d),l.blockedOn=g,!1;d.shift()}return!0}function H3(l,d,g){mb(l)&&g.delete(d)}function IX(){_2=!1,_l!==null&&mb(_l)&&(_l=null),Cl!==null&&mb(Cl)&&(Cl=null),Ol!==null&&mb(Ol)&&(Ol=null),um.forEach(H3),dm.forEach(H3)}function gb(l,d){l.blockedOn===d&&(l.blockedOn=null,_2||(_2=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,IX)))}var yb=null;function W3(l){yb!==l&&(yb=l,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){yb===l&&(yb=null);for(var d=0;d<l.length;d+=3){var g=l[d],b=l[d+1],S=l[d+2];if(typeof b!="function"){if(N2(b||g)===null)continue;break}var O=il(g);O!==null&&(l.splice(d,3),d-=3,pE(O,{pending:!0,data:S,method:g.method,action:b},b,S))}}))}function hm(l){function d(Z){return gb(Z,l)}_l!==null&&gb(_l,l),Cl!==null&&gb(Cl,l),Ol!==null&&gb(Ol,l),um.forEach(d),dm.forEach(d);for(var g=0;g<jl.length;g++){var b=jl[g];b.blockedOn===l&&(b.blockedOn=null)}for(;0<jl.length&&(g=jl[0],g.blockedOn===null);)q3(g),g.blockedOn===null&&jl.shift();if(g=(l.ownerDocument||l).$$reactFormReplay,g!=null)for(b=0;b<g.length;b+=3){var S=g[b],O=g[b+1],U=S[Jn]||null;if(typeof O=="function")U||W3(g);else if(U){var Y=null;if(O&&O.hasAttribute("formAction")){if(S=O,U=O[Jn]||null)Y=U.formAction;else if(N2(S)!==null)continue}else Y=U.action;typeof Y=="function"?g[b+1]=Y:(g.splice(b,3),b-=3),W3(g)}}}function C2(l){this._internalRoot=l}bb.prototype.render=C2.prototype.render=function(l){var d=this._internalRoot;if(d===null)throw Error(r(409));var g=d.current,b=ps();F3(g,b,l,d,null,null)},bb.prototype.unmount=C2.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var d=l.containerInfo;l.tag===0&&of(),F3(l.current,2,null,l,null,null),eb(),d[dt]=null}};function bb(l){this._internalRoot=l}bb.prototype.unstable_scheduleHydration=function(l){if(l){var d=qc();l={blockedOn:null,target:l,priority:d};for(var g=0;g<jl.length&&d!==0&&d<jl[g].priority;g++);jl.splice(g,0,l),g===0&&q3(l)}};var G3=t.version;if(G3!=="19.0.0")throw Error(r(527,G3,"19.0.0"));re.findDOMNode=function(l){var d=l._reactInternals;if(d===void 0)throw typeof l.render=="function"?Error(r(188)):(l=Object.keys(l).join(","),Error(r(268,l)));return l=W(d),l=l!==null?X(l):null,l=l===null?null:l.stateNode,l};var DX={bundleType:0,version:"19.0.0",rendererPackageName:"react-dom",currentDispatcherRef:D,findFiberByHostInstance:zo,reconcilerVersion:"19.0.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vb.isDisabled&&vb.supportsFiber)try{Ut=vb.inject(DX),Bt=vb}catch{}}return mm.createRoot=function(l,d){if(!s(l))throw Error(r(299));var g=!1,b="",S=uR,O=dR,U=fR,Y=null;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onUncaughtError!==void 0&&(S=d.onUncaughtError),d.onCaughtError!==void 0&&(O=d.onCaughtError),d.onRecoverableError!==void 0&&(U=d.onRecoverableError),d.unstable_transitionCallbacks!==void 0&&(Y=d.unstable_transitionCallbacks)),d=P3(l,1,!1,null,null,g,b,S,O,U,Y,null),l[dt]=d.current,c2(l.nodeType===8?l.parentNode:l),new C2(d)},mm.hydrateRoot=function(l,d,g){if(!s(l))throw Error(r(299));var b=!1,S="",O=uR,U=dR,Y=fR,Z=null,le=null;return g!=null&&(g.unstable_strictMode===!0&&(b=!0),g.identifierPrefix!==void 0&&(S=g.identifierPrefix),g.onUncaughtError!==void 0&&(O=g.onUncaughtError),g.onCaughtError!==void 0&&(U=g.onCaughtError),g.onRecoverableError!==void 0&&(Y=g.onRecoverableError),g.unstable_transitionCallbacks!==void 0&&(Z=g.unstable_transitionCallbacks),g.formState!==void 0&&(le=g.formState)),d=P3(l,1,!0,d,g??null,b,S,O,U,Y,Z,le),d.context=L3(null),g=d.current,b=ps(),S=yl(b),S.callback=null,bl(g,S,b),d.current.lanes=b,Er(d,b),lo(d),l[dt]=d.current,c2(l),new bb(d)},mm.version="19.0.0",mm}var iM;function YX(){if(iM)return $2.exports;iM=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),$2.exports=GX(),$2.exports}var JX=YX(),Hl=function(){return Hl=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hl.apply(this,arguments)};function XX(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function KX(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var uv="right-scroll-bar-position",dv="width-before-scroll-bar",QX="with-scroll-bars-hidden",ZX="--removed-body-scroll-bar-size";function k2(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function eK(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var tK=typeof window<"u"?w.useLayoutEffect:w.useEffect,oM=new WeakMap;function nK(e,t){var n=eK(null,function(r){return e.forEach(function(s){return k2(s,r)})});return tK(function(){var r=oM.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||k2(a,null)}),i.forEach(function(a){s.has(a)||k2(a,o)})}oM.set(n,e)},[e]),n}var Fv=function(){return Fv=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fv.apply(this,arguments)};function rK(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function sK(e){return e}function iK(e,t){t===void 0&&(t=sK);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var c=function(){var f=o;o=[],f.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){o.push(f),u()},filter:function(f){return o=o.filter(f),n}}}};return s}function oK(e){e===void 0&&(e={});var t=iK(null);return t.options=Fv({async:!0,ssr:!1},e),t}var r8=function(e){var t=e.sideCar,n=rK(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,Fv({},n))};r8.isSideCarExport=!0;function aK(e,t){return e.useMedium(t),r8}var s8=oK(),I2=function(){},Ew=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:I2,onWheelCapture:I2,onTouchMoveCapture:I2}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,y=e.noIsolation,v=e.inert,x=e.allowPinchZoom,E=e.as,N=E===void 0?"div":E,_=e.gapMode,C=XX(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,A=nK([n,t]),$=Hl(Hl({},C),s);return w.createElement(w.Fragment,null,f&&w.createElement(j,{sideCar:s8,removeScrollBar:u,shards:h,noIsolation:y,inert:v,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),Hl(Hl({},$),{ref:A})):w.createElement(N,Hl({},$,{className:c,ref:A}),a))});Ew.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ew.classNames={fullWidth:dv,zeroRight:uv};var lK=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cK(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lK();return t&&e.setAttribute("nonce",t),e}function uK(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dK(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fK=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cK())&&(uK(t,n),dK(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hK=function(){var e=fK();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},i8=function(){var e=hK(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},pK={left:0,top:0,right:0,gap:0},D2=function(e){return parseInt(e||"",10)||0},mK=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[D2(n),D2(r),D2(s)]},gK=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return pK;var t=mK(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},yK=i8(),Ff="data-scroll-locked",bK=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(QX,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(Ff,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(uv,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(dv,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(uv," .").concat(uv,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(dv," .").concat(dv,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(Ff,`] {
    `).concat(ZX,": ").concat(a,`px;
  }
`)},aM=function(){var e=parseInt(document.body.getAttribute(Ff)||"0",10);return isFinite(e)?e:0},vK=function(){w.useEffect(function(){return document.body.setAttribute(Ff,(aM()+1).toString()),function(){var e=aM()-1;e<=0?document.body.removeAttribute(Ff):document.body.setAttribute(Ff,e.toString())}},[])},xK=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;vK();var i=w.useMemo(function(){return gK(s)},[s]);return w.createElement(yK,{styles:bK(i,!t,s,n?"":"!important")})},B_=!1;if(typeof window<"u")try{var xb=Object.defineProperty({},"passive",{get:function(){return B_=!0,!0}});window.addEventListener("test",xb,xb),window.removeEventListener("test",xb,xb)}catch{B_=!1}var ff=B_?{passive:!1}:!1,wK=function(e){return e.tagName==="TEXTAREA"},o8=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!wK(e)&&n[t]==="visible")},SK=function(e){return o8(e,"overflowY")},EK=function(e){return o8(e,"overflowX")},lM=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=a8(e,r);if(s){var i=l8(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},NK=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},_K=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},a8=function(e,t){return e==="v"?SK(t):EK(t)},l8=function(e,t){return e==="v"?NK(t):_K(t)},CK=function(e,t){return e==="h"&&t==="rtl"?-1:1},OK=function(e,t,n,r,s){var i=CK(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,c=t.contains(a),u=!1,f=o>0,h=0,m=0;do{var y=l8(e,a),v=y[0],x=y[1],E=y[2],N=x-E-i*v;(v||N)&&a8(e,a)&&(h+=N,m+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(f&&Math.abs(h)<1||!f&&Math.abs(m)<1)&&(u=!0),u},wb=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cM=function(e){return[e.deltaX,e.deltaY]},uM=function(e){return e&&"current"in e?e.current:e},jK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},AK=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},$K=0,hf=[];function TK(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState($K++)[0],i=w.useState(i8)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var x=KX([e.lockRef.current],(e.shards||[]).map(uM),!0).filter(Boolean);return x.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),x.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(x,E){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var N=wb(x),_=n.current,C="deltaX"in x?x.deltaX:_[0]-N[0],j="deltaY"in x?x.deltaY:_[1]-N[1],A,$=x.target,R=Math.abs(C)>Math.abs(j)?"h":"v";if("touches"in x&&R==="h"&&$.type==="range")return!1;var M=lM(R,$);if(!M)return!0;if(M?A=R:(A=R==="v"?"h":"v",M=lM(R,$)),!M)return!1;if(!r.current&&"changedTouches"in x&&(C||j)&&(r.current=A),!A)return!0;var D=r.current||A;return OK(D,E,x,D==="h"?C:j)},[]),c=w.useCallback(function(x){var E=x;if(!(!hf.length||hf[hf.length-1]!==i)){var N="deltaY"in E?cM(E):wb(E),_=t.current.filter(function(A){return A.name===E.type&&(A.target===E.target||E.target===A.shadowParent)&&jK(A.delta,N)})[0];if(_&&_.should){E.cancelable&&E.preventDefault();return}if(!_){var C=(o.current.shards||[]).map(uM).filter(Boolean).filter(function(A){return A.contains(E.target)}),j=C.length>0?a(E,C[0]):!o.current.noIsolation;j&&E.cancelable&&E.preventDefault()}}},[]),u=w.useCallback(function(x,E,N,_){var C={name:x,delta:E,target:N,should:_,shadowParent:RK(N)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(j){return j!==C})},1)},[]),f=w.useCallback(function(x){n.current=wb(x),r.current=void 0},[]),h=w.useCallback(function(x){u(x.type,cM(x),x.target,a(x,e.lockRef.current))},[]),m=w.useCallback(function(x){u(x.type,wb(x),x.target,a(x,e.lockRef.current))},[]);w.useEffect(function(){return hf.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,ff),document.addEventListener("touchmove",c,ff),document.addEventListener("touchstart",f,ff),function(){hf=hf.filter(function(x){return x!==i}),document.removeEventListener("wheel",c,ff),document.removeEventListener("touchmove",c,ff),document.removeEventListener("touchstart",f,ff)}},[]);var y=e.removeScrollBar,v=e.inert;return w.createElement(w.Fragment,null,v?w.createElement(i,{styles:AK(s)}):null,y?w.createElement(xK,{gapMode:e.gapMode}):null)}function RK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const MK=aK(s8,TK);var Bv=w.forwardRef(function(e,t){return w.createElement(Ew,Hl({},e,{ref:t,sideCar:MK}))});Bv.classNames=Ew.classNames;function So(e){return Object.keys(e)}function P2(e){return e&&typeof e=="object"&&!Array.isArray(e)}function vj(e,t){const n={...e},r=t;return P2(e)&&P2(t)&&Object.keys(t).forEach(s=>{P2(r[s])&&s in e?n[s]=vj(n[s],r[s]):n[s]=r[s]}),n}function kK(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function IK(e){var t;return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:(t=e.match(/^calc\((.*?)\)$/))==null?void 0:t[1].split("*")[0].trim()}function DK(e){const t=IK(e);return typeof t=="number"?t:typeof t=="string"?t.includes("calc")||t.includes("var")?t:t.includes("px")?Number(t.replace("px","")):t.includes("rem")?Number(t.replace("rem",""))*16:t.includes("em")?Number(t.replace("em",""))*16:Number(t):NaN}function L2(e){return e==="0rem"?"0rem":`calc(${e} * var(--mantine-scale))`}function c8(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const s=`${r/16}${e}`;return t?L2(s):s}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(i=>n(i)).join(",");if(r.includes(" "))return r.split(" ").map(i=>n(i)).join(" ");if(r.includes(e))return t?L2(r):r;const s=r.replace("px","");if(!Number.isNaN(Number(s))){const i=`${Number(s)/16}${e}`;return t?L2(i):i}}return r}return n}const _e=c8("rem",{shouldScale:!0}),dM=c8("em");function xj(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function u8(e){if(typeof e=="number")return!0;if(typeof e=="string"){if(e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!=="")return!0;const t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(r=>t.test(r))}return!1}function jc(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==w.Fragment:!1}function Ua(e){const t=w.createContext(null);return[({children:s,value:i})=>p.jsx(t.Provider,{value:i,children:s}),()=>{const s=w.useContext(t);if(s===null)throw new Error(e);return s}]}function ld(e=null){const t=w.createContext(e);return[({children:s,value:i})=>p.jsx(t.Provider,{value:i,children:s}),()=>w.useContext(t)]}function fM(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function zv(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function PK(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].disabled)return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].disabled)return r}return e}function LK(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].disabled)return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].disabled)return r}return e}function FK(e,t,n){return zv(e,n)===zv(t,n)}function d8({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:s=!1,dir:i="rtl",orientation:o}){return a=>{var v;n==null||n(a);const c=Array.from(((v=zv(a.currentTarget,e))==null?void 0:v.querySelectorAll(t))||[]).filter(x=>FK(a.currentTarget,x,e)),u=c.findIndex(x=>a.currentTarget===x),f=LK(u,c,r),h=PK(u,c,r),m=i==="rtl"?h:f,y=i==="rtl"?f:h;switch(a.key){case"ArrowRight":{o==="horizontal"&&(a.stopPropagation(),a.preventDefault(),c[m].focus(),s&&c[m].click());break}case"ArrowLeft":{o==="horizontal"&&(a.stopPropagation(),a.preventDefault(),c[y].focus(),s&&c[y].click());break}case"ArrowUp":{o==="vertical"&&(a.stopPropagation(),a.preventDefault(),c[h].focus(),s&&c[h].click());break}case"ArrowDown":{o==="vertical"&&(a.stopPropagation(),a.preventDefault(),c[f].focus(),s&&c[f].click());break}case"Home":{a.stopPropagation(),a.preventDefault(),!c[0].disabled&&c[0].focus();break}case"End":{a.stopPropagation(),a.preventDefault();const x=c.length-1;!c[x].disabled&&c[x].focus();break}}}}const BK={app:100,modal:200,popover:300,overlay:400,max:9999};function Qi(e){return BK[e]}const z_=()=>{};function zK(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||z_:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function Mt(e,t="size",n=!0){if(e!==void 0)return u8(e)?n?_e(e):e:`var(--${t}-${e})`}function wj(e){return Mt(e,"mantine-spacing")}function Hn(e){return e===void 0?"var(--mantine-radius-default)":Mt(e,"mantine-radius")}function Br(e){return Mt(e,"mantine-font-size")}function Sj(e){if(e)return Mt(e,"mantine-shadow",!1)}function vo(e,t){return n=>{e==null||e(n),t==null||t(n)}}function VK(e,t,n){var r;return n?Array.from(((r=zv(n,t))==null?void 0:r.querySelectorAll(e))||[]).findIndex(s=>s===n):null}function UK(){const[e,t]=w.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}function Sa(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}function Bf(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function Eu(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}const qK=()=>{};function Nw(e,t){const n=typeof t=="number"?t:t.delay,r=typeof t=="number"?!1:t.flushOnUnmount,s=Eu(e),i=w.useRef(0),o=Object.assign(w.useCallback((...a)=>{window.clearTimeout(i.current);const c=()=>{i.current!==0&&(i.current=0,s(...a))};o.flush=c,i.current=window.setTimeout(c,n)},[s,n]),{flush:qK});return w.useEffect(()=>()=>{window.clearTimeout(i.current),r&&o.flush()},[o,r]),o}const hM=["mousedown","touchstart"];function yy(e,t,n){const r=w.useRef(null);return w.useEffect(()=>{const s=i=>{const{target:o}=i??{};if(Array.isArray(n)){const a=(o==null?void 0:o.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(o)&&o.tagName!=="HTML";n.every(u=>!!u&&!i.composedPath().includes(u))&&!a&&e()}else r.current&&!r.current.contains(o)&&e()};return(t||hM).forEach(i=>document.addEventListener(i,s)),()=>{(t||hM).forEach(i=>document.removeEventListener(i,s))}},[r,e,n]),r}function HK({timeout:e=2e3}={}){const[t,n]=w.useState(null),[r,s]=w.useState(!1),[i,o]=w.useState(null),a=f=>{window.clearTimeout(i),o(window.setTimeout(()=>s(!1),e)),s(f)};return{copy:f=>{"clipboard"in navigator?navigator.clipboard.writeText(f).then(()=>a(!0)).catch(h=>n(h)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{s(!1),n(null),window.clearTimeout(i)},error:t,copied:r}}function WK(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function GK(e,t){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function YK(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,s]=w.useState(n?t:GK(e)),i=w.useRef(null);return w.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),s(i.current.matches),WK(i.current,o=>s(o.matches))},[e]),r}const Wh=typeof document<"u"?w.useLayoutEffect:w.useEffect;function Ra(e,t){const n=w.useRef(!1);w.useEffect(()=>()=>{n.current=!1},[]),w.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function f8({opened:e,shouldReturnFocus:t=!0}){const n=w.useRef(null),r=()=>{var s;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((s=n.current)==null||s.focus({preventScroll:!0}))};return Ra(()=>{let s=-1;const i=o=>{o.key==="Tab"&&window.clearTimeout(s)};return document.addEventListener("keydown",i),e?n.current=document.activeElement:t&&(s=window.setTimeout(r,10)),()=>{window.clearTimeout(s),document.removeEventListener("keydown",i)}},[e,t]),r}const JK=/input|select|textarea|button|object/,h8="a, input, select, textarea, button, object, [tabindex]";function XK(e){return e.style.display==="none"}function KK(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(XK(n))return!1;n=n.parentNode}return!0}function p8(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function V_(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(p8(e));return(JK.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&KK(e)}function m8(e){const t=p8(e);return(Number.isNaN(t)||t>=0)&&V_(e)}function QK(e){return Array.from(e.querySelectorAll(h8)).filter(m8)}function ZK(e,t){const n=QK(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],s=e.getRootNode();let i=r===s.activeElement||e===s.activeElement;const o=s.activeElement;if(o.tagName==="INPUT"&&o.getAttribute("type")==="radio"&&(i=n.filter(f=>f.getAttribute("type")==="radio"&&f.getAttribute("name")===o.getAttribute("name")).includes(r)),!i)return;t.preventDefault();const c=n[t.shiftKey?n.length-1:0];c&&c.focus()}function _w(e=!0){const t=w.useRef(null),n=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const o=Array.from(s.querySelectorAll(h8));i=o.find(m8)||o.find(V_)||null,!i&&V_(s)&&(i=s)}i&&i.focus({preventScroll:!0})},r=w.useCallback(s=>{e&&s!==null&&t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&n(s)}),t.current=s):t.current=null)},[e]);return w.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>n(t.current));const s=i=>{i.key==="Tab"&&t.current&&ZK(t.current,i)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),r}const eQ=e=>(e+1)%1e6;function tQ(){const[,e]=w.useReducer(eQ,0);return e}const nQ=Re.useId||(()=>{});function rQ(){const e=nQ();return e?`mantine-${e.replace(/:/g,"")}`:""}function di(e){const t=rQ(),[n,r]=w.useState(t);return Wh(()=>{r(Bf())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function U_(e,t,n){w.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function Vv(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function sQ(...e){const t=new Map;return n=>{if(e.forEach(r=>{const s=Vv(r,n);s&&t.set(r,s)}),t.size>0)return()=>{e.forEach(r=>{const s=t.get(r);s?s():Vv(r,null)}),t.clear()}}}function _n(...e){return w.useCallback(sQ(...e),e)}function iQ(e,t,n="ltr"){const r=w.useRef(null),s=w.useRef(!1),i=w.useRef(!1),o=w.useRef(0),[a,c]=w.useState(!1);return w.useEffect(()=>{s.current=!0},[]),w.useEffect(()=>{const u=r.current,f=({x:C,y:j})=>{cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{if(s.current&&u){u.style.userSelect="none";const A=u.getBoundingClientRect();if(A.width&&A.height){const $=Sa((C-A.left)/A.width,0,1);e({x:n==="ltr"?$:1-$,y:Sa((j-A.top)/A.height,0,1)})}}})},h=()=>{document.addEventListener("mousemove",E),document.addEventListener("mouseup",v),document.addEventListener("touchmove",_),document.addEventListener("touchend",v)},m=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",v),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",v)},y=()=>{!i.current&&s.current&&(i.current=!0,typeof(t==null?void 0:t.onScrubStart)=="function"&&t.onScrubStart(),c(!0),h())},v=()=>{i.current&&s.current&&(i.current=!1,c(!1),m(),setTimeout(()=>{typeof(t==null?void 0:t.onScrubEnd)=="function"&&t.onScrubEnd()},0))},x=C=>{y(),C.preventDefault(),E(C)},E=C=>f({x:C.clientX,y:C.clientY}),N=C=>{C.cancelable&&C.preventDefault(),y(),_(C)},_=C=>{C.cancelable&&C.preventDefault(),f({x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY})};return u==null||u.addEventListener("mousedown",x),u==null||u.addEventListener("touchstart",N,{passive:!1}),()=>{u&&(u.removeEventListener("mousedown",x),u.removeEventListener("touchstart",N))}},[n,e]),{ref:r,active:a}}function ss({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[s,i]=w.useState(t!==void 0?t:n),o=(a,...c)=>{i(a),r==null||r(a,...c)};return e!==void 0?[e,r,!0]:[s,o,!1]}function Ej(e,t){return YK("(prefers-reduced-motion: reduce)",e,t)}function g8(e=[!1,!0]){const[[t],n]=w.useReducer((r,s)=>{const i=s instanceof Function?s(r[0]):s,o=Math.abs(r.indexOf(i));return r.slice(o).concat(r.slice(0,o))},e);return[t,n]}const pM={passive:!0};function oQ(){const[e,t]=w.useState({width:0,height:0}),n=w.useCallback(()=>{t({width:window.innerWidth||0,height:window.innerHeight||0})},[]);return U_("resize",n,pM),U_("orientationchange",n,pM),w.useEffect(n,[]),e}function aQ(e){const t=e.toLowerCase().split("+").map(i=>i.trim()),n={alt:t.includes("alt"),ctrl:t.includes("ctrl"),meta:t.includes("meta"),mod:t.includes("mod"),shift:t.includes("shift"),plus:t.includes("[plus]")},r=["alt","ctrl","meta","shift","mod"],s=t.find(i=>!r.includes(i));return{...n,key:s==="[plus]"?"+":s}}function lQ(e,t,n){const{alt:r,ctrl:s,meta:i,mod:o,shift:a,key:c}=e,{altKey:u,ctrlKey:f,metaKey:h,shiftKey:m,key:y,code:v}=t;if(r!==u)return!1;if(o){if(!f&&!h)return!1}else if(s!==f||i!==h)return!1;return a!==m?!1:!!(c&&(!n&&y.toLowerCase()===c.toLowerCase()||v.replace("Key","").toLowerCase()===c.toLowerCase()))}function y8(e,t){return n=>lQ(aQ(e),n,t)}function cQ(e){return t=>{const n="nativeEvent"in t?t.nativeEvent:t;e.forEach(([r,s,i={preventDefault:!0,usePhysicalKeys:!1}])=>{y8(r,i.usePhysicalKeys)(n)&&(i.preventDefault&&t.preventDefault(),s(n))})}}function uQ(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function Nj(e,t=["INPUT","TEXTAREA","SELECT"],n=!1){w.useEffect(()=>{const r=s=>{e.forEach(([i,o,a={preventDefault:!0,usePhysicalKeys:!1}])=>{y8(i,a.usePhysicalKeys)(s)&&uQ(s,t,n)&&(a.preventDefault&&s.preventDefault(),o(s))})};return document.documentElement.addEventListener("keydown",r),()=>document.documentElement.removeEventListener("keydown",r)},[e])}function Gh(e=!1,t){const{onOpen:n,onClose:r}={},[s,i]=w.useState(e),o=w.useCallback(()=>{i(u=>u||(n==null||n(),!0))},[n]),a=w.useCallback(()=>{i(u=>u&&(r==null||r(),!1))},[r]),c=w.useCallback(()=>{s?a():o()},[a,o,s]);return[s,{open:o,close:a,toggle:c}]}function dQ(e,t,n={autoInvoke:!1}){const r=w.useRef(null),s=w.useCallback((...o)=>{r.current||(r.current=window.setTimeout(()=>{e(o),r.current=null},t))},[t]),i=w.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return w.useEffect(()=>(n.autoInvoke&&s(),i),[i,s]),{start:s,clear:i}}function fQ(e){const t=w.useRef(void 0);return w.useEffect(()=>{t.current=e},[e]),t.current}function hQ(){const e=w.useRef(null),[t,n]=w.useState(!1);return{ref:w.useCallback(s=>{var i,o;typeof IntersectionObserver<"u"&&(s&&!e.current?e.current=new IntersectionObserver(a=>n(a.some(c=>c.isIntersecting))):(i=e.current)==null||i.disconnect(),s?(o=e.current)==null||o.observe(s):n(!1))},[]),inViewport:t}}function pQ(e,t,n){const r=w.useRef(null),s=w.useRef(null);return w.useEffect(()=>{const i=typeof n=="function"?n():n;return(i||s.current)&&(r.current=new MutationObserver(e),r.current.observe(i||s.current,t)),()=>{var o;(o=r.current)==null||o.disconnect()}},[e,t]),s}function mQ(){const[e,t]=w.useState(!1);return w.useEffect(()=>t(!0),[]),e}function gQ(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function yQ(e){function t(r){const s=Object.keys(r).reduce((i,o)=>(i[`${e}:${o}`]=a=>r[o](a.detail),i),{});Wh(()=>(Object.keys(s).forEach(i=>{window.removeEventListener(i,s[i]),window.addEventListener(i,s[i])}),()=>Object.keys(s).forEach(i=>{window.removeEventListener(i,s[i])})),[s])}function n(r){return(...s)=>gQ(`${e}:${String(r)}`,s[0])}return[t,n]}var bQ={};function b8(){return typeof process<"u"&&bQ?"production":"development"}function mM(e,t){return t.length===0?e:t.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}function Cw(e){var n;const t=Re.version;return typeof Re.version!="string"||t.startsWith("18.")?e==null?void 0:e.ref:(n=e==null?void 0:e.props)==null?void 0:n.ref}function v8(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=v8(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hn(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=v8(e))&&(r&&(r+=" "),r+=t);return r}const vQ={};function xQ(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,s])=>{t[r]?t[r]=hn(t[r],s):t[r]=s})}),t}function Ow({theme:e,classNames:t,props:n,stylesCtx:r}){const i=(Array.isArray(t)?t:[t]).map(o=>typeof o=="function"?o(e,n,r):o||vQ);return xQ(i)}function Uv({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((i,o)=>typeof o=="function"?{...i,...o(e,n,r)}:{...i,...o},{})}const x8=w.createContext(null);function Ac(){const e=w.useContext(x8);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function wQ(){return Ac().cssVariablesResolver}function SQ(){return Ac().classNamesPrefix}function _j(){return Ac().getStyleNonce}function EQ(){return Ac().withStaticClasses}function NQ(){return Ac().headless}function _Q(){var e;return(e=Ac().stylesTransform)==null?void 0:e.sx}function CQ(){var e;return(e=Ac().stylesTransform)==null?void 0:e.styles}function w8(){return Ac().env||"default"}function OQ(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function jQ(e){let t=e.replace("#","");if(t.length===3){const o=t.split("");t=[o[0],o[0],o[1],o[1],o[2],o[2]].join("")}if(t.length===8){const o=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:o}}const n=parseInt(t,16),r=n>>16&255,s=n>>8&255,i=n&255;return{r,g:s,b:i,a:1}}function AQ(e){const[t,n,r,s]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:s||1}}function $Q(e){const t=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=e.match(t);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),s=parseInt(n[2],10)/100,i=parseInt(n[3],10)/100,o=n[5]?parseFloat(n[5]):void 0,a=(1-Math.abs(2*i-1))*s,c=r/60,u=a*(1-Math.abs(c%2-1)),f=i-a/2;let h,m,y;return c>=0&&c<1?(h=a,m=u,y=0):c>=1&&c<2?(h=u,m=a,y=0):c>=2&&c<3?(h=0,m=a,y=u):c>=3&&c<4?(h=0,m=u,y=a):c>=4&&c<5?(h=u,m=0,y=a):(h=a,m=0,y=u),{r:Math.round((h+f)*255),g:Math.round((m+f)*255),b:Math.round((y+f)*255),a:o||1}}function Cj(e){return OQ(e)?jQ(e):e.startsWith("rgb")?AQ(e):e.startsWith("hsl")?$Q(e):{r:0,g:0,b:0,a:1}}function Sb(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:s,a:i}=Cj(e),o=1-t,a=c=>Math.round(c*o);return`rgba(${a(n)}, ${a(r)}, ${a(s)}, ${i})`}function mg(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function F2(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function TQ(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function RQ(e){if(e.startsWith("oklch("))return(TQ(e)||0)/100;const{r:t,g:n,b:r}=Cj(e),s=t/255,i=n/255,o=r/255,a=F2(s),c=F2(i),u=F2(o);return .2126*a+.7152*c+.0722*u}function gm(e,t=.179){return e.startsWith("var(")?!1:RQ(e)>t}function $c({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:gm(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:gm(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:gm(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,s]=e.split("."),i=s?Number(s):void 0,o=r in t.colors;if(o){const a=i!==void 0?t.colors[r][i]:t.colors[r][mg(t,n||"light")];return{color:r,value:a,shade:i,isThemeColor:o,isLight:gm(a,t.luminanceThreshold),variable:s?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:o,isLight:gm(e,t.luminanceThreshold),shade:i,variable:void 0}}function wr(e,t){const n=$c({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function gM(e,t){const n={from:(e==null?void 0:e.from)||t.defaultGradient.from,to:(e==null?void 0:e.to)||t.defaultGradient.to,deg:(e==null?void 0:e.deg)??t.defaultGradient.deg??0},r=wr(n.from,t),s=wr(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${s} 100%)`}function fo(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const i=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${i}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:s}=Cj(e);return`rgba(${n}, ${r}, ${s}, ${t})`}const pf=fo,MQ=({color:e,theme:t,variant:n,gradient:r,autoContrast:s})=>{const i=$c({color:e,theme:t}),o=typeof s=="boolean"?s:t.autoContrast;if(n==="filled"){const a=o&&i.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return i.isThemeColor?i.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:a,border:`${_e(1)} solid transparent`}:{background:`var(--mantine-color-${i.color}-${i.shade})`,hover:`var(--mantine-color-${i.color}-${i.shade===9?8:i.shade+1})`,color:a,border:`${_e(1)} solid transparent`}:{background:e,hover:Sb(e,.1),color:a,border:`${_e(1)} solid transparent`}}if(n==="light"){if(i.isThemeColor){if(i.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${_e(1)} solid transparent`};const a=t.colors[i.color][i.shade];return{background:fo(a,.1),hover:fo(a,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${_e(1)} solid transparent`}}return{background:fo(e,.1),hover:fo(e,.12),color:e,border:`${_e(1)} solid transparent`}}if(n==="outline")return i.isThemeColor?i.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${_e(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:fo(t.colors[i.color][i.shade],.05),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${_e(1)} solid var(--mantine-color-${i.color}-${i.shade})`}:{background:"transparent",hover:fo(e,.05),color:e,border:`${_e(1)} solid ${e}`};if(n==="subtle"){if(i.isThemeColor){if(i.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${_e(1)} solid transparent`};const a=t.colors[i.color][i.shade];return{background:"transparent",hover:fo(a,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${_e(1)} solid transparent`}}return{background:"transparent",hover:fo(e,.12),color:e,border:`${_e(1)} solid transparent`}}return n==="transparent"?i.isThemeColor?i.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${_e(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${_e(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${_e(1)} solid transparent`}:n==="white"?i.isThemeColor?i.shade===void 0?{background:"var(--mantine-color-white)",hover:Sb(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${_e(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Sb(t.white,.01),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${_e(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Sb(t.white,.01),color:e,border:`${_e(1)} solid transparent`}:n==="gradient"?{background:gM(r,t),hover:gM(r,t),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${_e(1)} solid var(--mantine-color-default-border)`}:{}},kQ={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},yM="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",Oj={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:kQ,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:MQ,autoContrast:!1,luminanceThreshold:.3,fontFamily:yM,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:yM,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:_e(34),lineHeight:"1.3"},h2:{fontSize:_e(26),lineHeight:"1.35"},h3:{fontSize:_e(22),lineHeight:"1.4"},h4:{fontSize:_e(18),lineHeight:"1.45"},h5:{fontSize:_e(16),lineHeight:"1.5"},h6:{fontSize:_e(14),lineHeight:"1.5"}}},fontSizes:{xs:_e(12),sm:_e(14),md:_e(16),lg:_e(18),xl:_e(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:_e(2),sm:_e(4),md:_e(8),lg:_e(16),xl:_e(32)},spacing:{xs:_e(10),sm:_e(12),md:_e(16),lg:_e(20),xl:_e(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${_e(1)} ${_e(3)} rgba(0, 0, 0, 0.05), 0 ${_e(1)} ${_e(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${_e(1)} ${_e(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_e(10)} ${_e(15)} ${_e(-5)}, rgba(0, 0, 0, 0.04) 0 ${_e(7)} ${_e(7)} ${_e(-5)}`,md:`0 ${_e(1)} ${_e(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_e(20)} ${_e(25)} ${_e(-5)}, rgba(0, 0, 0, 0.04) 0 ${_e(10)} ${_e(10)} ${_e(-5)}`,lg:`0 ${_e(1)} ${_e(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_e(28)} ${_e(23)} ${_e(-7)}, rgba(0, 0, 0, 0.04) 0 ${_e(12)} ${_e(12)} ${_e(-7)}`,xl:`0 ${_e(1)} ${_e(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_e(36)} ${_e(28)} ${_e(-7)}, rgba(0, 0, 0, 0.04) 0 ${_e(17)} ${_e(17)} ${_e(-7)}`},other:{},components:{}};function bM(e){return e==="auto"||e==="dark"||e==="light"}function IQ({key:e="mantine-color-scheme-value"}={}){let t;return{get:n=>{if(typeof window>"u")return n;try{const r=window.localStorage.getItem(e);return bM(r)?r:n}catch{return n}},set:n=>{try{window.localStorage.setItem(e,n)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:n=>{t=r=>{r.storageArea===window.localStorage&&r.key===e&&bM(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const DQ="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",vM="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function B2(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function xM(e){if(!(e.primaryColor in e.colors))throw new Error(DQ);if(typeof e.primaryShade=="object"&&(!B2(e.primaryShade.dark)||!B2(e.primaryShade.light)))throw new Error(vM);if(typeof e.primaryShade=="number"&&!B2(e.primaryShade))throw new Error(vM)}function PQ(e,t){var r;if(!t)return xM(e),e;const n=vj(e,t);return t.fontFamily&&!((r=t.headings)!=null&&r.fontFamily)&&(n.headings.fontFamily=t.fontFamily),xM(n),n}const jj=w.createContext(null),LQ=()=>w.useContext(jj)||Oj;function As(){const e=w.useContext(jj);if(!e)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return e}function S8({theme:e,children:t,inherit:n=!0}){const r=LQ(),s=w.useMemo(()=>PQ(n?r:Oj,e),[e,r,n]);return p.jsx(jj.Provider,{value:s,children:t})}S8.displayName="@mantine/core/MantineThemeProvider";function FQ(){const e=As(),t=_j(),n=So(e.breakpoints).reduce((r,s)=>{const i=e.breakpoints[s].includes("px"),o=DK(e.breakpoints[s]),a=i?`${o-.1}px`:dM(o-.1),c=i?`${o}px`:dM(o);return`${r}@media (max-width: ${a}) {.mantine-visible-from-${s} {display: none !important;}}@media (min-width: ${c}) {.mantine-hidden-from-${s} {display: none !important;}}`},"");return p.jsx("style",{"data-mantine-styles":"classes",nonce:t==null?void 0:t(),dangerouslySetInnerHTML:{__html:n}})}function z2(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function ym(e,t){return(Array.isArray(e)?e:[e]).reduce((r,s)=>`${s}{${r}}`,t)}function BQ(e,t){const n=z2(e.variables),r=n?ym(t,n):"",s=z2(e.dark),i=z2(e.light),o=s?ym(t===":host"?`${t}([data-mantine-color-scheme="dark"])`:`${t}[data-mantine-color-scheme="dark"]`,s):"",a=i?ym(t===":host"?`${t}([data-mantine-color-scheme="light"])`:`${t}[data-mantine-color-scheme="light"]`,i):"";return`${r}${o}${a}`}function by({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&$c({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function wM(e,t){return by({color:e.colors[e.primaryColor][mg(e,t)],theme:e,autoContrast:null})}function Eb({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:s=!0}){if(!e.colors[t])return{};if(n==="light"){const a=mg(e,"light"),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${a===9?8:a+1})`,[`--mantine-color-${r}-light`]:pf(e.colors[t][a],.1),[`--mantine-color-${r}-light-hover`]:pf(e.colors[t][a],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline-hover`]:pf(e.colors[t][a],.05)};return s?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}const i=mg(e,"dark"),o={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${i})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${i===9?8:i+1})`,[`--mantine-color-${r}-light`]:pf(e.colors[t][Math.max(0,i-2)],.15),[`--mantine-color-${r}-light-hover`]:pf(e.colors[t][Math.max(0,i-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(i-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(i-4,0)})`,[`--mantine-color-${r}-outline-hover`]:pf(e.colors[t][Math.max(i-4,0)],.05)};return s?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...o}:o}function zQ(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function mf(e,t,n){So(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const E8=e=>{const t=mg(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:_e(e.defaultRadius),r={variables:{"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-color-scheme":"light dark","--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-primary-color-contrast":wM(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)"},dark:{"--mantine-primary-color-contrast":wM(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)"}};mf(r.variables,e.breakpoints,"breakpoint"),mf(r.variables,e.spacing,"spacing"),mf(r.variables,e.fontSizes,"font-size"),mf(r.variables,e.lineHeights,"line-height"),mf(r.variables,e.shadows,"shadow"),mf(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((i,o)=>{r.variables[`--mantine-primary-color-${o}`]=`var(--mantine-color-${e.primaryColor}-${o})`}),So(e.colors).forEach(i=>{const o=e.colors[i];if(zQ(o)){Object.assign(r.light,Eb({theme:e,name:o.name,color:o.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,Eb({theme:e,name:o.name,color:o.dark,colorScheme:"dark",withColorValues:!0}));return}o.forEach((a,c)=>{r.variables[`--mantine-color-${i}-${c}`]=a}),Object.assign(r.light,Eb({theme:e,color:i,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,Eb({theme:e,color:i,colorScheme:"dark",withColorValues:!1}))});const s=e.headings.sizes;return So(s).forEach(i=>{r.variables[`--mantine-${i}-font-size`]=s[i].fontSize,r.variables[`--mantine-${i}-line-height`]=s[i].lineHeight,r.variables[`--mantine-${i}-font-weight`]=s[i].fontWeight||e.headings.fontWeight}),r};function VQ({theme:e,generator:t}){const n=E8(e),r=t==null?void 0:t(e);return r?vj(n,r):n}const V2=E8(Oj);function UQ(e){const t={variables:{},light:{},dark:{}};return So(e.variables).forEach(n=>{V2.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),So(e.light).forEach(n=>{V2.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),So(e.dark).forEach(n=>{V2.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function qQ(e){return`
  ${e}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
  ${e}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
`}function N8({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=As(),r=_j(),s=wQ(),i=VQ({theme:n,generator:s}),o=e===":root"&&t,a=o?UQ(i):i,c=BQ(a,e);return c?p.jsx("style",{"data-mantine-styles":!0,nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:`${c}${o?"":qQ(e)}`}}):null}N8.displayName="@mantine/CssVariables";function HQ(){const e=console.error;console.error=(...t)=>{t.length>1&&typeof t[0]=="string"&&t[0].toLowerCase().includes("extra attributes from the server")&&typeof t[1]=="string"&&t[1].toLowerCase().includes("data-mantine-color-scheme")||e(...t)}}function gf(e,t){var s,i;const n=typeof window<"u"&&"matchMedia"in window&&((s=window.matchMedia("(prefers-color-scheme: dark)"))==null?void 0:s.matches),r=e!=="auto"?e:n?"dark":"light";(i=t())==null||i.setAttribute("data-mantine-color-scheme",r)}function WQ({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const s=w.useRef(null),[i,o]=w.useState(()=>e.get(t)),a=r||i,c=w.useCallback(f=>{r||(gf(f,n),o(f),e.set(f))},[e.set,a,r]),u=w.useCallback(()=>{o(t),gf(t,n),e.clear()},[e.clear,t]);return w.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),Wh(()=>{gf(e.get(t),n)},[]),w.useEffect(()=>{var h;if(r)return gf(r,n),()=>{};r===void 0&&gf(i,n),typeof window<"u"&&"matchMedia"in window&&(s.current=window.matchMedia("(prefers-color-scheme: dark)"));const f=m=>{i==="auto"&&gf(m.matches?"dark":"light",n)};return(h=s.current)==null||h.addEventListener("change",f),()=>{var m;return(m=s.current)==null?void 0:m.removeEventListener("change",f)}},[i,r]),{colorScheme:a,setColorScheme:c,clearColorScheme:u}}function GQ({respectReducedMotion:e,getRootElement:t}){Wh(()=>{var n;e&&((n=t())==null||n.setAttribute("data-respect-reduced-motion","true"))},[e])}HQ();function _8({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:s=!0,deduplicateCssVariables:i=!0,withCssVariables:o=!0,cssVariablesSelector:a=":root",classNamesPrefix:c="mantine",colorSchemeManager:u=IQ(),defaultColorScheme:f="light",getRootElement:h=()=>document.documentElement,cssVariablesResolver:m,forceColorScheme:y,stylesTransform:v,env:x}){const{colorScheme:E,setColorScheme:N,clearColorScheme:_}=WQ({defaultColorScheme:f,forceColorScheme:y,manager:u,getRootElement:h});return GQ({respectReducedMotion:(e==null?void 0:e.respectReducedMotion)||!1,getRootElement:h}),p.jsx(x8.Provider,{value:{colorScheme:E,setColorScheme:N,clearColorScheme:_,getRootElement:h,classNamesPrefix:c,getStyleNonce:n,cssVariablesResolver:m,cssVariablesSelector:a,withStaticClasses:r,stylesTransform:v,env:x},children:p.jsxs(S8,{theme:e,children:[o&&p.jsx(N8,{cssVariablesSelector:a,deduplicateCssVariables:i}),s&&p.jsx(FQ,{}),t]})})}_8.displayName="@mantine/core/MantineProvider";function Yh({classNames:e,styles:t,props:n,stylesCtx:r}){const s=As();return{resolvedClassNames:Ow({theme:s,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:Uv({theme:s,styles:t,props:n,stylesCtx:r||void 0})}}const YQ={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function JQ({theme:e,options:t,unstyled:n}){return hn((t==null?void 0:t.focusable)&&!n&&(e.focusClassName||YQ[e.focusRing]),(t==null?void 0:t.active)&&!n&&e.activeClassName)}function XQ({selector:e,stylesCtx:t,options:n,props:r,theme:s}){return Ow({theme:s,classNames:n==null?void 0:n.classNames,props:(n==null?void 0:n.props)||r,stylesCtx:t})[e]}function SM({selector:e,stylesCtx:t,theme:n,classNames:r,props:s}){return Ow({theme:n,classNames:r,props:s,stylesCtx:t})[e]}function KQ({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function QQ({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function ZQ({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(s=>`${t}-${s}-${n}`)}function eZ({themeName:e,theme:t,selector:n,props:r,stylesCtx:s}){return e.map(i=>{var o,a;return(a=Ow({theme:t,classNames:(o=t.components[i])==null?void 0:o.classNames,props:r,stylesCtx:s}))==null?void 0:a[n]})}function tZ({options:e,classes:t,selector:n,unstyled:r}){return e!=null&&e.variant&&!r?t[`${n}--${e.variant}`]:void 0}function nZ({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:s,classNames:i,classes:o,unstyled:a,className:c,rootSelector:u,props:f,stylesCtx:h,withStaticClasses:m,headless:y,transformedStyles:v}){return hn(JQ({theme:e,options:t,unstyled:a||y}),eZ({theme:e,themeName:n,selector:r,props:f,stylesCtx:h}),tZ({options:t,classes:o,selector:r,unstyled:a}),SM({selector:r,stylesCtx:h,theme:e,classNames:i,props:f}),SM({selector:r,stylesCtx:h,theme:e,classNames:v,props:f}),XQ({selector:r,stylesCtx:h,options:t,props:f,theme:e}),KQ({rootSelector:u,selector:r,className:c}),QQ({selector:r,classes:o,unstyled:a||y}),m&&!y&&ZQ({themeName:n,classNamesPrefix:s,selector:r,withStaticClass:t==null?void 0:t.withStaticClass}),t==null?void 0:t.className)}function rZ({theme:e,themeName:t,props:n,stylesCtx:r,selector:s}){return t.map(i=>{var o;return Uv({theme:e,styles:(o=e.components[i])==null?void 0:o.styles,props:n,stylesCtx:r})[s]}).reduce((i,o)=>({...i,...o}),{})}function q_({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...q_({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function sZ(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...xj(n[r])}}),t),{})}function iZ({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:s,selector:i,themeName:o,headless:a}){var c;return(c=sZ([a?{}:t==null?void 0:t(n,r,s),...o.map(u=>{var f,h,m;return(m=(h=(f=n.components)==null?void 0:f[u])==null?void 0:h.vars)==null?void 0:m.call(h,n,r,s)}),e==null?void 0:e(n,r,s)]))==null?void 0:c[i]}function oZ({theme:e,themeName:t,selector:n,options:r,props:s,stylesCtx:i,rootSelector:o,styles:a,style:c,vars:u,varsResolver:f,headless:h,withStylesTransform:m}){return{...!m&&rZ({theme:e,themeName:t,props:s,stylesCtx:i,selector:n}),...!m&&Uv({theme:e,styles:a,props:s,stylesCtx:i})[n],...!m&&Uv({theme:e,styles:r==null?void 0:r.styles,props:(r==null?void 0:r.props)||s,stylesCtx:i})[n],...iZ({theme:e,props:s,stylesCtx:i,vars:u,varsResolver:f,selector:n,themeName:t,headless:h}),...o===n?q_({style:c,theme:e}):null,...q_({style:r==null?void 0:r.style,theme:e})}}function aZ({props:e,stylesCtx:t,themeName:n}){var o;const r=As(),s=(o=CQ())==null?void 0:o();return{getTransformedStyles:a=>s?[...a.map(u=>s(u,{props:e,theme:r,ctx:t})),...n.map(u=>{var f;return s((f=r.components[u])==null?void 0:f.styles,{props:e,theme:r,ctx:t})})].filter(Boolean):[],withStylesTransform:!!s}}function bt({name:e,classes:t,props:n,stylesCtx:r,className:s,style:i,rootSelector:o="root",unstyled:a,classNames:c,styles:u,vars:f,varsResolver:h}){const m=As(),y=SQ(),v=EQ(),x=NQ(),E=(Array.isArray(e)?e:[e]).filter(C=>C),{withStylesTransform:N,getTransformedStyles:_}=aZ({props:n,stylesCtx:r,themeName:E});return(C,j)=>({className:nZ({theme:m,options:j,themeName:E,selector:C,classNamesPrefix:y,classNames:c,classes:t,unstyled:a,className:s,rootSelector:o,props:n,stylesCtx:r,withStaticClasses:v,headless:x,transformedStyles:_([j==null?void 0:j.styles,u])}),style:oZ({theme:m,themeName:E,selector:C,options:j,props:n,stylesCtx:r,rootSelector:o,styles:u,style:i,vars:f,varsResolver:h,headless:x,withStylesTransform:N})})}function Aj(e,t){return typeof e=="boolean"?e:t.autoContrast}function Pe(e,t,n){var o;const r=As(),s=(o=r.components[e])==null?void 0:o.defaultProps,i=typeof s=="function"?s(r):s;return{...t,...i,...xj(n)}}function U2(e){return So(e).reduce((t,n)=>e[n]!==void 0?`${t}${kK(n)}:${e[n]};`:t,"").trim()}function lZ({selector:e,styles:t,media:n,container:r}){const s=t?U2(t):"",i=Array.isArray(n)?n.map(a=>`@media${a.query}{${e}{${U2(a.styles)}}}`):[],o=Array.isArray(r)?r.map(a=>`@container ${a.query}{${e}{${U2(a.styles)}}}`):[];return`${s?`${e}{${s}}`:""}${i.join("")}${o.join("")}`.trim()}function cZ(e){const t=_j();return p.jsx("style",{"data-mantine-styles":"inline",nonce:t==null?void 0:t(),dangerouslySetInnerHTML:{__html:lZ(e)}})}function Jh(e){const{m:t,mx:n,my:r,mt:s,mb:i,ml:o,mr:a,me:c,ms:u,p:f,px:h,py:m,pt:y,pb:v,pl:x,pr:E,pe:N,ps:_,bd:C,bg:j,c:A,opacity:$,ff:R,fz:M,fw:D,lts:P,ta:F,lh:V,fs:H,tt:I,td:B,w:T,miw:L,maw:z,h:q,mih:k,mah:W,bgsz:X,bgp:ne,bgr:re,bga:se,pos:fe,top:he,left:ue,bottom:ve,right:Se,inset:ke,display:Oe,flex:Ce,hiddenFrom:Me,visibleFrom:Ve,lightHidden:We,darkHidden:$e,sx:J,...te}=e;return{styleProps:xj({m:t,mx:n,my:r,mt:s,mb:i,ml:o,mr:a,me:c,ms:u,p:f,px:h,py:m,pt:y,pb:v,pl:x,pr:E,pe:N,ps:_,bd:C,bg:j,c:A,opacity:$,ff:R,fz:M,fw:D,lts:P,ta:F,lh:V,fs:H,tt:I,td:B,w:T,miw:L,maw:z,h:q,mih:k,mah:W,bgsz:X,bgp:ne,bgr:re,bga:se,pos:fe,top:he,left:ue,bottom:ve,right:Se,inset:ke,display:Oe,flex:Ce,hiddenFrom:Me,visibleFrom:Ve,lightHidden:We,darkHidden:$e,sx:J}),rest:te}}const uZ={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function $j(e,t){const n=$c({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function dZ(e,t){const n=$c({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:$j(e,t)}function fZ(e,t){if(typeof e=="number")return _e(e);if(typeof e=="string"){const[n,r,...s]=e.split(" ").filter(o=>o.trim()!=="");let i=`${_e(n)}`;return r&&(i+=` ${r}`),s.length>0&&(i+=` ${$j(s.join(" "),t)}`),i.trim()}return e}const EM={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function hZ(e){return typeof e=="string"&&e in EM?EM[e]:e}const pZ=["h1","h2","h3","h4","h5","h6"];function mZ(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&pZ.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?_e(e):e}function gZ(e){return e}const yZ=["h1","h2","h3","h4","h5","h6"];function bZ(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&yZ.includes(e)?`var(--mantine-${e}-line-height)`:e}function vZ(e){return typeof e=="number"?_e(e):e}function xZ(e,t){if(typeof e=="number")return _e(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return _e(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const q2={color:$j,textColor:dZ,fontSize:mZ,spacing:xZ,identity:gZ,size:vZ,lineHeight:bZ,fontFamily:hZ,border:fZ};function NM(e){return e.replace("(min-width: ","").replace("em)","")}function wZ({media:e,...t}){const r=Object.keys(e).sort((s,i)=>Number(NM(s))-Number(NM(i))).map(s=>({query:s,styles:e[s]}));return{...t,media:r}}function SZ(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function EZ(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function NZ(e){return typeof e=="object"&&e!==null?So(e).filter(t=>t!=="base"):[]}function _Z(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function CZ({styleProps:e,data:t,theme:n}){return wZ(So(e).reduce((r,s)=>{if(s==="hiddenFrom"||s==="visibleFrom"||s==="sx")return r;const i=t[s],o=Array.isArray(i.property)?i.property:[i.property],a=EZ(e[s]);if(!SZ(e[s]))return o.forEach(u=>{r.inlineStyles[u]=q2[i.type](a,n)}),r;r.hasResponsiveStyles=!0;const c=NZ(e[s]);return o.forEach(u=>{a&&(r.styles[u]=q2[i.type](a,n)),c.forEach(f=>{const h=`(min-width: ${n.breakpoints[f]})`;r.media[h]={...r.media[h],[u]:q2[i.type](_Z(e[s],f),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function OZ(){return`__m__-${w.useId().replace(/:/g,"")}`}function C8(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...C8(r,t)}),{}):typeof e=="function"?e(t):e??{}}function O8(e){return e.startsWith("data-")?e:`data-${e}`}function jZ(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[O8(n)]=e[n]),t},{})}function j8(e){return e?typeof e=="string"?{[O8(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...j8(n)}),{}):jZ(e):null}function H_(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...H_(r,t)}),{}):typeof e=="function"?e(t):e??{}}function AZ({theme:e,style:t,vars:n,styleProps:r}){const s=H_(t,e),i=H_(n,e);return{...s,...i,...r}}const A8=w.forwardRef(({component:e,style:t,__vars:n,className:r,variant:s,mod:i,size:o,hiddenFrom:a,visibleFrom:c,lightHidden:u,darkHidden:f,renderRoot:h,__size:m,...y},v)=>{var M;const x=As(),E=e||"div",{styleProps:N,rest:_}=Jh(y),C=_Q(),j=(M=C==null?void 0:C())==null?void 0:M(N.sx),A=OZ(),$=CZ({styleProps:N,theme:x,data:uZ}),R={ref:v,style:AZ({theme:x,style:t,vars:n,styleProps:$.inlineStyles}),className:hn(r,j,{[A]:$.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":f,[`mantine-hidden-from-${a}`]:a,[`mantine-visible-from-${c}`]:c}),"data-variant":s,"data-size":u8(o)?void 0:o||void 0,size:m,...j8(i),..._};return p.jsxs(p.Fragment,{children:[$.hasResponsiveStyles&&p.jsx(cZ,{selector:`.${A}`,styles:$.styles,media:$.media}),typeof h=="function"?h(R):p.jsx(E,{...R})]})});A8.displayName="@mantine/core/Box";const ze=A8;function $8(e){return e}function qe(e){const t=w.forwardRef(e);return t.extend=$8,t.withProps=n=>{const r=w.forwardRef((s,i)=>p.jsx(t,{...n,...s,ref:i}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t}function Tc(e){const t=w.forwardRef(e);return t.withProps=n=>{const r=w.forwardRef((s,i)=>p.jsx(t,{...n,...s,ref:i}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t.extend=$8,t}const $Z=w.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function Rc(){return w.useContext($Z)}var vy=n8();const Rf=Ki(vy),[TZ,fi]=Ua("ScrollArea.Root component was not found in tree");function mh(e,t){const n=Eu(t);Wh(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}const RZ=w.forwardRef((e,t)=>{const{style:n,...r}=e,s=fi(),[i,o]=w.useState(0),[a,c]=w.useState(0),u=!!(i&&a);return mh(s.scrollbarX,()=>{var h;const f=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(f),c(f)}),mh(s.scrollbarY,()=>{var h;const f=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(f),o(f)}),u?p.jsx("div",{...r,ref:t,style:{...n,width:i,height:a}}):null}),MZ=w.forwardRef((e,t)=>{const n=fi(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(RZ,{...e,ref:t}):null}),kZ={scrollHideDelay:1e3,type:"hover"},T8=w.forwardRef((e,t)=>{const n=Pe("ScrollAreaRoot",kZ,e),{type:r,scrollHideDelay:s,scrollbars:i,...o}=n,[a,c]=w.useState(null),[u,f]=w.useState(null),[h,m]=w.useState(null),[y,v]=w.useState(null),[x,E]=w.useState(null),[N,_]=w.useState(0),[C,j]=w.useState(0),[A,$]=w.useState(!1),[R,M]=w.useState(!1),D=_n(t,P=>c(P));return p.jsx(TZ,{value:{type:r,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:f,content:h,onContentChange:m,scrollbarX:y,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:$,scrollbarY:x,onScrollbarYChange:E,scrollbarYEnabled:R,onScrollbarYEnabledChange:M,onCornerWidthChange:_,onCornerHeightChange:j},children:p.jsx(ze,{...o,ref:D,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${N}px`,"--sa-corner-height":i!=="xy"?"0px":`${C}px`}})})});T8.displayName="@mantine/core/ScrollAreaRoot";function R8(e,t){const n=e/t;return Number.isNaN(n)?0:n}function jw(e){const t=R8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function M8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function IZ(e,[t,n]){return Math.min(n,Math.max(t,e))}function _M(e,t,n="ltr"){const r=jw(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,a=i-r,c=n==="ltr"?[0,o]:[o*-1,0],u=IZ(e,c);return M8([0,o],[0,a])(u)}function DZ(e,t,n,r="ltr"){const s=jw(n),i=s/2,o=t||i,a=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,h=r==="ltr"?[0,f]:[f*-1,0];return M8([c,u],h)(e)}function k8(e,t){return e>0&&e<t}function ac(e){return e?parseInt(e,10):0}function Gu(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e==null||e(r),(n===!1||!r.defaultPrevented)&&(t==null||t(r))}}const[PZ,I8]=Ua("ScrollAreaScrollbar was not found in tree"),D8=w.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:o,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=e,m=fi(),[y,v]=w.useState(null),x=_n(t,M=>v(M)),E=w.useRef(null),N=w.useRef(""),{viewport:_}=m,C=n.content-n.viewport,j=Eu(u),A=Eu(a),$=Nw(f,10),R=M=>{if(E.current){const D=M.clientX-E.current.left,P=M.clientY-E.current.top;c({x:D,y:P})}};return w.useEffect(()=>{const M=D=>{const P=D.target;(y==null?void 0:y.contains(P))&&j(D,C)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[_,y,C,j]),w.useEffect(A,[n,A]),mh(y,$),mh(m.content,$),p.jsx(PZ,{value:{scrollbar:y,hasThumb:r,onThumbChange:Eu(s),onThumbPointerUp:Eu(i),onThumbPositionChange:A,onThumbPointerDown:Eu(o)},children:p.jsx("div",{...h,ref:x,"data-mantine-scrollbar":!0,style:{position:"absolute",...h.style},onPointerDown:Gu(e.onPointerDown,M=>{M.preventDefault(),M.button===0&&(M.target.setPointerCapture(M.pointerId),E.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",R(M))}),onPointerMove:Gu(e.onPointerMove,R),onPointerUp:Gu(e.onPointerUp,M=>{const D=M.target;D.hasPointerCapture(M.pointerId)&&(M.preventDefault(),D.releasePointerCapture(M.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=N.current,E.current=null}})})}),P8=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:s,...i}=e,o=fi(),[a,c]=w.useState(),u=w.useRef(null),f=_n(t,u,o.onScrollbarXChange);return w.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),p.jsx(D8,{"data-orientation":"horizontal",...i,ref:f,sizes:n,style:{...s,"--sa-thumb-width":`${jw(n)}px`},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(o.viewport){const y=o.viewport.scrollLeft+h.deltaX;e.onWheelScroll(y),k8(y,m)&&h.preventDefault()}},onResize:()=>{u.current&&o.viewport&&a&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:ac(a.paddingLeft),paddingEnd:ac(a.paddingRight)}})}})});P8.displayName="@mantine/core/ScrollAreaScrollbarX";const L8=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:s,...i}=e,o=fi(),[a,c]=w.useState(),u=w.useRef(null),f=_n(t,u,o.onScrollbarYChange);return w.useEffect(()=>{u.current&&c(window.getComputedStyle(u.current))},[]),p.jsx(D8,{...i,"data-orientation":"vertical",ref:f,sizes:n,style:{"--sa-thumb-height":`${jw(n)}px`,...s},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(o.viewport){const y=o.viewport.scrollTop+h.deltaY;e.onWheelScroll(y),k8(y,m)&&h.preventDefault()}},onResize:()=>{u.current&&o.viewport&&a&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:ac(a.paddingTop),paddingEnd:ac(a.paddingBottom)}})}})});L8.displayName="@mantine/core/ScrollAreaScrollbarY";const Aw=w.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:s}=Rc(),i=fi(),o=w.useRef(null),a=w.useRef(0),[c,u]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=R8(c.viewport,c.content),h={...r,sizes:c,onSizesChange:u,hasThumb:f>0&&f<1,onThumbChange:y=>{o.current=y},onThumbPointerUp:()=>{a.current=0},onThumbPointerDown:y=>{a.current=y}},m=(y,v)=>DZ(y,a.current,c,v);return n==="horizontal"?p.jsx(P8,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const y=i.viewport.scrollLeft,v=_M(y,c,s);o.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollLeft=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollLeft=m(y,s))}}):n==="vertical"?p.jsx(L8,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const y=i.viewport.scrollTop,v=_M(y,c);c.scrollbar.size===0?o.current.style.setProperty("--thumb-opacity","0"):o.current.style.setProperty("--thumb-opacity","1"),o.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollTop=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollTop=m(y))}}):null});Aw.displayName="@mantine/core/ScrollAreaScrollbarVisible";const Tj=w.forwardRef((e,t)=>{const n=fi(),{forceMount:r,...s}=e,[i,o]=w.useState(!1),a=e.orientation==="horizontal",c=Nw(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?u:f)}},10);return mh(n.viewport,c),mh(n.content,c),r||i?p.jsx(Aw,{"data-state":i?"visible":"hidden",...s,ref:t}):null});Tj.displayName="@mantine/core/ScrollAreaScrollbarAuto";const F8=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=fi(),[i,o]=w.useState(!1);return w.useEffect(()=>{const{scrollArea:a}=s;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},f=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),n||i?p.jsx(Tj,{"data-state":i?"visible":"hidden",...r,ref:t}):null});F8.displayName="@mantine/core/ScrollAreaScrollbarHover";const LZ=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=fi(),i=e.orientation==="horizontal",[o,a]=w.useState("hidden"),c=Nw(()=>a("idle"),100);return w.useEffect(()=>{if(o==="idle"){const u=window.setTimeout(()=>a("hidden"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[o,s.scrollHideDelay]),w.useEffect(()=>{const{viewport:u}=s,f=i?"scrollLeft":"scrollTop";if(u){let h=u[f];const m=()=>{const y=u[f];h!==y&&(a("scrolling"),c()),h=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,i,c]),n||o!=="hidden"?p.jsx(Aw,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Gu(e.onPointerEnter,()=>a("interacting")),onPointerLeave:Gu(e.onPointerLeave,()=>a("idle"))}):null}),W_=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=fi(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,a=e.orientation==="horizontal";return w.useEffect(()=>(a?i(!0):o(!0),()=>{a?i(!1):o(!1)}),[a,i,o]),s.type==="hover"?p.jsx(F8,{...r,ref:t,forceMount:n}):s.type==="scroll"?p.jsx(LZ,{...r,ref:t,forceMount:n}):s.type==="auto"?p.jsx(Tj,{...r,ref:t,forceMount:n}):s.type==="always"?p.jsx(Aw,{...r,ref:t}):null});W_.displayName="@mantine/core/ScrollAreaScrollbar";function FZ(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,a=n.top!==i.top;(o||a)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)}const B8=w.forwardRef((e,t)=>{const{style:n,...r}=e,s=fi(),i=I8(),{onThumbPositionChange:o}=i,a=_n(t,f=>i.onThumbChange(f)),c=w.useRef(void 0),u=Nw(()=>{c.current&&(c.current(),c.current=void 0)},100);return w.useEffect(()=>{const{viewport:f}=s;if(f){const h=()=>{if(u(),!c.current){const m=FZ(f,o);c.current=m,o()}};return o(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,u,o]),p.jsx("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:a,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:Gu(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),y=f.clientX-m.left,v=f.clientY-m.top;i.onThumbPointerDown({x:y,y:v})}),onPointerUp:Gu(e.onPointerUp,i.onThumbPointerUp)})});B8.displayName="@mantine/core/ScrollAreaThumb";const G_=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=I8();return n||s.hasThumb?p.jsx(B8,{ref:t,...r}):null});G_.displayName="@mantine/core/ScrollAreaThumb";const z8=w.forwardRef(({children:e,style:t,...n},r)=>{const s=fi(),i=_n(r,s.onViewportChange);return p.jsx(ze,{...n,ref:i,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...t},children:p.jsx("div",{style:{minWidth:"100%",display:"table"},ref:s.onContentChange,children:e})})});z8.displayName="@mantine/core/ScrollAreaViewport";var Rj={root:"m_d57069b5",viewport:"m_c0783ff9",viewportInner:"m_f8f631dd",scrollbar:"m_c44ba933",thumb:"m_d8b5e363",corner:"m_21657268"};const V8={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},BZ=(e,{scrollbarSize:t,overscrollBehavior:n})=>({root:{"--scrollarea-scrollbar-size":_e(t),"--scrollarea-over-scroll-behavior":n}}),xy=qe((e,t)=>{const n=Pe("ScrollArea",V8,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,scrollbarSize:c,vars:u,type:f,scrollHideDelay:h,viewportProps:m,viewportRef:y,onScrollPositionChange:v,children:x,offsetScrollbars:E,scrollbars:N,onBottomReached:_,onTopReached:C,overscrollBehavior:j,...A}=n,[$,R]=w.useState(!1),M=bt({name:"ScrollArea",props:n,classes:Rj,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:u,varsResolver:BZ});return p.jsxs(T8,{type:f==="never"?"always":f,scrollHideDelay:h,ref:t,scrollbars:N,...M("root"),...A,children:[p.jsx(z8,{...m,...M("viewport",{style:m==null?void 0:m.style}),ref:y,"data-offset-scrollbars":E===!0?"xy":E||void 0,"data-scrollbars":N||void 0,onScroll:D=>{var H;(H=m==null?void 0:m.onScroll)==null||H.call(m,D),v==null||v({x:D.currentTarget.scrollLeft,y:D.currentTarget.scrollTop});const{scrollTop:P,scrollHeight:F,clientHeight:V}=D.currentTarget;P-(F-V)>=0&&(_==null||_()),P===0&&(C==null||C())},children:x}),(N==="xy"||N==="x")&&p.jsx(W_,{...M("scrollbar"),orientation:"horizontal","data-hidden":f==="never"||void 0,forceMount:!0,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:p.jsx(G_,{...M("thumb")})}),(N==="xy"||N==="y")&&p.jsx(W_,{...M("scrollbar"),orientation:"vertical","data-hidden":f==="never"||void 0,forceMount:!0,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:p.jsx(G_,{...M("thumb")})}),p.jsx(MZ,{...M("corner"),"data-hovered":$||void 0,"data-hidden":f==="never"||void 0})]})});xy.displayName="@mantine/core/ScrollArea";const Mj=qe((e,t)=>{const{children:n,classNames:r,styles:s,scrollbarSize:i,scrollHideDelay:o,type:a,dir:c,offsetScrollbars:u,viewportRef:f,onScrollPositionChange:h,unstyled:m,variant:y,viewportProps:v,scrollbars:x,style:E,vars:N,onBottomReached:_,onTopReached:C,...j}=Pe("ScrollAreaAutosize",V8,e);return p.jsx(ze,{...j,ref:t,style:[{display:"flex",overflow:"auto"},E],children:p.jsx(ze,{style:{display:"flex",flexDirection:"column",flex:1},children:p.jsx(xy,{classNames:r,styles:s,scrollHideDelay:o,scrollbarSize:i,type:a,dir:c,offsetScrollbars:u,viewportRef:f,onScrollPositionChange:h,unstyled:m,variant:y,viewportProps:v,vars:N,scrollbars:x,onBottomReached:_,onTopReached:C,children:n})})})});xy.classes=Rj;Mj.displayName="@mantine/core/ScrollAreaAutosize";Mj.classes=Rj;xy.Autosize=Mj;var U8={root:"m_87cf2631"};const zZ={__staticSelector:"UnstyledButton"},Ma=Tc((e,t)=>{const n=Pe("UnstyledButton",zZ,e),{className:r,component:s="button",__staticSelector:i,unstyled:o,classNames:a,styles:c,style:u,...f}=n,h=bt({name:i,props:n,classes:U8,className:r,style:u,classNames:a,styles:c,unstyled:o});return p.jsx(ze,{...h("root",{focusable:!0}),component:s,ref:t,type:s==="button"?"button":void 0,...f})});Ma.classes=U8;Ma.displayName="@mantine/core/UnstyledButton";var q8={root:"m_515a97f8"};const VZ={},kj=qe((e,t)=>{const n=Pe("VisuallyHidden",VZ,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,...u}=n,f=bt({name:"VisuallyHidden",classes:q8,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a});return p.jsx(ze,{component:"span",ref:t,...f("root"),...u})});kj.classes=q8;kj.displayName="@mantine/core/VisuallyHidden";var H8={root:"m_1b7284a3"};const UZ={},qZ=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:Hn(t),"--paper-shadow":Sj(n)}}),Ij=Tc((e,t)=>{const n=Pe("Paper",UZ,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,withBorder:c,vars:u,radius:f,shadow:h,variant:m,mod:y,...v}=n,x=bt({name:"Paper",props:n,classes:H8,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:u,varsResolver:qZ});return p.jsx(ze,{ref:t,mod:[{"data-with-border":c},y],...x("root"),variant:m,...v})});Ij.classes=H8;Ij.displayName="@mantine/core/Paper";function $w(){return typeof window<"u"}function Xh(e){return W8(e)?(e.nodeName||"").toLowerCase():"#document"}function ts(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ro(e){var t;return(t=(W8(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function W8(e){return $w()?e instanceof Node||e instanceof ts(e).Node:!1}function cn(e){return $w()?e instanceof Element||e instanceof ts(e).Element:!1}function _s(e){return $w()?e instanceof HTMLElement||e instanceof ts(e).HTMLElement:!1}function Y_(e){return!$w()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ts(e).ShadowRoot}function wy(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=si(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function HZ(e){return["table","td","th"].includes(Xh(e))}function Tw(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Dj(e){const t=Rw(),n=cn(e)?si(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function WZ(e){let t=ka(e);for(;_s(t)&&!bc(t);){if(Dj(t))return t;if(Tw(t))return null;t=ka(t)}return null}function Rw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bc(e){return["html","body","#document"].includes(Xh(e))}function si(e){return ts(e).getComputedStyle(e)}function Mw(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ka(e){if(Xh(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Y_(e)&&e.host||Ro(e);return Y_(t)?t.host:t}function G8(e){const t=ka(e);return bc(t)?e.ownerDocument?e.ownerDocument.body:e.body:_s(t)&&wy(t)?t:G8(t)}function _a(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=G8(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=ts(s);if(i){const a=J_(o);return t.concat(o,o.visualViewport||[],wy(s)?s:[],a&&n?_a(a):[])}return t.concat(s,_a(s,[],n))}function J_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function CM(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function gg(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Y_(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Y8(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function J8(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function GZ(e){return XZ()?!1:!OM()&&e.width===0&&e.height===0||OM()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function YZ(){return/apple/i.test(navigator.vendor)}function OM(){const e=/android/i;return e.test(Y8())||e.test(J8())}function JZ(){return Y8().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function XZ(){return J8().includes("jsdom/")}function X_(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function KZ(e){return"nativeEvent"in e}function QZ(e){return e.matches("html,body")}function Cu(e){return(e==null?void 0:e.ownerDocument)||document}function H2(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Nf(e){return"composedPath"in e?e.composedPath()[0]:e.target}const ZZ="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function eee(e){return _s(e)&&e.matches(ZZ)}const Hi=Math.min,xr=Math.max,qv=Math.round,Nb=Math.floor,Eo=e=>({x:e,y:e}),tee={left:"right",right:"left",bottom:"top",top:"bottom"},nee={start:"end",end:"start"};function K_(e,t,n){return xr(e,Hi(t,n))}function Ia(e,t){return typeof e=="function"?e(t):e}function Wi(e){return e.split("-")[0]}function Kh(e){return e.split("-")[1]}function Pj(e){return e==="x"?"y":"x"}function Lj(e){return e==="y"?"height":"width"}function Da(e){return["top","bottom"].includes(Wi(e))?"y":"x"}function Fj(e){return Pj(Da(e))}function ree(e,t,n){n===void 0&&(n=!1);const r=Kh(e),s=Fj(e),i=Lj(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Hv(o)),[o,Hv(o)]}function see(e){const t=Hv(e);return[Q_(e),t,Q_(t)]}function Q_(e){return e.replace(/start|end/g,t=>nee[t])}function iee(e,t,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?i:o;default:return[]}}function oee(e,t,n,r){const s=Kh(e);let i=iee(Wi(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Q_)))),i}function Hv(e){return e.replace(/left|right|bottom|top/g,t=>tee[t])}function aee(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bj(e){return typeof e!="number"?aee(e):{top:e,right:e,bottom:e,left:e}}function gh(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function jM(e,t,n){let{reference:r,floating:s}=e;const i=Da(t),o=Fj(t),a=Lj(o),c=Wi(t),u=i==="y",f=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,m=r[a]/2-s[a]/2;let y;switch(c){case"top":y={x:f,y:r.y-s.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-s.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Kh(t)){case"start":y[o]-=m*(n&&u?-1:1);break;case"end":y[o]+=m*(n&&u?-1:1);break}return y}const lee=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:h}=jM(u,r,c),m=r,y={},v=0;for(let x=0;x<a.length;x++){const{name:E,fn:N}=a[x],{x:_,y:C,data:j,reset:A}=await N({x:f,y:h,initialPlacement:r,placement:m,strategy:s,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});f=_??f,h=C??h,y={...y,[E]:{...y[E],...j}},A&&v<=50&&(v++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(u=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:f,y:h}=jM(u,m,c)),x=-1)}return{x:f,y:h,placement:m,strategy:s,middlewareData:y}};async function zj(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:y=0}=Ia(t,e),v=Bj(y),E=a[m?h==="floating"?"reference":"floating":h],N=gh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(E)))==null||n?E:E.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),_=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),j=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},A=gh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:C,strategy:c}):_);return{top:(N.top-A.top+v.top)/j.y,bottom:(A.bottom-N.bottom+v.bottom)/j.y,left:(N.left-A.left+v.left)/j.x,right:(A.right-N.right+v.right)/j.x}}const cee=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=Ia(e,t)||{};if(u==null)return{};const h=Bj(f),m={x:n,y:r},y=Fj(s),v=Lj(y),x=await o.getDimensions(u),E=y==="y",N=E?"top":"left",_=E?"bottom":"right",C=E?"clientHeight":"clientWidth",j=i.reference[v]+i.reference[y]-m[y]-i.floating[v],A=m[y]-i.reference[y],$=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let R=$?$[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement($)))&&(R=a.floating[C]||i.floating[v]);const M=j/2-A/2,D=R/2-x[v]/2-1,P=Hi(h[N],D),F=Hi(h[_],D),V=P,H=R-x[v]-F,I=R/2-x[v]/2+M,B=K_(V,I,H),T=!c.arrow&&Kh(s)!=null&&I!==B&&i.reference[v]/2-(I<V?P:F)-x[v]/2<0,L=T?I<V?I-V:I-H:0;return{[y]:m[y]+L,data:{[y]:B,centerOffset:I-B-L,...T&&{alignmentOffset:L}},reset:T}}}),uee=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...E}=Ia(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const N=Wi(s),_=Da(a),C=Wi(a)===a,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),A=m||(C||!x?[Hv(a)]:see(a)),$=v!=="none";!m&&$&&A.push(...oee(a,x,v,j));const R=[a,...A],M=await zj(t,E),D=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(M[N]),h){const I=ree(s,o,j);D.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:s,overflows:D}],!D.every(I=>I<=0)){var F,V;const I=(((F=i.flip)==null?void 0:F.index)||0)+1,B=R[I];if(B)return{data:{index:I,overflows:P},reset:{placement:B}};let T=(V=P.filter(L=>L.overflows[0]<=0).sort((L,z)=>L.overflows[1]-z.overflows[1])[0])==null?void 0:V.placement;if(!T)switch(y){case"bestFit":{var H;const L=(H=P.filter(z=>{if($){const q=Da(z.placement);return q===_||q==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(q=>q>0).reduce((q,k)=>q+k,0)]).sort((z,q)=>z[1]-q[1])[0])==null?void 0:H[0];L&&(T=L);break}case"initialPlacement":T=a;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function X8(e){const t=Hi(...e.map(i=>i.left)),n=Hi(...e.map(i=>i.top)),r=xr(...e.map(i=>i.right)),s=xr(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:s-n}}function dee(e){const t=e.slice().sort((s,i)=>s.y-i.y),n=[];let r=null;for(let s=0;s<t.length;s++){const i=t[s];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(s=>gh(X8(s)))}const fee=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:s,platform:i,strategy:o}=t,{padding:a=2,x:c,y:u}=Ia(e,t),f=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),h=dee(f),m=gh(X8(f)),y=Bj(a);function v(){if(h.length===2&&h[0].left>h[1].right&&c!=null&&u!=null)return h.find(E=>c>E.left-y.left&&c<E.right+y.right&&u>E.top-y.top&&u<E.bottom+y.bottom)||m;if(h.length>=2){if(Da(n)==="y"){const P=h[0],F=h[h.length-1],V=Wi(n)==="top",H=P.top,I=F.bottom,B=V?P.left:F.left,T=V?P.right:F.right,L=T-B,z=I-H;return{top:H,bottom:I,left:B,right:T,width:L,height:z,x:B,y:H}}const E=Wi(n)==="left",N=xr(...h.map(P=>P.right)),_=Hi(...h.map(P=>P.left)),C=h.filter(P=>E?P.left===_:P.right===N),j=C[0].top,A=C[C.length-1].bottom,$=_,R=N,M=R-$,D=A-j;return{top:j,bottom:A,left:$,right:R,width:M,height:D,x:$,y:j}}return m}const x=await i.getElementRects({reference:{getBoundingClientRect:v},floating:r.floating,strategy:o});return s.reference.x!==x.reference.x||s.reference.y!==x.reference.y||s.reference.width!==x.reference.width||s.reference.height!==x.reference.height?{reset:{rects:x}}:{}}}};async function hee(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Wi(n),a=Kh(n),c=Da(n)==="y",u=["left","top"].includes(o)?-1:1,f=i&&c?-1:1,h=Ia(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof v=="number"&&(y=a==="end"?v*-1:v),c?{x:y*f,y:m*u}:{x:m*u,y:y*f}}const pee=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,c=await hee(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},mee=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:E=>{let{x:N,y:_}=E;return{x:N,y:_}}},...c}=Ia(e,t),u={x:n,y:r},f=await zj(t,c),h=Da(Wi(s)),m=Pj(h);let y=u[m],v=u[h];if(i){const E=m==="y"?"top":"left",N=m==="y"?"bottom":"right",_=y+f[E],C=y-f[N];y=K_(_,y,C)}if(o){const E=h==="y"?"top":"left",N=h==="y"?"bottom":"right",_=v+f[E],C=v-f[N];v=K_(_,v,C)}const x=a.fn({...t,[m]:y,[h]:v});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[m]:i,[h]:o}}}}}},gee=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ia(e,t),f={x:n,y:r},h=Da(s),m=Pj(h);let y=f[m],v=f[h];const x=Ia(a,t),E=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const C=m==="y"?"height":"width",j=i.reference[m]-i.floating[C]+E.mainAxis,A=i.reference[m]+i.reference[C]-E.mainAxis;y<j?y=j:y>A&&(y=A)}if(u){var N,_;const C=m==="y"?"width":"height",j=["top","left"].includes(Wi(s)),A=i.reference[h]-i.floating[C]+(j&&((N=o.offset)==null?void 0:N[h])||0)+(j?0:E.crossAxis),$=i.reference[h]+i.reference[C]+(j?0:((_=o.offset)==null?void 0:_[h])||0)-(j?E.crossAxis:0);v<A?v=A:v>$&&(v=$)}return{[m]:y,[h]:v}}}},yee=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:c=()=>{},...u}=Ia(e,t),f=await zj(t,u),h=Wi(s),m=Kh(s),y=Da(s)==="y",{width:v,height:x}=i.floating;let E,N;h==="top"||h==="bottom"?(E=h,N=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(N=h,E=m==="end"?"top":"bottom");const _=x-f.top-f.bottom,C=v-f.left-f.right,j=Hi(x-f[E],_),A=Hi(v-f[N],C),$=!t.middlewareData.shift;let R=j,M=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=_),$&&!m){const P=xr(f.left,0),F=xr(f.right,0),V=xr(f.top,0),H=xr(f.bottom,0);y?M=v-2*(P!==0||F!==0?P+F:xr(f.left,f.right)):R=x-2*(V!==0||H!==0?V+H:xr(f.top,f.bottom))}await c({...t,availableWidth:M,availableHeight:R});const D=await o.getDimensions(a.floating);return v!==D.width||x!==D.height?{reset:{rects:!0}}:{}}}};function K8(e){const t=si(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=_s(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=qv(n)!==i||qv(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Vj(e){return cn(e)?e:e.contextElement}function zf(e){const t=Vj(e);if(!_s(t))return Eo(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=K8(t);let o=(i?qv(n.width):n.width)/r,a=(i?qv(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const bee=Eo(0);function Q8(e){const t=ts(e);return!Rw()||!t.visualViewport?bee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ts(e)?!1:t}function Xu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Vj(e);let o=Eo(1);t&&(r?cn(r)&&(o=zf(r)):o=zf(e));const a=vee(i,n,r)?Q8(i):Eo(0);let c=(s.left+a.x)/o.x,u=(s.top+a.y)/o.y,f=s.width/o.x,h=s.height/o.y;if(i){const m=ts(i),y=r&&cn(r)?ts(r):r;let v=m,x=J_(v);for(;x&&r&&y!==v;){const E=zf(x),N=x.getBoundingClientRect(),_=si(x),C=N.left+(x.clientLeft+parseFloat(_.paddingLeft))*E.x,j=N.top+(x.clientTop+parseFloat(_.paddingTop))*E.y;c*=E.x,u*=E.y,f*=E.x,h*=E.y,c+=C,u+=j,v=ts(x),x=J_(v)}}return gh({width:f,height:h,x:c,y:u})}function Uj(e,t){const n=Mw(e).scrollLeft;return t?t.left+n:Xu(Ro(e)).left+n}function Z8(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:Uj(e,r)),i=r.top+t.scrollTop;return{x:s,y:i}}function xee(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Ro(r),a=t?Tw(t.floating):!1;if(r===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Eo(1);const f=Eo(0),h=_s(r);if((h||!h&&!i)&&((Xh(r)!=="body"||wy(o))&&(c=Mw(r)),_s(r))){const y=Xu(r);u=zf(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const m=o&&!h&&!i?Z8(o,c,!0):Eo(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+m.x,y:n.y*u.y-c.scrollTop*u.y+f.y+m.y}}function wee(e){return Array.from(e.getClientRects())}function See(e){const t=Ro(e),n=Mw(e),r=e.ownerDocument.body,s=xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Uj(e);const a=-n.scrollTop;return si(r).direction==="rtl"&&(o+=xr(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}function Eee(e,t){const n=ts(e),r=Ro(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;const u=Rw();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a,y:c}}function Nee(e,t){const n=Xu(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=_s(e)?zf(e):Eo(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:a,x:c,y:u}}function AM(e,t,n){let r;if(t==="viewport")r=Eee(e,n);else if(t==="document")r=See(Ro(e));else if(cn(t))r=Nee(t,n);else{const s=Q8(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return gh(r)}function e7(e,t){const n=ka(e);return n===t||!cn(n)||bc(n)?!1:si(n).position==="fixed"||e7(n,t)}function _ee(e,t){const n=t.get(e);if(n)return n;let r=_a(e,[],!1).filter(a=>cn(a)&&Xh(a)!=="body"),s=null;const i=si(e).position==="fixed";let o=i?ka(e):e;for(;cn(o)&&!bc(o);){const a=si(o),c=Dj(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||wy(o)&&!c&&e7(e,o))?r=r.filter(f=>f!==o):s=a,o=ka(o)}return t.set(e,r),r}function Cee(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Tw(t)?[]:_ee(t,this._c):[].concat(n),r],a=o[0],c=o.reduce((u,f)=>{const h=AM(t,f,s);return u.top=xr(h.top,u.top),u.right=Hi(h.right,u.right),u.bottom=Hi(h.bottom,u.bottom),u.left=xr(h.left,u.left),u},AM(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Oee(e){const{width:t,height:n}=K8(e);return{width:t,height:n}}function jee(e,t,n){const r=_s(t),s=Ro(t),i=n==="fixed",o=Xu(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Eo(0);if(r||!r&&!i)if((Xh(t)!=="body"||wy(s))&&(a=Mw(t)),r){const m=Xu(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&(c.x=Uj(s));const u=s&&!r&&!i?Z8(s,a):Eo(0),f=o.left+a.scrollLeft-c.x-u.x,h=o.top+a.scrollTop-c.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function W2(e){return si(e).position==="static"}function $M(e,t){if(!_s(e)||si(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ro(e)===n&&(n=n.ownerDocument.body),n}function t7(e,t){const n=ts(e);if(Tw(e))return n;if(!_s(e)){let s=ka(e);for(;s&&!bc(s);){if(cn(s)&&!W2(s))return s;s=ka(s)}return n}let r=$M(e,t);for(;r&&HZ(r)&&W2(r);)r=$M(r,t);return r&&bc(r)&&W2(r)&&!Dj(r)?n:r||WZ(e)||n}const Aee=async function(e){const t=this.getOffsetParent||t7,n=this.getDimensions,r=await n(e.floating);return{reference:jee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $ee(e){return si(e).direction==="rtl"}const Tee={convertOffsetParentRelativeRectToViewportRelativeRect:xee,getDocumentElement:Ro,getClippingRect:Cee,getOffsetParent:t7,getElementRects:Aee,getClientRects:wee,getDimensions:Oee,getScale:zf,isElement:cn,isRTL:$ee};function n7(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ree(e,t){let n=null,r;const s=Ro(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:f,top:h,width:m,height:y}=u;if(a||t(),!m||!y)return;const v=Nb(h),x=Nb(s.clientWidth-(f+m)),E=Nb(s.clientHeight-(h+y)),N=Nb(f),C={rootMargin:-v+"px "+-x+"px "+-E+"px "+-N+"px",threshold:xr(0,Hi(1,c))||1};let j=!0;function A($){const R=$[0].intersectionRatio;if(R!==c){if(!j)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!n7(u,e.getBoundingClientRect())&&o(),j=!1}try{n=new IntersectionObserver(A,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,C)}n.observe(e)}return o(!0),i}function Mee(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Vj(e),f=s||i?[...u?_a(u):[],..._a(t)]:[];f.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),i&&N.addEventListener("resize",n)});const h=u&&a?Ree(u,n):null;let m=-1,y=null;o&&(y=new ResizeObserver(N=>{let[_]=N;_&&_.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(t)})),n()}),u&&!c&&y.observe(u),y.observe(t));let v,x=c?Xu(e):null;c&&E();function E(){const N=Xu(e);x&&!n7(x,N)&&n(),x=N,v=requestAnimationFrame(E)}return n(),()=>{var N;f.forEach(_=>{s&&_.removeEventListener("scroll",n),i&&_.removeEventListener("resize",n)}),h==null||h(),(N=y)==null||N.disconnect(),y=null,c&&cancelAnimationFrame(v)}}const kee=pee,Iee=mee,Dee=uee,Pee=yee,TM=cee,Lee=fee,Fee=gee,Bee=(e,t,n)=>{const r=new Map,s={platform:Tee,...n},i={...s.platform,_c:r};return lee(e,t,{...s,platform:i})};var fv=typeof document<"u"?w.useLayoutEffect:w.useEffect;function Wv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wv(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Wv(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function r7(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RM(e,t){const n=r7(e);return Math.round(t*n)/n}function G2(e){const t=w.useRef(e);return fv(()=>{t.current=e}),t}function zee(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,h]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=w.useState(r);Wv(m,r)||y(r);const[v,x]=w.useState(null),[E,N]=w.useState(null),_=w.useCallback(z=>{z!==$.current&&($.current=z,x(z))},[]),C=w.useCallback(z=>{z!==R.current&&(R.current=z,N(z))},[]),j=i||v,A=o||E,$=w.useRef(null),R=w.useRef(null),M=w.useRef(f),D=c!=null,P=G2(c),F=G2(s),V=G2(u),H=w.useCallback(()=>{if(!$.current||!R.current)return;const z={placement:t,strategy:n,middleware:m};F.current&&(z.platform=F.current),Bee($.current,R.current,z).then(q=>{const k={...q,isPositioned:V.current!==!1};I.current&&!Wv(M.current,k)&&(M.current=k,vy.flushSync(()=>{h(k)}))})},[m,t,n,F,V]);fv(()=>{u===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,h(z=>({...z,isPositioned:!1})))},[u]);const I=w.useRef(!1);fv(()=>(I.current=!0,()=>{I.current=!1}),[]),fv(()=>{if(j&&($.current=j),A&&(R.current=A),j&&A){if(P.current)return P.current(j,A,H);H()}},[j,A,H,P,D]);const B=w.useMemo(()=>({reference:$,floating:R,setReference:_,setFloating:C}),[_,C]),T=w.useMemo(()=>({reference:j,floating:A}),[j,A]),L=w.useMemo(()=>{const z={position:n,left:0,top:0};if(!T.floating)return z;const q=RM(T.floating,f.x),k=RM(T.floating,f.y);return a?{...z,transform:"translate("+q+"px, "+k+"px)",...r7(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:k}},[n,a,T.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:H,refs:B,elements:T,floatingStyles:L}),[f,H,B,T,L])}const Vee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?TM({element:r.current,padding:s}).fn(n):{}:r?TM({element:r,padding:s}).fn(n):{}}}},s7=(e,t)=>({...kee(e),options:[e,t]}),qj=(e,t)=>({...Iee(e),options:[e,t]}),MM=(e,t)=>({...Fee(e),options:[e,t]}),Gv=(e,t)=>({...Dee(e),options:[e,t]}),Uee=(e,t)=>({...Pee(e),options:[e,t]}),Hm=(e,t)=>({...Lee(e),options:[e,t]}),i7=(e,t)=>({...Vee(e),options:[e,t]}),o7={...t8},qee=o7.useInsertionEffect,Hee=qee||(e=>e());function ya(e){const t=w.useRef(()=>{});return Hee(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}var No=typeof document<"u"?w.useLayoutEffect:w.useEffect;let kM=!1,Wee=0;const IM=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Wee++;function Gee(){const[e,t]=w.useState(()=>kM?IM():void 0);return No(()=>{e==null&&t(IM())},[]),w.useEffect(()=>{kM=!0},[]),e}const Yee=o7.useId,a7=Yee||Gee;function Jee(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(s=>s!==n))||[])}}}const Xee=w.createContext(null),Kee=w.createContext(null),Hj=()=>{var e;return((e=w.useContext(Xee))==null?void 0:e.id)||null},Wj=()=>w.useContext(Kee);function Gj(e){return"data-floating-ui-"+e}function Y2(e){const t=w.useRef(e);return No(()=>{t.current=e}),t}const DM=Gj("safe-polygon");function hv(e,t,n){return n&&!X_(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function Qee(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:s,events:i,elements:o}=e,{enabled:a=!0,delay:c=0,handleClose:u=null,mouseOnly:f=!1,restMs:h=0,move:m=!0}=t,y=Wj(),v=Hj(),x=Y2(u),E=Y2(c),N=Y2(n),_=w.useRef(),C=w.useRef(-1),j=w.useRef(),A=w.useRef(-1),$=w.useRef(!0),R=w.useRef(!1),M=w.useRef(()=>{}),D=w.useRef(!1),P=w.useCallback(()=>{var L;const z=(L=s.current.openEvent)==null?void 0:L.type;return(z==null?void 0:z.includes("mouse"))&&z!=="mousedown"},[s]);w.useEffect(()=>{if(!a)return;function L(z){let{open:q}=z;q||(clearTimeout(C.current),clearTimeout(A.current),$.current=!0,D.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[a,i]),w.useEffect(()=>{if(!a||!x.current||!n)return;function L(q){P()&&r(!1,q,"hover")}const z=Cu(o.floating).documentElement;return z.addEventListener("mouseleave",L),()=>{z.removeEventListener("mouseleave",L)}},[o.floating,n,r,a,x,P]);const F=w.useCallback(function(L,z,q){z===void 0&&(z=!0),q===void 0&&(q="hover");const k=hv(E.current,"close",_.current);k&&!j.current?(clearTimeout(C.current),C.current=window.setTimeout(()=>r(!1,L,q),k)):z&&(clearTimeout(C.current),r(!1,L,q))},[E,r]),V=ya(()=>{M.current(),j.current=void 0}),H=ya(()=>{if(R.current){const L=Cu(o.floating).body;L.style.pointerEvents="",L.removeAttribute(DM),R.current=!1}}),I=ya(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);w.useEffect(()=>{if(!a)return;function L(W){if(clearTimeout(C.current),$.current=!1,f&&!X_(_.current)||h>0&&!hv(E.current,"open"))return;const X=hv(E.current,"open",_.current);X?C.current=window.setTimeout(()=>{N.current||r(!0,W,"hover")},X):n||r(!0,W,"hover")}function z(W){if(I())return;M.current();const X=Cu(o.floating);if(clearTimeout(A.current),D.current=!1,x.current&&s.current.floatingContext){n||clearTimeout(C.current),j.current=x.current({...s.current.floatingContext,tree:y,x:W.clientX,y:W.clientY,onClose(){H(),V(),I()||F(W,!0,"safe-polygon")}});const re=j.current;X.addEventListener("mousemove",re),M.current=()=>{X.removeEventListener("mousemove",re)};return}(_.current==="touch"?!gg(o.floating,W.relatedTarget):!0)&&F(W)}function q(W){I()||s.current.floatingContext&&(x.current==null||x.current({...s.current.floatingContext,tree:y,x:W.clientX,y:W.clientY,onClose(){H(),V(),I()||F(W)}})(W))}if(cn(o.domReference)){var k;const W=o.domReference;return n&&W.addEventListener("mouseleave",q),(k=o.floating)==null||k.addEventListener("mouseleave",q),m&&W.addEventListener("mousemove",L,{once:!0}),W.addEventListener("mouseenter",L),W.addEventListener("mouseleave",z),()=>{var X;n&&W.removeEventListener("mouseleave",q),(X=o.floating)==null||X.removeEventListener("mouseleave",q),m&&W.removeEventListener("mousemove",L),W.removeEventListener("mouseenter",L),W.removeEventListener("mouseleave",z)}}},[o,a,e,f,h,m,F,V,H,r,n,N,y,E,x,s,I]),No(()=>{var L;if(a&&n&&(L=x.current)!=null&&L.__options.blockPointerEvents&&P()){R.current=!0;const q=o.floating;if(cn(o.domReference)&&q){var z;const k=Cu(o.floating).body;k.setAttribute(DM,"");const W=o.domReference,X=y==null||(z=y.nodesRef.current.find(ne=>ne.id===v))==null||(z=z.context)==null?void 0:z.elements.floating;return X&&(X.style.pointerEvents=""),k.style.pointerEvents="none",W.style.pointerEvents="auto",q.style.pointerEvents="auto",()=>{k.style.pointerEvents="",W.style.pointerEvents="",q.style.pointerEvents=""}}}},[a,n,v,o,y,x,P]),No(()=>{n||(_.current=void 0,D.current=!1,V(),H())},[n,V,H]),w.useEffect(()=>()=>{V(),clearTimeout(C.current),clearTimeout(A.current),H()},[a,o.domReference,V,H]);const B=w.useMemo(()=>{function L(z){_.current=z.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(z){const{nativeEvent:q}=z;function k(){!$.current&&!N.current&&r(!0,q,"hover")}f&&!X_(_.current)||n||h===0||D.current&&z.movementX**2+z.movementY**2<2||(clearTimeout(A.current),_.current==="touch"?k():(D.current=!0,A.current=window.setTimeout(k,h)))}}},[f,r,n,N,h]),T=w.useMemo(()=>({onMouseEnter(){clearTimeout(C.current)},onMouseLeave(L){I()||F(L.nativeEvent,!1)}}),[F,I]);return w.useMemo(()=>a?{reference:B,floating:T}:{},[a,B,T])}const Z_=()=>{},l7=w.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Z_,setState:Z_,isInstantPhase:!1}),Zee=()=>w.useContext(l7);function ete(e){const{children:t,delay:n,timeoutMs:r=0}=e,[s,i]=w.useReducer((c,u)=>({...c,...u}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=w.useRef(null),a=w.useCallback(c=>{i({currentId:c})},[]);return No(()=>{s.currentId?o.current===null?o.current=s.currentId:s.isInstantPhase||i({isInstantPhase:!0}):(s.isInstantPhase&&i({isInstantPhase:!1}),o.current=null)},[s.currentId,s.isInstantPhase]),w.createElement(l7.Provider,{value:w.useMemo(()=>({...s,setState:i,setCurrentId:a}),[s,a])},t)}function tte(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,floatingId:s}=e,{id:i,enabled:o=!0}=t,a=i??s,c=Zee(),{currentId:u,setCurrentId:f,initialDelay:h,setState:m,timeoutMs:y}=c;return No(()=>{o&&u&&(m({delay:{open:1,close:hv(h,"close")}}),u!==a&&r(!1))},[o,a,r,m,u,h]),No(()=>{function v(){r(!1),m({delay:h,currentId:null})}if(o&&u&&!n&&u===a){if(y){const x=window.setTimeout(v,y);return()=>{clearTimeout(x)}}v()}},[o,n,m,u,a,r,h,y]),No(()=>{o&&(f===Z_||!n||f(a))},[o,n,f,a]),c}function J2(e,t){let n=e.filter(s=>{var i;return s.parentId===t&&((i=s.context)==null?void 0:i.open)}),r=n;for(;r.length;)r=e.filter(s=>{var i;return(i=r)==null?void 0:i.some(o=>{var a;return s.parentId===o.id&&((a=s.context)==null?void 0:a.open)})}),n=n.concat(r);return n}const nte="data-floating-ui-focusable",rte={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ste={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},PM=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function ite(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:s,dataRef:i}=e,{enabled:o=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:u="pointerdown",referencePress:f=!1,referencePressEvent:h="pointerdown",ancestorScroll:m=!1,bubbles:y,capture:v}=t,x=Wj(),E=ya(typeof c=="function"?c:()=>!1),N=typeof c=="function"?E:c,_=w.useRef(!1),C=w.useRef(!1),{escapeKey:j,outsidePress:A}=PM(y),{escapeKey:$,outsidePress:R}=PM(v),M=w.useRef(!1),D=ya(B=>{var T;if(!n||!o||!a||B.key!=="Escape"||M.current)return;const L=(T=i.current.floatingContext)==null?void 0:T.nodeId,z=x?J2(x.nodesRef.current,L):[];if(!j&&(B.stopPropagation(),z.length>0)){let q=!0;if(z.forEach(k=>{var W;if((W=k.context)!=null&&W.open&&!k.context.dataRef.current.__escapeKeyBubbles){q=!1;return}}),!q)return}r(!1,KZ(B)?B.nativeEvent:B,"escape-key")}),P=ya(B=>{var T;const L=()=>{var z;D(B),(z=Nf(B))==null||z.removeEventListener("keydown",L)};(T=Nf(B))==null||T.addEventListener("keydown",L)}),F=ya(B=>{var T;const L=_.current;_.current=!1;const z=C.current;if(C.current=!1,u==="click"&&z||L||typeof N=="function"&&!N(B))return;const q=Nf(B),k="["+Gj("inert")+"]",W=Cu(s.floating).querySelectorAll(k);let X=cn(q)?q:null;for(;X&&!bc(X);){const fe=ka(X);if(bc(fe)||!cn(fe))break;X=fe}if(W.length&&cn(q)&&!QZ(q)&&!gg(q,s.floating)&&Array.from(W).every(fe=>!gg(X,fe)))return;if(_s(q)&&I){const fe=q.clientWidth>0&&q.scrollWidth>q.clientWidth,he=q.clientHeight>0&&q.scrollHeight>q.clientHeight;let ue=he&&B.offsetX>q.clientWidth;if(he&&si(q).direction==="rtl"&&(ue=B.offsetX<=q.offsetWidth-q.clientWidth),ue||fe&&B.offsetY>q.clientHeight)return}const ne=(T=i.current.floatingContext)==null?void 0:T.nodeId,re=x&&J2(x.nodesRef.current,ne).some(fe=>{var he;return H2(B,(he=fe.context)==null?void 0:he.elements.floating)});if(H2(B,s.floating)||H2(B,s.domReference)||re)return;const se=x?J2(x.nodesRef.current,ne):[];if(se.length>0){let fe=!0;if(se.forEach(he=>{var ue;if((ue=he.context)!=null&&ue.open&&!he.context.dataRef.current.__outsidePressBubbles){fe=!1;return}}),!fe)return}r(!1,B,"outside-press")}),V=ya(B=>{var T;const L=()=>{var z;F(B),(z=Nf(B))==null||z.removeEventListener(u,L)};(T=Nf(B))==null||T.addEventListener(u,L)});w.useEffect(()=>{if(!n||!o)return;i.current.__escapeKeyBubbles=j,i.current.__outsidePressBubbles=A;let B=-1;function T(W){r(!1,W,"ancestor-scroll")}function L(){window.clearTimeout(B),M.current=!0}function z(){B=window.setTimeout(()=>{M.current=!1},Rw()?5:0)}const q=Cu(s.floating);a&&(q.addEventListener("keydown",$?P:D,$),q.addEventListener("compositionstart",L),q.addEventListener("compositionend",z)),N&&q.addEventListener(u,R?V:F,R);let k=[];return m&&(cn(s.domReference)&&(k=_a(s.domReference)),cn(s.floating)&&(k=k.concat(_a(s.floating))),!cn(s.reference)&&s.reference&&s.reference.contextElement&&(k=k.concat(_a(s.reference.contextElement)))),k=k.filter(W=>{var X;return W!==((X=q.defaultView)==null?void 0:X.visualViewport)}),k.forEach(W=>{W.addEventListener("scroll",T,{passive:!0})}),()=>{a&&(q.removeEventListener("keydown",$?P:D,$),q.removeEventListener("compositionstart",L),q.removeEventListener("compositionend",z)),N&&q.removeEventListener(u,R?V:F,R),k.forEach(W=>{W.removeEventListener("scroll",T)}),window.clearTimeout(B)}},[i,s,a,N,u,n,r,m,o,j,A,D,$,P,F,R,V]),w.useEffect(()=>{_.current=!1},[N,u]);const H=w.useMemo(()=>({onKeyDown:D,[rte[h]]:B=>{f&&r(!1,B.nativeEvent,"reference-press")}}),[D,r,f,h]),I=w.useMemo(()=>({onKeyDown:D,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[ste[u]]:()=>{_.current=!0}}),[D,u]);return w.useMemo(()=>o?{reference:H,floating:I}:{},[o,H,I])}function ote(e){const{open:t=!1,onOpenChange:n,elements:r}=e,s=a7(),i=w.useRef({}),[o]=w.useState(()=>Jee()),a=Hj()!=null,[c,u]=w.useState(r.reference),f=ya((y,v,x)=>{i.current.openEvent=y?v:void 0,o.emit("openchange",{open:y,event:v,reason:x,nested:a}),n==null||n(y,v,x)}),h=w.useMemo(()=>({setPositionReference:u}),[]),m=w.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return w.useMemo(()=>({dataRef:i,open:t,onOpenChange:f,elements:m,events:o,floatingId:s,refs:h}),[t,f,m,o,s,h])}function Yj(e){e===void 0&&(e={});const{nodeId:t}=e,n=ote({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,s=r.elements,[i,o]=w.useState(null),[a,c]=w.useState(null),f=(s==null?void 0:s.domReference)||i,h=w.useRef(null),m=Wj();No(()=>{f&&(h.current=f)},[f]);const y=zee({...e,elements:{...s,...a&&{reference:a}}}),v=w.useCallback(C=>{const j=cn(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),contextElement:C}:C;c(j),y.refs.setReference(j)},[y.refs]),x=w.useCallback(C=>{(cn(C)||C===null)&&(h.current=C,o(C)),(cn(y.refs.reference.current)||y.refs.reference.current===null||C!==null&&!cn(C))&&y.refs.setReference(C)},[y.refs]),E=w.useMemo(()=>({...y.refs,setReference:x,setPositionReference:v,domReference:h}),[y.refs,x,v]),N=w.useMemo(()=>({...y.elements,domReference:f}),[y.elements,f]),_=w.useMemo(()=>({...y,...r,refs:E,elements:N,nodeId:t}),[y,E,N,t,r]);return No(()=>{r.dataRef.current.floatingContext=_;const C=m==null?void 0:m.nodesRef.current.find(j=>j.id===t);C&&(C.context=_)}),w.useMemo(()=>({...y,context:_,refs:E,elements:N}),[y,E,N,_])}function ate(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:s,dataRef:i,elements:o}=e,{enabled:a=!0,visibleOnly:c=!0}=t,u=w.useRef(!1),f=w.useRef(),h=w.useRef(!0);w.useEffect(()=>{if(!a)return;const y=ts(o.domReference);function v(){!n&&_s(o.domReference)&&o.domReference===CM(Cu(o.domReference))&&(u.current=!0)}function x(){h.current=!0}return y.addEventListener("blur",v),y.addEventListener("keydown",x,!0),()=>{y.removeEventListener("blur",v),y.removeEventListener("keydown",x,!0)}},[o.domReference,n,a]),w.useEffect(()=>{if(!a)return;function y(v){let{reason:x}=v;(x==="reference-press"||x==="escape-key")&&(u.current=!0)}return s.on("openchange",y),()=>{s.off("openchange",y)}},[s,a]),w.useEffect(()=>()=>{clearTimeout(f.current)},[]);const m=w.useMemo(()=>({onPointerDown(y){GZ(y.nativeEvent)||(h.current=!1)},onMouseLeave(){u.current=!1},onFocus(y){if(u.current)return;const v=Nf(y.nativeEvent);if(c&&cn(v))try{if(YZ()&&JZ())throw Error();if(!v.matches(":focus-visible"))return}catch{if(!h.current&&!eee(v))return}r(!0,y.nativeEvent,"focus")},onBlur(y){u.current=!1;const v=y.relatedTarget,x=y.nativeEvent,E=cn(v)&&v.hasAttribute(Gj("focus-guard"))&&v.getAttribute("data-type")==="outside";f.current=window.setTimeout(()=>{var N;const _=CM(o.domReference?o.domReference.ownerDocument:document);!v&&_===o.domReference||gg((N=i.current.floatingContext)==null?void 0:N.refs.floating.current,_)||gg(o.domReference,_)||E||r(!1,x,"focus")})}}),[i,o.domReference,r,c]);return w.useMemo(()=>a?{reference:m}:{},[a,m])}const LM="active",FM="selected";function X2(e,t,n){const r=new Map,s=n==="item";let i=e;if(s&&e){const{[LM]:o,[FM]:a,...c}=e;i=c}return{...n==="floating"&&{tabIndex:-1,[nte]:""},...i,...t.map(o=>{const a=o?o[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((o,a)=>(a&&Object.entries(a).forEach(c=>{let[u,f]=c;if(!(s&&[LM,FM].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof f=="function"){var h;(h=r.get(u))==null||h.push(f),o[u]=function(){for(var m,y=arguments.length,v=new Array(y),x=0;x<y;x++)v[x]=arguments[x];return(m=r.get(u))==null?void 0:m.map(E=>E(...v)).find(E=>E!==void 0)}}}else o[u]=f}),o),{})}}function lte(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=w.useCallback(a=>X2(a,e,"reference"),t),i=w.useCallback(a=>X2(a,e,"floating"),n),o=w.useCallback(a=>X2(a,e,"item"),r);return w.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:o}),[s,i,o])}const cte=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function ute(e,t){var n;t===void 0&&(t={});const{open:r,floatingId:s}=e,{enabled:i=!0,role:o="dialog"}=t,a=(n=cte.get(o))!=null?n:o,c=a7(),f=Hj()!=null,h=w.useMemo(()=>a==="tooltip"||o==="label"?{["aria-"+(o==="label"?"labelledby":"describedby")]:r?s:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":a==="alertdialog"?"dialog":a,"aria-controls":r?s:void 0,...a==="listbox"&&{role:"combobox"},...a==="menu"&&{id:c},...a==="menu"&&f&&{role:"menuitem"},...o==="select"&&{"aria-autocomplete":"none"},...o==="combobox"&&{"aria-autocomplete":"list"}},[a,s,f,r,c,o]),m=w.useMemo(()=>{const v={id:s,...a&&{role:a}};return a==="tooltip"||o==="label"?v:{...v,...a==="menu"&&{"aria-labelledby":c}}},[a,s,c,o]),y=w.useCallback(v=>{let{active:x,selected:E}=v;const N={role:"option",...x&&{id:s+"-option"}};switch(o){case"select":return{...N,"aria-selected":x&&E};case"combobox":return{...N,...x&&{"aria-selected":!0}}}return{}},[s,o]);return w.useMemo(()=>i?{reference:h,floating:m,item:y}:{},[i,h,m,y])}function c7(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),s=n==="right"?"left":"right";return r===void 0?s:`${s}-${r}`}return t}function BM(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function zM(e,t,n,r,s){return e==="center"||r==="center"?{left:t}:e==="end"?{[s==="ltr"?"right":"left"]:n}:e==="start"?{[s==="ltr"?"left":"right"]:n}:{}}const dte={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function fte({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:s,arrowX:i,arrowY:o,dir:a}){const[c,u="center"]=e.split("-"),f={width:t,height:t,transform:"rotate(45deg)",position:"absolute",[dte[c]]:r},h=-t/2;return c==="left"?{...f,...BM(u,o,n,s),right:h,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:c==="right"?{...f,...BM(u,o,n,s),left:h,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:c==="top"?{...f,...zM(u,i,n,s,a),bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:c==="bottom"?{...f,...zM(u,i,n,s,a),top:h,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const Jj=w.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:s,visible:i,arrowX:o,arrowY:a,style:c,...u},f)=>{const{dir:h}=Rc();return i?p.jsx("div",{...u,ref:f,style:{...c,...fte({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:s,dir:h,arrowX:o,arrowY:a})}}):null});Jj.displayName="@mantine/core/FloatingArrow";var u7={root:"m_9814e45f"};const hte={zIndex:Qi("modal")},pte=(e,{gradient:t,color:n,backgroundOpacity:r,blur:s,radius:i,zIndex:o})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&fo(n||"#000",r??.6)||void 0,"--overlay-filter":s?`blur(${_e(s)})`:void 0,"--overlay-radius":i===void 0?void 0:Hn(i),"--overlay-z-index":o==null?void 0:o.toString()}}),kw=Tc((e,t)=>{const n=Pe("Overlay",hte,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,fixed:u,center:f,children:h,radius:m,zIndex:y,gradient:v,blur:x,color:E,backgroundOpacity:N,mod:_,...C}=n,j=bt({name:"Overlay",props:n,classes:u7,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:pte});return p.jsx(ze,{ref:t,...j("root"),mod:[{center:f,fixed:u},_],...C,children:h})});kw.classes=u7;kw.displayName="@mantine/core/Overlay";function K2(e){const t=document.createElement("div");return t.setAttribute("data-portal","true"),typeof e.className=="string"&&t.classList.add(...e.className.split(" ").filter(Boolean)),typeof e.style=="object"&&Object.assign(t.style,e.style),typeof e.id=="string"&&t.setAttribute("id",e.id),t}function mte({target:e,reuseTargetNode:t,...n}){if(e)return typeof e=="string"?document.querySelector(e)||K2(n):e;if(t){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const s=K2(n);return s.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(s),s}return K2(n)}const gte={},d7=qe((e,t)=>{const{children:n,target:r,reuseTargetNode:s,...i}=Pe("Portal",gte,e),[o,a]=w.useState(!1),c=w.useRef(null);return Wh(()=>(a(!0),c.current=mte({target:r,reuseTargetNode:s,...i}),Vv(t,c.current),!r&&!s&&c.current&&document.body.appendChild(c.current),()=>{!r&&!s&&c.current&&document.body.removeChild(c.current)}),[r]),!o||!c.current?null:vy.createPortal(p.jsx(p.Fragment,{children:n}),c.current)});d7.displayName="@mantine/core/Portal";const cd=qe(({withinPortal:e=!0,children:t,...n},r)=>w8()==="test"||!e?p.jsx(p.Fragment,{children:t}):p.jsx(d7,{ref:r,...n,children:t}));cd.displayName="@mantine/core/OptionalPortal";const bm=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),_b={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...bm("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...bm("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...bm("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...bm("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...bm("top"),common:{transformOrigin:"top right"}}},VM={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function yte({transition:e,state:t,duration:n,timingFunction:r}){const s={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in _b?{transitionProperty:_b[e].transitionProperty,...s,..._b[e].common,..._b[e][VM[t]]}:{}:{transitionProperty:e.transitionProperty,...s,...e.common,...e[VM[t]]}}function bte({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:s,onExit:i,onEntered:o,onExited:a,enterDelay:c,exitDelay:u}){const f=As(),h=Ej(),m=f.respectReducedMotion?h:!1,[y,v]=w.useState(m?0:e),[x,E]=w.useState(r?"entered":"exited"),N=w.useRef(-1),_=w.useRef(-1),C=w.useRef(-1),j=$=>{const R=$?s:i,M=$?o:a;window.clearTimeout(N.current);const D=m?0:$?e:t;v(D),D===0?(typeof R=="function"&&R(),typeof M=="function"&&M(),E($?"entered":"exited")):C.current=requestAnimationFrame(()=>{Rf.flushSync(()=>{E($?"pre-entering":"pre-exiting")}),C.current=requestAnimationFrame(()=>{typeof R=="function"&&R(),E($?"entering":"exiting"),N.current=window.setTimeout(()=>{typeof M=="function"&&M(),E($?"entered":"exited")},D)})})},A=$=>{if(window.clearTimeout(_.current),typeof($?c:u)!="number"){j($);return}_.current=window.setTimeout(()=>{j($)},$?c:u)};return Ra(()=>{A(r)},[r]),w.useEffect(()=>()=>{window.clearTimeout(N.current),cancelAnimationFrame(C.current)},[]),{transitionDuration:y,transitionStatus:x,transitionTimingFunction:n||"ease"}}function Mc({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:s,children:i,timingFunction:o="ease",onExit:a,onEntered:c,onEnter:u,onExited:f,enterDelay:h,exitDelay:m}){const y=w8(),{transitionDuration:v,transitionStatus:x,transitionTimingFunction:E}=bte({mounted:s,exitDuration:r,duration:n,timingFunction:o,onExit:a,onEntered:c,onEnter:u,onExited:f,enterDelay:h,exitDelay:m});return v===0||y==="test"?s?p.jsx(p.Fragment,{children:i({})}):e?i({display:"none"}):null:x==="exited"?e?i({display:"none"}):null:p.jsx(p.Fragment,{children:i(yte({transition:t,duration:v,state:x,timingFunction:E}))})}Mc.displayName="@mantine/core/Transition";const[vte,f7]=Ua("Popover component was not found in the tree");function Iw({children:e,active:t=!0,refProp:n="ref",innerRef:r}){const s=_w(t),i=_n(s,r);return jc(e)?w.cloneElement(e,{[n]:i}):e}function h7(e){return p.jsx(kj,{tabIndex:-1,"data-autofocus":!0,...e})}Iw.displayName="@mantine/core/FocusTrap";h7.displayName="@mantine/core/FocusTrapInitialFocus";Iw.InitialFocus=h7;var p7={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};const xte={},Xj=qe((e,t)=>{var E,N,_,C;const n=Pe("PopoverDropdown",xte,e),{className:r,style:s,vars:i,children:o,onKeyDownCapture:a,variant:c,classNames:u,styles:f,...h}=n,m=f7(),y=f8({opened:m.opened,shouldReturnFocus:m.returnFocus}),v=m.withRoles?{"aria-labelledby":m.getTargetId(),id:m.getDropdownId(),role:"dialog",tabIndex:-1}:{},x=_n(t,m.floating);return m.disabled?null:p.jsx(cd,{...m.portalProps,withinPortal:m.withinPortal,children:p.jsx(Mc,{mounted:m.opened,...m.transitionProps,transition:((E=m.transitionProps)==null?void 0:E.transition)||"fade",duration:((N=m.transitionProps)==null?void 0:N.duration)??150,keepMounted:m.keepMounted,exitDuration:typeof((_=m.transitionProps)==null?void 0:_.exitDuration)=="number"?m.transitionProps.exitDuration:(C=m.transitionProps)==null?void 0:C.duration,children:j=>p.jsx(Iw,{active:m.trapFocus&&m.opened,innerRef:x,children:p.jsxs(ze,{...v,...h,variant:c,onKeyDownCapture:zK(()=>{var A,$;(A=m.onClose)==null||A.call(m),($=m.onDismiss)==null||$.call(m)},{active:m.closeOnEscape,onTrigger:y,onKeyDown:a}),"data-position":m.placement,"data-fixed":m.floatingStrategy==="fixed"||void 0,...m.getStyles("dropdown",{className:r,props:n,classNames:u,styles:f,style:[{...j,zIndex:m.zIndex,top:m.y??0,left:m.x??0,width:m.width==="target"?void 0:_e(m.width)},m.resolvedStyles.dropdown,f==null?void 0:f.dropdown,s]}),children:[o,p.jsx(Jj,{ref:m.arrowRef,arrowX:m.arrowX,arrowY:m.arrowY,visible:m.withArrow,position:m.placement,arrowSize:m.arrowSize,arrowRadius:m.arrowRadius,arrowOffset:m.arrowOffset,arrowPosition:m.arrowPosition,...m.getStyles("arrow",{props:n,classNames:u,styles:f})})]})})})})});Xj.classes=p7;Xj.displayName="@mantine/core/PopoverDropdown";const wte={refProp:"ref",popupType:"dialog"},m7=qe((e,t)=>{const{children:n,refProp:r,popupType:s,...i}=Pe("PopoverTarget",wte,e);if(!jc(n))throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const o=i,a=f7(),c=_n(a.reference,Cw(n),t),u=a.withRoles?{"aria-haspopup":s,"aria-expanded":a.opened,"aria-controls":a.getDropdownId(),id:a.getTargetId()}:{};return w.cloneElement(n,{...o,...u,...a.targetProps,className:hn(a.targetProps.className,o.className,n.props.className),[r]:c,...a.controlled?null:{onClick:a.onToggle}})});m7.displayName="@mantine/core/PopoverTarget";function g7({opened:e,floating:t,position:n,positionDependencies:r}){const[s,i]=w.useState(0);w.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current&&e)return Mee(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,s,n]),Ra(()=>{t.update()},r),Ra(()=>{i(o=>o+1)},[e])}function Ste(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Ete(e,t){const n=Ste(e.middlewares),r=[s7(e.offset)];return n.shift&&r.push(qj(typeof n.shift=="boolean"?{limiter:MM(),padding:5}:{limiter:MM(),padding:5,...n.shift})),n.flip&&r.push(typeof n.flip=="boolean"?Gv():Gv(n.flip)),n.inline&&r.push(typeof n.inline=="boolean"?Hm():Hm(n.inline)),r.push(i7({element:e.arrowRef,padding:e.arrowOffset})),(n.size||e.width==="target")&&r.push(Uee({...typeof n.size=="boolean"?{}:n.size,apply({rects:s,availableWidth:i,availableHeight:o,...a}){var f;const u=((f=t().refs.floating.current)==null?void 0:f.style)??{};n.size&&(typeof n.size=="object"&&n.size.apply?n.size.apply({rects:s,availableWidth:i,availableHeight:o,...a}):Object.assign(u,{maxWidth:`${i}px`,maxHeight:`${o}px`})),e.width==="target"&&Object.assign(u,{width:`${s.reference.width}px`})}})),r}function Nte(e){const[t,n]=ss({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=w.useRef(t),s=()=>{t&&n(!1)},i=()=>n(!t),o=Yj({strategy:e.strategy,placement:e.position,middleware:Ete(e,()=>o)});return g7({opened:t,position:e.position,positionDependencies:e.positionDependencies||[],floating:o}),Ra(()=>{var a;(a=e.onPositionChange)==null||a.call(e,o.placement)},[o.placement]),Ra(()=>{var a,c;t!==r.current&&(t?(c=e.onOpen)==null||c.call(e):(a=e.onClose)==null||a.call(e)),r.current=t},[t,e.onClose,e.onOpen]),{floating:o,controlled:typeof e.opened=="boolean",opened:t,onClose:s,onToggle:i}}const _te={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Qi("popover"),__staticSelector:"Popover",width:"max-content"},Cte=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Hn(t),"--popover-shadow":Sj(n)}});function ns(e){var de,be,Ae,Ie,ht,Vt;const t=Pe("Popover",_te,e),{children:n,position:r,offset:s,onPositionChange:i,positionDependencies:o,opened:a,transitionProps:c,onExitTransitionEnd:u,onEnterTransitionEnd:f,width:h,middlewares:m,withArrow:y,arrowSize:v,arrowOffset:x,arrowRadius:E,arrowPosition:N,unstyled:_,classNames:C,styles:j,closeOnClickOutside:A,withinPortal:$,portalProps:R,closeOnEscape:M,clickOutsideEvents:D,trapFocus:P,onClose:F,onDismiss:V,onOpen:H,onChange:I,zIndex:B,radius:T,shadow:L,id:z,defaultOpened:q,__staticSelector:k,withRoles:W,disabled:X,returnFocus:ne,variant:re,keepMounted:se,vars:fe,floatingStrategy:he,withOverlay:ue,overlayProps:ve,...Se}=t,ke=bt({name:k,props:t,classes:p7,classNames:C,styles:j,unstyled:_,rootSelector:"dropdown",vars:fe,varsResolver:Cte}),{resolvedStyles:Oe}=Yh({classNames:C,styles:j,props:t}),Ce=w.useRef(null),[Me,Ve]=w.useState(null),[We,$e]=w.useState(null),{dir:J}=Rc(),te=di(z),Q=Nte({middlewares:m,width:h,position:c7(J,r),offset:typeof s=="number"?s+(y?v/2:0):s,arrowRef:Ce,arrowOffset:x,onPositionChange:i,positionDependencies:o,opened:a,defaultOpened:q,onChange:I,onOpen:H,onClose:F,onDismiss:V,strategy:he});yy(()=>{A&&(Q.onClose(),V==null||V())},D,[Me,We]);const ye=w.useCallback(_t=>{Ve(_t),Q.floating.refs.setReference(_t)},[Q.floating.refs.setReference]),ce=w.useCallback(_t=>{$e(_t),Q.floating.refs.setFloating(_t)},[Q.floating.refs.setFloating]),ae=w.useCallback(()=>{var _t;(_t=c==null?void 0:c.onExited)==null||_t.call(c),u==null||u()},[c==null?void 0:c.onExited,u]),ie=w.useCallback(()=>{var _t;(_t=c==null?void 0:c.onEntered)==null||_t.call(c),f==null||f()},[c==null?void 0:c.onEntered,f]);return p.jsxs(vte,{value:{returnFocus:ne,disabled:X,controlled:Q.controlled,reference:ye,floating:ce,x:Q.floating.x,y:Q.floating.y,arrowX:(Ae=(be=(de=Q.floating)==null?void 0:de.middlewareData)==null?void 0:be.arrow)==null?void 0:Ae.x,arrowY:(Vt=(ht=(Ie=Q.floating)==null?void 0:Ie.middlewareData)==null?void 0:ht.arrow)==null?void 0:Vt.y,opened:Q.opened,arrowRef:Ce,transitionProps:{...c,onExited:ae,onEntered:ie},width:h,withArrow:y,arrowSize:v,arrowOffset:x,arrowRadius:E,arrowPosition:N,placement:Q.floating.placement,trapFocus:P,withinPortal:$,portalProps:R,zIndex:B,radius:T,shadow:L,closeOnEscape:M,onDismiss:V,onClose:Q.onClose,onToggle:Q.onToggle,getTargetId:()=>`${te}-target`,getDropdownId:()=>`${te}-dropdown`,withRoles:W,targetProps:Se,__staticSelector:k,classNames:C,styles:j,unstyled:_,variant:re,keepMounted:se,getStyles:ke,resolvedStyles:Oe,floatingStrategy:he},children:[n,ue&&p.jsx(Mc,{transition:"fade",mounted:Q.opened,duration:(c==null?void 0:c.duration)||250,exitDuration:(c==null?void 0:c.exitDuration)||250,children:_t=>p.jsx(cd,{withinPortal:$,children:p.jsx(kw,{...ve,...ke("overlay",{className:ve==null?void 0:ve.className,style:[_t,ve==null?void 0:ve.style]})})})})]})}ns.Target=m7;ns.Dropdown=Xj;ns.displayName="@mantine/core/Popover";ns.extend=e=>e;var Pi={root:"m_5ae2e3c",barsLoader:"m_7a2bd4cd",bar:"m_870bb79","bars-loader-animation":"m_5d2b3b9d",dotsLoader:"m_4e3f22d7",dot:"m_870c4af","loader-dots-animation":"m_aac34a1",ovalLoader:"m_b34414df","oval-loader-animation":"m_f8e89c4b"};const y7=w.forwardRef(({className:e,...t},n)=>p.jsxs(ze,{component:"span",className:hn(Pi.barsLoader,e),...t,ref:n,children:[p.jsx("span",{className:Pi.bar}),p.jsx("span",{className:Pi.bar}),p.jsx("span",{className:Pi.bar})]}));y7.displayName="@mantine/core/Bars";const b7=w.forwardRef(({className:e,...t},n)=>p.jsxs(ze,{component:"span",className:hn(Pi.dotsLoader,e),...t,ref:n,children:[p.jsx("span",{className:Pi.dot}),p.jsx("span",{className:Pi.dot}),p.jsx("span",{className:Pi.dot})]}));b7.displayName="@mantine/core/Dots";const v7=w.forwardRef(({className:e,...t},n)=>p.jsx(ze,{component:"span",className:hn(Pi.ovalLoader,e),...t,ref:n}));v7.displayName="@mantine/core/Oval";const x7={bars:y7,oval:v7,dots:b7},Ote={loaders:x7,type:"oval"},jte=(e,{size:t,color:n})=>({root:{"--loader-size":Mt(t,"loader-size"),"--loader-color":n?wr(n,e):void 0}}),Sy=qe((e,t)=>{const n=Pe("Loader",Ote,e),{size:r,color:s,type:i,vars:o,className:a,style:c,classNames:u,styles:f,unstyled:h,loaders:m,variant:y,children:v,...x}=n,E=bt({name:"Loader",props:n,classes:Pi,className:a,style:c,classNames:u,styles:f,unstyled:h,vars:o,varsResolver:jte});return v?p.jsx(ze,{...E("root"),ref:t,...x,children:v}):p.jsx(ze,{...E("root"),ref:t,component:m[i],variant:y,size:r,...x})});Sy.defaultLoaders=x7;Sy.classes=Pi;Sy.displayName="@mantine/core/Loader";const w7=w.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>p.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n,children:p.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}));w7.displayName="@mantine/core/CloseIcon";var S7={root:"m_86a44da5","root--subtle":"m_220c80f2"};const Ate={variant:"subtle"},$te=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":Mt(t,"cb-size"),"--cb-radius":n===void 0?void 0:Hn(n),"--cb-icon-size":_e(r)}}),Qh=Tc((e,t)=>{const n=Pe("CloseButton",Ate,e),{iconSize:r,children:s,vars:i,radius:o,className:a,classNames:c,style:u,styles:f,unstyled:h,"data-disabled":m,disabled:y,variant:v,icon:x,mod:E,__staticSelector:N,..._}=n,C=bt({name:N||"CloseButton",props:n,className:a,style:u,classes:S7,classNames:c,styles:f,unstyled:h,vars:i,varsResolver:$te});return p.jsxs(Ma,{ref:t,..._,unstyled:h,variant:v,disabled:y,mod:[{disabled:y||m},E],...C("root",{variant:v,active:!y&&!m}),children:[x||p.jsx(w7,{}),s]})});Qh.classes=S7;Qh.displayName="@mantine/core/CloseButton";function Tte(e){return w.Children.toArray(e).filter(Boolean)}var E7={root:"m_4081bf90"};const Rte={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},Mte=(e,{grow:t,preventGrowOverflow:n,gap:r,align:s,justify:i,wrap:o},{childWidth:a})=>({root:{"--group-child-width":t&&n?a:void 0,"--group-gap":wj(r),"--group-align":s,"--group-justify":i,"--group-wrap":o}}),Kj=qe((e,t)=>{const n=Pe("Group",Rte,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,children:c,gap:u,align:f,justify:h,wrap:m,grow:y,preventGrowOverflow:v,vars:x,variant:E,__size:N,mod:_,...C}=n,j=Tte(c),A=j.length,$=wj(u??"md"),M={childWidth:`calc(${100/A}% - (${$} - ${$} / ${A}))`},D=bt({name:"Group",props:n,stylesCtx:M,className:s,style:i,classes:E7,classNames:r,styles:o,unstyled:a,vars:x,varsResolver:Mte});return p.jsx(ze,{...D("root"),ref:t,variant:E,mod:[{grow:y},_],size:N,...C,children:j})});Kj.classes=E7;Kj.displayName="@mantine/core/Group";const[kte,qa]=Ua("ModalBase component was not found in tree");function Ite({opened:e,transitionDuration:t}){const[n,r]=w.useState(e),s=w.useRef(-1),o=Ej()?0:t;return w.useEffect(()=>(e?(r(!0),window.clearTimeout(s.current)):o===0?r(!1):s.current=window.setTimeout(()=>r(!1),o),()=>window.clearTimeout(s.current)),[e,o]),n}function Dte({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:s,onClose:i,returnFocus:o}){const a=di(e),[c,u]=w.useState(!1),[f,h]=w.useState(!1),m=typeof(t==null?void 0:t.duration)=="number"?t==null?void 0:t.duration:200,y=Ite({opened:n,transitionDuration:m});return U_("keydown",v=>{var x;v.key==="Escape"&&s&&n&&((x=v.target)==null?void 0:x.getAttribute("data-mantine-stop-propagation"))!=="true"&&i()},{capture:!0}),f8({opened:n,shouldReturnFocus:r&&o}),{_id:a,titleMounted:c,bodyMounted:f,shouldLockScroll:y,setTitleMounted:u,setBodyMounted:h}}const N7=w.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:s,onExitTransitionEnd:i,onEnterTransitionEnd:o,trapFocus:a,closeOnEscape:c,returnFocus:u,closeOnClickOutside:f,withinPortal:h,portalProps:m,lockScroll:y,children:v,zIndex:x,shadow:E,padding:N,__vars:_,unstyled:C,removeScrollProps:j,...A},$)=>{const{_id:R,titleMounted:M,bodyMounted:D,shouldLockScroll:P,setTitleMounted:F,setBodyMounted:V}=Dte({id:r,transitionProps:s,opened:t,trapFocus:a,closeOnEscape:c,onClose:n,returnFocus:u}),{key:H,...I}=j||{};return p.jsx(cd,{...m,withinPortal:h,children:p.jsx(kte,{value:{opened:t,onClose:n,closeOnClickOutside:f,onExitTransitionEnd:i,onEnterTransitionEnd:o,transitionProps:{...s,keepMounted:e},getTitleId:()=>`${R}-title`,getBodyId:()=>`${R}-body`,titleMounted:M,bodyMounted:D,setTitleMounted:F,setBodyMounted:V,trapFocus:a,closeOnEscape:c,zIndex:x,unstyled:C},children:p.jsx(Bv,{enabled:P&&y,...I,children:p.jsx(ze,{ref:$,...A,__vars:{..._,"--mb-z-index":(x||Qi("modal")).toString(),"--mb-shadow":Sj(E),"--mb-padding":wj(N)},children:v})},H)})})});N7.displayName="@mantine/core/ModalBase";function Pte(){const e=qa();return w.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var yh={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};const _7=w.forwardRef(({className:e,...t},n)=>{const r=Pte(),s=qa();return p.jsx(ze,{ref:n,...t,id:r,className:hn({[yh.body]:!s.unstyled},e)})});_7.displayName="@mantine/core/ModalBaseBody";const C7=w.forwardRef(({className:e,onClick:t,...n},r)=>{const s=qa();return p.jsx(Qh,{ref:r,...n,onClick:i=>{s.onClose(),t==null||t(i)},className:hn({[yh.close]:!s.unstyled},e),unstyled:s.unstyled})});C7.displayName="@mantine/core/ModalBaseCloseButton";const O7=w.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:s,...i},o)=>{const a=qa();return p.jsx(Mc,{mounted:a.opened,transition:"pop",...a.transitionProps,onExited:()=>{var c,u,f;(c=a.onExitTransitionEnd)==null||c.call(a),(f=(u=a.transitionProps)==null?void 0:u.onExited)==null||f.call(u)},onEntered:()=>{var c,u,f;(c=a.onEnterTransitionEnd)==null||c.call(a),(f=(u=a.transitionProps)==null?void 0:u.onEntered)==null||f.call(u)},...e,children:c=>p.jsx("div",{...n,className:hn({[yh.inner]:!a.unstyled},n.className),children:p.jsx(Iw,{active:a.opened&&a.trapFocus,innerRef:o,children:p.jsx(Ij,{...i,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":a.bodyMounted?a.getBodyId():void 0,"aria-labelledby":a.titleMounted?a.getTitleId():void 0,style:[s,c],className:hn({[yh.content]:!a.unstyled},t),unstyled:a.unstyled,children:i.children})})})})});O7.displayName="@mantine/core/ModalBaseContent";const j7=w.forwardRef(({className:e,...t},n)=>{const r=qa();return p.jsx(ze,{component:"header",ref:n,className:hn({[yh.header]:!r.unstyled},e),...t})});j7.displayName="@mantine/core/ModalBaseHeader";const Lte={duration:200,timingFunction:"ease",transition:"fade"};function Fte(e){const t=qa();return{...Lte,...t.transitionProps,...e}}const A7=w.forwardRef(({onClick:e,transitionProps:t,style:n,visible:r,...s},i)=>{const o=qa(),a=Fte(t);return p.jsx(Mc,{mounted:r!==void 0?r:o.opened,...a,transition:"fade",children:c=>p.jsx(kw,{ref:i,fixed:!0,style:[n,c],zIndex:o.zIndex,unstyled:o.unstyled,onClick:u=>{e==null||e(u),o.closeOnClickOutside&&o.onClose()},...s})})});A7.displayName="@mantine/core/ModalBaseOverlay";function Bte(){const e=qa();return w.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const $7=w.forwardRef(({className:e,...t},n)=>{const r=Bte(),s=qa();return p.jsx(ze,{component:"h2",ref:n,className:hn({[yh.title]:!s.unstyled},e),...t,id:r})});$7.displayName="@mantine/core/ModalBaseTitle";function zte({children:e}){return p.jsx(p.Fragment,{children:e})}const[Vte,Ute]=ld({size:"sm"}),qte={},T7=qe((e,t)=>{const n=Pe("InputClearButton",qte,e),{size:r,variant:s,vars:i,classNames:o,styles:a,...c}=n,u=Ute(),{resolvedClassNames:f,resolvedStyles:h}=Yh({classNames:o,styles:a,props:n});return p.jsx(Qh,{variant:s||"transparent",ref:t,size:r||(u==null?void 0:u.size)||"sm",classNames:f,styles:h,__staticSelector:"InputClearButton",...c})});T7.displayName="@mantine/core/InputClearButton";const[Hte,Zh]=ld({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var hi={wrapper:"m_6c018570",input:"m_8fb7ebe7",section:"m_82577fc2",placeholder:"m_88bacfd0",root:"m_46b77525",label:"m_8fdc1311",required:"m_78a94662",error:"m_8f816625",description:"m_fe47ce59"};const UM={},Wte=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Br(t)} - ${_e(2)})`}}),Dw=qe((e,t)=>{const n=Pe("InputDescription",UM,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,size:u,__staticSelector:f,__inheritStyles:h=!0,variant:m,...y}=Pe("InputDescription",UM,n),v=Zh(),x=bt({name:["InputWrapper",f],props:n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,rootSelector:"description",vars:c,varsResolver:Wte}),E=h&&(v==null?void 0:v.getStyles)||x;return p.jsx(ze,{component:"p",ref:t,variant:m,size:u,...E("description",v!=null&&v.getStyles?{className:s,style:i}:void 0),...y})});Dw.classes=hi;Dw.displayName="@mantine/core/InputDescription";const Gte={},Yte=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Br(t)} - ${_e(2)})`}}),Pw=qe((e,t)=>{const n=Pe("InputError",Gte,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,size:u,__staticSelector:f,__inheritStyles:h=!0,variant:m,...y}=n,v=bt({name:["InputWrapper",f],props:n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,rootSelector:"error",vars:c,varsResolver:Yte}),x=Zh(),E=h&&(x==null?void 0:x.getStyles)||v;return p.jsx(ze,{component:"p",ref:t,variant:m,size:u,...E("error",x!=null&&x.getStyles?{className:s,style:i}:void 0),...y})});Pw.classes=hi;Pw.displayName="@mantine/core/InputError";const qM={labelElement:"label"},Jte=(e,{size:t})=>({label:{"--input-label-size":Br(t),"--input-asterisk-color":void 0}}),Lw=qe((e,t)=>{const n=Pe("InputLabel",qM,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,labelElement:u,size:f,required:h,htmlFor:m,onMouseDown:y,children:v,__staticSelector:x,variant:E,mod:N,..._}=Pe("InputLabel",qM,n),C=bt({name:["InputWrapper",x],props:n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,rootSelector:"label",vars:c,varsResolver:Jte}),j=Zh(),A=(j==null?void 0:j.getStyles)||C;return p.jsxs(ze,{...A("label",j!=null&&j.getStyles?{className:s,style:i}:void 0),component:u,variant:E,size:f,ref:t,htmlFor:u==="label"?m:void 0,mod:[{required:h},N],onMouseDown:$=>{y==null||y($),!$.defaultPrevented&&$.detail>1&&$.preventDefault()},..._,children:[v,h&&p.jsx("span",{...A("required"),"aria-hidden":!0,children:" *"})]})});Lw.classes=hi;Lw.displayName="@mantine/core/InputLabel";const HM={},Qj=qe((e,t)=>{const n=Pe("InputPlaceholder",HM,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,__staticSelector:u,variant:f,error:h,mod:m,...y}=Pe("InputPlaceholder",HM,n),v=bt({name:["InputPlaceholder",u],props:n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,rootSelector:"placeholder"});return p.jsx(ze,{...v("placeholder"),mod:[{error:!!h},m],component:"span",variant:f,ref:t,...y})});Qj.classes=hi;Qj.displayName="@mantine/core/InputPlaceholder";function Xte(e,{hasDescription:t,hasError:n}){const r=e.findIndex(c=>c==="input"),s=e.slice(0,r),i=e.slice(r+1),o=t&&s.includes("description")||n&&s.includes("error");return{offsetBottom:t&&i.includes("description")||n&&i.includes("error"),offsetTop:o}}const Kte={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},Qte=(e,{size:t})=>({label:{"--input-label-size":Br(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Br(t)} - ${_e(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Br(t)} - ${_e(2)})`}}),Zj=qe((e,t)=>{const n=Pe("InputWrapper",Kte,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,size:u,variant:f,__staticSelector:h,inputContainer:m,inputWrapperOrder:y,label:v,error:x,description:E,labelProps:N,descriptionProps:_,errorProps:C,labelElement:j,children:A,withAsterisk:$,id:R,required:M,__stylesApiProps:D,mod:P,...F}=n,V=bt({name:["InputWrapper",h],props:D||n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:Qte}),H={size:u,variant:f,__staticSelector:h},I=di(R),B=typeof $=="boolean"?$:M,T=(C==null?void 0:C.id)||`${I}-error`,L=(_==null?void 0:_.id)||`${I}-description`,z=I,q=!!x&&typeof x!="boolean",k=!!E,W=`${q?T:""} ${k?L:""}`,X=W.trim().length>0?W.trim():void 0,ne=(N==null?void 0:N.id)||`${I}-label`,re=v&&p.jsx(Lw,{labelElement:j,id:ne,htmlFor:z,required:B,...H,...N,children:v},"label"),se=k&&p.jsx(Dw,{..._,...H,size:(_==null?void 0:_.size)||H.size,id:(_==null?void 0:_.id)||L,children:E},"description"),fe=p.jsx(w.Fragment,{children:m(A)},"input"),he=q&&w.createElement(Pw,{...C,...H,size:(C==null?void 0:C.size)||H.size,key:"error",id:(C==null?void 0:C.id)||T},x),ue=y.map(ve=>{switch(ve){case"label":return re;case"input":return fe;case"description":return se;case"error":return he;default:return null}});return p.jsx(Hte,{value:{getStyles:V,describedBy:X,inputId:z,labelId:ne,...Xte(y,{hasDescription:k,hasError:q})},children:p.jsx(ze,{ref:t,variant:f,size:u,mod:[{error:!!x},P],...V("root"),...F,children:ue})})});Zj.classes=hi;Zj.displayName="@mantine/core/InputWrapper";const Zte={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},ene=(e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":Mt(t.size,"input-height"),"--input-fz":Br(t.size),"--input-radius":t.radius===void 0?void 0:Hn(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?_e(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?_e(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?Mt(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),kt=Tc((e,t)=>{const n=Pe("Input",Zte,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,required:c,__staticSelector:u,__stylesApiProps:f,size:h,wrapperProps:m,error:y,disabled:v,leftSection:x,leftSectionProps:E,leftSectionWidth:N,rightSection:_,rightSectionProps:C,rightSectionWidth:j,rightSectionPointerEvents:A,leftSectionPointerEvents:$,variant:R,vars:M,pointer:D,multiline:P,radius:F,id:V,withAria:H,withErrorStyles:I,mod:B,inputSize:T,__clearSection:L,__clearable:z,__defaultRightSection:q,...k}=n,{styleProps:W,rest:X}=Jh(k),ne=Zh(),re={offsetBottom:ne==null?void 0:ne.offsetBottom,offsetTop:ne==null?void 0:ne.offsetTop},se=bt({name:["Input",u],props:f||n,classes:hi,className:s,style:i,classNames:r,styles:o,unstyled:a,stylesCtx:re,rootSelector:"wrapper",vars:M,varsResolver:ene}),fe=H?{required:c,disabled:v,"aria-invalid":!!y,"aria-describedby":ne==null?void 0:ne.describedBy,id:(ne==null?void 0:ne.inputId)||V}:{},he=_||z&&L||q;return p.jsx(Vte,{value:{size:h||"sm"},children:p.jsxs(ze,{...se("wrapper"),...W,...m,mod:[{error:!!y&&I,pointer:D,disabled:v,multiline:P,"data-with-right-section":!!he,"data-with-left-section":!!x},B],variant:R,size:h,children:[x&&p.jsx("div",{...E,"data-position":"left",...se("section",{className:E==null?void 0:E.className,style:E==null?void 0:E.style}),children:x}),p.jsx(ze,{component:"input",...X,...fe,ref:t,required:c,mod:{disabled:v,error:!!y&&I},variant:R,__size:T,...se("input")}),he&&p.jsx("div",{...C,"data-position":"right",...se("section",{className:C==null?void 0:C.className,style:C==null?void 0:C.style}),children:he})]})})});kt.classes=hi;kt.Wrapper=Zj;kt.Label=Lw;kt.Error=Pw;kt.Description=Dw;kt.Placeholder=Qj;kt.ClearButton=T7;kt.displayName="@mantine/core/Input";function tne(e,t,n){const r=Pe(e,t,n),{label:s,description:i,error:o,required:a,classNames:c,styles:u,className:f,unstyled:h,__staticSelector:m,__stylesApiProps:y,errorProps:v,labelProps:x,descriptionProps:E,wrapperProps:N,id:_,size:C,style:j,inputContainer:A,inputWrapperOrder:$,withAsterisk:R,variant:M,vars:D,mod:P,...F}=r,{styleProps:V,rest:H}=Jh(F),I={label:s,description:i,error:o,required:a,classNames:c,className:f,__staticSelector:m,__stylesApiProps:y||r,errorProps:v,labelProps:x,descriptionProps:E,unstyled:h,styles:u,size:C,style:j,inputContainer:A,inputWrapperOrder:$,withAsterisk:R,variant:M,id:_,mod:P,...N};return{...H,classNames:c,styles:u,unstyled:h,wrapperProps:{...I,...V},inputProps:{required:a,classNames:c,styles:u,unstyled:h,size:C,__staticSelector:m,__stylesApiProps:y||r,error:o,variant:M,id:_}}}const nne={__staticSelector:"InputBase",withAria:!0},pi=Tc((e,t)=>{const{inputProps:n,wrapperProps:r,...s}=tne("InputBase",nne,e);return p.jsx(kt.Wrapper,{...r,children:p.jsx(kt,{...n,...s,ref:t})})});pi.classes={...kt.classes,...kt.Wrapper.classes};pi.displayName="@mantine/core/InputBase";function rne(e,t){if(!t||!e)return!1;let n=t.parentNode;for(;n!=null;){if(n===e)return!0;n=n.parentNode}return!1}function sne({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const s=w.useRef(-1),[i,o]=w.useState(!1),[a,c]=w.useState(typeof r=="boolean"?r:!1),u=()=>{if(!e||!t||!n.current)return;const y=e.getBoundingClientRect(),v=t.getBoundingClientRect(),x=window.getComputedStyle(e),E=window.getComputedStyle(t),N=ac(x.borderTopWidth)+ac(E.borderTopWidth),_=ac(x.borderLeftWidth)+ac(E.borderLeftWidth),C={top:y.top-v.top-N,left:y.left-v.left-_,width:y.width,height:y.height};n.current.style.transform=`translateY(${C.top}px) translateX(${C.left}px)`,n.current.style.width=`${C.width}px`,n.current.style.height=`${C.height}px`},f=()=>{window.clearTimeout(s.current),n.current&&(n.current.style.transitionDuration="0ms"),u(),s.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},h=w.useRef(null),m=w.useRef(null);return w.useEffect(()=>{if(u(),e)return h.current=new ResizeObserver(f),h.current.observe(e),t&&(m.current=new ResizeObserver(f),m.current.observe(t)),()=>{var y,v;(y=h.current)==null||y.disconnect(),(v=m.current)==null||v.disconnect()}},[t,e]),w.useEffect(()=>{if(t){const y=v=>{rne(v.target,t)&&(f(),c(!1))};return t.addEventListener("transitionend",y),()=>{t.removeEventListener("transitionend",y)}}},[t]),dQ(()=>{b8()!=="test"&&o(!0)},20,{autoInvoke:!0}),pQ(y=>{y.forEach(v=>{v.type==="attributes"&&v.attributeName==="dir"&&f()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:i,hidden:a}}var R7={root:"m_96b553a6"};const ine={},one=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),eA=qe((e,t)=>{const n=Pe("FloatingIndicator",ine,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,target:u,parent:f,transitionDuration:h,mod:m,displayAfterTransitionEnd:y,...v}=n,x=bt({name:"FloatingIndicator",classes:R7,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:one}),E=w.useRef(null),{initialized:N,hidden:_}=sne({target:u,parent:f,ref:E,displayAfterTransitionEnd:y}),C=_n(t,E);return!u||!f?null:p.jsx(ze,{ref:C,mod:[{initialized:N,hidden:_},m],...x("root"),...v})});eA.displayName="@mantine/core/FloatingIndicator";eA.classes=R7;function M7(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>M7(t))}:e}function k7(e){return e?e.map(t=>M7(t)):[]}function tA(e){return e.reduce((t,n)=>"group"in n?{...t,...tA(n.items)}:(t[n.value]=n,t),{})}var is={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const ane={error:null},lne=(e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":Mt(t,"combobox-chevron-size"),"--combobox-chevron-color":n?wr(n,e):void 0}}),nA=qe((e,t)=>{const n=Pe("ComboboxChevron",ane,e),{size:r,error:s,style:i,className:o,classNames:a,styles:c,unstyled:u,vars:f,mod:h,...m}=n,y=bt({name:"ComboboxChevron",classes:is,props:n,style:i,className:o,classNames:a,styles:c,unstyled:u,vars:f,varsResolver:lne,rootSelector:"chevron"});return p.jsx(ze,{component:"svg",...m,...y("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:s},h],ref:t,children:p.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});nA.classes=is;nA.displayName="@mantine/core/ComboboxChevron";const[cne,mi]=Ua("Combobox component was not found in tree"),I7=w.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...s},i)=>p.jsx(kt.ClearButton,{ref:i,tabIndex:-1,"aria-hidden":!0,...s,onMouseDown:o=>{o.preventDefault(),t==null||t(o)},onClick:o=>{r(),n==null||n(o)}}));I7.displayName="@mantine/core/ComboboxClearButton";const une={},rA=qe((e,t)=>{const{classNames:n,styles:r,className:s,style:i,hidden:o,...a}=Pe("ComboboxDropdown",une,e),c=mi();return p.jsx(ns.Dropdown,{...a,ref:t,role:"presentation","data-hidden":o||void 0,...c.getStyles("dropdown",{className:s,style:i,classNames:n,styles:r})})});rA.classes=is;rA.displayName="@mantine/core/ComboboxDropdown";const dne={refProp:"ref"},D7=qe((e,t)=>{const{children:n,refProp:r}=Pe("ComboboxDropdownTarget",dne,e);if(mi(),!jc(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return p.jsx(ns.Target,{ref:t,refProp:r,children:n})});D7.displayName="@mantine/core/ComboboxDropdownTarget";const fne={},sA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,...a}=Pe("ComboboxEmpty",fne,e),c=mi();return p.jsx(ze,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:s}),...a})});sA.classes=is;sA.displayName="@mantine/core/ComboboxEmpty";function iA({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:s,autoComplete:i}){const o=mi(),[a,c]=w.useState(null),u=h=>{if(e==null||e(h),!o.readOnly&&t){if(h.nativeEvent.isComposing)return;if(h.nativeEvent.code==="ArrowDown"&&(h.preventDefault(),o.store.dropdownOpened?c(o.store.selectNextOption()):(o.store.openDropdown("keyboard"),c(o.store.selectActiveOption()),o.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),h.nativeEvent.code==="ArrowUp"&&(h.preventDefault(),o.store.dropdownOpened?c(o.store.selectPreviousOption()):(o.store.openDropdown("keyboard"),c(o.store.selectActiveOption()),o.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),h.nativeEvent.code==="Enter"||h.nativeEvent.code==="NumpadEnter"){if(h.nativeEvent.keyCode===229)return;const m=o.store.getSelectedOptionIndex();o.store.dropdownOpened&&m!==-1?(h.preventDefault(),o.store.clickSelectedOption()):s==="button"&&(h.preventDefault(),o.store.openDropdown("keyboard"))}h.key==="Escape"&&o.store.closeDropdown("keyboard"),h.nativeEvent.code==="Space"&&s==="button"&&(h.preventDefault(),o.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r&&!!(o.store.listId&&o.store.dropdownOpened)||void 0,"aria-controls":o.store.dropdownOpened?o.store.listId:void 0,"aria-activedescendant":o.store.dropdownOpened&&a||void 0,autoComplete:i,"data-expanded":o.store.dropdownOpened||void 0,"data-mantine-stop-propagation":o.store.dropdownOpened||void 0}:{},onKeyDown:u}}const hne={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},P7=qe((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:s,withAriaAttributes:i,withExpandedAttribute:o,targetType:a,autoComplete:c,...u}=Pe("ComboboxEventsTarget",hne,e);if(!jc(n))throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const f=mi(),h=iA({targetType:a,withAriaAttributes:i,withKeyboardNavigation:s,withExpandedAttribute:o,onKeyDown:n.props.onKeyDown,autoComplete:c});return w.cloneElement(n,{...h,...u,[r]:_n(t,f.store.targetRef,Cw(n))})});P7.displayName="@mantine/core/ComboboxEventsTarget";const pne={},oA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,...a}=Pe("ComboboxFooter",pne,e),c=mi();return p.jsx(ze,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:s,styles:i}),...a,onMouseDown:u=>{u.preventDefault()}})});oA.classes=is;oA.displayName="@mantine/core/ComboboxFooter";const mne={},aA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,children:a,label:c,...u}=Pe("ComboboxGroup",mne,e),f=mi();return p.jsxs(ze,{ref:t,...f.getStyles("group",{className:r,classNames:n,style:s,styles:i}),...u,children:[c&&p.jsx("div",{...f.getStyles("groupLabel",{classNames:n,styles:i}),children:c}),a]})});aA.classes=is;aA.displayName="@mantine/core/ComboboxGroup";const gne={},lA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,...a}=Pe("ComboboxHeader",gne,e),c=mi();return p.jsx(ze,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:s,styles:i}),...a,onMouseDown:u=>{u.preventDefault()}})});lA.classes=is;lA.displayName="@mantine/core/ComboboxHeader";function L7({value:e,valuesDivider:t=",",...n}){return p.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}L7.displayName="@mantine/core/ComboboxHiddenInput";const yne={},cA=qe((e,t)=>{const n=Pe("ComboboxOption",yne,e),{classNames:r,className:s,style:i,styles:o,vars:a,onClick:c,id:u,active:f,onMouseDown:h,onMouseOver:m,disabled:y,selected:v,mod:x,...E}=n,N=mi(),_=w.useId(),C=u||_;return p.jsx(ze,{...N.getStyles("option",{className:s,classNames:r,styles:o,style:i}),...E,ref:t,id:C,mod:["combobox-option",{"combobox-active":f,"combobox-disabled":y,"combobox-selected":v},x],role:"option",onClick:j=>{var A;y?j.preventDefault():((A=N.onOptionSubmit)==null||A.call(N,n.value,n),c==null||c(j))},onMouseDown:j=>{j.preventDefault(),h==null||h(j)},onMouseOver:j=>{N.resetSelectionOnOptionHover&&N.store.resetSelectedOption(),m==null||m(j)}})});cA.classes=is;cA.displayName="@mantine/core/ComboboxOption";const bne={},uA=qe((e,t)=>{const n=Pe("ComboboxOptions",bne,e),{classNames:r,className:s,style:i,styles:o,id:a,onMouseDown:c,labelledBy:u,...f}=n,h=mi(),m=di(a);return w.useEffect(()=>{h.store.setListId(m)},[m]),p.jsx(ze,{ref:t,...h.getStyles("options",{className:s,style:i,classNames:r,styles:o}),...f,id:m,role:"listbox","aria-labelledby":u,onMouseDown:y=>{y.preventDefault(),c==null||c(y)}})});uA.classes=is;uA.displayName="@mantine/core/ComboboxOptions";const vne={withAriaAttributes:!0,withKeyboardNavigation:!0},dA=qe((e,t)=>{const n=Pe("ComboboxSearch",vne,e),{classNames:r,styles:s,unstyled:i,vars:o,withAriaAttributes:a,onKeyDown:c,withKeyboardNavigation:u,size:f,...h}=n,m=mi(),y=m.getStyles("search"),v=iA({targetType:"input",withAriaAttributes:a,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c,autoComplete:"off"});return p.jsx(kt,{ref:_n(t,m.store.searchRef),classNames:[{input:y.className},r],styles:[{input:y.style},s],size:f||m.size,...v,...h,__staticSelector:"Combobox"})});dA.classes=is;dA.displayName="@mantine/core/ComboboxSearch";const xne={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},F7=qe((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:s,withAriaAttributes:i,withExpandedAttribute:o,targetType:a,autoComplete:c,...u}=Pe("ComboboxTarget",xne,e);if(!jc(n))throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const f=mi(),h=iA({targetType:a,withAriaAttributes:i,withKeyboardNavigation:s,withExpandedAttribute:o,onKeyDown:n.props.onKeyDown,autoComplete:c}),m=w.cloneElement(n,{...h,...u});return p.jsx(ns.Target,{ref:_n(t,f.store.targetRef),children:m})});F7.displayName="@mantine/core/ComboboxTarget";function wne(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function Sne(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function Ene(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function fA({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:s,loop:i=!0,scrollBehavior:o="instant"}={}){const[a,c]=ss({value:t,defaultValue:e,finalValue:!1,onChange:n}),u=w.useRef(null),f=w.useRef(-1),h=w.useRef(null),m=w.useRef(null),y=w.useRef(-1),v=w.useRef(-1),x=w.useRef(-1),E=w.useCallback((T="unknown")=>{a||(c(!0),s==null||s(T))},[c,s,a]),N=w.useCallback((T="unknown")=>{a&&(c(!1),r==null||r(T))},[c,r,a]),_=w.useCallback((T="unknown")=>{a?N(T):E(T)},[N,E,a]),C=w.useCallback(()=>{const T=document.querySelector(`#${u.current} [data-combobox-selected]`);T==null||T.removeAttribute("data-combobox-selected"),T==null||T.removeAttribute("aria-selected")},[]),j=w.useCallback(T=>{const L=document.getElementById(u.current),z=L==null?void 0:L.querySelectorAll("[data-combobox-option]");if(!z)return null;const q=T>=z.length?0:T<0?z.length-1:T;return f.current=q,z!=null&&z[q]&&!z[q].hasAttribute("data-combobox-disabled")?(C(),z[q].setAttribute("data-combobox-selected","true"),z[q].setAttribute("aria-selected","true"),z[q].scrollIntoView({block:"nearest",behavior:o}),z[q].id):null},[o,C]),A=w.useCallback(()=>{const T=document.querySelector(`#${u.current} [data-combobox-active]`);if(T){const L=document.querySelectorAll(`#${u.current} [data-combobox-option]`),z=Array.from(L).findIndex(q=>q===T);return j(z)}return j(0)},[j]),$=w.useCallback(()=>j(Sne(f.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[j,i]),R=w.useCallback(()=>j(wne(f.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[j,i]),M=w.useCallback(()=>j(Ene(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[j]),D=w.useCallback((T="selected",L)=>{x.current=window.setTimeout(()=>{var k;const z=document.querySelectorAll(`#${u.current} [data-combobox-option]`),q=Array.from(z).findIndex(W=>W.hasAttribute(`data-combobox-${T}`));f.current=q,L!=null&&L.scrollIntoView&&((k=z[q])==null||k.scrollIntoView({block:"nearest",behavior:o}))},0)},[]),P=w.useCallback(()=>{f.current=-1,C()},[C]),F=w.useCallback(()=>{const T=document.querySelectorAll(`#${u.current} [data-combobox-option]`),L=T==null?void 0:T[f.current];L==null||L.click()},[]),V=w.useCallback(T=>{u.current=T},[]),H=w.useCallback(()=>{y.current=window.setTimeout(()=>h.current.focus(),0)},[]),I=w.useCallback(()=>{v.current=window.setTimeout(()=>m.current.focus(),0)},[]),B=w.useCallback(()=>f.current,[]);return w.useEffect(()=>()=>{window.clearTimeout(y.current),window.clearTimeout(v.current),window.clearTimeout(x.current)},[]),{dropdownOpened:a,openDropdown:E,closeDropdown:N,toggleDropdown:_,selectedOptionIndex:f.current,getSelectedOptionIndex:B,selectOption:j,selectFirstOption:M,selectActiveOption:A,selectNextOption:$,selectPreviousOption:R,resetSelectedOption:P,updateSelectedOptionIndex:D,listId:u.current,setListId:V,clickSelectedOption:F,searchRef:h,focusSearchInput:H,targetRef:m,focusTarget:I}}const Nne={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},_ne=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Br(t),"--combobox-option-padding":Mt(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:_e(n),"--combobox-option-fz":Br(t),"--combobox-option-padding":Mt(t,"combobox-option-padding")}});function jt(e){const t=Pe("Combobox",Nne,e),{classNames:n,styles:r,unstyled:s,children:i,store:o,vars:a,onOptionSubmit:c,onClose:u,size:f,dropdownPadding:h,resetSelectionOnOptionHover:m,__staticSelector:y,readOnly:v,...x}=t,E=fA(),N=o||E,_=bt({name:y||"Combobox",classes:is,props:t,classNames:n,styles:r,unstyled:s,vars:a,varsResolver:_ne}),C=()=>{u==null||u(),N.closeDropdown()};return p.jsx(cne,{value:{getStyles:_,store:N,onOptionSubmit:c,size:f,resetSelectionOnOptionHover:m,readOnly:v},children:p.jsx(ns,{opened:N.dropdownOpened,...x,onChange:j=>!j&&C(),withRoles:!1,unstyled:s,children:i})})}const Cne=e=>e;jt.extend=Cne;jt.classes=is;jt.displayName="@mantine/core/Combobox";jt.Target=F7;jt.Dropdown=rA;jt.Options=uA;jt.Option=cA;jt.Search=dA;jt.Empty=sA;jt.Chevron=nA;jt.Footer=oA;jt.Header=lA;jt.EventsTarget=P7;jt.DropdownTarget=D7;jt.Group=aA;jt.ClearButton=I7;jt.HiddenInput=L7;var B7={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const One=B7,hA=w.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:s,unstyled:i,children:o,label:a,description:c,id:u,disabled:f,error:h,size:m,labelPosition:y="left",bodyElement:v="div",labelElement:x="label",variant:E,style:N,vars:_,mod:C,...j},A)=>{const $=bt({name:e,props:t,className:n,style:N,classes:B7,classNames:r,styles:s,unstyled:i});return p.jsx(ze,{...$("root"),ref:A,__vars:{"--label-fz":Br(m),"--label-lh":Mt(m,"label-lh")},mod:[{"label-position":y},C],variant:E,size:m,...j,children:p.jsxs(ze,{component:v,htmlFor:v==="label"?u:void 0,...$("body"),children:[o,p.jsxs("div",{...$("labelWrapper"),"data-disabled":f||void 0,children:[a&&p.jsx(ze,{component:x,htmlFor:x==="label"?u:void 0,...$("label"),"data-disabled":f||void 0,children:a}),c&&p.jsx(kt.Description,{size:m,__inheritStyles:!1,...$("description"),children:c}),h&&typeof h!="boolean"&&p.jsx(kt.Error,{size:m,__inheritStyles:!1,...$("error"),children:h})]})]})})});hA.displayName="@mantine/core/InlineInput";function z7({children:e,role:t}){const n=Zh();return n?p.jsx("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):p.jsx(p.Fragment,{children:e})}function jne({size:e,style:t,...n}){const r=e!==void 0?{width:_e(e),height:_e(e),...t}:t;return p.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n,children:p.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function bh(e){return"group"in e}function V7({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),s=[];for(let i=0;i<e.length;i+=1){const o=e[i];if(s.length===n)return s;bh(o)&&s.push({group:o.group,items:V7({options:o.items,search:t,limit:n-s.length})}),bh(o)||o.label.toLowerCase().includes(r)&&s.push(o)}return s}function Ane(e){if(e.length===0)return!0;for(const t of e)if(!("group"in t)||t.items.length>0)return!1;return!0}function U7(e,t=new Set){if(Array.isArray(e))for(const n of e)if(bh(n))U7(n.items,t);else{if(typeof n.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof n.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof n.value}`);if(t.has(n.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function $ne(e,t){return Array.isArray(e)?e.includes(t):e===t}function q7({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:s,renderOption:i}){if(!bh(e)){const a=$ne(n,e.value),c=t&&a&&p.jsx(jne,{className:is.optionsDropdownCheckIcon}),u=p.jsxs(p.Fragment,{children:[r==="left"&&c,p.jsx("span",{children:e.label}),r==="right"&&c]});return p.jsx(jt.Option,{value:e.value,disabled:e.disabled,className:hn({[is.optionsDropdownOption]:!s}),"data-reverse":r==="right"||void 0,"data-checked":a||void 0,"aria-selected":a,active:a,children:typeof i=="function"?i({option:e,checked:a}):u})}const o=e.items.map(a=>p.jsx(q7,{data:a,value:n,unstyled:s,withCheckIcon:t,checkIconPosition:r,renderOption:i},a.value));return p.jsx(jt.Group,{label:e.group,children:o})}function H7({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:s,limit:i,maxDropdownHeight:o,withScrollArea:a=!0,filterOptions:c=!0,withCheckIcon:u=!1,value:f,checkIconPosition:h,nothingFoundMessage:m,unstyled:y,labelId:v,renderOption:x,scrollAreaProps:E,"aria-label":N}){U7(e);const C=typeof s=="string"?(r||V7)({options:e,search:c?s:"",limit:i??1/0}):e,j=Ane(C),A=C.map($=>p.jsx(q7,{data:$,withCheckIcon:u,value:f,checkIconPosition:h,unstyled:y,renderOption:x},bh($)?$.group:$.value));return p.jsx(jt.Dropdown,{hidden:t||n&&j,"data-composed":!0,children:p.jsxs(jt.Options,{labelledBy:v,"aria-label":N,children:[a?p.jsx(xy.Autosize,{mah:o??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...E,children:A}):A,j&&m&&p.jsx(jt.Empty,{children:m})]})})}var ep={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const WM={orientation:"horizontal"},Tne=(e,{borderWidth:t})=>({group:{"--button-border-width":_e(t)}}),pA=qe((e,t)=>{const n=Pe("ButtonGroup",WM,e),{className:r,style:s,classNames:i,styles:o,unstyled:a,orientation:c,vars:u,borderWidth:f,variant:h,mod:m,...y}=Pe("ButtonGroup",WM,e),v=bt({name:"ButtonGroup",props:n,classes:ep,className:r,style:s,classNames:i,styles:o,unstyled:a,vars:u,varsResolver:Tne,rootSelector:"group"});return p.jsx(ze,{...v("group"),ref:t,variant:h,mod:[{"data-orientation":c},m],role:"group",...y})});pA.classes=ep;pA.displayName="@mantine/core/ButtonGroup";const GM={},Rne=(e,{radius:t,color:n,gradient:r,variant:s,autoContrast:i,size:o})=>{const a=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:s||"filled",autoContrast:i});return{groupSection:{"--section-height":Mt(o,"section-height"),"--section-padding-x":Mt(o,"section-padding-x"),"--section-fz":o!=null&&o.includes("compact")?Br(o.replace("compact-","")):Br(o),"--section-radius":t===void 0?void 0:Hn(t),"--section-bg":n||s?a.background:void 0,"--section-color":a.color,"--section-bd":n||s?a.border:void 0}}},mA=qe((e,t)=>{const n=Pe("ButtonGroupSection",GM,e),{className:r,style:s,classNames:i,styles:o,unstyled:a,vars:c,variant:u,gradient:f,radius:h,autoContrast:m,...y}=Pe("ButtonGroupSection",GM,e),v=bt({name:"ButtonGroupSection",props:n,classes:ep,className:r,style:s,classNames:i,styles:o,unstyled:a,vars:c,varsResolver:Rne,rootSelector:"groupSection"});return p.jsx(ze,{...v("groupSection"),ref:t,variant:u,...y})});mA.classes=ep;mA.displayName="@mantine/core/ButtonGroupSection";const Mne={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${_e(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},kne={},Ine=(e,{radius:t,color:n,gradient:r,variant:s,size:i,justify:o,autoContrast:a})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:s||"filled",autoContrast:a});return{root:{"--button-justify":o,"--button-height":Mt(i,"button-height"),"--button-padding-x":Mt(i,"button-padding-x"),"--button-fz":i!=null&&i.includes("compact")?Br(i.replace("compact-","")):Br(i),"--button-radius":t===void 0?void 0:Hn(t),"--button-bg":n||s?c.background:void 0,"--button-hover":n||s?c.hover:void 0,"--button-color":c.color,"--button-bd":n||s?c.border:void 0,"--button-hover-color":n||s?c.hoverColor:void 0}}},Ku=Tc((e,t)=>{const n=Pe("Button",kne,e),{style:r,vars:s,className:i,color:o,disabled:a,children:c,leftSection:u,rightSection:f,fullWidth:h,variant:m,radius:y,loading:v,loaderProps:x,gradient:E,classNames:N,styles:_,unstyled:C,"data-disabled":j,autoContrast:A,mod:$,...R}=n,M=bt({name:"Button",props:n,classes:ep,className:i,style:r,classNames:N,styles:_,unstyled:C,vars:s,varsResolver:Ine}),D=!!u,P=!!f;return p.jsxs(Ma,{ref:t,...M("root",{active:!a&&!v&&!j}),unstyled:C,variant:m,disabled:a||v,mod:[{disabled:a||j,loading:v,block:h,"with-left-section":D,"with-right-section":P},$],...R,children:[p.jsx(Mc,{mounted:!!v,transition:Mne,duration:150,children:F=>p.jsx(ze,{component:"span",...M("loader",{style:F}),"aria-hidden":!0,children:p.jsx(Sy,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...x})})}),p.jsxs("span",{...M("inner"),children:[u&&p.jsx(ze,{component:"span",...M("section"),mod:{position:"left"},children:u}),p.jsx(ze,{component:"span",mod:{loading:v},...M("label"),children:c}),f&&p.jsx(ze,{component:"span",...M("section"),mod:{position:"right"},children:f})]})]})});Ku.classes=ep;Ku.displayName="@mantine/core/Button";Ku.Group=pA;Ku.GroupSection=mA;function Dne({open:e,close:t,openDelay:n,closeDelay:r}){const s=w.useRef(-1),i=w.useRef(-1),o=()=>{window.clearTimeout(s.current),window.clearTimeout(i.current)},a=()=>{o(),n===0||n===void 0?e():s.current=window.setTimeout(e,n)},c=()=>{o(),r===0||r===void 0?t():i.current=window.setTimeout(t,r)};return w.useEffect(()=>o,[]),{openDropdown:a,closeDropdown:c}}function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vh.apply(null,arguments)}function gA(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Pne=w.useLayoutEffect,Lne=function(t){var n=Re.useRef(t);return Pne(function(){n.current=t}),n},YM=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},Fne=function(t,n){var r=Re.useRef();return Re.useCallback(function(s){t.current=s,r.current&&YM(r.current,null),r.current=n,n&&YM(n,s)},[n])},JM={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},Bne=function(t){Object.keys(JM).forEach(function(n){t.style.setProperty(n,JM[n],"important")})},XM=Bne,Or=null,KM=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function zne(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Or||(Or=document.createElement("textarea"),Or.setAttribute("tabindex","-1"),Or.setAttribute("aria-hidden","true"),XM(Or)),Or.parentNode===null&&document.body.appendChild(Or);var s=e.paddingSize,i=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(m){var y=m;Or.style[y]=o[y]}),XM(Or),Or.value=t;var c=KM(Or,e);Or.value=t,c=KM(Or,e),Or.value="x";var u=Or.scrollHeight-s,f=u*n;a==="border-box"&&(f=f+s+i),c=Math.max(f,c);var h=u*r;return a==="border-box"&&(h=h+s+i),c=Math.min(h,c),[c,u]}var QM=function(){},Vne=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},Une=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],qne=!!document.documentElement.currentStyle,Hne=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=Vne(Une,n),s=r.boxSizing;if(s==="")return null;qne&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:o}},Wne=Hne;function W7(e,t,n){var r=Lne(n);w.useLayoutEffect(function(){var s=function(o){return r.current(o)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var Gne=function(t){W7(window,"resize",t)},Yne=function(t){W7(document.fonts,"loadingdone",t)},Jne=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Xne=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,i=t.minRows,o=t.onChange,a=o===void 0?QM:o,c=t.onHeightChange,u=c===void 0?QM:c,f=gA(t,Jne),h=f.value!==void 0,m=w.useRef(null),y=Fne(m,n),v=w.useRef(0),x=w.useRef(),E=function(){var C=m.current,j=r&&x.current?x.current:Wne(C);if(j){x.current=j;var A=zne(j,C.value||C.placeholder||"x",i,s),$=A[0],R=A[1];v.current!==$&&(v.current=$,C.style.setProperty("height",$+"px","important"),u($,{rowHeight:R}))}},N=function(C){h||E(),a(C)};return w.useLayoutEffect(E),Gne(E),Yne(E),w.createElement("textarea",vh({},f,{onChange:N,ref:y}))},Kne=w.forwardRef(Xne);const Qne={},Ey=qe((e,t)=>{const{autosize:n,maxRows:r,minRows:s,__staticSelector:i,resize:o,...a}=Pe("Textarea",Qne,e),c=n&&b8()!=="test",u=c?{maxRows:r,minRows:s}:{};return p.jsx(pi,{component:c?Kne:"textarea",ref:t,...a,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":o},...u})});Ey.classes=pi.classes;Ey.displayName="@mantine/core/Textarea";const[Zne,Ny]=Ua("Menu component was not found in the tree");var tp={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504"};const ere={},yA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,...a}=Pe("MenuDivider",ere,e),c=Ny();return p.jsx(ze,{ref:t,...c.getStyles("divider",{className:r,style:s,styles:i,classNames:n}),...a})});yA.classes=tp;yA.displayName="@mantine/core/MenuDivider";const tre={},bA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,onMouseEnter:a,onMouseLeave:c,onKeyDown:u,children:f,...h}=Pe("MenuDropdown",tre,e),m=w.useRef(null),y=Ny(),v=vo(u,N=>{var _,C;(N.key==="ArrowUp"||N.key==="ArrowDown")&&(N.preventDefault(),(C=(_=m.current)==null?void 0:_.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||C.focus())}),x=vo(a,()=>(y.trigger==="hover"||y.trigger==="click-hover")&&y.openDropdown()),E=vo(c,()=>(y.trigger==="hover"||y.trigger==="click-hover")&&y.closeDropdown());return p.jsxs(ns.Dropdown,{...h,onMouseEnter:x,onMouseLeave:E,role:"menu","aria-orientation":"vertical",ref:_n(t,m),...y.getStyles("dropdown",{className:r,style:s,styles:i,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:v,children:[y.withInitialFocusPlaceholder&&p.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),f]})});bA.classes=tp;bA.displayName="@mantine/core/MenuDropdown";const nre={},vA=Tc((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,color:a,closeMenuOnClick:c,leftSection:u,rightSection:f,children:h,disabled:m,"data-disabled":y,...v}=Pe("MenuItem",nre,e),x=Ny(),E=As(),{dir:N}=Rc(),_=w.useRef(null),C=x.getItemIndex(_.current),j=v,A=vo(j.onMouseLeave,()=>x.setHovered(-1)),$=vo(j.onMouseEnter,()=>x.setHovered(x.getItemIndex(_.current))),R=vo(j.onClick,()=>{y||(typeof c=="boolean"?c&&x.closeDropdownImmediately():x.closeOnItemClick&&x.closeDropdownImmediately())}),M=vo(j.onFocus,()=>x.setHovered(x.getItemIndex(_.current))),D=a?E.variantColorResolver({color:a,theme:E,variant:"light"}):void 0,P=a?$c({color:a,theme:E}):null;return p.jsxs(Ma,{...v,unstyled:x.unstyled,tabIndex:x.menuItemTabIndex,onFocus:M,...x.getStyles("item",{className:r,style:s,styles:i,classNames:n}),ref:_n(_,t),role:"menuitem",disabled:m,"data-menu-item":!0,"data-disabled":m||y||void 0,"data-hovered":x.hovered===C?!0:void 0,"data-mantine-stop-propagation":!0,onMouseEnter:$,onMouseLeave:A,onClick:R,onKeyDown:d8({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:x.loop,dir:N,orientation:"vertical",onKeyDown:j.onKeyDown}),__vars:{"--menu-item-color":P!=null&&P.isThemeColor&&(P==null?void 0:P.shade)===void 0?`var(--mantine-color-${P.color}-6)`:D==null?void 0:D.color,"--menu-item-hover":D==null?void 0:D.hover},children:[u&&p.jsx("div",{...x.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left",children:u}),h&&p.jsx("div",{...x.getStyles("itemLabel",{styles:i,classNames:n}),children:h}),f&&p.jsx("div",{...x.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right",children:f})]})});vA.classes=tp;vA.displayName="@mantine/core/MenuItem";const rre={},xA=qe((e,t)=>{const{classNames:n,className:r,style:s,styles:i,vars:o,...a}=Pe("MenuLabel",rre,e),c=Ny();return p.jsx(ze,{ref:t,...c.getStyles("label",{className:r,style:s,styles:i,classNames:n}),...a})});xA.classes=tp;xA.displayName="@mantine/core/MenuLabel";const sre={refProp:"ref"},G7=w.forwardRef((e,t)=>{const{children:n,refProp:r,...s}=Pe("MenuTarget",sre,e);if(!jc(n))throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const i=Ny(),o=n.props,a=vo(o.onClick,()=>{i.trigger==="click"?i.toggleDropdown():i.trigger==="click-hover"&&(i.setOpenedViaClick(!0),i.opened||i.openDropdown())}),c=vo(o.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),u=vo(o.onMouseLeave,()=>{(i.trigger==="hover"||i.trigger==="click-hover"&&!i.openedViaClick)&&i.closeDropdown()});return p.jsx(ns.Target,{refProp:r,popupType:"menu",ref:t,...s,children:w.cloneElement(n,{onClick:a,onMouseEnter:c,onMouseLeave:u,"data-expanded":i.opened?!0:void 0})})});G7.displayName="@mantine/core/MenuTarget";const ire={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function xs(e){const t=Pe("Menu",ire,e),{children:n,onOpen:r,onClose:s,opened:i,defaultOpened:o,trapFocus:a,onChange:c,closeOnItemClick:u,loop:f,closeOnEscape:h,trigger:m,openDelay:y,closeDelay:v,classNames:x,styles:E,unstyled:N,variant:_,vars:C,menuItemTabIndex:j,keepMounted:A,withInitialFocusPlaceholder:$,...R}=t,M=bt({name:"Menu",classes:tp,props:t,classNames:x,styles:E,unstyled:N}),[D,{setHovered:P,resetHovered:F}]=UK(),[V,H]=ss({value:i,defaultValue:o,finalValue:!1,onChange:c}),[I,B]=w.useState(!1),T=()=>{H(!1),B(!1),V&&(s==null||s())},L=()=>{H(!0),!V&&(r==null||r())},z=()=>{V?T():L()},{openDropdown:q,closeDropdown:k}=Dne({open:L,close:T,closeDelay:v,openDelay:y}),W=re=>VK("[data-menu-item]","[data-menu-dropdown]",re),{resolvedClassNames:X,resolvedStyles:ne}=Yh({classNames:x,styles:E,props:t});return Ra(()=>{F()},[V]),p.jsx(Zne,{value:{getStyles:M,opened:V,toggleDropdown:z,getItemIndex:W,hovered:D,setHovered:P,openedViaClick:I,setOpenedViaClick:B,closeOnItemClick:u,closeDropdown:m==="click"?T:k,openDropdown:m==="click"?L:q,closeDropdownImmediately:T,loop:f,trigger:m,unstyled:N,menuItemTabIndex:j,withInitialFocusPlaceholder:$},children:p.jsx(ns,{...R,opened:V,onChange:z,defaultOpened:o,trapFocus:A?!1:a,closeOnEscape:h,__staticSelector:"Menu",classNames:X,styles:ne,unstyled:N,variant:_,keepMounted:A,children:n})})}xs.extend=e=>e;xs.classes=tp;xs.displayName="@mantine/core/Menu";xs.Item=vA;xs.Label=xA;xs.Dropdown=bA;xs.Target=G7;xs.Divider=yA;const[ore,np]=Ua("Modal component was not found in tree");var Ha={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const are={},Fw=qe((e,t)=>{const n=Pe("ModalBody",are,e),{classNames:r,className:s,style:i,styles:o,vars:a,...c}=n,u=np();return p.jsx(_7,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:o,className:s}),...c})});Fw.classes=Ha;Fw.displayName="@mantine/core/ModalBody";const lre={},Bw=qe((e,t)=>{const n=Pe("ModalCloseButton",lre,e),{classNames:r,className:s,style:i,styles:o,vars:a,...c}=n,u=np();return p.jsx(C7,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:o,className:s}),...c})});Bw.classes=Ha;Bw.displayName="@mantine/core/ModalCloseButton";const cre={},zw=qe((e,t)=>{const n=Pe("ModalContent",cre,e),{classNames:r,className:s,style:i,styles:o,vars:a,children:c,__hidden:u,...f}=n,h=np(),m=h.scrollAreaComponent||zte;return p.jsx(O7,{...h.getStyles("content",{className:s,style:i,styles:o,classNames:r}),innerProps:h.getStyles("inner",{className:s,style:i,styles:o,classNames:r}),"data-full-screen":h.fullScreen||void 0,"data-modal-content":!0,"data-hidden":u||void 0,ref:t,...f,children:p.jsx(m,{style:{maxHeight:h.fullScreen?"100dvh":`calc(100dvh - (${_e(h.yOffset)} * 2))`},children:c})})});zw.classes=Ha;zw.displayName="@mantine/core/ModalContent";const ure={},Vw=qe((e,t)=>{const n=Pe("ModalHeader",ure,e),{classNames:r,className:s,style:i,styles:o,vars:a,...c}=n,u=np();return p.jsx(j7,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:o,className:s}),...c})});Vw.classes=Ha;Vw.displayName="@mantine/core/ModalHeader";const dre={},Uw=qe((e,t)=>{const n=Pe("ModalOverlay",dre,e),{classNames:r,className:s,style:i,styles:o,vars:a,...c}=n,u=np();return p.jsx(A7,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:o,className:s}),...c})});Uw.classes=Ha;Uw.displayName="@mantine/core/ModalOverlay";const fre={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Qi("modal"),transitionProps:{duration:200,transition:"fade-down"},yOffset:"5dvh"},hre=(e,{radius:t,size:n,yOffset:r,xOffset:s})=>({root:{"--modal-radius":t===void 0?void 0:Hn(t),"--modal-size":Mt(n,"modal-size"),"--modal-y-offset":_e(r),"--modal-x-offset":_e(s)}}),qw=qe((e,t)=>{const n=Pe("ModalRoot",fre,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,yOffset:u,scrollAreaComponent:f,radius:h,fullScreen:m,centered:y,xOffset:v,__staticSelector:x,...E}=n,N=bt({name:x,classes:Ha,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:hre});return p.jsx(ore,{value:{yOffset:u,scrollAreaComponent:f,getStyles:N,fullScreen:m},children:p.jsx(N7,{ref:t,...N("root"),"data-full-screen":m||void 0,"data-centered":y||void 0,unstyled:a,...E})})});qw.classes=Ha;qw.displayName="@mantine/core/ModalRoot";const[pre,mre]=ld();function Y7({children:e}){const[t,n]=w.useState([]),[r,s]=w.useState(Qi("modal"));return p.jsx(pre,{value:{stack:t,addModal:(i,o)=>{n(a=>[...new Set([...a,i])]),s(a=>typeof o=="number"&&typeof a=="number"?Math.max(a,o):a)},removeModal:i=>n(o=>o.filter(a=>a!==i)),getZIndex:i=>`calc(${r} + ${t.indexOf(i)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Y7.displayName="@mantine/core/ModalStack";const gre={},Hw=qe((e,t)=>{const n=Pe("ModalTitle",gre,e),{classNames:r,className:s,style:i,styles:o,vars:a,...c}=n,u=np();return p.jsx($7,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:o,className:s}),...c})});Hw.classes=Ha;Hw.displayName="@mantine/core/ModalTitle";const yre={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Qi("modal"),transitionProps:{duration:200,transition:"fade-down"},withOverlay:!0,withCloseButton:!0},$s=qe((e,t)=>{const{title:n,withOverlay:r,overlayProps:s,withCloseButton:i,closeButtonProps:o,children:a,radius:c,opened:u,stackId:f,zIndex:h,...m}=Pe("Modal",yre,e),y=mre(),v=!!n||i,x=y&&f?{closeOnEscape:y.currentId===f,trapFocus:y.currentId===f,zIndex:y.getZIndex(f)}:{},E=r===!1?!1:f&&y?y.currentId===f:u;return w.useEffect(()=>{y&&f&&(u?y.addModal(f,h||Qi("modal")):y.removeModal(f))},[u,f,h]),p.jsxs(qw,{ref:t,radius:c,opened:u,zIndex:y&&f?y.getZIndex(f):h,...m,...x,children:[r&&p.jsx(Uw,{visible:E,transitionProps:y&&f?{duration:0}:void 0,...s}),p.jsxs(zw,{radius:c,__hidden:y&&f&&u?f!==y.currentId:!1,children:[v&&p.jsxs(Vw,{children:[n&&p.jsx(Hw,{children:n}),i&&p.jsx(Bw,{...o})]}),p.jsx(Fw,{children:a})]})]})});$s.classes=Ha;$s.displayName="@mantine/core/Modal";$s.Root=qw;$s.Overlay=Uw;$s.Content=zw;$s.Body=Fw;$s.Header=Vw;$s.Title=Hw;$s.CloseButton=Bw;$s.Stack=Y7;const[bre,wA]=ld(),[vre,xre]=ld();var Ww={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const wre={},Sre=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?Mt(t):Mt(n,"pg-gap")}}),SA=qe((e,t)=>{const n=Pe("PillGroup",wre,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,size:u,disabled:f,...h}=n,m=wA(),y=(m==null?void 0:m.size)||u||void 0,v=bt({name:"PillGroup",classes:Ww,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:Sre,stylesCtx:{size:y},rootSelector:"group"});return p.jsx(vre,{value:{size:y,disabled:f},children:p.jsx(ze,{ref:t,size:y,...v("group"),...h})})});SA.classes=Ww;SA.displayName="@mantine/core/PillGroup";const Ere={variant:"default"},Nre=(e,{radius:t},{size:n})=>({root:{"--pill-fz":Mt(n,"pill-fz"),"--pill-height":Mt(n,"pill-height"),"--pill-radius":t===void 0?void 0:Hn(t)}}),yg=qe((e,t)=>{const n=Pe("Pill",Ere,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,variant:u,children:f,withRemoveButton:h,onRemove:m,removeButtonProps:y,radius:v,size:x,disabled:E,mod:N,..._}=n,C=xre(),j=wA(),A=x||(C==null?void 0:C.size)||void 0,$=(j==null?void 0:j.variant)==="filled"?"contrast":u||"default",R=bt({name:"Pill",classes:Ww,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:Nre,stylesCtx:{size:A}});return p.jsxs(ze,{component:"span",ref:t,variant:$,size:A,...R("root",{variant:$}),mod:[{"with-remove":h&&!E,disabled:E||(C==null?void 0:C.disabled)},N],..._,children:[p.jsx("span",{...R("label"),children:f}),h&&p.jsx(Qh,{variant:"transparent",radius:v,tabIndex:-1,"aria-hidden":!0,unstyled:a,...y,...R("remove",{className:y==null?void 0:y.className,style:y==null?void 0:y.style}),onMouseDown:M=>{var D;M.preventDefault(),M.stopPropagation(),(D=y==null?void 0:y.onMouseDown)==null||D.call(y,M)},onClick:M=>{var D;M.stopPropagation(),m==null||m(),(D=y==null?void 0:y.onClick)==null||D.call(y,M)}})]})});yg.classes=Ww;yg.displayName="@mantine/core/Pill";yg.Group=SA;var J7={field:"m_45c4369d"};const _re={type:"visible"},EA=qe((e,t)=>{const n=Pe("PillsInputField",_re,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,type:u,disabled:f,id:h,pointer:m,mod:y,...v}=n,x=wA(),E=Zh(),N=bt({name:"PillsInputField",classes:J7,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,rootSelector:"field"}),_=f||(x==null?void 0:x.disabled);return p.jsx(ze,{component:"input",ref:_n(t,x==null?void 0:x.fieldRef),"data-type":u,disabled:_,mod:[{disabled:_,pointer:m},y],...N("field"),...v,id:(E==null?void 0:E.inputId)||h,"aria-invalid":x==null?void 0:x.hasError,"aria-describedby":E==null?void 0:E.describedBy,type:"text",onMouseDown:C=>!m&&C.stopPropagation()})});EA.classes=J7;EA.displayName="@mantine/core/PillsInputField";const Cre={},Yv=qe((e,t)=>{const n=Pe("PillsInput",Cre,e),{children:r,onMouseDown:s,onClick:i,size:o,disabled:a,__staticSelector:c,error:u,variant:f,...h}=n,m=w.useRef(null);return p.jsx(bre,{value:{fieldRef:m,size:o,disabled:a,hasError:!!u,variant:f},children:p.jsx(pi,{size:o,error:u,variant:f,component:"div",ref:t,onMouseDown:y=>{var v;y.preventDefault(),s==null||s(y),(v=m.current)==null||v.focus()},onClick:y=>{var x;y.preventDefault();const v=y.currentTarget.closest("fieldset");v!=null&&v.disabled||((x=m.current)==null||x.focus(),i==null||i(y))},...h,multiline:!0,disabled:a,__staticSelector:c||"PillsInput",withAria:!1,children:r})})});Yv.displayName="@mantine/core/PillsInput";Yv.Field=EA;var X7={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const Ore={withCloseButton:!0},jre=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:Hn(t),"--notification-color":n?wr(n,e):void 0}}),NA=qe((e,t)=>{const n=Pe("Notification",Ore,e),{className:r,color:s,radius:i,loading:o,withCloseButton:a,withBorder:c,title:u,icon:f,children:h,onClose:m,closeButtonProps:y,classNames:v,style:x,styles:E,unstyled:N,variant:_,vars:C,mod:j,...A}=n,$=bt({name:"Notification",classes:X7,props:n,className:r,style:x,classNames:v,styles:E,unstyled:N,vars:C,varsResolver:jre});return p.jsxs(ze,{...$("root"),mod:[{"data-with-icon":!!f||o,"data-with-border":c},j],ref:t,variant:_,...A,role:"alert",children:[f&&!o&&p.jsx("div",{...$("icon"),children:f}),o&&p.jsx(Sy,{size:28,color:s,...$("loader")}),p.jsxs("div",{...$("body"),children:[u&&p.jsx("div",{...$("title"),children:u}),p.jsx(ze,{...$("description"),mod:{"data-with-title":!!u},children:h})]}),a&&p.jsx(Qh,{iconSize:16,color:"gray",...y,unstyled:N,onClick:m,...$("closeButton")})]})});NA.classes=X7;NA.displayName="@mantine/core/Notification";function K7(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}var bg;(function(e){e.event="event",e.props="prop"})(bg||(bg={}));function Wl(){}function Are(e){var t,n=void 0;return function(){for(var r=[],s=arguments.length;s--;)r[s]=arguments[s];return t&&r.length===t.length&&r.every(function(i,o){return i===t[o]})||(t=r,n=e.apply(void 0,r)),n}}function vg(e){return!!(e||"").match(/\d/)}function Vf(e){return e==null}function $re(e){return typeof e=="number"&&isNaN(e)}function Q7(e){return Vf(e)||$re(e)||typeof e=="number"&&!isFinite(e)}function Z7(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Tre(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Rre(e,t,n){var r=Tre(n),s=e.search(/[1-9]/);return s=s===-1?e.length:s,e.substring(0,s)+e.substring(s,e.length).replace(r,"$1"+t)}function Mre(e){var t=w.useRef(e);t.current=e;var n=w.useRef(function(){for(var r=[],s=arguments.length;s--;)r[s]=arguments[s];return t.current.apply(t,r)});return n.current}function _A(e,t){t===void 0&&(t=!0);var n=e[0]==="-",r=n&&t;e=e.replace("-","");var s=e.split("."),i=s[0],o=s[1]||"";return{beforeDecimal:i,afterDecimal:o,hasNegation:n,addNegation:r}}function kre(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",s=n[1]||"";return(t?"-":"")+r+(s?"."+s:"")}function eL(e,t,n){for(var r="",s=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||s;return r}function ZM(e,t){return Array(t+1).join(e)}function tL(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var r=t.split(/[eE]/g),s=r[0],i=r[1];if(i=Number(i),!i)return n+s;s=s.replace(".","");var o=1+i,a=s.length;return o<0?s="0."+ZM("0",Math.abs(o))+s:o>=a?s=s+ZM("0",o-a):s=(s.substring(0,o)||"0")+"."+s.substring(o),n+s}function e6(e,t,n){if(["","-"].indexOf(e)!==-1)return e;var r=(e.indexOf(".")!==-1||n)&&t,s=_A(e),i=s.beforeDecimal,o=s.afterDecimal,a=s.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),f=u.split("."),h=i;i&&Number(f[0])&&(h=i.split("").reverse().reduce(function(x,E,N){return x.length>N?(Number(x[0])+Number(E)).toString()+x.substring(1,x.length):E+x},f[0]));var m=eL(f[1]||"",t,n),y=a?"-":"",v=r?".":"";return""+y+h+v+m}function Nu(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var nL=Are(function(e,t){for(var n=0,r=0,s=e.length,i=t.length;e[n]===t[n]&&n<s;)n++;for(;e[s-1-r]===t[i-1-r]&&i-r>n&&s-r>n;)r++;return{from:{start:n,end:s-r},to:{start:n,end:i-r}}}),Ire=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function Dre(e,t,n){return Math.min(Math.max(e,t),n)}function Q2(e){return Math.max(e.selectionStart,e.selectionEnd)}function Pre(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Lre(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function Fre(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,s=e.formattedValueIndex;return t[r]===n[s]}function Bre(e,t,n,r,s,i,o){o===void 0&&(o=Fre);var a=s.findIndex(function(j){return j}),c=e.slice(0,a);!t&&!n.startsWith(c)&&(t=c,n=c+n,r=r+c.length);for(var u=n.length,f=e.length,h={},m=new Array(u),y=0;y<u;y++){m[y]=-1;for(var v=0,x=f;v<x;v++){var E=o({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:v});if(E&&h[v]!==!0){m[y]=v,h[v]=!0;break}}}for(var N=r;N<u&&(m[N]===-1||!i(n[N]));)N++;var _=N===u||m[N]===-1?f:m[N];for(N=r-1;N>0&&m[N]===-1;)N--;var C=N===-1||m[N]===-1?0:m[N]+1;return C>_?_:r-C<_-r?C:_}function t6(e,t,n,r){var s=e.length;if(t=Dre(t,0,s),r==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=s&&!n[t];)t++;t>s&&(t=n.lastIndexOf(!0))}return t===-1&&(t=s),t}function zre(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(vg(e[n])||vg(e[n-1]));return t}function rL(e,t,n,r,s,i){i===void 0&&(i=Wl);var o=Mre(function(v,x){var E,N;return Q7(v)?(N="",E=""):typeof v=="number"||x?(N=typeof v=="number"?tL(v):v,E=r(N)):(N=s(v,void 0),E=r(N)),{formattedValue:E,numAsString:N}}),a=w.useState(function(){return o(Vf(e)?t:e,n)}),c=a[0],u=a[1],f=function(v,x){v.formattedValue!==c.formattedValue&&u({formattedValue:v.formattedValue,numAsString:v.value}),i(v,x)},h=e,m=n;Vf(e)&&(h=c.numAsString,m=!0);var y=o(h,m);return w.useMemo(function(){u(y)},[y.formattedValue]),[c,f]}function Vre(e){return e.replace(/[^0-9]/g,"")}function Ure(e){return e}function qre(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var r=e.customInput,s=e.renderText,i=e.getInputRef,o=e.format;o===void 0&&(o=Ure);var a=e.removeFormatting;a===void 0&&(a=Vre);var c=e.defaultValue,u=e.valueIsNumericString,f=e.onValueChange,h=e.isAllowed,m=e.onChange;m===void 0&&(m=Wl);var y=e.onKeyDown;y===void 0&&(y=Wl);var v=e.onMouseUp;v===void 0&&(v=Wl);var x=e.onFocus;x===void 0&&(x=Wl);var E=e.onBlur;E===void 0&&(E=Wl);var N=e.value,_=e.getCaretBoundary;_===void 0&&(_=zre);var C=e.isValidInputCharacter;C===void 0&&(C=vg);var j=e.isCharacterSame,A=K7(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),$=rL(N,c,!!u,o,a,f),R=$[0],M=R.formattedValue,D=R.numAsString,P=$[1],F=w.useRef(),V=w.useRef({formattedValue:M,numAsString:D}),H=function($e,J){V.current={formattedValue:$e.formattedValue,numAsString:$e.value},P($e,J)},I=w.useState(!1),B=I[0],T=I[1],L=w.useRef(null),z=w.useRef({setCaretTimeout:null,focusTimeout:null});w.useEffect(function(){return T(!0),function(){clearTimeout(z.current.setCaretTimeout),clearTimeout(z.current.focusTimeout)}},[]);var q=o,k=function($e,J){var te=parseFloat(J);return{formattedValue:$e,value:J,floatValue:isNaN(te)?void 0:te}},W=function($e,J,te){$e.selectionStart===0&&$e.selectionEnd===$e.value.length||(Nu($e,J),z.current.setCaretTimeout=setTimeout(function(){$e.value===te&&$e.selectionStart!==J&&Nu($e,J)},0))},X=function($e,J,te){return t6($e,J,_($e),te)},ne=function($e,J,te){var Q=_(J),ye=Bre(J,M,$e,te,Q,C,j);return ye=t6(J,ye,Q),ye},re=function($e){var J=$e.formattedValue;J===void 0&&(J="");var te=$e.input,Q=$e.source,ye=$e.event,ce=$e.numAsString,ae;if(te){var ie=$e.inputValue||te.value,de=Q2(te);te.value=J,ae=ne(ie,J,de),ae!==void 0&&W(te,ae,J)}J!==M&&H(k(J,ce),{event:ye,source:Q})};w.useEffect(function(){var $e=V.current,J=$e.formattedValue,te=$e.numAsString;(M!==J||D!==te)&&H(k(M,D),{event:void 0,source:bg.props})},[M,D]);var se=L.current?Q2(L.current):void 0,fe=typeof window<"u"?w.useLayoutEffect:w.useEffect;fe(function(){var $e=L.current;if(M!==V.current.formattedValue&&$e){var J=ne(V.current.formattedValue,M,se);$e.value=M,W($e,J,M)}},[M]);var he=function($e,J,te){var Q=J.target,ye=F.current?Ire(F.current,Q.selectionEnd):nL(M,$e),ce=Object.assign(Object.assign({},ye),{lastValue:M}),ae=a($e,ce),ie=q(ae);if(ae=a(ie,void 0),h&&!h(k(ie,ae))){var de=J.target,be=Q2(de),Ae=ne($e,M,be);return de.value=M,W(de,Ae,M),!1}return re({formattedValue:ie,numAsString:ae,inputValue:$e,event:J,source:te,input:J.target}),!0},ue=function($e,J){J===void 0&&(J=0);var te=$e.selectionStart,Q=$e.selectionEnd;F.current={selectionStart:te,selectionEnd:Q+J}},ve=function($e){var J=$e.target,te=J.value,Q=he(te,$e,bg.event);Q&&m($e),F.current=void 0},Se=function($e){var J=$e.target,te=$e.key,Q=J.selectionStart,ye=J.selectionEnd,ce=J.value;ce===void 0&&(ce="");var ae;te==="ArrowLeft"||te==="Backspace"?ae=Math.max(Q-1,0):te==="ArrowRight"?ae=Math.min(Q+1,ce.length):te==="Delete"&&(ae=Q);var ie=0;te==="Delete"&&Q===ye&&(ie=1);var de=te==="ArrowLeft"||te==="ArrowRight";if(ae===void 0||Q!==ye&&!de){y($e),ue(J,ie);return}var be=ae;if(de){var Ae=te==="ArrowLeft"?"left":"right";be=X(ce,ae,Ae),be!==ae&&$e.preventDefault()}else te==="Delete"&&!C(ce[ae])?be=X(ce,ae,"right"):te==="Backspace"&&!C(ce[ae])&&(be=X(ce,ae,"left"));be!==ae&&W(J,be,ce),y($e),ue(J,ie)},ke=function($e){var J=$e.target,te=function(){var Q=J.selectionStart,ye=J.selectionEnd,ce=J.value;if(ce===void 0&&(ce=""),Q===ye){var ae=X(ce,Q);ae!==Q&&W(J,ae,ce)}};te(),requestAnimationFrame(function(){te()}),v($e),ue(J)},Oe=function($e){$e.persist&&$e.persist();var J=$e.target,te=$e.currentTarget;L.current=J,z.current.focusTimeout=setTimeout(function(){var Q=J.selectionStart,ye=J.selectionEnd,ce=J.value;ce===void 0&&(ce="");var ae=X(ce,Q);ae!==Q&&!(Q===0&&ye===ce.length)&&W(J,ae,ce),x(Object.assign(Object.assign({},$e),{currentTarget:te}))},0)},Ce=function($e){L.current=null,clearTimeout(z.current.focusTimeout),clearTimeout(z.current.setCaretTimeout),E($e)},Me=B&&Pre()?"numeric":void 0,Ve=Object.assign({inputMode:Me},A,{type:t,value:M,onChange:ve,onKeyDown:Se,onMouseUp:ke,onFocus:Oe,onBlur:Ce});if(n==="text")return s?Re.createElement(Re.Fragment,null,s(M,A)||null):Re.createElement("span",Object.assign({},A,{ref:i}),M);if(r){var We=r;return Re.createElement(We,Object.assign({},Ve,{ref:i}))}return Re.createElement("input",Object.assign({},Ve,{ref:i}))}function n6(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,s=t.prefix;s===void 0&&(s="");var i=t.suffix;i===void 0&&(i="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=Gw(t),u=c.thousandSeparator,f=c.decimalSeparator,h=n!==0&&e.indexOf(".")!==-1||n&&r,m=_A(e,o),y=m.beforeDecimal,v=m.afterDecimal,x=m.addNegation;return n!==void 0&&(v=eL(v,n,!!r)),u&&(y=Rre(y,u,a)),s&&(y=s+y),i&&(v=v+i),x&&(y="-"+y),e=y+(h&&f||"")+v,e}function Gw(e){var t=e.decimalSeparator;t===void 0&&(t=".");var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=","),r||(r=[t,"."]),{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function Hre(e,t){e===void 0&&(e="");var n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),s=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),s&&!i&&t&&(e="-"+e),e}function Wre(e,t){return new RegExp("(^-)|[0-9]|"+Z7(e),"g")}function Gre(e,t,n){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(n!=null&&n.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Yre(e,t,n){var r;t===void 0&&(t=Lre(e));var s=n.allowNegative,i=n.prefix;i===void 0&&(i="");var o=n.suffix;o===void 0&&(o="");var a=n.decimalScale,c=t.from,u=t.to,f=u.start,h=u.end,m=Gw(n),y=m.allowedDecimalSeparators,v=m.decimalSeparator,x=e[h]===v;if(vg(e)&&(e===i||e===o)&&t.lastValue==="")return e;if(h-f===1&&y.indexOf(e[f])!==-1){var E=a===0?"":v;e=e.substring(0,f)+E+e.substring(f+1,e.length)}var N=function(L,z,q){var k=!1,W=!1;i.startsWith("-")?k=!1:L.startsWith("--")?(k=!1,W=!0):o.startsWith("-")&&L.length===o.length?k=!1:L[0]==="-"&&(k=!0);var X=k?1:0;return W&&(X=2),X&&(L=L.substring(X),z-=X,q-=X),{value:L,start:z,end:q,hasNegation:k}},_=N(e,f,h),C=_.hasNegation;r=_,e=r.value,f=r.start,h=r.end;var j=N(t.lastValue,c.start,c.end),A=j.start,$=j.end,R=j.value,M=e.substring(f,h);e.length&&R.length&&(A>R.length-o.length||$<i.length)&&!(M&&o.startsWith(M))&&(e=R);var D=0;e.startsWith(i)?D+=i.length:f<i.length&&(D=f),e=e.substring(D),h-=D;var P=e.length,F=e.length-o.length;e.endsWith(o)?P=F:(h>F||h>e.length-o.length)&&(P=h),e=e.substring(0,P),e=Hre(C?"-"+e:e,s),e=(e.match(Wre(v))||[]).join("");var V=e.indexOf(v);e=e.replace(new RegExp(Z7(v),"g"),function(L,z){return z===V?".":""});var H=_A(e,s),I=H.beforeDecimal,B=H.afterDecimal,T=H.addNegation;return u.end-u.start<c.end-c.start&&I===""&&x&&!parseFloat(B)&&(e=T?"-":""),e}function Jre(e,t){var n=t.prefix;n===void 0&&(n="");var r=t.suffix;r===void 0&&(r="");var s=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";s.fill(!1,0,n.length+(i?1:0));var o=e.length;return s.fill(!1,o-r.length+1,o+1),s}function Xre(e){var t=Gw(e),n=t.thousandSeparator,r=t.decimalSeparator,s=e.prefix;s===void 0&&(s="");var i=e.allowNegative;if(i===void 0&&(i=!0),n===r)throw new Error(`
        Decimal separator can't be same as thousand separator.
        thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
        decimalSeparator: `+r+` (default value for decimalSeparator is .)
     `);return s.startsWith("-")&&i&&(console.error(`
      Prefix can't start with '-' when allowNegative is true.
      prefix: `+s+`
      allowNegative: `+i+`
    `),i=!1),Object.assign(Object.assign({},e),{allowNegative:i})}function Kre(e){e=Xre(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,s=e.onKeyDown;s===void 0&&(s=Wl);var i=e.onBlur;i===void 0&&(i=Wl);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var f=e.defaultValue,h=e.value,m=e.valueIsNumericString,y=e.onValueChange,v=K7(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),x=Gw(e),E=x.decimalSeparator,N=x.allowedDecimalSeparators,_=function(T){return n6(T,e)},C=function(T,L){return Yre(T,L,e)},j=Vf(h)?f:h,A=m??Gre(j,u,t);Vf(h)?Vf(f)||(A=A||typeof f=="number"):A=A||typeof h=="number";var $=function(T){return Q7(T)?T:(typeof T=="number"&&(T=tL(T)),A&&typeof a=="number"?e6(T,a,!!c):T)},R=rL($(h),$(f),!!A,_,C,y),M=R[0],D=M.numAsString,P=M.formattedValue,F=R[1],V=function(T){var L=T.target,z=T.key,q=L.selectionStart,k=L.selectionEnd,W=L.value;if(W===void 0&&(W=""),(z==="Backspace"||z==="Delete")&&k<u.length){T.preventDefault();return}if(q!==k){s(T);return}z==="Backspace"&&W[0]==="-"&&q===u.length+1&&n&&Nu(L,1),a&&c&&(z==="Backspace"&&W[q-1]===E?(Nu(L,q-1),T.preventDefault()):z==="Delete"&&W[q]===E&&T.preventDefault()),N!=null&&N.includes(z)&&W[q]===E&&Nu(L,q+1);var X=o===!0?",":o;z==="Backspace"&&W[q-1]===X&&Nu(L,q-1),z==="Delete"&&W[q]===X&&Nu(L,q+1),s(T)},H=function(T){var L=D;if(L.match(/\d/g)||(L=""),r||(L=kre(L)),c&&a&&(L=e6(L,a,c)),L!==D){var z=n6(L,e);F({formattedValue:z,value:L,floatValue:parseFloat(L)},{event:T,source:bg.event})}i(T)},I=function(T){return T===E?!0:vg(T)},B=function(T){var L=T.currentValue,z=T.lastValue,q=T.formattedValue,k=T.currentValueIndex,W=T.formattedValueIndex,X=L[k],ne=q[W],re=nL(z,L),se=re.to,fe=function(he){return C(he).indexOf(".")+u.length};return h===0&&c&&a&&L[se.start]===E&&fe(L)<k&&fe(q)>W?!1:k>=se.start&&k<se.end&&N&&N.includes(X)&&ne===E?!0:X===ne};return Object.assign(Object.assign({},v),{value:P,valueIsNumericString:!1,isValidInputCharacter:I,isCharacterSame:B,onValueChange:F,format:_,removeFormatting:C,getCaretBoundary:function(T){return Jre(T,e)},onKeyDown:V,onBlur:H})}function Qre(e){var t=Kre(e);return Re.createElement(qre,Object.assign({},t))}function r6({direction:e,style:t,...n}){return p.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...t},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:p.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var eC={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};const Zre=/^(0\.0*|-0(\.0*)?)$/,ese=/^-?0\d+(\.\d+)?\.?$/;function tC(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function Z2(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||tC(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function tse(e){return e.toString().replace(".","").length}function nse(e,t){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&tse(t)<14&&t!==""}function s6(e,t,n){if(e===void 0)return!0;const r=t===void 0||e>=t,s=n===void 0||e<=n;return r&&s}const rse={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0},sse=(e,{size:t})=>({controls:{"--ni-chevron-size":Mt(t,"ni-chevron-size")}}),Yw=qe((e,t)=>{const n=Pe("NumberInput",rse,e),{className:r,classNames:s,styles:i,unstyled:o,vars:a,onChange:c,onValueChange:u,value:f,defaultValue:h,max:m,min:y,step:v,hideControls:x,rightSection:E,isAllowed:N,clampBehavior:_,onBlur:C,allowDecimal:j,decimalScale:A,onKeyDown:$,onKeyDownCapture:R,handlersRef:M,startValue:D,disabled:P,rightSectionPointerEvents:F,allowNegative:V,readOnly:H,size:I,rightSectionWidth:B,stepHoldInterval:T,stepHoldDelay:L,allowLeadingZeros:z,withKeyboardEvents:q,trimLeadingZeroesOnBlur:k,...W}=n,X=bt({name:"NumberInput",classes:eC,props:n,classNames:s,styles:i,unstyled:o,vars:a,varsResolver:sse}),{resolvedClassNames:ne,resolvedStyles:re}=Yh({classNames:s,styles:i,props:n}),[se,fe]=ss({value:f,defaultValue:h,finalValue:"",onChange:c}),he=L!==void 0&&T!==void 0,ue=w.useRef(null),ve=w.useRef(null),Se=w.useRef(0),ke=(ie,de)=>{de.source==="event"&&fe(nse(ie.floatValue,ie.value)&&!Zre.test(ie.value)&&!(z&&ese.test(ie.value))?ie.floatValue:ie.value),u==null||u(ie,de)},Oe=ie=>{const de=String(ie).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return de?Math.max(0,(de[1]?de[1].length:0)-(de[2]?+de[2]:0)):0},Ce=ie=>{ue.current&&typeof ie<"u"&&ue.current.setSelectionRange(ie,ie)},Me=w.useRef(z_);Me.current=()=>{if(!Z2(se))return;let ie;const de=Oe(se),be=Oe(v),Ae=Math.max(de,be),Ie=10**Ae;if(!tC(se)&&(typeof se!="number"||Number.isNaN(se)))ie=Sa(D,y,m);else if(m!==void 0){const Vt=(Math.round(Number(se)*Ie)+Math.round(v*Ie))/Ie;ie=Vt<=m?Vt:m}else ie=(Math.round(Number(se)*Ie)+Math.round(v*Ie))/Ie;const ht=ie.toFixed(Ae);fe(parseFloat(ht)),u==null||u({floatValue:parseFloat(ht),formattedValue:ht,value:ht},{source:"increment"}),setTimeout(()=>{var Vt;return Ce((Vt=ue.current)==null?void 0:Vt.value.length)},0)};const Ve=w.useRef(z_);Ve.current=()=>{if(!Z2(se))return;let ie;const de=y!==void 0?y:V?Number.MIN_SAFE_INTEGER:0,be=Oe(se),Ae=Oe(v),Ie=Math.max(be,Ae),ht=10**Ie;if(!tC(se)&&typeof se!="number"||Number.isNaN(se))ie=Sa(D,de,m);else{const _t=(Math.round(Number(se)*ht)-Math.round(v*ht))/ht;ie=de!==void 0&&_t<de?de:_t}const Vt=ie.toFixed(Ie);fe(parseFloat(Vt)),u==null||u({floatValue:parseFloat(Vt),formattedValue:Vt,value:Vt},{source:"decrement"}),setTimeout(()=>{var _t;return Ce((_t=ue.current)==null?void 0:_t.value.length)},0)};const We=ie=>{$==null||$(ie),!(H||!q)&&(ie.key==="ArrowUp"&&(ie.preventDefault(),Me.current()),ie.key==="ArrowDown"&&(ie.preventDefault(),Ve.current()))},$e=ie=>{if(R==null||R(ie),ie.key==="Backspace"){const de=ue.current;de.selectionStart===0&&de.selectionStart===de.selectionEnd&&(ie.preventDefault(),window.setTimeout(()=>Ce(0),0))}},J=ie=>{let de=se;if(_==="blur"&&typeof de=="number"&&(de=Sa(de,y,m)),k&&typeof de=="string"&&Oe(de)<15){const be=de.toString().replace(/^0+/,""),Ae=parseFloat(be);de=Number.isNaN(Ae)||Ae>Number.MAX_SAFE_INTEGER?be:Sa(Ae,y,m)}se!==de&&fe(de),C==null||C(ie)};Vv(M,{increment:Me.current,decrement:Ve.current});const te=ie=>{ie?Me.current():Ve.current(),Se.current+=1},Q=ie=>{if(te(ie),he){const de=typeof T=="number"?T:T(Se.current);ve.current=window.setTimeout(()=>Q(ie),de)}},ye=(ie,de)=>{var be;ie.preventDefault(),(be=ue.current)==null||be.focus(),te(de),he&&(ve.current=window.setTimeout(()=>Q(de),L))},ce=()=>{ve.current&&window.clearTimeout(ve.current),ve.current=null,Se.current=0},ae=p.jsxs("div",{...X("controls"),children:[p.jsx(Ma,{...X("control"),tabIndex:-1,"aria-hidden":!0,disabled:P||typeof se=="number"&&m!==void 0&&se>=m,mod:{direction:"up"},onMouseDown:ie=>ie.preventDefault(),onPointerDown:ie=>{ye(ie,!0)},onPointerUp:ce,onPointerLeave:ce,children:p.jsx(r6,{direction:"up"})}),p.jsx(Ma,{...X("control"),tabIndex:-1,"aria-hidden":!0,disabled:P||typeof se=="number"&&y!==void 0&&se<=y,mod:{direction:"down"},onMouseDown:ie=>ie.preventDefault(),onPointerDown:ie=>{ye(ie,!1)},onPointerUp:ce,onPointerLeave:ce,children:p.jsx(r6,{direction:"down"})})]});return p.jsx(pi,{component:Qre,allowNegative:V,className:hn(eC.root,r),size:I,...W,readOnly:H,disabled:P,value:se,getInputRef:_n(t,ue),onValueChange:ke,rightSection:x||H||!Z2(se)?E:E||ae,classNames:ne,styles:re,unstyled:o,__staticSelector:"NumberInput",decimalScale:j?A:0,onKeyDown:We,onKeyDownCapture:$e,rightSectionPointerEvents:F??(P?"none":void 0),rightSectionWidth:B??`var(--ni-right-section-width-${I||"sm"})`,allowLeadingZeros:z,onBlur:J,isAllowed:ie=>_==="strict"?N?N(ie)&&s6(ie.floatValue,y,m):s6(ie.floatValue,y,m):N?N(ie):!0})});Yw.classes={...pi.classes,...eC};Yw.displayName="@mantine/core/NumberInput";const[ise,sL]=ld(),[ose,ase]=ld();var iL={card:"m_9dc8ae12"};const lse={withBorder:!0},cse=(e,{radius:t})=>({card:{"--card-radius":Hn(t)}}),CA=qe((e,t)=>{const n=Pe("RadioCard",lse,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,checked:u,mod:f,withBorder:h,value:m,onClick:y,name:v,onKeyDown:x,...E}=n,N=bt({name:"RadioCard",classes:iL,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:cse,rootSelector:"card"}),{dir:_}=Rc(),C=sL(),j=typeof u=="boolean"?u:(C==null?void 0:C.value)===m||!1,A=v||(C==null?void 0:C.name),$=R=>{if(x==null||x(R),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(R.nativeEvent.code)){R.preventDefault();const M=Array.from(document.querySelectorAll(`[role="radio"][name="${A||"__mantine"}"]`)),D=M.findIndex(V=>V===R.target),P=D+1>=M.length?0:D+1,F=D-1<0?M.length-1:D-1;R.nativeEvent.code==="ArrowDown"&&(M[P].focus(),M[P].click()),R.nativeEvent.code==="ArrowUp"&&(M[F].focus(),M[F].click()),R.nativeEvent.code==="ArrowLeft"&&(M[_==="ltr"?F:P].focus(),M[_==="ltr"?F:P].click()),R.nativeEvent.code==="ArrowRight"&&(M[_==="ltr"?P:F].focus(),M[_==="ltr"?P:F].click())}};return p.jsx(ose,{value:{checked:j},children:p.jsx(Ma,{ref:t,mod:[{"with-border":h,checked:j},f],...N("card"),...E,role:"radio","aria-checked":j,name:A,onClick:R=>{y==null||y(R),C==null||C.onChange(m||"")},onKeyDown:$})})});CA.displayName="@mantine/core/RadioCard";CA.classes=iL;const use={},Jw=qe((e,t)=>{const{value:n,defaultValue:r,onChange:s,size:i,wrapperProps:o,children:a,name:c,readOnly:u,...f}=Pe("RadioGroup",use,e),h=di(c),[m,y]=ss({value:n,defaultValue:r,finalValue:"",onChange:s}),v=x=>!u&&y(typeof x=="string"?x:x.currentTarget.value);return p.jsx(ise,{value:{value:m,onChange:v,size:i,name:h},children:p.jsx(kt.Wrapper,{size:i,ref:t,...o,...f,labelElement:"div",__staticSelector:"RadioGroup",children:p.jsx(z7,{role:"radiogroup",children:a})})})});Jw.classes=kt.Wrapper.classes;Jw.displayName="@mantine/core/RadioGroup";function oL({size:e,style:t,...n}){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:_e(e),height:_e(e),...t},"aria-hidden":!0,...n,children:p.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var aL={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const dse={icon:oL},fse=(e,{radius:t,color:n,size:r,iconColor:s,variant:i,autoContrast:o})=>{const a=$c({color:n||e.primaryColor,theme:e}),c=a.isThemeColor&&a.shade===void 0?`var(--mantine-color-${a.color}-outline)`:a.color;return{indicator:{"--radio-size":Mt(r,"radio-size"),"--radio-radius":t===void 0?void 0:Hn(t),"--radio-color":i==="outline"?c:wr(n,e),"--radio-icon-size":Mt(r,"radio-icon-size"),"--radio-icon-color":s?wr(s,e):Aj(o,e)?by({color:n,theme:e,autoContrast:o}):void 0}}},OA=qe((e,t)=>{const n=Pe("RadioIndicator",dse,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,icon:u,radius:f,color:h,iconColor:m,autoContrast:y,checked:v,mod:x,variant:E,disabled:N,..._}=n,C=u,j=bt({name:"RadioIndicator",classes:aL,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:fse,rootSelector:"indicator"}),A=ase(),$=typeof v=="boolean"?v:(A==null?void 0:A.checked)||!1;return p.jsx(ze,{ref:t,...j("indicator",{variant:E}),variant:E,mod:[{checked:$,disabled:N},x],..._,children:p.jsx(C,{...j("icon")})})});OA.displayName="@mantine/core/RadioIndicator";OA.classes=aL;var lL={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const hse={labelPosition:"right"},pse=(e,{size:t,radius:n,color:r,iconColor:s,variant:i,autoContrast:o})=>{const a=$c({color:r||e.primaryColor,theme:e}),c=a.isThemeColor&&a.shade===void 0?`var(--mantine-color-${a.color}-outline)`:a.color;return{root:{"--radio-size":Mt(t,"radio-size"),"--radio-radius":n===void 0?void 0:Hn(n),"--radio-color":i==="outline"?c:wr(r,e),"--radio-icon-color":s?wr(s,e):Aj(o,e)?by({color:r,theme:e,autoContrast:o}):void 0,"--radio-icon-size":Mt(t,"radio-icon-size")}}},Co=qe((e,t)=>{const n=Pe("Radio",hse,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,id:u,size:f,label:h,labelPosition:m,description:y,error:v,radius:x,color:E,variant:N,disabled:_,wrapperProps:C,icon:j=oL,rootRef:A,iconColor:$,onChange:R,mod:M,...D}=n,P=bt({name:"Radio",classes:lL,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:pse}),F=sL(),V=(F==null?void 0:F.size)??f,H=n.size?f:V,{styleProps:I,rest:B}=Jh(D),T=di(u),L=F?{checked:F.value===B.value,name:B.name??F.name,onChange:z=>{F.onChange(z),R==null||R(z)}}:{};return p.jsx(hA,{...P("root"),__staticSelector:"Radio",__stylesApiProps:n,id:T,size:H,labelPosition:m,label:h,description:y,error:v,disabled:_,classNames:r,styles:o,unstyled:a,"data-checked":L.checked||void 0,variant:N,ref:A,mod:M,...I,...C,children:p.jsxs(ze,{...P("inner"),mod:{"label-position":m},children:[p.jsx(ze,{...P("radio",{focusable:!0,variant:N}),onChange:R,...B,...L,component:"input",mod:{error:!!v},ref:t,id:T,disabled:_,type:"radio"}),p.jsx(j,{...P("icon"),"aria-hidden":!0})]})})});Co.classes=lL;Co.displayName="@mantine/core/Radio";Co.Group=Jw;Co.Card=CA;Co.Indicator=OA;const mse={duration:100,transition:"fade"};function gse(e,t){return{...mse,...t,...e}}function yse({offset:e,position:t,defaultOpened:n}){const[r,s]=w.useState(n),i=w.useRef(null),{x:o,y:a,elements:c,refs:u,update:f,placement:h}=Yj({placement:t,middleware:[qj({crossAxis:!0,padding:5,rootBoundary:"document"})]}),m=h.includes("right")?e:t.includes("left")?e*-1:0,y=h.includes("bottom")?e:t.includes("top")?e*-1:0,v=w.useCallback(({clientX:x,clientY:E})=>{u.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x,y:E,left:x+m,top:E+y,right:x,bottom:E}}})},[c.reference]);return w.useEffect(()=>{if(u.floating.current){const x=i.current;x.addEventListener("mousemove",v);const E=_a(u.floating.current);return E.forEach(N=>{N.addEventListener("scroll",f)}),()=>{x.removeEventListener("mousemove",v),E.forEach(N=>{N.removeEventListener("scroll",f)})}}},[c.reference,u.floating.current,f,v,r]),{handleMouseMove:v,x:o,y:a,opened:r,setOpened:s,boundaryRef:i,floating:u.setFloating}}var Xw={tooltip:"m_1b3c8819",arrow:"m_f898399f"};const bse={refProp:"ref",withinPortal:!0,offset:10,defaultOpened:!1,position:"right",zIndex:Qi("popover")},vse=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Hn(t),"--tooltip-bg":n?wr(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),jA=qe((e,t)=>{const n=Pe("TooltipFloating",bse,e),{children:r,refProp:s,withinPortal:i,style:o,className:a,classNames:c,styles:u,unstyled:f,radius:h,color:m,label:y,offset:v,position:x,multiline:E,zIndex:N,disabled:_,defaultOpened:C,variant:j,vars:A,portalProps:$,...R}=n,M=As(),D=bt({name:"TooltipFloating",props:n,classes:Xw,className:a,style:o,classNames:c,styles:u,unstyled:f,rootSelector:"tooltip",vars:A,varsResolver:vse}),{handleMouseMove:P,x:F,y:V,opened:H,boundaryRef:I,floating:B,setOpened:T}=yse({offset:v,position:x,defaultOpened:C});if(!jc(r))throw new Error("[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const L=_n(I,Cw(r),t),z=r.props,q=W=>{var X;(X=z.onMouseEnter)==null||X.call(z,W),P(W),T(!0)},k=W=>{var X;(X=z.onMouseLeave)==null||X.call(z,W),T(!1)};return p.jsxs(p.Fragment,{children:[p.jsx(cd,{...$,withinPortal:i,children:p.jsx(ze,{...R,...D("tooltip",{style:{...C8(o,M),zIndex:N,display:!_&&H?"block":"none",top:(V&&Math.round(V))??"",left:(F&&Math.round(F))??""}}),variant:j,ref:B,mod:{multiline:E},children:y})}),w.cloneElement(r,{...z,[s]:L,onMouseEnter:q,onMouseLeave:k})]})});jA.classes=Xw;jA.displayName="@mantine/core/TooltipFloating";const cL=w.createContext(!1),xse=cL.Provider,wse=()=>w.useContext(cL),Sse={openDelay:0,closeDelay:0};function AA(e){const{openDelay:t,closeDelay:n,children:r}=Pe("TooltipGroup",Sse,e);return p.jsx(xse,{value:!0,children:p.jsx(ete,{delay:{open:t,close:n},children:r})})}AA.displayName="@mantine/core/TooltipGroup";AA.extend=e=>e;function Ese(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Nse(e){const t=Ese(e.middlewares),n=[s7(e.offset)];return t.shift&&n.push(qj(typeof t.shift=="boolean"?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip=="boolean"?Gv():Gv(t.flip)),n.push(i7({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline=="boolean"?Hm():Hm(t.inline)):e.inline&&n.push(Hm()),n}function _se(e){var $,R,M;const[t,n]=w.useState(e.defaultOpened),s=typeof e.opened=="boolean"?e.opened:t,i=wse(),o=di(),a=w.useCallback(D=>{n(D),D&&_(o)},[o]),{x:c,y:u,context:f,refs:h,update:m,placement:y,middlewareData:{arrow:{x:v,y:x}={}}}=Yj({strategy:e.strategy,placement:e.position,open:s,onOpenChange:a,middleware:Nse(e)}),{delay:E,currentId:N,setCurrentId:_}=tte(f,{id:o}),{getReferenceProps:C,getFloatingProps:j}=lte([Qee(f,{enabled:($=e.events)==null?void 0:$.hover,delay:i?E:{open:e.openDelay,close:e.closeDelay},mouseOnly:!((R=e.events)!=null&&R.touch)}),ate(f,{enabled:(M=e.events)==null?void 0:M.focus,visibleOnly:!0}),ute(f,{role:"tooltip"}),ite(f,{enabled:typeof e.opened>"u"})]);g7({opened:s,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:h,update:m}}),Ra(()=>{var D;(D=e.onPositionChange)==null||D.call(e,y)},[y]);const A=s&&N&&N!==o;return{x:c,y:u,arrowX:v,arrowY:x,reference:h.setReference,floating:h.setFloating,getFloatingProps:j,getReferenceProps:C,isGroupPhase:A,opened:s,placement:y}}const i6={position:"top",refProp:"ref",withinPortal:!0,inline:!1,defaultOpened:!1,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:Qi("popover"),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},Cse=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Hn(t),"--tooltip-bg":n?wr(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),ud=qe((e,t)=>{const n=Pe("Tooltip",i6,e),{children:r,position:s,refProp:i,label:o,openDelay:a,closeDelay:c,onPositionChange:u,opened:f,defaultOpened:h,withinPortal:m,radius:y,color:v,classNames:x,styles:E,unstyled:N,style:_,className:C,withArrow:j,arrowSize:A,arrowOffset:$,arrowRadius:R,arrowPosition:M,offset:D,transitionProps:P,multiline:F,events:V,zIndex:H,disabled:I,positionDependencies:B,onClick:T,onMouseEnter:L,onMouseLeave:z,inline:q,variant:k,keepMounted:W,vars:X,portalProps:ne,mod:re,floatingStrategy:se,middlewares:fe,...he}=Pe("Tooltip",i6,n),{dir:ue}=Rc(),ve=w.useRef(null),Se=_se({position:c7(ue,s),closeDelay:c,openDelay:a,onPositionChange:u,opened:f,defaultOpened:h,events:V,arrowRef:ve,arrowOffset:$,offset:typeof D=="number"?D+(j?A/2:0):D,positionDependencies:[...B,r],inline:q,strategy:se,middlewares:fe}),ke=bt({name:"Tooltip",props:n,classes:Xw,className:C,style:_,classNames:x,styles:E,unstyled:N,rootSelector:"tooltip",vars:X,varsResolver:Cse});if(!jc(r))throw new Error("[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const Oe=_n(Se.reference,Cw(r),t),Ce=gse(P,{duration:100,transition:"fade"}),Me=r.props;return p.jsxs(p.Fragment,{children:[p.jsx(cd,{...ne,withinPortal:m,children:p.jsx(Mc,{...Ce,keepMounted:W,mounted:!I&&!!Se.opened,duration:Se.isGroupPhase?10:Ce.duration,children:Ve=>p.jsxs(ze,{...he,"data-fixed":se==="fixed"||void 0,variant:k,mod:[{multiline:F},re],...Se.getFloatingProps({ref:Se.floating,className:ke("tooltip").className,style:{...ke("tooltip").style,...Ve,zIndex:H,top:Se.y??0,left:Se.x??0}}),children:[o,p.jsx(Jj,{ref:ve,arrowX:Se.arrowX,arrowY:Se.arrowY,visible:j,position:Se.placement,arrowSize:A,arrowOffset:$,arrowRadius:R,arrowPosition:M,...ke("arrow")})]})})}),w.cloneElement(r,Se.getReferenceProps({onClick:T,onMouseEnter:L,onMouseLeave:z,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,[i]:Oe,className:hn(C,Me.className),...Me}))]})});ud.classes=Xw;ud.displayName="@mantine/core/Tooltip";ud.Floating=jA;ud.Group=AA;var uL={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const Ose={withItemsBorders:!0},jse=(e,{radius:t,color:n,transitionDuration:r,size:s,transitionTimingFunction:i})=>({root:{"--sc-radius":t===void 0?void 0:Hn(t),"--sc-color":n?wr(n,e):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":i,"--sc-padding":Mt(s,"sc-padding"),"--sc-font-size":Br(s)}}),dd=qe((e,t)=>{var fe,he;const n=Pe("SegmentedControl",Ose,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,data:u,value:f,defaultValue:h,onChange:m,size:y,name:v,disabled:x,readOnly:E,fullWidth:N,orientation:_,radius:C,color:j,transitionDuration:A,transitionTimingFunction:$,variant:R,autoContrast:M,withItemsBorders:D,mod:P,...F}=n,V=bt({name:"SegmentedControl",props:n,classes:uL,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:jse}),H=As(),I=u.map(ue=>typeof ue=="string"?{label:ue,value:ue}:ue),B=mQ(),[T,L]=w.useState(null),[z,q]=w.useState({}),k=(ue,ve)=>{z[ve]=ue,q(z)},[W,X]=ss({value:f,defaultValue:h,finalValue:Array.isArray(u)?((fe=I.find(ue=>!ue.disabled))==null?void 0:fe.value)??((he=u[0])==null?void 0:he.value)??null:null,onChange:m}),ne=di(v),re=I.map(ue=>w.createElement(ze,{...V("control"),mod:{active:W===ue.value,orientation:_},key:ue.value},w.createElement("input",{...V("input"),disabled:x||ue.disabled,type:"radio",name:ne,value:ue.value,id:`${ne}-${ue.value}`,checked:W===ue.value,onChange:()=>!E&&X(ue.value),"data-focus-ring":H.focusRing,key:`${ue.value}-input`}),w.createElement(ze,{component:"label",...V("label"),mod:{active:W===ue.value&&!(x||ue.disabled),disabled:x||ue.disabled,"read-only":E},htmlFor:`${ne}-${ue.value}`,ref:ve=>k(ve,ue.value),__vars:{"--sc-label-color":j!==void 0?by({color:j,theme:H,autoContrast:M}):void 0},key:`${ue.value}-label`},p.jsx("span",{...V("innerLabel"),children:ue.label})))),se=_n(t,ue=>L(ue));return u.length===0?null:p.jsxs(ze,{...V("root"),variant:R,size:y,ref:se,mod:[{"full-width":N,orientation:_,initialized:B,"with-items-borders":D},P],...F,role:"radiogroup","data-disabled":x,children:[typeof W=="string"&&p.jsx(eA,{target:z[W],parent:T,component:"span",transitionDuration:"var(--sc-transition-duration)",...V("indicator")}),re]})});dd.classes=uL;dd.displayName="@mantine/core/SegmentedControl";const Ase={searchable:!1,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:"left"},Kw=qe((e,t)=>{const n=Pe("Select",Ase,e),{classNames:r,styles:s,unstyled:i,vars:o,dropdownOpened:a,defaultDropdownOpened:c,onDropdownClose:u,onDropdownOpen:f,onFocus:h,onBlur:m,onClick:y,onChange:v,data:x,value:E,defaultValue:N,selectFirstOptionOnChange:_,onOptionSubmit:C,comboboxProps:j,readOnly:A,disabled:$,filter:R,limit:M,withScrollArea:D,maxDropdownHeight:P,size:F,searchable:V,rightSection:H,checkIconPosition:I,withCheckIcon:B,nothingFoundMessage:T,name:L,form:z,searchValue:q,defaultSearchValue:k,onSearchChange:W,allowDeselect:X,error:ne,rightSectionPointerEvents:re,id:se,clearable:fe,clearButtonProps:he,hiddenInputProps:ue,renderOption:ve,onClear:Se,autoComplete:ke,scrollAreaProps:Oe,__defaultRightSection:Ce,__clearSection:Me,__clearable:Ve,chevronColor:We,...$e}=n,J=w.useMemo(()=>k7(x),[x]),te=w.useMemo(()=>tA(J),[J]),Q=di(se),[ye,ce,ae]=ss({value:E,defaultValue:N,finalValue:null,onChange:v}),ie=typeof ye=="string"?te[ye]:void 0,de=fQ(ie),[be,Ae]=ss({value:q,defaultValue:k,finalValue:ie?ie.label:"",onChange:W}),Ie=fA({opened:a,defaultOpened:c,onDropdownOpen:()=>{f==null||f(),Ie.updateSelectedOptionIndex("active",{scrollIntoView:!0})},onDropdownClose:()=>{u==null||u(),Ie.resetSelectedOption()}}),{resolvedClassNames:ht,resolvedStyles:Vt}=Yh({props:n,styles:s,classNames:r});w.useEffect(()=>{_&&Ie.selectFirstOption()},[_,ye]),w.useEffect(()=>{E===null&&Ae(""),typeof E=="string"&&ie&&((de==null?void 0:de.value)!==ie.value||(de==null?void 0:de.label)!==ie.label)&&Ae(ie.label)},[E,ie]);const _t=p.jsx(jt.ClearButton,{...he,onClear:()=>{ce(null,null),Ae(""),Se==null||Se()}}),no=fe&&!!ye&&!$&&!A;return p.jsxs(p.Fragment,{children:[p.jsxs(jt,{store:Ie,__staticSelector:"Select",classNames:ht,styles:Vt,unstyled:i,readOnly:A,onOptionSubmit:Ut=>{C==null||C(Ut);const Bt=X&&te[Ut].value===ye?null:te[Ut],Rs=Bt?Bt.value:null;Rs!==ye&&ce(Rs,Bt),!ae&&Ae(typeof Rs=="string"&&(Bt==null?void 0:Bt.label)||""),Ie.closeDropdown()},size:F,...j,children:[p.jsx(jt.Target,{targetType:V?"input":"button",autoComplete:ke,children:p.jsx(pi,{id:Q,ref:t,__defaultRightSection:p.jsx(jt.Chevron,{size:F,error:ne,unstyled:i,color:We}),__clearSection:_t,__clearable:no,rightSection:H,rightSectionPointerEvents:re||(no?"all":"none"),...$e,size:F,__staticSelector:"Select",disabled:$,readOnly:A||!V,value:be,onChange:Ut=>{Ae(Ut.currentTarget.value),Ie.openDropdown(),_&&Ie.selectFirstOption()},onFocus:Ut=>{V&&Ie.openDropdown(),h==null||h(Ut)},onBlur:Ut=>{var Bt;V&&Ie.closeDropdown(),Ae(ye!=null&&((Bt=te[ye])==null?void 0:Bt.label)||""),m==null||m(Ut)},onClick:Ut=>{V?Ie.openDropdown():Ie.toggleDropdown(),y==null||y(Ut)},classNames:ht,styles:Vt,unstyled:i,pointer:!V,error:ne})}),p.jsx(H7,{data:J,hidden:A||$,filter:R,search:be,limit:M,hiddenWhenEmpty:!T,withScrollArea:D,maxDropdownHeight:P,filterOptions:V&&(ie==null?void 0:ie.label)!==be,value:ye,checkIconPosition:I,withCheckIcon:B,nothingFoundMessage:T,unstyled:i,labelId:$e.label?`${Q}-label`:void 0,"aria-label":$e.label?void 0:$e["aria-label"],renderOption:ve,scrollAreaProps:Oe})]}),p.jsx(jt.HiddenInput,{value:ye,name:L,form:z,disabled:$,...ue})]})});Kw.classes={...pi.classes,...jt.classes};Kw.displayName="@mantine/core/Select";const[$se,Qw]=Ua("SliderProvider was not found in tree"),dL=w.forwardRef(({size:e,disabled:t,variant:n,color:r,thumbSize:s,radius:i,...o},a)=>{const{getStyles:c}=Qw();return p.jsx(ze,{tabIndex:-1,variant:n,size:e,ref:a,...c("root"),...o})});dL.displayName="@mantine/core/SliderRoot";const fL=w.forwardRef(({max:e,min:t,value:n,position:r,label:s,dragging:i,onMouseDown:o,onKeyDownCapture:a,labelTransitionProps:c,labelAlwaysOn:u,thumbLabel:f,onFocus:h,onBlur:m,showLabelOnHover:y,isHovered:v,children:x=null,disabled:E},N)=>{const{getStyles:_}=Qw(),[C,j]=w.useState(!1),A=u||i||C||y&&v;return p.jsxs(ze,{tabIndex:0,role:"slider","aria-label":f,"aria-valuemax":e,"aria-valuemin":t,"aria-valuenow":n,ref:N,__vars:{"--slider-thumb-offset":`${r}%`},..._("thumb",{focusable:!0}),mod:{dragging:i,disabled:E},onFocus:$=>{j(!0),typeof h=="function"&&h($)},onBlur:$=>{j(!1),typeof m=="function"&&m($)},onTouchStart:o,onMouseDown:o,onKeyDownCapture:a,onClick:$=>$.stopPropagation(),children:[x,p.jsx(Mc,{mounted:s!=null&&!!A,transition:"fade",duration:0,...c,children:$=>p.jsx("div",{..._("label",{style:$}),children:s})})]})});fL.displayName="@mantine/core/SliderThumb";function hL({value:e,min:t,max:n}){const r=(e-t)/(n-t)*100;return Math.min(Math.max(r,0),100)}function Tse({mark:e,offset:t,value:n,inverted:r=!1}){return r?typeof t=="number"&&e.value<=t||e.value>=n:typeof t=="number"?e.value>=t&&e.value<=n:e.value<=n}function pL({marks:e,min:t,max:n,disabled:r,value:s,offset:i,inverted:o}){const{getStyles:a}=Qw();if(!e)return null;const c=e.map((u,f)=>w.createElement(ze,{...a("markWrapper"),__vars:{"--mark-offset":`${hL({value:u.value,min:t,max:n})}%`},key:f},p.jsx(ze,{...a("mark"),mod:{filled:Tse({mark:u,value:s,offset:i,inverted:o}),disabled:r}}),u.label&&p.jsx("div",{...a("markLabel"),children:u.label})));return p.jsx("div",{children:c})}pL.displayName="@mantine/core/SliderMarks";function mL({filled:e,children:t,offset:n,disabled:r,marksOffset:s,inverted:i,containerProps:o,...a}){const{getStyles:c}=Qw();return p.jsx(ze,{...c("trackContainer"),mod:{disabled:r},...o,children:p.jsxs(ze,{...c("track"),mod:{inverted:i,disabled:r},children:[p.jsx(ze,{mod:{inverted:i,disabled:r},__vars:{"--slider-bar-width":`calc(${e}% + var(--slider-size))`,"--slider-bar-offset":`calc(${n}% - var(--slider-size))`},...c("bar")}),t,p.jsx(pL,{...a,offset:s,disabled:r,inverted:i})]})})}mL.displayName="@mantine/core/SliderTrack";function Rse({value:e,containerWidth:t,min:n,max:r,step:s,precision:i}){const a=(t?Math.min(Math.max(e,0),t)/t:e)*(r-n),c=(a!==0?Math.round(a/s)*s:0)+n,u=Math.max(c,n);return i!==void 0?Number(u.toFixed(i)):u}function Cb(e,t){return parseFloat(e.toFixed(t))}function Mse(e){if(!e)return 0;const t=e.toString().split(".");return t.length>1?t[1].length:0}function eN(e,t){const r=[...t].sort((s,i)=>s.value-i.value).find(s=>s.value>e);return r?r.value:e}function tN(e,t){const r=[...t].sort((s,i)=>i.value-s.value).find(s=>s.value<e);return r?r.value:e}function o6(e){const t=[...e].sort((n,r)=>n.value-r.value);return t.length>0?t[0].value:0}function a6(e){const t=[...e].sort((n,r)=>n.value-r.value);return t.length>0?t[t.length-1].value:100}var gL={root:"m_dd36362e",label:"m_c9357328",thumb:"m_c9a9a60a",trackContainer:"m_a8645c2",track:"m_c9ade57f",bar:"m_38aeed47",markWrapper:"m_b7b0423a",mark:"m_dd33bc19",markLabel:"m_68c77a5b"};const kse={radius:"xl",min:0,max:100,step:1,marks:[],label:e=>e,labelTransitionProps:{transition:"fade",duration:0},labelAlwaysOn:!1,thumbLabel:"",showLabelOnHover:!0,disabled:!1,scale:e=>e},Ise=(e,{size:t,color:n,thumbSize:r,radius:s})=>({root:{"--slider-size":Mt(t,"slider-size"),"--slider-color":n?wr(n,e):void 0,"--slider-radius":s===void 0?void 0:Hn(s),"--slider-thumb-size":r!==void 0?_e(r):"calc(var(--slider-size) * 2)"}}),$A=qe((e,t)=>{const n=Pe("Slider",kse,e),{classNames:r,styles:s,value:i,onChange:o,onChangeEnd:a,size:c,min:u,max:f,step:h,precision:m,defaultValue:y,name:v,marks:x,label:E,labelTransitionProps:N,labelAlwaysOn:_,thumbLabel:C,showLabelOnHover:j,thumbChildren:A,disabled:$,unstyled:R,scale:M,inverted:D,className:P,style:F,vars:V,hiddenInputProps:H,restrictToMarks:I,thumbProps:B,...T}=n,L=bt({name:"Slider",props:n,classes:gL,classNames:r,className:P,styles:s,style:F,vars:V,varsResolver:Ise,unstyled:R}),{dir:z}=Rc(),[q,k]=w.useState(!1),[W,X]=ss({value:typeof i=="number"?Sa(i,u,f):i,defaultValue:typeof y=="number"?Sa(y,u,f):y,finalValue:Sa(0,u,f),onChange:o}),ne=w.useRef(W),re=w.useRef(null),se=w.useRef(null),fe=hL({value:W,min:u,max:f}),he=M(W),ue=typeof E=="function"?E(he):E,ve=m??Mse(h),Se=w.useCallback(({x:Me})=>{if(!$){const Ve=Rse({value:Me,min:u,max:f,step:h,precision:ve});X(I&&(x!=null&&x.length)?mM(Ve,x.map(We=>We.value)):Ve),ne.current=Ve}},[$,u,f,h,ve,X,x,I]),{ref:ke,active:Oe}=iQ(Se,{onScrubEnd:()=>!$&&(a==null?void 0:a(I&&(x!=null&&x.length)?mM(ne.current,x.map(Me=>Me.value)):ne.current))},z),Ce=Me=>{var Ve,We,$e,J,te,Q;if(!$)switch(Me.key){case"ArrowUp":{if(Me.preventDefault(),(Ve=se.current)==null||Ve.focus(),I&&x){const ce=eN(W,x);X(ce),a==null||a(ce);break}const ye=Cb(Math.min(Math.max(W+h,u),f),ve);X(ye),a==null||a(ye);break}case"ArrowRight":{if(Me.preventDefault(),(We=se.current)==null||We.focus(),I&&x){const ce=z==="rtl"?tN(W,x):eN(W,x);X(ce),a==null||a(ce);break}const ye=Cb(Math.min(Math.max(z==="rtl"?W-h:W+h,u),f),ve);X(ye),a==null||a(ye);break}case"ArrowDown":{if(Me.preventDefault(),($e=se.current)==null||$e.focus(),I&&x){const ce=tN(W,x);X(ce),a==null||a(ce);break}const ye=Cb(Math.min(Math.max(W-h,u),f),ve);X(ye),a==null||a(ye);break}case"ArrowLeft":{if(Me.preventDefault(),(J=se.current)==null||J.focus(),I&&x){const ce=z==="rtl"?eN(W,x):tN(W,x);X(ce),a==null||a(ce);break}const ye=Cb(Math.min(Math.max(z==="rtl"?W+h:W-h,u),f),ve);X(ye),a==null||a(ye);break}case"Home":{if(Me.preventDefault(),(te=se.current)==null||te.focus(),I&&x){X(o6(x)),a==null||a(o6(x));break}X(u),a==null||a(u);break}case"End":{if(Me.preventDefault(),(Q=se.current)==null||Q.focus(),I&&x){X(a6(x)),a==null||a(a6(x));break}X(f),a==null||a(f);break}}};return p.jsx($se,{value:{getStyles:L},children:p.jsxs(dL,{...T,ref:_n(t,re),onKeyDownCapture:Ce,onMouseDownCapture:()=>{var Me;return(Me=re.current)==null?void 0:Me.focus()},size:c,disabled:$,children:[p.jsx(mL,{inverted:D,offset:0,filled:fe,marks:x,min:u,max:f,value:he,disabled:$,containerProps:{ref:ke,onMouseEnter:j?()=>k(!0):void 0,onMouseLeave:j?()=>k(!1):void 0},children:p.jsx(fL,{max:f,min:u,value:he,position:fe,dragging:Oe,label:ue,ref:se,labelTransitionProps:N,labelAlwaysOn:_,thumbLabel:C,showLabelOnHover:j,isHovered:q,disabled:$,...B,children:A})}),p.jsx("input",{type:"hidden",name:v,value:he,...H})]})})});$A.classes=gL;$A.displayName="@mantine/core/Slider";const yL=w.createContext(null),Dse=yL.Provider,Pse=()=>w.useContext(yL),Lse={},TA=qe((e,t)=>{const{value:n,defaultValue:r,onChange:s,size:i,wrapperProps:o,children:a,readOnly:c,...u}=Pe("SwitchGroup",Lse,e),[f,h]=ss({value:n,defaultValue:r,finalValue:[],onChange:s}),m=y=>{const v=y.currentTarget.value;!c&&h(f.includes(v)?f.filter(x=>x!==v):[...f,v])};return p.jsx(Dse,{value:{value:f,onChange:m,size:i},children:p.jsx(kt.Wrapper,{size:i,ref:t,...o,...u,labelElement:"div",__staticSelector:"SwitchGroup",children:p.jsx(z7,{role:"group",children:a})})})});TA.classes=kt.Wrapper.classes;TA.displayName="@mantine/core/SwitchGroup";var bL={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const Fse={labelPosition:"right"},Bse=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:Hn(t),"--switch-height":Mt(r,"switch-height"),"--switch-width":Mt(r,"switch-width"),"--switch-thumb-size":Mt(r,"switch-thumb-size"),"--switch-label-font-size":Mt(r,"switch-label-font-size"),"--switch-track-label-padding":Mt(r,"switch-track-label-padding"),"--switch-color":n?wr(n,e):void 0}}),Wa=qe((e,t)=>{const n=Pe("Switch",Fse,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,color:u,label:f,offLabel:h,onLabel:m,id:y,size:v,radius:x,wrapperProps:E,thumbIcon:N,checked:_,defaultChecked:C,onChange:j,labelPosition:A,description:$,error:R,disabled:M,variant:D,rootRef:P,mod:F,...V}=n,H=Pse(),I=v||(H==null?void 0:H.size),B=bt({name:"Switch",props:n,classes:bL,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:Bse}),{styleProps:T,rest:L}=Jh(V),z=di(y),q=H?{checked:H.value.includes(L.value),onChange:H.onChange}:{},[k,W]=ss({value:q.checked??_,defaultValue:C,finalValue:!1});return p.jsxs(hA,{...B("root"),__staticSelector:"Switch",__stylesApiProps:n,id:z,size:I,labelPosition:A,label:f,description:$,error:R,disabled:M,bodyElement:"label",labelElement:"span",classNames:r,styles:o,unstyled:a,"data-checked":q.checked||_||void 0,variant:D,ref:P,mod:F,...T,...E,children:[p.jsx("input",{...L,disabled:M,checked:k,"data-checked":q.checked||_||void 0,onChange:X=>{var ne;H?(ne=q.onChange)==null||ne.call(q,X):j==null||j(X),W(X.currentTarget.checked)},id:z,ref:t,type:"checkbox",role:"switch",...B("input")}),p.jsxs(ze,{"aria-hidden":"true",mod:{error:R,"label-position":A,"without-labels":!m&&!h},...B("track"),children:[p.jsx(ze,{component:"span",mod:"reduce-motion",...B("thumb"),children:N}),p.jsx("span",{...B("trackLabel"),children:k?m:h})]})]})});Wa.classes={...bL,...One};Wa.displayName="@mantine/core/Switch";Wa.Group=TA;const[zse,RA]=Ua("Tabs component was not found in the tree");var _y={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",panel:"m_b0c91715",tab:"m_4ec4dce6",tabSection:"m_fc420b1f","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const Vse={},MA=qe((e,t)=>{const n=Pe("TabsList",Vse,e),{children:r,className:s,grow:i,justify:o,classNames:a,styles:c,style:u,mod:f,...h}=n,m=RA();return p.jsx(ze,{...h,...m.getStyles("list",{className:s,style:u,classNames:a,styles:c,props:n,variant:m.variant}),ref:t,role:"tablist",variant:m.variant,mod:[{grow:i,orientation:m.orientation,placement:m.orientation==="vertical"&&m.placement,inverted:m.inverted},f],"aria-orientation":m.orientation,__vars:{"--tabs-justify":o},children:r})});MA.classes=_y;MA.displayName="@mantine/core/TabsList";const Use={},kA=qe((e,t)=>{const n=Pe("TabsPanel",Use,e),{children:r,className:s,value:i,classNames:o,styles:a,style:c,mod:u,keepMounted:f,...h}=n,m=RA(),y=m.value===i,v=m.keepMounted||f||y?r:null;return p.jsx(ze,{...h,...m.getStyles("panel",{className:s,classNames:o,styles:a,style:[c,y?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:m.orientation},u],role:"tabpanel",id:m.getPanelId(i),"aria-labelledby":m.getTabId(i),children:v})});kA.classes=_y;kA.displayName="@mantine/core/TabsPanel";const qse={},IA=qe((e,t)=>{const n=Pe("TabsTab",qse,e),{className:r,children:s,rightSection:i,leftSection:o,value:a,onClick:c,onKeyDown:u,disabled:f,color:h,style:m,classNames:y,styles:v,vars:x,mod:E,tabIndex:N,..._}=n,C=As(),{dir:j}=Rc(),A=RA(),$=a===A.value,R=D=>{A.onChange(A.allowTabDeactivation&&a===A.value?null:a),c==null||c(D)},M={classNames:y,styles:v,props:n};return p.jsxs(Ma,{..._,...A.getStyles("tab",{className:r,style:m,variant:A.variant,...M}),disabled:f,unstyled:A.unstyled,variant:A.variant,mod:[{active:$,disabled:f,orientation:A.orientation,inverted:A.inverted,placement:A.orientation==="vertical"&&A.placement},E],ref:t,role:"tab",id:A.getTabId(a),"aria-selected":$,tabIndex:N!==void 0?N:$||A.value===null?0:-1,"aria-controls":A.getPanelId(a),onClick:R,__vars:{"--tabs-color":h?wr(h,C):void 0},onKeyDown:d8({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:A.activateTabWithKeyboard,loop:A.loop,orientation:A.orientation||"horizontal",dir:j,onKeyDown:u}),children:[o&&p.jsx("span",{...A.getStyles("tabSection",M),"data-position":"left",children:o}),s&&p.jsx("span",{...A.getStyles("tabLabel",M),children:s}),i&&p.jsx("span",{...A.getStyles("tabSection",M),"data-position":"right",children:i})]})});IA.classes=_y;IA.displayName="@mantine/core/TabsTab";const l6="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",Hse={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},Wse=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":Hn(t),"--tabs-color":wr(n,e),"--tabs-text-color":Aj(r,e)?by({color:n,theme:e,autoContrast:r}):void 0}}),bn=qe((e,t)=>{const n=Pe("Tabs",Hse,e),{defaultValue:r,value:s,onChange:i,orientation:o,children:a,loop:c,id:u,activateTabWithKeyboard:f,allowTabDeactivation:h,variant:m,color:y,radius:v,inverted:x,placement:E,keepMounted:N,classNames:_,styles:C,unstyled:j,className:A,style:$,vars:R,autoContrast:M,mod:D,...P}=n,F=di(u),[V,H]=ss({value:s,defaultValue:r,finalValue:null,onChange:i}),I=bt({name:"Tabs",props:n,classes:_y,className:A,style:$,classNames:_,styles:C,unstyled:j,vars:R,varsResolver:Wse});return p.jsx(zse,{value:{placement:E,value:V,orientation:o,id:F,loop:c,activateTabWithKeyboard:f,getTabId:fM(`${F}-tab`,l6),getPanelId:fM(`${F}-panel`,l6),onChange:H,allowTabDeactivation:h,variant:m,color:y,radius:v,inverted:x,keepMounted:N,unstyled:j,getStyles:I},children:p.jsx(ze,{ref:t,id:F,variant:m,mod:[{orientation:o,inverted:o==="horizontal"&&x,placement:o==="vertical"&&E},D],...I("root"),...P,children:a})})});bn.classes=_y;bn.displayName="@mantine/core/Tabs";bn.Tab=IA;bn.Panel=kA;bn.List=MA;function Gse({data:e,value:t}){const n=t.map(s=>s.trim().toLowerCase());return e.reduce((s,i)=>(bh(i)?s.push({group:i.group,items:i.items.filter(o=>n.indexOf(o.label.toLowerCase().trim())===-1)}):n.indexOf(i.label.toLowerCase().trim())===-1&&s.push(i),s),[])}function Yse(e,t){return e?t.split(new RegExp(`[${e.join("")}]`)).map(n=>n.trim()).filter(n=>n!==""):[t]}function c6({splitChars:e,allowDuplicates:t,maxTags:n,value:r,currentTags:s}){const i=Yse(e,r),o=t?[...s,...i]:[...new Set([...s,...i])];return n?o.slice(0,n):o}const Jse={maxTags:1/0,allowDuplicates:!1,acceptValueOnBlur:!0,splitChars:[","],hiddenInputValuesDivider:","},DA=qe((e,t)=>{const n=Pe("TagsInput",Jse,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,size:u,value:f,defaultValue:h,onChange:m,onKeyDown:y,maxTags:v,allowDuplicates:x,onDuplicate:E,variant:N,data:_,dropdownOpened:C,defaultDropdownOpened:j,onDropdownOpen:A,onDropdownClose:$,selectFirstOptionOnChange:R,onOptionSubmit:M,comboboxProps:D,filter:P,limit:F,withScrollArea:V,maxDropdownHeight:H,searchValue:I,defaultSearchValue:B,onSearchChange:T,readOnly:L,disabled:z,splitChars:q,onFocus:k,onBlur:W,onPaste:X,radius:ne,rightSection:re,rightSectionWidth:se,rightSectionPointerEvents:fe,rightSectionProps:he,leftSection:ue,leftSectionWidth:ve,leftSectionPointerEvents:Se,leftSectionProps:ke,inputContainer:Oe,inputWrapperOrder:Ce,withAsterisk:Me,required:Ve,labelProps:We,descriptionProps:$e,errorProps:J,wrapperProps:te,description:Q,label:ye,error:ce,withErrorStyles:ae,name:ie,form:de,id:be,clearable:Ae,clearButtonProps:Ie,hiddenInputProps:ht,hiddenInputValuesDivider:Vt,mod:_t,renderOption:no,onRemove:Ut,onClear:Bt,scrollAreaProps:Rs,acceptValueOnBlur:Ms,...Gn}=n,zc=di(be),Od=k7(_),vp=tA(Od),Fo=w.useRef(null),nl=_n(Fo,t),Yn=fA({opened:C,defaultOpened:j,onDropdownOpen:A,onDropdownClose:()=>{$==null||$(),Yn.resetSelectedOption()}}),{styleProps:Bo,rest:{type:rl,autoComplete:xp,...jd}}=Jh(Gn),[dn,cs]=ss({value:f,defaultValue:h,finalValue:[],onChange:m}),[Er,ro]=ss({value:I,defaultValue:B,finalValue:"",onChange:T}),sl=bt({name:"TagsInput",classes:{},props:n,classNames:r,styles:o,unstyled:a}),{resolvedClassNames:Vc,resolvedStyles:Uc}=Yh({props:n,styles:o,classNames:r}),qc=dt=>{const Xn=dn.some(Is=>Is.toLowerCase()===dt.toLowerCase());Xn&&(E==null||E(dt)),(!Xn||Xn&&x)&&dn.length<v&&(M==null||M(dt),ro(""),dt.length>0&&cs([...dn,dt]))},wp=dt=>{if(y==null||y(dt),dt.isPropagationStopped())return;const Xn=Er.trim(),{length:Is}=Xn;if(q.includes(dt.key)&&Is>0&&(cs(c6({splitChars:q,allowDuplicates:x,maxTags:v,value:Er,currentTags:dn})),ro(""),dt.preventDefault()),dt.key==="Enter"&&Is>0&&!dt.nativeEvent.isComposing){if(dt.preventDefault(),!!document.querySelector(`#${Yn.listId} [data-combobox-option][data-combobox-selected]`))return;qc(Xn)}dt.key==="Backspace"&&Is===0&&dn.length>0&&!dt.nativeEvent.isComposing&&(Ut==null||Ut(dn[dn.length-1]),cs(dn.slice(0,dn.length-1)))},ks=dt=>{if(X==null||X(dt),dt.preventDefault(),dt.clipboardData){const Xn=dt.clipboardData.getData("text/plain");cs(c6({splitChars:q,allowDuplicates:x,maxTags:v,value:`${Er}${Xn}`,currentTags:dn})),ro("")}},Tn=dn.map((dt,Xn)=>p.jsx(yg,{withRemoveButton:!L,onRemove:()=>{const Is=dn.slice();Is.splice(Xn,1),cs(Is),Ut==null||Ut(dt)},unstyled:a,disabled:z,...sl("pill"),children:dt},`${dt}-${Xn}`));w.useEffect(()=>{R&&Yn.selectFirstOption()},[R,dn,Er]);const Jn=p.jsx(jt.ClearButton,{...Ie,onClear:()=>{var dt;cs([]),ro(""),(dt=Fo.current)==null||dt.focus(),Yn.openDropdown(),Bt==null||Bt()}});return p.jsxs(p.Fragment,{children:[p.jsxs(jt,{store:Yn,classNames:Vc,styles:Uc,unstyled:a,size:u,readOnly:L,__staticSelector:"TagsInput",onOptionSubmit:dt=>{M==null||M(dt),ro(""),dn.length<v&&cs([...dn,vp[dt].label]),Yn.resetSelectedOption()},...D,children:[p.jsx(jt.DropdownTarget,{children:p.jsx(Yv,{...Bo,__staticSelector:"TagsInput",classNames:Vc,styles:Uc,unstyled:a,size:u,className:s,style:i,variant:N,disabled:z,radius:ne,rightSection:re,__clearSection:Jn,__clearable:Ae&&dn.length>0&&!z&&!L,rightSectionWidth:se,rightSectionPointerEvents:fe,rightSectionProps:he,leftSection:ue,leftSectionWidth:ve,leftSectionPointerEvents:Se,leftSectionProps:ke,inputContainer:Oe,inputWrapperOrder:Ce,withAsterisk:Me,required:Ve,labelProps:We,descriptionProps:$e,errorProps:J,wrapperProps:te,description:Q,label:ye,error:ce,multiline:!0,withErrorStyles:ae,__stylesApiProps:{...n,multiline:!0},id:zc,mod:_t,children:p.jsxs(yg.Group,{disabled:z,unstyled:a,...sl("pillsList"),children:[Tn,p.jsx(jt.EventsTarget,{autoComplete:xp,children:p.jsx(Yv.Field,{...jd,ref:nl,...sl("inputField"),unstyled:a,onKeyDown:wp,onFocus:dt=>{k==null||k(dt),Yn.openDropdown()},onBlur:dt=>{W==null||W(dt),Ms&&qc(Er),Yn.closeDropdown()},onPaste:ks,value:Er,onChange:dt=>ro(dt.currentTarget.value),required:Ve&&dn.length===0,disabled:z,readOnly:L,id:zc})})]})})}),p.jsx(H7,{data:Gse({data:Od,value:dn}),hidden:L||z,filter:P,search:Er,limit:F,hiddenWhenEmpty:!0,withScrollArea:V,maxDropdownHeight:H,unstyled:a,labelId:ye?`${zc}-label`:void 0,"aria-label":ye?void 0:Gn["aria-label"],renderOption:no,scrollAreaProps:Rs})]}),p.jsx(jt.HiddenInput,{name:ie,form:de,value:dn,valuesDivider:Vt,disabled:z,...ht})]})});DA.classes={...pi.classes,...jt.classes};DA.displayName="@mantine/core/TagsInput";const Xse={},Nn=qe((e,t)=>{const n=Pe("TextInput",Xse,e);return p.jsx(pi,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});Nn.classes=pi.classes;Nn.displayName="@mantine/core/TextInput";function Kse(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(s){t=typeof s=="function"?s(t):s},setState(s){this.updateState(s),r.forEach(i=>i(t))},initialize(s){n||(t=s,n=!0)},subscribe(s){return r.add(s),()=>r.delete(s)}}}function Qse(e){return w.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}function Zse(e,t,n){const r=[],s=[],i={};for(const o of e){const a=o.position||t;i[a]=i[a]||0,i[a]+=1,i[a]<=n?s.push(o):r.push(o)}return{notifications:s,queue:r}}const eie=()=>Kse({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),fd=eie(),tie=(e=fd)=>Qse(e);function rp(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]),s=Zse(r,n.defaultPosition,n.limit);e.setState({notifications:s.notifications,queue:s.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function nie(e,t=fd){const n=e.id||Bf();return rp(t,r=>e.id&&r.some(s=>s.id===e.id)?r:[...r,{...e,id:n}]),n}function vL(e,t=fd){return rp(t,n=>n.filter(r=>{var s;return r.id===e?((s=r.onClose)==null||s.call(r,r),!1):!0})),e}function rie(e,t=fd){return rp(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function sie(e=fd){rp(e,()=>[])}function iie(e=fd){rp(e,t=>t.slice(0,e.getState().limit))}const vc={show:nie,hide:vL,update:rie,clean:sie,cleanQueue:iie,updateState:rp};function nC(e,t){return nC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nC(e,t)}function xL(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,nC(e,t)}const u6={disabled:!1},Jv=Re.createContext(null);var oie=function(t){return t.scrollTop},Pm="unmounted",mu="exited",gu="entering",_f="entered",rC="exiting",Ga=function(e){xL(t,e);function t(r,s){var i;i=e.call(this,r,s)||this;var o=s,a=o&&!o.isMounting?r.enter:r.appear,c;return i.appearStatus=null,r.in?a?(c=mu,i.appearStatus=gu):c=_f:r.unmountOnExit||r.mountOnEnter?c=Pm:c=mu,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(s,i){var o=s.in;return o&&i.status===Pm?{status:mu}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(s){var i=null;if(s!==this.props){var o=this.state.status;this.props.in?o!==gu&&o!==_f&&(i=gu):(o===gu||o===_f)&&(i=rC)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var s=this.props.timeout,i,o,a;return i=o=a=s,s!=null&&typeof s!="number"&&(i=s.exit,o=s.enter,a=s.appear!==void 0?s.appear:o),{exit:i,enter:o,appear:a}},n.updateStatus=function(s,i){if(s===void 0&&(s=!1),i!==null)if(this.cancelNextCallback(),i===gu){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:Rf.findDOMNode(this);o&&oie(o)}this.performEnter(s)}else this.performExit();else this.props.unmountOnExit&&this.state.status===mu&&this.setState({status:Pm})},n.performEnter=function(s){var i=this,o=this.props.enter,a=this.context?this.context.isMounting:s,c=this.props.nodeRef?[a]:[Rf.findDOMNode(this),a],u=c[0],f=c[1],h=this.getTimeouts(),m=a?h.appear:h.enter;if(!s&&!o||u6.disabled){this.safeSetState({status:_f},function(){i.props.onEntered(u)});return}this.props.onEnter(u,f),this.safeSetState({status:gu},function(){i.props.onEntering(u,f),i.onTransitionEnd(m,function(){i.safeSetState({status:_f},function(){i.props.onEntered(u,f)})})})},n.performExit=function(){var s=this,i=this.props.exit,o=this.getTimeouts(),a=this.props.nodeRef?void 0:Rf.findDOMNode(this);if(!i||u6.disabled){this.safeSetState({status:mu},function(){s.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:rC},function(){s.props.onExiting(a),s.onTransitionEnd(o.exit,function(){s.safeSetState({status:mu},function(){s.props.onExited(a)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(s,i){i=this.setNextCallback(i),this.setState(s,i)},n.setNextCallback=function(s){var i=this,o=!0;return this.nextCallback=function(a){o&&(o=!1,i.nextCallback=null,s(a))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},n.onTransitionEnd=function(s,i){this.setNextCallback(i);var o=this.props.nodeRef?this.props.nodeRef.current:Rf.findDOMNode(this),a=s==null&&!this.props.addEndListener;if(!o||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],u=c[0],f=c[1];this.props.addEndListener(u,f)}s!=null&&setTimeout(this.nextCallback,s)},n.render=function(){var s=this.state.status;if(s===Pm)return null;var i=this.props,o=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=gA(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Re.createElement(Jv.Provider,{value:null},typeof o=="function"?o(s,a):Re.cloneElement(Re.Children.only(o),a))},t}(Re.Component);Ga.contextType=Jv;Ga.propTypes={};function yf(){}Ga.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:yf,onEntering:yf,onEntered:yf,onExit:yf,onExiting:yf,onExited:yf};Ga.UNMOUNTED=Pm;Ga.EXITED=mu;Ga.ENTERING=gu;Ga.ENTERED=_f;Ga.EXITING=rC;function aie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PA(e,t){var n=function(i){return t&&w.isValidElement(i)?t(i):i},r=Object.create(null);return e&&w.Children.map(e,function(s){return s}).forEach(function(s){r[s.key]=n(s)}),r}function lie(e,t){e=e||{},t=t||{};function n(f){return f in t?t[f]:e[f]}var r=Object.create(null),s=[];for(var i in e)i in t?s.length&&(r[i]=s,s=[]):s.push(i);var o,a={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var u=r[c][o];a[r[c][o]]=n(u)}a[c]=n(c)}for(o=0;o<s.length;o++)a[s[o]]=n(s[o]);return a}function Ou(e,t,n){return n[t]!=null?n[t]:e.props[t]}function cie(e,t){return PA(e.children,function(n){return w.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Ou(n,"appear",e),enter:Ou(n,"enter",e),exit:Ou(n,"exit",e)})})}function uie(e,t,n){var r=PA(e.children),s=lie(t,r);return Object.keys(s).forEach(function(i){var o=s[i];if(w.isValidElement(o)){var a=i in t,c=i in r,u=t[i],f=w.isValidElement(u)&&!u.props.in;c&&(!a||f)?s[i]=w.cloneElement(o,{onExited:n.bind(null,o),in:!0,exit:Ou(o,"exit",e),enter:Ou(o,"enter",e)}):!c&&a&&!f?s[i]=w.cloneElement(o,{in:!1}):c&&a&&w.isValidElement(u)&&(s[i]=w.cloneElement(o,{onExited:n.bind(null,o),in:u.props.in,exit:Ou(o,"exit",e),enter:Ou(o,"enter",e)}))}}),s}var die=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},fie={component:"div",childFactory:function(t){return t}},zl=function(e){xL(t,e);function t(r,s){var i;i=e.call(this,r,s)||this;var o=i.handleExited.bind(aie(i));return i.state={contextValue:{isMounting:!0},handleExited:o,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(s,i){var o=i.children,a=i.handleExited,c=i.firstRender;return{children:c?cie(s,a):uie(s,o,a),firstRender:!1}},n.handleExited=function(s,i){var o=PA(this.props.children);s.key in o||(s.props.onExited&&s.props.onExited(i),this.mounted&&this.setState(function(a){var c=vh({},a.children);return delete c[s.key],{children:c}}))},n.render=function(){var s=this.props,i=s.component,o=s.childFactory,a=gA(s,["component","childFactory"]),c=this.state.contextValue,u=die(this.state.children).map(o);return delete a.appear,delete a.enter,delete a.exit,i===null?Re.createElement(Jv.Provider,{value:c},u):Re.createElement(Jv.Provider,{value:c},Re.createElement(i,a,u))},t}(Re.Component);zl.propTypes={};zl.defaultProps=fie;const wL=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"];function hie(e,t){return e.reduce((n,r)=>(n[r.position||t].push(r),n),wL.reduce((n,r)=>(n[r]=[],n),{}))}const d6={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},pie={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function mie({state:e,maxHeight:t,position:n,transitionDuration:r}){const[s,i]=n.split("-"),o=i==="center"?`${s}-center`:i,a={opacity:0,maxHeight:t,transform:d6[o],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},c={opacity:1,transform:pie[o]},u={opacity:0,maxHeight:0,transform:d6[o]};return{...a,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function gie(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const SL=w.forwardRef(({data:e,onHide:t,autoClose:n,...r},s)=>{const{autoClose:i,message:o,...a}=e,c=gie(n,e.autoClose),u=w.useRef(-1),f=()=>window.clearTimeout(u.current),h=()=>{t(e.id),f()},m=()=>{typeof c=="number"&&(u.current=window.setTimeout(h,c))};return w.useEffect(()=>{var y;(y=e.onOpen)==null||y.call(e,e)},[]),w.useEffect(()=>(m(),f),[c]),p.jsx(NA,{...r,...a,onClose:h,ref:s,onMouseEnter:f,onMouseLeave:m,children:o})});SL.displayName="@mantine/notifications/NotificationContainer";var EL={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const yie=Ga,bie={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:Qi("overlay"),store:fd,withinPortal:!0},vie=(e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t==null?void 0:t.toString(),"--notifications-container-width":_e(n)}}),Mo=qe((e,t)=>{const n=Pe("Notifications",bie,e),{classNames:r,className:s,style:i,styles:o,unstyled:a,vars:c,position:u,autoClose:f,transitionDuration:h,containerWidth:m,notificationMaxHeight:y,limit:v,zIndex:x,store:E,portalProps:N,withinPortal:_,...C}=n,j=As(),A=tie(E),$=tQ(),R=Ej(),M=w.useRef({}),D=w.useRef(0),F=(j.respectReducedMotion?R:!1)?1:h,V=bt({name:"Notifications",classes:EL,props:n,className:s,style:i,classNames:r,styles:o,unstyled:a,vars:c,varsResolver:vie});w.useEffect(()=>{E==null||E.updateState(B=>({...B,limit:v||5,defaultPosition:u}))},[v,u]),Ra(()=>{A.notifications.length>D.current&&setTimeout(()=>$(),0),D.current=A.notifications.length},[A.notifications]);const H=hie(A.notifications,u),I=wL.reduce((B,T)=>(B[T]=H[T].map(({style:L,...z})=>p.jsx(yie,{timeout:F,onEnter:()=>M.current[z.id].offsetHeight,nodeRef:{current:M.current[z.id]},children:q=>p.jsx(SL,{ref:k=>{M.current[z.id]=k},data:z,onHide:k=>vL(k,E),autoClose:f,...V("notification",{style:{...mie({state:q,position:T,transitionDuration:F,maxHeight:y}),...L}})})},z.id)),B),{});return p.jsxs(cd,{withinPortal:_,...N,children:[p.jsx(ze,{...V("root"),"data-position":"top-center",ref:t,...C,children:p.jsx(zl,{children:I["top-center"]})}),p.jsx(ze,{...V("root"),"data-position":"top-left",...C,children:p.jsx(zl,{children:I["top-left"]})}),p.jsx(ze,{...V("root",{className:Bv.classNames.fullWidth}),"data-position":"top-right",...C,children:p.jsx(zl,{children:I["top-right"]})}),p.jsx(ze,{...V("root",{className:Bv.classNames.fullWidth}),"data-position":"bottom-right",...C,children:p.jsx(zl,{children:I["bottom-right"]})}),p.jsx(ze,{...V("root"),"data-position":"bottom-left",...C,children:p.jsx(zl,{children:I["bottom-left"]})}),p.jsx(ze,{...V("root"),"data-position":"bottom-center",...C,children:p.jsx(zl,{children:I["bottom-center"]})})]})});Mo.classes=EL;Mo.displayName="@mantine/notifications/Notifications";Mo.show=vc.show;Mo.hide=vc.hide;Mo.update=vc.update;Mo.clean=vc.clean;Mo.cleanQueue=vc.cleanQueue;Mo.updateState=vc.updateState;var pv={exports:{}},xie=pv.exports,f6;function wie(){return f6||(f6=1,function(e,t){(function(n,r){e.exports=r()})(xie,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",c="hour",u="day",f="week",h="month",m="quarter",y="year",v="date",x="Invalid Date",E=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var B=["th","st","nd","rd"],T=I%100;return"["+I+(B[(T-20)%10]||B[T]||B[0])+"]"}},C=function(I,B,T){var L=String(I);return!L||L.length>=B?I:""+Array(B+1-L.length).join(T)+I},j={s:C,z:function(I){var B=-I.utcOffset(),T=Math.abs(B),L=Math.floor(T/60),z=T%60;return(B<=0?"+":"-")+C(L,2,"0")+":"+C(z,2,"0")},m:function I(B,T){if(B.date()<T.date())return-I(T,B);var L=12*(T.year()-B.year())+(T.month()-B.month()),z=B.clone().add(L,h),q=T-z<0,k=B.clone().add(L+(q?-1:1),h);return+(-(L+(T-z)/(q?z-k:k-z))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:h,y,w:f,d:u,D:v,h:c,m:a,s:o,ms:i,Q:m}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},A="en",$={};$[A]=_;var R="$isDayjsObject",M=function(I){return I instanceof V||!(!I||!I[R])},D=function I(B,T,L){var z;if(!B)return A;if(typeof B=="string"){var q=B.toLowerCase();$[q]&&(z=q),T&&($[q]=T,z=q);var k=B.split("-");if(!z&&k.length>1)return I(k[0])}else{var W=B.name;$[W]=B,z=W}return!L&&z&&(A=z),z||!L&&A},P=function(I,B){if(M(I))return I.clone();var T=typeof B=="object"?B:{};return T.date=I,T.args=arguments,new V(T)},F=j;F.l=D,F.i=M,F.w=function(I,B){return P(I,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var V=function(){function I(T){this.$L=D(T.locale,null,!0),this.parse(T),this.$x=this.$x||T.x||{},this[R]=!0}var B=I.prototype;return B.parse=function(T){this.$d=function(L){var z=L.date,q=L.utc;if(z===null)return new Date(NaN);if(F.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var k=z.match(E);if(k){var W=k[2]-1||0,X=(k[7]||"0").substring(0,3);return q?new Date(Date.UTC(k[1],W,k[3]||1,k[4]||0,k[5]||0,k[6]||0,X)):new Date(k[1],W,k[3]||1,k[4]||0,k[5]||0,k[6]||0,X)}}return new Date(z)}(T),this.init()},B.init=function(){var T=this.$d;this.$y=T.getFullYear(),this.$M=T.getMonth(),this.$D=T.getDate(),this.$W=T.getDay(),this.$H=T.getHours(),this.$m=T.getMinutes(),this.$s=T.getSeconds(),this.$ms=T.getMilliseconds()},B.$utils=function(){return F},B.isValid=function(){return this.$d.toString()!==x},B.isSame=function(T,L){var z=P(T);return this.startOf(L)<=z&&z<=this.endOf(L)},B.isAfter=function(T,L){return P(T)<this.startOf(L)},B.isBefore=function(T,L){return this.endOf(L)<P(T)},B.$g=function(T,L,z){return F.u(T)?this[L]:this.set(z,T)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(T,L){var z=this,q=!!F.u(L)||L,k=F.p(T),W=function(ve,Se){var ke=F.w(z.$u?Date.UTC(z.$y,Se,ve):new Date(z.$y,Se,ve),z);return q?ke:ke.endOf(u)},X=function(ve,Se){return F.w(z.toDate()[ve].apply(z.toDate("s"),(q?[0,0,0,0]:[23,59,59,999]).slice(Se)),z)},ne=this.$W,re=this.$M,se=this.$D,fe="set"+(this.$u?"UTC":"");switch(k){case y:return q?W(1,0):W(31,11);case h:return q?W(1,re):W(0,re+1);case f:var he=this.$locale().weekStart||0,ue=(ne<he?ne+7:ne)-he;return W(q?se-ue:se+(6-ue),re);case u:case v:return X(fe+"Hours",0);case c:return X(fe+"Minutes",1);case a:return X(fe+"Seconds",2);case o:return X(fe+"Milliseconds",3);default:return this.clone()}},B.endOf=function(T){return this.startOf(T,!1)},B.$set=function(T,L){var z,q=F.p(T),k="set"+(this.$u?"UTC":""),W=(z={},z[u]=k+"Date",z[v]=k+"Date",z[h]=k+"Month",z[y]=k+"FullYear",z[c]=k+"Hours",z[a]=k+"Minutes",z[o]=k+"Seconds",z[i]=k+"Milliseconds",z)[q],X=q===u?this.$D+(L-this.$W):L;if(q===h||q===y){var ne=this.clone().set(v,1);ne.$d[W](X),ne.init(),this.$d=ne.set(v,Math.min(this.$D,ne.daysInMonth())).$d}else W&&this.$d[W](X);return this.init(),this},B.set=function(T,L){return this.clone().$set(T,L)},B.get=function(T){return this[F.p(T)]()},B.add=function(T,L){var z,q=this;T=Number(T);var k=F.p(L),W=function(re){var se=P(q);return F.w(se.date(se.date()+Math.round(re*T)),q)};if(k===h)return this.set(h,this.$M+T);if(k===y)return this.set(y,this.$y+T);if(k===u)return W(1);if(k===f)return W(7);var X=(z={},z[a]=r,z[c]=s,z[o]=n,z)[k]||1,ne=this.$d.getTime()+T*X;return F.w(ne,this)},B.subtract=function(T,L){return this.add(-1*T,L)},B.format=function(T){var L=this,z=this.$locale();if(!this.isValid())return z.invalidDate||x;var q=T||"YYYY-MM-DDTHH:mm:ssZ",k=F.z(this),W=this.$H,X=this.$m,ne=this.$M,re=z.weekdays,se=z.months,fe=z.meridiem,he=function(Se,ke,Oe,Ce){return Se&&(Se[ke]||Se(L,q))||Oe[ke].slice(0,Ce)},ue=function(Se){return F.s(W%12||12,Se,"0")},ve=fe||function(Se,ke,Oe){var Ce=Se<12?"AM":"PM";return Oe?Ce.toLowerCase():Ce};return q.replace(N,function(Se,ke){return ke||function(Oe){switch(Oe){case"YY":return String(L.$y).slice(-2);case"YYYY":return F.s(L.$y,4,"0");case"M":return ne+1;case"MM":return F.s(ne+1,2,"0");case"MMM":return he(z.monthsShort,ne,se,3);case"MMMM":return he(se,ne);case"D":return L.$D;case"DD":return F.s(L.$D,2,"0");case"d":return String(L.$W);case"dd":return he(z.weekdaysMin,L.$W,re,2);case"ddd":return he(z.weekdaysShort,L.$W,re,3);case"dddd":return re[L.$W];case"H":return String(W);case"HH":return F.s(W,2,"0");case"h":return ue(1);case"hh":return ue(2);case"a":return ve(W,X,!0);case"A":return ve(W,X,!1);case"m":return String(X);case"mm":return F.s(X,2,"0");case"s":return String(L.$s);case"ss":return F.s(L.$s,2,"0");case"SSS":return F.s(L.$ms,3,"0");case"Z":return k}return null}(Se)||k.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(T,L,z){var q,k=this,W=F.p(L),X=P(T),ne=(X.utcOffset()-this.utcOffset())*r,re=this-X,se=function(){return F.m(k,X)};switch(W){case y:q=se()/12;break;case h:q=se();break;case m:q=se()/3;break;case f:q=(re-ne)/6048e5;break;case u:q=(re-ne)/864e5;break;case c:q=re/s;break;case a:q=re/r;break;case o:q=re/n;break;default:q=re}return z?q:F.a(q)},B.daysInMonth=function(){return this.endOf(h).$D},B.$locale=function(){return $[this.$L]},B.locale=function(T,L){if(!T)return this.$L;var z=this.clone(),q=D(T,L,!0);return q&&(z.$L=q),z},B.clone=function(){return F.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},I}(),H=V.prototype;return P.prototype=H,[["$ms",i],["$s",o],["$m",a],["$H",c],["$W",u],["$M",h],["$y",y],["$D",v]].forEach(function(I){H[I[1]]=function(B){return this.$g(B,I[0],I[1])}}),P.extend=function(I,B){return I.$i||(I(B,V,P),I.$i=!0),P},P.locale=D,P.isDayjs=M,P.unix=function(I){return P(1e3*I)},P.en=$[A],P.Ls=$,P.p={},P})}(pv)),pv.exports}var Sie=wie();const Xv=Ki(Sie);var mv={exports:{}},Eie=mv.exports,h6;function Nie(){return h6||(h6=1,function(e,t){(function(n,r){e.exports=r()})(Eie,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(f.isBefore(h))return 1}var m=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),y=this.diff(m,n,!0);return y<0?o(this).startOf("week").week():Math.ceil(y)},a.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})}(mv)),mv.exports}var _ie=Nie();const Cie=Ki(_ie);Xv.extend(Cie);function NL(e){return Xv(e).format("YYYY-MM-DD HH:mm:ss")}var Ob={exports:{}},p6;function Oie(){if(p6)return Ob.exports;p6=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return Ob.exports=t(),Ob.exports.createColors=t,Ob.exports}var jie=Oie();const Gs=Ki(jie);var Aie={};const sC=(e,t)=>typeof e=="string"?[1,"1","true"].includes(e):!!(e||t);function qr(){try{return sC(0)}catch{return!1}}function $ie(){try{return"0.16.0"}catch{return"0.0.0"}}const Tie={cli_log_level:{key:"BKND_CLI_LOG_LEVEL",validate:e=>{if(typeof e=="string"&&["log","info","warn","error","debug"].includes(e.toLowerCase()))return e.toLowerCase()}},cli_create_ref:{key:"BKND_CLI_CREATE_REF",validate:e=>typeof e=="string"?e:void 0},cli_telemetry:{key:"BKND_CLI_TELEMETRY",validate:e=>{if(!(typeof e>"u"))return sC(e,!0)}},modules_debug:{key:"BKND_MODULES_DEBUG",validate:sC}},_L=(e,t,n)=>{var r,s;try{const i=(n==null?void 0:n.source)??Aie,o=Tie[e],a=i[o.key],c=o.validate(a);if(typeof c<"u")return(r=n==null?void 0:n.onValid)==null||r.call(n,c),c;(s=n==null?void 0:n.onFallback)==null||s.call(n,a)}catch{}return t};function Rie(){try{const e=process||{},t=e.argv||[],n=e.env||{};return!(n.NO_COLOR||t.includes("--no-color"))&&(!!n.FORCE_COLOR||t.includes("--color")||e.platform==="win32"||(e.stdout||{}).isTTY&&n.TERM!=="dumb"||!!n.CI)}catch{return!1}}const LA={critical:{prefix:"CRT",color:Gs.red,args_color:Gs.red,original:console.error},error:{prefix:"ERR",color:Gs.red,args_color:Gs.red,original:console.error},warn:{prefix:"WRN",color:Gs.yellow,args_color:Gs.yellow,original:console.warn},info:{prefix:"INF",color:Gs.cyan,original:console.info},log:{prefix:"LOG",color:Gs.dim,args_color:Gs.dim,original:console.log},debug:{prefix:"DBG",color:Gs.yellow,args_color:Gs.dim,original:console.debug}};function Mie(e,t){const n=Rie(),r=LA[e],s=r.color(`[${r.prefix}]`),i=t.map(o=>"args_color"in r&&n&&typeof o=="string"?r.args_color(o):o);return r.original(s,Gs.gray(NL()),...i)}const CL=_L("cli_log_level","log"),jb=globalThis.__consoleConfig??(globalThis.__consoleConfig={level:CL}),m6=Object.keys(LA),pt=new Proxy(jb,{get:(e,t)=>{switch(t){case"original":return console;case"setLevel":return s=>{jb.level=s};case"resetLevel":return()=>{jb.level=CL}}const n=m6.indexOf(jb.level),r=m6.indexOf(t);return t in LA&&r<=n?(...s)=>Mie(t,s):()=>null}});function kie(){return(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))!==-1?"Opera":navigator.userAgent.indexOf("Edg")!==-1?"Edge":navigator.userAgent.indexOf("Chrome")!==-1?"Chrome":navigator.userAgent.indexOf("Safari")!==-1?"Safari":navigator.userAgent.indexOf("Firefox")!==-1?"Firefox":navigator.userAgent.indexOf("MSIE")!==-1||document.documentMode?"IE":"unknown"}function ii(e){return!e||e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function Iie(e,t=" "){return!e||e.length===0?e:e.split(t).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(t)}function OL(e,t=!1){const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+(t?"!@#$%^&*()_+{}:\"<>?|[];',./`~":"");let i="";for(let o=0;o<e;o++)i+=s[Math.floor(Math.random()*s.length)];return i}function xh(e){return!e||e.length===0?e:e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function iC(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Die(e){return/^[a-z]+(_[a-z]+)*$/.test(e)?"snake_case":/^[A-Z][a-zA-Z]*$/.test(e)?"PascalCase":/^[a-z][a-zA-Z]*$/.test(e)?"camelCase":/^[a-z]+(-[a-z]+)*$/.test(e)?"kebab-case":/^[A-Z]+(_[A-Z]+)*$/.test(e)?"SCREAMING_SNAKE_CASE":"unknown"}function Pie(e){switch(Die(e)){case"snake_case":return xh(e);case"PascalCase":return nN(iC(e));case"camelCase":return ii(nN(iC(e)));case"kebab-case":return nN(e);case"SCREAMING_SNAKE_CASE":return xh(e.toLowerCase());case"unknown":return ii(e)}}function wh(e){return Pie(e)}function nN(e){return e.split("-").map(ii).join(" ")}function Cy(e,t=" "){return Iie(xh(e),t)}function Lie(e,t){return t instanceof RegExp?t.test(e):typeof t=="string"&&t.startsWith("/")?new RegExp(t).test(e):typeof t=="string"?e.startsWith(t):!1}function Fie(e,t=50,n="..."){return e.length<=t?e:e.substring(0,t)+n}function FA(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sh(e){return e!==null&&typeof e=="object"}function Cs(e,t){const n=new Set(t),r={};for(const[s,i]of Object.entries(e))n.has(s)||(r[s]=i);return r}function oC(e,t=[]){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(n=>oC(n,t)):Object.keys(e).reduce((n,r)=>{const s=t.includes(r)?r:iC(r);return n[s]=oC(e[r],t),n},{})}function jL(e,t){const n={};for(const r in e)t.some(i=>r.includes(i))||(typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])?n[r]=jL(e[r],t):n[r]=e[r]);return n}function sn(e,t){const n={};for(const[r,s]of Object.entries(e)){const i=t(s,r);typeof i<"u"&&(n[r]=i)}return n}const Zw=sn;function AL(e,t=""){let n=[];for(const r in e){const s=t?`${t}.${r}`:r;n.push(s),typeof e[r]=="object"&&e[r]!==null&&(n=n.concat(AL(e[r],s)))}return n}function $L(e){let t=1;for(const n in e)if(typeof e[n]=="object"){const r=$L(e[n])+1;t=Math.max(r,t)}return t}function xg(e){return e&&Object.entries(e).reduce((t,[n,r])=>{if(r&&Array.isArray(r)&&r.some(s=>typeof s=="object")){const s=r.map(xg);s.length>0&&(t[n]=s)}else if(r&&typeof r=="object"&&!Array.isArray(r)){const s=xg(r);Object.keys(s).length>0&&(t[n]=s)}else r!==""&&r!==null&&r!==void 0&&(t[n]=r);return t},{})}function TL(e,...t){for(const n of t)for(const[r,s]of Object.entries(n))s!==void 0&&(!FA(s)&&!Array.isArray(s)||Array.isArray(s)&&!Array.isArray(e[r])?e[r]=s:Sh(e[r])?TL(e[r],s):e[r]=s);return e}function RL(e,t,n){for(const[r,s]of Object.entries(t)){const i=n(e[r],s,r,e,t);if(i!==void 0){e[r]=i;continue}s!==void 0&&(!FA(s)&&!Array.isArray(s)||Array.isArray(s)&&!Array.isArray(e[r])?e[r]=s:Sh(e[r])?RL(e[r],s,n):e[r]=s)}return e}function Ca(e,t){const n=s=>{var i;if(s!==Object(s))return"primitive";if(Array.isArray(s))return"array";if(s instanceof Map)return"map";if(s!=null&&[null,Object.prototype].includes(Object.getPrototypeOf(s)))return"plainObject";if(s instanceof Function)return"function";throw new Error(`deeply comparing an instance of type ${(i=e.constructor)==null?void 0:i.name} is not supported.`)},r=n(e);if(r!==n(t))return!1;if(r==="primitive")return e===t||Number.isNaN(e)&&Number.isNaN(t);if(r==="array")return e.length===t.length&&e.every((s,i)=>Ca(s,t[i]));if(r==="map")return e.size===t.size&&[...e].every(([s,i])=>t.has(s)&&Ca(i,t.get(s)));if(r==="plainObject"){const s=new Map(Object.entries(e)),i=new Map(Object.entries(t));return s.size===i.size&&[...s].every(([o,a])=>i.has(o)&&Ca(a,i.get(o)))}else{if(r==="function")return e.toString()===t.toString();throw new Error("Unreachable")}}function BA(e,t,n=void 0){const r=typeof t=="string"?t.split(/[.\[\]\"]+/).filter(s=>s):t;if(r.length===0)return e;try{const[s,...i]=r;return!s||!(s in e)?n:BA(e[s],i,n)}catch{if(typeof n<"u")return n;throw new Error(`Invalid path: ${r.join(".")}`)}}function aC(e,t=0,n=0){const r=t?`
`:"",s=c=>t?" ".repeat(t*c):"",i=s(n+1),o=s(n);if(e===null)return"null";if(e===void 0)return"undefined";const a=typeof e;if(a==="string")return JSON.stringify(e);if(a==="number"||a==="boolean")return String(e);if(Array.isArray(e)){const c=e.map(u=>aC(u,t,n+1)).join(", "+(t?r+i:""));return"["+(t&&e.length?r+i:"")+c+(t&&e.length?r+o:"")+"]"}if(a==="object"){const c=Object.entries(e).map(([f,h])=>(/^[A-Za-z_$][\w$]*$/.test(f)?f:JSON.stringify(f))+": "+aC(h,t,n+1)),u=c.join(", "+(t?r+i:""));return"{"+(t&&c.length?r+i:"")+u+(t&&c.length?r+o:"")+"}"}throw new TypeError(`Unsupported data type: ${a}`)}function ML(e,t){return t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function Cf(e){if(Object.isFrozen(e))return e;const t=Reflect.ownKeys(e);for(const n of t){const r=e[n];(r&&typeof r=="object"||typeof r=="function")&&Cf(r)}return Object.freeze(e)}const zA={video:["mp4","webm"],audio:["ogg"],image:["jpeg","png","gif","webp","bmp","tiff","avif","heic","heif"],text:["html","css","mdx","yaml","vcard","csv","vtt"],application:["zip","xml","toml","json","json5"],font:["woff","woff2","ttf","otf"]},gt={vnd:"vnd.openxmlformats-officedocument",z:"application/x-7z-compressed",t:(e="plain")=>`text/${e}`,a:(e="octet-stream")=>`application/${e}`,i:e=>`image/${e}`,v:e=>`video/${e}`},VA=new Map([["7z",gt.z],["7zip",gt.z],["ai",gt.a("pdf")],["apk",gt.a("vnd.android.package-archive")],["doc",gt.a("msword")],["docx",`${gt.vnd}.wordprocessingml.document`],["eps",gt.a("postscript")],["epub",gt.a("epub+zip")],["ini",gt.t()],["ico",gt.i("vnd.microsoft.icon")],["jar",gt.a("java-archive")],["jsonld",gt.a("ld+json")],["jpg",gt.i("jpeg")],["js",gt.t("javascript")],["log",gt.t()],["m3u",gt.t()],["m3u8",gt.a("vnd.apple.mpegurl")],["manifest",gt.t("cache-manifest")],["md",gt.t("markdown")],["mkv",gt.v("x-matroska")],["mp3",gt.a("mpeg")],["mobi",gt.a("x-mobipocket-ebook")],["ppt",gt.a("powerpoint")],["pptx",`${gt.vnd}.presentationml.presentation`],["qt",gt.v("quicktime")],["svg",gt.i("svg+xml")],["tif",gt.i("tiff")],["tsv",gt.t("tab-separated-values")],["tgz",gt.a("x-tar")],["txt",gt.t()],["text",gt.t()],["vcd",gt.a("x-cdlink")],["vcs",gt.t("x-vcalendar")],["wav",gt.a("x-wav")],["webmanifest",gt.a("manifest+json")],["xls",gt.a("vnd.ms-excel")],["xlsx",`${gt.vnd}.spreadsheetml.sheet`],["yml",gt.t("yaml")]]);function kL(e){try{const t=e.split(".").pop();if(!t)return gt.a();for(const[n,r]of Object.entries(zA))if(r.includes(t))return`${n}/${t}`;return VA.get(t)}catch{return gt.a()}}function IL(e,t=[]){const n=e.toLowerCase();if(t.includes(n))return!1;if(Object.entries(zA).flatMap(([r,s])=>s.map(i=>`${r}/${i}`)).includes(n))return!0;for(const[r,s]of VA.entries())if(s===n&&!t.includes(r))return!0;return!1}function DL(e){const t=e.toLowerCase();for(const[n,r]of Object.entries(zA))for(const s of r)if(t===`${n}/${s}`)return s;for(const[n,r]of VA.entries())if(r===t)return n;return""}var Bie={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},PL=()=>{var n,r;const e=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[s,i]of Object.entries(Bie))if(zie(i))return s}return typeof(e==null?void 0:e.EdgeRuntime)=="string"?"edge-light":(e==null?void 0:e.fastly)!==void 0?"fastly":((r=(n=e==null?void 0:e.process)==null?void 0:n.release)==null?void 0:r.name)==="node"?"node":"other"},zie=e=>navigator.userAgent.startsWith(e);function Vie(){var t,n,r,s;const e=globalThis;return((n=(t=e==null?void 0:e.process)==null?void 0:t.env)==null?void 0:n.NEXT_RUNTIME)==="nodejs"?"nextjs":((s=(r=e==null?void 0:e.process)==null?void 0:r.env)==null?void 0:s.NEXT_RUNTIME)==="edge"?"nextjs-edge":typeof window<"u"&&window.__NEXT_DATA__?"nextjs-client":PL()}const g6={redirects_non_fq:!0};function Uie(e){return Vie().startsWith("nextjs")&&(g6.redirects_non_fq=!1),g6[e]}function y6(e,t){if(!e)throw new Error(t)}function qie(e){let t="";typeof e=="string"?t=e:e instanceof Headers?t=e.get("Content-Disposition")||"":e instanceof Request&&(t=e.headers.get("Content-Disposition")||"");const n=t.match(/filename\*?=(?:UTF-8'')?("?)([^";]+)\1/);return n?n[2]:void 0}function Hie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}function e1(e){return typeof e=="object"&&e!==null&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"}function hd(e){return e1(e)&&typeof e.name=="string"&&typeof e.lastModified=="number"}function Wie(e){return typeof e=="object"&&e!==null&&Object.prototype.toString.call(e)==="[object ArrayBuffer]"}function Gie(e){return typeof e=="object"&&e!==null&&ArrayBuffer.isView(e)}const Yie={"89504E47":"image/png",FFD8FF:"image/jpeg",47494638:"image/gif","49492A00":"image/tiff","4D4D002A":"image/tiff","52494646????57454250":"image/webp","504B0304":"application/zip",25504446:"application/pdf","00000020667479706D70":"video/mp4","000001BA":"video/mpeg","000001B3":"video/mpeg","1A45DFA3":"video/webm","4F676753":"audio/ogg",494433:"audio/mpeg",FFF1:"audio/aac",FFF9:"audio/aac","52494646????41564920":"audio/wav","52494646????57415645":"audio/wave","52494646????415550":"audio/aiff"};async function Jie(e){if(!e)return;let t;if(Hie(e)){const r=e.getReader(),{value:s}=await r.read();if(!s)return;t=new Uint8Array(s)}else if(e1(e)||hd(e))t=new Uint8Array(await e.slice(0,12).arrayBuffer());else if(Wie(e))t=new Uint8Array(e);else if(Gie(e))t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);else if(typeof e=="string")t=new TextEncoder().encode(e);else return;const n=Array.from(t.slice(0,12)).map(r=>r.toString(16).padStart(2,"0").toUpperCase()).join("");for(const[r,s]of Object.entries(Yie))if(new RegExp("^"+r.replace(/\?\?/g,"..")).test(n))return s}async function rN(e){const t=e.req.header("Content-Type")??"application/octet-stream";if(t!=null&&t.startsWith("multipart/form-data")||t!=null&&t.startsWith("application/x-www-form-urlencoded"))try{const n=await e.req.formData();if([...n.values()].length>0){const r=[...n.values()][0];return await b6(r)}}catch(n){pt.warn("Error parsing form data",n)}else try{const n=await e.req.blob();if(hd(n))return n;if(e1(n))return await b6(n,{name:qie(e.req.raw),type:t})}catch(n){pt.warn("Error parsing blob",n)}throw new Error("No file found in request")}async function Xie(e,t){const n=hd(e),r=n?e.type:t;y6(r&&typeof r=="string"&&r.startsWith("image/"),"type must be image/*");const s=n?await e.arrayBuffer():e;y6(s.byteLength>=128,"Buffer must be at least 128 bytes");const i=new DataView(s);if(r==="image/jpeg"){let o=2;for(;o<i.byteLength;){const a=i.getUint16(o);if(o+=2,a===65472||a===65474)return{width:i.getUint16(o+5),height:i.getUint16(o+3)};o+=i.getUint16(o)}}else{if(r==="image/png")return{width:i.getUint32(16),height:i.getUint32(20)};if(r==="image/gif")return{width:i.getUint16(6),height:i.getUint16(8)};if(r==="image/tiff"){const o=i.getUint16(0)===18761,a=i.getUint32(4,o),c=i.getUint32(a+18,o),u=i.getUint32(a+10,o);return{width:c,height:u}}}throw new Error("Unsupported image format")}async function b6(e,t={}){if(hd(e))return e;if(!e1(e))throw new Error("Not a Blob");const n=IL(t.type,["application/octet-stream"])?t.type:await Jie(e),r=n?DL(n):"",s=t.name||[OL(16),r].filter(Boolean).join(".");return new File([e],s,{type:n||kL(s),lastModified:Date.now()})}function Kie(e){return e?{...Object.fromEntries(e.entries())}:{}}function Qie(e,t){const n=Kie(e),r={};for(const s of t)n[s]&&(r[s]=n[s]);return r}function Zie(e,t){const n=new Headers;for(const r of t)e.has(r)&&n.set(r,e.get(r));return n}function t1(e,t){let n="";function r(s){return t!=null&&t.encode?encodeURIComponent(s):s}for(const s in e){let i=e[s];if(i!==void 0)if(Array.isArray(i))for(let o=0;o<i.length;o++)n.length>0&&(n+="&"),n+=`${r(s)}=${r(i[o])}`;else typeof i=="object"&&(i=JSON.stringify(i)),n.length>0&&(n+="&"),n+=`${r(s)}=${r(i)}`}return((t==null?void 0:t.prefix)||"")+n}function eoe(e){function t(o){if(!o)return"";const a=decodeURIComponent(o);if(a==="false")return!1;if(a==="true")return!0;try{return JSON.parse(a)}catch{return+a*0===0?+a:a}}let n,r;const s={},i=e.split("&");for(;n=i.shift();)n=n.split("="),r=n.shift(),s[r]!==void 0?s[r]=[].concat(s[r],t(n.shift())):s[r]=t(n.shift());return s}var fn=(e=>(e[e.CONTINUE=100]="CONTINUE",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.ALREADY_REPORTED=208]="ALREADY_REPORTED",e[e.IM_USED=226]="IM_USED",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED",e))(fn||{});const LL=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",toe=LL+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",noe="["+LL+"]["+toe+"]*",roe=new RegExp("^"+noe+"$");function FL(e,t){const n=[];let r=t.exec(e);for(;r;){const s=[];s.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n}const UA=function(e){const t=roe.exec(e);return!(t===null||typeof t>"u")};function soe(e){return typeof e<"u"}const ioe={allowBooleanAttributes:!1,unpairedTags:[]};function ooe(e,t){t=Object.assign({},ioe,t);const n=[];let r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=x6(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=w6(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!=="	"&&e[i]!==`
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!poe(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",On("InvalidTag",h,Tr(e,i))}const u=coe(e,i);if(u===!1)return On("InvalidAttr","Attributes for '"+c+"' have open quote.",Tr(e,i));let f=u.value;if(i=u.index,f[f.length-1]==="/"){const h=i-f.length;f=f.substring(0,f.length-1);const m=S6(f,t);if(m===!0)r=!0;else return On(m.err.code,m.err.msg,Tr(e,h+m.err.line))}else if(a)if(u.tagClosed){if(f.trim().length>0)return On("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Tr(e,o));if(n.length===0)return On("InvalidTag","Closing tag '"+c+"' has not been opened.",Tr(e,o));{const h=n.pop();if(c!==h.tagName){let m=Tr(e,h.tagStartPos);return On("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+c+"'.",Tr(e,o))}n.length==0&&(s=!0)}}else return On("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Tr(e,i));else{const h=S6(f,t);if(h!==!0)return On(h.err.code,h.err.msg,Tr(e,i-f.length+h.err.line));if(s===!0)return On("InvalidXml","Multiple possible root nodes found.",Tr(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=w6(e,i);continue}else if(e[i+1]==="?"){if(i=x6(e,++i),i.err)return i}else break;else if(e[i]==="&"){const h=foe(e,i);if(h==-1)return On("InvalidChar","char '&' is not expected.",Tr(e,i));i=h}else if(s===!0&&!v6(e[i]))return On("InvalidXml","Extra text at the end",Tr(e,i));e[i]==="<"&&i--}}else{if(v6(e[i]))continue;return On("InvalidChar","char '"+e[i]+"' is not expected.",Tr(e,i))}if(r){if(n.length==1)return On("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Tr(e,n[0].tagStartPos));if(n.length>0)return On("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return On("InvalidXml","Start tag expected.",1);return!0}function v6(e){return e===" "||e==="	"||e===`
`||e==="\r"}function x6(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return On("InvalidXml","XML declaration allowed only at the start of the document.",Tr(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function w6(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const aoe='"',loe="'";function coe(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===aoe||e[t]===loe)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}const uoe=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function S6(e,t){const n=FL(e,uoe),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return On("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",vm(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return On("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",vm(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return On("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",vm(n[s]));const i=n[s][2];if(!hoe(i))return On("InvalidAttr","Attribute '"+i+"' is an invalid name.",vm(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return On("InvalidAttr","Attribute '"+i+"' is repeated.",vm(n[s]))}return!0}function doe(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function foe(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,doe(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function On(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function hoe(e){return UA(e)}function poe(e){return UA(e)}function Tr(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function vm(e){return e.startIndex+e[1].length}const moe={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},goe=function(e){return Object.assign({},moe,e)};class xm{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function yoe(e,t){const n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&xoe(e,t)){t+=7;let a,c;[a,c,t]=boe(e,t+1),c.indexOf("&")===-1&&(n[Noe(a)]={regx:RegExp(`&${a};`,"g"),val:c})}else if(s&&woe(e,t))t+=8;else if(s&&Soe(e,t))t+=8;else if(s&&Eoe(e,t))t+=9;else if(voe)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function boe(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=e[t++];let s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function voe(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function xoe(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function woe(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Soe(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Eoe(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Noe(e){if(UA(e))return e;throw new Error(`Invalid entity name ${e}`)}const _oe=/^[-+]?0x[a-fA-F0-9]+$/,Coe=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Ooe={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function joe(e,t={}){if(t=Object.assign({},Ooe,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&_oe.test(n))return $oe(n,16);if(n.search(/[eE]/)!==-1){const r=n.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(r){if(t.leadingZeros)n=(r[1]||"")+r[3];else if(!(r[2]==="0"&&r[3][0]==="."))return e;return t.eNotation?Number(n):e}else return e}else{const r=Coe.exec(n);if(r){const s=r[1],i=r[2];let o=Aoe(r[3]);if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;if(t.leadingZeros&&i===e)return 0;{const a=Number(n),c=""+a;return c.search(/[eE]/)!==-1?t.eNotation?a:e:n.indexOf(".")!==-1?c==="0"&&o===""||c===o||s&&c==="-"+o?a:e:i?o===c||s+o===c?a:e:n===c||n===s+c?a:e}}else return e}}function Aoe(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}function $oe(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Toe(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Roe{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=Moe,this.parseXml=Loe,this.parseTextData=koe,this.resolveNameSpace=Ioe,this.buildAttributesMap=Poe,this.isItStopNode=Voe,this.replaceEntitiesValue=Boe,this.readStopNodeData=qoe,this.saveTextToParentTag=zoe,this.addChild=Foe,this.ignoreAttributesFn=Toe(this.options.ignoreAttributes)}}function Moe(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function koe(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,s,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?cC(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?cC(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ioe(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Doe=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Poe(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=FL(e,Doe),s=r.length,i={};for(let o=0;o<s;o++){const a=this.resolveNameSpace(r[o][1]);if(this.ignoreAttributesFn(a,t))continue;let c=r[o][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);const f=this.options.attributeValueProcessor(a,c,t);f==null?i[u]=c:typeof f!=typeof c||f!==c?i[u]=f:i[u]=cC(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[u]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=i,o}return i}}const Loe=function(e){e=e.replace(/\r\n?/g,`
`);const t=new xm("!xml");let n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const a=ju(e,">",i,"Closing Tag is not closed.");let c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){const h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,s));const u=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let f=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(f=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=s.lastIndexOf("."),s=s.substring(0,f),n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=lC(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new xm(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(n,c,s)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const a=ju(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const c=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){const a=yoe(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){const a=ju(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);r=this.saveTextToParentTag(r,n,s);let u=this.parseTextData(c,n.tagname,s,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,u),i=a+2}else{let a=lC(e,i,this.options.removeNSPrefix),c=a.tagName;const u=a.rawTagName;let f=a.tagExp,h=a.attrExpPresent,m=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));const y=n;if(y&&this.options.unpairedTags.indexOf(y.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let v="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{const E=this.readStopNodeData(e,u,m+1);if(!E)throw new Error(`Unexpected end of ${u}`);i=E.i,v=E.tagContent}const x=new xm(c);c!==f&&h&&(x[":@"]=this.buildAttributesMap(f,s,c)),v&&(v=this.parseTextData(v,c,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),x.add(this.options.textNodeName,v),this.addChild(n,x,s)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const v=new xm(c);c!==f&&h&&(v[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(n,v,s),s=s.substr(0,s.lastIndexOf("."))}else{const v=new xm(c);this.tagsNodeStack.push(n),c!==f&&h&&(v[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(n,v,s),n=v}r="",i=m}}else r+=e[i];return t.child};function Foe(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}const Boe=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function zoe(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Voe(e,t,n){const r="*."+n;for(const s in e){const i=e[s];if(r===i||t===i)return!0}return!1}function Uoe(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o==="	"&&(o=" ");s+=o}}function ju(e,t,n,r){const s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function lC(e,t,n,r=">"){const s=Uoe(e,t+1,r);if(!s)return;let i=s.data;const o=s.index,a=i.search(/\s/);let c=i,u=!0;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());const f=c;if(n){const h=c.indexOf(":");h!==-1&&(c=c.substr(h+1),u=c!==s.data.substr(h+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:u,rawTagName:f}}function qoe(e,t,n){const r=n;let s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=ju(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=ju(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=ju(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=ju(e,"]]>",n,"StopNode is not closed.")-2;else{const i=lC(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function cC(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:joe(e,n)}else return soe(e)?e:""}function Hoe(e,t){return BL(e,t)}function BL(e,t,n){let r;const s={};for(let i=0;i<e.length;i++){const o=e[i],a=Woe(o);let c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let u=BL(o[a],t,c);const f=Yoe(u,t);o[":@"]?Goe(u,o[":@"],c,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(u)):t.isArray(a,c,f)?s[a]=[u]:s[a]=u}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function Woe(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function Goe(e,t,n,r){if(t){const s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){const a=s[o];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function Yoe(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class Joe{constructor(t){this.externalEntities={},this.options=goe(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=ooe(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Roe(this.options);r.addExternalEntities(this.externalEntities);const s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:Hoe(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}}function Xoe(e){return new Joe().parse(e)}const Koe=["SHA-1","SHA-256","SHA-384","SHA-512"];async function E6(e,t,n,r){if(!Koe.includes(e))throw new Error(`Invalid hash algorithm: ${e}`);const s=new TextEncoder().encode((n??"")+t+(r??"")),i=await crypto.subtle.digest(e,s);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}const zL={sha256:async(e,t,n)=>E6("SHA-256",e,t,n),sha1:async(e,t,n)=>E6("SHA-1",e,t,n)};function Qoe(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>String.fromCharCode(33+n%94)).join("")}const ur=[];for(let e=0;e<256;++e)ur.push((e+256).toString(16).slice(1));function VL(e,t=0){return(ur[e[t+0]]+ur[e[t+1]]+ur[e[t+2]]+ur[e[t+3]]+"-"+ur[e[t+4]]+ur[e[t+5]]+"-"+ur[e[t+6]]+ur[e[t+7]]+"-"+ur[e[t+8]]+ur[e[t+9]]+"-"+ur[e[t+10]]+ur[e[t+11]]+ur[e[t+12]]+ur[e[t+13]]+ur[e[t+14]]+ur[e[t+15]]).toLowerCase()}let sN;const Zoe=new Uint8Array(16);function UL(){if(!sN){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");sN=crypto.getRandomValues.bind(crypto)}return sN(Zoe)}const eae=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),N6={randomUUID:eae};function tae(e,t,n){var s;if(N6.randomUUID&&!e)return N6.randomUUID();e=e||{};const r=e.random??((s=e.rng)==null?void 0:s.call(e))??UL();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,VL(r)}const iN={};function nae(e,t,n){let r;{const s=Date.now(),i=UL();rae(iN,s,i),r=sae(i,iN.msecs,iN.seq,t,n)}return t??VL(r)}function rae(e,t,n){return e.msecs??(e.msecs=-1/0),e.seq??(e.seq=0),t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function sae(e,t,n,r,s=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),s=0;else if(s<0||s+16>r.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);return t??(t=Date.now()),n??(n=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9]),r[s++]=t/1099511627776&255,r[s++]=t/4294967296&255,r[s++]=t/16777216&255,r[s++]=t/65536&255,r[s++]=t/256&255,r[s++]=t&255,r[s++]=112|n>>>28&15,r[s++]=n>>>20&255,r[s++]=128|n>>>14&63,r[s++]=n>>>6&255,r[s++]=n<<2&255|e[10]&3,r[s++]=e[11],r[s++]=e[12],r[s++]=e[13],r[s++]=e[14],r[s++]=e[15],r}function iae(){return tae()}function oae(){return nae()}function qL(e,t,n){const r=Math.min(t,n),s=Math.max(t,n);return Math.max(r,Math.min(e,s))}function _6(e){return e==null?0:typeof e=="number"?e:Number.parseInt(e,10)}const HL={fileSize:(e,t=2)=>{if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,s=["Bytes","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return Number.parseFloat((e/n**i).toFixed(r))+" "+s[i]}};var uC=(e=[],t="")=>"/"+[t,...e.map(n=>String(n).replace(/\./g,"/"))].filter(Boolean).join("/"),WL=e=>e.split("/").slice(1);function aae(e,t,n=void 0){let r=typeof t=="string"?WL(t):uC(t);return n1(e,r,n)}function n1(e,t,n=void 0){let r=typeof t=="string"?t.split(/[.\[\]\"]+/).filter(s=>s):t;if(r.length===0)return e;try{let[s,...i]=r;return!s||!(s in e)?n:n1(e[s],i,n)}catch{if(typeof n<"u")return n;throw new Error(`Invalid path: ${r.join(".")}`)}}var Qt=(e={},t,n,r)=>({valid:!1,errors:[...e.errors??[],{keywordLocation:uC([...e.keywordPath??[],t]),instanceLocation:uC(e.instancePath),error:typeof n=="string"?n:`Invalid value for ${t}`,data:r}]}),et=()=>({valid:!0,errors:[]}),sp=(e,t,n)=>{let r=Array.isArray(t)?t:[t],s=n?Array.isArray(n)?n:[n]:[];return{...e,keywordPath:[...e.keywordPath??[],...r],instancePath:s?[...e.instancePath??[],...s]:e.instancePath}},gv=(e={})=>({...e,errors:[]}),Qu=class extends Error{constructor(t){super(`Expected ${t}`)}},lae=class extends Error{constructor(e,t){super(`${e??"Invalid raw schema"}: ${JSON.stringify(t)}`),this.schema=t}},cae=class extends Error{constructor(e,t){super(`${e}, got: '${JSON.stringify(t)}'`),this.value=t}};function uae(e){return e===null}function ir(e){return!Array.isArray(e)&&typeof e=="object"&&e!==null}function dae(e){return Object.prototype.toString.call(e)==="[object Object]"}function ko(e){return typeof e=="string"}function Ya(e){return typeof e=="number"}function fae(e){return typeof e=="number"&&Number.isInteger(e)}function qA(e){return typeof e=="boolean"}function Ja(e){return Array.isArray(e)}function hae(e){return typeof e!="boolean"}function pae(e){return e!==void 0&&hae(e)&&"type"in e}function oi(e){return e instanceof Xa}function mae(e){return oi(e)&&typeof e.toJSON()=="boolean"}function gae(e,t,n){if(!e)throw new cae(t,n)}function Pa(e){if(Ja(e))return e.map(Pa).sort();if(ir(e)){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,Pa(r)]);return Object.fromEntries(t)}return ko(e)?e.normalize("NFC"):e}function yae(e,t){return t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}var Kv=class{constructor(e){K(this,"cache");this.root=e,this.cache=new Map}hasRef(e,t){return t!==void 0&&"$ref"in e&&ko(e.$ref)}resolve(e){let t=this.cache.get(e);if(!t){if(t=aae(this.root,e),!oi(t))throw new Error(`ref not found: ${e}`);if("$ref"in t&&t.$ref===e)throw new Error(`ref loop: ${e}`);this.cache.set(e,t)}return t}};function bae(e,t,n={}){let r=t;try{r=structuredClone(t)}catch{r=JSON.parse(JSON.stringify(t))}let s={resolver:n.resolver||new Kv(e),depth:n.depth||0,dropUnknown:n.dropUnknown||!1};return s.resolver.hasRef(e,r)?s.resolver.resolve(e.$ref).coerce(r,{...s,depth:s.depth+1}):r}var vae=({type:e},t,n={})=>{if(e===void 0||t===void 0)return et();let r,s={string:ko,number:Ya,integer:fae,object:ir,array:Ja,boolean:qA,null:uae};if(Array.isArray(e)){for(let i of e){if(!(i in s))throw new Qu(`Unknown type: ${i}`);if(s[i](t))return et()}r=`Expected one of: ${e.join(", ")}`}else{if(!(e in s))throw new Qu(`Unknown type: ${e}`);s[e](t)||(r=`Expected ${e}`)}return r?Qt(n,"type",r,t):et()},xae=({const:e},t,n={})=>{let r=JSON.stringify(Pa(e)),s=JSON.stringify(Pa(t));return r!==s?Qt(n,"const",`Expected const: ${r}`,s):et()},wae=({enum:e=[]},t,n={})=>{let r=JSON.stringify(e.map(Pa)),s=JSON.stringify(Pa(t));return r.includes(s)?et():Qt(n,"enum",`Expected enum: ${r}`,t)};function r1(e,t,n={}){return e.map(r=>r.validate(t,gv(n)).valid?r:void 0).filter(Boolean)}var Sae=({anyOf:e=[]},t,n={})=>r1(e,t,n).length>0?et():Qt(n,"anyOf","Expected at least one to match",t),Eae=({oneOf:e=[]},t,n={})=>r1(e,t).length===1?et():Qt(n,"oneOf","Expected exactly one to match",t),Nae=({allOf:e=[]},t,n={})=>r1(e,t,n).length===e.length?et():Qt(n,"allOf","Expected all to match",t),_ae=({not:e},t,n={})=>t===void 0?et():oi(e)&&e.validate(t,n).valid?Qt(n,"not","Expected not to match",t):et(),Cae=({if:e,then:t,else:n},r,s={})=>{if(e&&(t||n)){if(e.validate(r,gv(s)).valid)return t?t.validate(r,gv(s)):et();if(n)return n.validate(r,gv(s))}return et()},Oae=({pattern:e=""},t,n={})=>{if(!ko(t))return et();if(e instanceof RegExp){if(e.test(t))return et()}else if(new RegExp(e,"u").test(t))return et();return Qt(n,"pattern",`Expected string matching pattern ${e}`,t)},jae=({minLength:e=0},t,n={})=>ko(t)?[...Pa(t)].length>=e?et():Qt(n,"minLength",`Expected string with minimum length of ${e}`,t):et(),Aae=({maxLength:e=0},t,n={})=>ko(t)?[...Pa(t)].length<=e?et():Qt(n,"maxLength",`Expected string with maximum length of ${e}`,t):et(),$ae=({multipleOf:e=0},t,n={})=>{if(!Ya(t))return et();if(!(Number.isFinite(t)&&Number.isFinite(e))||e<=0)throw new Qu("number");let r=t/e,s=Number.EPSILON*Math.max(1,Math.abs(r));return Math.abs(r-Math.round(r))<=s?et():Qt(n,"multipleOf",`Expected number being a multiple of ${e}`,t)},Tae=({maximum:e=0},t,n={})=>!Ya(t)||t<=e?et():Qt(n,"maximum",`Expected number less than or equal to ${e}`,t),Rae=({exclusiveMaximum:e=0},t,n={})=>!Ya(t)||t<e?et():Qt(n,"exclusiveMaximum",`Expected number less than ${e}`,t),Mae=({minimum:e=0},t,n={})=>!Ya(t)||t>=e?et():Qt(n,"minimum",`Expected number greater than or equal to ${e}`,t),kae=({exclusiveMinimum:e=0},t,n={})=>!Ya(t)||t>e?et():Qt(n,"exclusiveMinimum",`Expected number greater than ${e}`,t),Iae=({properties:e={}},t,n={})=>{if(!ir(t))return et();for(let[r,s]of Object.entries(t)){let i=e[r];if(!oi(i))continue;let o=i.validate(s,sp(n,["properties",r],r));if(!o.valid)return o}return et()},Dae=({properties:e={},additionalProperties:t,patternProperties:n},r,s={})=>{if(!ir(r))return et();if(!oi(t))throw new Qu("additionalProperties must be a boolean or a managed schema");let i=Object.keys(e),o=ir(n)?Object.keys(r).filter(c=>Object.keys(n).some(u=>new RegExp(u).test(c))):[],a=Object.keys(r).filter(c=>!i.includes(c)&&!o.includes(c));if(a.length>0){if(mae(t)){if(t.toJSON()===!0)return et();let c=a.reduce((u,f)=>(u[f]=r[f],u),{});return Qt(s,"additionalProperties","Additional properties are not allowed",c)}else if(oi(t))for(let c of a){let u=t.validate(r[c],sp(s,["additionalProperties"],c));if(!u.valid)return u}}return et()},Pae=({dependentRequired:e},t,n={})=>{if(!ir(t))return et();let r=Object.keys(t).filter(s=>typeof t[s]!="function");if(ir(e)){for(let[s,i]of Object.entries(e))if(r.includes(s)){for(let o of i)if(!r.includes(o))return Qt(n,"dependentRequired",`Expected dependent required property ${o}`,t)}}return et()},Lae=({required:e=[]},t,n={})=>{if(!ir(t))return et();let r=Object.keys(t).filter(s=>typeof t[s]!="function");return e.every(s=>r.includes(s))?et():Qt(n,"required",`Expected object with required properties ${e.join(", ")}`,t)},Fae=({dependentSchemas:e},t,n={})=>{if(!ir(t))return et();let r=Object.keys(t).filter(s=>typeof t[s]!="function");if(ir(e)){for(let[s,i]of Object.entries(e))if(r.includes(s)){let o=i.validate(t,n);if(!o.valid)return o}}return et()},Bae=({minProperties:e=0},t,n={})=>ir(t)?Object.keys(t).length>=e?et():Qt(n,"minProperties",`Expected object with at least ${e} properties`,t):et(),zae=({maxProperties:e=0},t,n={})=>!ir(t)||Object.keys(t).length<=e?et():Qt(n,"maxProperties",`Expected object with at most ${e} properties`,t),Vae=({patternProperties:e={}},t,n={})=>{if(!ir(t))return et();if(!ir(e))throw new Qu("patternProperties must be an object");for(let[r,s]of Object.entries(t))for(let[i,o]of Object.entries(e))if(new RegExp(i,"u").test(r)){let a=o.validate(s,sp(n,["patternProperties"],r));if(!a.valid)return a}return et()},Uae=({propertyNames:e},t,n={})=>{if(!ir(t)||e===void 0)return et();if(!oi(e))throw new Qu("propertyNames must be a managed schema");for(let r of Object.keys(t)){let s=e.validate(r,sp(n,["propertyNames"],r));if(!s.valid)return s}return et()},qae=({items:e,prefixItems:t=[]},n,r={})=>{if(!Ja(n)||e===void 0)return et();if(!oi(e))throw new Qu("items must be a managed schema");for(let[s,i]of n.slice(t.length).entries()){let o=e.validate(i,sp(r,["items"],String(s)));if(!o.valid)return o}return et()},Hae=({minItems:e=0},t,n={})=>!Ja(t)||t.length>=e?et():Qt(n,"minItems",`Expected array with at least ${e} items`,t),Wae=({maxItems:e=0},t,n={})=>!Ja(t)||t.length<=e?et():Qt(n,"maxItems",`Expected array with at most ${e} items`,t),Gae=({uniqueItems:e=!1},t,n={})=>{if(!Ja(t)||!e)return et();let r=t.map(Pa);return new Set(r.map(s=>JSON.stringify(s))).size===t.length?et():Qt(n,"uniqueItems","Expected array with unique items",t)},Yae=({contains:e,minContains:t,maxContains:n},r,s={})=>{if(!oi(e))throw new Error("contains must be a managed schema");if(!Ja(r))return et();let i=r.filter(o=>e.validate(o).valid).length;return i<(t??1)?Qt(s,t?"minContains":"contains",`Expected array to contain at least ${t??1}, but found ${i}`,r):n!==void 0&&i>n?Qt(s,"maxContains",`Expected array to contain at most ${n}, but found ${i}`,r):et()},Jae=({prefixItems:e=[]},t,n={})=>{var r;if(!Ja(t))return et();for(let s=0;s<t.length;s++){let i=(r=e[s])==null?void 0:r.validate(t[s],sp(n,String(s),String(s)));if(i&&(i==null?void 0:i.valid)!==!0)return i}return et()},C6={email:e=>{if(e.length>318)return!1;if(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,20}(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,21}){0,2}@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,60}[a-z0-9])?){0,3}$/i.test(e))return!0;if(!e.includes("@")||/(^\.|^"|\.@|\.\.)/.test(e))return!1;let[t,n,...r]=e.split("@");return!t||!n||r.length!==0||t.length>64||n.length>253||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(".").every(s=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},hostname:e=>e.length>(e.endsWith(".")?254:253)?!1:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.?$/i.test(e),date:e=>{if(e.length!==10)return!1;if(e[5]==="0"&&e[6]==="2"){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)$/.test(e))return!0;let t=e.match(/^(\d\d\d\d)-02-29$/);if(!t)return!1;let n=Number(t[1]);return n%16===0||n%4===0&&n%25!==0}return e.endsWith("31")?/^\d\d\d\d-(?:0[13578]|1[02])-31$/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)$/.test(e)},time:e=>{if(e.length>27||!/^(?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)?$/i.test(e))return!1;if(!/:60/.test(e))return!0;let t=e.match(/([0-9.]+|[^0-9.])/g);if(!t)return!1;let n=Number(t[0])*60+Number(t[2]);return t[5]==="+"?n+=24*60-Number(t[6]||0)*60-Number(t[8]||0):t[5]==="-"&&(n+=Number(t[6]||0)*60+Number(t[8]||0)),n%(24*60)===23*60+59},"date-time":e=>{if(e.length>38)return!1;let t=/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:[0-2]\d|3[01])[t\s](?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i,n=e[5]==="0"&&e[6]==="2";if(n&&e[8]==="3"||!t.test(e))return!1;if(e[17]==="6"){let r=e.slice(11).match(/([0-9.]+|[^0-9.])/g);if(!r)return!1;let s=Number(r[0])*60+Number(r[2]);if(r[5]==="+"?s+=24*60-Number(r[6]||0)*60-Number(r[8]||0):r[5]==="-"&&(s+=Number(r[6]||0)*60+Number(r[8]||0)),s%(24*60)!==23*60+59)return!1}if(n){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)/.test(e))return!0;let r=e.match(/^(\d\d\d\d)-02-29/);if(!r)return!1;let s=Number(r[1]??0);return s%16===0||s%4===0&&s%25!==0}return e[8]==="3"&&e[9]==="1"?/^\d\d\d\d-(?:0[13578]|1[02])-31/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)/.test(e)},ipv4:e=>e.length<=15&&/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)$/.test(e),ipv6:e=>{if(e.length>45||e.length<2)return!1;let t=0,n=0,r=0,s=!1,i=!1,o=0,a=!0;for(let u=0;u<e.length;u++){let f=e.charCodeAt(u);if(u===1&&o===58&&f!==58)return!1;if(f>=48&&f<=57){if(++r>4)return!1}else if(f===46){if(t>6||n>=3||r===0||i)return!1;n++,r=0}else if(f===58){if(n>0||t>=7)return!1;if(o===58){if(s)return!1;s=!0}else u===0&&(a=!1);t++,r=0,i=!1}else if(f>=97&&f<=102||f>=65&&f<=70){if(n>0||++r>4)return!1;i=!0}else return!1;o=f}if(t<2||n>0&&(n!==3||r===0))return!1;if(s&&e.length===2)return!0;if(n>0&&!/(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/.test(e))return!1;let c=n>0?6:7;return s?(a||r>0)&&t<c:t===c&&a&&r>0},uri:e=>/^[a-z][a-z0-9+\-.]*:(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test(e),"uri-reference":e=>/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)?(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test(e),"uri-template":e=>/^(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i.test(e),"json-pointer":e=>/^(?:|\/(?:[^~]|~0|~1)*)$/.test(e),"relative-json-pointer":e=>/^(?:0|[1-9][0-9]*)(?:|#|\/(?:[^~]|~0|~1)*)$/.test(e),uuid:e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),duration:e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e)),regex:e=>{if(/[^\\]\\Z/.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}},Xae=({format:e},t,n={})=>!ko(t)||!e?et():C6[e]?C6[e](t)?et():Qt(n,"format",`Expected format: ${e}`,t):et(),Kae={type:vae,const:xae,enum:wae,allOf:Nae,anyOf:Sae,oneOf:Eae,not:_ae,minLength:jae,maxLength:Aae,pattern:Oae,format:Xae,minimum:Mae,exclusiveMinimum:kae,maximum:Tae,exclusiveMaximum:Rae,multipleOf:$ae,required:Lae,dependentRequired:Pae,dependentSchemas:Fae,minProperties:Bae,maxProperties:zae,propertyNames:Uae,properties:Iae,patternProperties:Vae,additionalProperties:Dae,minItems:Hae,maxItems:Wae,uniqueItems:Gae,contains:Yae,prefixItems:Jae,items:qae,if:Cae};function Qae(e,t,n={}){let r={keywordPath:n.keywordPath||[],instancePath:n.instancePath||[],coerce:n.coerce||!1,errors:n.errors||[],shortCircuit:n.shortCircuit||!1,ignoreUnsupported:n.ignoreUnsupported||!1,resolver:n.resolver||new Kv(e),depth:n.depth?n.depth+1:0},s=structuredClone(n!=null&&n.coerce&&e.coerce?e.coerce(t,{resolver:r.resolver,depth:r.depth}):t);if(n.ignoreUnsupported!==!0){let i=["$defs"];for(let o of i)if(e[o])throw new Error(`${o} not implemented`)}if(r.resolver.hasRef(e,s)){let i=r.resolver.resolve(e.$ref).validate(s,{...r,errors:[]});i.valid||r.errors.push(...i.errors)}else for(let[i,o]of Object.entries(Kae)){if(e[i]===void 0||s===void 0)continue;let a=o(e,s,{...r,errors:[]});if(!a.valid){if(n.shortCircuit)return a;r.errors.push(...a.errors)}}return{valid:r.errors.length===0,errors:r.errors}}var Ir=Symbol.for("schema"),B9,Xa=class{constructor(e,t){K(this,"~standard");K(this,B9);K(this,"type");K(this,"$id");K(this,"$ref");K(this,"$schema");K(this,"title");K(this,"description");K(this,"readOnly");K(this,"writeOnly");K(this,"$comment");K(this,"examples");let{type:n,validate:r,coerce:s,template:i,...o}=e||{};Object.assign(this,{type:n},o),this[Ir]={raw:e,optional:!1,overrides:t},this["~standard"]={version:1,vendor:"jsonv-ts",validate:a=>{let c=this.validate(a);return c.valid?{value:a}:{issues:c.errors.map(u=>({message:u.error,path:WL(u.instanceLocation)}))}}}}template(e,t){var i,o,a;let n=this,r=e;if(n.const!==void 0?r=n.const:r===void 0&&(n.default!==void 0&&(r=n.default),t!=null&&t.withExtendedOptional&&n.enum!==void 0&&(r=n.enum[0])),(t==null?void 0:t.withOptional)!==!0&&r===void 0&&this.isOptional())return r;if((i=this[Ir].raw)!=null&&i.template){let c=this[Ir].raw.template(r,t);c!==void 0&&(r=c)}let s=(a=(o=this[Ir].overrides)==null?void 0:o.template)==null?void 0:a.call(o,r,t);return s!==void 0&&(r=s),r}validate(e,t){var s;let n={keywordPath:(t==null?void 0:t.keywordPath)||[],instancePath:(t==null?void 0:t.instancePath)||[],coerce:(t==null?void 0:t.coerce)||!1,errors:(t==null?void 0:t.errors)||[],shortCircuit:(t==null?void 0:t.shortCircuit)||!1,ignoreUnsupported:(t==null?void 0:t.ignoreUnsupported)||!1,resolver:(t==null?void 0:t.resolver)||new Kv(this),depth:t!=null&&t.depth?t.depth+1:0},r=(s=this[Ir].raw)==null?void 0:s.validate;if(r!==void 0){let i=r(e,n);if(!i.valid)return i}return Qae(this,e,n)}coerce(e,t){var i,o,a;let n={...t,resolver:(t==null?void 0:t.resolver)||new Kv(this),depth:t!=null&&t.depth?t.depth+1:0,dropUnknown:(t==null?void 0:t.dropUnknown)||!1},r=(i=this[Ir].raw)==null?void 0:i.coerce;if(r!==void 0)return r(e,n);let s=((a=(o=this[Ir].overrides)==null?void 0:o.coerce)==null?void 0:a.call(o,e,n))??e;return bae(this,s,n)}optional(){return this[Ir].optional=!0,this}isOptional(){return this[Ir].optional}children(e){return[]}*walk({instancePath:e=[],keywordPath:t=[],...n}={}){n.includeSelf!==!1&&(yield new Oy(this,{instancePath:e,keywordPath:t,...n}));for(let r of this.children(n))yield*r.schema.walk({...n,instancePath:[...e,...r.instancePath],keywordPath:[...t,...r.keywordPath]})}*[(B9=Ir,Symbol.iterator)](e){for(let t of this.walk(e))yield t}toJSON(){let{toJSON:e,"~standard":t,...n}=this;return JSON.parse(JSON.stringify(n))}},Oy=class{constructor(e,t={}){K(this,"instancePath");K(this,"keywordPath");K(this,"data");this.schema=e,this.instancePath=t.instancePath||[],this.keywordPath=t.keywordPath||[];try{let n=n1(t.data,this.instancePath);e.validate(n).valid&&(this.data=n)}catch{}}appendInstancePath(e){return this.instancePath=[...this.instancePath,...e],this}appendKeywordPath(e){return this.keywordPath=[...this.keywordPath,...e],this}setData(e){return this.data=structuredClone(e),this}};function s1(e,t,n){return new class extends Xa{constructor(){super(...arguments);K(this,"type",e)}}(t,n)}function GL(e){return new class extends Xa{toJSON(){return e}validate(t,n){return e?et():Qt(n,"","Always fails",t)}}}var ai=e=>s1(e==null?void 0:e.type,e),ti=(e,t)=>s1(void 0,{...t,const:e}),Zae=class dC extends Xa{constructor(n,r){let s=[];for(let[o,a]of Object.entries(n||{}))gae(oi(a),"properties must be managed schemas",a),a[Ir].optional||s.push(o);let i=(r==null?void 0:r.additionalProperties)===!1?GL(!1):r==null?void 0:r.additionalProperties;s=s.length>0?s:void 0;super({...r,additionalProperties:i,properties:n,required:s},{template:(o,a)=>{let c=structuredClone(ir(o)?o:{}),u={...c};if(this.properties)for(let[f,h]of Object.entries(this.properties)){let m=n1(c,f);if(h.isOptional()&&(a==null?void 0:a.withOptional)!==!0&&m===void 0&&o===void 0)continue;let y=h.template(m,a);y!==void 0&&(u[f]=y)}if(!(Object.keys(u).length===0&&!(a!=null&&a.withExtendedOptional)))return u},coerce:(o,a)=>{let c=structuredClone(o),u=Object.keys(this.properties),f=u.length>0&&Object.values(this.properties).every(h=>!h[Ir].optional);if(dae(c)&&((a==null?void 0:a.dropUnknown)===!0||f)&&(c=yae(c,u)),typeof c=="string"&&c.match(/^\{/)&&(c=JSON.parse(c)),!(typeof c!="object"||c===null)){if(this.properties)for(let[h,m]of Object.entries(this.properties)){let y=c[h];y!==void 0&&(c[h]=m.coerce(y,a))}return c}}});K(this,"type","object");K(this,"properties");K(this,"required");this.properties=n,this.required=s}strict(){return new dC(this.properties,{...this[Ir].raw,additionalProperties:!1})}partial(){let n={...this.properties};for(let[,r]of Object.entries(n))r[Ir].optional=!0;return new dC(n,this[Ir].raw)}children(n){let r=[];for(let[s,i]of Object.entries(this.properties)){let o=new Oy(i,n);o.appendInstancePath([s]),o.appendKeywordPath(["properties",s]),r.push(o)}return r}},Qe=(e,t)=>new Zae(e,t),st=(e,t)=>Qe(e,t).strict(),YL=(e,t)=>Qe(e,t).partial(),ele=class extends Xa{constructor(t,n){super({...n,additionalProperties:t},{template:(r,s)=>s!=null&&s.withExtendedOptional&&(r===void 0||!ir(r))?{}:r});K(this,"type","object");K(this,"additionalProperties");this.additionalProperties=t}children(t){let n=[],r=new Oy(this.additionalProperties,t);return r.appendKeywordPath(["additionalProperties"]),n.push(r),n}},Vi=(e,t)=>new ele(e,t),JL=class extends Xa{constructor(t){super(t,{template:(n,r)=>r!=null&&r.withExtendedOptional&&(n===void 0||!ko(n))?"":n,coerce:n=>Ya(n)?String(n):n});K(this,"type","string")}toJSON(){let{pattern:t,"~standard":n,...r}=this;return JSON.parse(JSON.stringify({...r,pattern:t instanceof RegExp?t.source:t}))}},xe=e=>new JL(e),XL=(e,t,n)=>s1(e,n,{template:(r,s)=>s!=null&&s.withExtendedOptional&&(r===void 0||!Ya(r))?(n==null?void 0:n.minimum)??0:r,coerce:r=>{if(ko(r)){let s=t.parseFn(r);if(!Number.isNaN(s))return s}return r}}),Rt=e=>XL("number",{parseFn:Number},e),tle=e=>XL("integer",{parseFn:Number.parseInt},e),nle=class extends Xa{constructor(t,n={}){super({...n,items:t},{template:r=>r===void 0||!Array.isArray(r)?[]:r,coerce:(r,s)=>{try{let i=typeof r=="string"?JSON.parse(r):r;if(!Array.isArray(i))return;if(oi(this.items))for(let[o,a]of i.entries())i[o]=this.items.coerce(a,s);return i}catch{}return r}});K(this,"type","array");this.items=t,this.items=t}children(t){let n=[];if(this.items){let r=new Oy(this.items,t);r.appendKeywordPath(["items"]),n.push(r)}return n}},un=(e,t)=>new nle(e,t),Wt=e=>s1("boolean",e,{template:(t,n)=>n!=null&&n.withExtendedOptional&&(t===void 0||!qA(t))?!1:t,coerce:t=>{if(ko(t)&&["true","false","1","0"].includes(t))return t==="true"||t==="1";if(Ya(t)){if(t===1)return!0;if(t===0)return!1}return t}}),Ab=Symbol.for("unionType"),z9,V9,rle=class extends(V9=Xa,z9=Ab,V9){constructor(t,n,r){super({...r,[n]:t},{coerce:(s,i)=>{let o=r==null?void 0:r.coerce;if(o!==void 0)return o.bind(this)(s,i);let a=r1(t,s,{ignoreUnsupported:!0,resolver:i==null?void 0:i.resolver,coerce:!0});return a.length>0?a[0].coerce(s,i):s}});K(this,z9);this[Ab]=n}get schemas(){return this[this[Ab]]}children(t){let n=[];for(let[r,s]of this.schemas.entries()){let i=new Oy(s,t);i.appendKeywordPath([this[Ab],r]),n.push(i)}return n}},Zt=(e,t)=>new rle(e,"anyOf",t);function O6(e,t){return Array.isArray(e)?e.map(t):e!==void 0?[t(e)]:[]}function j6(e,t,n=r=>r){return Object.fromEntries(Object.entries(e).map(([r,s])=>[r,n(t(s),r)]))}function Gl(e){if(qA(e))return GL(e);let t=structuredClone(e);if(!ir(t))throw new lae("non-object schemas not implemented",t);"properties"in t&&t.properties&&(t.properties=j6(t.properties,Gl,(i,o)=>"required"in t&&Array.isArray(t.required)&&t.required.includes(o)?i:i.optional()));let n=["patternProperties","dependentSchemas","$defs"];for(let i of n)i in t&&t[i]&&(t[i]=j6(t[i],Gl));let r=["additionalProperties","items","prefixItems","propertyNames","contains","not","if","then","else"];for(let i of r)i in t&&typeof t[i]<"u"&&(Ja(t[i])?t[i]=O6(t[i],Gl):t[i]=Gl(t[i]));let s=["anyOf","oneOf","allOf"];for(let i of s)if(i in t){let{[i]:o}=t;t[i]=O6(o,Gl)}if(pae(t))switch(t.type){case"string":return xe(t);case"number":return Rt(t);case"integer":return tle(t);case"boolean":return Wt(t);case"object":{let{properties:i,...o}=t;return Qe(i,o)}case"array":{let{items:i,...o}=t;return un(i,o)}}return ai(t)}var sle=e=>e(new Xa({$ref:"#",coerce:(t,n)=>{var s;let r=(s=n==null?void 0:n.resolver)==null?void 0:s.resolve("#");if(!oi(r))throw new Error("Ref not found: #");return r.coerce(t,n)}})),KL=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},ile=e=>{const{groups:t,path:n}=ole(e),r=KL(n);return ale(r,t)},ole=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(n,r)=>{const s=`@${r}`;return t.push([s,n]),s}),{groups:t,path:e}},ale=(e,t)=>{for(let n=t.length-1;n>=0;n--){const[r]=t[n];for(let s=e.length-1;s>=0;s--)if(e[s].includes(r)){e[s]=e[s].replace(r,t[n][1]);break}}return e},$b={},lle=(e,t)=>{if(e==="*")return"*";const n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){const r=`${e}#${t}`;return $b[r]||(n[2]?$b[r]=t&&t[0]!==":"&&t[0]!=="*"?[r,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:$b[r]=[e,n[1],!0]),$b[r]}return null},i1=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},cle=e=>i1(e,decodeURI),QL=e=>{const t=e.url,n=t.indexOf("/",t.charCodeAt(9)===58?13:8);let r=n;for(;r<t.length;r++){const s=t.charCodeAt(r);if(s===37){const i=t.indexOf("?",r),o=t.slice(n,i===-1?void 0:i);return cle(o.includes("%25")?o.replace(/%25/g,"%2525"):o)}else if(s===63)break}return t.slice(n,r)},ule=e=>{const t=QL(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},Of=(e,t,...n)=>(n.length&&(t=Of(t,...n)),`${(e==null?void 0:e[0])==="/"?"":"/"}${e}${t==="/"?"":`${(e==null?void 0:e.at(-1))==="/"?"":"/"}${(t==null?void 0:t[0])==="/"?t.slice(1):t}`}`),ZL=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),n=[];let r="";return t.forEach(s=>{if(s!==""&&!/\:/.test(s))r+="/"+s;else if(/\:/.test(s))if(/\?/.test(s)){n.length===0&&r===""?n.push("/"):n.push(r);const i=s.replace("?","");r+="/"+i,n.push(r)}else r+="/"+s}),n.filter((s,i,o)=>o.indexOf(s)===i)},oN=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?i1(e,HA):e):e,eF=(e,t,n)=>{let r;if(!n&&t&&!/[%+]/.test(t)){let o=e.indexOf(`?${t}`,8);for(o===-1&&(o=e.indexOf(`&${t}`,8));o!==-1;){const a=e.charCodeAt(o+t.length+1);if(a===61){const c=o+t.length+2,u=e.indexOf("&",c);return oN(e.slice(c,u===-1?void 0:u))}else if(a==38||isNaN(a))return"";o=e.indexOf(`&${t}`,o+1)}if(r=/[%+]/.test(e),!r)return}const s={};r??(r=/[%+]/.test(e));let i=e.indexOf("?",8);for(;i!==-1;){const o=e.indexOf("&",i+1);let a=e.indexOf("=",i);a>o&&o!==-1&&(a=-1);let c=e.slice(i+1,a===-1?o===-1?void 0:o:a);if(r&&(c=oN(c)),i=o,c==="")continue;let u;a===-1?u="":(u=e.slice(a+1,o===-1?void 0:o),r&&(u=oN(u))),n?(s[c]&&Array.isArray(s[c])||(s[c]=[]),s[c].push(u)):s[c]??(s[c]=u)}return t?s[t]:s},dle=eF,fle=(e,t)=>eF(e,t,!0),HA=decodeURIComponent,WA={name:"HMAC",hash:"SHA-256"},tF=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,WA,!1,["sign","verify"])},hle=async(e,t)=>{const n=await tF(t),r=await crypto.subtle.sign(WA.name,n,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(r)))},ple=async(e,t,n)=>{try{const r=atob(e),s=new Uint8Array(r.length);for(let i=0,o=r.length;i<o;i++)s[i]=r.charCodeAt(i);return await crypto.subtle.verify(WA,n,s,new TextEncoder().encode(t))}catch{return!1}},mle=/^[\w!#$%&'*.^`|~+-]+$/,gle=/^[ !#-:<-[\]-~]*$/,fC=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const n=e.trim().split(";"),r={};for(let s of n){s=s.trim();const i=s.indexOf("=");if(i===-1)continue;const o=s.substring(0,i).trim();if(t&&t!==o||!mle.test(o))continue;let a=s.substring(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1)),gle.test(a)&&(r[o]=a.indexOf("%")!==-1?i1(a,HA):a,t))break}return r},A6=async(e,t,n)=>{const r={},s=await tF(t);for(const[i,o]of Object.entries(fC(e,n))){const a=o.lastIndexOf(".");if(a<1)continue;const c=o.substring(0,a),u=o.substring(a+1);if(u.length!==44||!u.endsWith("="))continue;const f=await ple(u,c,s);r[i]=f?c:!1}return r},nF=(e,t,n={})=>{let r=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");r+="; Partitioned"}return r},aN=(e,t,n)=>(t=encodeURIComponent(t),nF(e,t,n)),yv=async(e,t,n,r={})=>{const s=await hle(t,n);return t=`${t}.${s}`,t=encodeURIComponent(t),nF(e,t,r)},rF=(e,t,n)=>{const r=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!r)return;let i=t;return n==="secure"?i="__Secure-"+t:n==="host"&&(i="__Host-"+t),fC(r,i)[i]}return r?fC(r):{}},sF=async(e,t,n,r)=>{const s=e.req.raw.headers.get("Cookie");if(typeof n=="string"){if(!s)return;let o=n;return(await A6(s,t,o))[o]}return s?await A6(s,t):{}},iF=(e,t,n,r)=>{let s;(r==null?void 0:r.prefix)==="secure"?s=aN("__Secure-"+t,n,{path:"/",...r,secure:!0}):(r==null?void 0:r.prefix)==="host"?s=aN("__Host-"+t,n,{...r,path:"/",secure:!0,domain:void 0}):s=aN(t,n,{path:"/",...r}),e.header("Set-Cookie",s,{append:!0})},oF=async(e,t,n,r,s)=>{let i;(s==null?void 0:s.prefix)==="secure"?i=await yv("__Secure-"+t,n,r,{path:"/",...s,secure:!0}):(s==null?void 0:s.prefix)==="host"?i=await yv("__Host-"+t,n,r,{...s,path:"/",secure:!0,domain:void 0}):i=await yv(t,n,r,{path:"/",...s}),e.header("set-cookie",i,{append:!0})},yle=(e,t,n)=>{const r=rF(e,t,n==null?void 0:n.prefix);return iF(e,t,"",{...n,maxAge:0}),r},$6=class extends Error{constructor(t=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});K(this,"res");K(this,"status");this.res=n==null?void 0:n.res,this.status=t}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},ble=(e,t)=>new Response(e,{headers:{"Content-Type":t}}).formData(),vle=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,xle=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/,wle=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,Sle=(e,t)=>async(n,r)=>{let s={};const i=n.req.header("Content-Type");switch(e){case"json":if(!i||!vle.test(i))break;try{s=await n.req.json()}catch{const a="Malformed JSON in request body";throw new $6(400,{message:a})}break;case"form":{if(!i||!(xle.test(i)||wle.test(i)))break;let a;if(n.req.bodyCache.formData)a=await n.req.bodyCache.formData;else try{const u=await n.req.arrayBuffer();a=await ble(u,i),n.req.bodyCache.formData=a}catch(u){let f="Malformed FormData request.";throw f+=u instanceof Error?` ${u.message}`:` ${String(u)}`,new $6(400,{message:f})}const c={};a.forEach((u,f)=>{f.endsWith("[]")?(c[f]??(c[f]=[])).push(u):Array.isArray(c[f])?c[f].push(u):f in c?c[f]=[c[f],u]:c[f]=u}),s=c;break}case"query":s=Object.fromEntries(Object.entries(n.req.queries()).map(([a,c])=>c.length===1?[a,c[0]]:[a,c]));break;case"param":s=n.req.param();break;case"header":s=n.req.header();break;case"cookie":s=rF(n);break}const o=await t(s,n);if(o instanceof Response)return o;n.req.addValidatedData(e,o),await r()},aF=Symbol.for("jsonv"),qt=(e,t,n,r)=>{let s=Sle(e,async(i,o)=>{let a=(n==null?void 0:n.coerce)!==!1?t.coerce(i,{dropUnknown:n==null?void 0:n.dropUnknown}):i,c=t.validate(a);return c.valid?a:o.json({...c,schema:t},400)});return n!=null&&n.skipOpenAPI?s:Object.assign(s,{[aF]:{type:"parameters",value:{target:e,schema:t}}})},Ele={query:"query",param:"path",header:"header",cookie:"cookie"},Nle={json:{type:"application/json"},form:{type:"multipart/form-data"}};function _le(e,t){var s;let n=Ele[t],r=Nle[t];return n?{parameters:Object.entries(e.properties).map(([i,o])=>{var a;return{name:i,in:n,required:((a=e.required)==null?void 0:a.includes(i))||void 0,description:(o==null?void 0:o.description)||void 0,schema:structuredClone(o.toJSON())}})}:r?{requestBody:{content:{[r.type]:{schema:structuredClone(e.toJSON()),example:((s=e.examples)==null?void 0:s[0])??e.template({},{withOptional:!0,withExtendedOptional:!0})}}}}:{}}var Kt=e=>Object.assign(async(t,n)=>{await n()},{[aF]:{type:"route-doc",value:e}});class Cle extends JL{}const Ole=e=>new Cle(e),jle=e=>e,Zu=xe({pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$",minLength:2,maxLength:150});class o1 extends Error{constructor(t,n,r=[]){super(`Invalid schema given for ${JSON.stringify(n,null,2)}

Error: ${JSON.stringify(r[0],null,2)}`),this.schema=t,this.value=n,this.errors=r}first(){return this.errors[0]}firstToString(){const t=this.first();return`${t.error} at ${t.instanceLocation}`}}const lF=e=>{const t=e.toJSON();return Gl(t)};function Ln(e,t,n){const r=n!=null&&n.clone?lF(e):e;let s=(n==null?void 0:n.coerce)!==!1?r.coerce(t,{dropUnknown:(n==null?void 0:n.coerceDropUnknown)??!1}):t;(n==null?void 0:n.withDefaults)!==!1&&(s=r.template(s,{withOptional:!0,withExtendedOptional:(n==null?void 0:n.withExtendedDefaults)??!1}));const i=e.validate(s,{shortCircuit:!0,ignoreUnsupported:!0});if(!i.valid)if(n!=null&&n.onError)n.onError(i.errors);else throw new o1(r,t,i.errors);return s}let li=class extends Error{constructor(n,r){super(n);K(this,"code",fn.BAD_REQUEST);K(this,"name","Exception");K(this,"_context");r&&(this.code=r)}context(n){return this._context=n,this}toJSON(){return{error:this.message,type:this.name,context:this._context}}};class Mf extends Error{constructor(t,n,r){super(t),this.details=n,this.type=r}static with(t,n,r){throw new Mf(t,n,r)}toJSON(){return{type:this.type??"unknown",message:this.message,details:this.details}}}class zr{constructor(t){this.name=t,this.name=t}toJSON(){return{name:this.name}}}class T6{constructor(t,n){this.permission=t,this.config=n}}class Qv{constructor(t,n=[],r=!1,s=!1){this.name=t,this.permissions=n,this.is_default=r,this.implicit_allow=s}static createWithPermissionNames(t,n,r=!1,s=!1){return new Qv(t,n.map(i=>new T6(new zr(i))),r,s)}static create(t){var n;return new Qv(t.name,((n=t.permissions)==null?void 0:n.map(r=>new T6(new zr(r))))??[],t.is_default,t.implicit_allow)}}var L_;let Hr=(L_=class{constructor(t){K(this,"_returning");K(this,"params");K(this,"returned",!1);this.params=t}validate(t){throw new Ale(this,t)}clone(t){const n=new this.constructor(t);return n.returned=!0,n}},K(L_,"slug","untitled-event"),L_);class a1 extends Error{constructor(t,n){super(`Expected "${t}", got "${n}"`)}}class Ale extends Error{constructor(t,n){super(`Event "${t.constructor.slug}" returned without validation`),this.data=n}}class $le{constructor(t,n,r="async",s){K(this,"mode","async");K(this,"event");K(this,"handler");K(this,"once",!1);K(this,"id");this.event=t,this.handler=n,this.mode=r,this.id=s}}class jy{constructor(t,n){K(this,"events",[]);K(this,"listeners",[]);K(this,"enabled",!0);K(this,"asyncs",[]);var r;this.options=n,t&&this.registerEvents(t),(r=n==null?void 0:n.listeners)==null||r.forEach(s=>this.addListener(s))}enable(){return this.enabled=!0,this}disable(){return this.enabled=!1,this}clearEvents(){return this.events=[],this}clearAll(){return this.clearEvents(),this.listeners=[],this}getListeners(){return[...this.listeners]}get Events(){return new Proxy(this,{get:(t,n)=>this.events.find(r=>r.slug===n)})}eventExists(t){var r;let n;return typeof t=="string"?n=t:n=((r=t.constructor)==null?void 0:r.slug)??t.slug,!!this.events.find(s=>n===s.slug)}throwIfEventNotRegistered(t){var n;if(!this.eventExists(t)){const r=((n=t.constructor)==null?void 0:n.slug)??t.slug??t;throw new Error(`Event "${r}" not registered`)}}registerEvent(t,n=!1){if(this.eventExists(t)){if(n)return this;throw new Error(`Event "${t.name}" already registered.`)}return this.events.push(t),this}registerEvents(t){return(typeof t=="object"?Object.values(t):t).forEach(r=>this.registerEvent(r,!0)),this}addListener(t){return this.throwIfEventNotRegistered(t.event),t.id&&this.listeners.find(r=>r.id===t.id)?(pt.debug(`Listener with id "${t.id}" already exists.`),this):(this.listeners.push(t),this)}createEventListener(t,n,r="async"){const s=typeof t=="string"?this.events.find(a=>a.slug===t):t,i=typeof r=="string"?{mode:r}:r,o=new $le(s,n,i.mode);i.once&&(o.once=!0),i.id&&(o.id=`${s.slug}-${i.id}`),this.addListener(o)}onEvent(t,n,r){this.createEventListener(t,n,r)}on(t,n,r){this.createEventListener(t,n,r)}onAny(t,n){this.events.forEach(r=>this.onEvent(r,t,n))}collectAsyncs(t){this.asyncs.push(...t)}async executeAsyncs(t=n=>Promise.all(n)){if(this.asyncs.length===0)return;const n=[...this.asyncs];this.asyncs=[],await t(n.map(r=>r()))}async emit(t){var o,a,c;const n=t.constructor.slug;if(!this.enabled)return pt.debug("EventManager disabled, not emitting",n),t;if(!this.eventExists(t))throw new Error(`Event "${n}" not registered`);const r=[],s=[];this.listeners=this.listeners.filter(u=>u.event.slug!==n?!0:(u.mode==="sync"?r.push(u):s.push(async()=>await u.handler(t,u.event.slug)),!u.once)),this.collectAsyncs(s);let i=t;for(const u of r)try{const f=await u.handler(i,u.event.slug);if(typeof f<"u"){const h=i.validate(f);if(h&&h.constructor.slug===n){if(!h.returned)throw new Error(`Returned event ${h.constructor.slug} must be marked as returned.`);i=h}}}catch(f){if(f instanceof a1)(a=(o=this.options)==null?void 0:o.onInvalidReturn)==null||a.call(o,i,f),pt.warn(`Invalid return of event listener for "${n}": ${f.message}`);else if((c=this.options)!=null&&c.onError)this.options.onError(i,f);else throw f}return i}}function Zv(e){return typeof e>"u"||e===void 0}function Oo(e){return typeof e=="string"}function GA(e){return typeof e=="number"}function cF(e){return typeof e=="boolean"}function uF(e){return e===null}function dF(e){return typeof e=="bigint"}function pd(e){return typeof e=="function"}function l1(e){return typeof e=="object"&&e!==null}function ee(e){return Object.freeze(e)}function Tb(e){return xc(e)?e:[e]}function xc(e){return Array.isArray(e)}const Ss=ee({is(e){return e.kind==="IdentifierNode"},create(e){return ee({kind:"IdentifierNode",name:e})}}),hC=ee({is(e){return e.kind==="SchemableIdentifierNode"},create(e){return ee({kind:"SchemableIdentifierNode",identifier:Ss.create(e)})},createWithSchema(e,t){return ee({kind:"SchemableIdentifierNode",schema:Ss.create(e),identifier:Ss.create(t)})}}),kc=ee({is(e){return e.kind==="AliasNode"},create(e,t){return ee({kind:"AliasNode",node:e,alias:t})}}),lc=ee({is(e){return e.kind==="TableNode"},create(e){return ee({kind:"TableNode",table:hC.create(e)})},createWithSchema(e,t){return ee({kind:"TableNode",table:hC.createWithSchema(e,t)})}});function gi(e){return l1(e)&&pd(e.toOperationNode)}function Tle(e){return l1(e)&&"expressionType"in e&&gi(e)}function Rle(e){return l1(e)&&"expression"in e&&Oo(e.alias)&&gi(e)}const sa=ee({is(e){return e.kind==="SelectModifierNode"},create(e,t){return ee({kind:"SelectModifierNode",modifier:e,of:t})},createWithExpression(e){return ee({kind:"SelectModifierNode",rawModifier:e})}}),wc=ee({is(e){return e.kind==="AndNode"},create(e,t){return ee({kind:"AndNode",left:e,right:t})}}),ip=ee({is(e){return e.kind==="OrNode"},create(e,t){return ee({kind:"OrNode",left:e,right:t})}}),lN=ee({is(e){return e.kind==="OnNode"},create(e){return ee({kind:"OnNode",on:e})},cloneWithOperation(e,t,n){return ee({...e,on:t==="And"?wc.create(e.on,n):ip.create(e.on,n)})}}),Wm=ee({is(e){return e.kind==="JoinNode"},create(e,t){return ee({kind:"JoinNode",joinType:e,table:t,on:void 0})},createWithOn(e,t,n){return ee({kind:"JoinNode",joinType:e,table:t,on:lN.create(n)})},cloneWithOn(e,t){return ee({...e,on:e.on?lN.cloneWithOperation(e.on,"And",t):lN.create(t)})}}),Eh=ee({is(e){return e.kind==="BinaryOperationNode"},create(e,t,n){return ee({kind:"BinaryOperationNode",leftOperand:e,operator:t,rightOperand:n})}}),Mle=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","^@","&&","?","?&","?|","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->","regexp","is distinct from","is not distinct from"],kle=["+","-","*","/","%","^","&","|","#","<<",">>"],fF=["->","->>"],Ile=[...Mle,...kle,"&&","||"],Dle=["exists","not exists"],Ple=["not","-",...Dle],Lle=[...Ile,...fF,...Ple,"between","between symmetric"],ed=ee({is(e){return e.kind==="OperatorNode"},create(e){return ee({kind:"OperatorNode",operator:e})}});function R6(e){return Oo(e)&&fF.includes(e)}const YA=ee({is(e){return e.kind==="ColumnNode"},create(e){return ee({kind:"ColumnNode",column:Ss.create(e)})}}),hF=ee({is(e){return e.kind==="SelectAllNode"},create(){return ee({kind:"SelectAllNode"})}}),c1=ee({is(e){return e.kind==="ReferenceNode"},create(e,t){return ee({kind:"ReferenceNode",table:t,column:e})},createSelectAll(e){return ee({kind:"ReferenceNode",table:e,column:hF.create()})}});function pF(e){return l1(e)&&gi(e)&&Oo(e.dynamicReference)}const pC=ee({is(e){return e.kind==="OrderByItemNode"},create(e,t){return ee({kind:"OrderByItemNode",orderBy:e,direction:t})}}),gs=ee({is(e){return e.kind==="RawNode"},create(e,t){return ee({kind:"RawNode",sqlFragments:ee(e),parameters:ee(t)})},createWithSql(e){return gs.create([e],[])},createWithChild(e){return gs.create(["",""],[e])},createWithChildren(e){return gs.create(new Array(e.length+1).fill(""),e)}});function Fle(e){return e==="asc"||e==="desc"}function JA(e){if(e.length===2)return[cN(e[0],e[1])];if(e.length===1){const[t]=e;return Array.isArray(t)?t.map(n=>cN(n)):[cN(t)]}throw new Error(`Invalid number of arguments at order by! expected 1-2, received ${e.length}`)}function cN(e,t){const n=Ble(e);if(pC.is(n)){if(t)throw new Error("Cannot specify direction twice!");return n}return pC.create(n,mF(t))}function Ble(e){if(h1(e))return f1(e);if(pF(e))return e.toOperationNode();const[t,n]=e.split(" ");if(n){if(!Fle(n))throw new Error(`Invalid order by direction: ${n}`);return pC.create(Sc(t),mF(n))}return Sc(e)}function mF(e){if(e)return e==="asc"||e==="desc"?gs.createWithSql(e):e.toOperationNode()}const ex=ee({is(e){return e.kind==="JSONReferenceNode"},create(e,t){return ee({kind:"JSONReferenceNode",reference:e,traversal:t})},cloneWithTraversal(e,t){return ee({...e,traversal:t})}}),gF=ee({is(e){return e.kind==="JSONOperatorChainNode"},create(e){return ee({kind:"JSONOperatorChainNode",operator:e,values:ee([])})},cloneWithValue(e,t){return ee({...e,values:ee([...e.values,t])})}}),Gm=ee({is(e){return e.kind==="JSONPathNode"},create(e){return ee({kind:"JSONPathNode",inOperator:e,pathLegs:ee([])})},cloneWithLeg(e,t){return ee({...e,pathLegs:ee([...e.pathLegs,t])})}});function zle(e){return Oo(e)?Sc(e):e.toOperationNode()}function wg(e){return xc(e)?e.map(t=>Ks(t)):[Ks(e)]}function Ks(e){return h1(e)?f1(e):zle(e)}function Vle(e,t){const n=Sc(e);if(R6(t))return ex.create(n,gF.create(ed.create(t)));const r=t.slice(0,-1);if(R6(r))return ex.create(n,Gm.create(ed.create(r)));throw new Error(`Invalid JSON operator: ${t}`)}function Sc(e){const t=".";if(!e.includes(t))return c1.create(YA.create(e));const n=e.split(t).map(yF);if(n.length===3)return qle(n);if(n.length===2)return Hle(n);throw new Error(`invalid column reference ${e}`)}function Ule(e){const t=" as ";if(e.includes(t)){const[n,r]=e.split(t).map(yF);return kc.create(Sc(n),Ss.create(r))}else return Sc(e)}function qle(e){const[t,n,r]=e;return c1.create(YA.create(r),lc.createWithSchema(t,n))}function Hle(e){const[t,n]=e;return c1.create(YA.create(n),lc.create(t))}function yF(e){return e.trim()}const Wle=ee({is(e){return e.kind==="PrimitiveValueListNode"},create(e){return ee({kind:"PrimitiveValueListNode",values:ee([...e])})}}),Gle=ee({is(e){return e.kind==="ValueListNode"},create(e){return ee({kind:"ValueListNode",values:ee(e)})}}),Ec=ee({is(e){return e.kind==="ValueNode"},create(e){return ee({kind:"ValueNode",value:e})},createImmediate(e){return ee({kind:"ValueNode",value:e,immediate:!0})}});function Yle(e){return xc(e)?Jle(e):Lr(e)}function Lr(e){return h1(e)?f1(e):Ec.create(e)}function XA(e){return GA(e)||cF(e)||uF(e)}function KA(e){if(!XA(e))throw new Error(`unsafe immediate value ${JSON.stringify(e)}`);return Ec.createImmediate(e)}function Jle(e){return e.some(h1)?Gle.create(e.map(t=>Lr(t))):Wle.create(e)}const Sg=ee({is(e){return e.kind==="ParensNode"},create(e){return ee({kind:"ParensNode",node:e})}});function Gi(e){if(e.length===3)return QA(e[0],e[1],e[2]);if(e.length===1)return Lr(e[0]);throw new Error(`invalid arguments: ${JSON.stringify(e)}`)}function QA(e,t,n){return Xle(t)&&bF(n)?Eh.create(Ks(e),gC(t),Ec.createImmediate(n)):Eh.create(Ks(e),gC(t),Yle(n))}function Eg(e,t,n){return Eh.create(Ks(e),gC(t),Ks(n))}function M6(e,t){return mC(Object.entries(e).filter(([,n])=>!Zv(n)).map(([n,r])=>QA(n,bF(r)?"is":"=",r)),t)}function mC(e,t,n=!0){const r=t==="and"?wc.create:ip.create;if(e.length===0)return Eh.create(Ec.createImmediate(1),ed.create("="),Ec.createImmediate(t==="and"?1:0));let s=k6(e[0]);for(let i=1;i<e.length;++i)s=r(s,k6(e[i]));return e.length>1&&n?Sg.create(s):s}function Xle(e){return e==="is"||e==="is not"}function bF(e){return uF(e)||cF(e)}function gC(e){if(Oo(e)&&Lle.includes(e))return ed.create(e);if(gi(e))return e.toOperationNode();throw new Error(`invalid operator ${JSON.stringify(e)}`)}function k6(e){return gi(e)?e.toOperationNode():e}const Nc=ee({is(e){return e.kind==="OrderByNode"},create(e){return ee({kind:"OrderByNode",items:ee([...e])})},cloneWithItems(e,t){return ee({...e,items:ee([...e.items,...t])})}}),I6=ee({is(e){return e.kind==="PartitionByNode"},create(e){return ee({kind:"PartitionByNode",items:ee(e)})},cloneWithItems(e,t){return ee({...e,items:ee([...e.items,...t])})}}),yC=ee({is(e){return e.kind==="OverNode"},create(){return ee({kind:"OverNode"})},cloneWithOrderByItems(e,t){return ee({...e,orderBy:e.orderBy?Nc.cloneWithItems(e.orderBy,t):Nc.create(t)})},cloneWithPartitionByItems(e,t){return ee({...e,partitionBy:e.partitionBy?I6.cloneWithItems(e.partitionBy,t):I6.create(t)})}}),tx=ee({is(e){return e.kind==="FromNode"},create(e){return ee({kind:"FromNode",froms:ee(e)})},cloneWithFroms(e,t){return ee({...e,froms:ee([...e.froms,...t])})}}),D6=ee({is(e){return e.kind==="GroupByNode"},create(e){return ee({kind:"GroupByNode",items:ee(e)})},cloneWithItems(e,t){return ee({...e,items:ee([...e.items,...t])})}}),P6=ee({is(e){return e.kind==="HavingNode"},create(e){return ee({kind:"HavingNode",having:e})},cloneWithOperation(e,t,n){return ee({...e,having:t==="And"?wc.create(e.having,n):ip.create(e.having,n)})}}),on=ee({is(e){return e.kind==="SelectQueryNode"},create(e){return ee({kind:"SelectQueryNode",...e&&{with:e}})},createFrom(e,t){return ee({kind:"SelectQueryNode",from:tx.create(e),...t&&{with:t}})},cloneWithSelections(e,t){return ee({...e,selections:e.selections?ee([...e.selections,...t]):ee(t)})},cloneWithDistinctOn(e,t){return ee({...e,distinctOn:e.distinctOn?ee([...e.distinctOn,...t]):ee(t)})},cloneWithFrontModifier(e,t){return ee({...e,frontModifiers:e.frontModifiers?ee([...e.frontModifiers,t]):ee([t])})},cloneWithOrderByItems(e,t){return ee({...e,orderBy:e.orderBy?Nc.cloneWithItems(e.orderBy,t):Nc.create(t)})},cloneWithGroupByItems(e,t){return ee({...e,groupBy:e.groupBy?D6.cloneWithItems(e.groupBy,t):D6.create(t)})},cloneWithLimit(e,t){return ee({...e,limit:t})},cloneWithOffset(e,t){return ee({...e,offset:t})},cloneWithFetch(e,t){return ee({...e,fetch:t})},cloneWithHaving(e,t){return ee({...e,having:e.having?P6.cloneWithOperation(e.having,"And",t):P6.create(t)})},cloneWithSetOperations(e,t){return ee({...e,setOperations:e.setOperations?ee([...e.setOperations,...t]):ee([...t])})},cloneWithoutSelections(e){return ee({...e,selections:[]})},cloneWithoutLimit(e){return ee({...e,limit:void 0})},cloneWithoutOffset(e){return ee({...e,offset:void 0})},cloneWithoutOrderBy(e){return ee({...e,orderBy:void 0})},cloneWithoutGroupBy(e){return ee({...e,groupBy:void 0})}});function md(e,t){Object.defineProperties(e.prototype,{then:{enumerable:!1,value:()=>{throw new Error(t)}}})}var ji,yc;let vF=(yc=class{constructor(t){Fe(this,ji);Be(this,ji,ee(t))}on(...t){return new yc({...G(this,ji),joinNode:Wm.cloneWithOn(G(this,ji).joinNode,Gi(t))})}onRef(t,n,r){return new yc({...G(this,ji),joinNode:Wm.cloneWithOn(G(this,ji).joinNode,Eg(t,n,r))})}onTrue(){return new yc({...G(this,ji),joinNode:Wm.cloneWithOn(G(this,ji).joinNode,gs.createWithSql("true"))})}$call(t){return t(this)}toOperationNode(){return G(this,ji).joinNode}},ji=new WeakMap,yc);md(vF,"don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");const Kle=ee({is(e){return e.kind==="PartitionByItemNode"},create(e){return ee({kind:"PartitionByItemNode",partitionBy:e})}});function Qle(e){return wg(e).map(Kle.create)}var Mu;const uw=class uw{constructor(t){Fe(this,Mu);Be(this,Mu,ee(t))}orderBy(t,n){return new uw({overNode:yC.cloneWithOrderByItems(G(this,Mu).overNode,JA([t,n]))})}partitionBy(t){return new uw({overNode:yC.cloneWithPartitionByItems(G(this,Mu).overNode,Qle(t))})}$call(t){return t(this)}toOperationNode(){return G(this,Mu).overNode}};Mu=new WeakMap;let nx=uw;md(nx,"don't await OverBuilder instances. They are never executed directly and are always just a part of a query.");const Ym=ee({is(e){return e.kind==="SelectionNode"},create(e){return ee({kind:"SelectionNode",selection:e})},createSelectAll(){return ee({kind:"SelectionNode",selection:hF.create()})},createSelectAllFromTable(e){return ee({kind:"SelectionNode",selection:c1.createSelectAll(e)})}});function xF(e){return pd(e)?xF(e(d1())):xc(e)?e.map(t=>L6(t)):[L6(e)]}function L6(e){return Oo(e)?Ym.create(Ule(e)):pF(e)?Ym.create(e.toOperationNode()):Ym.create(AF(e))}function wF(e){return e?Array.isArray(e)?e.map(F6):[F6(e)]:[Ym.createSelectAll()]}function F6(e){if(Oo(e))return Ym.createSelectAllFromTable(Li(e));throw new Error(`invalid value selectAll expression: ${JSON.stringify(e)}`)}const Zle=ee({is(e){return e.kind==="InsertQueryNode"},create(e,t,n){return ee({kind:"InsertQueryNode",into:e,...t&&{with:t},replace:n})},createWithoutInto(){return ee({kind:"InsertQueryNode"})},cloneWith(e,t){return ee({...e,...t})}}),ece=ee({is(e){return e.kind==="UpdateQueryNode"},create(e,t){return ee({kind:"UpdateQueryNode",table:e,...t&&{with:t}})},createWithoutTable(){return ee({kind:"UpdateQueryNode"})},cloneWithFromItems(e,t){return ee({...e,from:e.from?tx.cloneWithFroms(e.from,t):tx.create(t)})},cloneWithUpdates(e,t){return ee({...e,updates:e.updates?ee([...e.updates,...t]):t})},cloneWithLimit(e,t){return ee({...e,limit:t})}}),B6=ee({is(e){return e.kind==="UsingNode"},create(e){return ee({kind:"UsingNode",tables:ee(e)})},cloneWithTables(e,t){return ee({...e,tables:ee([...e.tables,...t])})}}),tce=ee({is(e){return e.kind==="DeleteQueryNode"},create(e,t){return ee({kind:"DeleteQueryNode",from:tx.create(e),...t&&{with:t}})},cloneWithOrderByItems(e,t){return ee({...e,orderBy:e.orderBy?Nc.cloneWithItems(e.orderBy,t):Nc.create(t)})},cloneWithoutOrderBy(e){return ee({...e,orderBy:void 0})},cloneWithLimit(e,t){return ee({...e,limit:t})},cloneWithoutLimit(e){return ee({...e,limit:void 0})},cloneWithUsing(e,t){return ee({...e,using:e.using!==void 0?B6.cloneWithTables(e.using,t):B6.create(t)})}}),kf=ee({is(e){return e.kind==="WhereNode"},create(e){return ee({kind:"WhereNode",where:e})},cloneWithOperation(e,t,n){return ee({...e,where:t==="And"?wc.create(e.where,n):ip.create(e.where,n)})}}),z6=ee({is(e){return e.kind==="ReturningNode"},create(e){return ee({kind:"ReturningNode",selections:ee(e)})},cloneWithSelections(e,t){return ee({...e,selections:e.selections?ee([...e.selections,...t]):ee(t)})}}),nce=ee({is(e){return e.kind==="ExplainNode"},create(e,t){return ee({kind:"ExplainNode",format:e,options:t})}}),u1=ee({is(e){return e.kind==="WhenNode"},create(e){return ee({kind:"WhenNode",condition:e})},cloneWithResult(e,t){return ee({...e,result:t})}}),rce=ee({is(e){return e.kind==="MergeQueryNode"},create(e,t){return ee({kind:"MergeQueryNode",into:e,...t&&{with:t}})},cloneWithUsing(e,t){return ee({...e,using:t})},cloneWithWhen(e,t){return ee({...e,whens:e.whens?ee([...e.whens,t]):ee([t])})},cloneWithThen(e,t){return ee({...e,whens:e.whens?ee([...e.whens.slice(0,-1),u1.cloneWithResult(e.whens[e.whens.length-1],t)]):void 0})}}),V6=ee({is(e){return e.kind==="OutputNode"},create(e){return ee({kind:"OutputNode",selections:ee(e)})},cloneWithSelections(e,t){return ee({...e,selections:e.selections?ee([...e.selections,...t]):ee(t)})}}),er=ee({is(e){return on.is(e)||Zle.is(e)||ece.is(e)||tce.is(e)||rce.is(e)},cloneWithEndModifier(e,t){return ee({...e,endModifiers:e.endModifiers?ee([...e.endModifiers,t]):ee([t])})},cloneWithWhere(e,t){return ee({...e,where:e.where?kf.cloneWithOperation(e.where,"And",t):kf.create(t)})},cloneWithJoin(e,t){return ee({...e,joins:e.joins?ee([...e.joins,t]):ee([t])})},cloneWithReturning(e,t){return ee({...e,returning:e.returning?z6.cloneWithSelections(e.returning,t):z6.create(t)})},cloneWithoutReturning(e){return ee({...e,returning:void 0})},cloneWithoutWhere(e){return ee({...e,where:void 0})},cloneWithExplain(e,t,n){return ee({...e,explain:nce.create(t,n==null?void 0:n.toOperationNode())})},cloneWithTop(e,t){return ee({...e,top:t})},cloneWithOutput(e,t){return ee({...e,output:e.output?V6.cloneWithSelections(e.output,t):V6.create(t)})}});class sce extends Error{constructor(n){super("no result");K(this,"node");this.node=n}}function ice(e){return Object.prototype.hasOwnProperty.call(e,"prototype")}const oce=ee({is(e){return e.kind==="TopNode"},create(e,t){return ee({kind:"TopNode",expression:e,modifiers:t})}});function ace(e,t){if(!GA(e)&&!dF(e))throw new Error(`Invalid top expression: ${e}`);if(!Zv(t)&&!lce(t))throw new Error(`Invalid top modifiers: ${t}`);return oce.create(e,t)}function lce(e){return e==="percent"||e==="with ties"||e==="percent with ties"}const cce=ee({is(e){return e.kind==="LimitNode"},create(e){return ee({kind:"LimitNode",limit:e})}}),U6=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];function uce(e){let t="";for(let n=0;n<e;++n)t+=dce();return t}function dce(){return U6[~~(Math.random()*U6.length)]}function aa(){return new fce}var Xf;class fce{constructor(){Fe(this,Xf)}get queryId(){return G(this,Xf)===void 0&&Be(this,Xf,uce(8)),G(this,Xf)}}Xf=new WeakMap;var dw;class hce{constructor(){K(this,"nodeStack",[]);Fe(this,dw,ee({AliasNode:this.transformAlias.bind(this),ColumnNode:this.transformColumn.bind(this),IdentifierNode:this.transformIdentifier.bind(this),SchemableIdentifierNode:this.transformSchemableIdentifier.bind(this),RawNode:this.transformRaw.bind(this),ReferenceNode:this.transformReference.bind(this),SelectQueryNode:this.transformSelectQuery.bind(this),SelectionNode:this.transformSelection.bind(this),TableNode:this.transformTable.bind(this),FromNode:this.transformFrom.bind(this),SelectAllNode:this.transformSelectAll.bind(this),AndNode:this.transformAnd.bind(this),OrNode:this.transformOr.bind(this),ValueNode:this.transformValue.bind(this),ValueListNode:this.transformValueList.bind(this),PrimitiveValueListNode:this.transformPrimitiveValueList.bind(this),ParensNode:this.transformParens.bind(this),JoinNode:this.transformJoin.bind(this),OperatorNode:this.transformOperator.bind(this),WhereNode:this.transformWhere.bind(this),InsertQueryNode:this.transformInsertQuery.bind(this),DeleteQueryNode:this.transformDeleteQuery.bind(this),ReturningNode:this.transformReturning.bind(this),CreateTableNode:this.transformCreateTable.bind(this),AddColumnNode:this.transformAddColumn.bind(this),ColumnDefinitionNode:this.transformColumnDefinition.bind(this),DropTableNode:this.transformDropTable.bind(this),DataTypeNode:this.transformDataType.bind(this),OrderByNode:this.transformOrderBy.bind(this),OrderByItemNode:this.transformOrderByItem.bind(this),GroupByNode:this.transformGroupBy.bind(this),GroupByItemNode:this.transformGroupByItem.bind(this),UpdateQueryNode:this.transformUpdateQuery.bind(this),ColumnUpdateNode:this.transformColumnUpdate.bind(this),LimitNode:this.transformLimit.bind(this),OffsetNode:this.transformOffset.bind(this),OnConflictNode:this.transformOnConflict.bind(this),OnDuplicateKeyNode:this.transformOnDuplicateKey.bind(this),CreateIndexNode:this.transformCreateIndex.bind(this),DropIndexNode:this.transformDropIndex.bind(this),ListNode:this.transformList.bind(this),PrimaryKeyConstraintNode:this.transformPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.transformUniqueConstraint.bind(this),ReferencesNode:this.transformReferences.bind(this),CheckConstraintNode:this.transformCheckConstraint.bind(this),WithNode:this.transformWith.bind(this),CommonTableExpressionNode:this.transformCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.transformCommonTableExpressionName.bind(this),HavingNode:this.transformHaving.bind(this),CreateSchemaNode:this.transformCreateSchema.bind(this),DropSchemaNode:this.transformDropSchema.bind(this),AlterTableNode:this.transformAlterTable.bind(this),DropColumnNode:this.transformDropColumn.bind(this),RenameColumnNode:this.transformRenameColumn.bind(this),AlterColumnNode:this.transformAlterColumn.bind(this),ModifyColumnNode:this.transformModifyColumn.bind(this),AddConstraintNode:this.transformAddConstraint.bind(this),DropConstraintNode:this.transformDropConstraint.bind(this),ForeignKeyConstraintNode:this.transformForeignKeyConstraint.bind(this),CreateViewNode:this.transformCreateView.bind(this),DropViewNode:this.transformDropView.bind(this),GeneratedNode:this.transformGenerated.bind(this),DefaultValueNode:this.transformDefaultValue.bind(this),OnNode:this.transformOn.bind(this),ValuesNode:this.transformValues.bind(this),SelectModifierNode:this.transformSelectModifier.bind(this),CreateTypeNode:this.transformCreateType.bind(this),DropTypeNode:this.transformDropType.bind(this),ExplainNode:this.transformExplain.bind(this),DefaultInsertValueNode:this.transformDefaultInsertValue.bind(this),AggregateFunctionNode:this.transformAggregateFunction.bind(this),OverNode:this.transformOver.bind(this),PartitionByNode:this.transformPartitionBy.bind(this),PartitionByItemNode:this.transformPartitionByItem.bind(this),SetOperationNode:this.transformSetOperation.bind(this),BinaryOperationNode:this.transformBinaryOperation.bind(this),UnaryOperationNode:this.transformUnaryOperation.bind(this),UsingNode:this.transformUsing.bind(this),FunctionNode:this.transformFunction.bind(this),CaseNode:this.transformCase.bind(this),WhenNode:this.transformWhen.bind(this),JSONReferenceNode:this.transformJSONReference.bind(this),JSONPathNode:this.transformJSONPath.bind(this),JSONPathLegNode:this.transformJSONPathLeg.bind(this),JSONOperatorChainNode:this.transformJSONOperatorChain.bind(this),TupleNode:this.transformTuple.bind(this),MergeQueryNode:this.transformMergeQuery.bind(this),MatchedNode:this.transformMatched.bind(this),AddIndexNode:this.transformAddIndex.bind(this),CastNode:this.transformCast.bind(this),FetchNode:this.transformFetch.bind(this),TopNode:this.transformTop.bind(this),OutputNode:this.transformOutput.bind(this)}))}transformNode(t){if(!t)return t;this.nodeStack.push(t);const n=this.transformNodeImpl(t);return this.nodeStack.pop(),ee(n)}transformNodeImpl(t){return G(this,dw)[t.kind](t)}transformNodeList(t){return t&&ee(t.map(n=>this.transformNode(n)))}transformSelectQuery(t){return{kind:"SelectQueryNode",from:this.transformNode(t.from),selections:this.transformNodeList(t.selections),distinctOn:this.transformNodeList(t.distinctOn),joins:this.transformNodeList(t.joins),groupBy:this.transformNode(t.groupBy),orderBy:this.transformNode(t.orderBy),where:this.transformNode(t.where),frontModifiers:this.transformNodeList(t.frontModifiers),endModifiers:this.transformNodeList(t.endModifiers),limit:this.transformNode(t.limit),offset:this.transformNode(t.offset),with:this.transformNode(t.with),having:this.transformNode(t.having),explain:this.transformNode(t.explain),setOperations:this.transformNodeList(t.setOperations),fetch:this.transformNode(t.fetch),top:this.transformNode(t.top)}}transformSelection(t){return{kind:"SelectionNode",selection:this.transformNode(t.selection)}}transformColumn(t){return{kind:"ColumnNode",column:this.transformNode(t.column)}}transformAlias(t){return{kind:"AliasNode",node:this.transformNode(t.node),alias:this.transformNode(t.alias)}}transformTable(t){return{kind:"TableNode",table:this.transformNode(t.table)}}transformFrom(t){return{kind:"FromNode",froms:this.transformNodeList(t.froms)}}transformReference(t){return{kind:"ReferenceNode",column:this.transformNode(t.column),table:this.transformNode(t.table)}}transformAnd(t){return{kind:"AndNode",left:this.transformNode(t.left),right:this.transformNode(t.right)}}transformOr(t){return{kind:"OrNode",left:this.transformNode(t.left),right:this.transformNode(t.right)}}transformValueList(t){return{kind:"ValueListNode",values:this.transformNodeList(t.values)}}transformParens(t){return{kind:"ParensNode",node:this.transformNode(t.node)}}transformJoin(t){return{kind:"JoinNode",joinType:t.joinType,table:this.transformNode(t.table),on:this.transformNode(t.on)}}transformRaw(t){return{kind:"RawNode",sqlFragments:ee([...t.sqlFragments]),parameters:this.transformNodeList(t.parameters)}}transformWhere(t){return{kind:"WhereNode",where:this.transformNode(t.where)}}transformInsertQuery(t){return{kind:"InsertQueryNode",into:this.transformNode(t.into),columns:this.transformNodeList(t.columns),values:this.transformNode(t.values),returning:this.transformNode(t.returning),onConflict:this.transformNode(t.onConflict),onDuplicateKey:this.transformNode(t.onDuplicateKey),endModifiers:this.transformNodeList(t.endModifiers),with:this.transformNode(t.with),ignore:t.ignore,replace:t.replace,explain:this.transformNode(t.explain),defaultValues:t.defaultValues,top:this.transformNode(t.top),output:this.transformNode(t.output)}}transformValues(t){return{kind:"ValuesNode",values:this.transformNodeList(t.values)}}transformDeleteQuery(t){return{kind:"DeleteQueryNode",from:this.transformNode(t.from),using:this.transformNode(t.using),joins:this.transformNodeList(t.joins),where:this.transformNode(t.where),returning:this.transformNode(t.returning),endModifiers:this.transformNodeList(t.endModifiers),with:this.transformNode(t.with),orderBy:this.transformNode(t.orderBy),limit:this.transformNode(t.limit),explain:this.transformNode(t.explain),top:this.transformNode(t.top),output:this.transformNode(t.output)}}transformReturning(t){return{kind:"ReturningNode",selections:this.transformNodeList(t.selections)}}transformCreateTable(t){return{kind:"CreateTableNode",table:this.transformNode(t.table),columns:this.transformNodeList(t.columns),constraints:this.transformNodeList(t.constraints),temporary:t.temporary,ifNotExists:t.ifNotExists,onCommit:t.onCommit,frontModifiers:this.transformNodeList(t.frontModifiers),endModifiers:this.transformNodeList(t.endModifiers),selectQuery:this.transformNode(t.selectQuery)}}transformColumnDefinition(t){return{kind:"ColumnDefinitionNode",column:this.transformNode(t.column),dataType:this.transformNode(t.dataType),references:this.transformNode(t.references),primaryKey:t.primaryKey,autoIncrement:t.autoIncrement,unique:t.unique,notNull:t.notNull,unsigned:t.unsigned,defaultTo:this.transformNode(t.defaultTo),check:this.transformNode(t.check),generated:this.transformNode(t.generated),frontModifiers:this.transformNodeList(t.frontModifiers),endModifiers:this.transformNodeList(t.endModifiers),nullsNotDistinct:t.nullsNotDistinct,identity:t.identity,ifNotExists:t.ifNotExists}}transformAddColumn(t){return{kind:"AddColumnNode",column:this.transformNode(t.column)}}transformDropTable(t){return{kind:"DropTableNode",table:this.transformNode(t.table),ifExists:t.ifExists,cascade:t.cascade}}transformOrderBy(t){return{kind:"OrderByNode",items:this.transformNodeList(t.items)}}transformOrderByItem(t){return{kind:"OrderByItemNode",orderBy:this.transformNode(t.orderBy),direction:this.transformNode(t.direction)}}transformGroupBy(t){return{kind:"GroupByNode",items:this.transformNodeList(t.items)}}transformGroupByItem(t){return{kind:"GroupByItemNode",groupBy:this.transformNode(t.groupBy)}}transformUpdateQuery(t){return{kind:"UpdateQueryNode",table:this.transformNode(t.table),from:this.transformNode(t.from),joins:this.transformNodeList(t.joins),where:this.transformNode(t.where),updates:this.transformNodeList(t.updates),returning:this.transformNode(t.returning),endModifiers:this.transformNodeList(t.endModifiers),with:this.transformNode(t.with),explain:this.transformNode(t.explain),limit:this.transformNode(t.limit),top:this.transformNode(t.top),output:this.transformNode(t.output)}}transformColumnUpdate(t){return{kind:"ColumnUpdateNode",column:this.transformNode(t.column),value:this.transformNode(t.value)}}transformLimit(t){return{kind:"LimitNode",limit:this.transformNode(t.limit)}}transformOffset(t){return{kind:"OffsetNode",offset:this.transformNode(t.offset)}}transformOnConflict(t){return{kind:"OnConflictNode",columns:this.transformNodeList(t.columns),constraint:this.transformNode(t.constraint),indexExpression:this.transformNode(t.indexExpression),indexWhere:this.transformNode(t.indexWhere),updates:this.transformNodeList(t.updates),updateWhere:this.transformNode(t.updateWhere),doNothing:t.doNothing}}transformOnDuplicateKey(t){return{kind:"OnDuplicateKeyNode",updates:this.transformNodeList(t.updates)}}transformCreateIndex(t){return{kind:"CreateIndexNode",name:this.transformNode(t.name),table:this.transformNode(t.table),columns:this.transformNodeList(t.columns),unique:t.unique,using:this.transformNode(t.using),ifNotExists:t.ifNotExists,where:this.transformNode(t.where),nullsNotDistinct:t.nullsNotDistinct}}transformList(t){return{kind:"ListNode",items:this.transformNodeList(t.items)}}transformDropIndex(t){return{kind:"DropIndexNode",name:this.transformNode(t.name),table:this.transformNode(t.table),ifExists:t.ifExists,cascade:t.cascade}}transformPrimaryKeyConstraint(t){return{kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(t.columns),name:this.transformNode(t.name)}}transformUniqueConstraint(t){return{kind:"UniqueConstraintNode",columns:this.transformNodeList(t.columns),name:this.transformNode(t.name),nullsNotDistinct:t.nullsNotDistinct}}transformForeignKeyConstraint(t){return{kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(t.columns),references:this.transformNode(t.references),name:this.transformNode(t.name),onDelete:t.onDelete,onUpdate:t.onUpdate}}transformSetOperation(t){return{kind:"SetOperationNode",operator:t.operator,expression:this.transformNode(t.expression),all:t.all}}transformReferences(t){return{kind:"ReferencesNode",table:this.transformNode(t.table),columns:this.transformNodeList(t.columns),onDelete:t.onDelete,onUpdate:t.onUpdate}}transformCheckConstraint(t){return{kind:"CheckConstraintNode",expression:this.transformNode(t.expression),name:this.transformNode(t.name)}}transformWith(t){return{kind:"WithNode",expressions:this.transformNodeList(t.expressions),recursive:t.recursive}}transformCommonTableExpression(t){return{kind:"CommonTableExpressionNode",name:this.transformNode(t.name),materialized:t.materialized,expression:this.transformNode(t.expression)}}transformCommonTableExpressionName(t){return{kind:"CommonTableExpressionNameNode",table:this.transformNode(t.table),columns:this.transformNodeList(t.columns)}}transformHaving(t){return{kind:"HavingNode",having:this.transformNode(t.having)}}transformCreateSchema(t){return{kind:"CreateSchemaNode",schema:this.transformNode(t.schema),ifNotExists:t.ifNotExists}}transformDropSchema(t){return{kind:"DropSchemaNode",schema:this.transformNode(t.schema),ifExists:t.ifExists,cascade:t.cascade}}transformAlterTable(t){return{kind:"AlterTableNode",table:this.transformNode(t.table),renameTo:this.transformNode(t.renameTo),setSchema:this.transformNode(t.setSchema),columnAlterations:this.transformNodeList(t.columnAlterations),addConstraint:this.transformNode(t.addConstraint),dropConstraint:this.transformNode(t.dropConstraint),addIndex:this.transformNode(t.addIndex),dropIndex:this.transformNode(t.dropIndex)}}transformDropColumn(t){return{kind:"DropColumnNode",column:this.transformNode(t.column)}}transformRenameColumn(t){return{kind:"RenameColumnNode",column:this.transformNode(t.column),renameTo:this.transformNode(t.renameTo)}}transformAlterColumn(t){return{kind:"AlterColumnNode",column:this.transformNode(t.column),dataType:this.transformNode(t.dataType),dataTypeExpression:this.transformNode(t.dataTypeExpression),setDefault:this.transformNode(t.setDefault),dropDefault:t.dropDefault,setNotNull:t.setNotNull,dropNotNull:t.dropNotNull}}transformModifyColumn(t){return{kind:"ModifyColumnNode",column:this.transformNode(t.column)}}transformAddConstraint(t){return{kind:"AddConstraintNode",constraint:this.transformNode(t.constraint)}}transformDropConstraint(t){return{kind:"DropConstraintNode",constraintName:this.transformNode(t.constraintName),ifExists:t.ifExists,modifier:t.modifier}}transformCreateView(t){return{kind:"CreateViewNode",name:this.transformNode(t.name),temporary:t.temporary,orReplace:t.orReplace,ifNotExists:t.ifNotExists,materialized:t.materialized,columns:this.transformNodeList(t.columns),as:this.transformNode(t.as)}}transformDropView(t){return{kind:"DropViewNode",name:this.transformNode(t.name),ifExists:t.ifExists,materialized:t.materialized,cascade:t.cascade}}transformGenerated(t){return{kind:"GeneratedNode",byDefault:t.byDefault,always:t.always,identity:t.identity,stored:t.stored,expression:this.transformNode(t.expression)}}transformDefaultValue(t){return{kind:"DefaultValueNode",defaultValue:this.transformNode(t.defaultValue)}}transformOn(t){return{kind:"OnNode",on:this.transformNode(t.on)}}transformSelectModifier(t){return{kind:"SelectModifierNode",modifier:t.modifier,rawModifier:this.transformNode(t.rawModifier),of:this.transformNodeList(t.of)}}transformCreateType(t){return{kind:"CreateTypeNode",name:this.transformNode(t.name),enum:this.transformNode(t.enum)}}transformDropType(t){return{kind:"DropTypeNode",name:this.transformNode(t.name),ifExists:t.ifExists}}transformExplain(t){return{kind:"ExplainNode",format:t.format,options:this.transformNode(t.options)}}transformSchemableIdentifier(t){return{kind:"SchemableIdentifierNode",schema:this.transformNode(t.schema),identifier:this.transformNode(t.identifier)}}transformAggregateFunction(t){return{kind:"AggregateFunctionNode",aggregated:this.transformNodeList(t.aggregated),distinct:t.distinct,orderBy:this.transformNode(t.orderBy),filter:this.transformNode(t.filter),func:t.func,over:this.transformNode(t.over)}}transformOver(t){return{kind:"OverNode",orderBy:this.transformNode(t.orderBy),partitionBy:this.transformNode(t.partitionBy)}}transformPartitionBy(t){return{kind:"PartitionByNode",items:this.transformNodeList(t.items)}}transformPartitionByItem(t){return{kind:"PartitionByItemNode",partitionBy:this.transformNode(t.partitionBy)}}transformBinaryOperation(t){return{kind:"BinaryOperationNode",leftOperand:this.transformNode(t.leftOperand),operator:this.transformNode(t.operator),rightOperand:this.transformNode(t.rightOperand)}}transformUnaryOperation(t){return{kind:"UnaryOperationNode",operator:this.transformNode(t.operator),operand:this.transformNode(t.operand)}}transformUsing(t){return{kind:"UsingNode",tables:this.transformNodeList(t.tables)}}transformFunction(t){return{kind:"FunctionNode",func:t.func,arguments:this.transformNodeList(t.arguments)}}transformCase(t){return{kind:"CaseNode",value:this.transformNode(t.value),when:this.transformNodeList(t.when),else:this.transformNode(t.else),isStatement:t.isStatement}}transformWhen(t){return{kind:"WhenNode",condition:this.transformNode(t.condition),result:this.transformNode(t.result)}}transformJSONReference(t){return{kind:"JSONReferenceNode",reference:this.transformNode(t.reference),traversal:this.transformNode(t.traversal)}}transformJSONPath(t){return{kind:"JSONPathNode",inOperator:this.transformNode(t.inOperator),pathLegs:this.transformNodeList(t.pathLegs)}}transformJSONPathLeg(t){return{kind:"JSONPathLegNode",type:t.type,value:t.value}}transformJSONOperatorChain(t){return{kind:"JSONOperatorChainNode",operator:this.transformNode(t.operator),values:this.transformNodeList(t.values)}}transformTuple(t){return{kind:"TupleNode",values:this.transformNodeList(t.values)}}transformMergeQuery(t){return{kind:"MergeQueryNode",into:this.transformNode(t.into),using:this.transformNode(t.using),whens:this.transformNodeList(t.whens),with:this.transformNode(t.with),top:this.transformNode(t.top),endModifiers:this.transformNodeList(t.endModifiers),output:this.transformNode(t.output)}}transformMatched(t){return{kind:"MatchedNode",not:t.not,bySource:t.bySource}}transformAddIndex(t){return{kind:"AddIndexNode",name:this.transformNode(t.name),columns:this.transformNodeList(t.columns),unique:t.unique,using:this.transformNode(t.using),ifNotExists:t.ifNotExists}}transformCast(t){return{kind:"CastNode",expression:this.transformNode(t.expression),dataType:this.transformNode(t.dataType)}}transformFetch(t){return{kind:"FetchNode",rowCount:this.transformNode(t.rowCount),modifier:t.modifier}}transformTop(t){return{kind:"TopNode",expression:t.expression,modifiers:t.modifiers}}transformOutput(t){return{kind:"OutputNode",selections:this.transformNodeList(t.selections)}}transformDataType(t){return t}transformSelectAll(t){return t}transformIdentifier(t){return t}transformValue(t){return t}transformPrimitiveValueList(t){return t}transformOperator(t){return t}transformDefaultInsertValue(t){return t}}dw=new WeakMap;const pce=ee({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0,MergeQueryNode:!0}),mce={json_agg:!0,to_json:!0};var Kf,ku,Iu,En,bC,SF,EF,NF,jf,vC,_F;class gce extends hce{constructor(n){super();Fe(this,En);Fe(this,Kf);Fe(this,ku,new Set);Fe(this,Iu,new Set);Be(this,Kf,n)}transformNodeImpl(n){if(!it(this,En,SF).call(this,n))return super.transformNodeImpl(n);const r=it(this,En,NF).call(this,n);for(const o of r)G(this,Iu).add(o);const s=it(this,En,EF).call(this,n);for(const o of s)G(this,ku).add(o);const i=super.transformNodeImpl(n);for(const o of s)G(this,ku).delete(o);for(const o of r)G(this,Iu).delete(o);return i}transformSchemableIdentifier(n){const r=super.transformSchemableIdentifier(n);return r.schema||!G(this,ku).has(n.identifier.name)?r:{...r,schema:Ss.create(G(this,Kf))}}transformReferences(n){const r=super.transformReferences(n);return r.table.table.schema?r:{...r,table:lc.createWithSchema(G(this,Kf),r.table.table.identifier.name)}}transformAggregateFunction(n){return{...super.transformAggregateFunction({...n,aggregated:[]}),aggregated:it(this,En,bC).call(this,n,"aggregated")}}transformFunction(n){return{...super.transformFunction({...n,arguments:[]}),arguments:it(this,En,bC).call(this,n,"arguments")}}}Kf=new WeakMap,ku=new WeakMap,Iu=new WeakMap,En=new WeakSet,bC=function(n,r){return mce[n.func]?n[r].map(s=>!lc.is(s)||s.table.schema?this.transformNode(s):{...s,table:this.transformIdentifier(s.table.identifier)}):this.transformNodeList(n[r])},SF=function(n){return n.kind in pce},EF=function(n){const r=new Set;if("name"in n&&n.name&&hC.is(n.name)&&it(this,En,vC).call(this,n.name,r),"from"in n&&n.from)for(const s of n.from.froms)it(this,En,jf).call(this,s,r);if("into"in n&&n.into&&it(this,En,jf).call(this,n.into,r),"table"in n&&n.table&&it(this,En,jf).call(this,n.table,r),"joins"in n&&n.joins)for(const s of n.joins)it(this,En,jf).call(this,s.table,r);return"using"in n&&n.using&&it(this,En,jf).call(this,n.using,r),r},NF=function(n){const r=new Set;return"with"in n&&n.with&&it(this,En,_F).call(this,n.with,r),r},jf=function(n,r){const s=lc.is(n)?n:kc.is(n)&&lc.is(n.node)?n.node:null;s&&it(this,En,vC).call(this,s.table,r)},vC=function(n,r){const s=n.identifier.name;!G(this,ku).has(s)&&!G(this,Iu).has(s)&&r.add(s)},_F=function(n,r){for(const s of n.expressions){const i=s.name.table.table.identifier.name;G(this,Iu).has(i)||r.add(i)}};var ay;class yce{constructor(t){Fe(this,ay);Be(this,ay,new gce(t))}transformQuery(t){return G(this,ay).transformNode(t.node)}async transformResult(t){return t.result}}ay=new WeakMap;var ly,Qf,Zf;class q6{constructor(){Fe(this,ly);Fe(this,Qf);Fe(this,Zf);K(this,"resolve",t=>{G(this,Qf)&&G(this,Qf).call(this,t)});K(this,"reject",t=>{G(this,Zf)&&G(this,Zf).call(this,t)});Be(this,ly,new Promise((t,n)=>{Be(this,Zf,n),Be(this,Qf,t)}))}get promise(){return G(this,ly)}}ly=new WeakMap,Qf=new WeakMap,Zf=new WeakMap;const H6=new Set;function bce(e){H6.has(e)||(H6.add(e),console.log(e))}const vce=ee([]);var Du,cy,xC;class xce{constructor(t=vce){Fe(this,cy);Fe(this,Du);Be(this,Du,t)}get plugins(){return G(this,Du)}transformQuery(t,n){for(const r of G(this,Du)){const s=r.transformQuery({node:t,queryId:n});if(s.kind===t.kind)t=s;else throw new Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${t.kind}`,`but it returned a ${s.kind}`].join(" "))}return t}async executeQuery(t,n){return await this.provideConnection(async r=>{const s=await r.executeQuery(t),i=await it(this,cy,xC).call(this,s,n);return wce(s,i),i})}async*stream(t,n,r){const s=new q6,i=new q6;this.provideConnection(async a=>(s.resolve(a),await i.promise)).catch(a=>s.reject(a));const o=await s.promise;try{for await(const a of o.streamQuery(t,n))yield await it(this,cy,xC).call(this,a,r)}finally{i.resolve()}}}Du=new WeakMap,cy=new WeakSet,xC=async function(t,n){for(const r of G(this,Du))t=await r.transformResult({result:t,queryId:n});return t};function wce(e,t){const{numAffectedRows:n}=e;n===void 0&&e.numUpdatedOrDeletedRows===void 0||n!==void 0&&t.numAffectedRows!==void 0||bce("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.")}class If extends xce{get adapter(){throw new Error("this query cannot be compiled to SQL")}compileQuery(){throw new Error("this query cannot be compiled to SQL")}provideConnection(){throw new Error("this query cannot be executed")}withConnectionProvider(){throw new Error("this query cannot have a connection provider")}withPlugin(t){return new If([...this.plugins,t])}withPlugins(t){return new If([...this.plugins,...t])}withPluginAtFront(t){return new If([t,...this.plugins])}withoutPlugins(){return new If([])}}const CF=new If;function Sce(e,t){return new vF({joinNode:Wm.create(e,ix(t))})}function Ece(){return new nx({overNode:yC.create()})}function bf(e,t){if(t.length===3)return _ce(e,t[0],t[1],t[2]);if(t.length===2)return Nce(e,t[0],t[1]);throw new Error("not implemented")}function Nce(e,t,n){return n(Sce(e,t)).toOperationNode()}function _ce(e,t,n,r){return Wm.createWithOn(e,ix(t),Eg(n,"=",r))}const Cce=ee({is(e){return e.kind==="OffsetNode"},create(e){return ee({kind:"OffsetNode",offset:e})}}),Oce=ee({is(e){return e.kind==="GroupByItemNode"},create(e){return ee({kind:"GroupByItemNode",groupBy:e})}});function jce(e){return e=pd(e)?e(d1()):e,wg(e).map(Oce.create)}const Ace=ee({is(e){return e.kind==="SetOperationNode"},create(e,t,n){return ee({kind:"SetOperationNode",operator:e,expression:t,all:n})}});function vf(e,t,n){return pd(t)&&(t=t(e$())),xc(t)||(t=[t]),t.map(r=>Ace.create(e,f1(r),n))}var fa;const fw=class fw{constructor(t){Fe(this,fa);Be(this,fa,t)}get expressionType(){}as(t){return new ZA(this,t)}or(...t){return new wC(ip.create(G(this,fa),Gi(t)))}and(...t){return new SC(wc.create(G(this,fa),Gi(t)))}$castTo(){return new fw(G(this,fa))}$notNull(){return new fw(G(this,fa))}toOperationNode(){return G(this,fa)}};fa=new WeakMap;let rn=fw;var eh,Ql;class ZA{constructor(t,n){Fe(this,eh);Fe(this,Ql);Be(this,eh,t),Be(this,Ql,n)}get expression(){return G(this,eh)}get alias(){return G(this,Ql)}toOperationNode(){return kc.create(G(this,eh).toOperationNode(),gi(G(this,Ql))?G(this,Ql).toOperationNode():Ss.create(G(this,Ql)))}}eh=new WeakMap,Ql=new WeakMap;var Pu;const hw=class hw{constructor(t){Fe(this,Pu);Be(this,Pu,t)}get expressionType(){}as(t){return new ZA(this,t)}or(...t){return new hw(ip.create(G(this,Pu),Gi(t)))}$castTo(){return new hw(G(this,Pu))}toOperationNode(){return Sg.create(G(this,Pu))}};Pu=new WeakMap;let wC=hw;var Lu;const pw=class pw{constructor(t){Fe(this,Lu);Be(this,Lu,t)}get expressionType(){}as(t){return new ZA(this,t)}and(...t){return new pw(wc.create(G(this,Lu),Gi(t)))}$castTo(){return new pw(G(this,Lu))}toOperationNode(){return Sg.create(G(this,Lu))}};Lu=new WeakMap;let SC=pw;const $ce={is(e){return e.kind==="FetchNode"},create(e,t){return{kind:"FetchNode",rowCount:Ec.create(e),modifier:t}}};function Tce(e,t){if(!GA(e)&&!dF(e))throw new Error(`Invalid fetch row count: ${e}`);if(!Rce(t))throw new Error(`Invalid fetch modifier: ${t}`);return $ce.create(e,t)}function Rce(e){return e==="only"||e==="with ties"}var Te;const ct=class ct{constructor(t){Fe(this,Te);Be(this,Te,ee(t))}get expressionType(){}get isSelectQueryBuilder(){return!0}where(...t){return new ct({...G(this,Te),queryNode:er.cloneWithWhere(G(this,Te).queryNode,Gi(t))})}whereRef(t,n,r){return new ct({...G(this,Te),queryNode:er.cloneWithWhere(G(this,Te).queryNode,Eg(t,n,r))})}having(...t){return new ct({...G(this,Te),queryNode:on.cloneWithHaving(G(this,Te).queryNode,Gi(t))})}havingRef(t,n,r){return new ct({...G(this,Te),queryNode:on.cloneWithHaving(G(this,Te).queryNode,Eg(t,n,r))})}select(t){return new ct({...G(this,Te),queryNode:on.cloneWithSelections(G(this,Te).queryNode,xF(t))})}distinctOn(t){return new ct({...G(this,Te),queryNode:on.cloneWithDistinctOn(G(this,Te).queryNode,wg(t))})}modifyFront(t){return new ct({...G(this,Te),queryNode:on.cloneWithFrontModifier(G(this,Te).queryNode,sa.createWithExpression(t.toOperationNode()))})}modifyEnd(t){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.createWithExpression(t.toOperationNode()))})}distinct(){return new ct({...G(this,Te),queryNode:on.cloneWithFrontModifier(G(this,Te).queryNode,sa.create("Distinct"))})}forUpdate(t){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("ForUpdate",t?Tb(t).map(Li):void 0))})}forShare(t){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("ForShare",t?Tb(t).map(Li):void 0))})}forKeyShare(t){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("ForKeyShare",t?Tb(t).map(Li):void 0))})}forNoKeyUpdate(t){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("ForNoKeyUpdate",t?Tb(t).map(Li):void 0))})}skipLocked(){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("SkipLocked"))})}noWait(){return new ct({...G(this,Te),queryNode:er.cloneWithEndModifier(G(this,Te).queryNode,sa.create("NoWait"))})}selectAll(t){return new ct({...G(this,Te),queryNode:on.cloneWithSelections(G(this,Te).queryNode,wF(t))})}innerJoin(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("InnerJoin",t))})}leftJoin(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("LeftJoin",t))})}rightJoin(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("RightJoin",t))})}fullJoin(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("FullJoin",t))})}innerJoinLateral(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("LateralInnerJoin",t))})}leftJoinLateral(...t){return new ct({...G(this,Te),queryNode:er.cloneWithJoin(G(this,Te).queryNode,bf("LateralLeftJoin",t))})}orderBy(...t){return new ct({...G(this,Te),queryNode:on.cloneWithOrderByItems(G(this,Te).queryNode,JA(t))})}groupBy(t){return new ct({...G(this,Te),queryNode:on.cloneWithGroupByItems(G(this,Te).queryNode,jce(t))})}limit(t){return new ct({...G(this,Te),queryNode:on.cloneWithLimit(G(this,Te).queryNode,cce.create(Lr(t)))})}offset(t){return new ct({...G(this,Te),queryNode:on.cloneWithOffset(G(this,Te).queryNode,Cce.create(Lr(t)))})}fetch(t,n="only"){return new ct({...G(this,Te),queryNode:on.cloneWithFetch(G(this,Te).queryNode,Tce(t,n))})}top(t,n){return new ct({...G(this,Te),queryNode:er.cloneWithTop(G(this,Te).queryNode,ace(t,n))})}union(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("union",t,!1))})}unionAll(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("union",t,!0))})}intersect(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("intersect",t,!1))})}intersectAll(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("intersect",t,!0))})}except(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("except",t,!1))})}exceptAll(t){return new ct({...G(this,Te),queryNode:on.cloneWithSetOperations(G(this,Te).queryNode,vf("except",t,!0))})}as(t){return new OF(this,t)}clearSelect(){return new ct({...G(this,Te),queryNode:on.cloneWithoutSelections(G(this,Te).queryNode)})}clearWhere(){return new ct({...G(this,Te),queryNode:er.cloneWithoutWhere(G(this,Te).queryNode)})}clearLimit(){return new ct({...G(this,Te),queryNode:on.cloneWithoutLimit(G(this,Te).queryNode)})}clearOffset(){return new ct({...G(this,Te),queryNode:on.cloneWithoutOffset(G(this,Te).queryNode)})}clearOrderBy(){return new ct({...G(this,Te),queryNode:on.cloneWithoutOrderBy(G(this,Te).queryNode)})}clearGroupBy(){return new ct({...G(this,Te),queryNode:on.cloneWithoutGroupBy(G(this,Te).queryNode)})}$call(t){return t(this)}$if(t,n){return t?n(this):new ct({...G(this,Te)})}$castTo(){return new ct(G(this,Te))}$narrowType(){return new ct(G(this,Te))}$assertType(){return new ct(G(this,Te))}$asTuple(){return new rn(this.toOperationNode())}withPlugin(t){return new ct({...G(this,Te),executor:G(this,Te).executor.withPlugin(t)})}toOperationNode(){return G(this,Te).executor.transformQuery(G(this,Te).queryNode,G(this,Te).queryId)}compile(){return G(this,Te).executor.compileQuery(this.toOperationNode(),G(this,Te).queryId)}async execute(){const t=this.compile();return(await G(this,Te).executor.executeQuery(t,G(this,Te).queryId)).rows}async executeTakeFirst(){const[t]=await this.execute();return t}async executeTakeFirstOrThrow(t=sce){const n=await this.executeTakeFirst();if(n===void 0)throw ice(t)?new t(this.toOperationNode()):t(this.toOperationNode());return n}async*stream(t=100){const n=this.compile(),r=G(this,Te).executor.stream(n,t,G(this,Te).queryId);for await(const s of r)yield*s.rows}async explain(t,n){return await new ct({...G(this,Te),queryNode:er.cloneWithExplain(G(this,Te).queryNode,t,n)}).execute()}};Te=new WeakMap;let rx=ct;md(rx,"don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");function Mce(e){return new rx(e)}var th,nh;class OF{constructor(t,n){Fe(this,th);Fe(this,nh);Be(this,th,t),Be(this,nh,n)}get expression(){return G(this,th)}get alias(){return G(this,nh)}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return kc.create(G(this,th).toOperationNode(),Ss.create(G(this,nh)))}}th=new WeakMap,nh=new WeakMap;md(OF,"don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");const Yl=ee({is(e){return e.kind==="AggregateFunctionNode"},create(e,t=[]){return ee({kind:"AggregateFunctionNode",func:e,aggregated:t})},cloneWithDistinct(e){return ee({...e,distinct:!0})},cloneWithOrderBy(e,t){return ee({...e,orderBy:e.orderBy?Nc.cloneWithItems(e.orderBy,t):Nc.create(t)})},cloneWithFilter(e,t){return ee({...e,filter:e.filter?kf.cloneWithOperation(e.filter,"And",t):kf.create(t)})},cloneWithOrFilter(e,t){return ee({...e,filter:e.filter?kf.cloneWithOperation(e.filter,"Or",t):kf.create(t)})},cloneWithOver(e,t){return ee({...e,over:t})}}),W6=ee({is(e){return e.kind==="FunctionNode"},create(e,t){return ee({kind:"FunctionNode",func:e,arguments:t})}});var dr;const ua=class ua{constructor(t){Fe(this,dr);Be(this,dr,ee(t))}get expressionType(){}as(t){return new kce(this,t)}distinct(){return new ua({...G(this,dr),aggregateFunctionNode:Yl.cloneWithDistinct(G(this,dr).aggregateFunctionNode)})}orderBy(t,n){return new ua({...G(this,dr),aggregateFunctionNode:Yl.cloneWithOrderBy(G(this,dr).aggregateFunctionNode,JA([t,n]))})}filterWhere(...t){return new ua({...G(this,dr),aggregateFunctionNode:Yl.cloneWithFilter(G(this,dr).aggregateFunctionNode,Gi(t))})}filterWhereRef(t,n,r){return new ua({...G(this,dr),aggregateFunctionNode:Yl.cloneWithFilter(G(this,dr).aggregateFunctionNode,Eg(t,n,r))})}over(t){const n=Ece();return new ua({...G(this,dr),aggregateFunctionNode:Yl.cloneWithOver(G(this,dr).aggregateFunctionNode,(t?t(n):n).toOperationNode())})}$call(t){return t(this)}$castTo(){return new ua(G(this,dr))}$notNull(){return new ua(G(this,dr))}toOperationNode(){return G(this,dr).aggregateFunctionNode}};dr=new WeakMap;let Uf=ua;md(Uf,"don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");var rh,sh;class kce{constructor(t,n){Fe(this,rh);Fe(this,sh);Be(this,rh,t),Be(this,sh,n)}get expression(){return G(this,rh)}get alias(){return G(this,sh)}toOperationNode(){return kc.create(G(this,rh).toOperationNode(),Ss.create(G(this,sh)))}}rh=new WeakMap,sh=new WeakMap;function Ice(){const e=(n,r)=>new rn(W6.create(n,wg(r??[]))),t=(n,r)=>new Uf({aggregateFunctionNode:Yl.create(n,r?wg(r):void 0)});return Object.assign(e,{agg:t,avg(n){return t("avg",[n])},coalesce(...n){return e("coalesce",n)},count(n){return t("count",[n])},countAll(n){return new Uf({aggregateFunctionNode:Yl.create("count",wF(n))})},max(n){return t("max",[n])},min(n){return t("min",[n])},sum(n){return t("sum",[n])},any(n){return e("any",[n])},jsonAgg(n){return new Uf({aggregateFunctionNode:Yl.create("json_agg",[Oo(n)?Li(n):n.toOperationNode()])})},toJson(n){return new rn(W6.create("to_json",[Oo(n)?Li(n):n.toOperationNode()]))}})}const Dce=ee({is(e){return e.kind==="UnaryOperationNode"},create(e,t){return ee({kind:"UnaryOperationNode",operator:e,operand:t})}});function Pce(e,t){return Dce.create(ed.create(e),Ks(t))}const Ea=ee({is(e){return e.kind==="CaseNode"},create(e){return ee({kind:"CaseNode",value:e})},cloneWithWhen(e,t){return ee({...e,when:ee(e.when?[...e.when,t]:[t])})},cloneWithThen(e,t){return ee({...e,when:e.when?ee([...e.when.slice(0,-1),u1.cloneWithResult(e.when[e.when.length-1],t)]):void 0})},cloneWith(e,t){return ee({...e,...t})}});var ih;class Lce{constructor(t){Fe(this,ih);Be(this,ih,ee(t))}when(...t){return new jF({...G(this,ih),node:Ea.cloneWithWhen(G(this,ih).node,u1.create(Gi(t)))})}}ih=new WeakMap;var oh;class jF{constructor(t){Fe(this,oh);Be(this,oh,ee(t))}then(t){return new Fce({...G(this,oh),node:Ea.cloneWithThen(G(this,oh).node,XA(t)?KA(t):Lr(t))})}}oh=new WeakMap;var ho;class Fce{constructor(t){Fe(this,ho);Be(this,ho,ee(t))}when(...t){return new jF({...G(this,ho),node:Ea.cloneWithWhen(G(this,ho).node,u1.create(Gi(t)))})}else(t){return new Bce({...G(this,ho),node:Ea.cloneWith(G(this,ho).node,{else:XA(t)?KA(t):Lr(t)})})}end(){return new rn(Ea.cloneWith(G(this,ho).node,{isStatement:!1}))}endCase(){return new rn(Ea.cloneWith(G(this,ho).node,{isStatement:!0}))}}ho=new WeakMap;var ah;class Bce{constructor(t){Fe(this,ah);Be(this,ah,ee(t))}end(){return new rn(Ea.cloneWith(G(this,ah).node,{isStatement:!1}))}endCase(){return new rn(Ea.cloneWith(G(this,ah).node,{isStatement:!0}))}}ah=new WeakMap;const G6=ee({is(e){return e.kind==="JSONPathLegNode"},create(e,t){return ee({kind:"JSONPathLegNode",type:e,value:t})}});var po,uy,NC;class EC{constructor(t){Fe(this,uy);Fe(this,po);Be(this,po,t)}at(t){return it(this,uy,NC).call(this,"ArrayLocation",t)}key(t){return it(this,uy,NC).call(this,"Member",t)}}po=new WeakMap,uy=new WeakSet,NC=function(t,n){return ex.is(G(this,po))?new sx(ex.cloneWithTraversal(G(this,po),Gm.is(G(this,po).traversal)?Gm.cloneWithLeg(G(this,po).traversal,G6.create(t,n)):gF.cloneWithValue(G(this,po).traversal,Ec.createImmediate(n)))):new sx(Gm.cloneWithLeg(G(this,po),G6.create(t,n)))};var Fu;const mw=class mw extends EC{constructor(n){super(n);Fe(this,Fu);Be(this,Fu,n)}get expressionType(){}as(n){return new zce(this,n)}$castTo(){return new mw(G(this,Fu))}$notNull(){return new mw(G(this,Fu))}toOperationNode(){return G(this,Fu)}};Fu=new WeakMap;let sx=mw;var lh,Zl;class zce{constructor(t,n){Fe(this,lh);Fe(this,Zl);Be(this,lh,t),Be(this,Zl,n)}get expression(){return G(this,lh)}get alias(){return G(this,Zl)}toOperationNode(){return kc.create(G(this,lh).toOperationNode(),gi(G(this,Zl))?G(this,Zl).toOperationNode():Ss.create(G(this,Zl)))}}lh=new WeakMap,Zl=new WeakMap;const Y6=ee({is(e){return e.kind==="TupleNode"},create(e){return ee({kind:"TupleNode",values:ee(e)})}}),Vce=["varchar","char","text","integer","int2","int4","int8","smallint","bigint","boolean","real","double precision","float4","float8","decimal","numeric","binary","bytea","date","datetime","time","timetz","timestamp","timestamptz","serial","bigserial","uuid","json","jsonb","blob","varbinary","int4range","int4multirange","int8range","int8multirange","numrange","nummultirange","tsrange","tsmultirange","tstzrange","tstzmultirange","daterange","datemultirange"],Uce=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],qce=ee({is(e){return e.kind==="DataTypeNode"},create(e){return ee({kind:"DataTypeNode",dataType:e})}});function Hce(e){return!!(Vce.includes(e)||Uce.some(t=>t.test(e)))}function Wce(e){if(gi(e))return e.toOperationNode();if(Hce(e))return qce.create(e);throw new Error(`invalid column data type ${JSON.stringify(e)}`)}const Gce=ee({is(e){return e.kind==="CastNode"},create(e,t){return ee({kind:"CastNode",expression:e,dataType:t})}});function e$(e=CF){function t(s,i,o){return new rn(QA(s,i,o))}function n(s,i){return new rn(Pce(s,i))}const r=Object.assign(t,{fn:void 0,eb:void 0,selectFrom(s){return Mce({queryId:aa(),executor:e,queryNode:on.createFrom(Yce(s))})},case(s){return new Lce({node:Ea.create(Zv(s)?void 0:Ks(s))})},ref(s,i){return Zv(i)?new rn(Sc(s)):new EC(Vle(s,i))},jsonPath(){return new EC(Gm.create())},table(s){return new rn(Li(s))},val(s){return new rn(Lr(s))},refTuple(...s){return new rn(Y6.create(s.map(Ks)))},tuple(...s){return new rn(Y6.create(s.map(Lr)))},lit(s){return new rn(KA(s))},unary:n,not(s){return n("not",s)},exists(s){return n("exists",s)},neg(s){return n("-",s)},between(s,i,o){return new rn(Eh.create(Ks(s),ed.create("between"),wc.create(Lr(i),Lr(o))))},betweenSymmetric(s,i,o){return new rn(Eh.create(Ks(s),ed.create("between symmetric"),wc.create(Lr(i),Lr(o))))},and(s){return xc(s)?new rn(mC(s,"and")):new rn(M6(s,"and"))},or(s){return xc(s)?new rn(mC(s,"or")):new rn(M6(s,"or"))},parens(...s){const i=Gi(s);return Sg.is(i)?new rn(i):new rn(Sg.create(i))},cast(s,i){return new rn(Gce.create(Ks(s),Wce(i)))},withSchema(s){return e$(e.withPluginAtFront(new yce(s)))}});return r.fn=Ice(),r.eb=r,r}function d1(e){return e$()}function f1(e){if(gi(e))return e.toOperationNode();if(pd(e))return e(d1()).toOperationNode();throw new Error(`invalid expression: ${JSON.stringify(e)}`)}function AF(e){if(gi(e))return e.toOperationNode();if(pd(e))return e(d1()).toOperationNode();throw new Error(`invalid aliased expression: ${JSON.stringify(e)}`)}function h1(e){return Tle(e)||Rle(e)||pd(e)}function Yce(e){return xc(e)?e.map(t=>ix(t)):[ix(e)]}function ix(e){return Oo(e)?Jce(e):AF(e)}function Jce(e){const t=" as ";if(e.includes(t)){const[n,r]=e.split(t).map($F);return kc.create(Li(n),Ss.create(r))}else return Li(e)}function Li(e){const t=".";if(e.includes(t)){const[n,r]=e.split(t).map($F);return lc.createWithSchema(n,r)}else return lc.create(e)}function $F(e){return e.trim()}var Mr,ri,bv,_C,CC;const dg=class dg{constructor(t){Fe(this,ri);Fe(this,Mr);Be(this,Mr,ee(t))}get expressionType(){}get isRawBuilder(){return!0}as(t){return new TF(this,t)}$castTo(){return new dg({...G(this,Mr)})}$notNull(){return new dg(G(this,Mr))}withPlugin(t){return new dg({...G(this,Mr),plugins:G(this,Mr).plugins!==void 0?ee([...G(this,Mr).plugins,t]):ee([t])})}toOperationNode(){return it(this,ri,_C).call(this,it(this,ri,bv).call(this))}compile(t){return it(this,ri,CC).call(this,it(this,ri,bv).call(this,t))}async execute(t){const n=it(this,ri,bv).call(this,t);return n.executeQuery(it(this,ri,CC).call(this,n),G(this,Mr).queryId)}};Mr=new WeakMap,ri=new WeakSet,bv=function(t){const n=t!==void 0?t.getExecutor():CF;return G(this,Mr).plugins!==void 0?n.withPlugins(G(this,Mr).plugins):n},_C=function(t){return t.transformQuery(G(this,Mr).rawNode,G(this,Mr).queryId)},CC=function(t){return t.compileQuery(it(this,ri,_C).call(this,t),G(this,Mr).queryId)};let ox=dg;function $l(e){return new ox(e)}md(ox,"don't await RawBuilder instances directly. To execute the query you need to call `execute`");var Bu,ec;class TF{constructor(t,n){Fe(this,Bu);Fe(this,ec);Be(this,Bu,t),Be(this,ec,n)}get expression(){return G(this,Bu)}get alias(){return G(this,ec)}get rawBuilder(){return G(this,Bu)}toOperationNode(){return kc.create(G(this,Bu).toOperationNode(),gi(G(this,ec))?G(this,ec).toOperationNode():Ss.create(G(this,ec)))}}Bu=new WeakMap,ec=new WeakMap;md(TF,"don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");const Ng=Object.assign((e,...t)=>$l({queryId:aa(),rawNode:gs.create(e,(t==null?void 0:t.map(J6))??[])}),{ref(e){return $l({queryId:aa(),rawNode:gs.createWithChild(Sc(e))})},val(e){return $l({queryId:aa(),rawNode:gs.createWithChild(Lr(e))})},value(e){return this.val(e)},table(e){return $l({queryId:aa(),rawNode:gs.createWithChild(Li(e))})},id(...e){const t=new Array(e.length+1).fill(".");return t[0]="",t[t.length-1]="",$l({queryId:aa(),rawNode:gs.create(t,e.map(Ss.create))})},lit(e){return $l({queryId:aa(),rawNode:gs.createWithChild(Ec.createImmediate(e))})},literal(e){return this.lit(e)},raw(e){return $l({queryId:aa(),rawNode:gs.createWithSql(e)})},join(e,t=Ng`, `){const n=new Array(2*e.length-1),r=t.toOperationNode();for(let s=0;s<e.length;++s)n[2*s]=J6(e[s]),s!==e.length-1&&(n[2*s+1]=r);return $l({queryId:aa(),rawNode:gs.createWithChildren(n)})}});function J6(e){return gi(e)?e.toOperationNode():Lr(e)}class Xce{constructor(t=[]){K(this,"plugins");this.plugins=new Set(t)}async transformResultRows(t){let n=t;for(const r of this.plugins)n=(await r.transformResult({queryId:"1",result:{rows:n}})).rows;return n}}const X6=["text","integer","real","blob","date","datetime","timestamp","boolean","json"],K6=Symbol.for("bknd:connection");class RF{constructor(t,n={},r=[]){K(this,"initialized",!1);K(this,"pluginRunner");K(this,"supported",{batching:!1,softscans:!0});K(this,"kysely");K(this,"client");this.fn=n,this.plugins=r,this.kysely=t,this[K6]=!0,this.pluginRunner=new Xce(r)}async init(){this.initialized=!0}static isConnection(t){return t?t[K6]===!0:!1}getIntrospector(){return this.kysely.introspection}supports(t){return this.supported[t]??!1}async ping(){return(await Ng`SELECT 1`.execute(this.kysely)).rows.length>0}async transformResultRows(t){return await this.pluginRunner.transformResultRows(t)}async executeQueries(...t){return Promise.all(t.map(async n=>await this.kysely.executeQuery(n)))}async executeQuery(t){return(await this.executeQueries(t))[0]}getCompiled(...t){return t.map(n=>"compile"in n?n.compile():n)}async withTransformedRows(t,n){return await Promise.all(t.map(async r=>{const s=n??"rows",{[s]:i,...o}=r;return{...o,rows:await this.transformResultRows(i)}}))}validateFieldSpecType(t){if(!X6.includes(t))throw new Error(`Invalid field type "${t}". Allowed types are: ${X6.join(", ")}`);return!0}toDriver(t,n){return t}fromDriver(t,n){return t}async close(){}}class Kce extends li{constructor(){super(...arguments);K(this,"name","UnableToConnectException");K(this,"code",fn.INTERNAL_SERVER_ERROR)}}class Jl extends li{constructor(){super(...arguments);K(this,"name","InvalidSearchParamsException");K(this,"code",fn.UNPROCESSABLE_ENTITY)}}class Qce extends li{constructor(){super(...arguments);K(this,"name","TransformRetrieveFailedException");K(this,"code",fn.UNPROCESSABLE_ENTITY)}}class rs extends li{constructor(){super(...arguments);K(this,"name","TransformPersistFailedException");K(this,"code",fn.UNPROCESSABLE_ENTITY)}static invalidType(n,r,s){const i=typeof s=="object"?JSON.stringify(s):s,o=`Property "${n}" must be of type "${r}", "${i}" of type "${typeof s}" given.`;return new rs(o)}static required(n){return new rs(`Property "${n}" is required`)}}class Zce extends li{constructor(n,r,s){console.error("InvalidFieldConfigException",{given:r,error:s.first()});super(`Invalid Field config given for field "${n.name}": ${s.firstToString()}`);K(this,"name","InvalidFieldConfigException");K(this,"code",fn.BAD_REQUEST);this.given=r}}class eue extends li{constructor(n){var t=(...e9e)=>(super(...e9e),K(this,"name","EntityNotDefinedException"),K(this,"code",fn.BAD_REQUEST),this);t(n?`Entity "${typeof n!="string"?n.name:n}" not defined`:"Cannot find an entity that is undefined")}}class MF extends Hr{validate(t){const{entity:n}=this.params;if(!n.isValidData(t,"create"))throw pt.warn("MutatorInsertBefore.validate: invalid",{entity:n.name,data:t}),new a1("EntityData","invalid");return this.clone({entity:n,data:t})}}K(MF,"slug","mutator-insert-before");class kF extends Hr{}K(kF,"slug","mutator-insert-after");class IF extends Hr{validate(t){const{entity:n,entityId:r}=this.params;if(!n.isValidData(t,"update"))throw pt.warn("MutatorUpdateBefore.validate: invalid",{entity:n.name,entityId:r,data:t}),new a1("EntityData","invalid");return this.clone({entityId:r,entity:n,data:t})}}K(IF,"slug","mutator-update-before");class DF extends Hr{}K(DF,"slug","mutator-update-after");class PF extends Hr{}K(PF,"slug","mutator-delete-before");class LF extends Hr{}K(LF,"slug","mutator-delete-after");const ax={MutatorInsertBefore:MF,MutatorInsertAfter:kF,MutatorUpdateBefore:IF,MutatorUpdateAfter:DF,MutatorDeleteBefore:PF,MutatorDeleteAfter:LF};class FF extends Hr{}K(FF,"slug","repository-find-one-before");class BF extends Hr{}K(BF,"slug","repository-find-one-after");class OC extends Hr{}K(OC,"slug","repository-find-many-before"),K(OC,"another","one");class zF extends Hr{}K(zF,"slug","repository-find-many-after");const VF={RepositoryFindOneBefore:FF,RepositoryFindOneAfter:BF,RepositoryFindManyBefore:OC,RepositoryFindManyAfter:zF};class UF{constructor(t){K(this,"_relations",[]);this._relations=t}get all(){return this._relations}exists(t){return this._relations.some(n=>n.source.entity.name===t.source.entity.name&&n.target.entity.name===t.target.entity.name&&n.type===t.type)}relationsOf(t){return this._relations.filter(n=>n.visibleFrom("source")&&n.source.entity.name===t.name||n.visibleFrom("target")&&n.target.entity.name===t.name)}sourceRelationsOf(t){return this._relations.filter(n=>n.source.entity.name===t.name)}targetRelationsOf(t){return this._relations.filter(n=>n.visibleFrom("target")&&n.target.entity.name===t.name)}listableRelationsOf(t){return this.relationsOf(t).filter(n=>n.isListableFor(t))}relationOf(t,n){return this.relationsOf(t).find(r=>r.target.entity.name===t.name&&r.source.reference===n||r.source.entity.name===t.name&&r.target.reference===n)}hasRelations(t){return this.relationsOf(t).length>0}relatedEntitiesOf(t){return this.relationsOf(t).map(n=>n.other(t).entity)}relationReferencesOf(t){return this.relationsOf(t).map(n=>n.other(t).reference)}}const tue=["create","read","update","delete"],nue=["create","read","update","delete","form","table","submit"],Q6=!0,Z6=!1,Io=st({label:xe(),description:xe(),required:Wt({default:!1}),fillable:Zt([Wt({title:"Boolean"}),un(xe({enum:tue}),{title:"Context",uniqueItems:!0})]),hidden:Zt([Wt({title:"Boolean"}),un(xe({enum:nue}),{title:"Context",uniqueItems:!0})]),virtual:Wt(),default_value:ai()}).partial();let Zi=class{constructor(t,n){K(this,"_required");K(this,"_type");K(this,"name");K(this,"type","field");K(this,"config");this.name=t,this._type,this._required;try{this.config=Ln(this.getSchema(),n||{})}catch(r){throw r instanceof o1?new Zce(this,n,r):r}}getType(){return this.type}schema(){return Object.freeze({name:this.name,type:"text",nullable:!0,dflt:void 0})}hasDefault(){return this.config.default_value!==void 0}getDefault(){var t;return(t=this.config)==null?void 0:t.default_value}isFillable(t){return Array.isArray(this.config.fillable)?t?this.config.fillable.includes(t):Q6:this.config.fillable??Q6}isHidden(t){return Array.isArray(this.config.hidden)?t?this.config.hidden.includes(t):Z6:this.config.hidden??Z6}isRequired(){var t;return((t=this.config)==null?void 0:t.required)??!1}isVirtual(){return this.config.virtual??!1}getLabel(t){return this.config.label?this.config.label:(t==null?void 0:t.fallback)!==!1?xh(this.name):void 0}getDescription(){return this.config.description}getValue(t,n){return t}getHtmlConfig(){return{element:"input",props:{type:"text"}}}isValid(t,n){return typeof t<"u"?this.isFillable(n):n==="create"?!this.isRequired():!0}transformRetrieve(t){return t}async transformPersist(t,n,r){if(this.nullish(t)){if(this.isRequired()&&!this.hasDefault())throw rs.required(this.name);return this.getDefault()}return t}toSchemaWrapIfRequired(t){return this.isRequired()?t:t.optional()}nullish(t){return t==null}toJsonSchema(){return this.toSchemaWrapIfRequired(ai())}toType(){return{required:this.isRequired(),comment:this.getDescription(),type:"any"}}toJSON(){return{type:this.type,config:this.config}}};const qF=st({default_value:Wt(),...Cs(Io.properties,["default_value"])}).partial();class HF extends Zi{constructor(){super(...arguments);K(this,"type","boolean")}getSchema(){return qF}getValue(n,r){switch(r){case"table":return n?"Yes":"No";default:return n}}schema(){return Object.freeze({...super.schema(),type:"boolean"})}getHtmlConfig(){return{...super.getHtmlConfig(),element:"boolean"}}transformRetrieve(n){return typeof n>"u"||n===null?this.isRequired()?!1:this.hasDefault()?this.getDefault():null:typeof n=="string"?n==="1":!!n}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(this.nullish(i))return this.isRequired()?!!this.config.default_value:void 0;if(typeof i=="number")return i!==0;if(typeof i!="boolean")throw rs.invalidType(this.name,"boolean",i);return i}toJsonSchema(){return this.toSchemaWrapIfRequired(Wt({default:this.getDefault()}))}toType(){return{...super.toType(),type:"boolean"}}}const WF=st({type:xe({enum:["date","datetime","week"],default:"date"}),timezone:xe(),min_date:xe(),max_date:xe(),...Io.properties}).partial();class jC extends Zi{constructor(){super(...arguments);K(this,"type","date")}getSchema(){return WF}schema(){return Object.freeze({...super.schema(),type:this.config.type==="datetime"?"datetime":"date"})}getHtmlConfig(){const n=this.config.type==="datetime"?"datetime-local":this.config.type;return{...super.getHtmlConfig(),element:"date",props:{type:n}}}parseDateFromString(n){if(this.config.type==="week"&&n.includes("-W")){const[r,s]=n.split("-W").map(i=>Number.parseInt(i,10));return Xv().year(r).week(s).toDate()}return new Date(n)}getValue(n,r){if(n===null||!n)return;const s=this.parseDateFromString(n);if(r==="submit")try{return s.toISOString()}catch{return}if(this.config.type==="week")try{return`${s.getFullYear()}-W${Xv(s).week()}`}catch(i){pt.warn("DateField.getValue:week error",n,String(i));return}try{const o=new Date().getTimezoneOffset(),a=new Date(s.getTime()-o*6e4);return this.formatDate(a)}catch(i){pt.warn("DateField.getValue error",this.config.type,n,String(i));return}}formatDate(n){switch(this.config.type){case"datetime":return n.toISOString().split(".")[0].replace("T"," ");default:return n.toISOString().split("T")[0]}}transformRetrieve(n){const r=super.transformRetrieve(n);if(r===null)return null;try{return new Date(r)}catch{return null}}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(this.nullish(i))return i;switch(this.config.type){case"date":case"week":return new Date(i).toISOString().split("T")[0];default:return new Date(i).toISOString()}}toJsonSchema(){return this.toSchemaWrapIfRequired(xe({default:this.getDefault()}))}toType(){return{...super.toType(),type:"Date | string"}}}const GF=st({default_value:xe(),options:Zt([Qe({type:ti("strings"),values:un(xe())}),Qe({type:ti("objects"),values:un(Qe({label:xe(),value:xe()}))})]),...Cs(Io.properties,["default_value"])}).partial();class YF extends Zi{constructor(n,r){super(n,r);K(this,"type","enum");if(this.config.default_value&&!this.isValidValue(this.config.default_value))throw new Error(`Default value "${this.config.default_value}" is not a valid option`)}getSchema(){return GF}getOptions(){var r,s;const n=((r=this.config)==null?void 0:r.options)??{type:"strings",values:[]};return n.type==="strings"?(s=n.values)==null?void 0:s.map(i=>({label:i,value:i})):n==null?void 0:n.values}isValidValue(n){return this.getOptions().map(s=>s.value).includes(n)}getValue(n,r){var s;if(!this.isValidValue(n))return this.hasDefault()?this.getDefault():null;switch(r){case"table":return((s=this.getOptions().find(i=>i.value===n))==null?void 0:s.label)??n}return n}transformRetrieve(n){const r=super.transformRetrieve(n);return r===null&&this.hasDefault()?this.getDefault():this.isValidValue(r)?r:this.hasDefault()?this.getDefault():null}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(this.nullish(i))return i;if(!this.isValidValue(i))throw new rs(`Field "${this.name}" must be one of the following values: ${this.getOptions().map(o=>o.value).join(", ")}`);return i}toJsonSchema(){var s,i;const r=((i=(((s=this.config)==null?void 0:s.options)??{values:[]}).values)==null?void 0:i.map(o=>typeof o=="string"?o:o.value))??[];return this.toSchemaWrapIfRequired(xe({enum:r,default:this.getDefault()}))}toType(){const n=this.getOptions().map(({value:r})=>typeof r=="string"?`"${r}"`:r);return{...super.toType(),type:n.length>0?n.join(" | "):"string"}}}const JF=st({default_value:ai(),...Cs(Io.properties,["default_value"])}).partial();class XF extends Zi{constructor(){super(...arguments);K(this,"type","json")}getSchema(){return JF}transformRetrieve(n){const r=super.transformRetrieve(n);return r===null&&this.hasDefault()?this.getDefault():this.isSerialized(r)?JSON.parse(r):r}isSerializable(n){try{const r=JSON.stringify(n);if(r===JSON.stringify(JSON.parse(r)))return!0}catch{}return!1}isSerialized(n){try{if(typeof n=="string")return n===JSON.stringify(JSON.parse(n))}catch{}return!1}getValue(n,r){switch(r){case"form":return n===null?"":JSON.stringify(n,null,2);case"table":return n===null?null:JSON.stringify(n);case"submit":return typeof n=="string"&&n.length===0?null:JSON.parse(n)}return n}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(this.nullish(i))return i;if(!this.isSerializable(i))throw new rs(`Field "${this.name}" must be serializable to JSON.`);return this.isSerialized(i)?i:JSON.stringify(i)}toType(){return{...super.toType(),type:"any"}}}function Jm(e,t){const n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;const r=e.length;if(r!==t.length)return!1;for(let s=0;s<r;s++)if(!Jm(e[s],t[s]))return!1;return!0}if(n==="object"){if(!e||!t)return e===t;const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const o of r)if(!Jm(e[o],t[o]))return!1;return!0}return e===t}function Oi(e){return encodeURI(rue(e))}function rue(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}const sue={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},iue={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},oue={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};let aue=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function Au(e,t=Object.create(null),n=aue,r=""){if(e&&typeof e=="object"&&!Array.isArray(e)){const i=e.$id||e.id;if(i){const o=new URL(i,n.href);o.hash.length>1?t[o.href]=e:(o.hash="",r===""?n=o:Au(e,t,n))}}else if(e!==!0&&e!==!1)return t;const s=n.href+(r?"#"+r:"");if(t[s]!==void 0)throw new Error(`Duplicate schema URI "${s}".`);if(t[s]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:s}),e.$ref&&e.__absolute_ref__===void 0){const i=new URL(e.$ref,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){const i=new URL(e.$recursiveRef,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){const i=new URL("#"+e.$anchor,n.href);t[i.href]=e}for(let i in e){if(oue[i])continue;const o=`${r}/${Oi(i)}`,a=e[i];if(Array.isArray(a)){if(sue[i]){const c=a.length;for(let u=0;u<c;u++)Au(a[u],t,n,`${o}/${u}`)}}else if(iue[i])for(let c in a)Au(a[c],t,n,`${o}/${Oi(c)}`);else Au(a,t,n,o)}return t}const lue=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cue=[0,31,28,31,30,31,30,31,31,30,31,30,31],uue=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,due=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,fue=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,hue=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,pue=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,mue=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,gue=/^(?:\/(?:[^~/]|~0|~1)*)*$/,yue=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,bue=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,vue=e=>{if(e[0]==='"')return!1;const[t,n,...r]=e.split("@");return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(".").every(s=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},xue=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,wue=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Sue=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function co(e){return e.test.bind(e)}const ek={date:KF,time:QF.bind(void 0,!1),"date-time":_ue,duration:Sue,uri:jue,"uri-reference":co(fue),"uri-template":co(hue),url:co(pue),email:vue,hostname:co(due),ipv4:co(xue),ipv6:co(wue),regex:$ue,uuid:co(mue),"json-pointer":co(gue),"json-pointer-uri-fragment":co(yue),"relative-json-pointer":co(bue)};function Eue(e){return e%4===0&&(e%100!==0||e%400===0)}function KF(e){const t=e.match(lue);if(!t)return!1;const n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r==2&&Eue(n)?29:cue[r])}function QF(e,t){const n=t.match(uue);if(!n)return!1;const r=+n[1],s=+n[2],i=+n[3],o=!!n[5];return(r<=23&&s<=59&&i<=59||r==23&&s==59&&i==60)&&(!e||o)}const Nue=/t|\s/i;function _ue(e){const t=e.split(Nue);return t.length==2&&KF(t[0])&&QF(!0,t[1])}const Cue=/\/|:/,Oue=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function jue(e){return Cue.test(e)&&Oue.test(e)}const Aue=/[^\\]\\Z/;function $ue(e){if(Aue.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}function Tue(e){let t=0,n=e.length,r=0,s;for(;r<n;)t++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<n&&(s=e.charCodeAt(r),(s&64512)==56320&&r++);return t}function yn(e,t,n="2019-09",r=Au(t),s=!0,i=null,o="#",a="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:o,keyword:"false",keywordLocation:o,error:"False boolean schema."}]};const u=typeof e;let f;switch(u){case"boolean":case"number":case"string":f=u;break;case"object":e===null?f="null":Array.isArray(e)?f="array":f="object";break;default:throw new Error(`Instances of "${u}" type are not supported.`)}const{$ref:h,$recursiveRef:m,$recursiveAnchor:y,type:v,const:x,enum:E,required:N,not:_,anyOf:C,allOf:j,oneOf:A,if:$,then:R,else:M,format:D,properties:P,patternProperties:F,additionalProperties:V,unevaluatedProperties:H,minProperties:I,maxProperties:B,propertyNames:T,dependentRequired:L,dependentSchemas:z,dependencies:q,prefixItems:k,items:W,additionalItems:X,unevaluatedItems:ne,contains:re,minContains:se,maxContains:fe,minItems:he,maxItems:ue,uniqueItems:ve,minimum:Se,maximum:ke,exclusiveMinimum:Oe,exclusiveMaximum:Ce,multipleOf:Me,minLength:Ve,maxLength:We,pattern:$e,__absolute_ref__:J,__absolute_recursive_ref__:te}=t,Q=[];if(y===!0&&i===null&&(i=t),m==="#"){const ce=i===null?r[te]:i,ae=`${a}/$recursiveRef`,ie=yn(e,i===null?t:i,n,r,s,ce,o,ae,c);ie.valid||Q.push({instanceLocation:o,keyword:"$recursiveRef",keywordLocation:ae,error:"A subschema had errors."},...ie.errors)}if(h!==void 0){const ae=r[J||h];if(ae===void 0){let be=`Unresolved $ref "${h}".`;throw J&&J!==h&&(be+=`  Absolute URI "${J}".`),be+=`
Known schemas:
- ${Object.keys(r).join(`
- `)}`,new Error(be)}const ie=`${a}/$ref`,de=yn(e,ae,n,r,s,i,o,ie,c);if(de.valid||Q.push({instanceLocation:o,keyword:"$ref",keywordLocation:ie,error:"A subschema had errors."},...de.errors),n==="4"||n==="7")return{valid:Q.length===0,errors:Q}}if(Array.isArray(v)){let ce=v.length,ae=!1;for(let ie=0;ie<ce;ie++)if(f===v[ie]||v[ie]==="integer"&&f==="number"&&e%1===0&&e===e){ae=!0;break}ae||Q.push({instanceLocation:o,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v.join('", "')}".`})}else v==="integer"?(f!=="number"||e%1||e!==e)&&Q.push({instanceLocation:o,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v}".`}):v!==void 0&&f!==v&&Q.push({instanceLocation:o,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v}".`});if(x!==void 0&&(f==="object"||f==="array"?Jm(e,x)||Q.push({instanceLocation:o,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(x)}.`}):e!==x&&Q.push({instanceLocation:o,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(x)}.`})),E!==void 0&&(f==="object"||f==="array"?E.some(ce=>Jm(e,ce))||Q.push({instanceLocation:o,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(E)}.`}):E.some(ce=>e===ce)||Q.push({instanceLocation:o,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(E)}.`})),_!==void 0){const ce=`${a}/not`;yn(e,_,n,r,s,i,o,ce).valid&&Q.push({instanceLocation:o,keyword:"not",keywordLocation:ce,error:'Instance matched "not" schema.'})}let ye=[];if(C!==void 0){const ce=`${a}/anyOf`,ae=Q.length;let ie=!1;for(let de=0;de<C.length;de++){const be=C[de],Ae=Object.create(c),Ie=yn(e,be,n,r,s,y===!0?i:null,o,`${ce}/${de}`,Ae);Q.push(...Ie.errors),ie=ie||Ie.valid,Ie.valid&&ye.push(Ae)}ie?Q.length=ae:Q.splice(ae,0,{instanceLocation:o,keyword:"anyOf",keywordLocation:ce,error:"Instance does not match any subschemas."})}if(j!==void 0){const ce=`${a}/allOf`,ae=Q.length;let ie=!0;for(let de=0;de<j.length;de++){const be=j[de],Ae=Object.create(c),Ie=yn(e,be,n,r,s,y===!0?i:null,o,`${ce}/${de}`,Ae);Q.push(...Ie.errors),ie=ie&&Ie.valid,Ie.valid&&ye.push(Ae)}ie?Q.length=ae:Q.splice(ae,0,{instanceLocation:o,keyword:"allOf",keywordLocation:ce,error:"Instance does not match every subschema."})}if(A!==void 0){const ce=`${a}/oneOf`,ae=Q.length,ie=A.filter((de,be)=>{const Ae=Object.create(c),Ie=yn(e,de,n,r,s,y===!0?i:null,o,`${ce}/${be}`,Ae);return Q.push(...Ie.errors),Ie.valid&&ye.push(Ae),Ie.valid}).length;ie===1?Q.length=ae:Q.splice(ae,0,{instanceLocation:o,keyword:"oneOf",keywordLocation:ce,error:`Instance does not match exactly one subschema (${ie} matches).`})}if((f==="object"||f==="array")&&Object.assign(c,...ye),$!==void 0){const ce=`${a}/if`;if(yn(e,$,n,r,s,i,o,ce,c).valid){if(R!==void 0){const ie=yn(e,R,n,r,s,i,o,`${a}/then`,c);ie.valid||Q.push({instanceLocation:o,keyword:"if",keywordLocation:ce,error:'Instance does not match "then" schema.'},...ie.errors)}}else if(M!==void 0){const ie=yn(e,M,n,r,s,i,o,`${a}/else`,c);ie.valid||Q.push({instanceLocation:o,keyword:"if",keywordLocation:ce,error:'Instance does not match "else" schema.'},...ie.errors)}}if(f==="object"){if(N!==void 0)for(const de of N)de in e||Q.push({instanceLocation:o,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${de}".`});const ce=Object.keys(e);if(I!==void 0&&ce.length<I&&Q.push({instanceLocation:o,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${I} properties.`}),B!==void 0&&ce.length>B&&Q.push({instanceLocation:o,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${B} properties.`}),T!==void 0){const de=`${a}/propertyNames`;for(const be in e){const Ae=`${o}/${Oi(be)}`,Ie=yn(be,T,n,r,s,i,Ae,de);Ie.valid||Q.push({instanceLocation:o,keyword:"propertyNames",keywordLocation:de,error:`Property name "${be}" does not match schema.`},...Ie.errors)}}if(L!==void 0){const de=`${a}/dependantRequired`;for(const be in L)if(be in e){const Ae=L[be];for(const Ie of Ae)Ie in e||Q.push({instanceLocation:o,keyword:"dependentRequired",keywordLocation:de,error:`Instance has "${be}" but does not have "${Ie}".`})}}if(z!==void 0)for(const de in z){const be=`${a}/dependentSchemas`;if(de in e){const Ae=yn(e,z[de],n,r,s,i,o,`${be}/${Oi(de)}`,c);Ae.valid||Q.push({instanceLocation:o,keyword:"dependentSchemas",keywordLocation:be,error:`Instance has "${de}" but does not match dependant schema.`},...Ae.errors)}}if(q!==void 0){const de=`${a}/dependencies`;for(const be in q)if(be in e){const Ae=q[be];if(Array.isArray(Ae))for(const Ie of Ae)Ie in e||Q.push({instanceLocation:o,keyword:"dependencies",keywordLocation:de,error:`Instance has "${be}" but does not have "${Ie}".`});else{const Ie=yn(e,Ae,n,r,s,i,o,`${de}/${Oi(be)}`);Ie.valid||Q.push({instanceLocation:o,keyword:"dependencies",keywordLocation:de,error:`Instance has "${be}" but does not match dependant schema.`},...Ie.errors)}}}const ae=Object.create(null);let ie=!1;if(P!==void 0){const de=`${a}/properties`;for(const be in P){if(!(be in e))continue;const Ae=`${o}/${Oi(be)}`,Ie=yn(e[be],P[be],n,r,s,i,Ae,`${de}/${Oi(be)}`);if(Ie.valid)c[be]=ae[be]=!0;else if(ie=s,Q.push({instanceLocation:o,keyword:"properties",keywordLocation:de,error:`Property "${be}" does not match schema.`},...Ie.errors),ie)break}}if(!ie&&F!==void 0){const de=`${a}/patternProperties`;for(const be in F){const Ae=new RegExp(be,"u"),Ie=F[be];for(const ht in e){if(!Ae.test(ht))continue;const Vt=`${o}/${Oi(ht)}`,_t=yn(e[ht],Ie,n,r,s,i,Vt,`${de}/${Oi(be)}`);_t.valid?c[ht]=ae[ht]=!0:(ie=s,Q.push({instanceLocation:o,keyword:"patternProperties",keywordLocation:de,error:`Property "${ht}" matches pattern "${be}" but does not match associated schema.`},..._t.errors))}}}if(!ie&&V!==void 0){const de=`${a}/additionalProperties`;for(const be in e){if(ae[be])continue;const Ae=`${o}/${Oi(be)}`,Ie=yn(e[be],V,n,r,s,i,Ae,de);Ie.valid?c[be]=!0:(ie=s,Q.push({instanceLocation:o,keyword:"additionalProperties",keywordLocation:de,error:`Property "${be}" does not match additional properties schema.`},...Ie.errors))}}else if(!ie&&H!==void 0){const de=`${a}/unevaluatedProperties`;for(const be in e)if(!c[be]){const Ae=`${o}/${Oi(be)}`,Ie=yn(e[be],H,n,r,s,i,Ae,de);Ie.valid?c[be]=!0:Q.push({instanceLocation:o,keyword:"unevaluatedProperties",keywordLocation:de,error:`Property "${be}" does not match unevaluated properties schema.`},...Ie.errors)}}}else if(f==="array"){ue!==void 0&&e.length>ue&&Q.push({instanceLocation:o,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${ue}).`}),he!==void 0&&e.length<he&&Q.push({instanceLocation:o,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${he}).`});const ce=e.length;let ae=0,ie=!1;if(k!==void 0){const de=`${a}/prefixItems`,be=Math.min(k.length,ce);for(;ae<be;ae++){const Ae=yn(e[ae],k[ae],n,r,s,i,`${o}/${ae}`,`${de}/${ae}`);if(c[ae]=!0,!Ae.valid&&(ie=s,Q.push({instanceLocation:o,keyword:"prefixItems",keywordLocation:de,error:"Items did not match schema."},...Ae.errors),ie))break}}if(W!==void 0){const de=`${a}/items`;if(Array.isArray(W)){const be=Math.min(W.length,ce);for(;ae<be;ae++){const Ae=yn(e[ae],W[ae],n,r,s,i,`${o}/${ae}`,`${de}/${ae}`);if(c[ae]=!0,!Ae.valid&&(ie=s,Q.push({instanceLocation:o,keyword:"items",keywordLocation:de,error:"Items did not match schema."},...Ae.errors),ie))break}}else for(;ae<ce;ae++){const be=yn(e[ae],W,n,r,s,i,`${o}/${ae}`,de);if(c[ae]=!0,!be.valid&&(ie=s,Q.push({instanceLocation:o,keyword:"items",keywordLocation:de,error:"Items did not match schema."},...be.errors),ie))break}if(!ie&&X!==void 0){const be=`${a}/additionalItems`;for(;ae<ce;ae++){const Ae=yn(e[ae],X,n,r,s,i,`${o}/${ae}`,be);c[ae]=!0,Ae.valid||(ie=s,Q.push({instanceLocation:o,keyword:"additionalItems",keywordLocation:be,error:"Items did not match additional items schema."},...Ae.errors))}}}if(re!==void 0)if(ce===0&&se===void 0)Q.push({instanceLocation:o,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(se!==void 0&&ce<se)Q.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${ce}) than minContains (${se}).`});else{const de=`${a}/contains`,be=Q.length;let Ae=0;for(let Ie=0;Ie<ce;Ie++){const ht=yn(e[Ie],re,n,r,s,i,`${o}/${Ie}`,de);ht.valid?(c[Ie]=!0,Ae++):Q.push(...ht.errors)}Ae>=(se||0)&&(Q.length=be),se===void 0&&fe===void 0&&Ae===0?Q.splice(be,0,{instanceLocation:o,keyword:"contains",keywordLocation:de,error:"Array does not contain item matching schema."}):se!==void 0&&Ae<se?Q.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${se} items matching schema. Only ${Ae} items were found.`}):fe!==void 0&&Ae>fe&&Q.push({instanceLocation:o,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${fe} items matching schema. ${Ae} items were found.`})}if(!ie&&ne!==void 0){const de=`${a}/unevaluatedItems`;for(ae;ae<ce;ae++){if(c[ae])continue;const be=yn(e[ae],ne,n,r,s,i,`${o}/${ae}`,de);c[ae]=!0,be.valid||Q.push({instanceLocation:o,keyword:"unevaluatedItems",keywordLocation:de,error:"Items did not match unevaluated items schema."},...be.errors)}}if(ve)for(let de=0;de<ce;de++){const be=e[de],Ae=typeof be=="object"&&be!==null;for(let Ie=0;Ie<ce;Ie++){if(de===Ie)continue;const ht=e[Ie];(be===ht||Ae&&(typeof ht=="object"&&ht!==null)&&Jm(be,ht))&&(Q.push({instanceLocation:o,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${de} and ${Ie}.`}),de=Number.MAX_SAFE_INTEGER,Ie=Number.MAX_SAFE_INTEGER)}}}else if(f==="number"){if(n==="4"?(Se!==void 0&&(Oe===!0&&e<=Se||e<Se)&&Q.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Oe?"or equal to ":""} ${Se}.`}),ke!==void 0&&(Ce===!0&&e>=ke||e>ke)&&Q.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Ce?"or equal to ":""} ${ke}.`})):(Se!==void 0&&e<Se&&Q.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Se}.`}),ke!==void 0&&e>ke&&Q.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${ke}.`}),Oe!==void 0&&e<=Oe&&Q.push({instanceLocation:o,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${Oe}.`}),Ce!==void 0&&e>=Ce&&Q.push({instanceLocation:o,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${Ce}.`})),Me!==void 0){const ce=e%Me;Math.abs(0-ce)>=11920929e-14&&Math.abs(Me-ce)>=11920929e-14&&Q.push({instanceLocation:o,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${Me}.`})}}else if(f==="string"){const ce=Ve===void 0&&We===void 0?0:Tue(e);Ve!==void 0&&ce<Ve&&Q.push({instanceLocation:o,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${ce} < ${Ve}).`}),We!==void 0&&ce>We&&Q.push({instanceLocation:o,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ce} > ${We}).`}),$e!==void 0&&!new RegExp($e,"u").test(e)&&Q.push({instanceLocation:o,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),D!==void 0&&ek[D]&&!ek[D](e)&&Q.push({instanceLocation:o,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${D}".`})}return{valid:Q.length===0,errors:Q}}class Rue{constructor(t,n="2019-09",r=!0){K(this,"schema");K(this,"draft");K(this,"shortCircuit");K(this,"lookup");this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=Au(t)}validate(t){return yn(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),Au(t,this.lookup)}}const ZF=st({schema:ai({type:"object"}),ui_schema:ai({type:"object"}),default_from_schema:Wt(),...Io.properties}).partial();class eB extends Zi{constructor(n,r){super(n,r);K(this,"type","jsonschema");K(this,"validator");this.validator=new Rue({...this.getJsonSchema()})}getSchema(){return ZF}getJsonSchema(){var n;return(n=this.config)==null?void 0:n.schema}getJsonUiSchema(){return this.config.ui_schema??{}}isValid(n,r="update"){return super.isValid(n,r)?!this.isRequired()&&(!n||typeof n!="object")?!0:this.validator.validate(n).valid:!1}getValue(n,r){switch(r){case"form":return n===null?"":n;case"table":return n===null?null:JSON.stringify(n)}return n}transformRetrieve(n){const r=super.transformRetrieve(n);if(r===null){if(this.config.default_from_schema)try{return Gl(this.getJsonSchema()).template()}catch{return null}else if(this.hasDefault())return this.getDefault()}return r}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(this.nullish(i))return i;if(!this.isValid(i))throw new rs(this.name,i);return!i||typeof i!="object"?this.getDefault():JSON.stringify(i)}toJsonSchema(){const n=this.getJsonSchema()??{type:"object"};return this.toSchemaWrapIfRequired(Gl({default:this.getDefault(),...n}))}toType(){return{...super.toType(),import:[{package:"json-schema-to-ts",name:"FromSchema"}],type:`FromSchema<${aC(this.getJsonSchema(),2,1)}>`}}}const tB=st({default_value:Rt(),minimum:Rt(),maximum:Rt(),exclusiveMinimum:Rt(),exclusiveMaximum:Rt(),multipleOf:Rt(),...Cs(Io.properties,["default_value"])}).partial();class t$ extends Zi{constructor(){super(...arguments);K(this,"type","number")}getSchema(){return tB}getHtmlConfig(){return{element:"input",props:{type:"number",pattern:"d*",inputMode:"numeric"}}}schema(){return Object.freeze({...super.schema(),type:"integer"})}getValue(n,r){if(typeof n>"u"||n===null)return null;switch(r){case"submit":return Number.parseInt(n)}return n}async transformPersist(n,r,s){const i=await super.transformPersist(n,r,s);if(!this.nullish(i)&&typeof i!="number")throw rs.invalidType(this.name,"number",i);if(this.config.maximum&&i>this.config.maximum)throw new rs(`Field "${this.name}" cannot be greater than ${this.config.maximum}`);if(this.config.minimum&&i<this.config.minimum)throw new rs(`Field "${this.name}" cannot be less than ${this.config.minimum}`);return i}toJsonSchema(){var n,r,s,i,o;return this.toSchemaWrapIfRequired(Rt({default:this.getDefault(),minimum:(n=this.config)==null?void 0:n.minimum,maximum:(r=this.config)==null?void 0:r.maximum,exclusiveMinimum:(s=this.config)==null?void 0:s.exclusiveMinimum,exclusiveMaximum:(i=this.config)==null?void 0:i.exclusiveMaximum,multipleOf:(o=this.config)==null?void 0:o.multipleOf}))}toType(){return{...super.toType(),type:"number"}}}const nB={data:{default_primary_field:"id"}},n$=["integer","uuid"],rB=st({format:xe({enum:n$,default:"integer"}),required:Wt({default:!1}),...Cs(Io.properties,["required"])}).partial();class _g extends Zi{constructor(n=nB.data.default_primary_field,r){super(n,{...r,fillable:!1,required:!1});K(this,"type","primary")}isRequired(){return!1}getSchema(){return rB}get format(){return this.config.format??"integer"}get fieldType(){return this.format==="integer"?"integer":"text"}schema(){return Object.freeze({type:this.fieldType,name:this.name,primary:!0,nullable:!1})}getNewValue(){if(this.format==="uuid")return oae()}async transformPersist(n){throw new Error("PrimaryField: This function should not be called")}toJsonSchema(){return this.toSchemaWrapIfRequired(this.format==="integer"?Rt({writeOnly:void 0}):xe({writeOnly:void 0}))}toType(){const n=this.format==="integer"?"number":"string";return{...super.toType(),required:!0,import:[{package:"kysely",name:"Generated"}],type:`Generated<${n}>`}}}const sB=st({default_value:xe(),minLength:Rt(),maxLength:Rt(),pattern:xe(),html_config:YL({element:xe(),props:Vi(Zt([xe({title:"String"}),Rt({title:"Number"})]))}),...Cs(Io.properties,["default_value"])}).partial();class r$ extends Zi{constructor(){super(...arguments);K(this,"type","text")}getSchema(){return sB}getHtmlConfig(){return this.config.html_config?this.config.html_config:super.getHtmlConfig()}transformRetrieve(n){const r=super.transformRetrieve(n);return this.config.maxLength?r.substring(0,this.config.maxLength):this.isRequired()?r?r.toString():"":r}async transformPersist(n,r,s){let i=await super.transformPersist(n,r,s);if(this.nullish(i))return i;if(i!==null&&typeof i!="string"&&(i=String(i)),this.config.maxLength&&(i==null?void 0:i.length)>this.config.maxLength)throw new rs(`Field "${this.name}" must be at most ${this.config.maxLength} character(s)`);if(this.config.minLength&&(i==null?void 0:i.length)<this.config.minLength)throw new rs(`Field "${this.name}" must be at least ${this.config.minLength} character(s)`);if(this.config.pattern&&i&&!new RegExp(this.config.pattern).test(i))throw new rs(`Field "${this.name}" must match the pattern ${this.config.pattern}`);return i}toJsonSchema(){var n,r,s;return this.toSchemaWrapIfRequired(xe({default:this.getDefault(),minLength:(n=this.config)==null?void 0:n.minLength,maxLength:(r=this.config)==null?void 0:r.maxLength,pattern:(s=this.config)==null?void 0:s.pattern}))}toType(){return{...super.toType(),type:"string"}}}class iB{constructor(t,n,r=!1,s){var i;if(this.entity=t,this.fields=n,this.unique=r,this.name=s,n.length===0)throw new Error("Indices must contain at least one field");if(n.some(o=>!(o instanceof Zi)))throw new Error("All fields must be instances of Field");if(r&&!((i=n[0])==null?void 0:i.isRequired()))throw new Error(`Unique indices must have first field as required: ${n.map(a=>a.name).join(", ")}`);s||(this.name=[r?"idx_unique":"idx",t.name,...n.map(o=>o.name)].join("_"))}toJSON(){return{entity:this.entity.name,fields:this.fields.map(t=>t.name),unique:this.unique}}}var oB=typeof global=="object"&&global&&global.Object===Object&&global,Mue=typeof self=="object"&&self&&self.Object===Object&&self,eo=oB||Mue||Function("return this")(),ci=eo.Symbol,aB=Object.prototype,kue=aB.hasOwnProperty,Iue=aB.toString,wm=ci?ci.toStringTag:void 0;function Due(e){var t=kue.call(e,wm),n=e[wm];try{e[wm]=void 0;var r=!0}catch{}var s=Iue.call(e);return r&&(t?e[wm]=n:delete e[wm]),s}var Pue=Object.prototype,Lue=Pue.toString;function Fue(e){return Lue.call(e)}var Bue="[object Null]",zue="[object Undefined]",tk=ci?ci.toStringTag:void 0;function gd(e){return e==null?e===void 0?zue:Bue:tk&&tk in Object(e)?Due(e):Fue(e)}function jo(e){return e!=null&&typeof e=="object"}var Vue="[object Symbol]";function p1(e){return typeof e=="symbol"||jo(e)&&gd(e)==Vue}function lB(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var os=Array.isArray,nk=ci?ci.prototype:void 0,rk=nk?nk.toString:void 0;function cB(e){if(typeof e=="string")return e;if(os(e))return lB(e,cB)+"";if(p1(e))return rk?rk.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Uue=/\s/;function que(e){for(var t=e.length;t--&&Uue.test(e.charAt(t)););return t}var Hue=/^\s+/;function Wue(e){return e&&e.slice(0,que(e)+1).replace(Hue,"")}function Sr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var sk=NaN,Gue=/^[-+]0x[0-9a-f]+$/i,Yue=/^0b[01]+$/i,Jue=/^0o[0-7]+$/i,Xue=parseInt;function ik(e){if(typeof e=="number")return e;if(p1(e))return sk;if(Sr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Sr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Wue(e);var n=Yue.test(e);return n||Jue.test(e)?Xue(e.slice(2),n?2:8):Gue.test(e)?sk:+e}function s$(e){return e}var Kue="[object AsyncFunction]",Que="[object Function]",Zue="[object GeneratorFunction]",ede="[object Proxy]";function m1(e){if(!Sr(e))return!1;var t=gd(e);return t==Que||t==Zue||t==Kue||t==ede}var uN=eo["__core-js_shared__"],ok=function(){var e=/[^.]+$/.exec(uN&&uN.keys&&uN.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function tde(e){return!!ok&&ok in e}var nde=Function.prototype,rde=nde.toString;function yd(e){if(e!=null){try{return rde.call(e)}catch{}try{return e+""}catch{}}return""}var sde=/[\\^$.*+?()[\]{}|]/g,ide=/^\[object .+?Constructor\]$/,ode=Function.prototype,ade=Object.prototype,lde=ode.toString,cde=ade.hasOwnProperty,ude=RegExp("^"+lde.call(cde).replace(sde,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dde(e){if(!Sr(e)||tde(e))return!1;var t=m1(e)?ude:ide;return t.test(yd(e))}function fde(e,t){return e==null?void 0:e[t]}function bd(e,t){var n=fde(e,t);return dde(n)?n:void 0}var AC=bd(eo,"WeakMap"),ak=Object.create,uB=function(){function e(){}return function(t){if(!Sr(t))return{};if(ak)return ak(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function hde(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function dB(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var pde=800,mde=16,gde=Date.now;function yde(e){var t=0,n=0;return function(){var r=gde(),s=mde-(r-n);if(n=r,s>0){if(++t>=pde)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function bde(e){return function(){return e}}var lx=function(){try{var e=bd(Object,"defineProperty");return e({},"",{}),e}catch{}}(),vde=lx?function(e,t){return lx(e,"toString",{configurable:!0,enumerable:!1,value:bde(t),writable:!0})}:s$,fB=yde(vde);function hB(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var xde=9007199254740991,wde=/^(?:0|[1-9]\d*)$/;function g1(e,t){var n=typeof e;return t=t??xde,!!t&&(n=="number"||n!="symbol"&&wde.test(e))&&e>-1&&e%1==0&&e<t}function i$(e,t,n){t=="__proto__"&&lx?lx(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ay(e,t){return e===t||e!==e&&t!==t}var Sde=Object.prototype,Ede=Sde.hasOwnProperty;function o$(e,t,n){var r=e[t];(!(Ede.call(e,t)&&Ay(r,n))||n===void 0&&!(t in e))&&i$(e,t,n)}function op(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],c=void 0;c===void 0&&(c=e[a]),s?i$(n,a,c):o$(n,a,c)}return n}var lk=Math.max;function pB(e,t,n){return t=lk(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=lk(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),hde(e,this,a)}}function Nde(e,t){return fB(pB(e,t,s$),e+"")}var _de=9007199254740991;function a$(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=_de}function y1(e){return e!=null&&a$(e.length)&&!m1(e)}function Cde(e,t,n){if(!Sr(n))return!1;var r=typeof t;return(r=="number"?y1(n)&&g1(t,n.length):r=="string"&&t in n)?Ay(n[t],e):!1}function Ode(e){return Nde(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&Cde(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var jde=Object.prototype;function l$(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||jde;return e===n}function Ade(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var $de="[object Arguments]";function ck(e){return jo(e)&&gd(e)==$de}var mB=Object.prototype,Tde=mB.hasOwnProperty,Rde=mB.propertyIsEnumerable,Cg=ck(function(){return arguments}())?ck:function(e){return jo(e)&&Tde.call(e,"callee")&&!Rde.call(e,"callee")};function Mde(){return!1}var gB=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uk=gB&&typeof module=="object"&&module&&!module.nodeType&&module,kde=uk&&uk.exports===gB,dk=kde?eo.Buffer:void 0,Ide=dk?dk.isBuffer:void 0,Nh=Ide||Mde,Dde="[object Arguments]",Pde="[object Array]",Lde="[object Boolean]",Fde="[object Date]",Bde="[object Error]",zde="[object Function]",Vde="[object Map]",Ude="[object Number]",qde="[object Object]",Hde="[object RegExp]",Wde="[object Set]",Gde="[object String]",Yde="[object WeakMap]",Jde="[object ArrayBuffer]",Xde="[object DataView]",Kde="[object Float32Array]",Qde="[object Float64Array]",Zde="[object Int8Array]",efe="[object Int16Array]",tfe="[object Int32Array]",nfe="[object Uint8Array]",rfe="[object Uint8ClampedArray]",sfe="[object Uint16Array]",ife="[object Uint32Array]",an={};an[Kde]=an[Qde]=an[Zde]=an[efe]=an[tfe]=an[nfe]=an[rfe]=an[sfe]=an[ife]=!0;an[Dde]=an[Pde]=an[Jde]=an[Lde]=an[Xde]=an[Fde]=an[Bde]=an[zde]=an[Vde]=an[Ude]=an[qde]=an[Hde]=an[Wde]=an[Gde]=an[Yde]=!1;function ofe(e){return jo(e)&&a$(e.length)&&!!an[gd(e)]}function c$(e){return function(t){return e(t)}}var yB=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xm=yB&&typeof module=="object"&&module&&!module.nodeType&&module,afe=Xm&&Xm.exports===yB,dN=afe&&oB.process,_h=function(){try{var e=Xm&&Xm.require&&Xm.require("util").types;return e||dN&&dN.binding&&dN.binding("util")}catch{}}(),fk=_h&&_h.isTypedArray,b1=fk?c$(fk):ofe,lfe=Object.prototype,cfe=lfe.hasOwnProperty;function bB(e,t){var n=os(e),r=!n&&Cg(e),s=!n&&!r&&Nh(e),i=!n&&!r&&!s&&b1(e),o=n||r||s||i,a=o?Ade(e.length,String):[],c=a.length;for(var u in e)(t||cfe.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||g1(u,c)))&&a.push(u);return a}function vB(e,t){return function(n){return e(t(n))}}var ufe=vB(Object.keys,Object),dfe=Object.prototype,ffe=dfe.hasOwnProperty;function hfe(e){if(!l$(e))return ufe(e);var t=[];for(var n in Object(e))ffe.call(e,n)&&n!="constructor"&&t.push(n);return t}function $y(e){return y1(e)?bB(e):hfe(e)}function pfe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var mfe=Object.prototype,gfe=mfe.hasOwnProperty;function yfe(e){if(!Sr(e))return pfe(e);var t=l$(e),n=[];for(var r in e)r=="constructor"&&(t||!gfe.call(e,r))||n.push(r);return n}function Ty(e){return y1(e)?bB(e,!0):yfe(e)}var bfe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vfe=/^\w*$/;function u$(e,t){if(os(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||p1(e)?!0:vfe.test(e)||!bfe.test(e)||t!=null&&e in Object(t)}var Og=bd(Object,"create");function xfe(){this.__data__=Og?Og(null):{},this.size=0}function wfe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Sfe="__lodash_hash_undefined__",Efe=Object.prototype,Nfe=Efe.hasOwnProperty;function _fe(e){var t=this.__data__;if(Og){var n=t[e];return n===Sfe?void 0:n}return Nfe.call(t,e)?t[e]:void 0}var Cfe=Object.prototype,Ofe=Cfe.hasOwnProperty;function jfe(e){var t=this.__data__;return Og?t[e]!==void 0:Ofe.call(t,e)}var Afe="__lodash_hash_undefined__";function $fe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Og&&t===void 0?Afe:t,this}function td(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}td.prototype.clear=xfe;td.prototype.delete=wfe;td.prototype.get=_fe;td.prototype.has=jfe;td.prototype.set=$fe;function Tfe(){this.__data__=[],this.size=0}function v1(e,t){for(var n=e.length;n--;)if(Ay(e[n][0],t))return n;return-1}var Rfe=Array.prototype,Mfe=Rfe.splice;function kfe(e){var t=this.__data__,n=v1(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Mfe.call(t,n,1),--this.size,!0}function Ife(e){var t=this.__data__,n=v1(t,e);return n<0?void 0:t[n][1]}function Dfe(e){return v1(this.__data__,e)>-1}function Pfe(e,t){var n=this.__data__,r=v1(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ka(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ka.prototype.clear=Tfe;Ka.prototype.delete=kfe;Ka.prototype.get=Ife;Ka.prototype.has=Dfe;Ka.prototype.set=Pfe;var jg=bd(eo,"Map");function Lfe(){this.size=0,this.__data__={hash:new td,map:new(jg||Ka),string:new td}}function Ffe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function x1(e,t){var n=e.__data__;return Ffe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Bfe(e){var t=x1(this,e).delete(e);return this.size-=t?1:0,t}function zfe(e){return x1(this,e).get(e)}function Vfe(e){return x1(this,e).has(e)}function Ufe(e,t){var n=x1(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Qa(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Qa.prototype.clear=Lfe;Qa.prototype.delete=Bfe;Qa.prototype.get=zfe;Qa.prototype.has=Vfe;Qa.prototype.set=Ufe;var qfe="Expected a function";function d$(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(qfe);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(d$.Cache||Qa),n}d$.Cache=Qa;var Hfe=500;function Wfe(e){var t=d$(e,function(r){return n.size===Hfe&&n.clear(),r}),n=t.cache;return t}var Gfe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yfe=/\\(\\)?/g,Jfe=Wfe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Gfe,function(n,r,s,i){t.push(s?i.replace(Yfe,"$1"):r||n)}),t});function Xfe(e){return e==null?"":cB(e)}function ap(e,t){return os(e)?e:u$(e,t)?[e]:Jfe(Xfe(e))}function lp(e){if(typeof e=="string"||p1(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function w1(e,t){t=ap(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[lp(t[n++])];return n&&n==r?e:void 0}function Ag(e,t,n){var r=e==null?void 0:w1(e,t);return r===void 0?n:r}function f$(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var hk=ci?ci.isConcatSpreadable:void 0;function Kfe(e){return os(e)||Cg(e)||!!(hk&&e&&e[hk])}function xB(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=Kfe),s||(s=[]);++i<o;){var a=e[i];t>0&&n(a)?t>1?xB(a,t-1,n,r,s):f$(s,a):r||(s[s.length]=a)}return s}function Qfe(e){var t=e==null?0:e.length;return t?xB(e,1):[]}function wB(e){return fB(pB(e,void 0,Qfe),e+"")}var S1=vB(Object.getPrototypeOf,Object),Zfe="[object Object]",ehe=Function.prototype,the=Object.prototype,SB=ehe.toString,nhe=the.hasOwnProperty,rhe=SB.call(Object);function EB(e){if(!jo(e)||gd(e)!=Zfe)return!1;var t=S1(e);if(t===null)return!0;var n=nhe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&SB.call(n)==rhe}function she(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++r<s;)i[r]=e[r+t];return i}function ihe(){this.__data__=new Ka,this.size=0}function ohe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ahe(e){return this.__data__.get(e)}function lhe(e){return this.__data__.has(e)}var che=200;function uhe(e,t){var n=this.__data__;if(n instanceof Ka){var r=n.__data__;if(!jg||r.length<che-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qa(r)}return n.set(e,t),this.size=n.size,this}function Ui(e){var t=this.__data__=new Ka(e);this.size=t.size}Ui.prototype.clear=ihe;Ui.prototype.delete=ohe;Ui.prototype.get=ahe;Ui.prototype.has=lhe;Ui.prototype.set=uhe;function dhe(e,t){return e&&op(t,$y(t),e)}function fhe(e,t){return e&&op(t,Ty(t),e)}var NB=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pk=NB&&typeof module=="object"&&module&&!module.nodeType&&module,hhe=pk&&pk.exports===NB,mk=hhe?eo.Buffer:void 0,gk=mk?mk.allocUnsafe:void 0;function _B(e,t){if(t)return e.slice();var n=e.length,r=gk?gk(n):new e.constructor(n);return e.copy(r),r}function phe(e,t){for(var n=-1,r=e==null?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}function CB(){return[]}var mhe=Object.prototype,ghe=mhe.propertyIsEnumerable,yk=Object.getOwnPropertySymbols,h$=yk?function(e){return e==null?[]:(e=Object(e),phe(yk(e),function(t){return ghe.call(e,t)}))}:CB;function yhe(e,t){return op(e,h$(e),t)}var bhe=Object.getOwnPropertySymbols,OB=bhe?function(e){for(var t=[];e;)f$(t,h$(e)),e=S1(e);return t}:CB;function vhe(e,t){return op(e,OB(e),t)}function jB(e,t,n){var r=t(e);return os(e)?r:f$(r,n(e))}function $C(e){return jB(e,$y,h$)}function AB(e){return jB(e,Ty,OB)}var TC=bd(eo,"DataView"),RC=bd(eo,"Promise"),MC=bd(eo,"Set"),bk="[object Map]",xhe="[object Object]",vk="[object Promise]",xk="[object Set]",wk="[object WeakMap]",Sk="[object DataView]",whe=yd(TC),She=yd(jg),Ehe=yd(RC),Nhe=yd(MC),_he=yd(AC),ki=gd;(TC&&ki(new TC(new ArrayBuffer(1)))!=Sk||jg&&ki(new jg)!=bk||RC&&ki(RC.resolve())!=vk||MC&&ki(new MC)!=xk||AC&&ki(new AC)!=wk)&&(ki=function(e){var t=gd(e),n=t==xhe?e.constructor:void 0,r=n?yd(n):"";if(r)switch(r){case whe:return Sk;case She:return bk;case Ehe:return vk;case Nhe:return xk;case _he:return wk}return t});var Che=Object.prototype,Ohe=Che.hasOwnProperty;function jhe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Ohe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var cx=eo.Uint8Array;function p$(e){var t=new e.constructor(e.byteLength);return new cx(t).set(new cx(e)),t}function Ahe(e,t){var n=t?p$(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var $he=/\w*$/;function The(e){var t=new e.constructor(e.source,$he.exec(e));return t.lastIndex=e.lastIndex,t}var Ek=ci?ci.prototype:void 0,Nk=Ek?Ek.valueOf:void 0;function Rhe(e){return Nk?Object(Nk.call(e)):{}}function $B(e,t){var n=t?p$(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Mhe="[object Boolean]",khe="[object Date]",Ihe="[object Map]",Dhe="[object Number]",Phe="[object RegExp]",Lhe="[object Set]",Fhe="[object String]",Bhe="[object Symbol]",zhe="[object ArrayBuffer]",Vhe="[object DataView]",Uhe="[object Float32Array]",qhe="[object Float64Array]",Hhe="[object Int8Array]",Whe="[object Int16Array]",Ghe="[object Int32Array]",Yhe="[object Uint8Array]",Jhe="[object Uint8ClampedArray]",Xhe="[object Uint16Array]",Khe="[object Uint32Array]";function Qhe(e,t,n){var r=e.constructor;switch(t){case zhe:return p$(e);case Mhe:case khe:return new r(+e);case Vhe:return Ahe(e,n);case Uhe:case qhe:case Hhe:case Whe:case Ghe:case Yhe:case Jhe:case Xhe:case Khe:return $B(e,n);case Ihe:return new r;case Dhe:case Fhe:return new r(e);case Phe:return The(e);case Lhe:return new r;case Bhe:return Rhe(e)}}function TB(e){return typeof e.constructor=="function"&&!l$(e)?uB(S1(e)):{}}var Zhe="[object Map]";function epe(e){return jo(e)&&ki(e)==Zhe}var _k=_h&&_h.isMap,tpe=_k?c$(_k):epe,npe="[object Set]";function rpe(e){return jo(e)&&ki(e)==npe}var Ck=_h&&_h.isSet,spe=Ck?c$(Ck):rpe,ipe=1,ope=2,ape=4,RB="[object Arguments]",lpe="[object Array]",cpe="[object Boolean]",upe="[object Date]",dpe="[object Error]",MB="[object Function]",fpe="[object GeneratorFunction]",hpe="[object Map]",ppe="[object Number]",kB="[object Object]",mpe="[object RegExp]",gpe="[object Set]",ype="[object String]",bpe="[object Symbol]",vpe="[object WeakMap]",xpe="[object ArrayBuffer]",wpe="[object DataView]",Spe="[object Float32Array]",Epe="[object Float64Array]",Npe="[object Int8Array]",_pe="[object Int16Array]",Cpe="[object Int32Array]",Ope="[object Uint8Array]",jpe="[object Uint8ClampedArray]",Ape="[object Uint16Array]",$pe="[object Uint32Array]",nn={};nn[RB]=nn[lpe]=nn[xpe]=nn[wpe]=nn[cpe]=nn[upe]=nn[Spe]=nn[Epe]=nn[Npe]=nn[_pe]=nn[Cpe]=nn[hpe]=nn[ppe]=nn[kB]=nn[mpe]=nn[gpe]=nn[ype]=nn[bpe]=nn[Ope]=nn[jpe]=nn[Ape]=nn[$pe]=!0;nn[dpe]=nn[MB]=nn[vpe]=!1;function Km(e,t,n,r,s,i){var o,a=t&ipe,c=t&ope,u=t&ape;if(n&&(o=s?n(e,r,s,i):n(e)),o!==void 0)return o;if(!Sr(e))return e;var f=os(e);if(f){if(o=jhe(e),!a)return dB(e,o)}else{var h=ki(e),m=h==MB||h==fpe;if(Nh(e))return _B(e,a);if(h==kB||h==RB||m&&!s){if(o=c||m?{}:TB(e),!a)return c?vhe(e,fhe(o,e)):yhe(e,dhe(o,e))}else{if(!nn[h])return s?e:{};o=Qhe(e,h,a)}}i||(i=new Ui);var y=i.get(e);if(y)return y;i.set(e,o),spe(e)?e.forEach(function(E){o.add(Km(E,t,n,E,e,i))}):tpe(e)&&e.forEach(function(E,N){o.set(N,Km(E,t,n,N,e,i))});var v=u?c?AB:$C:c?Ty:$y,x=f?void 0:v(e);return hB(x||e,function(E,N){x&&(N=E,E=e[N]),o$(o,N,Km(E,t,n,N,e,i))}),o}var Tpe=1,Rpe=4;function E1(e){return Km(e,Tpe|Rpe)}var Mpe="__lodash_hash_undefined__";function kpe(e){return this.__data__.set(e,Mpe),this}function Ipe(e){return this.__data__.has(e)}function ux(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Qa;++t<n;)this.add(e[t])}ux.prototype.add=ux.prototype.push=kpe;ux.prototype.has=Ipe;function Dpe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Ppe(e,t){return e.has(t)}var Lpe=1,Fpe=2;function IB(e,t,n,r,s,i){var o=n&Lpe,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=i.get(e),f=i.get(t);if(u&&f)return u==t&&f==e;var h=-1,m=!0,y=n&Fpe?new ux:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var v=e[h],x=t[h];if(r)var E=o?r(x,v,h,t,e,i):r(v,x,h,e,t,i);if(E!==void 0){if(E)continue;m=!1;break}if(y){if(!Dpe(t,function(N,_){if(!Ppe(y,_)&&(v===N||s(v,N,n,r,i)))return y.push(_)})){m=!1;break}}else if(!(v===x||s(v,x,n,r,i))){m=!1;break}}return i.delete(e),i.delete(t),m}function Bpe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,s){n[++t]=[s,r]}),n}function zpe(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Vpe=1,Upe=2,qpe="[object Boolean]",Hpe="[object Date]",Wpe="[object Error]",Gpe="[object Map]",Ype="[object Number]",Jpe="[object RegExp]",Xpe="[object Set]",Kpe="[object String]",Qpe="[object Symbol]",Zpe="[object ArrayBuffer]",eme="[object DataView]",Ok=ci?ci.prototype:void 0,fN=Ok?Ok.valueOf:void 0;function tme(e,t,n,r,s,i,o){switch(n){case eme:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Zpe:return!(e.byteLength!=t.byteLength||!i(new cx(e),new cx(t)));case qpe:case Hpe:case Ype:return Ay(+e,+t);case Wpe:return e.name==t.name&&e.message==t.message;case Jpe:case Kpe:return e==t+"";case Gpe:var a=Bpe;case Xpe:var c=r&Vpe;if(a||(a=zpe),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;r|=Upe,o.set(e,t);var f=IB(a(e),a(t),r,s,i,o);return o.delete(e),f;case Qpe:if(fN)return fN.call(e)==fN.call(t)}return!1}var nme=1,rme=Object.prototype,sme=rme.hasOwnProperty;function ime(e,t,n,r,s,i){var o=n&nme,a=$C(e),c=a.length,u=$C(t),f=u.length;if(c!=f&&!o)return!1;for(var h=c;h--;){var m=a[h];if(!(o?m in t:sme.call(t,m)))return!1}var y=i.get(e),v=i.get(t);if(y&&v)return y==t&&v==e;var x=!0;i.set(e,t),i.set(t,e);for(var E=o;++h<c;){m=a[h];var N=e[m],_=t[m];if(r)var C=o?r(_,N,m,t,e,i):r(N,_,m,e,t,i);if(!(C===void 0?N===_||s(N,_,n,r,i):C)){x=!1;break}E||(E=m=="constructor")}if(x&&!E){var j=e.constructor,A=t.constructor;j!=A&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof A=="function"&&A instanceof A)&&(x=!1)}return i.delete(e),i.delete(t),x}var ome=1,jk="[object Arguments]",Ak="[object Array]",Rb="[object Object]",ame=Object.prototype,$k=ame.hasOwnProperty;function lme(e,t,n,r,s,i){var o=os(e),a=os(t),c=o?Ak:ki(e),u=a?Ak:ki(t);c=c==jk?Rb:c,u=u==jk?Rb:u;var f=c==Rb,h=u==Rb,m=c==u;if(m&&Nh(e)){if(!Nh(t))return!1;o=!0,f=!1}if(m&&!f)return i||(i=new Ui),o||b1(e)?IB(e,t,n,r,s,i):tme(e,t,c,n,r,s,i);if(!(n&ome)){var y=f&&$k.call(e,"__wrapped__"),v=h&&$k.call(t,"__wrapped__");if(y||v){var x=y?e.value():e,E=v?t.value():t;return i||(i=new Ui),s(x,E,n,r,i)}}return m?(i||(i=new Ui),ime(e,t,n,r,s,i)):!1}function N1(e,t,n,r,s){return e===t?!0:e==null||t==null||!jo(e)&&!jo(t)?e!==e&&t!==t:lme(e,t,n,r,N1,s)}var cme=1,ume=2;function dme(e,t,n,r){var s=n.length,i=s;if(e==null)return!i;for(e=Object(e);s--;){var o=n[s];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++s<i;){o=n[s];var a=o[0],c=e[a],u=o[1];if(o[2]){if(c===void 0&&!(a in e))return!1}else{var f=new Ui,h;if(!(h===void 0?N1(u,c,cme|ume,r,f):h))return!1}}return!0}function DB(e){return e===e&&!Sr(e)}function fme(e){for(var t=$y(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,DB(s)]}return t}function PB(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function hme(e){var t=fme(e);return t.length==1&&t[0][2]?PB(t[0][0],t[0][1]):function(n){return n===e||dme(n,e,t)}}function pme(e,t){return e!=null&&t in Object(e)}function LB(e,t,n){t=ap(t,e);for(var r=-1,s=t.length,i=!1;++r<s;){var o=lp(t[r]);if(!(i=e!=null&&n(e,o)))break;e=e[o]}return i||++r!=s?i:(s=e==null?0:e.length,!!s&&a$(s)&&g1(o,s)&&(os(e)||Cg(e)))}function FB(e,t){return e!=null&&LB(e,t,pme)}var mme=1,gme=2;function yme(e,t){return u$(e)&&DB(t)?PB(lp(e),t):function(n){var r=Ag(n,e);return r===void 0&&r===t?FB(n,e):N1(t,r,mme|gme)}}function bme(e){return function(t){return t==null?void 0:t[e]}}function vme(e){return function(t){return w1(t,e)}}function xme(e){return u$(e)?bme(lp(e)):vme(e)}function wme(e){return typeof e=="function"?e:e==null?s$:typeof e=="object"?os(e)?yme(e[0],e[1]):hme(e):xme(e)}function Sme(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var c=o[++s];if(n(i[c],c,i)===!1)break}return t}}var BB=Sme();function Eme(e,t){return e&&BB(e,t,$y)}var hN=function(){return eo.Date.now()},Nme="Expected a function",_me=Math.max,Cme=Math.min;function Ome(e,t,n){var r,s,i,o,a,c,u=0,f=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(Nme);t=ik(t)||0,Sr(n)&&(f=!!n.leading,h="maxWait"in n,i=h?_me(ik(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function y($){var R=r,M=s;return r=s=void 0,u=$,o=e.apply(M,R),o}function v($){return u=$,a=setTimeout(N,t),f?y($):o}function x($){var R=$-c,M=$-u,D=t-R;return h?Cme(D,i-M):D}function E($){var R=$-c,M=$-u;return c===void 0||R>=t||R<0||h&&M>=i}function N(){var $=hN();if(E($))return _($);a=setTimeout(N,x($))}function _($){return a=void 0,m&&r?y($):(r=s=void 0,o)}function C(){a!==void 0&&clearTimeout(a),u=0,r=c=s=a=void 0}function j(){return a===void 0?o:_(hN())}function A(){var $=hN(),R=E($);if(r=arguments,s=this,c=$,R){if(a===void 0)return v(c);if(h)return clearTimeout(a),a=setTimeout(N,t),y(c)}return a===void 0&&(a=setTimeout(N,t)),o}return A.cancel=C,A.flush=j,A}function kC(e,t,n){(n!==void 0&&!Ay(e[t],n)||n===void 0&&!(t in e))&&i$(e,t,n)}function jme(e){return jo(e)&&y1(e)}function IC(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Ame(e){return op(e,Ty(e))}function $me(e,t,n,r,s,i,o){var a=IC(e,n),c=IC(t,n),u=o.get(c);if(u){kC(e,n,u);return}var f=i?i(a,c,n+"",e,t,o):void 0,h=f===void 0;if(h){var m=os(c),y=!m&&Nh(c),v=!m&&!y&&b1(c);f=c,m||y||v?os(a)?f=a:jme(a)?f=dB(a):y?(h=!1,f=_B(c,!0)):v?(h=!1,f=$B(c,!0)):f=[]:EB(c)||Cg(c)?(f=a,Cg(a)?f=Ame(a):(!Sr(a)||m1(a))&&(f=TB(c))):h=!1}h&&(o.set(c,f),s(f,c,r,i,o),o.delete(c)),kC(e,n,f)}function zB(e,t,n,r,s){e!==t&&BB(t,function(i,o){if(s||(s=new Ui),Sr(i))$me(e,t,o,n,zB,r,s);else{var a=r?r(IC(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),kC(e,o,a)}},Ty)}var Tme=Ode(function(e,t,n,r){zB(e,t,n,r)});function Rme(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Mme=Object.prototype,kme=Mme.hasOwnProperty;function Ime(e,t){return e!=null&&kme.call(e,t)}function pN(e,t){return e!=null&&LB(e,t,Ime)}function Dme(e,t){return t.length<2?e:w1(e,she(t,0,-1))}function VB(e,t){return N1(e,t)}function Pme(e,t){return t=ap(t,e),e=Dme(e,t),e==null||delete e[lp(Rme(t))]}function Lme(e){return EB(e)?void 0:e}var Fme=1,Bme=2,zme=4,Ch=wB(function(e,t){var n={};if(e==null)return n;var r=!1;t=lB(t,function(i){return i=ap(i,e),r||(r=i.length>1),i}),op(e,AB(e),n),r&&(n=Km(n,Fme|Bme|zme,Lme));for(var s=t.length;s--;)Pme(n,t[s]);return n});function UB(e,t,n,r){if(!Sr(e))return e;t=ap(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var c=lp(t[s]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(s!=o){var f=a[c];u=r?r(f,c,a):void 0,u===void 0&&(u=Sr(f)?f:g1(t[s+1])?[]:{})}o$(a,c,u),a=a[c]}return e}function Vme(e,t,n){for(var r=-1,s=t.length,i={};++r<s;){var o=t[r],a=w1(e,o);n(a,o)&&UB(i,ap(o,e),a)}return i}function Ume(e,t){return Vme(e,t,function(n,r){return FB(e,r)})}var dx=wB(function(e,t){return e==null?{}:Ume(e,t)});function Lm(e,t,n){return e==null?e:UB(e,t,n)}var qme="Expected a function";function qB(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(qme);return Sr(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),Ome(e,t,{leading:r,maxWait:t,trailing:s})}function Zs(e,t,n){var r=os(e),s=r||Nh(e)||b1(e);if(t=wme(t),n==null){var i=e&&e.constructor;s?n=r?new i:[]:Sr(e)?n=m1(i)?uB(S1(e)):{}:n={}}return(s?hB:Eme)(e,function(o,a,c){return t(n,o,a,c)}),n}const Hme={primary:{schema:rB,field:_g},text:{schema:sB,field:r$},number:{schema:tB,field:t$},boolean:{schema:qF,field:HF},date:{schema:WF,field:jC},enum:{schema:GF,field:YF},json:{schema:JF,field:XF},jsonschema:{schema:ZF,field:eB}},gw=class gw{constructor(t){this.em=t}getIntrospector(){return this.em.connection.getIntrospector()}async introspect(){const t=await this.getIntrospector().getTables({withInternalKyselyTables:!1}),n=await this.getIntrospector().getIndices(),r=[];for(const s of t)gw.EXCLUDE_TABLES.includes(s.name)||r.push({...s,indices:n.filter(i=>i.table===s.name)});return r}getIntrospectionFromEntity(t){const n=t.getFields(!1),r=this.em.getIndicesOf(t);return{name:t.name,isView:!1,columns:n.map(s=>({name:s.name,dataType:"TEXT",isNullable:!0,isAutoIncrementing:s instanceof _g,hasDefaultValue:!1,comment:void 0})),indices:r.map(s=>({name:s.name,table:t.name,isUnique:s.unique,columns:s.fields.map(i=>({name:i.name,order:0}))}))}}async getDiff(){const t=await this.introspect(),n=this.em.entities.map(i=>this.getIntrospectionFromEntity(i)),r=[],s=i=>i.name;t.filter(i=>/bknd/.test(i.name)||i.isView?!1:!n.map(o=>o.name).includes(i.name)).forEach(i=>{r.push({name:i.name,isDrop:!0,isNew:!1,columns:{add:[],drop:[],change:[]},indices:{add:[],drop:[]}})});for(const i of n){const o=t.find(a=>a.name===i.name);if(!o)r.push({name:i.name,isNew:!0,columns:{add:i.columns.map(s),drop:[],change:[]},indices:{add:i.indices.map(s),drop:[]}});else{const a=i.columns.filter(y=>!o.columns.map(s).includes(y.name)),c=o.columns.filter(y=>!i.columns.map(s).includes(y.name)),u=[];for(const y of i.columns){const v=o.columns.find(E=>E.name===y.name),x=[];for(const[E,N]of Object.entries(y))v&&v[E]!==N&&x.push({attribute:E,prev:v[E],next:N});Object.keys(x).length>0&&u.push({name:y.name,changes:x})}const f=i.indices.filter(y=>!o.indices.map(v=>v.name).includes(y.name)),h=o.indices.filter(y=>!i.indices.map(v=>v.name).includes(y.name));[a,c,f,h].some(y=>y.length>0)&&r.push({name:i.name,isNew:!1,columns:{add:a.map(s),drop:c.map(s),change:[]},indices:{add:f.map(s),drop:h.map(s)}})}}return r}collectFieldSchemas(t,n){const r=[];if(n.length===0)return r;for(const s of n){const o=this.em.entity(t).getField(s).schema();o&&r.push(this.em.connection.getFieldSchema(o))}return r}async sync(t={force:!1,drop:!1}){const n=await this.getDiff(),r=[],s=this.em.connection.kysely.schema;for(const i of n){const o=[];let a=0;const c=this.collectFieldSchemas(i.name,i.columns.add),u=i.columns.drop,f=i.indices.drop;if(i.isDrop)a++,t.drop&&o.push(s.dropTable(i.name));else if(i.isNew){let h=s.createTable(i.name);for(const m of c)a++,h=h.addColumn(...m);o.push(h)}else{if(c.length>0)for(const h of c)a++,o.push(s.alterTable(i.name).addColumn(...h));if(t.drop&&u.length>0)for(const h of u)a++,o.push(s.alterTable(i.name).dropColumn(h))}for(const h of i.indices.add){const y=this.em.getIndicesOf(i.name).find(x=>x.name===h);let v=s.createIndex(h).on(i.name).columns(y.fields.map(x=>x.name));y.unique&&(v=v.unique()),o.push(v),a++}if(t.drop)for(const h of f)o.push(s.dropIndex(h)),a++;if(a!==0)for(const h of o){const{sql:m,parameters:y}=h.compile();if(r.push({sql:m,parameters:y}),t.force)try{pt.debug("[SchemaManager]",m),await h.execute()}catch(v){throw new Error(`Failed to execute query: ${m}: ${v.message}`)}}}return r}};K(gw,"EXCLUDE_TABLES",["libsql_wasm_func_table","sqlite_sequence","_cf_KV"]);let DC=gw;const HB=st({name:xe(),name_singular:xe(),description:xe(),sort_field:xe({default:nB.data.default_primary_field}),sort_dir:xe({enum:["asc","desc"],default:"asc"}),primary_format:xe({enum:n$})}).partial(),Wme=["regular","system","generated"],Tk=Symbol.for("bknd:entity");var yj,bj;const C5=class C5{constructor(t,n,r,s){Fe(this,yj);Fe(this,bj);K(this,"name");K(this,"fields");K(this,"config");K(this,"data");K(this,"type","regular");if(typeof t!="string"||t.length===0)throw new Error("Entity name must be a non-empty string");this.name=t,this.config=Ln(HB,r||{});const i=(n==null?void 0:n.filter(o=>o instanceof _g).length)??0;if(i>1)throw new Error(`Entity "${t}" has more than one primary field`);this.fields=i===1?[]:[new _g(void 0,{format:this.config.primary_format})],n&&n.forEach(o=>this.addField(o)),s&&(this.type=s),this[Tk]=!0}static isEntity(t){return t?t[Tk]===!0:!1}static create(t){return new C5(t.name,t.fields,t.config,t.type)}getType(){return this.type}getSelect(t,n){return this.getFields().filter(r=>!r.isHidden(n??"read")).map(r=>t?`${t}.${r.name} as ${r.name}`:r.name)}getDefaultSort(){return{by:this.config.sort_field??"id",dir:this.config.sort_dir??"asc"}}getAliasedSelectFrom(t,n,r){const s=n??this.name;return this.getFields().filter(i=>!i.isVirtual()&&!i.isHidden(r??"read")&&t.includes(i.name)).map(i=>s?`${s}.${i.name} as ${i.name}`:i.name)}getFillableFields(t,n){return this.getFields(n).filter(r=>r.isFillable(t))}getRequiredFields(){return this.getFields().filter(t=>t.isRequired())}getDefaultObject(){return this.getFields().reduce((t,n)=>(n.hasDefault()&&(t[n.name]=n.getDefault()),t),{})}getField(t){return this.fields.find(n=>n.name===t)}__replaceField(t,n){const r=this.fields.findIndex(s=>s.name===t);if(r===-1)throw new Error(`Field "${t}" not found on entity "${this.name}"`);this.fields[r]=n}getPrimaryField(){return this.fields[0]}id(){return this.getPrimaryField()}get label(){return this.config.name??xh(this.name)}field(t){return this.getField(t)}hasField(t){const n=typeof t=="string"?t:t.name;return this.fields.findIndex(r=>r.name===n)!==-1}getFields(t=!1){return t?this.fields:this.fields.filter(n=>!n.isVirtual())}addField(t){const n=this.getField(t.name);if(n){if(JSON.stringify(n)===JSON.stringify(t)){pt.warn(`Field "${t.name}" already exists on entity "${this.name}", but it's the same, so skipping.`);return}throw new Error(`Field "${t.name}" already exists on entity "${this.name}"`)}this.fields.push(t)}__setData(t){this.data=t}isValidData(t,n,r){if(typeof t!="object"&&r!=null&&r.explain)throw new Error(`Entity "${this.name}" data must be an object`);const s=this.getFillableFields(n,!1);if((r==null?void 0:r.ignoreUnknown)!==!0){const i=s.map(c=>c.name),a=Object.keys(t).filter(c=>!i.includes(c));if(a.length>0&&r!=null&&r.explain)throw new Error(`Entity "${this.name}" data must only contain known keys, unknown: "${a}"`)}for(const i of s)if(!i.isValid(t==null?void 0:t[i.name],n)){if(pt.warn("invalid data given for",this.name,n,i.name,t[i.name]),r!=null&&r.explain)throw new Error(`Field "${i.name}" has invalid data: "${t[i.name]}"`);return!1}return!0}toSchema(t){let n;switch(t==null?void 0:t.context){case"create":case"update":n=this.getFillableFields(t.context);break;default:n=this.getFields(!0)}const r=Object.fromEntries(n.map(i=>[i.name,i])),s={type:"object",additionalProperties:!1,properties:sn(r,i=>{const o=i.isFillable(t==null?void 0:t.context);return{title:i.config.label,$comment:i.config.description,$field:i.type,readOnly:o?void 0:!0,...i.toJsonSchema()}})};return t!=null&&t.clean?JSON.parse(JSON.stringify(s)):s}toTypes(){return{name:this.name,type:this.type,comment:this.config.description,fields:Object.fromEntries(this.getFields().map(t=>[t.name,t.toType()]))}}toJSON(){return{type:this.type,fields:Object.fromEntries(this.fields.map(t=>[t.name,t.toJSON()])),config:this.config}}};yj=new WeakMap,bj=new WeakMap;let dc=C5;function Ll(e){return["string","number","boolean"].includes(typeof e)}function Gme(e){return[!0,!1,0,1].includes(e)}class Yme{constructor(t,n,r){K(this,"expect");this.key=t,this.valid=n,this.validate=r}}function _i(e,t,n){return new Yme(e,t,n)}function WB(e,t){const n=e.find(r=>r.key===t);if(!n)throw new Error(`Expression does not exist: "${t}"`);return n}const Rk="$or";function m$(e,t,n=[]){const r=t.map(c=>c.key),s=Object.keys(e),i=[Rk],o={};if(s.some(c=>c.startsWith("$")&&!i.includes(c)))throw new Error(`Invalid key '${s}'. Keys must not start with '$'.`);if(n.length>0&&s.some(c=>i.includes(c)))throw new Error(`Operand ${Rk} can only appear at the top level.`);function a(c,u,f=[]){if(WB(t,c).valid(u)===!1)throw new Error(`Invalid value at "${[...f,c].join(".")}": ${u}`)}for(const[c,u]of Object.entries(e))if(c==="$or")o.$or=m$(u,t,[...n,c]);else if(Ll(u))a("$eq",u,n),o[c]={$eq:u};else if(typeof u=="object"){const f=Object.keys(u).filter(h=>!r.includes(h));if(f.length===0){o[c]={};for(const[h,m]of Object.entries(u))a(h,m,[...n,c]),o[c][h]=m}else throw new Error(`Invalid key(s) at "${c}": ${f.join(", ")}. Expected expressions.`)}return o}function Mk(e,t,n){const r=n.convert?m$(e,t):e,s={$and:[],$or:[],keys:new Set},{$or:i,...o}=r;function a(c,u,f,h=[]){const m=WB(t,c);if(!m)throw new Error(`Expression does not exist: "${c}"`);if(!m.valid(u))throw new Error(`Invalid expected value at "${[...h,c].join(".")}": ${u}`);return m.validate(u,f,n.exp_ctx)}for(const[c,u]of Object.entries(o))for(const[f,h]of Object.entries(u)){const m=n.value_is_kv?c:n.object[c];s.$and.push(a(f,h,m,[c])),s.keys.add(c)}for(const[c,u]of Object.entries(i??{})){const f=n.value_is_kv?c:n.object[c];for(const[h,m]of Object.entries(u))s.$or.push(a(h,m,f,[c])),s.keys.add(c)}return s}function Jme(e){const t={$and:void 0,$or:void 0};return t.$and=e.$and.every(n=>!!n),t.$or=e.$or.some(n=>!!n),!!t.$and||!!t.$or}function Xme(e){return{convert:t=>m$(t,e),build:(t,n)=>Mk(t,e,n),validate:(t,n)=>{const r=Mk(t,e,n);return Jme(r)},expressions:e,expressionKeys:e.map(t=>t.key)}}function Ci(e){if(typeof e!="string")throw new Error(`Invalid key: ${e}`);return e}const Kme=[_i("$eq",e=>Ll(e),(e,t,n)=>n(Ci(t),"=",e)),_i("$ne",e=>Ll(e),(e,t,n)=>n(Ci(t),"!=",e)),_i("$gt",e=>Ll(e),(e,t,n)=>n(Ci(t),">",e)),_i("$gte",e=>Ll(e),(e,t,n)=>n(Ci(t),">=",e)),_i("$lt",e=>Ll(e),(e,t,n)=>n(Ci(t),"<",e)),_i("$lte",e=>Ll(e),(e,t,n)=>n(Ci(t),"<=",e)),_i("$isnull",e=>Gme(e),(e,t,n)=>n(Ci(t),e?"is":"is not",null)),_i("$in",e=>Array.isArray(e),(e,t,n)=>n(Ci(t),"in",e)),_i("$notin",e=>Array.isArray(e),(e,t,n)=>n(Ci(t),"not in",e)),_i("$between",e=>Array.isArray(e)&&e.length===2,(e,t,n)=>n.between(Ci(t),e[0],e[1])),_i("$like",e=>Ll(e),(e,t,n)=>n(Ci(t),"like",String(e).replace(/\*/g,"%")))],mN=Xme(Kme);class cc{static addClause(t,n){return Object.keys(n).length===0?t:t.where(r=>{const s=mN.build(n,{value_is_kv:!0,exp_ctx:r,convert:!0});return s.$or.length>0&&s.$and.length>0?r.and(s.$and).or(r.and(s.$or)):s.$or.length>0?r.or(s.$or):r.and(s.$and)})}static convert(t){return mN.convert(t)}static getPropertyNames(t){const{keys:n}=mN.build(t,{value_is_kv:!0,exp_ctx:()=>null,convert:!0});return Array.from(n)}}class nd{constructor(t,n,r={}){K(this,"config");K(this,"source");K(this,"target");K(this,"directions",["source","target"]);this.source=t,this.target=n;const s=this.constructor.schema;this.config=Ln(s,r)}getReferenceQuery(t,n,r){return{}}helper(t){return new Zme(this,t)}other(t){const n=typeof t=="string"?t:t.name;if(this.source.entity.name===this.target.entity.name)return this.source.cardinality===1?this.target:this.source;if(this.source.entity.name===n)return this.target;if(this.target.entity.name===n)return this.source;throw new Error(`Entity "${n}" is not part of the relation "${this.source.entity.name} <-> ${this.target.entity.name}"`)}self(t){return this.other(t).entity.name===this.source.entity.name?this.target:this.source}ref(t){return this.source.reference===t?this.source:this.target}otherRef(t){return this.source.reference===t?this.target:this.source}visibleFrom(t){return this.directions.includes(t)}hydrate(t,n,r){const s=typeof t=="string"?t:t.name,i=this.ref(s),o=r.hydrate(i.entity.name,n);if(i.cardinality===1){if(Array.isArray(o)&&o.length>1)throw new Error(`Failed to hydrate "${i.entity.name}" with value: ${JSON.stringify(n)} (cardinality: 1)`);return o[0]}if(!o)throw new Error(`Failed to hydrate "${i.entity.name}" with value: ${JSON.stringify(n)} (cardinality: -)`);return o}isListableFor(t){return this.target.entity.name===t.name}get required(){return!!this.config.required}async $set(t,n,r){throw new Error("$set is not allowed")}async $create(t,n,r){throw new Error("$create is not allowed")}async $attach(t,n,r){throw new Error("$attach is not allowed")}async $detach(t,n,r){throw new Error("$detach is not allowed")}getName(){return[this.type().replace(":",""),this.source.entity.name,this.target.entity.name,this.config.mappedBy,this.config.inversedBy].filter(Boolean).join("_")}toJSON(){return{type:this.type(),source:this.source.entity.name,target:this.target.entity.name,config:this.config}}}K(nd,"schema",st({mappedBy:xe().optional(),inversedBy:xe().optional(),required:Wt().optional()}));class Oh{constructor(t,n,r){K(this,"entity");K(this,"cardinality");K(this,"reference");this.entity=t,this.cardinality=r,this.reference=n}toJSON(){return{entity:this.entity.name,cardinality:this.cardinality,name:this.reference}}}const Qme=["cascade","set null","set default","restrict","no action"],GB=st({reference:xe(),target:xe(),target_field:xe({default:"id"}).optional(),target_field_type:xe({enum:["text","integer"],default:"integer"}).optional(),on_delete:xe({enum:Qme,default:"set null"}).optional(),...Io.properties});class ys extends Zi{constructor(){super(...arguments);K(this,"type","relation")}getSchema(){return GB}static create(n,r,s){const i=[r.reference??r.entity.name,r.entity.getPrimaryField().name].join("_");return new ys(i,{...s,required:n.required,reference:r.reference,target:r.entity.name,target_field:r.entity.getPrimaryField().name,target_field_type:r.entity.getPrimaryField().fieldType})}reference(){return this.config.reference}target(){return this.config.target}targetField(){return this.config.target_field}schema(){return Object.freeze({...super.schema(),type:this.config.target_field_type??"integer",references:`${this.config.target}.${this.config.target_field}`,onDelete:this.config.on_delete??"set null"})}transformRetrieve(n){return n}async transformPersist(n,r){throw new Error("RelationField: This function should not be called")}toJsonSchema(){var n,r;return this.toSchemaWrapIfRequired(Rt({$ref:`${(n=this.config)==null?void 0:n.target}#/properties/${(r=this.config)==null?void 0:r.target_field}`}))}toType(){return{...super.toType(),type:"number"}}}const Fr={OneToOne:"1:1",ManyToOne:"n:1",ManyToMany:"m:n",Polymorphic:"poly"},yw=class yw extends nd{constructor(n,r,s,i){const o=(s==null?void 0:s.connectionTable)||yw.defaultConnectionTable(n,r),a=new Oh(n,n.name),c=new Oh(r,r.name);super(a,c,s);K(this,"connectionEntity");K(this,"additionalFields",[]);K(this,"connectionTableMappedName");K(this,"em");this.connectionEntity=new dc(o,i,void 0,"generated"),this.connectionTableMappedName=(s==null?void 0:s.connectionTableMappedName)||o,this.additionalFields=i||[]}static defaultConnectionTable(n,r){return`${n.name}_${r.name}`}type(){return Fr.ManyToMany}isListableFor(){return!0}getField(n){const r=this.connectionEntity,s=r.fields.find(i=>i instanceof ys&&i.target()===n.name);if(!s||!(s instanceof ys))throw new Error(`Connection entity "${r.name}" does not have a relation to "${n.name}"`);return s}getQueryInfo(n){const r=this.other(n),s=this.connectionEntity,i=this.getField(n),o=this.getField(r.entity),a=`${n.name}.${n.getPrimaryField().name}`,c=`${s.name}.${i.name}`,u=`${s.name}.${o.name}`,f=[s.name,`${r.entity.name}.${r.entity.getPrimaryField().name}`,u],h=`${n.name}.${n.getPrimaryField().name}`;return{other:r,join:f,entityRef:a,selfRef:c,otherRef:u,groupBy:h}}getReferenceQuery(n,r){const{other:s,otherRef:i}=this.getQueryInfo(n);return{where:{[i]:r},join:[s.reference]}}buildJoin(n,r){const{other:s,join:i,entityRef:o,selfRef:a,groupBy:c}=this.getQueryInfo(n);return r.innerJoin(s.entity.name,o,a).innerJoin(...i).groupBy(c)}buildWith(n){if(!this.em)throw new Error("EntityManager not set, can't build");const r=this.em.connection.fn.jsonBuildObject;if(!r)throw new Error("Connection does not support jsonBuildObject");const s=5,{other:i,join:o,entityRef:a,selfRef:c}=this.getQueryInfo(n),u=this.connectionEntity.fields.filter(f=>!(f instanceof ys||f instanceof _g));return f=>f.selectFrom(i.entity.name).select(h=>{const m=[];if(u.length>0){const y=this.connectionEntity.name;m.push(r(Object.fromEntries(u.map(v=>[v.name,h.ref(`${y}.${v.name}`)]))).as(this.connectionTableMappedName))}return m}).whereRef(a,"=",c).innerJoin(...o).limit(s)}initialize(n){this.em=n;const r=ys.create(this,this.source),s=ys.create(this,this.target);n.hasEntity(this.connectionEntity)?(this.connectionEntity.hasField(r)||this.connectionEntity.addField(r),this.connectionEntity.hasField(s)||this.connectionEntity.addField(s)):(this.connectionEntity.addField(r),this.connectionEntity.addField(s),n.addEntity(this.connectionEntity))}getName(){return[super.getName(),[this.connectionEntity.name,this.connectionTableMappedName].filter(Boolean)].join("_")}};K(yw,"schema",st({connectionTable:xe().optional(),connectionTableMappedName:xe().optional(),...nd.schema.properties}));let La=yw;const fg=class fg extends nd{constructor(n,r,s={}){const i=s.mappedBy||r.name,o=s.inversedBy||n.name,a=typeof s.sourceCardinality=="number"&&s.sourceCardinality>0?s.sourceCardinality:void 0,c=new Oh(n,o,a),u=new Oh(r,i,1);super(c,u,s);K(this,"fieldConfig");this.fieldConfig=s.fieldConfig??{}}type(){return Fr.ManyToOne}initialize(n){const r=xh(this.target.reference),s=ys.create(this,this.target,{label:r,...this.fieldConfig});this.source.entity.field(s.name)||this.source.entity.addField(ys.create(this,this.target,{label:r,...this.fieldConfig}))}getField(){const n=this.target.entity.getPrimaryField().name,r=this.source.entity.getField(`${this.target.reference}_${n}`);if(!(r instanceof ys))throw new Error(`Field "${this.target.reference}_${n}" not found on entity "${this.source.entity.name}"`);return r}queryInfo(n,r){const s=this.source.reference===r?"source":"target",i=this[s],o=this[s==="source"?"target":"source"];let a,c,u;s==="source"?(a=this.source.reference,c=`${a}.${this.getField().name}`,u=`${n.name}.${i.entity.getPrimaryField().name}`):(a=this.target.reference,c=`${a}.${n.getPrimaryField().name}`,u=`${n.name}.${this.getField().name}`);const f=`${n.name}.${n.getPrimaryField().name}`;return{other:o,self:i,relationRef:a,entityRef:c,otherRef:u,groupBy:f}}getReferenceQuery(n,r,s){const i=this.source.reference===s?"source":"target",o=this[i],a=this[i==="source"?"target":"source"];return{where:{[`${a.reference}_${a.entity.getPrimaryField().name}`]:r},join:a.entity.name===o.entity.name?[]:[a.entity.name]}}buildJoin(n,r,s){const{self:i,entityRef:o,otherRef:a,groupBy:c}=this.queryInfo(n,s);return r.innerJoin(i.entity.name,o,a).groupBy(c)}buildWith(n,r){const{self:s,entityRef:i,otherRef:o,relationRef:a}=this.queryInfo(n,r);return c=>c.selectFrom(`${s.entity.name} as ${a}`).whereRef(i,"=",o).$if(s.cardinality===1,u=>u.limit(1))}async $set(n,r,s){if(typeof s!="object")throw new Error(`Invalid value for relation field "${r}" given, expected object.`);const i=this.source.entity,a=this.helper(i.name).getMutationInfo();if(!a.$set)throw new Error(`Cannot perform $set for relation "${r}"`);const c=a.local_field,u=this.getField(),f=s[Object.keys(s)[0]];if(!c||!(u instanceof ys))throw new Error(`Cannot perform $set for relation "${r}"`);if(f===null&&!u.isRequired())return[c,null];if(!(await n.repository(u.target()).exists({[u.targetField()]:f})).data.exists){const m=u.targetField();throw new Error(`Cannot connect "${i.name}.${r}" to "${u.target()}.${m}" = "${f}": not found.`)}return[c,f]}};K(fg,"DEFAULTS",{with_limit:5}),K(fg,"schema",st({sourceCardinality:Rt().optional(),with_limit:Rt({default:fg.DEFAULTS.with_limit}).optional(),fieldConfig:Qe({label:xe()}).optional(),...nd.schema.properties}));let _c=fg;class PC extends _c{constructor(t,n,r){const{mappedBy:s,inversedBy:i,required:o}=r||{};super(t,n,{mappedBy:s,inversedBy:i,sourceCardinality:1,required:o})}type(){return Fr.OneToOne}isListableFor(){return!1}async $set(t,n,r){throw new Error("$set is not allowed")}async $create(t,n,r){if(r===null||typeof r!="object")throw new Error(`Invalid value for relation field "${n}" given, expected object.`);const s=this.other(this.source.entity).entity,o=this.helper(this.source.entity.name).getMutationInfo(),a=o.primary,c=o.local_field;if(!o.$create||!a||!c)throw new Error(`Cannot perform $create for relation "${n}"`);try{const{data:u}=await t.mutator(s).insertOne(r),f=u[a];return[c,f]}catch{throw new Error(`Error performing $create on "${s.name}".`)}}}class $g extends nd{constructor(t,n,r={}){const s=r.mappedBy||n.name,i=r.inversedBy||t.name,o=typeof r.targetCardinality=="number"&&r.targetCardinality>0?r.targetCardinality:void 0,a=new Oh(t,i,1),c=new Oh(n,s,o);super(a,c,r),this.directions=["source"]}type(){return Fr.Polymorphic}queryInfo(t){const n=this.other(t),r=`${n.entity.name}.${this.getReferenceField().name}`,s=`${t.name}.${this.config.mappedBy}`,i=`${n.entity.name}.${this.config.mappedBy}`,o=`${t.name}.${t.getPrimaryField().name}`,a=`${n.entity.name}.${this.getEntityIdField().name}`,c=`${t.name}.${t.getPrimaryField().name}`;return{other:n,whereLhs:r,reference:s,reference_other:i,entityRef:o,otherRef:a,groupBy:c}}buildJoin(t,n){const{other:r,whereLhs:s,reference:i,entityRef:o,otherRef:a,groupBy:c}=this.queryInfo(t);return n.innerJoin(r.entity.name,u=>u.onRef(o,"=",a).on(s,"=",i)).groupBy(c)}getReferenceQuery(t,n){const r=this.queryInfo(t);return{where:{[this.getReferenceField().name]:r.reference_other,[this.getEntityIdField().name]:n}}}buildWith(t){const{other:n,whereLhs:r,reference:s,entityRef:i,otherRef:o}=this.queryInfo(t);return a=>a.selectFrom(n.entity.name).where(r,"=",s).whereRef(i,"=",o).$if(n.cardinality===1,c=>c.limit(1))}isListableFor(t){return this.source.entity.name===t.name&&this.target.cardinality!==1}getReferenceField(){return new r$("reference",{hidden:!0,fillable:["create"]})}getEntityIdField(){return new t$("entity_id",{hidden:!0,fillable:["create"]})}initialize(t){const n=this.getReferenceField(),r=this.getEntityIdField();this.target.entity.field(n.name)||this.target.entity.addField(n),this.target.entity.field(r.name)||this.target.entity.addField(r)}}K($g,"schema",st({targetCardinality:Rt().optional(),...nd.schema.properties}));const kk=["$set","$create","$attach","$detach"];class Zme{constructor(t,n){K(this,"relation");K(this,"access");K(this,"self");K(this,"other");if(this.relation=t,t.source.entity.name===n)this.access="source",this.self=t.source,this.other=t.target;else if(t.target.entity.name===n)this.access="target",this.self=t.target,this.other=t.source;else throw new Error(`Entity "${n}" is not part of the relation "${t.source.entity.name} <-> ${t.target.entity.name}"`)}getMutationInfo(){var s,i;const t={$set:!1,$create:!1,$attach:!1,$detach:!1};let n,r;switch(this.relation.type()){case Fr.ManyToOne:typeof this.self.cardinality>"u"&&this.other.cardinality===1&&(t.$set=!0,n=(s=this.relation.getField())==null?void 0:s.name,r=this.other.entity.getPrimaryField().name);break;case Fr.OneToOne:this.access==="source"&&(t.$create=!0,t.$set=!0,n=(i=this.relation.getField())==null?void 0:i.name,r=this.other.entity.getPrimaryField().name);break;case Fr.ManyToMany:this.access==="source"&&(t.$attach=!0,t.$detach=!0,r=this.other.entity.getPrimaryField().name);break}return{reference:this.other.reference,local_field:n,...t,primary:r,cardinality:this.other.cardinality,relation_type:this.relation.type()}}}class ege{constructor(t,n){this.entity=t,this.em=n}getRelationalKeys(){const t=[];return this.entity.type==="generated"&&this.em.relations.all.find(r=>r instanceof La&&r.connectionEntity.name===this.entity.name)instanceof La&&t.push(...this.entity.fields.filter(r=>r.type==="relation").map(r=>r.name)),this.em.relationsOf(this.entity.name).map(n=>{const r=n.helper(this.entity.name).getMutationInfo();t.push(r.reference),r.local_field&&t.push(r.local_field)}),t}async persistRelationField(t,n,r){if(r===null&&!t.isRequired())return[n,r];if(typeof r=="object")throw new Error(`Invalid value for relation field "${n}" given, expected primitive.`);if(!(await this.em.repository(t.target()).exists({[t.targetField()]:r})).data.exists){const i=t.targetField();throw new Error(`Cannot connect "${this.entity.name}.${n}" to "${t.target()}.${i}" = "${r}": not found.`)}return[n,r]}async persistReference(t,n,r){if(typeof r!="object"||r===null||typeof r>"u")throw new Error(`Invalid value for relation "${n}" given, expected object to persist reference. Like '{$set: {id: 1}}'.`);const s=Object.keys(r)[0];if(!kk.includes(s))throw new Error(`Invalid operation "${s}" for relation "${n}". Allowed: ${kk.join(", ")}`);const i=r[s];return await t[s](this.em,n,i)}async persistRelation(t,n){const r=this.entity.getField(t);if(r instanceof ys)return this.persistRelationField(r,t,n);const s=this.em.relationOf(this.entity.name,t);if(s)return this.persistReference(s,t,n);throw new Error(`Relation "${t}" failed to resolve on entity "${this.entity.name}": Unable to resolve relation origin.`)}}const YB={[Fr.OneToOne]:{schema:PC.schema,cls:PC},[Fr.ManyToOne]:{schema:_c.schema,cls:_c},[Fr.ManyToMany]:{schema:La.schema,cls:La},[Fr.Polymorphic]:{schema:$g.schema,cls:$g}},tge={relation:{schema:GB,field:ys}};class JB{constructor(t,n={}){K(this,"results",[]);K(this,"time",0);this.conn=t,this.options=n}get(){if(!this.results)throw new Error("Result not executed");return Array.isArray(this.results)?this.results??[]:this.results[0]}first(){const t=this.get();return(Array.isArray(t)?t[0]:t)??{}}get sql(){return this.first().sql}get parameters(){return this.first().parameters}get data(){var t;return this.options.single?(t=this.first().data)==null?void 0:t[0]:this.first().data??[]}async execute(t){var r,s,i,o;const n=Array.isArray(t)?t:[t];for(const a of n){const c=a.compile();await((s=(r=this.options).beforeExecute)==null?void 0:s.call(r,c));try{const u=performance.now(),f=await this.conn.executeQuery(c);this.time=Number.parseFloat((performance.now()-u).toFixed(2)),this.results.push({...f,data:(o=(i=this.options).hydrator)==null?void 0:o.call(i,f.rows),items:f.rows.length,time:this.time,sql:c.sql,parameters:[...c.parameters]})}catch(u){if(this.options.onError)await this.options.onError(u);else throw u}}return this}additionalMetaKeys(){return[]}toJSON(){const{rows:t,data:n,...r}=this.first(),s=qr()?["items","time","sql","parameters"]:["items","time"],i=ML(r,[...s,...this.additionalMetaKeys()]);return{data:this.data,meta:i}}}class nge extends JB{constructor(t,n,r){const s=(r==null?void 0:r.logParams)===void 0?qr():r.logParams;super(t.connection,{hydrator:i=>t.hydrate(n.name,i),beforeExecute:i=>{r!=null&&r.silent||pt.debug(`[Mutation]
${i.sql}
`,s?i.parameters:void 0)},onError:i=>{if(!(r!=null&&r.silent))throw pt.error("[ERROR] Mutator:",i.message),i},...r}),this.em=t,this.entity=n}}const da=class da{constructor(t,n,r){K(this,"emgr");K(this,"__unstable_disable_system_entity_creation",!0);this.em=t,this.entity=n,this.options=r,this.emgr=(r==null?void 0:r.emgr)??new jy(ax)}__unstable_toggleSystemEntityCreation(t){this.__unstable_disable_system_entity_creation=t}get conn(){return this.em.connection.kysely}async getValidatedData(t,n){const r=this.entity;if(!n)throw new Error("Context must be provided for validation");const s=Object.keys(t),i={},o=new ege(r,this.em),a=o.getRelationalKeys();for(const c of s){if(a.includes(c)){const f=await o.persistRelation(c,t[c]);if(Array.isArray(f)){const[h,m]=f;i[h]=m}continue}const u=r.getField(c);if(!u)throw new Error(`Field "${c}" not found on entity "${r.name}". Fields: ${r.getFillableFields().map(f=>f.name).join(", ")}`);if(!u.isFillable(n))throw new Error(`Field "${c}" is not fillable on entity "${r.name}"`);i[c]=await u.transformPersist(t[c],this.em,n),i[c]=this.em.connection.toDriver(i[c],u)}if(Object.keys(i).length===0)throw new Error(`No data left to update "${r.name}"`);return i}async performQuery(t,n){return await new nge(this.em,this.entity,{silent:!1,...n}).execute(t)}async insertOne(t){const n=this.entity;if(n.type==="system"&&this.__unstable_disable_system_entity_creation)throw new Error(`Creation of system entity "${n.name}" is disabled`);const r=await this.emgr.emit(new da.Events.MutatorInsertBefore({entity:n,data:t})),s=r.returned?r.params.data:t;let i=await this.getValidatedData({...n.getDefaultObject(),...s},"create");const o=n.getRequiredFields();for(const h of o)if(typeof i[h.name]>"u"||i[h.name]===null)throw new Error(`Field "${h.name}" is required`);const a=n.getPrimaryField(),c=a.getNewValue();c&&(i={[a.name]:c,...i});const u=this.conn.insertInto(n.name).values(i).returning(n.getSelect()),f=await this.performQuery(u,{single:!0});return await this.emgr.emit(new da.Events.MutatorInsertAfter({entity:n,data:f.data,changed:i})),f}async updateOne(t,n){const r=this.entity;if(!t)throw new Error("ID must be provided for update");const s=await this.emgr.emit(new da.Events.MutatorUpdateBefore({entity:r,entityId:t,data:n})),i=s.returned?s.params.data:n,o=await this.getValidatedData(i,"update"),a=this.conn.updateTable(r.name).set(o).where(r.id().name,"=",t).returning(r.getSelect()),c=await this.performQuery(a,{single:!0});return await this.emgr.emit(new da.Events.MutatorUpdateAfter({entity:r,entityId:t,data:c.data,changed:o})),c}async deleteOne(t){const n=this.entity;if(!t)throw new Error("ID must be provided for deletion");await this.emgr.emit(new da.Events.MutatorDeleteBefore({entity:n,entityId:t}));const r=this.conn.deleteFrom(n.name).where(n.id().name,"=",t).returning(n.getSelect()),s=await this.performQuery(r,{single:!0});return await this.emgr.emit(new da.Events.MutatorDeleteAfter({entity:n,entityId:t,data:s.data})),s}getValidOptions(t){const n=this.entity,r={};if(t!=null&&t.where){const s=cc.getPropertyNames(t.where).filter(i=>typeof n.getField(i)>"u");if(s.length>0)throw new Jl(`Invalid where field(s): ${s.join(", ")}`);r.where=t.where}return r}appendWhere(t,n){const r=this.entity;if(r.name,n){const s=cc.getPropertyNames(n).filter(i=>typeof r.getField(i)>"u");if(s.length>0)throw new Jl(`Invalid where field(s): ${s.join(", ")}`);return cc.addClause(t,n)}return t}async deleteWhere(t){const n=this.entity;if(!t||typeof t!="object"||Object.keys(t).length===0)throw new Error("Where clause must be provided for mass deletion");const r=this.appendWhere(this.conn.deleteFrom(n.name),t).returning(n.getSelect());return await this.performQuery(r)}async updateWhere(t,n){const r=this.entity,s=await this.getValidatedData(t,"update");if(!n||typeof n!="object"||Object.keys(n).length===0)throw new Error("Where clause must be provided for mass update");const i=this.appendWhere(this.conn.updateTable(r.name),n).set(s).returning(r.getSelect());return await this.performQuery(i)}async insertMany(t){const n=this.entity;if(n.type==="system"&&this.__unstable_disable_system_entity_creation)throw new Error(`Creation of system entity "${n.name}" is disabled`);const r=[];for(const i of t){const o={...n.getDefaultObject(),...await this.getValidatedData(i,"create")},a=n.getRequiredFields();for(const c of a)if(typeof o[c.name]>"u"||o[c.name]===null)throw new Error(`Field "${c.name}" is required`);r.push(o)}const s=this.conn.insertInto(n.name).values(r).returning(n.getSelect());return await this.performQuery(s)}};K(da,"Events",ax);let LC=da;const fx=xe({pattern:"^(?:[a-zA-Z_$][\\w$]*)(?:,[a-zA-Z_$][\\w$]*)*$"}),Ik=Zt([fx,un(fx,{uniqueItems:!0})],{default:[],coerce:e=>Array.isArray(e)?e:typeof e=="string"?e.includes(",")?e.split(","):[e]:[]}),Mb={by:"id",dir:"asc"},rge=Qe({by:xe(),dir:xe({enum:["asc","desc"]}).optional()}).strict(),sge=Zt([xe(),rge],{default:Mb,coerce:e=>{if(typeof e=="string"){if(/^-?[a-zA-Z_][a-zA-Z0-9_.]*$/.test(e)){const t=e[0]==="-"?"desc":"asc";return{by:t==="desc"?e.slice(1):e,dir:t}}else if(/^{.*}$/.test(e))return{...Mb,...JSON.parse(e)};return pt.warn(`Invalid sort given: '${JSON.stringify(e)}'`),Mb}else if(Sh(e))return{...Mb,...e};return e}}),ige=Zt([xe(),Qe({})],{default:{},examples:[{attribute:{$eq:1}}],coerce:e=>{const t=typeof e=="string"?JSON.parse(e):e;return cc.convert(t)}}),oge=e=>Zt([fx,un(fx),e],{coerce:function(t,n={}){let r=t;if(typeof r=="string"&&(r.match(/^\{/)||r.match(/^\[/)?r=JSON.parse(r):r.includes(",")?r=r.split(","):r=[r]),Array.isArray(r)&&(r=r.reduce((s,i)=>(s[i]={},s),{})),Sh(r))for(const s in r)r[s]=e.coerce(r[s],n);return r}}),Ys=sle(e=>Qe({limit:Rt({default:10}),offset:Rt({default:0}),sort:sge,where:ige,select:Ik,join:Ik,with:oge(e)}).partial()),age=()=>Ys.template({},{withOptional:!0});class hx{static buildClause(t,n,r,s){const i=t.relationOf(r.name,s);if(!i)throw new Error(`Relation "${s}" not found`);return i.buildJoin(r,n,s)}static getJoinedEntityNames(t,n,r){return r.flatMap(s=>{const i=t.relationOf(n.name,s);if(!i)throw new Error(`Relation "${s}" not found`);const o=i.other(n);return i instanceof _c?[o.entity.name]:i instanceof La?[o.entity.name,i.connectionEntity.name]:[]})}static addClause(t,n,r,s){if(s.length===0)return n;let i=n;for(const o of s)i=hx.buildClause(t,i,r,o);return i}}class lge extends JB{constructor(t,n,r){super(t.connection,{hydrator:s=>t.hydrate(n.name,s),beforeExecute:s=>{r!=null&&r.silent||pt.debug(`Query:
${s.sql}
`,s.parameters)},onError:s=>{if((r==null?void 0:r.silent)!==!0)throw pt.error("Repository:",String(s)),s},...r}),this.em=t,this.entity=n}shouldIncludeCounts(t){return t===void 0?this.conn.supports("softscans"):t}async execute(t,n){var s,i,o,a,c,u;if(this.shouldIncludeCounts(n==null?void 0:n.includeCounts)){const f=(v="count")=>this.conn.kysely.fn.countAll().as(v),h=t.clearSelect().select(f()).clearLimit().clearOffset().clearGroupBy().clearOrderBy(),m=this.conn.kysely.selectFrom(this.entity.name).select(f()),y=t.compile();(i=(s=this.options).beforeExecute)==null||i.call(s,y);try{const v=performance.now(),[x,E,N]=await this.em.connection.executeQueries(y,h,m);this.time=Number.parseFloat((performance.now()-v).toFixed(2)),this.results.push({...x,data:(a=(o=this.options).hydrator)==null?void 0:a.call(o,x.rows),items:x.rows.length,count:_6(((c=E.rows[0])==null?void 0:c.count)??0),total:_6(((u=N.rows[0])==null?void 0:u.count)??0),time:this.time,sql:y.sql,parameters:[...y.parameters]})}catch(v){if(this.options.onError)await this.options.onError(v);else throw v}return this}return await super.execute(t)}get count(){return this.first().count}get total(){return this.first().total}additionalMetaKeys(){return["count","total"]}}const ql=class ql{constructor(t,n,r={}){K(this,"emgr");this.em=t,this.entity=n,this.options=r,this.emgr=(r==null?void 0:r.emgr)??new jy(ax)}cloneFor(t,n={}){return new ql(this.em,this.em.entity(t),{...this.options,...n,emgr:this.emgr})}get conn(){return this.em.connection.kysely}checkIndex(t,n,r){var i;!this.em.getIndexedFields(t).map(o=>o.name).includes(n)&&((i=this.options)==null?void 0:i.silent)!==!0&&pt.warn(`Field "${t}.${n}" used in "${r}" is not indexed`)}getValidOptions(t){var s;const n=this.entity,r={...structuredClone(age()),sort:n.getDefaultSort(),select:n.getSelect()};if(!t)return r;if(t.sort){if(!r.select.includes(t.sort.by))throw new Jl(`Invalid sort field "${t.sort.by}"`);if(!["asc","desc"].includes(t.sort.dir))throw new Jl(`Invalid sort direction "${t.sort.dir}"`);this.checkIndex(n.name,t.sort.by,"sort"),r.sort={dir:t.sort.dir??"asc",by:t.sort.by}}if(t.select&&t.select.length>0){const i=t.select.filter(o=>!r.select.includes(o));if(i.length>0)throw new Jl(`Invalid select field(s): ${i.join(", ")}`).context({entity:n.name,valid:r.select});r.select=t.select}if(t.with&&(Tg.validateWiths(this.em,n.name,t.with),r.with=t.with),t.join&&t.join.length>0)for(const i of t.join){if(!this.em.relationOf(n.name,i))throw new Jl(`JOIN: "${i}" is not a relation of "${n.name}"`);r.join.push(i)}if(t.where){const i=[n.name];((s=r.join)==null?void 0:s.length)>0&&i.push(...hx.getJoinedEntityNames(this.em,n,r.join));const o=cc.getPropertyNames(t.where).filter(a=>{if(a.includes(".")){const[c,u]=a.split(".");return i.includes(c)?(this.checkIndex(c,u,"where"),!this.em.entity(c).getField(u)):!0}return this.checkIndex(n.name,a,"where"),typeof n.getField(a)>"u"});if(o.length>0)throw new Jl(`Invalid where field(s): ${o.join(", ")}`).context({aliases:i,entity:n.name});r.where=t.where}return t.limit&&(r.limit=t.limit),t.offset&&(r.offset=t.offset),r}async performQuery(t,n,r){return await new lge(this.em,this.entity,{silent:this.options.silent,...n}).execute(t,{includeCounts:(r==null?void 0:r.includeCounts)??this.options.includeCounts})}async triggerFindBefore(t,n){const r=n.limit===1?ql.Events.RepositoryFindOneBefore:ql.Events.RepositoryFindManyBefore;await this.emgr.emit(new r({entity:t,options:n}))}async triggerFindAfter(t,n,r){n.limit===1?await this.emgr.emit(new ql.Events.RepositoryFindOneAfter({entity:t,options:n,data:r})):await this.emgr.emit(new ql.Events.RepositoryFindManyAfter({entity:t,options:n,data:r}))}async single(t,n){await this.triggerFindBefore(this.entity,n);const r=await this.performQuery(t,{single:!0});return await this.triggerFindAfter(this.entity,n,r.data),r}addOptionsToQueryBuilder(t,n,r){var h,m;const s=this.entity;let i=t??this.conn.selectFrom(s.name);const o=(r==null?void 0:r.validate)!==!1?this.getValidOptions(n):n;if(!o)return i;const a=(r==null?void 0:r.alias)??s.name,c=y=>`${a}.${y}`,u=(r==null?void 0:r.ignore)??[],f={limit:10,offset:0,...r==null?void 0:r.defaults};return!u.includes("select")&&o.select&&(i=i.select(s.getAliasedSelectFrom(o.select,a))),!u.includes("with")&&o.with&&(i=Tg.addClause(this.em,i,s,o.with)),!u.includes("join")&&o.join&&(i=hx.addClause(this.em,i,s,o.join)),!u.includes("where")&&o.where&&(i=cc.addClause(i,o.where)),u.includes("limit")||(i=i.limit(o.limit??f.limit),u.includes("offset")||(i=i.offset(o.offset??f.offset))),u.includes("sort")||(i=i.orderBy(c(((h=o.sort)==null?void 0:h.by)??"id"),((m=o.sort)==null?void 0:m.dir)??"asc")),i}buildQuery(t,n=[]){const r=this.entity,s=this.getValidOptions(t);return{qb:this.addOptionsToQueryBuilder(void 0,s,{ignore:n,alias:r.name,validate:!1}),options:s}}async findId(t,n){const{qb:r,options:s}=this.buildQuery({...n,where:{[this.entity.getPrimaryField().name]:t},limit:1},["offset","sort"]);return this.single(r,s)}async findOne(t,n){const{qb:r,options:s}=this.buildQuery({...n,where:t,limit:1});return await this.single(r,s)}async findMany(t){const{qb:n,options:r}=this.buildQuery(t);await this.triggerFindBefore(this.entity,r);const s=await this.performQuery(n);return await this.triggerFindAfter(this.entity,r,s.data),s}async findManyByReference(t,n,r){const s=this.entity,o=this.em.relations.listableRelationsOf(s).find(f=>f.ref(n).reference===n);if(!o)throw new Error(`Relation "${n}" not found or not listable on entity "${s.name}"`);const a=o.other(s).entity,c=o.getReferenceQuery(a,t,n);if(!("where"in c)||Object.keys(c.where).length===0)throw new Error(`Invalid reference query for "${n}" on entity "${a.name}"`);const u={...r,...c,where:{...c.where,...(r==null?void 0:r.where)??{}}};return this.cloneFor(a).findMany(u)}async count(t){const n=this.entity,r=this.getValidOptions({where:t}),s=this.conn.fn.count(Ng`*`).as("count");let i=this.conn.selectFrom(n.name).select(s);return r.where&&(i=cc.addClause(i,r.where)),await this.performQuery(i,{hydrator:o=>{var a;return{count:((a=o[0])==null?void 0:a.count)??0}}},{includeCounts:!1})}async exists(t){const n=this.entity,r=this.getValidOptions({where:t}),s=this.conn.fn.count(Ng`*`).as("count");let i=this.conn.selectFrom(n.name).select(s);return i=cc.addClause(i,r.where).limit(1),await this.performQuery(i,{hydrator:o=>{var a;return{exists:((a=o[0])==null?void 0:a.count)>0}}})}};K(ql,"Events",VF);let FC=ql;class Tg{static addClause(t,n,r,s){if(!s||!Sh(s))return console.warn(`'withs' undefined or invalid, given: ${JSON.stringify(s)}`),n;const i=t.connection.fn;let o=n;for(const[a,c]of Object.entries(s)){const u=t.relationOf(r.name,a);if(!u)throw new Error(`Relation "${r.name}<>${a}" not found`);const f=u.ref(a).cardinality,h=f===1?i.jsonObjectFrom:i.jsonArrayFrom;if(!h)throw new Error("Connection does not support jsonObjectFrom/jsonArrayFrom");const m=u.other(r);o=o.select(y=>{let v=u.buildWith(r,a)(y);return c&&(v=t.repo(m.entity).addOptionsToQueryBuilder(v,c,{ignore:["with","join",f===1?"limit":void 0].filter(Boolean)})),c.with&&(v=Tg.addClause(t,v,m.entity,c.with)),h(v).as(m.reference)})}return o}static validateWiths(t,n,r){let s=0;if(!r||!Sh(r))return r&&console.warn(`'withs' invalid, given: ${JSON.stringify(r)}`),s;const i=[];for(const[o,a]of Object.entries(r)){if(!t.relationOf(n,o))throw new Jl(`WITH: "${o}" is not a relation of "${n}"`);s++,"with"in a&&i.push(Tg.validateWiths(t,o,a.with))}return i.length>0&&(s+=Math.max(...i)),s}}const hg=class hg{constructor(t,n,r=[],s=[],i){K(this,"connection");K(this,"_entities",[]);K(this,"_relations",[]);K(this,"_indices",[]);K(this,"_schema");K(this,"emgr");if(t.forEach(o=>this.addEntity(o)),r.forEach(o=>this.addRelation(o)),s.forEach(o=>this.addIndex(o)),!RF.isConnection(n))throw new Kce("");this.connection=n,this.emgr=i??new jy,this.emgr.registerEvents(hg.Events)}fork(){return new hg(this._entities,this.connection,this._relations,this._indices)}clear(){return this._entities=[],this._relations=[],this._indices=[],this}get entities(){return this._entities}get relations(){return new UF(this._relations)}get indices(){return this._indices}async ping(){return(await Ng`SELECT 1`.execute(this.connection.kysely)).rows.length>0}addEntity(t){const n=this.entities.find(r=>r.name===t.name);if(n){if(JSON.stringify(n)===JSON.stringify(t)){pt.warn(`Entity "${t.name}" already exists, but it's the same, skipping adding it.`);return}throw new Error(`Entity "${t.name}" already exists`)}this.entities.push(t)}__replaceEntity(t,n=t.name){const r=this._entities.findIndex(s=>s.name===n);if(r===-1)throw new Error(`Entity "${n}" not found and cannot be replaced`);this._entities[r]=t}entity(t,n){const r=this.entities.find(s=>dc.isEntity(t)?s.name===t.name:s.name===t);if(!r){if(n===!0)return;throw new eue(dc.isEntity(t)?t.name:t)}return r}hasEntity(t){const n=typeof t=="string"?t:t.name;return this.entities.some(r=>r.name===n)}hasIndex(t){const n=typeof t=="string"?t:t.name;return this.indices.some(r=>r.name===n)}getIndexedFields(t){const n=this.entity(t),r=this.getIndicesOf(n),s=n.fields.filter(o=>o.type==="relation"),i=r.map(o=>o.fields[0]);return[n.getPrimaryField(),...s,...i].filter(Boolean)}addRelation(t){if(!this.entity(t.source.entity.name)||!this.entity(t.target.entity.name))throw new Error("Relation source or target entity not found");if(this._relations.find(r=>{const s=r.source.entity.name===t.source.entity.name&&r.target.entity.name===t.target.entity.name,i=r.source.reference===t.source.reference&&r.target.reference===t.target.reference;return s&&i}))throw new Error(`Relation "${t.type}" between "${t.source.entity.name}" and "${t.target.entity.name}" already exists`);this._relations.push(t),t.initialize(this)}relationsOf(t){return this.relations.relationsOf(this.entity(t))}relationOf(t,n){return this.relations.relationOf(this.entity(t),n)}hasRelations(t){return this.relations.hasRelations(this.entity(t))}relatedEntitiesOf(t){return this.relations.relatedEntitiesOf(this.entity(t))}relationReferencesOf(t){return this.relations.relationReferencesOf(this.entity(t))}repository(t,n={}){return this.repo(t,n)}repo(t,n={}){return new FC(this,this.entity(t),{...n,emgr:this.emgr})}mutator(t){return new LC(this,this.entity(t),{emgr:this.emgr})}addIndex(t,n=!1){if(this.indices.find(r=>r.name===t.name)){if(n)throw new Error(`Index "${t.name}" already exists`);return}this._indices.push(t)}getIndicesOf(t){const n=dc.isEntity(t)?t:this.entity(t);return this.indices.filter(r=>r.entity.name===n.name)}schema(){return this._schema||(this._schema=new DC(this)),this._schema}hydrate(t,n){const r=this.entity(t),s=[];for(const i of n){for(let[o,a]of Object.entries(i)){const c=r.getField(o);if(!c||c.isVirtual()){const u=this.relationOf(t,o);if(u){if(!a)continue;a=u.hydrate(o,Array.isArray(a)?a:[a],this),i[o]=a;continue}else if(c!=null&&c.isVirtual())continue;throw new Error(`Field "${o}" not found on entity "${r.name}"`)}try{a===null&&c.hasDefault()&&(i[o]=c.getDefault()),a=this.connection.fromDriver(a,c),i[o]=c.transformRetrieve(a)}catch(u){throw new Qce(`"${c.type}" field "${o}" on entity "${r.name}": ${u.message}`)}}s.push(i)}return s}toJSON(){return{entities:Object.fromEntries(this.entities.map(t=>[t.name,t.toJSON()])),relations:Object.fromEntries(this.relations.all.map(t=>[t.getName(),t.toJSON()])),indices:Object.fromEntries(this.indices.map(t=>[t.name,t.toJSON()]))}}};K(hg,"Events",{...ax,...VF});let px=hg;class cge extends RF{constructor(){super(void 0);K(this,"name","dummy");K(this,"supported",{batching:!0})}getFieldSchema(n,r){throw new Error("Method not implemented.")}}const XB=st({entity:xe(),min_items:Rt(),max_items:Rt(),mime_types:un(xe()),...Io.properties}).partial();class Rg extends Zi{constructor(n,r){super(n,{...r,fillable:["update"],virtual:!0});K(this,"type","media")}getSchema(){return XB}getMaxItems(){return this.config.max_items}getMinItems(){return this.config.min_items}schema(){}toJsonSchema(){var i,o;const n="../schema.json#/properties/media",r=(i=this.config)==null?void 0:i.min_items,s=(o=this.config)==null?void 0:o.max_items;return s===1?{$ref:n}:{type:"array",items:{$ref:n},minItems:r,maxItems:s}}}const kb={text:e=>new r$(e.field_name,{...e.config,required:e.is_required}),number:e=>new t$(e.field_name,{...e.config,required:e.is_required}),date:e=>new jC(e.field_name,{...e.config,required:e.is_required}),datetime:e=>new jC(e.field_name,{...e.config,required:e.is_required}),boolean:e=>new HF(e.field_name,{...e.config,required:e.is_required}),enumm:e=>new YF(e.field_name,{...e.config,required:e.is_required}),json:e=>new XF(e.field_name,{...e.config,required:e.is_required}),jsonSchema:e=>new eB(e.field_name,{...e.config,required:e.is_required}),media:e=>new Rg(e.field_name,{...e.config,entity:e.entity.name,required:e.is_required}),medium:e=>new Rg(e.field_name,{...e.config,entity:e.entity.name,required:e.is_required})};class vd{constructor(t,n,r){this.type=t,this.config=n,this.is_required=r}required(){return this.is_required=!0,this}getField(t){if(!kb[this.type])throw new Error(`Unknown field type: ${this.type}`);try{return kb[this.type](t)}catch(n){throw new Error(`Faild to construct field "${this.type}": ${n}`)}}make(t){if(!kb[this.type])throw new Error(`Unknown field type: ${this.type}`);try{return kb[this.type]({entity:{name:"unknown",fields:{}},field_name:t,config:this.config,is_required:this.is_required})}catch(n){throw new Error(`Faild to construct field "${this.type}": ${n}`)}}}function ba(e){return new vd("text",e,!1)}function BC(e){return new vd("number",e,!1)}function zC(e){return new vd("date",{...e,type:"datetime"},!1)}function uge(e){return new vd("boolean",e,!1)}function VC(e){var r;const n={options:{type:typeof((r=e==null?void 0:e.enum)==null?void 0:r[0])!="string"?"objects":"strings",values:(e==null?void 0:e.enum)??[]}};return new vd("enumm",n,!1)}function dge(e){return new vd("json",e,!1)}function fge(e){return new vd("jsonSchema",e,!1)}function g$(e,t,n,r){const s=[];for(const[i,o]of Object.entries(t)){const a=o,c={entity:{name:e,fields:t},field_name:i,config:a.config,is_required:a.is_required};s.push(a.getField(c))}return new dc(e,s,n,r)}function hge(e){return{manyToOne:(t,n)=>new _c(e,t,n),oneToOne:(t,n)=>new PC(e,t,n),manyToMany:(t,n,r)=>{const s=[];if(r){const i=r,o=[],a=(n==null?void 0:n.connectionTable)??La.defaultConnectionTable(e,t);for(const[c,u]of Object.entries(r)){const f=u,h={entity:{name:a,fields:i},field_name:c,config:f.config,is_required:f.is_required};o.push(f.getField(h))}s.push(o)}return new La(e,t,n,s)},polyToOne:(t,n)=>new $g(e,t,{...n,targetCardinality:1}),polyToMany:(t,n)=>new $g(e,t,n)}}function pge(e){return{on:(t,n)=>{const r=t.map(s=>{const i=e.field(s);if(!i)throw new Error(`Field "${String(s)}" not found on entity "${e.name}"`);return i});return new iB(e,r,n)}}}class mge extends px{constructor(t,n=[],r=[]){super(Object.values(t),new cge,n,r),this.__entities=t}withConnection(t){return new px(this.entities,t,this.relations.all,this.indices)}}function KB(e,t){const n=[],r=[],s=a=>new Proxy(hge(a),{get(c,u){return(...f)=>(n.push(c[u](...f)),s(a))}}),i=a=>new Proxy(pge(a),{get(c,u){return(...f)=>(r.push(c[u](...f)),i(a))}});t&&t({relation:s,index:i},e);const o=new mge(e,n,r);return{DB:o.__entities,entities:o.__entities,relations:n,indices:r,proto:o,toJSON:()=>o.toJSON()}}var Dk=(e,t,n)=>(r,s)=>{let i=-1;return o(0);async function o(a){if(a<=i)throw new Error("next() called multiple times");i=a;let c,u=!1,f;if(e[a]?(f=e[a][0][0],r.req.routeIndex=a):f=a===e.length&&s||void 0,f)try{c=await f(r,()=>o(a+1))}catch(h){if(h instanceof Error&&t)r.error=h,c=await t(h,r),u=!0;else throw h}else r.finalized===!1&&n&&(c=await n(r));return c&&(r.finalized===!1||u)&&(r.res=c),r}},gge=Symbol(),yge=async(e,t=Object.create(null))=>{const{all:n=!1,dot:r=!1}=t,i=(e instanceof QB?e.raw.headers:e.headers).get("Content-Type");return i!=null&&i.startsWith("multipart/form-data")||i!=null&&i.startsWith("application/x-www-form-urlencoded")?bge(e,{all:n,dot:r}):{}};async function bge(e,t){const n=await e.formData();return n?vge(n,t):{}}function vge(e,t){const n=Object.create(null);return e.forEach((r,s)=>{t.all||s.endsWith("[]")?xge(n,s,r):n[s]=r}),t.dot&&Object.entries(n).forEach(([r,s])=>{r.includes(".")&&(wge(n,r,s),delete n[r])}),n}var xge=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},wge=(e,t,n)=>{let r=e;const s=t.split(".");s.forEach((i,o)=>{o===s.length-1?r[i]=n:((!r[i]||typeof r[i]!="object"||Array.isArray(r[i])||r[i]instanceof File)&&(r[i]=Object.create(null)),r=r[i])})},Pk=e=>i1(e,HA),ch,Js,Va,ZB,ez,UC,tc,U9,QB=(U9=class{constructor(e,t="/",n=[[]]){Fe(this,Va);K(this,"raw");Fe(this,ch);Fe(this,Js);K(this,"routeIndex",0);K(this,"path");K(this,"bodyCache",{});Fe(this,tc,e=>{const{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;const s=Object.keys(t)[0];return s?t[s].then(i=>(s==="json"&&(i=JSON.stringify(i)),new Response(i)[e]())):t[e]=n[e]()});this.raw=e,this.path=t,Be(this,Js,n),Be(this,ch,{})}param(e){return e?it(this,Va,ZB).call(this,e):it(this,Va,ez).call(this)}query(e){return dle(this.url,e)}queries(e){return fle(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;const t={};return this.raw.headers.forEach((n,r)=>{t[r]=n}),t}async parseBody(e){var t;return(t=this.bodyCache).parsedBody??(t.parsedBody=await yge(this,e))}json(){return G(this,tc).call(this,"json")}text(){return G(this,tc).call(this,"text")}arrayBuffer(){return G(this,tc).call(this,"arrayBuffer")}blob(){return G(this,tc).call(this,"blob")}formData(){return G(this,tc).call(this,"formData")}addValidatedData(e,t){G(this,ch)[e]=t}valid(e){return G(this,ch)[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[gge](){return G(this,Js)}get matchedRoutes(){return G(this,Js)[0].map(([[,e]])=>e)}get routePath(){return G(this,Js)[0].map(([[,e]])=>e)[this.routeIndex].path}},ch=new WeakMap,Js=new WeakMap,Va=new WeakSet,ZB=function(e){const t=G(this,Js)[0][this.routeIndex][1][e],n=it(this,Va,UC).call(this,t);return n?/\%/.test(n)?Pk(n):n:void 0},ez=function(){const e={},t=Object.keys(G(this,Js)[0][this.routeIndex][1]);for(const n of t){const r=it(this,Va,UC).call(this,G(this,Js)[0][this.routeIndex][1][n]);r&&typeof r=="string"&&(e[n]=/\%/.test(r)?Pk(r):r)}return e},UC=function(e){return G(this,Js)[1]?G(this,Js)[1][e]:e},tc=new WeakMap,U9),Sge={Stringify:1},tz=async(e,t,n,r,s)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;return i!=null&&i.length?(s?s[0]+=e:s=[e],Promise.all(i.map(a=>a({phase:t,buffer:s,context:r}))).then(a=>Promise.all(a.filter(Boolean).map(c=>tz(c,t,!1,r,s))).then(()=>s[0]))):Promise.resolve(e)},Ege="text/plain; charset=UTF-8",gN=(e,t)=>({"Content-Type":e,...t}),dy,fy,ha,uh,pa,kr,hy,dh,fh,zu,py,my,nc,Af,q9,Nge=(q9=class{constructor(e,t){Fe(this,nc);Fe(this,dy);Fe(this,fy);K(this,"env",{});Fe(this,ha);K(this,"finalized",!1);K(this,"error");Fe(this,uh);Fe(this,pa);Fe(this,kr);Fe(this,hy);Fe(this,dh);Fe(this,fh);Fe(this,zu);Fe(this,py);Fe(this,my);K(this,"render",(...e)=>(G(this,dh)??Be(this,dh,t=>this.html(t)),G(this,dh).call(this,...e)));K(this,"setLayout",e=>Be(this,hy,e));K(this,"getLayout",()=>G(this,hy));K(this,"setRenderer",e=>{Be(this,dh,e)});K(this,"header",(e,t,n)=>{this.finalized&&Be(this,kr,new Response(G(this,kr).body,G(this,kr)));const r=G(this,kr)?G(this,kr).headers:G(this,zu)??Be(this,zu,new Headers);t===void 0?r.delete(e):n!=null&&n.append?r.append(e,t):r.set(e,t)});K(this,"status",e=>{Be(this,uh,e)});K(this,"set",(e,t)=>{G(this,ha)??Be(this,ha,new Map),G(this,ha).set(e,t)});K(this,"get",e=>G(this,ha)?G(this,ha).get(e):void 0);K(this,"newResponse",(...e)=>it(this,nc,Af).call(this,...e));K(this,"body",(e,t,n)=>it(this,nc,Af).call(this,e,t,n));K(this,"text",(e,t,n)=>!G(this,zu)&&!G(this,uh)&&!t&&!n&&!this.finalized?new Response(e):it(this,nc,Af).call(this,e,t,gN(Ege,n)));K(this,"json",(e,t,n)=>it(this,nc,Af).call(this,JSON.stringify(e),t,gN("application/json",n)));K(this,"html",(e,t,n)=>{const r=s=>it(this,nc,Af).call(this,s,t,gN("text/html; charset=UTF-8",n));return typeof e=="object"?tz(e,Sge.Stringify,!1,{}).then(r):r(e)});K(this,"redirect",(e,t)=>(this.header("Location",String(e)),this.newResponse(null,t??302)));K(this,"notFound",()=>(G(this,fh)??Be(this,fh,()=>new Response),G(this,fh).call(this,this)));Be(this,dy,e),t&&(Be(this,pa,t.executionCtx),this.env=t.env,Be(this,fh,t.notFoundHandler),Be(this,my,t.path),Be(this,py,t.matchResult))}get req(){return G(this,fy)??Be(this,fy,new QB(G(this,dy),G(this,my),G(this,py))),G(this,fy)}get event(){if(G(this,pa)&&"respondWith"in G(this,pa))return G(this,pa);throw Error("This context has no FetchEvent")}get executionCtx(){if(G(this,pa))return G(this,pa);throw Error("This context has no ExecutionContext")}get res(){return G(this,kr)||Be(this,kr,new Response(null,{headers:G(this,zu)??Be(this,zu,new Headers)}))}set res(e){if(G(this,kr)&&e){e=new Response(e.body,e);for(const[t,n]of G(this,kr).headers.entries())if(t!=="content-type")if(t==="set-cookie"){const r=G(this,kr).headers.getSetCookie();e.headers.delete("set-cookie");for(const s of r)e.headers.append("set-cookie",s)}else e.headers.set(t,n)}Be(this,kr,e),this.finalized=!0}get var(){return G(this,ha)?Object.fromEntries(G(this,ha)):{}}},dy=new WeakMap,fy=new WeakMap,ha=new WeakMap,uh=new WeakMap,pa=new WeakMap,kr=new WeakMap,hy=new WeakMap,dh=new WeakMap,fh=new WeakMap,zu=new WeakMap,py=new WeakMap,my=new WeakMap,nc=new WeakSet,Af=function(e,t,n){const r=G(this,kr)?new Headers(G(this,kr).headers):G(this,zu)??new Headers;if(typeof t=="object"&&"headers"in t){const i=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(const[o,a]of i)o.toLowerCase()==="set-cookie"?r.append(o,a):r.set(o,a)}if(n)for(const[i,o]of Object.entries(n))if(typeof o=="string")r.set(i,o);else{r.delete(i);for(const a of o)r.append(i,a)}const s=typeof t=="number"?t:(t==null?void 0:t.status)??G(this,uh);return new Response(e,{status:s,headers:r})},q9),Vn="ALL",_ge="all",Cge=["get","post","put","delete","options","patch"],nz="Can not add a route since the matcher is already built.",rz=class extends Error{},Oge="__COMPOSED_HANDLER",jge=e=>e.text("404 Not Found",404),Lk=(e,t)=>{if("getResponse"in e){const n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},Ai,qn,iz,$i,yu,vv,xv,H9,sz=(H9=class{constructor(t={}){Fe(this,qn);K(this,"get");K(this,"post");K(this,"put");K(this,"delete");K(this,"options");K(this,"patch");K(this,"all");K(this,"on");K(this,"use");K(this,"router");K(this,"getPath");K(this,"_basePath","/");Fe(this,Ai,"/");K(this,"routes",[]);Fe(this,$i,jge);K(this,"errorHandler",Lk);K(this,"onError",t=>(this.errorHandler=t,this));K(this,"notFound",t=>(Be(this,$i,t),this));K(this,"fetch",(t,...n)=>it(this,qn,xv).call(this,t,n[1],n[0],t.method));K(this,"request",(t,n,r,s)=>t instanceof Request?this.fetch(n?new Request(t,n):t,r,s):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${Of("/",t)}`,n),r,s)));K(this,"fire",()=>{addEventListener("fetch",t=>{t.respondWith(it(this,qn,xv).call(this,t.request,t,void 0,t.request.method))})});[...Cge,_ge].forEach(i=>{this[i]=(o,...a)=>(typeof o=="string"?Be(this,Ai,o):it(this,qn,yu).call(this,i,G(this,Ai),o),a.forEach(c=>{it(this,qn,yu).call(this,i,G(this,Ai),c)}),this)}),this.on=(i,o,...a)=>{for(const c of[o].flat()){Be(this,Ai,c);for(const u of[i].flat())a.map(f=>{it(this,qn,yu).call(this,u.toUpperCase(),G(this,Ai),f)})}return this},this.use=(i,...o)=>(typeof i=="string"?Be(this,Ai,i):(Be(this,Ai,"*"),o.unshift(i)),o.forEach(a=>{it(this,qn,yu).call(this,Vn,G(this,Ai),a)}),this);const{strict:r,...s}=t;Object.assign(this,s),this.getPath=r??!0?t.getPath??QL:ule}route(t,n){const r=this.basePath(t);return n.routes.map(s=>{var o;let i;n.errorHandler===Lk?i=s.handler:(i=async(a,c)=>(await Dk([],n.errorHandler)(a,()=>s.handler(a,c))).res,i[Oge]=s.handler),it(o=r,qn,yu).call(o,s.method,s.path,i)}),this}basePath(t){const n=it(this,qn,iz).call(this);return n._basePath=Of(this._basePath,t),n}mount(t,n,r){let s,i;r&&(typeof r=="function"?i=r:(i=r.optionHandler,r.replaceRequest===!1?s=c=>c:s=r.replaceRequest));const o=i?c=>{const u=i(c);return Array.isArray(u)?u:[u]}:c=>{let u;try{u=c.executionCtx}catch{}return[c.env,u]};s||(s=(()=>{const c=Of(this._basePath,t),u=c==="/"?0:c.length;return f=>{const h=new URL(f.url);return h.pathname=h.pathname.slice(u)||"/",new Request(h,f)}})());const a=async(c,u)=>{const f=await n(s(c.req.raw),...o(c));if(f)return f;await u()};return it(this,qn,yu).call(this,Vn,Of(t,"*"),a),this}},Ai=new WeakMap,qn=new WeakSet,iz=function(){const t=new sz({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,Be(t,$i,G(this,$i)),t.routes=this.routes,t},$i=new WeakMap,yu=function(t,n,r){t=t.toUpperCase(),n=Of(this._basePath,n);const s={basePath:this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,s]),this.routes.push(s)},vv=function(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t},xv=function(t,n,r,s){if(s==="HEAD")return(async()=>new Response(null,await it(this,qn,xv).call(this,t,n,r,"GET")))();const i=this.getPath(t,{env:r}),o=this.router.match(s,i),a=new Nge(t,{path:i,matchResult:o,env:r,executionCtx:n,notFoundHandler:G(this,$i)});if(o[0].length===1){let u;try{u=o[0][0][0][0](a,async()=>{a.res=await G(this,$i).call(this,a)})}catch(f){return it(this,qn,vv).call(this,f,a)}return u instanceof Promise?u.then(f=>f||(a.finalized?a.res:G(this,$i).call(this,a))).catch(f=>it(this,qn,vv).call(this,f,a)):u??G(this,$i).call(this,a)}const c=Dk(o[0],this.errorHandler,G(this,$i));return(async()=>{try{const u=await c(a);if(!u.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return u.res}catch(u){return it(this,qn,vv).call(this,u,a)}})()},H9),mx="[^/]+",Qm=".*",Zm="(?:|/.*)",Fm=Symbol(),Age=new Set(".\\+*[^]$()");function $ge(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1||e===Qm||e===Zm?1:t===Qm||t===Zm?-1:e===mx?1:t===mx?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Vu,Uu,Ti,W9,qC=(W9=class{constructor(){Fe(this,Vu);Fe(this,Uu);Fe(this,Ti,Object.create(null))}insert(t,n,r,s,i){if(t.length===0){if(G(this,Vu)!==void 0)throw Fm;if(i)return;Be(this,Vu,n);return}const[o,...a]=t,c=o==="*"?a.length===0?["","",Qm]:["","",mx]:o==="/*"?["","",Zm]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let u;if(c){const f=c[1];let h=c[2]||mx;if(f&&c[2]&&(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h)))throw Fm;if(u=G(this,Ti)[h],!u){if(Object.keys(G(this,Ti)).some(m=>m!==Qm&&m!==Zm))throw Fm;if(i)return;u=G(this,Ti)[h]=new qC,f!==""&&Be(u,Uu,s.varIndex++)}!i&&f!==""&&r.push([f,G(u,Uu)])}else if(u=G(this,Ti)[o],!u){if(Object.keys(G(this,Ti)).some(f=>f.length>1&&f!==Qm&&f!==Zm))throw Fm;if(i)return;u=G(this,Ti)[o]=new qC}u.insert(a,n,r,s,i)}buildRegExpStr(){const n=Object.keys(G(this,Ti)).sort($ge).map(r=>{const s=G(this,Ti)[r];return(typeof G(s,Uu)=="number"?`(${r})@${G(s,Uu)}`:Age.has(r)?`\\${r}`:r)+s.buildRegExpStr()});return typeof G(this,Vu)=="number"&&n.unshift(`#${G(this,Vu)}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}},Vu=new WeakMap,Uu=new WeakMap,Ti=new WeakMap,W9),bw,gy,G9,Tge=(G9=class{constructor(){Fe(this,bw,{varIndex:0});Fe(this,gy,new qC)}insert(e,t,n){const r=[],s=[];for(let o=0;;){let a=!1;if(e=e.replace(/\{[^}]+\}/g,c=>{const u=`@\\${o}`;return s[o]=[u,c],o++,a=!0,u}),!a)break}const i=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let o=s.length-1;o>=0;o--){const[a]=s[o];for(let c=i.length-1;c>=0;c--)if(i[c].indexOf(a)!==-1){i[c]=i[c].replace(a,s[o][1]);break}}return G(this,gy).insert(i,t,r,G(this,bw),n),r}buildRegExp(){let e=G(this,gy).buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0;const n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(s,i,o)=>i!==void 0?(n[++t]=Number(i),"$()"):(o!==void 0&&(r[Number(o)]=++t),"")),[new RegExp(`^${e}`),n,r]}},bw=new WeakMap,gy=new WeakMap,G9),oz=[],Rge=[/^$/,[],Object.create(null)],wv=Object.create(null);function az(e){return wv[e]??(wv[e]=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(t,n)=>n?`\\${n}`:"(?:|/.*)")}$`))}function Mge(){wv=Object.create(null)}function kge(e){var u;const t=new Tge,n=[];if(e.length===0)return Rge;const r=e.map(f=>[!/\*|\/:/.test(f[0]),...f]).sort(([f,h],[m,y])=>f?1:m?-1:h.length-y.length),s=Object.create(null);for(let f=0,h=-1,m=r.length;f<m;f++){const[y,v,x]=r[f];y?s[v]=[x.map(([N])=>[N,Object.create(null)]),oz]:h++;let E;try{E=t.insert(v,h,y)}catch(N){throw N===Fm?new rz(v):N}y||(n[h]=x.map(([N,_])=>{const C=Object.create(null);for(_-=1;_>=0;_--){const[j,A]=E[_];C[j]=A}return[N,C]}))}const[i,o,a]=t.buildRegExp();for(let f=0,h=n.length;f<h;f++)for(let m=0,y=n[f].length;m<y;m++){const v=(u=n[f][m])==null?void 0:u[1];if(!v)continue;const x=Object.keys(v);for(let E=0,N=x.length;E<N;E++)v[x[E]]=a[v[x[E]]]}const c=[];for(const f in o)c[f]=n[o[f]];return[i,c,s]}function xf(e,t){if(e){for(const n of Object.keys(e).sort((r,s)=>s.length-r.length))if(az(n).test(t))return[...e[n]]}}var rc,sc,qh,lz,cz,Y9,Ige=(Y9=class{constructor(){Fe(this,qh);K(this,"name","RegExpRouter");Fe(this,rc);Fe(this,sc);Be(this,rc,{[Vn]:Object.create(null)}),Be(this,sc,{[Vn]:Object.create(null)})}add(e,t,n){var a;const r=G(this,rc),s=G(this,sc);if(!r||!s)throw new Error(nz);r[e]||[r,s].forEach(c=>{c[e]=Object.create(null),Object.keys(c[Vn]).forEach(u=>{c[e][u]=[...c[Vn][u]]})}),t==="/*"&&(t="*");const i=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){const c=az(t);e===Vn?Object.keys(r).forEach(u=>{var f;(f=r[u])[t]||(f[t]=xf(r[u],t)||xf(r[Vn],t)||[])}):(a=r[e])[t]||(a[t]=xf(r[e],t)||xf(r[Vn],t)||[]),Object.keys(r).forEach(u=>{(e===Vn||e===u)&&Object.keys(r[u]).forEach(f=>{c.test(f)&&r[u][f].push([n,i])})}),Object.keys(s).forEach(u=>{(e===Vn||e===u)&&Object.keys(s[u]).forEach(f=>c.test(f)&&s[u][f].push([n,i]))});return}const o=ZL(t)||[t];for(let c=0,u=o.length;c<u;c++){const f=o[c];Object.keys(s).forEach(h=>{var m;(e===Vn||e===h)&&((m=s[h])[f]||(m[f]=[...xf(r[h],f)||xf(r[Vn],f)||[]]),s[h][f].push([n,i-u+c+1]))})}}match(e,t){Mge();const n=it(this,qh,lz).call(this);return this.match=(r,s)=>{const i=n[r]||n[Vn],o=i[2][s];if(o)return o;const a=s.match(i[0]);if(!a)return[[],oz];const c=a.indexOf("",1);return[i[1][c],a]},this.match(e,t)}},rc=new WeakMap,sc=new WeakMap,qh=new WeakSet,lz=function(){const e=Object.create(null);return Object.keys(G(this,sc)).concat(Object.keys(G(this,rc))).forEach(t=>{e[t]||(e[t]=it(this,qh,cz).call(this,t))}),Be(this,rc,Be(this,sc,void 0)),e},cz=function(e){const t=[];let n=e===Vn;return[G(this,rc),G(this,sc)].forEach(r=>{const s=r[e]?Object.keys(r[e]).map(i=>[i,r[e][i]]):[];s.length!==0?(n||(n=!0),t.push(...s)):e!==Vn&&t.push(...Object.keys(r[Vn]).map(i=>[i,r[Vn][i]]))}),n?kge(t):null},Y9),ic,ma,J9,Dge=(J9=class{constructor(e){K(this,"name","SmartRouter");Fe(this,ic,[]);Fe(this,ma,[]);Be(this,ic,e.routers)}add(e,t,n){if(!G(this,ma))throw new Error(nz);G(this,ma).push([e,t,n])}match(e,t){if(!G(this,ma))throw new Error("Fatal error");const n=G(this,ic),r=G(this,ma),s=n.length;let i=0,o;for(;i<s;i++){const a=n[i];try{for(let c=0,u=r.length;c<u;c++)a.add(...r[c]);o=a.match(e,t)}catch(c){if(c instanceof rz)continue;throw c}this.match=a.match.bind(a),Be(this,ic,[a]),Be(this,ma,void 0);break}if(i===s)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,o}get activeRouter(){if(G(this,ma)||G(this,ic).length!==1)throw new Error("No active router has been determined yet.");return G(this,ic)[0]}},ic=new WeakMap,ma=new WeakMap,J9),Sm=Object.create(null),oc,yr,qu,hh,fr,ga,bu,X9,uz=(X9=class{constructor(t,n,r){Fe(this,ga);Fe(this,oc);Fe(this,yr);Fe(this,qu);Fe(this,hh,0);Fe(this,fr,Sm);if(Be(this,yr,r||Object.create(null)),Be(this,oc,[]),t&&n){const s=Object.create(null);s[t]={handler:n,possibleKeys:[],score:0},Be(this,oc,[s])}Be(this,qu,[])}insert(t,n,r){Be(this,hh,++J3(this,hh)._);let s=this;const i=ile(n),o=[];for(let a=0,c=i.length;a<c;a++){const u=i[a],f=i[a+1],h=lle(u,f),m=Array.isArray(h)?h[0]:u;if(m in G(s,yr)){s=G(s,yr)[m],h&&o.push(h[1]);continue}G(s,yr)[m]=new uz,h&&(G(s,qu).push(h),o.push(h[1])),s=G(s,yr)[m]}return G(s,oc).push({[t]:{handler:r,possibleKeys:o.filter((a,c,u)=>u.indexOf(a)===c),score:G(this,hh)}}),s}search(t,n){var c;const r=[];Be(this,fr,Sm);let i=[this];const o=KL(n),a=[];for(let u=0,f=o.length;u<f;u++){const h=o[u],m=u===f-1,y=[];for(let v=0,x=i.length;v<x;v++){const E=i[v],N=G(E,yr)[h];N&&(Be(N,fr,G(E,fr)),m?(G(N,yr)["*"]&&r.push(...it(this,ga,bu).call(this,G(N,yr)["*"],t,G(E,fr))),r.push(...it(this,ga,bu).call(this,N,t,G(E,fr)))):y.push(N));for(let _=0,C=G(E,qu).length;_<C;_++){const j=G(E,qu)[_],A=G(E,fr)===Sm?{}:{...G(E,fr)};if(j==="*"){const F=G(E,yr)["*"];F&&(r.push(...it(this,ga,bu).call(this,F,t,G(E,fr))),Be(F,fr,A),y.push(F));continue}if(!h)continue;const[$,R,M]=j,D=G(E,yr)[$],P=o.slice(u).join("/");if(M instanceof RegExp){const F=M.exec(P);if(F){if(A[R]=F[0],r.push(...it(this,ga,bu).call(this,D,t,G(E,fr),A)),Object.keys(G(D,yr)).length){Be(D,fr,A);const V=((c=F[0].match(/\//))==null?void 0:c.length)??0;(a[V]||(a[V]=[])).push(D)}continue}}(M===!0||M.test(h))&&(A[R]=h,m?(r.push(...it(this,ga,bu).call(this,D,t,A,G(E,fr))),G(D,yr)["*"]&&r.push(...it(this,ga,bu).call(this,G(D,yr)["*"],t,A,G(E,fr)))):(Be(D,fr,A),y.push(D)))}}i=y.concat(a.shift()??[])}return r.length>1&&r.sort((u,f)=>u.score-f.score),[r.map(({handler:u,params:f})=>[u,f])]}},oc=new WeakMap,yr=new WeakMap,qu=new WeakMap,hh=new WeakMap,fr=new WeakMap,ga=new WeakSet,bu=function(t,n,r,s){const i=[];for(let o=0,a=G(t,oc).length;o<a;o++){const c=G(t,oc)[o],u=c[n]||c[Vn],f={};if(u!==void 0&&(u.params=Object.create(null),i.push(u),r!==Sm||s&&s!==Sm))for(let h=0,m=u.possibleKeys.length;h<m;h++){const y=u.possibleKeys[h],v=f[u.score];u.params[y]=s!=null&&s[y]&&!v?s[y]:r[y]??(s==null?void 0:s[y]),f[u.score]=!0}}return i},X9),Hu,K9,Pge=(K9=class{constructor(){K(this,"name","TrieRouter");Fe(this,Hu);Be(this,Hu,new uz)}add(e,t,n){const r=ZL(t);if(r){for(let s=0,i=r.length;s<i;s++)G(this,Hu).insert(e,r[s],n);return}G(this,Hu).insert(e,t,n)}match(e,t){return G(this,Hu).search(e,t)}},Hu=new WeakMap,K9),_1=class extends sz{constructor(e={}){super(e),this.router=e.router??new Dge({routers:[new Ige,new Pge]})}};const Fk=[{version:1,up:async e=>e},{version:2,up:async(e,{db:t})=>e},{version:3,up:async e=>e},{version:4,up:async(e,{db:t})=>({...e,auth:{...e.auth,basepath:"/api/auth2"}})},{version:5,up:async(e,{db:t})=>{var r;const n=((r=e.server.cors)==null?void 0:r.allow_methods)??[];return Lm(e.server,"cors.allow_methods",[...new Set([...n,"PATCH"])]),e}},{version:6,up:async(e,{db:t})=>e},{version:7,up:async(e,{db:t})=>{const{expiresIn:n,...r}=e.auth.jwt;return{...e,auth:{...e.auth,jwt:r}}}},{version:8,up:async e=>{const t=sn(e.auth.strategies,n=>({...n,enabled:!0}));return{...e,auth:{...e.auth,strategies:t}}}},{version:9,up:async e=>{const{admin:t,...n}=e.server;return{...e,server:n}}}];var Q9;(Q9=Fk[Fk.length-1])==null||Q9.version;const Lge="__bknd";var Fge=e=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...e},r=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(n.origin),s=(i=>typeof i=="function"?i:Array.isArray(i)?()=>i:()=>[])(n.allowMethods);return async function(o,a){var f;function c(h,m){o.res.headers.set(h,m)}const u=r(o.req.header("origin")||"",o);if(u&&c("Access-Control-Allow-Origin",u),n.origin!=="*"){const h=o.req.header("Vary");h?c("Vary",h):c("Vary","Origin")}if(n.credentials&&c("Access-Control-Allow-Credentials","true"),(f=n.exposeHeaders)!=null&&f.length&&c("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.maxAge!=null&&c("Access-Control-Max-Age",n.maxAge.toString());const h=s(o.req.header("origin")||"",o);h.length&&c("Access-Control-Allow-Methods",h.join(","));let m=n.allowHeaders;if(!(m!=null&&m.length)){const y=o.req.header("Access-Control-Request-Headers");y&&(m=y.split(/\s*,\s*/))}return m!=null&&m.length&&(c("Access-Control-Allow-Headers",m.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await a()}};class Bk{constructor(t,n,r){K(this,"_default");K(this,"_value");K(this,"_config");K(this,"_restriction_bypass",!1);this._schema=t,this.options=r,this._default=Cf(t.template({},{withOptional:!0})),this._value=Cf(Ln(t,structuredClone(n??{}),{withDefaults:!0,forceParse:this.isForceParse(),skipMark:this.isForceParse()})),this._config=Cf(this._value)}isForceParse(){var t;return((t=this.options)==null?void 0:t.forceParse)??!0}default(){return this._default}async onBeforeUpdate(t,n){var r;return(r=this.options)!=null&&r.onBeforeUpdate?this.options.onBeforeUpdate(t,n):n}get(t){return t!=null&&t.stripMark?jle(this._config):this._config}clone(){return structuredClone(this._config)}async set(t,n){var i,o;const r=Ln(this._schema,structuredClone(t),{coerce:!1,forceParse:!0,skipMark:this.isForceParse()}),s=await this.onBeforeUpdate(this._config,r);return this._value=Cf(s),this._config=Cf(s),n!==!0&&await((o=(i=this.options)==null?void 0:i.onUpdate)==null?void 0:o.call(i,this._config)),this._config}bypass(){return this._restriction_bypass=!0,this}throwIfRestricted(t){var r;if(this._restriction_bypass){this._restriction_bypass=!1;return}const n=((r=this.options)==null?void 0:r.restrictPaths)??[];if(Array.isArray(n)&&n.length>0){for(const s of n)if(typeof t=="string"?t.startsWith(s):pN(t,s))throw new Error(`Path "${s}" is restricted`)}}async patch(t,n){var a;const r=this.clone(),s=t.length>0?Lm({},t,n):n;this.throwIfRestricted(s);const i=RL(r,s,(c,u)=>{if(Array.isArray(c)&&Array.isArray(u))return u});if((a=this.options)!=null&&a.overwritePaths){const u=AL(n).map(f=>t.length>0?t+"."+f:f).filter(f=>{var h,m;return(m=(h=this.options)==null?void 0:h.overwritePaths)==null?void 0:m.some(y=>typeof y=="string"?f===y:y.test(f))});if(u.length>0){const f=u.length>1?u.filter(h=>u.some(m=>m!==h&&m.startsWith(h))):u;for(const h of f)Lm(i,h,Ag(s,h))}}const o=await this.set(i);return[s,o]}async overwrite(t,n){const r=this.clone(),s=t.length>0?Lm({},t,n):n;this.throwIfRestricted(s);const i=Lm(r,t,n),o=await this.set(i);return[s,o]}has(t){const n=t.split(".");if(n.length>1){const r=n.slice(0,-1).join(".");if(!pN(this._config,r))throw new Error(`Parent path "${r}" does not exist`)}return pN(this._config,t)}async remove(t){if(this.throwIfRestricted(t),!this.has(t))throw new Error(`Path "${t}" does not exist`);const n=this.clone(),r=Ag(n,t),s=Ch(n,t),i=await this.set(s);return[r,i]}}var F_;let Ry=(F_=class{constructor(t,n){K(this,"_built",!1);K(this,"_schema");K(this,"_listener",()=>null);this._ctx=n,this._schema=new Bk(this.getSchema(),t,{forceParse:this.useForceParse(),onUpdate:async r=>{await this._listener(r)},restrictPaths:this.getRestrictedPaths(),overwritePaths:this.getOverwritePaths(),onBeforeUpdate:this.onBeforeUpdate.bind(this)})}onBeforeUpdate(t,n){return n}setListener(t){return this._listener=t,this}useForceParse(){return!1}getRestrictedPaths(){}getOverwritePaths(){}get configDefault(){return this._schema.default()}get config(){return this._schema.get()}setContext(t){return this._ctx=t,this}schema(){return this._schema}onServerInit(t){}get ctx(){if(!this._ctx)throw new Error("Context not set");return this._ctx}async build(){throw new Error("Not implemented")}setBuilt(){this._built=!0,this._schema=new Bk(this.getSchema(),this.toJSON(!0),{onUpdate:async t=>{await this._listener(t)},forceParse:this.useForceParse(),restrictPaths:this.getRestrictedPaths(),overwritePaths:this.getOverwritePaths(),onBeforeUpdate:this.onBeforeUpdate.bind(this)})}isBuilt(){return this._built}throwIfNotBuilt(){if(!this._built)throw new Error("Config not built: "+this.constructor.name)}toJSON(t){return this.config}},K(F_,"ctx_flags",{sync_required:!1,ctx_reload_required:!1}),F_);class My extends li{getSafeErrorAndCode(){return{error:"Invalid credentials",code:fn.UNAUTHORIZED}}toJSON(){return qr()?super.toJSON():{error:this.getSafeErrorAndCode().error,type:"AuthException"}}}class Bge extends My{constructor(){super("User not found");K(this,"name","UserNotFoundException");K(this,"code",fn.NOT_FOUND)}}class yN extends My{constructor(){super("Invalid credentials");K(this,"name","InvalidCredentialsException");K(this,"code",fn.UNAUTHORIZED)}}class zge extends My{constructor(){super("Unable to create user");K(this,"name","UnableToCreateUserException");K(this,"code",fn.INTERNAL_SERVER_ERROR)}}class Fl extends My{constructor(n){super(n??"Invalid conditions");K(this,"code",fn.UNPROCESSABLE_ENTITY)}}const zk=["GET","POST","PATCH","PUT","DELETE"],Vge=st({cors:st({origin:xe({default:"*"}),allow_methods:un(xe({enum:zk}),{default:zk,uniqueItems:!0}),allow_headers:un(xe(),{default:["Content-Type","Content-Length","Authorization","Accept"]}),allow_credentials:Wt({default:!0})})});class Uge extends Ry{getRestrictedPaths(){return[]}get client(){return this.ctx.server}getSchema(){return Vge}async build(){const t=this.config.cors.origin??"";this.client.use("*",Fge({origin:t.includes(",")?t.split(",").map(n=>n.trim()):t,allowMethods:this.config.cors.allow_methods,allowHeaders:this.config.cors.allow_headers,credentials:this.config.cors.allow_credentials})),this.client.use("/",async(n,r)=>{await r(),(!n.finalized||n.res.status===404)&&new URL(n.req.url).pathname==="/"&&(n.res=void 0,n.res=Response.json({bknd:"hello world!"}))}),this.client.onError((n,r)=>(pt.error("[AppServer:onError]",n),n instanceof Response?n:n instanceof My?r.json(n.toJSON(),n.getSafeErrorAndCode().code):n instanceof li?r.json(n.toJSON(),n.code):n instanceof Error&&qr()?r.json({error:n.message,stack:n.stack},500):r.json({error:n.message},500))),this.setBuilt()}toJSON(t){return this.config}}const dz=new zr("auth.user.create"),qge=Object.freeze(Object.defineProperty({__proto__:null,createUser:dz},Symbol.toStringTag,{value:"Module"})),uo=new zr("data.entity.read"),C1=new zr("data.entity.create"),HC=new zr("data.entity.update"),WC=new zr("data.entity.delete"),fz=new zr("data.database.sync"),Hge=new zr("data.raw.query"),Wge=new zr("data.raw.mutate"),Gge=Object.freeze(Object.defineProperty({__proto__:null,databaseSync:fz,entityCreate:C1,entityDelete:WC,entityRead:uo,entityUpdate:HC,rawMutate:Wge,rawQuery:Hge},Symbol.toStringTag,{value:"Module"}));var hz=e=>e;function y$(e){const t=e instanceof Request?e:e.req.raw;return new URL(t.url).pathname}function Yge(e,t){const n=e.get("auth");if(!n)throw new Error("auth ctx not found");if(n.skip)return!0;const r=e.req.raw;if(!t)return!1;const s=y$(r),i=t.some(o=>Lie(s,o));return n.skip=i,i}const Jge=e=>hz(async(t,n)=>{t.get("auth")||t.set("auth",{registered:!1,resolved:!1,skip:!1,user:void 0});const r=t.get("app"),s=t.get("auth"),i=r==null?void 0:r.module.auth.authenticator;let o=Yge(t,e==null?void 0:e.skip)||!(r!=null&&r.module.auth.enabled);s.registered?(o=!0,pt.warn(`auth middleware already registered for ${y$(t)}`)):(s.registered=!0,!o&&!s.resolved&&(r!=null&&r.module.auth.enabled)&&(s.user=await(i==null?void 0:i.resolveAuthFromRequest(t)),s.resolved=!0)),await n(),s.skip=!1,s.resolved=!1,s.user=void 0}),Xge=(e,t)=>hz(async(n,r)=>{var o,a;const s=n.get("app"),i=n.get("auth");if(!i)throw new Error("auth ctx not found");if(!i.registered||!s){const c=`auth middleware not registered, cannot check permissions for ${y$(n)}`;if(s!=null&&s.module.auth.enabled)throw new Error(c);pt.warn(c)}else if(!i.skip){const c=s.modules.ctx().guard,u=Array.isArray(e)?e:[e];if(t!=null&&t.onGranted||t!=null&&t.onDenied){let f;if(u.every(h=>c.granted(h,n))?f=await((o=t==null?void 0:t.onGranted)==null?void 0:o.call(t,n)):f=await((a=t==null?void 0:t.onDenied)==null?void 0:a.call(t,n)),f instanceof Response)return f}else u.some(f=>c.throwUnlessGranted(f,n))}await r()}),Kge=Object.freeze(Object.defineProperty({__proto__:null,auth:Jge,permission:Xge},Symbol.toStringTag,{value:"Module"}));class ky{constructor(){K(this,"middlewares",Kge)}create(){return ky.createServer()}static createServer(){return new _1}getController(){return this.create()}isJsonRequest(t){return t.req.header("Content-Type")==="application/json"||t.req.header("Accept")==="application/json"}notFound(t){return this.isJsonRequest(t)?t.json({error:"Not found"},404):t.notFound()}getEntitiesEnum(t){const n=t.entities.map(r=>r.name);return n.length>0?Zt([xe({enum:n}),xe()]):xe()}}class Qge extends ky{constructor(t){super(),this.auth=t}get guard(){return this.auth.ctx.guard}get em(){return this.auth.ctx.em}get userRepo(){const t=this.auth.config.entity_name;return this.em.repo(t)}registerStrategyActions(t,n){var h;if(!this.auth.isStrategyEnabled(t))return;const r=(h=t.getActions)==null?void 0:h.call(t);if(!r)return;const{auth:s,permission:i}=this.middlewares,o=this.create().use(s()),a=t.getName(),{create:c,change:u}=r,f=this.auth.em;c&&(o.post("/create",i([dz,C1]),Kt({summary:"Create a new user",tags:["auth"]}),async m=>{var y;try{const v=await this.auth.authenticator.getBody(m),x=Ln(c.schema,v,{}),E=await((y=c.preprocess)==null?void 0:y.call(c,x))??x,N=f.mutator(this.auth.config.entity_name);N.__unstable_toggleSystemEntityCreation(!1);const{data:_}=await N.insertOne({...E,strategy:a});return N.__unstable_toggleSystemEntityCreation(!0),m.json({success:!0,action:"create",strategy:a,data:_})}catch(v){if(v instanceof o1)return m.json({success:!1,errors:v.errors},400);throw v}}),o.get("create/schema.json",Kt({summary:"Get the schema for creating a user",tags:["auth"]}),async m=>m.json(c.schema))),n.route(`/${a}/actions`,o)}getController(){const{auth:t}=this.middlewares,n=this.create();n.get("/me",Kt({summary:"Get the current user",tags:["auth"]}),t(),async s=>{var o,a;const i=(o=s.get("auth"))==null?void 0:o.user;if(i){const{data:c}=await this.userRepo.findId(i.id);return await((a=this.auth.authenticator)==null?void 0:a.requestCookieRefresh(s)),s.json({user:c})}return s.json({user:null},403)}),n.get("/logout",Kt({summary:"Logout the current user",tags:["auth"]}),t(),async s=>{if(await this.auth.authenticator.logout(s),this.auth.authenticator.isJsonRequest(s))return s.json({ok:!0});const i=s.req.header("referer");return i?s.redirect(i):s.redirect("/")}),n.get("/strategies",Kt({summary:"Get the available authentication strategies",tags:["auth"]}),qt("query",Qe({include_disabled:Wt().optional()})),async s=>{const{include_disabled:i}=s.req.valid("query"),{strategies:o,basepath:a}=this.auth.toJSON(!1);return i?s.json({strategies:o,basepath:a}):s.json({strategies:sn(o??{},(c,u)=>this.auth.isStrategyEnabled(u)?c:void 0),basepath:a})});const r=this.auth.authenticator.getStrategies();for(const[s,i]of Object.entries(r))this.auth.isStrategyEnabled(i)&&(n.route(`/${s}`,i.getController(this.auth.authenticator)),this.registerStrategyActions(i,n));return n}}const GC="__bknd_flash";function Vk(e,t,n="info"){var r;(r=e.req.header("Accept"))!=null&&r.includes("text/html")&&iF(e,GC,JSON.stringify({type:n,message:t}),{path:"/"})}function Zge(e){const t=document.cookie.split("; ");for(const n of t){const[r,s]=n.split("=");if(r===e)try{return decodeURIComponent(s)}catch{return null}}return null}function eye(e=!0){const t=Zge(GC);return t&&e&&(document.cookie=`${GC}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`),t?JSON.parse(t):void 0}var pz=e=>gz(e.replace(/_|-/g,t=>({_:"/","-":"+"})[t]??t)),mz=e=>tye(e).replace(/\/|\+/g,t=>({"/":"_","+":"-"})[t]??t),tye=e=>{let t="";const n=new Uint8Array(e);for(let r=0,s=n.length;r<s;r++)t+=String.fromCharCode(n[r]);return btoa(t)},gz=e=>{const t=atob(e),n=new Uint8Array(new ArrayBuffer(t.length)),r=t.length/2;for(let s=0,i=t.length-1;s<=r;s++,i--)n[s]=t.charCodeAt(s),n[i]=t.charCodeAt(i);return n},yz=(e=>(e.HS256="HS256",e.HS384="HS384",e.HS512="HS512",e.RS256="RS256",e.RS384="RS384",e.RS512="RS512",e.PS256="PS256",e.PS384="PS384",e.PS512="PS512",e.ES256="ES256",e.ES384="ES384",e.ES512="ES512",e.EdDSA="EdDSA",e))(yz||{}),nye=class extends Error{constructor(e){super(`${e} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},bz=class extends Error{constructor(e){super(`invalid JWT token: ${e}`),this.name="JwtTokenInvalid"}},rye=class extends Error{constructor(e){super(`token (${e}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},sye=class extends Error{constructor(e){super(`token (${e}) expired`),this.name="JwtTokenExpired"}},iye=class extends Error{constructor(e,t){super(`Invalid "iat" claim, must be a valid number lower than "${e}" (iat: "${t}")`),this.name="JwtTokenIssuedAt"}},oye=class extends Error{constructor(e){super(`jwt header is invalid: ${JSON.stringify(e)}`),this.name="JwtHeaderInvalid"}},aye=class extends Error{constructor(e){super(`token(${e}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},Mg=(e=>(e.Encrypt="encrypt",e.Decrypt="decrypt",e.Sign="sign",e.Verify="verify",e.DeriveKey="deriveKey",e.DeriveBits="deriveBits",e.WrapKey="wrapKey",e.UnwrapKey="unwrapKey",e))(Mg||{}),Iy=new TextEncoder,lye=new TextDecoder;async function cye(e,t,n){const r=vz(t),s=await dye(e,r);return await crypto.subtle.sign(r,s,n)}async function uye(e,t,n,r){const s=vz(t),i=await fye(e,s);return await crypto.subtle.verify(s,i,n,r)}function YC(e){return gz(e.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function dye(e,t){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(xz(e)){if(e.type!=="private"&&e.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${e.type}, expected private or secret`);return e}const n=[Mg.Sign];return typeof e=="object"?await crypto.subtle.importKey("jwk",e,t,!1,n):e.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",YC(e),t,!1,n):await crypto.subtle.importKey("raw",Iy.encode(e),t,!1,n)}async function fye(e,t){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(xz(e)){if(e.type==="public"||e.type==="secret")return e;e=await Uk(e)}if(typeof e=="string"&&e.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",YC(e),t,!0,[Mg.Sign]);e=await Uk(r)}const n=[Mg.Verify];return typeof e=="object"?await crypto.subtle.importKey("jwk",e,t,!1,n):e.includes("PUBLIC")?await crypto.subtle.importKey("spki",YC(e),t,!1,n):await crypto.subtle.importKey("raw",Iy.encode(e),t,!1,n)}async function Uk(e){if(e.type!=="private")throw new Error(`unexpected key type: ${e.type}`);if(!e.extractable)throw new Error("unexpected private key is unextractable");const t=await crypto.subtle.exportKey("jwk",e),{kty:n}=t,{alg:r,e:s,n:i}=t,{crv:o,x:a,y:c}=t;return{kty:n,alg:r,e:s,n:i,crv:o,x:a,y:c,key_ops:[Mg.Verify]}}function vz(e){switch(e){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new nye(e)}}function xz(e){return PL()==="node"&&crypto.webcrypto?e instanceof crypto.webcrypto.CryptoKey:e instanceof CryptoKey}var bN=e=>mz(Iy.encode(JSON.stringify(e)).buffer).replace(/=/g,""),hye=e=>mz(e).replace(/=/g,""),qk=e=>JSON.parse(lye.decode(pz(e)));function pye(e){if(typeof e=="object"&&e!==null){const t=e;return"alg"in t&&Object.values(yz).includes(t.alg)&&(!("typ"in t)||t.typ==="JWT")}return!1}var mye=async(e,t,n="HS256")=>{const r=bN(e);let s;typeof t=="object"&&"alg"in t?(n=t.alg,s=bN({alg:n,typ:"JWT",kid:t.kid})):s=bN({alg:n,typ:"JWT"});const i=`${s}.${r}`,o=await cye(t,n,Iy.encode(i)),a=hye(o);return`${i}.${a}`},gye=async(e,t,n="HS256")=>{const r=e.split(".");if(r.length!==3)throw new bz(e);const{header:s,payload:i}=wz(e);if(!pye(s))throw new oye(s);const o=Date.now()/1e3|0;if(i.nbf&&i.nbf>o)throw new rye(e);if(i.exp&&i.exp<=o)throw new sye(e);if(i.iat&&o<i.iat)throw new iye(o,i.iat);const a=e.substring(0,e.lastIndexOf("."));if(!await uye(t,n,pz(r[2]),Iy.encode(a)))throw new aye(e);return i},wz=e=>{try{const[t,n]=e.split("."),r=qk(t),s=qk(n);return{header:r,payload:s}}catch{throw new bz(e)}},b$={sign:mye,verify:gye,decode:wz},yye=b$.verify,bye=b$.decode,vye=b$.sign;const Sz=60*60*24*7,Ez=Qe({path:xe({default:"/"}),sameSite:xe({enum:["strict","lax","none"],default:"lax"}),secure:Wt({default:!0}),httpOnly:Wt({default:!0}),expires:Rt({default:Sz}),partitioned:Wt({default:!1}),renew:Wt({default:!0}),pathSuccess:xe({default:"/"}),pathLoggedOut:xe({default:"/"})}).partial().strict(),Nz=Qe({secret:Ole({default:""}),alg:xe({enum:["HS256","HS384","HS512"],default:"HS256"}).optional(),expires:Rt().optional(),issuer:xe().optional(),fields:un(xe(),{default:["id","email","role"]})},{default:{}}).strict(),xye=Qe({jwt:Nz,cookie:Ez});class wye{constructor(t,n,r){K(this,"config");this.strategies=t,this.userPool=n,this.config=Ln(xye,r??{})}async resolveLogin(t,n,r,s,i){try{const o=(i==null?void 0:i.identifier)||"email";if(typeof o!="string"||o.length===0)throw new Fl("Identifier must be a string");if(!(o in r))throw new Fl(`Profile must have identifier "${o}"`);const a=await this.userPool.findBy(n.getName(),o,r[o]);if(a.strategy_value){if(a.strategy!==n.getName())throw new Fl("User signed up with a different strategy")}else throw new Fl("User must have a strategy value");await s(a);const c=await this.safeAuthResponse(a);return this.respondWithUser(t,c,i)}catch(o){return this.respondWithError(t,o,i)}}async resolveRegister(t,n,r,s,i){try{const o=(i==null?void 0:i.identifier)||"email";if(typeof o!="string"||o.length===0)throw new Fl("Identifier must be a string");if(!(o in r))throw new Fl(`Profile must have identifier "${o}"`);if(!("strategy_value"in r))throw new Fl("Profile must have a strategy value");const a=await this.userPool.create(n.getName(),{...r,strategy_value:r.strategy_value});await s(a);const c=await this.safeAuthResponse(a);return this.respondWithUser(t,c,i)}catch(o){return this.respondWithError(t,o,i)}}async respondWithUser(t,n,r){const s=this.getSafeUrl(t,(r==null?void 0:r.redirect)??this.config.cookie.pathSuccess??"/");if("token"in n)return await this.setAuthCookie(t,n.token),this.isJsonRequest(t)||r!=null&&r.forceJsonResponse?t.json(n):t.redirect(s);throw new li("Invalid response")}async respondWithError(t,n,r){if(pt.error("respondWithError",n),this.isJsonRequest(t)||r!=null&&r.forceJsonResponse)throw n;await Vk(t,String(n),"error");const s=this.getSafeUrl(t,t.req.header("Referer")??"/");return t.redirect(s)}getStrategies(){return this.strategies}strategy(t){try{return this.strategies[t]}catch{throw new Error(`Strategy "${String(t)}" not found`)}}async jwt(t){var i,o,a;const r={...dx(t,this.config.jwt.fields),iat:Math.floor(Date.now()/1e3)};(i=this.config.jwt)!=null&&i.issuer&&(r.iss=this.config.jwt.issuer),(o=this.config.jwt)!=null&&o.expires&&(r.exp=Math.floor(Date.now()/1e3)+this.config.jwt.expires);const s=this.config.jwt.secret;if(!s||s.length===0)throw new Error("Cannot sign JWT without a secret");return vye(r,s,((a=this.config.jwt)==null?void 0:a.alg)??"HS256")}async safeAuthResponse(t){const n=dx(t,this.config.jwt.fields);return{user:n,token:await this.jwt(n)}}async verify(t){var n,r,s;try{const i=await yye(t,((n=this.config.jwt)==null?void 0:n.secret)??"",((r=this.config.jwt)==null?void 0:r.alg)??"HS256");if((s=this.config.jwt)!=null&&s.issuer&&i.iss!==this.config.jwt.issuer)throw new li("Invalid issuer",403);return i}catch{}}get cookieOptions(){const{expires:t=Sz,renew:n,...r}=this.config.cookie;return{...r,expires:new Date(Date.now()+t*1e3)}}async getAuthCookie(t){try{const n=this.config.jwt.secret,r=await sF(t,n,"auth");return typeof r!="string"?void 0:r}catch(n){n instanceof Error&&pt.error("[getAuthCookie]",n.message);return}}async requestCookieRefresh(t){var n;if(this.config.cookie.renew&&((n=t.get("auth"))!=null&&n.user)){const r=await this.getAuthCookie(t);r&&await this.setAuthCookie(t,r)}}async setAuthCookie(t,n){pt.debug("setting auth cookie",Fie(n));const r=this.config.jwt.secret;await oF(t,"auth",n,r,this.cookieOptions)}async unsafeGetAuthCookie(t){return yv("auth",t,this.config.jwt.secret,this.cookieOptions)}deleteAuthCookie(t){pt.debug("deleting auth cookie"),yle(t,"auth",this.cookieOptions)}async logout(t){pt.info("Logging out"),t.set("auth",void 0),await this.getAuthCookie(t)&&Vk(t,"Signed out","info"),this.deleteAuthCookie(t)}isJsonRequest(t){return t.req.header("Content-Type")==="application/json"}async getBody(t){return this.isJsonRequest(t)?await t.req.json():Object.fromEntries((await t.req.formData()).entries())}getSafeUrl(t,n){const r=n.replace(/\/+$/,"/");return Uie("redirects_non_fq")?r:new URL(t.req.url).origin+r}async resolveAuthFromRequest(t){let n;if(t.req.raw.headers.has("Authorization")?n=String(t.req.header("Authorization")).replace("Bearer ",""):n=await this.getAuthCookie(t),n)return await this.verify(n)}toJSON(t){return{...this.config,jwt:t?this.config.jwt:void 0}}}let JC;var cv,Z9;(typeof navigator>"u"||!((Z9=(cv=navigator.userAgent)==null?void 0:cv.startsWith)!=null&&Z9.call(cv,"Mozilla/5.0 ")))&&(JC="oauth4webapi/v2.17.0");function Dy(e,t){if(e==null)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch{return!1}}const gx=Symbol(),Sye=Symbol(),v$=Symbol(),Eye=Symbol(),_z=Symbol(),Nye=Symbol(),_ye=new TextEncoder,Cye=new TextDecoder;function fc(e){return typeof e=="string"?_ye.encode(e):Cye.decode(e)}const Hk=32768;function Oye(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=[];for(let n=0;n<e.byteLength;n+=Hk)t.push(String.fromCharCode.apply(null,e.subarray(n,n+Hk)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function jye(e){try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}catch(t){throw new Je("The input to be decoded is not correctly encoded.",{cause:t})}}function Oa(e){return typeof e=="string"?jye(e):Oye(e)}class Aye{constructor(t){this.cache=new Map,this._cache=new Map,this.maxSize=t}get(t){let n=this.cache.get(t);if(n)return n;if(n=this._cache.get(t))return this.update(t,n),n}has(t){return this.cache.has(t)||this._cache.has(t)}set(t,n){return this.cache.has(t)?this.cache.set(t,n):this.update(t,n),this}delete(t){return this.cache.has(t)?this.cache.delete(t):this._cache.has(t)?this._cache.delete(t):!1}update(t,n){this.cache.set(t,n),this.cache.size>=this.maxSize&&(this._cache=this.cache,this.cache=new Map)}}class Yi extends Error{constructor(t){var n;super(t??"operation not supported"),this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}}class $ye extends Error{constructor(t,n){var r;super(t,n),this.name=this.constructor.name,(r=Error.captureStackTrace)==null||r.call(Error,this,this.constructor)}}const Je=$ye,Cz=new Aye(100);function Oz(e){return e instanceof CryptoKey}function Tye(e){return Oz(e)&&e.type==="private"}function Rye(e){return Oz(e)&&e.type==="public"}function x$(e){try{const t=e.headers.get("dpop-nonce");t&&Cz.set(new URL(e.url).origin,t)}catch{}return e}function jh(e){return!(e===null||typeof e!="object"||Array.isArray(e))}function O1(e){Dy(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(e);if(JC&&!t.has("user-agent")&&t.set("user-agent",JC),t.has("authorization"))throw new TypeError('"options.headers" must not include the "authorization" header name');if(t.has("dpop"))throw new TypeError('"options.headers" must not include the "dpop" header name');return t}function Mye(e){if(typeof e=="function"&&(e=e()),!(e instanceof AbortSignal))throw new TypeError('"options.signal" must return or be an instance of AbortSignal');return e}async function kye(e,t){if(!(e instanceof URL))throw new TypeError('"issuerIdentifier" must be an instance of URL');if(e.protocol!=="https:"&&e.protocol!=="http:")throw new TypeError('"issuer.protocol" must be "https:" or "http:"');const n=new URL(e.href);switch(t==null?void 0:t.algorithm){case void 0:case"oidc":n.pathname=`${n.pathname}/.well-known/openid-configuration`.replace("//","/");break;case"oauth2":n.pathname==="/"?n.pathname=".well-known/oauth-authorization-server":n.pathname=`.well-known/oauth-authorization-server/${n.pathname}`.replace("//","/");break;default:throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"')}const r=O1(t==null?void 0:t.headers);return r.set("accept","application/json"),((t==null?void 0:t[v$])||fetch)(n.href,{headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:null}).then(x$)}function rr(e){return typeof e=="string"&&e.length!==0}async function Iye(e,t){if(!(e instanceof URL))throw new TypeError('"expectedIssuer" must be an instance of URL');if(!Dy(t,Response))throw new TypeError('"response" must be an instance of Response');if(t.status!==200)throw new Je('"response" is not a conform Authorization Server Metadata response');kg(t);let n;try{n=await t.json()}catch(r){throw new Je('failed to parse "response" body as JSON',{cause:r})}if(!jh(n))throw new Je('"response" body must be a top level object');if(!rr(n.issuer))throw new Je('"response" body "issuer" property must be a non-empty string');if(new URL(n.issuer).href!==e.href)throw new Je('"response" body "issuer" does not match "expectedIssuer"');return n}function jz(){return Oa(crypto.getRandomValues(new Uint8Array(32)))}function Wk(){return jz()}async function Dye(e){if(!rr(e))throw new TypeError('"codeVerifier" must be a non-empty string');return Oa(await crypto.subtle.digest("SHA-256",fc(e)))}function Gk(e){return encodeURIComponent(e).replace(/%20/g,"+")}function Pye(e,t){const n=Gk(e),r=Gk(t);return`Basic ${btoa(`${n}:${r}`)}`}function Lye(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Yi("unsupported RsaHashedKeyAlgorithm hash name")}}function Fye(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Yi("unsupported RsaHashedKeyAlgorithm hash name")}}function Bye(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Yi("unsupported EcKeyAlgorithm namedCurve")}}function zye(e){switch(e.algorithm.name){case"RSA-PSS":return Lye(e);case"RSASSA-PKCS1-v1_5":return Fye(e);case"ECDSA":return Bye(e);case"Ed25519":case"Ed448":return"EdDSA";default:throw new Yi("unsupported CryptoKey algorithm name")}}function Py(e){const t=e==null?void 0:e[gx];return typeof t=="number"&&Number.isFinite(t)?t:0}function w$(e){const t=e==null?void 0:e[Sye];return typeof t=="number"&&Number.isFinite(t)&&Math.sign(t)!==-1?t:30}function S$(){return Math.floor(Date.now()/1e3)}function Ly(e){if(typeof e!="object"||e===null)throw new TypeError('"as" must be an object');if(!rr(e.issuer))throw new TypeError('"as.issuer" property must be a non-empty string');return!0}function Fy(e){if(typeof e!="object"||e===null)throw new TypeError('"client" must be an object');if(!rr(e.client_id))throw new TypeError('"client.client_id" property must be a non-empty string');return!0}function Yk(e){if(!rr(e))throw new TypeError('"client.client_secret" property must be a non-empty string');return e}function Jk(e,t){if(t!==void 0)throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`)}async function Vye(e,t,n,r,s){switch(n.delete("client_secret"),n.delete("client_assertion_type"),n.delete("client_assertion"),t.token_endpoint_auth_method){case void 0:case"client_secret_basic":{r.set("authorization",Pye(t.client_id,Yk(t.client_secret)));break}case"client_secret_post":{n.set("client_id",t.client_id),n.set("client_secret",Yk(t.client_secret));break}case"private_key_jwt":throw Jk("private_key_jwt",t.client_secret),new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');case"tls_client_auth":case"self_signed_tls_client_auth":case"none":{Jk(t.token_endpoint_auth_method,t.client_secret),t.token_endpoint_auth_method,n.set("client_id",t.client_id);break}default:throw new Yi("unsupported client token_endpoint_auth_method")}}async function Uye(e,t,n){if(!n.usages.includes("sign"))throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');const r=`${Oa(fc(JSON.stringify(e)))}.${Oa(fc(JSON.stringify(t)))}`,s=Oa(await crypto.subtle.sign(Pz(n),n,fc(r)));return`${r}.${s}`}async function qye(e,t,n,r,s,i){var m;const{privateKey:o,publicKey:a,nonce:c=Cz.get(n.origin)}=t;if(!Tye(o))throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');if(!Rye(a))throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');if(c!==void 0&&!rr(c))throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');if(!a.extractable)throw new TypeError('"DPoP.publicKey.extractable" must be true');const u=S$()+s,f={alg:zye(o),typ:"dpop+jwt",jwk:await Wye(a)},h={iat:u,jti:jz(),htm:r,nonce:c,htu:`${n.origin}${n.pathname}`,ath:i?Oa(await crypto.subtle.digest("SHA-256",fc(i))):void 0};(m=t[Eye])==null||m.call(t,f,h),e.set("dpop",await Uye(f,h,o))}let Sv;async function Hye(e){const{kty:t,e:n,n:r,x:s,y:i,crv:o}=await crypto.subtle.exportKey("jwk",e),a={kty:t,e:n,n:r,x:s,y:i,crv:o};return Sv.set(e,a),a}async function Wye(e){return Sv||(Sv=new WeakMap),Sv.get(e)||Hye(e)}function Xk(e,t,n){if(typeof e!="string")throw n?new TypeError(`"as.mtls_endpoint_aliases.${t}" must be a string`):new TypeError(`"as.${t}" must be a string`);return new URL(e)}function Az(e,t,n=!1){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Xk(e.mtls_endpoint_aliases[t],t,n):Xk(e[t],t,n)}function $z(e,t){return!!(e.use_mtls_endpoint_aliases||t!=null&&t[Nye])}function Df(e){const t=e;return typeof t!="object"||Array.isArray(t)||t===null?!1:t.error!==void 0}function Gye(e){return e.length>=2&&e[0]==='"'&&e[e.length-1]==='"'?e.slice(1,-1):e}const Yye=/((?:,|, )?[0-9a-zA-Z!#$%&'*+-.^_`|~]+=)/,Jye=/(?:^|, ?)([0-9a-zA-Z!#$%&'*+\-.^_`|~]+)(?=$|[ ,])/g;function Xye(e,t){const n=t.split(Yye).slice(1);if(!n.length)return{scheme:e.toLowerCase(),parameters:{}};n[n.length-1]=n[n.length-1].replace(/,$/,"");const r={};for(let s=1;s<n.length;s+=2){const i=s;if(n[i][0]==='"')for(;n[i].slice(-1)!=='"'&&++s<n.length;)n[i]+=n[s];const o=n[i-1].replace(/^(?:, ?)|=$/g,"").toLowerCase();r[o]=Gye(n[i])}return{scheme:e.toLowerCase(),parameters:r}}function Kk(e){if(!Dy(e,Response))throw new TypeError('"response" must be an instance of Response');const t=e.headers.get("www-authenticate");if(t===null)return;const n=[];for(const{1:s,index:i}of t.matchAll(Jye))n.push([s,i]);return n.length?n.map(([s,i],o,a)=>{const c=a[o+1];let u;return c?u=t.slice(i,c[1]):u=t.slice(i),Xye(s,u)}):void 0}async function Kye(e,t,n,r,s,i){if(!rr(e))throw new TypeError('"accessToken" must be a non-empty string');if(!(n instanceof URL))throw new TypeError('"url" must be an instance of URL');return r=O1(r),(i==null?void 0:i.DPoP)===void 0?r.set("authorization",`Bearer ${e}`):(await qye(r,i.DPoP,n,t.toUpperCase(),Py({[gx]:i==null?void 0:i[gx]}),e),r.set("authorization",`DPoP ${e}`)),((i==null?void 0:i[v$])||fetch)(n.href,{body:s,headers:Object.fromEntries(r.entries()),method:t,redirect:"manual",signal:i!=null&&i.signal?Mye(i.signal):null}).then(x$)}async function Qk(e,t,n,r){Ly(e),Fy(t);const s=Az(e,"userinfo_endpoint",$z(t,r)),i=O1(r==null?void 0:r.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),Kye(n,"GET",s,i,null,{...r,[gx]:Py(t)})}const Qye=Symbol();function Zye(e){var t;return(t=e.headers.get("content-type"))==null?void 0:t.split(";")[0]}async function e0e(e,t,n,r){if(Ly(e),Fy(t),!Dy(r,Response))throw new TypeError('"response" must be an instance of Response');if(r.status!==200)throw new Je('"response" is not a conform UserInfo Endpoint response');let s;if(Zye(r)==="application/jwt"){kg(r);const{claims:i,jwt:o}=await Lz(await r.text(),Fz.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported),E$,Py(t),w$(t),t[_z]).then(s0e.bind(void 0,t.client_id)).then(i0e.bind(void 0,e.issuer));r0e.set(r,o),s=i}else{if(t.userinfo_signed_response_alg)throw new Je("JWT UserInfo Response expected");kg(r);try{s=await r.json()}catch(i){throw new Je('failed to parse "response" body as JSON',{cause:i})}}if(!jh(s))throw new Je('"response" body must be a top level object');if(!rr(s.sub))throw new Je('"response" body "sub" property must be a non-empty string');switch(n){case Qye:break;default:if(!rr(n))throw new Je('"expectedSubject" must be a non-empty string');if(s.sub!==n)throw new Je('unexpected "response" body "sub" value')}return s}async function t0e(e,t,n,r,s,i,o){return await Vye(e,t,s,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((o==null?void 0:o[v$])||fetch)(r.href,{body:s,headers:Object.fromEntries(i.entries()),method:n,redirect:"manual",signal:null}).then(x$)}async function n0e(e,t,n,r,s){const i=Az(e,"token_endpoint",$z(t,s));r.set("grant_type",n);const o=O1(s==null?void 0:s.headers);return o.set("accept","application/json"),t0e(e,t,"POST",i,r,o,s)}const Tz=new WeakMap,r0e=new WeakMap;function Rz(e){if(!e.id_token)return;const t=Tz.get(e);if(!t)throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');return t[0]}async function Mz(e,t,n,r=!1,s=!1){if(Ly(e),Fy(t),!Dy(n,Response))throw new TypeError('"response" must be an instance of Response');if(n.status!==200){let o;if(o=await f0e(n))return o;throw new Je('"response" is not a conform Token Endpoint response')}kg(n);let i;try{i=await n.json()}catch(o){throw new Je('failed to parse "response" body as JSON',{cause:o})}if(!jh(i))throw new Je('"response" body must be a top level object');if(!rr(i.access_token))throw new Je('"response" body "access_token" property must be a non-empty string');if(!rr(i.token_type))throw new Je('"response" body "token_type" property must be a non-empty string');if(i.token_type=i.token_type.toLowerCase(),i.token_type!=="dpop"&&i.token_type!=="bearer")throw new Yi("unsupported `token_type` value");if(i.expires_in!==void 0&&(typeof i.expires_in!="number"||i.expires_in<=0))throw new Je('"response" body "expires_in" property must be a positive number');if(!s&&i.refresh_token!==void 0&&!rr(i.refresh_token))throw new Je('"response" body "refresh_token" property must be a non-empty string');if(i.scope!==void 0&&typeof i.scope!="string")throw new Je('"response" body "scope" property must be a string');if(!r){if(i.id_token!==void 0&&!rr(i.id_token))throw new Je('"response" body "id_token" property must be a non-empty string');if(i.id_token){const{claims:o,jwt:a}=await Lz(i.id_token,Fz.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported),E$,Py(t),w$(t),t[_z]).then(l0e.bind(void 0,["aud","exp","iat","iss","sub"])).then(Iz.bind(void 0,e.issuer)).then(kz.bind(void 0,t.client_id));if(Array.isArray(o.aud)&&o.aud.length!==1){if(o.azp===void 0)throw new Je('ID Token "aud" (audience) claim includes additional untrusted audiences');if(o.azp!==t.client_id)throw new Je('unexpected ID Token "azp" (authorized party) claim value')}if(o.auth_time!==void 0&&(!Number.isFinite(o.auth_time)||Math.sign(o.auth_time)!==1))throw new Je('ID Token "auth_time" (authentication time) must be a positive number');Tz.set(i,[o,a])}}return i}function s0e(e,t){return t.claims.aud!==void 0?kz(e,t):t}function kz(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw new Je('unexpected JWT "aud" (audience) claim value')}else if(t.claims.aud!==e)throw new Je('unexpected JWT "aud" (audience) claim value');return t}function i0e(e,t){return t.claims.iss!==void 0?Iz(e,t):t}function Iz(e,t){if(t.claims.iss!==e)throw new Je('unexpected JWT "iss" (issuer) claim value');return t}const Dz=new WeakSet;function o0e(e){return Dz.add(e),e}async function Zk(e,t,n,r,s,i){if(Ly(e),Fy(t),!Dz.has(n))throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');if(!rr(r))throw new TypeError('"redirectUri" must be a non-empty string');if(!rr(s))throw new TypeError('"codeVerifier" must be a non-empty string');const o=la(n,"code");if(!o)throw new Je('no authorization code in "callbackParameters"');const a=new URLSearchParams(i==null?void 0:i.additionalParameters);return a.set("redirect_uri",r),a.set("code_verifier",s),a.set("code",o),n0e(e,t,"authorization_code",a,i)}const a0e={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation"};function l0e(e,t){for(const n of e)if(t.claims[n]===void 0)throw new Je(`JWT "${n}" (${a0e[n]}) claim missing`);return t}const c0e=Symbol(),vN=Symbol();async function u0e(e,t,n,r,s){const i=await Mz(e,t,n);if(Df(i))return i;if(!rr(i.id_token))throw new Je('"response" body "id_token" property must be a non-empty string');s??(s=t.default_max_age??vN);const o=Rz(i);if((t.require_auth_time||s!==vN)&&o.auth_time===void 0)throw new Je('ID Token "auth_time" (authentication time) claim missing');if(s!==vN){if(typeof s!="number"||s<0)throw new TypeError('"maxAge" must be a non-negative number');const a=S$()+Py(t),c=w$(t);if(o.auth_time+s<a-c)throw new Je("too much time has elapsed since the last End-User authentication")}switch(r){case void 0:case c0e:if(o.nonce!==void 0)throw new Je('unexpected ID Token "nonce" claim value');break;default:if(!rr(r))throw new TypeError('"expectedNonce" must be a non-empty string');if(o.nonce===void 0)throw new Je('ID Token "nonce" claim missing');if(o.nonce!==r)throw new Je('unexpected ID Token "nonce" claim value')}return i}async function d0e(e,t,n){const r=await Mz(e,t,n,!0);if(Df(r))return r;if(r.id_token!==void 0){if(typeof r.id_token=="string"&&r.id_token.length)throw new Je("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");delete r.id_token}return r}function kg(e){if(e.bodyUsed)throw new TypeError('"response" body has been used already')}async function f0e(e){if(e.status>399&&e.status<500){kg(e);try{const t=await e.json();if(jh(t)&&typeof t.error=="string"&&t.error.length)return t.error_description!==void 0&&typeof t.error_description!="string"&&delete t.error_description,t.error_uri!==void 0&&typeof t.error_uri!="string"&&delete t.error_uri,t.algs!==void 0&&typeof t.algs!="string"&&delete t.algs,t.scope!==void 0&&typeof t.scope!="string"&&delete t.scope,t}catch{}}}function eI(e){if(typeof e.modulusLength!="number"||e.modulusLength<2048)throw new Je(`${e.name} modulusLength must be at least 2048 bits`)}function h0e(e){switch(e){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Yi}}function Pz(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:h0e(e.algorithm.namedCurve)};case"RSA-PSS":switch(eI(e.algorithm),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Yi}case"RSASSA-PKCS1-v1_5":return eI(e.algorithm),e.algorithm.name;case"Ed448":case"Ed25519":return e.algorithm.name}throw new Yi}const E$=Symbol();async function p0e(e,t,n,r){const s=`${e}.${t}`;if(!await crypto.subtle.verify(Pz(n),n,r,fc(s)))throw new Je("JWT signature verification failed")}async function Lz(e,t,n,r,s,i){let{0:o,1:a,2:c,length:u}=e.split(".");if(u===5)if(i!==void 0)e=await i(e),{0:o,1:a,2:c,length:u}=e.split(".");else throw new Yi("JWE structure JWTs are not supported");if(u!==3)throw new Je("Invalid JWT");let f;try{f=JSON.parse(fc(Oa(o)))}catch(x){throw new Je("failed to parse JWT Header body as base64url encoded JSON",{cause:x})}if(!jh(f))throw new Je("JWT Header must be a top level object");if(t(f),f.crit!==void 0)throw new Je('unexpected JWT "crit" header parameter');const h=Oa(c);let m;n!==E$&&(m=await n(f),await p0e(o,a,m,h));let y;try{y=JSON.parse(fc(Oa(a)))}catch(x){throw new Je("failed to parse JWT Payload body as base64url encoded JSON",{cause:x})}if(!jh(y))throw new Je("JWT Payload must be a top level object");const v=S$()+r;if(y.exp!==void 0){if(typeof y.exp!="number")throw new Je('unexpected JWT "exp" (expiration time) claim type');if(y.exp<=v-s)throw new Je('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()')}if(y.iat!==void 0&&typeof y.iat!="number")throw new Je('unexpected JWT "iat" (issued at) claim type');if(y.iss!==void 0&&typeof y.iss!="string")throw new Je('unexpected JWT "iss" (issuer) claim type');if(y.nbf!==void 0){if(typeof y.nbf!="number")throw new Je('unexpected JWT "nbf" (not before) claim type');if(y.nbf>v+s)throw new Je('unexpected JWT "nbf" (not before) claim value, timestamp is > now()')}if(y.aud!==void 0&&typeof y.aud!="string"&&!Array.isArray(y.aud))throw new Je('unexpected JWT "aud" (audience) claim type');return{header:f,claims:y,signature:h,key:m,jwt:e}}function Fz(e,t,n){if(e!==void 0){if(n.alg!==e)throw new Je('unexpected JWT "alg" header parameter');return}if(Array.isArray(t)){if(!t.includes(n.alg))throw new Je('unexpected JWT "alg" header parameter');return}if(n.alg!=="RS256")throw new Je('unexpected JWT "alg" header parameter')}function la(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw new Je(`"${t}" parameter must be provided only once`);return n}const m0e=Symbol(),XC=Symbol();function tI(e,t,n,r){if(Ly(e),Fy(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');if(la(n,"response"))throw new Je('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');const s=la(n,"iss"),i=la(n,"state");if(!s&&e.authorization_response_iss_parameter_supported)throw new Je('response parameter "iss" (issuer) missing');if(s&&s!==e.issuer)throw new Je('unexpected "iss" (issuer) response parameter value');switch(r){case void 0:case XC:if(i!==void 0)throw new Je('unexpected "state" response parameter encountered');break;case m0e:break;default:if(!rr(r))throw new Je('"expectedState" must be a non-empty string');if(i===void 0)throw new Je('response parameter "state" missing');if(i!==r)throw new Je('unexpected "state" response parameter value')}const o=la(n,"error");if(o)return{error:o,error_description:la(n,"error_description"),error_uri:la(n,"error_uri")};const a=la(n,"id_token"),c=la(n,"token");if(a!==void 0||c!==void 0)throw new Yi("implicit and hybrid flows are not supported");return o0e(new URLSearchParams(n))}const g0e={type:"oidc",client:{token_endpoint_auth_method:"client_secret_basic"},as:{issuer:"https://accounts.google.com"},profile:async e=>({...e,sub:e.sub,email:e.email})},y0e={type:"oauth2",client:{token_endpoint_auth_method:"client_secret_basic"},as:{code_challenge_methods_supported:["S256"],issuer:"https://github.com",scopes_supported:["read:user","user:email"],scope_separator:" ",authorization_endpoint:"https://github.com/login/oauth/authorize",token_endpoint:"https://github.com/login/oauth/access_token",userinfo_endpoint:"https://api.github.com/user"},profile:async(e,t,n)=>{var r;try{const o=(r=(await(await fetch("https://api.github.com/user/emails",{headers:{"User-Agent":"bknd",Accept:"application/json",Authorization:`Bearer ${n.access_token}`}})).json()).find(a=>a.primary))==null?void 0:r.email;if(!o)throw new Error("No primary email found");return{...e,sub:String(e.id),email:o}}catch{throw new Error("Couldn't retrive github email")}}},Bz=Object.freeze(Object.defineProperty({__proto__:null,github:y0e,google:g0e},Symbol.toStringTag,{value:"Module"}));class zz{constructor(t,n,r,s){K(this,"actions",{});this.config=t,this.type=n,this.name=r,this.mode=s,this.config=Ln(this.getSchema(),t??{})}registerAction(t,n,r){this.actions[t]={schema:n,preprocess:r}}getType(){return this.type}getMode(){return this.mode}getName(){return this.name}toJSON(t){return{type:this.getType(),config:t?this.config:void 0}}getActions(){return this.actions}}const b0e=Qe({name:xe({enum:Object.keys(Bz)}),type:xe({enum:["oidc","oauth2"],default:"oauth2"}),client:Qe({client_id:xe(),client_secret:xe()}).strict()},{title:"OAuth"});class Em extends li{constructor(n,r){super("OAuthCallbackException on "+r);K(this,"name","OAuthCallbackException");this.error=n,this.step=r}}class KC extends zz{constructor(t){super(t,"oauth",t.name,"external")}getSchema(){return b0e}getIssuerConfig(){return Bz[this.config.name]}async getConfig(){const t=this.getIssuerConfig();if(t.type==="oidc"){const n=new URL(t.as.issuer),r=await kye(n);t.as=await Iye(n,r)}return{...t,type:t.type,client:{...t.client,...this.config.client}}}async getCodeChallenge(t,n,r="S256"){var a;const s=(a=t.code_challenge_methods_supported)==null?void 0:a.includes(r);let i,o;return s&&(i=await Dye(n),o=r),{challenge_supported:s,challenge:i,challenge_method:o}}async request(t){const{client:n,as:r}=await this.getConfig(),{challenge_supported:s,challenge:i,challenge_method:o}=await this.getCodeChallenge(r,t.state);if(!r.authorization_endpoint)throw new Error("authorization_endpoint is not provided");const a=t.scopes??r.scopes_supported;if(!Array.isArray(a)||a.length===0)throw new Error("No scopes provided");if(a.every(f=>{var h;return!((h=r.scopes_supported)!=null&&h.includes(f))}))throw new Error("Invalid scopes provided");const c=r.authorization_endpoint,u={client_id:n.client_id,redirect_uri:t.redirect_uri,response_type:"code",scope:a.join(r.scope_separator??" ")};return s?(u.code_challenge=i,u.code_challenge_method=o):u.nonce=t.state,{url:new URL(c)+"?"+new URLSearchParams(u).toString(),endpoint:c,params:u}}async oidc(t,n){const r=await this.getConfig(),{client:s,as:i,type:o}=r,a=tI(i,s,t,XC);if(Df(a))throw new Em(a,"validateAuthResponse");const c=await Zk(i,s,a,n.redirect_uri,n.state),u=Kk(c);if(u)throw new Em(u,"www-authenticate");const{challenge_supported:f,challenge:h}=await this.getCodeChallenge(i,n.state),y=await u0e(i,s,c,f?void 0:h);if(Df(y))throw new Em(y,"processAuthorizationCodeOpenIDResponse");const v=Rz(y),x=await Qk(i,s,y.access_token),E=await e0e(i,s,v.sub,x);return await r.profile(E,r,v)}async oauth2(t,n){const r=await this.getConfig(),{client:s,type:i,as:o,profile:a}=r,c=tI(o,s,t,XC);if(Df(c))throw new Em(c,"validateAuthResponse");const u=await Zk(o,s,c,n.redirect_uri,n.state),f=Kk(u);if(f)throw new Em(f,"www-authenticate");const h=u.clone();let m={};try{if(m=await d0e(o,s,u),Df(m))throw new Error}catch{m=await h.json()}const v=await(await Qk(o,s,m.access_token)).json();return await r.profile(v,r,m)}async callback(t,n){switch(this.getIssuerConfig().type){case"oidc":return await this.oidc(t,n);case"oauth2":return await this.oauth2(t,n);default:throw new Error("Unsupported type")}}getController(t){const n=new _1,r="secret",s="_challenge",i=async(a,c)=>{await oF(a,s,JSON.stringify(c),r,{secure:!0,httpOnly:!0,sameSite:"Lax",maxAge:60*5})},o=async a=>{if(a.req.header("X-State-Challenge"))return{state:a.req.header("X-State-Challenge"),action:a.req.header("X-State-Action"),mode:"token"};const c=await sF(a,r,s);try{return JSON.parse(c)}catch{throw new Error("Invalid state")}};return n.get("/callback",async a=>{const c=new URL(a.req.url),u=new URLSearchParams(c.search),f=await o(a),h=f.mode==="cookie"?c.origin+c.pathname:c.origin+c.pathname.replace("/callback","/token"),m=await this.callback(u,{redirect_uri:h,state:f.state}),y={email:m.email,strategy_value:m.sub},v=async E=>{if(E.strategy_value!==m.sub)throw new li("Invalid credentials")},x={redirect:f.redirect,forceJsonResponse:f.mode!=="cookie"};switch(f.action){case"login":return t.resolveLogin(a,this,y,v,x);case"register":return t.resolveRegister(a,this,y,v,x);default:throw new Error("Invalid action")}}),n.get("/token",async a=>{const c=new URL(a.req.url),u=new URLSearchParams(c.search);return a.json({code:u.get("code")??null})}),n.post("/:action",async a=>{const c=a.req.param("action");if(!["login","register"].includes(c))return a.notFound();const u=new URL(a.req.url),f=u.pathname.replace(`/${c}`,""),h=u.origin+f+"/callback",m=new URL(a.req.header("Referer")??"/"),y=Wk(),v=await this.request({redirect_uri:h,state:y});return await i(a,{state:y,action:c,redirect:m.toString(),mode:"cookie"}),a.redirect(v.url)}),n.get("/:action",async a=>{const c=a.req.param("action");if(!["login","register"].includes(c))return a.notFound();const u=new URL(a.req.url),f=u.pathname.replace(`/${c}`,""),h=u.origin+f+"/token",m=Wk(),y=await this.request({redirect_uri:h,state:m});return qr()?a.json({url:y.url,redirect_uri:h,challenge:m,action:c,params:y.params}):a.json({url:y.url,challenge:m,action:c})}),n}toJSON(t){const n=t?this.config:jL(this.config,["secret","client_id"]);return{...super.toJSON(t),config:{...n,type:this.getIssuerConfig().type}}}}const xN=xe({pattern:"^(https?|wss?)://[^\\s/$.?#].[^\\s]*$"}),v0e=st({type:xe({enum:["oidc","oauth2"],default:"oidc"}),name:xe(),client:Qe({client_id:xe(),client_secret:xe(),token_endpoint_auth_method:xe({enum:["client_secret_basic"]})}),as:st({issuer:xe(),code_challenge_methods_supported:xe({enum:["S256"]}).optional(),scopes_supported:un(xe()).optional(),scope_separator:xe({default:" "}).optional(),authorization_endpoint:xN.optional(),token_endpoint:xN.optional(),userinfo_endpoint:xN.optional()})},{title:"Custom OAuth"});class nI extends KC{constructor(t){super(t),this.type="custom_oauth"}getIssuerConfig(){return{...this.config,profile:async t=>t}}getSchema(){return v0e}}const x0e={};function w0e(e){try{return crypto.getRandomValues(new Uint8Array(e))}catch{}try{return x0e.randomBytes(e)}catch{}throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative")}function S0e(e,t){if(e=e||qz,typeof e!="number")throw Error("Illegal arguments: "+typeof e+", "+typeof t);e<4?e=4:e>31&&(e=31);var n=[];return n.push("$2b$"),e<10&&n.push("0"),n.push(e.toString()),n.push("$"),n.push(QC(w0e(Ig),Ig)),n.join("")}function Vz(e,t,n){if(typeof t=="function"&&(n=t,t=void 0),typeof e=="function"&&(n=e,e=void 0),typeof e>"u")e=qz;else if(typeof e!="number")throw Error("illegal arguments: "+typeof e);function r(s){Fi(function(){try{s(null,S0e(e))}catch(i){s(i)}})}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);r(n)}else return new Promise(function(s,i){r(function(o,a){if(o){i(o);return}s(a)})})}function Uz(e,t,n,r){function s(i){typeof e=="string"&&typeof t=="number"?Vz(t,function(o,a){aI(e,a,i,r)}):typeof e=="string"&&typeof t=="string"?aI(e,t,i,r):Fi(i.bind(this,Error("Illegal arguments: "+typeof e+", "+typeof t)))}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);s(n)}else return new Promise(function(i,o){s(function(a,c){if(a){o(a);return}i(c)})})}function E0e(e,t){for(var n=e.length^t.length,r=0;r<e.length;++r)n|=e.charCodeAt(r)^t.charCodeAt(r);return n===0}function N0e(e,t,n,r){function s(i){if(typeof e!="string"||typeof t!="string"){Fi(i.bind(this,Error("Illegal arguments: "+typeof e+", "+typeof t)));return}if(t.length!==60){Fi(i.bind(this,null,!1));return}Uz(e,t.substring(0,29),function(o,a){o?i(o):i(null,E0e(a,t))},r)}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);s(n)}else return new Promise(function(i,o){s(function(a,c){if(a){o(a);return}i(c)})})}var Fi=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function _0e(e){for(var t=0,n=0,r=0;r<e.length;++r)n=e.charCodeAt(r),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320?(++r,t+=4):t+=3;return t}function C0e(e){for(var t=0,n,r,s=new Array(_0e(e)),i=0,o=e.length;i<o;++i)n=e.charCodeAt(i),n<128?s[t++]=n:n<2048?(s[t++]=n>>6|192,s[t++]=n&63|128):(n&64512)===55296&&((r=e.charCodeAt(i+1))&64512)===56320?(n=65536+((n&1023)<<10)+(r&1023),++i,s[t++]=n>>18|240,s[t++]=n>>12&63|128,s[t++]=n>>6&63|128,s[t++]=n&63|128):(s[t++]=n>>12|224,s[t++]=n>>6&63|128,s[t++]=n&63|128);return s}var wf="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),Tl=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1];function QC(e,t){var n=0,r=[],s,i;if(t<=0||t>e.length)throw Error("Illegal len: "+t);for(;n<t;){if(s=e[n++]&255,r.push(wf[s>>2&63]),s=(s&3)<<4,n>=t){r.push(wf[s&63]);break}if(i=e[n++]&255,s|=i>>4&15,r.push(wf[s&63]),s=(i&15)<<2,n>=t){r.push(wf[s&63]);break}i=e[n++]&255,s|=i>>6&3,r.push(wf[s&63]),r.push(wf[i&63])}return r.join("")}function O0e(e,t){for(var n=0,r=e.length,s=0,i=[],o,a,c,u,f,h;n<r-1&&s<t&&(h=e.charCodeAt(n++),o=h<Tl.length?Tl[h]:-1,h=e.charCodeAt(n++),a=h<Tl.length?Tl[h]:-1,!(o==-1||a==-1||(f=o<<2>>>0,f|=(a&48)>>4,i.push(String.fromCharCode(f)),++s>=t||n>=r)||(h=e.charCodeAt(n++),c=h<Tl.length?Tl[h]:-1,c==-1)||(f=(a&15)<<4>>>0,f|=(c&60)>>2,i.push(String.fromCharCode(f)),++s>=t||n>=r)));)h=e.charCodeAt(n++),u=h<Tl.length?Tl[h]:-1,f=(c&3)<<6>>>0,f|=u,i.push(String.fromCharCode(f)),++s;var m=[];for(n=0;n<s;n++)m.push(i[n].charCodeAt(0));return m}var Ig=16,qz=10,j0e=16,A0e=100,rI=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],sI=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],Hz=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function Dg(e,t,n,r){var s,i=e[t],o=e[t+1];return i^=n[0],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[1],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[2],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[3],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[4],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[5],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[6],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[7],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[8],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[9],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[10],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[11],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[12],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[13],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[14],s=r[i>>>24],s+=r[256|i>>16&255],s^=r[512|i>>8&255],s+=r[768|i&255],o^=s^n[15],s=r[o>>>24],s+=r[256|o>>16&255],s^=r[512|o>>8&255],s+=r[768|o&255],i^=s^n[16],e[t]=o^n[j0e+1],e[t+1]=i,e}function $f(e,t){for(var n=0,r=0;n<4;++n)r=r<<8|e[t]&255,t=(t+1)%e.length;return{key:r,offp:t}}function iI(e,t,n){for(var r=0,s=[0,0],i=t.length,o=n.length,a,c=0;c<i;c++)a=$f(e,r),r=a.offp,t[c]=t[c]^a.key;for(c=0;c<i;c+=2)s=Dg(s,0,t,n),t[c]=s[0],t[c+1]=s[1];for(c=0;c<o;c+=2)s=Dg(s,0,t,n),n[c]=s[0],n[c+1]=s[1]}function $0e(e,t,n,r){for(var s=0,i=[0,0],o=n.length,a=r.length,c,u=0;u<o;u++)c=$f(t,s),s=c.offp,n[u]=n[u]^c.key;for(s=0,u=0;u<o;u+=2)c=$f(e,s),s=c.offp,i[0]^=c.key,c=$f(e,s),s=c.offp,i[1]^=c.key,i=Dg(i,0,n,r),n[u]=i[0],n[u+1]=i[1];for(u=0;u<a;u+=2)c=$f(e,s),s=c.offp,i[0]^=c.key,c=$f(e,s),s=c.offp,i[1]^=c.key,i=Dg(i,0,n,r),r[u]=i[0],r[u+1]=i[1]}function oI(e,t,n,r,s){var i=Hz.slice(),o=i.length,a;if(n<4||n>31)if(a=Error("Illegal number of rounds (4-31): "+n),r){Fi(r.bind(this,a));return}else throw a;if(t.length!==Ig)if(a=Error("Illegal salt length: "+t.length+" != "+Ig),r){Fi(r.bind(this,a));return}else throw a;n=1<<n>>>0;var c,u,f=0,h;typeof Int32Array=="function"?(c=new Int32Array(rI),u=new Int32Array(sI)):(c=rI.slice(),u=sI.slice()),$0e(t,e,c,u);function m(){if(s&&s(f/n),f<n)for(var v=Date.now();f<n&&(f=f+1,iI(e,c,u),iI(t,c,u),!(Date.now()-v>A0e)););else{for(f=0;f<64;f++)for(h=0;h<o>>1;h++)Dg(i,h<<1,c,u);var x=[];for(f=0;f<o;f++)x.push((i[f]>>24&255)>>>0),x.push((i[f]>>16&255)>>>0),x.push((i[f]>>8&255)>>>0),x.push((i[f]&255)>>>0);if(r){r(null,x);return}else return x}r&&Fi(m)}if(typeof r<"u")m();else for(var y;;)if(typeof(y=m())<"u")return y||[]}function aI(e,t,n,r){var s;if(typeof e!="string"||typeof t!="string")if(s=Error("Invalid string / salt: Not a string"),n){Fi(n.bind(this,s));return}else throw s;var i,o;if(t.charAt(0)!=="$"||t.charAt(1)!=="2")if(s=Error("Invalid salt version: "+t.substring(0,2)),n){Fi(n.bind(this,s));return}else throw s;if(t.charAt(2)==="$")i="\0",o=3;else{if(i=t.charAt(2),i!=="a"&&i!=="b"&&i!=="y"||t.charAt(3)!=="$")if(s=Error("Invalid salt revision: "+t.substring(2,4)),n){Fi(n.bind(this,s));return}else throw s;o=4}if(t.charAt(o+2)>"$")if(s=Error("Missing salt rounds"),n){Fi(n.bind(this,s));return}else throw s;var a=parseInt(t.substring(o,o+1),10)*10,c=parseInt(t.substring(o+1,o+2),10),u=a+c,f=t.substring(o+3,o+25);e+=i>="a"?"\0":"";var h=C0e(e),m=O0e(f,Ig);function y(v){var x=[];return x.push("$2"),i>="a"&&x.push(i),x.push("$"),u<10&&x.push("0"),x.push(u.toString()),x.push("$"),x.push(QC(m,m.length)),x.push(QC(v,Hz.length*4-1)),x.join("")}if(typeof n>"u")return y(oI(h,m,u));oI(h,m,u,function(v,x){v?n(v,null):n(null,y(x))},r)}const T0e=Qe({hashing:xe({enum:["plain","sha256","bcrypt"],default:"sha256"}),rounds:Rt({minimum:1,maximum:10}).optional()}).strict();class lI extends zz{constructor(t={}){super(t,"password","password","form"),this.registerAction("create",this.getPayloadSchema(),async({password:n,...r})=>({...r,strategy_value:await this.hash(n)}))}getSchema(){return T0e}getPayloadSchema(){return Qe({email:xe({format:"email"}),password:xe({minLength:8})})}async hash(t){switch(this.config.hashing){case"sha256":return zL.sha256(t);case"bcrypt":{const n=await Vz(this.config.rounds??4);return Uz(t,n)}default:return t}}async compare(t,n){switch(this.config.hashing){case"sha256":{const r=await this.hash(n);return t===r}case"bcrypt":return await N0e(n,t)}return!1}verify(t){return async n=>{if(await this.compare(n==null?void 0:n.strategy_value,t)!==!0)throw new yN}}getController(t){const n=new _1,r=Qe({redirect:xe().optional()}),s=this.getPayloadSchema();return n.post("/login",qt("query",r),async i=>{try{const o=Ln(s,await t.getBody(i),{onError:c=>{throw pt.error("Invalid login payload",[...c]),new yN}}),{redirect:a}=i.req.valid("query");return await t.resolveLogin(i,this,o,this.verify(o.password),{redirect:a})}catch(o){return t.respondWithError(i,o)}}),n.post("/register",qt("query",r),async i=>{try{const{redirect:o}=i.req.valid("query"),{password:a,email:c,...u}=Ln(s,await t.getBody(i),{onError:h=>{pt.error("Invalid register payload",[...h]),new yN}}),f={...u,email:c,strategy_value:await this.hash(a)};return await t.resolveRegister(i,this,f,async()=>{},{redirect:o})}catch(o){return t.respondWithError(i,o)}}),n}}const R0e={password:{cls:lI,schema:lI.prototype.getSchema()},oauth:{cls:KC,schema:KC.prototype.getSchema()},custom_oauth:{cls:nI,schema:nI.prototype.getSchema()}},Wz=R0e,M0e=Zw(Wz,(e,t)=>st({enabled:Wt({default:!0}).optional(),type:ti(t),config:e.schema},{title:t})),k0e=Zt(Object.values(M0e)),I0e=Qe({enabled:Wt({default:!1}).optional()}),Gz=st({permissions:un(xe()).optional(),is_default:Wt().optional(),implicit_allow:Wt().optional()}),cI=st({enabled:Wt({default:!1}),basepath:xe({default:"/api/auth"}),entity_name:xe({default:"users"}),allow_register:Wt({default:!0}).optional(),jwt:Nz,cookie:Ez,strategies:Vi(k0e,{title:"Strategies",default:{password:{type:"password",enabled:!0,config:{hashing:"sha256"}}}}),guard:I0e.optional(),roles:Vi(Gz,{default:{}}).optional()},{title:"Authentication"});class D0e{constructor(t){this.appAuth=t}get em(){return this.appAuth.em}get users(){return this.appAuth.getUsersEntity()}async findBy(t,n,r){pt.debug("[AppUserPool:findBy]",{strategy:t,prop:n,value:r}),this.toggleStrategyValueVisibility(!0);const s=await this.em.repo(this.users).findOne({[n]:r,strategy:t});if(this.toggleStrategyValueVisibility(!1),!s.data)throw pt.debug("[AppUserPool]: User not found"),new Bge;return s.data}async create(t,n){if(pt.debug("[AppUserPool:create]",{strategy:t,payload:n}),!("strategy_value"in n))throw new Fl("Profile must have a strategy_value value");const r=this.users.getSelect(void 0,"create"),i={...dx(n,r),strategy:t},o=this.em.mutator(this.users);o.__unstable_toggleSystemEntityCreation(!1),this.toggleStrategyValueVisibility(!0);const a=await o.insertOne(i);if(o.__unstable_toggleSystemEntityCreation(!0),this.toggleStrategyValueVisibility(!1),!a.data)throw new zge;return pt.debug("[AppUserPool]: User created",a.data),a.data}toggleStrategyValueVisibility(t){const n=(r,s)=>{const i=this.users.field(r);if(s)i.config.hidden=!1,i.config.fillable=!0;else{const o=yx.usersFields.strategy_value.config;i.config.hidden=o.hidden,i.config.fillable=o.fillable}};n("strategy_value",t),n("strategy",t)}}const P0e={email:ba().required(),strategy:ba({fillable:["create"],hidden:["update","form"]}).required(),strategy_value:ba({fillable:["create"],hidden:["read","table","update","form"]}).required(),role:ba()},vw=class vw extends Ry{constructor(){super(...arguments);K(this,"_authenticator");K(this,"cache",{});K(this,"_controller")}async onBeforeUpdate(n,r){var i,o;const s=cI.properties.jwt.properties.secret.default;return!n.enabled&&r.enabled&&r.jwt.secret===s&&(pt.warn("No JWT secret provided, generating a random one"),r.jwt.secret=Qoe(64)),(o=(i=r.strategies)==null?void 0:i.password)!=null&&o.enabled||(pt.warn("Password strategy cannot be disabled."),r.strategies.password.enabled=!0),r}get enabled(){return this.config.enabled}async build(){if(!this.enabled){this.setBuilt();return}const n=sn(this.config.roles??{},(s,i)=>Qv.create({name:i,...s}));this.ctx.guard.setRoles(Object.values(n)),this.ctx.guard.setConfig(this.config.guard??{});const r=sn(this.config.strategies??{},(s,i)=>{try{return new Wz[s.type].cls(s.config)}catch{throw new Error(`Could not build strategy ${String(i)} with config ${JSON.stringify(s.config)}`)}});this._authenticator=new wye(r,new D0e(this),{jwt:this.config.jwt,cookie:this.config.cookie}),this.registerEntities(),super.setBuilt(),this._controller=new Qge(this),this.ctx.server.route(this.config.basepath,this._controller.getController()),this.ctx.guard.registerPermissions(qge)}isStrategyEnabled(n){var s,i;const r=typeof n=="string"?n:n.getName();return r==="password"?!0:((i=(s=this.config.strategies)==null?void 0:s[r])==null?void 0:i.enabled)??!1}get controller(){if(!this.isBuilt())throw new Error("Can't access controller, AppAuth not built yet");return this._controller}getSchema(){return cI}get authenticator(){return this.throwIfNotBuilt(),this._authenticator}get em(){return this.ctx.em}getUsersEntity(n){const r=this.config.entity_name;return n||!this.em.hasEntity(r)?g$(r,vw.usersFields,void 0,"system"):this.em.entity(r)}registerEntities(){const n=this.getUsersEntity(!0);this.ctx.helper.ensureSchema(KB({[n.name]:n},({index:r},{users:s})=>{r(s).on(["email"],!0).on(["strategy"]).on(["strategy_value"])}));try{const r=Object.keys(this.config.roles??{});this.ctx.helper.replaceEntityField(n,"role",VC({enum:r}))}catch{}try{const r=Object.keys(this.config.strategies??{});this.ctx.helper.replaceEntityField(n,"strategy",VC({enum:r}))}catch{}}async createUser({email:n,password:r,...s}){if(!this.enabled)throw new Error("Cannot create user, auth not enabled");const i="password",a=await this.authenticator.strategy(i).hash(r),c=this.em.mutator(this.config.entity_name);c.__unstable_toggleSystemEntityCreation(!1);const{data:u}=await c.insertOne({...s,email:n,strategy:i,strategy_value:a});return c.__unstable_toggleSystemEntityCreation(!0),u}toJSON(n){if(!this.config.enabled)return this.configDefault;const r=this.authenticator.getStrategies();return{...this.config,...this.authenticator.toJSON(n),strategies:sn(r,s=>({enabled:this.isStrategyEnabled(s),...s.toJSON(n)}))}}};K(vw,"usersFields",P0e);let yx=vw;const L0e=new zr("system.access.api");class F0e extends ky{constructor(t,n){super(),this.ctx=t,this.config=n}get em(){return this.ctx.em}get guard(){return this.ctx.guard}entityExists(t){try{return!!this.em.entity(t)}catch{return!1}}getController(){const{permission:t,auth:n}=this.middlewares,r=this.create().use(n(),t(L0e)),s=this.getEntitiesEnum(this.em);function i(o,a){const c=a;return c.description=o,c}return r.get("/",Kt({summary:"Retrieve data configuration",tags:["data"]}),i("data info",o=>o.json(this.em.toJSON()))),r.get("/sync",t(fz),Kt({summary:"Sync database schema",tags:["data"]}),qt("query",Qe({force:Wt(),drop:Wt()}).partial()),async o=>{const{force:a,drop:c}=o.req.valid("query"),u=await this.em.schema().introspect(),f=await this.em.schema().sync({force:a,drop:c});return o.json({tables:u.map(h=>h.name),changes:f})}),r.get("/schema.json",t(uo),Kt({summary:"Retrieve data schema",tags:["data"]}),async o=>{const a=`${this.config.basepath}/schema.json`,c=Object.fromEntries(this.em.entities.map(u=>[u.name,{$ref:`${this.config.basepath}/schemas/${u.name}`}]));return o.json({$schema:"https://json-schema.org/draft/2020-12/schema",$id:a,properties:c})}),r.get("/schemas/:entity/:context?",t(uo),Kt({summary:"Retrieve entity schema",tags:["data"]}),qt("param",Qe({entity:s,context:xe({enum:["create","update"],default:"create"}).optional()})),async o=>{const{entity:a,context:c}=o.req.param();if(!this.entityExists(a))return this.notFound(o);const u=this.em.entity(a),f=u.toSchema({context:c}),m=`${new URL(o.req.url).origin}${this.config.basepath}`,y=`${this.config.basepath}/schemas/${a}`;return o.json({$schema:`${m}/schema.json`,$id:y,title:u.label,$comment:u.config.description,...f})}),r.route("/entity",this.getEntityRoutes()),r.get("/info/:entity",t(uo),Kt({summary:"Retrieve entity info",tags:["data"]}),qt("param",Qe({entity:s})),async o=>{const{entity:a}=o.req.param();if(!this.entityExists(a))return this.notFound(o);const c=this.em.entity(a),u=c.fields.map(h=>h.name),f=h=>h.map(m=>({entity:m.other(c).entity.name,ref:m.other(c).reference}));return o.json({name:c.name,fields:u,relations:{all:f(this.em.relations.relationsOf(c)),listable:f(this.em.relations.listableRelationsOf(c)),source:f(this.em.relations.sourceRelationsOf(c)),target:f(this.em.relations.targetRelationsOf(c))}})}),r}getEntityRoutes(){const{permission:t}=this.middlewares,n=this.create(),r=this.getEntitiesEnum(this.em),s=Zt([Rt(),xe()],{coerce:c=>c});n.post("/:entity/fn/count",t(uo),Kt({summary:"Count entities",tags:["data"]}),qt("param",Qe({entity:r})),qt("json",Ys.properties.where),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=c.req.valid("json"),h=await this.em.repository(u).count(f);return c.json({entity:u,...h.data})}),n.post("/:entity/fn/exists",t(uo),Kt({summary:"Check if entity exists",tags:["data"]}),qt("param",Qe({entity:r})),qt("json",Ys.properties.where),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=c.req.valid("json"),h=await this.em.repository(u).exists(f);return c.json({entity:u,...h.data})});const i=Qe({...Cs(Ys.properties,["with"]),sort:xe({default:"id"}),select:un(xe()),join:un(xe())}).partial(),o=(c=Object.keys(Ys.properties))=>{var u;return[...(u=_le(i,"query").parameters)==null?void 0:u.filter(f=>c.includes(f.name))]};n.get("/:entity",Kt({summary:"Read many",parameters:o(["limit","offset","sort","select","join"]),tags:["data"]}),t(uo),qt("param",Qe({entity:r})),qt("query",Ys,{skipOpenAPI:!0}),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=c.req.valid("query"),h=await this.em.repository(u).findMany(f);return c.json(h,{status:h.data?200:404})}),n.get("/:entity/:id",Kt({summary:"Read one",parameters:o(["offset","sort","select"]),tags:["data"]}),t(uo),qt("param",Qe({entity:r,id:s})),qt("query",Ys,{skipOpenAPI:!0}),async c=>{const{entity:u,id:f}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const h=c.req.valid("query"),m=await this.em.repository(u).findId(f,h);return c.json(m,{status:m.data?200:404})}),n.get("/:entity/:id/:reference",Kt({summary:"Read many by reference",parameters:o(),tags:["data"]}),t(uo),qt("param",Qe({entity:r,id:s,reference:xe()})),qt("query",Ys,{skipOpenAPI:!0}),async c=>{const{entity:u,id:f,reference:h}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const m=c.req.valid("query"),y=await this.em.repository(u).findManyByReference(f,h,m);return c.json(y,{status:y.data?200:404})});const a=Qe({...i.properties,with:Qe({})}).partial();return n.post("/:entity/query",Kt({summary:"Query entities",requestBody:{content:{"application/json":{schema:a.toJSON(),example:a.template({withOptional:!0})}}},tags:["data"]}),t(uo),qt("param",Qe({entity:r})),qt("json",Ys,{skipOpenAPI:!0}),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=c.req.valid("json"),h=await this.em.repository(u).findMany(f);return c.json(h,{status:h.data?200:404})}),n.post("/:entity",Kt({summary:"Insert one or many",tags:["data"]}),t(C1),qt("param",Qe({entity:r})),qt("json",Zt([Qe({}),un(Qe({}))])),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=await c.req.json();if(Array.isArray(f)){const m=await this.em.mutator(u).insertMany(f);return c.json(m,201)}const h=await this.em.mutator(u).insertOne(f);return c.json(h,201)}),n.patch("/:entity",Kt({summary:"Update many",tags:["data"]}),t(HC),qt("param",Qe({entity:r})),qt("json",Qe({update:Qe({}),where:Ys.properties.where})),async c=>{const{entity:u}=c.req.param();if(!this.entityExists(u))return this.notFound(c);const{update:f,where:h}=await c.req.json(),m=await this.em.mutator(u).updateWhere(f,h);return c.json(m)}),n.patch("/:entity/:id",Kt({summary:"Update one",tags:["data"]}),t(HC),qt("param",Qe({entity:r,id:s})),qt("json",Qe({})),async c=>{const{entity:u,id:f}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const h=await c.req.json(),m=await this.em.mutator(u).updateOne(f,h);return c.json(m)}),n.delete("/:entity/:id",Kt({summary:"Delete one",tags:["data"]}),t(WC),qt("param",Qe({entity:r,id:s})),async c=>{const{entity:u,id:f}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const h=await this.em.mutator(u).deleteOne(f);return c.json(h)}),n.delete("/:entity",Kt({summary:"Delete many",tags:["data"]}),t(WC),qt("param",Qe({entity:r})),qt("json",Ys.properties.where),async c=>{const{entity:u}=c.req.valid("param");if(!this.entityExists(u))return this.notFound(c);const f=await c.req.json(),h=await this.em.mutator(u).deleteWhere(f);return c.json(h)}),n}}const ZC={...Hme,...tge,media:{schema:XB,field:Rg}},B0e=YB,Yz=Zw(ZC,(e,t)=>st({name:xe().optional(),type:ti(t),config:e.schema.optional()},{title:t})),N$=Zt(Object.values(Yz)),Jz=Vi(N$),_$=st({name:xe().optional(),type:xe({enum:Wme,default:"regular"}),config:HB,fields:Jz}),C$=Object.entries(YB).map(([e,t])=>st({type:ti(e),source:xe(),target:xe(),config:t.schema.optional()},{title:e})),z0e=st({entity:xe(),fields:un(xe(),{minItems:1}),unique:Wt({default:!1}).optional()}),V0e=st({basepath:xe({default:"/api/data"}).optional(),default_primary_format:xe({enum:n$,default:"integer"}).optional(),entities:Vi(_$,{default:{}}).optional(),relations:Vi(Zt(C$),{default:{}}).optional(),indices:Vi(z0e,{default:{}}).optional()});function O$(e,t){const n=sn(t.fields??{},(r,s)=>{const{type:i}=r;if(!(i in ZC))throw new Error(`Field type "${i}" not found`);const{field:o}=ZC[i];return new o(s,r.config)});return new dc(e,Object.values(n),t.config,t.type)}function Xz(e,t){return new B0e[e.type].cls(t(e.source),t(e.target),e.config)}class U0e extends Ry{async build(){const{entities:t={},relations:n={},indices:r={}}=this.config,s=sn(t,(c,u)=>O$(u,c)),i=c=>{const u=typeof c=="string"?c:c.name,f=s[u];if(f)return f;throw new Error(`[AppData] Entity "${u}" not found`)},o=sn(n,c=>Xz(c,i)),a=sn(r,(c,u)=>{const f=i(c.entity),h=c.fields.map(m=>f.field(m));return new iB(f,h,c.unique,u)});for(const c of Object.values(s))this.ctx.em.addEntity(c);for(const c of Object.values(o))this.ctx.em.addRelation(c);for(const c of Object.values(a))this.ctx.em.addIndex(c);this.ctx.server.route(this.basepath,new F0e(this.ctx,this.config).getController()),this.ctx.guard.registerPermissions(Object.values(Gge)),this.setBuilt()}async onBeforeUpdate(t,n){const r={from:Object.keys(t.entities??{}),to:Object.keys(n.entities??{})};if(r.from.length-r.to.length>1)throw new Error("Cannot remove more than one entity at a time");return n}getSchema(){return V0e}get em(){return this.throwIfNotBuilt(),this.ctx.em}get basepath(){return this.config.basepath??"/api/data"}getOverwritePaths(){return[/^entities\..*\.config$/,/^entities\..*\.fields\..*\.config$/]}toJSON(t){return{...this.config,...this.em.toJSON()}}}class uI{constructor(t={},n={}){this.variables=t,this.options=n}another(){return 1}static hasMarkup(t){let n="";if(Array.isArray(t)||typeof t=="object"){if(!["Array","Object"].includes(t.constructor.name))return!1;n=JSON.stringify(t)}else n=String(t);return["{{"].some(s=>n.includes(s))}async render(t){if(typeof t>"u"||t===null)return t;if(typeof t=="string")return await this.renderString(t);if(Array.isArray(t))return await Promise.all(t.map(n=>this.render(n)));if(typeof t=="object")return await this.renderObject(t);throw new Error("Invalid template type")}async renderString(t){return t.replace(/{{\s*([^{}]+?)\s*}}/g,(n,r)=>{const s=Ag(this.variables,r.trim());return s==null?"":String(s)})}async renderObject(t){const n={};for(const[r,s]of Object.entries(t)){let i=r;this.options.renderKeys&&(i=await this.renderString(r)),n[i]=await this.render(s)}return n}}const Bm=(e,t)=>e,pg=class pg{constructor(t,n){K(this,"name");K(this,"_params");if(typeof t!="string")throw new Error(`Task name must be a string, got ${typeof t}`);this.name=t;const r=this.constructor.schema;if(r===pg.schema&&typeof n<"u"&&Object.keys(n||{}).length>0)throw new Error(`Task "${t}" has no schema defined but params passed: ${JSON.stringify(n)}`);this._params=Ln(r,n||{})}get params(){return this._params}clone(t,n){return new this.constructor(t,n)}static async resolveParams(t,n,r={}){const s={},i=new uI(r,{renderKeys:!0});for(const[o,a]of Object.entries(n)){if(a&&uI.hasMarkup(a)){try{s[o]=await i.render(a)}catch(c){throw c instanceof Mf?c:new Mf("Failed to resolve param",{key:o,value:a,error:c.message},"resolve-params")}continue}s[o]=a}return t.coerce(s)}async cloneWithResolvedParams(t){const n=Object.fromEntries(t.entries()),r=await pg.resolveParams(this.constructor.schema,this._params,n);return this.clone(this.name,r)}async run(t=new Map){const n=new Date;let r,s,i,o;const a=performance.now();try{const c=await this.cloneWithResolvedParams(t);o=c.params,r=await c.execute(t),i=!0}catch(c){i=!1,c instanceof Mf?s=c.toJSON():s={type:"unknown",message:c.message}}return{start:n,output:r,error:s,success:i,params:o,time:performance.now()-a}}error(t,n){return new Mf(t,n,"runtime")}get label(){return this.name}toJSON(){return{type:this.type,params:this.params}}};K(pg,"schema",ai());let Ah=pg;const wN=["GET","POST","PUT","PATCH","DELETE"];class j$ extends Ah{constructor(){super(...arguments);K(this,"type","fetch")}getBody(){const n=this.params.body;if(n){if(typeof n=="string")return n;if(typeof n=="object")return JSON.stringify(n);throw new Error(`Invalid body type: ${typeof n}`)}}async execute(){var o;if(!wN.includes(this.params.method??"GET"))throw this.error("Invalid method",{given:this.params.method,valid:wN});const n=this.getBody(),r=new Headers((o=this.params.headers)==null?void 0:o.map(a=>[a.key,a.value])),s=await fetch(this.params.url,{method:this.params.method??"GET",headers:r,body:n});if(!s.ok)throw this.error("Failed to fetch",{status:s.status,statusText:s.statusText});return await s.json()}}K(j$,"schema",st({url:xe({pattern:"^(http|https)://"}),method:Bm(xe({enum:wN,default:"GET"})).optional(),headers:Bm(un(st({key:xe(),value:xe()}))).optional(),body:Bm(xe()).optional(),normal:Bm(Rt()).optional()}));class Kz extends Ah{constructor(){super(...arguments);K(this,"type","log")}async execute(){return await new Promise(n=>setTimeout(n,this.params.delay)),pt.log(`[DONE] LogTask: ${this.name}`),!0}}K(Kz,"schema",st({delay:Rt({default:10})}));class Qz extends Ah{constructor(){super(...arguments);K(this,"type","render")}async execute(){return this.params.render}}K(Qz,"schema",st({render:xe()}));class Zz{constructor(t,n,r,s){K(this,"source");K(this,"target");K(this,"config");K(this,"id");this.source=t,this.target=n,this.config=r??{},this.config.condition instanceof go||(this.config.condition=go.default()),this.id=s??iae()}get condition(){return this.config.condition}get max_retries(){return this.config.max_retries??0}toJSON(){var t;return xg({source:this.source.name,target:this.target.name,config:{...this.config,condition:(t=this.config.condition)==null?void 0:t.toJSON()}})}}class go{constructor(t,n="",r=void 0){this.type=t,this.path=n,this.value=r}static default(){return go.success()}static success(){return new go("success")}static error(){return new go("error")}static matches(t,n){if(typeof t!="string"||t.length===0)throw new Error("Invalid path");return new go("matches",t,n)}isMet(t){switch(this.type){case"success":return t.success;case"error":return t.success===!1;case"matches":return Ag(t.output,this.path)===this.value}}sameAs(t=go.default()){return this.type===t.type&&this.path===t.path&&this.value===t.value}toJSON(){return{type:this.type,path:this.path.length===0?void 0:this.path,value:this.value}}static fromObject(t){return new go(t.type,t.path,t.value)}}class Ev extends Hr{task(){return this.params.task}getState(){return this.succeeded()?"success":this.failed()?"failed":this.isStart()?"running":"idle"}isStart(){return this.params.end===void 0}isEnd(){return!this.isStart()}succeeded(){var t;return this.isEnd()&&((t=this.params.result)==null?void 0:t.success)}failed(){var t;return this.isEnd()&&!((t=this.params.result)!=null&&t.success)}}K(Ev,"slug","flow-execution-event");class Nv extends Hr{}K(Nv,"slug","flow-execution-state");const xw=class xw{constructor(t){K(this,"flow");K(this,"started_at");K(this,"finished_at");K(this,"logs",[]);K(this,"inputs",new Map);K(this,"queue",[]);K(this,"emgr");this.flow=t,this.logs=[],this.queue=[this.flow.startTask],this.emgr=new jy(xw.Events)}subscribe(t){this.emgr.onAny(t)}async onDone(t,n){const r=new Date;if(this.logs.push({...n,task:t,end:r}),this.inputs.set(t.name,n),this.flow.respondingTask===t){this.queue=[];return}this.queue=this.queue.filter(i=>i!==t);const s=this.flow.task(t).getOutConnections(n).filter(i=>{var u;const o=i.target,a=this.logs.filter(f=>f.task===o&&f.success).length,c=((u=this.flow.task(o).getInConnections().find(f=>f.source===t))==null?void 0:u.max_retries)??0;if(a>c)throw new Error(`Task "${o.name}" reached max retries (${a}/${c})`);return this.flow.task(o).getInTasks(!0).every(f=>this.logs.some(h=>h.task===f&&h.end!==void 0))}).map(i=>i.target);this.queue.push(...s)}__getLastTaskLog(t){var n;for(let r=this.logs.length-1;r>=0;r--)if(((n=this.logs[r])==null?void 0:n.task)===t)return this.logs[r];return null}async run(){const t=this.queue;if(t.length===0)return;const n=t.map(async r=>{await this.emgr.emit(new Ev({task:r}));const s=await r.run(this.inputs);return await this.emgr.emit(new Ev({task:r,result:s,end:new Date})),await this.onDone(r,s),s});try{return await Promise.all(n),this.run()}catch(r){throw pt.error("RuntimeExecutor: error",r),r}}async start(t){await this.emgr.emit(new Nv({execution:this,state:"started"})),this.inputs.set("flow",{start:new Date,output:t,error:void 0,success:!0,params:t}),this.started_at=new Date,await this.run(),this.finished_at=new Date,await this.emgr.emit(new Nv({execution:this,state:"ended"}))}finished(){return this.finished_at!==void 0}errorCount(){return this.logs.filter(t=>!t.success).length}hasErrors(){return this.errorCount()>0}getErrorLogs(){return this.logs.filter(t=>!t.success)}getErrors(){return this.getErrorLogs().map(t=>t.error)}getResponse(){let t=this.flow.respondingTask;t||(t=this.flow.tasks[this.flow.tasks.length-1]);const n=this.__getLastTaskLog(t);if(n)return n.output}};K(xw,"Events",{ExecutionEvent:Ev,ExecutionState:Nv});let eO=xw;class A${constructor(t,n){K(this,"flow");K(this,"source");this.flow=t,this.source=n}task(t){return new A$(this.flow,t)}asInputFor(t,n,r){const s=this.getDepth(),i=this.getOutConnections(),o=i.map(c=>c.condition),a=i.some(c=>this.task(c.target).getDepth()<=s);if(o.length>0&&a&&this.getOutConnections().some(c=>c.condition.sameAs(n)))throw new Error("Task cannot be connected to a deeper task with the same condition");this.flow.addConnection(new Zz(this.source,t,{condition:n,max_retries:r}))}asOutputFor(t,n){this.task(t).asInputFor(this.source,n)}getNext(){return this.flow.connections.filter(t=>t.source===this.source).map(t=>t.target)}getDepth(){return this.flow.getSequence().findIndex(t=>t.includes(this.source))}getInConnections(t=!1){if(t){const n=this.getDepth();return this.getInConnections().filter(r=>r.target===this.source&&this.task(r.source).getDepth()<n)}return this.flow.connections.filter(n=>n.target===this.source)}getInTasks(t=!1){if(t){const n=this.getDepth();return this.getInConnections().map(r=>r.source).filter(r=>this.task(r).getDepth()<n)}return this.getInConnections().map(n=>n.source)}getOutConnections(t){return t?this.flow.connections.filter(n=>n.source===this.source&&n.condition.isMet(t)):this.flow.connections.filter(n=>n.source===this.source)}getOutTasks(t){return this.getOutConnections(t).map(n=>n.target)}}class rd{constructor(t){K(this,"executions",[]);K(this,"type","manual");K(this,"config");const n=this.constructor.schema;this.config=Ln(n,t??{})}async register(t,...n){this.executions.push(await t.start())}toJSON(){return{type:this.type,config:this.config}}}K(rd,"schema",st({mode:xe({enum:["sync","async"],default:"async"})}));class By{constructor(t,n,r,s){K(this,"name");K(this,"trigger");K(this,"tasks",[]);K(this,"connections",[]);K(this,"respondingTask");K(this,"startTask");K(this,"sequence");this.name=t,this.trigger=s??new rd,n.map(i=>this.addTask(i)),this.connections=r||[],this.startTask=n[0],this.sequence=this.getSequence()}setStartTask(t){return this.startTask=t,this.sequence=this.getSequence(),this}getSequence(t=[]){if(t.length===0)return t.push([this.startTask]),this.getSequence(t);const n=t[t.length-1],r=[];return n==null||n.forEach(s=>{this.task(s).getOutTasks().forEach(o=>{t.some(a=>a.includes(o))||r.push(o)})}),r.length===0?t:(t.push(r),this.getSequence(t))}addTask(t){if(this.tasks.includes(t))throw new Error("Task already defined");if(this.tasks.some(n=>n.name===t.name))throw new Error(`Task with name "${t.name}" already defined. Use a unique name.`);return this.tasks.push(t),this}setRespondingTask(t){if(!this.tasks.includes(t))throw new Error(`Cannot set task "${t.name}" as responding, not registered.`);return this.respondingTask=t,this}addConnection(t){if(this.connections.some(r=>r.source===t.source&&r.target===t.target&&r.condition[0]===t.condition[0]&&r.condition[1]===t.condition[1]))throw new Error("Connection already defined");return this.connections.push(t),this}task(t){return new A$(this,t)}createExecution(){return this.sequence=this.getSequence(),new eO(this)}async start(t=void 0){const n=this.createExecution();return await n.start(t),n}toJSON(){var t,n;return{trigger:this.trigger.toJSON(),tasks:Object.fromEntries(this.tasks.map(r=>[r.name,r.toJSON()])),connections:Object.fromEntries(this.connections.map(r=>[r.id,r.toJSON()])),start_task:(t=this.startTask)==null?void 0:t.name,responding_task:(n=this.respondingTask)==null?void 0:n.name}}static fromObject(t,n,r){var c;const s=sn(n.tasks??{},(u,f)=>{const h=r[u.type];if(!h)throw new Error(`Task ${f} not found in taskMap`);try{const m=h.cls;return new m(f,u.params)}catch(m){throw pt.error("Error creating task",f,u.type,u,h),new Error(`Error creating task ${u.type}: ${m.message}`)}}),i=sn(n.connections??{},(u,f)=>{const h=u.config.condition?go.fromObject(u.config.condition):void 0;return new Zz(s[u.source],s[u.target],{...u.config,condition:h},f)});let o;if(n.trigger){const u=(c=T$[n.trigger.type])==null?void 0:c.cls;u&&(o=new u(n.trigger.config))}const a=new By(t,Object.values(s),Object.values(i),o);return a.startTask=n.start_task?s[n.start_task]:null,n.responding_task&&(a.respondingTask=s[n.responding_task]),a}}class eV extends Ah{constructor(){super(...arguments);K(this,"type","subflow")}async execute(){const n=this.params.flow;if(!(n instanceof By))throw new Error("Invalid flow provided");if(this.params.loop){const s=Array.isArray(this.params.input)?this.params.input:[this.params.input],i=[];for(const o of s){const a=n.createExecution();await a.start(o),i.push(await a.getResponse())}return i}const r=n.createExecution();return await r.start(this.params.input),r.getResponse()}}K(eV,"schema",st({flow:ai(),input:Bm(ai()).optional(),loop:Wt().optional()}));class tV extends rd{constructor(){super(...arguments);K(this,"type","event")}async register(n,r){if(!r.eventExists(this.config.event))throw new Error(`Event ${this.config.event} is not registered.`);r.on(this.config.event,async s=>{const i=n.createExecution();this.executions.push(i);try{await i.start(s.params)}catch(o){pt.error(o)}},this.config.mode)}}K(tV,"schema",st({event:xe(),...rd.schema.properties}));const q0e=["GET","POST","PUT","PATCH","DELETE"];class $$ extends rd{constructor(){super(...arguments);K(this,"type","http")}async register(n,r){const s=this.config.method.toLowerCase();r[s](this.config.path,async i=>{const o=i.req.raw,a=i[this.config.response_type],c=n.createExecution();if(this.executions.push(c),this.config.mode==="sync"){await c.start(o);const u=c.getResponse(),f=c.getErrors();return f.length>0?i.json({success:!1,errors:f}):a(u)}return c.start(o),i.json({success:!0})})}}K($$,"schema",st({path:xe({pattern:"^/.*$"}),method:xe({enum:q0e,default:"GET"}),response_type:xe({enum:["json","text","html"],default:"json"}),...rd.schema.properties}));const T$={manual:{cls:rd},event:{cls:tV},http:{cls:$$}},nV={fetch:{cls:j$},log:{cls:Kz},render:{cls:Qz},subflow:{cls:eV}},rV={...nV},sV=T$,iV=sn(rV,(e,t)=>st({type:ti(t),params:e.cls.schema},{title:String(t)}));Zt(Object.values(iV));const oV=sn(sV,(e,t)=>st({type:ti(t),config:e.cls.schema.optional()},{title:String(t)}));Zt(Object.values(oV));const H0e=st({source:xe(),target:xe(),config:st({condition:Zt([st({type:ti("success")},{title:"success"}),st({type:ti("error")},{title:"error"}),st({type:ti("matches"),path:xe(),value:xe()},{title:"matches"})]),max_retries:Rt()}).partial()}),aV=st({trigger:Zt(Object.values(oV)),tasks:Vi(Zt(Object.values(iV))).optional(),connections:Vi(H0e).optional(),start_task:xe().optional(),responding_task:xe().optional()}),W0e=st({basepath:xe({default:"/api/flows"}),flows:Vi(aV,{default:{}})});class G0e extends Ry{constructor(){super(...arguments);K(this,"flows",{})}getSchema(){return W0e}getFlowInfo(n){return{...n.toJSON(),tasks:n.tasks.length,connections:n.connections}}async build(){const n=sn(this.config.flows,(s,i)=>By.fromObject(i,s,rV));this.flows=n;const r=new _1;r.get("/",async s=>{const i=sn(this.flows,o=>this.getFlowInfo(o));return s.json(i)}),r.get("/flow/:name",async s=>{var o;const i=s.req.param("name");return s.json((o=this.flows[i])==null?void 0:o.toJSON())}),r.get("/flow/:name/run",async s=>{const i=s.req.param("name"),o=this.flows[i],a=o.createExecution(),c=performance.now();await a.start();const u=performance.now()-c,f=a.getErrors();return s.json({success:f.length===0,time:u,errors:f,response:a.getResponse(),flow:this.getFlowInfo(o),logs:a.logs})}),r.all("*",s=>s.notFound()),this.ctx.server.route(this.config.basepath,r);for(const[s,i]of Object.entries(this.flows)){const o=i.trigger;switch(!0){case o instanceof $$:await o.register(i,this.ctx.server);break}}this.setBuilt()}toJSON(){return{...this.config,flows:sn(this.flows,n=>n.toJSON())}}}class R$ extends Hr{validate(t){if(typeof t!="object")throw new a1("object",typeof t);return this.clone({...t,...this.params})}}K(R$,"slug","file-uploaded");class M$ extends Hr{}K(M$,"slug","file-deleted");class k$ extends Hr{}K(k$,"slug","file-access");const Y0e=Object.freeze(Object.defineProperty({__proto__:null,FileAccessEvent:k$,FileDeletedEvent:M$,FileUploadedEvent:R$},Symbol.toStringTag,{value:"Module"}));var mo;const ww=class ww{constructor(t,n={},r){Fe(this,mo);K(this,"emgr");K(this,"config");Be(this,mo,t),this.config={...n,body_max_size:n.body_max_size&&n.body_max_size>0?n.body_max_size:void 0},this.emgr=r??new jy,this.emgr.registerEvents(ww.Events)}getAdapter(){return G(this,mo)}async objectMetadata(t){return await G(this,mo).getObjectMeta(t)}getConfig(){return this.config}async uploadFile(t,n,r){const s=await G(this,mo).putObject(n,t);if(typeof s>"u")throw new Error("Failed to upload file");let i={name:n,meta:{size:0,type:"application/octet-stream"},etag:typeof s=="string"?s:""};if(typeof s=="object"?i=s:hd(t)&&(i.meta.size=t.size,i.meta.type=t.type),!IL(i.meta.type,["application/octet-stream","application/json"])){const a=await G(this,mo).getObjectMeta(n);if(!a)throw new Error("Failed to get object meta");i.meta=a}if(i.meta.type.startsWith("image")&&(!i.meta.width||!i.meta.height))try{const a=await Xie(t);i.meta={...i.meta,...a}}catch(a){pt.warn("Failed to get image dimensions",a)}const o={file:t,...i,state:{name:i.name,path:i.name}};if(!r){const a=await this.emgr.emit(new R$(o));if(a.returned)return a.params}return o}async deleteFile(t){await G(this,mo).deleteObject(t),await this.emgr.emit(new M$({name:t}))}async fileExists(t){return await G(this,mo).objectExists(t)}};mo=new WeakMap,K(ww,"Events",Y0e);let eg=ww;const lV=new zr("media.file.read"),cV=new zr("media.file.list"),tO=new zr("media.file.upload"),uV=new zr("media.file.delete"),J0e=Object.freeze(Object.defineProperty({__proto__:null,deleteFile:uV,listFiles:cV,readFile:lV,uploadFile:tO},Symbol.toStringTag,{value:"Module"}));function X0e(e){var n;if(!e.includes("."))return;const t=e.split(".");return(n=t[t.length-1])==null?void 0:n.toLowerCase()}function dI(e,t=16){const n=typeof e=="string"?e:e.name;if(typeof n!="string")throw console.error("Couldn't extract filename from",e),new Error("Invalid file name");let r=X0e(n);if(!r&&hd(e)&&e.type){const s=DL(e.type);s.length>0&&(r=s)}return[OL(t),r].filter(Boolean).join(".")}class K0e extends ky{constructor(t){super(),this.media=t}getStorageAdapter(){return this.getStorage().getAdapter()}getStorage(){return this.media.storage}getController(){const{auth:t,permission:n}=this.middlewares,r=this.create().use(t()),s=this.getEntitiesEnum(this.media.em);r.get("/files",Kt({summary:"Get the list of files",tags:["media"]}),n(cV),async a=>{const c=await this.getStorageAdapter().listObjects();return a.json(c)}),r.get("/file/:filename",Kt({summary:"Get a file by name",tags:["media"]}),n(lV),async a=>{const{filename:c}=a.req.param();if(!c)throw new Error("No file name provided");await this.getStorage().emgr.emit(new k$({name:c}));const u=await this.getStorageAdapter().getObject(c,a.req.raw.headers),f=new Headers(u.headers);return f.set("Cache-Control","public, max-age=31536000, immutable"),new Response(u.body,{status:u.status,statusText:u.statusText,headers:f})}),r.delete("/file/:filename",Kt({summary:"Delete a file by name",tags:["media"]}),n(uV),async a=>{const{filename:c}=a.req.param();if(!c)throw new Error("No file name provided");return await this.getStorage().deleteFile(c),a.json({message:"File deleted"})});const i=this.getStorage().getConfig().body_max_size??Number.POSITIVE_INFINITY;qr()&&r.post("/inspect",Kt({summary:"Inspect a file",tags:["media"]}),async a=>{const c=await rN(a);return a.json({type:c==null?void 0:c.type,name:c==null?void 0:c.name,size:c==null?void 0:c.size})});const o={content:{"multipart/form-data":{schema:{type:"object",properties:{file:{type:"string",format:"binary"}},required:["file"]}},"application/octet-stream":{schema:{type:"string",format:"binary"}}}};return r.post("/upload/:filename?",Kt({summary:"Upload a file",tags:["media"],requestBody:o}),qt("param",Qe({filename:xe().optional()})),n(tO),async a=>{const c=a.req.param("filename"),u=await rN(a);if(!u)return a.json({error:"No file provided"},fn.BAD_REQUEST);if(u.size>i)return a.json({error:`Max size (${i} bytes) exceeded`},fn.PAYLOAD_TOO_LARGE);const f=c??dI(u),h=await this.getStorage().uploadFile(u,f);return a.json(h,fn.CREATED)}),r.post("/entity/:entity/:id/:field",Kt({summary:"Add a file to an entity",tags:["media"],requestBody:o}),qt("param",Qe({entity:s,id:Rt(),field:xe()})),qt("query",Qe({overwrite:Wt().optional()})),n([C1,tO]),async a=>{const c=a.req.param("entity"),u=a.req.param("field"),f=Number.parseInt(a.req.param("id")),h=this.media.em.entity(c);if(!h)return a.json({error:`Entity "${c}" not found`},fn.NOT_FOUND);const m=h.field(u);if(!m||!(m instanceof Rg))return a.json({error:`Invalid field "${u}"`},fn.BAD_REQUEST);const y=this.media.getMediaEntity().name,v=`${c}.${u}`,x={scope:u,reference:v,entity_id:f},E=m.getMaxItems(),N=[];if(E){const{overwrite:M}=a.req.valid("query"),{data:{count:D}}=await this.media.em.repository(y).count(x);if(D>=E){if(!M)return a.json({error:`Max items (${E}) reached`},fn.BAD_REQUEST);if(D>E)return a.json({error:`Max items (${E}) exceeded already with ${D} items.`},fn.UNPROCESSABLE_ENTITY);const P=await this.media.em.repo(y).findMany({select:["path"],where:x,sort:{by:"id",dir:"asc"},limit:D-E+1});P.data&&P.data.length>0&&P.data.map(F=>N.push(F.path))}}const{data:{exists:_}}=await this.media.em.repository(h).exists({id:f});if(!_)return a.json({error:`Entity "${c}" with ID "${f}" doesn't exist found`},fn.NOT_FOUND);const C=await rN(a);if(!C)return a.json({error:"No file provided"},fn.BAD_REQUEST);if(C.size>i)return a.json({error:`Max size (${i} bytes) exceeded`},fn.PAYLOAD_TOO_LARGE);const j=dI(C),A=await this.getStorage().uploadFile(C,j,!0),$=this.media.em.mutator(y);$.__unstable_toggleSystemEntityCreation(!1);const R=await $.insertOne({...this.media.uploadedEventDataToMediaPayload(A),...x});if($.__unstable_toggleSystemEntityCreation(!0),N.length>0)for(const M of N)await this.getStorage().deleteFile(M);return a.json({ok:!0,result:R.data,...A},fn.CREATED)}),r}}class Q0e{constructor(t){K(this,"is_set",!1);K(this,"items",{});this.registerFn=t}set(t){if(this.is_set)throw new Error("Registry is already set");return this.items=t,this.is_set=!0,this}add(t,n){return this.items[t]=n,this}register(t,n){if(this.registerFn){const r=this.registerFn(n);return this.items[t]=r,this}return this.add(t,n)}get(t){return this.items[t]}has(t){return t in this.items}all(){return this.items}}/**
 * @license MIT <https://opensource.org/licenses/MIT>
 * @copyright Michael Hart 2024
 */const nO=new TextEncoder,Z0e={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},ebe=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);let tbe=class{constructor({accessKeyId:t,secretAccessKey:n,sessionToken:r,service:s,region:i,cache:o,retries:a,initRetryMs:c}){if(t==null)throw new TypeError("accessKeyId is a required option");if(n==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=t,this.secretAccessKey=n,this.sessionToken=r,this.service=s,this.region=i,this.cache=o||new Map,this.retries=a??10,this.initRetryMs=c||50}async sign(t,n){if(t instanceof Request){const{method:i,url:o,headers:a,body:c}=t;n=Object.assign({method:i,url:o,headers:a},n),n.body==null&&a.has("Content-Type")&&(n.body=c!=null&&a.has("X-Amz-Content-Sha256")?c:await t.clone().arrayBuffer()),t=o}const r=new nbe(Object.assign({url:t.toString()},n,this,n&&n.aws)),s=Object.assign({},n,await r.sign());delete s.aws;try{return new Request(s.url.toString(),s)}catch(i){if(i instanceof TypeError)return new Request(s.url.toString(),Object.assign({duplex:"half"},s));throw i}}async fetch(t,n){for(let r=0;r<=this.retries;r++){const s=fetch(await this.sign(t,n));if(r===this.retries)return s;const i=await s;if(i.status<500&&i.status!==429)return i;await new Promise(o=>setTimeout(o,Math.random()*this.initRetryMs*Math.pow(2,r)))}throw new Error("An unknown error occurred, ensure retries is not negative")}};class nbe{constructor({method:t,url:n,headers:r,body:s,accessKeyId:i,secretAccessKey:o,sessionToken:a,service:c,region:u,cache:f,datetime:h,signQuery:m,appendSessionToken:y,allHeaders:v,singleEncode:x}){if(n==null)throw new TypeError("url is a required option");if(i==null)throw new TypeError("accessKeyId is a required option");if(o==null)throw new TypeError("secretAccessKey is a required option");this.method=t||(s?"POST":"GET"),this.url=new URL(n),this.headers=new Headers(r||{}),this.body=s,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=a;let E,N;(!c||!u)&&([E,N]=rbe(this.url,this.headers)),this.service=c||E||"",this.region=u||N||"us-east-1",this.cache=f||new Map,this.datetime=h||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=m,this.appendSessionToken=y||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");const _=this.signQuery?this.url.searchParams:this.headers;if(_.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&_.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(j=>v||!ebe.has(j)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(j=>j+":"+(j==="host"?this.url.host:(this.headers.get(j)||"").replace(/\s+/g," "))).join(`
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!_.has("X-Amz-Expires")&&_.set("X-Amz-Expires","86400"),_.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),_.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),_.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");x||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=pI(this.encodedPath);const C=new Set;this.encodedSearch=[...this.url.searchParams].filter(([j])=>{if(!j)return!1;if(this.service==="s3"){if(C.has(j))return!1;C.add(j)}return!0}).map(j=>j.map(A=>pI(encodeURIComponent(A)))).sort(([j,A],[$,R])=>j<$?-1:j>$?1:A<R?-1:A>R?1:0).map(j=>j.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const t=this.datetime.slice(0,8),n=[this.secretAccessKey,t,this.region,this.service].join();let r=this.cache.get(n);if(!r){const s=await Nm("AWS4"+this.secretAccessKey,t),i=await Nm(s,this.region),o=await Nm(i,this.service);r=await Nm(o,"aws4_request"),this.cache.set(n,r)}return SN(await Nm(r,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,SN(await fI(await this.canonicalString()))].join(`
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
`,this.signedHeaders,await this.hexBodyHash()].join(`
`)}async hexBodyHash(){let t=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(t==null){if(this.body&&typeof this.body!="string"&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");t=SN(await fI(this.body||""))}return t}}async function Nm(e,t){const n=await crypto.subtle.importKey("raw",typeof e=="string"?nO.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,nO.encode(t))}async function fI(e){return crypto.subtle.digest("SHA-256",typeof e=="string"?nO.encode(e):e)}const hI=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function SN(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++){const s=t[r];n+=hI[s>>>4&15],n+=hI[s&15]}return n}function pI(e){return e.replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function rbe(e,t){const{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){const a=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){const a=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}const s=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/);let i=s&&s[1]||"",o=s&&s[2];if(o==="us-gov")o="us-gov-west-1";else if(o==="s3"||o==="s3-accelerate")o="us-east-1",i="s3";else if(i==="iot")n.startsWith("iot.")?i="execute-api":n.startsWith("data.jobs.iot.")?i="iot-jobs-data":i=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){const a=(t.get("X-Amz-Target")||"").split(".")[0];a==="AnyScaleFrontendService"?i="application-autoscaling":a==="AnyScaleScalingPlannerFrontendService"&&(i="autoscaling-plans")}else o==null&&i.startsWith("s3-")?(o=i.slice(3).replace(/^fips-|^external-1/,""),i="s3"):i.endsWith("-fips")?i=i.slice(0,-5):o&&/-\d$/.test(i)&&!/-\d$/.test(o)&&([i,o]=[o,i]);return[Z0e[i]||i,o||""]}var Wu;class sbe extends tbe{constructor(n,r){super(n);Fe(this,Wu);Be(this,Wu,r??{responseType:"json"})}convertParams(n){switch(G(this,Wu).convertParams){case"pascalToKebab":return oC(n);default:return n}}getUrl(n="/",r={}){const s=new URL(n),i=this.convertParams(r);return Object.entries(i).forEach(([o,a])=>{s.searchParams.append(o,a)}),s.toString()}updateKeysRecursively(n,r){return n==null?n:Array.isArray(n)?n.map(s=>this.updateKeysRecursively(s,r)):typeof n=="object"?Object.keys(n).reduce((s,i)=>{let o=i;return i.indexOf(" ")===-1&&(o=i.charAt(0)[r]()+i.slice(1)),s[o]=this.updateKeysRecursively(n[i],r),s},{}):n}async fetchJson(n,r){const s=await this.fetch(n,r);if(G(this,Wu).responseType==="xml"){if(!s.ok){const a=await s.text();throw new Error(a)}const o=await s.text();return Xoe(o)}if(!s.ok){const o=await s.json();throw new Error(o.message)}const i=await s.json();return G(this,Wu).responseKeysToUpper?this.updateKeysRecursively(i,"toUpperCase"):i}}Wu=new WeakMap;const mI=Symbol.for("bknd:storage");class dV{constructor(){this[mI]=!0}static isAdapter(t){return t?t[mI]===!0:!1}}const gI=Qe({access_key:xe(),secret_access_key:xe(),url:xe({pattern:"^https?://(?:.*)?[^/.]+$",description:"URL to S3 compatible endpoint without trailing slash",examples:["https://{account_id}.r2.cloudflarestorage.com/{bucket}","https://{bucket}.s3.{region}.amazonaws.com"]})},{title:"AWS S3",description:"AWS S3 or compatible storage"});var ph;class fV extends dV{constructor(n){super();Fe(this,ph);K(this,"client");this.client=new sbe({accessKeyId:n.access_key,secretAccessKey:n.secret_access_key,retries:qr()?0:10},{convertParams:"pascalToKebab",responseType:"xml"}),Be(this,ph,Ln(gI,n))}getName(){return"s3"}getSchema(){return gI}getUrl(n="",r={}){let s=this.getObjectUrl("").slice(0,-1);return n.length>0&&(s+=`/${n}`),this.client.getUrl(s,r)}getObjectUrl(n){return`${G(this,ph).url}/${n}`}async listObjects(n=""){const r={ListType:2,Prefix:n},s=this.getUrl("",r),i=await this.client.fetchJson(s,{method:"GET"}),{Contents:o}=i.ListBucketResult,a=o?Array.isArray(o)?o:[o]:[];return Zs(a,(u,f)=>{f.Key&&f.LastModified&&f.Size&&u.push({key:f.Key,last_modified:f.LastModified,size:f.Size})},[])}async putObject(n,r,s={}){const i=this.getUrl(n,{}),o=await this.client.fetch(i,{method:"PUT",body:r,headers:hd(r)?{"Content-Length":String(r.size)}:{}});if(!o.ok)throw new Error(`Failed to upload object: ${o.status} ${o.statusText}`);return String(o.headers.get("etag"))}async headObject(n,r={}){const s=this.getUrl(n,{});return await this.client.fetch(s,{method:"HEAD",headers:{Range:"bytes=0-1"}})}async getObjectMeta(n){var o;const r=await this.headObject(n),s=String(r.headers.get("content-type")),i=Number(String((o=r.headers.get("content-range"))==null?void 0:o.split("/")[1]));return{type:s,size:i}}async objectExists(n,r={}){return(await this.headObject(n)).ok}async getObject(n,r){const s=this.getUrl(n),i=await this.client.fetch(s,{method:"GET",headers:Zie(r,["if-none-match","accept-encoding","accept","if-modified-since"])});return new Response(i.body,{status:i.status,statusText:i.statusText,headers:i.headers})}async deleteObject(n,r={}){const s=this.getUrl(n,r);await this.client.fetch(s,{method:"DELETE"})}toJSON(n){return{type:this.getName(),config:n?G(this,ph):void 0}}}ph=new WeakMap;const yI=Qe({cloud_name:xe(),api_key:xe(),api_secret:xe(),upload_preset:xe().optional()},{title:"Cloudinary",description:"Cloudinary media storage"});class hV extends dV{constructor(n){super();K(this,"config");this.config=Ln(yI,n)}getSchema(){return yI}getMimeType(n){switch(!0){case(n.format==="jpeg"||n.format==="jpg"):return"image/jpeg"}return`${n.resource_type}/${n.format}`}getName(){return"cloudinary"}getAuthorizationHeader(){return{Authorization:`Basic ${btoa(`${this.config.api_key}:${this.config.api_secret}`)}`}}async putObject(n,r){const s=n.replace(/\.[a-z0-9]{2,5}$/,""),i=new FormData;i.append("file",r),i.append("public_id",s),i.append("api_key",this.config.api_key),this.config.upload_preset&&i.append("upload_preset",this.config.upload_preset);const o=await fetch(`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/auto/upload`,{method:"POST",headers:{Accept:"application/json"},body:i});if(!o.ok)return;const a=await o.json();return{name:a.public_id+"."+a.format,etag:a.etag,meta:{type:this.getMimeType(a),size:a.bytes}}}async listObjects(n){const r=await fetch(`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/resources/search`,{method:"GET",headers:{Accept:"application/json","Cache-Control":"no-cache",...this.getAuthorizationHeader()}});if(!r.ok)throw new Error("Failed to list objects");return(await r.json()).resources.map(o=>({key:o.public_id,last_modified:new Date(o.uploaded_at),size:o.bytes}))}async headObject(n){const r=this.getObjectUrl(n);return await fetch(r,{method:"HEAD",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:"0",Range:"bytes=0-1"}})}async objectExists(n){return(await this.headObject(n)).ok}async getObjectMeta(n){var s;const r=await this.headObject(n);if(r.ok){const i=r.headers.get("content-type"),o=Number((s=r.headers.get("content-range"))==null?void 0:s.split("/")[1]);return{type:i,size:o}}throw new Error("Cannot get object meta")}guessType(n){const r={image:["jpg","jpeg","png","gif","webp","svg"],video:["mp4","webm","ogg"]},s=n.split(".").pop();return Object.keys(r).find(i=>r[i].includes(s))}getObjectUrl(n){const r=this.guessType(n)??"image";return`https://res.cloudinary.com/${this.config.cloud_name}/${r}/upload/${n}`}async generateSignature(n,r){const s=n.timestamp??Math.floor(Date.now()/1e3),i=Object.entries({...n,timestamp:s}).sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>`${a}=${c}`).join("&");return{signature:await zL.sha1(i+(r??this.config.api_secret)),timestamp:s}}filenameToPublicId(n){return n.split(".").slice(0,-1).join(".")}async getObject(n,r){const s=await fetch(this.getObjectUrl(n),{method:"GET",headers:Qie(r,["range"])});return new Response(s.body,{status:s.status,statusText:s.statusText,headers:s.headers})}async deleteObject(n){const r=this.guessType(n)??"image",s=this.filenameToPublicId(n),{timestamp:i,signature:o}=await this.generateSignature({public_id:s}),a=new FormData;a.append("public_id",s),a.append("timestamp",String(i)),a.append("signature",o),a.append("api_key",this.config.api_key);const c=`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/${r}/destroy`,u=await fetch(c,{headers:{Accept:"application/json","Cache-Control":"no-cache",...this.getAuthorizationHeader()},method:"POST",body:a});if(!u.ok)throw new Error(`Failed to delete object: ${u.status} ${u.statusText}`)}toJSON(n){return{type:"cloudinary",config:n?this.config:{cloud_name:this.config.cloud_name}}}}const ibe=new Q0e(e=>({cls:e,schema:e.prototype.getSchema()})).register("s3",fV).register("cloudinary",hV);fV.prototype.getSchema(),hV.prototype.getSchema();const obe={media:ibe},pV=obe.media;function mV(){const e=Zw(pV.all(),(t,n)=>{var r,s;return st({type:ti(n),config:t.schema},{title:((r=t.schema)==null?void 0:r.title)??n,description:(s=t.schema)==null?void 0:s.description})});return st({enabled:Wt({default:!1}),basepath:xe({default:"/api/media"}),entity_name:xe({default:"media"}),storage:st({body_max_size:Rt({description:"Max size of the body in bytes. Leave blank for unlimited."}).optional()},{default:{}}),adapter:Zt(Object.values(e)).optional()},{default:{}})}mV();const abe={path:ba().required(),folder:uge({default_value:!1,hidden:!0,fillable:["create"]}),mime_type:ba(),size:BC(),scope:ba({hidden:!0,fillable:["create"]}),etag:ba(),modified_at:zC(),reference:ba(),entity_id:BC(),metadata:dge()},Sw=class Sw extends Ry{constructor(){super(...arguments);K(this,"_storage")}async build(){if(!this.config.enabled){this.setBuilt();return}if(!this.config.adapter){console.info("No storage adapter provided, skip building media.");return}let n;try{const{type:r,config:s}=this.config.adapter,i=pV.get(r).cls;n=new i(s),this._storage=new eg(n,this.config.storage,this.ctx.emgr),this.setBuilt(),this.setupListeners(),this.ctx.guard.registerPermissions(J0e),this.ctx.server.route(this.basepath,new K0e(this).getController());const o=this.getMediaEntity(!0);this.ctx.helper.ensureSchema(KB({[o.name]:o},({index:a},{media:c})=>{a(c).on(["path"],!0).on(["reference"]).on(["entity_id"])}))}catch(r){throw console.error(r),new Error(`Could not build adapter with config ${JSON.stringify(this.config.adapter)}`)}}getSchema(){return mV()}get basepath(){return this.config.basepath}get storage(){return this.throwIfNotBuilt(),this._storage}uploadedEventDataToMediaPayload(n){const r={};return n.meta.width&&n.meta.height&&(r.width=n.meta.width,r.height=n.meta.height),{path:n.name,mime_type:n.meta.type,size:n.meta.size,etag:n.etag,modified_at:new Date,metadata:r}}getMediaEntity(n){const r=this.config.entity_name;return n||!this.em.hasEntity(r)?g$(r,Sw.mediaFields,void 0,"system"):this.em.entity(r)}get em(){return this.ctx.em}setupListeners(){const{emgr:n,em:r}=this.ctx,s=this.getMediaEntity().name;n.onEvent(eg.Events.FileUploadedEvent,async i=>{const o=r.mutator(s);o.__unstable_toggleSystemEntityCreation(!1);const a=this.uploadedEventDataToMediaPayload(i.params),{data:c}=await o.insertOne(a);return o.__unstable_toggleSystemEntityCreation(!0),{data:c}},{mode:"sync",id:"add-data-media"}),n.onEvent(eg.Events.FileDeletedEvent,async i=>{const{data:o}=await r.repo(s).findOne({path:i.params.name});o&&await r.mutator(s).deleteOne(o.id),pt.log("App:storage:file deleted",i.params)},{mode:"sync",id:"delete-data-media"})}getOverwritePaths(){return[/^\.?adapter$/]}toJSON(n){return!this.isBuilt()||!this.config.enabled?this.configDefault:{...this.config,adapter:this.storage.getAdapter().toJSON(n)}}};K(Sw,"mediaFields",abe);let rO=Sw;const gV={server:Uge,data:U0e,auth:yx,media:rO,flows:G0e},lbe=Zt([yV(),un(st({t:xe({enum:["a","r","e"]}),p:un(Zt([xe(),Rt()])),o:ai().optional(),n:ai().optional()}))]);g$(Lge,{version:BC().required(),type:VC({enum:["config","diff","backup"]}).required(),json:fge({schema:lbe.toJSON()}).required(),created_at:zC(),updated_at:zC()});_L("modules_debug");function yV(){return{type:"object",...sn(gV,t=>t.prototype.getSchema())}}function cbe(){const e=sn(gV,t=>t.prototype.getSchema().template({},{withOptional:!0,withExtendedOptional:!0}));return structuredClone(e)}class j1{constructor(t={},n){K(this,"fetcher");this._options=t,this.fetcher=n??fetch}getDefaultOptions(){return{}}get options(){return{host:"http://localhost",token:void 0,...this.getDefaultOptions(),...this._options}}key(){return this.options.basepath??""}getUrl(t){const n=this.options.basepath??"";return this.options.host+(n+"/"+t).replace(/\/{2,}/g,"/").replace(/\/$/,"")}request(t,n,r){const s=(r==null?void 0:r.method)??"GET",i=Array.isArray(t)?t.join("/"):t;let o=this.getUrl(i);n instanceof URLSearchParams?o+="?"+n.toString():typeof n=="object"&&Object.keys(n).length>0&&(o+="?"+t1(n));const a=new Headers(this.options.headers??{});for(const[f,h]of Object.entries((r==null?void 0:r.headers)??{}))a.set(f,h);a.has("Accept")||a.set("Accept","application/json"),this.options.token&&this.options.token_transport==="header"&&a.set("Authorization",`Bearer ${this.options.token}`);let c=r==null?void 0:r.body;if(r&&"body"in r&&["POST","PATCH","PUT"].includes(s)){const f=a.get("Content-Type")??void 0;(!f||f.startsWith("application/json")||FA(c))&&(c=JSON.stringify(r.body),a.set("Content-Type","application/json"))}const u=new Request(o,{...r,method:s,body:c,headers:a});return new bx(u,{fetcher:this.fetcher,verbose:this.options.verbose})}get(t,n,r){return this.request(t,n,{...r,method:"GET"})}post(t,n,r){return this.request(t,void 0,{...r,body:n,method:"POST"})}patch(t,n,r){return this.request(t,void 0,{...r,body:n,method:"PATCH"})}put(t,n,r){return this.request(t,void 0,{...r,body:n,method:"PUT"})}delete(t,n,r){return this.request(t,void 0,{...r,body:n,method:"DELETE"})}}function ube(e,t,n){let r=typeof n<"u"?n:t;const s=["raw","body","ok","status","res","data","toJSON"];return typeof r!="object"&&(r={}),new Proxy(r,{get(i,o,a){return o==="raw"||o==="res"?e:o==="body"?t:o==="data"?n:o==="ok"?e.ok:o==="status"?e.status:o==="toJSON"?()=>i:Reflect.get(i,o,a)},has(i,o){return s.includes(o)?!0:Reflect.has(i,o)},ownKeys(i){return Array.from(new Set([...Reflect.ownKeys(i),...s]))},getOwnPropertyDescriptor(i,o){return s.includes(o)?{configurable:!0,enumerable:!0,value:Reflect.get({raw:e,body:t,ok:e.ok,status:e.status},o)}:Reflect.getOwnPropertyDescriptor(i,o)}})}var e8;e8=Symbol.toStringTag;const O5=class O5{constructor(t,n,r){K(this,e8);this.request=t,this.options=n,this.refineData=r}get verbose(){var t;return((t=this.options)==null?void 0:t.verbose)??!1}refine(t){return new O5(this.request,this.options,t)}async execute(){var o;qr()&&await new Promise(a=>setTimeout(a,200));const t=((o=this.options)==null?void 0:o.fetcher)??fetch;this.verbose&&pt.debug("[FetchPromise] Request",{method:this.request.method,url:this.request.url});const n=await t(this.request);this.verbose&&pt.debug("[FetchPromise] Response",{res:n,ok:n.ok,status:n.status});let r,s;const i=n.headers.get("Content-Type")??"";if(i.startsWith("application/json")?(r=await n.json(),typeof r=="object"&&(s="data"in r?r.data:r)):i.startsWith("text")?r=await n.text():r=n.body,this.refineData)try{s=this.refineData(s)}catch(a){console.warn("[FetchPromise] Error in refineData",a),s=void 0}return ube(n,r,s)}then(t,n){return this.execute().then(t,n)}catch(t){return this.then(void 0,t)}finally(t){return this.then(n=>(t==null||t(),n),n=>{throw t==null||t(),n})}path(){return new URL(this.request.url).pathname}key(t){const n=new URL(this.request.url);return(t==null?void 0:t.search)!==!1?this.path()+n.search:this.path()}keyArray(t){const n=new URL(this.request.url),r=this.path().split("/");return((t==null?void 0:t.search)!==!1?[...r,n.searchParams.toString()]:r).filter(Boolean)}toString(){return this.key({search:!0})}toJSON(){return{url:this.request.url,method:this.request.method}}};let bx=O5;class dbe extends j1{getDefaultOptions(){return{basepath:"/api/auth",credentials:"include"}}async login(t,n){var s,i;const r=await this.post([t,"login"],n,{credentials:this.options.credentials});return r.ok&&r.body.token&&await((i=(s=this.options).onTokenUpdate)==null?void 0:i.call(s,r.body.token)),r}async register(t,n){var s,i;const r=await this.post([t,"register"],n,{credentials:this.options.credentials});return r.ok&&r.body.token&&await((i=(s=this.options).onTokenUpdate)==null?void 0:i.call(s,r.body.token)),r}async actionSchema(t,n){return this.get([t,"actions",n,"schema.json"])}async action(t,n,r){return this.post([t,"actions",n],r)}async loginWithPassword(t){return this.login("password",t)}async registerWithPassword(t){return this.register("password",t)}me(){return this.get(["me"])}strategies(){return this.get(["strategies"])}async logout(){var t,n;await((n=(t=this.options).onTokenUpdate)==null?void 0:n.call(t,void 0))}}class fbe extends j1{getDefaultOptions(){return{basepath:"/api/data",queryLengthLimit:1e3,defaultQuery:{limit:10}}}requireObjectSet(t,n){if(!t||typeof t!="object"||Object.keys(t).length===0)throw new Error(n??"object is required")}readOne(t,n,r={}){return this.get(["entity",t,n],r)}readOneBy(t,n={}){return this.readMany(t,{...n,limit:1,offset:0}).refine(r=>r[0])}readMany(t,n={}){const r=n??this.options.defaultQuery,s=this.get(["entity",t],r);return s.request.url.length<=this.options.queryLengthLimit?s:this.post(["entity",t,"query"],r)}readManyByReference(t,n,r,s={}){return this.get(["entity",t,n,r],s??this.options.defaultQuery)}createOne(t,n){return this.post(["entity",t],n)}createMany(t,n){if(!n||!Array.isArray(n)||n.length===0)throw new Error("input is required");return this.post(["entity",t],n)}updateOne(t,n,r){if(!n)throw new Error("ID is required");return this.patch(["entity",t,n],r)}updateMany(t,n,r){return this.requireObjectSet(n),this.patch(["entity",t],{update:r,where:n})}deleteOne(t,n){if(!n)throw new Error("ID is required");return this.delete(["entity",t,n])}deleteMany(t,n){return this.requireObjectSet(n),this.delete(["entity",t],n)}count(t,n={}){return this.post(["entity",t,"fn","count"],n)}exists(t,n={}){return this.post(["entity",t,"fn","exists"],n)}}class hbe extends j1{getDefaultOptions(){return{basepath:"/api/media",upload_fetcher:fetch,init:{}}}listFiles(){return this.get(["files"])}getFile(t){return this.get(["file",t],void 0,{headers:{Accept:"*/*"}})}async getFileStream(t){const{res:n}=await this.getFile(t);if(!n.ok||!n.body)throw new Error("Failed to fetch file");return n.body}async download(t){const{res:n}=await this.getFile(t);if(!n.ok||!n.body)throw new Error("Failed to fetch file");return await n.blob()}getFileUploadUrl(t){return t?this.getUrl(`/upload/${t.path}`):this.getUrl("/upload")}getEntityUploadUrl(t,n,r){return this.getUrl(`/entity/${t}/${n}/${r}`)}getUploadHeaders(){return this.options.token_transport==="header"&&this.options.token?new Headers({Authorization:`Bearer ${this.options.token}`}):new Headers}uploadFile(t,n){var o;const r={"Content-Type":"application/octet-stream",...((o=n==null?void 0:n._init)==null?void 0:o.headers)||{}};let s=(n==null?void 0:n.filename)||"";try{typeof t.type<"u"&&(r["Content-Type"]=t.type),n!=null&&n.filename||(s=t.name)}catch{}s&&s.length>0&&s.includes("/")&&(s=s.split("/").pop()||"");const i={...this.options.init,...(n==null?void 0:n._init)||{},headers:r};if(n!=null&&n.path)return this.post(n.path,t,i);if(!s||s.length===0)throw new Error("Invalid filename");return this.post((n==null?void 0:n.path)??["upload",s],t,i)}async upload(t,n={}){var r;if(t instanceof Request||typeof t=="string"){const i=await(n.fetcher??this.options.upload_fetcher)(t);if(!i.ok||!i.body)throw new Error("Failed to fetch file");return this.uploadFile(i.body,n)}else if(t instanceof Response){if(!t.body)throw new Error("Invalid response");return this.uploadFile(t.body,{...n??{},_init:{...n._init??{},headers:{...((r=n._init)==null?void 0:r.headers)??{},"Content-Type":t.headers.get("Content-Type")||"application/octet-stream"}}})}return this.uploadFile(t,n)}async uploadToEntity(t,n,r,s,i){return this.upload(s,{...i,path:["entity",t,n,r]})}deleteFile(t){return this.delete(["file",t])}}class pbe extends j1{getDefaultOptions(){return{basepath:"/api/system"}}readConfig(){return this.get("config")}readSchema(t){return this.get("schema",{config:t!=null&&t.config?1:0,secrets:t!=null&&t.secrets?1:0,fresh:t!=null&&t.fresh?1:0})}setConfig(t,n,r){return this.post(["config","set",t].join("/")+`?force=${r?1:0}`,n)}addConfig(t,n,r){return this.post(["config","add",t,n],r)}patchConfig(t,n,r){return this.patch(["config","patch",t,n],r)}overwriteConfig(t,n,r){return this.put(["config","overwrite",t,n],r)}removeConfig(t,n){return this.delete(["config","remove",t,n])}}class bV{constructor(t={}){K(this,"token");K(this,"user");K(this,"verified",!1);K(this,"token_transport","header");K(this,"system");K(this,"data");K(this,"auth");K(this,"media");this.options=t,this.verified=t.verified===!0,"request"in t&&t.request?(this.options.host=t.host??new URL(t.request.url).origin,this.options.headers=t.headers??t.request.headers,this.extractToken()):"token"in t&&t.token?(this.token_transport="header",this.updateToken(t.token,{trigger:!1})):"user"in t&&t.user?(this.token_transport="none",this.user=t.user,this.verified=t.verified!==!1):this.extractToken(),this.buildApis()}get fetcher(){return this.options.fetcher??fetch}get baseUrl(){return this.options.host??"http://localhost"}get tokenKey(){return this.options.key??"auth"}extractToken(){var t;if(this.verified=!1,this.options.headers){const n=mbe(this.options.headers.get("cookie"),"auth");if(n){this.token_transport="cookie",this.updateToken(n);return}const r=(t=this.options.headers.get("authorization"))==null?void 0:t.replace("Bearer ","");if(r){this.token_transport="header",this.updateToken(r);return}}else this.storage&&this.storage.getItem(this.tokenKey).then(n=>{this.token_transport="header",this.updateToken(n?String(n):void 0)})}get storage(){return this.options.storage?{getItem:async t=>await this.options.storage.getItem(t),setItem:async(t,n)=>await this.options.storage.setItem(t,n),removeItem:async t=>await this.options.storage.removeItem(t)}:null}updateToken(t,n){var r,s;if(this.token=t,this.verified=!1,t?this.user=Cs(bye(t).payload,["iat","iss","exp"]):this.user=void 0,this.storage){const i=this.tokenKey;t?this.storage.setItem(i,t).then(()=>{var o,a;(a=(o=this.options).onAuthStateChange)==null||a.call(o,this.getAuthState())}):this.storage.removeItem(i).then(()=>{var o,a;(a=(o=this.options).onAuthStateChange)==null||a.call(o,this.getAuthState())})}else(n==null?void 0:n.trigger)!==!1&&((s=(r=this.options).onAuthStateChange)==null||s.call(r,this.getAuthState()));n!=null&&n.rebuild&&this.buildApis()}markAuthVerified(t){return this.verified=t,this}isAuthVerified(){return this.verified}getAuthState(){return{token:this.token,user:this.user,verified:this.verified}}isAuthenticated(){const{token:t,user:n}=this.getAuthState();return!!t&&!!n}async getVerifiedAuthState(){return await this.verifyAuth(),this.getAuthState()}async verifyAuth(){if(!this.token){this.markAuthVerified(!1);return}try{const{ok:t,data:n}=await this.auth.me(),r=n==null?void 0:n.user;if(!t||!r)throw new Error;this.user=r,this.markAuthVerified(!0)}catch{this.markAuthVerified(!1),this.updateToken(void 0)}}getUser(){return this.user||null}getParams(){return Object.freeze({host:this.baseUrl,token:this.token,headers:this.options.headers,token_transport:this.token_transport,verbose:this.options.verbose})}buildApis(){const t=this.getParams(),n=this.options.fetcher;this.system=new pbe(t,n),this.data=new fbe({...t,...this.options.data},n),this.auth=new dbe({...t,credentials:this.options.storage?"omit":"include",...this.options.auth,onTokenUpdate:r=>{var s,i;this.updateToken(r,{rebuild:!0}),(i=(s=this.options.auth)==null?void 0:s.onTokenUpdate)==null||i.call(s,r)}},n),this.media=new hbe({...t,...this.options.media},n)}}function mbe(e,t){if(!e)return null;for(const n of e.split("; ")){const[r,s]=n.split("=");if(r===t&&s)return decodeURIComponent(s)}return null}const I$=w.createContext(void 0),gbe=({children:e,host:t,baseUrl:n=t,...r})=>{const s=A1(),i=vV();let o=n??(i==null?void 0:i.baseUrl)??"",a;if(s&&(a=s.user),!o)try{o=window.location.origin}catch{}const c={user:a,...r,host:o},u=w.useMemo(()=>new bV({...c,verbose:qr(),onAuthStateChange:m=>{var y;(y=r.onAuthStateChange)==null||y.call(r,m),(!(f!=null&&f.token)||m.token!==(f==null?void 0:f.token))&&h(m)}}),[JSON.stringify(c)]),[f,h]=w.useState(c.user?u.getAuthState():void 0);return p.jsx(I$.Provider,{value:{baseUrl:u.baseUrl,api:u,authState:f},children:e})},Do=e=>{const t=w.useContext(I$);return!(t!=null&&t.api)||e?new bV({host:""}):t.api},vV=()=>w.useContext(I$);function A1(){const e={logout_route:"/api/auth/logout",admin_basepath:""};return typeof window<"u"&&window.__BKND__?{...e,...window.__BKND__}:e}var EN={exports:{}},NN={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var bI;function ybe(){if(bI)return NN;bI=1;var e=Hh();function t(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(h,m){var y=m(),v=r({inst:{value:y,getSnapshot:m}}),x=v[0].inst,E=v[1];return i(function(){x.value=y,x.getSnapshot=m,c(x)&&E({inst:x})},[h,y,m]),s(function(){return c(x)&&E({inst:x}),h(function(){c(x)&&E({inst:x})})},[h]),o(y),y}function c(h){var m=h.getSnapshot;h=h.value;try{var y=m();return!n(h,y)}catch{return!0}}function u(h,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return NN.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,NN}var vI;function xV(){return vI||(vI=1,EN.exports=ybe()),EN.exports}var D$=xV();const wV=0,SV=1,EV=2,xI=3;var wI=Object.prototype.hasOwnProperty;function sO(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&sO(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(wI.call(e,n)&&++r&&!wI.call(t,n)||!(n in t)||!sO(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const yo=new WeakMap,uc=()=>{},nr=uc(),iO=Object,yt=e=>e===nr,Ii=e=>typeof e=="function",Cc=(e,t)=>({...e,...t}),NV=e=>Ii(e.then),_N={},Ib={},P$="undefined",zy=typeof window!=P$,oO=typeof document!=P$,bbe=zy&&"Deno"in window,vbe=()=>zy&&typeof window.requestAnimationFrame!=P$,Vl=(e,t)=>{const n=yo.get(e);return[()=>!yt(t)&&e.get(t)||_N,r=>{if(!yt(t)){const s=e.get(t);t in Ib||(Ib[t]=s),n[5](t,Cc(s,r),s||_N)}},n[6],()=>!yt(t)&&t in Ib?Ib[t]:!yt(t)&&e.get(t)||_N]};let aO=!0;const xbe=()=>aO,[lO,cO]=zy&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[uc,uc],wbe=()=>{const e=oO&&document.visibilityState;return yt(e)||e!=="hidden"},Sbe=e=>(oO&&document.addEventListener("visibilitychange",e),lO("focus",e),()=>{oO&&document.removeEventListener("visibilitychange",e),cO("focus",e)}),Ebe=e=>{const t=()=>{aO=!0,e()},n=()=>{aO=!1};return lO("online",t),lO("offline",n),()=>{cO("online",t),cO("offline",n)}},Nbe={isOnline:xbe,isVisible:wbe},_be={initFocus:Sbe,initReconnect:Ebe},SI=!Re.useId,Pg=!zy||bbe,Cbe=e=>vbe()?window.requestAnimationFrame(e):setTimeout(e,1),_v=Pg?w.useEffect:w.useLayoutEffect,CN=typeof navigator<"u"&&navigator.connection,EI=!Pg&&CN&&(["slow-2g","2g"].includes(CN.effectiveType)||CN.saveData),Db=new WeakMap,ON=(e,t)=>iO.prototype.toString.call(e)===`[object ${t}]`;let Obe=0;const uO=e=>{const t=typeof e,n=ON(e,"Date"),r=ON(e,"RegExp"),s=ON(e,"Object");let i,o;if(iO(e)===e&&!n&&!r){if(i=Db.get(e),i)return i;if(i=++Obe+"~",Db.set(e,i),Array.isArray(e)){for(i="@",o=0;o<e.length;o++)i+=uO(e[o])+",";Db.set(e,i)}if(s){i="#";const a=iO.keys(e).sort();for(;!yt(o=a.pop());)yt(e[o])||(i+=o+":"+uO(e[o])+",");Db.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},Lg=e=>{if(Ii(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?uO(e):"",[e,t]};let jbe=0;const dO=()=>++jbe;async function _V(...e){const[t,n,r,s]=e,i=Cc({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const a=i.rollbackOnError;let c=i.optimisticData;const u=m=>typeof a=="function"?a(m):a!==!1,f=i.throwOnError;if(Ii(n)){const m=n,y=[],v=t.keys();for(const x of v)!/^\$(inf|sub)\$/.test(x)&&m(t.get(x)._k)&&y.push(x);return Promise.all(y.map(h))}return h(n);async function h(m){const[y]=Lg(m);if(!y)return;const[v,x]=Vl(t,y),[E,N,_,C]=yo.get(t),j=()=>{const H=E[y];return(Ii(i.revalidate)?i.revalidate(v().data,m):i.revalidate!==!1)&&(delete _[y],delete C[y],H&&H[0])?H[0](EV).then(()=>v().data):v().data};if(e.length<3)return j();let A=r,$;const R=dO();N[y]=[R,0];const M=!yt(c),D=v(),P=D.data,F=D._c,V=yt(F)?P:F;if(M&&(c=Ii(c)?c(V,P):c,x({data:c,_c:V})),Ii(A))try{A=A(V)}catch(H){$=H}if(A&&NV(A))if(A=await A.catch(H=>{$=H}),R!==N[y][0]){if($)throw $;return A}else $&&M&&u($)&&(o=!0,x({data:V,_c:nr}));if(o&&!$)if(Ii(o)){const H=o(A,V);x({data:H,error:nr,_c:nr})}else x({data:A,error:nr,_c:nr});if(N[y][1]=dO(),Promise.resolve(j()).then(()=>{x({_c:nr})}),$){if(f)throw $;return}return A}}const NI=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Abe=(e,t)=>{if(!yo.has(e)){const n=Cc(_be,t),r=Object.create(null),s=_V.bind(nr,e);let i=uc;const o=Object.create(null),a=(f,h)=>{const m=o[f]||[];return o[f]=m,m.push(h),()=>m.splice(m.indexOf(h),1)},c=(f,h,m)=>{e.set(f,h);const y=o[f];if(y)for(const v of y)v(h,m)},u=()=>{if(!yo.has(e)&&(yo.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Pg)){const f=n.initFocus(setTimeout.bind(nr,NI.bind(nr,r,wV))),h=n.initReconnect(setTimeout.bind(nr,NI.bind(nr,r,SV)));i=()=>{f&&f(),h&&h(),yo.delete(e)}}};return u(),[e,s,u,i]}return[e,yo.get(e)[4]]},$be=(e,t,n,r,s)=>{const i=n.errorRetryCount,o=s.retryCount,a=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!yt(i)&&o>i||setTimeout(r,a,s)},Tbe=sO,[L$,F$]=Abe(new Map),Rbe=Cc({onLoadingSlow:uc,onSuccess:uc,onError:uc,onErrorRetry:$be,onDiscarded:uc,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:EI?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:EI?5e3:3e3,compare:Tbe,isPaused:()=>!1,cache:L$,mutate:F$,fallback:{}},Nbe),Mbe=(e,t)=>{const n=Cc(e,t);if(t){const{use:r,fallback:s}=e,{use:i,fallback:o}=t;r&&i&&(n.use=r.concat(i)),s&&o&&(n.fallback=Cc(s,o))}return n},kbe=w.createContext({}),CV="$inf$",OV=zy&&window.__SWR_DEVTOOLS_USE__,Ibe=OV?window.__SWR_DEVTOOLS_USE__:[],Dbe=()=>{OV&&(window.__SWR_DEVTOOLS_REACT__=Re)},jV=e=>Ii(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],AV=()=>Cc(Rbe,w.useContext(kbe)),Pbe=e=>(t,n,r)=>e(t,n&&((...i)=>{const[o]=Lg(t),[,,,a]=yo.get(L$);if(o.startsWith(CV))return n(...i);const c=a[o];return yt(c)?n(...i):(delete a[o],c)}),r),Lbe=Ibe.concat(Pbe),Fbe=e=>function(...n){const r=AV(),[s,i,o]=jV(n),a=Mbe(r,o);let c=e;const{use:u}=a,f=(u||[]).concat(Lbe);for(let h=f.length;h--;)c=f[h](c);return c(s,i||a.fetcher||null,a)},Bbe=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}},zbe=(e,t)=>(...n)=>{const[r,s,i]=jV(n),o=(i.use||[]).concat(t);return e(r,s,{...i,use:o})};Dbe();const jN=Re.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),AN={dedupe:!0},Vbe=(e,t,n)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:h,keepPreviousData:m}=n,[y,v,x,E]=yo.get(r),[N,_]=Lg(e),C=w.useRef(!1),j=w.useRef(!1),A=w.useRef(N),$=w.useRef(t),R=w.useRef(n),M=()=>R.current,D=()=>M().isVisible()&&M().isOnline(),[P,F,V,H]=Vl(r,N),I=w.useRef({}).current,B=yt(o)?yt(n.fallback)?nr:n.fallback[N]:o,T=(Ce,Me)=>{for(const Ve in I){const We=Ve;if(We==="data"){if(!s(Ce[We],Me[We])&&(!yt(Ce[We])||!s(se,Me[We])))return!1}else if(Me[We]!==Ce[We])return!1}return!0},L=w.useMemo(()=>{const Ce=!N||!t?!1:yt(a)?M().isPaused()||i?!1:c!==!1:a,Me=Q=>{const ye=Cc(Q);return delete ye._k,Ce?{isValidating:!0,isLoading:!0,...ye}:ye},Ve=P(),We=H(),$e=Me(Ve),J=Ve===We?$e:Me(We);let te=$e;return[()=>{const Q=Me(P());return T(Q,te)?(te.data=Q.data,te.isLoading=Q.isLoading,te.isValidating=Q.isValidating,te.error=Q.error,te):(te=Q,Q)},()=>J]},[r,N]),z=D$.useSyncExternalStore(w.useCallback(Ce=>V(N,(Me,Ve)=>{T(Ve,Me)||Ce()}),[r,N]),L[0],L[1]),q=!C.current,k=y[N]&&y[N].length>0,W=z.data,X=yt(W)?B&&NV(B)?jN(B):B:W,ne=z.error,re=w.useRef(X),se=m?yt(W)?yt(re.current)?X:re.current:W:X,fe=k&&!yt(ne)?!1:q&&!yt(a)?a:M().isPaused()?!1:i?yt(X)?!1:c:yt(X)||c,he=!!(N&&t&&q&&fe),ue=yt(z.isValidating)?he:z.isValidating,ve=yt(z.isLoading)?he:z.isLoading,Se=w.useCallback(async Ce=>{const Me=$.current;if(!N||!Me||j.current||M().isPaused())return!1;let Ve,We,$e=!0;const J=Ce||{},te=!x[N]||!J.dedupe,Q=()=>SI?!j.current&&N===A.current&&C.current:N===A.current,ye={isValidating:!1,isLoading:!1},ce=()=>{F(ye)},ae=()=>{const de=x[N];de&&de[1]===We&&delete x[N]},ie={isValidating:!0};yt(P().data)&&(ie.isLoading=!0);try{if(te&&(F(ie),n.loadingTimeout&&yt(P().data)&&setTimeout(()=>{$e&&Q()&&M().onLoadingSlow(N,n)},n.loadingTimeout),x[N]=[Me(_),dO()]),[Ve,We]=x[N],Ve=await Ve,te&&setTimeout(ae,n.dedupingInterval),!x[N]||x[N][1]!==We)return te&&Q()&&M().onDiscarded(N),!1;ye.error=nr;const de=v[N];if(!yt(de)&&(We<=de[0]||We<=de[1]||de[1]===0))return ce(),te&&Q()&&M().onDiscarded(N),!1;const be=P().data;ye.data=s(be,Ve)?be:Ve,te&&Q()&&M().onSuccess(Ve,N,n)}catch(de){ae();const be=M(),{shouldRetryOnError:Ae}=be;be.isPaused()||(ye.error=de,te&&Q()&&(be.onError(de,N,be),(Ae===!0||Ii(Ae)&&Ae(de))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||D())&&be.onErrorRetry(de,N,be,Ie=>{const ht=y[N];ht&&ht[0]&&ht[0](xI,Ie)},{retryCount:(J.retryCount||0)+1,dedupe:!0})))}return $e=!1,ce(),!0},[N,r]),ke=w.useCallback((...Ce)=>_V(r,A.current,...Ce),[]);if(_v(()=>{$.current=t,R.current=n,yt(W)||(re.current=W)}),_v(()=>{if(!N)return;const Ce=Se.bind(nr,AN);let Me=0;M().revalidateOnFocus&&(Me=Date.now()+M().focusThrottleInterval);const We=Bbe(N,y,($e,J={})=>{if($e==wV){const te=Date.now();M().revalidateOnFocus&&te>Me&&D()&&(Me=te+M().focusThrottleInterval,Ce())}else if($e==SV)M().revalidateOnReconnect&&D()&&Ce();else{if($e==EV)return Se();if($e==xI)return Se(J)}});return j.current=!1,A.current=N,C.current=!0,F({_k:_}),fe&&(yt(X)||Pg?Ce():Cbe(Ce)),()=>{j.current=!0,We()}},[N]),_v(()=>{let Ce;function Me(){const We=Ii(u)?u(P().data):u;We&&Ce!==-1&&(Ce=setTimeout(Ve,We))}function Ve(){!P().error&&(f||M().isVisible())&&(h||M().isOnline())?Se(AN).then(Me):Me()}return Me(),()=>{Ce&&(clearTimeout(Ce),Ce=-1)}},[u,f,h,N]),w.useDebugValue(se),i&&yt(X)&&N){if(!SI&&Pg)throw new Error("Fallback data is required when using Suspense in SSR.");$.current=t,R.current=n,j.current=!1;const Ce=E[N];if(!yt(Ce)){const Me=ke(Ce);jN(Me)}if(yt(ne)){const Me=Se(AN);yt(se)||(Me.status="fulfilled",Me.value=!0),jN(Me)}else throw ne}return{mutate:ke,get data(){return I.data=!0,se},get error(){return I.error=!0,ne},get isValidating(){return I.isValidating=!0,ue},get isLoading(){return I.isLoading=!0,ve}}},B$=Fbe(Vbe),Ube=()=>{},qbe=Ube(),fO=Object,_I=e=>e===qbe,Hbe=e=>typeof e=="function",Pb=new WeakMap,$N=(e,t)=>fO.prototype.toString.call(e)===`[object ${t}]`;let Wbe=0;const hO=e=>{const t=typeof e,n=$N(e,"Date"),r=$N(e,"RegExp"),s=$N(e,"Object");let i,o;if(fO(e)===e&&!n&&!r){if(i=Pb.get(e),i)return i;if(i=++Wbe+"~",Pb.set(e,i),Array.isArray(e)){for(i="@",o=0;o<e.length;o++)i+=hO(e[o])+",";Pb.set(e,i)}if(s){i="#";const a=fO.keys(e).sort();for(;!_I(o=a.pop());)_I(e[o])||(i+=o+":"+hO(e[o])+",");Pb.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},Gbe=e=>{if(Hbe(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?hO(e):"",[e,t]},Ybe=e=>Gbe(e?e(0,null):null)[0],TN=Promise.resolve(),Jbe=e=>(t,n,r)=>{const s=w.useRef(!1),{cache:i,initialSize:o=1,revalidateAll:a=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:f=!1,parallel:h=!1}=r,[,,,m]=yo.get(L$);let y;try{y=Ybe(t),y&&(y=CV+y)}catch{}const[v,x,E]=Vl(i,y),N=w.useCallback(()=>yt(v()._l)?o:v()._l,[i,y,o]);D$.useSyncExternalStore(w.useCallback(M=>y?E(y,()=>{M()}):()=>{},[i,y]),N,N);const _=w.useCallback(()=>{const M=v()._l;return yt(M)?o:M},[y,o]),C=w.useRef(_());_v(()=>{if(!s.current){s.current=!0;return}y&&x({_l:c?C.current:_()})},[y,i]);const j=f&&!s.current,A=e(y,async M=>{const D=v()._i,P=v()._r;x({_r:nr});const F=[],V=_(),[H]=Vl(i,M),I=H().data,B=[];let T=null;for(let L=0;L<V;++L){const[z,q]=Lg(t(L,h?null:T));if(!z)break;const[k,W]=Vl(i,z);let X=k().data;const ne=a||D||yt(X)||u&&!L&&!yt(I)||j||I&&!yt(I[L])&&!r.compare(I[L],X);if(n&&(typeof P=="function"?P(X,q):ne)){const re=async()=>{if(!(z in m))X=await n(q);else{const fe=m[z];delete m[z],X=await fe}W({data:X,_k:q}),F[L]=X};h?B.push(re):await re()}else F[L]=X;h||(T=X)}return h&&await Promise.all(B.map(L=>L())),x({_i:nr}),F},r),$=w.useCallback(function(M,D){const P=typeof D=="boolean"?{revalidate:D}:D||{},F=P.revalidate!==!1;return y?(F&&(yt(M)?x({_i:!0,_r:P.revalidate}):x({_i:!1,_r:P.revalidate})),arguments.length?A.mutate(M,{...P,revalidate:F}):A.mutate()):TN},[y,i]),R=w.useCallback(M=>{if(!y)return TN;const[,D]=Vl(i,y);let P;if(Ii(M)?P=M(_()):typeof M=="number"&&(P=M),typeof P!="number")return TN;D({_l:P}),C.current=P;const F=[],[V]=Vl(i,y);let H=null;for(let I=0;I<P;++I){const[B]=Lg(t(I,H)),[T]=Vl(i,B),L=B?T().data:nr;if(yt(L))return $(V().data);F.push(L),H=L}return $(F)},[y,i,$,_]);return{size:_(),setSize:R,mutate:$,get data(){return A.data},get error(){return A.error},get isValidating(){return A.isValidating},get isLoading(){return A.isLoading}}},Xbe=zbe(B$,Jbe),$1=(e,t)=>{const n=Do(),r=e(n),s=(t==null?void 0:t.refine)??(c=>c),i=()=>r.execute().then(s),o=r.key();return{...B$((t==null?void 0:t.enabled)===!1?null:o,i,t),promise:r,key:o,api:n}},Kbe=(e,t)=>{const[n,r]=w.useState(!1),s=Do(),i=u=>e(s,u),o=(t==null?void 0:t.refine)??(u=>u),a=Xbe((u,f)=>f&&!f.length?(r(!0),null):i(u).request.url,u=>new bx(new Request(u),{fetcher:s.fetcher},o).execute(),{revalidateFirstPage:!1}),c=a.data?[].concat(...a.data):[];return{...a,_data:a.data,data:c,endReached:n,promise:i(a.size),key:i(a.size).key(),api:s}},z$=e=>{const t=AV().mutate,n=Do();return async r=>{let s="";return typeof r=="string"?s=r:typeof r=="function"&&(s=r(n).key()),t(i=>typeof i=="string"&&i.startsWith(s))}};class Lb extends Error{constructor(t,n){let r=n;"error"in t&&(r=t.error,n&&(r=`${n}: ${r}`)),super(r??"UseEntityApiError"),this.response=t}}const Qbe=(e,t)=>{const n=Do().data;return{create:async r=>{const s=await n.createOne(e,r);if(!s.ok)throw new Lb(s,`Failed to create entity "${e}"`);return s},read:async r=>{const s=t?await n.readOne(e,t,r):await n.readMany(e,r);if(!s.ok)throw new Lb(s,`Failed to read entity "${e}"`);return s},update:async(r,s=t)=>{if(!s)throw new Error("id is required");const i=await n.updateOne(e,s,r);if(!i.ok)throw new Lb(i,`Failed to update entity "${e}"`);return i},_delete:async(r=t)=>{if(!r)throw new Error("id is required");const s=await n.deleteOne(e,r);if(!s.ok)throw new Lb(s,`Failed to delete entity "${e}"`);return s}}};function pO(e,t,n,r){var s,i;return"/"+[...((i=(s=e.options)==null?void 0:s.basepath)==null?void 0:i.split("/"))??[],t,...n?[n]:[]].filter(Boolean).join("/")+(r?"?"+t1(r):"")}const T1=(e,t,n,r)=>{const s=Do().data,i=pO(s,e,t,n),{read:o,...a}=Qbe(e,t),c=()=>o(n??{}),u=B$((r==null?void 0:r.enabled)===!1?null:i,c,{revalidateOnFocus:!1,keepPreviousData:!0,...r}),f=async m=>{const y=pO(s,e,m);return F$(v=>typeof v=="string"&&v.startsWith(y),void 0,{revalidate:!0})},h=Zw(a,m=>async(...y)=>{const v=await m(...y);return(r==null?void 0:r.revalidateOnMutate)!==!1&&await f(),v});return{...u,...h,mutate:f,mutateRaw:u.mutate,api:s,key:i}};async function Zbe(e,t,n,r){function s(o,a){return typeof o<"u"&&typeof a<"u"&&"id"in o&&o.id===n?{...o,...a}:o}const i=pO(e,t);return F$(o=>typeof o=="string"&&o.startsWith(i),async o=>{if(!(typeof o>"u"))return Array.isArray(o)?o.map(a=>s(a,r)):s(o,r)},{revalidate:!1})}const eve=(e,t,n)=>{const{data:r,...s}=T1(e,t,void 0,{...n,enabled:!1});return{...s,mutate:(o,a)=>Zbe(s.api,e,o,a)}},$V=e=>{const t=Do(e==null?void 0:e.baseUrl),n=z$(),{authState:r}=vV(),s=(r==null?void 0:r.verified)??!1;async function i(f){return(await t.auth.login("password",f)).data}async function o(f){return(await t.auth.register("password",f)).data}function a(f){t.updateToken(f)}async function c(){t.updateToken(void 0),n()}async function u(){await t.verifyAuth()}return{data:r,user:r==null?void 0:r.user,token:r==null?void 0:r.token,verified:s,login:i,register:o,logout:c,setToken:a,verify:u}};function tve({api:e,setSchema:t,reloadSchema:n}){async function r(s,i,o,a){const c={id:"schema-"+[s,i,a].join("-"),position:"top-right",autoClose:3e3};return o.success?(console.log("update config",s,i,a,o.body),o.body.success&&t(u=>u&&{...u,config:{...u.config,[i]:o.config}}),vc.show({...c,title:`Config updated: ${ii(i)}`,color:"blue",message:`Operation ${s.toUpperCase()} at ${i}${a?"."+a:""}`})):vc.show({...c,title:`Config Update failed: ${ii(i)}${a?"."+a:""}`,color:"red",withCloseButton:!0,autoClose:!1,message:o.error??"Failed to complete config update"}),o.success}return{reload:n,set:async(s,i,o)=>{const a=await e.system.setConfig(s,i,o);return await r("set",s,a)},patch:async(s,i,o)=>{const a=await e.system.patchConfig(s,i,o);return await r("patch",s,a,i)},overwrite:async(s,i,o)=>{const a=await e.system.overwriteConfig(s,i,o);return await r("overwrite",s,a,i)},add:async(s,i,o)=>{const a=await e.system.addConfig(s,i,o);return await r("add",s,a,i)},remove:async(s,i)=>{const o=await e.system.removeConfig(s,i);return await r("remove",s,o,i)}}}class nve{constructor(t,n={}){K(this,"_entities",[]);K(this,"_relations",[]);K(this,"_flows",[]);this.appJson=t,this._options=n,this._entities=Object.entries(this.appJson.data.entities??{}).map(([r,s])=>O$(r,s)),this._relations=Object.entries(this.appJson.data.relations??{}).map(([,r])=>Xz(r,this.entity.bind(this)));for(const[r,s]of Object.entries(this.appJson.flows.flows??{})){const i=By.fromObject(r,s,nV);this._flows.push(i)}}get entities(){return this._entities}entity(t){const n=typeof t=="string"?t:t.name,r=this._entities.find(s=>s.name===n);if(!r)throw new Error(`Entity "${n}" not found`);return r}get relations(){return new UF(this._relations)}get flows(){return this._flows}get config(){return this.appJson}get options(){return{basepath:"",logo_return_path:"/",...this._options}}getSettingsPath(t=[]){return[`~/${this.options.basepath}/settings`.replace(/\/+/g,"/"),...t].join("/")}getAbsolutePath(t){const{basepath:n}=this.options;return(t?`~/${n}/${t}`:`~/${n}`).replace(/\/+/g,"/")}getAuthConfig(){return this.appJson.auth}}/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var rve={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ft=(e,t,n,r)=>{const s=w.forwardRef(({color:i="currentColor",size:o=24,stroke:a=2,title:c,className:u,children:f,...h},m)=>w.createElement("svg",{ref:m,...rve[e],width:o,height:o,className:["tabler-icon",`tabler-icon-${t}`,u].join(" "),...e==="filled"?{fill:i}:{strokeWidth:a,stroke:i},...h},[c&&w.createElement("title",{key:"svg-title"},c),...r.map(([y,v])=>w.createElement(y,v)),...Array.isArray(f)?f:[f]]));return s.displayName=`${n}`,s};/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var V$=Ft("outline","align-justified","IconAlignJustified",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l12 0",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var sve=Ft("outline","api","IconApi",[["path",{d:"M4 13h5",key:"svg-0"}],["path",{d:"M12 16v-8h3a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-3",key:"svg-1"}],["path",{d:"M20 8v8",key:"svg-2"}],["path",{d:"M9 16v-5.5a2.5 2.5 0 0 0 -5 0v5.5",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var ive=Ft("outline","bolt","IconBolt",[["path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11",key:"svg-0"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var ove=Ft("outline","book","IconBook",[["path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0",key:"svg-0"}],["path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0",key:"svg-1"}],["path",{d:"M3 6l0 13",key:"svg-2"}],["path",{d:"M12 6l0 13",key:"svg-3"}],["path",{d:"M21 6l0 13",key:"svg-4"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var ave=Ft("outline","box","IconBox",[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var lve=Ft("outline","brand-aws","IconBrandAws",[["path",{d:"M17 18.5a15.198 15.198 0 0 1 -7.37 1.44a14.62 14.62 0 0 1 -6.63 -2.94",key:"svg-0"}],["path",{d:"M19.5 21c.907 -1.411 1.451 -3.323 1.5 -5c-1.197 -.773 -2.577 -.935 -4 -1",key:"svg-1"}],["path",{d:"M3 11v-4.5a1.5 1.5 0 0 1 3 0v4.5",key:"svg-2"}],["path",{d:"M3 9h3",key:"svg-3"}],["path",{d:"M9 5l1.2 6l1.8 -4l1.8 4l1.2 -6",key:"svg-4"}],["path",{d:"M18 10.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75",key:"svg-5"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var cve=Ft("outline","brand-cloudflare","IconBrandCloudflare",[["path",{d:"M13.031 7.007c2.469 -.007 3.295 1.293 3.969 2.993c4 0 4.994 3.825 5 6h-20c-.001 -1.64 1.36 -2.954 3 -3c0 -1.5 1 -3 3 -3c.66 -1.942 2.562 -2.986 5.031 -2.993z",key:"svg-0"}],["path",{d:"M12 13h6",key:"svg-1"}],["path",{d:"M17 10l-2.5 6",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var TV=Ft("outline","bug","IconBug",[["path",{d:"M9 9v-1a3 3 0 0 1 6 0v1",key:"svg-0"}],["path",{d:"M8 9h8a6 6 0 0 1 1 3v3a5 5 0 0 1 -10 0v-3a6 6 0 0 1 1 -3",key:"svg-1"}],["path",{d:"M3 13l4 0",key:"svg-2"}],["path",{d:"M17 13l4 0",key:"svg-3"}],["path",{d:"M12 20l0 -6",key:"svg-4"}],["path",{d:"M4 19l3.35 -2",key:"svg-5"}],["path",{d:"M20 19l-3.35 -2",key:"svg-6"}],["path",{d:"M4 7l3.75 2.4",key:"svg-7"}],["path",{d:"M20 7l-3.75 2.4",key:"svg-8"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var uve=Ft("outline","chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var dve=Ft("outline","chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var U$=Ft("outline","circles-relation","IconCirclesRelation",[["path",{d:"M9.183 6.117a6 6 0 1 0 4.511 3.986",key:"svg-0"}],["path",{d:"M14.813 17.883a6 6 0 1 0 -4.496 -3.954",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var fve=Ft("outline","cloud","IconCloud",[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var cp=Ft("outline","database","IconDatabase",[["path",{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var hve=Ft("outline","external-link","IconExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var pve=Ft("outline","grip-vertical","IconGripVertical",[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var mve=Ft("outline","hierarchy-2","IconHierarchy2",[["path",{d:"M10 3h4v4h-4z",key:"svg-0"}],["path",{d:"M3 17h4v4h-4z",key:"svg-1"}],["path",{d:"M17 17h4v4h-4z",key:"svg-2"}],["path",{d:"M7 17l5 -4l5 4",key:"svg-3"}],["path",{d:"M12 7l0 6",key:"svg-4"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var gve=Ft("outline","home","IconHome",[["path",{d:"M5 12l-2 0l9 -9l9 9l-2 0",key:"svg-0"}],["path",{d:"M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7",key:"svg-1"}],["path",{d:"M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var yve=Ft("outline","info-circle","IconInfoCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var bve=Ft("outline","key-off","IconKeyOff",[["path",{d:"M10.17 6.159l2.316 -2.316a2.877 2.877 0 0 1 4.069 0l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.33 2.33",key:"svg-0"}],["path",{d:"M14.931 14.948a2.863 2.863 0 0 1 -1.486 -.79l-.301 -.302l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.863 2.863 0 0 1 -.794 -1.504",key:"svg-1"}],["path",{d:"M15 9h.01",key:"svg-2"}],["path",{d:"M3 3l18 18",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var vve=Ft("outline","library-plus","IconLibraryPlus",[["path",{d:"M7 3m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1",key:"svg-1"}],["path",{d:"M11 10h6",key:"svg-2"}],["path",{d:"M14 7v6",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var xve=Ft("outline","lock-access-off","IconLockAccessOff",[["path",{d:"M4 8v-2c0 -.554 .225 -1.055 .588 -1.417",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2c.55 0 1.05 -.222 1.41 -.582",key:"svg-3"}],["path",{d:"M15 11a1 1 0 0 1 1 1m-.29 3.704a1 1 0 0 1 -.71 .296h-6a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h2",key:"svg-4"}],["path",{d:"M10 11v-1m1.182 -2.826a2 2 0 0 1 2.818 1.826v1",key:"svg-5"}],["path",{d:"M3 3l18 18",key:"svg-6"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var wve=Ft("outline","minus","IconMinus",[["path",{d:"M5 12l14 0",key:"svg-0"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var RV=Ft("outline","photo","IconPhoto",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var q$=Ft("outline","plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Sve=Ft("outline","refresh","IconRefresh",[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Eve=Ft("outline","server","IconServer",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 12m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-1"}],["path",{d:"M7 8l0 .01",key:"svg-2"}],["path",{d:"M7 16l0 .01",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Fg=Ft("outline","settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Nve=Ft("outline","switch-horizontal","IconSwitchHorizontal",[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var MV=Ft("outline","trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var _ve=Ft("outline","user","IconUser",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var kV=Ft("outline","world","IconWorld",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]]);/**
 * @license @tabler/icons-react v3.18.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Cve=Ft("filled","bolt-filled","IconBoltFilled",[["path",{d:"M13 2l.018 .001l.016 .001l.083 .005l.011 .002h.011l.038 .009l.052 .008l.016 .006l.011 .001l.029 .011l.052 .014l.019 .009l.015 .004l.028 .014l.04 .017l.021 .012l.022 .01l.023 .015l.031 .017l.034 .024l.018 .011l.013 .012l.024 .017l.038 .034l.022 .017l.008 .01l.014 .012l.036 .041l.026 .027l.006 .009c.12 .147 .196 .322 .218 .513l.001 .012l.002 .041l.004 .064v6h5a1 1 0 0 1 .868 1.497l-.06 .091l-8 11c-.568 .783 -1.808 .38 -1.808 -.588v-6h-5a1 1 0 0 1 -.868 -1.497l.06 -.091l8 -11l.01 -.013l.018 -.024l.033 -.038l.018 -.022l.009 -.008l.013 -.014l.04 -.036l.028 -.026l.008 -.006a1 1 0 0 1 .402 -.199l.011 -.001l.027 -.005l.074 -.013l.011 -.001l.041 -.002z",key:"svg-0"}]]);const H$="-",Ove=e=>{const t=Ave(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const a=o.split(H$);return a[0]===""&&a.length!==1&&a.shift(),IV(a,t)||jve(o)},getConflictingClassGroupIds:(o,a)=>{const c=n[o]||[];return a&&r[o]?[...c,...r[o]]:c}}},IV=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?IV(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(H$);return(o=t.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},CI=/^\[(.+)\]$/,jve=e=>{if(CI.test(e)){const t=CI.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ave=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const s in n)mO(n[s],r,s,t);return r},mO=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:OI(t,s);i.classGroupId=n;return}if(typeof s=="function"){if($ve(s)){mO(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{mO(o,OI(t,i),n,r)})})},OI=(e,t)=>{let n=e;return t.split(H$).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},$ve=e=>e.isThemeGetter,Tve=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},gO="!",yO=":",Rve=yO.length,Mve=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const i=[];let o=0,a=0,c=0,u;for(let v=0;v<s.length;v++){let x=s[v];if(o===0&&a===0){if(x===yO){i.push(s.slice(c,v)),c=v+Rve;continue}if(x==="/"){u=v;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const f=i.length===0?s:s.substring(c),h=kve(f),m=h!==f,y=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:y}};if(t){const s=t+yO,i=r;r=o=>o.startsWith(s)?i(o.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},kve=e=>e.endsWith(gO)?e.substring(0,e.length-1):e.startsWith(gO)?e.substring(1):e,Ive=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const s=[];let i=[];return r.forEach(o=>{o[0]==="["||t[o]?(s.push(...i.sort(),o),i=[]):i.push(o)}),s.push(...i.sort()),s}},Dve=e=>({cache:Tve(e.cacheSize),parseClassName:Mve(e),sortModifiers:Ive(e),...Ove(e)}),Pve=/\s+/,Lve=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=t,o=[],a=e.trim().split(Pve);let c="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{isExternal:h,modifiers:m,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:x}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let E=!!x,N=r(E?v.substring(0,x):v);if(!N){if(!E){c=f+(c.length>0?" "+c:c);continue}if(N=r(v),!N){c=f+(c.length>0?" "+c:c);continue}E=!1}const _=i(m).join(":"),C=y?_+gO:_,j=C+N;if(o.includes(j))continue;o.push(j);const A=s(N,E);for(let $=0;$<A.length;++$){const R=A[$];o.push(C+R)}c=f+(c.length>0?" "+c:c)}return c};function Fve(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=DV(t))&&(r&&(r+=" "),r+=n);return r}const DV=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=DV(e[r]))&&(n&&(n+=" "),n+=t);return n};function Bve(e,...t){let n,r,s,i=o;function o(c){const u=t.reduce((f,h)=>h(f),e());return n=Dve(u),r=n.cache.get,s=n.cache.set,i=a,a(c)}function a(c){const u=r(c);if(u)return u;const f=Lve(c,n);return s(c,f),f}return function(){return i(Fve.apply(null,arguments))}}const tr=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},PV=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LV=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zve=/^\d+\/\d+$/,Vve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uve=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qve=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Hve=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wve=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sf=e=>zve.test(e),Et=e=>!!e&&!Number.isNaN(Number(e)),fu=e=>!!e&&Number.isInteger(Number(e)),jI=e=>e.endsWith("%")&&Et(e.slice(0,-1)),Rl=e=>Vve.test(e),Gve=()=>!0,Yve=e=>Uve.test(e)&&!qve.test(e),W$=()=>!1,Jve=e=>Hve.test(e),Xve=e=>Wve.test(e),Kve=e=>!Ge(e)&&!Ye(e),Qve=e=>up(e,zV,W$),Ge=e=>PV.test(e),hu=e=>up(e,VV,Yve),RN=e=>up(e,cxe,Et),Zve=e=>up(e,FV,W$),exe=e=>up(e,BV,Xve),txe=e=>up(e,W$,Jve),Ye=e=>LV.test(e),Fb=e=>dp(e,VV),nxe=e=>dp(e,uxe),rxe=e=>dp(e,FV),sxe=e=>dp(e,zV),ixe=e=>dp(e,BV),oxe=e=>dp(e,dxe,!0),up=(e,t,n)=>{const r=PV.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},dp=(e,t,n=!1)=>{const r=LV.exec(e);return r?r[1]?t(r[1]):n:!1},FV=e=>e==="position",axe=new Set(["image","url"]),BV=e=>axe.has(e),lxe=new Set(["length","size","percentage"]),zV=e=>lxe.has(e),VV=e=>e==="length",cxe=e=>e==="number",uxe=e=>e==="family-name",dxe=e=>e==="shadow",fxe=()=>{const e=tr("color"),t=tr("font"),n=tr("text"),r=tr("font-weight"),s=tr("tracking"),i=tr("leading"),o=tr("breakpoint"),a=tr("container"),c=tr("spacing"),u=tr("radius"),f=tr("shadow"),h=tr("inset-shadow"),m=tr("drop-shadow"),y=tr("blur"),v=tr("perspective"),x=tr("aspect"),E=tr("ease"),N=tr("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],$=()=>[Ye,Ge,c],R=()=>[Sf,"full","auto",...$()],M=()=>[fu,"none","subgrid",Ye,Ge],D=()=>["auto",{span:["full",fu,Ye,Ge]},Ye,Ge],P=()=>[fu,"auto",Ye,Ge],F=()=>["auto","min","max","fr",Ye,Ge],V=()=>["start","end","center","between","around","evenly","stretch","baseline"],H=()=>["start","end","center","stretch"],I=()=>["auto",...$()],B=()=>[Sf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],T=()=>[e,Ye,Ge],L=()=>[jI,hu],z=()=>["","none","full",u,Ye,Ge],q=()=>["",Et,Fb,hu],k=()=>["solid","dashed","dotted","double"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["","none",y,Ye,Ge],ne=()=>["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ye,Ge],re=()=>["none",Et,Ye,Ge],se=()=>["none",Et,Ye,Ge],fe=()=>[Et,Ye,Ge],he=()=>[Sf,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Rl],breakpoint:[Rl],color:[Gve],container:[Rl],"drop-shadow":[Rl],ease:["in","out","in-out"],font:[Kve],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Rl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Rl],shadow:[Rl],spacing:["px",Et],text:[Rl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sf,Ge,Ye,x]}],container:["container"],columns:[{columns:[Et,Ge,Ye,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...C(),Ge,Ye]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[fu,"auto",Ye,Ge]}],basis:[{basis:[Sf,"full","auto",a,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Et,Sf,"auto","initial","none",Ge]}],grow:[{grow:["",Et,Ye,Ge]}],shrink:[{shrink:["",Et,Ye,Ge]}],order:[{order:[fu,"first","last","none",Ye,Ge]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...H(),"baseline"]}],"align-self":[{self:["auto",...H(),"baseline"]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[a,"screen",...B()]}],"min-w":[{"min-w":[a,"screen","none",...B()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen",...B()]}],"min-h":[{"min-h":["screen","none",...B()]}],"max-h":[{"max-h":["screen",...B()]}],"font-size":[{text:["base",n,Fb,hu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,RN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jI,Ge]}],"font-family":[{font:[nxe,Ge,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ye,Ge]}],"line-clamp":[{"line-clamp":[Et,"none",Ye,RN]}],leading:[{leading:[i,...$()]}],"list-image":[{"list-image":["none",Ye,Ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:[Et,"from-font","auto",Ye,hu]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Et,"auto",Ye,Ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...C(),rxe,Zve]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:["auto","cover","contain",sxe,Qve]}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fu,Ye,Ge],radial:["",Ye,Ge],conic:[fu,Ye,Ge]},ixe,exe]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...k(),"hidden","none"]}],"divide-style":[{divide:[...k(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...k(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Et,Ye,Ge]}],"outline-w":[{outline:["",Et,Fb,hu]}],"outline-color":[{outline:[e]}],shadow:[{shadow:["","none",f,oxe,txe]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",Ye,Ge,h]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Et,hu]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":T()}],opacity:[{opacity:[Et,Ye,Ge]}],"mix-blend":[{"mix-blend":[...W(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none",Ye,Ge]}],blur:[{blur:X()}],brightness:[{brightness:[Et,Ye,Ge]}],contrast:[{contrast:[Et,Ye,Ge]}],"drop-shadow":[{"drop-shadow":["","none",m,Ye,Ge]}],grayscale:[{grayscale:["",Et,Ye,Ge]}],"hue-rotate":[{"hue-rotate":[Et,Ye,Ge]}],invert:[{invert:["",Et,Ye,Ge]}],saturate:[{saturate:[Et,Ye,Ge]}],sepia:[{sepia:["",Et,Ye,Ge]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Ge]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[Et,Ye,Ge]}],"backdrop-contrast":[{"backdrop-contrast":[Et,Ye,Ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Et,Ye,Ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Et,Ye,Ge]}],"backdrop-invert":[{"backdrop-invert":["",Et,Ye,Ge]}],"backdrop-opacity":[{"backdrop-opacity":[Et,Ye,Ge]}],"backdrop-saturate":[{"backdrop-saturate":[Et,Ye,Ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Et,Ye,Ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Et,"initial",Ye,Ge]}],ease:[{ease:["linear","initial",E,Ye,Ge]}],delay:[{delay:[Et,Ye,Ge]}],animate:[{animate:["none",N,Ye,Ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Ye,Ge]}],"perspective-origin":[{"perspective-origin":ne()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[Ye,Ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:ne()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ye,Ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ye,Ge]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Et,Fb,hu,RN]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["before","after","placeholder","file","marker","selection","first-line","first-letter","backdrop","*","**"]}},Ue=Bve(fxe);function hxe(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,s,i,o=[],a="",c=e.split("/");for(c[0]||c.shift();s=c.shift();)n=s[0],n==="*"?(o.push(n),a+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=s.indexOf("?",1),i=s.indexOf(".",1),o.push(s.substring(1,~r?r:~i?i:s.length)),a+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(a+=(~r?"?":"")+"\\"+s.substring(i))):a+="/"+s;return{keys:o,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}const pxe=t8.useInsertionEffect,mxe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gxe=mxe?w.useLayoutEffect:w.useEffect,yxe=pxe||gxe,UV=e=>{const t=w.useRef([e,(...n)=>t[0](...n)]).current;return yxe(()=>{t[0]=e}),t[1]},bxe="popstate",G$="pushState",Y$="replaceState",vxe="hashchange",AI=[bxe,G$,Y$,vxe],xxe=e=>{for(const t of AI)addEventListener(t,e);return()=>{for(const t of AI)removeEventListener(t,e)}},qV=(e,t)=>D$.useSyncExternalStore(xxe,e,t),wxe=()=>location.search,Sxe=({ssrSearch:e=""}={})=>qV(wxe,()=>e),$I=()=>location.pathname,Exe=({ssrPath:e}={})=>qV($I,e?()=>e:$I),Nxe=(e,{replace:t=!1,state:n=null}={})=>history[t?Y$:G$](n,"",e),_xe=(e={})=>[Exe(e),Nxe],TI=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[TI]>"u"){for(const e of[G$,Y$]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,TI,{value:!0})}const Cxe=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",HV=(e="")=>e==="/"?"":e,Oxe=(e,t)=>e[0]==="~"?e.slice(1):HV(t)+e,jxe=(e="",t)=>Cxe(bO(HV(e)),bO(t)),Axe=e=>e[0]==="?"?e.slice(1):e,bO=e=>{try{return decodeURI(e)}catch{return e}},$xe=e=>bO(Axe(e)),WV={hook:_xe,searchHook:Sxe,parser:hxe,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},GV=w.createContext(WV),Ic=()=>w.useContext(GV),YV={},JV=w.createContext(YV),J$=()=>w.useContext(JV),R1=e=>{const[t,n]=e.hook(e);return[jxe(e.base,t),UV((r,s)=>n(Oxe(r,e.base),s))]},yi=()=>R1(Ic()),Txe=()=>{const e=Ic();return $xe(e.searchHook(e))},XV=(e,t,n,r)=>{const{pattern:s,keys:i}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),o=s.exec(n)||[],[a,...c]=o;return a!==void 0?[!0,(()=>{const u=i!==!1?Object.fromEntries(i.map((h,m)=>[h,c[m]])):o.groups;let f={...c};return u&&Object.assign(f,u),f})(),...r?[a]:[]]:[!1,null]},KV=({children:e,...t})=>{var f,h;const n=Ic(),r=t.hook?WV:n;let s=r;const[i,o]=((f=t.ssrPath)==null?void 0:f.split("?"))??[];o&&(t.ssrSearch=o,t.ssrPath=i),t.hrefs=t.hrefs??((h=t.hook)==null?void 0:h.hrefs);let a=w.useRef({}),c=a.current,u=c;for(let m in r){const y=m==="base"?r[m]+(t[m]||""):t[m]||r[m];c===u&&y!==u[m]&&(a.current=u={...u}),u[m]=y,y!==r[m]&&(s=u)}return w.createElement(GV.Provider,{value:s,children:e})},RI=({children:e,component:t},n)=>t?w.createElement(t,{params:n}):typeof e=="function"?e(n):e,Rxe=e=>{let t=w.useRef(YV);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,s])=>s!==n[r])?e:n},lt=({path:e,nest:t,match:n,...r})=>{const s=Ic(),[i]=R1(s),[o,a,c]=n??XV(s.parser,e,i,t),u=Rxe({...J$(),...a});if(!o)return null;const f=c?w.createElement(KV,{base:c},RI(r,u)):RI(r,u);return w.createElement(JV.Provider,{value:u,children:f})},M1=w.forwardRef((e,t)=>{const n=Ic(),[r,s]=R1(n),{to:i="",href:o=i,onClick:a,asChild:c,children:u,className:f,replace:h,state:m,...y}=e,v=UV(E=>{E.ctrlKey||E.metaKey||E.altKey||E.shiftKey||E.button!==0||(a==null||a(E),E.defaultPrevented||(E.preventDefault(),s(o,e)))}),x=n.hrefs(o[0]==="~"?o.slice(1):n.base+o,n);return c&&w.isValidElement(u)?w.cloneElement(u,{onClick:v,href:x}):w.createElement("a",{...y,onClick:v,href:x,className:f!=null&&f.call?f(r===o):f,children:u,ref:t})}),QV=e=>Array.isArray(e)?e.flatMap(t=>QV(t&&t.type===w.Fragment?t.props.children:t)):[e],Fa=({children:e,location:t})=>{const n=Ic(),[r]=R1(n);for(const s of QV(e)){let i=0;if(w.isValidElement(s)&&(i=XV(n.parser,s.props.path,t||r,s.props.nest))[0])return w.cloneElement(s,{match:i})}return null},Lt=e=>(qr(),e),Mxe=(e="",t="")=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",ZV=(e,t="")=>e[0]==="~"?e.slice(1):t+e,kxe=e=>{try{return decodeURI(e)}catch{return e}},Ixe=e=>{const[t,n]=e.hook(e);return[kxe(Mxe(e.base,t)),Lt((r,s)=>n(ZV(r,e.base),s))]};function Dxe(e,t){const n=window.location.pathname;return n===e||n.endsWith(e)||n.includes(e+"/")}function jn({className:e,native:t,onClick:n,...r}){const s=Ic(),[i,o]=Ixe(s);function a(y,v){if(y.startsWith(v)){const x=y.replace(v,"");return x.length===0||x[0]==="/"}return!1}const c=r.href??r.to,u=s.hrefs(c[0]==="~"?c.slice(1):s.base+c,s).replace("//","/"),f=ZV(i,s.base).replace("//","/"),h=u.replace(s.base,"").length<=1?u===f:a(f,u);if(t)return p.jsx("a",{className:`${h?"active ":""}${e}`,...r});const m=y=>{n==null||n(y)};return p.jsx(M1,{className:`${h?"active ":""}${e}`,...r,onClick:m})}const Pxe={small:"px-2 py-1.5 rounded-md gap-1 text-sm",default:"px-3 py-2.5 rounded-md gap-1.5",large:"px-4 py-3 rounded-md gap-2.5 text-lg"},Lxe={small:12,default:16,large:20},Fxe={default:"bg-primary/5 hover:bg-primary/10 link text-primary/70",primary:"bg-primary hover:bg-primary/80 link text-background",ghost:"bg-transparent hover:bg-primary/5 link text-primary/70",outline:"border border-primary/20 bg-transparent hover:bg-primary/5 link text-primary/80",red:"dark:bg-red-950 dark:hover:bg-red-900 bg-red-100 hover:bg-red-200 link text-primary/70",subtlered:"dark:text-red-700 text-red-700 dark:hover:bg-red-900 dark:hover:text-red-200 bg-transparent hover:bg-red-50 link"},eU=({children:e,size:t,variant:n,IconLeft:r,IconRight:s,iconSize:i=Lxe[t??"default"],iconProps:o,labelClassName:a,...c})=>({...c,className:Ue("flex flex-row flex-nowrap items-center !font-semibold disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed transition-[opacity,background-color,color,border-color]",Pxe[t??"default"],Fxe[n??"default"],c.className),children:p.jsxs(p.Fragment,{children:[r&&p.jsx(r,{size:i,...o}),e&&w.Children.count(e)===1?p.jsx("span",{className:Ue("leading-none",a),children:e}):e,s&&p.jsx(s,{size:i,...o})]})}),ot=w.forwardRef((e,t)=>p.jsx("button",{type:"button",ref:t,...eU(e)})),vO=w.forwardRef((e,t)=>p.jsx(jn,{ref:t,href:"#",...eU(e)})),Vr=({Icon:e=void 0,title:t=void 0,description:n="Check back later my friend.",primary:r,secondary:s,className:i})=>p.jsx("div",{className:Ue("flex flex-col h-full w-full justify-center items-center",i),children:p.jsxs("div",{className:"flex flex-col gap-3 items-center max-w-80",children:[e&&p.jsx(e,{size:48,className:"opacity-50",stroke:1}),p.jsxs("div",{className:"flex flex-col gap-1",children:[t&&p.jsx("h3",{className:"text-center text-lg font-bold",children:t}),p.jsx("p",{className:"text-center text-primary/60",children:n})]}),p.jsxs("div",{className:"mt-1.5 flex flex-row gap-2",children:[s&&p.jsx(ot,{variant:"default",...s}),r&&p.jsx(ot,{variant:"primary",...r})]})]})}),Bxe=e=>p.jsx(Vr,{title:"Not Found",...e}),zxe=e=>p.jsx(Vr,{title:"Not Allowed",...e}),Vxe=({what:e,...t})=>p.jsx(Vr,{Icon:xve,title:"Missing Permission",description:`You're not allowed to access ${e??"this"}.`,...t}),Uxe=e=>p.jsx(Vr,{title:"Not Enabled",...e}),Os={NotFound:Bxe,NotAllowed:zxe,NotEnabled:Uxe,MissingPermission:Vxe},ut={data:{root:()=>"/data",entity:{list:e=>`/entity/${e}`,create:e=>`/entity/${e}/create`,edit:(e,t)=>`/entity/${e}/edit/${t}`},schema:{root:()=>"/schema",entity:e=>`/schema/entity/${e}`}},auth:{root:()=>"/auth",users:{list:()=>"/users",edit:e=>`/users/edit/${e}`},roles:{list:()=>"/roles",edit:e=>`/roles/edit/${e}`},settings:()=>"/settings",strategies:()=>"/strategies"},flows:{root:()=>"/flows",flows:{list:()=>"/",edit:e=>`/flow/${e}`}},settings:{root:()=>"/settings",path:e=>`/settings/${e.join("/")}`}};function qxe(e,t){const n=t1(t,{encode:!1});return`${e}?${n}`}function Hxe(){const[e]=$n();return(t,n)=>{e(t(ut),n)}}function $n(){const[e,t]=yi(),n=Ic(),{app:r}=Tt(),s=r.options.basepath;return[(i,o)=>{(c=>{c()})(()=>{if(o){if("reload"in o){window.location.href=i;return}else if("target"in o){const f=window.location.origin+s+n.base+i;window.open(f,o.target);return}}const c=o!=null&&o.absolute?`~/${s}${i}`.replace(/\/+/g,"/"):i,u={...o==null?void 0:o.state,referrer:e};t(o!=null&&o.query?qxe(c,o==null?void 0:o.query):c,{replace:o==null?void 0:o.replace,state:u})})},e,i=>{const o=window.history.state;o!=null&&o.referrer?t(o.referrer,{replace:!0}):i!=null&&i.fallback?t(i.fallback,{replace:!0}):window.history.back()}]}function Wxe(e="/",t){const{app:n}=Tt(),[r]=$n(),s=document.referrer,i=window.history.length,o=s.length===0,a=o&&i>1||!!o;function c(){o&&i>2?window.history.back():typeof e=="string"?r(e):typeof e=="function"&&e()}return{same:o,canGoBack:a,goBack:c}}const tU=w.createContext(void 0);function Gxe({includeSecrets:e=!1,options:t,children:n,fallback:r=null}){const[s,i]=w.useState(e),[o,a]=w.useState(),[c,u]=w.useState(!1),[f,h]=w.useState(),m=w.useRef(!1),y=w.useRef(0),[v,x]=w.useState(0),E=Do();async function N(){await _(e,{force:!0,fresh:!0})}async function _(R=!1,M){const D=s?2:1;if(y.current===D||s&&(M==null?void 0:M.force)!==!0)return;y.current=D;const P=await E.system.readSchema({config:!0,secrets:R,fresh:M==null?void 0:M.fresh});if(P.ok)f&&h(!1);else if(m.current||(m.current=!0,h(!0),c&&(o!=null&&o.schema)))return;const F=P.ok?P.body:{version:0,schema:yV(),config:cbe(),permissions:[],fallback:!0};w.startTransition(()=>{const V=()=>{a(F),i(R),u(!0),x(H=>H+1),y.current=0};"startViewTransition"in document?document.startViewTransition(V):V()})}async function C(){s||await _(!0)}if(w.useEffect(()=>{o!=null&&o.schema||_(e)},[]),!c||!o)return r;const j=new nve(o==null?void 0:o.config,t),A=tve({api:E,setSchema:a,reloadSchema:N}),$=s&&!f;return p.jsx(tU.Provider,{value:{...o,actions:A,requireSecrets:C,app:j,options:j.options,hasSecrets:$},children:f?p.jsx(Yxe,{}):n},v)}function Yxe(){const[e]=$n();return p.jsx(Os.MissingPermission,{what:"the Admin UI",primary:{children:"Login",onClick:()=>e("/auth/login")}})}function Tt({withSecrets:e}={}){const t=w.useContext(tU);return e&&t.requireSecrets(),t}const Jxe={},MI=e=>{let t;const n=new Set,r=(f,h)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const y=t;t=h??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(v=>v(t,y))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Jxe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},X$=e=>e?MI(e):MI;var MN={exports:{}},kN={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var kI;function Xxe(){if(kI)return kN;kI=1;var e=Hh(),t=xV();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return kN.useSyncExternalStoreWithSelector=function(u,f,h,m,y){var v=i(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function N($){if(!_){if(_=!0,C=$,$=m($),y!==void 0&&x.hasValue){var R=x.value;if(y(R,$))return j=R}return j=$}if(R=j,r(C,$))return R;var M=m($);return y!==void 0&&y(R,M)?(C=$,R):(C=$,j=M)}var _=!1,C,j,A=h===void 0?null:h;return[function(){return N(f())},A===null?void 0:function(){return N(A())}]},[f,h,m,y]);var E=s(u,v[0],v[1]);return o(function(){x.hasValue=!0,x.value=E},[E]),c(E),E},kN}var II;function Kxe(){return II||(II=1,MN.exports=Xxe()),MN.exports}var nU=Kxe();const rU=Ki(nU),sU={},{useDebugValue:Qxe}=Re,{useSyncExternalStoreWithSelector:Zxe}=rU;let DI=!1;const ewe=e=>e;function Xr(e,t=ewe,n){(sU?"production":void 0)!=="production"&&n&&!DI&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),DI=!0);const r=Zxe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qxe(r),r}const PI=e=>{(sU?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?X$(e):e,n=(r,s)=>Xr(t,r,s);return Object.assign(n,t),n},K$=e=>e?PI(e):PI,twe={},k1=(e,t)=>(...n)=>Object.assign({},e,t(...n));function nwe(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var i;const o=c=>c===null?null:JSON.parse(c,void 0),a=(i=n.getItem(s))!=null?i:null;return a instanceof Promise?a.then(o):o(a)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const Bg=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Bg(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Bg(r)(n)}}}},rwe=(e,t)=>(n,r,s)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,N)=>({...N,...E}),...t},o=!1;const a=new Set,c=new Set;let u;try{u=i.getStorage()}catch{}if(!u)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...E)},r,s);const f=Bg(i.serialize),h=()=>{const E=i.partialize({...r()});let N;const _=f({state:E,version:i.version}).then(C=>u.setItem(i.name,C)).catch(C=>{N=C});if(N)throw N;return _},m=s.setState;s.setState=(E,N)=>{m(E,N),h()};const y=e((...E)=>{n(...E),h()},r,s);let v;const x=()=>{var E;if(!u)return;o=!1,a.forEach(_=>_(r()));const N=((E=i.onRehydrateStorage)==null?void 0:E.call(i,r()))||void 0;return Bg(u.getItem.bind(u))(i.name).then(_=>{if(_)return i.deserialize(_)}).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==i.version){if(i.migrate)return i.migrate(_.state,_.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return _.state}).then(_=>{var C;return v=i.merge(_,(C=r())!=null?C:y),n(v,!0),h()}).then(()=>{N==null||N(v,void 0),o=!0,c.forEach(_=>_(v))}).catch(_=>{N==null||N(void 0,_)})};return s.persist={setOptions:E=>{i={...i,...E},E.getStorage&&(u=E.getStorage())},clearStorage:()=>{u==null||u.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:E=>(a.add(E),()=>{a.delete(E)}),onFinishHydration:E=>(c.add(E),()=>{c.delete(E)})},x(),v||y},swe=(e,t)=>(n,r,s)=>{let i={storage:nwe(()=>localStorage),partialize:x=>x,version:0,merge:(x,E)=>({...E,...x}),...t},o=!1;const a=new Set,c=new Set;let u=i.storage;if(!u)return e((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...x)},r,s);const f=()=>{const x=i.partialize({...r()});return u.setItem(i.name,{state:x,version:i.version})},h=s.setState;s.setState=(x,E)=>{h(x,E),f()};const m=e((...x)=>{n(...x),f()},r,s);s.getInitialState=()=>m;let y;const v=()=>{var x,E;if(!u)return;o=!1,a.forEach(_=>{var C;return _((C=r())!=null?C:m)});const N=((E=i.onRehydrateStorage)==null?void 0:E.call(i,(x=r())!=null?x:m))||void 0;return Bg(u.getItem.bind(u))(i.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==i.version){if(i.migrate)return[!0,i.migrate(_.state,_.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,_.state];return[!1,void 0]}).then(_=>{var C;const[j,A]=_;if(y=i.merge(A,(C=r())!=null?C:m),n(y,!0),j)return f()}).then(()=>{N==null||N(y,void 0),y=r(),o=!0,c.forEach(_=>_(y))}).catch(_=>{N==null||N(void 0,_)})};return s.persist={setOptions:x=>{i={...i,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>v(),hasHydrated:()=>o,onHydrate:x=>(a.add(x),()=>{a.delete(x)}),onFinishHydration:x=>(c.add(x),()=>{c.delete(x)})},i.skipHydration||v(),y||m},iwe=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((twe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),rwe(e,t)):swe(e,t),iU=iwe,oU=["dark","light","system"],LI=K$(iU(k1({theme:null},e=>({setTheme:t=>{oU.includes(t)&&document.startViewTransition(()=>{e({theme:t})})}})),{name:"bknd-admin-theme"}));function Dc(e="system"){var a;const t=Tt(),n=LI(c=>c.theme),r=LI(c=>c.setTheme),s=(a=t==null?void 0:t.options)==null?void 0:a.theme,i=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches,o=s??n??e;return{theme:o==="system"?i?"dark":"light":o,value:o,themes:oU,setTheme:r,state:n,prefersDark:i,override:s}}function I1({scale:e=.2,fill:t,...n}){const r=Dc(),s=n.theme??r.theme,i=t||(s==="light"?"black":"white"),o={width:Math.round(578*e),height:Math.round(188*e)};return p.jsx("div",{style:o,children:p.jsxs("svg",{width:o.width,height:o.height,viewBox:"0 0 578 188",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M41.5 34C37.0817 34 33.5 37.5817 33.5 42V146C33.5 150.418 37.0817 154 41.5 154H158.5C162.918 154 166.5 150.418 166.5 146V42C166.5 37.5817 162.918 34 158.5 34H41.5ZM123.434 113.942C124.126 111.752 124.5 109.42 124.5 107C124.5 94.2975 114.203 84 101.5 84C99.1907 84 96.9608 84.3403 94.8579 84.9736L87.2208 65.1172C90.9181 63.4922 93.5 59.7976 93.5 55.5C93.5 49.701 88.799 45 83 45C77.201 45 72.5 49.701 72.5 55.5C72.5 61.299 77.201 66 83 66C83.4453 66 83.8841 65.9723 84.3148 65.9185L92.0483 86.0256C87.1368 88.2423 83.1434 92.1335 80.7957 96.9714L65.4253 91.1648C65.4746 90.7835 65.5 90.3947 65.5 90C65.5 85.0294 61.4706 81 56.5 81C51.5294 81 47.5 85.0294 47.5 90C47.5 94.9706 51.5294 99 56.5 99C60.0181 99 63.0648 96.9814 64.5449 94.0392L79.6655 99.7514C78.9094 102.03 78.5 104.467 78.5 107C78.5 110.387 79.2321 113.603 80.5466 116.498L69.0273 123.731C67.1012 121.449 64.2199 120 61 120C55.201 120 50.5 124.701 50.5 130.5C50.5 136.299 55.201 141 61 141C66.799 141 71.5 136.299 71.5 130.5C71.5 128.997 71.1844 127.569 70.6158 126.276L81.9667 119.149C86.0275 125.664 93.2574 130 101.5 130C110.722 130 118.677 124.572 122.343 116.737L132.747 120.899C132.585 121.573 132.5 122.276 132.5 123C132.5 127.971 136.529 132 141.5 132C146.471 132 150.5 127.971 150.5 123C150.5 118.029 146.471 114 141.5 114C138.32 114 135.525 115.649 133.925 118.139L123.434 113.942Z"}),p.jsx("path",{d:"M243.9 151.5C240.4 151.5 237 151 233.7 150C230.4 149 227.4 147.65 224.7 145.95C222 144.15 219.75 142.15 217.95 139.95C216.15 137.65 215 135.3 214.5 132.9L219.3 131.1L218.25 149.7H198.15V39H219.45V89.25L215.4 87.6C216 85.2 217.15 82.9 218.85 80.7C220.55 78.4 222.7 76.4 225.3 74.7C227.9 72.9 230.75 71.5 233.85 70.5C236.95 69.5 240.15 69 243.45 69C250.35 69 256.5 70.8 261.9 74.4C267.3 77.9 271.55 82.75 274.65 88.95C277.85 95.15 279.45 102.25 279.45 110.25C279.45 118.25 277.9 125.35 274.8 131.55C271.7 137.75 267.45 142.65 262.05 146.25C256.75 149.75 250.7 151.5 243.9 151.5ZM238.8 133.35C242.8 133.35 246.25 132.4 249.15 130.5C252.15 128.5 254.5 125.8 256.2 122.4C257.9 118.9 258.75 114.85 258.75 110.25C258.75 105.75 257.9 101.75 256.2 98.25C254.6 94.75 252.3 92.05 249.3 90.15C246.3 88.25 242.8 87.3 238.8 87.3C234.8 87.3 231.3 88.25 228.3 90.15C225.3 92.05 222.95 94.75 221.25 98.25C219.55 101.75 218.7 105.75 218.7 110.25C218.7 114.85 219.55 118.9 221.25 122.4C222.95 125.8 225.3 128.5 228.3 130.5C231.3 132.4 234.8 133.35 238.8 133.35ZM308.312 126.15L302.012 108.6L339.512 70.65H367.562L308.312 126.15ZM288.062 150V39H309.362V150H288.062ZM341.762 150L313.262 114.15L328.262 102.15L367.412 150H341.762ZM371.675 150V70.65H392.075L392.675 86.85L388.475 88.65C389.575 85.05 391.525 81.8 394.325 78.9C397.225 75.9 400.675 73.5 404.675 71.7C408.675 69.9 412.875 69 417.275 69C423.275 69 428.275 70.2 432.275 72.6C436.375 75 439.425 78.65 441.425 83.55C443.525 88.35 444.575 94.3 444.575 101.4V150H423.275V103.05C423.275 99.45 422.775 96.45 421.775 94.05C420.775 91.65 419.225 89.9 417.125 88.8C415.125 87.6 412.625 87.1 409.625 87.3C407.225 87.3 404.975 87.7 402.875 88.5C400.875 89.2 399.125 90.25 397.625 91.65C396.225 93.05 395.075 94.65 394.175 96.45C393.375 98.25 392.975 100.2 392.975 102.3V150H382.475C380.175 150 378.125 150 376.325 150C374.525 150 372.975 150 371.675 150ZM488.536 151.5C481.636 151.5 475.436 149.75 469.936 146.25C464.436 142.65 460.086 137.8 456.886 131.7C453.786 125.5 452.236 118.35 452.236 110.25C452.236 102.35 453.786 95.3 456.886 89.1C460.086 82.9 464.386 78 469.786 74.4C475.286 70.8 481.536 69 488.536 69C492.236 69 495.786 69.6 499.186 70.8C502.686 71.9 505.786 73.45 508.486 75.45C511.286 77.45 513.536 79.7 515.236 82.2C516.936 84.6 517.886 87.15 518.086 89.85L512.686 90.75V39H533.986V150H513.886L512.986 131.7L517.186 132.15C516.986 134.65 516.086 137.05 514.486 139.35C512.886 141.65 510.736 143.75 508.036 145.65C505.436 147.45 502.436 148.9 499.036 150C495.736 151 492.236 151.5 488.536 151.5ZM493.336 133.8C497.336 133.8 500.836 132.8 503.836 130.8C506.836 128.8 509.186 126.05 510.886 122.55C512.586 119.05 513.436 114.95 513.436 110.25C513.436 105.65 512.586 101.6 510.886 98.1C509.186 94.5 506.836 91.75 503.836 89.85C500.836 87.85 497.336 86.85 493.336 86.85C489.336 86.85 485.836 87.85 482.836 89.85C479.936 91.75 477.636 94.5 475.936 98.1C474.336 101.6 473.536 105.65 473.536 110.25C473.536 114.95 474.336 119.05 475.936 122.55C477.636 126.05 479.936 128.8 482.836 130.8C485.836 132.8 489.336 133.8 493.336 133.8Z"})]})})}function FI(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function aU(...e){return t=>{let n=!1;const r=e.map(s=>{const i=FI(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():FI(e[s],null)}}}}function Pc(...e){return w.useCallback(aU(...e),e)}var lU=w.forwardRef((e,t)=>{const{children:n,...r}=e,s=w.Children.toArray(n),i=s.find(awe);if(i){const o=i.props.children,a=s.map(c=>c===i?w.Children.count(o)>1?w.Children.only(null):w.isValidElement(o)?o.props.children:null:c);return p.jsx(xO,{...r,ref:t,children:w.isValidElement(o)?w.cloneElement(o,void 0,a):null})}return p.jsx(xO,{...r,ref:t,children:n})});lU.displayName="Slot";var xO=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const s=cwe(n),i=lwe(r,n.props);return n.type!==w.Fragment&&(i.ref=t?aU(t,s):s),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});xO.displayName="SlotClone";var owe=({children:e})=>p.jsx(p.Fragment,{children:e});function awe(e){return w.isValidElement(e)&&e.type===owe}function lwe(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{i(...a),s(...a)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function cwe(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var uwe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],xd=uwe.reduce((e,t)=>{const n=w.forwardRef((r,s)=>{const{asChild:i,...o}=r,a=i?lU:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...o,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function cU(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o),c=n.length;n=[...n,o];const u=h=>{var N;const{scope:m,children:y,...v}=h,x=((N=m==null?void 0:m[e])==null?void 0:N[c])||a,E=w.useMemo(()=>v,Object.values(v));return p.jsx(x.Provider,{value:E,children:y})};u.displayName=i+"Provider";function f(h,m){var x;const y=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,v=w.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,dwe(s,...t)]}function dwe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function hc(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function va(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function fwe({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=hwe({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:r,a=va(n),c=w.useCallback(u=>{if(i){const h=typeof u=="function"?u(e):u;h!==e&&a(h)}else s(u)},[i,e,s,a]);return[o,c]}function hwe({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,s=w.useRef(r),i=va(t);return w.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}var vx=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{};function pwe(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Vy=e=>{const{present:t,children:n}=e,r=mwe(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Pc(r.ref,gwe(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};Vy.displayName="Presence";function mwe(e){const[t,n]=w.useState(),r=w.useRef({}),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,c]=pwe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=Bb(r.current);i.current=a==="mounted"?u:"none"},[a]),vx(()=>{const u=r.current,f=s.current;if(f!==e){const m=i.current,y=Bb(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&m!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),vx(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,h=y=>{const x=Bb(r.current).includes(y.animationName);if(y.target===t&&x&&(c("ANIMATION_END"),!s.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},m=y=>{y.target===t&&(i.current=Bb(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Bb(e){return(e==null?void 0:e.animationName)||"none"}function gwe(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ywe=w.createContext(void 0);function bwe(e){const t=w.useContext(ywe);return e||t||"ltr"}function vwe(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function xwe(e){const[t,n]=w.useState(void 0);return vx(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function wwe(e,[t,n]){return Math.min(n,Math.max(t,e))}function Swe(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Q$="ScrollArea",[uU,IPe]=cU(Q$),[Ewe,bi]=uU(Q$),dU=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=e,[a,c]=w.useState(null),[u,f]=w.useState(null),[h,m]=w.useState(null),[y,v]=w.useState(null),[x,E]=w.useState(null),[N,_]=w.useState(0),[C,j]=w.useState(0),[A,$]=w.useState(!1),[R,M]=w.useState(!1),D=Pc(t,F=>c(F)),P=bwe(s);return p.jsx(Ewe,{scope:n,type:r,dir:P,scrollHideDelay:i,scrollArea:a,viewport:u,onViewportChange:f,content:h,onContentChange:m,scrollbarX:y,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:$,scrollbarY:x,onScrollbarYChange:E,scrollbarYEnabled:R,onScrollbarYEnabledChange:M,onCornerWidthChange:_,onCornerHeightChange:j,children:p.jsx(xd.div,{dir:P,...o,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});dU.displayName=Q$;var fU="ScrollAreaViewport",hU=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=e,o=bi(fU,n),a=w.useRef(null),c=Pc(t,a,o.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),p.jsx(xd.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:p.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});hU.displayName=fU;var Po="ScrollAreaScrollbar",pU=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=bi(Po,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,a=e.orientation==="horizontal";return w.useEffect(()=>(a?i(!0):o(!0),()=>{a?i(!1):o(!1)}),[a,i,o]),s.type==="hover"?p.jsx(Nwe,{...r,ref:t,forceMount:n}):s.type==="scroll"?p.jsx(_we,{...r,ref:t,forceMount:n}):s.type==="auto"?p.jsx(mU,{...r,ref:t,forceMount:n}):s.type==="always"?p.jsx(Z$,{...r,ref:t}):null});pU.displayName=Po;var Nwe=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=bi(Po,e.__scopeScrollArea),[i,o]=w.useState(!1);return w.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},f=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),p.jsx(Vy,{present:n||i,children:p.jsx(mU,{"data-state":i?"visible":"hidden",...r,ref:t})})}),_we=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=bi(Po,e.__scopeScrollArea),i=e.orientation==="horizontal",o=P1(()=>c("SCROLL_END"),100),[a,c]=Swe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return w.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),w.useEffect(()=>{const u=s.viewport,f=i?"scrollLeft":"scrollTop";if(u){let h=u[f];const m=()=>{const y=u[f];h!==y&&(c("SCROLL"),o()),h=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,i,c,o]),p.jsx(Vy,{present:n||a!=="hidden",children:p.jsx(Z$,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:hc(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:hc(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),mU=w.forwardRef((e,t)=>{const n=bi(Po,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,o]=w.useState(!1),a=e.orientation==="horizontal",c=P1(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?u:f)}},10);return $h(n.viewport,c),$h(n.content,c),p.jsx(Vy,{present:r||i,children:p.jsx(Z$,{"data-state":i?"visible":"hidden",...s,ref:t})})}),Z$=w.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=bi(Po,e.__scopeScrollArea),i=w.useRef(null),o=w.useRef(0),[a,c]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=vU(a.viewport,a.content),f={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function h(m,y){return Rwe(m,o.current,a,y)}return n==="horizontal"?p.jsx(Cwe,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollLeft,y=BI(m,a,s.dir);i.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=h(m,s.dir))}}):n==="vertical"?p.jsx(Owe,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollTop,y=BI(m,a);i.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=h(m))}}):null}),Cwe=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=bi(Po,e.__scopeScrollArea),[o,a]=w.useState(),c=w.useRef(null),u=Pc(t,c,i.onScrollbarXChange);return w.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),p.jsx(yU,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":D1(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(i.viewport){const m=i.viewport.scrollLeft+f.deltaX;e.onWheelScroll(m),wU(m,h)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:wx(o.paddingLeft),paddingEnd:wx(o.paddingRight)}})}})}),Owe=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=bi(Po,e.__scopeScrollArea),[o,a]=w.useState(),c=w.useRef(null),u=Pc(t,c,i.onScrollbarYChange);return w.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),p.jsx(yU,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":D1(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(i.viewport){const m=i.viewport.scrollTop+f.deltaY;e.onWheelScroll(m),wU(m,h)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:wx(o.paddingTop),paddingEnd:wx(o.paddingBottom)}})}})}),[jwe,gU]=uU(Po),yU=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:f,onResize:h,...m}=e,y=bi(Po,n),[v,x]=w.useState(null),E=Pc(t,D=>x(D)),N=w.useRef(null),_=w.useRef(""),C=y.viewport,j=r.content-r.viewport,A=va(f),$=va(c),R=P1(h,10);function M(D){if(N.current){const P=D.clientX-N.current.left,F=D.clientY-N.current.top;u({x:P,y:F})}}return w.useEffect(()=>{const D=P=>{const F=P.target;(v==null?void 0:v.contains(F))&&A(P,j)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[C,v,j,A]),w.useEffect($,[r,$]),$h(v,R),$h(y.content,R),p.jsx(jwe,{scope:n,scrollbar:v,hasThumb:s,onThumbChange:va(i),onThumbPointerUp:va(o),onThumbPositionChange:$,onThumbPointerDown:va(a),children:p.jsx(xd.div,{...m,ref:E,style:{position:"absolute",...m.style},onPointerDown:hc(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),N.current=v.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),M(D))}),onPointerMove:hc(e.onPointerMove,M),onPointerUp:hc(e.onPointerUp,D=>{const P=D.target;P.hasPointerCapture(D.pointerId)&&P.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=_.current,y.viewport&&(y.viewport.style.scrollBehavior=""),N.current=null})})})}),xx="ScrollAreaThumb",bU=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=gU(xx,e.__scopeScrollArea);return p.jsx(Vy,{present:n||s.hasThumb,children:p.jsx(Awe,{ref:t,...r})})}),Awe=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=bi(xx,n),o=gU(xx,n),{onThumbPositionChange:a}=o,c=Pc(t,h=>o.onThumbChange(h)),u=w.useRef(void 0),f=P1(()=>{u.current&&(u.current(),u.current=void 0)},100);return w.useEffect(()=>{const h=i.viewport;if(h){const m=()=>{if(f(),!u.current){const y=Mwe(h,a);u.current=y,a()}};return a(),h.addEventListener("scroll",m),()=>h.removeEventListener("scroll",m)}},[i.viewport,f,a]),p.jsx(xd.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:hc(e.onPointerDownCapture,h=>{const y=h.target.getBoundingClientRect(),v=h.clientX-y.left,x=h.clientY-y.top;o.onThumbPointerDown({x:v,y:x})}),onPointerUp:hc(e.onPointerUp,o.onThumbPointerUp)})});bU.displayName=xx;var eT="ScrollAreaCorner",$we=w.forwardRef((e,t)=>{const n=bi(eT,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(Twe,{...e,ref:t}):null});$we.displayName=eT;var Twe=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=bi(eT,n),[i,o]=w.useState(0),[a,c]=w.useState(0),u=!!(i&&a);return $h(s.scrollbarX,()=>{var h;const f=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(f),c(f)}),$h(s.scrollbarY,()=>{var h;const f=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(f),o(f)}),u?p.jsx(xd.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function wx(e){return e?parseInt(e,10):0}function vU(e,t){const n=e/t;return isNaN(n)?0:n}function D1(e){const t=vU(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Rwe(e,t,n,r="ltr"){const s=D1(n),i=s/2,o=t||i,a=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,h=r==="ltr"?[0,f]:[f*-1,0];return xU([c,u],h)(e)}function BI(e,t,n="ltr"){const r=D1(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,a=i-r,c=n==="ltr"?[0,o]:[o*-1,0],u=wwe(e,c);return xU([0,o],[0,a])(u)}function xU(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function wU(e,t){return e>0&&e<t}var Mwe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,a=n.top!==i.top;(o||a)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function P1(e,t){const n=va(e),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function $h(e,t){const n=va(t);vx(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var SU=dU,EU=hU,Sx=pU,Ex=bU,tT="Switch",[kwe,DPe]=cU(tT),[Iwe,Dwe]=kwe(tT),NU=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:a,value:c="on",onCheckedChange:u,form:f,...h}=e,[m,y]=w.useState(null),v=Pc(t,C=>y(C)),x=w.useRef(!1),E=m?f||!!m.closest("form"):!0,[N=!1,_]=fwe({prop:s,defaultProp:i,onChange:u});return p.jsxs(Iwe,{scope:n,checked:N,disabled:a,children:[p.jsx(xd.button,{type:"button",role:"switch","aria-checked":N,"aria-required":o,"data-state":OU(N),"data-disabled":a?"":void 0,disabled:a,value:c,...h,ref:v,onClick:hc(e.onClick,C=>{_(j=>!j),E&&(x.current=C.isPropagationStopped(),x.current||C.stopPropagation())})}),E&&p.jsx(Pwe,{control:m,bubbles:!x.current,name:r,value:c,checked:N,required:o,disabled:a,form:f,style:{transform:"translateX(-100%)"}})]})});NU.displayName=tT;var _U="SwitchThumb",CU=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=Dwe(_U,n);return p.jsx(xd.span,{"data-state":OU(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});CU.displayName=_U;var Pwe=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,i=w.useRef(null),o=vwe(n),a=xwe(t);return w.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&h){const m=new Event("click",{bubbles:r});h.call(c,n),c.dispatchEvent(m)}},[o,n,r]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function OU(e){return e?"checked":"unchecked"}var Lwe=NU,Fwe=CU;const Bwe={xs:{className:"p-0.5",size:13},sm:{className:"p-0.5",size:15},md:{className:"p-1",size:18},lg:{className:"p-1.5",size:22}},St=w.forwardRef(({Icon:e,size:t,variant:n="ghost",onClick:r,disabled:s,iconProps:i,...o},a)=>{const c=Bwe[t??"md"];return p.jsx(ot,{ref:a,variant:n,iconSize:c.size,iconProps:i,IconLeft:e,className:Ue(c.className,o.className),onClick:r,disabled:s})});function jU(e){const t=e.match(/:(\w+)\??/);return(t==null?void 0:t[1])??""}function zI(e,t){return t?e.replace(/:\w+\??/,t):e.replace(/\/:\w+\??/,"")}function nT(e,t){const n=Vwe(e??""),r=e??(n==null?void 0:n.path)??"",s=jU(r),i=J$()[s],[o,a]=w.useState(i===t),c=n?t===n.activeIdentifier:o,[,u]=yi();function f(h){const m=h??!o;n&&n.setActiveIdentifier(t),r?u(m?zI(r,t):zI(r)):a(m)}return w.useEffect(()=>{!n&&e&&t&&a(i===t)},[i,t,e]),{active:c,toggle:f}}const AU=w.createContext(void 0);function zwe({children:e,defaultIdentifier:t,path:n}){const r=jU(n),s=J$()[r],[i,o]=w.useState(s??t);return p.jsx(AU.Provider,{value:{defaultIdentifier:t,path:n,activeIdentifier:i,setActiveIdentifier:o},children:e})}function Vwe(e){const t=w.use(AU);if(t&&(!e||t.path===e))return t}const $U=w.createContext(void 0);function Uwe({children:e}){const{width:t}=oQ(),[n,r]=Gh(t>768);return p.jsx($U.Provider,{value:{sidebar:{open:n,handler:r}},children:e})}function qwe(){return w.useContext($U)}const Th=K$(iU(k1({sidebarOpen:!1,sidebarWidth:350},e=>({toggleSidebar:()=>e(t=>({sidebarOpen:!t.sidebarOpen})),closeSidebar:()=>e({sidebarOpen:!1}),openSidebar:()=>e({sidebarOpen:!0}),setSidebarWidth:t=>e({sidebarWidth:t}),resetSidebarWidth:()=>e({sidebarWidth:350})})),{name:"appshell"}));var TU={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},VI=Re.createContext&&Re.createContext(TU),Hwe=["attr","size","title"];function Wwe(e,t){if(e==null)return{};var n=Gwe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gwe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Nx(){return Nx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nx.apply(this,arguments)}function UI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UI(Object(n),!0).forEach(function(r){Ywe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ywe(e,t,n){return t=Jwe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jwe(e){var t=Xwe(e,"string");return typeof t=="symbol"?t:t+""}function Xwe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function RU(e){return e&&e.map((t,n)=>Re.createElement(t.tag,_x({key:n},t.attr),RU(t.child)))}function Ke(e){return t=>Re.createElement(Kwe,Nx({attr:_x({},e.attr)},t),RU(e.child))}function Kwe(e){var t=n=>{var{attr:r,size:s,title:i}=e,o=Wwe(e,Hwe),a=s||n.size||"1em",c;return n.className&&(c=n.className),e.className&&(c=(c?c+" ":"")+e.className),Re.createElement("svg",Nx({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:c,style:_x(_x({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Re.createElement("title",null,i),e.children)};return VI!==void 0?Re.createElement(VI.Consumer,null,n=>t(n)):t(TU)}function Qwe(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15.079 5.999l.239 .012c1.43 .097 3.434 1.013 4.508 2.586a1 1 0 0 1 -.344 1.44c-.05 .028 -.372 .158 -.497 .217a4.15 4.15 0 0 0 -.722 .431c-.614 .461 -.948 1.009 -.942 1.694c.01 .885 .339 1.454 .907 1.846c.208 .143 .436 .253 .666 .33c.126 .043 .426 .116 .444 .122a1 1 0 0 1 .662 .942c0 2.621 -3.04 6.381 -5.286 6.381c-.79 0 -1.272 -.091 -1.983 -.315l-.098 -.031c-.463 -.146 -.702 -.192 -1.133 -.192c-.52 0 -.863 .06 -1.518 .237l-.197 .053c-.575 .153 -.964 .226 -1.5 .248c-2.749 0 -5.285 -5.093 -5.285 -9.072c0 -3.87 1.786 -6.92 5.286 -6.92c.297 0 .598 .045 .909 .128c.403 .107 .774 .26 1.296 .508c.787 .374 .948 .44 1.009 .44h.016c.03 -.003 .128 -.047 1.056 -.457c1.061 -.467 1.864 -.685 2.746 -.616l-.24 -.012z"},child:[]},{tag:"path",attr:{d:"M14 1a1 1 0 0 1 1 1a3 3 0 0 1 -3 3a1 1 0 0 1 -1 -1a3 3 0 0 1 3 -3z"},child:[]}]})(e)}function Zwe(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14.983 3l.123 .006c2.014 .214 3.527 .672 4.966 1.673a1 1 0 0 1 .371 .488c1.876 5.315 2.373 9.987 1.451 12.28c-1.003 2.005 -2.606 3.553 -4.394 3.553c-.732 0 -1.693 -.968 -2.328 -2.045a21.512 21.512 0 0 0 2.103 -.493a1 1 0 1 0 -.55 -1.924c-3.32 .95 -6.13 .95 -9.45 0a1 1 0 0 0 -.55 1.924c.717 .204 1.416 .37 2.103 .494c-.635 1.075 -1.596 2.044 -2.328 2.044c-1.788 0 -3.391 -1.548 -4.428 -3.629c-.888 -2.217 -.39 -6.89 1.485 -12.204a1 1 0 0 1 .371 -.488c1.439 -1.001 2.952 -1.459 4.966 -1.673a1 1 0 0 1 .935 .435l.063 .107l.651 1.285l.137 -.016a12.97 12.97 0 0 1 2.643 0l.134 .016l.65 -1.284a1 1 0 0 1 .754 -.54l.122 -.009zm-5.983 7a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15zm6 0a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15z"},child:[]}]})(e)}function e1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18 2a1 1 0 0 1 .993 .883l.007 .117v4a1 1 0 0 1 -.883 .993l-.117 .007h-3v1h3a1 1 0 0 1 .991 1.131l-.02 .112l-1 4a1 1 0 0 1 -.858 .75l-.113 .007h-2v6a1 1 0 0 1 -.883 .993l-.117 .007h-4a1 1 0 0 1 -.993 -.883l-.007 -.117v-6h-2a1 1 0 0 1 -.993 -.883l-.007 -.117v-4a1 1 0 0 1 .883 -.993l.117 -.007h2v-1a6 6 0 0 1 5.775 -5.996l.225 -.004h3z"},child:[]}]})(e)}function t1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.315 2.1c.791 -.113 1.9 .145 3.333 .966l.272 .161l.16 .1l.397 -.083a13.3 13.3 0 0 1 4.59 -.08l.456 .08l.396 .083l.161 -.1c1.385 -.84 2.487 -1.17 3.322 -1.148l.164 .008l.147 .017l.076 .014l.05 .011l.144 .047a1 1 0 0 1 .53 .514a5.2 5.2 0 0 1 .397 2.91l-.047 .267l-.046 .196l.123 .163c.574 .795 .93 1.728 1.03 2.707l.023 .295l.007 .272c0 3.855 -1.659 5.883 -4.644 6.68l-.245 .061l-.132 .029l.014 .161l.008 .157l.004 .365l-.002 .213l-.003 3.834a1 1 0 0 1 -.883 .993l-.117 .007h-6a1 1 0 0 1 -.993 -.883l-.007 -.117v-.734c-1.818 .26 -3.03 -.424 -4.11 -1.878l-.535 -.766c-.28 -.396 -.455 -.579 -.589 -.644l-.048 -.019a1 1 0 0 1 .564 -1.918c.642 .188 1.074 .568 1.57 1.239l.538 .769c.76 1.079 1.36 1.459 2.609 1.191l.001 -.678l-.018 -.168a5.03 5.03 0 0 1 -.021 -.824l.017 -.185l.019 -.12l-.108 -.024c-2.976 -.71 -4.703 -2.573 -4.875 -6.139l-.01 -.31l-.004 -.292a5.6 5.6 0 0 1 .908 -3.051l.152 -.222l.122 -.163l-.045 -.196a5.2 5.2 0 0 1 .145 -2.642l.1 -.282l.106 -.253a1 1 0 0 1 .529 -.514l.144 -.047l.154 -.03z"},child:[]}]})(e)}function n1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 2a9.96 9.96 0 0 1 6.29 2.226a1 1 0 0 1 .04 1.52l-1.51 1.362a1 1 0 0 1 -1.265 .06a6 6 0 1 0 2.103 6.836l.001 -.004h-3.66a1 1 0 0 1 -.992 -.883l-.007 -.117v-2a1 1 0 0 1 1 -1h6.945a1 1 0 0 1 .994 .89c.04 .367 .061 .737 .061 1.11c0 5.523 -4.477 10 -10 10s-10 -4.477 -10 -10s4.477 -10 10 -10z"},child:[]}]})(e)}function r1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"},child:[]}]})(e)}function s1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z"},child:[]}]})(e)}function i1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.333 2c1.96 0 3.56 1.537 3.662 3.472l.005 .195v12.666c0 1.96 -1.537 3.56 -3.472 3.662l-.195 .005h-12.666a3.667 3.667 0 0 1 -3.662 -3.472l-.005 -.195v-12.666c0 -1.96 1.537 -3.56 3.472 -3.662l.195 -.005h12.666zm-2.626 7.293a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"},child:[]}]})(e)}function o1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},child:[]},{tag:"path",attr:{d:"M12 8v4"},child:[]},{tag:"path",attr:{d:"M12 16h.01"},child:[]}]})(e)}function a1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M18 13l-6 6"},child:[]},{tag:"path",attr:{d:"M6 13l6 6"},child:[]}]})(e)}function rT(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]},{tag:"path",attr:{d:"M5 12l6 6"},child:[]},{tag:"path",attr:{d:"M5 12l6 -6"},child:[]}]})(e)}function l1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]},{tag:"path",attr:{d:"M13 18l6 -6"},child:[]},{tag:"path",attr:{d:"M13 6l6 6"},child:[]}]})(e)}function c1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M18 11l-6 -6"},child:[]},{tag:"path",attr:{d:"M6 11l6 -6"},child:[]}]})(e)}function u1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"},child:[]},{tag:"path",attr:{d:"M16 12v1.5a2.5 2.5 0 0 0 5 0v-1.5a9 9 0 1 0 -5.5 8.28"},child:[]}]})(e)}function d1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5"},child:[]},{tag:"path",attr:{d:"M12 12l8 -4.5"},child:[]},{tag:"path",attr:{d:"M12 12l0 9"},child:[]},{tag:"path",attr:{d:"M12 12l-8 -4.5"},child:[]}]})(e)}function f1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 4a2 2 0 0 0 -2 2v3a2 3 0 0 1 -2 3a2 3 0 0 1 2 3v3a2 2 0 0 0 2 2"},child:[]},{tag:"path",attr:{d:"M17 4a2 2 0 0 1 2 2v3a2 3 0 0 0 2 3a2 3 0 0 0 -2 3v3a2 2 0 0 1 -2 2"},child:[]}]})(e)}function h1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 4m0 4a4 4 0 0 1 4 -4h8a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-8a4 4 0 0 1 -4 -4z"},child:[]},{tag:"path",attr:{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16.5 7.5l0 .01"},child:[]}]})(e)}function p1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-10 0a10 10 0 1 0 20 0a10 10 0 1 0 -20 0"},child:[]},{tag:"path",attr:{d:"M12.556 6c.65 0 1.235 .373 1.508 .947l2.839 7.848a1.646 1.646 0 0 1 -1.01 2.108a1.673 1.673 0 0 1 -2.068 -.851l-.46 -1.052h-2.73l-.398 .905a1.67 1.67 0 0 1 -1.977 1.045l-.153 -.047a1.647 1.647 0 0 1 -1.056 -1.956l2.824 -7.852a1.664 1.664 0 0 1 1.409 -1.087l1.272 -.008z"},child:[]}]})(e)}function m1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 4l11.733 16h4.267l-11.733 -16z"},child:[]},{tag:"path",attr:{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"},child:[]}]})(e)}function MU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z"},child:[]},{tag:"path",attr:{d:"M16 3v4"},child:[]},{tag:"path",attr:{d:"M8 3v4"},child:[]},{tag:"path",attr:{d:"M4 11h16"},child:[]},{tag:"path",attr:{d:"M11 15h1"},child:[]},{tag:"path",attr:{d:"M12 15v3"},child:[]}]})(e)}function g1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l5 5l10 -10"},child:[]}]})(e)}function kU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 9l6 6l6 -6"},child:[]}]})(e)}function y1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 6l-6 6l6 6"},child:[]}]})(e)}function b1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 6l6 6l-6 6"},child:[]}]})(e)}function v1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 15l6 -6l6 6"},child:[]}]})(e)}function x1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M11 7l-5 5l5 5"},child:[]},{tag:"path",attr:{d:"M17 7l-5 5l5 5"},child:[]}]})(e)}function w1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7l5 5l-5 5"},child:[]},{tag:"path",attr:{d:"M13 7l5 5l-5 5"},child:[]}]})(e)}function S1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"},child:[]}]})(e)}function sT(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.183 6.117a6 6 0 1 0 4.511 3.986"},child:[]},{tag:"path",attr:{d:"M14.813 17.883a6 6 0 1 0 -4.496 -3.954"},child:[]}]})(e)}function E1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 12h6"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2"},child:[]}]})(e)}function IU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},child:[]},{tag:"path",attr:{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},child:[]}]})(e)}function DU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3"},child:[]},{tag:"path",attr:{d:"M4 6v6c0 1.657 3.582 3 8 3c1.075 0 2.1 -.08 3.037 -.224"},child:[]},{tag:"path",attr:{d:"M20 12v-6"},child:[]},{tag:"path",attr:{d:"M4 12v6c0 1.657 3.582 3 8 3c.166 0 .331 -.002 .495 -.006"},child:[]},{tag:"path",attr:{d:"M16 19h6"},child:[]},{tag:"path",attr:{d:"M19 16v6"},child:[]}]})(e)}function N1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0"},child:[]},{tag:"path",attr:{d:"M4 6v6a8 3 0 0 0 16 0v-6"},child:[]},{tag:"path",attr:{d:"M4 12v6a8 3 0 0 0 16 0v-6"},child:[]}]})(e)}function PPe(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.831 20.413l-5.375 -6.91c-.608 -.783 -.608 -2.223 0 -3l5.375 -6.911a1.457 1.457 0 0 1 2.338 0l5.375 6.91c.608 .783 .608 2.223 0 3l-5.375 6.911a1.457 1.457 0 0 1 -2.338 0z"},child:[]}]})(e)}function _1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function Lc(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function C1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"},child:[]},{tag:"path",attr:{d:"M11 13l9 -9"},child:[]},{tag:"path",attr:{d:"M15 4h5v5"},child:[]}]})(e)}function O1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"},child:[]},{tag:"path",attr:{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"},child:[]},{tag:"path",attr:{d:"M3 3l18 18"},child:[]}]})(e)}function PU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"},child:[]}]})(e)}function LU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3"},child:[]},{tag:"path",attr:{d:"M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6"},child:[]},{tag:"path",attr:{d:"M12 11v2a14 14 0 0 0 2.5 8"},child:[]},{tag:"path",attr:{d:"M8 15a18 18 0 0 0 1.8 6"},child:[]},{tag:"path",attr:{d:"M4.9 19a22 22 0 0 1 -.9 -7v-1a8 8 0 0 1 12 -6.95"},child:[]}]})(e)}function j1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function A1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 3h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M3 17h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M17 17h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M7 17l5 -4l5 4"},child:[]},{tag:"path",attr:{d:"M12 7l0 6"},child:[]}]})(e)}function $1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},child:[]},{tag:"path",attr:{d:"M12 9h.01"},child:[]},{tag:"path",attr:{d:"M11 12h1v4h1"},child:[]}]})(e)}function LPe(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0z"},child:[]},{tag:"path",attr:{d:"M15 9h.01"},child:[]}]})(e)}function T1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 8v-2a2 2 0 0 1 2 -2h2"},child:[]},{tag:"path",attr:{d:"M4 16v2a2 2 0 0 0 2 2h2"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v2"},child:[]},{tag:"path",attr:{d:"M16 20h2a2 2 0 0 0 2 -2v-2"},child:[]}]})(e)}function R1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 6l16 0"},child:[]},{tag:"path",attr:{d:"M4 12l16 0"},child:[]},{tag:"path",attr:{d:"M4 18l16 0"},child:[]}]})(e)}function M1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]}]})(e)}function k1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 10l2 -2v8"},child:[]},{tag:"path",attr:{d:"M9 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3"},child:[]},{tag:"path",attr:{d:"M17 8h2.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-1.5h1.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-2.5"},child:[]}]})(e)}function Uy(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 8h.01"},child:[]},{tag:"path",attr:{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"},child:[]},{tag:"path",attr:{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"},child:[]},{tag:"path",attr:{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"},child:[]}]})(e)}function FU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M5 12l14 0"},child:[]}]})(e)}function I1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},child:[]},{tag:"path",attr:{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},child:[]}]})(e)}function iT(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 9l4 -4l4 4"},child:[]},{tag:"path",attr:{d:"M16 15l-4 4l-4 -4"},child:[]}]})(e)}function fp(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"},child:[]},{tag:"path",attr:{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]}]})(e)}function wO(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M15 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M6 15v-1a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v1"},child:[]},{tag:"path",attr:{d:"M12 9l0 3"},child:[]}]})(e)}function D1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"},child:[]}]})(e)}function qI(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 15h16"},child:[]},{tag:"path",attr:{d:"M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"},child:[]},{tag:"path",attr:{d:"M4 20h12"},child:[]}]})(e)}function P1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M2 6m0 6a6 6 0 0 1 6 -6h8a6 6 0 0 1 6 6v0a6 6 0 0 1 -6 6h-8a6 6 0 0 1 -6 -6z"},child:[]}]})(e)}function BU(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 7l16 0"},child:[]},{tag:"path",attr:{d:"M10 11l0 6"},child:[]},{tag:"path",attr:{d:"M14 11l0 6"},child:[]},{tag:"path",attr:{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"},child:[]},{tag:"path",attr:{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"},child:[]}]})(e)}function L1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},child:[]},{tag:"path",attr:{d:"M7 9l5 -5l5 5"},child:[]},{tag:"path",attr:{d:"M12 4l0 12"},child:[]}]})(e)}function F1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"},child:[]},{tag:"path",attr:{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"},child:[]}]})(e)}function B1e(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 4c-2.5 5 -2.5 10 0 16m14 -16c2.5 5 2.5 10 0 16m-10 -11h1c1 0 1 1 2.016 3.527c.984 2.473 .984 3.473 1.984 3.473h1"},child:[]},{tag:"path",attr:{d:"M8 16c1.5 0 3 -2 4 -3.5s2.5 -3.5 4 -3.5"},child:[]}]})(e)}function oT(e){return Ke({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 6l-12 12"},child:[]},{tag:"path",attr:{d:"M6 6l12 12"},child:[]}]})(e)}function Ur({children:e,defaultOpen:t=!1,openEvent:n="onClick",position:r="bottom-start",dropdownWrapperProps:s,items:i,title:o,hideOnEmpty:a=!0,onClickItem:c,renderItem:u,itemsClassName:f,className:h}){const[m,y]=w.useState(t),[v,x]=w.useState(r),E=yy(()=>y(!1)),N=i.filter(Boolean),[_,C]=w.useState(0),j=Lt((V=50)=>setTimeout(()=>y(H=>!H),typeof V=="number"?V:0)),A=n==="onClick"?V=>{V.stopPropagation(),j()}:void 0,$=Lt(V=>{var T;if(n!=="onContextMenu")return;if(V.preventDefault(),m){j(0),setTimeout(()=>{x(r),C(0)},10);return}const H=V.clientX-V.currentTarget.getBoundingClientRect().left,{left:I=0,right:B=0}=((T=E.current)==null?void 0:T.getBoundingClientRect())??{};if(I>0&&B>0){const L=qL(H,I,B);H<(I+B)/2?(x("bottom-start"),C(L)):(x("bottom-end"),C(B-L))}else x(r),C(0);j()}),R=4,M={"bottom-start":{top:"100%",left:_,marginTop:R},"bottom-end":{right:_,top:"100%",marginTop:R},"top-start":{bottom:"100%",marginBottom:R},"top-end":{bottom:"100%",right:_,marginBottom:R}}[v],D=Lt(V=>{V.onClick&&V.onClick(),c&&c(V),j(50)});if(N.length===0&&a)return null;const P=N.some(V=>"icon"in V&&V.icon),F=u||((V,{key:H,onClick:I})=>typeof V=="function"?p.jsx(w.Fragment,{children:V()},H):p.jsxs("button",{type:"button",disabled:V.disabled,className:Ue("flex flex-row flex-nowrap text-nowrap items-center outline-none cursor-pointer px-2.5 rounded-md link leading-none h-8",f,V.disabled?"opacity-50 cursor-not-allowed":"hover:bg-primary/10",V.destructive&&"text-red-500 hover:bg-red-600 hover:text-white"),onClick:I,title:V.title,children:[P&&p.jsx("div",{className:"size-[16px] text-left mr-1.5 opacity-80",children:V.icon&&p.jsx(V.icon,{className:"size-[16px]"})}),p.jsx("div",{className:"flex flex-grow truncate text-nowrap",children:V.label})]},H));return p.jsxs("div",{role:"dropdown",className:Ue("relative flex",h),ref:E,onContextMenu:$,children:[w.cloneElement(e,{onClick:A}),m&&p.jsxs("div",{...s,className:Ue("absolute z-30 flex flex-col bg-background border border-muted px-1 py-1 rounded-lg shadow-lg min-w-full",s==null?void 0:s.className),style:M,children:[o&&p.jsx("div",{className:"text-sm font-bold px-2.5 mb-1 mt-1 opacity-50 truncate",children:o}),N.map((V,H)=>F(V,{key:H,onClick:I=>{I.stopPropagation(),D(V)}}))]})]})}function z1e(){const[e,t]=yi(),n=[{label:"Data",href:"/data",Icon:N1e},{label:"Auth",href:"/auth",Icon:LU},{label:"Media",href:"/media",Icon:Uy},{label:"Flows",href:"/flows",Icon:A1e}],r=n.find(o=>o.exact?e===o.href:e.startsWith(o.href)),s=Lt(o=>{t(o.href)}),i=(o,{key:a,onClick:c})=>p.jsx(tg,{onClick:c,as:"button",className:"rounded-md",children:p.jsxs("div",{"data-active":(r==null?void 0:r.label)===o.label,className:"flex flex-row items-center gap-2.5 data-[active=true]:opacity-50",children:[p.jsx(o.Icon,{size:18}),p.jsx("span",{className:"text-lg",children:o.label})]})},a);return p.jsxs(p.Fragment,{children:[p.jsx("nav",{className:"hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center",children:n.map(o=>p.jsx(tg,{as:jn,href:o.href,Icon:o.Icon,disabled:o.disabled,children:o.label},o.href))}),p.jsx("nav",{className:"flex md:hidden flex-row items-center",children:r&&p.jsx(Ur,{items:n,onClickItem:s,renderItem:i,children:p.jsx(tg,{as:"button",Icon:r.Icon,className:"active pl-6 pr-3.5",children:p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx("span",{className:"text-lg",children:r.label}),p.jsx(iT,{size:18,className:"opacity-70"})]})})})})]})}function V1e(){const e=Th(n=>n.toggleSidebar),t=Th(n=>n.sidebarOpen);return p.jsx(St,{id:"toggle-sidebar",size:"lg",Icon:t?oT:R1e,onClick:e})}function U1e({hasSidebar:e=!0}){const{app:t}=Tt(),{theme:n}=Dc(),{logo_return_path:r="/"}=t.options;return p.jsxs("header",{id:"header","data-shell":"header",className:"flex flex-row w-full h-16 gap-2.5 border-muted border-b justify-start bg-muted/10",children:[p.jsx(jn,{href:r,native:r!=="/",className:"max-h-full flex hover:bg-primary/5 link p-2.5 w-[134px] outline-none",children:p.jsx(I1,{theme:n})}),p.jsx(z1e,{}),p.jsx("div",{className:"flex flex-grow"}),p.jsxs("div",{className:"flex md:hidden flex-row items-center pr-2 gap-2",children:[p.jsx(V1e,{}),p.jsx(HI,{})]}),p.jsx("div",{className:"hidden md:flex flex-row items-center px-4 gap-2",children:p.jsx(HI,{})})]})}function HI(){var c;const{config:e,options:t}=Tt(),n=$V(),[r]=$n(),{logout_route:s}=A1();async function i(){await n.logout(),r(s,{reload:!0})}async function o(){r("/auth/login")}const a=[{label:"Settings",onClick:()=>r("/settings"),icon:Fg},{label:"OpenAPI",onClick:()=>window.open("/api/system/swagger","_blank"),icon:sve},{label:"Docs",onClick:()=>window.open("https://docs.bknd.io","_blank"),icon:ove}];return e.auth.enabled&&(n.user?a.push({label:"Logout",title:`Logout ${n.user.email}`,onClick:i,icon:bve}):a.push({label:"Login",onClick:o,icon:_ve})),a.push(()=>p.jsx(q1e,{})),a.push(()=>p.jsx("div",{className:"font-mono leading-none text-xs text-primary/50 text-center pb-1 pt-2 mt-1 border-t border-primary/5",children:$ie()})),p.jsx(p.Fragment,{children:p.jsx(Ur,{items:a,position:"bottom-end",children:n.user?p.jsx(ot,{className:"rounded-full w-12 h-12 justify-center p-0 text-lg",children:(c=n.user.email[0])==null?void 0:c.toUpperCase()}):p.jsx(ot,{className:"rounded-full w-12 h-12 justify-center p-0",IconLeft:F1e})})})}function q1e(){const{value:e,themes:t,setTheme:n}=Dc();return p.jsx("div",{className:"flex flex-col items-center mt-1 pt-1 border-t border-primary/5",children:p.jsx(dd,{withItemsBorders:!1,className:"w-full",data:t.map(r=>({value:r,label:wh(r)})),value:e,onChange:n,size:"xs"})})}function zU({children:e}){const t=Th(n=>n.sidebarWidth);return p.jsx(Uwe,{children:p.jsx("div",{id:"app-shell","data-shell":"root",className:"flex flex-1 flex-col select-none h-dvh",style:{"--sidebar-width":`${t}px`},children:e})})}const tg=({children:e,as:t,className:n,Icon:r,disabled:s,...i})=>{const o=t||"a";return p.jsxs(o,{...i,className:Ue("px-6 py-2 [&.active]:bg-muted [&.active]:hover:bg-primary/15 hover:bg-primary/5 flex flex-row items-center rounded-full gap-2.5 link transition-colors",s&&"opacity-50 cursor-not-allowed",n),children:[r&&p.jsx(r,{size:18}),typeof e=="string"?p.jsx("span",{className:"text-lg",children:e}):e]})};function VU({children:e,center:t}){return p.jsx("main",{"data-shell":"content",className:Ue("flex flex-1 flex-row w-dvw h-full",t&&"justify-center items-center"),children:e})}function qy({children:e}){const{sidebar:t}=qwe();return p.jsx("div",{"data-shell":"main",className:Ue("flex flex-col flex-grow w-1 flex-shrink-1",t.open&&"md:max-w-[calc(100%-var(--sidebar-width))]"),children:e})}function Hy({children:e}){const t=Th(o=>o.sidebarOpen),n=Th(o=>o.closeSidebar),r=yy(n,["mouseup","touchend"]),[s]=yi(),i=()=>{t&&n()};return w.useEffect(i,[s]),Nj([["Escape",i]]),p.jsxs(p.Fragment,{children:[p.jsx("aside",{"data-shell":"sidebar",className:"hidden md:flex flex-col basis-[var(--sidebar-width)] flex-shrink-0 flex-grow-0 h-full bg-muted/10",children:e}),p.jsx(H1e,{}),p.jsx("div",{"data-open":t,className:"absolute w-full md:hidden data-[open=true]:translate-x-0 translate-x-[-100%] transition-transform z-10 backdrop-blur-sm",children:p.jsx("aside",{ref:r,"data-shell":"sidebar",className:"flex-col w-[var(--sidebar-width)] flex-shrink-0 flex-grow-0 h-full border-muted border-r bg-background",children:e})})]})}const H1e=()=>{const e=Th(f=>f.setSidebarWidth),[t,n]=w.useState(!1),[r,s]=w.useState(0),[i,o]=w.useState(0),a=f=>{f.preventDefault(),n(!0),s(f.clientX),o(Number.parseInt(getComputedStyle(document.getElementById("app-shell")).getPropertyValue("--sidebar-width").replace("px","")))},c=f=>{if(!t)return;const h=f.clientX-r,m=qL(i+h,250,window.innerWidth*.5);e(m)},u=()=>{n(!1)};return w.useEffect(()=>(t&&(window.addEventListener("mousemove",c),window.addEventListener("mouseup",u)),()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u)}),[t,r,i]),p.jsx("div",{"data-active":t?1:void 0,className:"w-px h-full hidden md:flex bg-muted after:transition-colors relative after:absolute after:inset-0 after:-left-px after:w-[2px] select-none data-[active]:after:bg-sky-400 data-[active]:cursor-col-resize hover:after:bg-sky-400 hover:cursor-col-resize after:z-2",onMouseDown:a,style:{touchAction:"none"}})};function UU({children:e,className:t,...n}){return p.jsx("h2",{...n,className:Ue("text-lg dark:font-bold font-semibold select-text",t),children:e})}function Wn({children:e,right:t,className:n,scrollable:r,sticky:s}={}){return p.jsxs("div",{className:Ue("flex flex-row h-14 flex-shrink-0 py-2 pl-5 pr-3 border-muted border-b items-center justify-between bg-muted/10",s&&"sticky top-0 bottom-10 z-10",n),children:[p.jsx("div",{className:Ue("",r&&"overflow-x-scroll overflow-y-visible app-scrollbar"),children:typeof e=="string"?p.jsx(UU,{children:e}):e}),t&&!r&&p.jsx("div",{className:"flex flex-row gap-2.5",children:t}),t&&r&&p.jsxs("div",{className:"flex flex-row sticky z-10 right-0 h-full",children:[p.jsx("div",{className:"h-full w-5 bg-gradient-to-l from-background"}),p.jsx("div",{className:"flex flex-row gap-2.5 bg-background",children:t})]})]})}const bs=({children:e,as:t,className:n,disabled:r=!1,...s})=>{const i=t||"a";return p.jsx(i,{...s,className:Ue("flex flex-row px-4 items-center gap-2 h-12",!r&&"cursor-pointer rounded-md [&.active]:bg-primary/10 [&.active]:hover:bg-primary/15 [&.active]:font-medium hover:bg-primary/5 focus:bg-primary/5 link",r&&"opacity-50 cursor-not-allowed pointer-events-none",n),children:e})},W1e=({children:e,as:t,className:n,disabled:r=!1,active:s=!1,badge:i,...o})=>{const a=t||"a";return p.jsxs(a,{...o,className:Ue("hover:bg-primary/5 flex flex-row items-center justify-center gap-2.5 px-5 h-12 leading-none font-medium text-primary/80 rounded-tr-lg rounded-tl-lg",s?"bg-background hover:bg-background text-primary border border-muted border-b-0":"link",i&&"pr-4",n),children:[e,i?p.jsx("span",{className:"px-3 py-1 rounded-full font-mono bg-primary/5 text-sm leading-none",children:i}):null]})},qU=({title:e,items:t})=>p.jsx(Wn,{className:"mt-10 border-t pl-3 pb-0 items-end",children:p.jsxs("div",{className:"flex flex-row items-center gap-6 -mb-px",children:[e&&p.jsx(UU,{className:"pl-2 hidden md:block",children:e}),p.jsx("div",{className:"flex flex-row items-center gap-3",children:t==null?void 0:t.map(({label:n,...r},s)=>p.jsx(W1e,{...r,children:n},s))})]})});function pr({children:e,initialOffset:t=64}){const n=w.useRef(null),[r,s]=w.useState(t);function i(){n.current&&s(n.current.offsetTop)}return w.useEffect(i,[]),typeof window<"u"&&window.addEventListener("resize",qB(i,500)),p.jsxs(SU,{style:{height:`calc(100dvh - ${r}px`},ref:n,children:[p.jsx(EU,{className:"w-full h-full",children:e}),p.jsx(Sx,{forceMount:!0,className:"flex select-none touch-none bg-transparent w-0.5",orientation:"vertical",children:p.jsx(Ex,{className:"flex-1 bg-primary/50"})}),p.jsx(Sx,{forceMount:!0,className:"flex select-none touch-none bg-muted flex-col h-0.5",orientation:"horizontal",children:p.jsx(Ex,{className:"flex-1 bg-primary/50 "})})]})}const G1e=({title:e,open:t,toggle:n,ActiveIcon:r=dve,children:s,renderHeaderRight:i})=>p.jsxs("div",{style:{minHeight:49},className:Ue("flex flex-col flex-animate overflow-hidden",t?"flex-open border-b border-b-muted":"flex-initial cursor-pointer hover:bg-primary/5"),children:[p.jsxs("div",{className:Ue("flex flex-row bg-muted/10 border-muted border-b h-14 py-4 pr-4 pl-2 items-center gap-2"),onClick:n,children:[p.jsx(St,{Icon:t?r:uve,disabled:t}),p.jsx("h2",{className:"text-lg dark:font-bold font-semibold select-text",children:e}),p.jsx("div",{className:"flex flex-grow"}),i==null?void 0:i({open:t})]}),p.jsx("div",{className:Ue("overflow-y-scroll transition-all",t?" flex-grow":"h-0 opacity-0"),children:s})]}),Cx=({routePattern:e,identifier:t,...n})=>{const{active:r,toggle:s}=nT(e,t);return p.jsx(G1e,{...n,open:r,toggle:s})},SO=({className:e,...t})=>p.jsx("hr",{...t,className:Ue("border-muted my-3",e)});function Y1e(e){const t=e==="light",n={offset:2,transitionProps:{transition:"pop",duration:75}},r="!bg-muted/40 border-transparent disabled:bg-muted/50 disabled:text-primary/50 focus:!border-zinc-500";return{theme:{components:{Button:Ku.extend({vars:(s,i)=>({root:{"--button-height":"auto"}}),classNames:(s,i)=>({root:Ue("px-3 py-2 rounded-md h-auto")}),defaultProps:{size:"md",variant:t?"filled":"white"}}),Switch:Wa.extend({defaultProps:{size:"md",color:t?"dark":"blue"}}),Select:Kw.extend({classNames:(s,i)=>({input:r,dropdown:`bknd-admin ${e} bg-background border-primary/20`}),defaultProps:{checkIconPosition:"right",comboboxProps:n}}),TagsInput:DA.extend({defaultProps:{comboboxProps:n}}),Radio:Co.extend({defaultProps:{classNames:{body:"items-center"}}}),TextInput:Nn.extend({classNames:(s,i)=>({wrapper:"leading-none",input:r})}),NumberInput:Yw.extend({classNames:(s,i)=>({wrapper:"leading-none",input:r})}),Textarea:Ey.extend({classNames:(s,i)=>({wrapper:"leading-none",input:r})}),Modal:$s.extend({classNames:(s,i)=>({...i.classNames,root:`bknd-admin ${e} ${i.className??""}`,content:"!bg-background !rounded-lg !select-none",overlay:"!backdrop-blur-sm"})}),Tabs:bn.extend({vars:(s,i)=>({root:{"--tabs-color":"border-primary"}})}),Menu:xs.extend({defaultProps:{offset:2},classNames:(s,i)=>({dropdown:"!rounded-lg !px-1",item:"!rounded-md !text-[14px]"})}),SegmentedControl:dd.extend({classNames:(s,i)=>({root:t?"bg-primary/5":"bg-lightest/60",indicator:t?"bg-background":"bg-primary/15"})}),Notifications:Mo.extend({classNames:(s,i)=>({notification:"-top-4 -right-4"})})},primaryColor:"dark",primaryShade:9},forceColorScheme:e}}const J1e="modulepreload",X1e=function(e){return"/"+e},WI={},Wy=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(u=>{if(u=X1e(u),u in WI)return;WI[u]=!0;const f=u.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":J1e,f||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),f)return new Promise((y,v)=>{m.addEventListener("load",y),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};function Fc(){const{config:e,schema:t,actions:n,app:r}=Tt(),s={config:{set:async a=>(console.log("--set",a),await n.set("auth",a,!0)?(await n.reload(),!0):!1)},roles:{add:async(a,c={})=>(console.log("add role",a,c),await n.add("auth",`roles.${a}`,c)),patch:async(a,c)=>(console.log("patch role",a,c),await n.patch("auth",`roles.${a}`,c)),delete:async a=>(console.log("delete role",a),window.confirm(`Are you sure you want to delete the role "${a}"?`)?await n.remove("auth",`roles.${a}`):!1)}},i=["system.access.admin","system.access.api","system.config.read","system.config.read.secrets","system.build"];return{$auth:{roles:{none:Object.keys(e.auth.roles??{}).length===0,minimum_permissions:i,has_admin:Object.entries(e.auth.roles??{}).some(([a,c])=>c.implicit_allow||i.every(u=>{var f;return(f=c.permissions)==null?void 0:f.includes(u)}))},routes:{settings:r.getSettingsPath(["auth"]),listUsers:r.getAbsolutePath("/data/"+ut.data.entity.list(e.auth.entity_name))}},config:e.auth,schema:t.auth,actions:s}}const K1e=({className:e,...t})=>p.jsx(o1e,{...t,className:Ue("dark:text-amber-300 text-amber-700 cursor-help",e)}),aT={Warning:K1e};function as(e=[]){w.useLayoutEffect(()=>{const t="BKND";document.title=[t,...e].join(" / ")})}function Q1e({children:e}){const{config:t,$auth:n}=Fc();return p.jsxs(p.Fragment,{children:[p.jsxs(Hy,{children:[p.jsx(Wn,{right:p.jsx(jn,{href:n.routes.settings,children:p.jsx(St,{Icon:fp})}),children:"Auth"}),p.jsx(pr,{initialOffset:96,children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[p.jsx(bs,{as:jn,href:"/",children:"Overview"}),p.jsxs(bs,{as:jn,href:n.routes.listUsers,disabled:!t.enabled,className:"justify-between",children:["Users",!t.enabled&&p.jsx(_m,{title:"Auth is not enabled."})]}),p.jsxs(bs,{as:jn,href:ut.auth.roles.list(),disabled:!t.enabled,className:"justify-between",children:["Roles & Permissions",t.enabled?n.roles.none?p.jsx(_m,{title:"No roles defined."}):n.roles.has_admin?null:p.jsx(_m,{title:"No admin role defined."}):p.jsx(_m,{title:"Auth is not enabled."})]}),p.jsxs(bs,{as:jn,href:ut.auth.strategies(),disabled:!t.enabled,className:"justify-between",children:["Strategies",!t.enabled&&p.jsx(_m,{title:"Auth is not enabled."})]}),p.jsx(bs,{as:jn,href:ut.auth.settings(),className:"justify-between",children:"Settings"})]})})})]}),p.jsx(qy,{children:e})]})}const _m=({title:e})=>p.jsx(aT.Warning,{title:e,className:"size-5 pointer-events-auto"}),L1=({visible:e=!0,title:t,message:n,className:r,children:s,...i})=>e?p.jsx("div",{...i,className:Ue("flex flex-row items-center p-4",r),children:p.jsxs("p",{children:[t&&p.jsxs("b",{children:[t,": "]}),n||s]})}):null,Z1e=({className:e,...t})=>p.jsx(L1,{...t,className:Ue("bg-warning text-warning-foreground",e)}),eSe=({className:e,...t})=>p.jsx(L1,{...t,className:Ue("bg-error text-error-foreground",e)}),tSe=({className:e,...t})=>p.jsx(L1,{...t,className:Ue("bg-success text-success-foreground",e)}),nSe=({className:e,...t})=>p.jsx(L1,{...t,className:Ue("bg-info text-info-foreground",e)}),xo={Warning:Z1e,Exception:eSe,Success:tSe,Info:nSe};function rSe(){var y;const{app:e}=Tt(),{config:{roles:t,strategies:n,entity_name:r,enabled:s}}=Fc(),i=r,a=((y=$1(v=>v.data.count(i),{enabled:s}).data)==null?void 0:y.count)??0,c=Object.keys(t??{}).length??0,u=Object.keys(n??{}).length??0,f=e.getAbsolutePath("/data/"+ut.data.entity.list(i)),h=ut.auth.roles.list(),m=ut.auth.strategies();return p.jsxs(p.Fragment,{children:[p.jsx(Wn,{children:"Overview"}),p.jsxs(pr,{children:[p.jsx(xo.Warning,{visible:!s,title:"Auth not enabled",message:"To use authentication features, please enable it in the settings."}),p.jsxs("div",{className:"flex flex-col md:flex-row flex-1 p-3 gap-3",children:[p.jsxs("div",{className:"flex flex-col border border-primary/20 self-stretch md:self-start",children:[p.jsxs("div",{className:"flex flex-row gap-3 py-3 px-4 border-b border-b-muted font-medium bg-muted items-center justify-between",children:["Getting started",p.jsx(LU,{className:"size-5"})]}),p.jsx(zb,{title:"Enable authentication",done:s,to:ut.auth.settings()}),p.jsx(zb,{title:"Create Roles",done:c>0,to:h}),p.jsx(zb,{title:"Create an user",done:a>0,to:f}),p.jsx(zb,{title:"Enable a second strategy",done:u>1,to:m})]}),p.jsxs("div",{className:"grid xs:grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-5 flex-grow",children:[p.jsx(IN,{title:"Users registered",value:s?a:0,actions:[{label:"View all",href:f},{label:"Add new",variant:"default",href:f}]}),p.jsx(IN,{title:"Roles",value:s?c:0,actions:[{label:"View all",href:h},{label:"Manage",variant:"default",href:h}]}),p.jsx(IN,{title:"Strategies enabled",value:s?u:0,actions:[{label:"View all",href:m},{label:"Manage",variant:"default",href:m}]})]})]})]})]})}const IN=({title:e,value:t,actions:n})=>p.jsxs("div",{className:"flex flex-col border border-muted h-auto self-start",children:[p.jsxs("div",{className:"flex flex-col gap-2 px-5 pt-3.5 pb-4 border-b border-b-muted",children:[p.jsx("div",{children:p.jsx("span",{className:"opacity-50",children:e})}),p.jsx("div",{className:"text-4xl font-medium",children:t})]}),p.jsx("div",{className:"flex flex-row gap-3 p-3 justify-between",children:n.map((r,s)=>p.jsx(vO,{size:"small",variant:"ghost",href:"#",...r,children:r.label},s))})]}),zb=({title:e,done:t=!1,to:n})=>{const[r]=$n();return p.jsx("div",{className:"flex border-b border-b-muted",children:p.jsxs("div",{className:hn("flex flex-1 flex-row gap-3 py-3 px-4",t&&"opacity-50"),children:[p.jsxs("div",{className:"flex flex-row flex-1 gap-3 items-center",children:[t?p.jsx(r1e,{className:"size-5"}):p.jsx(S1e,{className:"size-5"}),p.jsx("p",{className:hn("font-medium text-primary/80 leading-none",t?"line-through":""),children:e})]}),n&&p.jsx(St,{Icon:l1e,onClick:()=>r(n)})]})})},lT=w.createContext(null);lT.displayName="@mantine/modals/ModalsContext";function sSe(){const e=w.useContext(lT);if(!e)throw new Error("[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component");return e}function iSe({id:e,cancelProps:t,confirmProps:n,labels:r={cancel:"",confirm:""},closeOnConfirm:s=!0,closeOnCancel:i=!0,groupProps:o,onCancel:a,onConfirm:c,children:u}){const{cancel:f,confirm:h}=r,m=sSe(),y=x=>{typeof(t==null?void 0:t.onClick)=="function"&&(t==null||t.onClick(x)),typeof a=="function"&&a(),i&&m.closeModal(e)},v=x=>{typeof(n==null?void 0:n.onClick)=="function"&&(n==null||n.onClick(x)),typeof c=="function"&&c(),s&&m.closeModal(e)};return p.jsxs(p.Fragment,{children:[u&&p.jsx(ze,{mb:"md",children:u}),p.jsxs(Kj,{mt:u?0:"md",justify:"flex-end",...o,children:[p.jsx(Ku,{variant:"default",...t,onClick:y,children:(t==null?void 0:t.children)||f}),p.jsx(Ku,{...n,onClick:v,children:(n==null?void 0:n.children)||h})]})]})}const[oSe,cT]=yQ("mantine-modals"),aSe=e=>{const t=e.modalId||Bf();return cT("openContextModal")({...e,modalId:t}),t},lSe=cT("closeModal"),cSe=cT("closeAllModals"),HU={closeAll:cSe};function GI(e,t){var n,r,s,i;t&&e.type==="confirm"&&((r=(n=e.props).onCancel)==null||r.call(n)),(i=(s=e.props).onClose)==null||i.call(s)}function uSe(e,t){var n;switch(t.type){case"OPEN":return{current:t.modal,modals:[...e.modals,t.modal]};case"CLOSE":{const r=e.modals.find(i=>i.id===t.modalId);if(!r)return e;GI(r,t.canceled);const s=e.modals.filter(i=>i.id!==t.modalId);return{current:s[s.length-1]||e.current,modals:s}}case"CLOSE_ALL":return e.modals.length?(e.modals.concat().reverse().forEach(r=>{GI(r,t.canceled)}),{current:e.current,modals:[]}):e;case"UPDATE":{const{modalId:r,newProps:s}=t,i=e.modals.map(a=>a.id!==r?a:a.type==="content"||a.type==="confirm"?{...a,props:{...a.props,...s}}:a.type==="context"?{...a,props:{...a.props,...s,innerProps:{...a.props.innerProps,...s.innerProps}}}:a),o=((n=e.current)==null?void 0:n.id)===r&&i.find(a=>a.id===r)||e.current;return{...e,modals:i,current:o}}default:return e}}function dSe(e){if(!e)return{confirmProps:{},modalProps:{}};const{id:t,children:n,onCancel:r,onConfirm:s,closeOnConfirm:i,closeOnCancel:o,cancelProps:a,confirmProps:c,groupProps:u,labels:f,...h}=e;return{confirmProps:{id:t,children:n,onCancel:r,onConfirm:s,closeOnConfirm:i,closeOnCancel:o,cancelProps:a,confirmProps:c,groupProps:u,labels:f},modalProps:{id:t,...h}}}function fSe({children:e,modalProps:t,labels:n,modals:r}){const[s,i]=w.useReducer(uSe,{modals:[],current:null}),o=w.useRef(s);o.current=s;const a=w.useCallback(_=>{i({type:"CLOSE_ALL",canceled:_})},[o,i]),c=w.useCallback(({modalId:_,...C})=>{const j=_||Bf();return i({type:"OPEN",modal:{id:j,type:"content",props:C}}),j},[i]),u=w.useCallback(({modalId:_,...C})=>{const j=_||Bf();return i({type:"OPEN",modal:{id:j,type:"confirm",props:C}}),j},[i]),f=w.useCallback((_,{modalId:C,...j})=>{const A=C||Bf();return i({type:"OPEN",modal:{id:A,type:"context",props:j,ctx:_}}),A},[i]),h=w.useCallback((_,C)=>{i({type:"CLOSE",modalId:_,canceled:C})},[o,i]),m=w.useCallback(({modalId:_,...C})=>{i({type:"UPDATE",modalId:_,newProps:C})},[i]),y=w.useCallback(({modalId:_,...C})=>{i({type:"UPDATE",modalId:_,newProps:C})},[i]);oSe({openModal:c,openConfirmModal:u,openContextModal:({modal:_,...C})=>f(_,C),closeModal:h,closeContextModal:h,closeAllModals:a,updateModal:m,updateContextModal:y});const v={modalProps:t||{},modals:s.modals,openModal:c,openConfirmModal:u,openContextModal:f,closeModal:h,closeContextModal:h,closeAll:a,updateModal:m,updateContextModal:y},x=()=>{const _=o.current.current;switch(_==null?void 0:_.type){case"context":{const{innerProps:C,...j}=_.props,A=r[_.ctx];return{modalProps:j,content:p.jsx(A,{innerProps:C,context:v,id:_.id})}}case"confirm":{const{modalProps:C,confirmProps:j}=dSe(_.props);return{modalProps:C,content:p.jsx(iSe,{...j,id:_.id,labels:_.props.labels||n})}}case"content":{const{children:C,...j}=_.props;return{modalProps:j,content:C}}default:return{modalProps:{},content:null}}},{modalProps:E,content:N}=x();return p.jsxs(lT.Provider,{value:v,children:[p.jsx($s,{zIndex:Qi("modal")+1,...t,...E,opened:s.modals.length>0,onClose:()=>{var _;return h((_=s.current)==null?void 0:_.id)},children:N}),e]})}function uT({context:e,id:t,innerProps:{content:n}}){return n}uT.defaultTitle=void 0;uT.modalProps={withCloseButton:!1,classNames:{size:"md",root:"bknd-admin",content:"text-center justify-center",title:"font-bold !text-md",body:"py-3 px-5 gap-4 flex flex-col"}};const hSe=e=>typeof e=="boolean"||e instanceof Boolean,pSe=e=>typeof e=="number"||e instanceof Number,mSe=e=>typeof e=="bigint"||e instanceof BigInt,WU=e=>!!e&&e instanceof Date,gSe=e=>typeof e=="string"||e instanceof String,ySe=e=>Array.isArray(e),bSe=e=>typeof e=="object"&&e!==null,GU=e=>!!e&&e instanceof Object&&typeof e=="function";function Ox(e,t){return t===void 0&&(t=!1),!e||t?`"${e}"`:e}function vSe(e,t,n){return n?JSON.stringify(e):t?`"${e}"`:e}function YU(e){let{field:t,value:n,data:r,lastElement:s,openBracket:i,closeBracket:o,level:a,style:c,shouldExpandNode:u,clickToExpandNode:f,outerRef:h,beforeExpandChange:m}=e;const y=w.useRef(!1),[v,x]=w.useState(()=>u(a,n,t)),E=w.useRef(null);w.useEffect(()=>{y.current?x(u(a,n,t)):y.current=!0},[u]);const N=w.useId();if(r.length===0)return xSe({field:t,openBracket:i,closeBracket:o,lastElement:s,style:c});const _=v?c.collapseIcon:c.expandIcon,C=v?c.ariaLables.collapseJson:c.ariaLables.expandJson,j=a+1,A=r.length-1,$=D=>{v!==D&&(!m||m({level:a,value:n,field:t,newExpandValue:D}))&&x(D)},R=D=>{if(D.key==="ArrowRight"||D.key==="ArrowLeft")D.preventDefault(),$(D.key==="ArrowRight");else if(D.key==="ArrowUp"||D.key==="ArrowDown"){D.preventDefault();const P=D.key==="ArrowUp"?-1:1;if(!h.current)return;const F=h.current.querySelectorAll("[role=button]");let V=-1;for(let I=0;I<F.length;I++)if(F[I].tabIndex===0){V=I;break}if(V<0)return;const H=(V+P+F.length)%F.length;F[V].tabIndex=-1,F[H].tabIndex=0,F[H].focus()}},M=()=>{var D;$(!v);const P=E.current;if(!P)return;const F=(D=h.current)===null||D===void 0?void 0:D.querySelector('[role=button][tabindex="0"]');F&&(F.tabIndex=-1),P.tabIndex=0,P.focus()};return w.createElement("div",{className:c.basicChildStyle,role:"treeitem","aria-expanded":v,"aria-selected":void 0},w.createElement("span",{className:_,onClick:M,onKeyDown:R,role:"button","aria-label":C,"aria-expanded":v,"aria-controls":v?N:void 0,ref:E,tabIndex:a===0?0:-1}),(t||t==="")&&(f?w.createElement("span",{className:c.clickableLabel,onClick:M,onKeyDown:R},Ox(t,c.quotesForFieldNames),":"):w.createElement("span",{className:c.label},Ox(t,c.quotesForFieldNames),":")),w.createElement("span",{className:c.punctuation},i),v?w.createElement("ul",{id:N,role:"group",className:c.childFieldsContainer},r.map((D,P)=>w.createElement(JU,{key:D[0]||P,field:D[0],value:D[1],style:c,lastElement:P===A,level:j,shouldExpandNode:u,clickToExpandNode:f,outerRef:h}))):w.createElement("span",{className:c.collapsedContent,onClick:M,onKeyDown:R}),w.createElement("span",{className:c.punctuation},o),!s&&w.createElement("span",{className:c.punctuation},","))}function xSe(e){let{field:t,openBracket:n,closeBracket:r,lastElement:s,style:i}=e;return w.createElement("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&w.createElement("span",{className:i.label},Ox(t,i.quotesForFieldNames),":"),w.createElement("span",{className:i.punctuation},n),w.createElement("span",{className:i.punctuation},r),!s&&w.createElement("span",{className:i.punctuation},","))}function wSe(e){let{field:t,value:n,style:r,lastElement:s,shouldExpandNode:i,clickToExpandNode:o,level:a,outerRef:c,beforeExpandChange:u}=e;return YU({field:t,value:n,lastElement:s||!1,level:a,openBracket:"{",closeBracket:"}",style:r,shouldExpandNode:i,clickToExpandNode:o,data:Object.keys(n).map(f=>[f,n[f]]),outerRef:c,beforeExpandChange:u})}function SSe(e){let{field:t,value:n,style:r,lastElement:s,level:i,shouldExpandNode:o,clickToExpandNode:a,outerRef:c,beforeExpandChange:u}=e;return YU({field:t,value:n,lastElement:s||!1,level:i,openBracket:"[",closeBracket:"]",style:r,shouldExpandNode:o,clickToExpandNode:a,data:n.map(f=>[void 0,f]),outerRef:c,beforeExpandChange:u})}function ESe(e){let{field:t,value:n,style:r,lastElement:s}=e,i,o=r.otherValue;return n===null?(i="null",o=r.nullValue):n===void 0?(i="undefined",o=r.undefinedValue):gSe(n)?(i=vSe(n,!r.noQuotesForStringValues,r.stringifyStringValues),o=r.stringValue):hSe(n)?(i=n?"true":"false",o=r.booleanValue):pSe(n)?(i=n.toString(),o=r.numberValue):mSe(n)?(i=`${n.toString()}n`,o=r.numberValue):WU(n)?i=n.toISOString():GU(n)?i="function() { }":i=n.toString(),w.createElement("div",{className:r.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&w.createElement("span",{className:r.label},Ox(t,r.quotesForFieldNames),":"),w.createElement("span",{className:o},i),!s&&w.createElement("span",{className:r.punctuation},","))}function JU(e){const t=e.value;return ySe(t)?w.createElement(SSe,Object.assign({},e)):bSe(t)&&!WU(t)&&!GU(t)?w.createElement(wSe,Object.assign({},e)):w.createElement(ESe,Object.assign({},e))}var jr={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti"};const NSe={collapseJson:"collapse JSON",expandJson:"expand JSON"},YI={container:jr["container-light"],basicChildStyle:jr["basic-element-style"],childFieldsContainer:jr["child-fields-container"],label:jr["label-light"],clickableLabel:jr["clickable-label-light"],nullValue:jr["value-null-light"],undefinedValue:jr["value-undefined-light"],stringValue:jr["value-string-light"],booleanValue:jr["value-boolean-light"],numberValue:jr["value-number-light"],otherValue:jr["value-other-light"],punctuation:jr["punctuation-light"],collapseIcon:jr["collapse-icon-light"],expandIcon:jr["expand-icon-light"],collapsedContent:jr["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:NSe,stringifyStringValues:!1},_Se=()=>!0,CSe=e=>{let{data:t,style:n=YI,shouldExpandNode:r=_Se,clickToExpandNode:s=!1,beforeExpandChange:i,...o}=e;const a=w.useRef(null);return w.createElement("div",Object.assign({"aria-label":"JSON view"},o,{className:n.container,ref:a,role:"tree"}),w.createElement(JU,{value:t,style:{...YI,...n},lastElement:!0,level:0,shouldExpandNode:r,clickToExpandNode:s,outerRef:a,beforeExpandChange:i}))},ui=({json:e,title:t,expand:n=0,showSize:r=!1,showCopy:s=!1,copyIconProps:i={},className:o})=>{const a=r?JSON.stringify(e).length:void 0,c=a||t||s;function u(){var f;(f=navigator.clipboard)==null||f.writeText(JSON.stringify(e,null,2))}return p.jsxs("div",{className:Ue("bg-primary/5 py-3 relative overflow-hidden",o),children:[c&&p.jsxs("div",{className:"absolute right-4 top-3 font-mono text-zinc-400 flex flex-row gap-2 items-center",children:[(t||a)&&p.jsxs("div",{className:"flex flex-row",children:[t&&p.jsx("span",{children:t})," ",a&&p.jsxs("span",{children:["(",a," Bytes)"]})]}),s&&p.jsx("div",{children:p.jsx(St,{Icon:IU,onClick:u,...i})})]}),p.jsx(CSe,{data:e,shouldExpandNode:f=>f<n,style:{basicChildStyle:"pl-5 ml-1 border-l border-muted hover:border-primary/20",container:"ml-[-10px]",label:"text-primary/90 font-bold font-mono mr-2",stringValue:"text-emerald-500 font-mono select-text",numberValue:"text-sky-400 font-mono",nullValue:"text-zinc-400 font-mono",undefinedValue:"text-zinc-400 font-mono",otherValue:"text-zinc-400 font-mono",booleanValue:"text-orange-400 font-mono",punctuation:"text-zinc-400 font-bold font-mono m-0.5",collapsedContent:"text-zinc-400 font-mono after:content-['...']",collapseIcon:"text-zinc-400 font-mono font-bold text-lg after:content-['▾'] mr-1.5",expandIcon:"text-zinc-400 font-mono font-bold text-lg after:content-['▸'] mr-1.5",noQuotesForStringValues:!1}})]})},OSe=w.forwardRef(({classNames:e,children:t,opened:n,closeOnClickOutside:r=!1,...s},i)=>{const[o,{open:a,close:c}]=Gh(n);return w.useImperativeHandle(i,()=>({open:a,close:c})),p.jsx($s,{withCloseButton:!1,padding:0,size:"xl",opened:o,...s,closeOnClickOutside:r,onClose:c,classNames:{...e,root:"bknd-admin",content:"rounded-lg select-none"},children:t})}),vu=({path:e,onClose:t})=>p.jsxs("div",{className:"py-3 px-5 font-bold bg-lightest flex flex-row justify-between items-center sticky top-0 left-0 right-0 z-10 border-none",children:[p.jsx("div",{className:"flex flex-row gap-1",children:e.map((n,r)=>{const s=r+1===e.length;return p.jsxs(w.Fragment,{children:[p.jsx("span",{className:Ue("",!s&&"opacity-70"),children:n},r),!s&&p.jsx("span",{className:"opacity-40",children:"/"})]},r)})}),p.jsx(St,{Icon:oT,onClick:t})]}),wd=({children:e,className:t})=>p.jsxs(SU,{className:Ue("flex flex-col min-h-96",t),style:{maxHeight:"calc(80vh)"},children:[p.jsx(EU,{className:"w-full h-full",children:p.jsx("div",{className:"py-3 px-5 gap-4 flex flex-col",children:e})}),p.jsx(Sx,{forceMount:!0,className:"flex select-none touch-none bg-transparent w-0.5",orientation:"vertical",children:p.jsx(Ex,{className:"flex-1 bg-primary/50"})}),p.jsx(Sx,{forceMount:!0,className:"flex select-none touch-none bg-muted flex-col h-0.5",orientation:"horizontal",children:p.jsx(Ex,{className:"flex-1 bg-primary/50 "})})]}),Sd=({next:e,prev:t,nextLabel:n="Next",prevLabel:r="Back",debug:s})=>{const[i,o]=Gh(!1);return p.jsx("div",{className:"flex flex-col border-t border-t-muted",children:p.jsxs("div",{className:"flex flex-row justify-between items-center py-3 px-4",children:[p.jsx("div",{children:s&&p.jsxs(ns,{position:"right-start",shadow:"md",opened:i,classNames:{dropdown:"!px-1 !pr-2.5 !py-2 text-sm"},children:[p.jsx(ns.Target,{children:p.jsx(St,{onClick:o.toggle,Icon:TV,variant:i?"default":"ghost"})}),p.jsx(ns.Dropdown,{children:p.jsx(ui,{json:s,expand:6,className:"p-0"})})]})}),p.jsxs("div",{className:"flex flex-row gap-2",children:[p.jsx(ot,{className:"w-24 justify-center",...t,children:r}),p.jsx(ot,{className:"w-24 justify-center",variant:"primary",...e,children:n})]})]})})},XU=w.createContext(void 0);function KU({children:e,initialPath:t=[],initialState:n={},lastBack:r}){const[s,i]=w.useState(n),[o,a]=w.useState(t),c=w.Children.toArray(e).filter(m=>m.props.disabled!==!0);function u(){o.length===0?r==null||r():a(m=>m.slice(0,-1))}const f=m=>()=>{a(y=>[...y,m])},h=c.find(m=>m.props.id===o[o.length-1])||c[0];return p.jsx(XU.Provider,{value:{nextStep:f,stepBack:u,state:s,path:o,setState:i,close:r},children:h})}function Ed(){return w.useContext(XU)}function xu({children:e,disabled:t=!1,path:n=[],id:r,...s}){return p.jsx("div",{...s,children:e})}function Ts(){const{config:e,app:t,schema:n,actions:r}=Tt(),s=sn(e.data.entities??{},(a,c)=>O$(c,a)),i={entity:{add:async(a,c)=>{const u=Ln(_$,c,{skipMark:!0,forceParse:!0});return await r.add("data",`entities.${a}`,u)},patch:a=>{if(!s[a])throw new Error(`Entity "${a}" not found`);return{config:async u=>await r.overwrite("data",`entities.${a}.config`,u),fields:ASe(r,a)}}},relations:{add:async a=>{const c=crypto.randomUUID(),u=Ln(Zt(C$),a,{skipMark:!0,forceParse:!0});return await r.add("data",`relations.${c}`,u)}}};return{$data:{entity:a=>s[a],modals:jSe,system:a=>{var c;return{any:((c=s[a])==null?void 0:c.type)==="system",users:a===e.auth.entity_name,media:a===e.media.entity_name}}},entities:s,relations:t.relations,config:e.data,schema:n.data,actions:i}}const jSe={createAny:()=>vr.open(vr.ids.dataCreate,{}),createEntity:()=>vr.open(vr.ids.dataCreate,{initialPath:["entities","entity"],initialState:{action:"entity"}}),createRelation:e=>vr.open(vr.ids.dataCreate,{initialPath:["entities","relation"],initialState:{action:"relation",relations:{create:[{source:e,type:"n:1"}]}}}),createMedia:e=>vr.open(vr.ids.dataCreate,{initialPath:["entities","template-media"],initialState:{action:"template-media",initial:{entity:e}}})};function ASe(e,t){return{add:async(n,r)=>{const s=Ln(N$,r,{skipMark:!0,forceParse:!0});return await e.add("data",`entities.${t}.fields.${n}`,s)},patch:()=>null,set:async n=>{try{const r=Ln(Jz,n,{skipMark:!0,forceParse:!0}),s=await e.overwrite("data",`entities.${t}.fields`,r)}catch(r){console.error("error",r),r instanceof o1?alert("Error updating fields: "+r.firstToString()):alert("An error occured, check console. There will be nice error handling soon.")}}}}function $Se(){var h,m,y;const{stepBack:e,state:t,close:n}=Ed(),[r,s]=w.useState([]),[i,o]=w.useState(!1),a=Ts(),c=Tt(),u=[];(h=t.entities)!=null&&h.create&&u.push(...t.entities.create.map(v=>({action:"add",Icon:ave,type:"Entity",name:v.name,json:v,run:async()=>await a.actions.entity.add(v.name,v)}))),(m=t.fields)!=null&&m.create&&u.push(...t.fields.create.map(v=>({action:"add",Icon:V$,type:"Field",name:v.name,json:v,run:async()=>await a.actions.entity.patch(v.entity).fields.add(v.name,v.field)}))),(y=t.relations)!=null&&y.create&&u.push(...t.relations.create.map(v=>({action:"add",Icon:U$,type:"Relation",name:`${v.source} -> ${v.target} (${v.type})`,json:v,run:async()=>await a.actions.relations.add(v)})));async function f(){o(!0);for(const v of u)try{const x=await v.run();if(s(E=>[...E,x]),x!==!0)break}catch(x){s(E=>[...E,x.message])}}return w.useEffect(()=>{console.log("states",r,u,r.length,u.length,r.every(v=>v===!0)),u.length===r.length&&r.every(v=>v===!0)?c.actions.reload().then(n):o(!1)},[r]),p.jsxs(p.Fragment,{children:[p.jsxs(wd,{children:[p.jsx("div",{children:'This is what will be created. Please confirm by clicking "Next".'}),p.jsx("div",{className:"flex flex-col gap-1",children:u.map((v,x)=>p.jsx(TSe,{...v,state:r[x]},x))})]}),p.jsx(Sd,{nextLabel:"Create",next:{onClick:f,disabled:i},prev:{onClick:e,disabled:i},debug:{state:t}})]})}const TSe=({Icon:e,type:t,name:n,json:r,state:s,action:i,initialExpanded:o=!1})=>{const[a,c]=Gh(o),u=typeof s<"u"&&s!==!0,f=s===!0;return p.jsxs("div",{className:Ue("flex flex-col border border-muted rounded bg-background mb-2",u&&"bg-red-500/20",f&&"bg-green-500/20"),children:[p.jsxs("div",{className:"flex flex-row gap-4 px-2 py-2 items-center",children:[p.jsx("div",{className:"flex flex-row items-center p-1 bg-primary/5 rounded",children:p.jsx(e,{className:"w-6 h-6"})}),p.jsxs("div",{className:"flex flex-row flex-grow gap-5",children:[p.jsx(DN,{type:"action",name:i}),p.jsx(DN,{type:"type",name:t}),p.jsx(DN,{type:"name",name:n})]}),r&&p.jsx(St,{Icon:yve,variant:a?"default":"ghost",onClick:c.toggle})]}),r&&a&&p.jsx("div",{className:"flex flex-col border-t border-t-muted",children:p.jsx(ui,{json:r,expand:8,className:"text-sm"})}),u&&typeof s=="string"&&p.jsx("div",{className:"text-sm text-red-500",children:s})]})},DN=({type:e,name:t})=>p.jsxs("div",{className:"flex flex-row text-sm font-mono gap-2",children:[p.jsx("div",{className:"opacity-50",children:ii(e)}),p.jsx("div",{className:"font-semibold",children:t})]});var Gy=e=>e.type==="checkbox",$u=e=>e instanceof Date,Pr=e=>e==null;const QU=e=>typeof e=="object";var An=e=>!Pr(e)&&!Array.isArray(e)&&QU(e)&&!$u(e),ZU=e=>An(e)&&e.target?Gy(e.target)?e.target.checked:e.target.value:e,RSe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,eq=(e,t)=>e.has(RSe(t)),MSe=e=>{const t=e.constructor&&e.constructor.prototype;return An(t)&&t.hasOwnProperty("isPrototypeOf")},dT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Un(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(dT&&(e instanceof Blob||r))&&(n||An(e)))if(t=n?[]:{},!n&&!MSe(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=Un(e[s]));else return e;return t}var Yy=e=>Array.isArray(e)?e.filter(Boolean):[],ln=e=>e===void 0,De=(e,t,n)=>{if(!t||!An(e))return n;const r=Yy(t.split(/[,[\].]+?/)).reduce((s,i)=>Pr(s)?s:s[i],e);return ln(r)||r===e?ln(e[t])?n:e[t]:r},Xs=e=>typeof e=="boolean",fT=e=>/^\w*$/.test(e),tq=e=>Yy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Pt=(e,t,n)=>{let r=-1;const s=fT(t)?[t]:tq(t),i=s.length,o=i-1;for(;++r<i;){const a=s[r];let c=n;if(r!==o){const u=e[a];c=An(u)||Array.isArray(u)?u:isNaN(+s[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}return e};const jx={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Qs={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ia={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},kSe=Re.createContext(null),F1=()=>Re.useContext(kSe);var nq=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Qs.all&&(t._proxyFormState[o]=!r||Qs.all),n&&(n[o]=!0),e[o]}});return s},Dr=e=>An(e)&&!Object.keys(e).length,rq=(e,t,n,r)=>{n(e);const{name:s,...i}=e;return Dr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!r||Qs.all))},Zr=e=>Array.isArray(e)?e:[e],sq=(e,t,n)=>!e||!t||e===t||Zr(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function B1(e){const t=Re.useRef(e);t.current=e,Re.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function ISe(e){const t=F1(),{control:n=t.control,disabled:r,name:s,exact:i}=e||{},[o,a]=Re.useState(n._formState),c=Re.useRef(!0),u=Re.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=Re.useRef(s);return f.current=s,B1({disabled:r,next:h=>c.current&&sq(f.current,h.name,i)&&rq(h,u.current,n._updateFormState)&&a({...n._formState,...h}),subject:n._subjects.state}),Re.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),Re.useMemo(()=>nq(o,n,u.current,!1),[o,n])}var wo=e=>typeof e=="string",iq=(e,t,n,r,s)=>wo(e)?(r&&t.watch.add(e),De(n,e,s)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),De(n,i))):(r&&(t.watchAll=!0),n);function DSe(e){const t=F1(),{control:n=t.control,name:r,defaultValue:s,disabled:i,exact:o}=e||{},a=Re.useRef(r);a.current=r,B1({disabled:i,subject:n._subjects.values,next:f=>{sq(a.current,f.name,o)&&u(Un(iq(a.current,n._names,f.values||n._formValues,!1,s)))}});const[c,u]=Re.useState(n._getWatch(r,s));return Re.useEffect(()=>n._removeUnmounted()),c}function Nd(e){const t=F1(),{name:n,disabled:r,control:s=t.control,shouldUnregister:i}=e,o=eq(s._names.array,n),a=DSe({control:s,name:n,defaultValue:De(s._formValues,n,De(s._defaultValues,n,e.defaultValue)),exact:!0}),c=ISe({control:s,name:n,exact:!0}),u=Re.useRef(s.register(n,{...e.rules,value:a,...Xs(e.disabled)?{disabled:e.disabled}:{}})),f=Re.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!De(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!De(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!De(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!De(c.validatingFields,n)},error:{enumerable:!0,get:()=>De(c.errors,n)}}),[c,n]),h=Re.useMemo(()=>({name:n,value:a,...Xs(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:m=>u.current.onChange({target:{value:ZU(m),name:n},type:jx.CHANGE}),onBlur:()=>u.current.onBlur({target:{value:De(s._formValues,n),name:n},type:jx.BLUR}),ref:m=>{const y=De(s._fields,n);y&&m&&(y._f.ref={focus:()=>m.focus(),select:()=>m.select(),setCustomValidity:v=>m.setCustomValidity(v),reportValidity:()=>m.reportValidity()})}}),[n,s._formValues,r,c.disabled,a,s._fields]);return Re.useEffect(()=>{const m=s._options.shouldUnregister||i,y=(v,x)=>{const E=De(s._fields,v);E&&E._f&&(E._f.mount=x)};if(y(n,!0),m){const v=Un(De(s._options.defaultValues,n));Pt(s._defaultValues,n,v),ln(De(s._formValues,n))&&Pt(s._formValues,n,v)}return!o&&s.register(n),()=>{(o?m&&!s._state.action:m)?s.unregister(n):y(n,!1)}},[n,s,o,i]),Re.useEffect(()=>{s._updateDisabledField({disabled:r,fields:s._fields,name:n})},[r,n,s]),Re.useMemo(()=>({field:h,formState:c,fieldState:f}),[h,c,f])}var PSe=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},Ml=()=>{const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},PN=(e,t,n={})=>n.shouldFocus||ln(n.shouldFocus)?n.focusName||`${e}.${ln(n.focusIndex)?t:n.focusIndex}.`:"",ng=e=>({isOnSubmit:!e||e===Qs.onSubmit,isOnBlur:e===Qs.onBlur,isOnChange:e===Qs.onChange,isOnAll:e===Qs.all,isOnTouch:e===Qs.onTouched}),EO=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const qf=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const i=De(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(qf(a,t))break}else if(An(a)&&qf(a,t))break}}};var oq=(e,t,n)=>{const r=Zr(De(e,n));return Pt(r,"root",t[n]),Pt(e,n,r),e},hT=e=>e.type==="file",bo=e=>typeof e=="function",Ax=e=>{if(!dT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Cv=e=>wo(e),pT=e=>e.type==="radio",$x=e=>e instanceof RegExp;const JI={value:!1,isValid:!1},XI={value:!0,isValid:!0};var aq=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ln(e[0].attributes.value)?ln(e[0].value)||e[0].value===""?XI:{value:e[0].value,isValid:!0}:XI:JI}return JI};const KI={isValid:!1,value:null};var lq=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,KI):KI;function QI(e,t,n="validate"){if(Cv(e)||Array.isArray(e)&&e.every(Cv)||Xs(e)&&!e)return{type:n,message:Cv(e)?e:"",ref:t}}var Ef=e=>An(e)&&!$x(e)?e:{value:e,message:""},NO=async(e,t,n,r,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:f,min:h,max:m,pattern:y,validate:v,name:x,valueAsNumber:E,mount:N}=e._f,_=De(n,x);if(!N||t.has(x))return{};const C=a?a[0]:o,j=V=>{s&&C.reportValidity&&(C.setCustomValidity(Xs(V)?"":V||""),C.reportValidity())},A={},$=pT(o),R=Gy(o),M=$||R,D=(E||hT(o))&&ln(o.value)&&ln(_)||Ax(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,P=PSe.bind(null,x,r,A),F=(V,H,I,B=ia.maxLength,T=ia.minLength)=>{const L=V?H:I;A[x]={type:V?B:T,message:L,ref:o,...P(V?B:T,L)}};if(i?!Array.isArray(_)||!_.length:c&&(!M&&(D||Pr(_))||Xs(_)&&!_||R&&!aq(a).isValid||$&&!lq(a).isValid)){const{value:V,message:H}=Cv(c)?{value:!!c,message:c}:Ef(c);if(V&&(A[x]={type:ia.required,message:H,ref:C,...P(ia.required,H)},!r))return j(H),A}if(!D&&(!Pr(h)||!Pr(m))){let V,H;const I=Ef(m),B=Ef(h);if(!Pr(_)&&!isNaN(_)){const T=o.valueAsNumber||_&&+_;Pr(I.value)||(V=T>I.value),Pr(B.value)||(H=T<B.value)}else{const T=o.valueAsDate||new Date(_),L=k=>new Date(new Date().toDateString()+" "+k),z=o.type=="time",q=o.type=="week";wo(I.value)&&_&&(V=z?L(_)>L(I.value):q?_>I.value:T>new Date(I.value)),wo(B.value)&&_&&(H=z?L(_)<L(B.value):q?_<B.value:T<new Date(B.value))}if((V||H)&&(F(!!V,I.message,B.message,ia.max,ia.min),!r))return j(A[x].message),A}if((u||f)&&!D&&(wo(_)||i&&Array.isArray(_))){const V=Ef(u),H=Ef(f),I=!Pr(V.value)&&_.length>+V.value,B=!Pr(H.value)&&_.length<+H.value;if((I||B)&&(F(I,V.message,H.message),!r))return j(A[x].message),A}if(y&&!D&&wo(_)){const{value:V,message:H}=Ef(y);if($x(V)&&!_.match(V)&&(A[x]={type:ia.pattern,message:H,ref:o,...P(ia.pattern,H)},!r))return j(H),A}if(v){if(bo(v)){const V=await v(_,n),H=QI(V,C);if(H&&(A[x]={...H,...P(ia.validate,H.message)},!r))return j(H.message),A}else if(An(v)){let V={};for(const H in v){if(!Dr(V)&&!r)break;const I=QI(await v[H](_,n),C,H);I&&(V={...I,...P(H,I.message)},j(I.message),r&&(A[x]=V))}if(!Dr(V)&&(A[x]={ref:C,...V},!r))return A}}return j(!0),A},LN=(e,t)=>[...e,...Zr(t)],FN=e=>Array.isArray(e)?e.map(()=>{}):void 0;function BN(e,t,n){return[...e.slice(0,t),...Zr(n),...e.slice(t)]}var zN=(e,t,n)=>Array.isArray(e)?(ln(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],VN=(e,t)=>[...Zr(t),...Zr(e)];function LSe(e,t){let n=0;const r=[...e];for(const s of t)r.splice(s-n,1),n++;return Yy(r).length?r:[]}var UN=(e,t)=>ln(t)?[]:LSe(e,Zr(t).sort((n,r)=>n-r)),qN=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]};function FSe(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ln(e)?r++:e[t[r++]];return e}function BSe(e){for(const t in e)if(e.hasOwnProperty(t)&&!ln(e[t]))return!1;return!0}function Dn(e,t){const n=Array.isArray(t)?t:fT(t)?[t]:tq(t),r=n.length===1?e:FSe(e,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(An(r)&&Dr(r)||Array.isArray(r)&&BSe(r))&&Dn(e,n.slice(0,-1)),e}var ZI=(e,t,n)=>(e[t]=n,e);function zSe(e){const t=F1(),{control:n=t.control,name:r,keyName:s="id",shouldUnregister:i,rules:o}=e,[a,c]=Re.useState(n._getFieldArray(r)),u=Re.useRef(n._getFieldArray(r).map(Ml)),f=Re.useRef(a),h=Re.useRef(r),m=Re.useRef(!1);h.current=r,f.current=a,n._names.array.add(r),o&&n.register(r,o),B1({next:({values:$,name:R})=>{if(R===h.current||!R){const M=De($,h.current);Array.isArray(M)&&(c(M),u.current=M.map(Ml))}},subject:n._subjects.array});const y=Re.useCallback($=>{m.current=!0,n._updateFieldArray(r,$)},[n,r]),v=($,R)=>{const M=Zr(Un($)),D=LN(n._getFieldArray(r),M);n._names.focus=PN(r,D.length-1,R),u.current=LN(u.current,M.map(Ml)),y(D),c(D),n._updateFieldArray(r,D,LN,{argA:FN($)})},x=($,R)=>{const M=Zr(Un($)),D=VN(n._getFieldArray(r),M);n._names.focus=PN(r,0,R),u.current=VN(u.current,M.map(Ml)),y(D),c(D),n._updateFieldArray(r,D,VN,{argA:FN($)})},E=$=>{const R=UN(n._getFieldArray(r),$);u.current=UN(u.current,$),y(R),c(R),!Array.isArray(De(n._fields,r))&&Pt(n._fields,r,void 0),n._updateFieldArray(r,R,UN,{argA:$})},N=($,R,M)=>{const D=Zr(Un(R)),P=BN(n._getFieldArray(r),$,D);n._names.focus=PN(r,$,M),u.current=BN(u.current,$,D.map(Ml)),y(P),c(P),n._updateFieldArray(r,P,BN,{argA:$,argB:FN(R)})},_=($,R)=>{const M=n._getFieldArray(r);qN(M,$,R),qN(u.current,$,R),y(M),c(M),n._updateFieldArray(r,M,qN,{argA:$,argB:R},!1)},C=($,R)=>{const M=n._getFieldArray(r);zN(M,$,R),zN(u.current,$,R),y(M),c(M),n._updateFieldArray(r,M,zN,{argA:$,argB:R},!1)},j=($,R)=>{const M=Un(R),D=ZI(n._getFieldArray(r),$,M);u.current=[...D].map((P,F)=>!P||F===$?Ml():u.current[F]),y(D),c([...D]),n._updateFieldArray(r,D,ZI,{argA:$,argB:M},!0,!1)},A=$=>{const R=Zr(Un($));u.current=R.map(Ml),y([...R]),c([...R]),n._updateFieldArray(r,[...R],M=>M,{},!0,!1)};return Re.useEffect(()=>{if(n._state.action=!1,EO(r,n._names)&&n._subjects.state.next({...n._formState}),m.current&&(!ng(n._options.mode).isOnSubmit||n._formState.isSubmitted))if(n._options.resolver)n._executeSchema([r]).then($=>{const R=De($.errors,r),M=De(n._formState.errors,r);(M?!R&&M.type||R&&(M.type!==R.type||M.message!==R.message):R&&R.type)&&(R?Pt(n._formState.errors,r,R):Dn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const $=De(n._fields,r);$&&$._f&&!(ng(n._options.reValidateMode).isOnSubmit&&ng(n._options.mode).isOnSubmit)&&NO($,n._names.disabled,n._formValues,n._options.criteriaMode===Qs.all,n._options.shouldUseNativeValidation,!0).then(R=>!Dr(R)&&n._subjects.state.next({errors:oq(n._formState.errors,R,r)}))}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&qf(n._fields,($,R)=>{if(n._names.focus&&R.startsWith(n._names.focus)&&$.focus)return $.focus(),1}),n._names.focus="",n._updateValid(),m.current=!1},[a,r,n]),Re.useEffect(()=>(!De(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||i)&&n.unregister(r)}),[r,n,s,i]),{swap:Re.useCallback(_,[y,r,n]),move:Re.useCallback(C,[y,r,n]),prepend:Re.useCallback(x,[y,r,n]),append:Re.useCallback(v,[y,r,n]),remove:Re.useCallback(E,[y,r,n]),insert:Re.useCallback(N,[y,r,n]),update:Re.useCallback(j,[y,r,n]),replace:Re.useCallback(A,[y,r,n]),fields:Re.useMemo(()=>a.map(($,R)=>({...$,[s]:u.current[R]||Ml()})),[a,s])}}var HN=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}},_O=e=>Pr(e)||!QU(e);function Xl(e,t){if(_O(e)||_O(t))return e===t;if($u(e)&&$u(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=t[s];if($u(i)&&$u(o)||An(i)&&An(o)||Array.isArray(i)&&Array.isArray(o)?!Xl(i,o):i!==o)return!1}}return!0}var cq=e=>e.type==="select-multiple",VSe=e=>pT(e)||Gy(e),WN=e=>Ax(e)&&e.isConnected,uq=e=>{for(const t in e)if(bo(e[t]))return!0;return!1};function Tx(e,t={}){const n=Array.isArray(e);if(An(e)||n)for(const r in e)Array.isArray(e[r])||An(e[r])&&!uq(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Tx(e[r],t[r])):Pr(e[r])||(t[r]=!0);return t}function dq(e,t,n){const r=Array.isArray(e);if(An(e)||r)for(const s in e)Array.isArray(e[s])||An(e[s])&&!uq(e[s])?ln(t)||_O(n[s])?n[s]=Array.isArray(e[s])?Tx(e[s],[]):{...Tx(e[s])}:dq(e[s],Pr(t)?{}:t[s],n[s]):n[s]=!Xl(e[s],t[s]);return n}var Cm=(e,t)=>dq(e,t,Tx(t)),fq=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ln(e)?e:t?e===""?NaN:e&&+e:n&&wo(e)?new Date(e):r?r(e):e;function GN(e){const t=e.ref;return hT(t)?t.files:pT(t)?lq(e.refs).value:cq(t)?[...t.selectedOptions].map(({value:n})=>n):Gy(t)?aq(e.refs).value:fq(ln(t.value)?e.ref.value:t.value,e)}var USe=(e,t,n,r)=>{const s={};for(const i of e){const o=De(t,i);o&&Pt(s,i,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},Om=e=>ln(e)?e:$x(e)?e.source:An(e)?$x(e.value)?e.value.source:e.value:e;const eD="AsyncFunction";var qSe=e=>!!e&&!!e.validate&&!!(bo(e.validate)&&e.validate.constructor.name===eD||An(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===eD)),HSe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function tD(e,t,n){const r=De(e,n);if(r||fT(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=De(t,i),a=De(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};s.pop()}return{name:n}}var WSe=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,GSe=(e,t)=>!Yy(De(e,t)).length&&Dn(e,t);const YSe={mode:Qs.onSubmit,reValidateMode:Qs.onChange,shouldFocusError:!0};function JSe(e={}){let t={...YSe,...e},n={submitCount:0,isDirty:!1,isLoading:bo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=An(t.defaultValues)||An(t.values)?Un(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Un(s),o={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={values:HN(),array:HN(),state:HN()},m=ng(t.mode),y=ng(t.reValidateMode),v=t.criteriaMode===Qs.all,x=J=>te=>{clearTimeout(u),u=setTimeout(J,te)},E=async J=>{if(!t.disabled&&(f.isValid||J)){const te=t.resolver?Dr((await M()).errors):await P(r,!0);te!==n.isValid&&h.state.next({isValid:te})}},N=(J,te)=>{!t.disabled&&(f.isValidating||f.validatingFields)&&((J||Array.from(a.mount)).forEach(Q=>{Q&&(te?Pt(n.validatingFields,Q,te):Dn(n.validatingFields,Q))}),h.state.next({validatingFields:n.validatingFields,isValidating:!Dr(n.validatingFields)}))},_=(J,te=[],Q,ye,ce=!0,ae=!0)=>{if(ye&&Q&&!t.disabled){if(o.action=!0,ae&&Array.isArray(De(r,J))){const ie=Q(De(r,J),ye.argA,ye.argB);ce&&Pt(r,J,ie)}if(ae&&Array.isArray(De(n.errors,J))){const ie=Q(De(n.errors,J),ye.argA,ye.argB);ce&&Pt(n.errors,J,ie),GSe(n.errors,J)}if(f.touchedFields&&ae&&Array.isArray(De(n.touchedFields,J))){const ie=Q(De(n.touchedFields,J),ye.argA,ye.argB);ce&&Pt(n.touchedFields,J,ie)}f.dirtyFields&&(n.dirtyFields=Cm(s,i)),h.state.next({name:J,isDirty:V(J,te),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Pt(i,J,te)},C=(J,te)=>{Pt(n.errors,J,te),h.state.next({errors:n.errors})},j=J=>{n.errors=J,h.state.next({errors:n.errors,isValid:!1})},A=(J,te,Q,ye)=>{const ce=De(r,J);if(ce){const ae=De(i,J,ln(Q)?De(s,J):Q);ln(ae)||ye&&ye.defaultChecked||te?Pt(i,J,te?ae:GN(ce._f)):B(J,ae),o.mount&&E()}},$=(J,te,Q,ye,ce)=>{let ae=!1,ie=!1;const de={name:J};if(!t.disabled){const be=!!(De(r,J)&&De(r,J)._f&&De(r,J)._f.disabled);if(!Q||ye){f.isDirty&&(ie=n.isDirty,n.isDirty=de.isDirty=V(),ae=ie!==de.isDirty);const Ae=be||Xl(De(s,J),te);ie=!!(!be&&De(n.dirtyFields,J)),Ae||be?Dn(n.dirtyFields,J):Pt(n.dirtyFields,J,!0),de.dirtyFields=n.dirtyFields,ae=ae||f.dirtyFields&&ie!==!Ae}if(Q){const Ae=De(n.touchedFields,J);Ae||(Pt(n.touchedFields,J,Q),de.touchedFields=n.touchedFields,ae=ae||f.touchedFields&&Ae!==Q)}ae&&ce&&h.state.next(de)}return ae?de:{}},R=(J,te,Q,ye)=>{const ce=De(n.errors,J),ae=f.isValid&&Xs(te)&&n.isValid!==te;if(t.delayError&&Q?(c=x(()=>C(J,Q)),c(t.delayError)):(clearTimeout(u),c=null,Q?Pt(n.errors,J,Q):Dn(n.errors,J)),(Q?!Xl(ce,Q):ce)||!Dr(ye)||ae){const ie={...ye,...ae&&Xs(te)?{isValid:te}:{},errors:n.errors,name:J};n={...n,...ie},h.state.next(ie)}},M=async J=>{N(J,!0);const te=await t.resolver(i,t.context,USe(J||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return N(J),te},D=async J=>{const{errors:te}=await M(J);if(J)for(const Q of J){const ye=De(te,Q);ye?Pt(n.errors,Q,ye):Dn(n.errors,Q)}else n.errors=te;return te},P=async(J,te,Q={valid:!0})=>{for(const ye in J){const ce=J[ye];if(ce){const{_f:ae,...ie}=ce;if(ae){const de=a.array.has(ae.name),be=ce._f&&qSe(ce._f);be&&f.validatingFields&&N([ye],!0);const Ae=await NO(ce,a.disabled,i,v,t.shouldUseNativeValidation&&!te,de);if(be&&f.validatingFields&&N([ye]),Ae[ae.name]&&(Q.valid=!1,te))break;!te&&(De(Ae,ae.name)?de?oq(n.errors,Ae,ae.name):Pt(n.errors,ae.name,Ae[ae.name]):Dn(n.errors,ae.name))}!Dr(ie)&&await P(ie,te,Q)}}return Q.valid},F=()=>{for(const J of a.unMount){const te=De(r,J);te&&(te._f.refs?te._f.refs.every(Q=>!WN(Q)):!WN(te._f.ref))&&fe(J)}a.unMount=new Set},V=(J,te)=>!t.disabled&&(J&&te&&Pt(i,J,te),!Xl(W(),s)),H=(J,te,Q)=>iq(J,a,{...o.mount?i:ln(te)?s:wo(J)?{[J]:te}:te},Q,te),I=J=>Yy(De(o.mount?i:s,J,t.shouldUnregister?De(s,J,[]):[])),B=(J,te,Q={})=>{const ye=De(r,J);let ce=te;if(ye){const ae=ye._f;ae&&(!ae.disabled&&Pt(i,J,fq(te,ae)),ce=Ax(ae.ref)&&Pr(te)?"":te,cq(ae.ref)?[...ae.ref.options].forEach(ie=>ie.selected=ce.includes(ie.value)):ae.refs?Gy(ae.ref)?ae.refs.length>1?ae.refs.forEach(ie=>(!ie.defaultChecked||!ie.disabled)&&(ie.checked=Array.isArray(ce)?!!ce.find(de=>de===ie.value):ce===ie.value)):ae.refs[0]&&(ae.refs[0].checked=!!ce):ae.refs.forEach(ie=>ie.checked=ie.value===ce):hT(ae.ref)?ae.ref.value="":(ae.ref.value=ce,ae.ref.type||h.values.next({name:J,values:{...i}})))}(Q.shouldDirty||Q.shouldTouch)&&$(J,ce,Q.shouldTouch,Q.shouldDirty,!0),Q.shouldValidate&&k(J)},T=(J,te,Q)=>{for(const ye in te){const ce=te[ye],ae=`${J}.${ye}`,ie=De(r,ae);(a.array.has(J)||An(ce)||ie&&!ie._f)&&!$u(ce)?T(ae,ce,Q):B(ae,ce,Q)}},L=(J,te,Q={})=>{const ye=De(r,J),ce=a.array.has(J),ae=Un(te);Pt(i,J,ae),ce?(h.array.next({name:J,values:{...i}}),(f.isDirty||f.dirtyFields)&&Q.shouldDirty&&h.state.next({name:J,dirtyFields:Cm(s,i),isDirty:V(J,ae)})):ye&&!ye._f&&!Pr(ae)?T(J,ae,Q):B(J,ae,Q),EO(J,a)&&h.state.next({...n}),h.values.next({name:o.mount?J:void 0,values:{...i}})},z=async J=>{o.mount=!0;const te=J.target;let Q=te.name,ye=!0;const ce=De(r,Q),ae=()=>te.type?GN(ce._f):ZU(J),ie=de=>{ye=Number.isNaN(de)||$u(de)&&isNaN(de.getTime())||Xl(de,De(i,Q,de))};if(ce){let de,be;const Ae=ae(),Ie=J.type===jx.BLUR||J.type===jx.FOCUS_OUT,ht=!HSe(ce._f)&&!t.resolver&&!De(n.errors,Q)&&!ce._f.deps||WSe(Ie,De(n.touchedFields,Q),n.isSubmitted,y,m),Vt=EO(Q,a,Ie);Pt(i,Q,Ae),Ie?(ce._f.onBlur&&ce._f.onBlur(J),c&&c(0)):ce._f.onChange&&ce._f.onChange(J);const _t=$(Q,Ae,Ie,!1),no=!Dr(_t)||Vt;if(!Ie&&h.values.next({name:Q,type:J.type,values:{...i}}),ht)return f.isValid&&(t.mode==="onBlur"&&Ie?E():Ie||E()),no&&h.state.next({name:Q,...Vt?{}:_t});if(!Ie&&Vt&&h.state.next({...n}),t.resolver){const{errors:Ut}=await M([Q]);if(ie(Ae),ye){const Bt=tD(n.errors,r,Q),Rs=tD(Ut,r,Bt.name||Q);de=Rs.error,Q=Rs.name,be=Dr(Ut)}}else N([Q],!0),de=(await NO(ce,a.disabled,i,v,t.shouldUseNativeValidation))[Q],N([Q]),ie(Ae),ye&&(de?be=!1:f.isValid&&(be=await P(r,!0)));ye&&(ce._f.deps&&k(ce._f.deps),R(Q,be,de,_t))}},q=(J,te)=>{if(De(n.errors,te)&&J.focus)return J.focus(),1},k=async(J,te={})=>{let Q,ye;const ce=Zr(J);if(t.resolver){const ae=await D(ln(J)?J:ce);Q=Dr(ae),ye=J?!ce.some(ie=>De(ae,ie)):Q}else J?(ye=(await Promise.all(ce.map(async ae=>{const ie=De(r,ae);return await P(ie&&ie._f?{[ae]:ie}:ie)}))).every(Boolean),!(!ye&&!n.isValid)&&E()):ye=Q=await P(r);return h.state.next({...!wo(J)||f.isValid&&Q!==n.isValid?{}:{name:J},...t.resolver||!J?{isValid:Q}:{},errors:n.errors}),te.shouldFocus&&!ye&&qf(r,q,J?ce:a.mount),ye},W=J=>{const te={...o.mount?i:s};return ln(J)?te:wo(J)?De(te,J):J.map(Q=>De(te,Q))},X=(J,te)=>({invalid:!!De((te||n).errors,J),isDirty:!!De((te||n).dirtyFields,J),error:De((te||n).errors,J),isValidating:!!De(n.validatingFields,J),isTouched:!!De((te||n).touchedFields,J)}),ne=J=>{J&&Zr(J).forEach(te=>Dn(n.errors,te)),h.state.next({errors:J?n.errors:{}})},re=(J,te,Q)=>{const ye=(De(r,J,{_f:{}})._f||{}).ref,ce=De(n.errors,J)||{},{ref:ae,message:ie,type:de,...be}=ce;Pt(n.errors,J,{...be,...te,ref:ye}),h.state.next({name:J,errors:n.errors,isValid:!1}),Q&&Q.shouldFocus&&ye&&ye.focus&&ye.focus()},se=(J,te)=>bo(J)?h.values.subscribe({next:Q=>J(H(void 0,te),Q)}):H(J,te,!0),fe=(J,te={})=>{for(const Q of J?Zr(J):a.mount)a.mount.delete(Q),a.array.delete(Q),te.keepValue||(Dn(r,Q),Dn(i,Q)),!te.keepError&&Dn(n.errors,Q),!te.keepDirty&&Dn(n.dirtyFields,Q),!te.keepTouched&&Dn(n.touchedFields,Q),!te.keepIsValidating&&Dn(n.validatingFields,Q),!t.shouldUnregister&&!te.keepDefaultValue&&Dn(s,Q);h.values.next({values:{...i}}),h.state.next({...n,...te.keepDirty?{isDirty:V()}:{}}),!te.keepIsValid&&E()},he=({disabled:J,name:te,field:Q,fields:ye})=>{(Xs(J)&&o.mount||J||a.disabled.has(te))&&(J?a.disabled.add(te):a.disabled.delete(te),$(te,GN(Q?Q._f:De(ye,te)._f),!1,!1,!0))},ue=(J,te={})=>{let Q=De(r,J);const ye=Xs(te.disabled)||Xs(t.disabled);return Pt(r,J,{...Q||{},_f:{...Q&&Q._f?Q._f:{ref:{name:J}},name:J,mount:!0,...te}}),a.mount.add(J),Q?he({field:Q,disabled:Xs(te.disabled)?te.disabled:t.disabled,name:J}):A(J,!0,te.value),{...ye?{disabled:te.disabled||t.disabled}:{},...t.progressive?{required:!!te.required,min:Om(te.min),max:Om(te.max),minLength:Om(te.minLength),maxLength:Om(te.maxLength),pattern:Om(te.pattern)}:{},name:J,onChange:z,onBlur:z,ref:ce=>{if(ce){ue(J,te),Q=De(r,J);const ae=ln(ce.value)&&ce.querySelectorAll&&ce.querySelectorAll("input,select,textarea")[0]||ce,ie=VSe(ae),de=Q._f.refs||[];if(ie?de.find(be=>be===ae):ae===Q._f.ref)return;Pt(r,J,{_f:{...Q._f,...ie?{refs:[...de.filter(WN),ae,...Array.isArray(De(s,J))?[{}]:[]],ref:{type:ae.type,name:J}}:{ref:ae}}}),A(J,!1,void 0,ae)}else Q=De(r,J,{}),Q._f&&(Q._f.mount=!1),(t.shouldUnregister||te.shouldUnregister)&&!(eq(a.array,J)&&o.action)&&a.unMount.add(J)}}},ve=()=>t.shouldFocusError&&qf(r,q,a.mount),Se=J=>{Xs(J)&&(h.state.next({disabled:J}),qf(r,(te,Q)=>{const ye=De(r,Q);ye&&(te.disabled=ye._f.disabled||J,Array.isArray(ye._f.refs)&&ye._f.refs.forEach(ce=>{ce.disabled=ye._f.disabled||J}))},0,!1))},ke=(J,te)=>async Q=>{let ye;Q&&(Q.preventDefault&&Q.preventDefault(),Q.persist&&Q.persist());let ce=Un(i);if(a.disabled.size)for(const ae of a.disabled)Pt(ce,ae,void 0);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:ae,values:ie}=await M();n.errors=ae,ce=ie}else await P(r);if(Dn(n.errors,"root"),Dr(n.errors)){h.state.next({errors:{}});try{await J(ce,Q)}catch(ae){ye=ae}}else te&&await te({...n.errors},Q),ve(),setTimeout(ve);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Dr(n.errors)&&!ye,submitCount:n.submitCount+1,errors:n.errors}),ye)throw ye},Oe=(J,te={})=>{De(r,J)&&(ln(te.defaultValue)?L(J,Un(De(s,J))):(L(J,te.defaultValue),Pt(s,J,Un(te.defaultValue))),te.keepTouched||Dn(n.touchedFields,J),te.keepDirty||(Dn(n.dirtyFields,J),n.isDirty=te.defaultValue?V(J,Un(De(s,J))):V()),te.keepError||(Dn(n.errors,J),f.isValid&&E()),h.state.next({...n}))},Ce=(J,te={})=>{const Q=J?Un(J):s,ye=Un(Q),ce=Dr(J),ae=ce?s:ye;if(te.keepDefaultValues||(s=Q),!te.keepValues){if(te.keepDirtyValues){const ie=new Set([...a.mount,...Object.keys(Cm(s,i))]);for(const de of Array.from(ie))De(n.dirtyFields,de)?Pt(ae,de,De(i,de)):L(de,De(ae,de))}else{if(dT&&ln(J))for(const ie of a.mount){const de=De(r,ie);if(de&&de._f){const be=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(Ax(be)){const Ae=be.closest("form");if(Ae){Ae.reset();break}}}}r={}}i=t.shouldUnregister?te.keepDefaultValues?Un(s):{}:Un(ae),h.array.next({values:{...ae}}),h.values.next({values:{...ae}})}a={mount:te.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!te.keepIsValid||!!te.keepDirtyValues,o.watch=!!t.shouldUnregister,h.state.next({submitCount:te.keepSubmitCount?n.submitCount:0,isDirty:ce?!1:te.keepDirty?n.isDirty:!!(te.keepDefaultValues&&!Xl(J,s)),isSubmitted:te.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ce?{}:te.keepDirtyValues?te.keepDefaultValues&&i?Cm(s,i):n.dirtyFields:te.keepDefaultValues&&J?Cm(s,J):te.keepDirty?n.dirtyFields:{},touchedFields:te.keepTouched?n.touchedFields:{},errors:te.keepErrors?n.errors:{},isSubmitSuccessful:te.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Me=(J,te)=>Ce(bo(J)?J(i):J,te);return{control:{register:ue,unregister:fe,getFieldState:X,handleSubmit:ke,setError:re,_executeSchema:M,_getWatch:H,_getDirty:V,_updateValid:E,_removeUnmounted:F,_updateFieldArray:_,_updateDisabledField:he,_getFieldArray:I,_reset:Ce,_resetDefaultValues:()=>bo(t.defaultValues)&&t.defaultValues().then(J=>{Me(J,t.resetOptions),h.state.next({isLoading:!1})}),_updateFormState:J=>{n={...n,...J}},_disableForm:Se,_subjects:h,_proxyFormState:f,_setErrors:j,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(J){o=J},get _defaultValues(){return s},get _names(){return a},set _names(J){a=J},get _formState(){return n},set _formState(J){n=J},get _options(){return t},set _options(J){t={...t,...J}}},trigger:k,register:ue,handleSubmit:ke,watch:se,setValue:L,getValues:W,reset:Me,resetField:Oe,clearErrors:ne,unregister:fe,setError:re,setFocus:(J,te={})=>{const Q=De(r,J),ye=Q&&Q._f;if(ye){const ce=ye.refs?ye.refs[0]:ye.ref;ce.focus&&(ce.focus(),te.shouldSelect&&bo(ce.select)&&ce.select())}},getFieldState:X}}function Za(e={}){const t=Re.useRef(void 0),n=Re.useRef(void 0),[r,s]=Re.useState({isDirty:!1,isValidating:!1,isLoading:bo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:bo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...JSe(e),formState:r});const i=t.current.control;return i._options=e,B1({subject:i._subjects.state,next:o=>{rq(o,i._proxyFormState,i._updateFormState,!0)&&s({...i._formState})}}),Re.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Re.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),Re.useEffect(()=>{e.values&&!Xl(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values,s(o=>({...o}))):i._resetDefaultValues()},[e.values,i]),Re.useEffect(()=>{e.errors&&i._setErrors(e.errors)},[e.errors,i]),Re.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),Re.useEffect(()=>{e.shouldUnregister&&i._subjects.values.next({values:i._getWatch()})},[e.shouldUnregister,i]),t.current.formState=nq(r,i),t.current}const nD=(e,t,n)=>{if(e&&"reportValidity"in e){const r=De(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},hq=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?nD(r.ref,n,e):r&&r.refs&&r.refs.forEach(s=>nD(s,n,e))}},XSe=(e,t)=>{t.shouldUseNativeValidation&&hq(e,t);const n={};for(const r in e){const s=De(t.fields,r),i=Object.assign(e[r]||{},{ref:s&&s.ref});if(KSe(t.names||Object.keys(e),r)){const o=Object.assign({},De(n,r));Pt(o,"root",i),Pt(n,r,o)}else Pt(n,r,i)}return n},KSe=(e,t)=>{const n=rD(t);return e.some(r=>rD(r).match(`^${n}\\.\\d+`))};function rD(e){return e.replace(/\]|\[/g,"")}function QSe(e){var t;if((t=e.path)!=null&&t.length){let n="";for(const r of e.path){const s=typeof r=="object"?r.key:r;if(typeof s=="string"||typeof s=="number")n?n+=`.${s}`:n+=s;else return null}return n}return null}function CO(){return CO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CO.apply(null,arguments)}function el(e,t){return t===void 0&&(t={}),function(n,r,s){try{var i=function(){if(o.issues){var c=function(u,f){for(var h={},m=0;m<u.length;m++){var y=u[m],v=QSe(y);if(v&&(h[v]||(h[v]={message:y.message,type:""}),f)){var x,E=h[v].types||{};h[v].types=CO({},E,((x={})[Object.keys(E).length]=y.message,x))}}return h}(o.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all");return{values:{},errors:XSe(c,s)}}return s.shouldUseNativeValidation&&hq({},s),{values:t.raw?Object.assign({},n):o.value,errors:{}}},o=e["~standard"].validate(n),a=function(){if(o instanceof Promise)return Promise.resolve(o).then(function(c){o=c})}();return Promise.resolve(a&&a.then?a.then(i):i())}catch(c){return Promise.reject(c)}}}const Rx=Qe({..._$.properties,name:xe()}),ZSe=Zt([xe({enum:["entity","relation","media"]}),xe({pattern:"^template-"})]),eEe=Qe({entity:xe(),name:xe(),field:un(N$)});st({action:ZSe,initial:ai().optional(),entities:Qe({create:un(Rx).optional()}).optional(),relations:Qe({create:un(Zt(C$)).optional()}).optional(),fields:Qe({create:un(eEe).optional()}).optional()});const tEe=Qe({name:Rx.properties.name,config:Rx.properties.config.partial().optional()});function nEe(){var h,m,y,v,x,E,N,_,C;const e=_w(),{nextStep:t,stepBack:n,state:r,setState:s}=Ed(),{register:i,handleSubmit:o,formState:a,watch:c,control:u}=Za({mode:"onChange",resolver:el(lF(tEe)),defaultValues:((m=(h=r.entities)==null?void 0:h.create)==null?void 0:m[0])??{}});function f(j){console.log("onSubmit",j),s(A=>{var R,M;const $=(M=(R=A.entities)==null?void 0:R.create)==null?void 0:M[0];return $&&$.name!==j.name?{...A,entities:{create:[{...j,fields:$.fields}]}}:{...A,entities:{create:[j]}}}),a.isValid&&(console.log("would go next"),t("entity-fields")())}return p.jsx(p.Fragment,{children:p.jsxs("form",{onSubmit:o(f),ref:e,children:[p.jsxs(wd,{children:[p.jsx("input",{type:"hidden",...i("type"),defaultValue:"regular"}),p.jsx(Nn,{"data-autofocus":!0,required:!0,error:(y=a.errors.name)==null?void 0:y.message,...i("name"),placeholder:"posts",size:"md",label:"What's the name of the entity?",description:"Use plural form, and all lowercase. It will be used as the database table."}),p.jsx(Nn,{...i("config.name"),error:(x=(v=a.errors.config)==null?void 0:v.name)==null?void 0:x.message,placeholder:"Posts",size:"md",label:"How should it be called?",description:"Use plural form. This will be used to display in the UI."}),p.jsx(Nn,{...i("config.name_singular"),error:(N=(E=a.errors.config)==null?void 0:E.name_singular)==null?void 0:N.message,placeholder:"Post",size:"md",label:"What's the singular form of it?"}),p.jsx(Ey,{placeholder:"This is a post (optional)",error:(C=(_=a.errors.config)==null?void 0:_.description)==null?void 0:C.message,...i("config.description"),size:"md",label:"Description"})]}),p.jsx(Sd,{next:{type:"submit",disabled:!a.isValid},prev:{onClick:n},debug:{state:r}})]})})}function ja({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,...o}){var h;const{field:{value:a,onChange:c,...u},fieldState:f}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsx(Kw,{value:a,onChange:async m=>{await c({...new Event("change",{bubbles:!0,cancelable:!0}),target:{value:m,name:u.name}}),i==null||i(m)},error:(h=f.error)==null?void 0:h.message,...u,...o})}function rg({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,...o}){var h;const{field:{value:a,onChange:c,...u},fieldState:f}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsx(Wa,{value:a,checked:a,onChange:m=>{c(m),i==null||i(m)},error:(h=f.error)==null?void 0:h.message,...u,...o})}const rEe=w.lazy(()=>Wy(()=>import("./JsonSchemaForm-BRm6fUTZ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.JsonSchemaForm}))),hp=w.forwardRef((e,t)=>p.jsx(w.Suspense,{children:p.jsx(rEe,{ref:t,...e})}));function Rr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var sEe=typeof Symbol=="function"&&Symbol.observable||"@@observable",sD=sEe,iD=()=>Math.random().toString(36).substring(7).split("").join("."),iEe={INIT:`@@redux/INIT${iD()}`,REPLACE:`@@redux/REPLACE${iD()}`},oD=iEe;function oEe(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function pq(e,t,n){if(typeof e!="function")throw new Error(Rr(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Rr(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Rr(1));return n(pq)(e,t)}let r=e,s=t,i=new Map,o=i,a=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((E,N)=>{o.set(N,E)}))}function f(){if(c)throw new Error(Rr(3));return s}function h(E){if(typeof E!="function")throw new Error(Rr(4));if(c)throw new Error(Rr(5));let N=!0;u();const _=a++;return o.set(_,E),function(){if(N){if(c)throw new Error(Rr(6));N=!1,u(),o.delete(_),i=null}}}function m(E){if(!oEe(E))throw new Error(Rr(7));if(typeof E.type>"u")throw new Error(Rr(8));if(typeof E.type!="string")throw new Error(Rr(17));if(c)throw new Error(Rr(9));try{c=!0,s=r(s,E)}finally{c=!1}return(i=o).forEach(_=>{_()}),E}function y(E){if(typeof E!="function")throw new Error(Rr(10));r=E,m({type:oD.REPLACE})}function v(){const E=h;return{subscribe(N){if(typeof N!="object"||N===null)throw new Error(Rr(11));function _(){const j=N;j.next&&j.next(f())}return _(),{unsubscribe:E(_)}},[sD](){return this}}}return m({type:oD.INIT}),{dispatch:m,subscribe:h,getState:f,replaceReducer:y,[sD]:v}}function aD(e,t){return function(...n){return t(e.apply(this,n))}}function lD(e,t){if(typeof e=="function")return aD(e,t);if(typeof e!="object"||e===null)throw new Error(Rr(16));const n={};for(const r in e){const s=e[r];typeof s=="function"&&(n[r]=aD(s,t))}return n}function mq(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function aEe(...e){return t=>(n,r)=>{const s=t(n,r);let i=()=>{throw new Error(Rr(15))};const o={getState:s.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(o));return i=mq(...a)(s.dispatch),{...s,dispatch:i}}}var YN={exports:{}},JN={};/**
 * @license React
 * use-sync-external-store-with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var cD;function lEe(){if(cD)return JN;cD=1;var e=Hh();function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=e.useRef,i=e.useEffect,o=e.useMemo,a=e.useDebugValue;return JN.useSyncExternalStoreWithSelector=function(c,u,f,h,m){var y=s(null);if(y.current===null){var v={hasValue:!1,value:null};y.current=v}else v=y.current;y=o(function(){function E(A){if(!N){if(N=!0,_=A,A=h(A),m!==void 0&&v.hasValue){var $=v.value;if(m($,A))return C=$}return C=A}if($=C,n(_,A))return $;var R=h(A);return m!==void 0&&m($,R)?(_=A,$):(_=A,C=R)}var N=!1,_,C,j=f===void 0?null:f;return[function(){return E(u())},j===null?void 0:function(){return E(j())}]},[u,f,h,m]);var x=r(c,y[0],y[1]);return i(function(){v.hasValue=!0,v.value=x},[x]),a(x),x},JN}var uD;function cEe(){return uD||(uD=1,YN.exports=lEe()),YN.exports}cEe();var uEe=w.version.startsWith("19"),dEe=Symbol.for(uEe?"react.transitional.element":"react.element"),fEe=Symbol.for("react.portal"),hEe=Symbol.for("react.fragment"),pEe=Symbol.for("react.strict_mode"),mEe=Symbol.for("react.profiler"),gEe=Symbol.for("react.consumer"),yEe=Symbol.for("react.context"),gq=Symbol.for("react.forward_ref"),bEe=Symbol.for("react.suspense"),vEe=Symbol.for("react.suspense_list"),mT=Symbol.for("react.memo"),xEe=Symbol.for("react.lazy"),wEe=gq,SEe=mT;function EEe(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case dEe:switch(e=e.type,e){case hEe:case mEe:case pEe:case bEe:case vEe:return e;default:switch(e=e&&e.$$typeof,e){case yEe:case gq:case xEe:case mT:return e;case gEe:return e;default:return t}}case fEe:return t}}}function NEe(e){return EEe(e)===mT}function _Ee(e,t,n,r,{areStatesEqual:s,areOwnPropsEqual:i,areStatePropsEqual:o}){let a=!1,c,u,f,h,m;function y(_,C){return c=_,u=C,f=e(c,u),h=t(r,u),m=n(f,h,u),a=!0,m}function v(){return f=e(c,u),t.dependsOnOwnProps&&(h=t(r,u)),m=n(f,h,u),m}function x(){return e.dependsOnOwnProps&&(f=e(c,u)),t.dependsOnOwnProps&&(h=t(r,u)),m=n(f,h,u),m}function E(){const _=e(c,u),C=!o(_,f);return f=_,C&&(m=n(f,h,u)),m}function N(_,C){const j=!i(C,u),A=!s(_,c,C,u);return c=_,u=C,j&&A?v():j?x():A?E():m}return function(C,j){return a?N(C,j):y(C,j)}}function CEe(e,{initMapStateToProps:t,initMapDispatchToProps:n,initMergeProps:r,...s}){const i=t(e,s),o=n(e,s),a=r(e,s);return _Ee(i,o,a,e,s)}function OEe(e,t){const n={};for(const r in e){const s=e[r];typeof s=="function"&&(n[r]=(...i)=>t(s(...i)))}return n}function OO(e){return function(n){const r=e(n);function s(){return r}return s.dependsOnOwnProps=!1,s}}function dD(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function yq(e,t){return function(r,{displayName:s}){const i=function(a,c){return i.dependsOnOwnProps?i.mapToProps(a,c):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,c){i.mapToProps=e,i.dependsOnOwnProps=dD(e);let u=i(a,c);return typeof u=="function"&&(i.mapToProps=u,i.dependsOnOwnProps=dD(u),u=i(a,c)),u},i}}function gT(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function jEe(e){return e&&typeof e=="object"?OO(t=>OEe(e,t)):e?typeof e=="function"?yq(e):gT(e,"mapDispatchToProps"):OO(t=>({dispatch:t}))}function AEe(e){return e?typeof e=="function"?yq(e):gT(e,"mapStateToProps"):OO(()=>({}))}function $Ee(e,t,n){return{...n,...e,...t}}function TEe(e){return function(n,{displayName:r,areMergedPropsEqual:s}){let i=!1,o;return function(c,u,f){const h=e(c,u,f);return i?s(h,o)||(o=h):(i=!0,o=h),o}}}function REe(e){return e?typeof e=="function"?TEe(e):gT(e,"mergeProps"):()=>$Ee}function MEe(e){e()}function kEe(){let e=null,t=null;return{clear(){e=null,t=null},notify(){MEe(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!r||e===null||(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var fD={notify(){},get:()=>[]};function bq(e,t){let n,r=fD,s=0,i=!1;function o(x){f();const E=r.subscribe(x);let N=!1;return()=>{N||(N=!0,E(),h())}}function a(){r.notify()}function c(){v.onStateChange&&v.onStateChange()}function u(){return i}function f(){s++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=kEe())}function h(){s--,n&&s===0&&(n(),n=void 0,r.clear(),r=fD)}function m(){i||(i=!0,f())}function y(){i&&(i=!1,h())}const v={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:u,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return v}var IEe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",DEe=IEe(),PEe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",LEe=PEe(),FEe=()=>DEe||LEe?w.useLayoutEffect:w.useEffect,Mx=FEe();function hD(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function XN(e,t){if(hD(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(!Object.prototype.hasOwnProperty.call(t,n[s])||!hD(e[n[s]],t[n[s]]))return!1;return!0}var BEe={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},zEe={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},VEe={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},vq={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},UEe={[wEe]:VEe,[SEe]:vq};function pD(e){return NEe(e)?vq:UEe[e.$$typeof]||BEe}var qEe=Object.defineProperty,HEe=Object.getOwnPropertyNames,mD=Object.getOwnPropertySymbols,WEe=Object.getOwnPropertyDescriptor,GEe=Object.getPrototypeOf,gD=Object.prototype;function jO(e,t){if(typeof t!="string"){if(gD){const i=GEe(t);i&&i!==gD&&jO(e,i)}let n=HEe(t);mD&&(n=n.concat(mD(t)));const r=pD(e),s=pD(t);for(let i=0;i<n.length;++i){const o=n[i];if(!zEe[o]&&!(s&&s[o])&&!(r&&r[o])){const a=WEe(t,o);try{qEe(e,o,a)}catch{}}}}return e}var KN=Symbol.for("react-redux-context"),QN=typeof globalThis<"u"?globalThis:{};function YEe(){if(!w.createContext)return{};const e=QN[KN]??(QN[KN]=new Map);let t=e.get(w.createContext);return t||(t=w.createContext(null),e.set(w.createContext,t)),t}var xq=YEe(),JEe=[null,null];function XEe(e,t,n){Mx(()=>e(...t),n)}function KEe(e,t,n,r,s,i){e.current=r,n.current=!1,s.current&&(s.current=null,i())}function QEe(e,t,n,r,s,i,o,a,c,u,f){if(!e)return()=>{};let h=!1,m=null;const y=()=>{if(h||!a.current)return;const x=t.getState();let E,N;try{E=r(x,s.current)}catch(_){N=_,m=_}N||(m=null),E===i.current?o.current||u():(i.current=E,c.current=E,o.current=!0,f())};return n.onStateChange=y,n.trySubscribe(),y(),()=>{if(h=!0,n.tryUnsubscribe(),n.onStateChange=null,m)throw m}}function ZEe(e,t){return e===t}function e2e(e,t,n,{pure:r,areStatesEqual:s=ZEe,areOwnPropsEqual:i=XN,areStatePropsEqual:o=XN,areMergedPropsEqual:a=XN,forwardRef:c=!1,context:u=xq}={}){const f=u,h=AEe(e),m=jEe(t),y=REe(n),v=!!e;return E=>{const N=E.displayName||E.name||"Component",_=`Connect(${N})`,C={shouldHandleStateChanges:v,displayName:_,wrappedComponentName:N,WrappedComponent:E,initMapStateToProps:h,initMapDispatchToProps:m,initMergeProps:y,areStatesEqual:s,areStatePropsEqual:o,areOwnPropsEqual:i,areMergedPropsEqual:a};function j(R){const[M,D,P]=w.useMemo(()=>{const{reactReduxForwardedRef:Oe,...Ce}=R;return[R.context,Oe,Ce]},[R]),F=w.useMemo(()=>{let Oe=f;return M!=null&&M.Consumer,Oe},[M,f]),V=w.useContext(F),H=!!R.store&&!!R.store.getState&&!!R.store.dispatch,I=!!V&&!!V.store,B=H?R.store:V.store,T=I?V.getServerState:B.getState,L=w.useMemo(()=>CEe(B.dispatch,C),[B]),[z,q]=w.useMemo(()=>{if(!v)return JEe;const Oe=bq(B,H?void 0:V.subscription),Ce=Oe.notifyNestedSubs.bind(Oe);return[Oe,Ce]},[B,H,V]),k=w.useMemo(()=>H?V:{...V,subscription:z},[H,V,z]),W=w.useRef(void 0),X=w.useRef(P),ne=w.useRef(void 0),re=w.useRef(!1),se=w.useRef(!1),fe=w.useRef(void 0);Mx(()=>(se.current=!0,()=>{se.current=!1}),[]);const he=w.useMemo(()=>()=>ne.current&&P===X.current?ne.current:L(B.getState(),P),[B,P]),ue=w.useMemo(()=>Ce=>z?QEe(v,B,z,L,X,W,re,se,ne,q,Ce):()=>{},[z]);XEe(KEe,[X,W,re,P,ne,q]);let ve;try{ve=w.useSyncExternalStore(ue,he,T?()=>L(T(),P):he)}catch(Oe){throw fe.current&&(Oe.message+=`
The error may be correlated with this previous error:
${fe.current.stack}

`),Oe}Mx(()=>{fe.current=void 0,ne.current=void 0,W.current=ve});const Se=w.useMemo(()=>w.createElement(E,{...ve,ref:D}),[D,E,ve]);return w.useMemo(()=>v?w.createElement(F.Provider,{value:k},Se):Se,[F,Se,k])}const $=w.memo(j);if($.WrappedComponent=E,$.displayName=j.displayName=_,c){const M=w.forwardRef(function(P,F){return w.createElement($,{...P,reactReduxForwardedRef:F})});return M.displayName=_,M.WrappedComponent=E,jO(M,E)}return jO($,E)}}var wq=e2e;function t2e(e){const{children:t,context:n,serverState:r,store:s}=e,i=w.useMemo(()=>{const c=bq(s);return{store:s,subscription:c,getServerState:r?()=>r:void 0}},[s,r]),o=w.useMemo(()=>s.getState(),[s]);Mx(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const a=n||xq;return w.createElement(a.Provider,{value:i},t)}var n2e=t2e,r2e="Invariant failed";function s2e(e,t){throw new Error(r2e)}var Bi=function(t){var n=t.top,r=t.right,s=t.bottom,i=t.left,o=r-i,a=s-n,c={top:n,right:r,bottom:s,left:i,width:o,height:a,x:i,y:n,center:{x:(r+i)/2,y:(s+n)/2}};return c},yT=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},yD=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},i2e=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},ZN={top:0,right:0,bottom:0,left:0},bT=function(t){var n=t.borderBox,r=t.margin,s=r===void 0?ZN:r,i=t.border,o=i===void 0?ZN:i,a=t.padding,c=a===void 0?ZN:a,u=Bi(yT(n,s)),f=Bi(yD(n,o)),h=Bi(yD(f,c));return{marginBox:u,borderBox:Bi(n),paddingBox:f,contentBox:h,margin:s,border:o,padding:c}},Ws=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var s=Number(n);return isNaN(s)&&s2e(),s},o2e=function(){return{x:window.pageXOffset,y:window.pageYOffset}},kx=function(t,n){var r=t.borderBox,s=t.border,i=t.margin,o=t.padding,a=i2e(r,n);return bT({borderBox:a,border:s,margin:i,padding:o})},Ix=function(t,n){return n===void 0&&(n=o2e()),kx(t,n)},Sq=function(t,n){var r={top:Ws(n.marginTop),right:Ws(n.marginRight),bottom:Ws(n.marginBottom),left:Ws(n.marginLeft)},s={top:Ws(n.paddingTop),right:Ws(n.paddingRight),bottom:Ws(n.paddingBottom),left:Ws(n.paddingLeft)},i={top:Ws(n.borderTopWidth),right:Ws(n.borderRightWidth),bottom:Ws(n.borderBottomWidth),left:Ws(n.borderLeftWidth)};return bT({borderBox:t,margin:r,padding:s,border:i})},Eq=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Sq(n,r)},zg=function(t){var n=[],r=null,s=function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];n=a,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return s.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},s};function Nq(e,t){}Nq.bind(null,"warn");Nq.bind(null,"error");function pc(){}function a2e(e,t){return{...e,...t}}function ei(e,t,n){const r=t.map(s=>{const i=a2e(n,s.options);return e.addEventListener(s.eventName,s.fn,i),function(){e.removeEventListener(s.eventName,s.fn,i)}});return function(){r.forEach(i=>{i()})}}const l2e="Invariant failed";class Dx extends Error{}Dx.prototype.toString=function(){return this.message};function Le(e,t){throw new Dx(l2e)}let c2e=class extends Re.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=pc,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Dx&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=ei(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Dx){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const u2e=`
  Press space bar to start a drag.
  When dragging you can use the arrow keys to move the item around and escape to cancel.
  Some screen readers may require you to be in focus mode or to use your pass through key
`,Px=e=>e+1,d2e=e=>`
  You have lifted an item in position ${Px(e.source.index)}
`,_q=(e,t)=>{const n=e.droppableId===t.droppableId,r=Px(e.index),s=Px(t.index);return n?`
      You have moved the item from position ${r}
      to position ${s}
    `:`
    You have moved the item from position ${r}
    in list ${e.droppableId}
    to list ${t.droppableId}
    in position ${s}
  `},Cq=(e,t,n)=>t.droppableId===n.droppableId?`
      The item ${e}
      has been combined with ${n.draggableId}`:`
      The item ${e}
      in list ${t.droppableId}
      has been combined with ${n.draggableId}
      in list ${n.droppableId}
    `,f2e=e=>{const t=e.destination;if(t)return _q(e.source,t);const n=e.combine;return n?Cq(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},bD=e=>`
  The item has returned to its starting position
  of ${Px(e.index)}
`,h2e=e=>{if(e.reason==="CANCEL")return`
      Movement cancelled.
      ${bD(e.source)}
    `;const t=e.destination,n=e.combine;return t?`
      You have dropped the item.
      ${_q(e.source,t)}
    `:n?`
      You have dropped the item.
      ${Cq(e.draggableId,e.source,n)}
    `:`
    The item has been dropped while not over a drop area.
    ${bD(e.source)}
  `},Ov={dragHandleUsageInstructions:u2e,onDragStart:d2e,onDragUpdate:f2e,onDragEnd:h2e};function p2e(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Oq(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!p2e(e[n],t[n]))return!1;return!0}function Ot(e,t){const n=w.useState(()=>({inputs:t,result:e()}))[0],r=w.useRef(!0),s=w.useRef(n),o=r.current||!!(t&&s.current.inputs&&Oq(t,s.current.inputs))?s.current:{inputs:t,result:e()};return w.useEffect(()=>{r.current=!1,s.current=o},[o]),o.result}function tt(e,t){return Ot(()=>e,t)}const or={x:0,y:0},hr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),ws=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),mc=(e,t)=>e.x===t.x&&e.y===t.y,pp=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),sd=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Vg=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),vD=(e,t)=>Math.min(...t.map(n=>Vg(e,n))),jq=e=>t=>({x:e(t.x),y:e(t.y)});var m2e=(e,t)=>{const n=Bi({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const Jy=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),xD=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],g2e={top:0,right:0,bottom:0,left:0},y2e=(e,t)=>t?Jy(e,t.scroll.diff.displacement):e,b2e=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,v2e=(e,t)=>t&&t.shouldClipSubject?m2e(t.pageMarginBox,e):Bi(e);var Rh=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const s=y2e(e.marginBox,r),i=b2e(s,n,t),o=v2e(i,r);return{page:e,withPlaceholder:t,active:o}},vT=(e,t)=>{e.frame||Le();const n=e.frame,r=ws(t,n.scroll.initial),s=pp(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:s},max:n.scroll.max}},o=Rh({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:o}};function sr(e,t=Oq){let n=null;function r(...s){if(n&&n.lastThis===this&&t(s,n.lastArgs))return n.lastResult;const i=e.apply(this,s);return n={lastResult:i,lastArgs:s,lastThis:this},i}return r.clear=function(){n=null},r}const Aq=sr(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),$q=sr(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),z1=sr(e=>Object.values(e)),x2e=sr(e=>Object.values(e));var mp=sr((e,t)=>x2e(t).filter(r=>e===r.descriptor.droppableId).sort((r,s)=>r.descriptor.index-s.descriptor.index));function xT(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function V1(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var U1=sr((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),w2e=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:s})=>{if(!n.isCombineEnabled||!xT(s))return null;function o(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...s,at:v}}const a=s.displaced.all,c=a.length?a[0]:null;if(e)return c?o(c):null;const u=U1(t,r);if(!c){if(!u.length)return null;const y=u[u.length-1];return o(y.descriptor.id)}const f=u.findIndex(y=>y.descriptor.id===c);f===-1&&Le();const h=f-1;if(h<0)return null;const m=u[h];return o(m.descriptor.id)},gp=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Tq={point:or,value:0},Ug={invisible:{},visible:{},all:[]},S2e={displaced:Ug,displacedBy:Tq,at:null};var ni=(e,t)=>n=>e<=n&&n<=t,Rq=e=>{const t=ni(e.top,e.bottom),n=ni(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),o=n(r.left)||n(r.right);if(i&&o)return!0;const c=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return c&&u?!0:c&&o||u&&i}},E2e=e=>{const t=ni(e.top,e.bottom),n=ni(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const wT={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Mq={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var N2e=e=>t=>{const n=ni(t.top,t.bottom),r=ni(t.left,t.right);return s=>e===wT?n(s.top)&&n(s.bottom):r(s.left)&&r(s.right)};const _2e=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:or;return Jy(e,n)},C2e=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,O2e=(e,t,n)=>n(t)(e),ST=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:s})=>{const i=r?_2e(e,t):e;return C2e(i,t,s)&&O2e(i,n,s)},j2e=e=>ST({...e,isVisibleThroughFrameFn:Rq}),kq=e=>ST({...e,isVisibleThroughFrameFn:E2e}),A2e=e=>ST({...e,isVisibleThroughFrameFn:N2e(e.destination.axis)}),$2e=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:s}=t;if(r[e])return!1;const i=s[e];return i?i.shouldAnimate:!0};function T2e(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Bi(yT(n,r))}function qg({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:s,last:i}){return e.reduce(function(a,c){const u=T2e(c,n),f=c.descriptor.id;if(a.all.push(f),!j2e({target:u,destination:t,viewport:r,withDroppableDisplacement:!0}))return a.invisible[c.descriptor.id]=!0,a;const m=$2e(f,i,s),y={draggableId:f,shouldAnimate:m};return a.visible[f]=y,a},{all:[],visible:{},invisible:{}})}function R2e(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function wD({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const s=R2e(e,{inHomeList:t});return{displaced:Ug,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:s}}}}function Lx({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:s,last:i,index:o,forceShouldAnimate:a}){const c=gp(e,n);if(o==null)return wD({insideDestination:t,inHomeList:c,displacedBy:s,destination:n});const u=t.find(v=>v.descriptor.index===o);if(!u)return wD({insideDestination:t,inHomeList:c,displacedBy:s,destination:n});const f=U1(e,t),h=t.indexOf(u),m=f.slice(h);return{displaced:qg({afterDragging:m,destination:n,displacedBy:s,last:i,viewport:r.frame,forceShouldAnimate:a}),displacedBy:s,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function Oc(e,t){return!!t.effected[e]}var M2e=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:s})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,a=n[i].descriptor.index;return Oc(i,s)?e?a:a-1:e?a+1:a},k2e=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const s=r.index,i=e?s+1:s-1,o=n[0].descriptor.index,a=n[n.length-1].descriptor.index,c=t?a:a+1;return i<o||i>c?null:i},I2e=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:s,insideDestination:i,previousImpact:o,viewport:a,afterCritical:c})=>{const u=o.at;if(u||Le(),u.type==="REORDER"){const h=k2e({isMovingForward:e,isInHomeList:t,location:u.destination,insideDestination:i});return h==null?null:Lx({draggable:n,insideDestination:i,destination:s,viewport:a,last:o.displaced,displacedBy:o.displacedBy,index:h})}const f=M2e({isMovingForward:e,destination:s,displaced:o.displaced,draggables:r,combine:u.combine,afterCritical:c});return f==null?null:Lx({draggable:n,insideDestination:i,destination:s,viewport:a,last:o.displaced,displacedBy:o.displacedBy,index:f})},D2e=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const s=!!(e.visible[n]||e.invisible[n]);return Oc(n,t)?s?or:pp(r.point):s?r.point:or},P2e=({afterCritical:e,impact:t,draggables:n})=>{const r=V1(t);r||Le();const s=r.draggableId,i=n[s].page.borderBox.center,o=D2e({displaced:t.displaced,afterCritical:e,combineWith:s,displacedBy:t.displacedBy});return hr(i,o)};const Iq=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,L2e=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,ET=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,SD=({axis:e,moveRelativeTo:t,isMoving:n})=>sd(e.line,t.marginBox[e.end]+Iq(e,n),ET(e,t.marginBox,n)),ED=({axis:e,moveRelativeTo:t,isMoving:n})=>sd(e.line,t.marginBox[e.start]-L2e(e,n),ET(e,t.marginBox,n)),F2e=({axis:e,moveInto:t,isMoving:n})=>sd(e.line,t.contentBox[e.start]+Iq(e,n),ET(e,t.contentBox,n));var B2e=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:s})=>{const i=mp(r.descriptor.id,n),o=t.page,a=r.axis;if(!i.length)return F2e({axis:a,moveInto:r.page,isMoving:o});const{displaced:c,displacedBy:u}=e,f=c.all[0];if(f){const m=n[f];if(Oc(f,s))return ED({axis:a,moveRelativeTo:m.page,isMoving:o});const y=kx(m.page,u.point);return ED({axis:a,moveRelativeTo:y,isMoving:o})}const h=i[i.length-1];if(h.descriptor.id===t.descriptor.id)return o.borderBox.center;if(Oc(h.descriptor.id,s)){const m=kx(h.page,pp(s.displacedBy.point));return SD({axis:a,moveRelativeTo:m,isMoving:o})}return SD({axis:a,moveRelativeTo:h.page,isMoving:o})},AO=(e,t)=>{const n=e.frame;return n?hr(t,n.scroll.diff.displacement):t};const z2e=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:s})=>{const i=t.page.borderBox.center,o=e.at;return!n||!o?i:o.type==="REORDER"?B2e({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:s}):P2e({impact:e,draggables:r,afterCritical:s})};var q1=e=>{const t=z2e(e),n=e.droppable;return n?AO(n,t):t},Dq=(e,t)=>{const n=ws(t,e.scroll.initial),r=pp(n);return{frame:Bi({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function ND(e,t){return e.map(n=>t[n])}function V2e(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var U2e=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:s})=>{const i=Dq(t,hr(t.scroll.current,s)),o=n.frame?vT(n,hr(n.frame.scroll.current,s)):n,a=e.displaced,c=qg({afterDragging:ND(a.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),u=qg({afterDragging:ND(a.all,r),destination:o,displacedBy:e.displacedBy,viewport:t.frame,last:a,forceShouldAnimate:!1}),f={},h={},m=[a,c,u];return a.all.forEach(v=>{const x=V2e(v,m);if(x){h[v]=x;return}f[v]=!0}),{...e,displaced:{all:a.all,invisible:f,visible:h}}},q2e=(e,t)=>hr(e.scroll.diff.displacement,t),NT=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=q2e(n,e),s=ws(r,t.page.borderBox.center);return hr(t.client.borderBox.center,s)},Pq=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:s,onlyOnMainAxis:i=!1})=>{const o=ws(n,e.page.borderBox.center),c={target:Jy(e.page.borderBox,o),destination:t,withDroppableDisplacement:s,viewport:r};return i?A2e(c):kq(c)},H2e=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:s,viewport:i,previousPageBorderBoxCenter:o,previousClientSelection:a,afterCritical:c})=>{if(!n.isEnabled)return null;const u=mp(n.descriptor.id,r),f=gp(t,n),h=w2e({isMovingForward:e,draggable:t,destination:n,insideDestination:u,previousImpact:s})||I2e({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:u,previousImpact:s,viewport:i,afterCritical:c});if(!h)return null;const m=q1({impact:h,draggable:t,droppable:n,draggables:r,afterCritical:c});if(Pq({draggable:t,destination:n,newPageBorderBoxCenter:m,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:NT({pageBorderBoxCenter:m,draggable:t,viewport:i}),impact:h,scrollJumpRequest:null};const v=ws(m,o),x=U2e({impact:h,viewport:i,destination:n,draggables:r,maxScrollChange:v});return{clientSelection:a,impact:x,scrollJumpRequest:v}};const Ar=e=>{const t=e.subject.active;return t||Le(),t};var W2e=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:s})=>{const i=n.subject.active;if(!i)return null;const o=n.axis,a=ni(i[o.start],i[o.end]),c=z1(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>Rq(s.frame)(Ar(f))).filter(f=>{const h=Ar(f);return e?i[o.crossAxisEnd]<h[o.crossAxisEnd]:h[o.crossAxisStart]<i[o.crossAxisStart]}).filter(f=>{const h=Ar(f),m=ni(h[o.start],h[o.end]);return a(h[o.start])||a(h[o.end])||m(i[o.start])||m(i[o.end])}).sort((f,h)=>{const m=Ar(f)[o.crossAxisStart],y=Ar(h)[o.crossAxisStart];return e?m-y:y-m}).filter((f,h,m)=>Ar(f)[o.crossAxisStart]===Ar(m[0])[o.crossAxisStart]);if(!c.length)return null;if(c.length===1)return c[0];const u=c.filter(f=>ni(Ar(f)[o.start],Ar(f)[o.end])(t[o.line]));return u.length===1?u[0]:u.length>1?u.sort((f,h)=>Ar(f)[o.start]-Ar(h)[o.start])[0]:c.sort((f,h)=>{const m=vD(t,xD(Ar(f))),y=vD(t,xD(Ar(h)));return m!==y?m-y:Ar(f)[o.start]-Ar(h)[o.start]})[0]};const _D=(e,t)=>{const n=e.page.borderBox.center;return Oc(e.descriptor.id,t)?ws(n,t.displacedBy.point):n},G2e=(e,t)=>{const n=e.page.borderBox;return Oc(e.descriptor.id,t)?Jy(n,pp(t.displacedBy.point)):n};var Y2e=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:s})=>r.filter(o=>kq({target:G2e(o,s),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((o,a)=>{const c=Vg(e,AO(n,_D(o,s))),u=Vg(e,AO(n,_D(a,s)));return c<u?-1:u<c?1:o.descriptor.index-a.descriptor.index})[0]||null,Xy=sr(function(t,n){const r=n[t.line];return{value:r,point:sd(t.line,r)}});const J2e=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return sd(r.line,t[r.line]);const s=e.subject.page.contentBox[r.size],c=mp(e.descriptor.id,n).reduce((u,f)=>u+f.client.marginBox[r.size],0)+t[r.line]-s;return c<=0?null:sd(r.line,c)},Lq=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Fq=(e,t,n)=>{const r=e.frame;gp(t,e)&&Le(),e.subject.withPlaceholder&&Le();const s=Xy(e.axis,t.displaceBy).point,i=J2e(e,s,n),o={placeholderSize:s,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Rh({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:e.frame});return{...e,subject:f}}const a=i?hr(r.scroll.max,i):r.scroll.max,c=Lq(r,a),u=Rh({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:c});return{...e,subject:u,frame:c}},X2e=e=>{const t=e.subject.withPlaceholder;t||Le();const n=e.frame;if(!n){const o=Rh({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:o}}const r=t.oldFrameMaxScroll;r||Le();const s=Lq(n,r),i=Rh({page:e.subject.page,axis:e.axis,frame:s,withPlaceholder:null});return{...e,subject:i,frame:s}};var K2e=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:s,destination:i,viewport:o,afterCritical:a})=>{if(!t){if(n.length)return null;const h={displaced:Ug,displacedBy:Tq,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},m=q1({impact:h,draggable:r,droppable:i,draggables:s,afterCritical:a}),y=gp(r,i)?i:Fq(i,r,s);return Pq({draggable:r,destination:y,newPageBorderBoxCenter:m,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?h:null}const c=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],u=(()=>{const h=t.descriptor.index;return t.descriptor.id===r.descriptor.id||c?h:h+1})(),f=Xy(i.axis,r.displaceBy);return Lx({draggable:r,insideDestination:n,destination:i,viewport:o,displacedBy:f,last:Ug,index:u})},Q2e=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:s,droppables:i,viewport:o,afterCritical:a})=>{const c=W2e({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:o});if(!c)return null;const u=mp(c.descriptor.id,s),f=Y2e({pageBorderBoxCenter:t,viewport:o,destination:c,insideDestination:u,afterCritical:a}),h=K2e({previousPageBorderBoxCenter:t,destination:c,draggable:n,draggables:s,moveRelativeTo:f,insideDestination:u,viewport:o,afterCritical:a});if(!h)return null;const m=q1({impact:h,draggable:n,droppable:c,draggables:s,afterCritical:a});return{clientSelection:NT({pageBorderBoxCenter:m,draggable:n,viewport:o}),impact:h,scrollJumpRequest:null}},Es=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const Z2e=(e,t)=>{const n=Es(e);return n?t[n]:null};var eNe=({state:e,type:t})=>{const n=Z2e(e.impact,e.dimensions.droppables),r=!!n,s=e.dimensions.droppables[e.critical.droppable.id],i=n||s,o=i.axis.direction,a=o==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||o==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(a&&!r)return null;const c=t==="MOVE_DOWN"||t==="MOVE_RIGHT",u=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:h,droppables:m}=e.dimensions;return a?H2e({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,destination:i,draggables:h,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Q2e({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,isOver:i,draggables:h,droppables:m,viewport:e.viewport,afterCritical:e.afterCritical})};function wu(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function Bq(e){const t=ni(e.top,e.bottom),n=ni(e.left,e.right);return function(s){return t(s.y)&&n(s.x)}}function tNe(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function nNe({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,s=n.map(i=>{const o=i.axis,a=sd(i.axis.line,e.center[o.line],i.page.borderBox.center[o.crossAxisLine]);return{id:i.descriptor.id,distance:Vg(r,a)}}).sort((i,o)=>o.distance-i.distance);return s[0]?s[0].id:null}function rNe({pageBorderBox:e,draggable:t,droppables:n}){const r=z1(n).filter(s=>{if(!s.isEnabled)return!1;const i=s.subject.active;if(!i||!tNe(e,i))return!1;if(Bq(i)(e.center))return!0;const o=s.axis,a=i.center[o.crossAxisLine],c=e[o.crossAxisStart],u=e[o.crossAxisEnd],f=ni(i[o.crossAxisStart],i[o.crossAxisEnd]),h=f(c),m=f(u);return!h&&!m?!0:h?c<a:u>a});return r.length?r.length===1?r[0].descriptor.id:nNe({pageBorderBox:e,draggable:t,candidates:r}):null}const zq=(e,t)=>Bi(Jy(e,t));var sNe=(e,t)=>{const n=e.frame;return n?zq(t,n.scroll.diff.value):t};function Vq({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function iNe({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var oNe=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:s,viewport:i,afterCritical:o})=>{const a=n.axis,c=Xy(n.axis,t.displaceBy),u=c.value,f=e[a.start],h=e[a.end],y=U1(t,r).find(x=>{const E=x.descriptor.id,N=x.page.borderBox.center[a.line],_=Oc(E,o),C=Vq({displaced:s,id:E});return _?C?h<=N:f<N-u:C?h<=N+u:f<N})||null,v=iNe({draggable:t,closest:y,inHomeList:gp(t,n)});return Lx({draggable:t,insideDestination:r,destination:n,viewport:i,last:s,displacedBy:c,index:v})};const aNe=4;var lNe=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:s,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const o=r.axis,a=Xy(r.axis,e.displaceBy),c=a.value,u=t[o.start],f=t[o.end],m=U1(e,s).find(v=>{const x=v.descriptor.id,E=v.page.borderBox,_=E[o.size]/aNe,C=Oc(x,i),j=Vq({displaced:n.displaced,id:x});return C?j?f>E[o.start]+_&&f<E[o.end]-_:u>E[o.start]-c+_&&u<E[o.end]-c-_:j?f>E[o.start]+c+_&&f<E[o.end]+c-_:u>E[o.start]+_&&u<E[o.end]-_});return m?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:m.descriptor.id,droppableId:r.descriptor.id}}}:null},Uq=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:s,viewport:i,afterCritical:o})=>{const a=zq(t.page.borderBox,e),c=rNe({pageBorderBox:a,draggable:t,droppables:r});if(!c)return S2e;const u=r[c],f=mp(u.descriptor.id,n),h=sNe(u,a);return lNe({pageBorderBoxWithDroppableScroll:h,draggable:t,previousImpact:s,destination:u,insideDestination:f,afterCritical:o})||oNe({pageBorderBoxWithDroppableScroll:h,draggable:t,destination:u,insideDestination:f,last:s.displaced,viewport:i,afterCritical:o})},_T=(e,t)=>({...e,[t.descriptor.id]:t});const cNe=({previousImpact:e,impact:t,droppables:n})=>{const r=Es(e),s=Es(t);if(!r||r===s)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const o=X2e(i);return _T(n,o)};var uNe=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:s})=>{const i=cNe({previousImpact:r,impact:s,droppables:n}),o=Es(s);if(!o)return i;const a=n[o];if(gp(e,a)||a.subject.withPlaceholder)return i;const c=Fq(a,e,t);return _T(i,c)},sg=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:s,scrollJumpRequest:i})=>{const o=r||e.viewport,a=n||e.dimensions,c=t||e.current.client.selection,u=ws(c,e.initial.client.selection),f={offset:u,selection:c,borderBoxCenter:hr(e.initial.client.borderBoxCenter,u)},h={selection:hr(f.selection,o.scroll.current),borderBoxCenter:hr(f.borderBoxCenter,o.scroll.current),offset:hr(f.offset,o.scroll.diff.value)},m={client:f,page:h};if(e.phase==="COLLECTING")return{...e,dimensions:a,viewport:o,current:m};const y=a.draggables[e.critical.draggable.id],v=s||Uq({pageOffset:h.offset,draggable:y,draggables:a.draggables,droppables:a.droppables,previousImpact:e.impact,viewport:o,afterCritical:e.afterCritical}),x=uNe({draggable:y,impact:v,previousImpact:e.impact,draggables:a.draggables,droppables:a.droppables});return{...e,current:m,dimensions:{draggables:a.draggables,droppables:x},impact:v,viewport:o,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function dNe(e,t){return e.map(n=>t[n])}var qq=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:s})=>{const i=e.displaced,o=dNe(i.all,n),a=qg({afterDragging:o,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:s,last:i});return{...e,displaced:a}},Hq=({impact:e,draggable:t,droppable:n,draggables:r,viewport:s,afterCritical:i})=>{const o=q1({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return NT({pageBorderBoxCenter:o,draggable:t,viewport:s})},Wq=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&Le();const r=e.impact,s=n||e.viewport,i=t||e.dimensions,{draggables:o,droppables:a}=i,c=o[e.critical.draggable.id],u=Es(r);u||Le();const f=a[u],h=qq({impact:r,viewport:s,destination:f,draggables:o}),m=Hq({impact:h,draggable:c,droppable:f,draggables:o,viewport:s,afterCritical:e.afterCritical});return sg({impact:h,clientSelection:m,state:e,dimensions:i,viewport:s})},fNe=e=>({index:e.index,droppableId:e.droppableId}),Gq=({draggable:e,home:t,draggables:n,viewport:r})=>{const s=Xy(t.axis,e.displaceBy),i=mp(t.descriptor.id,n),o=i.indexOf(e);o===-1&&Le();const a=i.slice(o+1),c=a.reduce((m,y)=>(m[y.descriptor.id]=!0,m),{}),u={inVirtualList:t.descriptor.mode==="virtual",displacedBy:s,effected:c};return{impact:{displaced:qg({afterDragging:a,destination:t,displacedBy:s,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:s,at:{type:"REORDER",destination:fNe(e.descriptor)}},afterCritical:u}},hNe=(e,t)=>({draggables:e.draggables,droppables:_T(e.droppables,t)}),pNe=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=kx(e.client,t),s=Ix(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:s}},mNe=e=>{const t=e.frame;return t||Le(),t},gNe=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(s=>{const i=s.descriptor.droppableId,o=t[i],c=mNe(o).scroll.diff.value,u=hr(r,c);return pNe({draggable:s,offset:u,initialWindowScroll:n.scroll.initial})})},yNe=({state:e,published:t})=>{const n=t.modified.map(N=>{const _=e.dimensions.droppables[N.droppableId];return vT(_,N.scroll)}),r={...e.dimensions.droppables,...Aq(n)},s=$q(gNe({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...s};t.removals.forEach(N=>{delete i[N]});const o={droppables:r,draggables:i},a=Es(e.impact),c=a?o.droppables[a]:null,u=o.draggables[e.critical.draggable.id],f=o.droppables[e.critical.droppable.id],{impact:h,afterCritical:m}=Gq({draggable:u,home:f,draggables:i,viewport:e.viewport}),y=c&&c.isCombineEnabled?e.impact:h,v=Uq({pageOffset:e.current.page.offset,draggable:o.draggables[e.critical.draggable.id],draggables:o.draggables,droppables:o.droppables,previousImpact:y,viewport:e.viewport,afterCritical:m}),x={...e,phase:"DRAGGING",impact:v,onLiftImpact:h,dimensions:o,afterCritical:m,forceShouldAnimate:!1};return e.phase==="COLLECTING"?x:{...x,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const $O=e=>e.movementMode==="SNAP",e_=(e,t,n)=>{const r=hNe(e.dimensions,t);return!$O(e)||n?sg({state:e,dimensions:r}):Wq({state:e,dimensions:r})};function t_(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const CD={phase:"IDLE",completed:null,shouldFlush:!1};var bNe=(e=CD,t)=>{if(t.type==="FLUSH")return{...CD,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Le();const{critical:n,clientSelection:r,viewport:s,dimensions:i,movementMode:o}=t.payload,a=i.draggables[n.draggable.id],c=i.droppables[n.droppable.id],u={selection:r,borderBoxCenter:a.client.borderBox.center,offset:or},f={client:u,page:{selection:hr(u.selection,s.scroll.initial),borderBoxCenter:hr(u.selection,s.scroll.initial),offset:hr(u.selection,s.scroll.diff.value)}},h=z1(i.droppables).every(x=>!x.isFixedOnPage),{impact:m,afterCritical:y}=Gq({draggable:a,home:c,draggables:i.draggables,viewport:s});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:o,dimensions:i,initial:f,current:f,isWindowScrollAllowed:h,impact:m,afterCritical:y,onLiftImpact:m,viewport:s,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&Le(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Le(),yNe({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;wu(e)||Le();const{client:n}=t.payload;return mc(n,e.current.client.selection)?e:sg({state:e,clientSelection:n,impact:$O(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return t_(e);wu(e)||Le();const{id:n,newScroll:r}=t.payload,s=e.dimensions.droppables[n];if(!s)return e;const i=vT(s,r);return e_(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;wu(e)||Le();const{id:n,isEnabled:r}=t.payload,s=e.dimensions.droppables[n];s||Le(),s.isEnabled===r&&Le();const i={...s,isEnabled:r};return e_(e,i,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;wu(e)||Le();const{id:n,isCombineEnabled:r}=t.payload,s=e.dimensions.droppables[n];s||Le(),s.isCombineEnabled===r&&Le();const i={...s,isCombineEnabled:r};return e_(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;wu(e)||Le(),e.isWindowScrollAllowed||Le();const n=t.payload.newScroll;if(mc(e.viewport.scroll.current,n))return t_(e);const r=Dq(e.viewport,n);return $O(e)?Wq({state:e,viewport:r}):sg({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!wu(e))return e;const n=t.payload.maxScroll;if(mc(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&Le();const n=eNe({state:e,type:t.type});return n?sg({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&Le(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:s}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||Le(),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:s,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function Ht(e,t){return e instanceof Object&&"type"in e&&e.type===t}const vNe=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),xNe=e=>({type:"LIFT",payload:e}),wNe=e=>({type:"INITIAL_PUBLISH",payload:e}),SNe=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),ENe=()=>({type:"COLLECTION_STARTING",payload:null}),NNe=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),_Ne=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),CNe=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),Yq=e=>({type:"MOVE",payload:e}),ONe=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),jNe=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),ANe=()=>({type:"MOVE_UP",payload:null}),$Ne=()=>({type:"MOVE_DOWN",payload:null}),TNe=()=>({type:"MOVE_RIGHT",payload:null}),RNe=()=>({type:"MOVE_LEFT",payload:null}),CT=()=>({type:"FLUSH",payload:null}),MNe=e=>({type:"DROP_ANIMATE",payload:e}),OT=e=>({type:"DROP_COMPLETE",payload:e}),Jq=e=>({type:"DROP",payload:e}),kNe=e=>({type:"DROP_PENDING",payload:e}),Xq=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var INe=e=>({getState:t,dispatch:n})=>r=>s=>{if(!Ht(s,"LIFT")){r(s);return}const{id:i,clientSelection:o,movementMode:a}=s.payload,c=t();c.phase==="DROP_ANIMATING"&&n(OT({completed:c.completed})),t().phase!=="IDLE"&&Le(),n(CT()),n(vNe({draggableId:i,movementMode:a}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:h,dimensions:m,viewport:y}=e.startPublishing(f);n(wNe({critical:h,dimensions:m,clientSelection:o,movementMode:a,viewport:y}))},DNe=e=>()=>t=>n=>{Ht(n,"INITIAL_PUBLISH")&&e.dragging(),Ht(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(Ht(n,"FLUSH")||Ht(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const jT={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Hg={opacity:{drop:0,combining:.7},scale:{drop:.75}},Kq={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},pu=`${Kq.outOfTheWay}s ${jT.outOfTheWay}`,ig={fluid:`opacity ${pu}`,snap:`transform ${pu}, opacity ${pu}`,drop:e=>{const t=`${e}s ${jT.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${pu}`,placeholder:`height ${pu}, width ${pu}, margin ${pu}`},OD=e=>mc(e,or)?void 0:`translate(${e.x}px, ${e.y}px)`,TO={moveTo:OD,drop:(e,t)=>{const n=OD(e);if(n)return t?`${n} scale(${Hg.scale.drop})`:n}},{minDropTime:RO,maxDropTime:Qq}=Kq,PNe=Qq-RO,jD=1500,LNe=.6;var FNe=({current:e,destination:t,reason:n})=>{const r=Vg(e,t);if(r<=0)return RO;if(r>=jD)return Qq;const s=r/jD,i=RO+PNe*s,o=n==="CANCEL"?i*LNe:i;return Number(o.toFixed(2))},BNe=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:s})=>{const{draggables:i,droppables:o}=n,a=Es(e),c=a?o[a]:null,u=o[t.descriptor.droppableId],f=Hq({impact:e,draggable:t,draggables:i,afterCritical:s,droppable:c||u,viewport:r});return ws(f,t.client.borderBox.center)},zNe=({draggables:e,reason:t,lastImpact:n,home:r,viewport:s,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:qq({draggables:e,impact:i,destination:r,viewport:s,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Ug},didDropInsideDroppable:!0};const VNe=({getState:e,dispatch:t})=>n=>r=>{if(!Ht(r,"DROP")){n(r);return}const s=e(),i=r.payload.reason;if(s.phase==="COLLECTING"){t(kNe({reason:i}));return}if(s.phase==="IDLE")return;s.phase==="DROP_PENDING"&&s.isWaiting&&Le(),s.phase==="DRAGGING"||s.phase==="DROP_PENDING"||Le();const a=s.critical,c=s.dimensions,u=c.draggables[s.critical.draggable.id],{impact:f,didDropInsideDroppable:h}=zNe({reason:i,lastImpact:s.impact,afterCritical:s.afterCritical,onLiftImpact:s.onLiftImpact,home:s.dimensions.droppables[s.critical.droppable.id],viewport:s.viewport,draggables:s.dimensions.draggables}),m=h?xT(f):null,y=h?V1(f):null,v={index:a.draggable.index,droppableId:a.droppable.id},x={draggableId:u.descriptor.id,type:u.descriptor.type,source:v,reason:i,mode:s.movementMode,destination:m,combine:y},E=BNe({impact:f,draggable:u,dimensions:c,viewport:s.viewport,afterCritical:s.afterCritical}),N={critical:s.critical,afterCritical:s.afterCritical,result:x,impact:f};if(!(!mc(s.current.client.offset,E)||!!x.combine)){t(OT({completed:N}));return}const C=FNe({current:s.current.client.offset,destination:E,reason:i});t(MNe({newHomeClientOffset:E,dropDuration:C,completed:N}))};var Zq=()=>({x:window.pageXOffset,y:window.pageYOffset});function UNe(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function qNe({onWindowScroll:e}){function t(){e(Zq())}const n=zg(t),r=UNe(n);let s=pc;function i(){return s!==pc}function o(){i()&&Le(),s=ei(window,[r])}function a(){i()||Le(),n.cancel(),s(),s=pc}return{start:o,stop:a,isActive:i}}const HNe=e=>Ht(e,"DROP_COMPLETE")||Ht(e,"DROP_ANIMATE")||Ht(e,"FLUSH"),WNe=e=>{const t=qNe({onWindowScroll:n=>{e.dispatch(ONe({newScroll:n}))}});return n=>r=>{!t.isActive()&&Ht(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&HNe(r)&&t.stop(),n(r)}};var GNe=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),s=i=>{t||n||(t=!0,e(i),clearTimeout(r))};return s.wasCalled=()=>t,s},YNe=()=>{const e=[],t=s=>{const i=e.findIndex(a=>a.timerId===s);i===-1&&Le();const[o]=e.splice(i,1);o.callback()};return{add:s=>{const i=setTimeout(()=>t(i)),o={timerId:i,callback:s};e.push(o)},flush:()=>{if(!e.length)return;const s=[...e];e.length=0,s.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const JNe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,XNe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,KNe=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},jm=(e,t)=>{t()},Vb=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function n_(e,t,n,r){if(!e){n(r(t));return}const s=GNe(n);e(t,{announce:s}),s.wasCalled()||n(r(t))}var QNe=(e,t)=>{const n=YNe();let r=null;const s=(h,m)=>{r&&Le(),jm("onBeforeCapture",()=>{const y=e().onBeforeCapture;y&&y({draggableId:h,mode:m})})},i=(h,m)=>{r&&Le(),jm("onBeforeDragStart",()=>{const y=e().onBeforeDragStart;y&&y(Vb(h,m))})},o=(h,m)=>{r&&Le();const y=Vb(h,m);r={mode:m,lastCritical:h,lastLocation:y.source,lastCombine:null},n.add(()=>{jm("onDragStart",()=>n_(e().onDragStart,y,t,Ov.onDragStart))})},a=(h,m)=>{const y=xT(m),v=V1(m);r||Le();const x=!KNe(h,r.lastCritical);x&&(r.lastCritical=h);const E=!JNe(r.lastLocation,y);E&&(r.lastLocation=y);const N=!XNe(r.lastCombine,v);if(N&&(r.lastCombine=v),!x&&!E&&!N)return;const _={...Vb(h,r.mode),combine:v,destination:y};n.add(()=>{jm("onDragUpdate",()=>n_(e().onDragUpdate,_,t,Ov.onDragUpdate))})},c=()=>{r||Le(),n.flush()},u=h=>{r||Le(),r=null,jm("onDragEnd",()=>n_(e().onDragEnd,h,t,Ov.onDragEnd))};return{beforeCapture:s,beforeStart:i,start:o,update:a,flush:c,drop:u,abort:()=>{if(!r)return;const h={...Vb(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};u(h)}}},ZNe=(e,t)=>{const n=QNe(e,t);return r=>s=>i=>{if(Ht(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Ht(i,"INITIAL_PUBLISH")){const a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),s(i),n.start(a,i.payload.movementMode);return}if(Ht(i,"DROP_COMPLETE")){const a=i.payload.completed.result;n.flush(),s(i),n.drop(a);return}if(s(i),Ht(i,"FLUSH")){n.abort();return}const o=r.getState();o.phase==="DRAGGING"&&n.update(o.critical,o.impact)}};const e_e=e=>t=>n=>{if(!Ht(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&Le(),e.dispatch(OT({completed:r.completed}))},t_e=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return s=>i=>{if((Ht(i,"FLUSH")||Ht(i,"DROP_COMPLETE")||Ht(i,"DROP_ANIMATION_FINISHED"))&&r(),s(i),!Ht(i,"DROP_ANIMATE"))return;const o={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Xq())}};n=requestAnimationFrame(()=>{n=null,t=ei(window,[o])})}};var n_e=e=>()=>t=>n=>{(Ht(n,"DROP_COMPLETE")||Ht(n,"FLUSH")||Ht(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},r_e=e=>{let t=!1;return()=>n=>r=>{if(Ht(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(Ht(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Ht(r,"DROP_COMPLETE")){t=!1;const s=r.payload.completed.result;s.combine&&e.tryShiftRecord(s.draggableId,s.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const s_e=e=>Ht(e,"DROP_COMPLETE")||Ht(e,"DROP_ANIMATE")||Ht(e,"FLUSH");var i_e=e=>t=>n=>r=>{if(s_e(r)){e.stop(),n(r);return}if(Ht(r,"INITIAL_PUBLISH")){n(r);const s=t.getState();s.phase!=="DRAGGING"&&Le(),e.start(s);return}n(r),e.scroll(t.getState())};const o_e=e=>t=>n=>{if(t(n),!Ht(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(Jq({reason:r.reason})))},a_e=mq;var l_e=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:s,autoScroller:i})=>pq(bNe,a_e(aEe(DNe(n),n_e(e),INe(e),VNe,e_e,t_e,o_e,i_e(i),WNe,r_e(t),ZNe(r,s))));const r_=()=>({additions:{},removals:{},modified:{}});function c_e({registry:e,callbacks:t}){let n=r_(),r=null;const s=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null;const{additions:c,removals:u,modified:f}=n,h=Object.keys(c).map(v=>e.draggable.getById(v).getDimension(or)).sort((v,x)=>v.descriptor.index-x.descriptor.index),m=Object.keys(f).map(v=>{const E=e.droppable.getById(v).callbacks.getScrollWhileDragging();return{droppableId:v,scroll:E}}),y={additions:h,removals:Object.keys(u),modified:m};n=r_(),t.publish(y)}))};return{add:c=>{const u=c.descriptor.id;n.additions[u]=c,n.modified[c.descriptor.droppableId]=!0,n.removals[u]&&delete n.removals[u],s()},remove:c=>{const u=c.descriptor;n.removals[u.id]=!0,n.modified[u.droppableId]=!0,n.additions[u.id]&&delete n.additions[u.id],s()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=r_())}}}var eH=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const s=ws({x:t,y:e},{x:r,y:n});return{x:Math.max(0,s.x),y:Math.max(0,s.y)}},tH=()=>{const e=document.documentElement;return e||Le(),e},nH=()=>{const e=tH();return eH({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},u_e=()=>{const e=Zq(),t=nH(),n=e.y,r=e.x,s=tH(),i=s.clientWidth,o=s.clientHeight,a=r+i,c=n+o;return{frame:Bi({top:n,left:r,right:a,bottom:c}),scroll:{initial:e,current:e,max:t,diff:{value:or,displacement:or}}}},d_e=({critical:e,scrollOptions:t,registry:n})=>{const r=u_e(),s=r.scroll.current,i=e.droppable,o=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(s,t)),a=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(s));return{dimensions:{draggables:$q(a),droppables:Aq(o)},critical:e,viewport:r}};function AD(e,t,n){return!(n.descriptor.id===t.id||n.descriptor.type!==t.type||e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var f_e=(e,t)=>{let n=null;const r=c_e({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),s=(m,y)=>{e.droppable.exists(m)||Le(),n&&t.updateDroppableIsEnabled({id:m,isEnabled:y})},i=(m,y)=>{n&&(e.droppable.exists(m)||Le(),t.updateDroppableIsCombineEnabled({id:m,isCombineEnabled:y}))},o=(m,y)=>{n&&(e.droppable.exists(m)||Le(),t.updateDroppableScroll({id:m,newScroll:y}))},a=(m,y)=>{n&&e.droppable.getById(m).callbacks.scroll(y)},c=()=>{if(!n)return;r.stop();const m=n.critical.droppable;e.droppable.getAllByType(m.type).forEach(y=>y.callbacks.dragStopped()),n.unsubscribe(),n=null},u=m=>{n||Le();const y=n.critical.draggable;m.type==="ADDITION"&&AD(e,y,m.value)&&r.add(m.value),m.type==="REMOVAL"&&AD(e,y,m.value)&&r.remove(m.value)};return{updateDroppableIsEnabled:s,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:o,startPublishing:m=>{n&&Le();const y=e.draggable.getById(m.draggableId),v=e.droppable.getById(y.descriptor.droppableId),x={draggable:y.descriptor,droppable:v.descriptor},E=e.subscribe(u);return n={critical:x,unsubscribe:E},d_e({critical:x,registry:e,scrollOptions:m.scrollOptions})},stopPublishing:c}},rH=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",h_e=e=>{window.scrollBy(e.x,e.y)};const p_e=sr(e=>z1(e).filter(t=>!(!t.isEnabled||!t.frame))),m_e=(e,t)=>p_e(t).find(r=>(r.frame||Le(),Bq(r.frame.pageMarginBox)(e)))||null;var g_e=({center:e,destination:t,droppables:n})=>{if(t){const s=n[t];return s.frame?s:null}return m_e(e,n)};const Wg={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var y_e=(e,t,n=()=>Wg)=>{const r=n(),s=e[t.size]*r.startFromPercentage,i=e[t.size]*r.maxScrollAtPercentage;return{startScrollingFrom:s,maxScrollValueAt:i}},sH=({startOfRange:e,endOfRange:t,current:n})=>{const r=t-e;return r===0?0:(n-e)/r},AT=1,b_e=(e,t,n=()=>Wg)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return AT;const i=1-sH({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),o=r.maxPixelScroll*r.ease(i);return Math.ceil(o)},v_e=(e,t,n)=>{const r=n(),s=r.durationDampening.accelerateAt,i=r.durationDampening.stopDampeningAt,o=t,a=i,u=Date.now()-o;if(u>=i)return e;if(u<s)return AT;const f=sH({startOfRange:s,endOfRange:a,current:u}),h=e*r.ease(f);return Math.ceil(h)},$D=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:s})=>{const i=b_e(e,t,s);return i===0?0:r?Math.max(v_e(i,n,s),AT):i},TD=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const o=y_e(e,r,i);return t[r.end]<t[r.start]?$D({distanceToEdge:t[r.end],thresholds:o,dragStartTime:n,shouldUseTimeDampening:s,getAutoScrollerOptions:i}):-1*$D({distanceToEdge:t[r.start],thresholds:o,dragStartTime:n,shouldUseTimeDampening:s,getAutoScrollerOptions:i})},x_e=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,s=t.width>e.width;return!s&&!r?n:s&&r?null:{x:s?0:n.x,y:r?0:n.y}};const w_e=jq(e=>e===0?0:e);var iH=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const o={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},a=TD({container:t,distanceToEdges:o,dragStartTime:e,axis:wT,shouldUseTimeDampening:s,getAutoScrollerOptions:i}),c=TD({container:t,distanceToEdges:o,dragStartTime:e,axis:Mq,shouldUseTimeDampening:s,getAutoScrollerOptions:i}),u=w_e({x:c,y:a});if(mc(u,or))return null;const f=x_e({container:t,subject:n,proposedScroll:u});return f?mc(f,or)?null:f:null};const S_e=jq(e=>e===0?0:e>0?1:-1),$T=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const s=hr(t,r),i={x:e(s.x,n.x),y:e(s.y,n.y)};return mc(i,or)?null:i}})(),oH=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},s=S_e(n),i=$T({max:r,current:t,change:s});return!i||s.x!==0&&i.x===0||s.y!==0&&i.y===0},TT=(e,t)=>oH({current:e.scroll.current,max:e.scroll.max,change:t}),E_e=(e,t)=>{if(!TT(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return $T({current:r,max:n,change:t})},RT=(e,t)=>{const n=e.frame;return n?oH({current:n.scroll.current,max:n.scroll.max,change:t}):!1},N_e=(e,t)=>{const n=e.frame;return!n||!RT(e,t)?null:$T({current:n.scroll.current,max:n.scroll.max,change:t})};var __e=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const o=iH({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:s,getAutoScrollerOptions:i});return o&&TT(e,o)?o:null},C_e=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const o=e.frame;if(!o)return null;const a=iH({dragStartTime:r,container:o.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:s,getAutoScrollerOptions:i});return a&&RT(e,a)?a:null},RD=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:s,getAutoScrollerOptions:i})=>{const o=e.current.page.borderBoxCenter,c=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const h=e.viewport,m=__e({dragStartTime:t,viewport:h,subject:c,center:o,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(m){r(m);return}}const u=g_e({center:o,destination:Es(e.impact),droppables:e.dimensions.droppables});if(!u)return;const f=C_e({dragStartTime:t,droppable:u,subject:c,center:o,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&s(u.descriptor.id,f)},O_e=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>Wg})=>{const r=zg(e),s=zg(t);let i=null;const o=u=>{i||Le();const{shouldUseTimeDampening:f,dragStartTime:h}=i;RD({state:u,scrollWindow:r,scrollDroppable:s,dragStartTime:h,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:u=>{i&&Le();const f=Date.now();let h=!1;const m=()=>{h=!0};RD({state:u,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:m,scrollDroppable:m,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:h},h&&o(u)},stop:()=>{i&&(r.cancel(),s.cancel(),i=null)},scroll:o}},j_e=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(a,c)=>{const u=hr(a.current.client.selection,c);e({client:u})},s=(a,c)=>{if(!RT(a,c))return c;const u=N_e(a,c);if(!u)return t(a.descriptor.id,c),null;const f=ws(c,u);return t(a.descriptor.id,f),ws(c,f)},i=(a,c,u)=>{if(!a||!TT(c,u))return u;const f=E_e(c,u);if(!f)return n(u),null;const h=ws(u,f);return n(h),ws(u,h)};return a=>{const c=a.scrollJumpRequest;if(!c)return;const u=Es(a.impact);u||Le();const f=s(a.dimensions.droppables[u],c);if(!f)return;const h=a.viewport,m=i(a.isWindowScrollAllowed,h,f);m&&r(a,m)}},A_e=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const s=O_e({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),i=j_e({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:c=>{if(!(r().disabled||c.phase!=="DRAGGING")){if(c.movementMode==="FLUID"){s.scroll(c);return}c.scrollJumpRequest&&i(c)}},start:s.start,stop:s.stop}};const Mh="data-rfd",kh=(()=>{const e=`${Mh}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),MO=(()=>{const e=`${Mh}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),$_e=(()=>{const e=`${Mh}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),MD={contextId:`${Mh}-scroll-container-context-id`},T_e=e=>t=>`[${t}="${e}"]`,Am=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),R_e="pointer-events: none;";var M_e=e=>{const t=T_e(e),n=(()=>{const a=`
      cursor: -webkit-grab;
      cursor: grab;
    `;return{selector:t(kh.contextId),styles:{always:`
          -webkit-touch-callout: none;
          -webkit-tap-highlight-color: rgba(0,0,0,0);
          touch-action: manipulation;
        `,resting:a,dragging:R_e,dropAnimating:a}}})(),r=(()=>{const a=`
      transition: ${ig.outOfTheWay};
    `;return{selector:t(MO.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),s={selector:t($_e.contextId),styles:{always:"overflow-anchor: none;"}},o=[r,n,s,{selector:"body",styles:{dragging:`
        cursor: grabbing;
        cursor: -webkit-grabbing;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        overflow-anchor: none;
      `}}];return{always:Am(o,"always"),resting:Am(o,"resting"),dragging:Am(o,"dragging"),dropAnimating:Am(o,"dropAnimating"),userCancel:Am(o,"userCancel")}};const Ns=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,s_=()=>{const e=document.querySelector("head");return e||Le(),e},kD=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function k_e(e,t){const n=Ot(()=>M_e(e),[e]),r=w.useRef(null),s=w.useRef(null),i=tt(sr(h=>{const m=s.current;m||Le(),m.textContent=h}),[]),o=tt(h=>{const m=r.current;m||Le(),m.textContent=h},[]);Ns(()=>{!r.current&&!s.current||Le();const h=kD(t),m=kD(t);return r.current=h,s.current=m,h.setAttribute(`${Mh}-always`,e),m.setAttribute(`${Mh}-dynamic`,e),s_().appendChild(h),s_().appendChild(m),o(n.always),i(n.resting),()=>{const y=v=>{const x=v.current;x||Le(),s_().removeChild(x),v.current=null};y(r),y(s)}},[t,o,i,n.always,n.resting,e]);const a=tt(()=>i(n.dragging),[i,n.dragging]),c=tt(h=>{if(h==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),u=tt(()=>{s.current&&i(n.resting)},[i,n.resting]);return Ot(()=>({dragging:a,dropping:c,resting:u}),[a,c,u])}function aH(e,t){return Array.from(e.querySelectorAll(t))}var lH=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function H1(e){return e instanceof lH(e).HTMLElement}function I_e(e,t){const n=`[${kh.contextId}="${e}"]`,r=aH(document,n);if(!r.length)return null;const s=r.find(i=>i.getAttribute(kh.draggableId)===t);return!s||!H1(s)?null:s}function D_e(e){const t=w.useRef({}),n=w.useRef(null),r=w.useRef(null),s=w.useRef(!1),i=tt(function(m,y){const v={id:m,focus:y};return t.current[m]=v,function(){const E=t.current;E[m]!==v&&delete E[m]}},[]),o=tt(function(m){const y=I_e(e,m);y&&y!==document.activeElement&&y.focus()},[e]),a=tt(function(m,y){n.current===m&&(n.current=y)},[]),c=tt(function(){r.current||s.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const m=n.current;m&&o(m)}))},[o]),u=tt(function(m){n.current=null;const y=document.activeElement;y&&y.getAttribute(kh.draggableId)===m&&(n.current=m)},[]);return Ns(()=>(s.current=!0,function(){s.current=!1;const m=r.current;m&&cancelAnimationFrame(m)}),[]),Ot(()=>({register:i,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:a}),[i,u,c,a])}function P_e(){const e={draggables:{},droppables:{}},t=[];function n(h){return t.push(h),function(){const y=t.indexOf(h);y!==-1&&t.splice(y,1)}}function r(h){t.length&&t.forEach(m=>m(h))}function s(h){return e.draggables[h]||null}function i(h){const m=s(h);return m||Le(),m}const o={register:h=>{e.draggables[h.descriptor.id]=h,r({type:"ADDITION",value:h})},update:(h,m)=>{const y=e.draggables[m.descriptor.id];y&&y.uniqueId===h.uniqueId&&(delete e.draggables[m.descriptor.id],e.draggables[h.descriptor.id]=h)},unregister:h=>{const m=h.descriptor.id,y=s(m);y&&h.uniqueId===y.uniqueId&&(delete e.draggables[m],e.droppables[h.descriptor.droppableId]&&r({type:"REMOVAL",value:h}))},getById:i,findById:s,exists:h=>!!s(h),getAllByType:h=>Object.values(e.draggables).filter(m=>m.descriptor.type===h)};function a(h){return e.droppables[h]||null}function c(h){const m=a(h);return m||Le(),m}const u={register:h=>{e.droppables[h.descriptor.id]=h},unregister:h=>{const m=a(h.descriptor.id);m&&h.uniqueId===m.uniqueId&&delete e.droppables[h.descriptor.id]},getById:c,findById:a,exists:h=>!!a(h),getAllByType:h=>Object.values(e.droppables).filter(m=>m.descriptor.type===h)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:o,droppable:u,subscribe:n,clean:f}}function L_e(){const e=Ot(P_e,[]);return w.useEffect(()=>function(){e.clean()},[e]),e}var MT=Re.createContext(null),Fx=()=>{const e=document.body;return e||Le(),e};const F_e={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},B_e=e=>`rfd-announcement-${e}`;function z_e(e){const t=Ot(()=>B_e(e),[e]),n=w.useRef(null);return w.useEffect(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),vh(i.style,F_e),Fx().appendChild(i),function(){setTimeout(function(){const c=Fx();c.contains(i)&&c.removeChild(i),i===n.current&&(n.current=null)})}},[t]),tt(s=>{const i=n.current;if(i){i.textContent=s;return}},[])}const V_e={separator:"::"};function kT(e,t=V_e){const n=Re.useId();return Ot(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function U_e({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function q_e({contextId:e,text:t}){const n=kT("hidden-text",{separator:"-"}),r=Ot(()=>U_e({contextId:e,uniqueId:n}),[n,e]);return w.useEffect(function(){const i=document.createElement("div");return i.id=r,i.textContent=t,i.style.display="none",Fx().appendChild(i),function(){const a=Fx();a.contains(i)&&a.removeChild(i)}},[r,t]),r}var W1=Re.createContext(null);function cH(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),t}function H_e(){let e=null;function t(){return!!e}function n(o){return o===e}function r(o){e&&Le();const a={abandon:o};return e=a,a}function s(){e||Le(),e=null}function i(){e&&(e.abandon(),s())}return{isClaimed:t,isActive:n,claim:r,release:s,tryAbandon:i}}function Gg(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const W_e=9,G_e=13,IT=27,uH=32,Y_e=33,J_e=34,X_e=35,K_e=36,Q_e=37,Z_e=38,eCe=39,tCe=40,nCe={[G_e]:!0,[W_e]:!0};var dH=e=>{nCe[e.keyCode]&&e.preventDefault()};const G1=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),fH=0,ID=5;function rCe(e,t){return Math.abs(t.x-e.x)>=ID||Math.abs(t.y-e.y)>=ID}const DD={type:"IDLE"};function sCe({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:s=>{const{button:i,clientX:o,clientY:a}=s;if(i!==fH)return;const c={x:o,y:a},u=n();if(u.type==="DRAGGING"){s.preventDefault(),u.actions.move(c);return}u.type!=="PENDING"&&Le();const f=u.point;if(!rCe(f,c))return;s.preventDefault();const h=u.actions.fluidLift(c);r({type:"DRAGGING",actions:h})}},{eventName:"mouseup",fn:s=>{const i=n();if(i.type!=="DRAGGING"){e();return}s.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:s=>{n().type==="DRAGGING"&&s.preventDefault(),e()}},{eventName:"keydown",fn:s=>{if(n().type==="PENDING"){e();return}if(s.keyCode===IT){s.preventDefault(),e();return}dH(s)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:s=>{const i=n();if(i.type==="IDLE"&&Le(),i.actions.shouldRespectForcePress()){e();return}s.preventDefault()}},{eventName:G1,fn:e}]}function iCe(e){const t=w.useRef(DD),n=w.useRef(pc),r=Ot(()=>({eventName:"mousedown",fn:function(h){if(h.defaultPrevented||h.button!==fH||h.ctrlKey||h.metaKey||h.shiftKey||h.altKey)return;const m=e.findClosestDraggableId(h);if(!m)return;const y=e.tryGetLock(m,o,{sourceEvent:h});if(!y)return;h.preventDefault();const v={x:h.clientX,y:h.clientY};n.current(),u(y,v)}}),[e]),s=Ot(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const h=e.findClosestDraggableId(f);if(!h)return;const m=e.findOptionsForDraggable(h);m&&(m.shouldRespectForcePress||e.canGetLock(h)&&f.preventDefault())}}),[e]),i=tt(function(){const h={passive:!1,capture:!0};n.current=ei(window,[s,r],h)},[s,r]),o=tt(()=>{t.current.type!=="IDLE"&&(t.current=DD,n.current(),i())},[i]),a=tt(()=>{const f=t.current;o(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[o]),c=tt(function(){const h={capture:!0,passive:!1},m=sCe({cancel:a,completed:o,getPhase:()=>t.current,setPhase:y=>{t.current=y}});n.current=ei(window,m,h)},[a,o]),u=tt(function(h,m){t.current.type!=="IDLE"&&Le(),t.current={type:"PENDING",point:m,actions:h},c()},[c]);Ns(function(){return i(),function(){n.current()}},[i])}function oCe(){}const aCe={[J_e]:!0,[Y_e]:!0,[K_e]:!0,[X_e]:!0};function lCe(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:s=>{if(s.keyCode===IT){s.preventDefault(),n();return}if(s.keyCode===uH){s.preventDefault(),r();return}if(s.keyCode===tCe){s.preventDefault(),e.moveDown();return}if(s.keyCode===Z_e){s.preventDefault(),e.moveUp();return}if(s.keyCode===eCe){s.preventDefault(),e.moveRight();return}if(s.keyCode===Q_e){s.preventDefault(),e.moveLeft();return}if(aCe[s.keyCode]){s.preventDefault();return}dH(s)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:G1,fn:n}]}function cCe(e){const t=w.useRef(oCe),n=Ot(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==uH)return;const o=e.findClosestDraggableId(i);if(!o)return;const a=e.tryGetLock(o,f,{sourceEvent:i});if(!a)return;i.preventDefault();let c=!0;const u=a.snapLift();t.current();function f(){c||Le(),c=!1,t.current(),r()}t.current=ei(window,lCe(u,f),{capture:!0,passive:!1})}}),[e]),r=tt(function(){const i={passive:!1,capture:!0};t.current=ei(window,[n],i)},[n]);Ns(function(){return r(),function(){t.current()}},[r])}const i_={type:"IDLE"},uCe=120,dCe=.15;function fCe({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===IT&&n.preventDefault(),e()}},{eventName:G1,fn:e}]}function hCe({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const s=n();if(s.type!=="DRAGGING"){e();return}s.hasMoved=!0;const{clientX:i,clientY:o}=r.touches[0],a={x:i,y:o};r.preventDefault(),s.actions.move(a)}},{eventName:"touchend",fn:r=>{const s=n();if(s.type!=="DRAGGING"){e();return}r.preventDefault(),s.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const s=n();s.type==="IDLE"&&Le();const i=r.touches[0];if(!i||!(i.force>=dCe))return;const a=s.actions.shouldRespectForcePress();if(s.type==="PENDING"){a&&e();return}if(a){if(s.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:G1,fn:e}]}function pCe(e){const t=w.useRef(i_),n=w.useRef(pc),r=tt(function(){return t.current},[]),s=tt(function(y){t.current=y},[]),i=Ot(()=>({eventName:"touchstart",fn:function(y){if(y.defaultPrevented)return;const v=e.findClosestDraggableId(y);if(!v)return;const x=e.tryGetLock(v,a,{sourceEvent:y});if(!x)return;const E=y.touches[0],{clientX:N,clientY:_}=E,C={x:N,y:_};n.current(),h(x,C)}}),[e]),o=tt(function(){const y={capture:!0,passive:!1};n.current=ei(window,[i],y)},[i]),a=tt(()=>{const m=t.current;m.type!=="IDLE"&&(m.type==="PENDING"&&clearTimeout(m.longPressTimerId),s(i_),n.current(),o())},[o,s]),c=tt(()=>{const m=t.current;a(),m.type==="DRAGGING"&&m.actions.cancel({shouldBlockNextClick:!0}),m.type==="PENDING"&&m.actions.abort()},[a]),u=tt(function(){const y={capture:!0,passive:!1},v={cancel:c,completed:a,getPhase:r},x=ei(window,hCe(v),y),E=ei(window,fCe(v),y);n.current=function(){x(),E()}},[c,r,a]),f=tt(function(){const y=r();y.type!=="PENDING"&&Le();const v=y.actions.fluidLift(y.point);s({type:"DRAGGING",actions:v,hasMoved:!1})},[r,s]),h=tt(function(y,v){r().type!=="IDLE"&&Le();const x=setTimeout(f,uCe);s({type:"PENDING",point:v,actions:y,longPressTimerId:x}),u()},[u,r,s,f]);Ns(function(){return o(),function(){n.current();const v=r();v.type==="PENDING"&&(clearTimeout(v.longPressTimerId),s(i_))}},[r,o,s]),Ns(function(){return ei(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const mCe=["input","button","textarea","select","option","optgroup","video","audio"];function hH(e,t){if(t==null)return!1;if(mCe.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:hH(e,t.parentElement)}function gCe(e,t){const n=t.target;return H1(n)?hH(e,n):!1}var yCe=e=>Bi(e.getBoundingClientRect()).center;function bCe(e){return e instanceof lH(e).Element}const vCe=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function pH(e,t){return e==null?null:e[vCe](t)?e:pH(e.parentElement,t)}function xCe(e,t){return e.closest?e.closest(t):pH(e,t)}function wCe(e){return`[${kh.contextId}="${e}"]`}function SCe(e,t){const n=t.target;if(!bCe(n))return null;const r=wCe(e),s=xCe(n,r);return!s||!H1(s)?null:s}function ECe(e,t){const n=SCe(e,t);return n?n.getAttribute(kh.draggableId):null}function NCe(e,t){const n=`[${MO.contextId}="${e}"]`,s=aH(document,n).find(i=>i.getAttribute(MO.id)===t);return!s||!H1(s)?null:s}function _Ce(e){e.preventDefault()}function Ub({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return!(!n()||e!==t)}function mH({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const s=n.draggable.findById(r);return!(!s||!s.options.isEnabled||!rH(t.getState(),r))}function CCe({lockAPI:e,contextId:t,store:n,registry:r,draggableId:s,forceSensorStop:i,sourceEvent:o}){if(!mH({lockAPI:e,store:n,registry:r,draggableId:s}))return null;const c=r.draggable.getById(s),u=NCe(t,c.descriptor.id);if(!u||o&&!c.options.canDragInteractiveElements&&gCe(u,o))return null;const f=e.claim(i||pc);let h="PRE_DRAG";function m(){return c.options.shouldRespectForcePress}function y(){return e.isActive(f)}function v(A,$){Ub({expected:A,phase:h,isLockActive:y,shouldWarn:!0})&&n.dispatch($())}const x=v.bind(null,"DRAGGING");function E(A){function $(){e.release(),h="COMPLETED"}h!=="PRE_DRAG"&&($(),Le()),n.dispatch(xNe(A.liftActionArgs)),h="DRAGGING";function R(M,D={shouldBlockNextClick:!1}){if(A.cleanup(),D.shouldBlockNextClick){const P=ei(window,[{eventName:"click",fn:_Ce,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(P)}$(),n.dispatch(Jq({reason:M}))}return{isActive:()=>Ub({expected:"DRAGGING",phase:h,isLockActive:y,shouldWarn:!1}),shouldRespectForcePress:m,drop:M=>R("DROP",M),cancel:M=>R("CANCEL",M),...A.actions}}function N(A){const $=zg(M=>{x(()=>Yq({client:M}))});return{...E({liftActionArgs:{id:s,clientSelection:A,movementMode:"FLUID"},cleanup:()=>$.cancel(),actions:{move:$}}),move:$}}function _(){const A={moveUp:()=>x(ANe),moveRight:()=>x(TNe),moveDown:()=>x($Ne),moveLeft:()=>x(RNe)};return E({liftActionArgs:{id:s,clientSelection:yCe(u),movementMode:"SNAP"},cleanup:pc,actions:A})}function C(){Ub({expected:"PRE_DRAG",phase:h,isLockActive:y,shouldWarn:!0})&&e.release()}return{isActive:()=>Ub({expected:"PRE_DRAG",phase:h,isLockActive:y,shouldWarn:!1}),shouldRespectForcePress:m,fluidLift:N,snapLift:_,abort:C}}const OCe=[iCe,cCe,pCe];function jCe({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:s}){const i=[...s?OCe:[],...r||[]],o=w.useState(()=>H_e())[0],a=tt(function(E,N){Gg(E)&&!Gg(N)&&o.tryAbandon()},[o]);Ns(function(){let E=t.getState();return t.subscribe(()=>{const _=t.getState();a(E,_),E=_})},[o,t,a]),Ns(()=>o.tryAbandon,[o.tryAbandon]);const c=tt(x=>mH({lockAPI:o,registry:n,store:t,draggableId:x}),[o,n,t]),u=tt((x,E,N)=>CCe({lockAPI:o,registry:n,contextId:e,store:t,draggableId:x,forceSensorStop:E||null,sourceEvent:N&&N.sourceEvent?N.sourceEvent:null}),[e,o,n,t]),f=tt(x=>ECe(e,x),[e]),h=tt(x=>{const E=n.draggable.findById(x);return E?E.options:null},[n.draggable]),m=tt(function(){o.isClaimed()&&(o.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(CT()))},[o,t]),y=tt(()=>o.isClaimed(),[o]),v=Ot(()=>({canGetLock:c,tryGetLock:u,findClosestDraggableId:f,findOptionsForDraggable:h,tryReleaseLock:m,isLockClaimed:y}),[c,u,f,h,m,y]);for(let x=0;x<i.length;x++)i[x](v)}const ACe=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};vy.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),$Ce=e=>({...Wg,...e.autoScrollerOptions,durationDampening:{...Wg.durationDampening,...e.autoScrollerOptions}});function $m(e){return e.current||Le(),e.current}function TCe(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:s,dragHandleUsageInstructions:i}=e,o=w.useRef(null),a=cH(e),c=tt(()=>ACe(a.current),[a]),u=tt(()=>$Ce(a.current),[a]),f=z_e(t),h=q_e({contextId:t,text:i}),m=k_e(t,s),y=tt(P=>{$m(o).dispatch(P)},[]),v=Ot(()=>lD({publishWhileDragging:SNe,updateDroppableScroll:NNe,updateDroppableIsEnabled:_Ne,updateDroppableIsCombineEnabled:CNe,collectionStarting:ENe},y),[y]),x=L_e(),E=Ot(()=>f_e(x,v),[x,v]),N=Ot(()=>A_e({scrollWindow:h_e,scrollDroppable:E.scrollDroppable,getAutoScrollerOptions:u,...lD({move:Yq},y)}),[E.scrollDroppable,y,u]),_=D_e(t),C=Ot(()=>l_e({announce:f,autoScroller:N,dimensionMarshal:E,focusMarshal:_,getResponders:c,styleMarshal:m}),[f,N,E,_,c,m]);o.current=C;const j=tt(()=>{const P=$m(o);P.getState().phase!=="IDLE"&&P.dispatch(CT())},[]),A=tt(()=>{const P=$m(o).getState();return P.phase==="DROP_ANIMATING"?!0:P.phase==="IDLE"?!1:P.isDragging},[]),$=Ot(()=>({isDragging:A,tryAbort:j}),[A,j]);n($);const R=tt(P=>rH($m(o).getState(),P),[]),M=tt(()=>wu($m(o).getState()),[]),D=Ot(()=>({marshal:E,focus:_,contextId:t,canLift:R,isMovementAllowed:M,dragHandleUsageInstructionsId:h,registry:x}),[t,E,h,_,R,M,x]);return jCe({contextId:t,store:C,registry:x,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),w.useEffect(()=>j,[j]),Re.createElement(W1.Provider,{value:D},Re.createElement(n2e,{context:MT,store:C},e.children))}function RCe(){return Re.useId()}function MCe(e){const t=RCe(),n=e.dragHandleUsageInstructions||Ov.dragHandleUsageInstructions;return Re.createElement(c2e,null,r=>Re.createElement(TCe,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const PD={dragging:5e3,dropAnimating:4500},kCe=(e,t)=>t?ig.drop(t.duration):e?ig.snap:ig.fluid,ICe=(e,t)=>{if(e)return t?Hg.opacity.drop:Hg.opacity.combining},DCe=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function PCe(e){const n=e.dimension.client,{offset:r,combineWith:s,dropping:i}=e,o=!!s,a=DCe(e),c=!!i,u=c?TO.drop(r,o):TO.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:kCe(a,i),transform:u,opacity:ICe(o,c),zIndex:c?PD.dropAnimating:PD.dragging,pointerEvents:"none"}}function LCe(e){return{transform:TO.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function FCe(e){return e.type==="DRAGGING"?PCe(e):LCe(e)}function BCe(e,t,n=or){const r=window.getComputedStyle(t),s=t.getBoundingClientRect(),i=Sq(s,r),o=Ix(i,n),a={client:i,tagName:t.tagName.toLowerCase(),display:r.display},c={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:a,displaceBy:c,client:i,page:o}}function zCe(e){const t=kT("draggable"),{descriptor:n,registry:r,getDraggableRef:s,canDragInteractiveElements:i,shouldRespectForcePress:o,isEnabled:a}=e,c=Ot(()=>({canDragInteractiveElements:i,shouldRespectForcePress:o,isEnabled:a}),[i,a,o]),u=tt(y=>{const v=s();return v||Le(),BCe(n,v,y)},[n,s]),f=Ot(()=>({uniqueId:t,descriptor:n,options:c,getDimension:u}),[n,u,c,t]),h=w.useRef(f),m=w.useRef(!0);Ns(()=>(r.draggable.register(h.current),()=>r.draggable.unregister(h.current)),[r.draggable]),Ns(()=>{if(m.current){m.current=!1;return}const y=h.current;h.current=f,r.draggable.update(f,y)},[f,r.draggable])}var DT=Re.createContext(null);function Bx(e){const t=w.useContext(e);return t||Le(),t}function VCe(e){e.preventDefault()}const UCe=e=>{const t=w.useRef(null),n=tt(($=null)=>{t.current=$},[]),r=tt(()=>t.current,[]),{contextId:s,dragHandleUsageInstructionsId:i,registry:o}=Bx(W1),{type:a,droppableId:c}=Bx(DT),u=Ot(()=>({id:e.draggableId,index:e.index,type:a,droppableId:c}),[e.draggableId,e.index,a,c]),{children:f,draggableId:h,isEnabled:m,shouldRespectForcePress:y,canDragInteractiveElements:v,isClone:x,mapped:E,dropAnimationFinished:N}=e;if(!x){const $=Ot(()=>({descriptor:u,registry:o,getDraggableRef:r,canDragInteractiveElements:v,shouldRespectForcePress:y,isEnabled:m}),[u,o,r,v,y,m]);zCe($)}const _=Ot(()=>m?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":h,"data-rfd-drag-handle-context-id":s,draggable:!1,onDragStart:VCe}:null,[s,i,h,m]),C=tt($=>{E.type==="DRAGGING"&&E.dropping&&$.propertyName==="transform"&&vy.flushSync(N)},[N,E]),j=Ot(()=>{const $=FCe(E),R=E.type==="DRAGGING"&&E.dropping?C:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":s,"data-rfd-draggable-id":h,style:$,onTransitionEnd:R},dragHandleProps:_}},[s,_,h,E,C,n]),A=Ot(()=>({draggableId:u.id,type:u.type,source:{index:u.index,droppableId:u.droppableId}}),[u.droppableId,u.id,u.index,u.type]);return Re.createElement(Re.Fragment,null,f(j,E.snapshot,A))};var gH=(e,t)=>e===t,yH=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const qCe=e=>e.combine?e.combine.draggableId:null,HCe=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function WCe(){const e=sr((s,i)=>({x:s,y:i})),t=sr((s,i,o=null,a=null,c=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!c,dropAnimation:c,mode:s,draggingOver:o,combineWith:a,combineTargetFor:null})),n=sr((s,i,o,a,c=null,u=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:c,combineWith:u,mode:i,offset:s,dimension:o,forceShouldAnimate:f,snapshot:t(i,a,c,u,null)}}));return(s,i)=>{if(Gg(s)){if(s.critical.draggable.id!==i.draggableId)return null;const o=s.current.client.offset,a=s.dimensions.draggables[i.draggableId],c=Es(s.impact),u=HCe(s.impact),f=s.forceShouldAnimate;return n(e(o.x,o.y),s.movementMode,a,i.isClone,c,u,f)}if(s.phase==="DROP_ANIMATING"){const o=s.completed;if(o.result.draggableId!==i.draggableId)return null;const a=i.isClone,c=s.dimensions.draggables[i.draggableId],u=o.result,f=u.mode,h=yH(u),m=qCe(u),v={duration:s.dropDuration,curve:jT.drop,moveTo:s.newHomeClientOffset,opacity:m?Hg.opacity.drop:null,scale:m?Hg.scale.drop:null};return{mapped:{type:"DRAGGING",offset:s.newHomeClientOffset,dimension:c,dropping:v,draggingOver:h,combineWith:m,mode:f,forceShouldAnimate:null,snapshot:t(f,a,h,m,v)}}}return null}}function bH(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const GCe={mapped:{type:"SECONDARY",offset:or,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:bH(null)}};function YCe(){const e=sr((o,a)=>({x:o,y:a})),t=sr(bH),n=sr((o,a=null,c)=>({mapped:{type:"SECONDARY",offset:o,combineTargetFor:a,shouldAnimateDisplacement:c,snapshot:t(a)}})),r=o=>o?n(or,o,!0):null,s=(o,a,c,u)=>{const f=c.displaced.visible[o],h=!!(u.inVirtualList&&u.effected[o]),m=V1(c),y=m&&m.draggableId===o?a:null;if(!f){if(!h)return r(y);if(c.displaced.invisible[o])return null;const E=pp(u.displacedBy.point),N=e(E.x,E.y);return n(N,y,!0)}if(h)return r(y);const v=c.displacedBy.point,x=e(v.x,v.y);return n(x,y,f.shouldAnimate)};return(o,a)=>{if(Gg(o))return o.critical.draggable.id===a.draggableId?null:s(a.draggableId,o.critical.draggable.id,o.impact,o.afterCritical);if(o.phase==="DROP_ANIMATING"){const c=o.completed;return c.result.draggableId===a.draggableId?null:s(a.draggableId,c.result.draggableId,c.impact,c.afterCritical)}return null}}const JCe=()=>{const e=WCe(),t=YCe();return(r,s)=>e(r,s)||t(r,s)||GCe},XCe={dropAnimationFinished:Xq},KCe=wq(JCe,XCe,null,{context:MT,areStatePropsEqual:gH})(UCe);function vH(e){return Bx(DT).isUsingCloneFor===e.draggableId&&!e.isClone?null:Re.createElement(KCe,e)}function QCe(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return Re.createElement(vH,vh({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const xH=e=>t=>e===t,ZCe=xH("scroll"),eOe=xH("auto"),LD=(e,t)=>t(e.overflowX)||t(e.overflowY),tOe=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return LD(n,ZCe)||LD(n,eOe)},nOe=()=>!1,wH=e=>e==null?null:e===document.body?nOe()?e:null:e===document.documentElement?null:tOe(e)?e:wH(e.parentElement);var kO=e=>({x:e.scrollLeft,y:e.scrollTop});const SH=e=>e?window.getComputedStyle(e).position==="fixed"?!0:SH(e.parentElement):!1;var rOe=e=>{const t=wH(e),n=SH(e);return{closestScrollable:t,isFixedOnPage:n}},sOe=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:s,client:i,page:o,closest:a})=>{const c=(()=>{if(!a)return null;const{scrollSize:m,client:y}=a,v=eH({scrollHeight:m.scrollHeight,scrollWidth:m.scrollWidth,height:y.paddingBox.height,width:y.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:y,scrollSize:m,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:v,diff:{value:or,displacement:or}}}})(),u=s==="vertical"?wT:Mq,f=Rh({page:o,withPlaceholder:null,axis:u,frame:c});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:u,isEnabled:t,client:i,page:o,frame:c,subject:f}};const iOe=(e,t)=>{const n=Eq(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,s=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,o=s+t.scrollWidth,c=yT({top:r,right:o,bottom:i,left:s},n.border);return bT({borderBox:c,margin:n.margin,border:n.border,padding:n.padding})};var oOe=({ref:e,descriptor:t,env:n,windowScroll:r,direction:s,isDropDisabled:i,isCombineEnabled:o,shouldClipSubject:a})=>{const c=n.closestScrollable,u=iOe(e,c),f=Ix(u,r),h=(()=>{if(!c)return null;const y=Eq(c),v={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:y,page:Ix(y,r),scroll:kO(c),scrollSize:v,shouldClipSubject:a}})();return sOe({descriptor:t,isEnabled:!i,isCombineEnabled:o,isFixedOnPage:n.isFixedOnPage,direction:s,client:u,page:f,closest:h})};const aOe={passive:!1},lOe={passive:!0};var FD=e=>e.shouldPublishImmediately?aOe:lOe;const qb=e=>e&&e.env.closestScrollable||null;function cOe(e){const t=w.useRef(null),n=Bx(W1),r=kT("droppable"),{registry:s,marshal:i}=n,o=cH(e),a=Ot(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),c=w.useRef(a),u=Ot(()=>sr((j,A)=>{t.current||Le();const $={x:j,y:A};i.updateDroppableScroll(a.id,$)}),[a.id,i]),f=tt(()=>{const j=t.current;return!j||!j.env.closestScrollable?or:kO(j.env.closestScrollable)},[]),h=tt(()=>{const j=f();u(j.x,j.y)},[f,u]),m=Ot(()=>zg(h),[h]),y=tt(()=>{const j=t.current,A=qb(j);if(j&&A||Le(),j.scrollOptions.shouldPublishImmediately){h();return}m()},[m,h]),v=tt((j,A)=>{t.current&&Le();const $=o.current,R=$.getDroppableRef();R||Le();const M=rOe(R),D={ref:R,descriptor:a,env:M,scrollOptions:A};t.current=D;const P=oOe({ref:R,descriptor:a,env:M,windowScroll:j,direction:$.direction,isDropDisabled:$.isDropDisabled,isCombineEnabled:$.isCombineEnabled,shouldClipSubject:!$.ignoreContainerClipping}),F=M.closestScrollable;return F&&(F.setAttribute(MD.contextId,n.contextId),F.addEventListener("scroll",y,FD(D.scrollOptions))),P},[n.contextId,a,y,o]),x=tt(()=>{const j=t.current,A=qb(j);return j&&A||Le(),kO(A)},[]),E=tt(()=>{const j=t.current;j||Le();const A=qb(j);t.current=null,A&&(m.cancel(),A.removeAttribute(MD.contextId),A.removeEventListener("scroll",y,FD(j.scrollOptions)))},[y,m]),N=tt(j=>{const A=t.current;A||Le();const $=qb(A);$||Le(),$.scrollTop+=j.y,$.scrollLeft+=j.x},[]),_=Ot(()=>({getDimensionAndWatchScroll:v,getScrollWhileDragging:x,dragStopped:E,scroll:N}),[E,v,x,N]),C=Ot(()=>({uniqueId:r,descriptor:a,callbacks:_}),[_,a,r]);Ns(()=>(c.current=C.descriptor,s.droppable.register(C),()=>{t.current&&E(),s.droppable.unregister(C)}),[_,a,E,C,i,s.droppable]),Ns(()=>{t.current&&i.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Ns(()=>{t.current&&i.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function o_(){}const BD={width:0,height:0,margin:g2e},uOe=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?BD:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},dOe=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=uOe({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?ig.placeholder:null}},fOe=e=>{const t=w.useRef(null),n=tt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:s,onClose:i,contextId:o}=e,[a,c]=w.useState(e.animate==="open");w.useEffect(()=>a?r!=="open"?(n(),c(!1),o_):t.current?o_:(t.current=setTimeout(()=>{t.current=null,c(!1)}),n):o_,[r,a,n]);const u=tt(h=>{h.propertyName==="height"&&(s(),r==="close"&&i())},[r,i,s]),f=dOe({isAnimatingOpenOnMount:a,animate:e.animate,placeholder:e.placeholder});return Re.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":o,onTransitionEnd:u,ref:e.innerRef})};var hOe=Re.memo(fOe);class pOe extends Re.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const mOe=e=>{const t=w.useContext(W1);t||Le();const{contextId:n,isMovementAllowed:r}=t,s=w.useRef(null),i=w.useRef(null),{children:o,droppableId:a,type:c,mode:u,direction:f,ignoreContainerClipping:h,isDropDisabled:m,isCombineEnabled:y,snapshot:v,useClone:x,updateViewportMaxScroll:E,getContainerForClone:N}=e,_=tt(()=>s.current,[]),C=tt((F=null)=>{s.current=F},[]);tt(()=>i.current,[]);const j=tt((F=null)=>{i.current=F},[]),A=tt(()=>{r()&&E({maxScroll:nH()})},[r,E]);cOe({droppableId:a,type:c,mode:u,direction:f,isDropDisabled:m,isCombineEnabled:y,ignoreContainerClipping:h,getDroppableRef:_});const $=Ot(()=>Re.createElement(pOe,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:F,data:V,animate:H})=>Re.createElement(hOe,{placeholder:V,onClose:F,innerRef:j,animate:H,contextId:n,onTransitionEnd:A})),[n,A,e.placeholder,e.shouldAnimatePlaceholder,j]),R=Ot(()=>({innerRef:C,placeholder:$,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,$,C]),M=x?x.dragging.draggableId:null,D=Ot(()=>({droppableId:a,type:c,isUsingCloneFor:M}),[a,M,c]);function P(){if(!x)return null;const{dragging:F,render:V}=x,H=Re.createElement(vH,{draggableId:F.draggableId,index:F.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(I,B)=>V(I,B,F));return Rf.createPortal(H,N())}return Re.createElement(DT.Provider,{value:D},o(R,v),P())};function gOe(){return document.body||Le(),document.body}const zD={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:gOe},EH=e=>{let t={...e},n;for(n in zD)e[n]===void 0&&(t={...t,[n]:zD[n]});return t},a_=(e,t)=>e===t.droppable.type,VD=(e,t)=>t.draggables[e.draggable.id],yOe=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=sr(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=sr((i,o,a,c,u,f)=>{const h=u.descriptor.id;if(u.descriptor.droppableId===i){const v=f?{render:f,dragging:n(u.descriptor)}:null,x={isDraggingOver:a,draggingOverWith:a?h:null,draggingFromThisWith:h,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!1,snapshot:x,useClone:v}}if(!o)return t;if(!c)return e;const y={isDraggingOver:a,draggingOverWith:h,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!0,snapshot:y,useClone:null}});return(i,o)=>{const a=EH(o),c=a.droppableId,u=a.type,f=!a.isDropDisabled,h=a.renderClone;if(Gg(i)){const m=i.critical;if(!a_(u,m))return t;const y=VD(m,i.dimensions),v=Es(i.impact)===c;return r(c,f,v,v,y,h)}if(i.phase==="DROP_ANIMATING"){const m=i.completed;if(!a_(u,m.critical))return t;const y=VD(m.critical,i.dimensions);return r(c,f,yH(m.result)===c,Es(m.impact)===c,y,h)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const m=i.completed;if(!a_(u,m.critical))return t;const y=Es(m.impact)===c,v=!!(m.impact.at&&m.impact.at.type==="COMBINE"),x=m.critical.droppable.id===c;return y?v?e:t:x?e:t}return t}},bOe={updateViewportMaxScroll:jNe},vOe=wq(yOe,bOe,(e,t,n)=>({...EH(n),...e,...t}),{context:MT,areStatePropsEqual:gH})(mOe);function xOe({data:e=[],extractId:t,renderItem:n,dndProps:r={droppableId:"sortable-list",direction:"vertical"},onReordered:s,onChange:i,disableIndices:o=[],...a}){function c({destination:f,source:h}){if(o.includes(h.index)||o.includes(f.index))return;const m={from:h.index,to:(f==null?void 0:f.index)||0};s==null||s(m.from,m.to)}const u=e.map((f,h)=>{const m=t?t(f):w.useId();return p.jsx(QCe,{index:h,draggableId:m,isDragDisabled:o.includes(h),children:(y,v,x)=>n?n({...f,dnd:{provided:y,snapshot:v,rubic:x}},h):p.jsxs("div",{className:"flex flex-row gap-2 p-2 border border-gray-200 rounded-md mb-3 bg-white items-center",ref:y.innerRef,...y.draggableProps,children:[p.jsx("div",{...y.dragHandleProps,children:p.jsx(pve,{className:"size-5",stroke:1.5})}),p.jsx("p",{children:JSON.stringify(f)})]})},m)});return p.jsx(MCe,{onDragEnd:c,children:p.jsx(vOe,{...r,children:f=>p.jsxs("div",{...a,...f.droppableProps,ref:f.innerRef,children:[u,f.placeholder]})})})}function PT({children:e,target:t,defaultOpen:n=!1,backdrop:r=!1,position:s="bottom-start",overlayProps:i,className:o}){const[a,c]=w.useState(n),u=yy(()=>c(!1)),f=Lt((m=50)=>setTimeout(()=>c(y=>!y),typeof m=="number"?m:0)),h={"bottom-start":"mt-1 top-[100%]","bottom-end":"right-0 top-[100%] mt-1","top-start":"bottom-[100%] mb-1","top-end":"bottom-[100%] right-0 mb-1"}[s];return p.jsxs(p.Fragment,{children:[a&&r&&p.jsx("div",{className:"animate-fade-in w-full h-full absolute top-0 bottom-0 right-0 left-0 bg-background/60"}),p.jsxs("div",{role:"dropdown",className:Ue("relative flex",o),ref:u,children:[w.cloneElement(e,{onClick:f}),a&&p.jsx("div",{...i,className:Ue("animate-fade-in absolute z-20 flex flex-col bg-background border border-muted px-1 py-1 rounded-lg shadow-lg backdrop-blur-sm min-w-full max-w-20",h,i==null?void 0:i.className),children:t({toggle:f})})]})]})}const Y1=[{type:"primary",label:"Primary",icon:qI,addable:!1,disabled:["name"],hidden:["virtual"]},{type:"text",label:"Text",icon:qI},{type:"number",label:"Number",icon:k1e},{type:"boolean",label:"Boolean",icon:P1e},{type:"date",label:"Date",icon:MU},{type:"enum",label:"Enum",icon:iT},{type:"json",label:"JSON",icon:f1e},{type:"jsonschema",label:"JSON Schema",icon:E1e},{type:"relation",label:"Relation",icon:sT,addable:!1,hidden:["virtual"]},{type:"media",label:"Media",icon:Uy,addable:!1,hidden:["virtual"]}],UD=()=>{const[e,t]=g8([!1,!0]),n=e?i1e:D1e;return p.jsx("button",{role:"checkbox",type:"button",className:"flex px-3 py-3",onClick:()=>t(),children:p.jsx(n,{size:18})})};function J1({data:e=[],columns:t,checkable:n,onClickRow:r,onClickPage:s,onClickSort:i,total:o,sort:a,page:c=1,perPage:u=10,perPageOptions:f,onClickPerPage:h,classNames:m,renderHeader:y,rowActions:v,renderValue:x,onClickNew:E}){o=o||(e==null?void 0:e.length)||0,c=c||1;const N=t&&t.length>0?t:Object.keys((e==null?void 0:e[0])||{}),_=Math.max(Math.ceil(o/u),1),C=x||X1;return p.jsxs("div",{className:"flex flex-col gap-3",children:[E&&p.jsx("div",{className:"flex flex-row space-between",children:E&&p.jsx(ot,{onClick:E,children:"Create new"})}),p.jsx("div",{className:"border-muted border rounded-md shadow-sm w-full max-w-full overflow-x-scroll overflow-y-hidden",children:p.jsxs("table",{className:"w-full text-md",children:[N.length>0?p.jsx("thead",{className:"sticky top-0 bg-muted/10",children:p.jsxs("tr",{children:[n&&p.jsx("th",{align:"center",className:"w-[40px]",children:p.jsx(UD,{})}),N.map((j,A)=>{const $=(y==null?void 0:y(j))??ii(j);return p.jsx("th",{children:p.jsx("div",{className:"flex flex-row py-1 px-1 font-normal text-primary/55",children:p.jsxs("button",{type:"button",className:Ue("py-1.5 rounded-md inline-flex flex-row justify-start items-center gap-1",i?"link hover:bg-primary/5 pl-2.5 pr-1":"px-2.5"),onClick:()=>i==null?void 0:i(j),children:[p.jsx("span",{className:"text-left text-nowrap whitespace-nowrap",children:$}),(i||a&&a.by===j)&&p.jsx(wOe,{sort:a,field:j})]})})},A)}),v&&v.length>0&&p.jsx("th",{className:"w-10"})]})}):null,p.jsx("tbody",{children:!e||!Array.isArray(e)||e.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:N.length+(n?1:0),children:p.jsx("div",{className:"flex flex-col gap-2 p-8 justify-center items-center border-t border-muted",children:p.jsx("i",{className:"opacity-50",children:Array.isArray(e)?"No data to show":e?p.jsx("pre",{children:JSON.stringify(e,null,2)}):"Loading..."})})})}):e.map((j,A)=>{const $=()=>r==null?void 0:r(j);return p.jsxs("tr",{"data-border":A>0,className:"hover:bg-primary/5 active:bg-muted border-muted data-[border]:border-t cursor-pointer transition-colors",children:[n&&p.jsx("td",{align:"center",children:p.jsx(UD,{})}),Object.entries(j).map(([R,M],D)=>p.jsx("td",{onClick:$,children:p.jsx("div",{className:"flex flex-row items-start py-3 px-3.5 font-normal ",children:p.jsx(C,{property:R,value:M})})},D)),v&&v.length>0&&p.jsx("td",{children:p.jsx("div",{className:"flex flex-row justify-end pr-2",children:p.jsxs(xs,{position:"bottom-end",children:[p.jsx(xs.Target,{children:p.jsx(St,{Icon:_1e})}),p.jsx(xs.Dropdown,{children:v.map(R=>p.jsx(xs.Item,{onClick:()=>R.onClick(j,A),leftSection:R.icon&&p.jsx(R.icon,{}),children:R.label},R.label))})]})})})]},A)})})]})}),p.jsxs("div",{className:"flex flex-row items-center justify-between",children:[p.jsx("div",{className:"hidden md:flex text-primary/40",children:p.jsx(SOe,{perPage:u,page:c,items:(e==null?void 0:e.length)||0,total:o})}),p.jsxs("div",{className:"flex flex-row gap-2 md:gap-10 items-center",children:[f&&p.jsxs("div",{className:"hidden md:flex flex-row items-center gap-2 text-primary/40",children:["Per Page"," ",p.jsx(Ur,{items:f.map(j=>({label:String(j),perPage:j})),position:"top-end",onClickItem:j=>h==null?void 0:h(j.perPage),children:p.jsx(ot,{children:u})})]}),p.jsxs("div",{className:"text-primary/40",children:["Page ",c," of ",_]}),s&&p.jsx("div",{className:"flex flex-row gap-1.5",children:p.jsx(EOe,{current:c,total:_,onClick:s})})]})]})]})}const X1=({value:e,property:t})=>{let n=!1;return e!==null&&typeof e=="object"&&(e=JSON.stringify(e),n=!0),e!==null&&typeof e<"u"?p.jsx("span",{className:Ue("line-clamp-2",n&&"font-mono break-all"),children:e}):p.jsx("span",{className:"opacity-10 font-mono",children:"null"})},wOe=({sort:e,field:t})=>!e||e.by!==t?p.jsx(iT,{size:18,className:"mt-[1px]"}):e.dir==="asc"?p.jsx(c1e,{size:18,className:"mt-[1px]"}):p.jsx(a1e,{size:18,className:"mt-[1px]"}),SOe=({perPage:e,page:t,items:n,total:r})=>r===0?p.jsx(p.Fragment,{children:"No rows to show"}):r===1?p.jsx(p.Fragment,{children:"Showing 1 row"}):p.jsxs(p.Fragment,{children:["Showing ",e*(t-1)+1,"-",e*(t-1)+n," of ",r," rows"]}),EOe=({current:e,total:t,onClick:n})=>[{value:1,Icon:x1e,disabled:e===1},{value:e-1,Icon:y1e,disabled:e===1},{value:e+1,Icon:b1e,disabled:e===t},{value:t,Icon:w1e,disabled:e===t}].map((s,i)=>p.jsx("button",{role:"button",type:"button",disabled:s.disabled,className:"px-2 py-2 border-muted border rounded-md enabled:link text-lg enabled:hover:bg-primary/5 text-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>{const o=s.value,a=o<1?1:o>t?t:o;n==null||n(a)},children:p.jsx(s.Icon,{})},i)),NOe=({path:e,backTo:t,onBack:n})=>{const[r,s]=yi(),i=window.location.pathname,o=Array.isArray(e)?e:[e],a=i.split("/").filter(h=>h!==""),c=o.length>1,u=n||Lt(()=>{if(t){s(t,{replace:!0});return}const h=a.slice(0,o.length+1).join("/");s(`~/${h}`,{replace:!0})}),f=w.useMemo(()=>o.map((h,m)=>{const y=m===o.length-1,v=a.indexOf(h),x=a.slice(0,v+1).join("/"),E=Cy(h);return{last:y,href:x,string:E}}),[o,a]);return p.jsxs("div",{className:"flex flex-row flex-grow items-center gap-2 text-lg",children:[c&&p.jsx(St,{onClick:u,Icon:rT,variant:"default",size:"lg",className:"mr-1"}),p.jsx("div",{className:"hidden md:flex gap-2",children:p.jsx(NH,{crumbs:f})}),p.jsx("div",{className:"flex md:hidden gap-2",children:p.jsx(_Oe,{crumbs:f})})]})},NH=({crumbs:e})=>e.map((t,n)=>t.last?p.jsx(_H,{...t},n):p.jsx(CH,{...t},n)),_Oe=({crumbs:e})=>{const[,t]=yi();if(e.length<=2)return p.jsx(NH,{crumbs:e});const n=e[0],r=e[e.length-1],s=w.useMemo(()=>e.slice(1,-1).map(o=>({label:o.string,href:o.href})),[e]),i=Lt(o=>t(`~/${o.href}`));return p.jsxs(p.Fragment,{children:[p.jsx(CH,{...n}),p.jsx(Ur,{onClickItem:i,items:s,children:p.jsx(St,{Icon:Lc,variant:"ghost"})}),p.jsx("span",{className:"opacity-25 dark:font-bold font-semibold",children:"/"}),p.jsx(_H,{...r})]})},_H=({string:e})=>p.jsx("span",{className:"text-nowrap dark:font-bold font-semibold",children:e}),CH=({href:e,string:t})=>p.jsxs("div",{className:"opacity-50 flex flex-row gap-2 dark:font-bold font-semibold",children:[p.jsx(M1,{to:`~/${e}`,className:"text-nowrap",children:t}),p.jsx("span",{className:"opacity-50",children:"/"})]});function OH(e,t,n){if(!e.properties)return[{...e.toJSON()},t,{}];const r=JSON.parse(JSON.stringify(e)),s={...r,properties:Cs(r.properties,n)};s.required&&(s.required=s.required.filter(a=>!n.includes(a)));const i={};for(const a of n)i[a]={config:t[a],schema:r.properties[a]};const o=Cs(t,n);return[s,o,i]}const COe=w.forwardRef((e,t)=>{const[n,r]=w.useState(!!(e.value??e.defaultValue));w.useEffect(()=>{console.log("value change",e.value),r(!!e.value)},[e.value]);function s(i){var o;r(i.target.checked),(o=e.onChange)==null||o.call(e,i.target.checked)}return p.jsx("div",{className:"flex flex-row",children:p.jsx(Wa,{ref:t,checked:n,onChange:s,disabled:e.disabled,id:e.id})})}),Ji=({error:e,as:t,...n})=>{const r=t||"div";return p.jsx(r,{...n,className:Ue("flex flex-col gap-1.5",t==="fieldset"&&"border border-primary/10 p-3 rounded-md",t==="fieldset"&&e&&"border-red-500",e&&"text-red-500",n.className)})},Ao=({as:e,...t})=>{const n=e||"label";return p.jsx(n,{...t})},OOe=({className:e,...t})=>p.jsx("div",{...t,className:Ue("text-sm text-primary/50",e)}),jOe=({className:e,...t})=>p.jsx("div",{...t,className:Ue("text-sm text-red-500",e)}),LT=({field:e,...t})=>{const n=e.getDescription();return p.jsxs(Ao,{...t,title:n,className:"flex flex-row gap-1 items-center",children:[e.getLabel(),e.isRequired()&&p.jsx("span",{className:"font-medium opacity-30",children:"*"}),n&&p.jsx($1e,{className:"opacity-50"})]})},Bc=w.forwardRef((e,t)=>{const n=e.disabled||e.readOnly;return p.jsx("input",{type:"text",...e,ref:t,className:Ue("bg-muted/40 h-11 rounded-md py-2.5 px-4 outline-none w-full",n&&"bg-muted/50 text-primary/50",!n&&"focus:bg-muted focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all",e.className)})}),AOe=w.forwardRef((e,t)=>e.type==="password"?p.jsx(jH,{...e,ref:t}):p.jsx(Bc,{...e,ref:t})),jH=w.forwardRef((e,t)=>{const[n,r]=w.useState(!1);function s(){r(i=>!i)}return p.jsxs("div",{className:"relative w-full",children:[p.jsx(Bc,{...e,type:n?"text":"password",className:"w-full",ref:t}),p.jsx("div",{className:"absolute right-3 top-0 bottom-0 flex items-center",children:p.jsx(St,{Icon:n?O1e:PU,onClick:s,variant:"ghost",className:"opacity-70"})})]})}),$Oe=w.forwardRef((e,t)=>p.jsx("textarea",{rows:3,...e,ref:t,className:Ue("bg-muted/40 min-h-11 rounded-md py-2.5 px-4 focus:bg-muted outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50",e.className)})),IO=w.forwardRef((e,t)=>{const n=w.useRef(null),r=kie();w.useImperativeHandle(t,()=>n.current);const s=Lt(()=>{n!=null&&n.current&&(n.current.focus(),["Safari"].includes(r)?n.current.click():n.current.showPicker())});return p.jsxs("div",{className:"relative w-full",children:[p.jsx("div",{className:"absolute h-full right-3 top-0 bottom-0 flex items-center",children:p.jsx(St,{Icon:MU,onClick:s})}),p.jsx(Bc,{...e,type:e.type??"date",ref:n,className:"w-full appearance-none"})]})}),BPe=w.forwardRef((e,t)=>{const[n,r]=w.useState(!!e.value);w.useEffect(()=>{r(!!e.value)},[e.value]);function s(i){var o;r(i.target.checked),(o=e.onChange)==null||o.call(e,i.target.checked)}return p.jsx("div",{className:"h-11 flex items-center",children:p.jsx("input",{...e,type:"checkbox",ref:t,className:"outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500  transition-all disabled:opacity-70 scale-150 ml-1",checked:n,onChange:s,disabled:e.disabled})})}),qD={xs:{root:"h-5 w-8",thumb:"data-[state=checked]:left-[calc(100%-1rem)]"},sm:{root:"h-6 w-10",thumb:"data-[state=checked]:left-[calc(100%-1.25rem)]"},md:{root:"h-7 w-12",thumb:"data-[state=checked]:left-[calc(100%-1.5rem)]"}},TOe=w.forwardRef(({type:e,required:t,...n},r)=>p.jsx(Lwe,{className:hn("relative cursor-pointer rounded-full bg-muted border-2 border-transparent outline-none ring-1 dark:ring-primary/10 ring-primary/20 data-[state=checked]:ring-primary/60 data-[state=checked]:bg-primary/60 appearance-none transition-colors hover:bg-muted/80",qD[n.size??"md"].root,n.disabled&&"opacity-50 !cursor-not-allowed"),onCheckedChange:s=>{var i;console.log("setting",s),(i=n.onChange)==null||i.call(n,{target:{value:s}})},...n,checked:typeof n.checked<"u"?n.checked:typeof n.value<"u"?!!n.value:void 0,ref:r,children:p.jsx(Fwe,{className:hn("absolute top-0 left-0 h-full aspect-square rounded-full bg-primary/30 data-[state=checked]:bg-background transition-[left,right] duration-100 border border-muted",qD[n.size??"md"].thumb)})})),AH=w.forwardRef(({children:e,options:t,...n},r)=>p.jsxs("div",{className:"flex w-full relative",children:[p.jsx("select",{...n,ref:r,className:Ue("bg-muted/40 focus:bg-muted rounded-md py-2.5 px-4 outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50","appearance-none h-11 w-full",!n.multiple&&"border-r-8 border-r-transparent",n.className),children:t?p.jsxs(p.Fragment,{children:[!n.required&&p.jsx("option",{value:""}),t.map(s=>typeof s!="object"?{value:s,label:String(s)}:s).map(s=>p.jsx("option",{value:s.value,children:s.label},s.value))]}):e}),!n.multiple&&p.jsx(kU,{className:"absolute right-3 top-0 bottom-0 h-full opacity-70 pointer-events-none",size:18})]})),ROe=(e,t)=>{switch(e){case"date":return IO;case"boolean":return COe;case"textarea":return $Oe;default:return Bc}};function $H({open:e=!1,children:t,onClose:n=()=>null,allowBackdropClose:r=!0,className:s,stickToTop:i}){const o=yy(()=>{r&&n()});return p.jsx(p.Fragment,{children:e&&p.jsx("div",{className:Ue("w-full h-full fixed bottom-0 top-0 right-0 left-0 bg-background/60 flex justify-center backdrop-blur-sm z-10",i?"items-start":"items-center"),children:p.jsx("div",{className:Ue("z-20 flex flex-col bg-background rounded-lg shadow-lg",s),ref:o,children:t})})})}const MOe=({schema:e,uiSchema:t={},anyOfValues:n,path:r,prefixPath:s,generateKey:i})=>{const[o,a]=yi(),[c,u]=w.useState(e),[f,h]=w.useState(!1),{actions:m}=Tt(),[y,{open:v,close:x}]=Gh(!1),E=i!==void 0,N=typeof i=="string",[_,C]=w.useState(N?i:""),j=_w(!E),A=w.useRef(null),$="anyOf"in e;function R(F){i&&typeof i=="function"&&M({target:{value:i(F)}}),console.log("form change",F)}function M(F){const V=String(F.target.value);if(V.length>0&&!/^[a-zA-Z_][a-zA-Z0-9_ ]*$/.test(V)){console.log("no match",V);return}C(V.toLowerCase().replace(/ /g,"_").replace(/__+/g,"_"))}async function D(){var F,V,H,I;if((F=A.current)!=null&&F.validateForm()){h(!0);const B=(V=A.current)==null?void 0:V.formData(),[T,...L]=r,z=[...L,_].join(".");await m.add(T,z,B)?setTimeout(()=>{a(s+_,{replace:!0})},500):h(!1)}console.log("valid?",(H=A.current)==null?void 0:H.validateForm()),console.log("data",_,(I=A.current)==null?void 0:I.formData())}const P=$?e.anyOf.map(F=>{var B,T;const V=F.title,H=((B=n==null?void 0:n[V])==null?void 0:B.label)||V,I=(T=n==null?void 0:n[V])==null?void 0:T.icon;return{label:H,icon:I,onClick:()=>{u(F),v()}}}):[];return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex flex-row",children:$?p.jsx(Ur,{position:"top-start",items:P,itemsClassName:"gap-3",children:p.jsx(ot,{children:"Add new"})}):p.jsx(ot,{onClick:v,children:"Add new"})}),p.jsx($H,{open:y,allowBackdropClose:!1,onClose:x,className:"min-w-96 w-6/12 mt-[30px] mb-[20px]",stickToTop:!0,children:p.jsxs("div",{className:"border border-muted rounded-lg flex flex-col overflow-y-scroll font-normal",style:{maxHeight:"calc(100dvh - 100px)"},children:[p.jsx("div",{className:"bg-muted py-2 px-4 text-primary/70 font-mono flex flex-row gap-2 items-center",children:[...r,_].join(".")}),p.jsxs("div",{className:"flex flex-row gap-10 sticky top-0 bg-background z-10 p-4 border-b border-muted",children:[p.jsxs("div",{className:"flex flex-row flex-grow items-center relative",children:[p.jsx(Bc,{ref:j,className:"w-full",placeholder:"New unique key...",onChange:M,value:_,disabled:E}),E&&p.jsx("div",{className:"absolute h-full flex items-center z-10 right-3.5 top-0 bottom-0 font-mono font-sm opacity-50",children:"generated"})]}),p.jsxs("div",{className:"flex flex-row gap-2",children:[p.jsx(ot,{onClick:x,disabled:f,children:"Cancel"}),p.jsx(ot,{variant:"primary",onClick:D,disabled:f||_.length===0,children:"Create"})]})]}),p.jsx("div",{className:"flex flex-col p-4",children:p.jsx(hp,{ref:A,schema:Ch(c,["title"]),uiSchema:t,onChange:R,className:"legacy hide-required-mark fieldset-alternative mute-root"})})]})})]})},HD=w.forwardRef(({tabs:e,title:t},n)=>{const[r,{open:s,close:i}]=Gh(!1),[o,a]=w.useState(0),c=e[o];return w.useImperativeHandle(n,()=>({open:s,close:i,isOpen:r})),c?p.jsx($H,{open:r,onClose:i,className:"min-w-96 w-9/12 mt-[80px] mb-[20px]",stickToTop:!0,children:p.jsxs("div",{className:"border border-primary rounded-lg flex flex-col overflow-scroll font-normal",style:{maxHeight:"calc(100dvh - 100px)"},children:[t&&p.jsxs("div",{className:"bg-primary py-2 px-4 text-background font-mono flex flex-row gap-2 items-center",children:[p.jsx(B1e,{size:20,className:"opacity-50"}),t]}),p.jsxs("div",{className:"flex flex-row justify-between sticky top-0 bg-background z-10 py-4 px-5",children:[p.jsx("div",{className:"flex flex-row gap-3",children:e.map((u,f)=>p.jsx("button",{onClick:()=>a(f),"data-active":f===o?1:void 0,className:"font-mono data-[active]:font-bold",children:u.title},f))}),p.jsx(St,{Icon:oT,onClick:i})]}),p.jsx("div",{className:"",children:p.jsx(ui,{json:c.json,expand:6,showSize:!0,showCopy:!0})})]})}):null});function Qr({schema:e,uiSchema:t,config:n,prefix:r="/",options:s,path:i=[],properties:o}){var V,H,I;const[a,c]=w.useState(!1),{actions:u}=Tt(),f=w.useRef(null),h=w.useRef(null),m=w.useRef(null),[y,v]=w.useState(!1);Nj([["mod+s",B=>(B.preventDefault(),P(),!1)],["e",()=>{y||D()}],["Escape",()=>{y&&D()}]]);const x=w.useMemo(()=>o?Object.entries(o).filter(([,B])=>B.hide||B.extract).map(([B])=>B):[],[o]),E=Lt(B=>{const T=window.location.href.split("/").slice(0,-1).join("/");B?window.location.replace(T):window.history.back()}),N=((V=s==null?void 0:s.allowDelete)==null?void 0:V.call(s,n))??!0,_=((H=s==null?void 0:s.allowEdit)==null?void 0:H.call(s,n))??!0,C=((I=s==null?void 0:s.showAlert)==null?void 0:I.call(s,n))??void 0;console.log("--setting",{schema:e,config:n,prefix:r,path:i,exclude:x});const[j,A,$]=OH(e,n,x);console.log({reducedSchema:j,reducedConfig:A,extracted:$});const R=Object.keys($),M=R.find(B=>window.location.pathname.endsWith(B))??R[0],D=Lt(()=>{_&&v(B=>!B)}),P=Lt(async()=>{var B,T;if(!(!_||!y)&&(B=f.current)!=null&&B.validateForm()){c(!0);const L=(T=f.current)==null?void 0:T.formData(),[z,...q]=i;let k;console.log("save:data",{module:z,restOfPath:q},L),q.length>0?(console.log("-> patch",{module:z,path:q.join(".")},L),k=await u.patch(z,q.join("."),L)):(console.log("-> set",{module:z},L),k=await u.set(z,L,!0)),console.log("save:success",k),k?s!=null&&s.reloadOnSave&&(await u.reload(),c(!1)):c(!1)}}),F=Lt(async()=>{if(!N)return;const[B,...T]=i;window.confirm(`Are you sure you want to delete ${i.join(".")}`)&&await u.remove(B,T.join("."))&&E(!0)});return n?p.jsxs(p.Fragment,{children:[p.jsx(Wn,{className:i.length>1?"pl-3":"",scrollable:!0,right:p.jsxs(p.Fragment,{children:[p.jsx(Ur,{items:[{label:"Inspect local schema",onClick:()=>{var B;(B=h.current)==null||B.open()}},{label:"Inspect schema",onClick:()=>{var B;(B=m.current)==null||B.open()}},N&&{label:"Delete",destructive:!0,onClick:F}],position:"bottom-end",children:p.jsx(St,{Icon:fp})}),p.jsx(ot,{onClick:D,disabled:!_,children:y?"Cancel":"Edit"}),y&&p.jsx(ot,{variant:"primary",onClick:P,disabled:a||!_,children:a?"Save...":"Save"})]}),children:p.jsx(NOe,{path:i})}),p.jsxs(pr,{children:[typeof C<"u"&&p.jsx(xo.Warning,{message:C}),p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsx(hp,{ref:f,readonly:!y,schema:Ch(j,["title"]),formData:A,uiSchema:t,onChange:console.log,className:"legacy hide-required-mark fieldset-alternative mute-root"})}),R.length>0&&p.jsxs("div",{className:"flex flex-col max-w-full",children:[p.jsx(qU,{items:R.map(B=>{var T;return{as:M1,label:ii(B),href:`${r}/${B}`.replace(/\/+/g,"/"),active:M===B,badge:Object.keys(((T=$[B])==null?void 0:T.config)??{}).length}})}),p.jsx("div",{className:"flex flex-grow flex-col gap-3 p-3",children:p.jsx(lt,{path:"/:prop?",component:({params:B})=>{var W,X,ne,re;const[,T]=yi(),L=B.prop??M,z=((W=$[L])==null?void 0:W.config)??{},q=(X=o==null?void 0:o[L])!=null&&X.tableValues?(ne=o==null?void 0:o[L])==null?void 0:ne.tableValues(z):Object.entries(z).map(([se,fe])=>{if(!fe||typeof fe!="object")return{key:se,value:fe};const he=Object.keys(fe)[0],ue=fe[he],ve=Ch(fe,[he]);return{key:se,[he]:ue,value:ve}}),k=(re=o==null?void 0:o[L])==null?void 0:re.new;return L?p.jsxs(p.Fragment,{children:[k&&p.jsx(MOe,{schema:k.schema,uiSchema:k.uiSchema,anyOfValues:k.anyOfValues,prefixPath:`/${L}/`,path:[...i,L],generateKey:k.generateKey}),p.jsx(J1,{data:q,onClickRow:se=>{const fe=Object.values(se)[0];T(`/${L}/${fe}`)}})]}):p.jsx("div",{className:"h-80 flex justify-center align-center",children:p.jsx(Vr,{title:"No sub-setting selected",description:"Select one from the tab bar"})})}})})]})]},i.join("-")),p.jsx(HD,{ref:h,title:i.join("."),tabs:[{title:"Schema",json:j},{title:"Config",json:A}]}),p.jsx(HD,{ref:m,title:i.join("."),tabs:[{title:"Schema",json:e},{title:"Config",json:n}]})]}):p.jsx(Vr,{title:"Not found",description:`Configuration at path ${i.join(".")} doesn't exist.`,primary:{children:"Go back",onClick:()=>E()}})}const DO={config:{fillable:{"ui:options":{wrap:!0},anyOf:[{},{"ui:widget":"checkboxes"}]},hidden:{"ui:options":{wrap:!0},anyOf:[{},{"ui:widget":"checkboxes"}]},schema:{"ui:field":"JsonField"},ui_schema:{"ui:field":"JsonField"}}},kOe=Y1.filter(e=>e.type!=="primary").reduce((e,t)=>(e[t.type]={label:t.label,icon:t.icon},e),{}),IOe={"1:1":{label:"One-to-One"},"n:1":{label:"Many-to-One"},"m:n":{label:"Many-to-Many"},poly:{label:"Polymorphic"}},DOe=({schema:e,config:t})=>{const{app:n}=Tt(),r=n.getAbsolutePath("settings"),s=Object.keys(t.entities??{});function i(o,a="entity"){s.length!==0&&(o.properties&&a in o.properties&&(o.properties[a].enum=s),"anyOf"in o&&o.anyOf.forEach(c=>i(c,a)))}return p.jsx(lt,{path:"/data",nest:!0,children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/entities/:entity/fields/:field",component:({params:{entity:o,field:a}})=>{var h,m,y,v,x;const c=(y=(m=(h=t.entities)==null?void 0:h[o])==null?void 0:m.fields)==null?void 0:y[a],u=(x=(v=e.properties.entities.additionalProperties)==null?void 0:v.properties)==null?void 0:x.fields.additionalProperties,f=u.anyOf.find(E=>E.properties.type.const===(c==null?void 0:c.type));return p.jsx(Qr,{schema:f??u,config:c,prefix:`${r}/data/entities/${o}/fields/${a}`,path:["data","entities",o,"fields",a],options:{showAlert:E=>{if((E==null?void 0:E.type)==="primary")return"Modifying the primary field may result in strange behaviors."}},uiSchema:DO})},nest:!0}),p.jsx(lt,{path:"/entities/:entity",component:({params:{entity:o}})=>{var f;const a=e.properties.entities.additionalProperties,c=E1(a);c.properties.type.readOnly=!0;const u={anyOf:c.properties.fields.additionalProperties.anyOf.filter(h=>h.properties.type.const!=="primary")};return p.jsx(Qr,{schema:c,config:(f=t.entities)==null?void 0:f[o],options:{showAlert:h=>{if(h.type==="system")return"Modifying the system entities may result in strange behaviors."}},properties:{fields:{extract:!0,tableValues:h=>Zs(h,(m,y,v)=>{var x;m.push({property:v,type:y.type,required:(x=y.config)!=null&&x.required?"Yes":"No"})},[]),new:{schema:u,uiSchema:DO,anyOfValues:kOe}}},path:["data","entities",o],prefix:`${r}/data/entities/${o}`})},nest:!0}),p.jsx(lt,{path:"/indices/:index",component:({params:{index:o}})=>{var c;const a=e.properties.indices.additionalProperties;return s.length>0&&i(a,"entity"),p.jsx(Qr,{schema:e.properties.indices.additionalProperties,config:(c=t.indices)==null?void 0:c[o],path:["data","indices",o],prefix:`${r}/data/indices/${o}`})},nest:!0}),p.jsx(lt,{path:"/relations/:relation",component:({params:{relation:o}})=>{var f;const a=(f=t.relations)==null?void 0:f[o],u=e.properties.relations.additionalProperties.anyOf.find(h=>h.properties.type.const===(a==null?void 0:a.type));return s.length>0&&(i(u,"source"),i(u,"target")),p.jsx(Qr,{schema:u,config:a,path:["data","relations",o],prefix:`${r}/data/relations/${o}`})},nest:!0}),p.jsx(lt,{path:"/",component:()=>{const o=e.properties.indices.additionalProperties,a=e.properties.relations.additionalProperties;return i(o,"entity"),i(a,"source"),i(a,"target"),p.jsx(Qr,{schema:e,config:t,properties:{entities:{extract:!0,tableValues:c=>Zs(c,(u,f,h)=>{u.push({name:h,type:f.type,fields:Object.keys(f.fields??{}).length})},[]),new:{schema:e.properties.entities.additionalProperties,uiSchema:{fields:{"ui:widget":"hidden"},type:{"ui:widget":"hidden"}}}},relations:{extract:!0,new:{schema:e.properties.relations.additionalProperties,generateKey:c=>{var f,h,m,y;const u=[c.type.replace(":",""),c.source,c.target,(f=c.config)==null?void 0:f.mappedBy,(h=c.config)==null?void 0:h.inversedBy,(m=c.config)==null?void 0:m.connectionTable,(y=c.config)==null?void 0:y.connectionTableMappedName].filter(Boolean);return[...new Set(u)].join("_")},anyOfValues:IOe},tableValues:c=>Zs(c,(u,f,h)=>{u.push({name:h,type:f.type,source:f.source,target:f.target})},[])},indices:{extract:!0,tableValues:c=>Zs(c,(u,f,h)=>{u.push({name:h,entity:f.entity,fields:f.fields.join(", "),unique:f.unique?"Yes":"No"})},[]),new:{schema:o,uiSchema:{fields:{"ui:options":{orderable:!1}}},generateKey:c=>["idx",c.entity,c.unique&&"unique",...c.fields.filter(Boolean)].filter(Boolean).join("_")}}},prefix:`${r}/data`,path:["data"]})},nest:!0})]})})};class Ky extends w.Component{constructor(n){super(n);K(this,"resetError",()=>{this.setState({hasError:!1,error:void 0})});this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){const s=this.props.suppressError?"warn":"error";console[s]("ErrorBoundary caught an error:",n,r)}renderFallback(){return this.props.fallback?typeof this.props.fallback=="function"?this.props.fallback({error:this.state.error,resetError:this.resetError}):p.jsx(WD,{children:this.props.fallback}):p.jsx(WD,{children:"Error1"})}render(){if(this.state.hasError)return this.renderFallback();if(this.props.suppressError)try{return this.props.children}catch{return this.renderFallback()}return this.props.children}}const WD=({children:e})=>p.jsx("div",{className:"bg-red-700 text-white py-1 px-2 rounded-md leading-none font-mono",children:e}),K1=Yz,POe=Zt(Object.values(K1)),LOe=st({name:Zu,new:Wt({const:!0}).optional(),field:POe}),FOe=st({fields:un(LOe)}),BOe=Object.keys(K1);BOe[0];const FT=["label","description","required","fillable","hidden","virtual"];function zOe(e){var t;return Qe(Cs((t=K1[e])==null?void 0:t.properties.config.properties,FT))}const TH=w.forwardRef(function({fields:t,sortable:n,additionalFieldTypes:r,routePattern:s,isNew:i,...o},a){const c=Object.entries(t).map(([D,P])=>({name:D,field:P})),{control:u,formState:{isValid:f,errors:h},getValues:m,watch:y,register:v,setValue:x,setError:E,reset:N}=Za({mode:"all",resolver:el(FOe),defaultValues:{fields:c}}),{fields:_,append:C,remove:j,move:A}=zSe({control:u,name:"fields"});function $(D){return Object.fromEntries(D.fields.map(P=>[P.name,xg(P.field)]))}w.useEffect(()=>{o!=null&&o.onChange&&y(D=>{var P;(P=o==null?void 0:o.onChange)==null||P.call(o,$(D))})},[]),w.useImperativeHandle(a,()=>({reset:N,getValues:()=>m(),getData:()=>$(m()),isValid:()=>f,getErrors:()=>h}));function R(D){var P;C({name:"",new:!0,field:{type:D,config:(P=K1[D])==null?void 0:P.properties.config.template()}})}const M={watch:y,register:v,setValue:x,getValues:m,control:u,setError:E};return p.jsx(p.Fragment,{children:p.jsx("div",{className:"flex flex-col gap-6",children:p.jsx("div",{className:"flex flex-col gap-3",children:p.jsxs("div",{className:"flex flex-col gap-4",children:[n?p.jsx(xOe,{data:_,onReordered:A,extractId:D=>D.id,disableIndices:[0],renderItem:({dnd:D,...P},F)=>p.jsx(UOe,{field:P,index:F,form:M,errors:h,remove:j,dnd:D,routePattern:s,primary:{defaultFormat:P.defaultPrimaryFormat,editable:i}},P.id)},_.length):p.jsx("div",{children:_.map((D,P)=>p.jsx(RH,{field:D,index:P,form:M,errors:h,remove:j,routePattern:s,primary:{defaultFormat:o.defaultPrimaryFormat,editable:i}},D.id))}),p.jsx(PT,{className:"flex flex-col w-full",target:({toggle:D})=>p.jsx(VOe,{additionalFieldTypes:r,onSelected:D,onSelect:P=>{R(P)}}),children:p.jsx(ot,{className:"justify-center",children:"Add Field"})})]})})})})}),VOe=({onSelect:e,additionalFieldTypes:t=[],onSelected:n})=>{const r=Y1.filter(s=>s.addable!==!1);return t&&r.push(...t),p.jsx("div",{className:"flex flex-row gap-2 justify-center flex-wrap",children:r.map(s=>p.jsx(ot,{IconLeft:s.icon,variant:"ghost",onClick:()=>{var i;s.addable!==!1?e(s.type):(i=s.onClick)==null||i.call(s),n==null||n()},children:s.label},s.type))})},UOe=w.memo(RH,(e,t)=>e.field.id!==t.field.id);function RH({field:e,index:t,form:{watch:n,register:r,setValue:s,getValues:i,control:o,setError:a},remove:c,errors:u,dnd:f,routePattern:h,primary:m}){var P,F,V,H,I;const y=`fields.${t}.field`,v=e.field.type,x=n(`fields.${t}.name`),{active:E,toggle:N}=nT(h??"",x),_=Y1.find(B=>B.type===v);Ch(e.field.config,FT);const C=_.disabled||[],j=_.hidden||[],A=t===0,$=!!((P=u==null?void 0:u.fields)!=null&&P[t]),R=v==="primary";function M(B){return()=>{(x.length===0||window.confirm(`Sure to delete "${x}"?`))&&(c(B),N())}}const D=f?{...f.provided.draggableProps,ref:f.provided.innerRef}:{};return p.jsxs("div",{className:Ue("flex flex-col border border-muted rounded bg-background mb-2",E&&"mb-6",$&&"border-red-500 "),...D,children:[p.jsxs("div",{className:"flex flex-row gap-2 px-2 py-2",children:[f?p.jsx("div",{className:"flex items-center",...f.provided.dragHandleProps,children:p.jsx(St,{Icon:j1e,className:"mt-1",disabled:A})}):null,p.jsxs("div",{className:"flex flex-row flex-grow gap-4 items-center md:mr-6",children:[p.jsx(ud,{label:_.label,children:p.jsx("div",{className:"flex flex-row items-center p-2 bg-primary/5 rounded",children:p.jsx(_.icon,{className:"size-5"})})}),e.new?p.jsx(Nn,{error:!!((V=(F=u==null?void 0:u.fields)==null?void 0:F[t])!=null&&V.name.message),placeholder:"Enter a property name...",classNames:{root:"w-full h-full",wrapper:"font-mono h-full",input:"pt-px !h-full"},...r(`fields.${t}.name`),disabled:!e.new}):p.jsxs("div",{className:"font-mono flex-grow flex flex-row gap-3",children:[p.jsx("span",{children:x}),((H=e.field.config)==null?void 0:H.label)&&p.jsx("span",{className:"opacity-50",children:(I=e.field.config)==null?void 0:I.label})]}),p.jsx("div",{className:"flex-col gap-1 hidden md:flex",children:R?p.jsx(p.Fragment,{children:p.jsx(ja,{data:["integer","uuid"],defaultValue:m==null?void 0:m.defaultFormat,disabled:!(m!=null&&m.editable),placeholder:"Select format",name:`${y}.config.format`,allowDeselect:!1,control:o,size:"xs",className:"w-22"})}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-xs text-primary/50 leading-none",children:"Required"}),p.jsx(rg,{size:"sm",name:`${y}.config.required`,control:o})]})})]}),p.jsx("div",{className:"flex items-end",children:p.jsx("div",{className:"flex flex-row gap-4",children:p.jsx(St,{size:"lg",Icon:fp,disabled:R,iconProps:{strokeWidth:1.5},onClick:()=>N(),variant:E?"primary":"ghost"})})})]}),E&&p.jsx("div",{className:"flex flex-col border-t border-t-muted px-3 py-2 bg-lightest/50",children:p.jsxs(bn,{defaultValue:"general",children:[p.jsxs(bn.List,{className:"flex flex-row",children:[p.jsx(bn.Tab,{value:"general",children:"General"}),p.jsx(bn.Tab,{value:"specific",children:Cy(v)}),p.jsx(bn.Tab,{value:"visibility",disabled:!0,children:"Visiblity"}),p.jsx("div",{className:"flex flex-grow"}),p.jsx(bn.Tab,{value:"code",className:"!self-end",children:"Code"})]}),p.jsx(bn.Panel,{value:"general",children:p.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-1",children:[p.jsx("div",{className:"flex flex-row",children:p.jsx(rg,{label:"Required",name:`${y}.config.required`,control:o})}),p.jsx(Nn,{label:"Label",placeholder:"Label",...r(`${y}.config.label`)}),p.jsx(Ey,{label:"Description",placeholder:"Description",...r(`${y}.config.description`)}),!j.includes("virtual")&&p.jsx(rg,{label:"Virtual",name:`${y}.config.virtual`,control:o,disabled:C.includes("virtual")})]},`${y}_${v}`)}),p.jsx(bn.Panel,{value:"specific",children:p.jsx("div",{className:"flex flex-col gap-2 pt-3 pb-1",children:p.jsx(Ky,{fallback:`Error rendering JSON Schema for ${v}`,children:p.jsx(qOe,{field:e,onChange:B=>{s(`${y}.config`,{...i([`fields.${t}.config`])[0],...B})}})})})}),p.jsx(bn.Panel,{value:"code",children:(()=>{const{id:B,...T}=e;return p.jsx(ui,{json:T,expand:4})})()}),p.jsx("div",{className:"flex flex-row justify-end",children:p.jsx(ot,{IconLeft:BU,onClick:M(t),size:"small",variant:"subtlered",children:"Delete"})})]})})]},e.id)}const qOe=({field:e,onChange:t})=>{var s;const n=e.field.type,r=Ch(e.field.config,FT);return p.jsx(hp,{schema:(s=zOe(n))==null?void 0:s.toJSON(),formData:r,uiSchema:DO.config,className:"legacy hide-required-mark fieldset-alternative mute-root",onChange:t},n)},HOe=Rx;function WOe(){var C,j;const{nextStep:e,stepBack:t,state:n,setState:r}=Ed(),{config:s}=Ts(),i=(j=(C=n.entities)==null?void 0:C.create)==null?void 0:j[0],o={id:{type:"primary",name:"id"}},a=w.useRef(null),c=xg(Tme(i,{fields:o,config:{sort_field:"id",sort_dir:"asc"}})),{control:u,formState:{isValid:f,errors:h},getValues:m,handleSubmit:y,watch:v,setValue:x}=Za({mode:"onTouched",resolver:el(HOe),defaultValues:c}),E=v(),N=Lt(A=>{x("fields",A)});function _(){var A,$;f&&((A=a.current)!=null&&A.isValid())?(r(R=>{var D,P;return((P=(D=R.entities)==null?void 0:D.create)==null?void 0:P[0])?{...R,entities:{create:[m()]}}:R}),console.log("valid"),e("create")()):console.warn("not valid",($=a.current)==null?void 0:$.getErrors())}return p.jsxs("form",{onSubmit:y(_),children:[p.jsx(wd,{children:p.jsxs("div",{className:"flex flex-col gap-6",children:[p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("p",{children:["Add fields to ",p.jsx("strong",{children:i.name}),":"]}),p.jsx("div",{className:"flex flex-col gap-1",children:p.jsx(TH,{ref:a,fields:c.fields,onChange:N,defaultPrimaryFormat:s==null?void 0:s.default_primary_format,isNew:!0})})]}),p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx("p",{children:"How should it be sorted by default?"}),p.jsxs("div",{className:"flex flex-row gap-2",children:[p.jsx(ja,{label:"Field",data:Object.keys(E.fields??{}).filter(A=>A.length>0),placeholder:"Select field",name:"config.sort_field",allowDeselect:!1,control:u}),p.jsx(ja,{label:"Direction",data:["asc","desc"],defaultValue:"asc",placeholder:"Select direction",name:"config.sort_dir",allowDeselect:!1,control:u})]})]}),p.jsx("div",{children:Object.entries(h).map(([A,$])=>p.jsxs("p",{children:[A,": ",$.message]},A))})]})}),p.jsx(Sd,{next:{disabled:!f,type:"submit"},prev:{onClick:t},debug:{state:n,values:E}})]})}function zx({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,...o}){var h;const{field:{value:a,onChange:c,...u},fieldState:f}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsx(Yw,{value:a,onChange:m=>{c(m),i==null||i(m)},error:(h=f.error)==null?void 0:h.message,...u,...o})}const PO=[{type:Fr.ManyToOne,label:"Many to One",component:JOe},{type:Fr.OneToOne,label:"One to One",component:XOe},{type:Fr.ManyToMany,label:"Many to Many",component:KOe},{type:Fr.Polymorphic,label:"Polymorphic",component:QOe}],GOe=st({type:xe({enum:PO.map(e=>e.type)}),source:Zu,target:Zu,config:Qe({})});function YOe(){var N,_,C;const{config:e}=Tt(),t=e.data.entities,n=Object.keys(t??{}).length,{nextStep:r,stepBack:s,state:i,path:o,setState:a}=Ed(),{register:c,handleSubmit:u,formState:{isValid:f},setValue:h,watch:m,control:y}=Za({resolver:el(GOe),defaultValues:((_=(N=i.relations)==null?void 0:N.create)==null?void 0:_[0])??{}}),v=m();function x(){f&&(a(j=>({...j,relations:{create:[v]}})),console.log("data",v),r("create")())}const E=Lt(()=>{const{source:j,target:A}=v;j&&A?(h("source",A),h("target",j)):j?(h("target",j),h("source",null)):(h("source",A),h("target",null))});return p.jsxs(p.Fragment,{children:[n<2&&p.jsx("div",{className:"px-5 py-4 bg-red-100 text-red-900",children:"Not enough entities to create a relation."}),p.jsxs("form",{onSubmit:u(x),children:[p.jsxs(wd,{children:[p.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[p.jsx(ja,{control:y,name:"source",label:"Source",allowDeselect:!1,data:Object.entries(t??{}).map(([j,A])=>{var $;return{value:j,label:(($=A.config)==null?void 0:$.name)??j,disabled:v.target===j}})}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsx(ja,{control:y,name:"type",onChange:()=>h("config",{}),label:"Relation Type",data:PO.map(j=>({value:j.type,label:j.label})),allowDeselect:!1}),v.type&&p.jsx("div",{className:"flex justify-center mt-1",children:p.jsx(ot,{size:"small",IconLeft:I1e,onClick:E,children:"Flip entities"})})]}),p.jsx(ja,{control:y,allowDeselect:!1,name:"target",label:"Target",data:Object.entries(t??{}).map(([j,A])=>{var $;return{value:j,label:(($=A.config)==null?void 0:$.name)??j,disabled:v.source===j}})})]}),p.jsx("div",{children:v.type&&((C=PO.find(j=>j.type===v.type))==null?void 0:C.component({register:c,control:y,data:v}))})]}),p.jsx(Sd,{next:{type:"submit",disabled:!f,onClick:x},prev:{onClick:s},debug:{state:i,path:o,data:v}})]})]})}const Jt=({children:e})=>p.jsx("b",{className:"font-mono select-text",children:e}),Q1=({children:e})=>p.jsx("div",{className:"bg-primary/5 py-4 px-5 rounded-lg mt-10",children:e});function JOe({register:e,control:t,data:{source:n,target:r,config:s}}){return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(Nn,{label:"Target mapping",...e("config.mappedBy"),placeholder:r}),p.jsx(zx,{label:"Cardinality",name:"config.sourceCardinality",control:t,placeholder:"n"}),p.jsx(zx,{label:"WITH limit",name:"config.with_limit",control:t,placeholder:String(_c.DEFAULTS.with_limit)})]}),p.jsx("div",{}),p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(Nn,{label:"Source mapping",...e("config.inversedBy"),placeholder:n}),p.jsx(Wa,{label:"Required",...e("config.required")})]})]}),n&&r&&s&&p.jsx(Q1,{children:p.jsxs(p.Fragment,{children:[p.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[p.jsx(cp,{className:"size-4"}),n,".",s.mappedBy||r,"_id ","→"," ",r]}),p.jsxs("p",{children:["Many ",p.jsx(Jt,{children:n})," will each have one reference to ",p.jsx(Jt,{children:r}),"."]}),p.jsxs("p",{children:["A property ",p.jsxs(Jt,{children:[s.mappedBy||r,"_id"]})," will be added to"," ",p.jsx(Jt,{children:n})," (which references ",p.jsx(Jt,{children:r}),")."]}),p.jsxs("p",{children:["When creating ",p.jsx(Jt,{children:n}),", a reference to ",p.jsx(Jt,{children:r})," is"," ",p.jsx("i",{children:s.required?"required":"optional"}),"."]}),s.sourceCardinality?p.jsxs("p",{children:[p.jsx(Jt,{children:r})," should not have more than"," ",p.jsx(Jt,{children:s.sourceCardinality})," referencing entr",s.sourceCardinality===1?"y":"ies"," to ",p.jsx(Jt,{children:n}),"."]}):null]})})]})}function XOe({register:e,control:t,data:{source:n,target:r,config:{mappedBy:s,required:i}}}){return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(Nn,{label:"Target mapping",...e("config.mappedBy"),placeholder:r}),p.jsx(Wa,{label:"Required",...e("config.required")})]}),p.jsx("div",{}),p.jsx("div",{className:"flex flex-col gap-4",children:p.jsx(Nn,{label:"Source mapping",...e("config.inversedBy"),placeholder:n})})]}),n&&r&&p.jsx(Q1,{children:p.jsxs(p.Fragment,{children:[p.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[p.jsx(cp,{className:"size-4"}),n,".",s||r,"_id ","↔"," ",r]}),p.jsxs("p",{children:["A single entry of ",p.jsx(Jt,{children:n})," will have a reference to"," ",p.jsx(Jt,{children:r}),"."]}),p.jsxs("p",{children:["A property ",p.jsxs(Jt,{children:[s||r,"_id"]})," will be added to"," ",p.jsx(Jt,{children:n})," (which references ",p.jsx(Jt,{children:r}),")."]}),p.jsxs("p",{children:["When creating ",p.jsx(Jt,{children:n}),", a reference to ",p.jsx(Jt,{children:r})," is"," ",p.jsx("i",{children:i?"required":"optional"}),"."]})]})})]})}function KOe({register:e,control:t,data:{source:n,target:r,config:s}}){const i=s.connectionTable?s.connectionTable:n&&r?`${n}_${r}`:"";return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[p.jsx("div",{className:"flex flex-col gap-4"}),p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(Nn,{label:"Connection Table",...e("config.connectionTable"),placeholder:i}),p.jsx(Nn,{label:"Connection Mapping",...e("config.connectionTableMappedName"),placeholder:i})]}),p.jsx("div",{className:"flex flex-col gap-4"})]}),n&&r&&p.jsx(Q1,{children:p.jsxs(p.Fragment,{children:[p.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[p.jsx(cp,{className:"size-4"}),n," ","→"," ",i," ","←"," ",r]}),p.jsxs("p",{children:["Many ",p.jsx(Jt,{children:n})," will have many ",p.jsx(Jt,{children:r}),"."]}),p.jsxs("p",{children:["A connection table ",p.jsx(Jt,{children:i})," will be created to store the relations."]})]})})]})}function QOe({register:e,control:t,data:{type:n,source:r,target:s,config:i}}){return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[p.jsx("div",{className:"flex flex-col gap-4",children:p.jsx(Nn,{label:"Target mapping",...e("config.mappedBy"),placeholder:s})}),p.jsx("div",{}),p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(Nn,{label:"Source mapping",...e("config.inversedBy"),placeholder:r}),p.jsx(zx,{label:"Cardinality",name:"config.targetCardinality",control:t,placeholder:"n"})]})]},n),r&&s&&p.jsx(Q1,{children:p.jsxs(p.Fragment,{children:[p.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[p.jsx(cp,{className:"size-4"}),r," ","←"," ",s]}),p.jsxs("p",{children:[p.jsx(Jt,{children:r})," will have many ",p.jsx(Jt,{children:s}),"."]}),p.jsxs("p",{children:[p.jsx(Jt,{children:s})," will get additional properties ",p.jsx(Jt,{children:"reference"})," and"," ",p.jsx(Jt,{children:"entity_id"})," to make the (polymorphic) reference."]}),i.targetCardinality?p.jsxs("p",{children:[p.jsx(Jt,{children:r})," should not have more than"," ",p.jsx(Jt,{children:i.targetCardinality})," reference",i.targetCardinality===1?"":"s"," to ",p.jsx(Jt,{children:s}),"."]}):null]})})]})}function BT({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,...o}){const{field:{value:a,onChange:c,...u}}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsx(Co,{value:a,onChange:f=>{c(f),i==null||i(f)},...u,...o})}function ZOe({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,...o}){var h;const{field:{value:a,onChange:c,...u},fieldState:f}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsx(Jw,{value:a,onChange:m=>{c(m),i==null||i(m)},error:(h=f.error)==null?void 0:h.message,...u,...o})}BT.Group=ZOe;BT.Item=Co;const GD=Qe({entity:Zu,cardinality_type:xe({enum:["single","multiple"],default:"multiple"}),cardinality:Rt({minimum:1}).optional(),name:Zu});function eje(){var j,A,$,R;const{stepBack:e,setState:t,state:n,path:r,nextStep:s}=Ed(),{register:i,handleSubmit:o,formState:{isValid:a,errors:c},watch:u,control:f}=Za({mode:"onChange",resolver:el(GD),defaultValues:GD.template(n.initial??{})}),[h,m]=w.useState(!1),{config:y}=Tt(),v=y.media.enabled??!1,x=y.media.entity_name??"media",E=sn(y.data.entities??{},(M,D)=>D!==x?M:void 0),N=u(),_=Object.keys(((A=(j=y.data.entities)==null?void 0:j[N.entity])==null?void 0:A.fields)??{});w.useEffect(()=>{m(_.includes(N.name))},[_,N.name]);async function C(){if(a&&!h){const{field:M,relation:D}=tje(x,N);t(P=>({...P,fields:{create:[M]},relations:{create:[D]}})),s("create")()}}return p.jsxs(p.Fragment,{children:[!v&&p.jsx("div",{className:"px-5 py-4 bg-red-100 text-red-900",children:"Media is not enabled in the configuration. Please enable it to use this template."}),p.jsxs("form",{onSubmit:o(C),children:[p.jsx(wd,{children:p.jsxs("div",{className:"flex flex-col gap-6",children:[p.jsx(ja,{name:"entity",allowDeselect:!1,control:f,size:"md",label:"Choose which entity to add media to",required:!0,data:Object.entries(E).map(([M,D])=>{var P;return{value:M,label:((P=D.config)==null?void 0:P.name)??M}})}),p.jsx(BT.Group,{name:"cardinality_type",control:f,label:"How many items can be attached?",size:"md",children:p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsx(Co,{label:"Multiple items",value:"multiple"}),p.jsx(Co,{label:"Single item",value:"single"})]})}),N.cardinality_type==="multiple"&&p.jsx(zx,{name:"cardinality",control:f,size:"md",label:"How many exactly?",placeholder:"n",description:"Leave empty for unlimited",inputWrapperOrder:["label","input","description","error"]}),p.jsx(Nn,{size:"md",label:"Set a name for the property",required:!0,description:`A virtual property will be added to ${N.entity?N.entity:"the entity"}.`,...i("name"),error:($=c.name)!=null&&$.message?(R=c.name)==null?void 0:R.message:h?`Property "${N.name}" already exists on entity ${N.entity}`:void 0})]})}),p.jsx(Sd,{next:{type:"submit",disabled:!a||!v||h},prev:{onClick:e},debug:{state:n,path:r,data:N}})]})]})}function tje(e,t){const n={name:t.name,entity:t.entity,field:{type:"media",config:{required:!1,fillable:["update"],hidden:!1,mime_types:[],virtual:!0,entity:t.entity}}},r={type:"poly",source:t.entity,target:e,config:{mappedBy:t.name,targetCardinality:t.cardinality_type==="single"?1:void 0}};return t.cardinality_type==="multiple"?t.cardinality&&t.cardinality>1&&(n.field.config.max_items=t.cardinality,r.config.targetCardinality=t.cardinality):(n.field.config.max_items=1,r.config.targetCardinality=1),{field:n,relation:r}}const nje={id:"template-media",title:"Attach Media",description:"Attach media to an entity",Icon:Uy},MH=[[eje,nje]];function rje(){const{nextStep:e,stepBack:t,state:n,path:r,setState:s}=Ed(),i=n.action??null;function o(a){if(i===a){e(a)();return}s({action:a})}return p.jsxs(p.Fragment,{children:[p.jsxs(wd,{children:[p.jsx("p",{children:"Choose what type to add."}),p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsx(l_,{Icon:d1e,title:"Entity",description:"Create a new entity with fields",onClick:()=>o("entity"),selected:i==="entity"}),p.jsx(l_,{Icon:sT,title:"Relation",description:"Create a new relation between entities",onClick:()=>o("relation"),selected:i==="relation"})]}),p.jsxs("div",{className:"flex flex-col gap-2 mt-3",children:[p.jsx("h3",{className:"font-bold",children:"Quick templates"}),p.jsx("div",{className:"grid grid-cols-2 gap-3",children:MH.map(([,a])=>p.jsx(l_,{compact:!0,Icon:Uy,title:a.title,description:a.description,onClick:()=>o(a.id),selected:i===a.id},a.id))})]})]}),p.jsx(Sd,{next:{onClick:i&&e(i),disabled:!i},prev:{onClick:t},prevLabel:"Cancel",debug:{state:n,path:r}})]})}const l_=({Icon:e,title:t,description:n,onClick:r,selected:s,compact:i=!1,disabled:o=!1})=>p.jsxs("div",{onClick:o!==!0?r:void 0,className:Ue("flex gap-3 border border-primary/10 rounded cursor-pointer",i?"flex-row p-4 items-center":"flex-col p-5",s?"bg-primary/10 border-primary/50":"hover:bg-primary/5",o&&"opacity-50"),children:[p.jsx(e,{className:"size-10"}),p.jsxs("div",{className:"flex flex-col leading-tight",children:[p.jsx("p",{className:"text-lg font-bold",children:t}),p.jsx("p",{children:n})]})]});function zT({context:e,id:t,innerProps:{initialPath:n=[],initialState:r}}){const[s,i]=w.useState(n);function o(){e.closeModal(t)}return p.jsxs(KU,{path:s,lastBack:o,initialPath:n,initialState:r,children:[p.jsxs(xu,{id:"select",children:[p.jsx(vu,{path:["Create New"],onClose:o}),p.jsx(rje,{})]}),p.jsxs(xu,{id:"entity",path:["action"],children:[p.jsx(vu,{path:["Create New","Entity"],onClose:o}),p.jsx(nEe,{})]}),p.jsxs(xu,{id:"entity-fields",path:["action","entity"],children:[p.jsx(vu,{path:["Create New","Entity","Fields"],onClose:o}),p.jsx(WOe,{})]}),p.jsxs(xu,{id:"relation",path:["action"],children:[p.jsx(vu,{path:["Create New","Relation"],onClose:o}),p.jsx(YOe,{})]}),p.jsxs(xu,{id:"create",path:["action"],children:[p.jsx(vu,{path:["Create New","Creation"],onClose:o}),p.jsx($Se,{})]}),MH.map(([a,c])=>p.jsxs(xu,{id:c.id,path:["action"],children:[p.jsx(vu,{path:["Create New","Template",c.title],onClose:o}),p.jsx(a,{})]},c.id))]})}zT.defaultTitle=void 0;zT.modalProps={withCloseButton:!1,size:"xl",padding:0};function VT({innerProps:e}){const{data:t,...n}=e,r=sn(t,(o,a)=>typeof o=="object"&&"label"in o?o:{label:p.jsx("span",{className:"font-mono",children:a}),value:o,expand:10,showCopy:!0,...n}),s=Object.keys(r).length;function i({value:o,label:a,className:c,...u}){return p.jsx(ui,{json:o,className:hn("text-sm",c),...u})}return p.jsx("div",{className:"bg-background",children:s>1?p.jsxs(bn,{defaultValue:Object.keys(r)[0],children:[p.jsx("div",{className:"sticky top-0 bg-background z-10",children:p.jsx(bn.List,{children:Object.entries(r).map(([o,a])=>p.jsx(bn.Tab,{value:o,children:a.label},o))})}),Object.entries(r).map(([o,a])=>p.jsx(bn.Panel,{value:o,children:i(a)},o))]}):i({...r[Object.keys(r)[0]],title:r[Object.keys(r)[0]].label})})}VT.defaultTitle=!1;VT.modalProps={withCloseButton:!1,size:"lg",classNames:{body:"!p-0"}};function UT({context:e,id:t,innerProps:{schema:n,uiSchema:r,onSubmit:s,autoCloseAfterSubmit:i}}){const[o,a]=w.useState(!1),c=w.useRef(null),[u,f]=w.useState(!1),h=w.useRef(!1),[m,y]=w.useState();function v(N,_){const C=_();console.log("Data changed",N,C),a(C)}function x(){e.closeModal(t)}async function E(){var N,_;h.current=!0,(N=c.current)!=null&&N.validateForm()&&(f(!0),await(s==null?void 0:s((_=c.current)==null?void 0:_.formData(),{close:x,setError:y})),f(!1),i!==!1&&x())}return p.jsxs(p.Fragment,{children:[m&&p.jsx(xo.Exception,{message:m}),p.jsxs("div",{className:"pt-3 pb-3 px-4 gap-4 flex flex-col",children:[p.jsx(hp,{tagName:"form",ref:c,schema:JSON.parse(JSON.stringify(n)),uiSchema:r,className:"legacy hide-required-mark fieldset-alternative mute-root",onChange:v,onSubmit:E}),p.jsxs("div",{className:"flex flex-row justify-end gap-2",children:[p.jsx(ot,{onClick:x,children:"Cancel"}),p.jsx(ot,{variant:"primary",onClick:E,disabled:!o||u,children:"Create"})]})]})]})}UT.defaultTitle="JSON Schema Form Modal";UT.modalProps={size:"md",classNames:{root:"bknd-admin",header:"!bg-lightest !py-3 px-5 !h-auto !min-h-px",content:"rounded-lg select-none",title:"!font-bold !text-md",body:"!p-0"}};function qT({context:e,id:t,innerProps:n}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{children:n.modalBody}),p.jsx("button",{onClick:()=>e.closeModal(t),children:"Close modal"})]})}qT.defaultTitle="Test Modal";qT.modalProps={classNames:{size:"md",root:"bknd-admin",header:"!bg-primary/5 border-b border-b-muted !py-3 px-5 !h-auto !min-h-px",content:"rounded-lg select-none",title:"font-bold !text-md",body:"py-3 px-5 gap-4 flex flex-col"}};const sje={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0.9)"},transitionProperty:"transform, opacity"},ije=e=>{const[t,n]=w.useState(),r=Do(e==null?void 0:e.baseUrl);return w.useEffect(()=>{(async()=>{const s=await r.auth.strategies();s.res.ok&&n(s.body)})()},[e==null?void 0:e.baseUrl]),{strategies:t==null?void 0:t.strategies,basepath:t==null?void 0:t.basepath,loading:!t}};function kH(e,t){const n=(e==null?void 0:e.tagName.toLowerCase())??"",r=["input","select","textarea"];return!e||!(t!=null&&t.contains(e))||!r.includes(n)||!("name"in e)||e.hasAttribute("data-ignore")||e.closest("[data-ignore]")}function oje(e){const t=e.currentTarget,n=e.target;return kH(n,t)?null:n}function aje(e,t){const n=e.querySelectorAll(`[name="${t}"]`);return Array.from(n).filter(r=>kH(r))}function lje(e,t){if(!e)return t;const n=e.required;if(!(!t&&!n))if(e.type==="number"){const r=Number(t);if(Number.isNaN(r)&&!n)return;const s="min"in e&&e.min.length>0?Number(e.min):void 0,i="max"in e&&e.max.length>0?Number(e.max):void 0,o="step"in e&&e.step.length>0?Number(e.step):void 0;return s&&r<s?s:i&&r>i?i:o&&o!==1?Math.round(r/o)*o:r}else if(e.type==="text"){const r="maxLength"in e&&e.maxLength>-1?Number(e.maxLength):void 0,s="pattern"in e?new RegExp(e.pattern):void 0;return r&&t.length>r?t.slice(0,r):s&&!s.test(t)?"":t}else return e.type==="checkbox"?"checked"in e?!!e.checked:["on","1","true",1,!0].includes(t):t}function LO(e,t){if(!e)return e;const n=[null,void 0,""],r={empty:(t==null?void 0:t.empty)??n,emptyInArray:(t==null?void 0:t.emptyInArray)??n,keepEmptyArray:(t==null?void 0:t.keepEmptyArray)??!1};return Object.entries(e).reduce((s,[i,o])=>{if(o&&Array.isArray(o)&&o.some(a=>typeof a=="object")){const a=o.map(c=>LO(c,r));(a.length>0||r!=null&&r.keepEmptyArray)&&(s[i]=a)}else if(o&&typeof o=="object"&&!Array.isArray(o)){const a=LO(o,r);Object.keys(a).length>0&&(s[i]=a)}else if(Array.isArray(o)){const a=o.filter(c=>!r.emptyInArray.includes(c));(a.length>0||r!=null&&r.keepEmptyArray)&&(s[i]=a)}else r.empty.includes(o)||(s[i]=o);return s},{})}function IH(e,t,n){let r=t;if(typeof r=="string"){const o=a=>a[0]==='"'&&a.at(-1)==='"';r=r.split(/[.\[\]]+/).filter(a=>a).map(a=>Number.isNaN(Number(a))?a:Number(a)).map(a=>typeof a=="string"&&o(a)?a.slice(1,-1):a)}if(r.length===0)throw new Error("The path must have at least one entry in it");const[s,...i]=r;return i.length===0?(e[s]=n,e):(s in e||(e[s]=typeof i[0]=="number"?[]:{}),IH(e[s],i,n),e)}function cje({children:e,validateOn:t="submit",hiddenSubmit:n=!1,errorFieldSelector:r,reportValidity:s,onSubmit:i,onSubmitInvalid:o,onError:a,clean:c,disableSubmitOnError:u=!0,...f}){const h=w.useRef(null),[m,y]=w.useState([]);w.useEffect(()=>{!h.current||f.noValidate||x()},[]),w.useEffect(()=>{if(!h.current||f.noValidate)return;const j=m.length>0;h.current.querySelectorAll("[type=submit]").forEach(A=>{!A||!("type"in A)||A.type!=="submit"||(A.disabled=j)}),a==null||a(m)},[m]);const v=(j,A)=>{var R;if(f.noValidate||!j||!("name"in j))return;const $=(R=h.current)==null?void 0:R.querySelector((r==null?void 0:r(j.name))??`[data-role="input-error"][data-name="${j.name}"]`);if(j.checkValidity())y(M=>M.filter(D=>D.name!==j.name)),$&&($.textContent="");else{const M={name:j.name,message:j.validationMessage};return y(D=>[...D.filter(P=>P.name!==j.name),M]),A!=null&&A.report&&($?$.textContent=M.message:s&&j.reportValidity()),M}},x=j=>{if(!h.current||f.noValidate)return[];const A=[];return h.current.querySelectorAll("input, select, textarea").forEach($=>{const M=v($,j);M&&A.push(M)}),u&&h.current.querySelectorAll("[type=submit]").forEach($=>{A.length>0?$.setAttribute("disabled","disabled"):$.removeAttribute("disabled")}),A},E=()=>{if(!h.current)return{};const j=new FormData(h.current),A={};return j.forEach(($,R)=>{const M=aje(h.current,R);if(M.length===0){console.warn(`No target found for key: ${R}`);return}const P=M.length>1;M.forEach((F,V)=>{let H=R;P&&(H=`${R}[${V}]`),IH(A,H,lje(F,F.value))})}),typeof c>"u"?A:LO(A,c===!0?void 0:c)},N=async j=>{if(!h.current)return;const $=oje(j);$&&((t==="change"||m.length>0)&&v($,{report:!0}),f.onChange&&await f.onChange(E(),{event:j,key:$.name,value:$.value,errors:m}))},_=async j=>{j.preventDefault();const A=h.current;if(!A)return;const $=x({report:!0});if($.length>0){o==null||o($,{event:j});return}i?await i(E(),{event:j}):A.submit()},C=j=>{h.current&&j.keyCode===13&&m.length>0&&!f.noValidate&&s&&h.current.reportValidity()};return p.jsxs("form",{...f,onChange:N,onSubmit:_,ref:h,onKeyDown:C,children:[e,n&&p.jsx("input",{type:"submit",style:{visibility:"hidden"}})]})}function uje({label:e,provider:t,icon:n,action:r,method:s="POST",basepath:i="/api/auth",children:o}){const a=[i,t,r].join("/");return p.jsxs("form",{method:s,action:a,className:"w-full",children:[p.jsxs(ot,{type:"submit",size:"large",variant:"outline",className:"justify-center w-full",IconLeft:n,children:["Continue with ",e??Cy(t)]}),o]})}function dje({formData:e,className:t,method:n="POST",action:r,auth:s,buttonLabel:i=r==="login"?"Sign in":"Sign up",...o}){var h,m;const a=(s==null?void 0:s.basepath)??"/api/auth",c={action:`${a}/password/${r}`,strategy:((h=s==null?void 0:s.strategies)==null?void 0:h.password)??{}},u=Zs((s==null?void 0:s.strategies)??{},(y,v,x)=>{v.type!=="password"&&(y[x]=v.config)},{}),f=Object.keys(u).length>0;return p.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[f&&p.jsxs(p.Fragment,{children:[p.jsx("div",{children:(m=Object.entries(u))==null?void 0:m.map(([y,v],x)=>p.jsx(uje,{provider:y,method:n,basepath:a,action:r},x))}),p.jsx(fje,{})]}),p.jsxs(cje,{method:n,action:c.action,...o,validateOn:"change",className:hn("flex flex-col gap-3 w-full",t),children:[p.jsxs(Ji,{children:[p.jsx(Ao,{htmlFor:"email",children:"Email address"}),p.jsx(Bc,{type:"email",name:"email",required:!0})]}),p.jsxs(Ji,{children:[p.jsx(Ao,{htmlFor:"password",children:"Password"}),p.jsx(jH,{name:"password",required:!0,minLength:8})]}),p.jsx(ot,{type:"submit",variant:"primary",size:"large",className:"w-full mt-2 justify-center",children:i})]})]})}const fje=()=>p.jsxs("div",{className:"w-full flex flex-row items-center",children:[p.jsx("div",{className:"relative flex grow",children:p.jsx("div",{className:"h-px bg-primary/10 w-full absolute top-[50%] z-0"})}),p.jsx("div",{className:"mx-5",children:"or"}),p.jsx("div",{className:"relative flex grow",children:p.jsx("div",{className:"h-px bg-primary/10 w-full absolute top-[50%] z-0"})})]});function hje({method:e="POST",action:t="login",logo:n,intro:r,formOnly:s}){const{strategies:i,basepath:o,loading:a}=ije(),c=p.jsx(dje,{auth:{basepath:o,strategies:i},method:e,action:t});return s?a?null:c:p.jsx("div",{className:"flex flex-1 flex-col select-none h-dvh w-dvw justify-center items-center bknd-admin",children:!a&&p.jsxs("div",{className:"flex flex-col gap-4 items-center w-96 px-6 py-7",children:[n||null,w.isValidElement(r)?r:p.jsxs("div",{className:"flex flex-col items-center",children:[p.jsxs("h1",{className:"text-xl font-bold",children:["Sign ",t==="login"?"in":"up"," to your admin panel"]}),p.jsx("p",{className:"text-primary/50",children:"Enter your credentials below to get access."})]}),c]})})}const DH={Screen:hje};function pje(){const e=w.useRef(0);return e.current++,e.current}const mje=[".DS_Store","Thumbs.db"];function Qy(e,t){const n=gje(e);if(typeof n.path!="string"){const{webkitRelativePath:r}=e;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function gje(e){const{name:t}=e,n=t&&t.lastIndexOf(".")!==-1;if(console.log("withMimeType",t,n),n&&!e.type){const r=kL(t);console.log("guessed",r),r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}async function Hb(e){return Vx(e)&&yje(e.dataTransfer)?wje(e.dataTransfer,e.type):bje(e)?vje(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?xje(e):[]}function yje(e){return Vx(e)}function bje(e){return Vx(e)&&Vx(e.target)}function Vx(e){return typeof e=="object"&&e!==null}function vje(e){return FO(e.target.files).map(t=>Qy(t))}async function xje(e){return(await Promise.all(e.map(n=>n.getFile()))).map(n=>Qy(n))}async function wje(e,t){if(e.items){const n=FO(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const r=await Promise.all(n.map(Sje));return YD(PH(r))}return YD(FO(e.files).map(n=>Qy(n)))}function YD(e){return e.filter(t=>mje.indexOf(t.name)===-1)}function FO(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function Sje(e){if(typeof e.webkitGetAsEntry!="function")return JD(e);const t=e.webkitGetAsEntry();return t!=null&&t.isDirectory?LH(t):JD(e)}function PH(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?PH(n):[n]],[])}function JD(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=Qy(t);return Promise.resolve(n)}async function Eje(e){return e.isDirectory?LH(e):Nje(e)}function LH(e){const t=e.createReader();return new Promise((n,r)=>{const s=[];function i(){t.readEntries(async o=>{if(o.length){const a=Promise.all(o.map(Eje));s.push(a),i()}else try{const a=await Promise.all(s);n(a)}catch(a){r(a)}},o=>{r(o)})}i()})}async function Nje(e){return new Promise((t,n)=>{e.file(r=>{const s=Qy(r,e.fullPath);t(s)},r=>{n(r)})})}const BO={enter:["dragenter","dragover","dragstart"],leave:["dragleave","drop"]},XD=[...BO.enter,...BO.leave];function _je({onDropped:e,onOver:t,onLeave:n}){const[r,s]=w.useState(!1),i=w.useRef(null),o=w.useRef(!1),a=w.useCallback(h=>{h.preventDefault(),h.stopPropagation()},[]),c=w.useCallback(async h=>{const m=BO.enter.includes(h.type);t&&m!==r&&!o.current&&(t(await Hb(h),h),o.current=!0),s(m),m===!1&&o.current&&(o.current=!1,n==null||n())},[]),u=w.useCallback(async h=>{const m=await Hb(h);e==null||e(m),o.current=!1},[e]),f=w.useCallback(async h=>{const m=await Hb(h);e==null||e(m)},[e]);return w.useEffect(()=>{const h=i.current;return XD.forEach(m=>{h.addEventListener(m,a),h.addEventListener(m,c)}),h.addEventListener("drop",u),()=>{XD.forEach(m=>{h.removeEventListener(m,a),h.removeEventListener(m,c)}),h.removeEventListener("drop",u)}},[]),{ref:i,isOver:r,fromEvent:Hb,onDropped:e,handleFileInputChange:f}}function Cje(e,t={overrides:{},baseUrl:""}){return{body:`${t.baseUrl}/api/media/file/${e.path}`,path:e.path,name:e.path,size:e.size??0,type:e.mime_type??"",state:"uploaded",progress:0,...t.overrides}}function Oje(e,t={overrides:{},baseUrl:""}){return e.map(n=>Cje(n,t))}function KD({maxItems:e,current:t=0,overwrite:n,added:r}){if(!e)return{reject:!1,to_drop:0};const s=e-t,i=r>s?r:r-s>0?r-s:0;return{reject:n?r>e:s-r<0,to_drop:i}}const jje=()=>X$(k1({files:[],isOver:!1,isOverAccepted:!1,uploading:!1},(e,t)=>({setFiles:n=>e(({files:r})=>({files:n(r)})),getFilesLength:()=>t().files.length,setIsOver:(n,r)=>e({isOver:n,isOverAccepted:r}),setUploading:n=>e({uploading:n}),setIsOverAccepted:n=>e({isOverAccepted:n}),reset:()=>e({files:[],isOver:!1,isOverAccepted:!1}),addFile:n=>e(r=>({files:[...r.files,n]})),removeFile:n=>e(r=>({files:r.files.filter(s=>s.path!==n)})),removeAllFiles:()=>e({files:[]}),setFileProgress:(n,r)=>e(s=>({files:s.files.map(i=>i.path===n?{...i,progress:r}:i)})),setFileState:(n,r,s)=>e(i=>({files:i.files.map(o=>o.path===n?{...o,state:r,progress:s??o.progress}:o)}))})));function Aje(e){if(e&&e instanceof XMLHttpRequest){const t=JSON.parse(e.responseText);alert(`Upload failed with code ${e.status}: ${t.error}`)}else alert("Upload failed")}function $je({getUploadInfo:e,handleDelete:t,initialItems:n=[],flow:r="start",allowedMimeTypes:s,maxItems:i,overwrite:o,autoUpload:a,placeholder:c,onRejected:u,onDeleted:f,onUploadedAll:h,onUploaded:m,children:y,onClick:v,footer:x}){const E=w.useRef(jje()).current,N=Xr(E,k=>k.files),_=Xr(E,k=>k.setFiles),C=Xr(E,k=>k.getFilesLength),j=Xr(E,k=>k.setUploading),A=Xr(E,k=>k.setIsOver),$=Xr(E,k=>k.uploading),R=Xr(E,k=>k.setFileState),M=Xr(E,k=>k.removeFile),D=w.useRef(null);w.useEffect(()=>{_(()=>n)},[n.length]);function P(k){return(Array.isArray(k)?k:[k]).map(ne=>({kind:"kind"in ne?ne.kind:"file",type:ne.type,size:"size"in ne?ne.size:0})).every(ne=>ne.kind!=="file"?!1:!(s&&!s.includes(ne.type)))}const F=w.useCallback(k=>{if(console.log("onDropped",k),!P(k))return;const W=k.length;_(X=>{let ne=0;if(i){const ue=KD({maxItems:i,overwrite:o,added:W,current:X.length});if(ue.reject)return u?u(k):console.warn("maxItems reached"),X;ne=ue.to_drop}const re=X.slice(ne),se=re.map(ue=>ue.path),fe=k.filter(ue=>!("path"in ue)||ue.path&&!se.includes(ue.path)).map(ue=>({body:ue,path:"path"in ue?ue.path:ue.name,name:ue.name,size:ue.size,type:ue.type,state:"pending",progress:0})),he=r==="start"?[...fe,...re]:[...re,...fe];return a&&fe.length>0&&setTimeout(()=>j(!0),0),he})},[a,r,i,o]),{handleFileInputChange:V,ref:H}=_je({onDropped:k=>{console.log("onDropped",k),F(k)},onOver:k=>{if(!P(k)){A(!0,!1);return}const W=C(),X=KD({maxItems:i,overwrite:o,added:k.length,current:W});console.log("--files in onOver",W,X),A(!0,!X.reject)},onLeave:()=>{A(!1,!1)}});w.useEffect(()=>{console.log("files updated")},[N]),w.useEffect(()=>{$&&(async()=>{const k=N.filter(W=>W.state==="pending");if(k.length===0){j(!1);return}else{const W=[];for(const X of k)try{const ne=await I(X);W.push(ne),m==null||m(ne)}catch(ne){Aje(ne)}j(!1),h==null||h(W)}})()},[$]);function I(k){return new Promise((W,X)=>{if(k.body){if(k.state!=="pending"){console.error("File is not pending"),X();return}else if(!(k.body instanceof File)){console.error("File body is not a File instance"),X();return}}else{console.error("File has no body"),X();return}const ne=e({path:k.body.path});console.log("dropzone:uploadInfo",ne);const{url:re,headers:se,method:fe="POST"}=ne,he=new XMLHttpRequest;console.log("xhr:url",re);const ue=new URLSearchParams;o&&ue.append("overwrite","1"),he.open(fe,String(re)+"?"+String(ue),!0),se&&se.forEach((ve,Se)=>{he.setRequestHeader(Se,ve)}),he.upload.addEventListener("progress",ve=>{if(console.log("progress",ve.loaded,ve.total),ve.lengthComputable){R(k.path,"uploading",ve.loaded/ve.total);const Se=ve.loaded/ve.total*100;console.log(`Progress: ${Se.toFixed(2)}%`)}else console.log("Unable to compute progress information since the total size is unknown")}),he.onload=()=>{if(console.log("onload",k.path,he.status),he.status>=200&&he.status<300){console.log("Upload complete");try{const ve=JSON.parse(he.responseText);console.log("Response:",k,ve);const Se={...ve.state,progress:1,state:"uploaded"};R(k.path,Se.state),W({...ve,...k,...Se})}catch(ve){R(k.path,"uploaded",1),console.error("Error parsing response",ve),X(ve)}}else R(k.path,"failed",1),console.error("Upload failed with status: ",he.status,he.statusText),X(he)},he.onerror=()=>{console.error("Error during the upload process.")},he.onloadstart=()=>{R(k.path,"uploading",0),console.log("loadstart")},he.setRequestHeader("Accept","application/json"),he.send(k.body)})}const B=w.useCallback(async k=>{switch(console.log("deleteFile",k),k.state){case"uploaded":case"initial":window.confirm("Are you sure you want to delete this file?")&&(console.log('setting state to "deleting"',k),R(k.path,"deleting"),await t(k),M(k.path),f==null||f(k));break}},[]),T=w.useCallback(async k=>{const W=await I(k);h==null||h([W]),m==null||m(W)},[]),L=w.useCallback(()=>{var k;return(k=D.current)==null?void 0:k.click()},[D]),z=w.useMemo(()=>!!((c==null?void 0:c.show)===!0||!i||i&&N.length<i),[c,i,N.length]),q=w.useMemo(()=>({store:E,wrapperRef:H,inputProps:{ref:D,type:"file",multiple:!i||i>1,onChange:V},showPlaceholder:z,actions:{uploadFile:T,deleteFile:B,openFileInput:L,addFiles:F},dropzoneProps:{maxItems:i,placeholder:c,autoUpload:a,flow:r},onClick:v,footer:x}),[i,r,c,a,x]);return p.jsx(FH.Provider,{value:q,children:y?typeof y=="function"?y(q):y:p.jsx(Rje,{...q})})}const FH=w.createContext(void 0);function HT(){return w.useContext(FH)}const BH=()=>{const{store:e}=HT(),t=Xr(e,i=>i.files),n=Xr(e,i=>i.isOver),r=Xr(e,i=>i.isOverAccepted),s=Xr(e,i=>i.uploading);return{files:t,isOver:n,isOverAccepted:r,uploading:s}},Zy=(e,t)=>{const{store:n}=HT();return Xr(n,r=>{const s=typeof e=="string"?r.files.find(i=>i.path===e):r.files.find(i=>i.path===e.path);return s?t(s):void 0})};function Tje(e){if(e&&e instanceof XMLHttpRequest){const t=JSON.parse(e.responseText);alert(`Upload failed with code ${e.status}: ${t.error}`)}else alert("Upload failed")}const Rje=({wrapperRef:e,inputProps:t,showPlaceholder:n,actions:{uploadFile:r,deleteFile:s,openFileInput:i},dropzoneProps:{placeholder:o,flow:a},onClick:c,footer:u})=>{const{files:f,isOver:h,isOverAccepted:m}=BH(),y=n&&p.jsx(Mje,{onClick:i,text:o==null?void 0:o.text}),v=w.useCallback(async x=>{try{return await r(x)}catch(E){Tje(E)}},[r]);return p.jsxs("div",{ref:e,className:Ue("dropzone w-full h-full align-start flex flex-col select-none",h&&m&&"bg-green-200/10",h&&!m&&"bg-red-200/40 cursor-not-allowed"),children:[p.jsx("div",{className:"hidden",children:p.jsx("input",{...t})}),p.jsx("div",{className:"flex flex-1 flex-col",children:p.jsxs("div",{className:"flex flex-row flex-wrap gap-2 md:gap-3",children:[a==="start"&&y,f.map(x=>p.jsx(Ije,{file:x,handleUpload:v,handleDelete:s,onClick:c},x.path)),a==="end"&&y,u]})})]})},Mje=({onClick:e,text:t="Upload files"})=>p.jsx("div",{className:"w-[49%] aspect-square md:w-60 flex flex-col border-2 border-dashed border-muted relative justify-center items-center text-primary/30 hover:border-primary/30 hover:text-primary/50 hover:cursor-pointer hover:bg-muted/20 transition-colors duration-200",onClick:e,children:p.jsx("span",{className:"",children:t})}),kje=({file:e,fallback:t,...n})=>e.type.startsWith("image/")?p.jsx(Fje,{...n,file:e}):e.type.startsWith("video/")?p.jsx(Bje,{...n,file:e}):t?t({file:e}):null,zH=w.memo(kje,(e,t)=>e.file.path===t.file.path),Ije=w.memo(({file:e,handleUpload:t,handleDelete:n,onClick:r})=>{pje();const s=Zy(e,o=>{const{progress:a,...c}=o;return c});if(!s)return null;const i=w.useCallback(()=>{r&&r(s)},[r,s.path]);return p.jsxs("div",{className:Ue("w-[49%] md:w-60 aspect-square flex flex-col border border-muted relative hover:bg-primary/5 cursor-pointer transition-colors",s.state==="failed"&&"border-red-500 bg-red-200/20",s.state==="deleting"&&"opacity-70"),onClick:i,children:[p.jsx("div",{className:"absolute top-2 right-2",children:p.jsx(Pje,{file:s,handleDelete:n,handleUpload:t})}),p.jsx(Dje,{file:s}),p.jsx("div",{className:"flex bg-primary/5 aspect-[1/0.78] overflow-hidden items-center justify-center",children:p.jsx(zH,{file:s,fallback:zje,className:"max-w-full max-h-full"})}),p.jsxs("div",{className:"flex flex-col px-1.5 py-1",children:[p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx("p",{className:"truncate select-text w-[calc(100%-10px)]",children:s.name}),p.jsx(Lje,{file:s})]}),p.jsxs("div",{className:"flex flex-row justify-between text-sm font-mono opacity-50 text-nowrap gap-2",children:[p.jsx("span",{className:"truncate select-text",children:s.type}),p.jsx("span",{children:HL.fileSize(s.size)})]})]})]})},(e,t)=>e.file.path===t.file.path&&e.file.state===t.file.state),Dje=({file:e})=>{const t=Zy(e.path,n=>({state:n.state,progress:n.progress}));return!t||t.state!=="uploading"?null:p.jsx("div",{className:"absolute w-full top-0 left-0 right-0 h-1",children:p.jsx("div",{className:"bg-blue-600 h-1 transition-all duration-75",style:{width:(t.progress*100).toFixed(0)+"%"}})})},Pje=w.memo(({file:e,handleDelete:t,handleUpload:n})=>{const r=Zy(e.path,i=>{const{progress:o,...a}=i;return a});if(!r)return null;const s=w.useMemo(()=>[r.state==="uploaded"&&typeof r.body=="string"&&{label:"Open",icon:C1e,onClick:()=>{window.open(r.body,"_blank")}},["initial","uploaded"].includes(r.state)&&{label:"Delete",destructive:!0,icon:BU,onClick:()=>t(r)},["initial","pending"].includes(r.state)&&{label:"Upload",icon:L1e,onClick:()=>n(r)}],[r,t,n]);return p.jsx(Ur,{items:s,position:"bottom-end",children:p.jsx(St,{Icon:Lc})})},(e,t)=>e.file.path===t.file.path),Lje=({file:e})=>{const t=Zy(e.path,r=>r.state);if(!t||t==="uploaded")return null;const n={failed:"bg-red-500",deleting:"bg-orange-500 animate-pulse",uploading:"bg-blue-500 animate-pulse"}[t]??"bg-primary/50";return p.jsx("div",{className:"w-2 h-2 rounded-full mt-px "+n,title:t})},Fje=({file:e,...t})=>{const n=typeof e.body=="string"?e.body:URL.createObjectURL(e.body);return p.jsx("img",{...t,src:n})},Bje=({file:e,...t})=>{const n=typeof e.body=="string"?e.body:URL.createObjectURL(e.body);return p.jsx("video",{...t,src:n})},zje=({file:e})=>p.jsx("div",{className:"text-xs text-primary/50 text-center",children:e.type});function Vje({initialItems:e,media:t,entity:n,query:r,randomFilename:s,infinite:i=!1,...o}){var A,$;const a=w.useId(),c=Do(),u=z$(),f=c.baseUrl,h=(r==null?void 0:r.limit)??o.maxItems??50,m=R=>({limit:h,offset:R*h}),y=(t==null?void 0:t.entity_name)??"media",v=(R,M=0)=>n?R.data.readManyByReference(n.name,n.id,n.field,{...m(M),...r}):R.data.readMany(y,{...m(M),...r}),x=i?Kbe(v,{}):$1(v,{enabled:e!==!1&&!e,revalidateOnFocus:!1}),E=Lt(R=>({url:n?c.media.getEntityUploadUrl(n.name,n.id,n.field):c.media.getFileUploadUrl(s?void 0:R),headers:c.media.getUploadHeaders(),method:"POST"}));Lt(async()=>{await u(x.promise.key({search:!1}))});const N=Lt(async R=>c.media.deleteFile(R.path)),_=e??(Array.isArray(x.data)?x.data:[])??[],C=Oje(_,{baseUrl:f}),j=a+JSON.stringify(C);return p.jsx($je,{getUploadInfo:E,handleDelete:N,autoUpload:!0,initialItems:C,footer:i&&"setSize"in x&&p.jsx(Uje,{items:C.length,length:Math.min((($=(A=x._data)==null?void 0:A[0])==null?void 0:$.body.meta.count)??0,C.length+h),onFirstVisible:()=>x.setSize(x.size+1)}),...o},a+j)}const Uje=({items:e=0,length:t=0,onFirstVisible:n})=>{const{ref:r,inViewport:s}=hQ(),[i,o]=w.useState(0),a=w.useRef(-1);return w.useEffect(()=>{s&&e>a.current&&(a.current=e,o(u=>u+1),n())},[s]),t-e<=0?null:new Array(Math.max(t-e,0)).fill(0).map((u,f)=>p.jsx("div",{ref:f===0?r:void 0,className:"w-[49%] md:w-60 bg-muted aspect-square"},f))},WT={Dropzone:Vje,Preview:zH,useDropzone:HT,useDropzoneState:BH,useDropzoneFileState:Zy};function VH(){const{config:e,schema:t,actions:n}=Tt(),r={config:{patch:async i=>await n.set("media",i,!0)?(await n.reload(),!0):!1}};return{$media:{},config:e.media,schema:t.media,actions:r}}const zm={},QD=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,ZD=e=>"init"in e,c_=e=>!!e.write,eP=e=>"v"in e||"e"in e,Wb=e=>{if("e"in e)throw e.e;if((zm?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},Ux=new WeakMap,tP=e=>{var t;return qx(e)&&!!((t=Ux.get(e))!=null&&t[0])},qje=e=>{const t=Ux.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))},UH=(e,t)=>{let n=Ux.get(e);if(!n){n=[!0,new Set],Ux.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)},qx=e=>typeof(e==null?void 0:e.then)=="function",qH=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},u_=(e,t,n)=>{const r=n(e),s="v"in r,i=r.v;if(qx(t))for(const o of r.d.keys())qH(e,t,n(o));r.v=t,delete r.e,(!s||!Object.is(i,r.v))&&(++r.n,qx(i)&&qje(i))},nP=(e,t,n)=>{var r;const s=new Set;for(const i of((r=n.get(e))==null?void 0:r.t)||[])n.has(i)&&s.add(i);for(const i of t.p)s.add(i);return s},Hje=()=>{const e=new Set,t=()=>{e.forEach(n=>n())};return t.add=n=>(e.add(n),()=>{e.delete(n)}),t},d_=()=>{const e={},t=new WeakMap,n=r=>{var s,i;(s=t.get(e))==null||s.forEach(o=>o(r)),(i=t.get(r))==null||i.forEach(o=>o())};return n.add=(r,s)=>{const i=r||e,o=(t.has(i)?t:t.set(i,new Set)).get(i);return o.add(s),()=>{o==null||o.delete(s),o.size||t.delete(i)}},n},Wje=e=>(e.c||(e.c=d_()),e.m||(e.m=d_()),e.u||(e.u=d_()),e.f||(e.f=Hje()),e),Gje=Symbol(),Yje=(e=new WeakMap,t=new WeakMap,n=new WeakMap,r=new Set,s=new Set,i=new Set,o={},a=(m,...y)=>m.read(...y),c=(m,...y)=>m.write(...y),u=(m,y)=>{var v;return(v=m.unstable_onInit)==null?void 0:v.call(m,y)},f=(m,y)=>{var v;return(v=m.onMount)==null?void 0:v.call(m,y)},...h)=>{const m=h[0]||(R=>{if((zm?"production":void 0)!=="production"&&!R)throw new Error("Atom is undefined or null");let M=e.get(R);return M||(M={d:new Map,p:new Set,n:0},e.set(R,M),u==null||u(R,$)),M}),y=h[1]||(()=>{const R=[],M=D=>{try{D()}catch(P){R.push(P)}};do{o.f&&M(o.f);const D=new Set,P=D.add.bind(D);r.forEach(F=>{var V;return(V=t.get(F))==null?void 0:V.l.forEach(P)}),r.clear(),i.forEach(P),i.clear(),s.forEach(P),s.clear(),D.forEach(M),r.size&&v()}while(r.size||i.size||s.size);if(R.length)throw new AggregateError(R)}),v=h[2]||(()=>{const R=[],M=new WeakSet,D=new WeakSet,P=Array.from(r);for(;P.length;){const F=P[P.length-1],V=m(F);if(D.has(F)){P.pop();continue}if(M.has(F)){if(n.get(F)===V.n)R.push([F,V]);else if((zm?"production":void 0)!=="production"&&n.has(F))throw new Error("[Bug] invalidated atom exists");D.add(F),P.pop();continue}M.add(F);for(const H of nP(F,V,t))M.has(H)||P.push(H)}for(let F=R.length-1;F>=0;--F){const[V,H]=R[F];let I=!1;for(const B of H.d.keys())if(B!==V&&r.has(B)){I=!0;break}I&&(x(V),_(V)),n.delete(V)}}),x=h[3]||(R=>{var M;const D=m(R);if(eP(D)&&(t.has(R)&&n.get(R)!==D.n||Array.from(D.d).every(([L,z])=>x(L).n===z)))return D;D.d.clear();let P=!0;const F=()=>{t.has(R)&&(_(R),v(),y())},V=L=>{var z;if(QD(R,L)){const k=m(L);if(!eP(k))if(ZD(L))u_(L,L.init,m);else throw new Error("no atom init");return Wb(k)}const q=x(L);try{return Wb(q)}finally{D.d.set(L,q.n),tP(D.v)&&qH(R,D.v,q),(z=t.get(L))==null||z.t.add(R),P||F()}};let H,I;const B={get signal(){return H||(H=new AbortController),H.signal},get setSelf(){return(zm?"production":void 0)!=="production"&&!c_(R)&&console.warn("setSelf function cannot be used with read-only atom"),!I&&c_(R)&&(I=(...L)=>{if((zm?"production":void 0)!=="production"&&P&&console.warn("setSelf function cannot be called in sync"),!P)try{return N(R,...L)}finally{v(),y()}}),I}},T=D.n;try{const L=a(R,V,B);return u_(R,L,m),qx(L)&&(UH(L,()=>H==null?void 0:H.abort()),L.then(F,F)),D}catch(L){return delete D.v,D.e=L,++D.n,D}finally{P=!1,T!==D.n&&n.get(R)===T&&(n.set(R,D.n),r.add(R),(M=o.c)==null||M.call(o,R))}}),E=h[4]||(R=>{const M=[R];for(;M.length;){const D=M.pop(),P=m(D);for(const F of nP(D,P,t)){const V=m(F);n.set(F,V.n),M.push(F)}}}),N=h[5]||((R,...M)=>{let D=!0;const P=V=>Wb(x(V)),F=(V,...H)=>{var I;const B=m(V);try{if(QD(R,V)){if(!ZD(V))throw new Error("atom not writable");const T=B.n,L=H[0];u_(V,L,m),_(V),T!==B.n&&(r.add(V),(I=o.c)==null||I.call(o,V),E(V));return}else return N(V,...H)}finally{D||(v(),y())}};try{return c(R,P,F,...M)}finally{D=!1}}),_=h[6]||(R=>{var M;const D=m(R),P=t.get(R);if(P&&!tP(D.v)){for(const[F,V]of D.d)if(!P.d.has(F)){const H=m(F);C(F).t.add(R),P.d.add(F),V!==H.n&&(r.add(F),(M=o.c)==null||M.call(o,F),E(F))}for(const F of P.d||[])if(!D.d.has(F)){P.d.delete(F);const V=j(F);V==null||V.t.delete(R)}}}),C=h[7]||(R=>{var M;const D=m(R);let P=t.get(R);if(!P){x(R);for(const F of D.d.keys())C(F).t.add(R);if(P={l:new Set,d:new Set(D.d.keys()),t:new Set},t.set(R,P),(M=o.m)==null||M.call(o,R),c_(R)){const F=()=>{let V=!0;const H=(...I)=>{try{return N(R,...I)}finally{V||(v(),y())}};try{const I=f(R,H);I&&(P.u=()=>{V=!0;try{I()}finally{V=!1}})}finally{V=!1}};s.add(F)}}return P}),j=h[8]||(R=>{var M;const D=m(R);let P=t.get(R);if(P&&!P.l.size&&!Array.from(P.t).some(F=>{var V;return(V=t.get(F))==null?void 0:V.d.has(R)})){P.u&&i.add(P.u),P=void 0,t.delete(R),(M=o.u)==null||M.call(o,R);for(const F of D.d.keys()){const V=j(F);V==null||V.t.delete(R)}return}return P}),A=[e,t,n,r,s,i,o,a,c,u,f,m,y,v,x,E,N,_,C,j],$={get:R=>Wb(x(R)),set:(R,...M)=>{try{return N(R,...M)}finally{v(),y()}},sub:(R,M)=>{const P=C(R).l;return P.add(M),y(),()=>{P.delete(M),j(R),y()}}};return Object.defineProperty($,Gje,{value:A}),$},HH=Yje,Jje=Wje,rP=UH,GT={};let Xje=0;function Ih(e,t){const n=`atom${++Xje}`,r={toString(){return(GT?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=Kje,r.write=Qje),t&&(r.write=t),r}function Kje(e){return e(this)}function Qje(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const Zje=()=>{let e=0;const t=Jje({}),n=new WeakMap,r=new WeakMap,s=HH(n,r,void 0,void 0,void 0,void 0,t,void 0,(a,c,u,...f)=>e?u(a,...f):a.write(c,u,...f)),i=new Set;return t.m.add(void 0,a=>{i.add(a);const c=n.get(a);c.m=r.get(a)}),t.u.add(void 0,a=>{i.delete(a);const c=n.get(a);delete c.m}),Object.assign(s,{dev4_get_internal_weak_map:()=>n,dev4_get_mounted_atoms:()=>i,dev4_restore_atoms:a=>{const c={read:()=>null,write:(u,f)=>{++e;try{for(const[h,m]of a)"init"in h&&f(h,m)}finally{--e}}};s.set(c)}})};function eAe(){return(GT?"production":void 0)!=="production"?Zje():HH()}let Tm;function WH(){return Tm||(Tm=eAe(),(GT?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Tm),globalThis.__JOTAI_DEFAULT_STORE__!==Tm&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Tm}const tAe={},nAe=w.createContext(void 0);function GH(e){return w.useContext(nAe)||WH()}const YH=e=>typeof(e==null?void 0:e.then)=="function",rAe=e=>{e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})},sAe=Re.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(rAe(e),e)}),f_=new WeakMap,iAe=(e,t)=>{let n=f_.get(e);return n||(n=new Promise((r,s)=>{let i=e;const o=u=>f=>{i===u&&r(f)},a=u=>f=>{i===u&&s(f)},c=()=>{try{const u=t();YH(u)?(f_.set(u,n),i=u,u.then(o(u),a(u)),rP(u,c)):r(u)}catch(u){s(u)}};e.then(o(e),a(e)),rP(e,c)}),f_.set(e,n)),n};function YT(e,t){const n=GH(),[[r,s,i],o]=w.useReducer(u=>{const f=n.get(e);return Object.is(u[0],f)&&u[1]===n&&u[2]===e?u:[f,n,e]},void 0,()=>[n.get(e),n,e]);let a=r;if((s!==n||i!==e)&&(o(),a=n.get(e)),w.useEffect(()=>{const u=n.sub(e,()=>{o()});return o(),u},[n,e,void 0]),w.useDebugValue(a),YH(a)){const u=iAe(a,()=>n.get(e));return sAe(u)}return a}function JT(e,t){const n=GH();return w.useCallback((...s)=>{if((tAe?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...s)},[n,e])}function yp(e,t){return[YT(e),JT(e)]}const XT={},oAe=Symbol((XT?"production":void 0)!=="production"?"RESET":""),h_=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),aAe=new WeakMap,lAe=(e,t,n,r)=>{const s=h_(()=>new WeakMap,aAe,t),i=h_(()=>new WeakMap,s,n);return h_(e,i,r)};function e0(e,t,n=Object.is){return lAe(()=>{const r=Symbol(),s=([o,a])=>{if(a===r)return t(o);const c=t(o,a);return n(a,c)?a:c},i=Ih(o=>{const a=o(i),c=o(e);return s([c,a])});return i.init=r,i},e,t,n)}const cAe=e=>typeof(e==null?void 0:e.then)=="function";function uAe(e=()=>{try{return window.localStorage}catch(n){(XT?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},t){var n;let r,s;const i={getItem:(c,u)=>{var f,h;const m=v=>{if(v=v||"",r!==v){try{s=JSON.parse(v,t==null?void 0:t.reviver)}catch{return u}r=v}return s},y=(h=(f=e())==null?void 0:f.getItem(c))!=null?h:null;return cAe(y)?y.then(m):m(y)},setItem:(c,u)=>{var f;return(f=e())==null?void 0:f.setItem(c,JSON.stringify(u,void 0))},removeItem:c=>{var u;return(u=e())==null?void 0:u.removeItem(c)}},o=c=>(u,f,h)=>c(u,m=>{let y;try{y=JSON.parse(m||"")}catch{y=h}f(y)});let a;try{a=(n=e())==null?void 0:n.subscribe}catch{}return!a&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(a=(c,u)=>{if(!(e()instanceof window.Storage))return()=>{};const f=h=>{h.storageArea===e()&&h.key===c&&u(h.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),a&&(i.subscribe=o(a)),i}const dAe=uAe();function fAe(e,t,n=dAe,r){const s=Ih(t);return(XT?"production":void 0)!=="production"&&(s.debugPrivate=!0),s.onMount=o=>{o(n.getItem(e,t));let a;return n.subscribe&&(a=n.subscribe(e,o,t)),a},Ih(o=>o(s),(o,a,c)=>{const u=typeof c=="function"?c(o(s)):c;return u===oAe?(a(s,t),n.removeItem(e)):u instanceof Promise?u.then(f=>(a(s,f),n.setItem(e,f))):(a(s,u),n.setItem(e,u))})}const hAe={AdditionalItemsError:"Array at `{{pointer}}` may not have an additional item `{{key}}`",AdditionalPropertiesError:"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`",AllOfError:"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`",AnyOfError:"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`",ConstError:"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`",containsAnyError:"The array at `{{pointer}}` must contain at least one item",ContainsArrayError:"The property at `{{pointer}}` must not be an array",ContainsError:"The array at `{{pointer}}` must contain an element that matches `{{schema}}`",ContainsMinError:"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`",ContainsMaxError:"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`",EnumError:"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`",ForbiddenPropertyError:"Property name `{{property}}` at `{{pointer}}` is not allowed",FormatDateError:"Value `{{value}}` at `{{pointer}}` is not a valid date",FormatDateTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid date-time",FormatDurationError:"Value `{{value}}` at `{{pointer}}` is not a valid duration",FormatEmailError:"Value `{{value}}` at `{{pointer}}` is not a valid email",FormatHostnameError:"Value `{{value}}` at `{{pointer}}` is not a valid hostname",FormatIPV4Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address",FormatIPV4LeadingZeroError:"IPv4 addresses starting with zero are invalid, since they are interpreted as octals",FormatIPV6Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address",FormatIPV6LeadingZeroError:"IPv6 addresses starting with zero are invalid, since they are interpreted as octals",FormatJsonPointerError:"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer",FormatRegExError:"Value `{{value}}` at `{{pointer}}` is not a valid regular expression",FormatTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid time",FormatURIError:"Value `{{value}}` at `{{pointer}}` is not a valid uri",FormatURIReferenceError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference",FormatURITemplateError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-template",FormatURLError:"Value `{{value}}` at `{{pointer}}` is not a valid url",FormatUUIDError:"Value `{{value}}` at `{{pointer}}` is not a valid uuid",InvalidDataError:"No value may be specified in `{{pointer}}`",InvalidPropertyNameError:"Invalid property name `{{property}}` at `{{pointer}}`",MaximumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum",MaxItemsError:"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MaxLengthError:"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.",MaxPropertiesError:"Too many properties in `{{pointer}}`, should be `{{maxProperties}}` at most, but got `{{length}}`",MinimumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum",MinItemsError:"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`",MinItemsOneError:"At least one item is required in `{{pointer}}`",MinLengthError:"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.",MinLengthOneError:"A value is required in `{{pointer}}`",MinPropertiesError:"Too few properties in `{{pointer}}`, should be at least `{{minProperties}}`, but got `{{length}}`",MissingDependencyError:"The required propery '{{missingProperty}}' in `{{pointer}}` is missing",MissingOneOfPropertyError:"Value at `{{pointer}}` property: `{{property}}`",MultipleOfError:"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`",MultipleOneOfError:"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`",NoAdditionalPropertiesError:"Additional property `{{property}}` in `{{pointer}}` is not allowed",NotError:"Value `{{value}}` at pointer should not match schema `{{not}}`",OneOfError:"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema",OneOfPropertyError:"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`",PatternError:"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`",PatternPropertiesError:"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}",RequiredPropertyError:"The required property `{{key}}` is missing at `{{pointer}}`",SchemaWarning:"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'",TypeError:"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`",UndefinedValueError:"Value must not be undefined in `{{pointer}}`",UnevaluatedPropertyError:"Invalid unevaluated property `{{pointer}}`",UnevaluatedItemsError:"Invalid unevaluated item `{{pointer}}`",UniqueItemsError:"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.",UnknownPropertyError:"Could not find a valid schema for property `{{pointer}}` within object",ValueNotEmptyError:"A value for `{{property}}` is required at `{{pointer}}`"},pAe=Object.prototype.toString;function At(e){const t=pAe.call(e).match(/\s([^\]]+)\]/).pop().toLowerCase();return t==="file"?"object":t}const mAe="object",gAe="array";function yAe(e,t={}){return e.replace(/\{\{\w+\}\}/g,n=>{const r=n.replace(/[{}]/g,""),s=t[r],i=At(s);return i===mAe||i===gAe?JSON.stringify(s):s})}function bAe(e,t,n=e){var r;const s=(r=hAe[e])!==null&&r!==void 0?r:n;return yAe(s,t)}function vAe(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function xAe(e,t){return{type:"error",name:e,code:vAe(e),message:bAe(e,t),data:t}}function Xe(e){return xAe.bind(null,e)}function Yg(e,t=[]){for(let n=0;n<e.length;n+=1){const r=e[n];Array.isArray(r)?Yg(r,t):t.push(r)}return t}const t0={DECLARATOR_ONEOF:"oneOfProperty",GET_TEMPLATE_RECURSION_LIMIT:1,propertyBlacklist:["_id"],templateDefaultOptions:{addOptionalProps:!1,removeInvalidData:!1,extendDefaults:!0}};function Pn(e){return(e==null?void 0:e.type)==="error"}function wAe(e){return e instanceof Promise}function Hx(e){return Pn(e)||wAe(e)}function zt(e){return At(e)==="object"}const{DECLARATOR_ONEOF:Hf}=t0;function og(e,t){zt(e)&&(e.__oneOfIndex=t)}function SAe(e,t){const{schema:n,draft:r,pointer:s}=e;if(t!=null&&n[Hf]){const a=[],c=n[Hf],u=t[n[Hf]];if(u===void 0)return r.errors.missingOneOfPropertyError({property:c,pointer:s,schema:n,value:t});for(let f=0;f<n.oneOf.length;f+=1){const h=e.next(n.oneOf[f]).resolveRef(),m=r.step(h,c,t);if(Pn(m))return m;let y=Yg(r.validate(m,u));if(y=y.filter(Hx),y.length>0)a.push(...y);else return og(h.schema,f),m.next(h.schema)}return r.errors.oneOfPropertyError({property:c,value:u,pointer:s,schema:n,errors:a})}const i=[],o=[];for(let a=0;a<n.oneOf.length;a+=1){const c=r.resolveRef(e.next(n.oneOf[a]));let u=Yg(r.validate(c,t));u=u.filter(Hx),u.length>0?o.push(...u):i.push({index:a,schema:c.schema})}return i.length===1?(og(i[0].schema,i[0].index),e.next(i[0].schema)):i.length>1?r.errors.multipleOneOfError({value:t,pointer:s,schema:n,matches:i}):r.errors.oneOfError({value:JSON.stringify(t),pointer:s,schema:n,oneOf:n.oneOf,errors:o})}function EAe(e,t){const{draft:n,schema:r,pointer:s}=e;if(t==null||r.properties==null)return-1;let i=0;const o=Object.keys(r.properties);for(let a=0;a<o.length;a+=1){const c=o[a];t[c]&&n.isValid(t[c],r.properties[c],s)&&(i+=1)}return i}function KT(e,t){const{schema:n,pointer:r,draft:s}=e;if(!Array.isArray(n.oneOf))throw new Error("not a oneof schema");if(t!=null&&n[Hf]){const o=[],a=n[Hf],c=t[n[Hf]];if(c===void 0)return s.errors.missingOneOfPropertyError({property:a,pointer:r,schema:n,value:t});for(let u=0;u<n.oneOf.length;u+=1){const f=s.resolveRef(e.next(n.oneOf[u])),h=s.step(f,a,t);if(Pn(h))return h;let m=Yg(s.validate(h,c));if(m=m.filter(Hx),m.length>0)o.push(...m);else return og(f.schema,u),h.next(f.schema)}return s.errors.oneOfPropertyError({property:a,value:c,pointer:r,schema:n,errors:o})}const i=[];for(let o=0;o<n.oneOf.length;o+=1){const c=s.resolveRef(e.next(n.oneOf[o])).schema;s.isValid(t,c,r)&&i.push({schema:c,index:o})}if(i.length===1)return og(i[0].schema,i[0].index),e.next(i[0].schema);if(zt(t)){let o,a=-1,c=0;for(let u=0;u<n.oneOf.length;u+=1){const f=s.resolveRef(e.next(n.oneOf[u])),h=EAe(f,t);c<h&&(c=h,o=f.schema,a=u)}return o===void 0?s.errors.oneOfError({value:JSON.stringify(t),pointer:r,schema:n,oneOf:n.oneOf}):(og(o,a),e.next(o))}return i.length>1?s.errors.multipleOneOfError({matches:i,pointer:r,schema:n,value:t}):s.errors.oneOfError({value:JSON.stringify(t),pointer:r,schema:n,oneOf:n.oneOf})}const NAe=(e,t)=>{if(Array.isArray(e.schema.oneOf)){const n=e.draft.resolveOneOf(e,t);if(Pn(n))return n}};function Kr(e,t,...n){if((t==null?void 0:t.type)==="error")return t;if((e==null?void 0:e.type)==="error")return e;const r=At(e),s=At(t);if(r!==s)return e;const i=jv(e,t);for(let o=0;o<n.length;o+=1)delete i[n[o]];return i}function jv(e,t,n){var r;if(zt(e)&&zt(t)){const s={};return[...Object.keys(e),...Object.keys(t)].filter((i,o,a)=>a.indexOf(i)===o).forEach(i=>s[i]=jv(e[i],t[i],i)),s}if(Array.isArray(e)&&Array.isArray(t)){if(n==="required")return e.concat(t).filter((o,a,c)=>c.indexOf(o)===a);if(n==="items"){const o=[];for(let a=0;a<t.length;a+=1)zt(e[a])&&zt(t[a])&&e[a].type===t[a].type?o[a]=jv(e[a],t[a]):o.push((r=t[a])!==null&&r!==void 0?r:e[a]);return o}const s=[],i=[];for(let o=0;o<Math.max(e.length,t.length);o+=1)zt(e[o])&&zt(t[o])?s[o]=jv(e[o],t[o]):e[o]!==void 0&&t[o]!==void 0?(s[o]=e[o],i.push(t[o])):e[o]!==void 0?s[o]=e[o]:t[o]!==void 0&&i.push(t[o]);return[...s,...i].filter((o,a,c)=>c.indexOf(o)===a)}return Array.isArray(t)?t:Array.isArray(e)?e:t!==void 0?t:e}function zO(e,...t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function Z1(e,t){if(e.schema.if!=null){if(e.schema.if===!1)return e.next(e.schema.else);if(e.schema.if&&(e.schema.then||e.schema.else)){const n=e.draft.resolveRef(e.next(e.schema.if)),r=e.draft.validate(n,t);if(r.length===0&&e.schema.then){const s=e.next(e.schema.then);return e.draft.resolveRef(s)}if(r.length!==0&&e.schema.else){const s=e.next(e.schema.else);return e.draft.resolveRef(s)}}}}const _Ae=(e,t)=>{const n=Z1(e,t);if(n)return e.draft.validate(n,t)};function JH(e){return{...e}}function XH(e,t){const n=Z1(e,t);if(n)return n;const r=JH(e.schema);return e.next(zO(r,"if","then","else"))}function CAe(e,t){const{schema:n}=e;let r=JH(n);for(let s=0;s<n.allOf.length;s+=1){const i=e.next(n.allOf[s]).resolveRef(),o=XH(i,t).schema;r=Kr(r,o)}return delete r.allOf,e.next(r)}function KH(e,t){const{allOf:n}=t;if(!Array.isArray(n)||n.length===0)return;let r={};return n.forEach(s=>{if(s==null)return;const i=e.createNode(s).resolveRef();r=Kr(r,i.schema)}),r}const OAe=(e,t)=>{const{draft:n,schema:r}=e,{allOf:s}=r;if(!Array.isArray(s)||s.length===0)return;const i=[];return r.allOf.forEach(o=>{i.push(...n.validate(e.next(o),t))}),i};function jAe(e,...t){if(e==null)throw new Error("undefined schema");const n=this,r=Kr(n.schema,e,...t);return{...n,schema:r,path:[...n.path,[n.pointer,n.schema]]}}function AAe(){const e=this;return e.draft.resolveRef(e)}function $Ae(e,t){if(Pn(e))return e;if(e==null)throw new Error("undefined schema");if(!zt(e)&&At(e)!=="boolean")throw new Error(`bad schema type ${At(e)}`);const n=this;return{...n,pointer:t?`${n.pointer}/${t}`:n.pointer,schema:e,path:[...n.path,[n.pointer,n.schema]]}}function qi(e){return zt(e)&&e.next&&e.path&&e.draft}function TAe(e,t,n="#"){return{draft:e,pointer:n,schema:t,path:[],next:$Ae,merge:jAe,resolveRef:AAe}}function RAe(e){const t=e.path;let n=0;for(let s=t.length-1;s>=0;s--){const i=t[s][1];if(i.$id&&/^https?:\/\//.test(i.$id)&&i.$recursiveAnchor!==!0){n=s;break}}const r=t.find((s,i)=>i>=n&&s[1].$recursiveAnchor===!0);if(r)return e.next(r[1]);for(let s=t.length-1;s>=0;s--){const i=t[s][1];if(i.$id)return e.next(i)}return e.next(e.draft.rootSchema)}function QH(e){if(!qi(e))throw new Error("expected node");if(e.schema==null)return e;if(e.schema.$recursiveRef)return QH(RAe(e));if(e.schema.$ref==null)return e;const t=e.draft.rootSchema.getRef(e.schema);return t===!1?e.next(t):e.merge(t,"$ref")}function MAe(e){return e.filter((t,n)=>e.indexOf(t)===n)}function ZH(e,t){var n;const{schema:r}=e,s=(n=r.dependencies)!==null&&n!==void 0?n:r.dependentSchemas;if(!zt(s)||!zt(t))return;let i=!1,o={required:[]};if(Object.keys(s).forEach(a=>{var c,u;if(t[a]==null&&!(!((c=r.required)===null||c===void 0)&&c.includes(a)||!((u=o.required)===null||u===void 0)&&u.includes(a)))return;const f=s[a];if(Array.isArray(f)){i=!0,o.required.push(...f);return}if(zt(f)){i=!0;const h=e.next(f).resolveRef();o=Kr(o,h.schema);return}}),i)return o.required=MAe(o.required),o}const kAe=(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=r.dependentRequired;if(!zt(i))return;const o=[];return Object.keys(t).forEach(a=>{const c=i[a];if(c!==!0){if(c===!1){o.push(n.errors.missingDependencyError({pointer:s,schema:r,value:t}));return}if(Array.isArray(c))for(let u=0,f=c.length;u<f;u+=1)t[c[u]]===void 0&&o.push(n.errors.missingDependencyError({missingProperty:c[u],pointer:s,schema:r,value:t}))}}),o},IAe=(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=r.dependentSchemas;if(!zt(i))return;const o=[];return Object.keys(t).forEach(a=>{const c=i[a];if(c!==!0){if(c===!1){o.push(n.errors.missingDependencyError({pointer:s,schema:r,value:t}));return}zt(c)&&n.validate(e.next(c),t).map(u=>o.push(u))}}),o},DAe=(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=r.dependencies;if(!zt(i))return;const o=[];return Object.keys(t).forEach(a=>{if(i[a]===void 0||i[a]===!0)return;if(i[a]===!1){o.push(n.errors.missingDependencyError({pointer:s,schema:r,value:t}));return}let c;const u=At(i[a]),f=i[a];if(Array.isArray(f))c=f.filter(h=>t[h]===void 0).map(h=>n.errors.missingDependencyError({missingProperty:h,pointer:s,schema:r,value:t}));else if(u==="object")c=n.validate(e.next(i[a]),t);else throw new Error(`Invalid dependency definition for ${s}/${a}. Must be string[] or schema`);o.push(...c)}),o.length>0?o:void 0};function eW(e,t){const{draft:n,schema:r}=e;if(!Array.isArray(r.anyOf)||r.anyOf.length===0)return;let s;if(r.anyOf.forEach(i=>{const o=n.resolveRef(e.next(i));n.validate(o,t).length===0&&(s=s?Kr(s,o.schema):o.schema)}),s)return e.next(s)}function PAe(e,t){const{anyOf:n}=e.schema;if(!Array.isArray(n)||n.length===0)return e;const r=eW(e,t);if(r){const{pointer:s,schema:i}=e;return e.draft.errors.anyOfError({pointer:s,schema:i,value:t,anyOf:JSON.stringify(n)})}return e.merge(r.schema,"anyOf")}const LAe=(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(!Array.isArray(r.anyOf)||r.anyOf.length===0)){for(let i=0;i<r.anyOf.length;i+=1){const o=n.resolveRef(e.next(r.anyOf[i]));if(n.validate(o,t).length===0)return}return n.errors.anyOfError({pointer:s,schema:r,value:t,anyOf:r.anyOf})}},sP=["allOf","anyOf","oneOf","dependencies","if","then","else"],FAe=["allOf","anyOf","oneOf","dependencies","if"];function BAe(e){const t=Object.keys(e);return FAe.findIndex(n=>t.includes(n))!==-1}function VO(e,t){let n,r;const s=e.draft.resolveRef(e),{draft:i}=s,o=qi(s)?s.schema:s;if(o.oneOf){const m=KT(s,t);Pn(m)?r=m:m&&(n=Kr(n??{},m.schema))}if(Array.isArray(o.allOf)){const m=o.allOf.map(y=>{if(BAe(y)){const v=VO(s.next(y),t);if(v==null||Pn(v))return v;const x=Kr(y,v.schema);return zO(x,...sP)}return y});if(m.length>0){const y=KH(i,{allOf:m});n=Kr(n??{},y)}}const a=eW(s,t);a&&a.schema&&(n=Kr(n??{},a.schema));const c=ZH(s,t);c&&(n=Kr(n??{},c));const u=Z1(s,t);if(qi(u)&&(n=Kr(n??{},u.schema)),n==null)return r;if(Pn(n))return n;const f=VO(s.next(n),t);qi(f)&&(n=Kr(n,f.schema));const h=zO(n,...sP);return s.next(h)}const zAe=["allOf","anyOf","oneOf","dependencies","if","then","else"];function Wx(e,t){const n=VO(e,t);return qi(n)?e.merge(n.schema,...zAe):n||e}var VAe=Function.prototype.toString,p_=Object.create,UAe=Object.prototype.toString,qAe=function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(t){return!!~this._keys.indexOf(t)},e.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},e.prototype.set=function(t,n){this._keys.push(t),this._values.push(n)},e}();function HAe(){return new qAe}function WAe(){return new WeakMap}var GAe=typeof WeakMap<"u"?WAe:HAe;function QT(e){if(!e)return p_(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:p_(e);if(t&&~VAe.call(t).indexOf("[native code]"))try{return new t}catch{}return p_(e)}function YAe(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}function JAe(e){return e.flags}var XAe=/test/g.flags==="g"?JAe:YAe;function tW(e){var t=UAe.call(e);return t.substring(8,t.length-1)}function KAe(e){return e[Symbol.toStringTag]||tW(e)}var QAe=typeof Symbol<"u"?KAe:tW,ZAe=Object.defineProperty,e$e=Object.getOwnPropertyDescriptor,nW=Object.getOwnPropertyNames,ZT=Object.getOwnPropertySymbols,rW=Object.prototype,sW=rW.hasOwnProperty,t$e=rW.propertyIsEnumerable,iW=typeof ZT=="function";function n$e(e){return nW(e).concat(ZT(e))}var r$e=iW?n$e:nW;function eS(e,t,n){for(var r=r$e(e),s=0,i=r.length,o=void 0,a=void 0;s<i;++s)if(o=r[s],!(o==="callee"||o==="caller")){if(a=e$e(e,o),!a){t[o]=n.copier(e[o],n);continue}!a.get&&!a.set&&(a.value=n.copier(a.value,n));try{ZAe(t,o,a)}catch{t[o]=a.value}}return t}function s$e(e,t){var n=new t.Constructor;t.cache.set(e,n);for(var r=0,s=e.length;r<s;++r)n[r]=t.copier(e[r],t);return n}function i$e(e,t){var n=new t.Constructor;return t.cache.set(e,n),eS(e,n,t)}function oW(e,t){return e.slice(0)}function o$e(e,t){return e.slice(0,e.size,e.type)}function a$e(e,t){return new t.Constructor(oW(e.buffer))}function l$e(e,t){return new t.Constructor(e.getTime())}function aW(e,t){var n=new t.Constructor;return t.cache.set(e,n),e.forEach(function(r,s){n.set(s,t.copier(r,t))}),n}function c$e(e,t){return eS(e,aW(e,t),t)}function u$e(e,t){var n=QT(t.prototype);t.cache.set(e,n);for(var r in e)sW.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function d$e(e,t){var n=QT(t.prototype);t.cache.set(e,n);for(var r in e)sW.call(e,r)&&(n[r]=t.copier(e[r],t));for(var s=ZT(e),i=0,o=s.length,a=void 0;i<o;++i)a=s[i],t$e.call(e,a)&&(n[a]=t.copier(e[a],t));return n}var f$e=iW?d$e:u$e;function h$e(e,t){var n=QT(t.prototype);return t.cache.set(e,n),eS(e,n,t)}function m_(e,t){return new t.Constructor(e.valueOf())}function p$e(e,t){var n=new t.Constructor(e.source,XAe(e));return n.lastIndex=e.lastIndex,n}function Av(e,t){return e}function lW(e,t){var n=new t.Constructor;return t.cache.set(e,n),e.forEach(function(r){n.add(t.copier(r,t))}),n}function m$e(e,t){return eS(e,lW(e,t),t)}var g$e=Array.isArray,e5=Object.assign,y$e=Object.getPrototypeOf||function(e){return e.__proto__},cW={array:s$e,arrayBuffer:oW,blob:o$e,dataView:a$e,date:l$e,error:Av,map:aW,object:f$e,regExp:p$e,set:lW},b$e=e5({},cW,{array:i$e,map:c$e,object:h$e,set:m$e});function v$e(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,Blob:e.blob,Boolean:m_,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:m_,Object:e.object,Promise:Av,RegExp:e.regExp,Set:e.set,String:m_,WeakMap:Av,WeakSet:Av,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer,Uint64Array:e.arrayBuffer}}function uW(e){var t=e5({},cW,e),n=v$e(t),r=n.Array,s=n.Object;function i(o,a){if(a.prototype=a.Constructor=void 0,!o||typeof o!="object")return o;if(a.cache.has(o))return a.cache.get(o);if(a.prototype=y$e(o),a.Constructor=a.prototype&&a.prototype.constructor,!a.Constructor||a.Constructor===Object)return s(o,a);if(g$e(o))return r(o,a);var c=n[QAe(o)];return c?c(o,a):typeof o.then=="function"?o:s(o,a)}return function(a){return i(a,{Constructor:void 0,cache:GAe(),copier:i,prototype:void 0})}}function x$e(e){return uW(e5({},b$e,e))}x$e({});var UO=uW({});class w$e{constructor(t,n){this.remotes={},this.errors={},this.typeKeywords={},this.validateKeyword={},this.validateType={},this.validateFormat={},this.config=t,this.typeKeywords=UO(t.typeKeywords),this.validateKeyword=Object.assign({},t.validateKeyword),this.validateType=Object.assign({},t.validateType),this.validateFormat=Object.assign({},t.validateFormat),this.errors=Object.assign({},t.errors),this.setSchema(n)}get rootSchema(){return this.__rootSchema}set rootSchema(t){t!=null&&(this.__rootSchema=this.config.compileSchema(this,t))}addRemoteSchema(t,n){this.config.addRemoteSchema(this,t,n)}compileSchema(t){var n;return this.config.compileSchema(this,t,(n=this.rootSchema)!==null&&n!==void 0?n:t)}createSchemaOf(t){return this.config.createSchemaOf(t)}each(t,n,r,s){const i=this.createNode(r??this.rootSchema,s);return this.config.each(i,t,n)}eachSchema(t,n=this.rootSchema){return this.config.eachSchema(n,t)}getChildSchemaSelection(t,n){return this.config.getChildSchemaSelection(this,t,n)}getSchema(t){const n=this.getSchemaNode(t);return qi(n)?n.schema:n}getSchemaNode(t){return this.config.getSchema(this,t)}getTemplate(t,n,r=this.config.templateDefaultOptions){return this.config.getTemplate(this,t,n,r)}isValid(t,n,r){return this.config.isValid(this,t,n,r)}createNode(t,n="#"){return this.config.createNode(this,t,n)}resolveAnyOf(t,n){return this.config.resolveAnyOf(t,n)}resolveAllOf(t,n){return this.config.resolveAllOf(t,n)}resolveRef(t){return this.config.resolveRef(t)}resolveOneOf(t,n){return this.config.resolveOneOf(t,n)}setSchema(t){this.rootSchema=t}step(t,n,r){return this.config.step(t,n,r)}validate(t,n=this.rootSchema,r){if(qi(t)){const i=n,o=t;return this.config.validate(o,i)}if(Pn(t))return[t];const s=this.createNode(n,r);return this.config.validate(s,t)}}function Tf(e,t,n,r){const s=t[e];zt(s)&&Object.keys(s).forEach(i=>{Array.isArray(s[i])||(i==="$defs"?Tf("$defs",s[i],n,`${r}/${e}/$defs`):Ri(s[i],n,`${r}/${e}/${i}`))})}function Gb(e,t,n,r){const s=t[e];Array.isArray(s)&&s.forEach((i,o)=>Ri(i,n,`${r}/${e}/${o}`))}function Ri(e,t,n=""){e!==void 0&&t(e,n)!==!0&&zt(e)&&(Tf("properties",e,t,n),Tf("patternProperties",e,t,n),Ri(e.not,t,`${n}/not`),Ri(e.additionalProperties,t,`${n}/additionalProperties`),Tf("dependencies",e,t,n),zt(e.items)&&Ri(e.items,t,`${n}/items`),Gb("items",e,t,n),Ri(e.additionalItems,t,`${n}/additionalItems`),Gb("allOf",e,t,n),Gb("anyOf",e,t,n),Gb("oneOf",e,t,n),Ri(e.if,t,`${n}/if`),Ri(e.then,t,`${n}/then`),Ri(e.else,t,`${n}/else`),Tf("definitions",e,t,n),Tf("$defs",e,t,n))}const S$e=/(#)+$/,g_=/#$/,iP=/^[#/]+/,oP=/^[^:]+:\/\/[^/]+\//,E$e=/\/[^/]*$/,N$e=/#.*$/,_$e=/^urn:uuid:[0-9A-Fa-f]/;function aP(e,t){return e==null&&t==null?"#":t==null?e.replace(g_,""):_$e.test(t)?t:e==null||e===""||e==="#"?t.replace(g_,""):t[0]==="#"?`${e.replace(N$e,"")}${t.replace(S$e,"")}`:oP.test(t)?t.replace(g_,""):oP.test(e)&&t.startsWith("/")?`${e.replace(/(^[^:]+:\/\/[^/]+)(.*)/,"$1")}/${t.replace(iP,"")}`:`${e.replace(E$e,"")}/${t.replace(iP,"")}`}var $v={exports:{}},C$e=$v.exports,lP;function O$e(){return lP||(lP=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:C$e,()=>(()=>{var n={d:(F,V)=>{for(var H in V)n.o(V,H)&&!n.o(F,H)&&Object.defineProperty(F,H,{enumerable:!0,get:V[H]})},o:(F,V)=>Object.prototype.hasOwnProperty.call(F,V),r:F=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})}},r={};function s(F){return F==="#"||F===""||Array.isArray(F)&&F.length===0||!1}n.r(r),n.d(r,{default:()=>P,get:()=>h,isRoot:()=>s,join:()=>M,remove:()=>j,removeUndefinedItems:()=>C,set:()=>E,split:()=>f,splitLast:()=>D});const i=/~1/g,o=/~0/g,a=/(^#?\/?)/g;function c(F){return F.replace(i,"/").replace(o,"~")}function u(F){return c(decodeURIComponent(F))}function f(F){if(F==null||typeof F!="string"||s(F))return Array.isArray(F)?F:[];const V=F.indexOf("#")>=0?u:c,H=(F=F.replace(a,"")).split("/");for(let I=0,B=H.length;I<B;I+=1)H[I]=V(H[I]);return H}function h(F,V,H=void 0){if(V==null||F==null)return H;if(s(V))return F;const I=m(F,f(V));return I===void 0?H:I}function m(F,V){const H=V.shift();if(F!==void 0)return H!==void 0?m(F[H],V):F}const y=/^\[.*\]$/,v=/^\[(.+)\]$/;function x(F,V){return F==="__proto__"||F=="constructor"&&V.length>0&&V[0]=="prototype"}function E(F,V,H){if(V==null)return F;const I=f(V);if(I.length===0)return F;F==null&&(F=y.test(I[0])?[]:{});let B,T,L=F;for(;I.length>1;)B=I.shift(),T=y.test(I[0]),x(B,I)||(L=_(L,B,T));return B=I.pop(),N(L,B,H),F}function N(F,V,H){let I;const B=V.match(v);V==="[]"&&Array.isArray(F)?F.push(H):B?(I=B.pop(),F[I]=H):F[V]=H}function _(F,V,H){var I,B;const T=(B=(I=V.match(v))===null||I===void 0?void 0:I.pop())!==null&&B!==void 0?B:V;if(F[T]!=null)return F[T];const L=H?[]:{};return N(F,V,L),L}function C(F){let V=0,H=0;for(;V+H<F.length;)F[V+H]===void 0&&(H+=1),F[V]=F[V+H],V+=1;return F.length=F.length-H,F}function j(F,V,H){const I=f(V),B=I.pop(),T=h(F,I);return T&&delete T[B],Array.isArray(T)&&H!==!0&&C(T),F}const A=/~/g,$=/\//g;function R(F,V){if(F.length===0)return V?"#":"";for(let H=0,I=F.length;H<I;H+=1)F[H]=F[H].replace(A,"~0").replace($,"~1"),V&&(F[H]=encodeURIComponent(F[H]));return(V?"#/":"/")+F.join("/")}function M(F,...V){const H=[];if(Array.isArray(F))return R(F,arguments[1]===!0);const I=arguments[arguments.length-1],B=typeof I=="boolean"?I:F&&F[0]==="#";for(let L=0,z=arguments.length;L<z;L+=1)H.push.apply(H,f(arguments[L]));const T=[];for(let L=0,z=H.length;L<z;L+=1)if(H[L]===".."){if(T.length===0)return B?"#":"";T.pop()}else T.push(H[L]);return R(T,B)}function D(F){const V=f(F);if(V.length===0)return typeof F=="string"&&F[0]==="#"?["#",V[0]]:["",void 0];if(V.length===1)return F[0]==="#"?["#",V[0]]:["",V[0]];const H=V.pop();return[M(V,F[0]==="#"),H]}const P={get:h,set:E,remove:j,join:M,split:f,splitLast:D,isRoot:s,removeUndefinedItems:C};return r})())}($v)),$v.exports}var _u=O$e();const j$e=Ki(_u),y_=/(#)+$/g,A$e=["",null,"#"];function $$e(e){if(A$e.includes(e))return[];if(e=e.replace(y_,""),e.indexOf("#")===-1)return[e.replace(/(#|\/)+$/g,"")];if(e.indexOf("#")===0)return[e.replace(y_,"")];const t=e.split("#");return t[0]=t[0].replace(/(#|\/)+$/g,""),t[1]=`#${t[1].replace(y_,"")}`,t}const T$e=/(#)+$/g,R$e=e=>At(e)==="object";function ca(e,t,n){var r,s,i,o,a;let c;if(R$e(n)?c=n.__ref||n.$ref:c=n,c==null)return t;let u;const f=c.replace(T$e,"");if(e.remotes[f]!=null)return u=e.remotes[f],u&&u.$ref?ca(e,u,u):u;const h=(r=e.anchors)===null||r===void 0?void 0:r[c];if(h)return _u.get(t,h);if(e.ids[c]!=null)return u=_u.get(t,e.ids[c]),u&&u.$ref?ca(e,t,u):u;const m=c,y=$$e(c);if(y.length===0)return t;if(y.length===1){if(c=y[0],e.remotes[c]&&(u=e.remotes[c],u&&u.$ref))return ca(e,t,u);if(e.ids[c])return u=_u.get(t,e.ids[c]),u&&u.$ref?ca(e,t,u):u;const v=(s=t.getContext)===null||s===void 0?void 0:s.call(t).ids[c];if(v)return ca(e,t,v)}if(y.length===2){const v=y[0];c=y[1];const x=(i=e.remotes[v])!==null&&i!==void 0?i:e.remotes[`${v}/`];if(x)return x.getContext&&x.getContext().anchors[m]!=null?x.getRef(m):x.getRef?x.getRef(c):ca(e,x,c);const E=(o=e.ids[v])!==null&&o!==void 0?o:e.ids[`${v}/`];if(E)return ca(e,_u.get(t,E),c)}return u=_u.get(t,(a=e.ids[c])!==null&&a!==void 0?a:c),u&&u.$ref?ca(e,t,u):u}function xa(e){if(e===void 0)return;const t={type:At(e)};return t.type==="object"&&zt(e)&&(t.properties={},Object.keys(e).forEach(n=>t.properties[n]=xa(e[n]))),t.type==="array"&&Array.isArray(e)&&(e.length===1?t.items=xa(e[0]):t.items=e.map(xa)),t}const M$e={additionalItemsError:Xe("AdditionalItemsError"),additionalPropertiesError:Xe("AdditionalPropertiesError"),allOfError:Xe("AllOfError"),anyOfError:Xe("AnyOfError"),constError:Xe("ConstError"),containsAnyError:Xe("ContainsAnyError"),containsArrayError:Xe("ContainsArrayError"),containsError:Xe("ContainsError"),containsMaxError:Xe("ContainsMaxError"),containsMinError:Xe("ContainsMinError"),enumError:Xe("EnumError"),forbiddenPropertyError:Xe("ForbiddenPropertyError"),formatDateError:Xe("FormatDateError"),formatDateTimeError:Xe("FormatDateTimeError"),formatDurationError:Xe("FormatDurationError"),formatEmailError:Xe("FormatEmailError"),formatHostnameError:Xe("FormatHostnameError"),formatIPV4Error:Xe("FormatIPV4Error"),formatIPV4LeadingZeroError:Xe("FormatIPV4LeadingZeroError"),formatIPV6Error:Xe("FormatIPV6Error"),formatIPV6LeadingZeroError:Xe("FormatIPV6LeadingZeroError"),formatJsonPointerError:Xe("FormatJsonPointerError"),formatRegExError:Xe("FormatRegExError"),formatTimeError:Xe("FormatTimeError"),formatURIError:Xe("FormatURIError"),formatURIReferenceError:Xe("FormatURIReferenceError"),formatURITemplateError:Xe("FormatURITemplateError"),formatURLError:Xe("FormatURLError"),formatUUIDError:Xe("FormatUUIDError"),invalidDataError:Xe("InvalidDataError"),invalidPropertyNameError:Xe("InvalidPropertyNameError"),invalidSchemaError:Xe("InvalidSchemaError"),invalidTypeError:Xe("InvalidTypeError"),maximumError:Xe("MaximumError"),maxItemsError:Xe("MaxItemsError"),maxLengthError:Xe("MaxLengthError"),maxPropertiesError:Xe("MaxPropertiesError"),minimumError:Xe("MinimumError"),minItemsError:Xe("MinItemsError"),minItemsOneError:Xe("MinItemsOneError"),minLengthError:Xe("MinLengthError"),minLengthOneError:Xe("MinLengthOneError"),minPropertiesError:Xe("MinPropertiesError"),missingDependencyError:Xe("MissingDependencyError"),missingOneOfPropertyError:Xe("MissingOneOfPropertyError"),multipleOfError:Xe("MultipleOfError"),multipleOneOfError:Xe("MultipleOneOfError"),noAdditionalPropertiesError:Xe("NoAdditionalPropertiesError"),notError:Xe("NotError"),oneOfError:Xe("OneOfError"),oneOfPropertyError:Xe("OneOfPropertyError"),patternError:Xe("PatternError"),patternPropertiesError:Xe("PatternPropertiesError"),requiredPropertyError:Xe("RequiredPropertyError"),schemaWarning:Xe("SchemaWarning"),typeError:Xe("TypeError"),undefinedValueError:Xe("UndefinedValueError"),unevaluatedItemsError:Xe("UnevaluatedItemsError"),unevaluatedPropertyError:Xe("UnevaluatedPropertyError"),uniqueItemsError:Xe("UniqueItemsError"),unknownPropertyError:Xe("UnknownPropertyError"),valueNotEmptyError:Xe("ValueNotEmptyError")};var b_={exports:{}},cP;function k$e(){return cP||(cP=1,function(e){(function(t){t.exports.is_uri=r,t.exports.is_http_uri=s,t.exports.is_https_uri=i,t.exports.is_web_uri=o,t.exports.isUri=r,t.exports.isHttpUri=s,t.exports.isHttpsUri=i,t.exports.isWebUri=o;var n=function(a){var c=a.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return c};function r(a){if(a&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(a)&&!/%[^0-9a-f]/i.test(a)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(a)){var c=[],u="",f="",h="",m="",y="",v="";if(c=n(a),u=c[1],f=c[2],h=c[3],m=c[4],y=c[5],!!(u&&u.length&&h.length>=0)){if(f&&f.length){if(!(h.length===0||/^\//.test(h)))return}else if(/^\/\//.test(h))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(u.toLowerCase()))return v+=u+":",f&&f.length&&(v+="//"+f),v+=h,m&&m.length&&(v+="?"+m),y&&y.length&&(v+="#"+y),v}}}function s(a,c){if(r(a)){var u=[],f="",h="",m="",y="",v="",x="",E="";if(u=n(a),f=u[1],h=u[2],m=u[3],v=u[4],x=u[5],!!f){if(c){if(f.toLowerCase()!="https")return}else if(f.toLowerCase()!="http")return;if(h)return/:(\d+)$/.test(h)&&(y=h.match(/:(\d+)$/)[0],h=h.replace(/:\d+$/,"")),E+=f+":",E+="//"+h,y&&(E+=y),E+=m,v&&v.length&&(E+="?"+v),x&&x.length&&(E+="#"+x),E}}}function i(a){return s(a,!0)}function o(a){return s(a)||i(a)}})(e)}(b_)),b_.exports}var I$e=k$e();const uP=Ki(I$e);var $r={},Tv={exports:{}},D$e=Tv.exports,dP;function P$e(){return dP||(dP=1,function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(D$e,function(){function t(u,f,h){return this.id=++t.highestId,this.name=u,this.symbols=f,this.postprocess=h,this}t.highestId=0,t.prototype.toString=function(u){var f=typeof u>"u"?this.symbols.map(c).join(" "):this.symbols.slice(0,u).map(c).join(" ")+" ● "+this.symbols.slice(u).map(c).join(" ");return this.name+" → "+f};function n(u,f,h,m){this.rule=u,this.dot=f,this.reference=h,this.data=[],this.wantedBy=m,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var f=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return f.left=this,f.right=u,f.isComplete&&(f.data=f.build(),f.right=void 0),f},n.prototype.build=function(){var u=[],f=this;do u.push(f.right.data),f=f.left;while(f.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,o.fail))};function r(u,f){this.grammar=u,this.index=f,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var f=this.states,h=this.wants,m=this.completed,y=0;y<f.length;y++){var v=f[y];if(v.isComplete){if(v.finish(),v.data!==o.fail){for(var x=v.wantedBy,E=x.length;E--;){var N=x[E];this.complete(N,v)}if(v.reference===this.index){var _=v.rule.name;(this.completed[_]=this.completed[_]||[]).push(v)}}}else{var _=v.rule.symbols[v.dot];if(typeof _!="string"){this.scannable.push(v);continue}if(h[_]){if(h[_].push(v),m.hasOwnProperty(_))for(var C=m[_],E=0;E<C.length;E++){var j=C[E];this.complete(v,j)}}else h[_]=[v],this.predict(_)}}},r.prototype.predict=function(u){for(var f=this.grammar.byName[u]||[],h=0;h<f.length;h++){var m=f[h],y=this.wants[u],v=new n(m,0,this.index,y);this.states.push(v)}},r.prototype.complete=function(u,f){var h=u.nextState(f);this.states.push(h)};function s(u,f){this.rules=u,this.start=f||this.rules[0].name;var h=this.byName={};this.rules.forEach(function(m){h.hasOwnProperty(m.name)||(h[m.name]=[]),h[m.name].push(m)})}s.fromCompiled=function(m,f){var h=m.Lexer;m.ParserStart&&(f=m.ParserStart,m=m.ParserRules);var m=m.map(function(v){return new t(v.name,v.symbols,v.postprocess)}),y=new s(m,f);return y.lexer=h,y};function i(){this.reset("")}i.prototype.reset=function(u,f){this.buffer=u,this.index=0,this.line=f?f.line:1,this.lastLineBreak=f?-f.col:0},i.prototype.next=function(){if(this.index<this.buffer.length){var u=this.buffer[this.index++];return u===`
`&&(this.line+=1,this.lastLineBreak=this.index),{value:u}}},i.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},i.prototype.formatError=function(u,f){var h=this.buffer;if(typeof h=="string"){var m=h.split(`
`).slice(Math.max(0,this.line-5),this.line),y=h.indexOf(`
`,this.index);y===-1&&(y=h.length);var v=this.index-this.lastLineBreak,x=String(this.line).length;return f+=" at line "+this.line+" col "+v+`:

`,f+=m.map(function(N,_){return E(this.line-m.length+_+1,x)+" "+N},this).join(`
`),f+=`
`+E("",x+v)+`^
`,f}else return f+" at index "+(this.index-1);function E(N,_){var C=String(N);return Array(_-C.length+1).join(" ")+C}};function o(u,f,h){if(u instanceof s)var m=u,h=f;else var m=s.fromCompiled(u,f);this.grammar=m,this.options={keepHistory:!1,lexer:m.lexer||new i};for(var y in h||{})this.options[y]=h[y];this.lexer=this.options.lexer,this.lexerState=void 0;var v=new r(m,0);this.table=[v],v.wants[m.start]=[],v.predict(m.start),v.process(),this.current=0}o.fail={},o.prototype.feed=function(u){var f=this.lexer;f.reset(u,this.lexerState);for(var h;;){try{if(h=f.next(),!h)break}catch(R){var x=new r(this.grammar,this.current+1);this.table.push(x);var m=new Error(this.reportLexerError(R));throw m.offset=this.current,m.token=R.token,m}var y=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var v=this.current+1,x=new r(this.grammar,v);this.table.push(x);for(var E=h.text!==void 0?h.text:h.value,N=f.constructor===i?h.value:h,_=y.scannable,C=_.length;C--;){var j=_[C],A=j.rule.symbols[j.dot];if(A.test?A.test(N):A.type?A.type===h.type:A.literal===E){var $=j.nextState({data:N,token:h,isToken:!0,reference:v-1});x.states.push($)}}if(x.process(),x.states.length===0){var m=new Error(this.reportError(h));throw m.offset=this.current,m.token=h,m}this.options.keepHistory&&(y.lexerState=f.save()),this.current++}return y&&(this.lexerState=f.save()),this.results=this.finish(),this},o.prototype.reportLexerError=function(u){var f,h,m=u.token;return m?(f="input "+JSON.stringify(m.text[0])+" (lexer error)",h=this.lexer.formatError(m,"Syntax error")):(f="input (lexer error)",h=u.message),this.reportErrorCommon(h,f)},o.prototype.reportError=function(u){var f=(u.type?u.type+" token: ":"")+JSON.stringify(u.value!==void 0?u.value:u),h=this.lexer.formatError(u,"Syntax error");return this.reportErrorCommon(h,f)},o.prototype.reportErrorCommon=function(u,f){var h=[];h.push(u);var m=this.table.length-2,y=this.table[m],v=y.states.filter(function(E){var N=E.rule.symbols[E.dot];return N&&typeof N!="string"});if(v.length===0)h.push("Unexpected "+f+`. I did not expect any more input. Here is the state of my parse table:
`),this.displayStateStack(y.states,h);else{h.push("Unexpected "+f+`. Instead, I was expecting to see one of the following:
`);var x=v.map(function(E){return this.buildFirstStateStack(E,[])||[E]},this);x.forEach(function(E){var N=E[0],_=N.rule.symbols[N.dot],C=this.getSymbolDisplay(_);h.push("A "+C+" based on:"),this.displayStateStack(E,h)},this)}return h.push(""),h.join(`
`)},o.prototype.displayStateStack=function(u,f){for(var h,m=0,y=0;y<u.length;y++){var v=u[y],x=v.rule.toString(v.dot);x===h?m++:(m>0&&f.push("    ^ "+m+" more lines identical to this"),m=0,f.push("    "+x)),h=x}},o.prototype.getSymbolDisplay=function(u){return a(u)},o.prototype.buildFirstStateStack=function(u,f){if(f.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var h=u.wantedBy[0],m=[u].concat(f),y=this.buildFirstStateStack(h,m);return y===null?null:[u].concat(y)},o.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},o.prototype.restore=function(u){var f=u.index;this.current=f,this.table[f]=u,this.table.splice(f+1),this.lexerState=u.lexerState,this.results=this.finish()},o.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},o.prototype.finish=function(){var u=[],f=this.grammar.start,h=this.table[this.table.length-1];return h.states.forEach(function(m){m.rule.name===f&&m.dot===m.rule.symbols.length&&m.reference===0&&m.data!==o.fail&&u.push(m)}),u.map(function(m){return m.data})};function a(u){var f=typeof u;if(f==="string")return u;if(f==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function c(u){var f=typeof u;if(f==="string")return u;if(f==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:o,Grammar:s,Rule:t}})}(Tv)),Tv.exports}var Yb={},fP;function L$e(){if(fP)return Yb;fP=1,Object.defineProperty(Yb,"__esModule",{value:!0});function e(s){return s[0]}const t=s=>[].concat(...s.map(i=>Array.isArray(i)?t(i):i));function n(s){return s?Array.isArray(s)?t(s).join(""):s:""}const r={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:s=>s.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(s){return s.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(s){return s.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:e},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:s=>s[0].concat([s[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:s=>s[0].concat([s[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:e},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:s=>s[0].concat([s[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:e},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:s=>s[0].concat([s[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:e},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(s){return{DomainName:n(s[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(s){return{AddressLiteral:n(s[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(s){return{localPart:n(s[0]),domainPart:n(s[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(s){return{DotString:n(s[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(s){return{QuotedString:n(s[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:s=>s[0].concat([s[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:s=>s[0].concat([s[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:s=>s[0].concat([s[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:e},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(s){return s.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:s=>s[0].concat([s[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:e},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:s=>s.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:s=>s.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:e},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:e},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:e}],ParserStart:"Reverse_path"};return Yb.default=r,Yb}var hP;function F$e(){if(hP)return $r;hP=1;var e=$r&&$r.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty($r,"__esModule",{value:!0}),$r.canonicalize=$r.canonicalize_quoted_string=$r.normalize=$r.normalize_dot_string=$r.parse=void 0;const t=P$e(),n=e(L$e());n.default.ParserStart="Mailbox";const r=t.Grammar.fromCompiled(n.default);function s(u){const f=new t.Parser(r);if(f.feed(u),f.results.length!==1)throw new Error("address parsing failed: ambiguous grammar");return f.results[0]}$r.parse=s;function i(u){return function(){const m=u.indexOf("+");return m===-1?u:u.substr(0,m)}().replace(/\./g,"").toLowerCase()}$r.normalize_dot_string=i;function o(u){var f,h;const m=s(u),y=(f=m.domainPart.AddressLiteral)!==null&&f!==void 0?f:m.domainPart.DomainName.toLowerCase();return`${(h=m.localPart.QuotedString)!==null&&h!==void 0?h:i(m.localPart.DotString)}@${y}`}$r.normalize=o;function a(u){return`"${u.substr(1).substr(0,u.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}$r.canonicalize_quoted_string=a;function c(u){var f;const h=s(u),m=(f=h.domainPart.AddressLiteral)!==null&&f!==void 0?f:h.domainPart.DomainName.toLowerCase();return`${h.localPart.QuotedString?a(h.localPart.QuotedString):h.localPart.DotString}@${m}`}return $r.canonicalize=c,$r}var B$e=F$e();const z$e=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,V$e=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,U$e=/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,q$e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,H$e=/^(?<time>(?:([0-1]\d|2[0-3]):[0-5]\d:(?<second>[0-5]\d|60)))(?:\.\d+)?(?<offset>(?:z|[+-]([0-1]\d|2[0-3])(?::?[0-5]\d)?))$/i,W$e=[0,31,28,31,30,31,30,31,31,30,31,30,31],G$e=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Y$e=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,J$e=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,X$e=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,K$e=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,qO={date:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t!="string"||t==="")return;const i=t.match(q$e);if(!i)return n.errors.formatDateTimeError({value:t,pointer:s,schema:r});const o=+i[1],a=+i[2],c=+i[3],u=o%4===0&&(o%100!==0||o%400===0);if(!(a>=1&&a<=12&&c>=1&&c<=(a==2&&u?29:W$e[a])))return n.errors.formatDateError({value:t,pointer:s,schema:r})},"date-time":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t!="string"||t==="")return;const i=t.split(/t/i);if(i.length===2){const o=qO.date(e,i[0])===void 0,a=qO.time(e,i[1])===void 0;if(o&&a)return}return n.errors.formatDateTimeError({value:t,pointer:s,schema:r})},duration:(e,t)=>{if(At(t)!=="string")return;const r=/(\d+M)(\d+W)|(\d+Y)(\d+W)/;if(!K$e.test(t)||r.test(t))return e.draft.errors.formatDurationError({value:t,pointer:e.pointer,schema:e.schema})},email:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t!="string"||t==="")return;if(t[0]==='"')return n.errors.formatEmailError({value:t,pointer:s,schema:r});const[i,o,...a]=t.split("@");if(!i||!o||a.length!==0||i.length>64||o.length>253)return n.errors.formatEmailError({value:t,pointer:s,schema:r});if(i[0]==="."||i.endsWith(".")||i.includes(".."))return n.errors.formatEmailError({value:t,pointer:s,schema:r});if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(i))return n.errors.formatEmailError({value:t,pointer:s,schema:r});if(!o.split(".").every(c=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(c)))return n.errors.formatEmailError({value:t,pointer:s,schema:r})},"idn-email":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t===""))try{B$e.parse(t);return}catch{return n.errors.formatEmailError({value:t,pointer:s,schema:r})}},hostname:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t=="string"&&!(t===""||U$e.test(t)))return n.errors.formatHostnameError({value:t,pointer:s,schema:r})},ipv4:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")){if(t&&t[0]==="0")return n.errors.formatIPV4LeadingZeroError({value:t,pointer:s,schema:r});if(!(t.length<=15&&z$e.test(t)))return n.errors.formatIPV4Error({value:t,pointer:s,schema:r})}},ipv6:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")){if(t&&t[0]==="0")return n.errors.formatIPV6LeadingZeroError({value:t,pointer:s,schema:r});if(!(t.length<=45&&V$e.test(t)))return n.errors.formatIPV6Error({value:t,pointer:s,schema:r})}},"json-pointer":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")&&!G$e.test(t))return n.errors.formatJsonPointerError({value:t,pointer:s,schema:r})},"relative-json-pointer":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t=="string"&&!Y$e.test(t))return n.errors.formatJsonPointerError({value:t,pointer:s,schema:r})},regex:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t=="string"&&/\\Z$/.test(t)===!1){try{new RegExp(t);return}catch{}return n.errors.formatRegExError({value:t,pointer:s,schema:r})}if(!(typeof t=="object"||typeof t=="number"||Array.isArray(t)))return n.errors.formatRegExError({value:t,pointer:s,schema:r})},time:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(typeof t!="string"||t==="")return;const i=t.match(H$e);if(!i)return n.errors.formatDateTimeError({value:t,pointer:s,schema:r});if(i.groups.second==="60"){if(/23:59:60(z|\+00:00)/i.test(t))return;const o=i.groups.time.match(/(\d+):(\d+):/),a=i.groups.offset.match(/(\d+):(\d+)/);if(a){const c=parseInt(o[1]),u=parseInt(a[1]),f=parseInt(o[2]),h=parseInt(a[2]);let m;/^-/.test(i.groups.offset)?m=(c+u)*60+(f+h):m=(24+c-u)*60+(f-h);const y=Math.floor(m/60),v=y%24,x=m-y*60;if(v===23&&x===59)return}return n.errors.formatDateTimeError({value:t,pointer:s,schema:r})}},uri:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")&&!uP.isUri(t))return n.errors.formatURIError({value:t,pointer:s,schema:r})},"uri-reference":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")&&!J$e.test(t))return n.errors.formatURIReferenceError({value:t,pointer:s,schema:r})},"uri-template":(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")&&!X$e.test(t))return n.errors.formatURITemplateError({value:t,pointer:s,schema:r})},url:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(t===""||uP.isWebUri(t)))return n.errors.formatURLError({value:t,pointer:s,schema:r})},uuid:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!(typeof t!="string"||t==="")&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return n.errors.formatUUIDError({value:t,pointer:s,schema:r})}};function Q$e(e,t,n=e.rootSchema){var r;if(n.oneOf)return n.oneOf.map(i=>e.createNode(i).resolveRef().schema);if(!((r=n.items)===null||r===void 0)&&r.oneOf)return n.items.oneOf.map(i=>e.createNode(i).resolveRef().schema);if(Array.isArray(n.items)&&n.items.length>+t)return[e.step(e.createNode(n),t,{}).schema];if(n.additionalItems&&!zt(n.items)){const i=n.additionalItems===!0?{type:"string"}:n.additionalItems;return[e.createNode(i).resolveRef().schema]}if(Array.isArray(n.items)&&n.items.length<=+t)return[];const s=e.step(e.createNode(n),t,{});return Pn(s)?s:[s.schema]}const dW={};function Z$e(e,t=dW){const{pointer:n="#",data:r,schema:s=e.rootSchema,withSchemaWarning:i=!1}=t,o=j$e.split(n),a=e.createNode(s).resolveRef(),c=fW(a,o,r);return!i&&Pn(c)&&c.code==="schema-warning"?e.createNode(void 0):c}function fW(e,t,n=dW){if(t.length===0)return e.resolveRef();const r=t.shift(),s=e.draft.step(e,r,n);return Pn(s)?s:(n=n[r],fW(s,t,n))}var v_,pP;function eTe(){if(pP)return v_;pP=1;var e=function(_){return t(_)&&!n(_)};function t(N){return!!N&&typeof N=="object"}function n(N){var _=Object.prototype.toString.call(N);return _==="[object RegExp]"||_==="[object Date]"||i(N)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function i(N){return N.$$typeof===s}function o(N){return Array.isArray(N)?[]:{}}function a(N,_){return _.clone!==!1&&_.isMergeableObject(N)?x(o(N),N,_):N}function c(N,_,C){return N.concat(_).map(function(j){return a(j,C)})}function u(N,_){if(!_.customMerge)return x;var C=_.customMerge(N);return typeof C=="function"?C:x}function f(N){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(N).filter(function(_){return Object.propertyIsEnumerable.call(N,_)}):[]}function h(N){return Object.keys(N).concat(f(N))}function m(N,_){try{return _ in N}catch{return!1}}function y(N,_){return m(N,_)&&!(Object.hasOwnProperty.call(N,_)&&Object.propertyIsEnumerable.call(N,_))}function v(N,_,C){var j={};return C.isMergeableObject(N)&&h(N).forEach(function(A){j[A]=a(N[A],C)}),h(_).forEach(function(A){y(N,A)||(m(N,A)&&C.isMergeableObject(_[A])?j[A]=u(A,C)(N[A],_[A],C):j[A]=a(_[A],C))}),j}function x(N,_,C){C=C||{},C.arrayMerge=C.arrayMerge||c,C.isMergeableObject=C.isMergeableObject||e,C.cloneUnlessOtherwiseSpecified=a;var j=Array.isArray(_),A=Array.isArray(N),$=j===A;return $?j?C.arrayMerge(N,_,C):v(N,_,C):a(_,C)}x.all=function(_,C){if(!Array.isArray(_))throw new Error("first argument should be an array");return _.reduce(function(j,A){return x(j,A,C)},{})};var E=x;return v_=E,v_}var tTe=eTe();const nTe=Ki(tTe),rTe=(e,t)=>t,hW=(e,t)=>nTe(e,t,{arrayMerge:rTe});function sTe(e){switch(At(e)){case"string":case"array":return(e==null?void 0:e.length)===0;case"null":case"undefined":return!0;case"object":return Object.keys(e).length===0;default:return!1}}const mP=t0.templateDefaultOptions;let wa;function x_(e,t){const{$ref:n}=e;return n==null?!0:(wa[t]==null||wa[t][n]==null?0:wa[t][n])<t0.GET_TEMPLATE_RECURSION_LIMIT}function gP(e,t,n){const{$ref:r}=t;return r==null?t:(wa[n]=wa[n]||{},wa[n][r]=wa[n][r]||0,wa[n][r]+=1,e.createNode(t,n).resolveRef().schema)}function iTe(e,t){if(e==="string")return JSON.stringify(t);if(typeof t!="string")return null;try{if(t=JSON.parse(t),typeof t===e)return t}catch{}return null}function pW(e,t,n,r,s){if(At(t)!=="object")return Object.assign({pointer:r},t);if(x_(t,r)===!1&&n==null)return!1;let i=UO(gP(e,t,r));if(Array.isArray(t.anyOf)&&t.anyOf.length>0){if(x_(t.anyOf[0],`${r}/anyOf/0`)){const o=gP(e,t.anyOf[0],`${r}/anyOf/0`);i=hW(i,o),i.pointer=t.anyOf[0].$ref||i.pointer}delete i.anyOf}if(Array.isArray(t.allOf)&&t.allOf.map((a,c)=>x_(a,`${r}/allOf/${c}`)).reduceRight((a,c)=>a&&c,!0)){const a=[];let c=UO(n);for(let f=0;f<t.allOf.length;f+=1){const h=e.createNode(t.allOf[f],r);a.push(XH(h,c).schema),c=ms(e,c,{type:t.type,...a[f]},`${r}/allOf/${f}`,s)}const u=KH(e,{allOf:a});u&&(i=Kr(i,u))}return i.pointer=i.pointer||t.$ref||r,i}const yP=e=>e&&typeof e=="object";function ms(e,t,n,r,s){var i;if(n==null)throw new Error(`getTemplate: missing schema for data: ${JSON.stringify(t)}`);if(r==null)throw new Error("Missing pointer");let o=pW(e,n,t,r,s);if(!yP(o))return;if(r=o.pointer,o!=null&&o.const)return o.const;if(Array.isArray(o.oneOf))if(sTe(t)){const f=o.oneOf[0].type||o.type||o.const&&typeof o.const||At(t);o={...o.oneOf[0],type:f}}else{const f=e.createNode(o,r),h=KT(f,t);if(Pn(h)){if(t!=null&&s.removeInvalidData!==!0)return t;o=o.oneOf[0],t=void 0}else{const m=h.schema;m.type=(i=m.type)!==null&&i!==void 0?i:o.type,o=m}}if(!yP(o)||o.type==null)return;if(t instanceof File)return t;const a=Array.isArray(o.type)?oTe(o.type,t,o.default):o.type,c=At(t);return t!=null&&c!==a&&!(c==="number"&&a==="integer")&&(t=iTe(a,t)),bP[a]==null?s.removeInvalidData?void 0:t:bP[a](e,o,t,r,s)}function oTe(e,t,n){if(t==null){if(n!=null){const s=At(n);if(e.includes(s))return s}return e[0]}const r=At(t);return e.includes(r)?r:e[0]}const bP={null:(e,t,n)=>Rm(t,n,null),string:(e,t,n)=>Rm(t,n,""),number:(e,t,n)=>Rm(t,n,0),integer:(e,t,n)=>Rm(t,n,0),boolean:(e,t,n)=>Rm(t,n,!1),object:(e,t,n,r,s)=>{var i;const o=t.default===void 0?{}:t.default,a={},c=s.extendDefaults===!1&&t.default!==void 0?[]:(i=t.required)!==null&&i!==void 0?i:[];t.properties&&Object.keys(t.properties).forEach(y=>{const v=n==null||n[y]==null?o[y]:n[y],x=c.includes(y);(v!=null||x||s.addOptionalProps)&&(a[y]=ms(e,v,t.properties[y],`${r}/properties/${y}`,s))});const u=e.createNode(t,r);let f=ZH(u,a);if(f){f=Kr(t,f),delete f.dependencies;const y=ms(e,n,f,`${r}/dependencies`,s);Object.assign(a,y)}n&&(s.removeInvalidData===!0&&(t.additionalProperties===!1||At(t.additionalProperties)==="object")?At(t.additionalProperties)==="object"&&Object.keys(n).forEach(y=>{a[y]==null&&e.isValid(n[y],t.additionalProperties)&&(a[y]=n[y])}):Object.keys(n).forEach(y=>a[y]==null&&(a[y]=n[y])));const h=e.createNode(t,r),m=Z1(h,a);if(qi(m)){const y=ms(e,a,{type:"object",...m.schema},r,s);Object.assign(a,y)}return a},array:(e,t,n,r,s)=>{var i,o,a;const c=t.default===void 0?[]:t.default,u=n||c,f=s.extendDefaults===!1&&t.default!==void 0?0:(i=t.minItems)!==null&&i!==void 0?i:0;if(t.items==null){if(t.additionalItems){const m=Math.max(f,u.length);for(let y=0;y<m;y+=1)u[y]=ms(e,u[y],t.additionalItems,`${r}/additionalItems`,s)}return n||[]}if(Array.isArray(t.items)){const m=Math.max(f??0,(a=(o=t.items)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0);for(let y=0;y<m;y+=1)t.items[y]?u[y]=ms(e,u[y]==null?c[y]:u[y],t.items[y],`${r}/items/${y}`,s):t.additionalItems&&(u[y]=ms(e,u[y]==null?c[y]:u[y],t.additionalItems,`${r}/additionalItems`,s));return u}if(At(t.items)!=="object")return u;const h=pW(e,t.items,n,r,s);if(h===!1)return u;if(r=h.pointer||r,h.oneOf&&u.length===0){const m=h.oneOf[0];for(let y=0;y<f;y+=1)u[y]=ms(e,u[y]==null?c[y]:u[y],m,`${r}/oneOf/0`,s);return u}if(h.oneOf&&u.length>0){const m=Math.max(f,u.length);for(let y=0;y<m;y+=1){let v=u[y]==null?c[y]:u[y];const x=e.createNode(h,r);let E=KT(x,v);E==null||Pn(E)?v!=null&&s.removeInvalidData!==!0?u[y]=v:(v=void 0,E=h.oneOf[0],u[y]=ms(e,v,E,`${r}/oneOf/${y}`,s)):u[y]=ms(e,v,E.schema,`${r}/oneOf/${y}`,s)}return u}if(h.type){for(let m=0,y=Math.max(f,u.length);m<y;m+=1)u[m]=ms(e,u[m]==null?c[m]:u[m],h,`${r}/items`,s);return u}return u}};function Rm(e,t,n){return t??(e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0?n:e.default)}const aTe=(e,t,n=e.rootSchema,r)=>(wa={},r?ms(e,t,n,"#",{...mP,...r}):ms(e,t,n,"#",mP));function lTe(e,t,n=e.rootSchema,r="#"){const s=e.createNode(n,r);return e.validate(s,t).length===0}function vP(e){const t=[];let n=0;const r=e.length;for(;n<r;){const s=e.charCodeAt(n++);if(s>=55296&&s<=56319&&n<r){const i=e.charCodeAt(n++);(i&64512)==56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),n--)}else t.push(s)}return t}function xP(e){const t=`${e}`;if(t.includes("e-"))return parseInt(t.replace(/.*e-/,""));const n=t.indexOf(".");return n===-1?0:t.length-(n+1)}var w_,wP;function cTe(){return wP||(wP=1,w_=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}),w_}var uTe=cTe();const mW=Ki(uTe),dTe=Object.prototype.hasOwnProperty,SP=(e,t)=>!(e[t]===void 0||!dTe.call(e,t)),fTe={additionalProperties:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(r.additionalProperties===!0||r.additionalProperties==null||At(r.patternProperties)==="object"&&r.additionalProperties===!1)return;const i=[];let o=Object.keys(t).filter(c=>t0.propertyBlacklist.includes(c)===!1);const a=Object.keys(r.properties||{});if(At(r.patternProperties)==="object"){const c=Object.keys(r.patternProperties).map(u=>new RegExp(u));o=o.filter(u=>{for(let f=0;f<c.length;f+=1)if(c[f].test(u))return!1;return!0})}for(let c=0,u=o.length;c<u;c+=1){const f=o[c];if(a.indexOf(f)===-1){const h=zt(r.additionalProperties);if(h&&Array.isArray(r.additionalProperties.oneOf)){const m=n.resolveOneOf(e.next(r.additionalProperties),t[f]);Pn(m)?i.push(n.errors.additionalPropertiesError({pointer:s,schema:r.additionalProperties,value:t,property:o[c],properties:a,errors:m.data.errors})):i.push(...n.validate(e.next(m,f),t[f]))}else if(h){const m=n.validate(e.next(r.additionalProperties,f),t[f]);i.push(...m)}else i.push(n.errors.noAdditionalPropertiesError({pointer:s,schema:r,value:t,property:o[c],properties:a}))}}return i},allOf:OAe,anyOf:LAe,dependencies:DAe,enum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=At(t);if(i==="object"||i==="array"){const o=JSON.stringify(t);for(let a=0;a<r.enum.length;a+=1)if(JSON.stringify(r.enum[a])===o)return}else if(r.enum.includes(t))return;return n.errors.enumError({pointer:s,schema:r,value:t,values:r.enum})},format:(e,t)=>{const{draft:n,schema:r}=e;if(n.validateFormat[r.format])return n.validateFormat[r.format](e,t)},items:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(r.items===!1)return Array.isArray(t)&&t.length===0?void 0:n.errors.invalidDataError({pointer:s,value:t,schema:r});const i=[];for(let o=0;o<t.length;o+=1){const a=t[o],c=n.step(e.next(r),o,t);if(Pn(c))return[c];const u=n.validate(c,a);i.push(...u)}return i},maximum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.maximum)){if(r.maximum&&r.maximum<t)return n.errors.maximumError({maximum:r.maximum,length:t,value:t,pointer:s,schema:r});if(r.maximum&&r.exclusiveMaximum===!0&&r.maximum===t)return n.errors.maximumError({maximum:r.maximum,length:t,pointer:s,schema:r,value:t})}},maxItems:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.maxItems)&&r.maxItems<t.length)return n.errors.maxItemsError({maximum:r.maxItems,length:t.length,schema:r,value:t,pointer:s})},maxLength:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(isNaN(r.maxLength))return;const i=vP(t).length;if(r.maxLength<i)return n.errors.maxLengthError({maxLength:r.maxLength,length:i,pointer:s,schema:r,value:t})},maxProperties:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=Object.keys(t).length;if(isNaN(r.maxProperties)===!1&&r.maxProperties<i)return n.errors.maxPropertiesError({maxProperties:r.maxProperties,length:i,pointer:s,schema:r,value:t})},minLength:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(isNaN(r.minLength))return;const i=vP(t).length;if(r.minLength>i)return r.minLength===1?n.errors.minLengthOneError({minLength:r.minLength,length:i,pointer:s,schema:r,value:t}):n.errors.minLengthError({minLength:r.minLength,length:i,pointer:s,schema:r,value:t})},minimum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.minimum)){if(r.minimum>t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:s,schema:r,value:t});if(r.exclusiveMinimum===!0&&r.minimum===t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:s,schema:r,value:t})}},minItems:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.minItems)&&r.minItems>t.length)return r.minItems===1?n.errors.minItemsOneError({minItems:r.minItems,length:t.length,pointer:s,schema:r,value:t}):n.errors.minItemsError({minItems:r.minItems,length:t.length,pointer:s,schema:r,value:t})},minProperties:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(isNaN(r.minProperties))return;const i=Object.keys(t).length;if(r.minProperties>i)return n.errors.minPropertiesError({minProperties:r.minProperties,length:i,pointer:s,schema:r,value:t})},multipleOf:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(isNaN(r.multipleOf)||typeof t!="number")return;const i=xP(t),o=xP(r.multipleOf);if(i>o)return n.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:s,schema:r});const a=Math.pow(10,o),c=Math.round(t*a),u=Math.round(r.multipleOf*a);if(c%u/a!==0)return n.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:s,schema:r})},not:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=[];return n.validate(e.next(r.not),t).length===0&&i.push(n.errors.notError({value:t,not:r.not,pointer:s,schema:r})),i},oneOf:NAe,pattern:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(new RegExp(r.pattern,"u").test(t)===!1)return n.errors.patternError({pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:s})},patternProperties:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=r.properties||{},o=r.patternProperties;if(At(o)!=="object")return;const a=[],c=Object.keys(t),u=Object.keys(o).map(f=>({regex:new RegExp(f),patternSchema:o[f]}));return c.forEach(f=>{let h=!1;for(let m=0,y=u.length;m<y;m+=1)if(u[m].regex.test(f)){h=!0;const v=n.validate(e.next(u[m].patternSchema,f),t[f]);v&&v.length>0&&a.push(...v)}i[f]||h===!1&&r.additionalProperties===!1&&a.push(n.errors.patternPropertiesError({key:f,pointer:s,schema:r,value:t,patterns:Object.keys(o).join(",")}))}),a},properties:(e,t)=>{const{draft:n,schema:r}=e,s=[],i=Object.keys(r.properties||{});for(let o=0;o<i.length;o+=1){const a=i[o];if(SP(t,a)){const c=n.step(e,a,t);if(Pn(c))s.push(c);else{const u=n.validate(c,t[a]);s.push(...u)}}}return s},propertiesRequired:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=[],o=Object.keys(r.properties||{});for(let a=0;a<o.length;a+=1){const c=o[a];if(t[c]===void 0)i.push(n.errors.requiredPropertyError({key:c,pointer:s,schema:r,value:t}));else{const u=n.step(e,c,t),f=n.validate(u,t[c]);i.push(...f)}}return i},required:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(Array.isArray(r.required)!==!1)return r.required.map(i=>{if(!SP(t,i))return n.errors.requiredPropertyError({key:i,pointer:s,schema:r,value:t})})},requiredNotEmpty:(e,t)=>{const{schema:n}=e;if(Array.isArray(n.required)!==!1)return n.required.map(r=>{const{draft:s,schema:i,pointer:o}=e;if(t[r]==null||t[r]==="")return s.errors.valueNotEmptyError({property:r,pointer:`${o}/${r}`,schema:i,value:t})})},uniqueItems:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if((Array.isArray(t)&&r.uniqueItems)===!1)return;const i=[],o=[];return t.forEach((a,c)=>{for(let u=c+1;u<t.length;u+=1)mW(a,t[u])&&!i.includes(u)&&(o.push(n.errors.uniqueItemsError({pointer:`${s}/${u}`,duplicatePointer:`${s}/${c}`,arrayPointer:s,value:JSON.stringify(a),schema:r})),i.push(u))}),o}},hTe={array:(e,t,n)=>{const{draft:r,schema:s,pointer:i}=e,o=n==null?void 0:n[t],a=At(s.items);if(a==="object")return Wx(e.next(s.items,t),o);if(a==="array"){if(s.items[t]===!0)return e.next(xa(o),t);if(s.items[t]===!1)return r.errors.invalidDataError({key:t,value:o,pointer:i,schema:s});if(s.items[t])return r.resolveRef(e.next(s.items[t],t));if(s.additionalItems===!1)return r.errors.additionalItemsError({key:t,value:o,pointer:i,schema:s});if(s.additionalItems===!0||s.additionalItems===void 0)return e.next(xa(o),t);if(At(s.additionalItems)==="object")return e.next(s.additionalItems,t);throw new Error(`Invalid schema ${JSON.stringify(s,null,2)} for ${JSON.stringify(n,null,2)}`)}return s.additionalItems!==!1&&o?e.next(xa(o),t):new Error(`Invalid array schema for ${t} at ${i}`)},object:(e,t,n)=>{var r,s;const{draft:i,pointer:o}=e,a=Wx(e,n),c=(r=a.schema)!==null&&r!==void 0?r:a,u=(s=c==null?void 0:c.properties)===null||s===void 0?void 0:s[t];if(u!==void 0){if(u===!1)return i.errors.forbiddenPropertyError({property:t,value:n,pointer:o,schema:c});if(u===!0)return e.next(xa(n==null?void 0:n[t]),t);const m=i.resolveRef(e.next(u,t));if(Pn(m))return m;if(m&&Array.isArray(m.schema.oneOf)){const y=e.next(m.schema,t),v=i.resolveOneOf(y,n[t]);return Pn(v)?v:y.merge(v.schema,"oneOf")}if(m)return m}const{patternProperties:f}=c;if(At(f)==="object"){let m;const y=Object.keys(f);for(let v=0,x=y.length;v<x;v+=1)if(m=new RegExp(y[v]),m.test(t))return e.next(f[y[v]],t)}const{additionalProperties:h}=c;if(At(h)==="object")return e.next(c.additionalProperties,t);if(n&&(h===void 0||h===!0)){const m=xa(n[t]);return m?e.next(m,t):void 0}return i.errors.unknownPropertyError({property:t,value:n,pointer:`${o}`,schema:c})}};function pTe(e,t,n){var r;const{draft:s,schema:i,pointer:o}=e,a=At(n);let c=(r=i.type)!==null&&r!==void 0?r:a;if(Array.isArray(c)){if(!c.includes(a))return s.errors.typeError({value:n,pointer:o,expected:i.type,received:a,schema:i});c=a}const u=hTe[c];if(u){const f=u(e,`${t}`,n);return f===void 0?s.errors.schemaWarning({pointer:o,value:n,schema:i,key:t}):f}return new Error(`Unsupported schema type ${i.type} for key ${t}`)}const mTe={array:(e,t)=>e.draft.typeKeywords.array.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),object:(e,t)=>e.draft.typeKeywords.object.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),string:(e,t)=>e.draft.typeKeywords.string.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),integer:(e,t)=>e.draft.typeKeywords.number.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),number:(e,t)=>e.draft.typeKeywords.number.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),boolean:(e,t)=>e.draft.typeKeywords.boolean.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),null:(e,t)=>e.draft.typeKeywords.null.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t))};function gTe(e,t){const n=At(e);return n==="number"&&(t==="integer"||Array.isArray(t)&&t.includes("integer"))?Number.isInteger(e)||isNaN(e)?"integer":"number":n}function yTe(e,t){if(!qi(e))throw new Error("node expected");const{draft:n,pointer:r}=e;e=e.resolveRef();const s=e.schema;if(s==null)throw new Error("missing schema");if(At(s)==="boolean")return s?[]:[n.errors.invalidDataError({pointer:r,schema:s,value:t})];if(Pn(s))return[s];if(s.const!==void 0)return mW(s.const,t)?[]:[n.errors.constError({pointer:r,schema:s,value:t,expected:s.const})];const i=gTe(t,s.type),o=s.type||i;return i!==o&&(!Array.isArray(o)||!o.includes(i))?[n.errors.typeError({pointer:r,schema:s,value:t,received:i,expected:o})]:n.validateType[i]==null?[n.errors.invalidTypeError({pointer:r,schema:s,value:t,receivedType:i})]:Yg(n.validateType[i](e,t)).filter(Hx)}function HO(e,t,n){const r=e.resolveRef(),{draft:s,schema:i,pointer:o}=r;n(i,t,o);const a=At(t);a==="object"?Object.keys(t).forEach(c=>{const u=s.step(r,c,t);qi(u)&&HO(u,t[c],n)}):a==="array"&&t.forEach((c,u)=>{const f=s.step(r,u,t);qi(f)&&HO(f,t[u],n)})}function bTe(e,t,n){n.$id=n.$id||t,e.remotes[t]=e.compileSchema(n)}const EP="__compiled",NP="__ref",vTe="getRef",xTe="getRoot",wTe="getContext",STe=/(#|\/)+$/g;function ETe(e,t,n=t,r=!1){if(t===!0||t===!1||t===void 0||t[EP]!==void 0)return t;const s={ids:{},anchors:{},remotes:e.remotes},i=JSON.stringify(t),o=JSON.parse(i);if(Object.defineProperties(o,{[EP]:{enumerable:!1,value:!0},[wTe]:{enumerable:!1,value:()=>s},[vTe]:{enumerable:!1,value:ca.bind(null,s,o)}}),r===!1&&i.includes("$ref")===!1)return o;o!==n&&Object.defineProperty(o,"$defs",{enumerable:!0,value:Object.assign({},n.definitions,n.$defs,o.definitions,o.$defs)});const a={},c=()=>o;return Ri(o,(u,f)=>{var h;if(u.$id){if(u.$id.startsWith("http")&&/(allOf|anyOf|oneOf|if)\/\d+$/.test(f)){const E=f.replace(/\/(allOf|anyOf|oneOf|if)\/\d+$/,""),N=_u.get(o,E);u.$id=(h=N.$id)!==null&&h!==void 0?h:u.$id}s.ids[u.$id.replace(STe,"")]=f}f=`#${f}`.replace(/##+/,"#");const m=f.replace(/\/[^/]+$/,""),y=f.replace(/\/[^/]+\/[^/]+$/,""),v=a[m]||a[y],x=aP(v,u.$id);a[f]=x,s.ids[x]==null&&(s.ids[x]=f),u.$anchor&&(s.anchors[`${x}#${u.$anchor}`]=f),u.$ref&&!u[NP]&&(Object.defineProperty(u,NP,{enumerable:!1,value:aP(x,u.$ref)}),Object.defineProperty(u,xTe,{enumerable:!1,value:c}))}),o}const NTe={...fTe,contains:(e,t)=>{var n,r;const{draft:s,schema:i,pointer:o}=e;if(i.contains===!1)return s.errors.containsArrayError({pointer:o,value:t,schema:i});if(i.contains===!0)return Array.isArray(t)&&t.length===0?s.errors.containsAnyError({pointer:o,value:t,schema:i}):void 0;if(At(i.contains)!=="object")return;let a=0;for(let f=0;f<t.length;f+=1)s.validate(e.next(i.contains,f),t[f]).length===0&&a++;const c=(n=i.maxContains)!==null&&n!==void 0?n:1/0,u=(r=i.minContains)!==null&&r!==void 0?r:1;if(!(c>=a&&u<=a))return c<a?s.errors.containsMaxError({pointer:o,schema:i,delta:a-c,value:t}):u>a?s.errors.containsMinError({pointer:o,schema:i,delta:u-a,value:t}):s.errors.containsError({pointer:o,schema:i,value:t})},exclusiveMaximum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.exclusiveMaximum)&&r.exclusiveMaximum<=t)return n.errors.maximumError({maximum:r.exclusiveMaximum,length:t,pointer:s,schema:r,value:t})},exclusiveMinimum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.exclusiveMinimum)&&r.exclusiveMinimum>=t)return n.errors.minimumError({minimum:r.exclusiveMinimum,length:t,pointer:s,schema:r,value:t})},if:_Ae,maximum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.maximum)&&r.maximum&&r.maximum<t)return n.errors.maximumError({maximum:r.maximum,length:t,pointer:s,schema:r,value:t})},minimum:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(!isNaN(r.minimum)&&r.minimum>t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:s,schema:r,value:t})},patternProperties:(e,t)=>{const{draft:n,schema:r,pointer:s}=e,i=r.properties||{},o=r.patternProperties;if(At(o)!=="object")return;const a=[],c=Object.keys(t),u=Object.keys(o).map(f=>({regex:new RegExp(f),patternSchema:o[f]}));return c.forEach(f=>{let h=!1;for(let m=0,y=u.length;m<y;m+=1)if(u[m].regex.test(f)){if(h=!0,u[m].patternSchema===!1){a.push(n.errors.patternPropertiesError({key:f,pointer:s,patterns:Object.keys(o).join(","),schema:r,value:t}));return}const v=n.validate(e.next(u[m].patternSchema,f),t[f]);v&&v.length>0&&a.push(...v)}i[f]||h===!1&&r.additionalProperties===!1&&a.push(n.errors.patternPropertiesError({key:f,pointer:s,patterns:Object.keys(o).join(","),schema:r,value:t}))}),a},propertyNames:(e,t)=>{const{draft:n,schema:r,pointer:s}=e;if(r.propertyNames===!1)return Object.keys(t).length===0?void 0:n.errors.invalidPropertyNameError({property:Object.keys(t),pointer:s,value:t,schema:r});if(r.propertyNames===!0||At(r.propertyNames)!=="object")return;const i=[],o=Object.keys(t),a={...r.propertyNames,type:"string"};return o.forEach(c=>{const u=e.next(a,c),f=n.validate(u,c);f.length>0&&i.push(n.errors.invalidPropertyNameError({property:c,pointer:s,validationError:f[0],value:t[c],schema:r}))}),i}},gW=e=>zt(e)?Object.keys(e).map(t=>new RegExp(t)):[];function _Te(e,t,n){var r,s;const i=e.draft.resolveRef(e),{schema:o}=i;if(o.additionalProperties===!0)return!0;if(!((r=o.properties)===null||r===void 0)&&r[t]){const c=(s=o.properties)===null||s===void 0?void 0:s[t];if(i.draft.isValid(n,c))return!0}if(gW(o.patternProperties).find(c=>c.test(t)))return!0;if(zt(o.additionalProperties)){const c=o.additionalProperties;return i.draft.validate(i.next(c),n)}return!1}const CTe={...NTe,dependencies:void 0,dependentSchemas:IAe,dependentRequired:kAe,unevaluatedProperties:(e,t)=>{var n;const{draft:r,schema:s,pointer:i}=e;if(!zt(t)||s.unevaluatedProperties==null)return;let o=Object.keys(t);if(o.length===0)return;const a=Wx(e,t),c=(n=a.schema)!==null&&n!==void 0?n:a;if(c.unevaluatedProperties===!0)return;const u=gW(c.patternProperties);if(o=o.filter(h=>{var m;return!(!((m=c.properties)===null||m===void 0)&&m[h]||zt(s.if)&&_Te(e.next({type:"object",...s.if}),h,t[h])||u.find(y=>y.test(h))||c.additionalProperties)}),o.length===0)return;const f=[];return c.unevaluatedProperties===!1?(o.forEach(h=>{f.push(r.errors.unevaluatedPropertyError({pointer:`${i}/${h}`,value:JSON.stringify(t[h]),schema:s}))}),f):(o.forEach(h=>{if(zt(c.unevaluatedProperties)){const m=r.validate(e.next(c.unevaluatedProperties,h),t[h]);f.push(...m)}}),f)},unevaluatedItems:(e,t)=>{var n;const{draft:r,schema:s,pointer:i}=e;if(!Array.isArray(t)||t.length===0||s.unevaluatedItems==null||s.unevaluatedItems===!0)return;const o=Wx(r.resolveRef(e),t),a=(n=o.schema)!==null&&n!==void 0?n:o;if(a.unevaluatedItems===!0||a.additionalItems===!0)return;if(zt(s.if)){const u={type:"array",...s.if};if(r.isValid(t,u)&&Array.isArray(u.items)&&u.items.length===t.length)return}if(zt(a.items)){const u={...a,unevaluatedItems:void 0};return r.validate(e.next(u),t).map(h=>r.errors.unevaluatedItemsError({...h.data}))}if(Array.isArray(a.items)){const u=[];for(let f=a.items.length;f<t.length;f+=1)f<a.items.length?r.validate(e.next(a.items[f],f),t[f]).length>0&&u.push({index:f,value:t[f]}):u.push({index:f,value:t[f]});return u.map(f=>r.errors.unevaluatedItemsError({pointer:`${i}/${f.index}`,value:JSON.stringify(f.value),schema:a.unevaluatedItems}))}if(zt(a.unevaluatedItems))return t.map((u,f)=>{if(!r.isValid(u,a.unevaluatedItems))return r.errors.unevaluatedItemsError({pointer:`${i}/${f}`,value:JSON.stringify(u),schema:a.unevaluatedItems})});const c=[];return t.forEach((u,f)=>{c.push(r.errors.unevaluatedItemsError({pointer:`${i}/${f}`,value:JSON.stringify(u),schema:s}))}),c}},OTe={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","unevaluatedItems","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependentSchemas","dependentRequired","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required","unevaluatedProperties"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:CTe,validateType:mTe,validateFormat:qO,errors:M$e,createNode:TAe,addRemoteSchema:bTe,compileSchema:ETe,createSchemaOf:xa,each:HO,eachSchema:Ri,getChildSchemaSelection:Q$e,getSchema:Z$e,getTemplate:aTe,isValid:lTe,resolveAllOf:CAe,resolveAnyOf:PAe,resolveOneOf:SAe,resolveRef:QH,step:pTe,validate:yTe,templateDefaultOptions:t0.templateDefaultOptions};class yW extends w$e{constructor(t,n={}){super(hW(OTe,n),t)}}/*!
 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
 *
 * Copyright (c) 2014-2017, Jon Schlinkert.
 * Released under the MIT License.
 */function _P(e){return Object.prototype.toString.call(e)==="[object Object]"}function CP(e){var t,n;return _P(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(_P(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Rv={exports:{}},jTe=Rv.exports,OP;function ATe(){return OP||(OP=1,function(e){(function(t,n){e.exports=n()})(jTe,function(){var t=Object.prototype.toString;function n(h,m){return h==null?!1:Object.prototype.hasOwnProperty.call(h,m)}function r(h){if(!h||o(h)&&h.length===0)return!0;if(typeof h!="string"){for(var m in h)if(n(h,m))return!1;return!0}return!1}function s(h){return t.call(h)}function i(h){return typeof h=="object"&&s(h)==="[object Object]"}var o=Array.isArray||function(h){return t.call(h)==="[object Array]"};function a(h){return typeof h=="boolean"||s(h)==="[object Boolean]"}function c(h){var m=parseInt(h);return m.toString()===h?m:h}function u(h){h=h||{};var m=function(N){return Object.keys(m).reduce(function(_,C){return C==="create"||typeof m[C]=="function"&&(_[C]=m[C].bind(m,N)),_},{})},y;h.includeInheritedProps?y=function(){return!0}:y=function(N,_){return typeof _=="number"&&Array.isArray(N)||n(N,_)};function v(N,_){if(y(N,_))return N[_]}var x;h.includeInheritedProps?x=function(N,_){typeof _!="string"&&typeof _!="number"&&(_=String(_));var C=v(N,_);if(_==="__proto__"||_==="prototype"||_==="constructor"&&typeof C=="function")throw new Error("For security reasons, object's magic properties cannot be set");return C}:x=function(N,_){return v(N,_)};function E(N,_,C,j){if(typeof _=="number"&&(_=[_]),!_||_.length===0)return N;if(typeof _=="string")return E(N,_.split(".").map(c),C,j);var A=_[0],$=x(N,A);return _.length===1?(($===void 0||!j)&&(N[A]=C),$):($===void 0&&(typeof _[1]=="number"?N[A]=[]:N[A]={}),E(N[A],_.slice(1),C,j))}return m.has=function(N,_){if(typeof _=="number"?_=[_]:typeof _=="string"&&(_=_.split(".")),!_||_.length===0)return!!N;for(var C=0;C<_.length;C++){var j=c(_[C]);if(typeof j=="number"&&o(N)&&j<N.length||(h.includeInheritedProps?j in Object(N):n(N,j)))N=N[j];else return!1}return!0},m.ensureExists=function(N,_,C){return E(N,_,C,!0)},m.set=function(N,_,C,j){return E(N,_,C,j)},m.insert=function(N,_,C,j){var A=m.get(N,_);j=~~j,o(A)||(A=[],m.set(N,_,A)),A.splice(j,0,C)},m.empty=function(N,_){if(!r(_)&&N!=null){var C,j;if(C=m.get(N,_)){if(typeof C=="string")return m.set(N,_,"");if(a(C))return m.set(N,_,!1);if(typeof C=="number")return m.set(N,_,0);if(o(C))C.length=0;else if(i(C))for(j in C)y(C,j)&&delete C[j];else return m.set(N,_,null)}}},m.push=function(N,_){var C=m.get(N,_);o(C)||(C=[],m.set(N,_,C)),C.push.apply(C,Array.prototype.slice.call(arguments,2))},m.coalesce=function(N,_,C){for(var j,A=0,$=_.length;A<$;A++)if((j=m.get(N,_[A]))!==void 0)return j;return C},m.get=function(N,_,C){if(typeof _=="number"&&(_=[_]),!_||_.length===0)return N;if(N==null)return C;if(typeof _=="string")return m.get(N,_.split("."),C);var j=c(_[0]),A=x(N,j);return A===void 0?C:_.length===1?A:m.get(N[j],_.slice(1),C)},m.del=function(_,C){if(typeof C=="number"&&(C=[C]),_==null||r(C))return _;if(typeof C=="string")return m.del(_,C.split("."));var j=c(C[0]);if(x(_,j),!y(_,j))return _;if(C.length===1)o(_)?_.splice(j,1):delete _[j];else return m.del(_[j],C.slice(1));return _},m}var f=u();return f.create=u,f.withInheritedProps=u({includeInheritedProps:!0}),f})}(Rv)),Rv.exports}var $Te=ATe();const TTe=Ki($Te);var Wf=Object.prototype.hasOwnProperty;function $o(e){if(WO(e))return!1;if(!e||Dh(e)&&e.length===0)return!0;if(!bW(e)){for(var t in e)if(Wf.call(e,t))return!1;return!0}return!1}function WO(e){return typeof e=="number"}function bW(e){return typeof e=="string"}function Dh(e){return Array.isArray(e)}function GO(e,t){for(var n in t)Wf.call(t,n)&&(e[n]=t[n]);return e}function RTe(e){var t=parseInt(e);return t.toString()===e?t:e}function Gx(e,t,n){return e==null?t?n?[]:{}:e:Dh(e)?e.slice():GO({},e)}function Yx(e,t){if(e!==t&&CP(e)&&CP(t)){var n={};for(var r in e)Wf.call(e,r)&&(Wf.call(t,r)?n[r]=Yx(e[r],t[r]):n[r]=e[r]);for(r in t)Wf.call(t,r)&&(n[r]=Yx(e[r],t[r]));return n}return t}function Ba(e,t,n,r){if(WO(n)&&(n=[n]),$o(n))return t;if(bW(n))return Ba(e,t,n.split(".").map(RTe),r);var s=n[0];return(!e||e===t)&&(e=Gx(t,!0,WO(s))),n.length===1?r(e,s):(t!=null&&(t=t[s]),e[s]=Ba(e[s],t,n.slice(1),r),e)}var ls={};ls.set=function(t,n,r,s){return $o(r)?s:Ba(t,n,r,function(i,o){return i[o]=s,i})};ls.update=function(t,n,r,s){return $o(r)?s(Gx(n)):Ba(t,n,r,function(i,o){return i[o]=s(i[o]),i})};ls.push=function(t,n,r){var s=Array.prototype.slice.call(arguments,3);return $o(r)?Dh(n)?n.concat(s):s:Ba(t,n,r,function(i,o){return Dh(i[o])?i[o]=i[o].concat(s):i[o]=s,i})};ls.insert=function(t,n,r,s,i){if(i=~~i,$o(r)){if(!Dh(n))return[s];var o=n.slice(0,i);return o.push(s),o.concat(n.slice(i))}return Ba(t,n,r,function(a,c){var u=a[c];if(!Dh(u)){if(u!=null&&typeof u<"u")throw new Error("Expected "+r+"to be an array. Instead got "+typeof r);u=[]}var f=u.slice(0,i);return f.push(s),a[c]=f.concat(u.slice(i)),a})};ls.del=function(t,n,r){if(!$o(r))return Ba(t,n,r,function(s,i){return Array.isArray(s)?s[i]!==void 0&&s.splice(i,1):Wf.call(s,i)&&delete s[i],s})};ls.assign=function(t,n,r,s){return $o(r)?$o(s)?n:GO(Gx(n),s):Ba(t,n,r,function(i,o){s=Object(s);var a=Gx(i[o],!0);return GO(a,s),i[o]=a,i})};ls.merge=function(t,n,r,s){return $o(r)?$o(s)?n:Yx(n,s):Ba(t,n,r,function(i,o){return s=Object(s),i[o]=Yx(i[o],s),i})};var MTe=ls.set.bind(null,null);ls.update.bind(null,null);ls.push.bind(null,null);ls.insert.bind(null,null);var kTe=ls.del.bind(null,null);ls.assign.bind(null,null);ls.merge.bind(null,null);TTe.get;function ITe(e){return e==null||e===""}function vW(e,t,n){if(!(ITe(e)&&typeof(n==null?void 0:n.required)=="boolean"&&!n.required)){switch(t.type){case"string":return String(e);case"integer":case"number":return Number(e);case"boolean":return["true","1",1,"on",!0].includes(e);case"null":return null}return e}}const t5=e=>typeof e<"u"&&e!==null&&e!=="";function Jx(e){return"#"+(e.includes(".")?e.split("."):[e]).filter(t5).map(n=>"/"+n).join("")}function n5(e="",t=""){const n=e.includes(".")?e.split("."):[e];return[t,...n].filter(t5).join(".")}function xW(e="",t=""){return[...e.includes(".")?e.split("."):[e],t].filter(t5).join(".")}function DTe(e){return e.substring(0,e.lastIndexOf("/"))}function PTe(e,t,n,r){var c;if(t==="#/"||!n)return!1;const s=e.getSchema({pointer:t,data:r,schema:n});if(typeof s=="object"&&"const"in s)return!0;const i=DTe(t),o=e.getSchema({pointer:i,data:r});return!!((c=o==null?void 0:o.required)==null?void 0:c.includes(t.split("/").pop()))}function Tu(e,t){if(!e||!t)return!1;const n=Array.isArray(e)?e:[e];return(Array.isArray(t)?t:[t]).some(s=>n.includes(s))}function wW(e,t){if(typeof t=="object"&&"title"in t)return t.title;if(!e)return"";const n=e.includes(".")?e.split(".").pop()??"":e;return wh(n)}function r5(e){if(!(!e||typeof e!="object"))return e.anyOf??e.oneOf}function SW(e,t){const n=r5(e);if(!n)return[-1,[],void 0];const r=n.findIndex(s=>new yW(s).validate(t,s).length===0);return r===-1?[-1,n,void 0]:[r,n,n[r]]}function LTe(e,t,n){if(typeof e!="object"||!("properties"in e)||t.length===0)return[e,n];const r=JSON.parse(JSON.stringify(e)),s=n?JSON.parse(JSON.stringify(n)):void 0,i={...r,properties:Cs(r.properties,t)};i.required&&(i.required=i.required.filter(a=>!t.includes(a)));const o=Cs(s,t);return[i,o]}function EW(e){return typeof e=="object"&&"type"in e&&!Tu(e.type,"error")}function FTe(...e){for(const t of e)if(typeof t<"u")return t}const tS=w.createContext(void 0);tS.displayName="FormContext";function s5({schema:e,initialValues:t,initialOpts:n,children:r,onChange:s,onSubmit:i,onInvalidSubmit:o,validateOn:a="submit",hiddenSubmit:c=!0,ignoreKeys:u=[],options:f={},...h}){const[m,y]=LTe(e,u,t),v=w.useMemo(()=>new yW(m),[JSON.stringify(m)]),x=y??v.getTemplate(void 0,m,n),E=w.useMemo(()=>Ih({dirty:!1,submitting:!1,errors:[],data:x}),[x]),N=JT(E),_=w.useRef(null);w.useEffect(()=>{x&&M()},[x]);async function C(P){const{data:F,errors:V}=M();if(i){P.preventDefault(),N(H=>({...H,submitting:!0}));try{V.length===0?await i(F):(console.log("invalid",V),o==null||o(V,F))}catch(H){console.warn(H)}return N(H=>({...H,submitting:!1})),!1}else if(V.length>0)return P.preventDefault(),o==null||o(V,F),!1}const j=Lt((P,F)=>{N(V=>{const H=V.data,I=MTe(H,P,F);return s==null||s(I,P,F),{...V,data:I}}),R()}),A=Lt(P=>{N(F=>{const V=F.data,H=kTe(V,P);return s==null||s(H,P,void 0),{...F,data:H}}),R()}),$=Lt(()=>WH().get(E)),R=Lt(()=>{var F;const P=$();N(V=>({...V,dirty:!Ca(x,P.data)})),(a==="change"||((F=P==null?void 0:P.errors)==null?void 0:F.length)>0)&&M()}),M=Lt(P=>{var H;const F=P??((H=$())==null?void 0:H.data),V=v.validate(F,m);return N(I=>({...I,errors:V})),{data:F,errors:V}}),D=w.useMemo(()=>({_formStateAtom:E,setValue:j,deleteValue:A,schema:m,lib:v,options:f,root:"",path:""}),[m,x]);return p.jsxs("form",{...h,ref:_,onSubmit:C,children:[p.jsxs(tS.Provider,{value:D,children:[r||p.jsx(Xi,{name:""}),(f==null?void 0:f.debug)&&p.jsx(rS,{})]}),c&&p.jsx("button",{style:{visibility:"hidden"},type:"submit",children:"Submit"})]})}function _d(){return w.useContext(tS)}function i5({children:e,overrideData:t,prefix:n,...r}){const s=_d(),i={};n&&(i.root=n);const o={...s,...r,...i};return p.jsx(tS.Provider,{value:o,children:e})}function nS(e,t){const{_formStateAtom:n,root:r}=_d();if((typeof e!="string"||e.length===0)&&(t==null?void 0:t.strict)===!0)return{value:void 0,errors:[]};const s=e0(n,w.useCallback(i=>{const o=n5(e,r),a=Jx(o);return{value:BA(i.data,o),errors:i.errors.filter(c=>c.data.pointer.startsWith(a))}},[e]),Ca);return yp(s)[0]}function n0(e,t){const{_formStateAtom:n,root:r}=_d(),s=e0(n,w.useCallback(i=>{const o=n5(e,r),a=Jx(o);return i.errors.filter(c=>t!=null&&t.strict?c.data.pointer===a:c.data.pointer.startsWith(a))},[e]),Ca);return yp(s)[0]}function NW(e,t=[]){const{_formStateAtom:n}=_d(),r=e0(n,w.useCallback(e,t),Ca);return yp(r)[0]}function Cd(e,t,n){const{_formStateAtom:r,root:s,lib:i,...o}=_d(),a=o.schema,c=e0(r,w.useCallback(u=>{const f=Jx(e),h=n5(e,s),m=Jx(h),y=BA(u.data,h),v=f==="#/"?a:i.getSchema({pointer:f,data:y,schema:a}),x=PTe(i,m,a,u.data),E={...o,path:h,root:s,schema:v,pointer:f,required:x},N=t==null?void 0:t({...E,_formStateAtom:r,lib:i,value:y});return{...E,value:N}},[e,a??{},s]),Ca);return{...YT(c),_formStateAtom:r,lib:i}}function r0({children:e,selector:t}){return e(NW(t??(n=>n)))}function rS({force:e=!1}){const{options:t}=_d();if((t==null?void 0:t.debug)!==!0&&e!==!0)return null;const n=NW(r=>r);return p.jsx(ui,{json:n,expand:99})}function Xx({name:e,label:t,required:n,schema:r,wrapper:s,hidden:i,errorPlacement:o="bottom",descriptionPlacement:a="bottom",children:c,fieldId:u,...f}){const h=n0(e,{strict:!0}),m=(r==null?void 0:r.examples)||[],y=`${e}-examples`,v=(f==null?void 0:f.description)??(r==null?void 0:r.description),x=typeof t<"u"?t:r?wW(e,r):e,E=h.length>0&&p.jsx(jOe,{children:h.map(_=>_.message).join(", ")}),N=v&&p.jsx(OOe,{className:a==="top"?"-mt-1 mb-1":"mb-2",children:v});return p.jsxs(Ji,{error:h.length>0,as:s==="fieldset"?"fieldset":"div",className:i?"hidden":"relative",children:[o==="top"&&E,p.jsx(BTe,{name:e,schema:r,required:n}),x&&p.jsxs(Ao,{as:s==="fieldset"?"legend":"label",htmlFor:u,className:"self-start",children:[x," ",n&&p.jsx("span",{className:"font-medium opacity-30",children:"*"})]}),a==="top"&&N,p.jsx("div",{className:"flex flex-row gap-2",children:p.jsxs("div",{className:"flex flex-1 flex-col gap-3",children:[w.Children.count(c)===1&&w.isValidElement(c)?w.cloneElement(c,{list:m.length>0?y:void 0}):c,m.length>0&&p.jsx("datalist",{id:y,children:m.map((_,C)=>p.jsx("option",{value:_},C))})]})}),a==="bottom"&&N,o==="bottom"&&E]})}const BTe=({name:e,schema:t,required:n})=>{const{options:r}=_d();if(!(r!=null&&r.debug))return null;const{value:s}=nS(e),i=n0(e,{strict:!0});return p.jsx("div",{className:"absolute top-0 right-0",children:p.jsx(PT,{overlayProps:{className:"max-w-none"},position:"bottom-end",target:({toggle:o})=>p.jsx(ui,{className:"bg-background pr-3 text-sm",json:{name:e,value:s,required:n,schema:t,errors:i},expand:6}),children:p.jsx(St,{Icon:TV,size:"xs",className:"opacity-30"})})})},zTe=({path:e=""})=>{const{setValue:t,pointer:n,required:r,schema:s,...i}=Cd(e);return!s||typeof s>"u"?`ArrayField(${e}): no schema ${n}`:s.uniqueItems&&typeof s.items=="object"&&"enum"in s.items?p.jsx(Xx,{name:e,schema:s,wrapper:"fieldset",children:p.jsx(iS,{required:!0,name:e,schema:s.items,multiple:!0,className:"h-auto",onChange:o=>{const a=Array.from(o.target.selectedOptions).map(c=>c.value);t(i.path,a)}})}):p.jsxs(Xx,{name:e,schema:s,wrapper:"fieldset",children:[p.jsx(UTe,{name:e,children:({value:o})=>o==null?void 0:o.map((a,c)=>p.jsx(VTe,{path:e,index:c,schema:s},c))}),p.jsx("div",{className:"flex flex-row",children:p.jsx(qTe,{path:e,schema:s})})]})},VTe=w.memo(({path:e,index:t,schema:n})=>{const{value:r,...s}=Cd(e,h=>{var m;return(m=h.value)==null?void 0:m[t]}),i=xW(e,t);let o=n.items;if(r5(n.items)){const[,,h]=SW(n.items,r);o=h}const c=Lt((h,m)=>{s.setValue(h,m)}),u=Lt(h=>{s.deleteValue(h)}),f=w.useMemo(()=>p.jsx(St,{Icon:MV,onClick:()=>u(i),size:"sm"}),[i]);return p.jsxs("div",{className:"flex flex-row gap-2",children:[p.jsx(iS,{name:i,schema:o,value:r,onChange:h=>{c(i,vW(h.target.value,o))},className:"w-full"}),f]},i)},Ca),UTe=w.memo(({name:e,children:t})=>t(nS(e)),(e,t)=>{var n,r;return((n=e.value)==null?void 0:n.length)===((r=t.value)==null?void 0:r.length)}),qTe=({schema:e,path:t})=>{const{setValue:n,value:{currentIndex:r},...s}=Cd(t,a=>{var c;return{currentIndex:((c=a.value)==null?void 0:c.length)??0}}),i=r5(e.items);function o(a){const c=xW(t,r);n(c,a??s.lib.getTemplate(void 0,e.items))}return i?p.jsx(Ur,{dropdownWrapperProps:{className:"min-w-0"},items:i.map((a,c)=>({label:a.title??`Option ${c+1}`,onClick:()=>o(s.lib.getTemplate(void 0,a))})),onClickItem:console.log,children:p.jsx(ot,{IconLeft:vve,children:"Add"})}):p.jsx(ot,{onClick:()=>o(),children:"Add"})},_W=w.createContext(void 0),o5=()=>w.useContext(_W),HTe=Ih(null),WTe=({path:e="",children:t})=>{const{setValue:n,lib:r,pointer:s,value:{matchedIndex:i,schemas:o},schema:a}=Cd(e,v=>{const[x,E=[]]=SW(v.schema,v.value);return{matchedIndex:x,schemas:E}}),c=n0(e,{strict:!0});if(!a)return`AnyOfField(${e}): no schema ${s}`;const[u,f]=yp(HTe),h=u!==null?u:i>-1?i:null,m=Lt(v=>{n(e,v!==null?r.getTemplate(void 0,o[v]):void 0),f(v)}),y=w.useMemo(()=>{const v=o.map((N,_)=>N.title??`Option ${_+1}`),x={type:"string",enum:v},E=h!==null?o[h]:void 0;return{options:v,selectSchema:x,selectedSchema:E,schema:a,schemas:o,selected:h}},[h]);return p.jsx(_W.Provider,{value:{...y,select:m,path:e,errors:c},children:t},h)},GTe=()=>{const{selected:e,select:t,path:n,schema:r,options:s,selectSchema:i}=o5(),o=Lt(c=>{const u=c.target.value?Number(c.target.value):null;t(u)}),a=w.useMemo(()=>s.map((c,u)=>({label:c,value:u})),[]);return p.jsxs(p.Fragment,{children:[p.jsx(Ao,{children:wW(n,r)}),p.jsx(iS,{schema:i,options:a,onChange:o,value:e??void 0,className:"h-8 py-1"})]})},YTe=({name:e,label:t,...n})=>{const{selected:r,selectedSchema:s,path:i,errors:o}=o5();return r===null?null:p.jsx(i5,{prefix:i,schema:s,children:p.jsx("div",{className:Ue(o.length>0&&"bg-red-500/10"),children:p.jsx(Xi,{name:"",label:!1,...n},`${i}_${r}`)})})},ag={Root:WTe,Select:GTe,Field:YTe,useContext:o5},JTe=e=>p.jsx("fieldset",{children:p.jsxs(ag.Root,{...e,children:[p.jsx("legend",{className:"flex flex-row gap-2 items-center py-2",children:p.jsx(ag.Select,{})}),p.jsx(ag.Field,{})]})}),sS=({path:e="",label:t,wrapperProps:n={}})=>{const{schema:r,...s}=Cd(e);if(!EW(r))return`ObjectField "${e}": no schema`;const i=Object.entries(r.properties??{});return p.jsx(Xx,{name:e,schema:{...r,description:void 0},wrapper:"fieldset",errorPlacement:"top",...n,children:i.length===0?p.jsx("i",{className:"opacity-50",children:"No properties"}):i.map(([o,a])=>{const c=[e,o].filter(Boolean).join(".");if(!(typeof a>"u"||typeof a=="boolean"))return a.anyOf||a.oneOf?p.jsx(JTe,{path:c},c):p.jsx(Xi,{name:c},c)})})},Xi=e=>p.jsx(Ky,{fallback:XTe(e),children:p.jsx(KTe,{...e})}),CW=({as:e="div",className:t,...n})=>{const r=e;return p.jsx(r,{className:[t,"hidden"].filter(Boolean).join(" "),children:p.jsx(Xi,{...n})})},XTe=({name:e})=>({error:t})=>p.jsxs(OW,{children:['Field "',e,'" error: ',t.message]}),KTe=({name:e,onChange:t,placeholder:n,required:r,inputProps:s,...i})=>{const{path:o,setValue:a,schema:c,...u}=Cd(e),f=`${e}-${w.useId()}`,h=typeof r=="boolean"?r:u.required;if(!c)return p.jsxs(OW,{children:["[Field] ",o," has no schema (",JSON.stringify(c),")"]});if(Tu(c.type,"object"))return p.jsx(sS,{path:e});if(Tu(c.type,"array"))return p.jsx(zTe,{path:e});w.useEffect(()=>{s!=null&&s.defaultValue&&a(o,s.defaultValue)},[s==null?void 0:s.defaultValue]);const m=FTe(s==null?void 0:s.disabled,i.disabled,c.readOnly,"const"in c,!1),y=Lt(v=>{var E;const x=vW(v.target.value,c,{required:h});typeof x>"u"&&!h&&((E=u.options)==null?void 0:E.keepEmpty)!==!0?u.deleteValue(o):a(o,x)});return p.jsx(Xx,{name:e,required:h,schema:c,fieldId:f,...i,children:p.jsx(iS,{...s,id:f,schema:c,name:e,required:h,disabled:m,placeholder:n,onChange:t??y})})},OW=({children:e})=>p.jsx("pre",{className:"dark:bg-red-950 bg-red-100 rounded-md px-3 py-1.5 text-wrap whitespace-break-spaces  break-all",children:e}),iS=({schema:e,render:t,...n})=>{const{value:r}=nS(n.name,{strict:!0});if(!EW(e))return null;const s={...n,value:typeof n.value<"u"?n.value:r,placeholder:n.placeholder??typeof e.default<"u"?String(e.default):""};if(t)return t({schema:e,...s});if(e.enum)return p.jsx(AH,{options:e.enum,...s});if(Tu(e.type,["number","integer"])){const o={min:e.minimum,max:e.maximum,step:e.multipleOf};return p.jsx(Bc,{type:"number",...s,value:s.value??"",...o})}if(Tu(e.type,"boolean"))return p.jsx(TOe,{...s,checked:r===!0});if(Tu(e.type,"string")&&e.format==="date-time"){const o=s.value?new Date(s.value).toISOString().slice(0,16):"";return p.jsx(IO,{...s,value:o,type:"datetime-local",onChange:a=>{var u;const c=new Date(a.target.value);(u=s.onChange)==null||u.call(s,{target:{value:c.toISOString()}})}})}if(Tu(e.type,"string")&&e.format==="date")return p.jsx(IO,{...s,value:s.value??""});const i={maxLength:e.maxLength,minLength:e.minLength,pattern:e.pattern};return e.format&&["password","hidden","url","email","tel"].includes(e.format)&&(i.type=e.format),p.jsx(AOe,{...s,value:s.value??"",...i})};function a5({context:e,id:t,innerProps:{file:n}}){var m;const{config:{entity_name:r,basepath:s}}=VH(),i=T1(r,void 0,{where:{path:n.path}}),o=()=>e.closeModal(t),a=(m=i.data)==null?void 0:m[0],c=window.location.origin,u=a!=null&&a.reference?a==null?void 0:a.reference.split(".")[0]:void 0,f=u?"/data"+ut.data.entity.edit(u,a==null?void 0:a.entity_id):void 0,h=a!=null&&a.path?"/data"+ut.data.entity.edit(r,a==null?void 0:a.id):void 0;return p.jsxs("div",{className:"flex flex-col md:flex-row",children:[p.jsx("div",{className:"flex w-full md:w-[calc(100%-300px)] justify-center items-center bg-lightest min-w-0",children:p.jsx(QTe,{file:n})}),p.jsxs("div",{className:"w-full md:!w-[300px] flex flex-col",children:[p.jsx(kl,{title:"ID",value:a==null?void 0:a.id,copyValue:c+h,first:!0,children:h&&p.jsxs(vO,{href:h,size:"small",className:"py-1.5 px-2 !leading-none font-mono",onClick:o,children:["#",String(a==null?void 0:a.id)]})}),p.jsx(kl,{title:"Path",value:a==null?void 0:a.path}),p.jsx(kl,{title:"Mime Type",value:a==null?void 0:a.mime_type}),p.jsx(kl,{title:"Size",value:(a==null?void 0:a.size)&&HL.fileSize(a.size,1),copyValue:a==null?void 0:a.size}),p.jsx(kl,{title:"Etag",value:a==null?void 0:a.etag}),p.jsx(kl,{title:"Entity",copyValue:c+f,children:f&&p.jsxs(vO,{href:f,size:"small",className:"py-1.5 px-2 !leading-none font-mono",onClick:o,children:[a==null?void 0:a.reference," #",a==null?void 0:a.entity_id]})}),p.jsx(kl,{title:"Modified At",value:(a==null?void 0:a.modified_at)&&NL(a==null?void 0:a.modified_at),copyValue:a==null?void 0:a.modified_at}),p.jsx(kl,{title:"Metadata",value:a==null?void 0:a.metadata,copyable:!1,children:(a==null?void 0:a.metadata)&&p.jsx(ui,{json:a==null?void 0:a.metadata,expand:2,showCopy:!0,className:"w-full text-sm bg-primary/2 pt-2.5 rounded-lg",copyIconProps:{className:"size-6 opacity-20 group-hover:opacity-100 transition-all"}})})]})]})}const kl=({title:e,children:t,value:n,first:r,copyable:s=!0,copyValue:i})=>{const o=HK(),a=!t&&(n===null||typeof n>"u"),c=s&&!a&&o.copy!==void 0,u=n?typeof n=="object"&&!a?JSON.stringify(n):String(n):void 0;return p.jsxs("div",{className:Ue("flex flex-col gap-1 py-3 pl-5 pr-3 group",!r&&"border-t border-muted"),children:[p.jsx("div",{className:"text-sm font-bold opacity-50",children:wh(e)}),p.jsxs("div",{className:"flex flex-row gap-1 justify-between items-center",children:[t??p.jsx("div",{className:Ue("font-mono truncate",a&&"opacity-30"),children:a?"null":u}),c&&p.jsx(St,{Icon:o.copied?g1e:IU,className:Ue("size-6 opacity-20 group-hover:opacity-100 transition-all",o.copied&&"text-success-foreground opacity-100"),onClick:()=>o.copy(i||n)})]})]})},QTe=({file:e})=>e.type.startsWith("image/")||e.type.startsWith("video/")?p.jsx(WT.Preview,{file:e,className:"max-h-[70dvh]",controls:!0,muted:!0}):p.jsx("div",{className:"min-w-96 min-h-48 flex justify-center items-center h-full max-h-[70dvh]",children:p.jsx("span",{className:"opacity-50 font-mono",children:"No Preview Available"})});a5.defaultTitle=void 0;a5.modalProps={withCloseButton:!1,size:"auto",centered:!0,styles:{content:{overflowY:"initial !important"}},classNames:{root:"bknd-admin w-full max-w-xl",content:"overflow-hidden",title:"font-bold !text-md",body:"max-h-inherit !p-0"}};const Kx={test:qT,debug:VT,form:UT,overlay:uT,dataCreate:zT,mediaInfo:a5};function ZTe({children:e}){return p.jsx(fSe,{modals:Kx,children:e})}function e5e(e,t,{title:n,...r}={}){const s=n??Kx[e].defaultTitle??void 0,i=Kx[e].modalProps??{},o={title:s,...r,...i,modal:e,innerProps:t};return aSe({transitionProps:{transition:sje,duration:300},...o}),{close:()=>jW(e),closeAll:HU.closeAll}}function jW(e){return lSe(e)}const vr={ids:Object.fromEntries(Object.keys(Kx).map(e=>[e,e])),open:e5e,close:jW,closeAll:HU.closeAll};function t5e(){const[e]=$n(),{config:t,actions:n}=Fc(),r=Object.values(sn(t.roles??{},(o,a)=>({role:a,permissions:o.permissions,is_default:o.is_default??!1,implicit_allow:o.implicit_allow??!1})));function s(o){e(ut.auth.roles.edit(o.role))}function i(){vr.open("form",{schema:st({name:Zu}),uiSchema:{name:{"ui:title":"Role name"}},onSubmit:async o=>{o.name.length>0&&await n.roles.add(o.name)&&e(ut.auth.roles.edit(o.name))}},{title:"New Role"})}return p.jsxs(p.Fragment,{children:[p.jsx(Wn,{right:p.jsx(ot,{variant:"primary",onClick:i,children:"Create new"}),children:"Roles & Permissions"}),p.jsxs(pr,{children:[p.jsx(xo.Warning,{visible:!t.enabled,title:"Auth not enabled",message:"To use authentication features, please enable it in the settings."}),p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsx(J1,{data:r,renderValue:n5e,renderHeader:Cy,onClickRow:s})})]})]})}const n5e=({value:e,property:t})=>{if(["is_default","implicit_allow"].includes(t))return e?p.jsx("span",{children:"Yes"}):p.jsx("span",{className:"opacity-50",children:"No"});if(t==="permissions"){let r=e||[];const s=r.length;return s>3&&(r=[...r.slice(0,3),`+${s-3}`]),p.jsx("div",{className:"flex flex-row gap-1",children:r.map((i,o)=>p.jsx("span",{className:"inline-block px-2 py-1.5 text-sm bg-primary/5 rounded font-mono leading-none",children:i},o))})}return p.jsx(X1,{value:e,property:t})},oS=({path:e,backTo:t,onBack:n})=>{const[,,r]=$n(),s=Array.isArray(e)?e:[e],i=s.length>1,o=n||(()=>r({fallback:t})),a=w.useMemo(()=>s.map((c,u)=>({last:u===s.length-1,...c})),[s]);return p.jsxs("div",{className:"flex flex-row flex-grow items-center gap-2 text-lg",children:[i&&p.jsx(St,{onClick:o,Icon:rT,variant:"default",size:"lg",className:"mr-1"}),p.jsx("div",{className:"hidden md:flex gap-1.5",children:p.jsx(AW,{crumbs:a})}),p.jsx("div",{className:"flex md:hidden gap-2",children:p.jsx(r5e,{crumbs:a})})]})},AW=({crumbs:e})=>e.map((t,n)=>t.last?p.jsx($W,{...t},n):p.jsx(TW,{...t},n)),r5e=({crumbs:e})=>{const[,t]=yi();if(e.length<=2)return p.jsx(AW,{crumbs:e});const n=e[0],r=e[e.length-1],s=w.useMemo(()=>e.slice(1,-1).map(o=>({label:o.string,href:o.href})),[e]),i=Lt(o=>t(`~/${o.href}`));return p.jsxs(p.Fragment,{children:[p.jsx(TW,{...n}),p.jsx(Ur,{onClickItem:i,items:s,children:p.jsx(St,{Icon:Lc,variant:"ghost"})}),p.jsx("span",{className:"opacity-25 dark:font-bold font-semibold",children:"/"}),p.jsx($W,{...r})]})},$W=({label:e})=>p.jsx("span",{className:"text-nowrap dark:font-bold font-semibold",children:e}),TW=({href:e,label:t})=>p.jsxs("div",{className:"opacity-50 flex flex-row gap-1.5 dark:font-bold font-semibold",children:[p.jsx(M1,{to:e,className:"text-nowrap",children:t}),p.jsx("span",{className:"opacity-50",children:"/"})]}),s5e=Gz,i5e=w.forwardRef(({role:e,debug:t},n)=>{const{permissions:r}=Tt(),{formState:{isValid:s},watch:i,control:o,reset:a,getValues:c}=Za({resolver:el(s5e),defaultValues:e});return w.useImperativeHandle(n,()=>({reset:a,getData:()=>c(),isValid:()=>s})),p.jsxs("div",{className:"flex flex-col flex-grow px-5 py-5 gap-8",children:[p.jsx("div",{className:"flex flex-col gap-2",children:p.jsx(o5e,{control:o,permissions:r})}),p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsx(kt.Wrapper,{label:"Should this role be the default?",size:"md",description:"In case an user is not assigned any role, this role will be assigned by default.",children:p.jsx("div",{className:"flex flex-row",children:p.jsx(rg,{name:"is_default",control:o,className:"mt-2"})})}),p.jsx(kt.Wrapper,{label:"Implicit allow missing permissions?",size:"md",description:"This should be only used for admins. If a permission is not explicitly denied, it will be allowed.",children:p.jsx("div",{className:"flex flex-row",children:p.jsx(rg,{name:"implicit_allow",control:o,className:"mt-2"})})})]}),t&&p.jsxs("div",{className:"font-mono opacity-50",children:[p.jsx("div",{children:JSON.stringify(e,null,2)}),p.jsx("div",{children:JSON.stringify(i(),null,2)})]})]})}),o5e=({control:e,permissions:t})=>{const{field:{value:n,onChange:r,...s},fieldState:i}=Nd({name:"permissions",control:e}),o=n??[];function a(u){return f=>{const m=f.target.checked?[...o,u]:o.filter(y=>y!==u);r(m)}}const c=t.reduce((u,f)=>{const[h,m]=f.split(".");return u[h]||(u[h]=[]),u[h].push(f),u},{});return console.log("grouped",c),p.jsx("div",{className:"flex flex-col gap-10",children:Object.entries(c).map(([u,f])=>p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsxs("h3",{className:"font-semibold",children:[ii(u)," Permissions"]}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-3 gap-3",children:f.map(h=>{const m=o.includes(h);return p.jsx("div",{className:"flex flex-col border border-muted",children:p.jsxs("div",{className:"flex flex-row gap-2 justify-between",children:[p.jsx("div",{className:"py-4 px-4 font-mono leading-none",children:h}),p.jsxs("div",{className:"flex flex-row gap-1 items-center px-2",children:[p.jsx(Wa,{checked:m,onChange:a(h)}),p.jsx(ud,{label:"Coming soon",children:p.jsx(ot,{size:"small",variant:"ghost",disabled:!0,children:p.jsx("span",{className:"font-normal italic font-mono",children:"FX"})})})]})]})},h)})})]},u))})};function a5e(e){const{hasSecrets:t}=Tt({withSecrets:!0});return t?p.jsx(l5e,{...e}):p.jsx(Os.MissingPermission,{what:"Roles & Permissions"})}function l5e({params:e}){var u;const[t]=$n(),{config:n,actions:r}=Fc(),s=e.role,i=(u=n.roles)==null?void 0:u[s],o=w.useRef(null);async function a(){var m,y,v;if(console.log("data",(m=o.current)==null?void 0:m.isValid()),!((y=o.current)!=null&&y.isValid()))return;const f=(v=o.current)==null?void 0:v.getData();await r.roles.patch(s,f)&&t(ut.auth.roles.list())}async function c(){await r.roles.delete(s)&&t(ut.auth.roles.list())}return p.jsxs(p.Fragment,{children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(Ur,{items:[{label:"Advanced Settings",onClick:()=>t(ut.settings.path(["auth","roles",s]),{absolute:!0})},{label:"Delete",onClick:c,destructive:!0}],position:"bottom-end",children:p.jsx(St,{Icon:Lc})}),p.jsx(ot,{variant:"primary",onClick:a,children:"Update"})]}),className:"pl-3",children:p.jsx(oS,{path:[{label:"Roles & Permissions",href:ut.auth.roles.list()},{label:s}]})}),p.jsx(pr,{children:p.jsx(i5e,{ref:o,role:i})})]})}const RW=K$(k1({advanced:[]},e=>({toggleAdvanced:t=>e(n=>({advanced:n.advanced.includes(t)?n.advanced.filter(r=>r!==t):[...n.advanced,t]}))})));function c5e(e){as(["Auth","Settings"]);const{hasSecrets:t}=Tt({withSecrets:!0});return t?p.jsx(d5e,{...e}):p.jsx(Os.MissingPermission,{what:"Auth Settings"})}const u5e={ignoreKeys:["roles","strategies"],options:{keepEmpty:!0,debug:qr()}};function d5e(){const{config:e,schema:t,actions:n,$auth:r}=Fc(),s=JSON.parse(JSON.stringify(t));s.properties.jwt.required=["alg"];async function i(o){await n.config.set(o)}return p.jsxs(s5,{schema:s,initialValues:e,onSubmit:i,...u5e,children:[p.jsx(r0,{selector:o=>({dirty:o.dirty,errors:o.errors.length>0,submitting:o.submitting}),children:({dirty:o,errors:a,submitting:c})=>p.jsx(Wn,{className:"pl-4",right:p.jsx(ot,{variant:"primary",type:"submit",disabled:!o||a||c,children:"Update"}),children:"Settings"})}),p.jsxs(pr,{children:[p.jsxs(S_,{className:"pt-4 pl-0 pb-0",children:[p.jsx("div",{className:"pl-4",children:p.jsx(Jr,{name:"enabled",label:"Authentication Enabled",description:"Only after enabling authentication, all settings below will take effect.",descriptionPlacement:"top"})}),p.jsxs("div",{className:"flex flex-col gap-6 relative pl-4 pb-2",children:[p.jsx(AP,{}),p.jsx(Jr,{name:"guard.enabled",label:p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx("span",{children:"Guard Enabled"}),!r.roles.has_admin&&p.jsx(aT.Warning,{title:"No admin roles defined. Enabling the guard will likely block all requests."})]}),disabled:r.roles.none,description:"When enabled, enforces permissions on all routes. Make sure to create roles first.",descriptionPlacement:"top"}),p.jsx(Jr,{name:"allow_register",label:"Allow User Registration",description:"When enabled, allows users to register autonomously. New users use the default role.",descriptionPlacement:"top"})]})]}),p.jsxs("div",{className:"flex flex-col gap-3 relative mt-3 pb-4",children:[p.jsx(AP,{}),p.jsx(SO,{}),p.jsxs(S_,{title:"JWT",children:[p.jsx(Jr,{name:"jwt.issuer"}),p.jsx(Jr,{name:"jwt.secret",description:"The secret used to sign the JWT token. If not set, a random key will be generated after enabling authentication.",advanced:"jwt",inputProps:{type:"password"}}),p.jsx(Jr,{name:"jwt.alg",advanced:"jwt"}),p.jsx(Jr,{name:"jwt.expires",advanced:"jwt"}),p.jsx(jP,{which:"jwt"})]}),p.jsx(SO,{}),p.jsxs(S_,{title:"Cookie",children:[p.jsx(Jr,{name:"cookie.path",advanced:"cookie"}),p.jsx(Jr,{name:"cookie.sameSite",advanced:"cookie"}),p.jsx(Jr,{name:"cookie.secure",advanced:"cookie"}),p.jsx(Jr,{name:"cookie.expires",advanced:"cookie"}),p.jsx(Jr,{name:"cookie.renew",label:"Renew Cookie",description:"Automatically renew users cookie on every request.",descriptionPlacement:"top"}),p.jsx(Jr,{name:"cookie.pathSuccess",advanced:"cookie"}),p.jsx(Jr,{name:"cookie.pathLoggedOut"}),p.jsx(jP,{which:"cookie"})]})]}),p.jsx(rS,{})]})]})}const jP=({which:e})=>{const{advanced:t,toggleAdvanced:n}=RW(),r=t.includes(e);return p.jsx(ot,{IconLeft:r?v1e:kU,onClick:()=>n(e),variant:r?"default":"ghost",className:"self-start",size:"small",children:r?"Hide advanced settings":"Show advanced settings"})},AP=()=>p.jsx(r0,{selector:e=>({enabled:e.data.enabled}),children:({enabled:e})=>!e&&p.jsx("div",{className:"absolute w-full h-full z-50 inset-0 bg-background opacity-90"})});function S_(e){const{children:t,title:n,className:r}=e;return p.jsx(p.Fragment,{children:p.jsxs("div",{className:hn("flex flex-col gap-6 px-4",n&&"pt-0",r),children:[n&&p.jsx("h3",{className:"text-lg font-bold",children:n}),t]})})}function Jr(e){const{advanced:t,...n}=e,r=RW(s=>s.advanced);return t&&!r.includes(t)?null:p.jsx(Xi,{...n})}const f5e=({className:e,...t})=>p.jsx("div",{className:Ue("flex flex-col gap-2 max-w-4xl",e),...t}),h5e=({className:e,hasError:t,disabled:n,...r})=>p.jsx("div",{className:Ue("flex flex-col border border-muted rounded bg-background",t&&"border-error",e),...r}),p5e=({className:e,left:t,right:n,children:r,...s})=>p.jsxs("div",{...s,className:Ue("flex flex-row justify-between p-3 gap-3 items-center",e),children:[t&&p.jsx("div",{className:"flex flex-row items-center p-2 bg-primary/5 rounded",children:t}),p.jsx("div",{className:"font-mono flex-grow flex flex-row gap-3",children:r}),n&&p.jsx("div",{className:"flex flex-row gap-4 items-center",children:n})]}),m5e=({className:e,open:t,...n})=>t&&p.jsx("div",{...n,className:Ue("flex flex-col border-t border-t-muted px-4 pt-3 pb-4 bg-lightest/50 gap-4",e)}),Mv={Root:f5e,Item:h5e,Preview:p5e,Detail:m5e};function g5e(e){as(["Auth","Strategies"]);const{hasSecrets:t,config:{auth:{enabled:n}}}=Tt({withSecrets:!0});if(t){if(!n)return p.jsx(Os.NotEnabled,{description:"Enable Auth first."})}else return p.jsx(Os.MissingPermission,{what:"Auth Strategies"});return p.jsx(b5e,{...e})}const y5e={keepEmpty:!0,debug:qr()};function b5e(){var s,i;const e=Fc(),t=e.config.strategies,n=e.schema.properties.strategies;Object.fromEntries((i=(s=e.schema.properties.strategies)==null?void 0:s.additionalProperties)==null?void 0:i.anyOf.map(o=>[o.properties.type.const,o]));async function r(o){await e.actions.config.set({strategies:o})}return p.jsxs(s5,{schema:n,initialValues:t,onSubmit:r,options:y5e,children:[p.jsx(r0,{selector:o=>({dirty:o.dirty,errors:o.errors.length>0,submitting:o.submitting}),children:({dirty:o,errors:a,submitting:c})=>p.jsx(Wn,{className:"pl-4",right:p.jsx(ot,{variant:"primary",type:"submit",disabled:!o||a||c,children:"Update"}),children:"Strategies"})}),p.jsxs(pr,{children:[p.jsxs("div",{className:"flex flex-col p-4 gap-4",children:[p.jsx("p",{className:"opacity-70",children:"Allow users to sign in or sign up using different strategies."}),p.jsxs(Mv.Root,{children:[p.jsx(Il,{type:"password",name:"password"}),p.jsx(Il,{type:"oauth",name:"google"}),p.jsx(Il,{type:"oauth",name:"github"}),p.jsx(Il,{type:"oauth",name:"facebook",unavailable:!0}),p.jsx(Il,{type:"oauth",name:"x",unavailable:!0}),p.jsx(Il,{type:"oauth",name:"instagram",unavailable:!0}),p.jsx(Il,{type:"oauth",name:"apple",unavailable:!0}),p.jsx(Il,{type:"oauth",name:"discord",unavailable:!0})]})]}),p.jsx(rS,{})]})]})}const Il=({type:e,name:t,unavailable:n})=>{const r=n0(t,{strict:!0}),s=Fc(),o=Object.fromEntries(s.schema.properties.strategies.additionalProperties.anyOf.map(u=>[u.properties.type.const,u]))[e],{active:a,toggle:c}=nT("/strategies/:strategy?",t);return o?p.jsx(i5,{schema:o,prefix:t,children:p.jsxs(Mv.Item,{hasError:r.length>0,className:n?"opacity-20 pointer-events-none cursor-not-allowed":void 0,children:[p.jsx(Mv.Preview,{left:p.jsx(x5e,{type:e,provider:t}),right:p.jsxs(p.Fragment,{children:[p.jsx(v5e,{type:e}),p.jsx(St,{Icon:fp,size:"lg",iconProps:{strokeWidth:1.5},variant:a?"primary":"ghost",onClick:()=>c(!a)})]}),children:p.jsx("span",{className:"leading-none",children:wh(t)})}),p.jsx(Mv.Detail,{open:a,children:p.jsx(w5e,{type:e,name:t})})]})}):null},v5e=({type:e})=>{const t=Cd(""),{value:n}=nS("");function r(s){const i=s.target.value,o=Object.keys(n??{}),a=o.length===0||o.length===1&&o[0]==="enabled";!i&&a?t.deleteValue(t.path):t.setValue([t.path,"enabled"].join("."),i)}return p.jsx(Xi,{name:"enabled",label:!1,required:!0,onChange:r})},x5e=({type:e,provider:t})=>{if(e==="password")return p.jsx(u1e,{className:"size-5"});if(t&&t in $P){const n=$P[t];return p.jsx(n,{className:"size-5"})}return p.jsx(p1e,{className:"size-5"})},$P={google:n1e,github:t1e,facebook:e1e,x:m1e,instagram:h1e,apple:Qwe,discord:Zwe},w5e=({type:e,name:t})=>{let n=r=>p.jsx(sS,{path:"",wrapperProps:{wrapper:"group",label:!1}});switch(e){case"password":n=S5e;break;case"oauth":n=E5e;break}return p.jsxs(p.Fragment,{children:[p.jsx(CW,{name:"type",inputProps:{disabled:!0,defaultValue:e}}),p.jsx(n,{type:e,name:t})]})},S5e=()=>p.jsx(sS,{path:"config",wrapperProps:{wrapper:"group",label:!1}}),E5e=({type:e,name:t})=>p.jsxs(p.Fragment,{children:[p.jsx(CW,{name:"config.name",inputProps:{disabled:!0,defaultValue:t}}),p.jsx(Xi,{name:"config.client.client_id",required:!0,inputProps:{type:"password"}}),p.jsx(Xi,{name:"config.client.client_secret",required:!0,inputProps:{type:"password"}})]});function N5e(){return null}function _5e(){return p.jsxs(Q1e,{children:[p.jsx(lt,{path:"/",component:rSe}),p.jsx(lt,{path:"/users",component:N5e}),p.jsx(lt,{path:"/roles",component:t5e}),p.jsx(lt,{path:"/roles/edit/:role",component:a5e}),p.jsx(lt,{path:"/strategies/:strategy?",component:g5e}),p.jsx(lt,{path:"/settings",component:c5e})]})}function C5e(){return as(["Login"]),p.jsx(DH.Screen,{action:"login",logo:p.jsx(jn,{href:"/",className:"link",children:p.jsx(I1,{scale:.25})})})}const MW={data:{btnCreateEntity:"data-btns-create-entity"},media:{switchEnabled:"media-switch-enabled"}};function O5e({children:e}){const{entities:t,$data:n}=Ts(),r={regular:[],generated:[],system:[]},[s]=$n(),i=window.location.href.match(/\/schema/)?"schema":"data";for(const a of Object.values(t))r[a.getType()].push(a);function o(a){var u;if(!a)return;const c=((u=window.location.href.match(/\/entity\/([^/]+)/))==null?void 0:u[1])||null;switch(a){case"data":c?s(ut.data.entity.list(c)):s(ut.data.root(),{absolute:!0});break;case"schema":s(c?ut.data.schema.entity(c):ut.data.schema.root());break}}return p.jsxs(p.Fragment,{children:[p.jsxs(Hy,{children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(dd,{data:[{value:"data",label:"Data"},{value:"schema",label:"Schema"}],value:i,onChange:o}),p.jsx(ud,{label:"New Entity",children:p.jsx(St,{Icon:DU,onClick:n.modals.createEntity})})]}),children:"Entities"}),p.jsx(pr,{initialOffset:96,children:p.jsxs("div",{className:"flex flex-col flex-grow py-3 gap-3",children:[p.jsx(E_,{entities:r.regular,context:i,suggestCreate:!0}),p.jsx(E_,{entities:r.system,context:i,title:"System"}),p.jsx(E_,{entities:r.generated,context:i,title:"Generated"})]})})]}),p.jsx(qy,{children:e})]})}const E_=({entities:e,title:t,context:n,suggestCreate:r=!1})=>{const{$data:s}=Ts(),i=Hxe();if(e.length===0)return r?p.jsx(Vr,{className:"py-10",description:"Create your first entity to get started.",secondary:{children:"Create entity",onClick:()=>s.modals.createEntity()}}):null;function o(a){return c=>{switch(c.stopPropagation(),c.preventDefault(),n){case"schema":i(u=>u.data.entity.list(a.name));break;case"data":i(u=>u.data.schema.entity(a.name));break}}}return p.jsxs("nav",{className:Ue("flex flex-col flex-1 gap-1 px-3",t&&"border-t border-primary/10 pt-2"),children:[t&&p.jsx("div",{className:"text-sm text-primary/50 ml-3.5 mb-1",children:t}),e.map(a=>{const c=n==="data"?ut.data.entity.list(a.name):ut.data.schema.entity(a.name);return p.jsx(j5e,{entity:a,children:p.jsxs(bs,{as:jn,href:c,className:"justify-between items-center",children:[a.label,Dxe(c)&&p.jsx(ot,{IconLeft:Nve,size:"small",onClick:o(a),children:n==="schema"?"Data":"Fields"})]})},a.name)})]})},j5e=({entity:e,children:t,enabled:n=!0})=>{if(!n)return t;const[r]=$n(),{$data:s}=Ts(),i=t.props.href,o=()=>p.jsx("div",{className:"h-px my-1 w-full bg-primary/5"});return p.jsx(Ur,{className:"flex flex-col w-full",dropdownWrapperProps:{className:"min-w-fit"},title:e.label+" Actions",items:[i&&{icon:hve,label:"Open in tab",onClick:()=>r(i,{target:"_blank"})},o,!s.system(e.name).any&&{icon:q$,label:"Create new",onClick:()=>r(ut.data.entity.create(e.name))},{icon:cp,label:"List entries",onClick:()=>r(ut.data.entity.list(e.name))},o,{icon:V$,label:"Manage fields",onClick:()=>r(ut.data.schema.entity(e.name))},{icon:U$,label:"Add relation",onClick:()=>s.modals.createRelation(e.name)},!s.system(e.name).media&&{icon:RV,label:"Add media",onClick:()=>s.modals.createMedia(e.name)},o,{icon:Fg,label:"Advanced",onClick:()=>r(ut.settings.path(["data","entities",e.name]),{absolute:!0})}],openEvent:"onContextMenu",position:"bottom-start",children:t})};function A5e(){as(["Data"]);const[e]=$n(),{$data:t}=Ts();function n(){e(ut.data.schema.root())}return p.jsx(Vr,{Icon:cp,title:"No entity selected",description:"Please select an entity from the left sidebar or create a new one to continue.",secondary:{children:"Go to schema",onClick:n},primary:{children:"Create entity","data-testid":MW.data.btnCreateEntity,onClick:t.modals.createEntity}})}const Gf=new WeakMap,kv=new WeakMap,Qx={current:[]};let N_=!1,lg=0;const Vm=new Set,Jb=new Map;function kW(e){const t=Array.from(e).sort((n,r)=>n instanceof Aa&&n.options.deps.includes(r)?1:r instanceof Aa&&r.options.deps.includes(n)?-1:0);for(const n of t){if(Qx.current.includes(n))continue;Qx.current.push(n),n.recompute();const r=kv.get(n);if(r)for(const s of r){const i=Gf.get(s);i&&kW(i)}}}function $5e(e){e.listeners.forEach(t=>t({prevVal:e.prevState,currentVal:e.state}))}function T5e(e){e.listeners.forEach(t=>t({prevVal:e.prevState,currentVal:e.state}))}function IW(e){if(lg>0&&!Jb.has(e)&&Jb.set(e,e.prevState),Vm.add(e),!(lg>0)&&!N_)try{for(N_=!0;Vm.size>0;){const t=Array.from(Vm);Vm.clear();for(const n of t){const r=Jb.get(n)??n.prevState;n.prevState=r,$5e(n)}for(const n of t){const r=Gf.get(n);r&&(Qx.current.push(n),kW(r))}for(const n of t){const r=Gf.get(n);if(r)for(const s of r)T5e(s)}}}finally{N_=!1,Qx.current=[],Jb.clear()}}function Bl(e){lg++;try{e()}finally{if(lg--,lg===0){const t=Array.from(Vm)[0];t&&IW(t)}}}class YO{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var s,i;this.listeners.add(r);const o=(i=(s=this.options)==null?void 0:s.onSubscribe)==null?void 0:i.call(s,r,this);return()=>{this.listeners.delete(r),o==null||o()}},this.setState=r=>{var s,i,o;this.prevState=this.state,this.state=(s=this.options)!=null&&s.updateFn?this.options.updateFn(this.prevState)(r):r(this.prevState),(o=(i=this.options)==null?void 0:i.onUpdate)==null||o.call(i),IW(this)},this.prevState=t,this.state=t,this.options=n}}class Aa{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=[],r=[];for(const s of this.options.deps)n.push(s.prevState),r.push(s.state);return this.lastSeenDepValues=r,{prevDepVals:n,currDepVals:r,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const{prevDepVals:s,currDepVals:i,prevVal:o}=this.getDepVals();this.state=this.options.fn({prevDepVals:s,currDepVals:i,prevVal:o}),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof Aa&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:s}=this.getDepVals();for(let i=0;i<s.length;i++)if(s[i]!==r[i]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,s;this.listeners.add(n);const i=(s=(r=this.options).onSubscribe)==null?void 0:s.call(r,n,this);return()=>{this.listeners.delete(n),i==null||i()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(const n of t)if(n instanceof Aa)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof YO){let r=Gf.get(n);r||(r=new Set,Gf.set(n,r)),r.add(this);let s=kv.get(this);s||(s=new Set,kv.set(this,s)),s.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof Aa)this.unregisterFromGraph(n.options.deps);else if(n instanceof YO){const r=Gf.get(n);r&&r.delete(this);const s=kv.get(this);s&&s.delete(n)}}}function aS(e,t=n=>n){return nU.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,R5e)}function R5e(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!t.has(r)||!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}const M5e=w.lazy(()=>Wy(()=>import("./CodeEditor-C3U4N43u.js"),[]));function k5e({editable:e,className:t,...n}){return p.jsx(w.Suspense,{fallback:null,children:p.jsx(M5e,{className:Ue("flex w-full border border-muted",!e&&"opacity-70",t),editable:e,_extensions:{json:!0},...n})})}function I5e({fieldApi:e,field:t,data:n,disabled:r,...s}){function i(a){r||e.setValue(a)}const o=n==null?void 0:n[t.name];return p.jsxs(Ji,{children:[p.jsx(LT,{htmlFor:e.name,field:t}),p.jsx("div",{"data-disabled":r?1:void 0,className:"data-[disabled]:opacity-70 data-[disabled]:pointer-events-none",children:p.jsx(hp,{schema:t.getJsonSchema(),onChange:i,direction:"horizontal",formData:o,uiSchema:{"ui:globalOptions":{flexDirection:"row"},...t.getJsonUiSchema()}})})]})}function l5({entity:e,select:t,...n}){const r=t??e.getSelect(),s=e.getFields();function i(c){return s.find(u=>u.name===c)}function o(c){try{return i(c).getLabel()}catch(u){return console.warn("Couldn't render header",{entity:e,select:t,...n},u),c}}function a({value:c,property:u}){let f=c;try{f=i(u).getValue(c,"table")}catch(h){console.warn("Couldn't render value",{value:c,property:u,entity:e,select:t,columns:r,...n},h)}return p.jsx(Ky,{fallback:String(f),children:p.jsx(X1,{value:f,property:u})})}return p.jsx(J1,{...n,columns:r,renderHeader:o,renderValue:a})}function D5e({fieldApi:e,field:t,data:n,disabled:r,tabIndex:s}){const{app:i}=Tt(),o=i.entity(t.target()),[a,c]=w.useState({limit:10,page:1,perPage:10,select:o.getSelect(void 0,"table")});yi();const u=w.useRef(null),f=T1(t.target(),void 0,{select:a.select,limit:a.limit,offset:(a.page-1)*a.limit}),[h,m]=w.useState(),y=n==null?void 0:n[t.reference()],v=n==null?void 0:n[t.name];w.useEffect(()=>{const E=n==null?void 0:n[t.reference()];m(E)},[y]),w.useEffect(()=>{(async()=>{if(!t.target()||!v)return;const N=await f.api.readOne(t.target(),v);N.ok&&N.data&&m(N.data)})()},[v]),w.useEffect(()=>{var E;if(t.isRequired()&&!e.state.value){const N=(E=f.data)==null?void 0:E[0];if(!N)return;console.warn("setting first value because field is required",t.name,N.id),e.setValue(N.id),m(N)}},[f.data]);const x=f.isLoading||f.isValidating;return p.jsxs(Ji,{children:[p.jsx(Ao,{htmlFor:e.name,children:t.getLabel({fallback:!1})??o.label}),p.jsx("div",{"data-disabled":x||r?1:void 0,className:"data-[disabled]:opacity-70 data-[disabled]:pointer-events-none",children:p.jsx(PT,{backdrop:!0,className:"",target:({toggle:E})=>p.jsx(P5e,{container:f.data,entity:o,query:a,toggle:E,onClickRow:N=>{e.setValue(N.id),m(N),E()},onClickPage:N=>{console.log("setting page",N),c(_=>({..._,page:N}))}}),children:p.jsx("div",{ref:u,className:"bg-muted/40 w-full h-11 focus:bg-muted rounded-md items-center px-2.5 outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50 cursor-pointer active:bg-muted/80 hover:bg-muted/60 flex flex-row gap-2",tabIndex:s,onKeyDown:cQ([["Enter",()=>{var E;(E=u.current)==null||E.click()}]]),children:h?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex bg-primary/10 px-2 leading-none py-1.5 rounded-lg font-mono text-sm",children:ii(o.name)}),p.jsx("div",{className:"flex flex-row gap-3 overflow-clip w-1 flex-grow",children:h&&Object.entries(h).map(([E,N])=>{const _=o.getField(E);if(_.isHidden("table"))return null;const C=_.getValue(N,"table");return p.jsxs("div",{className:"flex flex-row gap-1 items-center flex-nowrap",children:[p.jsxs("span",{className:"opacity-60 text-nowrap",children:[_.getLabel(),":"]})," ",C!==null&&typeof C<"u"?p.jsx(Ky,{fallback:JSON.stringify(C),suppressError:!0,children:p.jsx("span",{className:"text-nowrap truncate",children:C})}):p.jsx("span",{className:"opacity-30 text-nowrap font-mono mt-0.5",children:"null"})]},E)})}),p.jsx(jn,{to:ut.data.entity.edit(o.name,h.id),children:p.jsx(ot,{IconLeft:PU,size:"small",children:"View"})})]}):p.jsx("div",{className:"pl-2",children:"- Select -"})})})}),p.jsx(Bc,{type:"hidden",name:e.name,id:e.name,value:e.state.value??"",onChange:console.log,tabIndex:-1})]})}const P5e=({container:e,entity:t,query:n,toggle:r,onClickRow:s,onClickPage:i})=>{var c;function o(){var u;n.limit*n.page<((u=e.meta)==null?void 0:u.count)&&(i==null||i(n.page+1))}function a(){n.page>1&&(i==null||i(n.page-1))}return Nj([["ArrowRight",o],["ArrowLeft",a],["Escape",r]]),p.jsx("div",{children:p.jsx(l5,{classNames:{value:"line-clamp-1 truncate max-w-52 text-nowrap"},data:e??[],entity:t,select:n.select,total:(c=e.meta)==null?void 0:c.count,page:n.page,onClickRow:s,onClickPage:i})})};function DW({entity:e,entityId:t,handleSubmit:n,fieldsDisabled:r,Form:s,data:i,className:o,action:a}){const c=e.getFillableFields(a,!0);return p.jsxs("form",{onSubmit:n,children:[p.jsx(s.Subscribe,{selector:u=>[u.canSubmit,u.isValid,u.errors],children:([u,f,h])=>!f&&p.jsxs("div",{className:"flex flex-col dark:bg-red-950 bg-red-100 p-4",children:[p.jsx("p",{children:"Form is invalid."}),Array.isArray(h)&&p.jsx("ul",{className:"list-disc",children:h.map((m,y)=>p.jsx("li",{className:"ml-6",children:m},y))})]})}),p.jsx("div",{className:o,children:c.map((u,f)=>{if(u instanceof Rg)return p.jsx(F5e,{entity:e,entityId:t,formApi:s,field:u},u.name+f);if(!u.isFillable(a))return;const h=`${e.name}-${u.name}-${f}`;return p.jsx(Ky,{fallback:p.jsxs(xo.Exception,{className:"font-mono",children:["Field error: ",u.name]}),children:p.jsx(s.Field,{name:u.name,children:m=>p.jsx(L5e,{field:u,fieldApi:m,disabled:r,tabIndex:f+1,action:a,data:i})})},h)})}),p.jsx("div",{className:"hidden",children:p.jsx("button",{type:"submit"})})]})}function L5e({fieldApi:e,field:t,action:n,data:r,...s}){const i=Lt(u=>{typeof u=="object"&&"target"in u?e.handleChange(u.target.value):e.handleChange(u)});if(t.type==="relation")return p.jsx(D5e,{fieldApi:e,field:t,data:r,disabled:s.disabled,tabIndex:s.tabIndex});if(t.type==="json")return p.jsx(B5e,{fieldApi:e,field:t,...s});if(t.type==="jsonschema")return p.jsx(I5e,{fieldApi:e,field:t,data:r,disabled:s.disabled,tabIndex:s.tabIndex,...s});if(t.type==="enum")return p.jsx(z5e,{fieldApi:e,field:t,...s});const o=t.getHtmlConfig().element,a=t.getHtmlConfig().props,c=ROe(o??"input");return p.jsxs(Ji,{children:[p.jsx(LT,{htmlFor:e.name,field:t}),p.jsx(c,{...a,name:e.name,id:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:i,required:t.isRequired(),...s})]})}function F5e({formApi:e,field:t,entity:n,entityId:r,disabled:s}){if(!r)return;const i=aS(e.store,c=>{const u=c.values[t.name];return!u||typeof u>"u"?[]:Array.isArray(u)?u:[u]}),o=JSON.stringify([n,r,t.name,i.length]),a=c=>{vr.open(vr.ids.mediaInfo,{file:c})};return p.jsxs(Ji,{children:[p.jsx(LT,{field:t}),p.jsx(WT.Dropzone,{maxItems:t.getMaxItems(),initialItems:i,onClick:a,entity:{name:n.name,id:r,field:t.name},query:{sort:"-id"}},o)]})}function B5e({fieldApi:e,field:t,...n}){const r=Lt(s=>{e.handleChange(s)});return p.jsxs(Ji,{children:[p.jsx(Ao,{htmlFor:e.name,children:t.getLabel()}),p.jsx(w.Suspense,{children:p.jsx(k5e,{id:e.name,value:e.state.value,onChange:r,onBlur:e.handleBlur,minHeight:"100",...n})})]})}function z5e({fieldApi:e,field:t,...n}){const r=Lt(s=>{e.handleChange(s.target.value)});return p.jsxs(Ji,{children:[p.jsx(Ao,{htmlFor:e.name,children:t.getLabel()}),p.jsxs(AH,{name:e.name,id:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:r,required:t.isRequired(),...n,children:[!t.isRequired()&&p.jsx("option",{value:"",children:"- Select -"}),t.getOptions().map(s=>p.jsx("option",{value:s.value,children:s.label},s.value))]})]})}function lS(e,t){return typeof e=="function"?e(t):e}function PW(e,t){return c5(t).reduce((r,s)=>{if(r===null)return null;if(typeof r<"u")return r[s]},e)}function __(e,t,n){const r=c5(t);function s(i){if(!r.length)return lS(n,i);const o=r.shift();if(typeof o=="string"||typeof o=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[o]:s(i[o])}):{[o]:s()};if(Array.isArray(i)&&typeof o=="number"){const a=i.slice(0,o);return[...a.length?a:new Array(o),s(i[o]),...i.slice(o+1)]}return[...new Array(o),s()]}return s(e)}function V5e(e,t){const n=c5(t);function r(s){if(!s)return;if(n.length===1){const o=n[0];if(Array.isArray(s)&&typeof o=="number")return s.filter((u,f)=>f!==o);const{[o]:a,...c}=s;return c}const i=n.shift();if(typeof i=="string"&&typeof s=="object")return{...s,[i]:r(s[i])};if(typeof i=="number"&&Array.isArray(s)){if(i>=s.length)return s;const o=s.slice(0,i);return[...o.length?o:new Array(i),r(s[i]),...s.slice(i+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const U5e=/^(\d*)$/gm,q5e=/\.(\d*)\./gm,H5e=/^(\d*)\./gm,W5e=/\.(\d*$)/gm,G5e=/\.{2,}/gm,JO="__int__",Xb=`${JO}$1`;function c5(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/\[/g,".").replace(/\]/g,"").replace(U5e,Xb).replace(q5e,`.${Xb}.`).replace(H5e,`${Xb}.`).replace(W5e,`.${Xb}`).replace(G5e,".").split(".").map(t=>t.indexOf(JO)===0?parseInt(t.substring(JO.length),10):t)}function Y5e(e){return!(Array.isArray(e)&&e.length===0)}function XO(e,t){const{asyncDebounceMs:n}=t,{onChangeAsync:r,onBlurAsync:s,onSubmitAsync:i,onBlurAsyncDebounceMs:o,onChangeAsyncDebounceMs:a}=t.validators||{},c=n??0,u={cause:"change",validate:r,debounceMs:a??c},f={cause:"blur",validate:s,debounceMs:o??c},h={cause:"submit",validate:i,debounceMs:0},m=y=>({...y,debounceMs:0});switch(e){case"submit":return[m(u),m(f),h];case"blur":return[f];case"change":return[u];case"server":default:return[]}}function KO(e,t){const{onChange:n,onBlur:r,onSubmit:s,onMount:i}=t.validators||{},o={cause:"change",validate:n},a={cause:"blur",validate:r},c={cause:"submit",validate:s},u={cause:"mount",validate:i},f={cause:"server",validate:()=>{}};switch(e){case"mount":return[u];case"submit":return[o,a,c,f];case"server":return[f];case"blur":return[a,f];case"change":default:return[o,f]}}const LW=e=>!!e&&typeof e=="object"&&"fields"in e;function C_(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!t.has(r)||!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function J5e(e){const t=new Map;for(const n of e){const r=[...n.path??[]].map(s=>{const i=typeof s=="object"?s.key:s;return typeof i=="number"?`[${i}]`:i}).join(".").replace(/\.\[/g,"[");t.set(r,(t.get(r)??[]).concat(n))}return Object.fromEntries(t)}const X5e=e=>e,K5e=e=>{const t=J5e(e);return{form:t,fields:t}},TP=(e,t)=>e==="form"?K5e(t):X5e(t),FW={validate({value:e,validationSource:t},n){const r=n["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return TP(t,r.issues)},async validateAsync({value:e,validationSource:t},n){const r=await n["~standard"].validate(e);if(r.issues)return TP(t,r.issues)}},BW=e=>!!e&&"~standard"in e;function Kb(e){function t(h,m,y,v){const x=r(h,m,y,v);({insert:()=>a(x,h,m),remove:()=>c(x),swap:()=>v!==void 0&&f(x,h,m,v),move:()=>v!==void 0&&u(x,h,m,v)})[y]()}function n(h,m){return`${h}[${m}]`}function r(h,m,y,v){const x=[n(h,m)];if(y==="swap")x.push(n(h,v));else if(y==="move"){const[E,N]=[Math.min(m,v),Math.max(m,v)];for(let _=E;_<=N;_++)x.push(n(h,_))}else{const E=e.getFieldValue(h),N=Array.isArray(E)?E.length:0;for(let _=m+1;_<N;_++)x.push(n(h,_))}return Object.keys(e.fieldInfo).filter(E=>x.some(N=>E.startsWith(N)))}function s(h,m){return h.replace(/\[(\d+)\]/,(y,v)=>{const x=parseInt(v,10);return`[${m==="up"?x+1:Math.max(0,x-1)}]`})}function i(h,m){(m==="up"?h:[...h].reverse()).forEach(v=>{const x=s(v.toString(),m),E=e.getFieldMeta(x);E?e.setFieldMeta(v,E):e.setFieldMeta(v,o())})}const o=()=>({isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,errors:[],errorMap:{}}),a=(h,m,y)=>{i(h,"down"),h.forEach(v=>{v.toString().startsWith(n(m,y))&&e.setFieldMeta(v,o())})},c=h=>{i(h,"up")},u=(h,m,y,v)=>{const x=new Map(Object.keys(e.fieldInfo).filter(E=>E.startsWith(n(m,y))).map(E=>[E,e.getFieldMeta(E)]));i(h,y<v?"up":"down"),Object.keys(e.fieldInfo).filter(E=>E.startsWith(n(m,v))).forEach(E=>{const N=E.replace(n(m,v),n(m,y)),_=x.get(N);_&&e.setFieldMeta(E,_)})},f=(h,m,y,v)=>{h.forEach(x=>{if(!x.toString().startsWith(n(m,y)))return;const E=x.toString().replace(n(m,y),n(m,v)),[N,_]=[e.getFieldMeta(x),e.getFieldMeta(E)];N&&e.setFieldMeta(E,N),_&&e.setFieldMeta(x,_)})};return{handleArrayFieldMetaShift:t}}function O_(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0}}}class Q5e{constructor(t){var n;this.options={},this.fieldInfo={},this.prevTransformArray=[],this.cumulativeFieldsErrorMap={},this.mount=()=>{const r=this.fieldMetaDerived.mount(),s=this.store.mount(),i=()=>{r(),s()},{onMount:o}=this.options.validators||{};return o&&this.validateSync("mount"),i},this.update=r=>{var s,i;if(!r)return;const o=this.options;this.options=r;const a=!!((i=(s=r.transform)==null?void 0:s.deps)!=null&&i.some((f,h)=>f!==this.prevTransformArray[h])),c=r.defaultValues&&!C_(r.defaultValues,o.defaultValues)&&!this.state.isTouched,u=!C_(r.defaultState,o.defaultState)&&!this.state.isTouched;!c&&!u&&!a||Bl(()=>{this.baseStore.setState(()=>O_(Object.assign({},this.state,u?r.defaultState:{},c?{values:r.defaultValues}:{},a?{_force_re_eval:!this.state._force_re_eval}:{})))})},this.reset=(r,s)=>{const{fieldMeta:i}=this.state,o=this.resetFieldMeta(i);r&&!(s!=null&&s.keepDefaultValues)&&(this.options={...this.options,defaultValues:r}),this.baseStore.setState(()=>{var a;return O_({...this.options.defaultState,values:r??this.options.defaultValues??((a=this.options.defaultState)==null?void 0:a.values),fieldMetaBase:o})})},this.validateAllFields=async r=>{const s=[];return Bl(()=>{Object.values(this.fieldInfo).forEach(o=>{if(!o.instance)return;const a=o.instance;s.push(Promise.resolve().then(()=>a.validate(r,{skipFormValidation:!0}))),o.instance.state.meta.isTouched||o.instance.setMeta(c=>({...c,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=async(r,s,i)=>{const o=this.getFieldValue(r),a=Array.isArray(o)?Math.max(o.length-1,0):null,c=[`${r}[${s}]`];for(let m=s+1;m<=(a??0);m++)c.push(`${r}[${m}]`);const u=Object.keys(this.fieldInfo).filter(m=>c.some(y=>m.startsWith(y))),f=[];return Bl(()=>{u.forEach(m=>{f.push(Promise.resolve().then(()=>this.validateField(m,i)))})}),(await Promise.all(f)).flat()},this.validateField=(r,s)=>{var i;const o=(i=this.fieldInfo[r])==null?void 0:i.instance;return o?(o.state.meta.isTouched||o.setMeta(a=>({...a,isTouched:!0})),o.validate(s)):[]},this.validateSync=r=>{const s=KO(r,this.options);let i=!1;const o={};return Bl(()=>{var a;for(const u of s){if(!u.validate)continue;const f=this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:m}=QO(f),y=Qb(u.cause);if(m)for(const[v,x]of Object.entries(m)){const N={...this.cumulativeFieldsErrorMap[v]||{},[y]:x};o[v]=N,this.cumulativeFieldsErrorMap[v]=N;const _=this.getFieldMeta(v);_&&_.errorMap[y]!==x&&this.setFieldMeta(v,C=>({...C,errorMap:{...C.errorMap,[y]:x}}))}for(const v of Object.keys(this.cumulativeFieldsErrorMap)){const x=this.getFieldMeta(v);x!=null&&x.errorMap[y]&&!((a=o[v])!=null&&a[y])&&(this.cumulativeFieldsErrorMap[v]={...this.cumulativeFieldsErrorMap[v],[y]:void 0},this.setFieldMeta(v,E=>({...E,errorMap:{...E.errorMap,[y]:void 0}})))}this.state.errorMap[y]!==h&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[y]:h}})),(h||m)&&(i=!0)}const c=Qb("submit");this.state.errorMap[c]&&r!=="submit"&&!i&&this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[c]:void 0}}))}),{hasErrored:i,fieldsErrorMap:o}},this.validateAsync=async r=>{const s=XO(r,this.options);this.state.isFormValidating||this.baseStore.setState(u=>({...u,isFormValidating:!0}));const i=[];let o;for(const u of s){if(!u.validate)continue;const f=Qb(u.cause),h=this.state.validationMetaMap[f];h==null||h.lastAbortController.abort();const m=new AbortController;this.state.validationMetaMap[f]={lastAbortController:m},i.push(new Promise(async y=>{let v;try{v=await new Promise((_,C)=>{setTimeout(async()=>{if(m.signal.aborted)return _(void 0);try{_(await this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:m.signal},type:"validateAsync"}))}catch(j){C(j)}},u.debounceMs)})}catch(_){v=_}const{formError:x,fieldErrors:E}=QO(v);E&&(o=o?{...o,...E}:E);const N=Qb(u.cause);if(o)for(const[_,C]of Object.entries(o)){const j=this.getFieldMeta(_);j&&j.errorMap[N]!==C&&this.setFieldMeta(_,A=>({...A,errorMap:{...A.errorMap,[N]:C}}))}this.baseStore.setState(_=>({..._,errorMap:{..._.errorMap,[N]:x}})),y(o?{fieldErrors:o,errorMapKey:N}:void 0)}))}let a=[];const c={};if(i.length){a=await Promise.all(i);for(const u of a)if(u!=null&&u.fieldErrors){const{errorMapKey:f}=u;for(const[h,m]of Object.entries(u.fieldErrors)){const v={...c[h]||{},[f]:m};c[h]=v}}}return this.baseStore.setState(u=>({...u,isFormValidating:!1})),c},this.validate=r=>{const{hasErrored:s,fieldsErrorMap:i}=this.validateSync(r);return s&&!this.options.asyncAlways?i:this.validateAsync(r)},this.getFieldValue=r=>PW(this.state.values,r),this.getFieldMeta=r=>this.state.fieldMeta[r],this.getFieldInfo=r=>{var s;return(s=this.fieldInfo)[r]||(s[r]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0}})},this.setFieldMeta=(r,s)=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[r]:lS(s,i.fieldMetaBase[r])}}))},this.resetFieldMeta=r=>Object.keys(r).reduce((s,i)=>{const o=i;return s[o]={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,errors:[],errorMap:{}},s},{}),this.setFieldValue=(r,s,i)=>{const o=(i==null?void 0:i.dontUpdateMeta)??!1;Bl(()=>{o||this.setFieldMeta(r,a=>({...a,isTouched:!0,isDirty:!0,errorMap:{...a==null?void 0:a.errorMap,onMount:void 0}})),this.baseStore.setState(a=>({...a,values:__(a.values,r,s)}))})},this.deleteField=r=>{const i=[...Object.keys(this.fieldInfo).filter(o=>{const a=r.toString();return o!==a&&o.startsWith(a)}),r];this.baseStore.setState(o=>{const a={...o};return i.forEach(c=>{a.values=V5e(a.values,c),delete this.fieldInfo[c],delete a.fieldMetaBase[c]}),a})},this.pushFieldValue=(r,s,i)=>{this.setFieldValue(r,o=>[...Array.isArray(o)?o:[],s],i),this.validateField(r,"change")},this.insertFieldValue=async(r,s,i,o)=>{this.setFieldValue(r,a=>[...a.slice(0,s),i,...a.slice(s)],o),await this.validateField(r,"change"),Kb(this).handleArrayFieldMetaShift(r,s,"insert"),await this.validateArrayFieldsStartingFrom(r,s,"change")},this.replaceFieldValue=async(r,s,i,o)=>{this.setFieldValue(r,a=>a.map((c,u)=>u===s?i:c),o),await this.validateField(r,"change"),await this.validateArrayFieldsStartingFrom(r,s,"change")},this.removeFieldValue=async(r,s,i)=>{const o=this.getFieldValue(r),a=Array.isArray(o)?Math.max(o.length-1,0):null;if(this.setFieldValue(r,c=>c.filter((u,f)=>f!==s),i),Kb(this).handleArrayFieldMetaShift(r,s,"remove"),a!==null){const c=`${r}[${a}]`;this.deleteField(c)}await this.validateField(r,"change"),await this.validateArrayFieldsStartingFrom(r,s,"change")},this.swapFieldValues=(r,s,i,o)=>{this.setFieldValue(r,a=>{const c=a[s],u=a[i];return __(__(a,`${s}`,u),`${i}`,c)},o),Kb(this).handleArrayFieldMetaShift(r,s,"swap",i),this.validateField(r,"change"),this.validateField(`${r}[${s}]`,"change"),this.validateField(`${r}[${i}]`,"change")},this.moveFieldValues=(r,s,i,o)=>{this.setFieldValue(r,a=>(a.splice(i,0,a.splice(s,1)[0]),a),o),Kb(this).handleArrayFieldMetaShift(r,s,"move",i),this.validateField(r,"change"),this.validateField(`${r}[${s}]`,"change"),this.validateField(`${r}[${i}]`,"change")},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((r,[s,i])=>(Object.keys(i).length&&i.errors.length&&(r[s]={errors:i.errors,errorMap:i.errorMap}),r),{})}),this.baseStore=new YO(O_({...t==null?void 0:t.defaultState,values:(t==null?void 0:t.defaultValues)??((n=t==null?void 0:t.defaultState)==null?void 0:n.values)})),this.fieldMetaDerived=new Aa({deps:[this.baseStore],fn:({prevDepVals:r,currDepVals:s,prevVal:i})=>{var o;const a=i,c=r==null?void 0:r[0],u=s[0];let f=0;const h={};for(const m of Object.keys(u.fieldMetaBase)){const y=u.fieldMetaBase[m],v=c==null?void 0:c.fieldMetaBase[m],x=a==null?void 0:a[m];let E=x==null?void 0:x.errors;if(!v||y.errorMap!==v.errorMap){E=Object.values(y.errorMap??{}).filter(C=>C!==void 0);const _=(o=this.getFieldInfo(m))==null?void 0:o.instance;_&&!_.options.disableErrorFlat&&(E=E==null?void 0:E.flat(1))}const N=!y.isDirty;if(x&&x.isPristine===N&&x.errors===E&&y===v){h[m]=x,f++;continue}h[m]={...y,errors:E,isPristine:N}}return Object.keys(u.fieldMetaBase).length&&a&&f===Object.keys(u.fieldMetaBase).length?a:h}}),this.store=new Aa({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:r,currDepVals:s,prevVal:i})=>{var o,a,c,u;const f=i,h=r==null?void 0:r[0],m=s[0],y=Object.values(m.fieldMetaBase),v=y.some(B=>B==null?void 0:B.isValidating),x=!y.some(B=>(B==null?void 0:B.errorMap)&&Y5e(Object.values(B.errorMap).filter(Boolean))),E=y.some(B=>B==null?void 0:B.isTouched),N=y.some(B=>B==null?void 0:B.isBlurred),_=E&&((o=m==null?void 0:m.errorMap)==null?void 0:o.onMount),C=y.some(B=>B==null?void 0:B.isDirty),j=!C,A=!!((a=m.errorMap)!=null&&a.onMount||y.some(B=>{var T;return(T=B==null?void 0:B.errorMap)==null?void 0:T.onMount})),$=!!v;let R=(f==null?void 0:f.errors)??[];(!h||m.errorMap!==h.errorMap)&&(R=Object.values(m.errorMap).reduce((B,T)=>T===void 0?B:T&&LW(T)?(B.push(T.form),B):(B.push(T),B),[]));const M=R.length===0,D=x&&M,P=m.submissionAttempts===0&&!E&&!A||!$&&!m.isSubmitting&&D;let F=m.errorMap;if(_&&(R=R.filter(B=>B!==m.errorMap.onMount),F=Object.assign(F,{onMount:void 0})),f&&h&&f.errorMap===F&&f.fieldMeta===this.fieldMetaDerived.state&&f.errors===R&&f.isFieldsValidating===v&&f.isFieldsValid===x&&f.isFormValid===M&&f.isValid===D&&f.canSubmit===P&&f.isTouched===E&&f.isBlurred===N&&f.isPristine===j&&f.isDirty===C&&C_(h,m))return f;let V={...m,errorMap:F,fieldMeta:this.fieldMetaDerived.state,errors:R,isFieldsValidating:v,isFieldsValid:x,isFormValid:M,isValid:D,canSubmit:P,isTouched:E,isBlurred:N,isPristine:j,isDirty:C};const H=((c=this.options.transform)==null?void 0:c.deps)??[];if(H.length!==this.prevTransformArray.length||H.some((B,T)=>B!==this.prevTransformArray[T])){const B=Object.assign({},this,{state:V});(u=this.options.transform)==null||u.fn(B),V=B.state,this.prevTransformArray=H}return V}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}runValidator(t){return BW(t.validate)?FW[t.type](t.value,t.validate):t.validate(t.value)}async handleSubmit(t){var n,r,s,i,o,a;if(this.baseStore.setState(u=>({...u,isSubmitted:!1,submissionAttempts:u.submissionAttempts+1,isSubmitSuccessful:!1})),!this.state.canSubmit)return;this.baseStore.setState(u=>({...u,isSubmitting:!0}));const c=()=>{this.baseStore.setState(u=>({...u,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){c(),(r=(n=this.options).onSubmitInvalid)==null||r.call(n,{value:this.state.values,formApi:this});return}if(await this.validate("submit"),!this.state.isValid){c(),(i=(s=this.options).onSubmitInvalid)==null||i.call(s,{value:this.state.values,formApi:this});return}Bl(()=>{Object.values(this.fieldInfo).forEach(u=>{var f,h,m;(m=(h=(f=u.instance)==null?void 0:f.options.listeners)==null?void 0:h.onSubmit)==null||m.call(h,{value:u.instance.state.value,fieldApi:u.instance})})});try{await((a=(o=this.options).onSubmit)==null?void 0:a.call(o,{value:this.state.values,formApi:this,meta:t??this.options.onSubmitMeta})),Bl(()=>{this.baseStore.setState(u=>({...u,isSubmitted:!0,isSubmitSuccessful:!0})),c()})}catch(u){throw this.baseStore.setState(f=>({...f,isSubmitSuccessful:!1})),c(),u}}setErrorMap(t){this.baseStore.setState(n=>({...n,errorMap:{...n.errorMap,...t}}))}}function QO(e){if(e){if(LW(e)){const t=QO(e.form).formError,n=e.fields;return{formError:t,fieldErrors:n}}return{formError:e}}return{formError:void 0}}function Qb(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"change":default:return"onChange"}}class Z5e{constructor(t){this.options={},this.mount=()=>{var n,r;const s=this.store.mount(),i=this.getInfo();i.instance=this,this.update(this.options);const{onMount:o}=this.options.validators||{};if(o){const a=this.runValidator({validate:o,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});a&&this.setMeta(c=>({...c,errorMap:{...c==null?void 0:c.errorMap,onMount:a}}))}return(r=(n=this.options.listeners)==null?void 0:n.onMount)==null||r.call(n,{value:this.state.value,fieldApi:this}),s},this.update=n=>{if(this.state.value===void 0){const r=PW(n.form.options.defaultValues,n.name);n.defaultValue!==void 0?this.setValue(n.defaultValue,{dontUpdateMeta:!0}):r!==void 0&&this.setValue(r,{dontUpdateMeta:!0})}this.form.getFieldMeta(this.name)===void 0&&this.setMeta(this.state.meta),this.options=n,this.name=n.name},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(n,r)=>{var s,i;this.form.setFieldValue(this.name,n,r),(i=(s=this.options.listeners)==null?void 0:s.onChange)==null||i.call(s,{value:this.state.value,fieldApi:this}),this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=n=>this.form.setFieldMeta(this.name,n),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(n,r)=>{var s,i;this.form.pushFieldValue(this.name,n,r),(i=(s=this.options.listeners)==null?void 0:s.onChange)==null||i.call(s,{value:this.state.value,fieldApi:this})},this.insertValue=(n,r,s)=>{var i,o;this.form.insertFieldValue(this.name,n,r,s),(o=(i=this.options.listeners)==null?void 0:i.onChange)==null||o.call(i,{value:this.state.value,fieldApi:this})},this.replaceValue=(n,r,s)=>{var i,o;this.form.replaceFieldValue(this.name,n,r,s),(o=(i=this.options.listeners)==null?void 0:i.onChange)==null||o.call(i,{value:this.state.value,fieldApi:this})},this.removeValue=(n,r)=>{var s,i;this.form.removeFieldValue(this.name,n,r),(i=(s=this.options.listeners)==null?void 0:s.onChange)==null||i.call(s,{value:this.state.value,fieldApi:this})},this.swapValues=(n,r,s)=>{var i,o;this.form.swapFieldValues(this.name,n,r,s),(o=(i=this.options.listeners)==null?void 0:i.onChange)==null||o.call(i,{value:this.state.value,fieldApi:this})},this.moveValue=(n,r,s)=>{var i,o;this.form.moveFieldValues(this.name,n,r,s),(o=(i=this.options.listeners)==null?void 0:i.onChange)==null||o.call(i,{value:this.state.value,fieldApi:this})},this.getLinkedFields=n=>{const r=Object.values(this.form.fieldInfo),s=[];for(const i of r){if(!i.instance)continue;const{onChangeListenTo:o,onBlurListenTo:a}=i.instance.options.validators||{};n==="change"&&(o!=null&&o.includes(this.name))&&s.push(i.instance),n==="blur"&&(a!=null&&a.includes(this.name))&&s.push(i.instance)}return s},this.validateSync=(n,r)=>{const s=KO(n,this.options),o=this.getLinkedFields(n).reduce((u,f)=>{const h=KO(n,f.options);return h.forEach(m=>{m.field=f}),u.concat(h)},[]);let a=!1;Bl(()=>{const u=(f,h)=>{const m=Mm(h.cause),y=h.validate?RP(f.runValidator({validate:h.validate,value:{value:f.store.state.value,validationSource:"field",fieldApi:f},type:"validate"})):r[m];f.state.meta.errorMap[m]!==y&&f.setMeta(v=>({...v,errorMap:{...v.errorMap,[Mm(h.cause)]:y||r[m]}})),(y||r[m])&&(a=!0)};for(const f of s)u(this,f);for(const f of o)f.validate&&u(f.field,f)});const c=Mm("submit");return this.state.meta.errorMap[c]&&n!=="submit"&&!a&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[c]:void 0}})),{hasErrored:a}},this.validateAsync=async(n,r)=>{const s=XO(n,this.options),i=await r,o=this.getLinkedFields(n),a=o.reduce((m,y)=>{const v=XO(n,y.options);return v.forEach(x=>{x.field=y}),m.concat(v)},[]);this.state.meta.isValidating||this.setMeta(m=>({...m,isValidating:!0}));for(const m of o)m.setMeta(y=>({...y,isValidating:!0}));const c=[],u=[],f=(m,y,v)=>{const x=Mm(y.cause),E=m.getInfo().validationMetaMap[x];E==null||E.lastAbortController.abort();const N=new AbortController;this.getInfo().validationMetaMap[x]={lastAbortController:N},v.push(new Promise(async _=>{var C;let j;try{j=await new Promise((M,D)=>{this.timeoutIds[y.cause]&&clearTimeout(this.timeoutIds[y.cause]),this.timeoutIds[y.cause]=setTimeout(async()=>{if(N.signal.aborted)return M(void 0);try{M(await this.runValidator({validate:y.validate,value:{value:m.store.state.value,fieldApi:m,signal:N.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){D(P)}},y.debounceMs)})}catch(M){j=M}if(N.signal.aborted)return _(void 0);const A=RP(j),$=(C=i[this.name])==null?void 0:C[x],R=A||$;m.setMeta(M=>({...M,errorMap:{...M==null?void 0:M.errorMap,[x]:R}})),_(R)}))};for(const m of s)m.validate&&f(this,m,c);for(const m of a)m.validate&&f(m.field,m,u);let h=[];(c.length||u.length)&&(h=await Promise.all(c),await Promise.all(u)),this.setMeta(m=>({...m,isValidating:!1}));for(const m of o)m.setMeta(y=>({...y,isValidating:!1}));return h.filter(Boolean)},this.validate=(n,r)=>{var s;if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:i}=r!=null&&r.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(n),{hasErrored:o}=this.validateSync(n,i[this.name]??{});if(o&&!this.options.asyncAlways)return(s=this.getInfo().validationMetaMap[Mm(n)])==null||s.lastAbortController.abort(),this.state.meta.errors;const a=r!=null&&r.skipFormValidation?Promise.resolve({}):this.form.validateAsync(n);return this.validateAsync(n,a)},this.handleChange=n=>{this.setValue(n)},this.handleBlur=()=>{var n,r;this.state.meta.isTouched||(this.setMeta(i=>({...i,isTouched:!0})),this.validate("change")),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),(r=(n=this.options.listeners)==null?void 0:n.onBlur)==null||r.call(n,{value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.timeoutIds={},t.defaultValue!==void 0&&this.form.setFieldValue(this.name,t.defaultValue,{dontUpdateMeta:!0}),this.store=new Aa({deps:[this.form.store],fn:()=>{const n=this.form.getFieldValue(this.name),r=this.form.getFieldMeta(this.name)??{isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,errors:[],errorMap:{},...t.defaultMeta};return{value:n,meta:r}}}),this.options=t}get state(){return this.store.state}runValidator(t){return BW(t.validate)?FW[t.type](t.value,t.validate):t.validate(t.value)}setErrorMap(t){this.setMeta(n=>({...n,errorMap:{...n.errorMap,...t}}))}}function RP(e){if(e)return e}function Mm(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"change":default:return"onChange"}}const Zx=typeof window<"u"?w.useLayoutEffect:w.useEffect;function e4e(e){const[t]=w.useState(()=>{const r=new Z5e({...e,form:e.form,name:e.name});return r.Field=zW,r});return Zx(t.mount,[t]),Zx(()=>{t.update(e)}),aS(t.store,e.mode==="array"?n=>[n.meta,Object.keys(n.value??[]).length]:void 0),t}const zW=({children:e,...t})=>{const n=e4e(t),r=w.useMemo(()=>lS(e,n),[e,n,n.state.value,n.state.meta]);return p.jsx(p.Fragment,{children:r})};function t4e({form:e,selector:t,children:n}){const r=aS(e.store,t);return lS(n,r)}function n4e(e){const[t]=w.useState(()=>{const n=new Q5e(e),r=n;return r.Field=function(i){return p.jsx(zW,{...i,form:n})},r.Subscribe=s=>p.jsx(t4e,{form:n,selector:s.selector,children:s.children}),r});return Zx(t.mount,[]),aS(t.store,n=>n.isSubmitting),Zx(()=>{t.update(e)}),t}function r4e(e,t){return Zs(e,(n,r)=>{n[r.name]=r.getValue(t==null?void 0:t[r.name],"form")??""},{})}function s4e(e,t,n,r){return Zs(t,(s,i,o)=>{const a=r.find(f=>f.name===o);if(!a||a.isVirtual())return;const c=i===""?null:i,u=a.getValue(c,"submit")||null;(e==="create"||u!==n[o])&&(s[o]=u)},{})}function VW({action:e="update",entity:t,initialData:n,onSubmitted:r}){const s=n??{},i=t.getFillableFields(e,!0),o=r4e(i,s),a=n4e({defaultValues:o,validators:{onSubmitAsync:async({value:u})=>{try{t.isValidData(u,e,{explain:!0,ignoreUnknown:!0});return}catch(f){return f.message}}},onSubmit:async({value:u,formApi:f})=>{if(!t.isValidData(u,e)){console.error("invalid data",u);return}if(!s)return;const h=s4e(e,u,s,i);await(r==null?void 0:r(Object.keys(h).length===0?void 0:h))}});async function c(u){u.preventDefault(),u.stopPropagation(),a.handleSubmit()}return{Form:a,handleSubmit:c,fields:i,action:e,values:o,initialData:n}}function i4e({params:e}){return p.jsx(o4e,{params:e},e.entity)}function o4e({params:e}){var $,R;const{$data:t,relations:n}=Ts(),r=t.entity(e.entity);if(!r)return p.jsx(Os.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});const s=e.id,[i,o]=w.useState(null),[a,c,u]=$n();as(["Data",r.label,`#${s}`]);const f=n.listableRelationsOf(r),h=($=n.sourceRelationsOf(r))==null?void 0:$.map(M=>M.other(r).reference),m=T1(r.name,s,{with:h},{keepPreviousData:!1,revalidateOnFocus:!1,shouldRetryOnError:!1}),y=ut.data.entity.list(r.name),v=()=>u({fallback:y});async function x(M){if(!M){v();return}try{await m.update(M),i&&o(null),v()}catch(D){o(D instanceof Error?D.message:"Failed to update")}}async function E(){if(confirm("Are you sure to delete?"))try{await m._delete(),i&&o(null),v()}catch(M){o(M instanceof Error?M.message:"Failed to delete")}}const N=m.data,{Form:_,handleSubmit:C}=VW({action:"update",entity:r,initialData:(R=m.data)==null?void 0:R.toJSON(),onSubmitted:x});if(!N&&!m.isLoading)return p.jsx(Os.NotFound,{description:`Entity "${e.entity}" with ID "${s}" doesn't exist.`});const j=(M="")=>`${r.name}_${s}_${String(M)}`,A=m.isLoading||m.isValidating||_.state.isSubmitting;return p.jsxs(w.Fragment,{children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(Ur,{position:"bottom-end",items:[{label:"Inspect",onClick:()=>{vr.open("debug",{data:{data:N,entity:r.toJSON(),schema:r.toSchema({clean:!0}),form:_.state.values,state:_.state}})}},{label:"Settings",onClick:()=>a(ut.settings.path(["data","entities",r.name]),{absolute:!0})},{label:"Delete",onClick:E,destructive:!0,disabled:A}],children:p.jsx(St,{Icon:Lc})}),p.jsx(_.Subscribe,{selector:M=>[M.canSubmit,M.isSubmitting],children:([M,D])=>p.jsx(ot,{type:"button",onClick:_.handleSubmit,variant:"primary",tabIndex:r.fields.length+1,disabled:!M||D||A,children:"Update"})})]}),className:"pl-3",children:p.jsx(oS,{backTo:y,path:[{label:r.label,href:y},{label:`Edit #${s}`}]})}),m.isLoading?p.jsx("div",{className:"w-full h-full flex justify-center items-center font-mono opacity-30",children:"Loading..."}):p.jsxs(pr,{children:[i&&p.jsxs("div",{className:"flex flex-row dark:bg-red-950 bg-red-100 p-4",children:[p.jsx("b",{className:"mr-2",children:"Update failed: "})," ",i]}),p.jsx(DW,{entity:r,entityId:s,handleSubmit:C,fieldsDisabled:A,data:N??void 0,Form:_,action:"update",className:"flex flex-grow flex-col gap-3 p-3"}),f.length>0?p.jsx(a4e,{id:s,entity:r,relations:f}):null]})]},j())}function a4e({id:e,entity:t,relations:n}){const[r,s]=w.useState(n.length>0?n[0]:void 0);function i(o){s(o)}return n.length===0?null:p.jsxs("div",{className:"flex flex-col max-w-full",children:[p.jsx(qU,{title:"Relations",items:n.map(o=>{const a=o.other(t);return{as:"button",type:"button",label:ii(a.reference),onClick:()=>i(o),active:(r==null?void 0:r.other(t).reference)===a.reference,badge:o.type()}})}),p.jsx("div",{className:"flex flex-grow flex-col gap-3 p-3",children:p.jsx(l4e,{id:e,entity:t,relation:r},JSON.stringify(r==null?void 0:r.toJSON()))})]})}function l4e({id:e,entity:t,relation:n}){var h,m,y;const r=n.other(t),[s]=$n(),[i,o]=w.useState({select:r.entity.getSelect(void 0,"table"),sort:r.entity.getDefaultSort(),limit:10,offset:0}),a=$1(v=>v.data.readManyByReference(t.name,e,r.reference,i),{keepPreviousData:!0,revalidateOnFocus:!0});function c(v){s(ut.data.entity.edit(r.entity.name,v.id))}let u;try{if(r.entity.type!=="system"){const v=n.getReferenceQuery(r.entity,e,r.reference);u=()=>{s(ut.data.entity.create(r.entity.name),{query:v.where})}}}catch{}if(!a.data)return null;const f=a.isValidating||a.isLoading;return p.jsx("div",{"data-updating":f?1:void 0,className:"transition-opacity data-[updating]:opacity-50",children:p.jsx(l5,{select:i.select,data:a.data??null,entity:r.entity,sort:i.sort,onClickRow:c,onClickNew:u,page:Math.floor(i.offset/i.limit)+1,total:((y=(m=(h=a.data)==null?void 0:h.body)==null?void 0:m.meta)==null?void 0:y.count)??1,onClickPage:v=>{o(x=>({...x,offset:(v-1)*x.limit}))}})})}function UW(e,t){const n=Txe(),[r,s]=yi(),[i,o]=w.useState((t==null?void 0:t.defaultValue)??{}),a=w.useMemo(()=>TL(e.template({withOptional:!0}),(t==null?void 0:t.defaultValue)??{}),[JSON.stringify({schema:e,dflt:t==null?void 0:t.defaultValue})]);w.useEffect(()=>{const u=n.length>0?eoe(n):(t==null?void 0:t.defaultValue)??{},f=Ln(e,Object.assign({},a,u));o(f)},[n,JSON.stringify(t==null?void 0:t.defaultValue),r]);function c(u){var y;const f=c4e(Object.assign({},i,u),a),h=((y=t==null?void 0:t.beforeEncode)==null?void 0:y.call(t,f))??f,m=t1(h,{encode:!1});s(r+(m.length>0?"?"+m:""))}return{value:i,set:c}}function c4e(e,t){return Zs(e,(n,r,s)=>{t&&VB(r,t[s])||(n[s]=r)},{})}function u4e({params:e}){const{$data:t}=Ts(),[n,r,s]=$n(),i=t.entity(e.entity);if(i){if(i.type==="system")return p.jsx(Os.NotAllowed,{description:`Entity "${e.entity}" cannot be created.`})}else return p.jsx(Os.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});const[o,a]=w.useState(null);as(["Data",i.label,"Create"]);const c=eve(i.name),u=UW(Qe({}),{}),f=ut.data.entity.list(i.name),h=()=>s({fallback:f});async function m(E){if(console.log("create:changeSet",E),!!E)try{await c.create(E),o&&a(null),h()}catch(N){a(N instanceof Error?N.message:"Failed to create")}}const{Form:y,handleSubmit:v}=VW({action:"create",entity:i,initialData:u.value,onSubmitted:m}),x=c.isLoading||c.isValidating||y.state.isSubmitting;return p.jsxs(p.Fragment,{children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(ot,{onClick:h,children:"Cancel"}),p.jsx(y.Subscribe,{selector:E=>[E.canSubmit,E.isSubmitting],children:([E,N])=>p.jsx(ot,{type:"button",onClick:y.handleSubmit,variant:"primary",tabIndex:i.fields.length,disabled:!E||N,children:"Create"})})]}),children:p.jsx(oS,{backTo:f,path:[{label:i.label},{label:"Create"}]})}),p.jsxs(pr,{children:[o&&p.jsxs("div",{className:"flex flex-row dark:bg-red-950 bg-red-100 p-4",children:[p.jsx("b",{className:"mr-2",children:"Create failed: "})," ",o]}),p.jsx(DW,{entity:i,handleSubmit:v,fieldsDisabled:x,data:u.value,Form:y,action:"create",className:"flex flex-grow flex-col gap-3 p-3"})]},i.name)]})}function d4e(){const e=Do(),{config:t}=Fc(),n=z$(),[r]=$n();return{open:async()=>{const i=vr.open("overlay",{content:"Loading..."}),o=await e.auth.actionSchema("password","create");i.closeAll(),vr.open("form",{schema:o,uiSchema:{password:{"ui:widget":"password"}},autoCloseAfterSubmit:!1,onSubmit:async(a,c)=>{console.log("submitted:",a,c);const u=await e.auth.action("password","create",a);console.log(u),u.ok?(n(),r(ut.data.entity.edit(t.entity_name,u.data.id)),c.close()):"error"in u?c.setError(u.error):c.setError("Unknown error")}},{title:"Create User"})}}}const f4e=YL({...ML(Ys.properties,["select","where","sort"]),page:Rt({default:1}).optional(),perPage:Rt({default:10}).optional()}),h4e=[5,10,25,50,100];function p4e({params:e}){return p.jsx(m4e,{params:e},e.entity)}function m4e({params:e}){var y,v;const{$data:t}=Ts(),n=t.entity(e.entity);if(!n)return p.jsx(Os.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});as(["Data",(n==null?void 0:n.label)??e.entity]);const[r]=$n(),s=UW(f4e,{defaultValue:{select:n.getSelect(void 0,"table"),sort:n.getDefaultSort()},beforeEncode:x=>"sort"in x&&x.sort?{...x,sort:`${x.sort.dir==="asc"?"":"-"}${x.sort.by}`}:x}),i=$1(x=>x.data.readMany(n==null?void 0:n.name,{select:s.value.select,limit:s.value.perPage,offset:(s.value.page-1)*s.value.perPage,sort:`${s.value.sort.dir==="asc"?"":"-"}${s.value.sort.by}`}),{enabled:!!n,revalidateOnFocus:!0,keepPreviousData:!0}),o=(y=i.data)==null?void 0:y.data,a=(v=i.data)==null?void 0:v.body.meta;function c(x){n&&r(ut.data.entity.edit(n.name,x.id))}function u(x){s.set({page:x})}function f(x){const E=s.value.sort,N={by:x,dir:E.by===x&&E.dir==="asc"?"desc":"asc"};s.set({sort:N})}function h(x){s.set({perPage:x,page:1})}const m=i.isLoading||i.isValidating;return p.jsxs(w.Fragment,{children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(Ur,{items:[{label:"Settings",onClick:()=>r(ut.data.schema.entity(n.name))},{label:"Data Schema",onClick:()=>r(ut.data.schema.root())},{label:"Advanced Settings",onClick:()=>r(ut.settings.path(["data","entities",n.name]),{absolute:!0})}],position:"bottom-end",children:p.jsx(St,{Icon:Lc})}),p.jsx(g4e,{entity:n})]}),children:n.label}),p.jsx(pr,{children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsx("div",{"data-updating":m?1:void 0,className:"data-[updating]:opacity-50 transition-opacity pb-10",children:p.jsx(l5,{data:o??null,entity:n,select:s.value.select,onClickRow:c,page:s.value.page,sort:s.value.sort,onClickSort:f,perPage:s.value.perPage,perPageOptions:h4e,total:a==null?void 0:a.count,onClickPage:u,onClickPerPage:h})})})},n.name)]},n.name)}function g4e({entity:e}){const t=Tt(),n=d4e(),[r]=$n();return e?e.type==="system"?{users:t.app.config.auth.entity_name,media:t.app.config.media.entity_name}.users===e.name?p.jsx(ot,{onClick:n.open,variant:"primary",children:"New User"}):null:p.jsx(ot,{onClick:()=>{r(ut.data.entity.create(e.name))},variant:"primary",children:"Create new"}):null}function y4e({params:e}){const{$data:t}=Ts(),[n]=$n(),r=t.entity(e.entity);return r?p.jsxs(zwe,{path:`/entity/${r.name}/:setting?`,defaultIdentifier:"fields",children:[p.jsx(Wn,{right:p.jsxs(p.Fragment,{children:[p.jsx(Ur,{items:[{label:"Data",onClick:()=>n(ut.data.root()+ut.data.entity.list(r.name),{absolute:!0})},{label:"Advanced Settings",onClick:()=>n(ut.settings.path(["data","entities",r.name]),{absolute:!0})}],position:"bottom-end",children:p.jsx(St,{Icon:Lc})}),p.jsx(Ur,{items:[{icon:sT,label:"Add relation",onClick:()=>t.modals.createRelation(r.name)},{icon:Uy,label:"Add media",onClick:()=>t.modals.createMedia(r.name)},()=>p.jsx("div",{className:"h-px my-1 w-full bg-primary/5"}),{icon:DU,label:"Create Entity",onClick:()=>t.modals.createEntity()}],position:"bottom-end",children:p.jsx(ot,{IconRight:FU,children:"Add"})})]}),className:"pl-3",children:p.jsxs("div",{className:"flex flex-row gap-4",children:[p.jsx(oS,{path:[{label:"Schema",href:"/"},{label:r.label}],backTo:"/"}),p.jsx(jn,{to:"/",className:"hidden md:inline",children:p.jsx(ot,{IconLeft:wO,children:"Overview"})})]})}),p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx(b4e,{entity:r}),p.jsx(v4e,{entity:r}),p.jsx(Cx,{identifier:"relations",title:"Relations",ActiveIcon:U$,children:p.jsx(Vr,{title:"Relations",description:"This will soon be available here. Meanwhile, check advanced settings.",primary:{children:"Advanced Settings",onClick:()=>n(ut.settings.path(["data","relations"]),{absolute:!0})}})}),p.jsx(Cx,{identifier:"indices",title:"Indices",ActiveIcon:ive,children:p.jsx(Vr,{title:"Indices",description:"This will soon be available here. Meanwhile, check advanced settings.",primary:{children:"Advanced Settings",onClick:()=>n(ut.settings.path(["data","indices"]),{absolute:!0})}})})]},r.name)]}):p.jsx(Os.NotFound,{description:`Entity "${e.entity}" doesn't exist.`})}const b4e=({entity:e})=>{const[t,n]=w.useState(!1),[r,s]=w.useState(0),{actions:i,$data:o,config:a}=Ts(),[c,u]=w.useState(),f=w.useRef(null);async function h(){var v;if(t)return;n(!0);const y=(v=f.current)==null?void 0:v.getData();await i.entity.patch(e.name).fields.set(y),n(!1),s(x=>x+1)}const m=Object.fromEntries(e.fields.map(y=>[y.name,y.toJSON()]));return p.jsx(Cx,{identifier:"fields",title:"Fields",ActiveIcon:V$,renderHeaderRight:({open:y})=>y?p.jsx(ot,{variant:"primary",disabled:!y,onClick:h,children:"Update"}):null,children:p.jsxs("div",{className:"flex flex-col flex-grow py-3 px-4 max-w-4xl gap-3 relative",children:[t&&p.jsx("div",{className:"animate-fade-in absolute w-full h-full top-0 bottom-0 left-0 right-0 bg-background/65 z-50"}),p.jsx(TH,{routePattern:`/entity/${e.name}/fields/:sub?`,fields:m,ref:f,sortable:!0,additionalFieldTypes:Y1.filter(y=>["relation","media"].includes(y.type)).map(y=>({...y,onClick:()=>{switch(y.type){case"relation":o.modals.createRelation(e.name);break;case"media":o.modals.createMedia(e.name);break}}})),defaultPrimaryFormat:a==null?void 0:a.default_primary_format,isNew:!1},String(r)),qr()&&p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row gap-1 justify-center",children:[p.jsx(ot,{size:"small",onClick:()=>{var y;return u((y=f.current)==null?void 0:y.isValid())},children:"valid"}),p.jsx(ot,{size:"small",onClick:()=>{var y;return u((y=f.current)==null?void 0:y.getValues())},children:"values"}),p.jsx(ot,{size:"small",onClick:()=>{var y;return u((y=f.current)==null?void 0:y.getData())},children:"data"}),p.jsx(ot,{size:"small",onClick:()=>{var y;return u((y=f.current)==null?void 0:y.getErrors())},children:"errors"}),p.jsx(ot,{size:"small",onClick:h,children:"update"})]}),p.jsx("pre",{className:"select-text",children:JSON.stringify(c,null,2)})]})]})})},v4e=({entity:e})=>{var c,u,f,h;const t=Ts(),n=(u=(c=t.entities)==null?void 0:c[e.name])==null?void 0:u.config,r=w.useRef(null),s=E1((h=(f=t.schema.properties.entities.additionalProperties)==null?void 0:f.properties)==null?void 0:h.config),[i,o]=OH(s,n,["fields"]);try{i.properties.sort_field.enum=e.getFields().map(m=>m.name)}catch(m){console.error("error setting sort_field enum",m)}async function a(){var m,y;console.log("update",(m=r.current)==null?void 0:m.formData()),await t.actions.entity.patch(e.name).config((y=r.current)==null?void 0:y.formData())}return p.jsx(Cx,{identifier:"settings",title:"Settings",ActiveIcon:Fg,renderHeaderRight:({open:m})=>m?p.jsx(ot,{variant:"primary",disabled:!m,onClick:a,children:"Update"}):null,children:p.jsx("div",{className:"flex flex-col flex-grow py-3 px-4 max-w-4xl gap-3 relative",children:p.jsx(hp,{ref:r,schema:i,formData:o,onSubmit:console.log,className:"legacy hide-required-mark fieldset-alternative mute-root"})})})},x4e=w.lazy(()=>Wy(()=>import("./DataSchemaCanvas-kSVOR3cq.js"),[]).then(e=>({default:e.DataSchemaCanvas})));function w4e(){const{$data:e}=Ts();return p.jsxs(p.Fragment,{children:[p.jsx(Wn,{right:p.jsx(ot,{type:"button",variant:"primary",onClick:e.modals.createAny,children:"Create new"}),children:"Schema Overview"}),p.jsx("div",{className:"w-full h-full",children:p.jsx(w.Suspense,{children:p.jsx(x4e,{})})})]})}function S4e(){return p.jsx(O5e,{children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/",component:A5e}),p.jsx(lt,{path:"/entity/:entity",component:p4e}),p.jsx(lt,{path:"/entity/:entity/create",component:u4e}),p.jsx(lt,{path:"/entity/:entity/edit/:id",component:i4e}),p.jsxs(lt,{path:"/schema",nest:!0,children:[p.jsx(lt,{path:"/",component:w4e}),p.jsx(lt,{path:"/entity/:entity/:setting?/:sub?",component:y4e})]})]})})}const MP=()=>p.jsx("span",{className:"text-xs bg-primary/10 flex rounded-full px-2.5 py-1 leading-none",children:"coming soon"});function E4e(e){return qr()?p.jsx(N4e,{...e}):p.jsx(_4e,{})}function N4e({children:e}){const{app:t}=Tt();return p.jsxs(p.Fragment,{children:[p.jsxs(Hy,{children:[p.jsx(Wn,{right:p.jsx(jn,{href:t.getSettingsPath(["flows"]),children:p.jsx(St,{Icon:fp})}),children:"Flows"}),p.jsx(pr,{initialOffset:96,children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[p.jsx(bs,{as:jn,href:ut.flows.flows.list(),children:"All Flows"}),p.jsxs(bs,{disabled:!0,className:"justify-between",children:["Endpoints",p.jsx(MP,{})]}),p.jsxs(bs,{disabled:!0,className:"justify-between",children:["Executions",p.jsx(MP,{})]}),p.jsx(bs,{as:jn,href:t.getSettingsPath(["flows"]),children:"Settings"})]})})})]}),p.jsx(qy,{children:e})]})}function _4e(){return as(["Flows"]),p.jsx(Vr,{Icon:mve,title:"Flows",description:"Flows are coming very soon!"})}function Fn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Fn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var C4e={value:()=>{}};function cS(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Iv(n)}function Iv(e){this._=e}function O4e(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Iv.prototype=cS.prototype={constructor:Iv,on:function(e,t){var n=this._,r=O4e(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=j4e(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=kP(n[s],e.name,t);else if(t==null)for(s in n)n[s]=kP(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Iv(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function j4e(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function kP(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=C4e,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ZO="http://www.w3.org/1999/xhtml";const IP={svg:"http://www.w3.org/2000/svg",xhtml:ZO,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function uS(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),IP.hasOwnProperty(t)?{space:IP[t],local:e}:e}function A4e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ZO&&t.documentElement.namespaceURI===ZO?t.createElement(e):t.createElementNS(n,e)}}function $4e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qW(e){var t=uS(e);return(t.local?$4e:A4e)(t)}function T4e(){}function u5(e){return e==null?T4e:function(){return this.querySelector(e)}}function R4e(e){typeof e!="function"&&(e=u5(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=new Array(o),c,u,f=0;f<o;++f)(c=i[f])&&(u=e.call(c,c.__data__,f,i))&&("__data__"in c&&(u.__data__=c.__data__),a[f]=u);return new js(r,this._parents)}function M4e(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function k4e(){return[]}function HW(e){return e==null?k4e:function(){return this.querySelectorAll(e)}}function I4e(e){return function(){return M4e(e.apply(this,arguments))}}function D4e(e){typeof e=="function"?e=I4e(e):e=HW(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],a=o.length,c,u=0;u<a;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new js(r,s)}function WW(e){return function(){return this.matches(e)}}function GW(e){return function(t){return t.matches(e)}}var P4e=Array.prototype.find;function L4e(e){return function(){return P4e.call(this.children,e)}}function F4e(){return this.firstElementChild}function B4e(e){return this.select(e==null?F4e:L4e(typeof e=="function"?e:GW(e)))}var z4e=Array.prototype.filter;function V4e(){return Array.from(this.children)}function U4e(e){return function(){return z4e.call(this.children,e)}}function q4e(e){return this.selectAll(e==null?V4e:U4e(typeof e=="function"?e:GW(e)))}function H4e(e){typeof e!="function"&&(e=WW(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new js(r,this._parents)}function YW(e){return new Array(e.length)}function W4e(){return new js(this._enter||this._groups.map(YW),this._parents)}function ew(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ew.prototype={constructor:ew,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function G4e(e){return function(){return e}}function Y4e(e,t,n,r,s,i){for(var o=0,a,c=t.length,u=i.length;o<u;++o)(a=t[o])?(a.__data__=i[o],r[o]=a):n[o]=new ew(e,i[o]);for(;o<c;++o)(a=t[o])&&(s[o]=a)}function J4e(e,t,n,r,s,i,o){var a,c,u=new Map,f=t.length,h=i.length,m=new Array(f),y;for(a=0;a<f;++a)(c=t[a])&&(m[a]=y=o.call(c,c.__data__,a,t)+"",u.has(y)?s[a]=c:u.set(y,c));for(a=0;a<h;++a)y=o.call(e,i[a],a,i)+"",(c=u.get(y))?(r[a]=c,c.__data__=i[a],u.delete(y)):n[a]=new ew(e,i[a]);for(a=0;a<f;++a)(c=t[a])&&u.get(m[a])===c&&(s[a]=c)}function X4e(e){return e.__data__}function K4e(e,t){if(!arguments.length)return Array.from(this,X4e);var n=t?J4e:Y4e,r=this._parents,s=this._groups;typeof e!="function"&&(e=G4e(e));for(var i=s.length,o=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var f=r[u],h=s[u],m=h.length,y=Q4e(e.call(f,f&&f.__data__,u,r)),v=y.length,x=a[u]=new Array(v),E=o[u]=new Array(v),N=c[u]=new Array(m);n(f,h,x,E,N,y,t);for(var _=0,C=0,j,A;_<v;++_)if(j=x[_]){for(_>=C&&(C=_+1);!(A=E[C])&&++C<v;);j._next=A||null}}return o=new js(o,r),o._enter=a,o._exit=c,o}function Q4e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Z4e(){return new js(this._exit||this._groups.map(YW),this._parents)}function eRe(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function tRe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),a=new Array(s),c=0;c<o;++c)for(var u=n[c],f=r[c],h=u.length,m=a[c]=new Array(h),y,v=0;v<h;++v)(y=u[v]||f[v])&&(m[v]=y);for(;c<s;++c)a[c]=n[c];return new js(a,this._parents)}function nRe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function rRe(e){e||(e=sRe);function t(h,m){return h&&m?e(h.__data__,m.__data__):!h-!m}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],a=o.length,c=s[i]=new Array(a),u,f=0;f<a;++f)(u=o[f])&&(c[f]=u);c.sort(t)}return new js(s,this._parents).order()}function sRe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function iRe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function oRe(){return Array.from(this)}function aRe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function lRe(){let e=0;for(const t of this)++e;return e}function cRe(){return!this.node()}function uRe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,a;i<o;++i)(a=s[i])&&e.call(a,a.__data__,i,s);return this}function dRe(e){return function(){this.removeAttribute(e)}}function fRe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hRe(e,t){return function(){this.setAttribute(e,t)}}function pRe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mRe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gRe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function yRe(e,t){var n=uS(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?fRe:dRe:typeof t=="function"?n.local?gRe:mRe:n.local?pRe:hRe)(n,t))}function JW(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bRe(e){return function(){this.style.removeProperty(e)}}function vRe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xRe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function wRe(e,t,n){return arguments.length>1?this.each((t==null?bRe:typeof t=="function"?xRe:vRe)(e,t,n??"")):Ph(this.node(),e)}function Ph(e,t){return e.style.getPropertyValue(t)||JW(e).getComputedStyle(e,null).getPropertyValue(t)}function SRe(e){return function(){delete this[e]}}function ERe(e,t){return function(){this[e]=t}}function NRe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _Re(e,t){return arguments.length>1?this.each((t==null?SRe:typeof t=="function"?NRe:ERe)(e,t)):this.node()[e]}function XW(e){return e.trim().split(/^|\s+/)}function d5(e){return e.classList||new KW(e)}function KW(e){this._node=e,this._names=XW(e.getAttribute("class")||"")}KW.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function QW(e,t){for(var n=d5(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function ZW(e,t){for(var n=d5(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function CRe(e){return function(){QW(this,e)}}function ORe(e){return function(){ZW(this,e)}}function jRe(e,t){return function(){(t.apply(this,arguments)?QW:ZW)(this,e)}}function ARe(e,t){var n=XW(e+"");if(arguments.length<2){for(var r=d5(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?jRe:t?CRe:ORe)(n,t))}function $Re(){this.textContent=""}function TRe(e){return function(){this.textContent=e}}function RRe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function MRe(e){return arguments.length?this.each(e==null?$Re:(typeof e=="function"?RRe:TRe)(e)):this.node().textContent}function kRe(){this.innerHTML=""}function IRe(e){return function(){this.innerHTML=e}}function DRe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function PRe(e){return arguments.length?this.each(e==null?kRe:(typeof e=="function"?DRe:IRe)(e)):this.node().innerHTML}function LRe(){this.nextSibling&&this.parentNode.appendChild(this)}function FRe(){return this.each(LRe)}function BRe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zRe(){return this.each(BRe)}function VRe(e){var t=typeof e=="function"?e:qW(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function URe(){return null}function qRe(e,t){var n=typeof e=="function"?e:qW(e),r=t==null?URe:typeof t=="function"?t:u5(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HRe(){var e=this.parentNode;e&&e.removeChild(this)}function WRe(){return this.each(HRe)}function GRe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function YRe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function JRe(e){return this.select(e?YRe:GRe)}function XRe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function KRe(e){return function(t){e.call(this,t,this.__data__)}}function QRe(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ZRe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function e3e(e,t,n){return function(){var r=this.__on,s,i=KRe(t);if(r){for(var o=0,a=r.length;o<a;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function t3e(e,t,n){var r=QRe(e+""),s,i=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,f;c<u;++c)for(s=0,f=a[c];s<i;++s)if((o=r[s]).type===f.type&&o.name===f.name)return f.value}return}for(a=t?e3e:ZRe,s=0;s<i;++s)this.each(a(r[s],t,n));return this}function eG(e,t,n){var r=JW(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function n3e(e,t){return function(){return eG(this,e,t)}}function r3e(e,t){return function(){return eG(this,e,t.apply(this,arguments))}}function s3e(e,t){return this.each((typeof t=="function"?r3e:n3e)(e,t))}function*i3e(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var tG=[null];function js(e,t){this._groups=e,this._parents=t}function s0(){return new js([[document.documentElement]],tG)}function o3e(){return this}js.prototype=s0.prototype={constructor:js,select:R4e,selectAll:D4e,selectChild:B4e,selectChildren:q4e,filter:H4e,data:K4e,enter:W4e,exit:Z4e,join:eRe,merge:tRe,selection:o3e,order:nRe,sort:rRe,call:iRe,nodes:oRe,node:aRe,size:lRe,empty:cRe,each:uRe,attr:yRe,style:wRe,property:_Re,classed:ARe,text:MRe,html:PRe,raise:FRe,lower:zRe,append:VRe,insert:qRe,remove:WRe,clone:JRe,datum:XRe,on:t3e,dispatch:s3e,[Symbol.iterator]:i3e};function vs(e){return typeof e=="string"?new js([[document.querySelector(e)]],[document.documentElement]):new js([[e]],tG)}function a3e(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Mi(e,t){if(e=a3e(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const l3e={passive:!1},Jg={capture:!0,passive:!1};function j_(e){e.stopImmediatePropagation()}function Yf(e){e.preventDefault(),e.stopImmediatePropagation()}function nG(e){var t=e.document.documentElement,n=vs(e).on("dragstart.drag",Yf,Jg);"onselectstart"in t?n.on("selectstart.drag",Yf,Jg):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rG(e,t){var n=e.document.documentElement,r=vs(e).on("dragstart.drag",null);t&&(r.on("click.drag",Yf,Jg),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Zb=e=>()=>e;function ej(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:a,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}ej.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function c3e(e){return!e.ctrlKey&&!e.button}function u3e(){return this.parentNode}function d3e(e,t){return t??{x:e.x,y:e.y}}function f3e(){return navigator.maxTouchPoints||"ontouchstart"in this}function sG(){var e=c3e,t=u3e,n=d3e,r=f3e,s={},i=cS("start","drag","end"),o=0,a,c,u,f,h=0;function m(j){j.on("mousedown.drag",y).filter(r).on("touchstart.drag",E).on("touchmove.drag",N,l3e).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(j,A){if(!(f||!e.call(this,j,A))){var $=C(this,t.call(this,j,A),j,A,"mouse");$&&(vs(j.view).on("mousemove.drag",v,Jg).on("mouseup.drag",x,Jg),nG(j.view),j_(j),u=!1,a=j.clientX,c=j.clientY,$("start",j))}}function v(j){if(Yf(j),!u){var A=j.clientX-a,$=j.clientY-c;u=A*A+$*$>h}s.mouse("drag",j)}function x(j){vs(j.view).on("mousemove.drag mouseup.drag",null),rG(j.view,u),Yf(j),s.mouse("end",j)}function E(j,A){if(e.call(this,j,A)){var $=j.changedTouches,R=t.call(this,j,A),M=$.length,D,P;for(D=0;D<M;++D)(P=C(this,R,j,A,$[D].identifier,$[D]))&&(j_(j),P("start",j,$[D]))}}function N(j){var A=j.changedTouches,$=A.length,R,M;for(R=0;R<$;++R)(M=s[A[R].identifier])&&(Yf(j),M("drag",j,A[R]))}function _(j){var A=j.changedTouches,$=A.length,R,M;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),R=0;R<$;++R)(M=s[A[R].identifier])&&(j_(j),M("end",j,A[R]))}function C(j,A,$,R,M,D){var P=i.copy(),F=Mi(D||$,A),V,H,I;if((I=n.call(j,new ej("beforestart",{sourceEvent:$,target:m,identifier:M,active:o,x:F[0],y:F[1],dx:0,dy:0,dispatch:P}),R))!=null)return V=I.x-F[0]||0,H=I.y-F[1]||0,function B(T,L,z){var q=F,k;switch(T){case"start":s[M]=B,k=o++;break;case"end":delete s[M],--o;case"drag":F=Mi(z||L,A),k=o;break}P.call(T,j,new ej(T,{sourceEvent:L,subject:I,target:m,identifier:M,active:k,x:F[0]+V,y:F[1]+H,dx:F[0]-q[0],dy:F[1]-q[1],dispatch:P}),R)}}return m.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Zb(!!j),m):e},m.container=function(j){return arguments.length?(t=typeof j=="function"?j:Zb(j),m):t},m.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Zb(j),m):n},m.touchable=function(j){return arguments.length?(r=typeof j=="function"?j:Zb(!!j),m):r},m.on=function(){var j=i.on.apply(i,arguments);return j===i?m:j},m.clickDistance=function(j){return arguments.length?(h=(j=+j)*j,m):Math.sqrt(h)},m}function f5(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function iG(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function i0(){}var Xg=.7,tw=1/Xg,Jf="\\s*([+-]?\\d+)\\s*",Kg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h3e=/^#([0-9a-f]{3,8})$/,p3e=new RegExp(`^rgb\\(${Jf},${Jf},${Jf}\\)$`),m3e=new RegExp(`^rgb\\(${_o},${_o},${_o}\\)$`),g3e=new RegExp(`^rgba\\(${Jf},${Jf},${Jf},${Kg}\\)$`),y3e=new RegExp(`^rgba\\(${_o},${_o},${_o},${Kg}\\)$`),b3e=new RegExp(`^hsl\\(${Kg},${_o},${_o}\\)$`),v3e=new RegExp(`^hsla\\(${Kg},${_o},${_o},${Kg}\\)$`),DP={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};f5(i0,Qg,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:PP,formatHex:PP,formatHex8:x3e,formatHsl:w3e,formatRgb:LP,toString:LP});function PP(){return this.rgb().formatHex()}function x3e(){return this.rgb().formatHex8()}function w3e(){return oG(this).formatHsl()}function LP(){return this.rgb().formatRgb()}function Qg(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=h3e.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?FP(t):n===3?new es(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ev(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ev(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=p3e.exec(e))?new es(t[1],t[2],t[3],1):(t=m3e.exec(e))?new es(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g3e.exec(e))?ev(t[1],t[2],t[3],t[4]):(t=y3e.exec(e))?ev(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=b3e.exec(e))?VP(t[1],t[2]/100,t[3]/100,1):(t=v3e.exec(e))?VP(t[1],t[2]/100,t[3]/100,t[4]):DP.hasOwnProperty(e)?FP(DP[e]):e==="transparent"?new es(NaN,NaN,NaN,0):null}function FP(e){return new es(e>>16&255,e>>8&255,e&255,1)}function ev(e,t,n,r){return r<=0&&(e=t=n=NaN),new es(e,t,n,r)}function S3e(e){return e instanceof i0||(e=Qg(e)),e?(e=e.rgb(),new es(e.r,e.g,e.b,e.opacity)):new es}function tj(e,t,n,r){return arguments.length===1?S3e(e):new es(e,t,n,r??1)}function es(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}f5(es,tj,iG(i0,{brighter(e){return e=e==null?tw:Math.pow(tw,e),new es(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xg:Math.pow(Xg,e),new es(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new es(Yu(this.r),Yu(this.g),Yu(this.b),nw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BP,formatHex:BP,formatHex8:E3e,formatRgb:zP,toString:zP}));function BP(){return`#${Ru(this.r)}${Ru(this.g)}${Ru(this.b)}`}function E3e(){return`#${Ru(this.r)}${Ru(this.g)}${Ru(this.b)}${Ru((isNaN(this.opacity)?1:this.opacity)*255)}`}function zP(){const e=nw(this.opacity);return`${e===1?"rgb(":"rgba("}${Yu(this.r)}, ${Yu(this.g)}, ${Yu(this.b)}${e===1?")":`, ${e})`}`}function nw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ru(e){return e=Yu(e),(e<16?"0":"")+e.toString(16)}function VP(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Di(e,t,n,r)}function oG(e){if(e instanceof Di)return new Di(e.h,e.s,e.l,e.opacity);if(e instanceof i0||(e=Qg(e)),!e)return new Di;if(e instanceof Di)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,a=i-s,c=(i+s)/2;return a?(t===i?o=(n-r)/a+(n<r)*6:n===i?o=(r-t)/a+2:o=(t-n)/a+4,a/=c<.5?i+s:2-i-s,o*=60):a=c>0&&c<1?0:o,new Di(o,a,c,e.opacity)}function N3e(e,t,n,r){return arguments.length===1?oG(e):new Di(e,t,n,r??1)}function Di(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}f5(Di,N3e,iG(i0,{brighter(e){return e=e==null?tw:Math.pow(tw,e),new Di(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xg:Math.pow(Xg,e),new Di(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new es(A_(e>=240?e-240:e+120,s,r),A_(e,s,r),A_(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Di(UP(this.h),tv(this.s),tv(this.l),nw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=nw(this.opacity);return`${e===1?"hsl(":"hsla("}${UP(this.h)}, ${tv(this.s)*100}%, ${tv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function UP(e){return e=(e||0)%360,e<0?e+360:e}function tv(e){return Math.max(0,Math.min(1,e||0))}function A_(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const aG=e=>()=>e;function _3e(e,t){return function(n){return e+n*t}}function C3e(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function O3e(e){return(e=+e)==1?lG:function(t,n){return n-t?C3e(t,n,e):aG(isNaN(t)?n:t)}}function lG(e,t){var n=t-e;return n?_3e(e,n):aG(isNaN(e)?t:e)}const qP=function e(t){var n=O3e(t);function r(s,i){var o=n((s=tj(s)).r,(i=tj(i)).r),a=n(s.g,i.g),c=n(s.b,i.b),u=lG(s.opacity,i.opacity);return function(f){return s.r=o(f),s.g=a(f),s.b=c(f),s.opacity=u(f),s+""}}return r.gamma=e,r}(1);function Ul(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var nj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$_=new RegExp(nj.source,"g");function j3e(e){return function(){return e}}function A3e(e){return function(t){return e(t)+""}}function $3e(e,t){var n=nj.lastIndex=$_.lastIndex=0,r,s,i,o=-1,a=[],c=[];for(e=e+"",t=t+"";(r=nj.exec(e))&&(s=$_.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),a[o]?a[o]+=i:a[++o]=i),(r=r[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,c.push({i:o,x:Ul(r,s)})),n=$_.lastIndex;return n<t.length&&(i=t.slice(n),a[o]?a[o]+=i:a[++o]=i),a.length<2?c[0]?A3e(c[0].x):j3e(t):(t=c.length,function(u){for(var f=0,h;f<t;++f)a[(h=c[f]).i]=h.x(u);return a.join("")})}var HP=180/Math.PI,rj={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cG(e,t,n,r,s,i){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*HP,skewX:Math.atan(c)*HP,scaleX:o,scaleY:a}}var nv;function T3e(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?rj:cG(t.a,t.b,t.c,t.d,t.e,t.f)}function R3e(e){return e==null||(nv||(nv=document.createElementNS("http://www.w3.org/2000/svg","g")),nv.setAttribute("transform",e),!(e=nv.transform.baseVal.consolidate()))?rj:(e=e.matrix,cG(e.a,e.b,e.c,e.d,e.e,e.f))}function uG(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,f,h,m,y,v){if(u!==h||f!==m){var x=y.push("translate(",null,t,null,n);v.push({i:x-4,x:Ul(u,h)},{i:x-2,x:Ul(f,m)})}else(h||m)&&y.push("translate("+h+t+m+n)}function o(u,f,h,m){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),m.push({i:h.push(s(h)+"rotate(",null,r)-2,x:Ul(u,f)})):f&&h.push(s(h)+"rotate("+f+r)}function a(u,f,h,m){u!==f?m.push({i:h.push(s(h)+"skewX(",null,r)-2,x:Ul(u,f)}):f&&h.push(s(h)+"skewX("+f+r)}function c(u,f,h,m,y,v){if(u!==h||f!==m){var x=y.push(s(y)+"scale(",null,",",null,")");v.push({i:x-4,x:Ul(u,h)},{i:x-2,x:Ul(f,m)})}else(h!==1||m!==1)&&y.push(s(y)+"scale("+h+","+m+")")}return function(u,f){var h=[],m=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,h,m),o(u.rotate,f.rotate,h,m),a(u.skewX,f.skewX,h,m),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,h,m),u=f=null,function(y){for(var v=-1,x=m.length,E;++v<x;)h[(E=m[v]).i]=E.x(y);return h.join("")}}}var M3e=uG(T3e,"px, ","px)","deg)"),k3e=uG(R3e,", ",")",")"),I3e=1e-12;function WP(e){return((e=Math.exp(e))+1/e)/2}function D3e(e){return((e=Math.exp(e))-1/e)/2}function P3e(e){return((e=Math.exp(2*e))-1)/(e+1)}const L3e=function e(t,n,r){function s(i,o){var a=i[0],c=i[1],u=i[2],f=o[0],h=o[1],m=o[2],y=f-a,v=h-c,x=y*y+v*v,E,N;if(x<I3e)N=Math.log(m/u)/t,E=function(R){return[a+R*y,c+R*v,u*Math.exp(t*R*N)]};else{var _=Math.sqrt(x),C=(m*m-u*u+r*x)/(2*u*n*_),j=(m*m-u*u-r*x)/(2*m*n*_),A=Math.log(Math.sqrt(C*C+1)-C),$=Math.log(Math.sqrt(j*j+1)-j);N=($-A)/t,E=function(R){var M=R*N,D=WP(A),P=u/(n*_)*(D*P3e(t*M+A)-D3e(A));return[a+P*y,c+P*v,u*D/WP(t*M+A)]}}return E.duration=N*1e3*t/Math.SQRT2,E}return s.rho=function(i){var o=Math.max(.001,+i),a=o*o,c=a*a;return e(o,a,c)},s}(Math.SQRT2,2,4);var Lh=0,Um=0,km=0,dG=1e3,rw,qm,sw=0,id=0,dS=0,Zg=typeof performance=="object"&&performance.now?performance:Date,fG=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function h5(){return id||(fG(F3e),id=Zg.now()+dS)}function F3e(){id=0}function iw(){this._call=this._time=this._next=null}iw.prototype=hG.prototype={constructor:iw,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?h5():+n)+(t==null?0:+t),!this._next&&qm!==this&&(qm?qm._next=this:rw=this,qm=this),this._call=e,this._time=n,sj()},stop:function(){this._call&&(this._call=null,this._time=1/0,sj())}};function hG(e,t,n){var r=new iw;return r.restart(e,t,n),r}function B3e(){h5(),++Lh;for(var e=rw,t;e;)(t=id-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Lh}function GP(){id=(sw=Zg.now())+dS,Lh=Um=0;try{B3e()}finally{Lh=0,V3e(),id=0}}function z3e(){var e=Zg.now(),t=e-sw;t>dG&&(dS-=t,sw=e)}function V3e(){for(var e,t=rw,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:rw=n);qm=e,sj(r)}function sj(e){if(!Lh){Um&&(Um=clearTimeout(Um));var t=e-id;t>24?(e<1/0&&(Um=setTimeout(GP,e-Zg.now()-dS)),km&&(km=clearInterval(km))):(km||(sw=Zg.now(),km=setInterval(z3e,dG)),Lh=1,fG(GP))}}function YP(e,t,n){var r=new iw;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var U3e=cS("start","end","cancel","interrupt"),q3e=[],pG=0,JP=1,ij=2,Dv=3,XP=4,oj=5,Pv=6;function fS(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;H3e(e,n,{name:t,index:r,group:s,on:U3e,tween:q3e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pG})}function p5(e,t){var n=to(e,t);if(n.state>pG)throw new Error("too late; already scheduled");return n}function Lo(e,t){var n=to(e,t);if(n.state>Dv)throw new Error("too late; already running");return n}function to(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function H3e(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=hG(i,0,n.time);function i(u){n.state=JP,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var f,h,m,y;if(n.state!==JP)return c();for(f in r)if(y=r[f],y.name===n.name){if(y.state===Dv)return YP(o);y.state===XP?(y.state=Pv,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[f]):+f<t&&(y.state=Pv,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[f])}if(YP(function(){n.state===Dv&&(n.state=XP,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=ij,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ij){for(n.state=Dv,s=new Array(m=n.tween.length),f=0,h=-1;f<m;++f)(y=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++h]=y);s.length=h+1}}function a(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=oj,1),h=-1,m=s.length;++h<m;)s[h].call(e,f);n.state===oj&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Pv,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Lv(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>ij&&r.state<oj,r.state=Pv,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function W3e(e){return this.each(function(){Lv(this,e)})}function G3e(e,t){var n,r;return function(){var s=Lo(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function Y3e(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Lo(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var a={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=a;break}c===u&&s.push(a)}i.tween=s}}function J3e(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=to(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?G3e:Y3e)(n,e,t))}function m5(e,t,n){var r=e._id;return e.each(function(){var s=Lo(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return to(s,r).value[t]}}function mG(e,t){var n;return(typeof t=="number"?Ul:t instanceof Qg?qP:(n=Qg(t))?(t=n,qP):$3e)(e,t)}function X3e(e){return function(){this.removeAttribute(e)}}function K3e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q3e(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function Z3e(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function eMe(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function tMe(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function nMe(e,t){var n=uS(e),r=n==="transform"?k3e:mG;return this.attrTween(e,typeof t=="function"?(n.local?tMe:eMe)(n,r,m5(this,"attr."+e,t)):t==null?(n.local?K3e:X3e)(n):(n.local?Z3e:Q3e)(n,r,t))}function rMe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function sMe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function iMe(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&sMe(e,i)),n}return s._value=t,s}function oMe(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&rMe(e,i)),n}return s._value=t,s}function aMe(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=uS(e);return this.tween(n,(r.local?iMe:oMe)(r,t))}function lMe(e,t){return function(){p5(this,e).delay=+t.apply(this,arguments)}}function cMe(e,t){return t=+t,function(){p5(this,e).delay=t}}function uMe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lMe:cMe)(t,e)):to(this.node(),t).delay}function dMe(e,t){return function(){Lo(this,e).duration=+t.apply(this,arguments)}}function fMe(e,t){return t=+t,function(){Lo(this,e).duration=t}}function hMe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dMe:fMe)(t,e)):to(this.node(),t).duration}function pMe(e,t){if(typeof t!="function")throw new Error;return function(){Lo(this,e).ease=t}}function mMe(e){var t=this._id;return arguments.length?this.each(pMe(t,e)):to(this.node(),t).ease}function gMe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Lo(this,e).ease=n}}function yMe(e){if(typeof e!="function")throw new Error;return this.each(gMe(this._id,e))}function bMe(e){typeof e!="function"&&(e=WW(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new za(r,this._parents,this._name,this._id)}function vMe(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],f=c.length,h=o[a]=new Array(f),m,y=0;y<f;++y)(m=c[y]||u[y])&&(h[y]=m);for(;a<r;++a)o[a]=t[a];return new za(o,this._parents,this._name,this._id)}function xMe(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function wMe(e,t,n){var r,s,i=xMe(t)?p5:Lo;return function(){var o=i(this,e),a=o.on;a!==r&&(s=(r=a).copy()).on(t,n),o.on=s}}function SMe(e,t){var n=this._id;return arguments.length<2?to(this.node(),n).on.on(e):this.each(wMe(n,e,t))}function EMe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function NMe(){return this.on("end.remove",EMe(this._id))}function _Me(e){var t=this._name,n=this._id;typeof e!="function"&&(e=u5(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var a=r[o],c=a.length,u=i[o]=new Array(c),f,h,m=0;m<c;++m)(f=a[m])&&(h=e.call(f,f.__data__,m,a))&&("__data__"in f&&(h.__data__=f.__data__),u[m]=h,fS(u[m],t,n,m,u,to(f,n)));return new za(i,this._parents,t,n)}function CMe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=HW(e));for(var r=this._groups,s=r.length,i=[],o=[],a=0;a<s;++a)for(var c=r[a],u=c.length,f,h=0;h<u;++h)if(f=c[h]){for(var m=e.call(f,f.__data__,h,c),y,v=to(f,n),x=0,E=m.length;x<E;++x)(y=m[x])&&fS(y,t,n,x,m,v);i.push(m),o.push(f)}return new za(i,o,t,n)}var OMe=s0.prototype.constructor;function jMe(){return new OMe(this._groups,this._parents)}function AMe(e,t){var n,r,s;return function(){var i=Ph(this,e),o=(this.style.removeProperty(e),Ph(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function gG(e){return function(){this.style.removeProperty(e)}}function $Me(e,t,n){var r,s=n+"",i;return function(){var o=Ph(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function TMe(e,t,n){var r,s,i;return function(){var o=Ph(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ph(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a))}}function RMe(e,t){var n,r,s,i="style."+t,o="end."+i,a;return function(){var c=Lo(this,e),u=c.on,f=c.value[i]==null?a||(a=gG(t)):void 0;(u!==n||s!==f)&&(r=(n=u).copy()).on(o,s=f),c.on=r}}function MMe(e,t,n){var r=(e+="")=="transform"?M3e:mG;return t==null?this.styleTween(e,AMe(e,r)).on("end.style."+e,gG(e)):typeof t=="function"?this.styleTween(e,TMe(e,r,m5(this,"style."+e,t))).each(RMe(this._id,e)):this.styleTween(e,$Me(e,r,t),n).on("end.style."+e,null)}function kMe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function IMe(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&kMe(e,o,n)),r}return i._value=t,i}function DMe(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,IMe(e,t,n??""))}function PMe(e){return function(){this.textContent=e}}function LMe(e){return function(){var t=e(this);this.textContent=t??""}}function FMe(e){return this.tween("text",typeof e=="function"?LMe(m5(this,"text",e)):PMe(e==null?"":e+""))}function BMe(e){return function(t){this.textContent=e.call(this,t)}}function zMe(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&BMe(s)),t}return r._value=e,r}function VMe(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zMe(e))}function UMe(){for(var e=this._name,t=this._id,n=yG(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,u=0;u<a;++u)if(c=o[u]){var f=to(c,t);fS(c,e,n,u,o,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new za(r,this._parents,e,n)}function qMe(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var a={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Lo(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),s===0&&i()})}var HMe=0;function za(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function yG(){return++HMe}var oa=s0.prototype;za.prototype={constructor:za,select:_Me,selectAll:CMe,selectChild:oa.selectChild,selectChildren:oa.selectChildren,filter:bMe,merge:vMe,selection:jMe,transition:UMe,call:oa.call,nodes:oa.nodes,node:oa.node,size:oa.size,empty:oa.empty,each:oa.each,on:SMe,attr:nMe,attrTween:aMe,style:MMe,styleTween:DMe,text:FMe,textTween:VMe,remove:NMe,tween:J3e,delay:uMe,duration:hMe,ease:mMe,easeVarying:yMe,end:qMe,[Symbol.iterator]:oa[Symbol.iterator]};function WMe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var GMe={time:null,delay:0,duration:250,ease:WMe};function YMe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function JMe(e){var t,n;e instanceof za?(t=e._id,e=e._name):(t=yG(),(n=GMe).time=h5(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,u=0;u<a;++u)(c=o[u])&&fS(c,e,t,u,o,n||YMe(c,t));return new za(r,this._parents,e,t)}s0.prototype.interrupt=W3e;s0.prototype.transition=JMe;const rv=e=>()=>e;function XMe(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Na(e,t,n){this.k=e,this.x=t,this.y=n}Na.prototype={constructor:Na,scale:function(e){return e===1?this:new Na(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Na(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var hS=new Na(1,0,0);bG.prototype=Na.prototype;function bG(e){for(;!e.__zoom;)if(!(e=e.parentNode))return hS;return e.__zoom}function T_(e){e.stopImmediatePropagation()}function Im(e){e.preventDefault(),e.stopImmediatePropagation()}function KMe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QMe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function KP(){return this.__zoom||hS}function ZMe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function e6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function t6e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function vG(){var e=KMe,t=QMe,n=t6e,r=ZMe,s=e6e,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=L3e,u=cS("start","zoom","end"),f,h,m,y=500,v=150,x=0,E=10;function N(I){I.property("__zoom",KP).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",F).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(I,B,T,L){var z=I.selection?I.selection():I;z.property("__zoom",KP),I!==z?A(I,B,T,L):z.interrupt().each(function(){$(this,arguments).event(L).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},N.scaleBy=function(I,B,T,L){N.scaleTo(I,function(){var z=this.__zoom.k,q=typeof B=="function"?B.apply(this,arguments):B;return z*q},T,L)},N.scaleTo=function(I,B,T,L){N.transform(I,function(){var z=t.apply(this,arguments),q=this.__zoom,k=T==null?j(z):typeof T=="function"?T.apply(this,arguments):T,W=q.invert(k),X=typeof B=="function"?B.apply(this,arguments):B;return n(C(_(q,X),k,W),z,o)},T,L)},N.translateBy=function(I,B,T,L){N.transform(I,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),o)},null,L)},N.translateTo=function(I,B,T,L,z){N.transform(I,function(){var q=t.apply(this,arguments),k=this.__zoom,W=L==null?j(q):typeof L=="function"?L.apply(this,arguments):L;return n(hS.translate(W[0],W[1]).scale(k.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof T=="function"?-T.apply(this,arguments):-T),q,o)},L,z)};function _(I,B){return B=Math.max(i[0],Math.min(i[1],B)),B===I.k?I:new Na(B,I.x,I.y)}function C(I,B,T){var L=B[0]-T[0]*I.k,z=B[1]-T[1]*I.k;return L===I.x&&z===I.y?I:new Na(I.k,L,z)}function j(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function A(I,B,T,L){I.on("start.zoom",function(){$(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(L).end()}).tween("zoom",function(){var z=this,q=arguments,k=$(z,q).event(L),W=t.apply(z,q),X=T==null?j(W):typeof T=="function"?T.apply(z,q):T,ne=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),re=z.__zoom,se=typeof B=="function"?B.apply(z,q):B,fe=c(re.invert(X).concat(ne/re.k),se.invert(X).concat(ne/se.k));return function(he){if(he===1)he=se;else{var ue=fe(he),ve=ne/ue[2];he=new Na(ve,X[0]-ue[0]*ve,X[1]-ue[1]*ve)}k.zoom(null,he)}})}function $(I,B,T){return!T&&I.__zooming||new R(I,B)}function R(I,B){this.that=I,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,B),this.taps=0}R.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,B){return this.mouse&&I!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var B=vs(this.that).datum();u.call(I,this.that,new XMe(I,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:u}),B)}};function M(I,...B){if(!e.apply(this,arguments))return;var T=$(this,B).event(I),L=this.__zoom,z=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),q=Mi(I);if(T.wheel)(T.mouse[0][0]!==q[0]||T.mouse[0][1]!==q[1])&&(T.mouse[1]=L.invert(T.mouse[0]=q)),clearTimeout(T.wheel);else{if(L.k===z)return;T.mouse=[q,L.invert(q)],Lv(this),T.start()}Im(I),T.wheel=setTimeout(k,v),T.zoom("mouse",n(C(_(L,z),T.mouse[0],T.mouse[1]),T.extent,o));function k(){T.wheel=null,T.end()}}function D(I,...B){if(m||!e.apply(this,arguments))return;var T=I.currentTarget,L=$(this,B,!0).event(I),z=vs(I.view).on("mousemove.zoom",X,!0).on("mouseup.zoom",ne,!0),q=Mi(I,T),k=I.clientX,W=I.clientY;nG(I.view),T_(I),L.mouse=[q,this.__zoom.invert(q)],Lv(this),L.start();function X(re){if(Im(re),!L.moved){var se=re.clientX-k,fe=re.clientY-W;L.moved=se*se+fe*fe>x}L.event(re).zoom("mouse",n(C(L.that.__zoom,L.mouse[0]=Mi(re,T),L.mouse[1]),L.extent,o))}function ne(re){z.on("mousemove.zoom mouseup.zoom",null),rG(re.view,L.moved),Im(re),L.event(re).end()}}function P(I,...B){if(e.apply(this,arguments)){var T=this.__zoom,L=Mi(I.changedTouches?I.changedTouches[0]:I,this),z=T.invert(L),q=T.k*(I.shiftKey?.5:2),k=n(C(_(T,q),L,z),t.apply(this,B),o);Im(I),a>0?vs(this).transition().duration(a).call(A,k,L,I):vs(this).call(N.transform,k,L,I)}}function F(I,...B){if(e.apply(this,arguments)){var T=I.touches,L=T.length,z=$(this,B,I.changedTouches.length===L).event(I),q,k,W,X;for(T_(I),k=0;k<L;++k)W=T[k],X=Mi(W,this),X=[X,this.__zoom.invert(X),W.identifier],z.touch0?!z.touch1&&z.touch0[2]!==X[2]&&(z.touch1=X,z.taps=0):(z.touch0=X,q=!0,z.taps=1+!!f);f&&(f=clearTimeout(f)),q&&(z.taps<2&&(h=X[0],f=setTimeout(function(){f=null},y)),Lv(this),z.start())}}function V(I,...B){if(this.__zooming){var T=$(this,B).event(I),L=I.changedTouches,z=L.length,q,k,W,X;for(Im(I),q=0;q<z;++q)k=L[q],W=Mi(k,this),T.touch0&&T.touch0[2]===k.identifier?T.touch0[0]=W:T.touch1&&T.touch1[2]===k.identifier&&(T.touch1[0]=W);if(k=T.that.__zoom,T.touch1){var ne=T.touch0[0],re=T.touch0[1],se=T.touch1[0],fe=T.touch1[1],he=(he=se[0]-ne[0])*he+(he=se[1]-ne[1])*he,ue=(ue=fe[0]-re[0])*ue+(ue=fe[1]-re[1])*ue;k=_(k,Math.sqrt(he/ue)),W=[(ne[0]+se[0])/2,(ne[1]+se[1])/2],X=[(re[0]+fe[0])/2,(re[1]+fe[1])/2]}else if(T.touch0)W=T.touch0[0],X=T.touch0[1];else return;T.zoom("touch",n(C(k,W,X),T.extent,o))}}function H(I,...B){if(this.__zooming){var T=$(this,B).event(I),L=I.changedTouches,z=L.length,q,k;for(T_(I),m&&clearTimeout(m),m=setTimeout(function(){m=null},y),q=0;q<z;++q)k=L[q],T.touch0&&T.touch0[2]===k.identifier?delete T.touch0:T.touch1&&T.touch1[2]===k.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(k=Mi(k,this),Math.hypot(h[0]-k[0],h[1]-k[1])<E)){var W=vs(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return N.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:rv(+I),N):r},N.filter=function(I){return arguments.length?(e=typeof I=="function"?I:rv(!!I),N):e},N.touchable=function(I){return arguments.length?(s=typeof I=="function"?I:rv(!!I),N):s},N.extent=function(I){return arguments.length?(t=typeof I=="function"?I:rv([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),N):t},N.scaleExtent=function(I){return arguments.length?(i[0]=+I[0],i[1]=+I[1],N):[i[0],i[1]]},N.translateExtent=function(I){return arguments.length?(o[0][0]=+I[0][0],o[1][0]=+I[1][0],o[0][1]=+I[0][1],o[1][1]=+I[1][1],N):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},N.constrain=function(I){return arguments.length?(n=I,N):n},N.duration=function(I){return arguments.length?(a=+I,N):a},N.interpolate=function(I){return arguments.length?(c=I,N):c},N.on=function(){var I=u.on.apply(u,arguments);return I===u?N:I},N.clickDistance=function(I){return arguments.length?(x=(I=+I)*I,N):Math.sqrt(x)},N.tapDistance=function(I){return arguments.length?(E=+I,N):E},N}const To={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ey=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xG=["Enter"," ","Escape"];var Fh;(function(e){e.Strict="strict",e.Loose="loose"})(Fh||(Fh={}));var Ju;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ju||(Ju={}));var ty;(function(e){e.Partial="partial",e.Full="full"})(ty||(ty={}));const wG={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Kl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Kl||(Kl={}));var od;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(od||(od={}));var rt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(rt||(rt={}));const QP={[rt.Left]:rt.Right,[rt.Right]:rt.Left,[rt.Top]:rt.Bottom,[rt.Bottom]:rt.Top};function SG(e){return e===null?null:e?"valid":"invalid"}const EG=e=>"id"in e&&"source"in e&&"target"in e,n6e=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),g5=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),o0=(e,t=[0,0])=>{const{width:n,height:r}=tl(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},r6e=(e,t={nodeOrigin:[0,0],nodeLookup:void 0})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):g5(s)?s:t.nodeLookup.get(s.id));const a=o?ow(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return pS(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mS(n)},a0=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const s=ow(r);n=pS(n,s)}}),mS(n)},NG=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const a={...l0(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:f,selectable:h=!0,hidden:m=!1}=u;if(o&&!h||m)continue;const y=f.width??u.width??u.initialWidth??null,v=f.height??u.height??u.initialHeight??null,x=ny(a,zh(u)),E=(y??0)*(v??0),N=i&&x>0;(!u.internals.handleBounds||N||x>=E||u.dragging)&&c.push(u)}return c},s6e=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function aj(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function lj({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!1);const a=a0(e),c=y5(a,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(c,{duration:o==null?void 0:o.duration}),Promise.resolve(!0)}function _G({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),a=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},f=o.origin??r;let h=s;if(o.extent==="parent"&&!o.expandParent)if(!a)i==null||i("005",To.error005());else{const y=a.measured.width,v=a.measured.height;y&&v&&(h=[[c,u],[c+y,u+v]])}else a&&Vh(o.extent)&&(h=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const m=Vh(h)?ad(t,h,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",To.error015())),{position:{x:m.x-c+(o.measured.width??0)*f[0],y:m.y-u+(o.measured.height??0)*f[1]},positionAbsolute:m}}async function i6e({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(m=>m.id)),o=[];for(const m of n){if(m.deletable===!1)continue;const y=i.has(m.id),v=!y&&m.parentId&&o.find(x=>x.id===m.parentId);(y||v)&&o.push(m)}const a=new Set(t.map(m=>m.id)),c=r.filter(m=>m.deletable!==!1),f=s6e(o,c);for(const m of c)a.has(m.id)&&!f.find(v=>v.id===m.id)&&f.push(m);if(!s)return{edges:f,nodes:o};const h=await s({nodes:o,edges:f});return typeof h=="boolean"?h?{edges:f,nodes:o}:{edges:[],nodes:[]}:h}const Bh=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ad=(e={x:0,y:0},t,n)=>({x:Bh(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Bh(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function CG(e,t,n){const{width:r,height:s}=tl(n),{x:i,y:o}=n.internals.positionAbsolute;return ad(e,[[i,o],[i+r,o+s]],t)}const ZP=(e,t,n)=>e<t?Bh(Math.abs(e-t),1,t)/t:e>n?-Bh(Math.abs(e-n),1,t)/t:0,OG=(e,t,n=15,r=40)=>{const s=ZP(e.x,r,t.width-r)*n,i=ZP(e.y,r,t.height-r)*n;return[s,i]},pS=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),cj=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),mS=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),zh=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=g5(e)?e.internals.positionAbsolute:o0(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},ow=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=g5(e)?e.internals.positionAbsolute:o0(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},jG=(e,t)=>mS(pS(cj(e),cj(t))),ny=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},e9=e=>zi(e.width)&&zi(e.height)&&zi(e.x)&&zi(e.y),zi=e=>!isNaN(e)&&isFinite(e),o6e=(e,t)=>{},gS=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),l0=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const a={x:(e-n)/s,y:(t-r)/s};return i?gS(a,o):a},AG=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),y5=(e,t,n,r,s,i)=>{const o=t/(e.width*(1+i)),a=n/(e.height*(1+i)),c=Math.min(o,a),u=Bh(c,r,s),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*u,y=n/2-h*u;return{x:m,y,zoom:u}},aw=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Vh(e){return e!==void 0&&e!=="parent"}function tl(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function $G(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function TG(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const a=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function t9(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function cg(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=$a(e),a=l0({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?gS(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const yS=e=>({width:e.offsetWidth,height:e.offsetHeight}),RG=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},a6e=["INPUT","SELECT","TEXTAREA"];function uj(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:a6e.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const MG=e=>"clientX"in e,$a=(e,t)=>{var i,o;const n=MG(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},n9=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...yS(o)}})};function kG({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:a}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,f=Math.abs(c-e),h=Math.abs(u-t);return[c,u,f,h]}function sv(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function r9({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case rt.Left:return[t-sv(t-r,i),n];case rt.Right:return[t+sv(r-t,i),n];case rt.Top:return[t,n-sv(n-s,i)];case rt.Bottom:return[t,n+sv(s-n,i)]}}function IG({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:s,targetPosition:i=rt.Top,curvature:o=.25}){const[a,c]=r9({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,f]=r9({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[h,m,y,v]=kG({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${c} ${u},${f} ${r},${s}`,h,m,y,v]}function DG({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,a=r<t?r+o:r-o;return[i,a,s,o]}function l6e({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1}){if(!s)return r;const i=n||t.selected||e.selected,o=Math.max(e.internals.z||0,t.internals.z||0,1e3);return r+(i?o:0)}function c6e({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=pS(ow(e),ow(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return ny(o,mS(i))>0}const u6e=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,d6e=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),PG=(e,t)=>{if(!e.source||!e.target)return t;let n;return EG(e)?n={...e}:n={...e,id:u6e(e)},d6e(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function LG({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,a]=DG({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,a]}const s9={[rt.Left]:{x:-1,y:0},[rt.Right]:{x:1,y:0},[rt.Top]:{x:0,y:-1},[rt.Bottom]:{x:0,y:1}},f6e=({source:e,sourcePosition:t=rt.Bottom,target:n})=>t===rt.Left||t===rt.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},i9=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function h6e({source:e,sourcePosition:t=rt.Bottom,target:n,targetPosition:r=rt.Top,center:s,offset:i}){const o=s9[t],a=s9[r],c={x:e.x+o.x*i,y:e.y+o.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},f=f6e({source:c,sourcePosition:t,target:u}),h=f.x!==0?"x":"y",m=f[h];let y=[],v,x;const E={x:0,y:0},N={x:0,y:0},[_,C,j,A]=DG({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*a[h]===-1){v=s.x??_,x=s.y??C;const R=[{x:v,y:c.y},{x:v,y:u.y}],M=[{x:c.x,y:x},{x:u.x,y:x}];o[h]===m?y=h==="x"?R:M:y=h==="x"?M:R}else{const R=[{x:c.x,y:u.y}],M=[{x:u.x,y:c.y}];if(h==="x"?y=o.x===m?M:R:y=o.y===m?R:M,t===r){const H=Math.abs(e[h]-n[h]);if(H<=i){const I=Math.min(i-1,i-H);o[h]===m?E[h]=(c[h]>e[h]?-1:1)*I:N[h]=(u[h]>n[h]?-1:1)*I}}if(t!==r){const H=h==="x"?"y":"x",I=o[h]===a[H],B=c[H]>u[H],T=c[H]<u[H];(o[h]===1&&(!I&&B||I&&T)||o[h]!==1&&(!I&&T||I&&B))&&(y=h==="x"?R:M)}const D={x:c.x+E.x,y:c.y+E.y},P={x:u.x+N.x,y:u.y+N.y},F=Math.max(Math.abs(D.x-y[0].x),Math.abs(P.x-y[0].x)),V=Math.max(Math.abs(D.y-y[0].y),Math.abs(P.y-y[0].y));F>=V?(v=(D.x+P.x)/2,x=y[0].y):(v=y[0].x,x=(D.y+P.y)/2)}return[[e,{x:c.x+E.x,y:c.y+E.y},...y,{x:u.x+N.x,y:u.y+N.y},n],v,x,j,A]}function p6e(e,t,n,r){const s=Math.min(i9(e,t)/2,i9(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*f}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*a},${o}`}function dj({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:s,targetPosition:i=rt.Top,borderRadius:o=5,centerX:a,centerY:c,offset:u=20}){const[f,h,m,y,v]=h6e({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:a,y:c},offset:u});return[f.reduce((E,N,_)=>{let C="";return _>0&&_<f.length-1?C=p6e(f[_-1],N,f[_+1],o):C=`${_===0?"M":"L"}${N.x} ${N.y}`,E+=C,E},""),h,m,y,v]}function o9(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function m6e(e){var h;const{sourceNode:t,targetNode:n}=e;if(!o9(t)||!o9(n))return null;const r=t.internals.handleBounds||a9(t.handles),s=n.internals.handleBounds||a9(n.handles),i=l9((r==null?void 0:r.source)??[],e.sourceHandle),o=l9(e.connectionMode===Fh.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(h=e.onError)==null||h.call(e,"008",To.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||rt.Bottom,c=(o==null?void 0:o.position)||rt.Top,u=ry(t,i,a),f=ry(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function a9(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function ry(e,t,n=rt.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:a}=t??tl(e);if(r)return{x:s+o/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case rt.Top:return{x:s+o/2,y:i};case rt.Right:return{x:s+o,y:i+a/2};case rt.Bottom:return{x:s+o/2,y:i+a};case rt.Left:return{x:s,y:i+a/2}}}function l9(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fj(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function g6e(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,a)=>([a.markerStart||r,a.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=fj(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const b5={nodeOrigin:[0,0],nodeExtent:ey,elevateNodesOnSelect:!0,defaults:{}},y6e={...b5,checkEquality:!0};function v5(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function b6e(e,t,n){const r=v5(b5,n);for(const s of e.values())if(s.parentId)x5(s,e,t,r);else{const i=o0(s,r.nodeOrigin),o=Vh(s.extent)?s.extent:r.nodeExtent,a=ad(i,o,tl(s));s.internals.positionAbsolute=a}}function hj(e,t,n,r){var a,c;const s=v5(y6e,r),i=new Map(t),o=s!=null&&s.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const u of e){let f=i.get(u.id);if(s.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const h=o0(u,s.nodeOrigin),m=Vh(u.extent)?u.extent:s.nodeExtent,y=ad(h,m,tl(u));f={...s.defaults,...u,measured:{width:(a=u.measured)==null?void 0:a.width,height:(c=u.measured)==null?void 0:c.height},internals:{positionAbsolute:y,handleBounds:u.measured?f==null?void 0:f.internals.handleBounds:void 0,z:FG(u,o),userNode:u}},t.set(u.id,f)}u.parentId&&x5(f,t,n,r)}}function v6e(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function x5(e,t,n,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:o}=v5(b5,r),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}v6e(e,n);const u=s?1e3:0,{x:f,y:h,z:m}=x6e(e,c,i,o,u),{positionAbsolute:y}=e.internals,v=f!==y.x||h!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:h}:y,z:m}})}function FG(e,t){return(zi(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function x6e(e,t,n,r,s){const{x:i,y:o}=t.internals.positionAbsolute,a=tl(e),c=o0(e,n),u=Vh(e.extent)?ad(c,e.extent,a):c;let f=ad({x:i+u.x,y:o+u.y},r,a);e.extent==="parent"&&(f=CG(f,a,t));const h=FG(e,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>h?m:h}}function w5(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((o=i.get(a.parentId))==null?void 0:o.expandedRect)??zh(c),f=jG(u,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var C;const f=c.internals.positionAbsolute,h=tl(c),m=c.origin??r,y=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,v=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(h.width,Math.round(a.width)),E=Math.max(h.height,Math.round(a.height)),N=(x-h.width)*m[0],_=(E-h.height)*m[1];(y>0||v>0||N||_)&&(s.push({id:u,type:"position",position:{x:c.position.x-y+N,y:c.position.y-v+_}}),(C=n.get(u))==null||C.forEach(j=>{e.some(A=>A.id===j.id)||s.push({id:j.id,type:"position",position:{x:j.position.x+y,y:j.position.y+v}})})),(h.width<a.width||h.height<a.height||y||v)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(y?m[0]*y-N:0),height:E+(v?m[1]*v-_:0)}})}),s}function w6e(e,t,n,r,s,i){const o=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!o)return{changes:[],updatedInternals:a};const c=[],u=window.getComputedStyle(o),{m22:f}=new window.DOMMatrixReadOnly(u.transform),h=[];for(const m of e.values()){const y=t.get(m.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),a=!0;continue}const v=yS(m.nodeElement),x=y.measured.width!==v.width||y.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!y.internals.handleBounds||m.force))){const N=m.nodeElement.getBoundingClientRect(),_=Vh(y.extent)?y.extent:i;let{positionAbsolute:C}=y.internals;y.parentId&&y.extent==="parent"?C=CG(C,v,t.get(y.parentId)):_&&(C=ad(C,_,v));const j={...y,measured:v,internals:{...y.internals,positionAbsolute:C,handleBounds:{source:n9("source",m.nodeElement,N,f,y.id),target:n9("target",m.nodeElement,N,f,y.id)}}};t.set(y.id,j),y.parentId&&x5(j,t,n,{nodeOrigin:s}),a=!0,x&&(c.push({id:y.id,type:"dimensions",dimensions:v}),y.expandParent&&y.parentId&&h.push({id:y.id,parentId:y.parentId,rect:zh(j,s)}))}}if(h.length>0){const m=w5(h,t,n,s);c.push(...m)}return{changes:c,updatedInternals:a}}async function S6e({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function c9(e,t,n,r,s,i){let o=s;const a=r.get(o)||new Map;r.set(o,a.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function BG(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:a=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:a},u=`${s}-${o}--${i}-${a}`,f=`${i}-${a}--${s}-${o}`;c9("source",c,f,e,s,o),c9("target",c,u,e,i,a),t.set(r.id,r)}}function zG(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:zG(n,t):!1}function u9(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function E6e(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!zG(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const a=e.get(i);a&&s.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function R_({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,a,c;const s=[];for(const[u,f]of t){const h=(o=n.get(u))==null?void 0:o.internals.userNode;h&&s.push({...h,position:f.position,dragging:r})}if(!e)return[s[0],s];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function N6e({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,a=new Map,c=!1,u={x:0,y:0},f=null,h=!1,m=null,y=!1;function v({noDragClassName:E,handleSelector:N,domNode:_,isSelectable:C,nodeId:j,nodeClickDistance:A=0}){m=vs(_);function $({x:P,y:F},V){const{nodeLookup:H,nodeExtent:I,snapGrid:B,snapToGrid:T,nodeOrigin:L,onNodeDrag:z,onSelectionDrag:q,onError:k,updateNodePositions:W}=t();i={x:P,y:F};let X=!1,ne={x:0,y:0,x2:0,y2:0};if(a.size>1&&I){const re=a0(a);ne=cj(re)}for(const[re,se]of a){if(!H.has(re))continue;let fe={x:P-se.distance.x,y:F-se.distance.y};T&&(fe=gS(fe,B));let he=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];if(a.size>1&&I&&!se.extent){const{positionAbsolute:Se}=se.internals,ke=Se.x-ne.x+I[0][0],Oe=Se.x+se.measured.width-ne.x2+I[1][0],Ce=Se.y-ne.y+I[0][1],Me=Se.y+se.measured.height-ne.y2+I[1][1];he=[[ke,Ce],[Oe,Me]]}const{position:ue,positionAbsolute:ve}=_G({nodeId:re,nextPosition:fe,nodeLookup:H,nodeExtent:he,nodeOrigin:L,onError:k});X=X||se.position.x!==ue.x||se.position.y!==ue.y,se.position=ue,se.internals.positionAbsolute=ve}if(X&&(W(a,!0),V&&(r||z||!j&&q))){const[re,se]=R_({nodeId:j,dragItems:a,nodeLookup:H});r==null||r(V,a,re,se),z==null||z(V,re,se),j||q==null||q(V,se)}}async function R(){if(!f)return;const{transform:P,panBy:F,autoPanSpeed:V,autoPanOnNodeDrag:H}=t();if(!H){c=!1,cancelAnimationFrame(o);return}const[I,B]=OG(u,f,V);(I!==0||B!==0)&&(i.x=(i.x??0)-I/P[2],i.y=(i.y??0)-B/P[2],await F({x:I,y:B})&&$(i,null)),o=requestAnimationFrame(R)}function M(P){var X;const{nodeLookup:F,multiSelectionActive:V,nodesDraggable:H,transform:I,snapGrid:B,snapToGrid:T,selectNodesOnDrag:L,onNodeDragStart:z,onSelectionDragStart:q,unselectNodesAndEdges:k}=t();h=!0,(!L||!C)&&!V&&j&&((X=F.get(j))!=null&&X.selected||k()),C&&L&&j&&(e==null||e(j));const W=cg(P.sourceEvent,{transform:I,snapGrid:B,snapToGrid:T,containerBounds:f});if(i=W,a=E6e(F,H,W,j),a.size>0&&(n||z||!j&&q)){const[ne,re]=R_({nodeId:j,dragItems:a,nodeLookup:F});n==null||n(P.sourceEvent,a,ne,re),z==null||z(P.sourceEvent,ne,re),j||q==null||q(P.sourceEvent,re)}}const D=sG().clickDistance(A).on("start",P=>{const{domNode:F,nodeDragThreshold:V,transform:H,snapGrid:I,snapToGrid:B}=t();f=(F==null?void 0:F.getBoundingClientRect())||null,y=!1,V===0&&M(P),i=cg(P.sourceEvent,{transform:H,snapGrid:I,snapToGrid:B,containerBounds:f}),u=$a(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:F,transform:V,snapGrid:H,snapToGrid:I,nodeDragThreshold:B,nodeLookup:T}=t(),L=cg(P.sourceEvent,{transform:V,snapGrid:H,snapToGrid:I,containerBounds:f});if((P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||j&&!T.has(j))&&(y=!0),!y){if(!c&&F&&h&&(c=!0,R()),!h){const z=L.xSnapped-(i.x??0),q=L.ySnapped-(i.y??0);Math.sqrt(z*z+q*q)>B&&M(P)}(i.x!==L.xSnapped||i.y!==L.ySnapped)&&a&&h&&(u=$a(P.sourceEvent,f),$(L,P.sourceEvent))}}).on("end",P=>{if(!(!h||y)&&(c=!1,h=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:F,updateNodePositions:V,onNodeDragStop:H,onSelectionDragStop:I}=t();if(V(a,!1),s||H||!j&&I){const[B,T]=R_({nodeId:j,dragItems:a,nodeLookup:F,dragging:!1});s==null||s(P.sourceEvent,a,B,T),H==null||H(P.sourceEvent,B,T),j||I==null||I(P.sourceEvent,T)}}}).filter(P=>{const F=P.target;return!P.button&&(!E||!u9(F,`.${E}`,_))&&(!N||u9(F,N,_))});m.call(D)}function x(){m==null||m.on(".drag",null)}return{update:v,destroy:x}}function _6e(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())ny(s,zh(i))>0&&r.push(i);return r}const C6e=250;function O6e(e,t,n,r){var a,c;let s=[],i=1/0;const o=_6e(e,n,t+C6e);for(const u of o){const f=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const h of f){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:m,y}=ry(u,h,h.position,!0),v=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(y-e.y,2));v>t||(v<i?(s=[{...h,x:m,y}],i=v):v===i&&s.push({...h,x:m,y}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(f=>f.type===u)??s[0]}return s[0]}function VG(e,t,n,r,s,i=!1){var u,f,h;const o=r.get(e);if(!o)return null;const a=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((f=o.internals.handleBounds)==null?void 0:f.source)??[],...((h=o.internals.handleBounds)==null?void 0:h.target)??[]],c=(n?a==null?void 0:a.find(m=>m.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...ry(o,c,c.position,!0)}:c}function UG(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function j6e(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qG=()=>!0;function A6e(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:h,panBy:m,cancelConnection:y,onConnectStart:v,onConnect:x,onConnectEnd:E,isValidConnection:N=qG,onReconnectEnd:_,updateConnection:C,getTransform:j,getFromHandle:A,autoPanSpeed:$}){const R=RG(e.target);let M=0,D;const{x:P,y:F}=$a(e),V=R==null?void 0:R.elementFromPoint(P,F),H=UG(i,V),I=a==null?void 0:a.getBoundingClientRect();if(!I||!H)return;const B=VG(s,H,r,c,t);if(!B)return;let T=$a(e,I),L=!1,z=null,q=!1,k=null;function W(){if(!f||!I)return;const[ve,Se]=OG(T,I,$);m({x:ve,y:Se}),M=requestAnimationFrame(W)}const X={...B,nodeId:s,type:H,position:B.position},ne=c.get(s),se={inProgress:!0,isValid:null,from:ry(ne,X,rt.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ne,to:T,toHandle:null,toPosition:QP[X.position],toNode:null};C(se);let fe=se;v==null||v(e,{nodeId:s,handleId:r,handleType:H});function he(ve){if(!A()||!X){ue(ve);return}const Se=j();T=$a(ve,I),D=O6e(l0(T,Se,!1,[1,1]),n,c,X),L||(W(),L=!0);const ke=HG(ve,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:N,doc:R,lib:u,flowId:h,nodeLookup:c});k=ke.handleDomNode,z=ke.connection,q=j6e(!!D,ke.isValid);const Oe={...fe,isValid:q,to:D&&q?AG({x:D.x,y:D.y},Se):T,toHandle:ke.toHandle,toPosition:q&&ke.toHandle?ke.toHandle.position:QP[X.position],toNode:ke.toHandle?c.get(ke.toHandle.nodeId):null};q&&D&&fe.toHandle&&Oe.toHandle&&fe.toHandle.type===Oe.toHandle.type&&fe.toHandle.nodeId===Oe.toHandle.nodeId&&fe.toHandle.id===Oe.toHandle.id&&fe.to.x===Oe.to.x&&fe.to.y===Oe.to.y||(C(Oe),fe=Oe)}function ue(ve){(D||k)&&z&&q&&(x==null||x(z));const{inProgress:Se,...ke}=fe,Oe={...ke,toPosition:fe.toHandle?fe.toPosition:null};E==null||E(ve,Oe),i&&(_==null||_(ve,Oe)),y(),cancelAnimationFrame(M),L=!1,q=!1,z=null,k=null,R.removeEventListener("mousemove",he),R.removeEventListener("mouseup",ue),R.removeEventListener("touchmove",he),R.removeEventListener("touchend",ue)}R.addEventListener("mousemove",he),R.addEventListener("mouseup",ue),R.addEventListener("touchmove",he),R.addEventListener("touchend",ue)}function HG(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:a,flowId:c,isValidConnection:u=qG,nodeLookup:f}){const h=i==="target",m=t?o.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:v}=$a(e),x=o.elementFromPoint(y,v),E=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:m,N={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const _=UG(void 0,E),C=E.getAttribute("data-nodeid"),j=E.getAttribute("data-handleid"),A=E.classList.contains("connectable"),$=E.classList.contains("connectableend");if(!C||!_)return N;const R={source:h?C:r,sourceHandle:h?j:s,target:h?r:C,targetHandle:h?s:j};N.connection=R;const D=A&&$&&(n===Fh.Strict?h&&_==="source"||!h&&_==="target":C!==r||j!==s);N.isValid=D&&u(R),N.toHandle=VG(C,_,j,f,n,!1)}return N}const pj={onPointerDown:A6e,isValid:HG};function $6e({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=vs(e);function i({translateExtent:a,width:c,height:u,zoomStep:f=10,pannable:h=!0,zoomable:m=!0,inversePan:y=!1}){const v=C=>{const j=n();if(C.sourceEvent.type!=="wheel"||!t)return;const A=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*f,$=j[2]*Math.pow(2,A);t.scaleTo($)};let x=[0,0];const E=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(x=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},N=C=>{const j=n();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!t)return;const A=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],$=[A[0]-x[0],A[1]-x[1]];x=A;const R=r()*Math.max(j[2],Math.log(j[2]))*(y?-1:1),M={x:j[0]-$[0]*R,y:j[1]-$[1]*R},D=[[0,0],[c,u]];t.setViewportConstrained({x:M.x,y:M.y,zoom:j[2]},D,a)},_=vG().on("start",E).on("zoom",h?N:null).on("zoom.wheel",m?v:null);s.call(_,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:Mi}}const T6e=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,bS=e=>({x:e.x,y:e.y,zoom:e.k}),M_=({x:e,y:t,zoom:n})=>hS.translate(e,t).scale(n),Pf=(e,t)=>e.target.closest(`.${t}`),WG=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),k_=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},GG=e=>{const t=e.ctrlKey&&aw()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function R6e({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(Pf(f,t))return!1;f.preventDefault(),f.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(f.ctrlKey&&o){const E=Mi(f),N=GG(f),_=h*Math.pow(2,N);r.scaleTo(n,_,E,f);return}const m=f.deltaMode===1?20:1;let y=s===Ju.Vertical?0:f.deltaX*m,v=s===Ju.Horizontal?0:f.deltaY*m;!aw()&&f.shiftKey&&s!==Ju.Vertical&&(y=f.deltaY*m,v=0),r.translateBy(n,-(y/h)*i,-(v/h)*i,{internal:!0});const x=bS(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(f,x)),e.isPanScrolling&&(c==null||c(f,x),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,x),e.isPanScrolling=!1},150))}}function M6e({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){if(!t&&r.type==="wheel"&&!r.ctrlKey||Pf(r,e))return null;r.preventDefault(),n.call(this,r,s)}}function k6e({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,a;if((i=r.sourceEvent)!=null&&i.internal)return;const s=bS(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function I6e({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,a;e.usedRightMouseButton=!!(n&&WG(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((a=i.sourceEvent)!=null&&a.internal)&&(s==null||s(i.sourceEvent,bS(i.transform)))}}function D6e({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&WG(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s&&T6e(e.prevViewport,o.transform))){const c=bS(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function P6e({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:a,noPanClassName:c,lib:u}){return f=>{var v;const h=e||t,m=n&&f.ctrlKey;if(f.button===1&&f.type==="mousedown"&&(Pf(f,`${u}-flow__node`)||Pf(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||Pf(f,a)&&f.type==="wheel"||Pf(f,c)&&(f.type!=="wheel"||s&&f.type==="wheel"&&!e)||!n&&f.ctrlKey&&f.type==="wheel")return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!m&&f.type==="wheel"||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||f.type==="wheel")&&y}}function L6e({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:s,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),m=vG().clickDistance(!zi(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(s),y=vs(e).call(m);C({x:i.x,y:i.y,zoom:Bh(i.zoom,t,n)},[[0,0],[h.width,h.height]],s);const v=y.on("wheel.zoom"),x=y.on("dblclick.zoom");m.wheelDelta(GG);function E(V,H){return y?new Promise(I=>{m==null||m.transform(k_(y,H==null?void 0:H.duration,()=>I(!0)),V)}):Promise.resolve(!1)}function N({noWheelClassName:V,noPanClassName:H,onPaneContextMenu:I,userSelectionActive:B,panOnScroll:T,panOnDrag:L,panOnScrollMode:z,panOnScrollSpeed:q,preventScrolling:k,zoomOnPinch:W,zoomOnScroll:X,zoomOnDoubleClick:ne,zoomActivationKeyPressed:re,lib:se,onTransformChange:fe}){B&&!f.isZoomingOrPanning&&_();const ue=T&&!re&&!B?R6e({zoomPanValues:f,noWheelClassName:V,d3Selection:y,d3Zoom:m,panOnScrollMode:z,panOnScrollSpeed:q,zoomOnPinch:W,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:c}):M6e({noWheelClassName:V,preventScrolling:k,d3ZoomHandler:v});if(y.on("wheel.zoom",ue,{passive:!1}),!B){const Se=k6e({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:a});m.on("start",Se);const ke=I6e({zoomPanValues:f,panOnDrag:L,onPaneContextMenu:!!I,onPanZoom:o,onTransformChange:fe});m.on("zoom",ke);const Oe=D6e({zoomPanValues:f,panOnDrag:L,panOnScroll:T,onPaneContextMenu:I,onPanZoomEnd:c,onDraggingChange:u});m.on("end",Oe)}const ve=P6e({zoomActivationKeyPressed:re,panOnDrag:L,zoomOnScroll:X,panOnScroll:T,zoomOnDoubleClick:ne,zoomOnPinch:W,userSelectionActive:B,noPanClassName:H,noWheelClassName:V,lib:se});m.filter(ve),ne?y.on("dblclick.zoom",x):y.on("dblclick.zoom",null)}function _(){m.on("zoom",null)}async function C(V,H,I){const B=M_(V),T=m==null?void 0:m.constrain()(B,H,I);return T&&await E(T),new Promise(L=>L(T))}async function j(V,H){const I=M_(V);return await E(I,H),new Promise(B=>B(I))}function A(V){if(y){const H=M_(V),I=y.property("__zoom");(I.k!==V.zoom||I.x!==V.x||I.y!==V.y)&&(m==null||m.transform(y,H,null,{sync:!0}))}}function $(){const V=y?bG(y.node()):{x:0,y:0,k:1};return{x:V.x,y:V.y,zoom:V.k}}function R(V,H){return y?new Promise(I=>{m==null||m.scaleTo(k_(y,H==null?void 0:H.duration,()=>I(!0)),V)}):Promise.resolve(!1)}function M(V,H){return y?new Promise(I=>{m==null||m.scaleBy(k_(y,H==null?void 0:H.duration,()=>I(!0)),V)}):Promise.resolve(!1)}function D(V){m==null||m.scaleExtent(V)}function P(V){m==null||m.translateExtent(V)}function F(V){const H=!zi(V)||V<0?0:V;m==null||m.clickDistance(H)}return{update:N,destroy:_,setViewport:j,setViewportConstrained:C,getViewport:$,scaleTo:R,scaleBy:M,setScaleExtent:D,setTranslateExtent:P,syncViewport:A,setClickDistance:F}}var ug;(function(e){e.Line="line",e.Handle="handle"})(ug||(ug={}));function F6e({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,a=n-r,c=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&s&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function B6e(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Dl(e,t){return Math.max(0,t-e)}function Pl(e,t){return Math.max(0,e-t)}function iv(e,t,n){return Math.max(0,t-e,e-n)}function d9(e,t){return e?!t:t}function z6e(e,t,n,r,s,i,o,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:f,isVertical:h}=t,m=f&&h,{xSnapped:y,ySnapped:v}=n,{minWidth:x,maxWidth:E,minHeight:N,maxHeight:_}=r,{x:C,y:j,width:A,height:$,aspectRatio:R}=e;let M=Math.floor(f?y-e.pointerX:0),D=Math.floor(h?v-e.pointerY:0);const P=A+(c?-M:M),F=$+(u?-D:D),V=-i[0]*A,H=-i[1]*$;let I=iv(P,x,E),B=iv(F,N,_);if(o){let z=0,q=0;c&&M<0?z=Dl(C+M+V,o[0][0]):!c&&M>0&&(z=Pl(C+P+V,o[1][0])),u&&D<0?q=Dl(j+D+H,o[0][1]):!u&&D>0&&(q=Pl(j+F+H,o[1][1])),I=Math.max(I,z),B=Math.max(B,q)}if(a){let z=0,q=0;c&&M>0?z=Pl(C+M,a[0][0]):!c&&M<0&&(z=Dl(C+P,a[1][0])),u&&D>0?q=Pl(j+D,a[0][1]):!u&&D<0&&(q=Dl(j+F,a[1][1])),I=Math.max(I,z),B=Math.max(B,q)}if(s){if(f){const z=iv(P/R,N,_)*R;if(I=Math.max(I,z),o){let q=0;!c&&!u||c&&!u&&m?q=Pl(j+H+P/R,o[1][1])*R:q=Dl(j+H+(c?M:-M)/R,o[0][1])*R,I=Math.max(I,q)}if(a){let q=0;!c&&!u||c&&!u&&m?q=Dl(j+P/R,a[1][1])*R:q=Pl(j+(c?M:-M)/R,a[0][1])*R,I=Math.max(I,q)}}if(h){const z=iv(F*R,x,E)/R;if(B=Math.max(B,z),o){let q=0;!c&&!u||u&&!c&&m?q=Pl(C+F*R+V,o[1][0])/R:q=Dl(C+(u?D:-D)*R+V,o[0][0])/R,B=Math.max(B,q)}if(a){let q=0;!c&&!u||u&&!c&&m?q=Dl(C+F*R,a[1][0])/R:q=Pl(C+(u?D:-D)*R,a[0][0])/R,B=Math.max(B,q)}}}D=D+(D<0?B:-B),M=M+(M<0?I:-I),s&&(m?P>F*R?D=(d9(c,u)?-M:M)/R:M=(d9(c,u)?-D:D)*R:f?(D=M/R,u=c):(M=D*R,c=u));const T=c?C+M:C,L=u?j+D:j;return{width:A+(c?-M:M),height:$+(u?-D:D),x:i[0]*M*(c?-1:1)+T,y:i[1]*D*(u?-1:1)+L}}const YG={width:0,height:0,x:0,y:0},V6e={...YG,pointerX:0,pointerY:0,aspectRatio:1};function U6e(e){return[[0,0],[e.measured.width,e.measured.height]]}function q6e(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,a=n[0]*i,c=n[1]*o;return[[r-a,s-c],[r+i-a,s+o-c]]}function H6e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=vs(e);function o({controlPosition:c,boundaries:u,keepAspectRatio:f,onResizeStart:h,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...YG},E={...V6e};const N=B6e(c);let _,C=null,j=[],A,$,R;const M=sG().on("start",D=>{const{nodeLookup:P,transform:F,snapGrid:V,snapToGrid:H,nodeOrigin:I,paneDomNode:B}=n();if(_=P.get(t),!_)return;C=(B==null?void 0:B.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:L}=cg(D.sourceEvent,{transform:F,snapGrid:V,snapToGrid:H,containerBounds:C});x={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},E={...x,pointerX:T,pointerY:L,aspectRatio:x.width/x.height},A=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(A=P.get(_.parentId),$=A&&_.extent==="parent"?U6e(A):void 0),j=[],R=void 0;for(const[z,q]of P)if(q.parentId===t&&(j.push({id:z,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const k=q6e(q,_,q.origin??I);R?R=[[Math.min(k[0][0],R[0][0]),Math.min(k[0][1],R[0][1])],[Math.max(k[1][0],R[1][0]),Math.max(k[1][1],R[1][1])]]:R=k}h==null||h(D,{...x})}).on("drag",D=>{const{transform:P,snapGrid:F,snapToGrid:V,nodeOrigin:H}=n(),I=cg(D.sourceEvent,{transform:P,snapGrid:F,snapToGrid:V,containerBounds:C}),B=[];if(!_)return;const{x:T,y:L,width:z,height:q}=x,k={},W=_.origin??H,{width:X,height:ne,x:re,y:se}=z6e(E,N,I,u,f,W,$,R),fe=X!==z,he=ne!==q,ue=re!==T&&fe,ve=se!==L&&he;if(!ue&&!ve&&!fe&&!he)return;if((ue||ve||W[0]===1||W[1]===1)&&(k.x=ue?re:x.x,k.y=ve?se:x.y,x.x=k.x,x.y=k.y,j.length>0)){const Ce=re-T,Me=se-L;for(const Ve of j)Ve.position={x:Ve.position.x-Ce+W[0]*(X-z),y:Ve.position.y-Me+W[1]*(ne-q)},B.push(Ve)}if((fe||he)&&(k.width=fe?X:x.width,k.height=he?ne:x.height,x.width=k.width,x.height=k.height),A&&_.expandParent){const Ce=W[0]*(k.width??0);k.x&&k.x<Ce&&(x.x=Ce,E.x=E.x-(k.x-Ce));const Me=W[1]*(k.height??0);k.y&&k.y<Me&&(x.y=Me,E.y=E.y-(k.y-Me))}const Se=F6e({width:x.width,prevWidth:z,height:x.height,prevHeight:q,affectsX:N.affectsX,affectsY:N.affectsY}),ke={...x,direction:Se};(v==null?void 0:v(D,ke))!==!1&&(m==null||m(D,ke),r(k,B))}).on("end",D=>{y==null||y(D,{...x}),s==null||s()});i.call(M)}function a(){i.on(".drag",null)}return{update:o,destroy:a}}const{useDebugValue:W6e}=Re,{useSyncExternalStoreWithSelector:G6e}=rU,Y6e=e=>e;function JG(e,t=Y6e,n){const r=G6e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return W6e(r),r}const f9=(e,t)=>{const n=X$(e),r=(s,i=t)=>JG(n,s,i);return Object.assign(r,n),r},J6e=(e,t)=>e?f9(e,t):f9;function vn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const vS=w.createContext(null),X6e=vS.Provider,XG=To.error001();function $t(e,t){const n=w.useContext(vS);if(n===null)throw new Error(XG);return JG(n,e,t)}function pn(){const e=w.useContext(vS);if(e===null)throw new Error(XG);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const h9={display:"none"},K6e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},KG="react-flow__node-desc",QG="react-flow__edge-desc",Q6e="react-flow__aria-live",Z6e=e=>e.ariaLiveMessage;function eke({rfId:e}){const t=$t(Z6e);return p.jsx("div",{id:`${Q6e}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:K6e,children:t})}function tke({rfId:e,disableKeyboardA11y:t}){return p.jsxs(p.Fragment,{children:[p.jsxs("div",{id:`${KG}-${e}`,style:h9,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),p.jsx("div",{id:`${QG}-${e}`,style:h9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&p.jsx(eke,{rfId:e})]})}const nke=e=>e.userSelectionActive?"none":"all",Uh=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=$t(nke),a=`${e}`.split("-");return p.jsx("div",{className:Fn(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},ref:i,...s,children:t})});Uh.displayName="Panel";function rke({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:p.jsx(Uh,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ske=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},ov=e=>e.id;function ike(e,t){return vn(e.selectedNodes.map(ov),t.selectedNodes.map(ov))&&vn(e.selectedEdges.map(ov),t.selectedEdges.map(ov))}function oke({onSelectionChange:e}){const t=pn(),{selectedNodes:n,selectedEdges:r}=$t(ske,ike);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const ake=e=>!!e.onSelectionChangeHandlers;function lke({onSelectionChange:e}){const t=$t(ake);return e||t?p.jsx(oke,{onSelectionChange:e}):null}const ZG=[0,0],cke={x:0,y:0,zoom:1},uke=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance"],p9=[...uke,"rfId"],dke=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),m9={translateExtent:ey,nodeOrigin:ZG,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function fke(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=$t(dke,vn),f=pn();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=m9,a()}),[]);const h=w.useRef(m9);return w.useEffect(()=>{for(const m of p9){const y=e[m],v=h.current[m];y!==v&&(typeof e[m]>"u"||(m==="nodes"?t(y):m==="edges"?n(y):m==="minZoom"?r(y):m==="maxZoom"?s(y):m==="translateExtent"?i(y):m==="nodeExtent"?o(y):m==="paneClickDistance"?u(y):m==="fitView"?f.setState({fitViewOnInit:y}):m==="fitViewOptions"?f.setState({fitViewOnInitOptions:y}):f.setState({[m]:y})))}h.current=e},p9.map(m=>e[m])),null}function g9(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function hke(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=g9(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=g9())!=null&&r.matches?"dark":"light"}const y9=typeof document<"u"?document:null;function sy(e=null,t={target:y9,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[o,a]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
`).replace(`

`,`
+`).split(`
`)),f=u.reduce((h,m)=>h.concat(...m),[]);return[u,f]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)||y9;if(e!==null){const u=m=>{if(s.current=m.ctrlKey||m.metaKey||m.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&uj(m))return!1;const v=v9(m.code,a);i.current.add(m[v]),b9(o,i.current,!1)&&(m.preventDefault(),r(!0))},f=m=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&uj(m))return!1;const v=v9(m.code,a);b9(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[v]),m.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function b9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function v9(e,t){return t.includes(e)?"code":"key"}const pke=()=>{const e=pn();return w.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>{const{nodeLookup:n,minZoom:r,maxZoom:s,panZoom:i,domNode:o}=e.getState();if(!i||!o)return Promise.resolve(!1);const a=aj(n,t),{width:c,height:u}=yS(o);return lj({nodes:a,width:c,height:u,minZoom:r,maxZoom:s,panZoom:i},t)},setCenter:async(t,n,r)=>{const{width:s,height:i,maxZoom:o,panZoom:a}=e.getState(),c=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:o,u=s/2-t*c,f=i/2-n*c;return a?(await a.setViewport({x:u,y:f,zoom:c},{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:a}=e.getState(),c=y5(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:a,y:c}=o.getBoundingClientRect(),u={x:t.x-a,y:t.y-c},f=n.snapGrid??s,h=n.snapToGrid??i;return l0(u,r,h,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=AG(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function eY(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const a={...i};for(const c of o)mke(c,a);n.push(a)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function mke(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(t.width=e.dimensions.width,t.height=e.dimensions.height)),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function tY(e,t){return eY(e,t)}function nY(e,t){return eY(e,t)}function Su(e,t){return{id:e,type:"select",selected:t}}function Lf(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(Su(i.id,o)))}return r}function x9({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),c=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function w9(e){return{id:e.id,type:"remove"}}const S9=e=>n6e(e),gke=e=>EG(e);function rY(e){return w.forwardRef(e)}const yke=typeof window<"u"?w.useLayoutEffect:w.useEffect;function E9(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>bke(()=>n(s=>s+BigInt(1))));return yke(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function bke(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const sY=w.createContext(null);function vke({children:e}){const t=pn(),n=w.useCallback(a=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:f,onNodesChange:h,nodeLookup:m}=t.getState();let y=c;for(const v of a)y=typeof v=="function"?v(y):v;f?u(y):h&&h(x9({items:y,lookup:m}))},[]),r=E9(n),s=w.useCallback(a=>{const{edges:c=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:h,edgeLookup:m}=t.getState();let y=c;for(const v of a)y=typeof v=="function"?v(y):v;f?u(y):h&&h(x9({items:y,lookup:m}))},[]),i=E9(s),o=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return p.jsx(sY.Provider,{value:o,children:e})}function xke(){const e=w.useContext(sY);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const wke=e=>!!e.panZoom;function bp(){const e=pke(),t=pn(),n=xke(),r=$t(wke),s=w.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),o=h=>{n.nodeQueue.push(h)},a=h=>{n.edgeQueue.push(h)},c=h=>{var N,_;const{nodeLookup:m,nodeOrigin:y}=t.getState(),v=S9(h)?h:m.get(h.id),x=v.parentId?TG(v.position,v.measured,v.parentId,m,y):v.position,E={...v,position:x,width:((N=v.measured)==null?void 0:N.width)??v.width,height:((_=v.measured)==null?void 0:_.height)??v.height};return zh(E)},u=(h,m,y={replace:!1})=>{o(v=>v.map(x=>{if(x.id===h){const E=typeof m=="function"?m(x):m;return y.replace&&S9(E)?E:{...x,...E}}return x}))},f=(h,m,y={replace:!1})=>{a(v=>v.map(x=>{if(x.id===h){const E=typeof m=="function"?m(x):m;return y.replace&&gke(E)?E:{...x,...E}}return x}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>{var m;return(m=i(h))==null?void 0:m.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(m=>({...m}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:o,setEdges:a,addNodes:h=>{const m=Array.isArray(h)?h:[h];n.nodeQueue.push(y=>[...y,...m])},addEdges:h=>{const m=Array.isArray(h)?h:[h];n.edgeQueue.push(y=>[...y,...m])},toObject:()=>{const{nodes:h=[],edges:m=[],transform:y}=t.getState(),[v,x,E]=y;return{nodes:h.map(N=>({...N})),edges:m.map(N=>({...N})),viewport:{x:v,y:x,zoom:E}}},deleteElements:async({nodes:h=[],edges:m=[]})=>{const{nodes:y,edges:v,onNodesDelete:x,onEdgesDelete:E,triggerNodeChanges:N,triggerEdgeChanges:_,onDelete:C,onBeforeDelete:j}=t.getState(),{nodes:A,edges:$}=await i6e({nodesToRemove:h,edgesToRemove:m,nodes:y,edges:v,onBeforeDelete:j}),R=$.length>0,M=A.length>0;if(R){const D=$.map(w9);E==null||E($),_(D)}if(M){const D=A.map(w9);x==null||x(A),N(D)}return(M||R)&&(C==null||C({nodes:A,edges:$})),{deletedNodes:A,deletedEdges:$}},getIntersectingNodes:(h,m=!0,y)=>{const v=e9(h),x=v?h:c(h),E=y!==void 0;return x?(y||t.getState().nodes).filter(N=>{const _=t.getState().nodeLookup.get(N.id);if(_&&!v&&(N.id===h.id||!_.internals.positionAbsolute))return!1;const C=zh(E?N:_),j=ny(C,x);return m&&j>0||j>=x.width*x.height}):[]},isNodeIntersecting:(h,m,y=!0)=>{const x=e9(h)?h:c(h);if(!x)return!1;const E=ny(x,m);return y&&E>0||E>=x.width*x.height},updateNode:u,updateNodeData:(h,m,y={replace:!1})=>{u(h,v=>{const x=typeof m=="function"?m(v):m;return y.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},y)},updateEdge:f,updateEdgeData:(h,m,y={replace:!1})=>{f(h,v=>{const x=typeof m=="function"?m(v):m;return y.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},y)},getNodesBounds:h=>{const{nodeLookup:m,nodeOrigin:y}=t.getState();return r6e(h,{nodeLookup:m,nodeOrigin:y})},getHandleConnections:({type:h,id:m,nodeId:y})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${y}-${h}${m?`-${m}`:""}`))==null?void 0:v.values())??[])},getNodeConnections:({type:h,handleId:m,nodeId:y})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${y}${h?m?`-${h}-${m}`:`-${h}`:""}`))==null?void 0:v.values())??[])}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const N9=e=>e.selected,Ske={actInsideInputWithModifier:!1},Eke=typeof window<"u"?window:void 0;function Nke({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=pn(),{deleteElements:r}=bp(),s=sy(e,Ske),i=sy(t,{target:Eke});w.useEffect(()=>{if(s){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(N9),edges:o.filter(N9)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function _ke(e){const t=pn();w.useEffect(()=>{const n=()=>{var s,i;if(!e.current)return!1;const r=yS(e.current);(r.height===0||r.width===0)&&((i=(s=t.getState()).onError)==null||i.call(s,"004",To.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const xS={position:"absolute",width:"100%",height:"100%",top:0,left:0},Cke=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function Oke({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ju.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:u,minZoom:f,maxZoom:h,zoomActivationKeyCode:m,preventScrolling:y=!0,children:v,noWheelClassName:x,noPanClassName:E,onViewportChange:N,isControlledViewport:_,paneClickDistance:C}){const j=pn(),A=w.useRef(null),{userSelectionActive:$,lib:R}=$t(Cke,vn),M=sy(m),D=w.useRef();_ke(A);const P=w.useCallback(F=>{N==null||N({x:F[0],y:F[1],zoom:F[2]}),_||j.setState({transform:F})},[N,_]);return w.useEffect(()=>{if(A.current){D.current=L6e({domNode:A.current,minZoom:f,maxZoom:h,translateExtent:u,viewport:c,paneClickDistance:C,onDraggingChange:I=>j.setState({paneDragging:I}),onPanZoomStart:(I,B)=>{const{onViewportChangeStart:T,onMoveStart:L}=j.getState();L==null||L(I,B),T==null||T(B)},onPanZoom:(I,B)=>{const{onViewportChange:T,onMove:L}=j.getState();L==null||L(I,B),T==null||T(B)},onPanZoomEnd:(I,B)=>{const{onViewportChangeEnd:T,onMoveEnd:L}=j.getState();L==null||L(I,B),T==null||T(B)}});const{x:F,y:V,zoom:H}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[F,V,H],domNode:A.current.closest(".react-flow")}),()=>{var I;(I=D.current)==null||I.destroy()}}},[]),w.useEffect(()=>{var F;(F=D.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:M,preventScrolling:y,noPanClassName:E,userSelectionActive:$,noWheelClassName:x,lib:R,onTransformChange:P})},[e,t,n,r,s,i,o,a,M,y,E,$,x,R,P]),p.jsx("div",{className:"react-flow__renderer",ref:A,style:xS,children:v})}const jke=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ake(){const{userSelectionActive:e,userSelectionRect:t}=$t(jke,vn);return e&&t?p.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const I_=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},$ke=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging});function Tke({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ty.Full,panOnDrag:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:o,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:m,children:y}){const v=pn(),{userSelectionActive:x,elementsSelectable:E,dragging:N}=$t($ke,vn),_=E&&(e||x),C=w.useRef(null),j=w.useRef(),A=w.useRef(new Set),$=w.useRef(new Set),R=w.useRef(!1),M=w.useRef(!1),D=T=>{if(R.current){R.current=!1;return}a==null||a(T),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},P=T=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){T.preventDefault();return}c==null||c(T)},F=u?T=>u(T):void 0,V=T=>{var W,X;const{resetSelectedElements:L,domNode:z}=v.getState();if(j.current=z==null?void 0:z.getBoundingClientRect(),!E||!e||T.button!==0||T.target!==C.current||!j.current)return;(X=(W=T.target)==null?void 0:W.setPointerCapture)==null||X.call(W,T.pointerId),M.current=!0,R.current=!1;const{x:q,y:k}=$a(T.nativeEvent,j.current);L(),v.setState({userSelectionRect:{width:0,height:0,startX:q,startY:k,x:q,y:k}}),i==null||i(T)},H=T=>{const{userSelectionRect:L,transform:z,nodeLookup:q,edgeLookup:k,connectionLookup:W,triggerNodeChanges:X,triggerEdgeChanges:ne,defaultEdgeOptions:re}=v.getState();if(!j.current||!L)return;R.current=!0;const{x:se,y:fe}=$a(T.nativeEvent,j.current),{startX:he,startY:ue}=L,ve={startX:he,startY:ue,x:se<he?se:he,y:fe<ue?fe:ue,width:Math.abs(se-he),height:Math.abs(fe-ue)},Se=A.current,ke=$.current;A.current=new Set(NG(q,ve,z,n===ty.Partial,!0).map(Ce=>Ce.id)),$.current=new Set;const Oe=(re==null?void 0:re.selectable)??!0;for(const Ce of A.current){const Me=W.get(Ce);if(Me)for(const{edgeId:Ve}of Me.values()){const We=k.get(Ve);We&&(We.selectable??Oe)&&$.current.add(Ve)}}if(!t9(Se,A.current)){const Ce=Lf(q,A.current,!0);X(Ce)}if(!t9(ke,$.current)){const Ce=Lf(k,$.current);ne(Ce)}v.setState({userSelectionRect:ve,userSelectionActive:!0,nodesSelectionActive:!1})},I=T=>{var z,q;if(T.button!==0||!M.current)return;(q=(z=T.target)==null?void 0:z.releasePointerCapture)==null||q.call(z,T.pointerId);const{userSelectionRect:L}=v.getState();!x&&L&&T.target===C.current&&(D==null||D(T)),v.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:A.current.size>0}),o==null||o(T),(t||s)&&(R.current=!1),M.current=!1},B=r===!0||Array.isArray(r)&&r.includes(0);return p.jsxs("div",{className:Fn(["react-flow__pane",{draggable:B,dragging:N,selection:e}]),onClick:_?void 0:I_(D,C),onContextMenu:I_(P,C),onWheel:I_(F,C),onPointerEnter:_?void 0:f,onPointerDown:_?V:h,onPointerMove:_?H:h,onPointerUp:_?I:void 0,onPointerLeave:m,ref:C,style:xS,children:[y,p.jsx(Ake,{})]})}function mj({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:a,onError:c}=t.getState(),u=a.get(e);if(!u){c==null||c("012",To.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function iY({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const a=pn(),[c,u]=w.useState(!1),f=w.useRef();return w.useEffect(()=>{f.current=N6e({getStoreItems:()=>a.getState(),onNodeMouseDown:h=>{mj({id:h,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{var h,m;if(t)(h=f.current)==null||h.destroy();else if(e.current)return(m=f.current)==null||m.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var y;(y=f.current)==null||y.destroy()}},[n,r,t,i,e,s]),c}const Rke=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function oY(){const e=pn();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:a,updateNodePositions:c,nodeLookup:u,nodeOrigin:f}=e.getState(),h=new Map,m=Rke(o),y=s?i[0]:5,v=s?i[1]:5,x=n.direction.x*y*n.factor,E=n.direction.y*v*n.factor;for(const[,N]of u){if(!m(N))continue;let _={x:N.internals.positionAbsolute.x+x,y:N.internals.positionAbsolute.y+E};s&&(_=gS(_,i));const{position:C,positionAbsolute:j}=_G({nodeId:N.id,nextPosition:_,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:a});N.position=C,N.internals.positionAbsolute=j,h.set(N.id,N)}c(h)},[])}const S5=w.createContext(null),Mke=S5.Provider;S5.Consumer;const aY=()=>w.useContext(S5),kke=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ike=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:a,toHandle:c,isValid:u}=o,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Fh.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:f&&u}};function Dke({type:e="source",position:t=rt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:a,children:c,className:u,onMouseDown:f,onTouchStart:h,...m},y){var B,T;const v=o||null,x=e==="target",E=pn(),N=aY(),{connectOnClick:_,noPanClassName:C,rfId:j}=$t(kke,vn),{connectingFrom:A,connectingTo:$,clickConnecting:R,isPossibleEndHandle:M,connectionInProcess:D,clickConnectionInProcess:P,valid:F}=$t(Ike(N,v,e),vn);N||(T=(B=E.getState()).onError)==null||T.call(B,"010",To.error010());const V=L=>{const{defaultEdgeOptions:z,onConnect:q,hasDefaultEdges:k}=E.getState(),W={...z,...L};if(k){const{edges:X,setEdges:ne}=E.getState();ne(PG(W,X))}q==null||q(W),a==null||a(W)},H=L=>{if(!N)return;const z=MG(L.nativeEvent);if(s&&(z&&L.button===0||!z)){const q=E.getState();pj.onPointerDown(L.nativeEvent,{autoPanOnConnect:q.autoPanOnConnect,connectionMode:q.connectionMode,connectionRadius:q.connectionRadius,domNode:q.domNode,nodeLookup:q.nodeLookup,lib:q.lib,isTarget:x,handleId:v,nodeId:N,flowId:q.rfId,panBy:q.panBy,cancelConnection:q.cancelConnection,onConnectStart:q.onConnectStart,onConnectEnd:q.onConnectEnd,updateConnection:q.updateConnection,onConnect:V,isValidConnection:n||q.isValidConnection,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:q.autoPanSpeed})}z?f==null||f(L):h==null||h(L)},I=L=>{const{onClickConnectStart:z,onClickConnectEnd:q,connectionClickStartHandle:k,connectionMode:W,isValidConnection:X,lib:ne,rfId:re,nodeLookup:se,connection:fe}=E.getState();if(!N||!k&&!s)return;if(!k){z==null||z(L.nativeEvent,{nodeId:N,handleId:v,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:N,type:e,id:v}});return}const he=RG(L.target),ue=n||X,{connection:ve,isValid:Se}=pj.isValid(L.nativeEvent,{handle:{nodeId:N,id:v,type:e},connectionMode:W,fromNodeId:k.nodeId,fromHandleId:k.id||null,fromType:k.type,isValidConnection:ue,flowId:re,doc:he,lib:ne,nodeLookup:se});Se&&ve&&V(ve);const ke=structuredClone(fe);delete ke.inProgress,ke.toPosition=ke.toHandle?ke.toHandle.position:null,q==null||q(L,ke),E.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":v,"data-nodeid":N,"data-handlepos":t,"data-id":`${j}-${N}-${v}-${e}`,className:Fn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,clickconnecting:R,connectingfrom:A,connectingto:$,valid:F,connectionindicator:r&&(!D||M)&&(D||P?i:s)}]),onMouseDown:H,onTouchStart:H,onClick:_?I:void 0,ref:y,...m,children:c})}const iy=w.memo(rY(Dke));function Pke({data:e,isConnectable:t,sourcePosition:n=rt.Bottom}){return p.jsxs(p.Fragment,{children:[e==null?void 0:e.label,p.jsx(iy,{type:"source",position:n,isConnectable:t})]})}function Lke({data:e,isConnectable:t,targetPosition:n=rt.Top,sourcePosition:r=rt.Bottom}){return p.jsxs(p.Fragment,{children:[p.jsx(iy,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,p.jsx(iy,{type:"source",position:r,isConnectable:t})]})}function Fke(){return null}function Bke({data:e,isConnectable:t,targetPosition:n=rt.Top}){return p.jsxs(p.Fragment,{children:[p.jsx(iy,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const lw={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},_9={input:Pke,default:Lke,output:Bke,group:Fke};function zke(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Vke=e=>{const{width:t,height:n,x:r,y:s}=a0(e.nodeLookup,{filter:i=>!!i.selected});return{width:zi(t)?t:null,height:zi(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function Uke({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=pn(),{width:s,height:i,transformString:o,userSelectionActive:a}=$t(Vke,vn),c=oY(),u=w.useRef(null);if(w.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]),iY({nodeRef:u}),a||!s||!i)return null;const f=e?m=>{const y=r.getState().nodes.filter(v=>v.selected);e(m,y)}:void 0,h=m=>{Object.prototype.hasOwnProperty.call(lw,m.key)&&(m.preventDefault(),c({direction:lw[m.key],factor:m.shiftKey?4:1}))};return p.jsx("div",{className:Fn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:p.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const C9=typeof window<"u"?window:void 0,qke=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function lY({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:f,selectionMode:h,onSelectionStart:m,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:x,zoomActivationKeyCode:E,elementsSelectable:N,zoomOnScroll:_,zoomOnPinch:C,panOnScroll:j,panOnScrollSpeed:A,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:M,defaultViewport:D,translateExtent:P,minZoom:F,maxZoom:V,preventScrolling:H,onSelectionContextMenu:I,noWheelClassName:B,noPanClassName:T,disableKeyboardA11y:L,onViewportChange:z,isControlledViewport:q}){const{nodesSelectionActive:k,userSelectionActive:W}=$t(qke),X=sy(u,{target:C9}),ne=sy(x,{target:C9}),re=ne||M,se=ne||j,fe=f&&re!==!0,he=X||W||fe;return Nke({deleteKeyCode:c,multiSelectionKeyCode:v}),p.jsx(Oke,{onPaneContextMenu:i,elementsSelectable:N,zoomOnScroll:_,zoomOnPinch:C,panOnScroll:se,panOnScrollSpeed:A,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:!X&&re,defaultViewport:D,translateExtent:P,minZoom:F,maxZoom:V,zoomActivationKeyCode:E,preventScrolling:H,noWheelClassName:B,noPanClassName:T,onViewportChange:z,isControlledViewport:q,paneClickDistance:a,children:p.jsxs(Tke,{onSelectionStart:m,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:re,isSelecting:!!he,selectionMode:h,selectionKeyPressed:X,selectionOnDrag:fe,children:[e,k&&p.jsx(Uke,{onSelectionContextMenu:I,noPanClassName:T,disableKeyboardA11y:L})]})})}lY.displayName="FlowRenderer";const Hke=w.memo(lY),Wke=e=>t=>e?NG(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Gke(e){return $t(w.useCallback(Wke(e),[e]),vn)}const Yke=e=>e.updateNodeInternals;function Jke(){const e=$t(Yke),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Xke({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=pn(),i=w.useRef(null),o=w.useRef(null),a=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),f=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!f||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[f,e.hidden]),w.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),w.useEffect(()=>{if(i.current){const h=u.current!==t,m=a.current!==e.sourcePosition,y=c.current!==e.targetPosition;(h||m||y)&&(u.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Kke({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:a,elementsSelectable:c,nodesConnectable:u,nodesFocusable:f,resizeObserver:h,noDragClassName:m,noPanClassName:y,disableKeyboardA11y:v,rfId:x,nodeTypes:E,nodeClickDistance:N,onError:_}){const{node:C,internals:j,isParent:A}=$t(he=>{const ue=he.nodeLookup.get(e),ve=he.parentLookup.has(e);return{node:ue,internals:ue.internals,isParent:ve}},vn);let $=C.type||"default",R=(E==null?void 0:E[$])||_9[$];R===void 0&&(_==null||_("003",To.error003($)),$="default",R=_9.default);const M=!!(C.draggable||a&&typeof C.draggable>"u"),D=!!(C.selectable||c&&typeof C.selectable>"u"),P=!!(C.connectable||u&&typeof C.connectable>"u"),F=!!(C.focusable||f&&typeof C.focusable>"u"),V=pn(),H=$G(C),I=Xke({node:C,nodeType:$,hasDimensions:H,resizeObserver:h}),B=iY({nodeRef:I,disabled:C.hidden||!M,noDragClassName:m,handleSelector:C.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:N}),T=oY();if(C.hidden)return null;const L=tl(C),z=zke(C),q=D||M||t||n||r||s,k=n?he=>n(he,{...j.userNode}):void 0,W=r?he=>r(he,{...j.userNode}):void 0,X=s?he=>s(he,{...j.userNode}):void 0,ne=i?he=>i(he,{...j.userNode}):void 0,re=o?he=>o(he,{...j.userNode}):void 0,se=he=>{const{selectNodesOnDrag:ue,nodeDragThreshold:ve}=V.getState();D&&(!ue||!M||ve>0)&&mj({id:e,store:V,nodeRef:I}),t&&t(he,{...j.userNode})},fe=he=>{if(!(uj(he.nativeEvent)||v))if(xG.includes(he.key)&&D){const ue=he.key==="Escape";mj({id:e,store:V,unselect:ue,nodeRef:I})}else M&&C.selected&&Object.prototype.hasOwnProperty.call(lw,he.key)&&(he.preventDefault(),V.setState({ariaLiveMessage:`Moved selected node ${he.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~j.positionAbsolute.x}, y: ${~~j.positionAbsolute.y}`}),T({direction:lw[he.key],factor:he.shiftKey?4:1}))};return p.jsx("div",{className:Fn(["react-flow__node",`react-flow__node-${$}`,{[y]:M},C.className,{selected:C.selected,selectable:D,parent:A,draggable:M,dragging:B}]),ref:I,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:q?"all":"none",visibility:H?"visible":"hidden",...C.style,...z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:k,onMouseMove:W,onMouseLeave:X,onContextMenu:ne,onClick:se,onDoubleClick:re,onKeyDown:F?fe:void 0,tabIndex:F?0:void 0,role:F?"button":void 0,"aria-describedby":v?void 0:`${KG}-${x}`,"aria-label":C.ariaLabel,children:p.jsx(Mke,{value:e,children:p.jsx(R,{id:e,data:C.data,type:$,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:C.selected??!1,selectable:D,draggable:M,deletable:C.deletable??!0,isConnectable:P,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:B,dragHandle:C.dragHandle,zIndex:j.z,parentId:C.parentId,...L})})})}const Qke=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function cY(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=$t(Qke,vn),o=Gke(e.onlyRenderVisibleElements),a=Jke();return p.jsx("div",{className:"react-flow__nodes",style:xS,children:o.map(c=>p.jsx(Kke,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}cY.displayName="NodeRenderer";const Zke=w.memo(cY);function eIe(e){return $t(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&c6e({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),vn)}const tIe=({color:e="none",strokeWidth:t=1})=>p.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),nIe=({color:e="none",strokeWidth:t=1})=>p.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),O9={[od.Arrow]:tIe,[od.ArrowClosed]:nIe};function rIe(e){const t=pn();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(O9,e)?O9[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",To.error009(e)),null)},[e])}const sIe=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const c=rIe(t);return c?p.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:p.jsx(c,{color:n,strokeWidth:o})}):null},uY=({defaultColor:e,rfId:t})=>{const n=$t(i=>i.edges),r=$t(i=>i.defaultEdgeOptions),s=w.useMemo(()=>g6e(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?p.jsx("svg",{className:"react-flow__marker",children:p.jsx("defs",{children:s.map(i=>p.jsx(sIe,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};uY.displayName="MarkerDefinitions";var iIe=w.memo(uY);function dY({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:c,className:u,...f}){const[h,m]=w.useState({x:1,y:0,width:0,height:0}),y=Fn(["react-flow__edge-textwrapper",u]),v=w.useRef(null);return w.useEffect(()=>{if(v.current){const x=v.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:p.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:y,visibility:h.width?"visible":"hidden",...f,children:[s&&p.jsx("rect",{width:h.width+2*o[0],x:-o[0],y:-o[1],height:h.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),p.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:v,style:r,children:n}),c]})}dY.displayName="EdgeText";const oIe=w.memo(dY);function wS({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:u=20,...f}){return p.jsxs(p.Fragment,{children:[p.jsx("path",{...f,d:e,fill:"none",className:Fn(["react-flow__edge-path",f.className])}),u&&p.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}),r&&zi(t)&&zi(n)?p.jsx(oIe,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function j9({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===rt.Left||e===rt.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function fY({sourceX:e,sourceY:t,sourcePosition:n=rt.Bottom,targetX:r,targetY:s,targetPosition:i=rt.Top}){const[o,a]=j9({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=j9({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,h,m,y]=kG({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${a} ${c},${u} ${r},${s}`,f,h,m,y]}function hY(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=rt.Bottom,targetPosition:a=rt.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:E,interactionWidth:N})=>{const[_,C,j]=fY({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a}),A=e.isInternal?void 0:t;return p.jsx(wS,{id:A,path:_,labelX:C,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:E,interactionWidth:N})})}const aIe=hY({isInternal:!1}),pY=hY({isInternal:!0});aIe.displayName="SimpleBezierEdge";pY.displayName="SimpleBezierEdgeInternal";function mY(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:m,sourcePosition:y=rt.Bottom,targetPosition:v=rt.Top,markerEnd:x,markerStart:E,pathOptions:N,interactionWidth:_})=>{const[C,j,A]=dj({sourceX:n,sourceY:r,sourcePosition:y,targetX:s,targetY:i,targetPosition:v,borderRadius:N==null?void 0:N.borderRadius,offset:N==null?void 0:N.offset}),$=e.isInternal?void 0:t;return p.jsx(wS,{id:$,path:C,labelX:j,labelY:A,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:x,markerStart:E,interactionWidth:_})})}const gY=mY({isInternal:!1}),yY=mY({isInternal:!0});gY.displayName="SmoothStepEdge";yY.displayName="SmoothStepEdgeInternal";function bY(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return p.jsx(gY,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const lIe=bY({isInternal:!1}),vY=bY({isInternal:!0});lIe.displayName="StepEdge";vY.displayName="StepEdgeInternal";function xY(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:y,markerStart:v,interactionWidth:x})=>{const[E,N,_]=LG({sourceX:n,sourceY:r,targetX:s,targetY:i}),C=e.isInternal?void 0:t;return p.jsx(wS,{id:C,path:E,labelX:N,labelY:_,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:y,markerStart:v,interactionWidth:x})})}const cIe=xY({isInternal:!1}),wY=xY({isInternal:!0});cIe.displayName="StraightEdge";wY.displayName="StraightEdgeInternal";function SY(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=rt.Bottom,targetPosition:a=rt.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:E,pathOptions:N,interactionWidth:_})=>{const[C,j,A]=IG({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a,curvature:N==null?void 0:N.curvature}),$=e.isInternal?void 0:t;return p.jsx(wS,{id:$,path:C,labelX:j,labelY:A,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:E,interactionWidth:_})})}const uIe=SY({isInternal:!1}),EY=SY({isInternal:!0});uIe.displayName="BezierEdge";EY.displayName="BezierEdgeInternal";const A9={default:EY,straight:wY,step:vY,smoothstep:yY,simplebezier:pY},$9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},dIe=(e,t,n)=>n===rt.Left?e-t:n===rt.Right?e+t:e,fIe=(e,t,n)=>n===rt.Top?e-t:n===rt.Bottom?e+t:e,T9="react-flow__edgeupdater";function R9({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:a}){return p.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:Fn([T9,`${T9}-${a}`]),cx:dIe(t,r,e),cy:fIe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function hIe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:a,targetPosition:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,setReconnecting:m,setUpdateHover:y}){const v=pn(),x=(j,A)=>{if(j.button!==0)return;const{autoPanOnConnect:$,domNode:R,isValidConnection:M,connectionMode:D,connectionRadius:P,lib:F,onConnectStart:V,onConnectEnd:H,cancelConnection:I,nodeLookup:B,rfId:T,panBy:L,updateConnection:z}=v.getState(),q=A.type==="target";m(!0),f==null||f(j,n,A.type);const k=(X,ne)=>{m(!1),h==null||h(X,n,A.type,ne)},W=X=>u==null?void 0:u(n,X);pj.onPointerDown(j.nativeEvent,{autoPanOnConnect:$,connectionMode:D,connectionRadius:P,domNode:R,handleId:A.id,nodeId:A.nodeId,nodeLookup:B,isTarget:q,edgeUpdaterType:A.type,lib:F,flowId:T,cancelConnection:I,panBy:L,isValidConnection:M,onConnect:W,onConnectStart:V,onConnectEnd:H,onReconnectEnd:k,updateConnection:z,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle})},E=j=>x(j,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),N=j=>x(j,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>y(!0),C=()=>y(!1);return p.jsxs(p.Fragment,{children:[(e===!0||e==="source")&&p.jsx(R9,{position:a,centerX:r,centerY:s,radius:t,onMouseDown:E,onMouseEnter:_,onMouseOut:C,type:"source"}),(e===!0||e==="target")&&p.jsx(R9,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:N,onMouseEnter:_,onMouseOut:C,type:"target"})]})}function pIe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,reconnectRadius:f,onReconnect:h,onReconnectStart:m,onReconnectEnd:y,rfId:v,edgeTypes:x,noPanClassName:E,onError:N,disableKeyboardA11y:_}){let C=$t(Oe=>Oe.edgeLookup.get(e));const j=$t(Oe=>Oe.defaultEdgeOptions);C=j?{...j,...C}:C;let A=C.type||"default",$=(x==null?void 0:x[A])||A9[A];$===void 0&&(N==null||N("011",To.error011(A)),A="default",$=A9.default);const R=!!(C.focusable||t&&typeof C.focusable>"u"),M=typeof h<"u"&&(C.reconnectable||n&&typeof C.reconnectable>"u"),D=!!(C.selectable||r&&typeof C.selectable>"u"),P=w.useRef(null),[F,V]=w.useState(!1),[H,I]=w.useState(!1),B=pn(),{zIndex:T,sourceX:L,sourceY:z,targetX:q,targetY:k,sourcePosition:W,targetPosition:X}=$t(w.useCallback(Oe=>{const Ce=Oe.nodeLookup.get(C.source),Me=Oe.nodeLookup.get(C.target);if(!Ce||!Me)return{zIndex:C.zIndex,...$9};const Ve=m6e({id:e,sourceNode:Ce,targetNode:Me,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:Oe.connectionMode,onError:N});return{zIndex:l6e({selected:C.selected,zIndex:C.zIndex,sourceNode:Ce,targetNode:Me,elevateOnSelect:Oe.elevateEdgesOnSelect}),...Ve||$9}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),vn),ne=w.useMemo(()=>C.markerStart?`url('#${fj(C.markerStart,v)}')`:void 0,[C.markerStart,v]),re=w.useMemo(()=>C.markerEnd?`url('#${fj(C.markerEnd,v)}')`:void 0,[C.markerEnd,v]);if(C.hidden||L===null||z===null||q===null||k===null)return null;const se=Oe=>{var We;const{addSelectedEdges:Ce,unselectNodesAndEdges:Me,multiSelectionActive:Ve}=B.getState();D&&(B.setState({nodesSelectionActive:!1}),C.selected&&Ve?(Me({nodes:[],edges:[C]}),(We=P.current)==null||We.blur()):Ce([e])),s&&s(Oe,C)},fe=i?Oe=>{i(Oe,{...C})}:void 0,he=o?Oe=>{o(Oe,{...C})}:void 0,ue=a?Oe=>{a(Oe,{...C})}:void 0,ve=c?Oe=>{c(Oe,{...C})}:void 0,Se=u?Oe=>{u(Oe,{...C})}:void 0,ke=Oe=>{var Ce;if(!_&&xG.includes(Oe.key)&&D){const{unselectNodesAndEdges:Me,addSelectedEdges:Ve}=B.getState();Oe.key==="Escape"?((Ce=P.current)==null||Ce.blur(),Me({edges:[C]})):Ve([e])}};return p.jsx("svg",{style:{zIndex:T},children:p.jsxs("g",{className:Fn(["react-flow__edge",`react-flow__edge-${A}`,C.className,E,{selected:C.selected,animated:C.animated,inactive:!D&&!s,updating:F,selectable:D}]),onClick:se,onDoubleClick:fe,onContextMenu:he,onMouseEnter:ue,onMouseMove:ve,onMouseLeave:Se,onKeyDown:R?ke:void 0,tabIndex:R?0:void 0,role:R?"button":"img","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":R?`${QG}-${v}`:void 0,ref:P,children:[!H&&p.jsx($,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:D,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:L,sourceY:z,targetX:q,targetY:k,sourcePosition:W,targetPosition:X,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:ne,markerEnd:re,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),M&&p.jsx(hIe,{edge:C,isReconnectable:M,reconnectRadius:f,onReconnect:h,onReconnectStart:m,onReconnectEnd:y,sourceX:L,sourceY:z,targetX:q,targetY:k,sourcePosition:W,targetPosition:X,setUpdateHover:V,setReconnecting:I})]})})}const mIe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function NY({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:m,onReconnectStart:y,onReconnectEnd:v,disableKeyboardA11y:x}){const{edgesFocusable:E,edgesReconnectable:N,elementsSelectable:_,onError:C}=$t(mIe,vn),j=eIe(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(iIe,{defaultColor:e,rfId:n}),j.map(A=>p.jsx(pIe,{id:A,edgesFocusable:E,edgesReconnectable:N,elementsSelectable:_,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,onClick:f,reconnectRadius:h,onDoubleClick:m,onReconnectStart:y,onReconnectEnd:v,rfId:n,onError:C,edgeTypes:r,disableKeyboardA11y:x},A))]})}NY.displayName="EdgeRenderer";const gIe=w.memo(NY),yIe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function bIe({children:e}){const t=$t(yIe);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function vIe(e){const t=bp(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const xIe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function wIe(e){const t=$t(xIe),n=pn();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function SIe(e){return e.connection.inProgress?{...e.connection,to:l0(e.connection.to,e.transform)}:{...e.connection}}function EIe(e){return SIe}function NIe(e){const t=EIe();return $t(t,vn)}const _Ie=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function CIe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:a,inProgress:c}=$t(_Ie,vn);return!(i&&s&&c)?null:p.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:Fn(["react-flow__connection",SG(a)]),children:p.jsx(_Y,{style:t,type:n,CustomComponent:r,isValid:a})})})}const _Y=({style:e,type:t=Kl.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:a,fromPosition:c,to:u,toNode:f,toHandle:h,toPosition:m}=NIe();if(!s)return;if(n)return p.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:a,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:m,connectionStatus:SG(r),toNode:f,toHandle:h});let y="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:m};switch(t){case Kl.Bezier:[y]=IG(v);break;case Kl.SimpleBezier:[y]=fY(v);break;case Kl.Step:[y]=dj({...v,borderRadius:0});break;case Kl.SmoothStep:[y]=dj(v);break;default:[y]=LG(v)}return p.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};_Y.displayName="ConnectionLine";const OIe={};function M9(e=OIe){w.useRef(e),pn(),w.useEffect(()=>{},[e])}function jIe(){pn(),w.useRef(!1),w.useEffect(()=>{},[])}function CY({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:m,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:x,connectionLineComponent:E,connectionLineContainerStyle:N,selectionKeyCode:_,selectionOnDrag:C,selectionMode:j,multiSelectionKeyCode:A,panActivationKeyCode:$,zoomActivationKeyCode:R,deleteKeyCode:M,onlyRenderVisibleElements:D,elementsSelectable:P,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:I,preventScrolling:B,defaultMarkerColor:T,zoomOnScroll:L,zoomOnPinch:z,panOnScroll:q,panOnScrollSpeed:k,panOnScrollMode:W,zoomOnDoubleClick:X,panOnDrag:ne,onPaneClick:re,onPaneMouseEnter:se,onPaneMouseMove:fe,onPaneMouseLeave:he,onPaneScroll:ue,onPaneContextMenu:ve,paneClickDistance:Se,nodeClickDistance:ke,onEdgeContextMenu:Oe,onEdgeMouseEnter:Ce,onEdgeMouseMove:Me,onEdgeMouseLeave:Ve,reconnectRadius:We,onReconnect:$e,onReconnectStart:J,onReconnectEnd:te,noDragClassName:Q,noWheelClassName:ye,noPanClassName:ce,disableKeyboardA11y:ae,nodeExtent:ie,rfId:de,viewport:be,onViewportChange:Ae}){return M9(e),M9(t),jIe(),vIe(n),wIe(be),p.jsx(Hke,{onPaneClick:re,onPaneMouseEnter:se,onPaneMouseMove:fe,onPaneMouseLeave:he,onPaneContextMenu:ve,onPaneScroll:ue,paneClickDistance:Se,deleteKeyCode:M,selectionKeyCode:_,selectionOnDrag:C,selectionMode:j,onSelectionStart:m,onSelectionEnd:y,multiSelectionKeyCode:A,panActivationKeyCode:$,zoomActivationKeyCode:R,elementsSelectable:P,zoomOnScroll:L,zoomOnPinch:z,zoomOnDoubleClick:X,panOnScroll:q,panOnScrollSpeed:k,panOnScrollMode:W,panOnDrag:ne,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:I,onSelectionContextMenu:h,preventScrolling:B,noDragClassName:Q,noWheelClassName:ye,noPanClassName:ce,disableKeyboardA11y:ae,onViewportChange:Ae,isControlledViewport:!!be,children:p.jsxs(bIe,{children:[p.jsx(gIe,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:$e,onReconnectStart:J,onReconnectEnd:te,onlyRenderVisibleElements:D,onEdgeContextMenu:Oe,onEdgeMouseEnter:Ce,onEdgeMouseMove:Me,onEdgeMouseLeave:Ve,reconnectRadius:We,defaultMarkerColor:T,noPanClassName:ce,disableKeyboardA11y:ae,rfId:de}),p.jsx(CIe,{style:x,type:v,component:E,containerStyle:N}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(Zke,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:ke,onlyRenderVisibleElements:D,noPanClassName:ce,noDragClassName:Q,disableKeyboardA11y:ae,nodeExtent:ie,rfId:de}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}CY.displayName="GraphView";const AIe=w.memo(CY),k9=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c}={})=>{const u=new Map,f=new Map,h=new Map,m=new Map,y=r??t??[],v=n??e??[],x=a??[0,0],E=c??ey;BG(h,m,y),hj(v,u,f,{nodeOrigin:x,nodeExtent:E,elevateNodesOnSelect:!1});let N=[0,0,1];if(o&&s&&i){const _=a0(u,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:C,y:j,zoom:A}=y5(_,s,i,.5,2,.1);N=[C,j,A]}return{rfId:"1",width:0,height:0,transform:N,nodes:v,nodeLookup:u,parentLookup:f,edges:y,edgeLookup:m,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:ey,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Fh.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connection:{...wG},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:o6e,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},$Ie=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c})=>J6e((u,f)=>({...k9({nodes:e,edges:t,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c,defaultNodes:n,defaultEdges:r}),setNodes:h=>{const{nodeLookup:m,parentLookup:y,nodeOrigin:v,elevateNodesOnSelect:x}=f();hj(h,m,y,{nodeOrigin:v,nodeExtent:c,elevateNodesOnSelect:x,checkEquality:!0}),u({nodes:h})},setEdges:h=>{const{connectionLookup:m,edgeLookup:y}=f();BG(m,y,h),u({edges:h})},setDefaultNodesAndEdges:(h,m)=>{if(h){const{setNodes:y}=f();y(h),u({hasDefaultNodes:!0})}if(m){const{setEdges:y}=f();y(m),u({hasDefaultEdges:!0})}},updateNodeInternals:(h,m={triggerFitView:!0})=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:x,fitViewOnInit:E,fitViewDone:N,fitViewOnInitOptions:_,domNode:C,nodeOrigin:j,nodeExtent:A,debug:$,fitViewSync:R}=f(),{changes:M,updatedInternals:D}=w6e(h,v,x,C,j,A);if(D){if(b6e(v,x,{nodeOrigin:j,nodeExtent:A}),m.triggerFitView){let P=N;!N&&E&&(P=R({..._,nodes:_==null?void 0:_.nodes})),u({fitViewDone:P})}else u({});(M==null?void 0:M.length)>0&&($&&console.log("React Flow: trigger node changes",M),y==null||y(M))}},updateNodePositions:(h,m=!1)=>{const y=[],v=[],{nodeLookup:x,triggerNodeChanges:E}=f();for(const[N,_]of h){const C=x.get(N),j=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(_!=null&&_.position)),A={id:N,type:"position",position:j?{x:Math.max(0,_.position.x),y:Math.max(0,_.position.y)}:_.position,dragging:m};j&&C.parentId&&y.push({id:N,parentId:C.parentId,rect:{..._.internals.positionAbsolute,width:_.measured.width??0,height:_.measured.height??0}}),v.push(A)}if(y.length>0){const{parentLookup:N,nodeOrigin:_}=f(),C=w5(y,x,N,_);v.push(...C)}E(v)},triggerNodeChanges:h=>{const{onNodesChange:m,setNodes:y,nodes:v,hasDefaultNodes:x,debug:E}=f();if(h!=null&&h.length){if(x){const N=tY(h,v);y(N)}E&&console.log("React Flow: trigger node changes",h),m==null||m(h)}},triggerEdgeChanges:h=>{const{onEdgesChange:m,setEdges:y,edges:v,hasDefaultEdges:x,debug:E}=f();if(h!=null&&h.length){if(x){const N=nY(h,v);y(N)}E&&console.log("React Flow: trigger edge changes",h),m==null||m(h)}},addSelectedNodes:h=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:v,triggerNodeChanges:x,triggerEdgeChanges:E}=f();if(m){const N=h.map(_=>Su(_,!0));x(N);return}x(Lf(v,new Set([...h]),!0)),E(Lf(y))},addSelectedEdges:h=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:v,triggerNodeChanges:x,triggerEdgeChanges:E}=f();if(m){const N=h.map(_=>Su(_,!0));E(N);return}E(Lf(y,new Set([...h]))),x(Lf(v,new Set,!0))},unselectNodesAndEdges:({nodes:h,edges:m}={})=>{const{edges:y,nodes:v,nodeLookup:x,triggerNodeChanges:E,triggerEdgeChanges:N}=f(),_=h||v,C=m||y,j=_.map($=>{const R=x.get($.id);return R&&(R.selected=!1),Su($.id,!1)}),A=C.map($=>Su($.id,!1));E(j),N(A)},setMinZoom:h=>{const{panZoom:m,maxZoom:y}=f();m==null||m.setScaleExtent([h,y]),u({minZoom:h})},setMaxZoom:h=>{const{panZoom:m,minZoom:y}=f();m==null||m.setScaleExtent([y,h]),u({maxZoom:h})},setTranslateExtent:h=>{var m;(m=f().panZoom)==null||m.setTranslateExtent(h),u({translateExtent:h})},setPaneClickDistance:h=>{var m;(m=f().panZoom)==null||m.setClickDistance(h)},resetSelectedElements:()=>{const{edges:h,nodes:m,triggerNodeChanges:y,triggerEdgeChanges:v}=f(),x=m.reduce((N,_)=>_.selected?[...N,Su(_.id,!1)]:N,[]),E=h.reduce((N,_)=>_.selected?[...N,Su(_.id,!1)]:N,[]);y(x),v(E)},setNodeExtent:h=>{const{nodes:m,nodeLookup:y,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:E,nodeExtent:N}=f();h[0][0]===N[0][0]&&h[0][1]===N[0][1]&&h[1][0]===N[1][0]&&h[1][1]===N[1][1]||(hj(m,y,v,{nodeOrigin:x,nodeExtent:h,elevateNodesOnSelect:E,checkEquality:!1}),u({nodeExtent:h}))},panBy:h=>{const{transform:m,width:y,height:v,panZoom:x,translateExtent:E}=f();return S6e({delta:h,panZoom:x,transform:m,translateExtent:E,width:y,height:v})},fitView:h=>{const{panZoom:m,width:y,height:v,minZoom:x,maxZoom:E,nodeLookup:N}=f();if(!m)return Promise.resolve(!1);const _=aj(N,h);return lj({nodes:_,width:y,height:v,panZoom:m,minZoom:x,maxZoom:E},h)},fitViewSync:h=>{const{panZoom:m,width:y,height:v,minZoom:x,maxZoom:E,nodeLookup:N}=f();if(!m)return!1;const _=aj(N,h);return lj({nodes:_,width:y,height:v,panZoom:m,minZoom:x,maxZoom:E},h),_.size>0},cancelConnection:()=>{u({connection:{...wG}})},updateConnection:h=>{u({connection:h})},reset:()=>u({...k9()})}),Object.is);function OY({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:o,nodeOrigin:a,nodeExtent:c,children:u}){const[f]=w.useState(()=>$Ie({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c}));return p.jsx(X6e,{value:f,children:p.jsx(vke,{children:u})})}function TIe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:a,nodeOrigin:c,nodeExtent:u}){return w.useContext(vS)?p.jsx(p.Fragment,{children:e}):p.jsx(OY,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:a,nodeOrigin:c,nodeExtent:u,children:e})}const RIe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function MIe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:a,onEdgeClick:c,onInit:u,onMove:f,onMoveStart:h,onMoveEnd:m,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:E,onClickConnectEnd:N,onNodeMouseEnter:_,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:$,onNodeDragStart:R,onNodeDrag:M,onNodeDragStop:D,onNodesDelete:P,onEdgesDelete:F,onDelete:V,onSelectionChange:H,onSelectionDragStart:I,onSelectionDrag:B,onSelectionDragStop:T,onSelectionContextMenu:L,onSelectionStart:z,onSelectionEnd:q,onBeforeDelete:k,connectionMode:W,connectionLineType:X=Kl.Bezier,connectionLineStyle:ne,connectionLineComponent:re,connectionLineContainerStyle:se,deleteKeyCode:fe="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:ue=!1,selectionMode:ve=ty.Full,panActivationKeyCode:Se="Space",multiSelectionKeyCode:ke=aw()?"Meta":"Control",zoomActivationKeyCode:Oe=aw()?"Meta":"Control",snapToGrid:Ce,snapGrid:Me,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:We,nodesDraggable:$e,nodesConnectable:J,nodesFocusable:te,nodeOrigin:Q=ZG,edgesFocusable:ye,edgesReconnectable:ce,elementsSelectable:ae=!0,defaultViewport:ie=cke,minZoom:de=.5,maxZoom:be=2,translateExtent:Ae=ey,preventScrolling:Ie=!0,nodeExtent:ht,defaultMarkerColor:Vt="#b1b1b7",zoomOnScroll:_t=!0,zoomOnPinch:no=!0,panOnScroll:Ut=!1,panOnScrollSpeed:Bt=.5,panOnScrollMode:Rs=Ju.Free,zoomOnDoubleClick:Ms=!0,panOnDrag:Gn=!0,onPaneClick:zc,onPaneMouseEnter:Od,onPaneMouseMove:vp,onPaneMouseLeave:Fo,onPaneScroll:nl,onPaneContextMenu:Yn,paneClickDistance:Bo=0,nodeClickDistance:rl=0,children:xp,onReconnect:jd,onReconnectStart:dn,onReconnectEnd:cs,onEdgeContextMenu:Er,onEdgeDoubleClick:ro,onEdgeMouseEnter:sl,onEdgeMouseMove:Vc,onEdgeMouseLeave:Uc,reconnectRadius:qc=10,onNodesChange:wp,onEdgesChange:ks,noDragClassName:Tn="nodrag",noWheelClassName:Jn="nowheel",noPanClassName:dt="nopan",fitView:Xn,fitViewOptions:Is,connectOnClick:u0,attributionPosition:d0,proOptions:Hc,defaultEdgeOptions:Sp,elevateNodesOnSelect:zo,elevateEdgesOnSelect:il,disableKeyboardA11y:ol=!1,autoPanOnConnect:al,autoPanOnNodeDrag:Rn,autoPanSpeed:f0,connectionRadius:h0,isValidConnection:Vo,onError:ll,style:vi,id:p0,nodeDragThreshold:m0,viewport:g0,onViewportChange:SS,width:Ad,height:$d,colorMode:xi="light",debug:Wr,onScroll:Wc,...ES},Td){const Rd=p0||"1",Md=hke(xi),NS=w.useCallback(Nr=>{Nr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Wc==null||Wc(Nr)},[Wc]);return p.jsx("div",{"data-testid":"rf__wrapper",...ES,onScroll:NS,style:{...vi,...RIe},ref:Td,className:Fn(["react-flow",s,Md]),id:p0,children:p.jsxs(TIe,{nodes:e,edges:t,width:Ad,height:$d,fitView:Xn,nodeOrigin:Q,nodeExtent:ht,children:[p.jsx(AIe,{onInit:u,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:_,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:$,nodeTypes:i,edgeTypes:o,connectionLineType:X,connectionLineStyle:ne,connectionLineComponent:re,connectionLineContainerStyle:se,selectionKeyCode:he,selectionOnDrag:ue,selectionMode:ve,deleteKeyCode:fe,multiSelectionKeyCode:ke,panActivationKeyCode:Se,zoomActivationKeyCode:Oe,onlyRenderVisibleElements:Ve,defaultViewport:ie,translateExtent:Ae,minZoom:de,maxZoom:be,preventScrolling:Ie,zoomOnScroll:_t,zoomOnPinch:no,zoomOnDoubleClick:Ms,panOnScroll:Ut,panOnScrollSpeed:Bt,panOnScrollMode:Rs,panOnDrag:Gn,onPaneClick:zc,onPaneMouseEnter:Od,onPaneMouseMove:vp,onPaneMouseLeave:Fo,onPaneScroll:nl,onPaneContextMenu:Yn,paneClickDistance:Bo,nodeClickDistance:rl,onSelectionContextMenu:L,onSelectionStart:z,onSelectionEnd:q,onReconnect:jd,onReconnectStart:dn,onReconnectEnd:cs,onEdgeContextMenu:Er,onEdgeDoubleClick:ro,onEdgeMouseEnter:sl,onEdgeMouseMove:Vc,onEdgeMouseLeave:Uc,reconnectRadius:qc,defaultMarkerColor:Vt,noDragClassName:Tn,noWheelClassName:Jn,noPanClassName:dt,rfId:Rd,disableKeyboardA11y:ol,nodeExtent:ht,viewport:g0,onViewportChange:SS}),p.jsx(fke,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:E,onClickConnectEnd:N,nodesDraggable:$e,nodesConnectable:J,nodesFocusable:te,edgesFocusable:ye,edgesReconnectable:ce,elementsSelectable:ae,elevateNodesOnSelect:zo,elevateEdgesOnSelect:il,minZoom:de,maxZoom:be,nodeExtent:ht,onNodesChange:wp,onEdgesChange:ks,snapToGrid:Ce,snapGrid:Me,connectionMode:W,translateExtent:Ae,connectOnClick:u0,defaultEdgeOptions:Sp,fitView:Xn,fitViewOptions:Is,onNodesDelete:P,onEdgesDelete:F,onDelete:V,onNodeDragStart:R,onNodeDrag:M,onNodeDragStop:D,onSelectionDrag:B,onSelectionDragStart:I,onSelectionDragStop:T,onMove:f,onMoveStart:h,onMoveEnd:m,noPanClassName:dt,nodeOrigin:Q,rfId:Rd,autoPanOnConnect:al,autoPanOnNodeDrag:Rn,autoPanSpeed:f0,onError:ll,connectionRadius:h0,isValidConnection:Vo,selectNodesOnDrag:We,nodeDragThreshold:m0,onBeforeDelete:k,paneClickDistance:Bo,debug:Wr}),p.jsx(lke,{onSelectionChange:H}),xp,p.jsx(rke,{proOptions:Hc,position:d0}),p.jsx(tke,{rfId:Rd,disableKeyboardA11y:ol})]})})}var kIe=rY(MIe);const IIe=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function DIe(){return $t(IIe,vn)}function PIe(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>tY(s,i)),[]);return[t,n,r]}function LIe(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>nY(s,i)),[]);return[t,n,r]}function FIe({dimensions:e,lineWidth:t,variant:n,className:r}){return p.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Fn(["react-flow__background-pattern",n,r])})}function BIe({radius:e,className:t}){return p.jsx("circle",{cx:e,cy:e,r:e,className:Fn(["react-flow__background-pattern","dots",t])})}var Ta;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ta||(Ta={}));const zIe={[Ta.Dots]:1,[Ta.Lines]:1,[Ta.Cross]:6},VIe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jY({id:e,variant:t=Ta.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:a,style:c,className:u,patternClassName:f}){const h=w.useRef(null),{transform:m,patternId:y}=$t(VIe,vn),v=r||zIe[t],x=t===Ta.Dots,E=t===Ta.Cross,N=Array.isArray(n)?n:[n,n],_=[N[0]*m[2]||1,N[1]*m[2]||1],C=v*m[2],j=Array.isArray(i)?i:[i,i],A=E?[C,C]:_,$=[j[0]*m[2]||1+A[0]/2,j[1]*m[2]||1+A[1]/2],R=`${y}${e||""}`;return p.jsxs("svg",{className:Fn(["react-flow__background",u]),style:{...c,...xS,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:h,"data-testid":"rf__background",children:[p.jsx("pattern",{id:R,x:m[0]%_[0],y:m[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${$[0]},-${$[1]})`,children:x?p.jsx(BIe,{radius:C/2,className:f}):p.jsx(FIe,{dimensions:A,lineWidth:s,variant:t,className:f})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}jY.displayName="Background";const I9=w.memo(jY);function UIe(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:p.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function qIe(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:p.jsx("path",{d:"M0 0h32v4.2H0z"})})}function HIe(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:p.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function WIe(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function GIe(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function av({children:e,className:t,...n}){return p.jsx("button",{type:"button",className:Fn(["react-flow__controls-button",t]),...n,children:e})}const YIe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function AY({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:a,onInteractiveChange:c,className:u,children:f,position:h="bottom-left",orientation:m="vertical","aria-label":y="React Flow controls"}){const v=pn(),{isInteractive:x,minZoomReached:E,maxZoomReached:N}=$t(YIe,vn),{zoomIn:_,zoomOut:C,fitView:j}=bp(),A=()=>{_(),i==null||i()},$=()=>{C(),o==null||o()},R=()=>{j(s),a==null||a()},M=()=>{v.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},D=m==="horizontal"?"horizontal":"vertical";return p.jsxs(Uh,{className:Fn(["react-flow__controls",D,u]),position:h,style:e,"data-testid":"rf__controls","aria-label":y,children:[t&&p.jsxs(p.Fragment,{children:[p.jsx(av,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N,children:p.jsx(UIe,{})}),p.jsx(av,{onClick:$,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:E,children:p.jsx(qIe,{})})]}),n&&p.jsx(av,{className:"react-flow__controls-fitview",onClick:R,title:"fit view","aria-label":"fit view",children:p.jsx(HIe,{})}),r&&p.jsx(av,{className:"react-flow__controls-interactive",onClick:M,title:"toggle interactivity","aria-label":"toggle interactivity",children:x?p.jsx(GIe,{}):p.jsx(WIe,{})}),f]})}AY.displayName="Controls";w.memo(AY);function JIe({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:a,strokeWidth:c,className:u,borderRadius:f,shapeRendering:h,selected:m,onClick:y}){const{background:v,backgroundColor:x}=i||{},E=o||v||x;return p.jsx("rect",{className:Fn(["react-flow__minimap-node",{selected:m},u]),x:t,y:n,rx:f,ry:f,width:r,height:s,style:{fill:E,stroke:a,strokeWidth:c},shapeRendering:h,onClick:y?N=>y(N,e):void 0})}const XIe=w.memo(JIe),KIe=e=>e.nodes.map(t=>t.id),D_=e=>e instanceof Function?e:()=>e;function QIe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=XIe,onClick:o}){const a=$t(KIe,vn),c=D_(t),u=D_(e),f=D_(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return p.jsx(p.Fragment,{children:a.map(m=>p.jsx(eDe,{id:m,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:h},m))})}function ZIe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:a,onClick:c}){const{node:u,x:f,y:h,width:m,height:y}=$t(v=>{const x=v.nodeLookup.get(e),{x:E,y:N}=x.internals.positionAbsolute,{width:_,height:C}=tl(x);return{node:x,x:E,y:N,width:_,height:C}},vn);return!u||u.hidden||!$G(u)?null:p.jsx(a,{x:f,y:h,width:m,height:y,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const eDe=w.memo(ZIe);var tDe=w.memo(QIe);const nDe=200,rDe=150,sDe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?jG(a0(e.nodeLookup),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}},iDe="react-flow__minimap-desc";function $Y({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:c,maskColor:u,maskStrokeColor:f,maskStrokeWidth:h,position:m="bottom-right",onClick:y,onNodeClick:v,pannable:x=!1,zoomable:E=!1,ariaLabel:N="React Flow mini map",inversePan:_,zoomStep:C=10,offsetScale:j=5}){const A=pn(),$=w.useRef(null),{boundingRect:R,viewBB:M,rfId:D,panZoom:P,translateExtent:F,flowWidth:V,flowHeight:H}=$t(sDe,vn),I=(e==null?void 0:e.width)??nDe,B=(e==null?void 0:e.height)??rDe,T=R.width/I,L=R.height/B,z=Math.max(T,L),q=z*I,k=z*B,W=j*z,X=R.x-(q-R.width)/2-W,ne=R.y-(k-R.height)/2-W,re=q+W*2,se=k+W*2,fe=`${iDe}-${D}`,he=w.useRef(0),ue=w.useRef();he.current=z,w.useEffect(()=>{if($.current&&P)return ue.current=$6e({domNode:$.current,panZoom:P,getTransform:()=>A.getState().transform,getViewScale:()=>he.current}),()=>{var ke;(ke=ue.current)==null||ke.destroy()}},[P]),w.useEffect(()=>{var ke;(ke=ue.current)==null||ke.update({translateExtent:F,width:V,height:H,inversePan:_,pannable:x,zoomStep:C,zoomable:E})},[x,E,_,C,F,V,H]);const ve=y?ke=>{var Me;const[Oe,Ce]=((Me=ue.current)==null?void 0:Me.pointer(ke))||[0,0];y(ke,{x:Oe,y:Ce})}:void 0,Se=v?w.useCallback((ke,Oe)=>{const Ce=A.getState().nodeLookup.get(Oe);v(ke,Ce)},[]):void 0;return p.jsx(Uh,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*z:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="string"?o:void 0},className:Fn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:p.jsxs("svg",{width:I,height:B,viewBox:`${X} ${ne} ${re} ${se}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":fe,ref:$,onClick:ve,children:[N&&p.jsx("title",{id:fe,children:N}),p.jsx(tDe,{onClick:Se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:a}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-W},${ne-W}h${re+W*2}v${se+W*2}h${-re-W*2}z
        M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}$Y.displayName="MiniMap";const TY=w.memo($Y);function oDe({nodeId:e,position:t,variant:n=ug.Handle,className:r,style:s={},children:i,color:o,minWidth:a=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:h=!1,shouldResize:m,onResizeStart:y,onResize:v,onResizeEnd:x}){const E=aY(),N=typeof e=="string"?e:E,_=pn(),C=w.useRef(null),j=n===ug.Line?"right":"bottom-right",A=t??j,$=w.useRef(null);w.useEffect(()=>{if(!(!C.current||!N))return $.current||($.current=H6e({domNode:C.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:P,transform:F,snapGrid:V,snapToGrid:H,nodeOrigin:I,domNode:B}=_.getState();return{nodeLookup:P,transform:F,snapGrid:V,snapToGrid:H,nodeOrigin:I,paneDomNode:B}},onChange:(P,F)=>{const{triggerNodeChanges:V,nodeLookup:H,parentLookup:I,nodeOrigin:B}=_.getState(),T=[],L={x:P.x,y:P.y},z=H.get(N);if(z&&z.expandParent&&z.parentId){const q=z.origin??B,k=P.width??z.measured.width??0,W=P.height??z.measured.height??0,X={id:z.id,parentId:z.parentId,rect:{width:k,height:W,...TG({x:P.x??z.position.x,y:P.y??z.position.y},{width:k,height:W},z.parentId,H,q)}},ne=w5([X],H,I,B);T.push(...ne),L.x=P.x?Math.max(q[0]*k,P.x):void 0,L.y=P.y?Math.max(q[1]*W,P.y):void 0}if(L.x!==void 0&&L.y!==void 0){const q={id:N,type:"position",position:{...L}};T.push(q)}if(P.width!==void 0&&P.height!==void 0){const q={id:N,type:"dimensions",resizing:!0,setAttributes:!0,dimensions:{width:P.width,height:P.height}};T.push(q)}for(const q of F){const k={...q,type:"position"};T.push(k)}V(T)},onEnd:()=>{const P={id:N,type:"dimensions",resizing:!1};_.getState().triggerNodeChanges([P])}})),$.current.update({controlPosition:A,boundaries:{minWidth:a,minHeight:c,maxWidth:u,maxHeight:f},keepAspectRatio:h,onResizeStart:y,onResize:v,onResizeEnd:x,shouldResize:m}),()=>{var P;(P=$.current)==null||P.destroy()}},[A,a,c,u,f,h,y,v,x,m]);const R=A.split("-"),M=n===ug.Line?"borderColor":"backgroundColor",D=o?{...s,[M]:o}:s;return p.jsx("div",{className:Fn(["react-flow__resize-control","nodrag",...R,n,r]),ref:C,style:D,children:i})}w.memo(oDe);function aDe({nodes:e,edges:t,externalProvider:n,backgroundStyle:r="lines",minimap:s=!1,children:i,onDropNewNode:o,onDropNewEdge:a,...c}){const[u,f,h]=PIe(e??[]),[m,y,v]=LIe(t??[]),{screenToFlowPosition:x}=bp(),{theme:E}=Dc(),[N,_]=w.useState(!1),[C,j]=w.useState(!1),[A,$]=w.useState(!1),R=H=>{H.metaKey&&_(!0),H.key===" "&&j(!0)},M=H=>{H.metaKey||_(!1),H.key===" "&&j(!1)},D=()=>{if(C){$(!1);return}$(!0)},P=()=>{if(C){$(!1);return}$(!1)};w.useEffect(()=>{var H;return(H=document.querySelector("html"))==null||H.classList.add("fixed"),window.addEventListener("keydown",R),window.addEventListener("keyup",M),window.addEventListener("pointerdown",D),window.addEventListener("pointerup",P),()=>{var I;window.removeEventListener("keydown",R),window.removeEventListener("keyup",M),window.removeEventListener("pointerdown",D),window.removeEventListener("pointerup",P),(I=document.querySelector("html"))==null||I.classList.remove("fixed")}},[]),w.useEffect(()=>{f(e??[]),y(t??[])},[e,t]);const F=w.useCallback(H=>y(I=>PG(H,I)),[]),V=w.useCallback((H,I)=>{if(!o||!a)return;const{fromNode:B,fromHandle:T,fromPosition:L}=I;if(!I.isValid){console.log("conn",{event:H,connectionState:I});const{clientX:z,clientY:q}="changedTouches"in H?H.changedTouches[0]:H,k=o({id:"select",type:"default",data:{label:""},position:x({x:z,y:q}),origin:[0,0]});f(W=>W.concat(k)),y(W=>W.concat(o({id:k.id,source:I.fromNode.id,target:k.id})))}},[x]);return p.jsxs(kIe,{colorMode:E,onConnect:F,onConnectEnd:V,className:N?"cursor-zoom-in":C?A?"cursor-grabbing":"cursor-grab":"",proOptions:{hideAttribution:!0},fitView:!0,fitViewOptions:{maxZoom:1.5,...c.fitViewOptions},nodeDragThreshold:25,panOnScrollSpeed:1,snapToGrid:!0,nodes:u,edges:m,onNodesChange:h,onEdgesChange:v,nodesConnectable:!1,panOnDrag:!0,zoomOnScroll:N,panOnScroll:!N,zoomOnDoubleClick:!1,selectionOnDrag:!C,...c,children:[r==="lines"&&p.jsx(I9,{color:E==="light"?"rgba(0,0,0,.05)":"rgba(255,255,255,.1)",gap:[50,50],variant:Ta.Lines}),r==="dots"&&p.jsx(I9,{color:E==="light"?"rgba(0,0,0,.5)":"rgba(255,255,255,.2)"}),s&&p.jsx(TY,{...typeof s=="object"?s:{}}),i]})}function br({position:e,className:t,children:n,unstyled:r,...s}){return r?p.jsx(Uh,{position:e,className:Ue("flex flex-row p-1 gap-4",t),...s,children:n}):p.jsx(Uh,{position:e,...s,children:p.jsx(RY,{className:t,children:n})})}const RY=({children:e,className:t,...n})=>p.jsx("div",{...n,className:Ue("flex flex-row bg-lightest border ring-2 ring-muted/5 border-muted rounded-full items-center p-1",t),children:e}),lDe=({Icon:e,size:t="lg",variant:n="ghost",onClick:r,disabled:s,className:i,round:o,...a})=>p.jsx(St,{Icon:e,size:t,variant:n,onClick:r,disabled:s,className:Ue(o?"rounded-full":"",i),...a}),cDe=w.forwardRef(({children:e,className:t,mono:n,...r},s)=>p.jsx("span",{...r,ref:s,className:Ue("text-md font-medium leading-none",n&&"font-mono",t),children:e}));br.Wrapper=RY;br.IconButton=lDe;br.Text=cDe;function uDe({children:e,...t}){const[n,r]=w.useState(!1),s=bp(),{zoom:i,x:o,y:a}=DIe(),c=Math.round(i*100),u=async()=>await s.zoomIn(),f=async()=>s.zoomTo(1),h=async()=>await s.zoomOut();function m(){r(y=>!y)}return p.jsxs(p.Fragment,{children:[e,t.coordinates&&p.jsx(br,{position:"bottom-center",children:p.jsxs(br.Text,{className:"px-2",mono:!0,children:[o.toFixed(2),",",a.toFixed(2)]})}),p.jsxs(br,{unstyled:!0,position:"bottom-right",children:[t.zoom&&p.jsxs(br.Wrapper,{className:"px-1.5",children:[p.jsx(br.IconButton,{Icon:FU,round:!0,onClick:u}),p.jsxs(br.Text,{className:"px-2",mono:!0,onClick:f,children:[c,"%"]}),p.jsx(br.IconButton,{Icon:M1e,round:!0,onClick:h}),p.jsx(br.IconButton,{Icon:T1e,round:!0,onClick:f})]}),t.minimap&&p.jsxs(p.Fragment,{children:[p.jsx(br.Wrapper,{children:p.jsx(br.IconButton,{Icon:wO,round:!0,onClick:m,variant:n?"default":"ghost"})}),n&&p.jsx(TY,{style:{bottom:50,right:-5},ariaLabel:null})]})]})]})}function gc({selected:e,children:t,className:n,...r}){return Dc(),p.jsx("div",{...r,className:Ue("relative w-80 shadow-lg rounded-lg bg-background",e&&"outline outline-blue-500/25",n),children:t})}const dDe=({className:e,label:t,children:n,...r})=>p.jsx("div",{...r,className:Ue("flex flex-row bg-primary/15 justify-center items-center rounded-tl-lg rounded-tr-lg py-1 px-2 drag-handle",e),children:n||p.jsx("span",{className:"font-semibold opacity-75 font-mono",children:t??"Untitled node"})}),fDe=({children:e,className:t,...n})=>p.jsx("div",{...n,className:Ue("px-2 py-1.5 pb-2 flex flex-col",t),children:e});gc.Header=dDe;gc.Content=fDe;const E5=Ih({dirty:!1,name:void 0,flow:void 0}),MY=w.createContext(void 0),P_={trigger:{type:"manual"},tasks:{},connections:{}};function hDe({children:e,name:t}){const n=JT(E5),r=Tt(),s=t?r.config.flows.flows[t]:void 0,i=r.schema.flows.properties.flows;w.useEffect(()=>{t&&n({dirty:!1,name:t,flow:s})},[t]);const o={flow:{setName:async a=>{console.log("set name",a),n(c=>({...c,name:a,dirty:!0}))}},trigger:{update:async a=>{console.log("update trigger",a),n(c=>{const u=c.flow||P_;return{...c,dirty:!0,flow:{...u,trigger:a}}})}},task:{create:async(a,c={})=>{console.log("create task",a,c),n(u=>{const f=u.flow||P_,h={...f.tasks,[a]:c};return{...u,dirty:!0,flow:{...f,tasks:h}}})},update:async(a,c)=>{console.log("update task",a,c),n(u=>{var m,y;const f=u.flow||P_,h={...(y=(m=u.flow)==null?void 0:m.tasks)==null?void 0:y[a],params:c};return{...u,dirty:!0,flow:{...f,tasks:{...f.tasks,[a]:h}}}})}}};return p.jsx(MY.Provider,{value:{name:t,data:s,schema:i,actions:o},children:e})}function c0(){return w.useContext(MY)}function pDe(){return YT(E5)}function N5(e,t=VB){const n=e0(E5,w.useCallback(e,[]),t);return yp(n)[0]}function mDe(e,t){const n=[{id:"trigger",data:{label:t,type:e.trigger.type},type:"trigger",dragHandle:".drag-handle",position:{x:0,y:0}}];let r=1;const s=Object.keys(e.tasks??{}).length;for(const[i,o]of Object.entries(e.tasks??{})){const a=r===s,c=r===1,u=a;n.push({id:`task-${i}`,data:{label:i,type:o.type,last:a,start:c,responding:u},type:"task",dragHandle:".drag-handle",position:{x:450*r+(r-1)*64,y:0}}),r++}return n}function gDe(e){var r;const t=Object.entries(e.tasks??{});if(t.length===0)return[];const n=t.length>=1?[{id:"trigger-task",source:"trigger",target:`task-${(r=t[0])==null?void 0:r[0]}`,style:{strokeWidth:2},markerEnd:{type:od.ArrowClosed,width:10,height:10}}]:[];for(const[s,i]of Object.entries(e.connections??{}))n.push({id:s,source:"task-"+i.source,target:"task-"+i.target,style:{strokeWidth:2},markerEnd:{type:od.ArrowClosed,width:10,height:10}});return n}function cw(e){const t={top:16,width:10,height:10,background:"transparent",border:"2px solid #999"},n=-10,r={target:{...t,left:n},source:{...t,right:n}};return p.jsx(iy,{...e,position:e.type==="source"?rt.Right:rt.Left,style:r[e.type]})}const D9=[{type:"fetch",label:"Fetch",description:"Fetch data from a URL",template:{type:"fetch",params:{method:"GET",headers:[],url:""}}},{type:"render",label:"Render",description:"Render data using LiquidJS"}];function yDe(e){const[t,n]=w.useState(),r=bp(),{actions:s}=c0(),i=e.id;async function o(){const a=D9.find(u=>u.type===t),c="untitled";await s.task.create(c,a.template),r.setNodes(u=>u.map(f=>f.id===i?{...f,id:"task-"+c,type:"task",data:{...a.template,label:c}}:f)),setTimeout(()=>{r.setEdges(u=>u.map(f=>(console.log("edge?",f,i,f.target===i),f.target===i?{...f,id:"task-"+c,target:"task-"+c}:f)))},100),console.log("make",a)}return p.jsxs(gc,{className:"w-96",children:[p.jsx(cw,{type:"target",id:"select-in"}),p.jsxs(gc.Header,{className:"gap-3 justify-start py-2",children:[p.jsx("div",{className:"bg-primary/10 rounded-full w-4 h-4"}),p.jsx("div",{className:"bg-primary/5 rounded-full w-1/2 h-4"})]}),p.jsxs(gc.Content,{children:[p.jsx("div",{children:"select"}),p.jsx("div",{className:"grid grid-cols-3 gap-2",children:D9.map(a=>p.jsx("button",{type:"button",className:Ue("border border-primary/10 rounded-md py-2 px-4 hover:bg-primary/10",t===a.type&&"bg-primary/10"),onClick:()=>n(a.type),children:a.label},a.type))}),p.jsx("button",{onClick:o,children:"make"})]})]})}function bDe({label:e,description:t,size:n,...r}){return p.jsxs(kt.Wrapper,{className:"relative",children:[e&&p.jsxs("div",{className:"flex flex-col",children:[p.jsx(kt.Label,{size:n,children:e}),t&&p.jsx(kt.Description,{size:n,children:t})]}),p.jsx(dd,{...r,size:n})]})}const gj={key:"",value:""};function vDe(e){return!e||Array.isArray(e)?[gj]:Object.entries(e).map(([t,n])=>({key:t,value:n}))}const lv=({label:e,initialValue:t,onChange:n,error:r,classNames:s,mode:i="object"})=>{const[o,a]=w.useState(t?vDe(t):[gj]);w.useEffect(()=>{if(n)if(i==="object"){const h=o.reduce((m,y)=>(y.key&&typeof y.value<"u"&&(m[y.key]=y.value),m),{});n(h)}else n(o)},[o]);function c(){a(h=>[...h,gj])}function u(h,m){return y=>{const v=y.currentTarget.value;a(x=>x.map((E,N)=>N===h?{...E,[m]:v}:E))}}function f(h){return()=>{a(m=>m.filter((y,v)=>v!==h))}}return p.jsxs(kt.Wrapper,{className:"w-full",children:[p.jsxs("div",{className:"flex flex-row w-full justify-between",children:[e?p.jsx(kt.Label,{className:s==null?void 0:s.label,children:e}):p.jsx("div",{}),p.jsx(St,{Icon:q$,size:"xs",onClick:c})]}),p.jsxs("div",{className:Ue("flex flex-col gap-2",s==null?void 0:s.itemWrapper),children:[o.map(({key:h,value:m},y)=>p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[o.length>1&&p.jsx(St,{Icon:MV,size:"xs",onClick:f(y)}),p.jsx(Nn,{className:"w-36",placeholder:"key",value:h,classNames:{wrapper:"font-mono pt-px"},onChange:u(y,"key")}),p.jsx(Nn,{className:"w-full",placeholder:"value",value:m,classNames:{wrapper:"font-mono pt-px"},onChange:u(y,"value")})]},y)),r&&p.jsx(kt.Error,{children:r})]})]})};function _5({children:e,className:t,tabs:n,Icon:r,isInvalid:s,...i}){const{data:o}=i;function a(c){i.onChangeName&&i.onChangeName(c.target.value)}return p.jsxs(gc,{className:Ue("w-96",s&&"ring-8 ring-red-500/15",t),children:[p.jsx(wDe,{Icon:r??Cve,initialValue:o.label,onChange:a}),p.jsx(gc.Content,{className:"gap-3",children:e}),p.jsx(xDe,{tabs:n})]})}const xDe=({tabs:e})=>{var s;const[t,n]=w.useState();if(!e||(e==null?void 0:e.length)===0)return null;function r(i){return()=>{n(o=>o===i?void 0:i)}}return p.jsxs("div",{className:"border-t border-t-muted mt-1",children:[p.jsx("div",{className:"flex flex-row justify-start bg-primary/5 px-3 py-2.5 gap-3",children:e.map((i,o)=>p.jsx("button",{type:"button",onClick:r(o),className:Ue("text-sm leading-none",o===t?"font-bold opacity-80":"font-medium opacity-50"),children:i.label},i.id))}),typeof t<"u"?p.jsx("div",{className:"border-t border-t-muted",children:(s=e[t])==null?void 0:s.content()}):null]})},wDe=({Icon:e,iconProps:t,rightSection:n,initialValue:r,changable:s=!1,onChange:i})=>{const[o,a]=w.useState(r);function c(u){if(!s)return;const f=String(u.target.value);if(f.length>0&&!/^[a-zA-Z_][a-zA-Z0-9_ ]*$/.test(f)||f.length===25)return;const h=f.toLowerCase().replace(/ /g,"_").replace(/__+/g,"_");a(h),i==null||i({...u,target:{...u.target,value:h}})}return p.jsxs(gc.Header,{className:"justify-between gap-10",children:[p.jsxs("div",{className:"flex flex-row flex-grow gap-1 items-center",children:[p.jsx(e,{width:16,height:16,...t??{}}),s?p.jsx("input",{type:"text",value:o,disabled:!s,onChange:c,className:Ue("font-mono font-semibold bg-transparent rounded-lg outline-none pl-1.5 w-full hover:bg-lightest/30 transition-colors focus:bg-lightest/60")}):p.jsx("span",{className:"font-mono font-semibold bg-transparent  rounded-lg outline-none pl-1.5",children:o})]}),p.jsxs("div",{className:"flex flex-row gap-1",children:[p.jsx(St,{Icon:s1e,size:"sm"}),p.jsx(St,{Icon:Lc,size:"sm"})]})]})},SDe=Qe({query:Vi(xe()).optional(),...j$.schema.properties});function EDe({onChange:e,params:t,...n}){var E;const[r,s]=g8([!0,!1]),[i,o]=w.useState("None"),{register:a,handleSubmit:c,setValue:u,getValues:f,formState:{isValid:h,errors:m},watch:y,control:v}=Za({resolver:el(SDe),defaultValues:t,mode:"onChange"});function x(N){console.log("submit task",N),e(N)}return p.jsx(_5,{...n,isInvalid:!h,className:"w-[400px]",Icon:kV,tabs:NDe({watch:y}),onChangeName:console.log,children:p.jsxs("form",{onBlur:c(x),className:"flex flex-col gap-3",children:[p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx(ja,{className:"w-36",label:"Method",defaultValue:"GET",data:["GET","POST","PATCH","PUT","DEL"],name:"method",control:v}),p.jsx(Nn,{className:"w-full",label:"Mapping Path",placeholder:"/path/to-be/mapped",classNames:{wrapper:"font-mono pt-px"},...a("url")})]}),p.jsx(ot,{onClick:s,className:"justify-center",size:"small",variant:"ghost",iconSize:14,IconLeft:r?wve:q$,children:"More options"}),r&&p.jsxs(p.Fragment,{children:[p.jsx(lv,{label:"URL query",onChange:N=>u("query",N),error:(E=m.query)==null?void 0:E.message}),p.jsx(lv,{label:"Headers"}),p.jsx("div",{className:"flex flex-row gap-2 items-center mt-2",children:p.jsxs(kt.Wrapper,{className:"w-full",children:[p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx(kt.Label,{children:"Body"}),p.jsx(bDe,{data:["None","Form","JSON","Code"],size:"xs",defaultValue:i,onChange:N=>o(N)})]}),i==="Form"&&p.jsx(lv,{label:void 0}),i==="JSON"&&p.jsx(lv,{label:void 0})]})})]})]})})}const NDe=({watch:e})=>[{id:"json",label:"JSON",content:()=>p.jsx("div",{className:"scroll-auto",children:p.jsx(ui,{json:e(),expand:2,className:"bg-white break-all"})})},{id:"test",label:"test",content:()=>p.jsx("div",{children:"test"})}],_De=w.lazy(()=>Wy(()=>import("./CodeEditor-C3U4N43u.js"),[]));function CDe({editable:e,...t}){return p.jsx(w.Suspense,{fallback:null,children:p.jsx(_De,{className:Ue("flex w-full border border-muted bg-white rounded-lg",!e&&"opacity-70"),editable:e,_extensions:{html:!0},...t})})}function ODe(e){return p.jsx(_5,{...e,onChangeName:console.log,Icon:kV,className:"w-[400px]",children:p.jsx("form",{className:"flex flex-col gap-3",children:p.jsx(CDe,{value:e.params.render,onChange:console.log})})})}const P9={fetch:EDe,render:ODe},jDe=e=>{const{data:{label:t,start:n,last:r,responding:s}}=e,i=N5(u=>u.flow.tasks[t]),{actions:o}=c0(),a=i.type in P9?P9[i.type]:()=>p.jsx("div",{children:"unsupported"});function c(u){o.task.update(t,u)}return p.jsxs(p.Fragment,{children:[p.jsx(a,{...e,params:i.params,onChange:c}),p.jsx(cw,{type:"target",id:`${t}-in`}),p.jsx(cw,{type:"source",id:`${t}-out`})]})};function oy({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s,onChange:i,label:o,size:a,description:c,error:u,...f}){const{field:{value:h,onChange:m,...y}}=Nd({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:s});return p.jsxs(kt.Wrapper,{className:"relative",children:[o&&p.jsxs("div",{className:"flex flex-col",children:[p.jsx(kt.Label,{size:a,children:o}),c&&p.jsx(kt.Description,{size:a,children:c})]}),p.jsx(dd,{value:h,onChange:v=>{m(v),i==null||i(v)},size:a,...y,...f})]})}const ADe=Qe({trigger:Zt(Object.values(sn(T$,(e,t)=>st({type:ti(t),config:e.cls.schema},{title:String(t)}))))}),$De=e=>{const{data:{label:t,...n}}=e,r=N5(E=>E.flow.trigger),{actions:s}=c0(),{register:i,handleSubmit:o,setValue:a,getValues:c,formState:{isValid:u,errors:f},watch:h,control:m}=Za({resolver:el(ADe),defaultValues:{trigger:r},mode:"onChange"}),y=h("trigger");async function v(E){console.log("submit",E.trigger),await s.trigger.update(E.trigger)}async function x(E){console.log("change name",E),await s.flow.setName(E)}return p.jsxs(_5,{...e,tabs:MDe({data:y}),onChangeName:x,children:[p.jsxs("form",{onBlur:o(v),className:"flex flex-col gap-3",children:[p.jsxs("div",{className:"flex flex-row justify-between items-center",children:[p.jsx(oy,{label:"Trigger Type",defaultValue:"manual",data:[{label:"Manual",value:"manual"},{label:"HTTP",value:"http"},{label:"Event",value:"event",disabled:!0}],name:"trigger.type",control:m}),p.jsx(oy,{label:"Execution Mode",defaultValue:"async",data:[{label:"Async",value:"async"},{label:"Sync",value:"sync"}],name:"trigger.config.mode",control:m})]}),y.type==="manual"&&p.jsx(TDe,{}),y.type==="http"&&p.jsx(RDe,{form:{watch:h,register:i,setValue:a,getValues:c,control:m}})]}),p.jsx(cw,{type:"source",id:"trigger-out"})]})},TDe=()=>null,RDe=({form:e})=>p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[p.jsx(ja,{className:"w-36",label:"Method",data:["GET","POST","PATCH","PUT","DEL"],name:"trigger.config.method",control:e.control}),p.jsx(Nn,{className:"w-full",label:"Mapping Path",placeholder:"/trigger_http",classNames:{wrapper:"font-mono pt-px"},...e.register("trigger.config.path")})]}),p.jsx("div",{className:"flex flex-row gap-2 items-center",children:p.jsx(oy,{className:"w-full",label:"Response Type",defaultValue:"json",data:[{label:"JSON",value:"json"},{label:"HTML",value:"html"},{label:"Text",value:"text"}],name:"trigger.config.response_type",control:e.control})})]}),MDe=({data:e,...t})=>[{id:"json",label:"JSON",content:()=>p.jsx(ui,{json:e,expand:2,className:""})},{id:"test",label:"test",content:()=>p.jsx("div",{children:"test"})}],kDe={select:yDe,trigger:$De,task:jDe};function IDe(e){return p.jsx(hDe,{name:e.params.flow,children:p.jsx(OY,{children:p.jsx(DDe,{})})})}function DDe(){const e=w.useRef(null),[t,n]=w.useState(),r=c0();if(!r.data||!r.name)return"no flow";w.useEffect(()=>{var u,f;console.log("ref",(u=e.current)==null?void 0:u.getBoundingClientRect()),n((f=e.current)==null?void 0:f.getBoundingClientRect())},[]);const s=mDe(r.data,r.name),i=gDe(r.data);console.log("nodes",s),console.log("edges",i);const c={zoom:1,x:t!=null&&t.width?t.width*.1:0,y:t!=null&&t.height?t.height/2-260/2-50:0};return p.jsx("div",{className:"flex flex-col w-full h-full",ref:e,children:t&&p.jsxs(p.Fragment,{children:[p.jsx(aDe,{externalProvider:!0,backgroundStyle:"dots",nodes:s,edges:i,nodeTypes:kDe,nodeDragThreshold:0,fitView:!1,defaultViewport:c,nodesConnectable:!0,onDropNewNode:u=>({...u,type:"select",data:{label:""}}),onDropNewEdge:u=>({...u,style:{strokeWidth:2},markerEnd:{type:od.ArrowClosed,width:10,height:10}}),children:p.jsx(PDe,{})}),p.jsx(FDe,{})]})})}function PDe(){const e=N5(r=>dx(r,["name","dirty"])),[t]=$n(),{goBack:n}=Wxe(()=>t(ut.flows.flows.list()));return p.jsx(uDe,{minimap:!0,zoom:!0,children:p.jsxs(br,{position:"top-left",className:"gap-2 pr-6",children:[p.jsx(br.IconButton,{Icon:rT,round:!0,onClick:n}),p.jsxs(br.Text,{children:[e.name," ",e.dirty?"*":""]})]})})}const LDe=fAe("__dev_flow_debugger_tab",{tab:null}),FDe=()=>{var o;const[e,t]=yp(LDe),n=c0(),r=pDe();function s(a){t(c=>({...c,tab:c.tab===a?null:a}))}const i=((o=e.store)==null?void 0:o.expand)||3;return p.jsx("div",{className:"flex fixed left-5 bottom-5 z-20",children:p.jsxs(bn,{value:e.tab,onChange:s,children:[p.jsx("div",{className:"max-h-96 overflow-y-scroll bg-background/70",children:p.jsxs(bn.Panel,{value:"store",children:[p.jsxs("div",{className:"flex flex-row text-sm",children:[p.jsx(ui,{className:"max-w-96 break-all",title:"Context",json:{name:n.name,...n.data},expand:i}),p.jsx(ui,{className:"max-w-96 break-all",title:"State",json:{name:r.name,...r.flow},expand:i})]}),p.jsx($A,{className:"w-36",defaultValue:i,min:0,max:$L(r.flow??{}),onChange:qB(a=>t(c=>({...c,store:{...c.store,expand:a}})),250)})]})}),p.jsx(bn.List,{children:p.jsx(bn.Tab,{value:"store",children:"Store"})})]})})};function kY(){const{config:e,app:t,actions:n}=Tt(),r={flow:{create:async(s,i)=>{const o=Ln(aV,i,{skipMark:!0,forceParse:!0});await n.add("flows",`flows.${s}`,o)}}};return{flows:t.flows,config:e.flows,actions:r}}const BDe=Object.keys(sV),zDe=st({name:Zu,trigger:xe({enum:BDe}),mode:xe({enum:["async","sync"]})}),VDe=w.forwardRef(function(t,n){const[r,s]=w.useState([]);function i(){var o;(o=n==null?void 0:n.current)==null||o.close()}return p.jsx(OSe,{ref:n,size:"lg",children:p.jsx(KU,{path:r,lastBack:i,children:p.jsxs(xu,{id:"select",children:[p.jsx(vu,{path:["Create New Flow"],onClose:i}),p.jsx(UDe,{})]})})})});function UDe(){var y;const e=_w(),{actions:t}=kY(),{nextStep:n,stepBack:r,state:s,setState:i}=Ed(),{handleSubmit:o,watch:a,control:c,register:u,formState:{isValid:f,errors:h}}=Za({resolver:el(zDe),defaultValues:{name:"",trigger:"manual",mode:"async"},mode:"onSubmit"});async function m(v){console.log(v,f),t.flow.create(v.name,{trigger:{type:v.trigger,config:{mode:v.mode}}})}return console.log("errors",h),p.jsxs("form",{ref:e,onSubmit:o(m),children:[p.jsxs(wd,{className:"min-h-40",children:[p.jsx("div",{children:p.jsx(Nn,{"data-autofocus":!0,label:"Flow Name",placeholder:"Enter flow name",error:(y=h.name)==null?void 0:y.message,...u("name",{required:!0})})}),p.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[p.jsx(oy,{label:"Trigger Type",name:"trigger",data:[{label:"Manual",value:"manual"},{label:"HTTP",value:"http"},{label:"Event",value:"event"}],control:c}),p.jsx(oy,{label:"Execution mode",name:"mode",data:[{label:"Async",value:"async"},{label:"Sync",value:"sync"}],control:c})]}),p.jsx("pre",{children:JSON.stringify(a(),null,2)})]}),p.jsx(Sd,{next:{type:"submit",disabled:!f},nextLabel:"Create",prev:{onClick:r},prevLabel:"Cancel"})]})}function qDe(){const e=w.useRef(null),[t]=$n(),{flows:n}=kY();console.log("flows",n);const r=n.map(i=>{var o;return{flow:i.name,trigger:i.trigger.type,mode:i.trigger.config.mode,tasks:Object.keys(i.tasks).length,start_task:(o=i.startTask)==null?void 0:o.name}});function s(i){t(ut.flows.flows.edit(i.flow))}return p.jsxs(p.Fragment,{children:[p.jsx(VDe,{ref:e}),p.jsx(Wn,{right:p.jsx(ot,{variant:"primary",onClick:()=>{var i;return(i=e.current)==null?void 0:i.open()},children:"Create new"}),children:"All Flows"}),p.jsx(pr,{children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsx(J1,{data:r,renderValue:HDe,renderHeader:Cy,onClickRow:s})})})]})}const HDe=({value:e,property:t})=>["is_default","implicit_allow"].includes(t)?e?p.jsx("span",{children:"Yes"}):p.jsx("span",{className:"opacity-50",children:"No"}):t==="permissions"?[...e||[]].map((n,r)=>p.jsx("span",{className:"inline-block px-2 py-1.5 text-sm bg-primary/5 rounded font-mono leading-none",children:n},r)):p.jsx(X1,{value:e,property:t});function WDe(){return p.jsxs(Fa,{children:[p.jsx(lt,{path:"/flow/:flow",component:IDe}),p.jsx(E4e,{children:p.jsx(lt,{path:"/",component:qDe})})]})}function GDe({children:e}){const{app:t,config:n}=Tt(),r=!n.media.enabled;return as(["Media"]),p.jsxs(p.Fragment,{children:[p.jsxs(Hy,{children:[p.jsx(Wn,{right:p.jsx(jn,{href:t.getSettingsPath(["media"]),children:p.jsx(St,{Icon:fp})}),children:"Media"}),p.jsx(pr,{initialOffset:96,children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[p.jsxs(bs,{as:jn,href:"/",className:"flex flex-row justify-between",children:["Main Bucket"," ",r&&p.jsx(aT.Warning,{title:"Media not enabled.",className:"size-5"})]}),p.jsx(bs,{as:jn,href:"/settings",children:"Settings"})]})})})]}),p.jsx(qy,{children:e})]})}function YDe(){const{config:e}=Tt(),[,t]=yi();if(as(["Media"]),!e.media.enabled)return p.jsx(Vr,{Icon:RV,title:"Media not enabled",description:"Please enable media in the settings to continue.",primary:{children:"Manage Settings",onClick:()=>t("/settings")}});const n=r=>{vr.open(vr.ids.mediaInfo,{file:r})};return p.jsx(pr,{children:p.jsx("div",{className:"flex flex-1 p-3",children:p.jsx(WT.Dropzone,{onClick:n,infinite:!0,query:{sort:"-id"}})})})}function JDe(e){as(["Media","Settings"]);const{hasSecrets:t}=Tt({withSecrets:!0});return t?p.jsx(KDe,{...e}):p.jsx(Os.MissingPermission,{what:"Media Settings"})}const XDe={ignoreKeys:["entity_name","basepath"],options:{debug:qr(),keepEmpty:!0}};function KDe(){const{config:e,schema:t,actions:n}=VH(),r=JSON.parse(JSON.stringify(t));r.if={properties:{enabled:{const:!0}}},r.then={required:["adapter"]};async function s(i){console.log("submit",i),await n.config.patch(i)}return p.jsx(p.Fragment,{children:p.jsxs(s5,{schema:r,initialValues:e,onSubmit:s,...XDe,children:[p.jsx(r0,{selector:i=>({dirty:i.dirty,errors:i.errors.length>0,submitting:i.submitting}),children:({dirty:i,errors:o,submitting:a})=>p.jsx(Wn,{right:p.jsx(ot,{variant:"primary",type:"submit",disabled:!i||o||a,children:"Update"}),children:"Settings"})}),p.jsxs(pr,{children:[p.jsx(QDe,{}),p.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[p.jsx(Xi,{name:"enabled",inputProps:{"data-testId":MW.media.switchEnabled}}),p.jsxs("div",{className:"flex flex-col gap-3 relative",children:[p.jsx(L9,{}),p.jsx(Xi,{name:"storage.body_max_size",label:"Storage Body Max Size"})]})]}),p.jsx(SO,{}),p.jsxs("div",{className:"flex flex-col gap-3 p-3 relative",children:[p.jsx(L9,{}),p.jsx(ag.Root,{path:"adapter",children:p.jsx(tPe,{})})]}),p.jsx(rS,{})]})]})})}const QDe=()=>{const e=n0("",{strict:!0});return e.length===0?null:p.jsx(xo.Exception,{children:e.map((t,n)=>p.jsx("div",{children:t.message},n))})},ZDe={s3:lve,cloudinary:fve,local:Eve,r2:cve},ePe=({type:e})=>{var n;const t=(n=Object.entries(ZDe).find(([r])=>e.startsWith(r)))==null?void 0:n[1];return t?p.jsx(t,{}):null};function tPe(){var t;const e=ag.useContext();return p.jsxs(Ji,{children:[p.jsxs(Ao,{className:"flex flex-row items-center gap-1",children:[p.jsx("span",{className:"font-bold",children:"Media Adapter:"}),e.selected===null&&p.jsx("span",{className:"opacity-70",children:" (Choose one)"})]}),p.jsx("div",{className:"flex flex-row gap-1 mb-2",children:(t=e.schemas)==null?void 0:t.map((n,r)=>p.jsxs(ot,{onClick:()=>e.select(r),id:`adapter-${n.properties.type.const}`,variant:e.selected===r?"primary":"outline",className:Ue("flex flex-row items-center justify-center gap-3 border",e.selected===r&&"border-primary"),children:[p.jsx("div",{children:p.jsx(ePe,{type:n.properties.type.const})}),p.jsxs("div",{className:"flex flex-col items-start justify-center",children:[p.jsx("span",{children:wh(n.title)}),n.description&&p.jsx("span",{className:"text-xs opacity-70 text-left",children:n.description})]})]},r))}),e.selected!==null&&p.jsxs(Ji,{as:"fieldset",error:e.errors.length>0,children:[p.jsx(Ao,{as:"legend",className:"font-mono px-2",children:wh(e.selectedSchema.title)}),p.jsxs(i5,{schema:e.selectedSchema,prefix:e.path,children:[p.jsx(Xi,{name:"type",hidden:!0}),p.jsx(sS,{path:"config",wrapperProps:{label:!1,wrapper:"group"}})]})]})]})}const L9=()=>p.jsx(r0,{selector:e=>({enabled:e.data.enabled}),children:({enabled:e})=>!e&&p.jsx("div",{className:"absolute w-full h-full z-50 inset-0 bg-background opacity-90"})});function nPe(){return p.jsxs(GDe,{children:[p.jsx(lt,{path:"/",component:YDe}),p.jsx(lt,{path:"/settings",component:JDe})]})}function rPe(e,t){const n=w.useRef(!1),r=w.useRef(t);w.useEffect(()=>{if(!n.current||!sPe(r.current,t))return n.current=!0,r.current=t,e()},[t])}function sPe(e,t){return e&&e.length===0&&t.length===0||!e&&t.length===0?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>Object.is(n,t[r]))}const iPe=({children:e})=>{const{verify:t,user:n}=$V();return rPe(()=>{t()},[n==null?void 0:n.id]),p.jsxs(zU,{children:[p.jsx(U1e,{}),p.jsx(VU,{children:e})]})};function oPe(){const[e]=$n();return w.useEffect(()=>{e("/data")},[]),as(),p.jsx(Vr,{Icon:gve,title:"Not implemented yet",description:'Go checkout "Data" or "Media" for some action.'})}const Dm={jwt:{basepath:{"ui:options":{label:!1}},fields:{"ui:options":{orderable:!1}}},strategies:{additionalProperties:{"ui:widget":"select",type:{"ui:widget":"hidden"}},type:{"ui:widget":"hidden"}},roles:{"ui:options":{orderable:!1},permissions:{items:{"ui:widget":"checkboxes"},"ui:widget":"checkboxes"}}},aPe=({schema:e,config:t})=>{var o,a;const n=Tt(),r=E1(e),s=n.app.getAbsolutePath("settings");try{const c=t.entity_name??"users",u=n.config.data.entities??{};console.log("entities",u,c);const f=Object.entries(((o=u[c])==null?void 0:o.fields)??{}).map(([h,m])=>{var y;return(y=m.config)!=null&&y.virtual?void 0:h}).filter(Boolean);f.length>0&&(console.log("user_fields",f),r.properties.jwt.properties.fields.items.enum=f,r.properties.jwt.properties.fields.uniqueItems=!0,Dm.jwt.fields["ui:widget"]="checkboxes")}catch{}console.log("_s",n);const i=((a=r.properties.roles)==null?void 0:a.additionalProperties)??{type:"object"};return n.permissions&&(i.properties.permissions.items.enum=n.permissions,i.properties.permissions.uniqueItems=!0),p.jsx(lt,{path:"/auth",nest:!0,children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/roles/:role",component:({params:{role:c}})=>{var u;return p.jsx(Qr,{schema:i,uiSchema:Dm.roles,config:(u=t.roles)==null?void 0:u[c],path:["auth","roles",c],prefix:`${s}/auth/roles/${c}`})},nest:!0}),p.jsx(lt,{path:"/strategies/:strategy",component:({params:{strategy:c}})=>{var m,y;const u=(m=t.strategies)==null?void 0:m[c],f=r.properties.strategies.additionalProperties,h=f.anyOf.find(v=>v.properties.type.const===(u==null?void 0:u.type));return p.jsx(Qr,{schema:h??f,config:(y=t.strategies)==null?void 0:y[c],path:["auth","strategies",c],prefix:`${s}/auth/strategies/${c}`})},nest:!0}),p.jsx(lt,{path:"/",component:()=>p.jsx(Qr,{schema:r,uiSchema:Dm,config:t,options:{showAlert:c=>{if(!c.enabled)return"Auth is disabled. Enable it by toggling the switch below. Please also make sure set a secure secret to sign JWT tokens."},reloadOnSave:!0},properties:{strategies:{extract:!0,tableValues:c=>Object.values(sn(c,(u,f)=>({key:f,type:u.type}))),new:{schema:r.properties.strategies.additionalProperties,uiSchema:Dm.strategies,generateKey:c=>{var u;return c.type==="password"?"password":((u=c.config.name)==null?void 0:u.toLowerCase())||""}}},roles:{extract:!0,new:{schema:i,uiSchema:Dm.roles}}},prefix:`${s}/auth`,path:["auth"]}),nest:!0})]})})},lPe={jwt:{basepath:{"ui:options":{label:!1}},fields:{"ui:options":{orderable:!1}}},strategies:{additionalProperties:{"ui:widget":"select",type:{"ui:widget":"hidden"}},type:{"ui:widget":"hidden"}}},cPe=({schema:e,config:t})=>{const{app:n}=Tt(),r=n.getAbsolutePath("settings");function s(i,o,a){const c=Object.keys(o.tasks??{});c.length!==0&&(i.properties&&a in i.properties&&(i.properties[a].enum=c),"anyOf"in i&&i.anyOf.forEach(u=>s(u,o,a)))}return p.jsx(lt,{path:"/flows",nest:!0,children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/flows/:flow/connections/:connection",component:({params:{flow:i,connection:o}})=>{var f,h,m,y;const a=(f=t.flows)==null?void 0:f[i],c=(y=(m=(h=t.flows)==null?void 0:h[i])==null?void 0:m.connections)==null?void 0:y[o],u=e.properties.flows.additionalProperties.properties.connections.additionalProperties;return s(u,a,"source"),s(u,a,"target"),p.jsx(Qr,{schema:u,config:c,path:["flows","flows",i,"connections",o],prefix:`${r}/flows/flows/${i}/connections/${o}`})},nest:!0}),p.jsx(lt,{path:"/flows/:flow/tasks/:task",component:({params:{flow:i,task:o}})=>{var f,h,m;const a=(m=(h=(f=t.flows)==null?void 0:f[i])==null?void 0:h.tasks)==null?void 0:m[o],u=e.properties.flows.additionalProperties.properties.tasks.additionalProperties.anyOf.find(y=>y.properties.type.const===(a==null?void 0:a.type));return p.jsx(Qr,{schema:u,config:a,path:["flows","flows",i,"tasks",o],prefix:`${r}/flows/flows/${i}/tasks/${o}`,uiSchema:{params:{render:{"ui:field":"HtmlField"}}}})},nest:!0}),p.jsx(lt,{path:"/flows/:flow",component:({params:{flow:i}})=>{var f;const o=(f=t.flows)==null?void 0:f[i],a=e.properties.flows.additionalProperties,c=a.properties.tasks.additionalProperties,u=a.properties.connections.additionalProperties;return s(a,o,"start_task"),s(a,o,"responding_task"),s(u,o,"source"),s(u,o,"target"),p.jsx(Qr,{schema:a,config:o,path:["flows","flows",i],prefix:`${r}/flows/flows/${i}`,properties:{tasks:{extract:!0,new:{schema:c},tableValues:h=>Zs(h,(m,y,v)=>{m.push({name:v,type:y.type})},[])},connections:{extract:!0,new:{schema:u,generateKey:crypto.randomUUID()},tableValues:h=>Zs(h,(m,y,v)=>{var x;m.push({id:v,source:y.source,target:y.target,condition:(x=y.config.condition)==null?void 0:x.type})},[])}}})},nest:!0}),p.jsx(lt,{path:"/",component:()=>p.jsx(Qr,{schema:e,uiSchema:lPe,config:t,properties:{flows:{extract:!0,new:{schema:e.properties.flows.additionalProperties},tableValues:i=>Zs(i,(o,a,c)=>{o.push({name:c,trigger:a.trigger.type,mode:a.trigger.config.mode,start_task:a.start_task,responding_task:a.responding_task})},[])}},prefix:`${r}/flows`,path:["flows"]}),nest:!0})]})})},uPe={cors:{allow_methods:{"ui:widget":"checkboxes"},allow_headers:{"ui:options":{orderable:!1}}}},dPe=({schema:e,config:t})=>{const{app:n}=Tt(),r=E1(e),s=n.getAbsolutePath("settings"),i=r;return p.jsx(lt,{path:"/server",nest:!0,children:p.jsx(lt,{path:"/",component:()=>p.jsx(Qr,{schema:i,uiSchema:uPe,config:t,prefix:`${s}/server`,path:["server"]}),nest:!0})})};function fPe(){const{version:e,schema:t,actions:n,app:r}=Tt();as(["Settings"]);async function s(){await n.reload()}const i=Object.keys(t).map(o=>({title:t[o].title??ii(o),key:o}));return p.jsxs(Hy,{children:[p.jsx(Wn,{right:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("span",{className:"font-mono leading-none",children:["v",e]}),p.jsx(St,{Icon:Sve,onClick:s})]}),children:"Settings"}),p.jsx(pr,{initialOffset:96,children:p.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:p.jsx("nav",{className:"flex flex-col flex-1 gap-1",children:i.map((o,a)=>p.jsx(bs,{as:jn,href:`/${o.key}`,children:o.title},a))})})})]})}function hPe(){return Tt({withSecrets:!0}).hasSecrets?p.jsxs(p.Fragment,{children:[p.jsx(fPe,{}),p.jsx(qy,{children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/",component:()=>p.jsx(Vr,{Icon:Fg,title:"No Setting selected",description:"Please select a setting from the left sidebar."})}),p.jsx(mPe,{}),p.jsx(lt,{path:"*",component:()=>p.jsx(Vr,{Icon:Fg,title:"Settings not found",description:"Check other options."})})]})})]}):p.jsx(Os.MissingPermission,{what:"the settings"})}const pPe={media:{adapter:{"ui:options":{label:!1}}}},mPe=()=>{const{schema:e,config:t}=Tt();return console.log("flows",{schema:e.flows,config:t.flows}),p.jsxs(p.Fragment,{children:[p.jsx(dPe,{schema:e.server,config:t.server}),p.jsx(DOe,{schema:e.data,config:t.data}),p.jsx(aPe,{schema:e.auth,config:t.auth}),p.jsx(gPe,{module:"media",schema:e,config:t,uiSchema:pPe.media,options:{reloadOnSave:!0}}),p.jsx(cPe,{schema:e.flows,config:t.flows})]})},gPe=({module:e,schema:t,config:n,...r})=>{const{app:s}=Tt(),i=s.getAbsolutePath("settings");return p.jsx(lt,{path:e,nest:!0,children:p.jsx(Fa,{children:p.jsx(lt,{path:"/",component:()=>p.jsx(Qr,{...r,schema:t[e],config:n[e],prefix:`${i}/${e}`,path:[e]}),nest:!0})})})};function yPe(){const[e,t]=w.useState();if(w.useEffect(()=>{if(!e){const n=eye();n&&t(n)}},[]),e){let n=xo.Info;switch(e.type){case"error":n=xo.Exception;break;case"success":n=xo.Success;break;case"warning":n=xo.Warning;break}return p.jsx(n,{message:e.message,className:"justify-center"})}return null}function bPe(){return as(["Register"]),p.jsx(DH.Screen,{action:"register",logo:p.jsx(jn,{href:"/",className:"link",children:p.jsx(I1,{scale:.25})})})}const vPe=w.lazy(()=>Wy(()=>import("./index-BK2vhgNc.js"),__vite__mapDeps([2,1])));function xPe({BkndWrapper:e,basePath:t=""}){const{theme:n}=Dc(),r=A1(),s=t||r.admin_basepath;return p.jsxs("div",{id:"bknd-admin",className:n+" antialiased",children:[p.jsx(yPe,{}),p.jsx(KV,{base:s,children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/auth/login",component:C5e}),p.jsx(lt,{path:"/auth/register",component:bPe}),p.jsx(e,{children:p.jsx(ZTe,{children:p.jsx(lt,{path:"/",nest:!0,children:p.jsx(iPe,{children:p.jsxs(Fa,{children:[p.jsx(lt,{path:"/test*",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(vPe,{})})}),p.jsx(lt,{path:"/",component:oPe}),p.jsx(lt,{path:"/data",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(S4e,{})})}),p.jsx(lt,{path:"/flows",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(WDe,{})})}),p.jsx(lt,{path:"/auth",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(_5e,{})})}),p.jsx(lt,{path:"/media",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(nPe,{})})}),p.jsx(lt,{path:"/settings",nest:!0,children:p.jsx(w.Suspense,{fallback:null,children:p.jsx(hPe,{})})}),p.jsx(lt,{path:"*",component:wPe})]})})})})})]})})]})}function wPe(){return p.jsx("div",{className:"flex w-full items-center justify-center",children:p.jsxs("p",{className:"text-2xl font-mono",children:[p.jsx("span",{className:"font-bold",children:"404"}),p.jsx("span",{className:"opacity-50",children:", Sorry :)"})]})})}function SPe({baseUrl:e,withProvider:t=!1,config:n={}}){const{theme:r}=Dc(),s=({children:a})=>t?p.jsx(gbe,{baseUrl:e,...typeof t=="object"?t:{},children:a}):a,i={...n,...A1()},o=({children:a})=>p.jsx(Gxe,{options:i,fallback:p.jsx(EPe,{theme:i==null?void 0:i.theme}),children:a});return p.jsx(s,{children:p.jsxs(_8,{...Y1e(r),children:[p.jsx(Mo,{position:"top-right"}),p.jsx(xPe,{BkndWrapper:o,basePath:i==null?void 0:i.basepath})]})})}const EPe=({theme:e})=>{const t=Dc(),n=e&&["dark","light"].includes(e)?e:t.theme;return p.jsx("div",{id:"bknd-admin",className:n+" antialiased",children:p.jsxs(zU,{children:[p.jsxs("header",{"data-shell":"header",className:"flex flex-row w-full h-16 gap-2.5 border-muted border-b justify-start bg-muted/10",children:[p.jsx("div",{className:"max-h-full flex hover:bg-primary/5 link p-2.5 w-[134px] outline-none",children:p.jsx(I1,{theme:n})}),p.jsx("nav",{className:"hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center",children:[...new Array(4)].map((r,s)=>p.jsx(tg,{as:"span",className:"active h-full opacity-50",children:p.jsx("div",{className:"w-18 h-3"})},s))}),p.jsx("nav",{className:"flex md:hidden flex-row gap-2.5 pl-0 p-2.5 items-center",children:p.jsx(tg,{as:"span",className:"active h-full opacity-50",children:p.jsx("div",{className:"w-20 h-3"})})}),p.jsx("div",{className:"flex flex-grow"}),p.jsx("div",{className:"hidden lg:flex flex-row items-center px-4 gap-2 opacity-50",children:p.jsx("div",{className:"size-11 rounded-full bg-primary/10"})})]}),p.jsx(VU,{children:p.jsx("div",{className:"flex flex-col w-full h-full justify-center items-center"})})]})})};function F9(){JX.createRoot(document.getElementById("root")).render(p.jsx(w.StrictMode,{children:p.jsx(SPe,{withProvider:!0})}))}"startViewTransition"in document?document.startViewTransition(F9):F9();export{s5 as $,G0e as A,oS as B,Cve as C,Ur as D,bDe as E,j$ as F,Ji as G,Kw as H,St as I,ui as J,Nn as K,Ao as L,x8 as M,cje as N,cp as O,DA as P,kt as Q,k5e as R,Wn as S,Lc as T,g8 as U,kV as V,wve as W,q$ as X,lv as Y,s1e as Z,Tt as _,_j as a,Nh as a$,AH as a0,CDe as a1,Ku as a2,vc as a3,Wa as a4,$s as a5,ud as a6,Za as a7,el as a8,Qe as a9,os as aA,lB as aB,dB as aC,p1 as aD,Jfe as aE,Xfe as aF,lp as aG,pN as aH,Ag as aI,Lm as aJ,E1 as aK,EB as aL,Pie as aM,Ch as aN,FU as aO,BU as aP,c1e as aQ,a1e as aR,Cy as aS,Gl as aT,ik as aU,y1 as aV,Eme as aW,s$ as aX,xB as aY,jo as aZ,gd as a_,xe as aa,kIe as ab,QCe as ac,pve as ad,MCe as ae,vOe as af,xo as ag,BPe as ah,lt as ai,Vr as aj,Hy as ak,bs as al,jn as am,qy as an,J$ as ao,Ki as ap,iy as aq,rt as ar,LPe as as,PPe as at,Dc as au,od as av,OY as aw,aDe as ax,uDe as ay,UB as az,V$ as b,b1 as b0,Cg as b1,ki as b2,l$ as b3,hfe as b4,N1 as b5,Ode as b6,zB as b7,wme as b8,Ade as b9,MC as ba,zpe as bb,ux as bc,Ppe as bd,Nde as be,jme as bf,_Pe as bg,Zs as bh,Sr as bi,gA as bj,vh as bk,ot as c,Fg as d,U$ as e,ive as f,dve as g,uve as h,TOe as i,p as j,Bc as k,pr as l,$1 as m,z_ as n,Qbe as o,T1 as p,eve as q,w as r,Ln as s,Ue as t,YK as u,hp as v,Gh as w,$H as x,WT as y,gc as z};