@membank/dashboard 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +25 -6
- package/dist/client/assets/WorkspaceCenter-PpT-8GcH.js +1 -0
- package/dist/client/assets/WorkspaceMemoryDetail-CInd7oVg.js +1 -0
- package/dist/client/assets/_projectId-BBY1t0Aw.js +1 -0
- package/dist/client/assets/_projectId._memoryId-CLFHYqzf.js +1 -0
- package/dist/client/assets/_projectId.index-Cz1w0FSx.js +4 -0
- package/dist/client/assets/{collections-y7eMFwFc.js → collections-CjCv4IBK.js} +1 -1
- package/dist/client/assets/empty-DMv5m460.js +1 -0
- package/dist/client/assets/global-DkkLcPUz.js +1 -0
- package/dist/client/assets/{global._memoryId-DbiHUsW4.js → global._memoryId-C_6uW2wI.js} +1 -1
- package/dist/client/assets/{global.index-w6voN-YE.js → global.index-DLPM4DWb.js} +1 -1
- package/dist/client/assets/index-CP3vA60Z.css +2 -0
- package/dist/client/assets/index-D9OJJPjH.js +10 -0
- package/dist/client/assets/{input-BdBFU9te.js → input-V-rh1Z1b.js} +1 -1
- package/dist/client/assets/preload-helper-CAfwd7qG.js +1 -0
- package/dist/client/assets/routes-D9dF3uY0.js +1 -0
- package/dist/client/assets/{skeleton-BDvkvqhf.js → skeleton-CiFADsZy.js} +1 -1
- package/dist/client/assets/{types-DT_fBrSI.js → types-CKYjb0zP.js} +1 -1
- package/dist/client/assets/{useRenderElement-DhejdWAQ.js → useRenderElement-BpZtIOdZ.js} +1 -1
- package/dist/client/index.html +6 -6
- package/dist/index.cjs +24 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +25 -6
- package/package.json +2 -2
- package/dist/client/assets/WorkspaceCenter-F8ctl0ZL.js +0 -1
- package/dist/client/assets/WorkspaceMemoryDetail-BLFoEX3q.js +0 -1
- package/dist/client/assets/_projectId-D3UHHv9-.js +0 -1
- package/dist/client/assets/_projectId._memoryId-CZOJ7L4F.js +0 -1
- package/dist/client/assets/_projectId.index-Dc3jTh6p.js +0 -1
- package/dist/client/assets/empty-C4Q9vAt-.js +0 -1
- package/dist/client/assets/global-BZgjloNm.js +0 -1
- package/dist/client/assets/index-B3Ej81eU.js +0 -10
- package/dist/client/assets/index-DHtBroPC.css +0 -2
- package/dist/client/assets/preload-helper-DYD3iRAO.js +0 -1
- package/dist/client/assets/routes-DdtLVWUF.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,S as t,T as n,_ as r,a as i,g as a,l as o,m as s,n as c,p as l,r as u,t as d,u as f,v as p,w as m,y as h}from"./collections-y7eMFwFc.js";import{A as g,F as _,P as v,k as y,o as b,s as x,t as S}from"./useRenderElement-DhejdWAQ.js";import{c as C,i as w,n as T,r as E}from"./preload-helper-DYD3iRAO.js";import{i as D,r as O,t as k}from"./types-DT_fBrSI.js";import{i as A,r as j,t as M}from"./schemas-jSuIeSIL.js";import{A as N,C as P,E as F,O as I,S as L,T as ee,_ as te,b as R,f as z,g as B,h as V,i as ne,k as H,m as re,o as ie,p as ae,w as oe,x as se}from"./index-B3Ej81eU.js";import{n as ce,t as le}from"./input-BdBFU9te.js";var ue=class{constructor(e){this.atom=H(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(N(e))}},de=class{constructor(e){this.atom=H(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(N(e))}};function U(e){return typeof e==`function`?new de(e):new ue(e)}var W=e(n(),1);function fe(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function pe(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=fe(e,t),o=_(),{history:s}=o,[c,l]=W.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return W.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),n=o.getMatchedRoutes(t.pathname);return n.foundRoute===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n.routeParams,search:o.options.parseSearch(e.search)}:{routeId:n.foundRoute.id,fullPath:n.foundRoute.fullPath,pathname:t.pathname,params:n.routeParams,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}var me=new Map([[`bold`,W.createElement(W.Fragment,null,W.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`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),W.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`,W.createElement(W.Fragment,null,W.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`,W.createElement(W.Fragment,null,W.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`,W.createElement(W.Fragment,null,W.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`,W.createElement(W.Fragment,null,W.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`}))]]),G=W.forwardRef((e,t)=>W.createElement(w,{ref:t,...e,weights:me}));G.displayName=`CaretDownIcon`;var he=G,ge=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,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),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function _e(e,t){return new ge(e,t).maybeExecute}var ve=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},K=new class extends ve{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function ye(e,t){return typeof e==`function`?e(t):e}function q(e,t){return Oe(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function J(e,t,n){let r=Oe(t);function i(e){if(!r.length)return ye(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function be(e,t){let n=Oe(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var xe=/^(\d+)$/gm,Se=/\.(\d+)(?=\.)/gm,Ce=/^(\d+)\./gm,we=/\.(\d+$)/gm,Te=/\.{2,}/gm,Ee=`__int__`,De=`${Ee}$1`;function Oe(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);return e.replace(/(^\[)|]/gm,``).replace(/\[/g,`.`).replace(xe,De).replace(Se,`.${De}.`).replace(Ce,`${De}.`).replace(we,`.${De}`).replace(Te,`.`).split(`.`).map(e=>{if(e.startsWith(Ee)){let t=e.substring(7),n=parseInt(t,10);return String(n)===t?n:t}return e})}function ke(e){return!(Array.isArray(e)&&e.length===0)}function Ae(e,t){return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function je(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0;break}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var Me=e=>!!e&&typeof e==`object`&&`fields`in e;function Y(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!Y(e[i],t[i]))return!1;return!0}var Ne=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function X(e,t){return e==null?t:{...e,...t}}for(var Fe=256,Ie=[],Le;Fe--;)Ie[Fe]=(Fe+256).toString(16).substring(1);function Re(){let e=0,t,n=``;if(!Le||Fe+16>256){for(Le=Array(256),e=256;e--;)Le[e]=256*Math.random()|0;e=0,Fe=0}for(;e<16;e++)t=Le[Fe+e],e===6?n+=Ie[t&15|64]:e===8?n+=Ie[t&63|128]:n+=Ie[t],e&1&&e>1&&e<11&&(n+=`-`);return Fe++,n}var ze=_e(e=>K.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function Be(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=Be(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,Be(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(Be(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Be(e[n]));return t}var Ve=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function He(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);Array.isArray(i)&&!Number.isNaN(o)?a+=`[${o}]`:a+=(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Ue=(e,t)=>{let n=He(e,t);return{form:n,fields:n}},We={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Ue(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Ue(r.issues,e)}},Ge=e=>!!e&&`~standard`in e,Z={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Ke(e){function t(t,n,r){let i=o(t,n,`move`,r),s=Math.min(n,r),l=Math.max(n,r);for(let e=s;e<=l;e++)i.push(a(t,e));let u=Object.keys(e.fieldInfo).reduce((r,i)=>(i.startsWith(a(t,n))&&r.set(i,e.getFieldMeta(i)),r),new Map);c(i,n<r?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(a(t,r))).forEach(i=>{let o=i.replace(a(t,r),a(t,n)),s=u.get(o);s&&e.setFieldMeta(i,s)})}function n(e,t){c(o(e,t,`remove`),`up`)}function r(t,n,r){o(t,n,`swap`,r).forEach(i=>{if(!i.toString().startsWith(a(t,n)))return;let o=i.toString().replace(a(t,n),a(t,r)),[s,c]=[e.getFieldMeta(i),e.getFieldMeta(o)];s&&e.setFieldMeta(o,s),c&&e.setFieldMeta(i,c)})}function i(t,n){let r=o(t,n,`insert`);c(r,`down`),r.forEach(r=>{r.toString().startsWith(a(t,n))&&e.setFieldMeta(r,l())})}function a(e,t){return`${e}[${t}]`}function o(t,n,r,i){let o=[a(t,n)];switch(r){case`swap`:o.push(a(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)o.push(a(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)o.push(a(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>o.some(t=>e.startsWith(t)))}function s(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function c(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=s(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,l())})}let l=()=>Z;return{handleArrayMove:t,handleArrayRemove:n,handleArraySwap:r,handleArrayInsert:i}}function qe(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}}}var Je=class{constructor(e){this.options={},this.fieldInfo={},this.mount=()=>{let e=this.store.subscribe(()=>{ze(this)}),t=K.on(`request-form-state`,e=>{e.payload.id===this._formId&&K.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=K.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=K.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),K.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return K.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!Y(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!Y(e.defaultState,t.defaultState)&&!this.state.isTouched;!n&&!r||(I(()=>{this.baseStore.setState(()=>qe(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),K.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>qe({...this.options.defaultState,values:e??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:r}))},this.validateAllFields=async e=>{let t=[];return I(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0}))),n.instance.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return I(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=e=>{let t=Ae(e,{...this.options,form:this,validationLogic:this.options.validationLogic||Ve}),n=!1,r={};return I(()=>{for(let e of t){if(!e.validate)continue;let{formError:t,fieldErrors:i}=Ye(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),a=Xe(e.cause),o=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]);for(let e of o){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Z,o=i?.[e],{newErrorValue:s,newSource:c}=Ne({newFormValidatorError:o,isPreviousErrorFromFormValidator:n?.[a]===`form`,previousErrorValue:t?.[a]});c===`form`&&(r[e]={...r[e],[a]:o}),t?.[a]!==s&&this.setFieldMeta(e,(e=Z)=>({...e,errorMap:{...e.errorMap,[a]:s},errorSourceMap:{...e.errorSourceMap,[a]:c}}))}this.state.errorMap?.[a]!==t&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:t}})),(t||i)&&(n=!0)}let i=Xe(`submit`);this.state.errorMap?.[i]&&e!==`submit`&&!n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[i]:void 0}}));let a=Xe(`server`);this.state.errorMap?.[a]&&e!==`server`&&!n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}))}),{hasErrored:n,fieldsErrorMap:r}},this.validateAsync=async e=>{let t=je(e,{...this.options,form:this,validationLogic:this.options.validationLogic||Ve});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let n=[],r;for(let e of t){if(!e.validate)continue;let t=Xe(e.cause);this.state.validationMetaMap[t]?.lastAbortController.abort();let i=new AbortController;this.state.validationMetaMap[t]={lastAbortController:i},n.push(new Promise(async t=>{let n;try{n=await new Promise((t,n)=>{setTimeout(async()=>{if(i.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:i.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){n=e}let{formError:a,fieldErrors:o}=Ye(n);o&&(r=r?{...r,...o}:o);let s=Xe(e.cause);for(let e of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[e]===void 0)continue;let t=this.getFieldMeta(e);if(!t)continue;let{errorMap:n,errorSourceMap:i}=t,a=r?.[e],{newErrorValue:o,newSource:c}=Ne({newFormValidatorError:a,isPreviousErrorFromFormValidator:i?.[s]===`form`,previousErrorValue:n?.[s]});n?.[s]!==o&&this.setFieldMeta(e,e=>({...e,errorMap:{...e.errorMap,[s]:o},errorSourceMap:{...e.errorSourceMap,[s]:c}}))}this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[s]:a}})),t(r?{fieldErrors:r,errorMapKey:s}:void 0)}))}let i=[],a={};if(n.length){i=await Promise.all(n);for(let e of i)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))a[n]={...a[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),a},this.validate=e=>{let{hasErrored:t,fieldsErrorMap:n}=this.validateSync(e);return t&&!this.options.asyncAlways?n:this.validateAsync(e)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),K.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),K.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.options.listeners?.onSubmit?.({value:e.instance.state.value,fieldApi:e.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),I(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),K.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>q(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:ye(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=Z,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;I(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:J(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=be(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],X(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),Ke(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),X(r,{dontValidate:!0})),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),X(n,{dontValidate:!0})),Ke(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return J(J(e,`${t}`,i),`${n}`,r)},X(r,{dontValidate:!0})),Ke(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},X(r,{dontValidate:!0})),Ke(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],X(t,{dontValidate:!0})),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>({...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Z},values:this.options.defaultValues?J(t.values,e,q(this.options.defaultValues,e)):t.values}))},this.setErrorMap=e=>{I(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(Me(t)){let{formError:e,fieldErrors:r}=Ye(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>We.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>We.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??Re(),this._devtoolsSubmissionOverride=!1;let t=qe({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!Me(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=U(t);let n;this.fieldMetaDerived=U(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=q(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!ke(u),f=!o.isDirty,p=Y(l,q(this.options.defaultValues,a))||Y(l,this.getFieldInfo(a)?.instance?.options.defaultValue);if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i});let r;this.store=U(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&Me(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&Y(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return Ge(e.validate)?We[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Ye(e){return e?Me(e)?{formError:Ye(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}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`;default:return`onChange`}}var Ze=class{constructor(e){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...Z,isTouched:e.fieldMetaBase[this.name]?.isTouched??Z.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??Z.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??Z.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(Y(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.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=(e,t)=>{this.form.setFieldValue(this.name,e,X(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,X(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,X(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,X(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,X(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,X(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,X(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,X(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{let t=Object.values(this.form.fieldInfo),n=[];for(let r of t){if(!r.instance)continue;let{onChangeListenTo:t,onBlurListenTo:i}=r.instance.options.validators||{};e===`change`&&t?.includes(this.name)&&n.push(r.instance),e===`blur`&&i?.includes(this.name)&&n.push(r.instance)}return n},this.validateSync=(e,t)=>{let n=Ae(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Ve}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=Ae(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Ve});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;I(()=>{let e=(e,n)=>{let r=$e(n.cause),a=n.validate?Qe(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Pe({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=$e(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=je(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Ve}),r=await t,i=this.getLinkedFields(e),a=i.reduce((t,n)=>{let r=je(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Ve});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),o=[],s=[],c=n.some(e=>e.validate)||a.some(e=>e.validate);if(c){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of i)e.setMeta(e=>({...e,isValidating:!0}))}let l=(e,t,n)=>{let i=$e(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&clearTimeout(e.timeoutIds.validations[t.cause]),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=Qe(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=Pe({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,o);for(let e of a)e.validate&&l(e.field,e,s);let u=[];if((o.length||s.length)&&(u=await Promise.all(o),await Promise.all(s)),c){this.setMeta(e=>({...e,isValidating:!1}));for(let e of i)e.setMeta(e=>({...e,isValidating:!1}))}return u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e),{hasErrored:r}=this.validateSync(e,n[this.name]??{});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[$e(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e);return this.validateAsync(e,i)},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>We.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>We.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=U(t=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...Z,...e.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),t&&t.value===r&&t.meta===n?t:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return Ge(e.validate)?We[e.type](e.value,e.validate):e.validate(e.value)}triggerOnBlurListener(){let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}};function Qe(e){if(e)return e}function $e(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function et(e,t){if(!t)return;let n=Object.assign({},e,{state:Be(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return I(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var Q=m(),tt=typeof window<`u`?W.useLayoutEffect:W.useEffect;function nt(e){let[t,n]=(0,W.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,W.useState)(()=>new Ze({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Ze({...e})),n({form:e.form,name:e.name}));let a=v(r.store,e.mode===`array`?e=>Object.keys(e.value??[]).length:e=>e.value),o=v(r.store,e=>e.meta.isTouched),s=v(r.store,e=>e.meta.isBlurred),c=v(r.store,e=>e.meta.isDirty),l=v(r.store,e=>e.meta.errorMap),u=v(r.store,e=>e.meta.errorSourceMap),d=v(r.store,e=>e.meta.isValidating),f=(0,W.useMemo)(()=>{let t={...r,get state(){return{value:e.mode===`array`?r.state.value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d}}}}};return t.Field=rt,t},[r,e.mode,a,o,s,c,l,u,d]);return tt(r.mount,[r]),tt(()=>{r.update(e)}),f}var rt=(({children:e,...t})=>{let n=nt(t);return(0,Q.jsx)(Q.Fragment,{children:(0,W.useMemo)(()=>ye(e,n),[e,n])})});function it(){return(0,W.useState)(()=>Re())[0]}var at=W,ot=`19.2.5`.split(`.`)[0]===`17`?it:at.useId;function st({form:e,selector:t=e=>e,children:n}){return(0,Q.jsx)(Q.Fragment,{children:ye(n,v(e.store,t))})}function ct(e){let t=ot(),[n,r]=(0,W.useState)(e?.formId),[i,a]=(0,W.useState)(()=>new Je({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Je({...e,formId:n})),r(n)}let o=(0,W.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,Q.jsx)(rt,{...e,form:i})},e.Subscribe=function(e){return(0,Q.jsx)(st,{form:i,selector:e.selector,children:e.children})},e},[i]);tt(i.mount,[]),tt(()=>{i.update(e)});let s=(0,W.useRef)(!1);return tt(()=>{s.current&&e?.transform&&et(i,e.transform)},[i,e?.transform]),tt(()=>{s.current=!0}),o}function lt(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=ce({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=te(o,!0,!0),[d,f]=W.useState(o),[{height:p,width:m},h]=W.useState({height:void 0,width:void 0}),_=z(),[v,y]=W.useState(),x=v??_,[S,C]=W.useState(!1),[w,T]=W.useState(!1),E=W.useRef(null),D=W.useRef(null),O=W.useRef(null),k=W.useRef(null),A=re(k,!1),j=b(e=>{let t=!o,n=P(ee,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=k.current;D.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!S&&!w&&(D.current!=null&&D.current!==`css-animation`&&!c&&t&&l(!0),D.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),D.current===`none`&&c&&!t&&l(!1)});return g(()=>{a&&D.current===`none`&&!o&&l(!1)},[a,o,t,l]),W.useMemo(()=>({abortControllerRef:E,animationTypeRef:D,disabled:i,handleTrigger:j,height:p,mounted:c,open:o,panelId:x,panelRef:k,runOnceAnimationsFinish:A,setDimensions:h,setHiddenUntilFound:C,setKeepMounted:T,setMounted:l,setOpen:s,setPanelIdState:y,setVisible:f,transitionDimensionRef:O,transitionStatus:u,visible:d,width:m}),[E,D,i,j,p,c,o,x,k,A,h,C,T,l,s,f,O,u,d,m])}var ut=W.createContext(void 0);function dt(){let e=W.useContext(ut);if(e===void 0)throw Error(y(15));return e}var ft=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=V.startingStyle]=`startingStyle`,e[e.endingStyle=V.endingStyle]=`endingStyle`,e}({}),pt=function(e){return e.panelOpen=`data-panel-open`,e}({}),mt={[ft.open]:``},ht={[ft.closed]:``},gt={open(e){return e?{[pt.panelOpen]:``}:null}},_t={open(e){return e?mt:ht},...B},vt=W.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=b(o),d=lt({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=W.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=W.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=S(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:_t});return(0,Q.jsx)(ut.Provider,{value:p,children:m})}),yt={...gt,...B},bt=W.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=dt(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=E({disabled:c,focusableWhenDisabled:!0,native:d}),g=W.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return S(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:yt})}),xt=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function St(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:_,transitionDimensionRef:v,visible:y,width:S}=e,C=W.useRef(!1),w=W.useRef(null),T=W.useRef(u),E=W.useRef(u),D=se(),O=W.useMemo(()=>n.current===`css-animation`?!y:!u&&!c,[u,c,y,n]),k=x(r,d,b(e=>{if(!e)return;if(n.current==null||v.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(xt.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?v.current=`width`:v.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||S===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),E.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=R.request(()=>{E.current=!1,r=R.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{R.cancel(t),R.cancel(r)}}));return g(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!E.current&&!o&&e.setAttribute(ft.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=R.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=ft.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),D.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{R.cancel(r)}},[t,n,D,a,o,c,u,d,f,p,m]),g(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(w.current=e.style.animationName||w.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!T.current&&!C.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),_(!0)):(t.current=new AbortController,f(()=>{m(!1),_(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,_,y]),F(()=>{let e=R.request(()=>{T.current=!1});return()=>R.cancel(e)}),g(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&C.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=R.request(()=>{C.current=!1,n=R.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{R.cancel(t),R.cancel(n)}},[a,u,d,p]),g(()=>{let e=d.current;e&&a&&O&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(ft.startingStyle,``))},[a,O,n,d]),W.useEffect(function(){let e=d.current;if(!e)return;function t(e){C.current=!0,h(!0),l(!0,P(oe,e))}return L(e,`beforematch`,t)},[l,d,h]),W.useMemo(()=>({props:{hidden:O,id:s,ref:k}}),[O,s,k])}var Ct=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),wt=W.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:_,runOnceAnimationsFinish:v,setDimensions:y,setHiddenUntilFound:b,setKeepMounted:x,setMounted:C,setPanelIdState:w,setOpen:T,setVisible:E,state:D,transitionDimensionRef:O,visible:k,width:A,transitionStatus:j}=dt(),M=r??!1,N=i??!1;g(()=>{if(o)return w(o),()=>{w(void 0)}},[o,w]),g(()=>{b(M)},[b,M]),g(()=>{x(N)},[x,N]);let{props:P}=St({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:M,id:h,keepMounted:N,mounted:f,onOpenChange:p,open:m,panelRef:_,runOnceAnimationsFinish:v,setDimensions:y,setMounted:C,setOpen:T,setVisible:E,transitionDimensionRef:O,visible:k,width:A});ae({open:m&&j===`idle`,ref:_,onComplete(){m&&y({height:void 0,width:void 0})}});let F=S(`div`,e,{state:W.useMemo(()=>({...D,transitionStatus:j}),[D,j]),ref:[t,_],props:[P,{style:{[Ct.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[Ct.collapsiblePanelWidth]:A===void 0?`auto`:`${A}px`}},c],stateAttributesMapping:_t});return N||M||f?F:null}),$=t();function Tt(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(vt,{"data-slot":`collapsible`,...n}),t[2]=n,t[3]=r),r}function Et(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(bt,{"data-slot":`collapsible-trigger`,...n}),t[2]=n,t[3]=r),r}function Dt(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(wt,{"data-slot":`collapsible-content`,...n}),t[2]=n,t[3]=r),r}function Ot(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`label`,{"data-slot":`label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kt(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var At=r(`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 jt(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=h(At({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Q.jsx)(`fieldset`,{"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Mt(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Ot,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,$.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ft)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(Pt)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=h(`text-xs/relaxed font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function Pt(e){return e?.message&&(0,Q.jsx)(`li`,{children:e.message},e.message)}function Ft(e){return[e?.message,e]}function It(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]===n?o=t[5]:(o=h(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=(0,Q.jsx)(`select`,{"data-slot":`native-select`,"data-size":a,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`,...r}),t[6]=r,t[7]=a,t[8]=s):s=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(he,{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`}),t[9]=c):c=t[9];let l;return t[10]!==a||t[11]!==o||t[12]!==s?(l=(0,Q.jsxs)(`div`,{className:o,"data-slot":`native-select-wrapper`,"data-size":a,children:[s,c]}),t[10]=a,t[11]=o,t[12]=s,t[13]=l):l=t[13],l}function Lt(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`bg-[Canvas] text-[CanvasText]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`option`,{"data-slot":`native-select-option`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rt(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`textarea`,{"data-slot":`textarea`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zt(e,t){let n=(0,$.c)(27),r,c;n[0]===e?(r=n[1],c=n[2]):(r=t=>t.from({m:d}).where(t=>{let{m:n}=t;return s(n.id,e)}),c=[e],n[0]=e,n[1]=r,n[2]=c);let{data:p,isLoading:m}=l(r,c),h;n[3]===p?h=n[4]:(h=p===void 0?[]:p,n[3]=p,n[4]=h);let g=h[0]??null,_;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],n[5]=_):_=n[5];let{data:v}=l(Vt,_),y;n[6]===v?y=n[7]:(y=v===void 0?[]:v,n[6]=v,n[7]=y);let b=y,x;n[8]===e?x=n[9]:(x=()=>{o(e,{needsReview:!1}).then(Bt)},n[8]=e,n[9]=x);let S=x,C;n[10]===e?C=n[11]:(C=async t=>{try{return await i(e,t),await u.invalidateQueries({queryKey:[`memories`]}),!0}catch{return a.error(`Failed to add project — try again`),!1}},n[10]=e,n[11]=C);let w=C,T;n[12]===e?T=n[13]:(T=async t=>{try{await f(e,t),await u.invalidateQueries({queryKey:[`memories`]})}catch{a.error(`Failed to remove project — try again`)}},n[12]=e,n[13]=T);let E=T,D;if(n[14]!==b||n[15]!==g?.projects){let e;n[17]===g?.projects?e=n[18]:(e=e=>!g?.projects.some(t=>t.id===e.id),n[17]=g?.projects,n[18]=e),D=b.filter(e),n[14]=b,n[15]=g?.projects,n[16]=D}else D=n[16];let O=D,k;return n[19]!==O||n[20]!==w||n[21]!==S||n[22]!==E||n[23]!==m||n[24]!==g||n[25]!==t?(k={memory:g,isLoading:m,availableProjects:O,handleApprove:S,handleAddProject:w,handleRemoveProject:E,handleClose:t},n[19]=O,n[20]=w,n[21]=S,n[22]=E,n[23]=m,n[24]=g,n[25]=t,n[26]=k):k=n[26],k}function Bt(){return u.invalidateQueries({queryKey:[`memories`]})}function Vt(e){return e.from({p:c})}var Ht=j({content:A().min(1,`Content is required.`),type:M(k),tagsInput:A()});function Ut(e){let t=(0,$.c)(12),{field:n,label:r,description:i,children:a}=e,o=n.state.meta.isTouched&&!n.state.meta.isValid,s;t[0]!==n.name||t[1]!==r?(s=(0,Q.jsx)(Mt,{htmlFor:n.name,className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:r}),t[0]=n.name,t[1]=r,t[2]=s):s=t[2];let c;t[3]!==n.state.meta.errors||t[4]!==o?(c=o&&(0,Q.jsx)(Nt,{errors:n.state.meta.errors}),t[3]=n.state.meta.errors,t[4]=o,t[5]=c):c=t[5];let l;return t[6]!==a||t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Q.jsxs)(jt,{"data-invalid":o,children:[s,a,i,c]}),t[6]=a,t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Wt(e){let t=(0,$.c)(113),{memory:n,availableProjects:r,handleApprove:i,handleAddProject:a,handleRemoveProject:o,handleClose:s}=e,[c,l]=(0,W.useState)(!1),[u,f]=(0,W.useState)(``),p,m;t[0]===c?(p=t[1],m=t[2]):(p=()=>{if(!c)return;let e=setTimeout(()=>l(!1),1500);return()=>clearTimeout(e)},m=[c],t[0]=c,t[1]=p,t[2]=m),(0,W.useEffect)(p,m);let h=n.content,g=n.type,_;t[3]===n.tags?_=t[4]:(_=n.tags.join(`, `),t[3]=n.tags,t[4]=_);let v;t[5]!==n.content||t[6]!==n.type||t[7]!==_?(v={content:h,type:g,tagsInput:_},t[5]=n.content,t[6]=n.type,t[7]=_,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y={onSubmit:Ht},t[9]=y):y=t[9];let b;t[10]!==n.content||t[11]!==n.id||t[12]!==n.tags||t[13]!==n.type?(b=e=>{let{value:t}=e,r=t.tagsInput.split(`,`).map(Zt).filter(Boolean);d.update(n.id,e=>{t.content!==n.content&&(e.content=t.content),t.type!==n.type&&(e.type=t.type),JSON.stringify(r)!==JSON.stringify(n.tags)&&(e.tags=r)}),l(!0)},t[10]=n.content,t[11]=n.id,t[12]=n.tags,t[13]=n.type,t[14]=b):b=t[14];let x;t[15]!==v||t[16]!==b?(x={defaultValues:v,validators:y,onSubmit:b},t[15]=v,t[16]=b,t[17]=x):x=t[17];let S=ct(x),C;t[18]===S.state.isDirty?C=t[19]:(C={shouldBlockFn:()=>S.state.isDirty,withResolver:!0},t[18]=S.state.isDirty,t[19]=C);let w=pe(C),E;t[20]!==u||t[21]!==a?(E=async()=>{u&&await a(u)&&f(``)},t[20]=u,t[21]=a,t[22]=E):E=t[22];let O=E,k;t[23]===n.type?k=t[24]:(k=(0,Q.jsx)(D,{variant:n.type,children:n.type}),t[23]=n.type,t[24]=k);let A;t[25]===n.reviewEvents.length?A=t[26]:(A=n.reviewEvents.length>0&&(0,Q.jsx)(D,{variant:`destructive`,title:`Flagged for review — possible duplicate or conflict with another memory`,children:`needs review`}),t[25]=n.reviewEvents.length,t[26]=A);let j;t[27]===n.pinned?j=t[28]:(j=n.pinned&&(0,Q.jsx)(D,{variant:`default`,children:`pinned`}),t[27]=n.pinned,t[28]=j);let M;t[29]!==k||t[30]!==A||t[31]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A,j]}),t[29]=k,t[30]=A,t[31]=j,t[32]=M):M=t[32];let N;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(ie,{weight:`regular`}),t[33]=N):N=t[33];let P;t[34]===s?P=t[35]:(P=(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,onClick:s,"aria-label":`Close`,children:N}),t[34]=s,t[35]=P);let F;t[36]!==M||t[37]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0`,children:[M,P]}),t[36]=M,t[37]=P,t[38]=F):F=t[38];let I;t[39]===S.Field?I=t[40]:(I=(0,Q.jsx)(S.Field,{name:`content`,children:Xt}),t[39]=S.Field,t[40]=I);let L;t[41]===S.Field?L=t[42]:(L=(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Q.jsx)(S.Field,{name:`type`,children:Jt}),(0,Q.jsx)(S.Field,{name:`tagsInput`,children:qt})]}),t[41]=S.Field,t[42]=L);let ee;t[43]!==I||t[44]!==L?(ee=(0,Q.jsxs)(kt,{children:[I,L]}),t[43]=I,t[44]=L,t[45]=ee):ee=t[45];let te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground font-mono`,children:`Projects`}),t[46]=te):te=t[46];let R;t[47]===n.projects.length?R=t[48]:(R=n.projects.length===0&&(0,Q.jsx)(`span`,{className:`text-[11px] font-mono text-muted-foreground`,children:`Global (no project)`}),t[47]=n.projects.length,t[48]=R);let z;if(t[49]!==o||t[50]!==n.projects){let e;t[52]===o?e=t[53]:(e=e=>(0,Q.jsxs)(D,{variant:`secondary`,className:`gap-1 rounded-full text-[11px]`,children:[e.name,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void o(e.id),className:`hover:text-destructive transition-colors leading-none`,"aria-label":`Remove from ${e.name}`,children:(0,Q.jsx)(ie,{weight:`regular`,className:`size-2.5`})})]},e.id),t[52]=o,t[53]=e),z=n.projects.map(e),t[49]=o,t[50]=n.projects,t[51]=z}else z=t[51];let B;t[54]!==R||t[55]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[R,z]}),t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==u||t[58]!==r||t[59]!==O?(V=r.length>0&&(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsxs)(It,{value:u,onChange:e=>f(e.target.value),size:`sm`,className:`flex-1`,children:[(0,Q.jsx)(Lt,{value:``,children:`Add to project…`}),r.map(Kt)]}),(0,Q.jsx)(T,{variant:`outline`,size:`sm`,disabled:!u,onClick:()=>void O(),children:`+`})]}),t[57]=u,t[58]=r,t[59]=O,t[60]=V):V=t[60];let ne;t[61]!==B||t[62]!==V?(ne=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[te,B,V]}),t[61]=B,t[62]=V,t[63]=ne):ne=t[63];let H;t[64]===n.reviewEvents?H=t[65]:(H=n.reviewEvents.length>0&&(0,Q.jsxs)(Tt,{defaultOpen:!0,className:`group pt-2 border-t border-border`,children:[(0,Q.jsxs)(Et,{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:[(0,Q.jsx)(`span`,{className:`transition-transform group-data-[open]:rotate-90`,children:`›`}),`Review reasons`]}),(0,Q.jsx)(Dt,{className:`space-y-2 mt-2`,children:n.reviewEvents.map(Gt)})]}),t[64]=n.reviewEvents,t[65]=H);let re;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsxs)(Et,{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:[(0,Q.jsx)(`span`,{className:`transition-transform group-data-[open]:rotate-90`,children:`›`}),`Details`]}),t[66]=re):re=t[66];let ae;t[67]===n.sourceHarness?ae=t[68]:(ae=n.sourceHarness&&(0,Q.jsxs)(`div`,{className:`flex justify-between text-[11px] font-mono text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Source`}),(0,Q.jsx)(`span`,{children:n.sourceHarness})]}),t[67]=n.sourceHarness,t[68]=ae);let oe;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(`span`,{children:`Accessed`}),t[69]=oe):oe=t[69];let se;t[70]===n.accessCount?se=t[71]:(se=(0,Q.jsxs)(`div`,{className:`flex justify-between text-[11px] font-mono text-muted-foreground`,children:[oe,(0,Q.jsxs)(`span`,{children:[n.accessCount,`×`]})]}),t[70]=n.accessCount,t[71]=se);let ce;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Q.jsx)(`span`,{children:`Updated`}),t[72]=ce):ce=t[72];let le;t[73]===n.updatedAt?le=t[74]:(le=new Date(n.updatedAt).toLocaleString(),t[73]=n.updatedAt,t[74]=le);let ue;t[75]===le?ue=t[76]:(ue=(0,Q.jsxs)(`div`,{className:`flex justify-between text-[11px] font-mono text-muted-foreground`,children:[ce,(0,Q.jsx)(`span`,{children:le})]}),t[75]=le,t[76]=ue);let de;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(`span`,{children:`Created`}),t[77]=de):de=t[77];let U;t[78]===n.createdAt?U=t[79]:(U=new Date(n.createdAt).toLocaleString(),t[78]=n.createdAt,t[79]=U);let fe;t[80]===U?fe=t[81]:(fe=(0,Q.jsxs)(`div`,{className:`flex justify-between text-[11px] font-mono text-muted-foreground`,children:[de,(0,Q.jsx)(`span`,{children:U})]}),t[80]=U,t[81]=fe);let me;t[82]!==ae||t[83]!==se||t[84]!==ue||t[85]!==fe?(me=(0,Q.jsxs)(Tt,{className:`group pt-2 border-t border-border`,children:[re,(0,Q.jsxs)(Dt,{className:`space-y-1 mt-2`,children:[ae,se,ue,fe]})]}),t[82]=ae,t[83]=se,t[84]=ue,t[85]=fe,t[86]=me):me=t[86];let G;t[87]!==ee||t[88]!==ne||t[89]!==H||t[90]!==me?(G=(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4 space-y-4`,children:[ee,ne,H,me]}),t[87]=ee,t[88]=ne,t[89]=H,t[90]=me,t[91]=G):G=t[91];let he;t[92]===w?he=t[93]:(he=w.status===`blocked`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-xs font-mono text-destructive`,children:`Unsaved changes`}),(0,Q.jsx)(T,{variant:`ghost`,size:`sm`,onClick:()=>w.proceed(),children:`Discard`}),(0,Q.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>w.reset(),children:`Keep editing`})]}),t[92]=w,t[93]=he);let ge;t[94]!==w.status||t[95]!==i||t[96]!==n.reviewEvents.length?(ge=n.reviewEvents.length>0&&w.status!==`blocked`&&(0,Q.jsx)(T,{variant:`outline`,size:`sm`,onClick:i,title:`Mark as reviewed — this memory was flagged as a possible duplicate or conflict`,children:`Mark reviewed`}),t[94]=w.status,t[95]=i,t[96]=n.reviewEvents.length,t[97]=ge):ge=t[97];let _e;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(`div`,{className:`flex-1`}),t[98]=_e):_e=t[98];let ve=!S.state.isDirty,K;t[99]===S?K=t[100]:(K=()=>void S.handleSubmit(),t[99]=S,t[100]=K);let ye=c?`Saved`:`Save`,q;t[101]!==ve||t[102]!==K||t[103]!==ye?(q=(0,Q.jsx)(T,{variant:`default`,size:`sm`,disabled:ve,onClick:K,children:ye}),t[101]=ve,t[102]=K,t[103]=ye,t[104]=q):q=t[104];let J;t[105]!==he||t[106]!==ge||t[107]!==q?(J=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-t border-border shrink-0`,children:[he,ge,_e,q]}),t[105]=he,t[106]=ge,t[107]=q,t[108]=J):J=t[108];let be;return t[109]!==F||t[110]!==G||t[111]!==J?(be=(0,Q.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,G,J]}),t[109]=F,t[110]=G,t[111]=J,t[112]=be):be=t[112],be}function Gt(e){return(0,Q.jsxs)(`div`,{className:`rounded border border-border p-2 space-y-1 text-[11px]`,children:[(0,Q.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-destructive`,children:[Math.round(e.similarity*100),`% similarity match`]}),(0,Q.jsx)(`span`,{children:new Date(e.createdAt).toLocaleString()})]}),e.conflictingMemoryId?(0,Q.jsxs)(`div`,{className:`text-muted-foreground font-mono`,children:[`Conflicting memory:`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[10px]`,children:e.conflictingMemoryId})]}):(0,Q.jsx)(`div`,{className:`text-muted-foreground italic`,children:`Conflicting memory deleted`}),e.conflictContentSnapshot&&(0,Q.jsxs)(Tt,{children:[(0,Q.jsx)(Et,{className:`text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:`Show conflicting content ›`}),(0,Q.jsx)(Dt,{children:(0,Q.jsx)(`p`,{className:`mt-1 text-foreground bg-muted rounded px-2 py-1 whitespace-pre-wrap font-mono`,children:e.conflictContentSnapshot})})]})]},e.id)}function Kt(e){return(0,Q.jsx)(Lt,{value:e.id,children:e.name},e.id)}function qt(e){return(0,Q.jsx)(Ut,{field:e,label:`Tags`,children:(0,Q.jsx)(le,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`tag1, tag2`,"aria-invalid":e.state.meta.isTouched&&!e.state.meta.isValid})})}function Jt(e){return(0,Q.jsx)(Ut,{field:e,label:`Type`,description:(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-snug`,children:O[e.state.value]}),children:(0,Q.jsx)(It,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),className:`w-full`,children:k.map(Yt)})})}function Yt(e){return(0,Q.jsx)(Lt,{value:e,children:p(e)},e)}function Xt(e){return(0,Q.jsx)(Ut,{field:e,label:`Content`,children:(0,Q.jsx)(Rt,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),rows:8,className:`min-h-32 font-heading text-sm`,"aria-invalid":e.state.meta.isTouched&&!e.state.meta.isValid})})}function Zt(e){return e.trim()}function Qt(e){let t=(0,$.c)(12),{id:n}=e,{projectId:r}=ne.useParams(),i=C(),a;t[0]!==i||t[1]!==r?(a=()=>void i({to:`/$projectId`,params:{projectId:r},search:$t}),t[0]=i,t[1]=r,t[2]=a):a=t[2];let{memory:o,isLoading:s,availableProjects:c,handleApprove:l,handleAddProject:u,handleRemoveProject:d,handleClose:f}=zt(n,a);if(s||!o){let e=s?`Loading…`:`Memory not found`,n;return t[3]===e?n=t[4]:(n=(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs font-mono text-muted-foreground`,children:e}),t[3]=e,t[4]=n),n}let p;return t[5]!==c||t[6]!==u||t[7]!==l||t[8]!==f||t[9]!==d||t[10]!==o?(p=(0,Q.jsx)(Wt,{memory:o,availableProjects:c,handleApprove:l,handleAddProject:u,handleRemoveProject:d,handleClose:f},o.id),t[5]=c,t[6]=u,t[7]=l,t[8]=f,t[9]=d,t[10]=o,t[11]=p):p=t[11],p}function $t(e){return e}export{Wt as n,zt as r,Qt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,S as t,T as n,_ as r,n as i,p as a,t as o,v as s,w as c}from"./collections-y7eMFwFc.js";import{M as l}from"./useRenderElement-DhejdWAQ.js";import{c as u}from"./preload-helper-DYD3iRAO.js";import{i as d,n as f,r as p,t as m}from"./WorkspaceCenter-F8ctl0ZL.js";import{t as h}from"./types-DT_fBrSI.js";import{D as g,i as _,s as v}from"./index-B3Ej81eU.js";var y=t(),b=e(n(),1);function x(e){let t=(0,y.c)(52),{projectId:n}=_.useParams(),r=_.useSearch(),i=u(),[s,c]=(0,b.useState)(r.search),l=(0,b.useRef)(null),d=(0,b.useRef)(null),[f,p]=(0,b.useState)(-1),[m,h]=(0,b.useState)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let v=(0,b.useRef)(g),x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[1]=x):x=t[1];let{data:A,isLoading:j}=a(k,x),M;if(t[2]!==n||t[3]!==r.needsReview||t[4]!==r.pinned||t[5]!==r.search||t[6]!==r.type||t[7]!==A){let e=A===void 0?[]:A,i;if(t[9]===n?i=t[10]:(i=e=>e.projects.some(e=>e.id===n),t[9]=n,t[10]=i),M=e.filter(i),r.type){let e;t[11]===r.type?e=t[12]:(e=e=>e.type===r.type,t[11]=r.type,t[12]=e),M=M.filter(e)}if(r.pinned&&(M=M.filter(O)),r.needsReview&&(M=M.filter(D)),r.search){let e=r.search.toLowerCase();M=M.filter(t=>t.content.toLowerCase().includes(e))}t[2]=n,t[3]=r.needsReview,t[4]=r.pinned,t[5]=r.search,t[6]=r.type,t[7]=A,t[8]=M}else M=t[8];let N,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>()=>{l.current&&clearTimeout(l.current)},P=[],t[13]=N,t[14]=P):(N=t[13],P=t[14]),(0,b.useEffect)(N,P);let F;t[15]!==M.length||t[16]!==f?(F=()=>{M.length===0?p(-1):f>=M.length&&p(M.length-1)},t[15]=M.length,t[16]=f,t[17]=F):F=t[17];let I;t[18]!==M.length||t[19]!==f?(I=[M.length,f],t[18]=M.length,t[19]=f,t[20]=I):I=t[20],(0,b.useEffect)(F,I);let L,R;t[21]===f?(L=t[22],R=t[23]):(L=()=>{f>=0&&v.current[f]?.scrollIntoView({block:`nearest`})},R=[f],t[21]=f,t[22]=L,t[23]=R),(0,b.useEffect)(L,R);let z;t[24]!==i||t[25]!==n?(z=e=>{c(e),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{i({to:`/$projectId`,params:{projectId:n},search:t=>({...t,search:e})})},300)},t[24]=i,t[25]=n,t[26]=z):z=t[26];let B=z,V=E,H;t[27]!==i||t[28]!==n||t[29]!==e?(H=t=>{o.delete(t),e===t&&i({to:`/$projectId`,params:{projectId:n},search:T})},t[27]=i,t[28]=n,t[29]=e,t[30]=H):H=t[30];let U=H,W;t[31]!==M||t[32]!==i||t[33]!==n||t[34]!==e?(W=t=>{let r=M.findIndex(e=>e.id===t);r>=0&&p(r),i(e===t?{to:`/$projectId`,params:{projectId:n},search:w}:{to:`/$projectId/$memoryId`,params:{projectId:n,memoryId:t},search:C})},t[31]=M,t[32]=i,t[33]=n,t[34]=e,t[35]=W):W=t[35];let G=W,K=!!(r.search||r.type||r.pinned||r.needsReview),q;t[36]!==i||t[37]!==n?(q=()=>{l.current&&clearTimeout(l.current),c(``),i({to:`/$projectId`,params:{projectId:n},search:S})},t[36]=i,t[37]=n,t[38]=q):q=t[38];let J=q,Y;return t[39]!==m||t[40]!==M||t[41]!==f||t[42]!==J||t[43]!==U||t[44]!==B||t[45]!==G||t[46]!==K||t[47]!==j||t[48]!==n||t[49]!==r||t[50]!==s?(Y={projectId:n,search:r,searchInput:s,inputRef:d,isLoading:j,filtered:M,focusedIndex:f,setFocusedIndex:p,confirmingId:m,setConfirmingId:h,rowRefs:v,hasActiveFilters:K,handleSearchChange:B,handleClearFilters:J,handlePin:V,handleDelete:U,handleSelect:G},t[39]=m,t[40]=M,t[41]=f,t[42]=J,t[43]=U,t[44]=B,t[45]=G,t[46]=K,t[47]=j,t[48]=n,t[49]=r,t[50]=s,t[51]=Y):Y=t[51],Y}function S(){return{}}function C(e){return e}function w(e){return e}function T(e){return e}function E(e,t){o.update(e,e=>{e.pinned=!t})}function D(e){return e.reviewEvents.length>0}function O(e){return e.pinned}function k(e){return e.from({m:o}).orderBy(A,`desc`)}function A(e){let{m:t}=e;return t.createdAt}var j=c(),M=r(`w-full text-left py-1 px-4 text-xs font-mono transition-colors`,{variants:{active:{true:`text-primary bg-muted/50`,false:`text-muted-foreground hover:text-foreground hover:bg-muted/30`}},defaultVariants:{active:!1}}),N=r(`flex items-center gap-2 px-4 py-1 text-xs font-mono transition-colors w-full text-left`,{variants:{active:{true:``,false:`text-muted-foreground hover:text-foreground`},color:{primary:``,destructive:``}},compoundVariants:[{active:!0,color:`primary`,class:`text-primary`},{active:!0,color:`destructive`,class:`text-destructive`}],defaultVariants:{active:!1,color:`primary`}});function P(e){let t=(0,y.c)(48),{projectName:n}=e,{projectId:r}=_.useParams(),i=_.useSearch(),a=u(),o;t[0]!==a||t[1]!==r?(o=e=>void a({to:`/$projectId`,params:{projectId:r},search:t=>({...t,type:e})}),t[0]=a,t[1]=r,t[2]=o):o=t[2];let c=o,d;t[3]!==a||t[4]!==r?(d=()=>void a({to:`/$projectId`,params:{projectId:r},search:I}),t[3]=a,t[4]=r,t[5]=d):d=t[5];let m=d,g;t[6]!==a||t[7]!==r?(g=()=>void a({to:`/$projectId`,params:{projectId:r},search:F}),t[6]=a,t[7]=r,t[8]=g):g=t[8];let b=g,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,j.jsxs)(l,{to:`/`,className:`inline-flex items-center gap-1 text-[11px] font-mono text-muted-foreground hover:text-foreground transition-colors`,children:[(0,j.jsx)(p,{weight:`regular`,className:`size-3`}),`Projects`]}),t[9]=x):x=t[9];let S;t[10]===n?S=t[11]:(S=(0,j.jsxs)(`div`,{className:`px-4`,children:[x,(0,j.jsx)(`p`,{className:`text-xs font-mono font-medium text-foreground truncate mt-3 mb-4`,children:n})]}),t[10]=n,t[11]=S);let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,j.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground font-mono mb-1 px-4`,children:`Types`}),t[12]=C):C=t[12];let w;t[13]===c?w=t[14]:(w=()=>c(void 0),t[13]=c,t[14]=w);let T=!i.type,E;t[15]===T?E=t[16]:(E=M({active:T}),t[15]=T,t[16]=E);let D;t[17]!==w||t[18]!==E?(D=(0,j.jsx)(`button`,{type:`button`,onClick:w,className:E,children:`All`}),t[17]=w,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==i.type||t[21]!==c?(O=h.map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:M({active:i.type===e}),children:s(e)},e)),t[20]=i.type,t[21]=c,t[22]=O):O=t[22];let k;t[23]!==D||t[24]!==O?(k=(0,j.jsxs)(`div`,{className:`mb-1`,children:[C,D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(`div`,{className:`border-t border-border my-3`}),t[26]=A):A=t[26];let P;t[27]===i.pinned?P=t[28]:(P=N({active:i.pinned,color:`primary`}),t[27]=i.pinned,t[28]=P);let L=i.pinned?`fill`:`regular`,R;t[29]===L?R=t[30]:(R=(0,j.jsx)(f,{weight:L,className:`size-3 shrink-0`}),t[29]=L,t[30]=R);let z;t[31]!==P||t[32]!==R||t[33]!==m?(z=(0,j.jsxs)(`button`,{type:`button`,onClick:m,className:P,children:[R,`Pinned only`]}),t[31]=P,t[32]=R,t[33]=m,t[34]=z):z=t[34];let B;t[35]===i.needsReview?B=t[36]:(B=N({active:i.needsReview,color:`destructive`}),t[35]=i.needsReview,t[36]=B);let V=i.needsReview?`fill`:`regular`,H;t[37]===V?H=t[38]:(H=(0,j.jsx)(v,{weight:V,className:`size-3 shrink-0`}),t[37]=V,t[38]=H);let U;t[39]!==B||t[40]!==H||t[41]!==b?(U=(0,j.jsxs)(`button`,{type:`button`,onClick:b,className:B,children:[H,`Needs review`]}),t[39]=B,t[40]=H,t[41]=b,t[42]=U):U=t[42];let W;return t[43]!==k||t[44]!==z||t[45]!==U||t[46]!==S?(W=(0,j.jsxs)(`nav`,{className:`flex flex-col h-full bg-background border-r border-border py-3 overflow-y-auto`,children:[S,k,A,z,U]}),t[43]=k,t[44]=z,t[45]=U,t[46]=S,t[47]=W):W=t[47],W}function F(e){return{...e,needsReview:!e.needsReview}}function I(e){return{...e,pinned:!e.pinned}}function L(){let e=(0,y.c)(19),{projectId:t}=_.useParams(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0];let{data:r}=a(R,n),i;e[1]===r?i=e[2]:(i=r===void 0?[]:r,e[1]=r,e[2]=i);let o=i,s;if(e[3]!==t||e[4]!==o){let n;e[6]===t?n=e[7]:(n=e=>e.id===t,e[6]=t,e[7]=n),s=o.find(n),e[3]=t,e[4]=o,e[5]=s}else s=e[5];let c=s?.name??t,l;e[8]===t?l=e[9]:(l={select:e=>{let n=e.location.pathname,r=`/${t}/`;return n.startsWith(r)?n.slice(r.length):null}},e[8]=t,e[9]=l);let u=d(l),f=x(u),p;e[10]===c?p=e[11]:(p=(0,j.jsx)(`div`,{className:`w-50 shrink-0 overflow-hidden flex flex-col`,children:(0,j.jsx)(P,{projectName:c})}),e[10]=c,e[11]=p);let h;e[12]!==f||e[13]!==u?(h=(0,j.jsx)(`div`,{className:`flex-1 min-w-0 border-x border-border overflow-hidden flex flex-col`,children:(0,j.jsx)(m,{selectedId:u,list:f})}),e[12]=f,e[13]=u,e[14]=h):h=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,j.jsx)(`div`,{className:`max-w-prose shrink-0 overflow-hidden flex flex-col`,children:(0,j.jsx)(g,{})}),e[15]=v):v=e[15];let b;return e[16]!==p||e[17]!==h?(b=(0,j.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[p,h,v]}),e[16]=p,e[17]=h,e[18]=b):b=e[18],b}function R(e){return e.from({p:i})}export{L as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,w as t}from"./collections-y7eMFwFc.js";import{t as n}from"./WorkspaceMemoryDetail-BLFoEX3q.js";import{t as r}from"./index-B3Ej81eU.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{memoryId:t}=r.useParams(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(n,{id:t},t),e[0]=t,e[1]=o),o}export{o as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,S as t,T as n,b as r,d as i,f as a,i as o,m as s,n as c,p as l,r as u,t as d,w as f,y as p}from"./collections-y7eMFwFc.js";import{i as m,n as h}from"./preload-helper-DYD3iRAO.js";import{i as g,t as _}from"./types-DT_fBrSI.js";import{r as v}from"./index-B3Ej81eU.js";import{n as y,r as b,t as x}from"./empty-C4Q9vAt-.js";import{t as S}from"./skeleton-BDvkvqhf.js";var C=e(n(),1),w=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M96,240l16-80L48,136,160,16,144,96l64,24Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z`}))]]),T=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z`}))]]),E=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),D=C.forwardRef((e,t)=>C.createElement(m,{ref:t,...e,weights:w}));D.displayName=`LightningIcon`;var O=D,k=C.forwardRef((e,t)=>C.createElement(m,{ref:t,...e,weights:T}));k.displayName=`SpinnerIcon`;var A=C.forwardRef((e,t)=>C.createElement(m,{ref:t,...e,weights:E}));A.displayName=`WarningCircleIcon`;var j=A,M=t(),N=f();function P(e){let t=(0,M.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`size-4 animate-spin`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,N.jsx)(k,{role:`status`,"aria-label":`Loading`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var F=6e4;function I(e){let t=(0,M.c)(27),[n,r]=(0,C.useState)(null),[c,d]=(0,C.useState)(!1),f,p;t[0]===e.scopeHash?(f=t[1],p=t[2]):(f=t=>t.from({s:o}).where(t=>{let{s:n}=t;return s(n.scope,e.scopeHash)}),p=[e.scopeHash],t[0]=e.scopeHash,t[1]=f,t[2]=p);let{data:m,isLoading:h}=l(f,p),g;t[3]===m?g=t[4]:(g=m===void 0?[]:m,t[3]=m,t[4]=g);let _=g[0]??null,v;t[5]===_?.inFlightSince?v=t[6]:(v=()=>{if(!_?.inFlightSince)return;let e=setInterval(L,3e3);return()=>clearInterval(e)},t[5]=_?.inFlightSince,t[6]=v);let y=_?.inFlightSince,b;t[7]===y?b=t[8]:(b=[y],t[7]=y,t[8]=b),(0,C.useEffect)(v,b);let x;t[9]===_?x=t[10]:(x=()=>{if(!_?.inFlightSince){d(!1);return}let e=F-(Date.now()-new Date(_.inFlightSince).getTime());if(e<=0){d(!0);return}let t=setTimeout(()=>d(!0),e);return()=>clearTimeout(t)},t[9]=_,t[10]=x);let S=_?.inFlightSince,w;t[11]===S?w=t[12]:(w=[S],t[11]=S,t[12]=w),(0,C.useEffect)(x,w);let T;t[13]===e.id?T=t[14]:(T=async()=>{r(null);try{await a(e.id),await u.invalidateQueries({queryKey:[`syntheses`]})}catch{r(`Failed to start synthesis`)}},t[13]=e.id,t[14]=T);let E=T,D;t[15]===e.id?D=t[16]:(D=async()=>{r(null),d(!1);try{await i(e.id),await u.invalidateQueries({queryKey:[`syntheses`]})}catch{r(`Failed to reset synthesis`)}},t[15]=e.id,t[16]=D);let O=D,k;t[17]===_?k=t[18]:(k=_!==null&&_.inFlightSince===null&&new Date(_.expiresAt)<new Date,t[17]=_,t[18]=k);let A=k,j;return t[19]!==n||t[20]!==h||t[21]!==A||t[22]!==c||t[23]!==O||t[24]!==E||t[25]!==_?(j={synthesis:_,isLoading:h,isStale:A,isStuck:c,error:n,run:E,reset:O},t[19]=n,t[20]=h,t[21]=A,t[22]=c,t[23]=O,t[24]=E,t[25]=_,t[26]=j):j=t[26],j}function L(){u.invalidateQueries({queryKey:[`syntheses`]})}function R(e){let t=(0,M.c)(10),{synthesis:n,isStale:i}=e,a;t[0]===i?a=t[1]:(a=i?(0,N.jsx)(g,{variant:`stale`,children:`Stale`}):null,t[0]=i,t[1]=a);let o=n.synthesizedAt,s;t[2]===n.synthesizedAt?s=t[3]:(s=r(n.synthesizedAt),t[2]=n.synthesizedAt,t[3]=s);let c;t[4]!==n.synthesizedAt||t[5]!==s?(c=(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 tabular-nums`,title:o,children:s}),t[4]=n.synthesizedAt,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function z(e){let t=(0,M.c)(2),{onReset:n}=e,r;return t[0]===n?r=t[1]:(r=(0,N.jsx)(`button`,{type:`button`,onClick:()=>void n(),className:`text-[11px] text-muted-foreground/60 hover:text-muted-foreground transition-colors underline underline-offset-2`,children:`Taking too long? Reset`}),t[0]=n,t[1]=r),r}function B(e){let t=(0,M.c)(46),{synthesis:n,isLoading:r,isStale:i,isStuck:a,error:o,onRun:s,onReset:c}=e,l=n?.inFlightSince!==null&&n?.inFlightSince!==void 0,u=l&&n.content!==`pending`,d=!n&&!r&&!o,f=n!==null&&!l;if(r&&!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,N.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-4 space-y-2`,children:[(0,N.jsx)(S,{className:`h-3 w-32`}),(0,N.jsx)(S,{className:`h-3 w-full`}),(0,N.jsx)(S,{className:`h-3 w-full`}),(0,N.jsx)(S,{className:`h-3 w-3/4`})]}),t[0]=e):e=t[0],e}if(o){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,N.jsx)(j,{weight:`fill`,className:`size-4 text-destructive mt-0.5 shrink-0`}),t[1]=e):e=t[1];let n;t[2]===o?n=t[3]:(n=(0,N.jsx)(`p`,{className:`text-xs text-destructive`,children:o}),t[2]=o,t[3]=n);let r;t[4]===s?r=t[5]:(r=(0,N.jsx)(`button`,{type:`button`,onClick:()=>void s(),className:`text-[11px] text-muted-foreground hover:text-foreground mt-1 underline underline-offset-2 transition-colors`,children:`Retry`}),t[4]=s,t[5]=r);let i;return t[6]!==n||t[7]!==r?(i=(0,N.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-4 flex items-start gap-2`,children:[e,(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[n,r]})]}),t[6]=n,t[7]=r,t[8]=i):i=t[8],i}if(d){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No synthesis yet.`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground/70`,children:`Run a synthesis to see a summary of what this project's memories contain.`})]}),t[9]=e):e=t[9];let n;t[10]===s?n=t[11]:(n=()=>void s(),t[10]=s,t[11]=n);let r;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,N.jsx)(O,{weight:`fill`,className:`size-3`}),t[12]=r):r=t[12];let i;return t[13]===n?i=t[14]:(i=(0,N.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-4 space-y-3`,children:[e,(0,N.jsxs)(h,{size:`sm`,variant:`secondary`,onClick:n,className:`gap-1.5`,children:[r,`Generate`]})]}),t[13]=n,t[14]=i),i}if(l&&!u){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,N.jsx)(P,{className:`size-3`}),(0,N.jsx)(`span`,{className:`text-[11px]`,children:`Synthesizing…`})]}),t[15]=e):e=t[15];let n;t[16]!==a||t[17]!==c?(n=a?(0,N.jsx)(z,{onReset:c}):null,t[16]=a,t[17]=c,t[18]=n):n=t[18];let r;t[19]===n?r=t[20]:(r=(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e,n]}),t[19]=n,t[20]=r);let i;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(S,{className:`h-3 w-full`}),(0,N.jsx)(S,{className:`h-3 w-full`}),(0,N.jsx)(S,{className:`h-3 w-5/6`}),(0,N.jsx)(S,{className:`h-3 w-full`}),(0,N.jsx)(S,{className:`h-3 w-3/4`})]}),t[21]=i):i=t[21];let o;return t[22]===r?o=t[23]:(o=(0,N.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-4 space-y-3`,children:[r,i]}),t[22]=r,t[23]=o),o}if(!n)return null;let m;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground font-medium`,children:`Memory synthesis`}),t[24]=m):m=t[24];let g;t[25]!==i||t[26]!==n?(g=(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[m,(0,N.jsx)(R,{synthesis:n,isStale:i})]}),t[25]=i,t[26]=n,t[27]=g):g=t[27];let _=l&&`opacity-50`,v;t[28]===_?v=t[29]:(v=p(`text-sm leading-relaxed max-w-[70ch] text-foreground/90 whitespace-pre-wrap`,_),t[28]=_,t[29]=v);let y;t[30]!==l||t[31]!==a||t[32]!==c?(y=l?(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,N.jsx)(P,{className:`size-3`}),(0,N.jsx)(`span`,{className:`text-[11px]`,children:`Synthesizing…`})]}),a?(0,N.jsx)(z,{onReset:c}):null]}):null,t[30]=l,t[31]=a,t[32]=c,t[33]=y):y=t[33];let b;t[34]!==n.content||t[35]!==v||t[36]!==y?(b=(0,N.jsxs)(`div`,{className:v,children:[y,n.content]}),t[34]=n.content,t[35]=v,t[36]=y,t[37]=b):b=t[37];let x;t[38]!==f||t[39]!==i||t[40]!==s?(x=f?(0,N.jsx)(`div`,{className:`flex justify-end`,children:i?(0,N.jsxs)(h,{size:`sm`,variant:`secondary`,onClick:()=>void s(),className:`gap-1.5`,children:[(0,N.jsx)(O,{weight:`fill`,className:`size-3`}),`Regenerate`]}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>void s(),className:`text-[11px] text-muted-foreground/60 hover:text-muted-foreground transition-colors`,children:`Regenerate`})}):null,t[38]=f,t[39]=i,t[40]=s,t[41]=x):x=t[41];let C;return t[42]!==g||t[43]!==b||t[44]!==x?(C=(0,N.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-4 space-y-3`,children:[g,b,x]}),t[42]=g,t[43]=b,t[44]=x,t[45]=C):C=t[45],C}function V(e){let t=(0,M.c)(13),{projectId:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let{data:i}=l(H,r),a;t[1]===i?a=t[2]:(a=i===void 0?[]:i,t[1]=i,t[2]=a);let o=a,s;if(t[3]!==o||t[4]!==n){let e=o.filter(e=>e.projects.some(e=>e.id===n));s={};for(let e of _)s[e]=0;for(let t of e){let e=t.type;e in s&&(s[e]=s[e]+1)}t[3]=o,t[4]=n,t[5]=s}else s=t[5];let c=s,u,d,f;if(t[6]!==c){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=_.filter(e=>c[e]>0);if(e.length===0){f=null;break bb0}u=`flex flex-wrap gap-1.5`,d=e.map(e=>(0,N.jsxs)(g,{variant:e,children:[c[e],` `,e,c[e]===1?``:`s`]},e))}t[6]=c,t[7]=u,t[8]=d,t[9]=f}else u=t[7],d=t[8],f=t[9];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;return t[10]!==u||t[11]!==d?(p=(0,N.jsx)(`div`,{className:u,children:d}),t[10]=u,t[11]=d,t[12]=p):p=t[12],p}function H(e){return e.from({m:d})}function U(e){let t=(0,M.c)(21),{project:n}=e,{synthesis:r,isLoading:i,isStale:a,isStuck:o,error:s,run:c,reset:l}=I(n),u;t[0]===n.name?u=t[1]:(u=(0,N.jsx)(`h2`,{className:`font-heading text-base font-semibold text-foreground`,children:n.name}),t[0]=n.name,t[1]=u);let d;t[2]===n.scopeHash?d=t[3]:(d=(0,N.jsx)(`p`,{className:`font-mono text-[10px] text-muted-foreground/50 mt-0.5 truncate`,children:n.scopeHash}),t[2]=n.scopeHash,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,N.jsxs)(`header`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]!==s||t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==l||t[12]!==c||t[13]!==r?(p=(0,N.jsx)(B,{synthesis:r,isLoading:i,isStale:a,isStuck:o,error:s,onRun:c,onReset:l}),t[7]=s,t[8]=i,t[9]=a,t[10]=o,t[11]=l,t[12]=c,t[13]=r,t[14]=p):p=t[14];let m;t[15]===n.id?m=t[16]:(m=(0,N.jsx)(V,{projectId:n.id}),t[15]=n.id,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,N.jsxs)(`div`,{className:`h-full overflow-y-auto p-6 space-y-5`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function W(){let e=(0,M.c)(11),{projectId:t}=v.useParams(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0];let{data:r}=l(G,n),i;e[1]===r?i=e[2]:(i=r===void 0?[]:r,e[1]=r,e[2]=i);let a=i,o;if(e[3]!==t||e[4]!==a){let n;e[6]===t?n=e[7]:(n=e=>e.id===t,e[6]=t,e[7]=n),o=a.find(n),e[3]=t,e[4]=a,e[5]=o}else o=e[5];let s=o;if(!s){let t;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsxs)(x,{children:[(0,N.jsx)(b,{children:`Project not found`}),(0,N.jsx)(y,{children:`This project may have been removed.`})]}),e[8]=t):t=e[8],t}let c;return e[9]===s?c=e[10]:(c=(0,N.jsx)(U,{project:s}),e[9]=s,e[10]=c),c}function G(e){return e.from({p:c})}export{W as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,_ as t,w as n,y as r}from"./collections-y7eMFwFc.js";var i=e(),a=n();function o(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`empty`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}t(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function s(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`font-heading text-sm font-medium tracking-tight`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`empty-title`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function c(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`empty-description`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}export{c as n,s as r,o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,S as t,T as n,_ as r,p as i,t as a,v as o,w as s}from"./collections-y7eMFwFc.js";import{M as c}from"./useRenderElement-DhejdWAQ.js";import{c as l}from"./preload-helper-DYD3iRAO.js";import{i as u,n as d,r as f,t as p}from"./WorkspaceCenter-F8ctl0ZL.js";import{t as m}from"./types-DT_fBrSI.js";import{D as h,a as g,s as _}from"./index-B3Ej81eU.js";var v=t(),y=e(n(),1);function b(e){let t=(0,v.c)(44),n=g.useSearch(),r=l(),[o,s]=(0,y.useState)(n.search),c=(0,y.useRef)(null),u=(0,y.useRef)(null),[d,f]=(0,y.useState)(-1),[p,m]=(0,y.useState)(null),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[0]=h):h=t[0];let _=(0,y.useRef)(h),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let{data:A,isLoading:j}=i(k,b),M;if(t[2]!==n.needsReview||t[3]!==n.pinned||t[4]!==n.search||t[5]!==n.type||t[6]!==A){if(M=(A===void 0?[]:A).filter(O),n.type){let e;t[8]===n.type?e=t[9]:(e=e=>e.type===n.type,t[8]=n.type,t[9]=e),M=M.filter(e)}if(n.pinned&&(M=M.filter(D)),n.needsReview&&(M=M.filter(E)),n.search){let e=n.search.toLowerCase();M=M.filter(t=>t.content.toLowerCase().includes(e))}t[2]=n.needsReview,t[3]=n.pinned,t[4]=n.search,t[5]=n.type,t[6]=A,t[7]=M}else M=t[7];let N,P;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>()=>{c.current&&clearTimeout(c.current)},P=[],t[10]=N,t[11]=P):(N=t[10],P=t[11]),(0,y.useEffect)(N,P);let F;t[12]!==M.length||t[13]!==d?(F=()=>{M.length===0?f(-1):d>=M.length&&f(M.length-1)},t[12]=M.length,t[13]=d,t[14]=F):F=t[14];let I;t[15]!==M.length||t[16]!==d?(I=[M.length,d],t[15]=M.length,t[16]=d,t[17]=I):I=t[17],(0,y.useEffect)(F,I);let L,R;t[18]===d?(L=t[19],R=t[20]):(L=()=>{d>=0&&_.current[d]?.scrollIntoView({block:`nearest`})},R=[d],t[18]=d,t[19]=L,t[20]=R),(0,y.useEffect)(L,R);let z;t[21]===r?z=t[22]:(z=e=>{s(e),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{r({to:`/global`,search:t=>({...t,search:e})})},300)},t[21]=r,t[22]=z);let B=z,V=T,H;t[23]!==r||t[24]!==e?(H=t=>{a.delete(t),e===t&&r({to:`/global`,search:w})},t[23]=r,t[24]=e,t[25]=H):H=t[25];let U=H,W;t[26]!==M||t[27]!==r||t[28]!==e?(W=t=>{let n=M.findIndex(e=>e.id===t);n>=0&&f(n),r(e===t?{to:`/global`,search:C}:{to:`/global/$memoryId`,params:{memoryId:t},search:S})},t[26]=M,t[27]=r,t[28]=e,t[29]=W):W=t[29];let G=W,K=!!(n.search||n.type||n.pinned||n.needsReview),q;t[30]===r?q=t[31]:(q=()=>{c.current&&clearTimeout(c.current),s(``),r({to:`/global`,search:x})},t[30]=r,t[31]=q);let J=q,Y;return t[32]!==p||t[33]!==M||t[34]!==d||t[35]!==J||t[36]!==U||t[37]!==B||t[38]!==G||t[39]!==K||t[40]!==j||t[41]!==n||t[42]!==o?(Y={search:n,searchInput:o,inputRef:u,isLoading:j,filtered:M,focusedIndex:d,setFocusedIndex:f,confirmingId:p,setConfirmingId:m,rowRefs:_,hasActiveFilters:K,handleSearchChange:B,handleClearFilters:J,handlePin:V,handleDelete:U,handleSelect:G},t[32]=p,t[33]=M,t[34]=d,t[35]=J,t[36]=U,t[37]=B,t[38]=G,t[39]=K,t[40]=j,t[41]=n,t[42]=o,t[43]=Y):Y=t[43],Y}function x(){return{}}function S(e){return e}function C(e){return e}function w(e){return e}function T(e,t){a.update(e,e=>{e.pinned=!t})}function E(e){return e.reviewEvents.length>0}function D(e){return e.pinned}function O(e){return e.projects.length===0}function k(e){return e.from({m:a}).orderBy(A,`desc`)}function A(e){let{m:t}=e;return t.createdAt}var j=s(),M=r(`w-full text-left py-1 px-4 text-xs font-mono transition-colors`,{variants:{active:{true:`text-primary bg-muted/50`,false:`text-muted-foreground hover:text-foreground hover:bg-muted/30`}},defaultVariants:{active:!1}}),N=r(`flex items-center gap-2 px-4 py-1 text-xs font-mono transition-colors w-full text-left`,{variants:{active:{true:``,false:`text-muted-foreground hover:text-foreground`},color:{primary:``,destructive:``}},compoundVariants:[{active:!0,color:`primary`,class:`text-primary`},{active:!0,color:`destructive`,class:`text-destructive`}],defaultVariants:{active:!1,color:`primary`}});function P(){let e=(0,v.c)(42),t=g.useSearch(),n=l(),r;e[0]===n?r=e[1]:(r=e=>void n({to:`/global`,search:t=>({...t,type:e})}),e[0]=n,e[1]=r);let i=r,a;e[2]===n?a=e[3]:(a=()=>void n({to:`/global`,search:I}),e[2]=n,e[3]=a);let s=a,u;e[4]===n?u=e[5]:(u=()=>void n({to:`/global`,search:F}),e[4]=n,e[5]=u);let p=u,h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,j.jsxs)(`div`,{className:`px-4`,children:[(0,j.jsxs)(c,{to:`/`,className:`inline-flex items-center gap-1 text-[11px] font-mono text-muted-foreground hover:text-foreground transition-colors`,children:[(0,j.jsx)(f,{weight:`regular`,className:`size-3`}),`Projects`]}),(0,j.jsx)(`p`,{className:`text-xs font-mono font-medium text-foreground truncate mt-3 mb-4`,children:`Global`})]}),e[6]=h):h=e[6];let y;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,j.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground font-mono mb-1 px-4`,children:`Types`}),e[7]=y):y=e[7];let b;e[8]===i?b=e[9]:(b=()=>i(void 0),e[8]=i,e[9]=b);let x=!t.type,S;e[10]===x?S=e[11]:(S=M({active:x}),e[10]=x,e[11]=S);let C;e[12]!==b||e[13]!==S?(C=(0,j.jsx)(`button`,{type:`button`,onClick:b,className:S,children:`All`}),e[12]=b,e[13]=S,e[14]=C):C=e[14];let w;e[15]!==t.type||e[16]!==i?(w=m.map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:M({active:t.type===e}),children:o(e)},e)),e[15]=t.type,e[16]=i,e[17]=w):w=e[17];let T;e[18]!==C||e[19]!==w?(T=(0,j.jsxs)(`div`,{className:`mb-1`,children:[y,C,w]}),e[18]=C,e[19]=w,e[20]=T):T=e[20];let E;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,j.jsx)(`div`,{className:`border-t border-border my-3`}),e[21]=E):E=e[21];let D;e[22]===t.pinned?D=e[23]:(D=N({active:t.pinned,color:`primary`}),e[22]=t.pinned,e[23]=D);let O=t.pinned?`fill`:`regular`,k;e[24]===O?k=e[25]:(k=(0,j.jsx)(d,{weight:O,className:`size-3 shrink-0`}),e[24]=O,e[25]=k);let A;e[26]!==D||e[27]!==k||e[28]!==s?(A=(0,j.jsxs)(`button`,{type:`button`,onClick:s,className:D,children:[k,`Pinned only`]}),e[26]=D,e[27]=k,e[28]=s,e[29]=A):A=e[29];let P;e[30]===t.needsReview?P=e[31]:(P=N({active:t.needsReview,color:`destructive`}),e[30]=t.needsReview,e[31]=P);let L=t.needsReview?`fill`:`regular`,R;e[32]===L?R=e[33]:(R=(0,j.jsx)(_,{weight:L,className:`size-3 shrink-0`}),e[32]=L,e[33]=R);let z;e[34]!==P||e[35]!==R||e[36]!==p?(z=(0,j.jsxs)(`button`,{type:`button`,onClick:p,className:P,children:[R,`Needs review`]}),e[34]=P,e[35]=R,e[36]=p,e[37]=z):z=e[37];let B;return e[38]!==T||e[39]!==A||e[40]!==z?(B=(0,j.jsxs)(`nav`,{className:`flex flex-col h-full bg-background border-r border-border py-3 overflow-y-auto`,children:[h,T,E,A,z]}),e[38]=T,e[39]=A,e[40]=z,e[41]=B):B=e[41],B}function F(e){return{...e,needsReview:!e.needsReview}}function I(e){return{...e,pinned:!e.pinned}}function L(){let e=(0,v.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:R},e[0]=t):t=e[0];let n=u(t),r=b(n),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(`div`,{className:`w-50 shrink-0 overflow-hidden flex flex-col`,children:(0,j.jsx)(P,{})}),e[1]=i):i=e[1];let a;e[2]!==r||e[3]!==n?(a=(0,j.jsx)(`div`,{className:`flex-1 min-w-0 border-x border-border overflow-hidden flex flex-col`,children:(0,j.jsx)(p,{selectedId:n,list:r})}),e[2]=r,e[3]=n,e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,j.jsx)(`div`,{className:`max-w-prose shrink-0 overflow-hidden flex flex-col`,children:(0,j.jsx)(h,{})}),e[5]=o):o=e[5];let s;return e[6]===a?s=e[7]:(s=(0,j.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[i,a,o]}),e[6]=a,e[7]=s),s}function R(e){let t=e.location.pathname;return t.startsWith(`/global/`)?t.slice(8):null}export{L as component};
|