@membank/dashboard 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/bin.mjs +176 -0
- package/dist/client/assets/{MagnifyingGlass.es-CGxS0MwI.js → MagnifyingGlass.es-ERvQA8v5.js} +1 -1
- package/dist/client/assets/{index-DZxM00o8.js → index-BCPCyhdz.js} +2 -2
- package/dist/client/assets/index-ByUTKMgP.css +1 -0
- package/dist/client/assets/{memories-ja38P73o.js → memories-C4n5opTn.js} +1 -1
- package/dist/client/assets/{memories._id-DeaZiiQb.js → memories._id-CrT5UPVk.js} +1 -1
- package/dist/client/assets/{memories.index-DUtHo-Be.js → memories.index-Bg5p8A21.js} +1 -1
- package/dist/client/assets/{native-select-BpuM7pgJ.js → native-select-Boj2GMjk.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/index.cjs +37 -115
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +38 -116
- package/package.json +10 -3
- package/dist/client/assets/index-GVEqDPxR.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var qe=e=>{throw TypeError(e)};var He=(e,t,i)=>t.has(e)||qe("Cannot "+i);var S=(e,t,i)=>(He(e,t,"read from private field"),i?i.call(e):t.get(e)),N=(e,t,i)=>t.has(e)?qe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),P=(e,t,i,r)=>(He(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var Ge=(e,t,i,r)=>({set _(u){P(e,t,u,i)},get _(){return S(e,t,r)}});import{V as lt,W as ut,a as Mt,r as V,X as W,j as g,b as Q,Y as St,l as Ue,e as Z,x as xt,n as We,J as Ft,o as wt,Z as Vt,H as ue,_ as Et,M as At,O as Qe,P as dt,$ as jt,Q as It,a0 as Lt,a1 as ke,a2 as Ye,a3 as Ct,a4 as kt,D as ve,C as se,a5 as Je,S as ct,G as Tt,F as Ot,a6 as Pt,a7 as Xe,a8 as Bt,a9 as Nt}from"./index-DZxM00o8.js";import{v as Rt,k as Dt,q as _t,w as $t,d as ht,j as Ut,T as Ze,m as ft,e as Wt,A as $,b as Kt,x as zt,l as qt,N as et,s as Te,I as Ht}from"./native-select-BpuM7pgJ.js";class Gt{constructor(t){this.atom=lt(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ut(t))}}class Qt{constructor(t){this.atom=lt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ut(t))}}function Fe(e){return typeof e=="function"?new Qt(e):new Gt(e)}function Yt(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const i=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>i&&r!==void 0?await r():i,enableBeforeUnload:i,withResolver:r===void 0}}function Jt(e,t){const{shouldBlockFn:i,enableBeforeUnload:r=!0,disabled:u=!1,withResolver:f=!1}=Yt(e),s=Mt(),{history:n}=s,[c,d]=V.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return V.useEffect(()=>{const l=async o=>{function h(b){const x=s.parseLocation(b),p=s.getMatchedRoutes(x.pathname);return p.foundRoute===void 0?{routeId:"__notFound__",fullPath:x.pathname,pathname:x.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}:{routeId:p.foundRoute.id,fullPath:p.foundRoute.fullPath,pathname:x.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}}const a=h(o.currentLocation),m=h(o.nextLocation);if(a.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const v=await i({action:o.action,current:a,next:m});if(!f)return v;if(!v)return!1;const M=await new Promise(b=>{d({status:"blocked",current:a,next:m,action:o.action,proceed:()=>b(!1),reset:()=>b(!0)})});return d({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),M};return u?void 0:n.block({blockerFn:l,enableBeforeUnload:r})},[i,r,u,f,n,s]),c}var Xt=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...i)=>{const r=Date.now()-this.lastExecutionTime;if(this.options.leading&&r>=this.options.wait)this.execute(...i);else if(this.lastArgs=i,!this.timeoutId&&this.options.trailing){const u=this.options.wait-r;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},u)}},this.execute=(...i)=>{var r,u;this.fn(...i),(u=(r=this.options).onExecute)==null||u.call(r,i,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Zt(e,t){return new Xt(e,t).maybeExecute}var J,_,R,fe,q,te,H,re,me,Ae,X,oe,G,ge,le,je;class es{constructor({pluginId:t,debug:i=!1,enabled:r=!0,reconnectEveryMs:u=300}){N(this,J,!0);N(this,_);N(this,R);N(this,fe);N(this,q);N(this,te);N(this,H);N(this,re);N(this,me,0);N(this,Ae,5);N(this,X,!1);N(this,oe,!1);N(this,G,null);N(this,ge,()=>{this.debugLog("Connected to event bus"),P(this,te,!0),P(this,X,!1),this.debugLog("Emitting queued events",S(this,q)),S(this,q).forEach(t=>this.emitEventToBus(t)),P(this,q,[]),this.stopConnectLoop(),S(this,R).call(this).removeEventListener("tanstack-connect-success",S(this,ge))});N(this,le,()=>{if(S(this,me)<S(this,Ae)){Ge(this,me)._++,this.dispatchCustomEvent("tanstack-connect",{});return}S(this,R).call(this).removeEventListener("tanstack-connect",S(this,le)),P(this,oe,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,je,()=>{S(this,X)||(P(this,X,!0),S(this,R).call(this).addEventListener("tanstack-connect-success",S(this,ge)),S(this,le).call(this))});P(this,_,t),P(this,J,r),P(this,R,this.getGlobalTarget),P(this,fe,i),this.debugLog(" Initializing event subscription for plugin",S(this,_)),P(this,q,[]),P(this,te,!1),P(this,oe,!1),P(this,H,null),P(this,re,u)}startConnectLoop(){S(this,H)!==null||S(this,te)||(this.debugLog(`Starting connect loop (every ${S(this,re)}ms)`),P(this,H,setInterval(S(this,le),S(this,re))))}stopConnectLoop(){P(this,X,!1),S(this,H)!==null&&(clearInterval(S(this,H)),P(this,H,null),P(this,q,[]),this.debugLog("Stopped connect loop"))}debugLog(...t){S(this,fe)&&console.log(`🌴 [tanstack-devtools:${S(this,_)}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return S(this,_)}dispatchCustomEventShim(t,i){try{const r=new Event(t,{detail:i});S(this,R).call(this).dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,i){try{S(this,R).call(this).dispatchEvent(new CustomEvent(t,{detail:i}))}catch{this.dispatchCustomEventShim(t,i)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,i){return{type:`${S(this,_)}:${t}`,payload:i,pluginId:S(this,_)}}emit(t,i){if(!S(this,J)){this.debugLog("Event bus client is disabled, not emitting event",t,i);return}if(S(this,G)&&(this.debugLog("Emitting event to internal event target",t,i),S(this,G).dispatchEvent(new CustomEvent(`${S(this,_)}:${t}`,{detail:this.createEventPayload(t,i)}))),S(this,oe)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!S(this,te)){this.debugLog("Bus not available, will be pushed as soon as connected"),S(this,q).push(this.createEventPayload(t,i)),typeof CustomEvent<"u"&&!S(this,X)&&(S(this,je).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,i))}on(t,i,r){const u=(r==null?void 0:r.withEventTarget)??!1,f=`${S(this,_)}:${t}`;if(u&&(S(this,G)||P(this,G,new EventTarget),S(this,G).addEventListener(f,n=>{i(n.detail)})),!S(this,J))return this.debugLog("Event bus client is disabled, not registering event",f),()=>{};const s=n=>{this.debugLog("Received event from bus",n.detail),i(n.detail)};return S(this,R).call(this).addEventListener(f,s),this.debugLog("Registered event to bus",f),()=>{var n;u&&((n=S(this,G))==null||n.removeEventListener(f,s)),S(this,R).call(this).removeEventListener(f,s)}}onAll(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;t(u)};return S(this,R).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,R).call(this).removeEventListener("tanstack-devtools-global",i)}onAllPluginEvents(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;S(this,_)&&u.pluginId!==S(this,_)||t(u)};return S(this,R).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,R).call(this).removeEventListener("tanstack-devtools-global",i)}}J=new WeakMap,_=new WeakMap,R=new WeakMap,fe=new WeakMap,q=new WeakMap,te=new WeakMap,H=new WeakMap,re=new WeakMap,me=new WeakMap,Ae=new WeakMap,X=new WeakMap,oe=new WeakMap,G=new WeakMap,ge=new WeakMap,le=new WeakMap,je=new WeakMap;class ts extends es{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const U=new ts;function Ie(e,t){return typeof e=="function"?e(t):e}function be(e,t){return Ke(t).reduce((r,u)=>{if(r===null)return null;if(typeof r<"u")return r[u]},e)}function pe(e,t,i){const r=Ke(t);function u(f){if(!r.length)return Ie(i,f);const s=r.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(f))return typeof f=="object"?(f===null&&(f={}),{...f,[s]:u(f[s])}):{[s]:u()};if(Array.isArray(f)&&typeof s=="number"){const n=f.slice(0,s);return[...n.length?n:new Array(s),u(f[s]),...f.slice(s+1)]}return[...new Array(s),u()]}return u(e)}function ss(e,t){const i=Ke(t);function r(u){if(!u)return;if(i.length===1){const s=i[0];if(Array.isArray(u)&&typeof s=="number")return u.filter((d,l)=>l!==s);const{[s]:n,...c}=u;return c}const f=i.shift();if((typeof f=="string"||typeof f=="number"&&!Array.isArray(u))&&typeof u=="object")return{...u,[f]:r(u[f])};if(typeof f=="number"&&Array.isArray(u)){if(f>=u.length)return u;const s=u.slice(0,f);return[...s.length?s:new Array(f),r(u[f]),...u.slice(f+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const is=/^(\d+)$/gm,ns=/\.(\d+)(?=\.)/gm,as=/^(\d+)\./gm,rs=/\.(\d+$)/gm,os=/\.{2,}/gm,De="__int__",ye=`${De}$1`;function Ke(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(is,ye).replace(ns,`.${ye}.`).replace(as,`${ye}.`).replace(rs,`.${ye}`).replace(os,".").split(".").map(t=>{if(t.startsWith(De)){const i=t.substring(De.length),r=parseInt(i,10);return String(r)===i?r:i}return t})}function ls(e){return!(Array.isArray(e)&&e.length===0)}function _e(e,t){const i=r=>r.validators.filter(Boolean).map(u=>({cause:u.cause,validate:u.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:i})}function $e(e,t){const{asyncDebounceMs:i}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:u,onDynamicAsyncDebounceMs:f}=t.validators||{},s=i??0,n=c=>c.validators.filter(Boolean).map(d=>{const l=(d==null?void 0:d.cause)||e;let o=s;switch(l){case"change":o=u??s;break;case"blur":o=r??s;break;case"dynamic":o=f??s;break;case"submit":o=0;break}return e==="submit"&&(o=0),{cause:l,validate:d.fn,debounceMs:o}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:n})}const we=e=>!!e&&typeof e=="object"&&"fields"in e;function Y(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 Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[u,f]of e)if(!t.has(u)||!Object.is(f,t.get(u)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const u of e)if(!t.has(u))return!1;return!0}const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(const u of i)if(!r.includes(u)||!Y(e[u],t[u]))return!1;return!0}const tt=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:i})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:i?{newErrorValue:i,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},st=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function D(e,t){return e==null?t:{...e,...t}}let ee=256;const Ve=[];let Me;for(;ee--;)Ve[ee]=(ee+256).toString(16).substring(1);function mt(){let e=0,t,i="";if(!Me||ee+16>256){for(Me=new Array(256),e=256;e--;)Me[e]=256*Math.random()|0;e=0,ee=0}for(;e<16;e++)t=Me[ee+e],e===6?i+=Ve[t&15|64]:e===8?i+=Ve[t&63|128]:i+=Ve[t],e&1&&e>1&&e<11&&(i+="-");return ee++,i}const us=Zt(e=>U.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300});function ce(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){const i=[];for(let r=0;r<e.length;r++)i[r]=ce(e[r]);return i}if(e instanceof Map){const i=new Map;return e.forEach((r,u)=>{i.set(u,ce(r))}),i}if(e instanceof Set){const i=new Set;return e.forEach(r=>{i.add(ce(r))}),i}const t={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ce(e[i]));return t}const ie=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const t=e.event.async,i=t?void 0:{fn:e.validators.onMount,cause:"mount"},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},u={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},f={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},s=t?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[i],form:e.form});case"submit":return e.runValidation({validators:[r,u,f,s],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[u,s],form:e.form});case"change":return e.runValidation({validators:[r,s],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function ds(e,t){const i=new Map;for(const r of e){const u=r.path??[];let f=t,s="";for(let n=0;n<u.length;n++){const c=u[n];if(c===void 0)continue;const d=typeof c=="object"?c.key:c,l=Number(d);Array.isArray(f)&&!Number.isNaN(l)?s+=`[${l}]`:s+=(n>0?".":"")+String(d),typeof f=="object"&&f!==null?f=f[d]:f=void 0}i.set(s,(i.get(s)??[]).concat(r))}return Object.fromEntries(i)}const it=(e,t)=>{const i=ds(e,t);return{form:i,fields:i}},ae={validate({value:e,validationSource:t},i){const r=i["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return t==="field"?r.issues:it(r.issues,e)},async validateAsync({value:e,validationSource:t},i){const r=await i["~standard"].validate(e);if(r.issues)return t==="field"?r.issues:it(r.issues,e)}},gt=e=>!!e&&"~standard"in e,K={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Se(e){function t(l,o,h){const a=s(l,o,"move",h),m=Math.min(o,h),v=Math.max(o,h);for(let b=m;b<=v;b++)a.push(f(l,b));const M=Object.keys(e.fieldInfo).reduce((b,x)=>(x.startsWith(f(l,o))&&b.set(x,e.getFieldMeta(x)),b),new Map);c(a,o<h?"up":"down"),Object.keys(e.fieldInfo).filter(b=>b.startsWith(f(l,h))).forEach(b=>{const x=b.replace(f(l,h),f(l,o)),p=M.get(x);p&&e.setFieldMeta(b,p)})}function i(l,o){const h=s(l,o,"remove");c(h,"up")}function r(l,o,h){s(l,o,"swap",h).forEach(m=>{if(!m.toString().startsWith(f(l,o)))return;const v=m.toString().replace(f(l,o),f(l,h)),[M,b]=[e.getFieldMeta(m),e.getFieldMeta(v)];M&&e.setFieldMeta(v,M),b&&e.setFieldMeta(m,b)})}function u(l,o){const h=s(l,o,"insert");c(h,"down"),h.forEach(a=>{a.toString().startsWith(f(l,o))&&e.setFieldMeta(a,d())})}function f(l,o){return`${l}[${o}]`}function s(l,o,h,a){const m=[f(l,o)];switch(h){case"swap":m.push(f(l,a));break;case"move":{const[v,M]=[Math.min(o,a),Math.max(o,a)];for(let b=v;b<=M;b++)m.push(f(l,b));break}default:{const v=e.getFieldValue(l),M=Array.isArray(v)?v.length:0;for(let b=o+1;b<M;b++)m.push(f(l,b));break}}return Object.keys(e.fieldInfo).filter(v=>m.some(M=>v.startsWith(M)))}function n(l,o){return l.replace(/\[(\d+)\]/,(h,a)=>{const m=parseInt(a,10);return`[${o==="up"?m+1:Math.max(0,m-1)}]`})}function c(l,o){(o==="up"?l:[...l].reverse()).forEach(a=>{const m=n(a.toString(),o),v=e.getFieldMeta(m);v?e.setFieldMeta(a,v):e.setFieldMeta(a,d())})}const d=()=>K;return{handleArrayMove:t,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:u}}function Oe(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,onDynamic:void 0}}}class nt{constructor(t){var f;this.options={},this.fieldInfo={},this.mount=()=>{var h,a;const s=this.store.subscribe(()=>{us(this)}),n=U.on("request-form-state",m=>{m.payload.id===this._formId&&U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),c=U.on("request-form-reset",m=>{m.payload.id===this._formId&&this.reset()}),d=U.on("request-form-force-submit",m=>{m.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),l=()=>{d(),c(),n(),s.unsubscribe(),U.emit("form-unmounted",{id:this._formId})};(a=(h=this.options.listeners)==null?void 0:h.onMount)==null||a.call(h,{formApi:this});const{onMount:o}=this.options.validators||{};return U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),l},this.update=s=>{if(!s)return;const n=this.options;this.options=s;const c=s.defaultValues&&!Y(s.defaultValues,n.defaultValues)&&!this.state.isTouched,d=!Y(s.defaultState,n.defaultState)&&!this.state.isTouched;!c&&!d||(W(()=>{this.baseStore.setState(()=>Oe(Object.assign({},this.state,d?s.defaultState:{},c?{values:s.defaultValues}:{})))}),U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(s,n)=>{const{fieldMeta:c}=this.state,d=this.resetFieldMeta(c);s&&!(n!=null&&n.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var l;return Oe({...this.options.defaultState,values:s??this.options.defaultValues??((l=this.options.defaultState)==null?void 0:l.values),fieldMetaBase:d})})},this.validateAllFields=async s=>{const n=[];return W(()=>{Object.values(this.fieldInfo).forEach(d=>{if(!d.instance)return;const l=d.instance;n.push(Promise.resolve().then(()=>l.validate(s,{skipFormValidation:!0}))),d.instance.state.meta.isTouched||d.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(n)).flat()},this.validateArrayFieldsStartingFrom=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null,o=[`${s}[${n}]`];for(let v=n+1;v<=(l??0);v++)o.push(`${s}[${v}]`);const h=Object.keys(this.fieldInfo).filter(v=>o.some(M=>v.startsWith(M))),a=[];return W(()=>{h.forEach(v=>{a.push(Promise.resolve().then(()=>this.validateField(v,c)))})}),(await Promise.all(a)).flat()},this.validateField=(s,n)=>{var d,l;const c=(d=this.fieldInfo[s])==null?void 0:d.instance;if(!c){const{hasErrored:o}=this.validateSync(n);return o&&!this.options.asyncAlways?((l=this.getFieldMeta(s))==null?void 0:l.errors)??[]:this.validateAsync(n).then(()=>{var h;return((h=this.getFieldMeta(s))==null?void 0:h.errors)??[]})}return c.state.meta.isTouched||c.setMeta(o=>({...o,isTouched:!0})),c.validate(n)},this.validateSync=s=>{const n=_e(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});let c=!1;const d={};return W(()=>{var h,a,m;for(const v of n){if(!v.validate)continue;const M=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:b,fieldErrors:x}=Ee(M),p=de(v.cause),E=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(x||{})]);for(const F of E){if(this.baseStore.state.fieldMetaBase[F]===void 0&&!(x!=null&&x[F]))continue;const k=this.getFieldMeta(F)??K,{errorMap:A,errorSourceMap:O}=k,C=x==null?void 0:x[F],{newErrorValue:B,newSource:L}=tt({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[p])==="form",previousErrorValue:A==null?void 0:A[p]});L==="form"&&(d[F]={...d[F],[p]:C}),(A==null?void 0:A[p])!==B&&this.setFieldMeta(F,(y=K)=>({...y,errorMap:{...y.errorMap,[p]:B},errorSourceMap:{...y.errorSourceMap,[p]:L}}))}((h=this.state.errorMap)==null?void 0:h[p])!==b&&this.baseStore.setState(F=>({...F,errorMap:{...F.errorMap,[p]:b}})),(b||x)&&(c=!0)}const l=de("submit");(a=this.state.errorMap)!=null&&a[l]&&s!=="submit"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[l]:void 0}}));const o=de("server");(m=this.state.errorMap)!=null&&m[o]&&s!=="server"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}))}),{hasErrored:c,fieldsErrorMap:d}},this.validateAsync=async s=>{const n=$e(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});this.state.isFormValidating||this.baseStore.setState(h=>({...h,isFormValidating:!0}));const c=[];let d;for(const h of n){if(!h.validate)continue;const a=de(h.cause),m=this.state.validationMetaMap[a];m==null||m.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[a]={lastAbortController:v},c.push(new Promise(async M=>{let b;try{b=await new Promise((F,k)=>{setTimeout(async()=>{if(v.signal.aborted)return F(void 0);try{F(await this.runValidator({validate:h.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(A){k(A)}},h.debounceMs)})}catch(F){b=F}const{formError:x,fieldErrors:p}=Ee(b);p&&(d=d?{...d,...p}:p);const E=de(h.cause);for(const F of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[F]===void 0)continue;const k=this.getFieldMeta(F);if(!k)continue;const{errorMap:A,errorSourceMap:O}=k,C=d==null?void 0:d[F],{newErrorValue:B,newSource:L}=tt({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[E])==="form",previousErrorValue:A==null?void 0:A[E]});(A==null?void 0:A[E])!==B&&this.setFieldMeta(F,y=>({...y,errorMap:{...y.errorMap,[E]:B},errorSourceMap:{...y.errorSourceMap,[E]:L}}))}this.baseStore.setState(F=>({...F,errorMap:{...F.errorMap,[E]:x}})),M(d?{fieldErrors:d,errorMapKey:E}:void 0)}))}let l=[];const o={};if(c.length){l=await Promise.all(c);for(const h of l)if(h!=null&&h.fieldErrors){const{errorMapKey:a}=h;for(const[m,v]of Object.entries(h.fieldErrors)){const b={...o[m]||{},[a]:v};o[m]=b}}}return this.baseStore.setState(h=>({...h,isFormValidating:!1})),o},this.validate=s=>{const{hasErrored:n,fieldsErrorMap:c}=this.validateSync(s);return n&&!this.options.asyncAlways?c:this.validateAsync(s)},this._handleSubmit=async s=>{var d,l,o,h,a,m,v,M,b,x;this.baseStore.setState(p=>({...p,isSubmitted:!1,submissionAttempts:p.submissionAttempts+1,isSubmitSuccessful:!1})),W(()=>{Object.values(this.fieldInfo).forEach(p=>{p.instance&&(p.instance.state.meta.isTouched||p.instance.setMeta(E=>({...E,isTouched:!0})))})});const n=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){(l=(d=this.options).onSubmitInvalid)==null||l.call(d,{value:this.state.values,formApi:this,meta:n});return}this.baseStore.setState(p=>({...p,isSubmitting:!0}));const c=()=>{this.baseStore.setState(p=>({...p,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){c(),(h=(o=this.options).onSubmitInvalid)==null||h.call(o,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(p=>p.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){c(),(m=(a=this.options).onSubmitInvalid)==null||m.call(a,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}W(()=>{Object.values(this.fieldInfo).forEach(p=>{var E,F,k;(k=(F=(E=p.instance)==null?void 0:E.options.listeners)==null?void 0:F.onSubmit)==null||k.call(F,{value:p.instance.state.value,fieldApi:p.instance})})}),(M=(v=this.options.listeners)==null?void 0:v.onSubmit)==null||M.call(v,{formApi:this,meta:n});try{await((x=(b=this.options).onSubmit)==null?void 0:x.call(b,{value:this.state.values,formApi:this,meta:n})),W(()=>{this.baseStore.setState(p=>({...p,isSubmitted:!0,isSubmitSuccessful:!0})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),c()})}catch(p){throw this.baseStore.setState(E=>({...E,isSubmitSuccessful:!1})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:p}),c(),p}},this.getFieldValue=s=>be(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFieldInfo=s=>{var n;return(n=this.fieldInfo)[s]||(n[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,n)=>{this.baseStore.setState(c=>({...c,fieldMetaBase:{...c.fieldMetaBase,[s]:Ie(n,c.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((n,c)=>{const d=c;return n[d]=K,n},{}),this.setFieldValue=(s,n,c)=>{var h;const d=(c==null?void 0:c.dontUpdateMeta)??!1,l=(c==null?void 0:c.dontRunListeners)??!1,o=(c==null?void 0:c.dontValidate)??!1;W(()=>{d||this.setFieldMeta(s,a=>({...a,isTouched:!0,isDirty:!0,errorMap:{...a==null?void 0:a.errorMap,onMount:void 0}})),this.baseStore.setState(a=>({...a,values:pe(a.values,s,n)}))}),l||(h=this.getFieldInfo(s).instance)==null||h.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const c=[...Object.keys(this.fieldInfo).filter(d=>{const l=s.toString();return d!==l&&d.startsWith(l)}),s];this.baseStore.setState(d=>{const l={...d};return c.forEach(o=>{l.values=ss(l.values,o),delete this.fieldInfo[o],delete l.fieldMetaBase[o]}),l})},this.pushFieldValue=(s,n,c)=>{this.setFieldValue(s,d=>[...Array.isArray(d)?d:[],n],c)},this.insertFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>[...o.slice(0,n),c,...o.slice(n)],D(d,{dontValidate:!0}));const l=(d==null?void 0:d.dontValidate)??!1;l||await this.validateField(s,"change"),Se(this).handleArrayInsert(s,n),l||await this.validateArrayFieldsStartingFrom(s,n,"change")},this.replaceFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>o.map((h,a)=>a===n?c:h),D(d,{dontValidate:!0})),((d==null?void 0:d.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.removeFieldValue=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null;if(this.setFieldValue(s,h=>h.filter((a,m)=>m!==n),D(c,{dontValidate:!0})),Se(this).handleArrayRemove(s,n),l!==null){const h=`${s}[${l}]`;this.deleteField(h)}((c==null?void 0:c.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.swapFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=o[n],a=o[c];return pe(pe(o,`${n}`,a),`${c}`,h)},D(d,{dontValidate:!0})),Se(this).handleArraySwap(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.moveFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=[...o];return h.splice(c,0,h.splice(n,1)[0]),h},D(d,{dontValidate:!0})),Se(this).handleArrayMove(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.clearFieldValues=(s,n)=>{const c=this.getFieldValue(s),d=Array.isArray(c)?Math.max(c.length-1,0):null;if(this.setFieldValue(s,[],D(n,{dontValidate:!0})),d!==null)for(let o=0;o<=d;o++){const h=`${s}[${o}]`;this.deleteField(h)}((n==null?void 0:n.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[s]:K},values:this.options.defaultValues?pe(n.values,s,be(this.options.defaultValues,s)):n.values}))},this.setErrorMap=s=>{W(()=>{Object.entries(s).forEach(([n,c])=>{const d=n;if(we(c)){const{formError:l,fieldErrors:o}=Ee(c);for(const h of Object.keys(this.fieldInfo))this.getFieldMeta(h)&&this.setFieldMeta(h,m=>({...m,errorMap:{...m.errorMap,[d]:o==null?void 0:o[h]},errorSourceMap:{...m.errorSourceMap,[d]:"form"}}));this.baseStore.setState(h=>({...h,errorMap:{...h.errorMap,[d]:l}}))}else this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[d]:c}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[n,c])=>(Object.keys(c).length&&c.errors.length&&(s[n]={errors:c.errors,errorMap:c.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(t==null?void 0:t.formId)??mt(),this._devtoolsSubmissionOverride=!1;let i=Oe({...t==null?void 0:t.defaultState,values:(t==null?void 0:t.defaultValues)??((f=t==null?void 0:t.defaultState)==null?void 0:f.values)});if(t!=null&&t.transform){i=t.transform({state:i}).state;for(const s of Object.keys(i.errorMap)){const n=i.errorMap[s];if(!(n===void 0||!we(n)))for(const c of Object.keys(n.fields)){const d=n.fields[c];if(d===void 0)continue;const l=i.fieldMetaBase[c];i.fieldMetaBase[c]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...l??{},errorSourceMap:{...(l==null?void 0:l.errorSourceMap)??{},onChange:"form"},errorMap:{...(l==null?void 0:l.errorMap)??{},[s]:d}}}}}this.baseStore=Fe(i);let r;this.fieldMetaDerived=Fe(s=>{var l,o,h;const n=this.baseStore.get();let c=0;const d={};for(const a of Object.keys(n.fieldMetaBase)){const m=n.fieldMetaBase[a],v=r==null?void 0:r.fieldMetaBase[a],M=s==null?void 0:s[a],b=be(n.values,a);let x=M==null?void 0:M.errors;if(!v||m.errorMap!==v.errorMap){x=Object.values(m.errorMap??{}).filter(A=>A!==void 0);const k=(l=this.getFieldInfo(a))==null?void 0:l.instance;(!k||!k.options.disableErrorFlat)&&(x=x.flat(1))}const p=!ls(x),E=!m.isDirty,F=Y(b,be(this.options.defaultValues,a))||Y(b,(h=(o=this.getFieldInfo(a))==null?void 0:o.instance)==null?void 0:h.options.defaultValue);if(M&&M.isPristine===E&&M.isValid===p&&M.isDefaultValue===F&&M.errors===x&&m===v){d[a]=M,c++;continue}d[a]={...m,errors:x??[],isPristine:E,isValid:p,isDefaultValue:F}}return Object.keys(n.fieldMetaBase).length?s&&c===Object.keys(n.fieldMetaBase).length?s:(r=this.baseStore.get(),d):d});let u;this.store=Fe(s=>{var L,y;const n=this.baseStore.get(),c=this.fieldMetaDerived.get(),d=Object.values(c).filter(Boolean),l=d.some(w=>w.isValidating),o=d.every(w=>w.isValid),h=d.some(w=>w.isTouched),a=d.some(w=>w.isBlurred),m=d.every(w=>w.isDefaultValue),v=h&&((L=n.errorMap)==null?void 0:L.onMount),M=d.some(w=>w.isDirty),b=!M,x=!!((y=n.errorMap)!=null&&y.onMount||d.some(w=>{var j;return(j=w==null?void 0:w.errorMap)==null?void 0:j.onMount})),p=!!l;let E=(s==null?void 0:s.errors)??[];(!u||n.errorMap!==u.errorMap)&&(E=Object.values(n.errorMap).reduce((w,j)=>j===void 0?w:j&&we(j)?(w.push(j.form),w):(w.push(j),w),[]));const F=E.length===0,k=o&&F,A=this.options.canSubmitWhenInvalid??!1,O=n.submissionAttempts===0&&!h&&!x||!p&&!n.isSubmitting&&k||A;let C=n.errorMap;if(v&&(E=E.filter(w=>w!==n.errorMap.onMount),C=Object.assign(C,{onMount:void 0})),s&&u&&s.errorMap===C&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===E&&s.isFieldsValidating===l&&s.isFieldsValid===o&&s.isFormValid===F&&s.isValid===k&&s.canSubmit===O&&s.isTouched===h&&s.isBlurred===a&&s.isPristine===b&&s.isDefaultValue===m&&s.isDirty===M&&Y(u,n))return s;const B={...n,errorMap:C,fieldMeta:this.fieldMetaDerived.state,errors:E,isFieldsValidating:l,isFieldsValid:o,isFormValid:F,isValid:k,canSubmit:O,isTouched:h,isBlurred:a,isPristine:b,isDefaultValue:m,isDirty:M};return u=this.baseStore.get(),B}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(t){return gt(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}handleSubmit(t){return this._handleSubmit(t)}}function Ee(e){if(e){if(we(e)){const t=Ee(e.form).formError,i=e.fields;return{formError:t,fieldErrors:i}}return{formError:e}}return{formError:void 0}}function de(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class at{constructor(t){this.options={},this.mount=()=>{var u,f;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const i=this.getInfo();i.instance=this,this.update(this.options);const{onMount:r}=this.options.validators||{};if(r){const s=this.runValidator({validate:r,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(n=>({...n,errorMap:{...n==null?void 0:n.errorMap,onMount:s},errorSourceMap:{...n==null?void 0:n.errorSourceMap,onMount:"field"}}))}return(f=(u=this.options.listeners)==null?void 0:u.onMount)==null||f.call(u,{value:this.state.value,fieldApi:this}),()=>{var n,c,d,l;for(const[o,h]of Object.entries(this.timeoutIds.validations))h&&(clearTimeout(h),this.timeoutIds.validations[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.listeners))h&&(clearTimeout(h),this.timeoutIds.listeners[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.formListeners))h&&(clearTimeout(h),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,h]of Object.entries(s.validationMetaMap))h==null||h.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var h,a,m;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...K,isTouched:((h=o.fieldMetaBase[this.name])==null?void 0:h.isTouched)??K.isTouched,isBlurred:((a=o.fieldMetaBase[this.name])==null?void 0:a.isBlurred)??K.isBlurred,isDirty:((m=o.fieldMetaBase[this.name])==null?void 0:m.isDirty)??K.isDirty}}}}),s.instance=null,(c=(n=this.options.listeners)==null?void 0:n.onUnmount)==null||c.call(n,{value:this.state.value,fieldApi:this}),(l=(d=this.form.options.listeners)==null?void 0:d.onFieldUnmount)==null||l.call(d,{formApi:this.form,fieldApi:this})}}},this.update=i=>{if(this.options=i,this.name=i.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const r=this.form.getFieldValue(this.name);Y(r,i.defaultValue)||this.form.setFieldValue(this.name,i.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(i,r)=>{this.form.setFieldValue(this.name,i,D(r,{dontRunListeners:!0,dontValidate:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener(),r!=null&&r.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=i=>this.form.setFieldMeta(this.name,i),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(i,r)=>{this.form.pushFieldValue(this.name,i,D(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(i,r,u)=>{this.form.insertFieldValue(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(i,r,u)=>{this.form.replaceFieldValue(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(i,r)=>{this.form.removeFieldValue(this.name,i,D(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(i,r,u)=>{this.form.swapFieldValues(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(i,r,u)=>{this.form.moveFieldValues(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=i=>{this.form.clearFieldValues(this.name,D(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=i=>{const r=Object.values(this.form.fieldInfo),u=[];for(const f of r){if(!f.instance)continue;const{onChangeListenTo:s,onBlurListenTo:n}=f.instance.options.validators||{};i==="change"&&(s!=null&&s.includes(this.name))&&u.push(f.instance),i==="blur"&&(n!=null&&n.includes(this.name))&&u.push(f.instance)}return u},this.validateSync=(i,r)=>{var d;const u=_e(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),s=this.getLinkedFields(i).reduce((l,o)=>{const h=_e(i,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||ie});return h.forEach(a=>{a.field=o}),l.concat(h)},[]);let n=!1;W(()=>{const l=(o,h)=>{var x;const a=xe(h.cause),m=h.validate?rt(o.runValidator({validate:h.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,v=r[a],{newErrorValue:M,newSource:b}=st({formLevelError:v,fieldLevelError:m});((x=o.state.meta.errorMap)==null?void 0:x[a])!==M&&o.setMeta(p=>({...p,errorMap:{...p.errorMap,[a]:M},errorSourceMap:{...p.errorSourceMap,[a]:b}})),M&&(n=!0)};for(const o of u)l(this,o);for(const o of s)o.validate&&l(o.field,o)});const c=xe("submit");return(d=this.state.meta.errorMap)!=null&&d[c]&&i!=="submit"&&!n&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[c]:void 0},errorSourceMap:{...l.errorSourceMap,[c]:void 0}})),{hasErrored:n}},this.validateAsync=async(i,r)=>{const u=$e(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),f=await r,s=this.getLinkedFields(i),n=s.reduce((a,m)=>{const v=$e(i,{...m.options,form:m.form,fieldName:m.name,validationLogic:m.form.options.validationLogic||ie});return v.forEach(M=>{M.field=m}),a.concat(v)},[]),c=[],d=[],l=u.some(a=>a.validate)||n.some(a=>a.validate);if(l){this.state.meta.isValidating||this.setMeta(a=>({...a,isValidating:!0}));for(const a of s)a.setMeta(m=>({...m,isValidating:!0}))}const o=(a,m,v)=>{const M=xe(m.cause),b=a.getInfo(),x=b.validationMetaMap[M];x==null||x.lastAbortController.abort();const p=new AbortController;b.validationMetaMap[M]={lastAbortController:p},v.push(new Promise(async E=>{var B;let F;try{F=await new Promise((L,y)=>{a.timeoutIds.validations[m.cause]&&clearTimeout(a.timeoutIds.validations[m.cause]),a.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(p.signal.aborted)return L(void 0);try{L(await this.runValidator({validate:m.validate,value:{value:a.store.state.value,fieldApi:a,signal:p.signal,validationSource:"field"},type:"validateAsync"}))}catch(w){y(w)}},m.debounceMs)})}catch(L){F=L}if(p.signal.aborted)return E(void 0);const k=rt(F),A=(B=f[a.name])==null?void 0:B[M],{newErrorValue:O,newSource:C}=st({formLevelError:A,fieldLevelError:k});if(a.getInfo().instance!==a)return E(void 0);a.setMeta(L=>({...L,errorMap:{...L==null?void 0:L.errorMap,[M]:O},errorSourceMap:{...L.errorSourceMap,[M]:C}})),E(O)}))};for(const a of u)a.validate&&o(this,a,c);for(const a of n)a.validate&&o(a.field,a,d);let h=[];if((c.length||d.length)&&(h=await Promise.all(c),await Promise.all(d)),l){this.setMeta(a=>({...a,isValidating:!1}));for(const a of s)a.setMeta(m=>({...m,isValidating:!1}))}return h.filter(Boolean)},this.validate=(i,r)=>{var n;if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:u}=r!=null&&r.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(i),{hasErrored:f}=this.validateSync(i,u[this.name]??{});if(f&&!this.options.asyncAlways)return(n=this.getInfo().validationMetaMap[xe(i)])==null||n.lastAbortController.abort(),this.state.meta.errors;const s=r!=null&&r.skipFormValidation?Promise.resolve({}):this.form.validateAsync(i);return this.validateAsync(i,s)},this.handleChange=i=>{this.setValue(i)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=i=>{this.setMeta(r=>({...r,errorMap:{...r.errorMap,...i}}))},this.parseValueWithSchema=i=>ae.validate({value:this.state.value,validationSource:"field"},i),this.parseValueWithSchemaAsync=i=>ae.validateAsync({value:this.state.value,validationSource:"field"},i),this.triggerOnChangeListener=()=>{var u,f,s,n,c,d;const i=(u=this.form.options.listeners)==null?void 0:u.onChangeDebounceMs;i&&i>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var l,o;(o=(l=this.form.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{formApi:this.form,fieldApi:this})},i)):(s=(f=this.form.options.listeners)==null?void 0:f.onChange)==null||s.call(f,{formApi:this.form,fieldApi:this});const r=(n=this.options.listeners)==null?void 0:n.onChangeDebounceMs;r&&r>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var l,o;(o=(l=this.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{value:this.state.value,fieldApi:this})},r)):(d=(c=this.options.listeners)==null?void 0:c.onChange)==null||d.call(c,{value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=Fe(i=>{this.form.store.get();const r=this.form.getFieldMeta(this.name)??{...K,...t.defaultMeta};let u=this.form.getFieldValue(this.name);return!r.isTouched&&u===void 0&&this.options.defaultValue!==void 0&&!Y(u,this.options.defaultValue)&&(u=this.options.defaultValue),i&&i.value===u&&i.meta===r?i:{value:u,meta:r}})}get state(){return this.store.state}runValidator(t){return gt(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}triggerOnBlurListener(){var r,u,f,s,n,c;const t=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;t&&t>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,l;(l=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{formApi:this.form,fieldApi:this})},t)):(f=(u=this.form.options.listeners)==null?void 0:u.onBlur)==null||f.call(u,{formApi:this.form,fieldApi:this});const i=(s=this.options.listeners)==null?void 0:s.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,l;(l=(d=this.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{value:this.state.value,fieldApi:this})},i)):(c=(n=this.options.listeners)==null?void 0:n.onBlur)==null||c.call(n,{value:this.state.value,fieldApi:this})}}function rt(e){if(e)return e}function xe(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function cs(e,t){if(!t)return;const i=Object.assign({},e,{state:ce(e.state)});t(i),i.fieldInfo!==e.fieldInfo&&(e.fieldInfo=i.fieldInfo),i.options!==e.options&&(e.options=i.options);const u=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((f,s)=>(e.state[s]!==i.state[s]&&(f[s]=i.state[s]),f),{});return W(()=>{Object.keys(u).length&&e.baseStore.setState(f=>({...f,...u})),i.state.errorMap!==e.state.errorMap&&e.setErrorMap(i.state.errorMap)}),i}const ne=typeof window<"u"?V.useLayoutEffect:V.useEffect;function hs(e){const[t,i]=V.useState(()=>({form:e.form,name:e.name})),[r,u]=V.useState(()=>new at({...e}));(t.form!==e.form||t.name!==e.name)&&(u(new at({...e})),i({form:e.form,name:e.name}));const f=Q(r.store,e.mode==="array"?a=>Object.keys(a.value??[]).length:a=>a.value),s=Q(r.store,a=>a.meta.isTouched),n=Q(r.store,a=>a.meta.isBlurred),c=Q(r.store,a=>a.meta.isDirty),d=Q(r.store,a=>a.meta.errorMap),l=Q(r.store,a=>a.meta.errorSourceMap),o=Q(r.store,a=>a.meta.isValidating),h=V.useMemo(()=>{const m={...r,get state(){return{value:e.mode==="array"?r.state.value:f,get meta(){return{...r.state.meta,isTouched:s,isBlurred:n,isDirty:c,errorMap:d,errorSourceMap:l,isValidating:o}}}}};return m.Field=vt,m},[r,e.mode,f,s,n,c,d,l,o]);return ne(r.mount,[r]),ne(()=>{r.update(e)}),h}const vt=(({children:e,...t})=>{const i=hs(t),r=V.useMemo(()=>Ie(e,i),[e,i]);return g.jsx(g.Fragment,{children:r})});function fs(){return V.useState(()=>mt())[0]}const ms=St,gs=V.version.split(".")[0]==="17"?fs:ms.useId;function vs({form:e,selector:t=r=>r,children:i}){const r=Q(e.store,t);return g.jsx(g.Fragment,{children:Ie(i,r)})}function bs(e){const t=gs(),[i,r]=V.useState(e==null?void 0:e.formId),[u,f]=V.useState(()=>new nt({...e,formId:(e==null?void 0:e.formId)??t}));if(i!==(e==null?void 0:e.formId)){const c=(e==null?void 0:e.formId)??t;f(new nt({...e,formId:c})),r(c)}const s=V.useMemo(()=>{const c={...u,handleSubmit:((...d)=>u._handleSubmit(...d)),get formId(){return u._formId},get state(){return u.store.state}};return c.Field=function(l){return g.jsx(vt,{...l,form:u})},c.Subscribe=function(l){return g.jsx(vs,{form:u,selector:l.selector,children:l.children})},c},[u]);ne(u.mount,[]),ne(()=>{u.update(e)});const n=V.useRef(!1);return ne(()=>{n.current&&e!=null&&e.transform&&cs(u,e.transform)},[u,e==null?void 0:e.transform]),ne(()=>{n.current=!0}),s}function ps(e){const{open:t,defaultOpen:i,onOpenChange:r,disabled:u}=e,f=t!==void 0,[s,n]=Rt({controlled:t,default:i,name:"Collapsible",state:"open"}),{mounted:c,setMounted:d,transitionStatus:l}=Dt(s,!0,!0),[o,h]=V.useState(s),[{height:a,width:m},v]=V.useState({height:void 0,width:void 0}),M=_t(),[b,x]=V.useState(),p=b??M,[E,F]=V.useState(!1),[k,A]=V.useState(!1),O=V.useRef(null),C=V.useRef(null),B=V.useRef(null),L=V.useRef(null),y=$t(L,!1),w=Ue(j=>{const I=!s,T=ht(Ut,j.nativeEvent);if(r(I,T),T.isCanceled)return;const z=L.current;C.current==="css-animation"&&z!=null&&z.style.removeProperty("animation-name"),!E&&!k&&(C.current!=null&&C.current!=="css-animation"&&!c&&I&&d(!0),C.current==="css-animation"&&(!o&&I&&h(!0),!c&&I&&d(!0))),n(I),C.current==="none"&&c&&!I&&d(!1)});return Z(()=>{f&&C.current==="none"&&!s&&d(!1)},[f,s,t,d]),V.useMemo(()=>({abortControllerRef:O,animationTypeRef:C,disabled:u,handleTrigger:w,height:a,mounted:c,open:s,panelId:p,panelRef:L,runOnceAnimationsFinish:y,setDimensions:v,setHiddenUntilFound:F,setKeepMounted:A,setMounted:d,setOpen:n,setPanelIdState:x,setVisible:h,transitionDimensionRef:B,transitionStatus:l,visible:o,width:m}),[O,C,u,w,a,c,s,p,L,y,v,F,A,d,n,h,B,l,o,m])}const bt=V.createContext(void 0);function pt(){const e=V.useContext(bt);if(e===void 0)throw new Error(xt(15));return e}let he=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ze.startingStyle]="startingStyle",e[e.endingStyle=Ze.endingStyle]="endingStyle",e})({}),ys=(function(e){return e.panelOpen="data-panel-open",e})({});const Ms={[he.open]:""},Ss={[he.closed]:""},xs={open(e){return e?{[ys.panelOpen]:""}:null}},Fs={open(e){return e?Ms:Ss}},yt={...Fs,...ft},ws=V.forwardRef(function(t,i){const{render:r,className:u,defaultOpen:f=!1,disabled:s=!1,onOpenChange:n,open:c,style:d,...l}=t,o=Ue(n),h=ps({open:c,defaultOpen:f,onOpenChange:o,disabled:s}),a=V.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),m=V.useMemo(()=>({...h,onOpenChange:o,state:a}),[h,o,a]),v=We("div",t,{state:a,ref:i,props:l,stateAttributesMapping:yt});return g.jsx(bt.Provider,{value:m,children:v})}),Vs={...xs,...ft},Es=V.forwardRef(function(t,i){const{panelId:r,open:u,handleTrigger:f,state:s,disabled:n}=pt(),{className:c,disabled:d=n,id:l,render:o,nativeButton:h=!0,style:a,...m}=t,{getButtonProps:v,buttonRef:M}=Ft({disabled:d,focusableWhenDisabled:!0,native:h}),b=V.useMemo(()=>({"aria-controls":u?r:void 0,"aria-expanded":u,onClick:f}),[r,u,f]);return We("button",t,{state:s,ref:[i,M],props:[b,m,v],stateAttributesMapping:Vs})});let As=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function js(e){const{abortControllerRef:t,animationTypeRef:i,externalRef:r,height:u,hiddenUntilFound:f,keepMounted:s,id:n,mounted:c,onOpenChange:d,open:l,panelRef:o,runOnceAnimationsFinish:h,setDimensions:a,setMounted:m,setOpen:v,setVisible:M,transitionDimensionRef:b,visible:x,width:p}=e,E=V.useRef(!1),F=V.useRef(null),k=V.useRef(l),A=V.useRef(l),O=Wt(),C=V.useMemo(()=>i.current==="css-animation"?!x:!l&&!c,[l,c,x,i]),B=Ue(y=>{if(!y)return;if(i.current==null||b.current==null){const I=getComputedStyle(y),T=I.animationName!=="none"&&I.animationName!=="",z=I.transitionDuration!=="0s"&&I.transitionDuration!=="";T&&z||(I.animationName==="none"&&I.transitionDuration!=="0s"?i.current="css-transition":I.animationName!=="none"&&I.transitionDuration==="0s"?i.current="css-animation":i.current="none"),y.getAttribute(As.orientation)==="horizontal"||I.transitionProperty.indexOf("width")>-1?b.current="width":b.current="height"}if(i.current!=="css-transition")return;(u===void 0||p===void 0)&&(a({height:y.scrollHeight,width:y.scrollWidth}),A.current&&y.style.setProperty("transition-duration","0s"));let w=-1,j=-1;return w=$.request(()=>{A.current=!1,j=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})}),()=>{$.cancel(w),$.cancel(j)}}),L=wt(r,o,B);return Z(()=>{if(i.current!=="css-transition")return;const y=o.current;if(!y)return;let w=-1;if(t.current!=null&&(t.current.abort(),t.current=null),l){const j={"justify-content":y.style.justifyContent,"align-items":y.style.alignItems,"align-content":y.style.alignContent,"justify-items":y.style.justifyItems};Object.keys(j).forEach(I=>{y.style.setProperty(I,"initial","important")}),!A.current&&!s&&y.setAttribute(he.startingStyle,""),a({height:y.scrollHeight,width:y.scrollWidth}),w=$.request(()=>{Object.entries(j).forEach(([I,T])=>{T===""?y.style.removeProperty(I):y.style.setProperty(I,T)})})}else{if(y.scrollHeight===0&&y.scrollWidth===0)return;a({height:y.scrollHeight,width:y.scrollWidth});const j=new AbortController;t.current=j;const I=j.signal;let T=null;const z=he.endingStyle;return T=new MutationObserver(Le=>{Le.some(Ce=>Ce.type==="attributes"&&Ce.attributeName===z)&&(T==null||T.disconnect(),T=null,h(()=>{a({height:0,width:0}),y.style.removeProperty("content-visibility"),m(!1),t.current===j&&(t.current=null)},I))}),T.observe(y,{attributes:!0,attributeFilter:[z]}),()=>{T==null||T.disconnect(),O.cancel(),t.current===j&&(j.abort(),t.current=null)}}return()=>{$.cancel(w)}},[t,i,O,f,s,c,l,o,h,a,m]),Z(()=>{if(i.current!=="css-animation")return;const y=o.current;y&&(F.current=y.style.animationName||F.current,y.style.setProperty("animation-name","none"),a({height:y.scrollHeight,width:y.scrollWidth}),!k.current&&!E.current&&y.style.removeProperty("animation-name"),l?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),M(!0)):(t.current=new AbortController,h(()=>{m(!1),M(!1),t.current=null},t.current.signal)))},[t,i,l,o,h,a,m,M,x]),Vt(()=>{const y=$.request(()=>{k.current=!1});return()=>$.cancel(y)}),Z(()=>{if(!f)return;const y=o.current;if(!y)return;let w=-1,j=-1;return l&&E.current&&(y.style.transitionDuration="0s",a({height:y.scrollHeight,width:y.scrollWidth}),w=$.request(()=>{E.current=!1,j=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})})),()=>{$.cancel(w),$.cancel(j)}},[f,l,o,a]),Z(()=>{const y=o.current;y&&f&&C&&(y.setAttribute("hidden","until-found"),i.current==="css-transition"&&y.setAttribute(he.startingStyle,""))},[f,C,i,o]),V.useEffect(function(){const w=o.current;if(!w)return;function j(I){E.current=!0,v(!0),d(!0,ht(zt,I))}return Kt(w,"beforematch",j)},[d,o,v]),V.useMemo(()=>({props:{hidden:C,id:n,ref:L}}),[C,n,L])}let ot=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const Is=V.forwardRef(function(t,i){const{className:r,hiddenUntilFound:u,keepMounted:f,render:s,id:n,style:c,...d}=t,{abortControllerRef:l,animationTypeRef:o,height:h,mounted:a,onOpenChange:m,open:v,panelId:M,panelRef:b,runOnceAnimationsFinish:x,setDimensions:p,setHiddenUntilFound:E,setKeepMounted:F,setMounted:k,setPanelIdState:A,setOpen:O,setVisible:C,state:B,transitionDimensionRef:L,visible:y,width:w,transitionStatus:j}=pt(),I=u??!1,T=f??!1;Z(()=>{if(n)return A(n),()=>{A(void 0)}},[n,A]),Z(()=>{E(I)},[E,I]),Z(()=>{F(T)},[F,T]);const{props:z}=js({abortControllerRef:l,animationTypeRef:o,externalRef:i,height:h,hiddenUntilFound:I,id:M,keepMounted:T,mounted:a,onOpenChange:m,open:v,panelRef:b,runOnceAnimationsFinish:x,setDimensions:p,setMounted:k,setOpen:O,setVisible:C,transitionDimensionRef:L,visible:y,width:w});qt({open:v&&j==="idle",ref:b,onComplete(){v&&p({height:void 0,width:void 0})}});const Le=V.useMemo(()=>({...B,transitionStatus:j}),[B,j]),ze=We("div",t,{state:Le,ref:[i,b],props:[z,{style:{[ot.collapsiblePanelHeight]:h===void 0?"auto":`${h}px`,[ot.collapsiblePanelWidth]:w===void 0?"auto":`${w}px`}},d],stateAttributesMapping:yt});return T||I||a?ze:null});function Pe({...e}){return g.jsx(ws,{"data-slot":"collapsible",...e})}function Be({...e}){return g.jsx(Es,{"data-slot":"collapsible-trigger",...e})}function Ne({...e}){return g.jsx(Is,{"data-slot":"collapsible-content",...e})}function Ls({className:e,...t}){return g.jsx("label",{"data-slot":"label",className:ue("flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Cs({className:e,...t}){return g.jsx("div",{"data-slot":"field-group",className:ue("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const ks=Et("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function Ts({className:e,orientation:t="vertical",...i}){return g.jsx("fieldset",{"data-slot":"field","data-orientation":t,className:ue(ks({orientation:t}),e),...i})}function Os({className:e,...t}){return g.jsx(Ls,{"data-slot":"field-label",className:ue("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Ps({className:e,children:t,errors:i,...r}){const u=V.useMemo(()=>{var s;if(t)return t;if(!(i!=null&&i.length))return null;const f=[...new Map(i.map(n=>[n==null?void 0:n.message,n])).values()];return(f==null?void 0:f.length)===1?(s=f[0])==null?void 0:s.message:g.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:f.map(n=>(n==null?void 0:n.message)&&g.jsx("li",{children:n.message},n.message))})},[t,i]);return u?g.jsx("div",{role:"alert","data-slot":"field-error",className:ue("text-xs/relaxed font-normal text-destructive",e),...r,children:u}):null}function Bs({className:e,...t}){return g.jsx("textarea",{"data-slot":"textarea",className:ue("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function Ns(e){const t=At(),{data:i=[],isLoading:r}=Qe(o=>o.from({m:dt}).where(({m:h})=>jt(h.id,e)),[e]),u=i[0]??null,{data:f=[]}=Qe(o=>o.from({p:It}),[]),s=()=>{kt(e,{needsReview:!1}).then(()=>ke.invalidateQueries({queryKey:["memories"]}))},n=async o=>{try{return await Ct(e,o),await ke.invalidateQueries({queryKey:["memories"]}),!0}catch{return Ye.error("Failed to add project — try again"),!1}},c=async o=>{try{await Lt(e,o),await ke.invalidateQueries({queryKey:["memories"]})}catch{Ye.error("Failed to remove project — try again")}},d=()=>void t({to:"/memories"}),l=f.filter(o=>!(u!=null&&u.projects.some(h=>h.id===o.id)));return{memory:u,isLoading:r,availableProjects:l,handleApprove:s,handleAddProject:n,handleRemoveProject:c,handleClose:d}}const Rs=Pt({content:Xe().min(1,"Content is required."),type:Bt(ct),tagsInput:Xe()});function Re({field:e,label:t,description:i,children:r}){const u=e.state.meta.isTouched&&!e.state.meta.isValid;return g.jsxs(Ts,{"data-invalid":u,children:[g.jsx(Os,{htmlFor:e.name,className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:t}),r,i,u&&g.jsx(Ps,{errors:e.state.meta.errors})]})}function Ds({memory:e,availableProjects:t,handleApprove:i,handleAddProject:r,handleRemoveProject:u,handleClose:f}){const[s,n]=V.useState(!1),[c,d]=V.useState("");V.useEffect(()=>{if(!s)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[s]);const l=bs({defaultValues:{content:e.content,type:e.type,tagsInput:e.tags.join(", ")},validators:{onSubmit:Rs},onSubmit:({value:a})=>{const m=a.tagsInput.split(",").map(v=>v.trim()).filter(Boolean);dt.update(e.id,v=>{a.content!==e.content&&(v.content=a.content),a.type!==e.type&&(v.type=a.type),JSON.stringify(m)!==JSON.stringify(e.tags)&&(v.tags=m)}),n(!0)}}),o=Jt({shouldBlockFn:()=>l.state.isDirty,withResolver:!0}),h=async()=>{if(!c)return;await r(c)&&d("")};return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ve,{variant:e.type,children:e.type}),e.reviewEvents.length>0&&g.jsx(ve,{variant:"destructive",title:"Flagged for review — possible duplicate or conflict with another memory",children:"needs review"}),e.pinned&&g.jsx(ve,{variant:"default",children:"pinned"})]}),g.jsx(se,{variant:"ghost",size:"icon-sm",onClick:f,"aria-label":"Close",children:g.jsx(Je,{weight:"regular"})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[g.jsxs(Cs,{children:[g.jsx(l.Field,{name:"content",children:a=>g.jsx(Re,{field:a,label:"Content",children:g.jsx(Bs,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),rows:8,className:"min-h-32 font-[var(--font-heading)] text-sm","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})}),g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsx(l.Field,{name:"type",children:a=>g.jsx(Re,{field:a,label:"Type",description:g.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:Ot[a.state.value]}),children:g.jsx(et,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),className:"w-full",children:ct.map(m=>g.jsx(Te,{value:m,children:Tt(m)},m))})})}),g.jsx(l.Field,{name:"tagsInput",children:a=>g.jsx(Re,{field:a,label:"Tags",children:g.jsx(Ht,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),placeholder:"tag1, tag2","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})})]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Projects"}),g.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.projects.length===0&&g.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Global (no project)"}),e.projects.map(a=>g.jsxs(ve,{variant:"secondary",className:"gap-1 rounded-full text-[11px]",children:[a.name,g.jsx("button",{type:"button",onClick:()=>void u(a.id),className:"hover:text-destructive transition-colors leading-none","aria-label":`Remove from ${a.name}`,children:g.jsx(Je,{weight:"regular",className:"size-2.5"})})]},a.id))]}),t.length>0&&g.jsxs("div",{className:"flex gap-1",children:[g.jsxs(et,{value:c,onChange:a=>d(a.target.value),size:"sm",className:"flex-1",children:[g.jsx(Te,{value:"",children:"Add to project…"}),t.map(a=>g.jsx(Te,{value:a.id,children:a.name},a.id))]}),g.jsx(se,{variant:"outline",size:"sm",disabled:!c,onClick:()=>void h(),children:"+"})]})]}),e.reviewEvents.length>0&&g.jsxs(Pe,{defaultOpen:!0,className:"group pt-2 border-t border-border",children:[g.jsxs(Be,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[g.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Review reasons"]}),g.jsx(Ne,{className:"space-y-2 mt-2",children:e.reviewEvents.map(a=>g.jsxs("div",{className:"rounded border border-border p-2 space-y-1 text-[11px]",children:[g.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[g.jsxs("span",{className:"font-medium text-destructive",children:[Math.round(a.similarity*100),"% similarity match"]}),g.jsx("span",{children:new Date(a.createdAt).toLocaleString()})]}),a.conflictingMemoryId?g.jsxs("div",{className:"text-muted-foreground",children:["Conflicting memory:"," ",g.jsx("span",{className:"font-mono text-[10px]",children:a.conflictingMemoryId})]}):g.jsx("div",{className:"text-muted-foreground italic",children:"Conflicting memory deleted"}),a.conflictContentSnapshot&&g.jsxs(Pe,{children:[g.jsx(Be,{className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"Show conflicting content ›"}),g.jsx(Ne,{children:g.jsx("p",{className:"mt-1 text-foreground bg-muted rounded px-2 py-1 whitespace-pre-wrap",children:a.conflictContentSnapshot})})]})]},a.id))})]}),g.jsxs(Pe,{className:"group pt-2 border-t border-border",children:[g.jsxs(Be,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[g.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Details"]}),g.jsxs(Ne,{className:"space-y-1 mt-2",children:[e.sourceHarness&&g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Source"}),g.jsx("span",{children:e.sourceHarness})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Accessed"}),g.jsxs("span",{children:[e.accessCount,"×"]})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Updated"}),g.jsx("span",{children:new Date(e.updatedAt).toLocaleString()})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Created"}),g.jsx("span",{children:new Date(e.createdAt).toLocaleString()})]})]})]})]}),g.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0",children:[o.status==="blocked"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-destructive",children:"Unsaved changes"}),g.jsx(se,{variant:"ghost",size:"sm",onClick:()=>o.proceed(),children:"Discard"}),g.jsx(se,{variant:"outline",size:"sm",onClick:()=>o.reset(),children:"Keep editing"})]}),e.reviewEvents.length>0&&o.status!=="blocked"&&g.jsx(se,{variant:"outline",size:"sm",onClick:i,title:"Mark as reviewed — this memory was flagged as a possible duplicate or conflict",children:"Mark reviewed"}),g.jsx("div",{className:"flex-1"}),g.jsx(se,{variant:"default",size:"sm",disabled:!l.state.isDirty,onClick:()=>void l.handleSubmit(),children:s?"Saved":"Save"})]})]})}function _s({id:e}){const{memory:t,isLoading:i,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n}=Ns(e);return i||!t?g.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i?"Loading…":"Memory not found"}):g.jsx(Ds,{memory:t,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n},t.id)}function Ks(){const{id:e}=Nt.useParams();return g.jsx(_s,{id:e},e)}export{Ks as component};
|
|
1
|
+
var qe=e=>{throw TypeError(e)};var He=(e,t,i)=>t.has(e)||qe("Cannot "+i);var S=(e,t,i)=>(He(e,t,"read from private field"),i?i.call(e):t.get(e)),N=(e,t,i)=>t.has(e)?qe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),P=(e,t,i,r)=>(He(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var Ge=(e,t,i,r)=>({set _(u){P(e,t,u,i)},get _(){return S(e,t,r)}});import{V as lt,W as ut,a as Mt,r as V,X as W,j as g,b as Q,Y as St,l as Ue,e as Z,x as xt,n as We,J as Ft,o as wt,Z as Vt,H as ue,_ as Et,M as At,O as Qe,P as dt,$ as jt,Q as It,a0 as Lt,a1 as ke,a2 as Ye,a3 as Ct,a4 as kt,D as ve,C as se,a5 as Je,S as ct,G as Tt,F as Ot,a6 as Pt,a7 as Xe,a8 as Bt,a9 as Nt}from"./index-BCPCyhdz.js";import{v as Rt,k as Dt,q as _t,w as $t,d as ht,j as Ut,T as Ze,m as ft,e as Wt,A as $,b as Kt,x as zt,l as qt,N as et,s as Te,I as Ht}from"./native-select-Boj2GMjk.js";class Gt{constructor(t){this.atom=lt(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ut(t))}}class Qt{constructor(t){this.atom=lt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ut(t))}}function Fe(e){return typeof e=="function"?new Qt(e):new Gt(e)}function Yt(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const i=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>i&&r!==void 0?await r():i,enableBeforeUnload:i,withResolver:r===void 0}}function Jt(e,t){const{shouldBlockFn:i,enableBeforeUnload:r=!0,disabled:u=!1,withResolver:f=!1}=Yt(e),s=Mt(),{history:n}=s,[c,d]=V.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return V.useEffect(()=>{const l=async o=>{function h(b){const x=s.parseLocation(b),p=s.getMatchedRoutes(x.pathname);return p.foundRoute===void 0?{routeId:"__notFound__",fullPath:x.pathname,pathname:x.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}:{routeId:p.foundRoute.id,fullPath:p.foundRoute.fullPath,pathname:x.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}}const a=h(o.currentLocation),m=h(o.nextLocation);if(a.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const v=await i({action:o.action,current:a,next:m});if(!f)return v;if(!v)return!1;const M=await new Promise(b=>{d({status:"blocked",current:a,next:m,action:o.action,proceed:()=>b(!1),reset:()=>b(!0)})});return d({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),M};return u?void 0:n.block({blockerFn:l,enableBeforeUnload:r})},[i,r,u,f,n,s]),c}var Xt=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...i)=>{const r=Date.now()-this.lastExecutionTime;if(this.options.leading&&r>=this.options.wait)this.execute(...i);else if(this.lastArgs=i,!this.timeoutId&&this.options.trailing){const u=this.options.wait-r;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},u)}},this.execute=(...i)=>{var r,u;this.fn(...i),(u=(r=this.options).onExecute)==null||u.call(r,i,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Zt(e,t){return new Xt(e,t).maybeExecute}var J,_,R,fe,q,te,H,re,me,Ae,X,oe,G,ge,le,je;class es{constructor({pluginId:t,debug:i=!1,enabled:r=!0,reconnectEveryMs:u=300}){N(this,J,!0);N(this,_);N(this,R);N(this,fe);N(this,q);N(this,te);N(this,H);N(this,re);N(this,me,0);N(this,Ae,5);N(this,X,!1);N(this,oe,!1);N(this,G,null);N(this,ge,()=>{this.debugLog("Connected to event bus"),P(this,te,!0),P(this,X,!1),this.debugLog("Emitting queued events",S(this,q)),S(this,q).forEach(t=>this.emitEventToBus(t)),P(this,q,[]),this.stopConnectLoop(),S(this,R).call(this).removeEventListener("tanstack-connect-success",S(this,ge))});N(this,le,()=>{if(S(this,me)<S(this,Ae)){Ge(this,me)._++,this.dispatchCustomEvent("tanstack-connect",{});return}S(this,R).call(this).removeEventListener("tanstack-connect",S(this,le)),P(this,oe,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,je,()=>{S(this,X)||(P(this,X,!0),S(this,R).call(this).addEventListener("tanstack-connect-success",S(this,ge)),S(this,le).call(this))});P(this,_,t),P(this,J,r),P(this,R,this.getGlobalTarget),P(this,fe,i),this.debugLog(" Initializing event subscription for plugin",S(this,_)),P(this,q,[]),P(this,te,!1),P(this,oe,!1),P(this,H,null),P(this,re,u)}startConnectLoop(){S(this,H)!==null||S(this,te)||(this.debugLog(`Starting connect loop (every ${S(this,re)}ms)`),P(this,H,setInterval(S(this,le),S(this,re))))}stopConnectLoop(){P(this,X,!1),S(this,H)!==null&&(clearInterval(S(this,H)),P(this,H,null),P(this,q,[]),this.debugLog("Stopped connect loop"))}debugLog(...t){S(this,fe)&&console.log(`🌴 [tanstack-devtools:${S(this,_)}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return S(this,_)}dispatchCustomEventShim(t,i){try{const r=new Event(t,{detail:i});S(this,R).call(this).dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,i){try{S(this,R).call(this).dispatchEvent(new CustomEvent(t,{detail:i}))}catch{this.dispatchCustomEventShim(t,i)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,i){return{type:`${S(this,_)}:${t}`,payload:i,pluginId:S(this,_)}}emit(t,i){if(!S(this,J)){this.debugLog("Event bus client is disabled, not emitting event",t,i);return}if(S(this,G)&&(this.debugLog("Emitting event to internal event target",t,i),S(this,G).dispatchEvent(new CustomEvent(`${S(this,_)}:${t}`,{detail:this.createEventPayload(t,i)}))),S(this,oe)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!S(this,te)){this.debugLog("Bus not available, will be pushed as soon as connected"),S(this,q).push(this.createEventPayload(t,i)),typeof CustomEvent<"u"&&!S(this,X)&&(S(this,je).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,i))}on(t,i,r){const u=(r==null?void 0:r.withEventTarget)??!1,f=`${S(this,_)}:${t}`;if(u&&(S(this,G)||P(this,G,new EventTarget),S(this,G).addEventListener(f,n=>{i(n.detail)})),!S(this,J))return this.debugLog("Event bus client is disabled, not registering event",f),()=>{};const s=n=>{this.debugLog("Received event from bus",n.detail),i(n.detail)};return S(this,R).call(this).addEventListener(f,s),this.debugLog("Registered event to bus",f),()=>{var n;u&&((n=S(this,G))==null||n.removeEventListener(f,s)),S(this,R).call(this).removeEventListener(f,s)}}onAll(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;t(u)};return S(this,R).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,R).call(this).removeEventListener("tanstack-devtools-global",i)}onAllPluginEvents(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;S(this,_)&&u.pluginId!==S(this,_)||t(u)};return S(this,R).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,R).call(this).removeEventListener("tanstack-devtools-global",i)}}J=new WeakMap,_=new WeakMap,R=new WeakMap,fe=new WeakMap,q=new WeakMap,te=new WeakMap,H=new WeakMap,re=new WeakMap,me=new WeakMap,Ae=new WeakMap,X=new WeakMap,oe=new WeakMap,G=new WeakMap,ge=new WeakMap,le=new WeakMap,je=new WeakMap;class ts extends es{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const U=new ts;function Ie(e,t){return typeof e=="function"?e(t):e}function be(e,t){return Ke(t).reduce((r,u)=>{if(r===null)return null;if(typeof r<"u")return r[u]},e)}function pe(e,t,i){const r=Ke(t);function u(f){if(!r.length)return Ie(i,f);const s=r.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(f))return typeof f=="object"?(f===null&&(f={}),{...f,[s]:u(f[s])}):{[s]:u()};if(Array.isArray(f)&&typeof s=="number"){const n=f.slice(0,s);return[...n.length?n:new Array(s),u(f[s]),...f.slice(s+1)]}return[...new Array(s),u()]}return u(e)}function ss(e,t){const i=Ke(t);function r(u){if(!u)return;if(i.length===1){const s=i[0];if(Array.isArray(u)&&typeof s=="number")return u.filter((d,l)=>l!==s);const{[s]:n,...c}=u;return c}const f=i.shift();if((typeof f=="string"||typeof f=="number"&&!Array.isArray(u))&&typeof u=="object")return{...u,[f]:r(u[f])};if(typeof f=="number"&&Array.isArray(u)){if(f>=u.length)return u;const s=u.slice(0,f);return[...s.length?s:new Array(f),r(u[f]),...u.slice(f+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const is=/^(\d+)$/gm,ns=/\.(\d+)(?=\.)/gm,as=/^(\d+)\./gm,rs=/\.(\d+$)/gm,os=/\.{2,}/gm,De="__int__",ye=`${De}$1`;function Ke(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(is,ye).replace(ns,`.${ye}.`).replace(as,`${ye}.`).replace(rs,`.${ye}`).replace(os,".").split(".").map(t=>{if(t.startsWith(De)){const i=t.substring(De.length),r=parseInt(i,10);return String(r)===i?r:i}return t})}function ls(e){return!(Array.isArray(e)&&e.length===0)}function _e(e,t){const i=r=>r.validators.filter(Boolean).map(u=>({cause:u.cause,validate:u.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:i})}function $e(e,t){const{asyncDebounceMs:i}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:u,onDynamicAsyncDebounceMs:f}=t.validators||{},s=i??0,n=c=>c.validators.filter(Boolean).map(d=>{const l=(d==null?void 0:d.cause)||e;let o=s;switch(l){case"change":o=u??s;break;case"blur":o=r??s;break;case"dynamic":o=f??s;break;case"submit":o=0;break}return e==="submit"&&(o=0),{cause:l,validate:d.fn,debounceMs:o}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:n})}const we=e=>!!e&&typeof e=="object"&&"fields"in e;function Y(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 Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[u,f]of e)if(!t.has(u)||!Object.is(f,t.get(u)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const u of e)if(!t.has(u))return!1;return!0}const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(const u of i)if(!r.includes(u)||!Y(e[u],t[u]))return!1;return!0}const tt=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:i})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:i?{newErrorValue:i,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},st=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function D(e,t){return e==null?t:{...e,...t}}let ee=256;const Ve=[];let Me;for(;ee--;)Ve[ee]=(ee+256).toString(16).substring(1);function mt(){let e=0,t,i="";if(!Me||ee+16>256){for(Me=new Array(256),e=256;e--;)Me[e]=256*Math.random()|0;e=0,ee=0}for(;e<16;e++)t=Me[ee+e],e===6?i+=Ve[t&15|64]:e===8?i+=Ve[t&63|128]:i+=Ve[t],e&1&&e>1&&e<11&&(i+="-");return ee++,i}const us=Zt(e=>U.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300});function ce(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){const i=[];for(let r=0;r<e.length;r++)i[r]=ce(e[r]);return i}if(e instanceof Map){const i=new Map;return e.forEach((r,u)=>{i.set(u,ce(r))}),i}if(e instanceof Set){const i=new Set;return e.forEach(r=>{i.add(ce(r))}),i}const t={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ce(e[i]));return t}const ie=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const t=e.event.async,i=t?void 0:{fn:e.validators.onMount,cause:"mount"},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},u={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},f={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},s=t?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[i],form:e.form});case"submit":return e.runValidation({validators:[r,u,f,s],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[u,s],form:e.form});case"change":return e.runValidation({validators:[r,s],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function ds(e,t){const i=new Map;for(const r of e){const u=r.path??[];let f=t,s="";for(let n=0;n<u.length;n++){const c=u[n];if(c===void 0)continue;const d=typeof c=="object"?c.key:c,l=Number(d);Array.isArray(f)&&!Number.isNaN(l)?s+=`[${l}]`:s+=(n>0?".":"")+String(d),typeof f=="object"&&f!==null?f=f[d]:f=void 0}i.set(s,(i.get(s)??[]).concat(r))}return Object.fromEntries(i)}const it=(e,t)=>{const i=ds(e,t);return{form:i,fields:i}},ae={validate({value:e,validationSource:t},i){const r=i["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return t==="field"?r.issues:it(r.issues,e)},async validateAsync({value:e,validationSource:t},i){const r=await i["~standard"].validate(e);if(r.issues)return t==="field"?r.issues:it(r.issues,e)}},gt=e=>!!e&&"~standard"in e,K={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Se(e){function t(l,o,h){const a=s(l,o,"move",h),m=Math.min(o,h),v=Math.max(o,h);for(let b=m;b<=v;b++)a.push(f(l,b));const M=Object.keys(e.fieldInfo).reduce((b,x)=>(x.startsWith(f(l,o))&&b.set(x,e.getFieldMeta(x)),b),new Map);c(a,o<h?"up":"down"),Object.keys(e.fieldInfo).filter(b=>b.startsWith(f(l,h))).forEach(b=>{const x=b.replace(f(l,h),f(l,o)),p=M.get(x);p&&e.setFieldMeta(b,p)})}function i(l,o){const h=s(l,o,"remove");c(h,"up")}function r(l,o,h){s(l,o,"swap",h).forEach(m=>{if(!m.toString().startsWith(f(l,o)))return;const v=m.toString().replace(f(l,o),f(l,h)),[M,b]=[e.getFieldMeta(m),e.getFieldMeta(v)];M&&e.setFieldMeta(v,M),b&&e.setFieldMeta(m,b)})}function u(l,o){const h=s(l,o,"insert");c(h,"down"),h.forEach(a=>{a.toString().startsWith(f(l,o))&&e.setFieldMeta(a,d())})}function f(l,o){return`${l}[${o}]`}function s(l,o,h,a){const m=[f(l,o)];switch(h){case"swap":m.push(f(l,a));break;case"move":{const[v,M]=[Math.min(o,a),Math.max(o,a)];for(let b=v;b<=M;b++)m.push(f(l,b));break}default:{const v=e.getFieldValue(l),M=Array.isArray(v)?v.length:0;for(let b=o+1;b<M;b++)m.push(f(l,b));break}}return Object.keys(e.fieldInfo).filter(v=>m.some(M=>v.startsWith(M)))}function n(l,o){return l.replace(/\[(\d+)\]/,(h,a)=>{const m=parseInt(a,10);return`[${o==="up"?m+1:Math.max(0,m-1)}]`})}function c(l,o){(o==="up"?l:[...l].reverse()).forEach(a=>{const m=n(a.toString(),o),v=e.getFieldMeta(m);v?e.setFieldMeta(a,v):e.setFieldMeta(a,d())})}const d=()=>K;return{handleArrayMove:t,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:u}}function Oe(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,onDynamic:void 0}}}class nt{constructor(t){var f;this.options={},this.fieldInfo={},this.mount=()=>{var h,a;const s=this.store.subscribe(()=>{us(this)}),n=U.on("request-form-state",m=>{m.payload.id===this._formId&&U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),c=U.on("request-form-reset",m=>{m.payload.id===this._formId&&this.reset()}),d=U.on("request-form-force-submit",m=>{m.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),l=()=>{d(),c(),n(),s.unsubscribe(),U.emit("form-unmounted",{id:this._formId})};(a=(h=this.options.listeners)==null?void 0:h.onMount)==null||a.call(h,{formApi:this});const{onMount:o}=this.options.validators||{};return U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),l},this.update=s=>{if(!s)return;const n=this.options;this.options=s;const c=s.defaultValues&&!Y(s.defaultValues,n.defaultValues)&&!this.state.isTouched,d=!Y(s.defaultState,n.defaultState)&&!this.state.isTouched;!c&&!d||(W(()=>{this.baseStore.setState(()=>Oe(Object.assign({},this.state,d?s.defaultState:{},c?{values:s.defaultValues}:{})))}),U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(s,n)=>{const{fieldMeta:c}=this.state,d=this.resetFieldMeta(c);s&&!(n!=null&&n.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var l;return Oe({...this.options.defaultState,values:s??this.options.defaultValues??((l=this.options.defaultState)==null?void 0:l.values),fieldMetaBase:d})})},this.validateAllFields=async s=>{const n=[];return W(()=>{Object.values(this.fieldInfo).forEach(d=>{if(!d.instance)return;const l=d.instance;n.push(Promise.resolve().then(()=>l.validate(s,{skipFormValidation:!0}))),d.instance.state.meta.isTouched||d.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(n)).flat()},this.validateArrayFieldsStartingFrom=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null,o=[`${s}[${n}]`];for(let v=n+1;v<=(l??0);v++)o.push(`${s}[${v}]`);const h=Object.keys(this.fieldInfo).filter(v=>o.some(M=>v.startsWith(M))),a=[];return W(()=>{h.forEach(v=>{a.push(Promise.resolve().then(()=>this.validateField(v,c)))})}),(await Promise.all(a)).flat()},this.validateField=(s,n)=>{var d,l;const c=(d=this.fieldInfo[s])==null?void 0:d.instance;if(!c){const{hasErrored:o}=this.validateSync(n);return o&&!this.options.asyncAlways?((l=this.getFieldMeta(s))==null?void 0:l.errors)??[]:this.validateAsync(n).then(()=>{var h;return((h=this.getFieldMeta(s))==null?void 0:h.errors)??[]})}return c.state.meta.isTouched||c.setMeta(o=>({...o,isTouched:!0})),c.validate(n)},this.validateSync=s=>{const n=_e(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});let c=!1;const d={};return W(()=>{var h,a,m;for(const v of n){if(!v.validate)continue;const M=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:b,fieldErrors:x}=Ee(M),p=de(v.cause),E=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(x||{})]);for(const F of E){if(this.baseStore.state.fieldMetaBase[F]===void 0&&!(x!=null&&x[F]))continue;const k=this.getFieldMeta(F)??K,{errorMap:A,errorSourceMap:O}=k,C=x==null?void 0:x[F],{newErrorValue:B,newSource:L}=tt({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[p])==="form",previousErrorValue:A==null?void 0:A[p]});L==="form"&&(d[F]={...d[F],[p]:C}),(A==null?void 0:A[p])!==B&&this.setFieldMeta(F,(y=K)=>({...y,errorMap:{...y.errorMap,[p]:B},errorSourceMap:{...y.errorSourceMap,[p]:L}}))}((h=this.state.errorMap)==null?void 0:h[p])!==b&&this.baseStore.setState(F=>({...F,errorMap:{...F.errorMap,[p]:b}})),(b||x)&&(c=!0)}const l=de("submit");(a=this.state.errorMap)!=null&&a[l]&&s!=="submit"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[l]:void 0}}));const o=de("server");(m=this.state.errorMap)!=null&&m[o]&&s!=="server"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}))}),{hasErrored:c,fieldsErrorMap:d}},this.validateAsync=async s=>{const n=$e(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});this.state.isFormValidating||this.baseStore.setState(h=>({...h,isFormValidating:!0}));const c=[];let d;for(const h of n){if(!h.validate)continue;const a=de(h.cause),m=this.state.validationMetaMap[a];m==null||m.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[a]={lastAbortController:v},c.push(new Promise(async M=>{let b;try{b=await new Promise((F,k)=>{setTimeout(async()=>{if(v.signal.aborted)return F(void 0);try{F(await this.runValidator({validate:h.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(A){k(A)}},h.debounceMs)})}catch(F){b=F}const{formError:x,fieldErrors:p}=Ee(b);p&&(d=d?{...d,...p}:p);const E=de(h.cause);for(const F of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[F]===void 0)continue;const k=this.getFieldMeta(F);if(!k)continue;const{errorMap:A,errorSourceMap:O}=k,C=d==null?void 0:d[F],{newErrorValue:B,newSource:L}=tt({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[E])==="form",previousErrorValue:A==null?void 0:A[E]});(A==null?void 0:A[E])!==B&&this.setFieldMeta(F,y=>({...y,errorMap:{...y.errorMap,[E]:B},errorSourceMap:{...y.errorSourceMap,[E]:L}}))}this.baseStore.setState(F=>({...F,errorMap:{...F.errorMap,[E]:x}})),M(d?{fieldErrors:d,errorMapKey:E}:void 0)}))}let l=[];const o={};if(c.length){l=await Promise.all(c);for(const h of l)if(h!=null&&h.fieldErrors){const{errorMapKey:a}=h;for(const[m,v]of Object.entries(h.fieldErrors)){const b={...o[m]||{},[a]:v};o[m]=b}}}return this.baseStore.setState(h=>({...h,isFormValidating:!1})),o},this.validate=s=>{const{hasErrored:n,fieldsErrorMap:c}=this.validateSync(s);return n&&!this.options.asyncAlways?c:this.validateAsync(s)},this._handleSubmit=async s=>{var d,l,o,h,a,m,v,M,b,x;this.baseStore.setState(p=>({...p,isSubmitted:!1,submissionAttempts:p.submissionAttempts+1,isSubmitSuccessful:!1})),W(()=>{Object.values(this.fieldInfo).forEach(p=>{p.instance&&(p.instance.state.meta.isTouched||p.instance.setMeta(E=>({...E,isTouched:!0})))})});const n=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){(l=(d=this.options).onSubmitInvalid)==null||l.call(d,{value:this.state.values,formApi:this,meta:n});return}this.baseStore.setState(p=>({...p,isSubmitting:!0}));const c=()=>{this.baseStore.setState(p=>({...p,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){c(),(h=(o=this.options).onSubmitInvalid)==null||h.call(o,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(p=>p.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){c(),(m=(a=this.options).onSubmitInvalid)==null||m.call(a,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}W(()=>{Object.values(this.fieldInfo).forEach(p=>{var E,F,k;(k=(F=(E=p.instance)==null?void 0:E.options.listeners)==null?void 0:F.onSubmit)==null||k.call(F,{value:p.instance.state.value,fieldApi:p.instance})})}),(M=(v=this.options.listeners)==null?void 0:v.onSubmit)==null||M.call(v,{formApi:this,meta:n});try{await((x=(b=this.options).onSubmit)==null?void 0:x.call(b,{value:this.state.values,formApi:this,meta:n})),W(()=>{this.baseStore.setState(p=>({...p,isSubmitted:!0,isSubmitSuccessful:!0})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),c()})}catch(p){throw this.baseStore.setState(E=>({...E,isSubmitSuccessful:!1})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:p}),c(),p}},this.getFieldValue=s=>be(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFieldInfo=s=>{var n;return(n=this.fieldInfo)[s]||(n[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,n)=>{this.baseStore.setState(c=>({...c,fieldMetaBase:{...c.fieldMetaBase,[s]:Ie(n,c.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((n,c)=>{const d=c;return n[d]=K,n},{}),this.setFieldValue=(s,n,c)=>{var h;const d=(c==null?void 0:c.dontUpdateMeta)??!1,l=(c==null?void 0:c.dontRunListeners)??!1,o=(c==null?void 0:c.dontValidate)??!1;W(()=>{d||this.setFieldMeta(s,a=>({...a,isTouched:!0,isDirty:!0,errorMap:{...a==null?void 0:a.errorMap,onMount:void 0}})),this.baseStore.setState(a=>({...a,values:pe(a.values,s,n)}))}),l||(h=this.getFieldInfo(s).instance)==null||h.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const c=[...Object.keys(this.fieldInfo).filter(d=>{const l=s.toString();return d!==l&&d.startsWith(l)}),s];this.baseStore.setState(d=>{const l={...d};return c.forEach(o=>{l.values=ss(l.values,o),delete this.fieldInfo[o],delete l.fieldMetaBase[o]}),l})},this.pushFieldValue=(s,n,c)=>{this.setFieldValue(s,d=>[...Array.isArray(d)?d:[],n],c)},this.insertFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>[...o.slice(0,n),c,...o.slice(n)],D(d,{dontValidate:!0}));const l=(d==null?void 0:d.dontValidate)??!1;l||await this.validateField(s,"change"),Se(this).handleArrayInsert(s,n),l||await this.validateArrayFieldsStartingFrom(s,n,"change")},this.replaceFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>o.map((h,a)=>a===n?c:h),D(d,{dontValidate:!0})),((d==null?void 0:d.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.removeFieldValue=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null;if(this.setFieldValue(s,h=>h.filter((a,m)=>m!==n),D(c,{dontValidate:!0})),Se(this).handleArrayRemove(s,n),l!==null){const h=`${s}[${l}]`;this.deleteField(h)}((c==null?void 0:c.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.swapFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=o[n],a=o[c];return pe(pe(o,`${n}`,a),`${c}`,h)},D(d,{dontValidate:!0})),Se(this).handleArraySwap(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.moveFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=[...o];return h.splice(c,0,h.splice(n,1)[0]),h},D(d,{dontValidate:!0})),Se(this).handleArrayMove(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.clearFieldValues=(s,n)=>{const c=this.getFieldValue(s),d=Array.isArray(c)?Math.max(c.length-1,0):null;if(this.setFieldValue(s,[],D(n,{dontValidate:!0})),d!==null)for(let o=0;o<=d;o++){const h=`${s}[${o}]`;this.deleteField(h)}((n==null?void 0:n.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[s]:K},values:this.options.defaultValues?pe(n.values,s,be(this.options.defaultValues,s)):n.values}))},this.setErrorMap=s=>{W(()=>{Object.entries(s).forEach(([n,c])=>{const d=n;if(we(c)){const{formError:l,fieldErrors:o}=Ee(c);for(const h of Object.keys(this.fieldInfo))this.getFieldMeta(h)&&this.setFieldMeta(h,m=>({...m,errorMap:{...m.errorMap,[d]:o==null?void 0:o[h]},errorSourceMap:{...m.errorSourceMap,[d]:"form"}}));this.baseStore.setState(h=>({...h,errorMap:{...h.errorMap,[d]:l}}))}else this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[d]:c}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[n,c])=>(Object.keys(c).length&&c.errors.length&&(s[n]={errors:c.errors,errorMap:c.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(t==null?void 0:t.formId)??mt(),this._devtoolsSubmissionOverride=!1;let i=Oe({...t==null?void 0:t.defaultState,values:(t==null?void 0:t.defaultValues)??((f=t==null?void 0:t.defaultState)==null?void 0:f.values)});if(t!=null&&t.transform){i=t.transform({state:i}).state;for(const s of Object.keys(i.errorMap)){const n=i.errorMap[s];if(!(n===void 0||!we(n)))for(const c of Object.keys(n.fields)){const d=n.fields[c];if(d===void 0)continue;const l=i.fieldMetaBase[c];i.fieldMetaBase[c]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...l??{},errorSourceMap:{...(l==null?void 0:l.errorSourceMap)??{},onChange:"form"},errorMap:{...(l==null?void 0:l.errorMap)??{},[s]:d}}}}}this.baseStore=Fe(i);let r;this.fieldMetaDerived=Fe(s=>{var l,o,h;const n=this.baseStore.get();let c=0;const d={};for(const a of Object.keys(n.fieldMetaBase)){const m=n.fieldMetaBase[a],v=r==null?void 0:r.fieldMetaBase[a],M=s==null?void 0:s[a],b=be(n.values,a);let x=M==null?void 0:M.errors;if(!v||m.errorMap!==v.errorMap){x=Object.values(m.errorMap??{}).filter(A=>A!==void 0);const k=(l=this.getFieldInfo(a))==null?void 0:l.instance;(!k||!k.options.disableErrorFlat)&&(x=x.flat(1))}const p=!ls(x),E=!m.isDirty,F=Y(b,be(this.options.defaultValues,a))||Y(b,(h=(o=this.getFieldInfo(a))==null?void 0:o.instance)==null?void 0:h.options.defaultValue);if(M&&M.isPristine===E&&M.isValid===p&&M.isDefaultValue===F&&M.errors===x&&m===v){d[a]=M,c++;continue}d[a]={...m,errors:x??[],isPristine:E,isValid:p,isDefaultValue:F}}return Object.keys(n.fieldMetaBase).length?s&&c===Object.keys(n.fieldMetaBase).length?s:(r=this.baseStore.get(),d):d});let u;this.store=Fe(s=>{var L,y;const n=this.baseStore.get(),c=this.fieldMetaDerived.get(),d=Object.values(c).filter(Boolean),l=d.some(w=>w.isValidating),o=d.every(w=>w.isValid),h=d.some(w=>w.isTouched),a=d.some(w=>w.isBlurred),m=d.every(w=>w.isDefaultValue),v=h&&((L=n.errorMap)==null?void 0:L.onMount),M=d.some(w=>w.isDirty),b=!M,x=!!((y=n.errorMap)!=null&&y.onMount||d.some(w=>{var j;return(j=w==null?void 0:w.errorMap)==null?void 0:j.onMount})),p=!!l;let E=(s==null?void 0:s.errors)??[];(!u||n.errorMap!==u.errorMap)&&(E=Object.values(n.errorMap).reduce((w,j)=>j===void 0?w:j&&we(j)?(w.push(j.form),w):(w.push(j),w),[]));const F=E.length===0,k=o&&F,A=this.options.canSubmitWhenInvalid??!1,O=n.submissionAttempts===0&&!h&&!x||!p&&!n.isSubmitting&&k||A;let C=n.errorMap;if(v&&(E=E.filter(w=>w!==n.errorMap.onMount),C=Object.assign(C,{onMount:void 0})),s&&u&&s.errorMap===C&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===E&&s.isFieldsValidating===l&&s.isFieldsValid===o&&s.isFormValid===F&&s.isValid===k&&s.canSubmit===O&&s.isTouched===h&&s.isBlurred===a&&s.isPristine===b&&s.isDefaultValue===m&&s.isDirty===M&&Y(u,n))return s;const B={...n,errorMap:C,fieldMeta:this.fieldMetaDerived.state,errors:E,isFieldsValidating:l,isFieldsValid:o,isFormValid:F,isValid:k,canSubmit:O,isTouched:h,isBlurred:a,isPristine:b,isDefaultValue:m,isDirty:M};return u=this.baseStore.get(),B}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(t){return gt(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}handleSubmit(t){return this._handleSubmit(t)}}function Ee(e){if(e){if(we(e)){const t=Ee(e.form).formError,i=e.fields;return{formError:t,fieldErrors:i}}return{formError:e}}return{formError:void 0}}function de(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class at{constructor(t){this.options={},this.mount=()=>{var u,f;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const i=this.getInfo();i.instance=this,this.update(this.options);const{onMount:r}=this.options.validators||{};if(r){const s=this.runValidator({validate:r,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(n=>({...n,errorMap:{...n==null?void 0:n.errorMap,onMount:s},errorSourceMap:{...n==null?void 0:n.errorSourceMap,onMount:"field"}}))}return(f=(u=this.options.listeners)==null?void 0:u.onMount)==null||f.call(u,{value:this.state.value,fieldApi:this}),()=>{var n,c,d,l;for(const[o,h]of Object.entries(this.timeoutIds.validations))h&&(clearTimeout(h),this.timeoutIds.validations[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.listeners))h&&(clearTimeout(h),this.timeoutIds.listeners[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.formListeners))h&&(clearTimeout(h),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,h]of Object.entries(s.validationMetaMap))h==null||h.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var h,a,m;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...K,isTouched:((h=o.fieldMetaBase[this.name])==null?void 0:h.isTouched)??K.isTouched,isBlurred:((a=o.fieldMetaBase[this.name])==null?void 0:a.isBlurred)??K.isBlurred,isDirty:((m=o.fieldMetaBase[this.name])==null?void 0:m.isDirty)??K.isDirty}}}}),s.instance=null,(c=(n=this.options.listeners)==null?void 0:n.onUnmount)==null||c.call(n,{value:this.state.value,fieldApi:this}),(l=(d=this.form.options.listeners)==null?void 0:d.onFieldUnmount)==null||l.call(d,{formApi:this.form,fieldApi:this})}}},this.update=i=>{if(this.options=i,this.name=i.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const r=this.form.getFieldValue(this.name);Y(r,i.defaultValue)||this.form.setFieldValue(this.name,i.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(i,r)=>{this.form.setFieldValue(this.name,i,D(r,{dontRunListeners:!0,dontValidate:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener(),r!=null&&r.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=i=>this.form.setFieldMeta(this.name,i),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(i,r)=>{this.form.pushFieldValue(this.name,i,D(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(i,r,u)=>{this.form.insertFieldValue(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(i,r,u)=>{this.form.replaceFieldValue(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(i,r)=>{this.form.removeFieldValue(this.name,i,D(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(i,r,u)=>{this.form.swapFieldValues(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(i,r,u)=>{this.form.moveFieldValues(this.name,i,r,D(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=i=>{this.form.clearFieldValues(this.name,D(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=i=>{const r=Object.values(this.form.fieldInfo),u=[];for(const f of r){if(!f.instance)continue;const{onChangeListenTo:s,onBlurListenTo:n}=f.instance.options.validators||{};i==="change"&&(s!=null&&s.includes(this.name))&&u.push(f.instance),i==="blur"&&(n!=null&&n.includes(this.name))&&u.push(f.instance)}return u},this.validateSync=(i,r)=>{var d;const u=_e(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),s=this.getLinkedFields(i).reduce((l,o)=>{const h=_e(i,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||ie});return h.forEach(a=>{a.field=o}),l.concat(h)},[]);let n=!1;W(()=>{const l=(o,h)=>{var x;const a=xe(h.cause),m=h.validate?rt(o.runValidator({validate:h.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,v=r[a],{newErrorValue:M,newSource:b}=st({formLevelError:v,fieldLevelError:m});((x=o.state.meta.errorMap)==null?void 0:x[a])!==M&&o.setMeta(p=>({...p,errorMap:{...p.errorMap,[a]:M},errorSourceMap:{...p.errorSourceMap,[a]:b}})),M&&(n=!0)};for(const o of u)l(this,o);for(const o of s)o.validate&&l(o.field,o)});const c=xe("submit");return(d=this.state.meta.errorMap)!=null&&d[c]&&i!=="submit"&&!n&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[c]:void 0},errorSourceMap:{...l.errorSourceMap,[c]:void 0}})),{hasErrored:n}},this.validateAsync=async(i,r)=>{const u=$e(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),f=await r,s=this.getLinkedFields(i),n=s.reduce((a,m)=>{const v=$e(i,{...m.options,form:m.form,fieldName:m.name,validationLogic:m.form.options.validationLogic||ie});return v.forEach(M=>{M.field=m}),a.concat(v)},[]),c=[],d=[],l=u.some(a=>a.validate)||n.some(a=>a.validate);if(l){this.state.meta.isValidating||this.setMeta(a=>({...a,isValidating:!0}));for(const a of s)a.setMeta(m=>({...m,isValidating:!0}))}const o=(a,m,v)=>{const M=xe(m.cause),b=a.getInfo(),x=b.validationMetaMap[M];x==null||x.lastAbortController.abort();const p=new AbortController;b.validationMetaMap[M]={lastAbortController:p},v.push(new Promise(async E=>{var B;let F;try{F=await new Promise((L,y)=>{a.timeoutIds.validations[m.cause]&&clearTimeout(a.timeoutIds.validations[m.cause]),a.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(p.signal.aborted)return L(void 0);try{L(await this.runValidator({validate:m.validate,value:{value:a.store.state.value,fieldApi:a,signal:p.signal,validationSource:"field"},type:"validateAsync"}))}catch(w){y(w)}},m.debounceMs)})}catch(L){F=L}if(p.signal.aborted)return E(void 0);const k=rt(F),A=(B=f[a.name])==null?void 0:B[M],{newErrorValue:O,newSource:C}=st({formLevelError:A,fieldLevelError:k});if(a.getInfo().instance!==a)return E(void 0);a.setMeta(L=>({...L,errorMap:{...L==null?void 0:L.errorMap,[M]:O},errorSourceMap:{...L.errorSourceMap,[M]:C}})),E(O)}))};for(const a of u)a.validate&&o(this,a,c);for(const a of n)a.validate&&o(a.field,a,d);let h=[];if((c.length||d.length)&&(h=await Promise.all(c),await Promise.all(d)),l){this.setMeta(a=>({...a,isValidating:!1}));for(const a of s)a.setMeta(m=>({...m,isValidating:!1}))}return h.filter(Boolean)},this.validate=(i,r)=>{var n;if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:u}=r!=null&&r.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(i),{hasErrored:f}=this.validateSync(i,u[this.name]??{});if(f&&!this.options.asyncAlways)return(n=this.getInfo().validationMetaMap[xe(i)])==null||n.lastAbortController.abort(),this.state.meta.errors;const s=r!=null&&r.skipFormValidation?Promise.resolve({}):this.form.validateAsync(i);return this.validateAsync(i,s)},this.handleChange=i=>{this.setValue(i)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=i=>{this.setMeta(r=>({...r,errorMap:{...r.errorMap,...i}}))},this.parseValueWithSchema=i=>ae.validate({value:this.state.value,validationSource:"field"},i),this.parseValueWithSchemaAsync=i=>ae.validateAsync({value:this.state.value,validationSource:"field"},i),this.triggerOnChangeListener=()=>{var u,f,s,n,c,d;const i=(u=this.form.options.listeners)==null?void 0:u.onChangeDebounceMs;i&&i>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var l,o;(o=(l=this.form.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{formApi:this.form,fieldApi:this})},i)):(s=(f=this.form.options.listeners)==null?void 0:f.onChange)==null||s.call(f,{formApi:this.form,fieldApi:this});const r=(n=this.options.listeners)==null?void 0:n.onChangeDebounceMs;r&&r>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var l,o;(o=(l=this.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{value:this.state.value,fieldApi:this})},r)):(d=(c=this.options.listeners)==null?void 0:c.onChange)==null||d.call(c,{value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=Fe(i=>{this.form.store.get();const r=this.form.getFieldMeta(this.name)??{...K,...t.defaultMeta};let u=this.form.getFieldValue(this.name);return!r.isTouched&&u===void 0&&this.options.defaultValue!==void 0&&!Y(u,this.options.defaultValue)&&(u=this.options.defaultValue),i&&i.value===u&&i.meta===r?i:{value:u,meta:r}})}get state(){return this.store.state}runValidator(t){return gt(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}triggerOnBlurListener(){var r,u,f,s,n,c;const t=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;t&&t>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,l;(l=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{formApi:this.form,fieldApi:this})},t)):(f=(u=this.form.options.listeners)==null?void 0:u.onBlur)==null||f.call(u,{formApi:this.form,fieldApi:this});const i=(s=this.options.listeners)==null?void 0:s.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,l;(l=(d=this.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{value:this.state.value,fieldApi:this})},i)):(c=(n=this.options.listeners)==null?void 0:n.onBlur)==null||c.call(n,{value:this.state.value,fieldApi:this})}}function rt(e){if(e)return e}function xe(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function cs(e,t){if(!t)return;const i=Object.assign({},e,{state:ce(e.state)});t(i),i.fieldInfo!==e.fieldInfo&&(e.fieldInfo=i.fieldInfo),i.options!==e.options&&(e.options=i.options);const u=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((f,s)=>(e.state[s]!==i.state[s]&&(f[s]=i.state[s]),f),{});return W(()=>{Object.keys(u).length&&e.baseStore.setState(f=>({...f,...u})),i.state.errorMap!==e.state.errorMap&&e.setErrorMap(i.state.errorMap)}),i}const ne=typeof window<"u"?V.useLayoutEffect:V.useEffect;function hs(e){const[t,i]=V.useState(()=>({form:e.form,name:e.name})),[r,u]=V.useState(()=>new at({...e}));(t.form!==e.form||t.name!==e.name)&&(u(new at({...e})),i({form:e.form,name:e.name}));const f=Q(r.store,e.mode==="array"?a=>Object.keys(a.value??[]).length:a=>a.value),s=Q(r.store,a=>a.meta.isTouched),n=Q(r.store,a=>a.meta.isBlurred),c=Q(r.store,a=>a.meta.isDirty),d=Q(r.store,a=>a.meta.errorMap),l=Q(r.store,a=>a.meta.errorSourceMap),o=Q(r.store,a=>a.meta.isValidating),h=V.useMemo(()=>{const m={...r,get state(){return{value:e.mode==="array"?r.state.value:f,get meta(){return{...r.state.meta,isTouched:s,isBlurred:n,isDirty:c,errorMap:d,errorSourceMap:l,isValidating:o}}}}};return m.Field=vt,m},[r,e.mode,f,s,n,c,d,l,o]);return ne(r.mount,[r]),ne(()=>{r.update(e)}),h}const vt=(({children:e,...t})=>{const i=hs(t),r=V.useMemo(()=>Ie(e,i),[e,i]);return g.jsx(g.Fragment,{children:r})});function fs(){return V.useState(()=>mt())[0]}const ms=St,gs=V.version.split(".")[0]==="17"?fs:ms.useId;function vs({form:e,selector:t=r=>r,children:i}){const r=Q(e.store,t);return g.jsx(g.Fragment,{children:Ie(i,r)})}function bs(e){const t=gs(),[i,r]=V.useState(e==null?void 0:e.formId),[u,f]=V.useState(()=>new nt({...e,formId:(e==null?void 0:e.formId)??t}));if(i!==(e==null?void 0:e.formId)){const c=(e==null?void 0:e.formId)??t;f(new nt({...e,formId:c})),r(c)}const s=V.useMemo(()=>{const c={...u,handleSubmit:((...d)=>u._handleSubmit(...d)),get formId(){return u._formId},get state(){return u.store.state}};return c.Field=function(l){return g.jsx(vt,{...l,form:u})},c.Subscribe=function(l){return g.jsx(vs,{form:u,selector:l.selector,children:l.children})},c},[u]);ne(u.mount,[]),ne(()=>{u.update(e)});const n=V.useRef(!1);return ne(()=>{n.current&&e!=null&&e.transform&&cs(u,e.transform)},[u,e==null?void 0:e.transform]),ne(()=>{n.current=!0}),s}function ps(e){const{open:t,defaultOpen:i,onOpenChange:r,disabled:u}=e,f=t!==void 0,[s,n]=Rt({controlled:t,default:i,name:"Collapsible",state:"open"}),{mounted:c,setMounted:d,transitionStatus:l}=Dt(s,!0,!0),[o,h]=V.useState(s),[{height:a,width:m},v]=V.useState({height:void 0,width:void 0}),M=_t(),[b,x]=V.useState(),p=b??M,[E,F]=V.useState(!1),[k,A]=V.useState(!1),O=V.useRef(null),C=V.useRef(null),B=V.useRef(null),L=V.useRef(null),y=$t(L,!1),w=Ue(j=>{const I=!s,T=ht(Ut,j.nativeEvent);if(r(I,T),T.isCanceled)return;const z=L.current;C.current==="css-animation"&&z!=null&&z.style.removeProperty("animation-name"),!E&&!k&&(C.current!=null&&C.current!=="css-animation"&&!c&&I&&d(!0),C.current==="css-animation"&&(!o&&I&&h(!0),!c&&I&&d(!0))),n(I),C.current==="none"&&c&&!I&&d(!1)});return Z(()=>{f&&C.current==="none"&&!s&&d(!1)},[f,s,t,d]),V.useMemo(()=>({abortControllerRef:O,animationTypeRef:C,disabled:u,handleTrigger:w,height:a,mounted:c,open:s,panelId:p,panelRef:L,runOnceAnimationsFinish:y,setDimensions:v,setHiddenUntilFound:F,setKeepMounted:A,setMounted:d,setOpen:n,setPanelIdState:x,setVisible:h,transitionDimensionRef:B,transitionStatus:l,visible:o,width:m}),[O,C,u,w,a,c,s,p,L,y,v,F,A,d,n,h,B,l,o,m])}const bt=V.createContext(void 0);function pt(){const e=V.useContext(bt);if(e===void 0)throw new Error(xt(15));return e}let he=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ze.startingStyle]="startingStyle",e[e.endingStyle=Ze.endingStyle]="endingStyle",e})({}),ys=(function(e){return e.panelOpen="data-panel-open",e})({});const Ms={[he.open]:""},Ss={[he.closed]:""},xs={open(e){return e?{[ys.panelOpen]:""}:null}},Fs={open(e){return e?Ms:Ss}},yt={...Fs,...ft},ws=V.forwardRef(function(t,i){const{render:r,className:u,defaultOpen:f=!1,disabled:s=!1,onOpenChange:n,open:c,style:d,...l}=t,o=Ue(n),h=ps({open:c,defaultOpen:f,onOpenChange:o,disabled:s}),a=V.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),m=V.useMemo(()=>({...h,onOpenChange:o,state:a}),[h,o,a]),v=We("div",t,{state:a,ref:i,props:l,stateAttributesMapping:yt});return g.jsx(bt.Provider,{value:m,children:v})}),Vs={...xs,...ft},Es=V.forwardRef(function(t,i){const{panelId:r,open:u,handleTrigger:f,state:s,disabled:n}=pt(),{className:c,disabled:d=n,id:l,render:o,nativeButton:h=!0,style:a,...m}=t,{getButtonProps:v,buttonRef:M}=Ft({disabled:d,focusableWhenDisabled:!0,native:h}),b=V.useMemo(()=>({"aria-controls":u?r:void 0,"aria-expanded":u,onClick:f}),[r,u,f]);return We("button",t,{state:s,ref:[i,M],props:[b,m,v],stateAttributesMapping:Vs})});let As=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function js(e){const{abortControllerRef:t,animationTypeRef:i,externalRef:r,height:u,hiddenUntilFound:f,keepMounted:s,id:n,mounted:c,onOpenChange:d,open:l,panelRef:o,runOnceAnimationsFinish:h,setDimensions:a,setMounted:m,setOpen:v,setVisible:M,transitionDimensionRef:b,visible:x,width:p}=e,E=V.useRef(!1),F=V.useRef(null),k=V.useRef(l),A=V.useRef(l),O=Wt(),C=V.useMemo(()=>i.current==="css-animation"?!x:!l&&!c,[l,c,x,i]),B=Ue(y=>{if(!y)return;if(i.current==null||b.current==null){const I=getComputedStyle(y),T=I.animationName!=="none"&&I.animationName!=="",z=I.transitionDuration!=="0s"&&I.transitionDuration!=="";T&&z||(I.animationName==="none"&&I.transitionDuration!=="0s"?i.current="css-transition":I.animationName!=="none"&&I.transitionDuration==="0s"?i.current="css-animation":i.current="none"),y.getAttribute(As.orientation)==="horizontal"||I.transitionProperty.indexOf("width")>-1?b.current="width":b.current="height"}if(i.current!=="css-transition")return;(u===void 0||p===void 0)&&(a({height:y.scrollHeight,width:y.scrollWidth}),A.current&&y.style.setProperty("transition-duration","0s"));let w=-1,j=-1;return w=$.request(()=>{A.current=!1,j=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})}),()=>{$.cancel(w),$.cancel(j)}}),L=wt(r,o,B);return Z(()=>{if(i.current!=="css-transition")return;const y=o.current;if(!y)return;let w=-1;if(t.current!=null&&(t.current.abort(),t.current=null),l){const j={"justify-content":y.style.justifyContent,"align-items":y.style.alignItems,"align-content":y.style.alignContent,"justify-items":y.style.justifyItems};Object.keys(j).forEach(I=>{y.style.setProperty(I,"initial","important")}),!A.current&&!s&&y.setAttribute(he.startingStyle,""),a({height:y.scrollHeight,width:y.scrollWidth}),w=$.request(()=>{Object.entries(j).forEach(([I,T])=>{T===""?y.style.removeProperty(I):y.style.setProperty(I,T)})})}else{if(y.scrollHeight===0&&y.scrollWidth===0)return;a({height:y.scrollHeight,width:y.scrollWidth});const j=new AbortController;t.current=j;const I=j.signal;let T=null;const z=he.endingStyle;return T=new MutationObserver(Le=>{Le.some(Ce=>Ce.type==="attributes"&&Ce.attributeName===z)&&(T==null||T.disconnect(),T=null,h(()=>{a({height:0,width:0}),y.style.removeProperty("content-visibility"),m(!1),t.current===j&&(t.current=null)},I))}),T.observe(y,{attributes:!0,attributeFilter:[z]}),()=>{T==null||T.disconnect(),O.cancel(),t.current===j&&(j.abort(),t.current=null)}}return()=>{$.cancel(w)}},[t,i,O,f,s,c,l,o,h,a,m]),Z(()=>{if(i.current!=="css-animation")return;const y=o.current;y&&(F.current=y.style.animationName||F.current,y.style.setProperty("animation-name","none"),a({height:y.scrollHeight,width:y.scrollWidth}),!k.current&&!E.current&&y.style.removeProperty("animation-name"),l?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),M(!0)):(t.current=new AbortController,h(()=>{m(!1),M(!1),t.current=null},t.current.signal)))},[t,i,l,o,h,a,m,M,x]),Vt(()=>{const y=$.request(()=>{k.current=!1});return()=>$.cancel(y)}),Z(()=>{if(!f)return;const y=o.current;if(!y)return;let w=-1,j=-1;return l&&E.current&&(y.style.transitionDuration="0s",a({height:y.scrollHeight,width:y.scrollWidth}),w=$.request(()=>{E.current=!1,j=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})})),()=>{$.cancel(w),$.cancel(j)}},[f,l,o,a]),Z(()=>{const y=o.current;y&&f&&C&&(y.setAttribute("hidden","until-found"),i.current==="css-transition"&&y.setAttribute(he.startingStyle,""))},[f,C,i,o]),V.useEffect(function(){const w=o.current;if(!w)return;function j(I){E.current=!0,v(!0),d(!0,ht(zt,I))}return Kt(w,"beforematch",j)},[d,o,v]),V.useMemo(()=>({props:{hidden:C,id:n,ref:L}}),[C,n,L])}let ot=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const Is=V.forwardRef(function(t,i){const{className:r,hiddenUntilFound:u,keepMounted:f,render:s,id:n,style:c,...d}=t,{abortControllerRef:l,animationTypeRef:o,height:h,mounted:a,onOpenChange:m,open:v,panelId:M,panelRef:b,runOnceAnimationsFinish:x,setDimensions:p,setHiddenUntilFound:E,setKeepMounted:F,setMounted:k,setPanelIdState:A,setOpen:O,setVisible:C,state:B,transitionDimensionRef:L,visible:y,width:w,transitionStatus:j}=pt(),I=u??!1,T=f??!1;Z(()=>{if(n)return A(n),()=>{A(void 0)}},[n,A]),Z(()=>{E(I)},[E,I]),Z(()=>{F(T)},[F,T]);const{props:z}=js({abortControllerRef:l,animationTypeRef:o,externalRef:i,height:h,hiddenUntilFound:I,id:M,keepMounted:T,mounted:a,onOpenChange:m,open:v,panelRef:b,runOnceAnimationsFinish:x,setDimensions:p,setMounted:k,setOpen:O,setVisible:C,transitionDimensionRef:L,visible:y,width:w});qt({open:v&&j==="idle",ref:b,onComplete(){v&&p({height:void 0,width:void 0})}});const Le=V.useMemo(()=>({...B,transitionStatus:j}),[B,j]),ze=We("div",t,{state:Le,ref:[i,b],props:[z,{style:{[ot.collapsiblePanelHeight]:h===void 0?"auto":`${h}px`,[ot.collapsiblePanelWidth]:w===void 0?"auto":`${w}px`}},d],stateAttributesMapping:yt});return T||I||a?ze:null});function Pe({...e}){return g.jsx(ws,{"data-slot":"collapsible",...e})}function Be({...e}){return g.jsx(Es,{"data-slot":"collapsible-trigger",...e})}function Ne({...e}){return g.jsx(Is,{"data-slot":"collapsible-content",...e})}function Ls({className:e,...t}){return g.jsx("label",{"data-slot":"label",className:ue("flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Cs({className:e,...t}){return g.jsx("div",{"data-slot":"field-group",className:ue("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const ks=Et("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function Ts({className:e,orientation:t="vertical",...i}){return g.jsx("fieldset",{"data-slot":"field","data-orientation":t,className:ue(ks({orientation:t}),e),...i})}function Os({className:e,...t}){return g.jsx(Ls,{"data-slot":"field-label",className:ue("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Ps({className:e,children:t,errors:i,...r}){const u=V.useMemo(()=>{var s;if(t)return t;if(!(i!=null&&i.length))return null;const f=[...new Map(i.map(n=>[n==null?void 0:n.message,n])).values()];return(f==null?void 0:f.length)===1?(s=f[0])==null?void 0:s.message:g.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:f.map(n=>(n==null?void 0:n.message)&&g.jsx("li",{children:n.message},n.message))})},[t,i]);return u?g.jsx("div",{role:"alert","data-slot":"field-error",className:ue("text-xs/relaxed font-normal text-destructive",e),...r,children:u}):null}function Bs({className:e,...t}){return g.jsx("textarea",{"data-slot":"textarea",className:ue("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function Ns(e){const t=At(),{data:i=[],isLoading:r}=Qe(o=>o.from({m:dt}).where(({m:h})=>jt(h.id,e)),[e]),u=i[0]??null,{data:f=[]}=Qe(o=>o.from({p:It}),[]),s=()=>{kt(e,{needsReview:!1}).then(()=>ke.invalidateQueries({queryKey:["memories"]}))},n=async o=>{try{return await Ct(e,o),await ke.invalidateQueries({queryKey:["memories"]}),!0}catch{return Ye.error("Failed to add project — try again"),!1}},c=async o=>{try{await Lt(e,o),await ke.invalidateQueries({queryKey:["memories"]})}catch{Ye.error("Failed to remove project — try again")}},d=()=>void t({to:"/memories"}),l=f.filter(o=>!(u!=null&&u.projects.some(h=>h.id===o.id)));return{memory:u,isLoading:r,availableProjects:l,handleApprove:s,handleAddProject:n,handleRemoveProject:c,handleClose:d}}const Rs=Pt({content:Xe().min(1,"Content is required."),type:Bt(ct),tagsInput:Xe()});function Re({field:e,label:t,description:i,children:r}){const u=e.state.meta.isTouched&&!e.state.meta.isValid;return g.jsxs(Ts,{"data-invalid":u,children:[g.jsx(Os,{htmlFor:e.name,className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:t}),r,i,u&&g.jsx(Ps,{errors:e.state.meta.errors})]})}function Ds({memory:e,availableProjects:t,handleApprove:i,handleAddProject:r,handleRemoveProject:u,handleClose:f}){const[s,n]=V.useState(!1),[c,d]=V.useState("");V.useEffect(()=>{if(!s)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[s]);const l=bs({defaultValues:{content:e.content,type:e.type,tagsInput:e.tags.join(", ")},validators:{onSubmit:Rs},onSubmit:({value:a})=>{const m=a.tagsInput.split(",").map(v=>v.trim()).filter(Boolean);dt.update(e.id,v=>{a.content!==e.content&&(v.content=a.content),a.type!==e.type&&(v.type=a.type),JSON.stringify(m)!==JSON.stringify(e.tags)&&(v.tags=m)}),n(!0)}}),o=Jt({shouldBlockFn:()=>l.state.isDirty,withResolver:!0}),h=async()=>{if(!c)return;await r(c)&&d("")};return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ve,{variant:e.type,children:e.type}),e.reviewEvents.length>0&&g.jsx(ve,{variant:"destructive",title:"Flagged for review — possible duplicate or conflict with another memory",children:"needs review"}),e.pinned&&g.jsx(ve,{variant:"default",children:"pinned"})]}),g.jsx(se,{variant:"ghost",size:"icon-sm",onClick:f,"aria-label":"Close",children:g.jsx(Je,{weight:"regular"})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[g.jsxs(Cs,{children:[g.jsx(l.Field,{name:"content",children:a=>g.jsx(Re,{field:a,label:"Content",children:g.jsx(Bs,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),rows:8,className:"min-h-32 font-[var(--font-heading)] text-sm","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})}),g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsx(l.Field,{name:"type",children:a=>g.jsx(Re,{field:a,label:"Type",description:g.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:Ot[a.state.value]}),children:g.jsx(et,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),className:"w-full",children:ct.map(m=>g.jsx(Te,{value:m,children:Tt(m)},m))})})}),g.jsx(l.Field,{name:"tagsInput",children:a=>g.jsx(Re,{field:a,label:"Tags",children:g.jsx(Ht,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),placeholder:"tag1, tag2","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})})]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Projects"}),g.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.projects.length===0&&g.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Global (no project)"}),e.projects.map(a=>g.jsxs(ve,{variant:"secondary",className:"gap-1 rounded-full text-[11px]",children:[a.name,g.jsx("button",{type:"button",onClick:()=>void u(a.id),className:"hover:text-destructive transition-colors leading-none","aria-label":`Remove from ${a.name}`,children:g.jsx(Je,{weight:"regular",className:"size-2.5"})})]},a.id))]}),t.length>0&&g.jsxs("div",{className:"flex gap-1",children:[g.jsxs(et,{value:c,onChange:a=>d(a.target.value),size:"sm",className:"flex-1",children:[g.jsx(Te,{value:"",children:"Add to project…"}),t.map(a=>g.jsx(Te,{value:a.id,children:a.name},a.id))]}),g.jsx(se,{variant:"outline",size:"sm",disabled:!c,onClick:()=>void h(),children:"+"})]})]}),e.reviewEvents.length>0&&g.jsxs(Pe,{defaultOpen:!0,className:"group pt-2 border-t border-border",children:[g.jsxs(Be,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[g.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Review reasons"]}),g.jsx(Ne,{className:"space-y-2 mt-2",children:e.reviewEvents.map(a=>g.jsxs("div",{className:"rounded border border-border p-2 space-y-1 text-[11px]",children:[g.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[g.jsxs("span",{className:"font-medium text-destructive",children:[Math.round(a.similarity*100),"% similarity match"]}),g.jsx("span",{children:new Date(a.createdAt).toLocaleString()})]}),a.conflictingMemoryId?g.jsxs("div",{className:"text-muted-foreground",children:["Conflicting memory:"," ",g.jsx("span",{className:"font-mono text-[10px]",children:a.conflictingMemoryId})]}):g.jsx("div",{className:"text-muted-foreground italic",children:"Conflicting memory deleted"}),a.conflictContentSnapshot&&g.jsxs(Pe,{children:[g.jsx(Be,{className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"Show conflicting content ›"}),g.jsx(Ne,{children:g.jsx("p",{className:"mt-1 text-foreground bg-muted rounded px-2 py-1 whitespace-pre-wrap",children:a.conflictContentSnapshot})})]})]},a.id))})]}),g.jsxs(Pe,{className:"group pt-2 border-t border-border",children:[g.jsxs(Be,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[g.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Details"]}),g.jsxs(Ne,{className:"space-y-1 mt-2",children:[e.sourceHarness&&g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Source"}),g.jsx("span",{children:e.sourceHarness})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Accessed"}),g.jsxs("span",{children:[e.accessCount,"×"]})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Updated"}),g.jsx("span",{children:new Date(e.updatedAt).toLocaleString()})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Created"}),g.jsx("span",{children:new Date(e.createdAt).toLocaleString()})]})]})]})]}),g.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0",children:[o.status==="blocked"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-destructive",children:"Unsaved changes"}),g.jsx(se,{variant:"ghost",size:"sm",onClick:()=>o.proceed(),children:"Discard"}),g.jsx(se,{variant:"outline",size:"sm",onClick:()=>o.reset(),children:"Keep editing"})]}),e.reviewEvents.length>0&&o.status!=="blocked"&&g.jsx(se,{variant:"outline",size:"sm",onClick:i,title:"Mark as reviewed — this memory was flagged as a possible duplicate or conflict",children:"Mark reviewed"}),g.jsx("div",{className:"flex-1"}),g.jsx(se,{variant:"default",size:"sm",disabled:!l.state.isDirty,onClick:()=>void l.handleSubmit(),children:s?"Saved":"Save"})]})]})}function _s({id:e}){const{memory:t,isLoading:i,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n}=Ns(e);return i||!t?g.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i?"Loading…":"Memory not found"}):g.jsx(Ds,{memory:t,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n},t.id)}function Ks(){const{id:e}=Nt.useParams();return g.jsx(_s,{id:e},e)}export{Ks as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-BCPCyhdz.js";import{f as t}from"./MagnifyingGlass.es-ERvQA8v5.js";function o(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[e.jsx(t,{weight:"regular",className:"size-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a memory to view or edit"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Press"," ",e.jsx("kbd",{className:"font-mono px-1 py-0.5 rounded border border-border text-[10px]",children:"/"})," to search"]})]})}export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);import{E as k,d as j,Z as ae,h as se,Y as ie,r as a,e as E,l as A,k as le,B as oe,N as v,x as ue,t as ce,n as de,j as x,H as M}from"./index-DZxM00o8.js";const fe="none",je="trigger-press",Ze="trigger-hover",Be="outside-press",He="close-press",ze="focus-out",$e="escape-key",Ke="imperative-action";function me(e,t,n,i){let s=!1,r=!1;const o=k;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...o}}function Ye(e,t,n,i){return e.addEventListener(t,n,i),()=>{e.removeEventListener(t,n,i)}}const R=null;class ve{constructor(){p(this,"callbacks",[]);p(this,"callbacksCount",0);p(this,"nextId",1);p(this,"startId",1);p(this,"isScheduled",!1);p(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let r=0;r<n.length;r+=1)(s=n[r])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const T=new ve;class g{constructor(){p(this,"currentId",R);p(this,"cancel",()=>{this.currentId!==R&&(T.cancel(this.currentId),this.currentId=R)});p(this,"disposeEffect",()=>this.cancel)}static create(){return new g}static request(t){return T.request(t)}static cancel(t){return T.cancel(t)}request(t){this.cancel(),this.currentId=T.request(()=>{this.currentId=R,t()})}}function pe(){const e=j(g.create).current;return ae(e.disposeEffect),e}function ge(e){return(e==null?void 0:e.ownerDocument)||document}function he(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Ge(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&se(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Je(e){return"composedPath"in e?e.composedPath()[0]:e.target}const be={...ie};let _=0;function Ee(e,t="mui"){const[n,i]=a.useState(e),s=e||n;return a.useEffect(()=>{n==null&&(_+=1,i(`${t}-${_}`))},[n,t]),s}const q=be.useId;function Ie(e,t){if(q!==void 0){const n=q();return e??(t?`${t}-${n}`:n)}return Ee(e,t)}function xe(e){return e==null?e:"current"in e?e.current:e}function We(e,t=!1,n=!1){const[i,s]=a.useState(e&&t?"idle":void 0),[r,o]=a.useState(e);return e&&!r&&(o(!0),s("starting")),!e&&r&&i!=="ending"&&!n&&s("ending"),!e&&!r&&i==="ending"&&s(void 0),E(()=>{if(!e&&r&&i!=="ending"&&n){const l=g.request(()=>{s("ending")});return()=>{g.cancel(l)}}},[e,r,i,n]),E(()=>{if(!e||t)return;const l=g.request(()=>{s(void 0)});return()=>{g.cancel(l)}},[t,e]),E(()=>{if(!e||!t)return;e&&r&&i!=="idle"&&s("starting");const l=g.request(()=>{s("idle")});return()=>{g.cancel(l)}},[t,e,r,i]),{mounted:r,setMounted:o,transitionStatus:i}}let N=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ye={[N.startingStyle]:""},Ce={[N.endingStyle]:""},Qe={transitionStatus(e){return e==="starting"?ye:e==="ending"?Ce:null}};function we(e,t=!1,n=!0){const i=pe();return A((s,r=null)=>{i.cancel();const o=xe(e);if(o==null)return;const l=o,c=()=>{le.flushSync(s)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{r!=null&&r.aborted||c()}).catch(()=>{if(n){r!=null&&r.aborted||c();return}const f=l.getAnimations();!(r!=null&&r.aborted)&&f.length>0&&f.some(u=>u.pending||u.playState!=="finished")&&d()})}if(t){const f=N.startingStyle;if(!l.hasAttribute(f)){i.request(d);return}const u=new MutationObserver(()=>{l.hasAttribute(f)||(u.disconnect(),d())});u.observe(l,{attributes:!0,attributeFilter:[f]}),r==null||r.addEventListener("abort",()=>u.disconnect(),{once:!0});return}i.request(d)})}function Xe(e){const{enabled:t=!0,open:n,ref:i,onComplete:s}=e,r=A(s),o=we(i,n,!1);a.useEffect(()=>{if(!t)return;const l=new AbortController;return o(r,l.signal),()=>{l.abort()}},[t,n,r,o])}function Se(e){return Ie(e,"base-ui")}const Re=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Z=a.forwardRef((e,t)=>a.createElement(oe,{ref:t,...e,weights:Re}));Z.displayName="CaretDownIcon";const Te=Z;let U=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fe={disabled:!1,...y},ke={valid(e){return e===null?null:e?{[U.valid]:""}:{[U.invalid]:""}}},Me=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ae,errors:[],error:"",value:"",initialValue:null},setValidityData:v,disabled:void 0,touched:y.touched,setTouched:v,dirty:y.dirty,setDirty:v,filled:y.filled,setFilled:v,focused:y.focused,setFocused:v,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Fe,markedDirtyRef:{current:!1},registerFieldControl:v,validation:{getValidationProps:(e=k)=>e,getInputValidationProps:(e=k)=>e,inputRef:{current:null},commit:async()=>{}}});function B(e=!0){const t=a.useContext(Me);if(t.setValidityData===v&&!e)throw new Error(ue(28));return t}const Ne=a.createContext({controlId:void 0,registerControlId:v,labelId:void 0,setLabelId:v,messageIds:[],setMessageIds:v,getDescriptionProps:e=>e});function H(){return a.useContext(Ne)}function Pe(e={}){const{id:t,implicit:n=!1,controlRef:i}=e,{controlId:s,registerControlId:r}=H(),o=Se(t),l=n?s:void 0,c=j(()=>Symbol("labelable-control")),d=a.useRef(!1),f=a.useRef(t!=null),u=A(()=>{!d.current||r===v||(d.current=!1,r(c.current,void 0))});return E(()=>{if(r===v)return;let b;if(n){const C=i==null?void 0:i.current;ce(C)&&C.closest("label")!=null?b=t??null:b=l??o}else if(t!=null)f.current=!0,b=t;else if(f.current)b=o;else{u();return}if(b===void 0){u();return}d.current=!0,r(c.current,b)},[t,i,l,r,n,o,c,u]),a.useEffect(()=>u,[u]),s??o}function Le({controlled:e,default:t,name:n,state:i="value"}){const{current:s}=a.useRef(e!==void 0),[r,o]=a.useState(t),l=s?e:r,c=a.useCallback(d=>{s||o(d)},[]);return[l,c]}function De(e,t){const{enabled:n=!0,getValue:i,id:s,value:r}=t,{registerFieldControl:o}=B(),l=a.useRef(null);l.current||(l.current=Symbol()),E(()=>{const c=l.current;if(!(!c||!n))return o(c,{controlRef:e,getValue:i,id:s,value:r}),()=>{o(c,void 0)}},[e,n,i,s,o,r])}const Oe=a.forwardRef(function(t,n){const{render:i,className:s,id:r,name:o,value:l,disabled:c=!1,onValueChange:d,defaultValue:f,autoFocus:u=!1,style:b,...C}=t,{state:z,name:$,disabled:K,setTouched:P,setDirty:Y,validityData:G,setFocused:w,setFilled:S,validationMode:J,validation:h}=B(),L=K||c,W=$??o,Q={...z,disabled:L},{labelId:X}=H(),D=Pe({id:r});E(()=>{var I;const m=l!=null;(I=h.inputRef.current)!=null&&I.value||m&&l!==""?S(!0):m&&l===""&&S(!1)},[h.inputRef,S,l]);const F=a.useRef(null);E(()=>{u&&F.current===he(ge(F.current))&&w(!0)},[u,w]);const[ee]=Le({controlled:l,default:f,name:"FieldControl",state:"value"}),O=l!==void 0,V=O?ee:void 0,te=A(()=>{var m;return(m=h.inputRef.current)==null?void 0:m.value});return De(h.inputRef,{id:D,value:V,getValue:te}),de("input",t,{ref:[n,F],state:Q,props:[{id:D,disabled:L,name:W,ref:h.inputRef,"aria-labelledby":X,autoFocus:u,...O?{value:V}:{defaultValue:f},onChange(m){const I=m.currentTarget.value;d==null||d(I,me(fe,m.nativeEvent)),Y(I!==G.initialValue),S(I!=="")},onFocus(){w(!0)},onBlur(m){P(!0),w(!1),J==="onBlur"&&h.commit(m.currentTarget.value)},onKeyDown(m){m.currentTarget.tagName==="INPUT"&&m.key==="Enter"&&(P(!0),h.commit(m.currentTarget.value))}},h.getInputValidationProps(),C],stateAttributesMapping:ke})}),Ve=a.forwardRef(function(t,n){return x.jsx(Oe,{ref:n,...t})});function et({className:e,type:t,...n}){return x.jsx(Ve,{type:t,"data-slot":"input",className:M("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function tt({className:e,size:t="default",...n}){return x.jsxs("div",{className:M("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),"data-slot":"native-select-wrapper","data-size":t,children:[x.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-7 w-full min-w-0 appearance-none rounded-md border border-input bg-input/20 py-0.5 pr-6 pl-2 text-xs/relaxed transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=sm]:h-6 data-[size=sm]:text-[0.625rem] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...n}),x.jsx(Te,{className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground select-none group-data-[size=sm]/native-select:size-3","aria-hidden":"true","data-slot":"native-select-icon"})]})}function nt({className:e,...t}){return x.jsx("option",{"data-slot":"native-select-option",className:M("bg-[Canvas] text-[CanvasText]",e),...t})}export{g as A,et as I,tt as N,N as T,he as a,Ye as b,Ge as c,me as d,pe as e,ze as f,Be as g,Je as h,$e as i,je as j,We as k,Xe as l,Qe as m,He as n,ge as o,Ke as p,Se as q,xe as r,nt as s,Ze as t,Ie as u,Le as v,we as w,fe as x};
|
|
1
|
+
var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);import{E as k,d as j,Z as ae,h as se,Y as ie,r as a,e as E,l as A,k as le,B as oe,N as v,x as ue,t as ce,n as de,j as x,H as M}from"./index-BCPCyhdz.js";const fe="none",je="trigger-press",Ze="trigger-hover",Be="outside-press",He="close-press",ze="focus-out",$e="escape-key",Ke="imperative-action";function me(e,t,n,i){let s=!1,r=!1;const o=k;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...o}}function Ye(e,t,n,i){return e.addEventListener(t,n,i),()=>{e.removeEventListener(t,n,i)}}const R=null;class ve{constructor(){p(this,"callbacks",[]);p(this,"callbacksCount",0);p(this,"nextId",1);p(this,"startId",1);p(this,"isScheduled",!1);p(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let r=0;r<n.length;r+=1)(s=n[r])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const T=new ve;class g{constructor(){p(this,"currentId",R);p(this,"cancel",()=>{this.currentId!==R&&(T.cancel(this.currentId),this.currentId=R)});p(this,"disposeEffect",()=>this.cancel)}static create(){return new g}static request(t){return T.request(t)}static cancel(t){return T.cancel(t)}request(t){this.cancel(),this.currentId=T.request(()=>{this.currentId=R,t()})}}function pe(){const e=j(g.create).current;return ae(e.disposeEffect),e}function ge(e){return(e==null?void 0:e.ownerDocument)||document}function he(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Ge(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&se(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Je(e){return"composedPath"in e?e.composedPath()[0]:e.target}const be={...ie};let _=0;function Ee(e,t="mui"){const[n,i]=a.useState(e),s=e||n;return a.useEffect(()=>{n==null&&(_+=1,i(`${t}-${_}`))},[n,t]),s}const q=be.useId;function Ie(e,t){if(q!==void 0){const n=q();return e??(t?`${t}-${n}`:n)}return Ee(e,t)}function xe(e){return e==null?e:"current"in e?e.current:e}function We(e,t=!1,n=!1){const[i,s]=a.useState(e&&t?"idle":void 0),[r,o]=a.useState(e);return e&&!r&&(o(!0),s("starting")),!e&&r&&i!=="ending"&&!n&&s("ending"),!e&&!r&&i==="ending"&&s(void 0),E(()=>{if(!e&&r&&i!=="ending"&&n){const l=g.request(()=>{s("ending")});return()=>{g.cancel(l)}}},[e,r,i,n]),E(()=>{if(!e||t)return;const l=g.request(()=>{s(void 0)});return()=>{g.cancel(l)}},[t,e]),E(()=>{if(!e||!t)return;e&&r&&i!=="idle"&&s("starting");const l=g.request(()=>{s("idle")});return()=>{g.cancel(l)}},[t,e,r,i]),{mounted:r,setMounted:o,transitionStatus:i}}let N=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ye={[N.startingStyle]:""},Ce={[N.endingStyle]:""},Qe={transitionStatus(e){return e==="starting"?ye:e==="ending"?Ce:null}};function we(e,t=!1,n=!0){const i=pe();return A((s,r=null)=>{i.cancel();const o=xe(e);if(o==null)return;const l=o,c=()=>{le.flushSync(s)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{r!=null&&r.aborted||c()}).catch(()=>{if(n){r!=null&&r.aborted||c();return}const f=l.getAnimations();!(r!=null&&r.aborted)&&f.length>0&&f.some(u=>u.pending||u.playState!=="finished")&&d()})}if(t){const f=N.startingStyle;if(!l.hasAttribute(f)){i.request(d);return}const u=new MutationObserver(()=>{l.hasAttribute(f)||(u.disconnect(),d())});u.observe(l,{attributes:!0,attributeFilter:[f]}),r==null||r.addEventListener("abort",()=>u.disconnect(),{once:!0});return}i.request(d)})}function Xe(e){const{enabled:t=!0,open:n,ref:i,onComplete:s}=e,r=A(s),o=we(i,n,!1);a.useEffect(()=>{if(!t)return;const l=new AbortController;return o(r,l.signal),()=>{l.abort()}},[t,n,r,o])}function Se(e){return Ie(e,"base-ui")}const Re=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Z=a.forwardRef((e,t)=>a.createElement(oe,{ref:t,...e,weights:Re}));Z.displayName="CaretDownIcon";const Te=Z;let U=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fe={disabled:!1,...y},ke={valid(e){return e===null?null:e?{[U.valid]:""}:{[U.invalid]:""}}},Me=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ae,errors:[],error:"",value:"",initialValue:null},setValidityData:v,disabled:void 0,touched:y.touched,setTouched:v,dirty:y.dirty,setDirty:v,filled:y.filled,setFilled:v,focused:y.focused,setFocused:v,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Fe,markedDirtyRef:{current:!1},registerFieldControl:v,validation:{getValidationProps:(e=k)=>e,getInputValidationProps:(e=k)=>e,inputRef:{current:null},commit:async()=>{}}});function B(e=!0){const t=a.useContext(Me);if(t.setValidityData===v&&!e)throw new Error(ue(28));return t}const Ne=a.createContext({controlId:void 0,registerControlId:v,labelId:void 0,setLabelId:v,messageIds:[],setMessageIds:v,getDescriptionProps:e=>e});function H(){return a.useContext(Ne)}function Pe(e={}){const{id:t,implicit:n=!1,controlRef:i}=e,{controlId:s,registerControlId:r}=H(),o=Se(t),l=n?s:void 0,c=j(()=>Symbol("labelable-control")),d=a.useRef(!1),f=a.useRef(t!=null),u=A(()=>{!d.current||r===v||(d.current=!1,r(c.current,void 0))});return E(()=>{if(r===v)return;let b;if(n){const C=i==null?void 0:i.current;ce(C)&&C.closest("label")!=null?b=t??null:b=l??o}else if(t!=null)f.current=!0,b=t;else if(f.current)b=o;else{u();return}if(b===void 0){u();return}d.current=!0,r(c.current,b)},[t,i,l,r,n,o,c,u]),a.useEffect(()=>u,[u]),s??o}function Le({controlled:e,default:t,name:n,state:i="value"}){const{current:s}=a.useRef(e!==void 0),[r,o]=a.useState(t),l=s?e:r,c=a.useCallback(d=>{s||o(d)},[]);return[l,c]}function De(e,t){const{enabled:n=!0,getValue:i,id:s,value:r}=t,{registerFieldControl:o}=B(),l=a.useRef(null);l.current||(l.current=Symbol()),E(()=>{const c=l.current;if(!(!c||!n))return o(c,{controlRef:e,getValue:i,id:s,value:r}),()=>{o(c,void 0)}},[e,n,i,s,o,r])}const Oe=a.forwardRef(function(t,n){const{render:i,className:s,id:r,name:o,value:l,disabled:c=!1,onValueChange:d,defaultValue:f,autoFocus:u=!1,style:b,...C}=t,{state:z,name:$,disabled:K,setTouched:P,setDirty:Y,validityData:G,setFocused:w,setFilled:S,validationMode:J,validation:h}=B(),L=K||c,W=$??o,Q={...z,disabled:L},{labelId:X}=H(),D=Pe({id:r});E(()=>{var I;const m=l!=null;(I=h.inputRef.current)!=null&&I.value||m&&l!==""?S(!0):m&&l===""&&S(!1)},[h.inputRef,S,l]);const F=a.useRef(null);E(()=>{u&&F.current===he(ge(F.current))&&w(!0)},[u,w]);const[ee]=Le({controlled:l,default:f,name:"FieldControl",state:"value"}),O=l!==void 0,V=O?ee:void 0,te=A(()=>{var m;return(m=h.inputRef.current)==null?void 0:m.value});return De(h.inputRef,{id:D,value:V,getValue:te}),de("input",t,{ref:[n,F],state:Q,props:[{id:D,disabled:L,name:W,ref:h.inputRef,"aria-labelledby":X,autoFocus:u,...O?{value:V}:{defaultValue:f},onChange(m){const I=m.currentTarget.value;d==null||d(I,me(fe,m.nativeEvent)),Y(I!==G.initialValue),S(I!=="")},onFocus(){w(!0)},onBlur(m){P(!0),w(!1),J==="onBlur"&&h.commit(m.currentTarget.value)},onKeyDown(m){m.currentTarget.tagName==="INPUT"&&m.key==="Enter"&&(P(!0),h.commit(m.currentTarget.value))}},h.getInputValidationProps(),C],stateAttributesMapping:ke})}),Ve=a.forwardRef(function(t,n){return x.jsx(Oe,{ref:n,...t})});function et({className:e,type:t,...n}){return x.jsx(Ve,{type:t,"data-slot":"input",className:M("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function tt({className:e,size:t="default",...n}){return x.jsxs("div",{className:M("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),"data-slot":"native-select-wrapper","data-size":t,children:[x.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-7 w-full min-w-0 appearance-none rounded-md border border-input bg-input/20 py-0.5 pr-6 pl-2 text-xs/relaxed transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=sm]:h-6 data-[size=sm]:text-[0.625rem] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...n}),x.jsx(Te,{className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground select-none group-data-[size=sm]/native-select:size-3","aria-hidden":"true","data-slot":"native-select-icon"})]})}function nt({className:e,...t}){return x.jsx("option",{"data-slot":"native-select-option",className:M("bg-[Canvas] text-[CanvasText]",e),...t})}export{g as A,et as I,tt as N,N as T,he as a,Ye as b,Ge as c,me as d,pe as e,ze as f,Be as g,Je as h,$e as i,je as j,We as k,Xe as l,Qe as m,He as n,ge as o,Ke as p,Se as q,xe as r,nt as s,Ze as t,Ie as u,Le as v,we as w,fe as x};
|
package/dist/client/index.html
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
document.documentElement.classList.add(theme);
|
|
13
13
|
})();
|
|
14
14
|
</script>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-BCPCyhdz.js"></script>
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/index-ByUTKMgP.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="root"></div>
|