@membank/dashboard 0.2.3 → 0.3.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.
@@ -0,0 +1 @@
1
+ var $r=Object.defineProperty;var tn=e=>{throw TypeError(e)};var Yr=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ge=(e,t,n)=>Yr(e,typeof t!="symbol"?t+"":t,n),xt=(e,t,n)=>t.has(e)||tn("Cannot "+n);var Q=(e,t,n)=>(xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Be=(e,t,n)=>t.has(e)?tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),it=(e,t,n,r)=>(xt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ue=(e,t,n)=>(xt(e,t,"access private method"),n);import{u as Zr,r as c,a as Gr,b as qr,c as zr,d as Wt,e as ne,j as f,i as Se,g as Bt,f as Te,h as _t,N as $t,k as On,E as Qe,l as se,m as Xr,n as nt,o as nn,p as ft,q as bt,T as pt,s as Jr,t as Je,v as St,w as Qr,x as Yt,y as es,z as Dn,A as ts,B as An,C as Ae,D as rn,F as Nn,G as jn,H as de,I as Fn,J as ns,K as Zt,L as rs,R as ss,M as Hn,O as sn,P as Et,Q as os,S as is,U as as}from"./index-D_ebWYgx.js";import{f as cs}from"./MagnifyingGlass.es-BZ4bp5Mi.js";import{c as G,o as ee,a as He,b as Z,d as Ne,f as Ln,u as Gt,e as ls,r as De,t as us,g as Vn,h as Fe,i as ds,j as on,k as fs,l as Kn,T as an,m as Un,n as ps,A as hs,p as gs,q as ms,I as bs,N as cn,s as ze}from"./native-select-Dno9-QLw.js";function ys(e){return e!==null&&typeof e=="object"&&"current"in e}function Ie(){var n,r;if(typeof navigator>"u")return"linux";const e=((n=navigator.platform)==null?void 0:n.toLowerCase())??"",t=((r=navigator.userAgent)==null?void 0:r.toLowerCase())??"";return e.includes("mac")||t.includes("mac")?"mac":e.includes("win")||t.includes("win")?"windows":"linux"}const rt=["Control","Alt","Shift","Meta"];new Set(rt);const ln={Control:"Control",Ctrl:"Control",control:"Control",ctrl:"Control",Shift:"Shift",shift:"Shift",Alt:"Alt",Option:"Alt",alt:"Alt",option:"Alt",Command:"Meta",Cmd:"Meta",Meta:"Meta",command:"Meta",cmd:"Meta",meta:"Meta",OS:"Meta",os:"Meta",Win:"Meta",win:"Meta",CommandOrControl:"Mod",Mod:"Mod",commandorcontrol:"Mod",mod:"Mod"};function Wn(e,t=Ie()){return e==="Mod"?t==="mac"?"Meta":"Control":e}const xs=new Set(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),Ss=new Set(["0","1","2","3","4","5","6","7","8","9"]),Es=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ws=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),vs=new Set(["Enter","Escape","Space","Tab","Backspace","Delete"]),Rs=new Set(["/","[","]","\\","=","-",",",".",";","`"]),un={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Semicolon:";",Slash:"/"};[...xs,...Ss,...Es,...ws,...vs,...Rs];const dn={Esc:"Escape",esc:"Escape",escape:"Escape",Return:"Enter",return:"Enter",enter:"Enter"," ":"Space",space:"Space",Spacebar:"Space",spacebar:"Space",tab:"Tab",backspace:"Backspace",Del:"Delete",del:"Delete",delete:"Delete",Up:"ArrowUp",up:"ArrowUp",arrowup:"ArrowUp",Down:"ArrowDown",down:"ArrowDown",arrowdown:"ArrowDown",Left:"ArrowLeft",left:"ArrowLeft",arrowleft:"ArrowLeft",Right:"ArrowRight",right:"ArrowRight",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",PgUp:"PageUp",PgDn:"PageDown",pgup:"PageUp",pgdn:"PageDown"};function Bn(e){return new RegExp("^\\p{Letter}$","u").test(e)}function _e(e){if(!e)return"";if(e in dn)return dn[e];if(Bn(e)){const n=e.toUpperCase();return n.length===1?n:e}const t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function qt(e,t=Ie()){const n=e.split("+"),r=new Set;let s="";for(let o=0;o<n.length;o++){const i=n[o].trim();if(o===n.length-1)s=_e(i);else{const l=ln[i]??ln[i.toLowerCase()];if(l){const h=Wn(l,t);r.add(h)}else n.length===1&&(s=_e(i))}}return!s&&n.length>0&&(s=_e(n[n.length-1].trim())),{key:s,ctrl:r.has("Control"),shift:r.has("Shift"),alt:r.has("Alt"),meta:r.has("Meta"),modifiers:rt.filter(o=>r.has(o))}}function _n(e,t=Ie()){let n=e.ctrl??!1;const r=e.shift??!1,s=e.alt??!1;let o=e.meta??!1;e.mod&&(Wn("Mod",t)==="Control"?n=!0:o=!0);const i=rt.filter(l=>{switch(l){case"Control":return n;case"Shift":return r;case"Alt":return s;case"Meta":return o;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:s,meta:o,modifiers:i}}function $n(e,t){const n=t==="mac"?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push("Mod"),e.alt&&r.push("Alt"),e.shift&&r.push("Shift");else for(const s of rt)e.modifiers.includes(s)&&r.push(s);return r.push(_e(e.key)),r.join("+")}function Cs(e,t=Ie()){return $n(qt(e,t),t)}function Ts(e,t=Ie()){return $n(e,t)}function ks(e,t=Ie()){return typeof e=="string"?Cs(e,t):Ts(_n(e,t),t)}function Ps(e){const t=[];for(const n of rt)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join("+")}function fn(e,t,n=Ie()){const r=typeof t=="string"?qt(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;const s=_e(e.key),o=r.key;if(s!=="Dead"&&s.length===1&&o.length===1){if(s.toUpperCase()===o.toUpperCase())return!0;if(Bn(s)&&(/^[A-Za-z]$/.test(s)||!e.altKey))return!1}if(e.code&&(s==="Dead"||s.length===1&&o.length===1)){if(e.code.startsWith("Key")){const i=e.code.slice(3);if(i.length===1&&/^[A-Za-z]$/.test(i))return i.toUpperCase()===o.toUpperCase()}if(e.code.startsWith("Digit")){const i=e.code.slice(5);if(i.length===1&&/^[0-9]$/.test(i))return i===o}return e.code in un?un[e.code]===o:!1}return s===o}const Is={preventDefault:!0,stopPropagation:!0,eventType:"keydown",enabled:!0,ignoreInputs:!0,conflictBehavior:"warn"};function Ms(e){return!(e.ctrl||e.meta||e.key==="Escape")}function wt(e){if(!e)return!1;if(e instanceof HTMLInputElement){const t=e.type.toLowerCase();return!(t==="button"||t==="submit"||t==="reset")}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function Os(e){return typeof document>"u"?null:typeof Document<"u"&&e instanceof Document||typeof Node<"u"&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<"u"&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Ds(e,t,n){const r=Os(t);return r&&wt(r)&&r!==n||e.composedPath().some(s=>wt(s)&&s!==n)?!0:wt(e.target)&&e.target!==n}function As(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function Ns(e,t,n,r){if(n!=="allow"){if(n==="warn"){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n==="error")throw new Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}let R=(function(e){return e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e})({});function js({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:l};function r(a,d,g){const w=d.depsTail;if(w!==void 0&&w.dep===a)return;const m=w!==void 0?w.nextDep:d.deps;if(m!==void 0&&m.dep===a){m.version=g,d.depsTail=m;return}const b=a.subsTail;if(b!==void 0&&b.version===g&&b.sub===d)return;const p=d.depsTail=a.subsTail={version:g,dep:a,sub:d,prevDep:w,nextDep:m,prevSub:b,nextSub:void 0};m!==void 0&&(m.prevDep=p),w!==void 0?w.nextDep=p:d.deps=p,b!==void 0?b.nextSub=p:a.subs=p}function s(a,d=a.sub){const g=a.dep,w=a.prevDep,m=a.nextDep,b=a.nextSub,p=a.prevSub;return m!==void 0?m.prevDep=w:d.depsTail=w,w!==void 0?w.nextDep=m:d.deps=m,b!==void 0?b.prevSub=p:g.subsTail=p,p!==void 0?p.nextSub=b:(g.subs=b)===void 0&&n(g),m}function o(a){let d=a.nextSub,g;e:do{const w=a.sub;let m=w.flags;if(m&(R.RecursedCheck|R.Recursed|R.Dirty|R.Pending)?m&(R.RecursedCheck|R.Recursed)?m&R.RecursedCheck?!(m&(R.Dirty|R.Pending))&&h(a,w)?(w.flags=m|(R.Recursed|R.Pending),m&=R.Mutable):m=R.None:w.flags=m&~R.Recursed|R.Pending:m=R.None:w.flags=m|R.Pending,m&R.Watching&&t(w),m&R.Mutable){const b=w.subs;if(b!==void 0){const p=(a=b).nextSub;p!==void 0&&(g={value:d,prev:g},d=p);continue}}if((a=d)!==void 0){d=a.nextSub;continue}for(;g!==void 0;)if(a=g.value,g=g.prev,a!==void 0){d=a.nextSub;continue e}break}while(!0)}function i(a,d){let g,w=0,m=!1;e:do{const b=a.dep,p=b.flags;if(d.flags&R.Dirty)m=!0;else if((p&(R.Mutable|R.Dirty))===(R.Mutable|R.Dirty)){if(e(b)){const y=b.subs;y.nextSub!==void 0&&l(y),m=!0}}else if((p&(R.Mutable|R.Pending))===(R.Mutable|R.Pending)){(a.nextSub!==void 0||a.prevSub!==void 0)&&(g={value:a,prev:g}),a=b.deps,d=b,++w;continue}if(!m){const y=a.nextDep;if(y!==void 0){a=y;continue}}for(;w--;){const y=d.subs,E=y.nextSub!==void 0;if(E?(a=g.value,g=g.prev):a=y,m){if(e(d)){E&&l(y),d=a.sub;continue}m=!1}else d.flags&=~R.Pending;d=a.sub;const S=a.nextDep;if(S!==void 0){a=S;continue e}}return m}while(!0)}function l(a){do{const d=a.sub,g=d.flags;(g&(R.Pending|R.Dirty))===R.Pending&&(d.flags=g|R.Dirty,(g&(R.Watching|R.RecursedCheck))===R.Watching&&t(d))}while((a=a.nextSub)!==void 0)}function h(a,d){let g=d.depsTail;for(;g!==void 0;){if(g===a)return!0;g=g.prevDep}return!1}}function Yn(e,t,n){var o,i,l;const r=typeof e=="object",s=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(s),error:(i=r?e.error:t)==null?void 0:i.bind(s),complete:(l=r?e.complete:n)==null?void 0:l.bind(s)}}const Ot=[];let dt=0;const{link:pn,unlink:Fs,propagate:Hs,checkDirty:Zn,shallowPropagate:hn}=js({update(e){return e._update()},notify(e){Ot[Dt++]=e,e.flags&=~R.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=R.Mutable|R.Dirty,ht(e))}});let at=0,Dt=0,Re;function ht(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Fs(n,e)}function Ls(){for(;at<Dt;){const e=Ot[at];Ot[at++]=void 0,e.notify()}at=0,Dt=0}function Vs(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?R.None:R.Mutable,get(){return Re!==void 0&&pn(s,Re,dt),s._snapshot},subscribe(o){const i=Yn(o),l={current:!1},h=Ks(()=>{var a;s.get(),l.current?(a=i.next)==null||a.call(i,s._snapshot):l.current=!0});return{unsubscribe:()=>{h.stop()}}},_update(o){const i=Re,l=Object.is;if(n)Re=s,++dt,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=R.Mutable|R.RecursedCheck);try{const h=s._snapshot,a=typeof o=="function"?o(h):o===void 0&&n?r(h):o;return h===void 0||!l(h,a)?(s._snapshot=a,!0):!1}finally{Re=i,n&&(s.flags&=~R.RecursedCheck),ht(s)}}};return n?(s.flags=R.Mutable|R.Dirty,s.get=function(){const o=s.flags;if(o&R.Dirty||o&R.Pending&&Zn(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&hn(i)}}else o&R.Pending&&(s.flags=o&~R.Pending);return Re!==void 0&&pn(s,Re,dt),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Hs(i),hn(i),Ls())}},s}function Ks(e){const t=()=>{const r=Re;Re=n,++dt,n.depsTail=void 0,n.flags=R.Watching|R.RecursedCheck;try{return e()}finally{Re=r,n.flags&=~R.RecursedCheck,ht(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:R.Watching|R.RecursedCheck,notify(){const r=this.flags;r&R.Dirty||r&R.Pending&&Zn(this.deps,this)?t():this.flags=R.Watching},stop(){this.flags=R.None,this.depsTail=void 0,ht(this)}};return t(),n}var Us=class{constructor(t,n){this.atom=Vs(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Yn(t))}};let Ws=0;function gn(){return`hotkey_${++Ws}`}var me,ke,tt,Pe,Ce,q,At,Gn,Nt,jt,Ft,qn,zn,Xn,Jn,Bs=(me=class{constructor(){Be(this,q);Be(this,tt);Be(this,Pe,new Map);Be(this,Ce,new Map);this.registrations=new Us(new Map),it(this,tt,Ie())}static getInstance(){return Q(me,ke)||it(me,ke,new me),Q(me,ke)}static resetInstance(){Q(me,ke)&&(Q(me,ke).destroy(),it(me,ke,null))}register(t,n,r={}){if(typeof document>"u"&&!r.target){let b=n;return{id:gn(),unregister:()=>{},get callback(){return b},set callback(p){b=p},setOptions:()=>{},get isActive(){return!1}}}const s=gn(),o=r.platform??Q(this,tt),i=typeof t=="string"?qt(t,o):_n(t,o),l=typeof t=="string"?t:Ps(i),h=r.target??document,a=r.conflictBehavior??"warn",d=ue(this,q,Xn).call(this,l,h);d&&Ns(d.id,l,a,b=>ue(this,q,At).call(this,b));const g=r.ignoreInputs??Ms(i),w={id:s,hotkey:l,parsedHotkey:i,callback:n,options:{...Is,requireReset:!1,...r,platform:o,ignoreInputs:g},hasFired:!1,triggerCount:0,target:h};this.registrations.setState(b=>new Map(b).set(s,w)),Q(this,Ce).has(h)||Q(this,Ce).set(h,new Set),Q(this,Ce).get(h).add(s),ue(this,q,Gn).call(this,h);const m=this;return{get id(){return s},unregister:()=>{var b;ue(b=m,q,At).call(b,s)},get callback(){var b;return((b=m.registrations.state.get(s))==null?void 0:b.callback)??n},set callback(b){const p=m.registrations.state.get(s);p&&(p.callback=b)},setOptions:b=>{m.registrations.setState(p=>{const y=p.get(s);if(y){const E=new Map(p);return E.set(s,{...y,options:{...y.options,...b}}),E}return p})},get isActive(){return m.registrations.state.has(s)}}}triggerRegistration(t){const n=this.registrations.state.get(t);if(!n)return!1;const r=n.parsedHotkey,s=new KeyboardEvent(n.options.eventType??"keydown",{key:r.key,ctrlKey:r.ctrl,shiftKey:r.shift,altKey:r.alt,metaKey:r.meta,bubbles:!0,cancelable:!0});return n.triggerCount++,this.registrations.setState(o=>new Map(o)),n.callback(s,{hotkey:n.hotkey,parsedHotkey:n.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&(n===void 0||r.target===n))return!0;return!1}destroy(){for(const t of Q(this,Pe).keys())ue(this,q,Nt).call(this,t);this.registrations.setState(()=>new Map),Q(this,Pe).clear(),Q(this,Ce).clear()}},ke=new WeakMap,tt=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,q=new WeakSet,At=function(t){const n=this.registrations.state.get(t);if(!n)return;const r=n.target;this.registrations.setState(o=>{const i=new Map(o);return i.delete(t),i});const s=Q(this,Ce).get(r);s&&(s.delete(t),s.size===0&&ue(this,q,Nt).call(this,r))},Gn=function(t){if(typeof document>"u"||Q(this,Pe).has(t))return;const n=ue(this,q,qn).call(this,t),r=ue(this,q,zn).call(this,t);t.addEventListener("keydown",n),t.addEventListener("keyup",r),Q(this,Pe).set(t,{keydown:n,keyup:r})},Nt=function(t){if(typeof document>"u")return;const n=Q(this,Pe).get(t);n&&(t.removeEventListener("keydown",n.keydown),t.removeEventListener("keyup",n.keyup),Q(this,Pe).delete(t),Q(this,Ce).delete(t))},jt=function(t,n,r){const s=Q(this,Ce).get(n);if(s)for(const o of s){const i=this.registrations.state.get(o);if(i&&As(t,n)&&i.options.enabled&&!(i.options.ignoreInputs!==!1&&Ds(t,n,i.target)))if(r==="keydown"){if(i.options.eventType!=="keydown")continue;fn(t,i.parsedHotkey,i.options.platform)&&(i.options.preventDefault&&t.preventDefault(),i.options.stopPropagation&&t.stopPropagation(),(!i.options.requireReset||!i.hasFired)&&(ue(this,q,Ft).call(this,i,t),i.options.requireReset&&(i.hasFired=!0)))}else i.options.eventType==="keyup"&&fn(t,i.parsedHotkey,i.options.platform)&&ue(this,q,Ft).call(this,i,t),i.options.requireReset&&i.hasFired&&ue(this,q,Jn).call(this,i,t)&&(i.hasFired=!1)}},Ft=function(t,n){t.options.preventDefault&&n.preventDefault(),t.options.stopPropagation&&n.stopPropagation(),t.triggerCount++,this.registrations.setState(s=>new Map(s));const r={hotkey:t.hotkey,parsedHotkey:t.parsedHotkey};t.callback(n,r)},qn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keydown")}},zn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keyup")}},Xn=function(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&r.target===n)return r;return null},Jn=function(t,n){const r=t.parsedHotkey,s=_e(n.key),o=r.key.length===1?r.key.toUpperCase():r.key;return!!((s.length===1?s.toUpperCase():s)===o||r.ctrl&&s==="Control"||r.shift&&s==="Shift"||r.alt&&s==="Alt"||r.meta&&s==="Meta")},Be(me,ke,null),me);function _s(){return Bs.getInstance()}function $s(e,t={}){var w;const n=Zr().hotkey,r=_s(),s=t.platform??(n==null?void 0:n.platform)??Ie(),o=c.useRef(new Map),i=c.useRef(e),l=c.useRef([]),h=c.useRef(t),a=c.useRef(n),d=c.useRef(r),g=e.map(m=>ks(m.hotkey,s));i.current=e,l.current=g,h.current=t,a.current=n,d.current=r,c.useEffect(()=>{const m=o.current,b=new Map,p=[];for(let E=0;E<i.current.length;E++){const S=i.current[E],D=l.current[E],P={...a.current,...h.current,...S.options},k=ys(P.target)?P.target.current:P.target??(typeof document<"u"?document:null);if(!k)continue;const L=`${E}:${D}`;p.push({registrationKey:L,def:S,hotkeyStr:D,mergedOptions:P,resolvedTarget:k})}const y=new Set(p.map(E=>E.registrationKey));for(const[E,S]of m)!y.has(E)&&S.handle.isActive&&S.handle.unregister();for(const E of p){const{registrationKey:S,def:D,hotkeyStr:P,mergedOptions:k,resolvedTarget:L}=E,x=m.get(S);if(x!=null&&x.handle.isActive&&x.target===L){b.set(S,x);continue}x!=null&&x.handle.isActive&&x.handle.unregister();const C=d.current.register(P,D.callback,{...k,target:L});b.set(S,{handle:C,target:L})}o.current=b}),c.useEffect(()=>()=>{for(const{handle:m}of o.current.values())m.isActive&&m.unregister();o.current=new Map},[]);for(let m=0;m<e.length;m++){const b=e[m],p=g[m],y=`${m}:${p}`,E=(w=o.current.get(y))==null?void 0:w.handle;if(E!=null&&E.isActive){E.callback=b.callback;const{target:S,...D}={...n,...t,...b.options};E.setOptions(D)}}}function Ys(e){const t=Gr({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,r=c.useRef(void 0);return qr(n.stores.__store,s=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=zr(r.current,e.select(s));return r.current=o,o}return e.select(s)}return s})}function Zs(e){const t=c.useRef(!0);t.current&&(t.current=!1,e())}const Ze=typeof navigator<"u",vt=zs(),Qn=Js(),er=Xs(),tr=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),nr=vt.platform==="MacIntel"&&vt.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(vt.platform),Gs=Ze&&/apple/i.test(navigator.vendor),Ht=Ze&&/android/i.test(Qn)||/android/i.test(er);Ze&&Qn.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const qs=er.includes("jsdom/");function zs(){if(!Ze)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Xs(){if(!Ze)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Js(){if(!Ze)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Qs(e){e.preventDefault(),e.stopPropagation()}function eo(e){return"nativeEvent"in e}function to(e){return e.pointerType===""&&e.isTrusted?!0:Ht&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function no(e){return qs?!1:!Ht&&e.width===0&&e.height===0||Ht&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function ro(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function $e(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Rt(e){const t=Wt(so,e).current;return t.next=e,ne(t.effect),t}function so(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const oo={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},io={...oo,position:"fixed",top:0,left:0},gt=c.forwardRef(function(t,n){const[r,s]=c.useState();ne(()=>{Gs&&s("button")},[]);const o={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:io,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})}),Lt="data-base-ui-focusable",rr="active",sr="selected",ao="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function we(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function co(e){return e.matches("html,body")}function or(e){return Se(e)&&e.matches(ao)}function mn(e){return e?e.getAttribute("role")==="combobox"&&or(e):!1}function Vt(e){return e?e.hasAttribute(Lt)?e:e.querySelector(`[${Lt}]`)||e:null}function lo(e){return e.visibility==="hidden"||e.visibility==="collapse"}function ir(e,t=e?Bt(e):null){return!e||!e.isConnected||!t||lo(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const uo='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function fo(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return _t(n)?n.host:null}function Kt(e){for(const t of Array.from(e.children))if(Te(t)==="summary")return t;return null}function po(e,t){const n=Kt(t);return!!n&&(e===n||G(n,e))}function ar(e){const t=e?Te(e):"";return e!=null&&e.matches(uo)&&(t!=="summary"||e.parentElement!=null&&Te(e.parentElement)==="details"&&Kt(e.parentElement)===e)&&(t!=="details"||Kt(e)==null)&&(t!=="input"||e.type!=="hidden")}function cr(e){if(!ar(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=fo(t)){const n=t!==e,r=Te(t)==="slot";if(t.hasAttribute("inert")||n&&Te(t)==="details"&&!t.open&&!po(e,t)||t.hasAttribute("hidden")||!r&&!ho(t,n))return!1}return!0}function ho(e,t){const n=Bt(e);return t?n.display!=="none":ir(e,n)}function lr(e){const t=e.tabIndex;if(t<0){const n=Te(e);if(n==="details"||n==="audio"||n==="video"||Se(e)&&e.isContentEditable)return 0}return t}function Ct(e){if(Te(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function go(e,t){const n=Ct(e);if(!n)return!0;const r=t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form})===n}function ur(e){if(Se(e)&&Te(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Se(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function dr(e,t){ur(e).forEach(n=>{ar(n)&&t.push(n),dr(n,t)})}function fr(e,t,n){ur(e).forEach(r=>{Se(r)&&r.matches(t)&&n.push(r),fr(r,t,n)})}function zt(e){return cr(e)&&lr(e)>=0}function pr(e){const t=[];return dr(e,t),t.filter(cr)}function yt(e){const t=pr(e);return t.filter(n=>lr(n)>=0&&go(n,t))}function hr(e,t){const n=yt(e),r=n.length;if(r===0)return;const s=He(ee(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function gr(e){return hr(ee(e).body,1)||e}function mr(e){return hr(ee(e).body,-1)||e}function et(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!G(n,r)}function mo(e){yt(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bn(e){const t=[];fr(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ye(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>{var o;return[...!n||(o=s.context)!=null&&o.open?[s]:[],...Ye(e,s.id,n)]})}function yn(e,t){var s;let n=[],r=(s=e.find(o=>o.id===t))==null?void 0:s.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o==null?void 0:o.parentId,o&&(n=n.concat(o))}return n}function mt(e){return`data-base-ui-${e}`}let ct=0;function Tt(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(ct);const o=()=>e==null?void 0:e.focus({preventScroll:n});if(s)return o(),$t;const i=requestAnimationFrame(o);return ct=i,()=>{ct===i&&(cancelAnimationFrame(i),ct=0)}}const kt={inert:new WeakMap,"aria-hidden":new WeakMap},xn="data-base-ui-inert",Ut={inert:new WeakSet,"aria-hidden":new WeakSet};let Xe=new WeakMap,Pt=0;function bo(e){return Ut[e]}function br(e){return e?_t(e)?e.host:br(e.parentNode):null}const It=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=br(n);return e.contains(r)?r:null}).filter(n=>n!=null),Sn=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},En=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{Te(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function yo(e,t,n,r,{mark:s=!0,markerIgnoreElements:o=[]}){const i=r?"inert":n?"aria-hidden":null;let l=null,h=null;const a=It(t,e),d=s?It(t,o):[],g=new Set(d),w=s?En(t,Sn(a),new Set(a)).filter(p=>!g.has(p)):[],m=[],b=[];if(i){const p=kt[i],y=bo(i);h=y,l=p;const E=It(t,Array.from(t.querySelectorAll("[aria-live]"))),S=a.concat(E);En(t,Sn(S),new Set(S)).forEach(P=>{const k=P.getAttribute(i),L=k!==null&&k!=="false",x=(p.get(P)||0)+1;p.set(P,x),m.push(P),x===1&&L&&y.add(P),L||P.setAttribute(i,i==="inert"?"":"true")})}return s&&w.forEach(p=>{const y=(Xe.get(p)||0)+1;Xe.set(p,y),b.push(p),y===1&&p.setAttribute(xn,"")}),Pt+=1,()=>{l&&m.forEach(p=>{const E=(l.get(p)||0)-1;l.set(p,E),E||(!(h!=null&&h.has(p))&&i&&p.removeAttribute(i),h==null||h.delete(p))}),s&&b.forEach(p=>{const y=(Xe.get(p)||0)-1;Xe.set(p,y),y||p.removeAttribute(xn)}),Pt-=1,Pt||(kt.inert=new WeakMap,kt["aria-hidden"]=new WeakMap,Ut.inert=new WeakSet,Ut["aria-hidden"]=new WeakSet,Xe=new WeakMap)}}function wn(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:o=[]}=t,i=ee(e[0]).body;return yo(e,i,n,r,{mark:s,markerIgnoreElements:o})}const xo="data-base-ui-click-trigger",So={clipPath:"inset(50%)",position:"fixed",top:0,left:0},yr=c.createContext(null),xr=()=>c.useContext(yr),Eo=mt("portal");function wo(e={}){const{ref:t,container:n,componentProps:r=Qe,elementProps:s}=e,o=Gt(),i=xr(),l=i==null?void 0:i.portalNode,[h,a]=c.useState(null),[d,g]=c.useState(null),w=se(y=>{y!==null&&g(y)}),m=c.useRef(null);ne(()=>{if(n===null){m.current&&(m.current=null,g(null),a(null));return}if(o==null)return;const y=(n&&(Xr(n)?n:n.current))??l??document.body;if(y==null){m.current&&(m.current=null,g(null),a(null));return}m.current!==y&&(m.current=y,g(null),a(y))},[n,l,o]);const b=nt("div",r,{ref:[t,w],props:[{id:o,[Eo]:""},s]});return{portalNode:d,portalSubtree:h&&b?On.createPortal(b,h):null}}const vo=c.forwardRef(function(t,n){const{children:r,container:s,className:o,render:i,renderGuards:l,style:h,...a}=t,{portalNode:d,portalSubtree:g}=wo({container:s,ref:n,componentProps:t,elementProps:a}),w=c.useRef(null),m=c.useRef(null),b=c.useRef(null),p=c.useRef(null),[y,E]=c.useState(null),S=c.useRef(!1),D=y==null?void 0:y.modal,P=y==null?void 0:y.open,k=typeof l=="boolean"?l:!!y&&!y.modal&&y.open&&!!d;c.useEffect(()=>{if(!d||D)return;function x(C){d&&C.relatedTarget&&et(C)&&(C.type==="focusin"?S.current&&(bn(d),S.current=!1):(mo(d),S.current=!0))}return $e(Z(d,"focusin",x,!0),Z(d,"focusout",x,!0))},[d,D]),c.useEffect(()=>{!d||P!==!1||(bn(d),S.current=!1)},[P,d]);const L=c.useMemo(()=>({beforeOutsideRef:w,afterOutsideRef:m,beforeInsideRef:b,afterInsideRef:p,portalNode:d,setFocusManagerState:E}),[d]);return f.jsxs(c.Fragment,{children:[g,f.jsxs(yr.Provider,{value:L,children:[k&&d&&f.jsx(gt,{"data-type":"outside",ref:w,onFocus:x=>{var C;if(et(x,d))(C=b.current)==null||C.focus();else{const j=y?y.domReference:null,_=mr(j);_==null||_.focus()}}}),k&&d&&f.jsx("span",{"aria-owns":d.id,style:So}),d&&On.createPortal(r,d),k&&d&&f.jsx(gt,{"data-type":"outside",ref:m,onFocus:x=>{var C;if(et(x,d))(C=p.current)==null||C.focus();else{const j=y?y.domReference:null,_=gr(j);_==null||_.focus(),y!=null&&y.closeOnFocusOut&&(y==null||y.onOpenChange(!1,Ne(Ln,x.nativeEvent)))}}})]})]})});function Ro(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const Co=c.createContext(null),To=c.createContext(null),Sr=()=>{var e;return((e=c.useContext(Co))==null?void 0:e.id)||null},Er=e=>{const t=c.useContext(To);return e??t};function ko(e,t){const n=bt(Fe(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const vn=20;let je=[];function Xt(){je=je.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Po(e){Xt(),e&&Te(e)!=="body"&&(je.push(new WeakRef(e)),je.length>vn&&(je=je.slice(-vn)))}function Mt(){var e;return Xt(),(e=je[je.length-1])==null?void 0:e.deref()}function Io(e){return e?zt(e)?e:yt(e)[0]||e:null}function Rn(e,t){var o;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!((o=e.getAttribute("role"))!=null&&o.includes("dialog")))return;const r=pr(e).filter(i=>{const l=i.getAttribute("data-tabindex")||"";return zt(i)||i.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Mo(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:l=!0,closeOnFocusOut:h=!0,openInteractionType:a="",nextFocusableElement:d,previousFocusableElement:g,beforeContentFocusGuardRef:w,externalTree:m,getInsideElements:b}=e,p="rootStore"in t?t.rootStore:t,y=p.useState("open"),E=p.useState("domReferenceElement"),S=p.useState("floatingElement"),{events:D,dataRef:P}=p.context,k=se(()=>{var O;return(O=P.current.floatingContext)==null?void 0:O.nodeId}),L=s===!1,x=mn(E)&&L,C=c.useRef(["content"]),j=Rt(s),_=Rt(o),K=Rt(a),V=Er(m),u=xr(),I=c.useRef(!1),W=c.useRef(!1),$=c.useRef(!1),fe=c.useRef(null),ae=c.useRef(""),Ee=c.useRef(""),Ve=c.useRef(null),B=c.useRef(null),ve=nn(Ve,w,u==null?void 0:u.beforeInsideRef),Ke=nn(B,u==null?void 0:u.afterInsideRef),Ue=ft(),Me=ft(),Oe=ls(),be=u!=null,A=Vt(S),ce=se((O=A)=>O?yt(O):[]),pe=se(()=>(b==null?void 0:b().filter(O=>O!=null))??[]);c.useEffect(()=>{if(r||!l)return;function O(U){U.key==="Tab"&&G(A,He(ee(A)))&&ce().length===0&&!x&&Qs(U)}const X=ee(A);return Z(X,"keydown",O)},[r,E,A,l,C,x,ce]),c.useEffect(()=>{if(r||!y)return;const O=ee(A);function X(){$.current=!1}function U(F){const N=Fe(F),J=pe(),M=G(S,N)||G(E,N)||G(u==null?void 0:u.portalNode,N)||J.some(ye=>ye===N||G(ye,N));$.current=!M,Ee.current=F.pointerType||"keyboard",N!=null&&N.closest(`[${xo}]`)&&(W.current=!0)}function te(){Ee.current="keyboard"}return $e(Z(O,"pointerdown",U,!0),Z(O,"pointerup",X,!0),Z(O,"pointercancel",X,!0),Z(O,"keydown",te,!0))},[r,S,E,A,y,u,pe]),c.useEffect(()=>{if(r||!h)return;const O=ee(A);function X(){W.current=!0,Me.start(0,()=>{W.current=!1})}function U(J){const M=Fe(J);zt(M)&&(fe.current=M)}function te(J){const M=J.relatedTarget,ye=J.currentTarget,Y=Fe(J);queueMicrotask(()=>{const xe=k(),v=p.context.triggerElements,T=pe(),oe=(M==null?void 0:M.hasAttribute(mt("focus-guard")))&&[Ve.current,B.current,u==null?void 0:u.beforeInsideRef.current,u==null?void 0:u.afterInsideRef.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,De(g),De(d)].includes(M),re=!(G(E,M)||G(S,M)||G(M,S)||G(u==null?void 0:u.portalNode,M)||T.some(z=>z===M||G(z,M))||M!=null&&v.hasElement(M)||v.hasMatchingElement(z=>G(z,M))||oe||V&&(Ye(V.nodesRef.current,xe).find(z=>{var ie,le;return G((ie=z.context)==null?void 0:ie.elements.floating,M)||G((le=z.context)==null?void 0:le.elements.domReference,M)})||yn(V.nodesRef.current,xe).find(z=>{var ie,le,ot;return[(ie=z.context)==null?void 0:ie.elements.floating,Vt((le=z.context)==null?void 0:le.elements.floating)].includes(M)||((ot=z.context)==null?void 0:ot.elements.domReference)===M})));if(ye===E&&A&&Rn(A,C),i&&ye!==E&&!ir(Y)&&He(O)===O.body){if(Se(A)&&(A.focus(),i==="popup")){Oe.request(()=>{A.focus()});return}const z=ce(),ie=fe.current,le=(ie&&z.includes(ie)?ie:null)||z[z.length-1]||A;Se(le)&&le.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(x||!l)&&M&&re&&!W.current&&(x||M!==Mt())&&(I.current=!0,p.setOpen(!1,Ne(Ln,J)))})}function F(){$.current||(P.current.insideReactTree=!0,Ue.start(0,()=>{P.current.insideReactTree=!1}))}const N=Se(E)?E:null;if(!(!S&&!N))return $e(N&&Z(N,"focusout",te),N&&Z(N,"pointerdown",X),S&&Z(S,"focusin",U),S&&Z(S,"focusout",te),S&&u&&Z(S,"focusout",F,!0))},[r,E,S,A,l,V,u,p,h,i,ce,x,k,C,P,Ue,Me,Oe,d,g,pe]),c.useEffect(()=>{var ye,Y,xe;if(r||!S||!y)return;const O=Array.from(((ye=u==null?void 0:u.portalNode)==null?void 0:ye.querySelectorAll(`[${mt("portal")}]`))||[]),U=(xe=(Y=(V?yn(V.nodesRef.current,k()):[]).find(v=>{var T;return mn(((T=v.context)==null?void 0:T.elements.domReference)||null)}))==null?void 0:Y.context)==null?void 0:xe.elements.domReference,F=[...[S,...O,Ve.current,B.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,...pe()],U,De(g),De(d),x?E:null].filter(v=>v!=null),N=wn(F,{ariaHidden:l||x,mark:!1}),J=[S,...O].filter(v=>v!=null),M=wn(J);return()=>{M(),N()}},[y,r,E,S,l,C,u,x,V,k,d,g,pe]),ne(()=>{if(!y||r||!Se(A))return;const O=ee(A),X=He(O);queueMicrotask(()=>{const U=j.current,te=typeof U=="function"?U(K.current||""):U;if(te===void 0||te===!1||G(A,X))return;let N=null;const J=()=>(N==null&&(N=ce(A)),N[0]||A);let M;te===!0||te===null?M=J():M=De(te),M=M||J(),Tt(M,{preventScroll:M===A})})},[r,y,A,L,ce,j,K]),ne(()=>{if(r||!A)return;const O=ee(A),X=He(O);Po(X);function U(F){if(F.open||(ae.current=ko(F.nativeEvent,Ee.current)),F.reason===us&&F.nativeEvent.type==="mouseleave"&&(I.current=!0),F.reason===Vn)if(F.nested)I.current=!1;else if(to(F.nativeEvent)||no(F.nativeEvent))I.current=!1;else{let N=!1;ee(A).createElement("div").focus({get preventScroll(){return N=!0,!1}}),N?I.current=!1:I.current=!0}}D.on("openchange",U);function te(){const F=_.current;let N=typeof F=="function"?F(ae.current):F;if(N===void 0||N===!1)return null;if(N===null&&(N=!0),typeof N=="boolean"){const M=E||Mt();return M&&M.isConnected?M:null}const J=E||Mt();return De(N)||J||null}return()=>{D.off("openchange",U);const F=He(O),N=pe(),J=G(S,F)||N.some(Y=>Y===F||G(Y,F))||V&&Ye(V.nodesRef.current,k(),!1).some(Y=>{var xe;return G((xe=Y.context)==null?void 0:xe.elements.floating,F)}),M=_.current,ye=te();queueMicrotask(()=>{const Y=Io(ye),xe=typeof M!="boolean";M&&!I.current&&Se(Y)&&(!(!xe&&Y!==F&&F!==O.body)||J)&&Y.focus({preventScroll:!0}),I.current=!1})}},[r,S,A,_,P,D,V,E,k,pe]),ne(()=>{if(!tr||y||!S)return;const O=He(ee(S));!Se(O)||!or(O)||G(S,O)&&O.blur()},[y,S]),ne(()=>{if(!(r||!u))return u.setFocusManagerState({modal:l,closeOnFocusOut:h,open:y,onOpenChange:p.setOpen,domReference:E}),()=>{u.setFocusManagerState(null)}},[r,u,l,y,p,h,E]),ne(()=>{if(!(r||!A))return Rn(A,C),()=>{queueMicrotask(Xt)}},[r,A,C]);const st=!r&&(l?!x:!0)&&(be||l);return f.jsxs(c.Fragment,{children:[st&&f.jsx(gt,{"data-type":"inside",ref:ve,onFocus:O=>{var X;if(l){const U=ce();Tt(U[U.length-1])}else if(u!=null&&u.portalNode)if(I.current=!1,et(O,u.portalNode)){const U=gr(E);U==null||U.focus()}else(X=De(g??u.beforeOutsideRef))==null||X.focus()}}),n,st&&f.jsx(gt,{"data-type":"inside",ref:Ke,onFocus:O=>{var X;if(l)Tt(ce()[0]);else if(u!=null&&u.portalNode)if(h&&(I.current=!0),et(O,u.portalNode)){const U=mr(E);U==null||U.focus()}else(X=De(d??u.afterOutsideRef))==null||X.focus()}})]})}const Oo={intentional:"onClick",sloppy:"onPointerDown"};function Do(){return!1}function Ao(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function No(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),{dataRef:o}=n.context,{enabled:i=!0,escapeKey:l=!0,outsidePress:h=!0,outsidePressEvent:a="sloppy",referencePress:d=Do,referencePressEvent:g="sloppy",bubbles:w,externalTree:m}=t,b=Er(m),p=se(typeof h=="function"?h:()=>!1),y=typeof h=="function"?p:h,E=y!==!1,S=se(()=>a),D=c.useRef(!1),P=c.useRef(!1),k=c.useRef(!1),{escapeKey:L,outsidePress:x}=Ao(w),C=c.useRef(null),j=ft(),_=ft(),K=se(()=>{_.clear(),o.current.insideReactTree=!1}),V=c.useRef(!1),u=c.useRef(""),I=se(d),W=se(B=>{var Oe;if(!r||!i||!l||B.key!=="Escape"||V.current)return;const ve=(Oe=o.current.floatingContext)==null?void 0:Oe.nodeId,Ke=b?Ye(b.nodesRef.current,ve):[];if(!L&&Ke.length>0){let be=!0;if(Ke.forEach(A=>{var ce;(ce=A.context)!=null&&ce.open&&!A.context.dataRef.current.__escapeKeyBubbles&&(be=!1)}),!be)return}const Ue=eo(B)?B.nativeEvent:B,Me=Ne(ds,Ue);n.setOpen(!1,Me),!L&&!Me.isPropagationAllowed&&B.stopPropagation()}),$=se(()=>{o.current.insideReactTree=!0,_.start(0,K)});c.useEffect(()=>{if(!r||!i)return;o.current.__escapeKeyBubbles=L,o.current.__outsidePressBubbles=x;const B=new pt,ve=new pt;function Ke(){B.clear(),V.current=!0}function Ue(){B.start(Jr()?5:0,()=>{V.current=!1})}function Me(){k.current=!0,ve.start(0,()=>{k.current=!1})}function Oe(){D.current=!1,P.current=!1}function be(){const v=u.current,T=v==="pen"||!v?"mouse":v,oe=S(),re=typeof oe=="function"?oe():oe;return typeof re=="string"?re:re[T]}function A(v){const T=be();return T==="intentional"&&v.type!=="click"||T==="sloppy"&&v.type==="click"}function ce(v){var re;const T=(re=o.current.floatingContext)==null?void 0:re.nodeId,oe=b&&Ye(b.nodesRef.current,T).some(z=>{var ie;return we(v,(ie=z.context)==null?void 0:ie.elements.floating)});return we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||oe}function pe(v){var en;if(A(v)){K();return}if(o.current.insideReactTree){K();return}const T=Fe(v),oe=`[${mt("inert")}]`,re=Je(T)?T.getRootNode():null,z=Array.from((_t(re)?re:ee(n.select("floatingElement"))).querySelectorAll(oe)),ie=n.context.triggerElements;if(T&&(ie.hasElement(T)||ie.hasMatchingElement(he=>G(he,T))))return;let le=Je(T)?T:null;for(;le&&!St(le);){const he=Qr(le);if(St(he)||!Je(he))break;le=he}if(z.length&&Je(T)&&!co(T)&&!G(T,n.select("floatingElement"))&&z.every(he=>!G(le,he)))return;if(Se(T)&&!("touches"in v)){const he=St(T),We=Bt(T),qe=/auto|scroll/,Lr=he||qe.test(We.overflowX),Vr=he||qe.test(We.overflowY),Kr=Lr&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Ur=Vr&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Wr=We.direction==="rtl",Br=Ur&&(Wr?v.offsetX<=T.offsetWidth-T.clientWidth:v.offsetX>T.clientWidth),_r=Kr&&v.offsetY>T.clientHeight;if(Br||_r)return}if(ce(v))return;if(be()==="intentional"&&k.current){ve.clear(),k.current=!1;return}if(typeof y=="function"&&!y(v))return;const ot=(en=o.current.floatingContext)==null?void 0:en.nodeId,Qt=b?Ye(b.nodesRef.current,ot):[];if(Qt.length>0){let he=!0;if(Qt.forEach(We=>{var qe;(qe=We.context)!=null&&qe.open&&!We.context.dataRef.current.__outsidePressBubbles&&(he=!1)}),!he)return}n.setOpen(!1,Ne(Vn,v)),K()}function st(v){be()!=="sloppy"||v.pointerType==="touch"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||pe(v)}function O(v){if(be()!=="sloppy"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];T&&(C.current={startTime:Date.now(),startX:T.clientX,startY:T.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}function X(v,T){const oe=Fe(v);if(!oe)return;const re=Z(oe,v.type,()=>{T(v),re()})}function U(v){u.current="touch",X(v,O)}function te(v){j.clear(),v.type==="pointerdown"&&(u.current=v.pointerType),!(v.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)&&X(v,T=>{T.type==="pointerdown"?st(T):pe(T)})}function F(v){if(!D.current)return;const T=P.current;if(Oe(),be()==="intentional"){if(v.type==="pointercancel"){T&&Me();return}if(!ce(v)){if(T){Me();return}typeof y=="function"&&!y(v)||(ve.clear(),k.current=!0,K())}}}function N(v){if(be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];if(!T)return;const oe=Math.abs(T.clientX-C.current.startX),re=Math.abs(T.clientY-C.current.startY),z=Math.sqrt(oe*oe+re*re);z>5&&(C.current.dismissOnTouchEnd=!0),z>10&&(pe(v),j.clear(),C.current=null)}function J(v){X(v,N)}function M(v){be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&pe(v),j.clear(),C.current=null)}function ye(v){X(v,M)}const Y=ee(s),xe=$e(l&&$e(Z(Y,"keydown",W),Z(Y,"compositionstart",Ke),Z(Y,"compositionend",Ue)),E&&$e(Z(Y,"click",te,!0),Z(Y,"pointerdown",te,!0),Z(Y,"pointerup",F,!0),Z(Y,"pointercancel",F,!0),Z(Y,"mousedown",te,!0),Z(Y,"mouseup",F,!0),Z(Y,"touchstart",U,!0),Z(Y,"touchmove",J,!0),Z(Y,"touchend",ye,!0)));return()=>{xe(),B.clear(),ve.clear(),Oe(),k.current=!1}},[o,s,l,E,y,r,i,L,x,W,K,S,b,n,j]),c.useEffect(K,[y,K]);const fe=c.useMemo(()=>({onKeyDown:W,[Oo[g]]:B=>{I()&&n.setOpen(!1,Ne(on,B.nativeEvent))},...g!=="intentional"&&{onClick(B){I()&&n.setOpen(!1,Ne(on,B.nativeEvent))}}}),[W,n,g,I]),ae=se(B=>{if(!r||!i||B.button!==0)return;const ve=Fe(B.nativeEvent);G(n.select("floatingElement"),ve)&&(D.current||(D.current=!0,P.current=!1))}),Ee=se(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&D.current&&(P.current=!0)}),Ve=c.useMemo(()=>({onKeyDown:W,onPointerDown:Ee,onMouseDown:Ee,onClickCapture:$,onMouseDownCapture(B){$(),ae(B)},onPointerDownCapture(B){$(),ae(B)},onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[W,$,ae,Ee]);return c.useMemo(()=>i?{reference:fe,floating:Ve,trigger:fe}:{},[i,fe,Ve])}const H=(e,t,n,r,s,o,...i)=>{if(i.length>0)throw new Error(Yt(1));let l;if(e)l=e;else throw new Error("Missing arguments");return l};var jo=es();const Fo=Dn(19),Ho=Fo?Vo:Ko;function wr(e,t,n,r,s){return Ho(e,t,n,r,s)}function Lo(e,t,n,r,s){const o=c.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return jo.useSyncExternalStore(e.subscribe,o,o)}function Vo(e,t,n,r,s){return Lo(e,t,n,r,s)}function Ko(e,t,n,r,s){return ts.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class Uo{constructor(t){ge(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ge(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return wr(this,t,n,r,s)}}class vr extends Uo{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){c.useDebugValue(t),ne(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;ne(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);ne(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){c.useDebugValue(t);const r=n!==void 0;ne(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return c.useDebugValue(t),wr(this,this.selectors[t],n,r,s)}useContextCallback(t,n){c.useDebugValue(t);const r=se(n??$t);this.context[t]=r}useStateSetter(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const l=s;s=i,n(i,l,this)}})}}const Wo={open:H(e=>e.open),transitionStatus:H(e=>e.transitionStatus),domReferenceElement:H(e=>e.domReferenceElement),referenceElement:H(e=>e.positionReference??e.referenceElement),floatingElement:H(e=>e.floatingElement),floatingId:H(e=>e.floatingId)};class Rr extends vr{constructor(n){const{syncOnly:r,nested:s,onOpenChange:o,triggerElements:i,...l}=n;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:Ro(),nested:s,triggerElements:i},Wo);ge(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&ro(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ge(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const s={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",s)});ge(this,"setOpen",(n,r)=>{var s,o,i,l;if(this.syncOnly){(o=(s=this.context).onOpenChange)==null||o.call(s,n,r);return}this.dispatchOpenChange(n,r),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r)});this.syncOnly=r}}function Bo(e){const t=e.useState("open");ne(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;e.update({activeTriggerId:r,activeTriggerElement:s})}}},[t,e])}function _o(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=fs(e);t.useSyncedValues({mounted:r,transitionStatus:o});const i=se(()=>{var h,a;s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),(a=(h=t.context).onOpenChangeComplete)==null||a.call(h,!1)}),l=t.useState("preventUnmountingOnClose");return Kn({enabled:!l,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class Cr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function $o(){return new Rr({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Cr,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Yo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:$o(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Qe,inactiveTriggerProps:Qe,popupProps:Qe}}const lt=H(e=>e.triggerIdProp??e.activeTriggerId),Zo={open:H(e=>e.openProp??e.open),mounted:H(e=>e.mounted),transitionStatus:H(e=>e.transitionStatus),floatingRootContext:H(e=>e.floatingRootContext),preventUnmountingOnClose:H(e=>e.preventUnmountingOnClose),payload:H(e=>e.payload),activeTriggerId:lt,activeTriggerElement:H(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:H((e,t)=>t!==void 0&&lt(e)===t),isOpenedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.open),isMountedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.mounted),triggerProps:H((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:H(e=>e.popupProps),popupElement:H(e=>e.popupElement),positionerElement:H(e=>e.positionerElement)};function Go(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,s=Gt(),o=Sr()!=null,i=t.useState("open"),l=t.useState("activeTriggerElement"),h=t.useState(n?"popupElement":"positionerElement"),a=t.context.triggerElements,d=Wt(()=>new Rr({open:i,transitionStatus:void 0,referenceElement:l,floatingElement:h,triggerElements:a,onOpenChange:r,floatingId:s,syncOnly:!0,nested:o})).current;return ne(()=>{const g={open:i,floatingId:s,referenceElement:l,floatingElement:h};Je(l)&&(g.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(g.positionReference=l),d.update(g)},[i,s,l,h,d]),d.context.onOpenChange=r,d.context.nested=o,d}function qo(e=[]){const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=e.map(a=>a==null?void 0:a.trigger),o=c.useCallback(a=>ut(a,e,"reference"),t),i=c.useCallback(a=>ut(a,e,"floating"),n),l=c.useCallback(a=>ut(a,e,"item"),r),h=c.useCallback(a=>ut(a,e,"trigger"),s);return c.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l,getTriggerProps:h}),[o,i,l,h])}function ut(e,t,n){var i;const r=new Map,s=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Lt]="");for(const l in e)s&&e&&(l===rr||l===sr)||(o[l]=e[l]);for(let l=0;l<t.length;l+=1){let h;const a=(i=t[l])==null?void 0:i[n];typeof a=="function"?h=e?a(e):null:h=a,h&&Cn(o,h,s,r)}return Cn(o,e,s,r),o}function Cn(e,t,n,r){var s;for(const o in t){const i=t[o];n&&(o===rr||o===sr)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof i=="function"&&((s=r.get(o))==null||s.push(i),e[o]=(...l)=>{var h;return(h=r.get(o))==null?void 0:h.map(a=>a(...l)).find(a=>a!==void 0)})):e[o]=i)}}const zo=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Xo(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:l="dialog"}=t,h=Gt(),a=(o==null?void 0:o.id)||h,d=c.useMemo(()=>{var S;return((S=Vt(i))==null?void 0:S.id)||s},[i,s]),g=zo.get(l)??l,m=Sr()!=null,b=c.useMemo(()=>g==="tooltip"||l==="label"?Qe:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&m&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,m,l]),p=c.useMemo(()=>g==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...b,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...g==="menu"&&{id:a}},[g,d,r,a,l,b]),y=c.useMemo(()=>{const S={id:d,...g&&{role:g}};return g==="tooltip"||l==="label"?S:{...S,...g==="menu"&&{"aria-labelledby":a}}},[g,d,a,l]),E=c.useCallback(({active:S,selected:D})=>{const P={role:"option",...S&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...P,"aria-selected":D}}return{}},[d,l]);return c.useMemo(()=>({reference:p,floating:y,item:E,trigger:b}),[p,y,b,E])}let Le=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=an.startingStyle]="startingStyle",e[e.endingStyle=an.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const Jo={[Le.open]:""},Qo={[Le.closed]:""},ei={[Le.anchorHidden]:""},Tr={open(e){return e?Jo:Qo},anchorHidden(e){return e?ei:null}};function ti(e){return Dn(19)?e:e?"true":void 0}const ni=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M229.66,98.34,172.39,155.8c11.46,22.93-1.72,45.86-10.11,57a8,8,0,0,1-12,.83L42.34,105.76A8,8,0,0,1,43,93.85c29.65-23.92,57.4-10,57.4-10l57.27-57.46a8,8,0,0,1,11.31,0L229.66,87A8,8,0,0,1,229.66,98.34Z",opacity:"0.2"}),c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M233.91,82.79,173.22,22.1a14,14,0,0,0-19.81,0L98.93,76.77c-9.52-3.25-34-8.34-59.71,12.41A14,14,0,0,0,38.1,110l49.71,49.71-44.05,44a6,6,0,1,0,8.48,8.48l44.05-44.05L146,217.89a14,14,0,0,0,9.9,4.11q.49,0,1,0a14,14,0,0,0,10.19-5.54c19.72-26.21,17.15-47.23,12.46-59.3l54.37-54.55A14,14,0,0,0,233.91,82.79ZM225.42,94.1h0l-57.27,57.46a6,6,0,0,0-1.11,6.92c9.94,19.88-1.71,40.32-9.54,50.72a2,2,0,0,1-3,.2L46.58,101.51a2,2,0,0,1,.18-3c12.5-10.09,24.5-12.76,33.7-12.76a42.13,42.13,0,0,1,17.25,3.41A6,6,0,0,0,104.64,88L161.9,30.59a2,2,0,0,1,2.83,0l60.69,60.68A2,2,0,0,1,225.42,94.1Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M232.49,84.2,171.8,23.51a12,12,0,0,0-17,0L99.45,79.07c-8.08-3-32.79-9.45-59,11.67a12,12,0,0,0-1,17.84l51.13,51.13L45.17,205.17a4,4,0,0,0,5.66,5.66l45.46-45.47,51.12,51.12A12,12,0,0,0,155.9,220c.28,0,.57,0,.85,0a12,12,0,0,0,8.73-4.74c19.83-26.36,16.51-47.18,11.71-58.57l55.3-55.49A12,12,0,0,0,232.49,84.2Zm-5.66,11.31h0L169.56,153a4,4,0,0,0-.75,4.61c10.43,20.85-1.62,42-9.73,52.83a4,4,0,0,1-6,.4L45.17,102.93a4,4,0,0,1,.33-6C58.44,86.53,70.86,83.74,80.44,83.74A43.9,43.9,0,0,1,98.6,87.38a4,4,0,0,0,4.62-.75l57.27-57.46a4,4,0,0,1,5.66,0l60.68,60.69A4,4,0,0,1,226.83,95.51Z"}))]]),ri=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),kr=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ni}));kr.displayName="PushPinIcon";const Pr=kr,Ir=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ri}));Ir.displayName="TrashIcon";const si=Ir,oi=c.forwardRef(function({memory:t,selected:n,focused:r,confirming:s,onSelect:o,onPin:i,onDelete:l,onDeleteStart:h,onDeleteCancel:a},d){const g=t.content.length>140?`${t.content.slice(0,140)}…`:t.content;return f.jsxs("li",{ref:d,className:de("group relative flex flex-col gap-1.5 border-b border-border px-4 py-3 transition-colors","hover:bg-accent/40",n&&"bg-accent/60",r&&!n&&"bg-accent/20",r&&"outline-none ring-1 ring-inset ring-primary/40"),onMouseLeave:a,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsxs(Ae,{variant:"ghost",onClick:o,className:"h-auto flex-1 min-w-0 items-start justify-start whitespace-normal p-0 font-normal hover:bg-transparent",children:[f.jsx(rn,{variant:t.type,className:"mt-px shrink-0",title:Nn[t.type],children:jn(t.type)}),f.jsx("p",{className:"flex-1 text-xs leading-relaxed text-foreground line-clamp-2 min-w-0 text-left",children:g})]}),f.jsxs("div",{className:de("flex items-center gap-1 transition-opacity shrink-0",t.pinned?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":t.pinned?"Unpin":"Pin",className:de(t.pinned&&"text-primary"),children:f.jsx(Pr,{weight:t.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:s?l:h,onBlur:a,"aria-label":s?"Confirm delete":"Delete",className:de(s?"text-destructive bg-destructive/10":"hover:text-destructive",t.pinned&&"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity"),children:f.jsx(si,{weight:s?"fill":"regular"})})]})]}),f.jsxs("div",{className:"flex items-center gap-2 pl-[42px]",children:[t.tags.length>0&&f.jsx("div",{className:"flex gap-1 flex-wrap",children:t.tags.map(w=>f.jsx(rn,{variant:"outline",children:w},w))}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.needsReview&&f.jsx("span",{title:"Flagged for review — possible duplicate or conflict with another memory",children:f.jsx(Fn,{weight:"fill",className:"size-3 text-[var(--type-correction)]"})}),t.projects.length>0?f.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-32",children:t.projects.map(w=>w.name).join(", ")}):f.jsx("span",{className:"text-[11px] text-muted-foreground",children:"global"}),f.jsx("span",{className:"text-[11px] text-muted-foreground",children:new Date(t.updatedAt).toLocaleDateString()})]})]})]})}),Mr=c.createContext(void 0);function Ge(e){const t=c.useContext(Mr);if(e===!1&&t===void 0)throw new Error(Yt(27));return t}const ii={...Tr,...Un},ai=c.forwardRef(function(t,n){const{render:r,className:s,style:o,forceRender:i=!1,...l}=t,{store:h}=Ge(),a=h.useState("open"),d=h.useState("nested"),g=h.useState("mounted"),w=h.useState("transitionStatus");return nt("div",t,{state:{open:a,transitionStatus:w},ref:[h.context.backdropRef,n],stateAttributesMapping:ii,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:i||!d})}),ci=c.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,style:l,...h}=t,{store:a}=Ge(),d=a.useState("open");function g(p){d&&a.setOpen(!1,Ne(ps,p.nativeEvent))}const{getButtonProps:w,buttonRef:m}=ns({disabled:o,native:i});return nt("button",t,{state:{disabled:o},ref:[n,m],props:[{onClick:g},h,w]})});let li=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),ui=(function(e){return e[e.open=Le.open]="open",e[e.closed=Le.closed]="closed",e[e.startingStyle=Le.startingStyle]="startingStyle",e[e.endingStyle=Le.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Or=c.createContext(void 0);function di(){const e=c.useContext(Or);if(e===void 0)throw new Error(Yt(26));return e}const Dr="ArrowUp",Ar="ArrowDown",Nr="ArrowLeft",jr="ArrowRight",Fr="Home",Hr="End",fi=new Set([Nr,jr]),pi=new Set([Dr,Ar]),hi=new Set([...fi,...pi]);[...hi];const gi=new Set([Dr,Ar,Nr,jr,Fr,Hr]),mi={...Tr,...Un,nestedDialogOpen(e){return e?{[ui.nestedDialogOpen]:""}:null}},bi=c.forwardRef(function(t,n){const{className:r,finalFocus:s,initialFocus:o,render:i,style:l,...h}=t,{store:a}=Ge(),d=a.useState("descriptionElementId"),g=a.useState("disablePointerDismissal"),w=a.useState("floatingRootContext"),m=a.useState("popupProps"),b=a.useState("modal"),p=a.useState("mounted"),y=a.useState("nested"),E=a.useState("nestedOpenDialogCount"),S=a.useState("open"),D=a.useState("openMethod"),P=a.useState("titleElementId"),k=a.useState("transitionStatus"),L=a.useState("role");di(),Kn({open:S,ref:a.context.popupRef,onComplete(){var V,u;S&&((u=(V=a.context).onOpenChangeComplete)==null||u.call(V,!0))}});function x(V){return V==="touch"?a.context.popupRef.current:!0}const C=o===void 0?x:o,j=E>0,K=nt("div",t,{state:{open:S,nested:y,transitionStatus:k,nestedDialogOpen:j},props:[m,{"aria-labelledby":P??void 0,"aria-describedby":d??void 0,role:L,tabIndex:-1,hidden:!p,onKeyDown(V){gi.has(V.key)&&V.stopPropagation()},style:{[li.nestedDialogs]:E}},h],ref:[n,a.context.popupRef,a.useStateSetter("popupElement")],stateAttributesMapping:mi});return f.jsx(Mo,{context:w,openInteractionType:D,disabled:!p,closeOnFocusOut:!g,initialFocus:C,returnFocus:s,modal:b!==!1,restoreFocus:"popup",children:K})}),yi=c.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),xi=c.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=Ge(),i=o.useState("mounted"),l=o.useState("modal"),h=o.useState("open");return i||r?f.jsx(Or.Provider,{value:r,children:f.jsxs(vo,{ref:n,...s,children:[i&&l===!0&&f.jsx(yi,{ref:o.context.internalBackdropRef,inert:ti(!h)}),t.children]})}):null});let Tn={},kn={},Pn="";function Si(e){if(typeof document>"u")return!1;const t=ee(e);return bt(t).innerWidth-t.documentElement.clientWidth>0}function Ei(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ee(e),r=n.documentElement,s=n.body,o=Zt(r)?r:s,i=o.style.overflowY,l=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const a=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=l,h===a}function wi(e){const t=ee(e),n=t.documentElement,r=t.body,s=Zt(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function vi(e){var m;const t=ee(e),n=t.documentElement,r=t.body,s=bt(n);let o=0,i=0,l=!1;const h=hs.create();if(tr&&(((m=s.visualViewport)==null?void 0:m.scale)??1)!==1)return()=>{};function a(){const b=s.getComputedStyle(n),p=s.getComputedStyle(r),S=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tn={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Pn=n.style.scrollBehavior,kn={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const D=n.scrollHeight>n.clientHeight,P=n.scrollWidth>n.clientWidth,k=b.overflowY==="scroll"||p.overflowY==="scroll",L=b.overflowX==="scroll"||p.overflowX==="scroll",x=Math.max(0,s.innerWidth-r.clientWidth),C=Math.max(0,s.innerHeight-r.clientHeight),j=parseFloat(p.marginTop)+parseFloat(p.marginBottom),_=parseFloat(p.marginLeft)+parseFloat(p.marginRight),K=Zt(n)?n:r;if(l=Ei(e),l){n.style.scrollbarGutter=S,K.style.overflowY="hidden",K.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(D||k)&&(n.style.overflowY="scroll"),(P||L)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:j||C?`calc(100dvh - ${j+C}px)`:"100dvh",width:_||x?`calc(100vw - ${_+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Tn),Object.assign(r.style,kn),l||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Pn)}function g(){d(),h.request(a)}a();const w=Z(s,"resize",g);return()=>{h.cancel(),d(),typeof s.removeEventListener=="function"&&w()}}class Ri{constructor(){ge(this,"lockCount",0);ge(this,"restore",null);ge(this,"timeoutLock",pt.create());ge(this,"timeoutUnlock",pt.create());ge(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ge(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ee(t).documentElement,s=bt(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=$t;return}const o=nr||!Si(t);this.restore=o?wi(t):vi(t)}}const Ci=new Ri;function Ti(e=!0,t=null){ne(()=>{if(e)return Ci.acquire(t)},[e,t])}function ki(e){const t=c.useRef(""),n=c.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:c.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function Pi(e,t){const n=c.useRef(e),r=se(t);ne(()=>{n.current!==e&&r(n.current)},[e,r]),ne(()=>{n.current=e},[e])}function Ii(e){const[t,n]=c.useState(null),r=se((i,l)=>{e||n(l||(nr?"touch":""))});Pi(e,i=>{i&&!e&&n(null)});const{onClick:s,onPointerDown:o}=ki(r);return c.useMemo(()=>({openMethod:t,triggerProps:{onClick:s,onPointerDown:o}}),[t,s,o])}function Mi(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:s}=e,o=t.useState("open"),i=t.useState("disablePointerDismissal"),l=t.useState("modal"),h=t.useState("popupElement"),{openMethod:a,triggerProps:d}=Ii(o);Bo(t);const{forceUnmount:g}=_o(o,t),w=c.useCallback(()=>{t.setOpen(!1,Ne(gs))},[t]);c.useImperativeHandle(r,()=>({unmount:g,close:w}),[g,w]);const m=Go({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[b,p]=c.useState(0),[y,E]=c.useState(0),S=b===0,D=Xo(m),P=No(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(K){if(!t.context.outsidePressEnabledRef.current||"button"in K&&K.button!==0||"touches"in K&&K.touches.length!==1)return!1;const V=Fe(K);if(S&&!i){const u=V;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===u||t.context.backdropRef.current===u||G(u,h)&&!(u!=null&&u.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:S});Ti(o&&l===!0,h);const{getReferenceProps:k,getFloatingProps:L,getTriggerProps:x}=qo([D,P]);t.useContextCallback("onNestedDialogOpen",(K,V)=>{p(K),E(V)}),t.useContextCallback("onNestedDialogClose",()=>{p(0),E(0)}),c.useEffect(()=>(n!=null&&n.onNestedDialogOpen&&o&&n.onNestedDialogOpen(b+1,y+(s?1:0)),n!=null&&n.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n!=null&&n.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[s,o,b,y,n]);const C=c.useMemo(()=>k(d),[k,d]),j=c.useMemo(()=>x(d),[x,d]),_=c.useMemo(()=>L(),[L]);t.useSyncedValues({openMethod:a,activeTriggerProps:C,inactiveTriggerProps:j,popupProps:_,floatingRootContext:m,nestedOpenDialogCount:b,nestedOpenDrawerCount:y})}const Oi={...Zo,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:H(e=>e.nestedOpenDrawerCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)};class Jt extends vr{constructor(n){super(Di(n),{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Cr,onOpenChange:void 0,onOpenChangeComplete:void 0},Oi);ge(this,"setOpen",(n,r)=>{var i,l,h;if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const s={open:n},o=((h=r.trigger)==null?void 0:h.id)??null;(o||n)&&(s.activeTriggerId=o,s.activeTriggerElement=r.trigger??null),this.update(s)})}static useStore(n,r){const s=Wt(()=>new Jt(r)).current;return n??s}}function Di(e={}){return{...Yo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const In=c.createContext(!1);function Ai(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:l=!0,actionsRef:h,handle:a,triggerId:d,defaultTriggerId:g=null}=e,w=Ge(!0),m=c.useContext(In),b=!!w,p=Jt.useStore(a==null?void 0:a.store,{open:r,openProp:n,activeTriggerId:g,triggerIdProp:d,modal:l,disablePointerDismissal:i,nested:b});Zs(()=>{n===void 0&&p.state.open===!1&&r===!0&&p.update({open:!0,activeTriggerId:g})}),p.useControlledProp("openProp",n),p.useControlledProp("triggerIdProp",d),p.useSyncedValues({disablePointerDismissal:i,nested:b,modal:l}),p.useContextCallback("onOpenChange",s),p.useContextCallback("onOpenChangeComplete",o);const y=p.useState("payload");Mi({store:p,actionsRef:h,parentContext:w==null?void 0:w.store.context,isDrawer:m});const E=c.useMemo(()=>({store:p}),[p]);return f.jsx(In.Provider,{value:!1,children:f.jsx(Mr.Provider,{value:E,children:typeof t=="function"?t({payload:y}):t})})}const Ni=c.forwardRef(function(t,n){const{render:r,className:s,style:o,id:i,...l}=t,{store:h}=Ge(),a=ms(i);return h.useSyncedValueWithCleanup("titleElementId",a),nt("h2",t,{ref:n,props:[{id:a},l]})});function ji({...e}){return f.jsx(Ai,{"data-slot":"dialog",...e})}function Fi({...e}){return f.jsx(xi,{"data-slot":"dialog-portal",...e})}function Hi({className:e,...t}){return f.jsx(ai,{"data-slot":"dialog-overlay",className:de("fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Li({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(Fi,{children:[f.jsx(Hi,{}),f.jsxs(bi,{"data-slot":"dialog-content",className:de("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&f.jsxs(ci,{"data-slot":"dialog-close",render:f.jsx(Ae,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(rs,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Vi({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-1",e),...t})}function Ki({className:e,...t}){return f.jsx(Ni,{"data-slot":"dialog-title",className:de("font-heading text-sm font-medium",e),...t})}function Ui({className:e,...t}){return f.jsx("div",{"data-slot":"empty",className:de("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",e),...t})}function Mn({className:e,...t}){return f.jsx("div",{"data-slot":"empty-title",className:de("font-heading text-sm font-medium tracking-tight",e),...t})}function Wi({className:e,...t}){return f.jsx("div",{"data-slot":"empty-description",className:de("text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Bi({className:e,...t}){return f.jsx("kbd",{"data-slot":"kbd",className:de("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}function _i(e){const t=ss.useSearch(),n=Hn(),[r,s]=c.useState(t.search),o=c.useRef(null),i=c.useRef(null),[l,h]=c.useState(new Set),[a,d]=c.useState(-1),[g,w]=c.useState(null),[m,b]=c.useState(!1),p=c.useRef([]),{data:y=[],isLoading:E}=sn(u=>u.from({m:Et}).orderBy(({m:I})=>I.createdAt,"desc"),[]),{data:S=[]}=sn(u=>u.from({p:os}),[]),D=c.useMemo(()=>{let u=y;if(t.type&&(u=u.filter(I=>I.type===t.type)),t.pinned&&(u=u.filter(I=>I.pinned)),t.needsReview&&(u=u.filter(I=>I.needsReview)),t.search){const I=t.search.toLowerCase();u=u.filter(W=>W.content.toLowerCase().includes(I))}return u},[y,t]),P=c.useMemo(()=>{const{projectId:u}=t;if(u==="global")return[{label:"Global",projectId:null,memories:D.filter($=>$.projects.length===0)}];if(u!==void 0){const $=S.find(ae=>ae.id===u),fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===u));return[{label:($==null?void 0:$.name)??u,projectId:u,memories:fe}]}const I=[],W=D.filter($=>$.projects.length===0);W.length>0&&I.push({label:"Global",projectId:null,memories:W});for(const $ of[...S].sort((fe,ae)=>fe.name.localeCompare(ae.name))){const fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===$.id));fe.length>0&&I.push({label:$.name,projectId:$.id,memories:fe})}return I},[D,S,t]),k=c.useMemo(()=>P.flatMap(u=>l.has(u.label)?[]:u.memories),[P,l]),L=c.useMemo(()=>{const u=new Set;let I=0;for(const W of P)for(const $ of W.memories)u.has($.id)||(u.add($.id),I++);return I},[P]);c.useEffect(()=>{k.length===0?d(-1):a>=k.length&&d(k.length-1)},[k.length,a]),c.useEffect(()=>{var u;a>=0&&((u=p.current[a])==null||u.scrollIntoView({block:"nearest"}))},[a]);const x=u=>{s(u),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n({to:"/memories",search:I=>({...I,search:u})})},300)},C=(u,I)=>{Et.update(u,W=>{W.pinned=!I})},j=u=>{Et.delete(u),e===u&&n({to:"/memories"})},_=u=>{const I=k.findIndex(W=>W.id===u);I>=0&&d(I),n(e===u?{to:"/memories"}:{to:"/memories/$id",params:{id:u}})},K=u=>{h(I=>{const W=new Set(I);return W.has(u)?W.delete(u):W.add(u),W})},V=()=>{const u=k[a];u&&(g===u.id?(j(u.id),w(null)):w(u.id))};return $s([{hotkey:"/",callback:()=>{var u,I;(u=i.current)==null||u.focus(),(I=i.current)==null||I.select()},options:{preventDefault:!0}},{hotkey:"ArrowUp",callback:()=>{d(u=>u<=0?k.length-1:u-1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"ArrowDown",callback:()=>{d(u=>u<0||u>=k.length-1?0:u+1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"Enter",callback:()=>{const u=k[a];u&&_(u.id)},options:{enabled:a>=0}},{hotkey:"P",callback:()=>{const u=k[a];u&&C(u.id,u.pinned)},options:{enabled:a>=0}},{hotkey:"D",callback:V,options:{enabled:a>=0}},{hotkey:"Delete",callback:V,options:{enabled:a>=0}},{hotkey:"Escape",callback:()=>{if(g){w(null);return}if(m){b(!1);return}e&&n({to:"/memories"})}},{hotkey:{key:"?",shift:!0},callback:()=>b(u=>!u)}]),{search:t,searchInput:r,inputRef:i,allMemories:y,allProjects:S,isLoading:E,groups:P,totalCount:L,collapsedGroups:l,flatMemories:k,focusedIndex:a,confirmingId:g,setConfirmingId:w,showShortcuts:m,setShowShortcuts:b,rowRefs:p,handleSearchChange:x,handlePin:C,handleDelete:j,handleSelect:_,toggleGroup:K}}const $i=[["↑ / ↓","Navigate list"],["Enter","Open memory"],["P","Pin / unpin"],["D / Del","Delete (confirm twice)"],["Escape","Close / cancel"],["/","Focus search"],["?","Toggle this help"]];function Yi({selectedId:e}){const t=Hn(),{search:n,searchInput:r,inputRef:s,allMemories:o,allProjects:i,isLoading:l,groups:h,totalCount:a,collapsedGroups:d,focusedIndex:g,confirmingId:w,setConfirmingId:m,showShortcuts:b,setShowShortcuts:p,rowRefs:y,handleSearchChange:E,handlePin:S,handleDelete:D,handleSelect:P,toggleGroup:k}=_i(e);let L=0;return f.jsxs("div",{className:"relative flex flex-col h-full",children:[f.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:[a," ",a===1?"memory":"memories",n.search?` matching "${n.search}"`:""]}),f.jsxs("div",{className:"flex flex-col gap-1.5 px-4 pt-3 pb-2 border-b border-border shrink-0",children:[f.jsxs("div",{className:"relative",children:[f.jsx(cs,{weight:"regular",className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none"}),f.jsx(bs,{ref:s,placeholder:"Search…",value:r,onChange:x=>E(x.target.value),className:"pl-7",title:"Press / to focus"})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsxs(cn,{value:n.type??"",onChange:x=>void t({to:"/memories",search:C=>({...C,type:x.target.value?x.target.value:void 0})}),size:"sm",className:"w-24",children:[f.jsx(ze,{value:"",children:"All types"}),is.map(x=>f.jsx(ze,{value:x,title:Nn[x],children:jn(x)},x))]}),f.jsxs(cn,{value:n.projectId??"",onChange:x=>void t({to:"/memories",search:C=>({...C,projectId:x.target.value||void 0})}),size:"sm",className:"w-28",children:[f.jsx(ze,{value:"",children:"All projects"}),f.jsx(ze,{value:"global",children:"Global"}),[...i].sort((x,C)=>x.name.localeCompare(C.name)).map(x=>f.jsx(ze,{value:x.id,children:x.name},x.id))]}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[f.jsx(Ae,{variant:n.pinned?"default":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,pinned:!x.pinned})}),"aria-label":"Pinned only","aria-pressed":n.pinned,children:f.jsx(Pr,{weight:n.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:n.needsReview?"destructive":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,needsReview:!x.needsReview})}),"aria-label":"Needs review only","aria-pressed":n.needsReview,title:"Show memories flagged for review — possible duplicates or conflicts",children:f.jsx(Fn,{weight:n.needsReview?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:()=>p(x=>!x),"aria-label":"Keyboard shortcuts","aria-pressed":b,title:"Press ? for shortcuts",children:f.jsx("span",{className:"text-[11px] font-mono font-bold",children:"?"})})]})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l&&o.length===0&&f.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-muted-foreground",children:"Loading…"}),!l&&h.length===0&&f.jsx(Ui,{className:"border-0 rounded-none p-0 h-32",children:o.length===0?f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:"No memories yet"}),f.jsxs(Wi,{className:"max-w-48",children:["Memories are saved automatically by AI coding tools. Run"," ",f.jsx("code",{className:"font-mono",children:"membank setup"})," to connect your tools."]})]}):f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:n.search?`No memories match "${n.search}"`:"No memories match the current filters"}),f.jsx(Ae,{variant:"link",size:"sm",onClick:()=>void t({to:"/memories",search:{}}),children:"Clear filters"})]})}),h.map(x=>{const C=d.has(x.label);return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>k(x.label),className:de("sticky top-0 z-10 w-full flex items-center justify-between px-4 py-1.5","bg-background/95 backdrop-blur border-b border-border","text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{children:x.memories.length})]}),!C&&f.jsx("ul",{className:"m-0 p-0",children:x.memories.map(j=>{const _=L++;return f.jsx(oi,{ref:K=>{y.current[_]=K},memory:j,selected:e===j.id,focused:g===_,confirming:w===j.id,onSelect:()=>P(j.id),onPin:()=>S(j.id,j.pinned),onDelete:()=>{D(j.id),m(null)},onDeleteStart:()=>m(j.id),onDeleteCancel:()=>m(null)},`${x.label}-${j.id}`)})})]},x.label)})]}),a>0&&f.jsxs("div",{className:de("px-4 py-2 border-t border-border shrink-0","text-[11px] text-muted-foreground"),children:[a," ",a===1?"memory":"memories"]}),f.jsx(ji,{open:b,onOpenChange:p,children:f.jsxs(Li,{className:"min-w-56 sm:max-w-sm",children:[f.jsx(Vi,{children:f.jsx(Ki,{children:"Keyboard shortcuts"})}),f.jsx("dl",{className:"space-y-2",children:$i.map(([x,C])=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("dt",{className:"shrink-0 min-w-20 text-right",children:f.jsx(Bi,{children:x})}),f.jsx("dd",{className:"text-xs text-foreground",children:C})]},x))})]})})]})}function Ji(){const e=Ys({select:t=>{const n=t.location.pathname;return n.startsWith("/memories/")?n.slice(10):null}});return f.jsxs("div",{className:"flex flex-1 min-h-0 w-full",children:[f.jsx("div",{className:"w-[380px] shrink-0 border-r border-border overflow-hidden flex flex-col",children:f.jsx(Yi,{selectedId:e})}),f.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:f.jsx(as,{})})]})}export{Ji as component};
@@ -0,0 +1 @@
1
+ import{a as le,r as a,l as $,e as _,x as ce,n as Q,j as e,J as de,o as ue,V as pe,H as ne,M as fe,O as Y,P as W,W as me,Q as he,X as ge,Y as J,Z as G,_ as xe,D as z,C as D,$ as X,S as ve,G as ye,F as be,a0 as je}from"./index-D_ebWYgx.js";import{v as we,k as Ce,q as Se,w as Re,d as se,j as Ne,T as Z,m as re,e as Pe,A as B,b as ke,x as Me,l as Fe,N as ee,s as K,I as Oe}from"./native-select-Dno9-QLw.js";function Be(t,n){if(t===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in t)return t;if(typeof t=="function")return{shouldBlockFn:async()=>await t(),enableBeforeUnload:!0,withResolver:!1};const o=!!(t.condition??!0),S=t.blockerFn;return{shouldBlockFn:async()=>o&&S!==void 0?await S():o,enableBeforeUnload:o,withResolver:S===void 0}}function Ie(t,n){const{shouldBlockFn:o,enableBeforeUnload:S=!0,disabled:r=!1,withResolver:h=!1}=Be(t),u=le(),{history:v}=u,[y,g]=a.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return a.useEffect(()=>{const f=async i=>{function c(x){const R=u.parseLocation(x),k=u.getMatchedRoutes(R.pathname);return k.foundRoute===void 0?{routeId:"__notFound__",fullPath:R.pathname,pathname:R.pathname,params:k.routeParams,search:u.options.parseSearch(x.search)}:{routeId:k.foundRoute.id,fullPath:k.foundRoute.fullPath,pathname:R.pathname,params:k.routeParams,search:u.options.parseSearch(x.search)}}const d=c(i.currentLocation),m=c(i.nextLocation);if(d.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const w=await o({action:i.action,current:d,next:m});if(!h)return w;if(!w)return!1;const F=await new Promise(x=>{g({status:"blocked",current:d,next:m,action:i.action,proceed:()=>x(!1),reset:()=>x(!0)})});return g({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),F};return r?void 0:v.block({blockerFn:f,enableBeforeUnload:S})},[o,S,r,h,v,u]),y}function Te(t){const{open:n,defaultOpen:o,onOpenChange:S,disabled:r}=t,h=n!==void 0,[u,v]=we({controlled:n,default:o,name:"Collapsible",state:"open"}),{mounted:y,setMounted:g,transitionStatus:f}=Ce(u,!0,!0),[i,c]=a.useState(u),[{height:d,width:m},w]=a.useState({height:void 0,width:void 0}),F=Se(),[x,R]=a.useState(),k=x??F,[l,I]=a.useState(!1),[E,O]=a.useState(!1),T=a.useRef(null),M=a.useRef(null),C=a.useRef(null),N=a.useRef(null),s=Re(N,!1),P=$(b=>{const p=!u,j=se(Ne,b.nativeEvent);if(S(p,j),j.isCanceled)return;const A=N.current;M.current==="css-animation"&&A!=null&&A.style.removeProperty("animation-name"),!l&&!E&&(M.current!=null&&M.current!=="css-animation"&&!y&&p&&g(!0),M.current==="css-animation"&&(!i&&p&&c(!0),!y&&p&&g(!0))),v(p),M.current==="none"&&y&&!p&&g(!1)});return _(()=>{h&&M.current==="none"&&!u&&g(!1)},[h,u,n,g]),a.useMemo(()=>({abortControllerRef:T,animationTypeRef:M,disabled:r,handleTrigger:P,height:d,mounted:y,open:u,panelId:k,panelRef:N,runOnceAnimationsFinish:s,setDimensions:w,setHiddenUntilFound:I,setKeepMounted:O,setMounted:g,setOpen:v,setPanelIdState:R,setVisible:c,transitionDimensionRef:C,transitionStatus:f,visible:i,width:m}),[T,M,r,P,d,y,u,k,N,s,w,I,O,g,v,c,C,f,i,m])}const ae=a.createContext(void 0);function oe(){const t=a.useContext(ae);if(t===void 0)throw new Error(ce(15));return t}let L=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Z.startingStyle]="startingStyle",t[t.endingStyle=Z.endingStyle]="endingStyle",t})({}),Ae=(function(t){return t.panelOpen="data-panel-open",t})({});const Ee={[L.open]:""},_e={[L.closed]:""},De={open(t){return t?{[Ae.panelOpen]:""}:null}},Le={open(t){return t?Ee:_e}},ie={...Le,...re},ze=a.forwardRef(function(n,o){const{render:S,className:r,defaultOpen:h=!1,disabled:u=!1,onOpenChange:v,open:y,style:g,...f}=n,i=$(v),c=Te({open:y,defaultOpen:h,onOpenChange:i,disabled:u}),d=a.useMemo(()=>({open:c.open,disabled:c.disabled,transitionStatus:c.transitionStatus}),[c.open,c.disabled,c.transitionStatus]),m=a.useMemo(()=>({...c,onOpenChange:i,state:d}),[c,i,d]),w=Q("div",n,{state:d,ref:o,props:f,stateAttributesMapping:ie});return e.jsx(ae.Provider,{value:m,children:w})}),He={...De,...re},Ue=a.forwardRef(function(n,o){const{panelId:S,open:r,handleTrigger:h,state:u,disabled:v}=oe(),{className:y,disabled:g=v,id:f,render:i,nativeButton:c=!0,style:d,...m}=n,{getButtonProps:w,buttonRef:F}=de({disabled:g,focusableWhenDisabled:!0,native:c}),x=a.useMemo(()=>({"aria-controls":r?S:void 0,"aria-expanded":r,onClick:h}),[S,r,h]);return Q("button",n,{state:u,ref:[o,F],props:[x,m,w],stateAttributesMapping:He})});let qe=(function(t){return t.disabled="data-disabled",t.orientation="data-orientation",t})({});function We(t){const{abortControllerRef:n,animationTypeRef:o,externalRef:S,height:r,hiddenUntilFound:h,keepMounted:u,id:v,mounted:y,onOpenChange:g,open:f,panelRef:i,runOnceAnimationsFinish:c,setDimensions:d,setMounted:m,setOpen:w,setVisible:F,transitionDimensionRef:x,visible:R,width:k}=t,l=a.useRef(!1),I=a.useRef(null),E=a.useRef(f),O=a.useRef(f),T=Pe(),M=a.useMemo(()=>o.current==="css-animation"?!R:!f&&!y,[f,y,R,o]),C=$(s=>{if(!s)return;if(o.current==null||x.current==null){const p=getComputedStyle(s),j=p.animationName!=="none"&&p.animationName!=="",A=p.transitionDuration!=="0s"&&p.transitionDuration!=="";j&&A||(p.animationName==="none"&&p.transitionDuration!=="0s"?o.current="css-transition":p.animationName!=="none"&&p.transitionDuration==="0s"?o.current="css-animation":o.current="none"),s.getAttribute(qe.orientation)==="horizontal"||p.transitionProperty.indexOf("width")>-1?x.current="width":x.current="height"}if(o.current!=="css-transition")return;(r===void 0||k===void 0)&&(d({height:s.scrollHeight,width:s.scrollWidth}),O.current&&s.style.setProperty("transition-duration","0s"));let P=-1,b=-1;return P=B.request(()=>{O.current=!1,b=B.request(()=>{setTimeout(()=>{s.style.removeProperty("transition-duration")})})}),()=>{B.cancel(P),B.cancel(b)}}),N=ue(S,i,C);return _(()=>{if(o.current!=="css-transition")return;const s=i.current;if(!s)return;let P=-1;if(n.current!=null&&(n.current.abort(),n.current=null),f){const b={"justify-content":s.style.justifyContent,"align-items":s.style.alignItems,"align-content":s.style.alignContent,"justify-items":s.style.justifyItems};Object.keys(b).forEach(p=>{s.style.setProperty(p,"initial","important")}),!O.current&&!u&&s.setAttribute(L.startingStyle,""),d({height:s.scrollHeight,width:s.scrollWidth}),P=B.request(()=>{Object.entries(b).forEach(([p,j])=>{j===""?s.style.removeProperty(p):s.style.setProperty(p,j)})})}else{if(s.scrollHeight===0&&s.scrollWidth===0)return;d({height:s.scrollHeight,width:s.scrollWidth});const b=new AbortController;n.current=b;const p=b.signal;let j=null;const A=L.endingStyle;return j=new MutationObserver(U=>{U.some(q=>q.type==="attributes"&&q.attributeName===A)&&(j==null||j.disconnect(),j=null,c(()=>{d({height:0,width:0}),s.style.removeProperty("content-visibility"),m(!1),n.current===b&&(n.current=null)},p))}),j.observe(s,{attributes:!0,attributeFilter:[A]}),()=>{j==null||j.disconnect(),T.cancel(),n.current===b&&(b.abort(),n.current=null)}}return()=>{B.cancel(P)}},[n,o,T,h,u,y,f,i,c,d,m]),_(()=>{if(o.current!=="css-animation")return;const s=i.current;s&&(I.current=s.style.animationName||I.current,s.style.setProperty("animation-name","none"),d({height:s.scrollHeight,width:s.scrollWidth}),!E.current&&!l.current&&s.style.removeProperty("animation-name"),f?(n.current!=null&&(n.current.abort(),n.current=null),m(!0),F(!0)):(n.current=new AbortController,c(()=>{m(!1),F(!1),n.current=null},n.current.signal)))},[n,o,f,i,c,d,m,F,R]),pe(()=>{const s=B.request(()=>{E.current=!1});return()=>B.cancel(s)}),_(()=>{if(!h)return;const s=i.current;if(!s)return;let P=-1,b=-1;return f&&l.current&&(s.style.transitionDuration="0s",d({height:s.scrollHeight,width:s.scrollWidth}),P=B.request(()=>{l.current=!1,b=B.request(()=>{setTimeout(()=>{s.style.removeProperty("transition-duration")})})})),()=>{B.cancel(P),B.cancel(b)}},[h,f,i,d]),_(()=>{const s=i.current;s&&h&&M&&(s.setAttribute("hidden","until-found"),o.current==="css-transition"&&s.setAttribute(L.startingStyle,""))},[h,M,o,i]),a.useEffect(function(){const P=i.current;if(!P)return;function b(p){l.current=!0,w(!0),g(!0,se(Me,p))}return ke(P,"beforematch",b)},[g,i,w]),a.useMemo(()=>({props:{hidden:M,id:v,ref:N}}),[M,v,N])}let te=(function(t){return t.collapsiblePanelHeight="--collapsible-panel-height",t.collapsiblePanelWidth="--collapsible-panel-width",t})({});const Ke=a.forwardRef(function(n,o){const{className:S,hiddenUntilFound:r,keepMounted:h,render:u,id:v,style:y,...g}=n,{abortControllerRef:f,animationTypeRef:i,height:c,mounted:d,onOpenChange:m,open:w,panelId:F,panelRef:x,runOnceAnimationsFinish:R,setDimensions:k,setHiddenUntilFound:l,setKeepMounted:I,setMounted:E,setPanelIdState:O,setOpen:T,setVisible:M,state:C,transitionDimensionRef:N,visible:s,width:P,transitionStatus:b}=oe(),p=r??!1,j=h??!1;_(()=>{if(v)return O(v),()=>{O(void 0)}},[v,O]),_(()=>{l(p)},[l,p]),_(()=>{I(j)},[I,j]);const{props:A}=We({abortControllerRef:f,animationTypeRef:i,externalRef:o,height:c,hiddenUntilFound:p,id:F,keepMounted:j,mounted:d,onOpenChange:m,open:w,panelRef:x,runOnceAnimationsFinish:R,setDimensions:k,setMounted:E,setOpen:T,setVisible:M,transitionDimensionRef:N,visible:s,width:P});Fe({open:w&&b==="idle",ref:x,onComplete(){w&&k({height:void 0,width:void 0})}});const U=a.useMemo(()=>({...C,transitionStatus:b}),[C,b]),V=Q("div",n,{state:U,ref:[o,x],props:[A,{style:{[te.collapsiblePanelHeight]:c===void 0?"auto":`${c}px`,[te.collapsiblePanelWidth]:P===void 0?"auto":`${P}px`}},g],stateAttributesMapping:ie});return j||p||d?V:null});function $e({...t}){return e.jsx(ze,{"data-slot":"collapsible",...t})}function Qe({...t}){return e.jsx(Ue,{"data-slot":"collapsible-trigger",...t})}function Ve({...t}){return e.jsx(Ke,{"data-slot":"collapsible-content",...t})}function H({className:t,...n}){return e.jsx("label",{"data-slot":"label",className:ne("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",t),...n})}function Ye({className:t,...n}){return e.jsx("textarea",{"data-slot":"textarea",className:ne("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",t),...n})}function Je(t){const n=fe(),{data:o=[],isLoading:S}=Y(C=>C.from({m:W}).where(({m:N})=>me(N.id,t)),[t]),r=o[0]??null,{data:h=[]}=Y(C=>C.from({p:he}),[]),[u,v]=a.useState(""),[y,g]=a.useState("fact"),[f,i]=a.useState(""),[c,d]=a.useState(!1),[m,w]=a.useState(""),[F,x]=a.useState(!1);a.useEffect(()=>{r&&!c&&(v(r.content),g(r.type),i(r.tags.join(", ")),d(!0))},[r,c]);const R=r!==null&&(u!==r.content||y!==r.type||f!==r.tags.join(", ")),k=Ie({shouldBlockFn:()=>R,withResolver:!0}),l=()=>{if(!r||!R)return;const C=f.split(",").map(N=>N.trim()).filter(Boolean);W.update(t,N=>{u!==r.content&&(N.content=u),y!==r.type&&(N.type=y),JSON.stringify(C)!==JSON.stringify(r.tags)&&(N.tags=C)}),x(!0),setTimeout(()=>x(!1),1500)},I=()=>{W.update(t,C=>{C.needsReview=!1})},E=async()=>{if(m)try{await xe(t,m),await J.invalidateQueries({queryKey:["memories"]}),w("")}catch{G.error("Failed to add project — try again")}},O=async C=>{try{await ge(t,C),await J.invalidateQueries({queryKey:["memories"]})}catch{G.error("Failed to remove project — try again")}},T=()=>void n({to:"/memories"}),M=h.filter(C=>!(r!=null&&r.projects.some(N=>N.id===C.id)));return{memory:r,isLoading:S,content:u,setContent:v,type:y,setType:g,tagsInput:f,setTagsInput:i,addProjectId:m,setAddProjectId:w,saved:F,dirty:R,blocker:k,availableProjects:M,handleSave:l,handleApprove:I,handleAddProject:E,handleRemoveProject:O,handleClose:T}}function Ge({id:t}){const{memory:n,isLoading:o,content:S,setContent:r,type:h,setType:u,tagsInput:v,setTagsInput:y,addProjectId:g,setAddProjectId:f,saved:i,dirty:c,blocker:d,availableProjects:m,handleSave:w,handleApprove:F,handleAddProject:x,handleRemoveProject:R,handleClose:k}=Je(t);return o||!n?e.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:o?"Loading…":"Memory not found"}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:n.type,children:n.type}),n.needsReview&&e.jsx(z,{variant:"destructive",title:"Flagged for review — possible duplicate or conflict with another memory",children:"needs review"}),n.pinned&&e.jsx(z,{variant:"default",children:"pinned"})]}),e.jsx(D,{variant:"ghost",size:"icon-sm",onClick:k,"aria-label":"Close",children:e.jsx(X,{weight:"regular"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-content",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Content"}),e.jsx(Ye,{id:"memory-content",value:S,onChange:l=>r(l.target.value),rows:8,className:"min-h-32 font-[var(--font-heading)] text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-type",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Type"}),e.jsx(ee,{id:"memory-type",value:h,onChange:l=>u(l.target.value),className:"w-full",children:ve.map(l=>e.jsx(K,{value:l,children:ye(l)},l))}),e.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:be[h]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-tags",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Tags"}),e.jsx(Oe,{id:"memory-tags",value:v,onChange:l=>y(l.target.value),placeholder:"tag1, tag2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Projects"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[n.projects.length===0&&e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Global (no project)"}),n.projects.map(l=>e.jsxs(z,{variant:"secondary",className:"gap-1 rounded-full text-[11px]",children:[l.name,e.jsx("button",{type:"button",onClick:()=>void R(l.id),className:"hover:text-destructive transition-colors leading-none","aria-label":`Remove from ${l.name}`,children:e.jsx(X,{weight:"regular",className:"size-2.5"})})]},l.id))]}),m.length>0&&e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(ee,{value:g,onChange:l=>f(l.target.value),size:"sm",className:"flex-1",children:[e.jsx(K,{value:"",children:"Add to project…"}),m.map(l=>e.jsx(K,{value:l.id,children:l.name},l.id))]}),e.jsx(D,{variant:"outline",size:"sm",disabled:!g,onClick:()=>void x(),children:"+"})]})]}),e.jsxs($e,{className:"group pt-2 border-t border-border",children:[e.jsxs(Qe,{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:[e.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Details"]}),e.jsxs(Ve,{className:"space-y-1 mt-2",children:[n.sourceHarness&&e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Source"}),e.jsx("span",{children:n.sourceHarness})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Accessed"}),e.jsxs("span",{children:[n.accessCount,"×"]})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Updated"}),e.jsx("span",{children:new Date(n.updatedAt).toLocaleString()})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Created"}),e.jsx("span",{children:new Date(n.createdAt).toLocaleString()})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0",children:[d.status==="blocked"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-destructive",children:"Unsaved changes"}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>d.proceed(),children:"Discard"}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>d.reset(),children:"Keep editing"})]}),n.needsReview&&d.status!=="blocked"&&e.jsx(D,{variant:"outline",size:"sm",onClick:F,title:"Mark as reviewed — this memory was flagged as a possible duplicate or conflict",children:"Mark reviewed"}),e.jsx("div",{className:"flex-1"}),e.jsx(D,{variant:"default",size:"sm",onClick:w,disabled:!c,children:i?"Saved":"Save"})]})]})}function et(){const{id:t}=je.useParams();return e.jsx(Ge,{id:t},t)}export{et as component};
@@ -0,0 +1 @@
1
+ import{j as e}from"./index-D_ebWYgx.js";import{f as t}from"./MagnifyingGlass.es-BZ4bp5Mi.js";function o(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[e.jsx(t,{weight:"regular",className:"size-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a memory to view or edit"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Press"," ",e.jsx("kbd",{className:"font-mono px-1 py-0.5 rounded border border-border text-[10px]",children:"/"})," to search"]})]})}export{o as component};
@@ -0,0 +1 @@
1
+ var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);import{E as k,d as j,V as ae,h as se,a1 as ie,r as a,e as E,l as A,k as le,B as oe,N as v,x as ue,t as ce,n as de,j as x,H as M}from"./index-D_ebWYgx.js";const fe="none",je="trigger-press",Be="trigger-hover",Ze="outside-press",He="close-press",ze="focus-out",$e="escape-key",Ke="imperative-action";function me(e,t,n,i){let s=!1,r=!1;const o=k;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...o}}function Ge(e,t,n,i){return e.addEventListener(t,n,i),()=>{e.removeEventListener(t,n,i)}}const R=null;class ve{constructor(){p(this,"callbacks",[]);p(this,"callbacksCount",0);p(this,"nextId",1);p(this,"startId",1);p(this,"isScheduled",!1);p(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let r=0;r<n.length;r+=1)(s=n[r])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const T=new ve;class g{constructor(){p(this,"currentId",R);p(this,"cancel",()=>{this.currentId!==R&&(T.cancel(this.currentId),this.currentId=R)});p(this,"disposeEffect",()=>this.cancel)}static create(){return new g}static request(t){return T.request(t)}static cancel(t){return T.cancel(t)}request(t){this.cancel(),this.currentId=T.request(()=>{this.currentId=R,t()})}}function pe(){const e=j(g.create).current;return ae(e.disposeEffect),e}function ge(e){return(e==null?void 0:e.ownerDocument)||document}function he(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Ye(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&se(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Je(e){return"composedPath"in e?e.composedPath()[0]:e.target}const be={...ie};let _=0;function Ee(e,t="mui"){const[n,i]=a.useState(e),s=e||n;return a.useEffect(()=>{n==null&&(_+=1,i(`${t}-${_}`))},[n,t]),s}const q=be.useId;function Ie(e,t){if(q!==void 0){const n=q();return e??(t?`${t}-${n}`:n)}return Ee(e,t)}function xe(e){return e==null?e:"current"in e?e.current:e}function We(e,t=!1,n=!1){const[i,s]=a.useState(e&&t?"idle":void 0),[r,o]=a.useState(e);return e&&!r&&(o(!0),s("starting")),!e&&r&&i!=="ending"&&!n&&s("ending"),!e&&!r&&i==="ending"&&s(void 0),E(()=>{if(!e&&r&&i!=="ending"&&n){const l=g.request(()=>{s("ending")});return()=>{g.cancel(l)}}},[e,r,i,n]),E(()=>{if(!e||t)return;const l=g.request(()=>{s(void 0)});return()=>{g.cancel(l)}},[t,e]),E(()=>{if(!e||!t)return;e&&r&&i!=="idle"&&s("starting");const l=g.request(()=>{s("idle")});return()=>{g.cancel(l)}},[t,e,r,i]),{mounted:r,setMounted:o,transitionStatus:i}}let N=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ye={[N.startingStyle]:""},Ce={[N.endingStyle]:""},Qe={transitionStatus(e){return e==="starting"?ye:e==="ending"?Ce:null}};function we(e,t=!1,n=!0){const i=pe();return A((s,r=null)=>{i.cancel();const o=xe(e);if(o==null)return;const l=o,c=()=>{le.flushSync(s)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{r!=null&&r.aborted||c()}).catch(()=>{if(n){r!=null&&r.aborted||c();return}const f=l.getAnimations();!(r!=null&&r.aborted)&&f.length>0&&f.some(u=>u.pending||u.playState!=="finished")&&d()})}if(t){const f=N.startingStyle;if(!l.hasAttribute(f)){i.request(d);return}const u=new MutationObserver(()=>{l.hasAttribute(f)||(u.disconnect(),d())});u.observe(l,{attributes:!0,attributeFilter:[f]}),r==null||r.addEventListener("abort",()=>u.disconnect(),{once:!0});return}i.request(d)})}function Xe(e){const{enabled:t=!0,open:n,ref:i,onComplete:s}=e,r=A(s),o=we(i,n,!1);a.useEffect(()=>{if(!t)return;const l=new AbortController;return o(r,l.signal),()=>{l.abort()}},[t,n,r,o])}function Se(e){return Ie(e,"base-ui")}const Re=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),B=a.forwardRef((e,t)=>a.createElement(oe,{ref:t,...e,weights:Re}));B.displayName="CaretDownIcon";const Te=B;let U=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fe={disabled:!1,...y},ke={valid(e){return e===null?null:e?{[U.valid]:""}:{[U.invalid]:""}}},Me=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ae,errors:[],error:"",value:"",initialValue:null},setValidityData:v,disabled:void 0,touched:y.touched,setTouched:v,dirty:y.dirty,setDirty:v,filled:y.filled,setFilled:v,focused:y.focused,setFocused:v,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Fe,markedDirtyRef:{current:!1},registerFieldControl:v,validation:{getValidationProps:(e=k)=>e,getInputValidationProps:(e=k)=>e,inputRef:{current:null},commit:async()=>{}}});function Z(e=!0){const t=a.useContext(Me);if(t.setValidityData===v&&!e)throw new Error(ue(28));return t}const Ne=a.createContext({controlId:void 0,registerControlId:v,labelId:void 0,setLabelId:v,messageIds:[],setMessageIds:v,getDescriptionProps:e=>e});function H(){return a.useContext(Ne)}function Pe(e={}){const{id:t,implicit:n=!1,controlRef:i}=e,{controlId:s,registerControlId:r}=H(),o=Se(t),l=n?s:void 0,c=j(()=>Symbol("labelable-control")),d=a.useRef(!1),f=a.useRef(t!=null),u=A(()=>{!d.current||r===v||(d.current=!1,r(c.current,void 0))});return E(()=>{if(r===v)return;let b;if(n){const C=i==null?void 0:i.current;ce(C)&&C.closest("label")!=null?b=t??null:b=l??o}else if(t!=null)f.current=!0,b=t;else if(f.current)b=o;else{u();return}if(b===void 0){u();return}d.current=!0,r(c.current,b)},[t,i,l,r,n,o,c,u]),a.useEffect(()=>u,[u]),s??o}function Le({controlled:e,default:t,name:n,state:i="value"}){const{current:s}=a.useRef(e!==void 0),[r,o]=a.useState(t),l=s?e:r,c=a.useCallback(d=>{s||o(d)},[]);return[l,c]}function De(e,t){const{enabled:n=!0,getValue:i,id:s,value:r}=t,{registerFieldControl:o}=Z(),l=a.useRef(null);l.current||(l.current=Symbol()),E(()=>{const c=l.current;if(!(!c||!n))return o(c,{controlRef:e,getValue:i,id:s,value:r}),()=>{o(c,void 0)}},[e,n,i,s,o,r])}const Ve=a.forwardRef(function(t,n){const{render:i,className:s,id:r,name:o,value:l,disabled:c=!1,onValueChange:d,defaultValue:f,autoFocus:u=!1,style:b,...C}=t,{state:z,name:$,disabled:K,setTouched:P,setDirty:G,validityData:Y,setFocused:w,setFilled:S,validationMode:J,validation:h}=Z(),L=K||c,W=$??o,Q={...z,disabled:L},{labelId:X}=H(),D=Pe({id:r});E(()=>{var I;const m=l!=null;(I=h.inputRef.current)!=null&&I.value||m&&l!==""?S(!0):m&&l===""&&S(!1)},[h.inputRef,S,l]);const F=a.useRef(null);E(()=>{u&&F.current===he(ge(F.current))&&w(!0)},[u,w]);const[ee]=Le({controlled:l,default:f,name:"FieldControl",state:"value"}),V=l!==void 0,O=V?ee:void 0,te=A(()=>{var m;return(m=h.inputRef.current)==null?void 0:m.value});return De(h.inputRef,{id:D,value:O,getValue:te}),de("input",t,{ref:[n,F],state:Q,props:[{id:D,disabled:L,name:W,ref:h.inputRef,"aria-labelledby":X,autoFocus:u,...V?{value:O}:{defaultValue:f},onChange(m){const I=m.currentTarget.value;d==null||d(I,me(fe,m.nativeEvent)),G(I!==Y.initialValue),S(I!=="")},onFocus(){w(!0)},onBlur(m){P(!0),w(!1),J==="onBlur"&&h.commit(m.currentTarget.value)},onKeyDown(m){m.currentTarget.tagName==="INPUT"&&m.key==="Enter"&&(P(!0),h.commit(m.currentTarget.value))}},h.getInputValidationProps(),C],stateAttributesMapping:ke})}),Oe=a.forwardRef(function(t,n){return x.jsx(Ve,{ref:n,...t})});function et({className:e,type:t,...n}){return x.jsx(Oe,{type:t,"data-slot":"input",className:M("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function tt({className:e,size:t="default",...n}){return x.jsxs("div",{className:M("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),"data-slot":"native-select-wrapper","data-size":t,children:[x.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-7 w-full min-w-0 appearance-none rounded-md border border-input bg-input/20 py-0.5 pr-6 pl-2 text-xs/relaxed transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=sm]:h-6 data-[size=sm]:text-[0.625rem] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...n}),x.jsx(Te,{className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground select-none group-data-[size=sm]/native-select:size-3","aria-hidden":"true","data-slot":"native-select-icon"})]})}function nt({className:e,...t}){return x.jsx("option",{"data-slot":"native-select-option",className:M("bg-[Canvas] text-[CanvasText]",e),...t})}export{g as A,et as I,tt as N,N as T,he as a,Ge as b,Ye as c,me as d,pe as e,ze as f,Ze as g,Je as h,$e as i,je as j,We as k,Xe as l,Qe as m,He as n,ge as o,Ke as p,Se as q,xe as r,nt as s,Be as t,Ie as u,Le as v,we as w,fe as x};
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
+ <!-- Dark bg, slight violet tint -->
3
+ <rect width="32" height="32" rx="7" fill="#100f17"/>
4
+ <!-- Triangle edges -->
5
+ <line x1="16" y1="7" x2="8" y2="21" stroke="#7c6fd6" stroke-width="2" stroke-linecap="round"/>
6
+ <line x1="16" y1="7" x2="24" y2="21" stroke="#7c6fd6" stroke-width="2" stroke-linecap="round"/>
7
+ <line x1="8" y1="21" x2="24" y2="21" stroke="#7c6fd6" stroke-width="2" stroke-linecap="round"/>
8
+ <!-- Nodes -->
9
+ <circle cx="16" cy="7" r="3" fill="#c4b5fd"/>
10
+ <circle cx="8" cy="21" r="3" fill="#c4b5fd"/>
11
+ <circle cx="24" cy="21" r="3" fill="#c4b5fd"/>
12
+ </svg>
@@ -4,6 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Membank</title>
7
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
8
  <script>
8
9
  (() => {
9
10
  const stored = localStorage.getItem("membank-theme");
@@ -11,8 +12,8 @@
11
12
  document.documentElement.classList.add(theme);
12
13
  })();
13
14
  </script>
14
- <script type="module" crossorigin src="/assets/index-BJBlyjV_.js"></script>
15
- <link rel="stylesheet" crossorigin href="/assets/index-CP6dxIEs.css">
15
+ <script type="module" crossorigin src="/assets/index-D_ebWYgx.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-CMSfmat6.css">
16
17
  </head>
17
18
  <body>
18
19
  <div id="root"></div>
package/dist/index.cjs CHANGED
@@ -45,13 +45,13 @@ const MIME = {
45
45
  ".png": "image/png",
46
46
  ".json": "application/json"
47
47
  };
48
- function parseRow(row) {
48
+ function parseRow(row, projects = []) {
49
49
  return {
50
50
  id: row.id,
51
51
  content: row.content,
52
52
  type: row.type,
53
53
  tags: JSON.parse(row.tags),
54
- scope: row.scope,
54
+ projects,
55
55
  sourceHarness: row.source,
56
56
  accessCount: row.access_count,
57
57
  pinned: row.pinned !== 0,
@@ -83,24 +83,27 @@ async function findFreePort(preferred) {
83
83
  });
84
84
  }
85
85
  }
86
- function createApiApp(db, repo) {
86
+ function createApiApp(db, repo, projectRepo) {
87
87
  const app = new hono.Hono();
88
88
  app.get("/api/memories", (c) => {
89
- const { type, pinned, needsReview, search, scope } = c.req.query();
89
+ const { type, pinned, needsReview, search, projectId } = c.req.query();
90
90
  const conditions = [];
91
91
  const params = [];
92
92
  if (type) {
93
- conditions.push("type = ?");
93
+ conditions.push("m.type = ?");
94
94
  params.push(type);
95
95
  }
96
- if (pinned === "true") conditions.push("pinned = 1");
97
- if (needsReview === "true") conditions.push("needs_review = 1");
98
- if (scope) {
99
- conditions.push("scope = ?");
100
- params.push(scope);
96
+ if (pinned === "true") conditions.push("m.pinned = 1");
97
+ if (needsReview === "true") conditions.push("m.needs_review = 1");
98
+ if (projectId === "global") conditions.push("m.id NOT IN (SELECT memory_id FROM memory_projects)");
99
+ else if (projectId) {
100
+ conditions.push("m.id IN (SELECT memory_id FROM memory_projects WHERE project_id = ?)");
101
+ params.push(projectId);
101
102
  }
102
103
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
103
- let memories = db.db.prepare(`SELECT * FROM memories ${where} ORDER BY created_at DESC`).all(...params).map(parseRow);
104
+ const rows = db.db.prepare(`SELECT m.* FROM memories m ${where} ORDER BY m.created_at DESC`).all(...params);
105
+ const projectMap = projectRepo.getProjectsForMemories(rows.map((r) => r.id));
106
+ let memories = rows.map((r) => parseRow(r, projectMap.get(r.id) ?? []));
104
107
  if (search) {
105
108
  const q = search.toLowerCase();
106
109
  memories = memories.filter((m) => m.content.toLowerCase().includes(q));
@@ -108,9 +111,11 @@ function createApiApp(db, repo) {
108
111
  return c.json(memories);
109
112
  });
110
113
  app.get("/api/memories/:id", (c) => {
111
- const row = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(c.req.param("id"));
114
+ const id = c.req.param("id");
115
+ const row = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(id);
112
116
  if (!row) return c.json({ error: "Not found" }, 404);
113
- return c.json(parseRow(row));
117
+ const projectMap = projectRepo.getProjectsForMemories([id]);
118
+ return c.json(parseRow(row, projectMap.get(id) ?? []));
114
119
  });
115
120
  app.patch("/api/memories/:id", async (c) => {
116
121
  const id = c.req.param("id");
@@ -140,12 +145,35 @@ function createApiApp(db, repo) {
140
145
  tags: body.tags
141
146
  });
142
147
  const updated = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(id);
143
- return c.json(parseRow(updated));
148
+ const projectMap = projectRepo.getProjectsForMemories([id]);
149
+ return c.json(parseRow(updated, projectMap.get(id) ?? []));
144
150
  });
145
151
  app.delete("/api/memories/:id", async (c) => {
146
152
  await repo.delete(c.req.param("id"));
147
153
  return c.json({ ok: true });
148
154
  });
155
+ app.post("/api/memories/:id/projects", async (c) => {
156
+ const memoryId = c.req.param("id");
157
+ const body = await c.req.json();
158
+ projectRepo.addAssociation(memoryId, body.projectId);
159
+ return c.json({ ok: true });
160
+ });
161
+ app.delete("/api/memories/:id/projects/:projectId", (c) => {
162
+ projectRepo.removeAssociation(c.req.param("id"), c.req.param("projectId"));
163
+ return c.json({ ok: true });
164
+ });
165
+ app.get("/api/projects", (c) => {
166
+ return c.json(projectRepo.list());
167
+ });
168
+ app.patch("/api/projects/:id", async (c) => {
169
+ const id = c.req.param("id");
170
+ const body = await c.req.json();
171
+ try {
172
+ return c.json(projectRepo.rename(id, body.name));
173
+ } catch {
174
+ return c.json({ error: "Not found" }, 404);
175
+ }
176
+ });
149
177
  app.get("/api/stats", (c) => {
150
178
  const byType = {
151
179
  correction: 0,
@@ -171,7 +199,9 @@ function createApiApp(db, repo) {
171
199
  async function startDashboard(opts) {
172
200
  const port = await findFreePort(opts?.port ?? PREFERRED_PORT);
173
201
  const db = _membank_core.DatabaseManager.open();
174
- const app = createApiApp(db, new _membank_core.MemoryRepository(db, new _membank_core.EmbeddingService()));
202
+ const embedding = new _membank_core.EmbeddingService();
203
+ const projects = new _membank_core.ProjectRepository(db);
204
+ const app = createApiApp(db, new _membank_core.MemoryRepository(db, embedding, projects), projects);
175
205
  const clientDir = (0, node_path.join)((0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)), "client");
176
206
  app.get("*", (c) => {
177
207
  const filePath = (0, node_path.join)(clientDir, c.req.path === "/" ? "/index.html" : c.req.path);
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { DatabaseManager, MemoryRepository } from "@membank/core";
1
+ import { DatabaseManager, MemoryRepository, ProjectRepository } from "@membank/core";
2
2
  import { Hono } from "hono";
3
3
 
4
4
  //#region src/server/index.d.ts
5
- declare function createApiApp(db: DatabaseManager, repo: MemoryRepository): Hono;
5
+ declare function createApiApp(db: DatabaseManager, repo: MemoryRepository, projectRepo: ProjectRepository): Hono;
6
6
  declare function startDashboard(opts?: {
7
7
  port?: number;
8
8
  }): Promise<void>;
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { DatabaseManager, MemoryRepository } from "@membank/core";
1
+ import { DatabaseManager, MemoryRepository, ProjectRepository } from "@membank/core";
2
2
  import { Hono } from "hono";
3
3
 
4
4
  //#region src/server/index.d.ts
5
- declare function createApiApp(db: DatabaseManager, repo: MemoryRepository): Hono;
5
+ declare function createApiApp(db: DatabaseManager, repo: MemoryRepository, projectRepo: ProjectRepository): Hono;
6
6
  declare function startDashboard(opts?: {
7
7
  port?: number;
8
8
  }): Promise<void>;
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { createServer } from "node:net";
3
3
  import { dirname, extname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { serve } from "@hono/node-server";
6
- import { DatabaseManager, EmbeddingService, MemoryRepository } from "@membank/core";
6
+ import { DatabaseManager, EmbeddingService, MemoryRepository, ProjectRepository } from "@membank/core";
7
7
  import { Hono } from "hono";
8
8
  import open from "open";
9
9
  //#region src/server/index.ts
@@ -21,13 +21,13 @@ const MIME = {
21
21
  ".png": "image/png",
22
22
  ".json": "application/json"
23
23
  };
24
- function parseRow(row) {
24
+ function parseRow(row, projects = []) {
25
25
  return {
26
26
  id: row.id,
27
27
  content: row.content,
28
28
  type: row.type,
29
29
  tags: JSON.parse(row.tags),
30
- scope: row.scope,
30
+ projects,
31
31
  sourceHarness: row.source,
32
32
  accessCount: row.access_count,
33
33
  pinned: row.pinned !== 0,
@@ -59,24 +59,27 @@ async function findFreePort(preferred) {
59
59
  });
60
60
  }
61
61
  }
62
- function createApiApp(db, repo) {
62
+ function createApiApp(db, repo, projectRepo) {
63
63
  const app = new Hono();
64
64
  app.get("/api/memories", (c) => {
65
- const { type, pinned, needsReview, search, scope } = c.req.query();
65
+ const { type, pinned, needsReview, search, projectId } = c.req.query();
66
66
  const conditions = [];
67
67
  const params = [];
68
68
  if (type) {
69
- conditions.push("type = ?");
69
+ conditions.push("m.type = ?");
70
70
  params.push(type);
71
71
  }
72
- if (pinned === "true") conditions.push("pinned = 1");
73
- if (needsReview === "true") conditions.push("needs_review = 1");
74
- if (scope) {
75
- conditions.push("scope = ?");
76
- params.push(scope);
72
+ if (pinned === "true") conditions.push("m.pinned = 1");
73
+ if (needsReview === "true") conditions.push("m.needs_review = 1");
74
+ if (projectId === "global") conditions.push("m.id NOT IN (SELECT memory_id FROM memory_projects)");
75
+ else if (projectId) {
76
+ conditions.push("m.id IN (SELECT memory_id FROM memory_projects WHERE project_id = ?)");
77
+ params.push(projectId);
77
78
  }
78
79
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
79
- let memories = db.db.prepare(`SELECT * FROM memories ${where} ORDER BY created_at DESC`).all(...params).map(parseRow);
80
+ const rows = db.db.prepare(`SELECT m.* FROM memories m ${where} ORDER BY m.created_at DESC`).all(...params);
81
+ const projectMap = projectRepo.getProjectsForMemories(rows.map((r) => r.id));
82
+ let memories = rows.map((r) => parseRow(r, projectMap.get(r.id) ?? []));
80
83
  if (search) {
81
84
  const q = search.toLowerCase();
82
85
  memories = memories.filter((m) => m.content.toLowerCase().includes(q));
@@ -84,9 +87,11 @@ function createApiApp(db, repo) {
84
87
  return c.json(memories);
85
88
  });
86
89
  app.get("/api/memories/:id", (c) => {
87
- const row = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(c.req.param("id"));
90
+ const id = c.req.param("id");
91
+ const row = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(id);
88
92
  if (!row) return c.json({ error: "Not found" }, 404);
89
- return c.json(parseRow(row));
93
+ const projectMap = projectRepo.getProjectsForMemories([id]);
94
+ return c.json(parseRow(row, projectMap.get(id) ?? []));
90
95
  });
91
96
  app.patch("/api/memories/:id", async (c) => {
92
97
  const id = c.req.param("id");
@@ -116,12 +121,35 @@ function createApiApp(db, repo) {
116
121
  tags: body.tags
117
122
  });
118
123
  const updated = db.db.prepare("SELECT * FROM memories WHERE id = ?").get(id);
119
- return c.json(parseRow(updated));
124
+ const projectMap = projectRepo.getProjectsForMemories([id]);
125
+ return c.json(parseRow(updated, projectMap.get(id) ?? []));
120
126
  });
121
127
  app.delete("/api/memories/:id", async (c) => {
122
128
  await repo.delete(c.req.param("id"));
123
129
  return c.json({ ok: true });
124
130
  });
131
+ app.post("/api/memories/:id/projects", async (c) => {
132
+ const memoryId = c.req.param("id");
133
+ const body = await c.req.json();
134
+ projectRepo.addAssociation(memoryId, body.projectId);
135
+ return c.json({ ok: true });
136
+ });
137
+ app.delete("/api/memories/:id/projects/:projectId", (c) => {
138
+ projectRepo.removeAssociation(c.req.param("id"), c.req.param("projectId"));
139
+ return c.json({ ok: true });
140
+ });
141
+ app.get("/api/projects", (c) => {
142
+ return c.json(projectRepo.list());
143
+ });
144
+ app.patch("/api/projects/:id", async (c) => {
145
+ const id = c.req.param("id");
146
+ const body = await c.req.json();
147
+ try {
148
+ return c.json(projectRepo.rename(id, body.name));
149
+ } catch {
150
+ return c.json({ error: "Not found" }, 404);
151
+ }
152
+ });
125
153
  app.get("/api/stats", (c) => {
126
154
  const byType = {
127
155
  correction: 0,
@@ -147,7 +175,9 @@ function createApiApp(db, repo) {
147
175
  async function startDashboard(opts) {
148
176
  const port = await findFreePort(opts?.port ?? PREFERRED_PORT);
149
177
  const db = DatabaseManager.open();
150
- const app = createApiApp(db, new MemoryRepository(db, new EmbeddingService()));
178
+ const embedding = new EmbeddingService();
179
+ const projects = new ProjectRepository(db);
180
+ const app = createApiApp(db, new MemoryRepository(db, embedding, projects), projects);
151
181
  const clientDir = join(dirname(fileURLToPath(import.meta.url)), "client");
152
182
  app.get("*", (c) => {
153
183
  const filePath = join(clientDir, c.req.path === "/" ? "/index.html" : c.req.path);