@inkeep/open-knowledge 0.5.0-beta.48 → 0.5.0-beta.49

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.
Files changed (34) hide show
  1. package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
  2. package/dist/cli.mjs +4 -4
  3. package/dist/constants-BvIV9-u3.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-OOHQMBAG.mjs → init-C9ho5PLw.mjs} +3 -3
  6. package/dist/init-Dft22e1h.mjs +1 -0
  7. package/dist/loader-B5wdvkGE.mjs +1 -0
  8. package/dist/{loader-BeazNH_4.mjs → loader-F8wUMFGk.mjs} +2 -2
  9. package/dist/preview-DIuZwdT3.mjs +1 -0
  10. package/dist/{preview-D4eVomfX.mjs → preview-DM4jIpLN.mjs} +2 -2
  11. package/dist/public/assets/{ActivityModeContent-fhFzM0sk.js → ActivityModeContent-B8J4OFHO.js} +1 -1
  12. package/dist/public/assets/ConsentDialogBody-Dfx6N7pC.js +2 -0
  13. package/dist/public/assets/{DocumentContext-LS9HBbXh.js → DocumentContext-fSMev29P.js} +2 -2
  14. package/dist/public/assets/McpConsentDialogBody-fka4wJP7.js +1 -0
  15. package/dist/public/assets/{SettingsDialogBody-alvj4xbx.js → SettingsDialogBody-8zs3jwhI.js} +1 -1
  16. package/dist/public/assets/{SourceEditor-CuJQDNNo.js → SourceEditor-BCHJFeGa.js} +1 -1
  17. package/dist/public/assets/{config-validation-events-Dxvq0Gmu.js → config-validation-events-BtPgkHlf.js} +1 -1
  18. package/dist/public/assets/{index-Dhi_j7Vk.js → index-BZCMU4ot.js} +6 -6
  19. package/dist/public/assets/{index-BgKCFonW.css → index-D9afOIIc.css} +1 -1
  20. package/dist/public/assets/{typing-burst-detector-mzjjQOqs.js → typing-burst-detector-Cm3a_0Rp.js} +1 -1
  21. package/dist/public/index.html +5 -5
  22. package/dist/{repair-launch-json-DKyFyGxy.mjs → repair-launch-json-yfbhku73.mjs} +2 -2
  23. package/dist/{repair-mcp-configs-Bd5strDU.mjs → repair-mcp-configs-3DOkuM0T.mjs} +2 -2
  24. package/dist/{src-C0OBIJW_.mjs → src-6iWoC0XU.mjs} +2 -2
  25. package/dist/{start-BvMp3jiu.mjs → start-CO8Evcw9.mjs} +2 -2
  26. package/dist/start-Caiq4CNh.mjs +1 -0
  27. package/package.json +1 -1
  28. package/dist/constants-xPQnQB6p.mjs +0 -2
  29. package/dist/init-Bp6innPX.mjs +0 -1
  30. package/dist/loader-uwvpQlbv.mjs +0 -1
  31. package/dist/preview-DMNyrQqL.mjs +0 -1
  32. package/dist/public/assets/ConsentDialogBody-CSNo2n5l.js +0 -2
  33. package/dist/public/assets/McpConsentDialogBody-Cp08S9eY.js +0 -1
  34. package/dist/start-BvYwQHjm.mjs +0 -1
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{t as i}from"./button-DBLnjjvQ.js";import{a,c as o,i as s,n as c,o as l,s as u,t as d,x as f}from"./dialog-DSzqKgdW.js";import{t as p}from"./checkbox-kroC1jEP.js";import{t as m}from"./label-CdSs0Skc.js";import{n as h}from"./mcp-consent-store-BPw6Zd40.js";var g=r(),_=e(t(),1),v=n();function y(e){let t=new Set;for(let n of e)n.detected&&t.add(n.id);return t}function b(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function x(e,t){let n=[];for(let r of t)e.has(r.id)&&n.push(r.id);return n}var S={error:e=>f.error(e)};function C(e){let t=(0,g.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?h:r,s=i===void 0?S:i,c;t[2]!==a||t[3]!==o?(c=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c;if(!l)return null;let u;return t[5]!==l||t[6]!==o||t[7]!==s?(u=(0,v.jsx)(w,{payload:l,store:o,toast:s}),t[5]=l,t[6]=o,t[7]=s,t[8]=u):u=t[8],u}function w(e){let t=(0,g.c)(50),{payload:n,store:r,toast:f}=e,h=n.detectedEditors,S;t[0]===h?S=t[1]:(S=()=>y(h),t[0]=h,t[1]=S);let[C,w]=(0,_.useState)(S),[T,E]=(0,_.useState)(!1),D=(0,_.useId)(),O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){w(t=>b(t,e))},t[2]=O):O=t[2];let k=O,A;t[3]!==h||t[4]!==C||t[5]!==r||t[6]!==f?(A=async function(){E(!0);let e=await r.confirm(x(C,h));e.ok||(f.error(e.error),E(!1))},t[3]=h,t[4]=C,t[5]=r,t[6]=f,t[7]=A):A=t[7];let j=A,M;t[8]!==r||t[9]!==f?(M=async function(){E(!0);let e=await r.skip();e.ok||(f.error(e.error),E(!1))},t[8]=r,t[9]=f,t[10]=M):M=t[10];let N=M,P;t[11]!==T||t[12]!==N?(P=function(e){!e&&!T&&N()},t[11]=T,t[12]=N,t[13]=P):P=t[13];let F=P,I;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,v.jsx)(o,{children:`Add Open Knowledge to your AI tools`}),t[14]=I):I=t[14];let L;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,v.jsx)(`code`,{children:`open-knowledge`}),t[15]=L):L=t[15];let R;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,v.jsx)(`code`,{children:`open-knowledge-ui`}),t[16]=R):R=t[16];let z;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,v.jsx)(`code`,{children:`ok`}),t[17]=z):z=t[17];let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,v.jsxs)(u,{children:[I,(0,v.jsxs)(a,{children:[`Open Knowledge manages the `,L,` MCP server name, the`,` `,R,` launch config, and `,z,` /`,` `,(0,v.jsx)(`code`,{children:`open-knowledge`}),` on PATH (including OK-owned symlinks). Using a custom wrapper? Register it under a different name.`]})]}),t[18]=B):B=t[18];let V;if(t[19]!==T||t[20]!==h||t[21]!==D||t[22]!==C){let e;t[24]!==T||t[25]!==D||t[26]!==C?(e=e=>{let t=C.has(e.id),n=`${D}-${e.id}`,r=e.willReplace?`Will replace existing Open Knowledge entry`:e.detected?`Detected on this machine`:`Not detected`,i=e.willReplace?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,v.jsx)(`li`,{children:(0,v.jsxs)(m,{htmlFor:n,className:`flex cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal hover:bg-accent`,children:[(0,v.jsx)(p,{id:n,checked:t,disabled:T,onCheckedChange:()=>k(e.id),className:`mt-0.5`,"data-testid":`mcp-consent-checkbox-${e.id}`}),(0,v.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),(0,v.jsx)(`span`,{className:i,"data-testid":`mcp-consent-status-${e.id}`,children:r})]})]})},e.id)},t[24]=T,t[25]=D,t[26]=C,t[27]=e):e=t[27],V=h.map(e),t[19]=T,t[20]=h,t[21]=D,t[22]=C,t[23]=V}else V=t[23];let H;t[28]===V?H=t[29]:(H=(0,v.jsx)(c,{children:(0,v.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:V})}),t[28]=V,t[29]=H);let U;t[30]===N?U=t[31]:(U=()=>void N(),t[30]=N,t[31]=U);let W;t[32]!==T||t[33]!==U?(W=(0,v.jsx)(i,{variant:`outline`,className:`font-mono uppercase`,onClick:U,disabled:T,"data-testid":`mcp-consent-skip`,children:`Skip`}),t[32]=T,t[33]=U,t[34]=W):W=t[34];let G;t[35]===j?G=t[36]:(G=()=>void j(),t[35]=j,t[36]=G);let K=T||C.size===0,q=T?`Working`:`Add`,J;t[37]!==G||t[38]!==K||t[39]!==q?(J=(0,v.jsx)(i,{onClick:G,disabled:K,"data-testid":`mcp-consent-add`,children:q}),t[37]=G,t[38]=K,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==W||t[42]!==J?(Y=(0,v.jsxs)(l,{children:[W,J]}),t[41]=W,t[42]=J,t[43]=Y):Y=t[43];let X;t[44]!==H||t[45]!==Y?(X=(0,v.jsxs)(s,{className:`sm:max-w-md`,children:[B,H,Y]}),t[44]=H,t[45]=Y,t[46]=X):X=t[46];let Z;return t[47]!==F||t[48]!==X?(Z=(0,v.jsx)(d,{open:!0,onOpenChange:F,children:X}),t[47]=F,t[48]=X,t[49]=Z):Z=t[49],Z}export{C as McpConsentDialogBody,C as default,y as computeInitialSelection,x as selectedIdsOrdered,b as toggleSelectedId};
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{A as a,Cn as o,Sn as s,gn as c,hn as l}from"./DocumentContext-LS9HBbXh.js";import{D as u,E as d,Ln as f,Qn as p,ci as m,ct as h,ii as g,k as _,ni as v,ri as y,s as b,ut as x}from"./doc-hash-CMD_NjP8.js";import{C as S,S as C,g as w,t as T}from"./button-DBLnjjvQ.js";import{B as E,F as D,I as O,L as k,M as A,Mt as j,N as M,Nt as N,O as P,P as F,Q as ee,R as te,U as ne,V as re,W as I,X as ie,Z as ae,_ as oe,a as se,b as ce,c as le,d as ue,dt as de,f as fe,ft as L,g as pe,h as me,i as he,j as ge,l as _e,m as ve,n as ye,nt as be,o as xe,p as Se,rt as Ce,s as we,u as Te,v as Ee,z as De}from"./config-validation-events-Dxvq0Gmu.js";import{C as Oe,S as ke,t as Ae,x as je}from"./dialog-DSzqKgdW.js";import{i as Me}from"./collapsible-L2bca9Ur.js";import{n as Ne,t as Pe}from"./toggle-group-DQWMrY_b.js";import{t as Fe}from"./label-CdSs0Skc.js";var Ie=S(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),R=i(),z=e(n(),1),Le=e=>e.type===`checkbox`,Re=e=>e instanceof Date,B=e=>e==null,ze=e=>typeof e==`object`,V=e=>!B(e)&&!Array.isArray(e)&&ze(e)&&!Re(e),Be=e=>V(e)&&e.target?Le(e.target)?e.target.checked:e.target.value:e,Ve=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),He=e=>{let t=e.constructor&&e.constructor.prototype;return V(t)&&t.hasOwnProperty(`isPrototypeOf`)},Ue=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function H(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(Ue&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(V(e)&&He(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=H(e[t]));return r}var We=e=>/^\w*$/.test(e),U=e=>e===void 0,Ge=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>Ge(e.replace(/["|']|\]/g,``).split(/\.|\[/)),W=(e,t,n)=>{if(!t||!V(e))return n;let r=(We(t)?[t]:Ke(t)).reduce((e,t)=>B(e)?void 0:e[t],e);return U(r)||r===e?U(e[t])?n:e[t]:r},G=e=>typeof e==`boolean`,K=e=>typeof e==`function`,q=(e,t,n)=>{let r=-1,i=We(t)?[t]:Ke(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=V(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},qe={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},Je={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},J={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},Ye=`form`,Xe=`root`,Ze=z.createContext(null);Ze.displayName=`HookFormControlContext`;var Qe=()=>z.useContext(Ze),$e=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==Je.all&&(t._proxyFormState[i]=!r||Je.all),n&&(n[i]=!0),e[i]}});return i},et=typeof window<`u`?z.useLayoutEffect:z.useEffect;function tt(e){let t=Qe(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=z.useState(n._formState),c=z.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return et(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),z.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),z.useMemo(()=>$e(o,n,c.current,!1),[o,n])}var Y=e=>typeof e==`string`,nt=(e,t,n,r,i)=>Y(e)?(r&&t.watch.add(e),W(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),W(n,e))):(r&&(t.watchAll=!0),n),rt=e=>B(e)||!ze(e);function X(e,t,n=new WeakSet){if(e===t)return!0;if(rt(e)||rt(t))return Object.is(e,t);if(Re(e)&&Re(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(Re(r)&&Re(e)||(V(r)||Array.isArray(r))&&(V(e)||Array.isArray(e))?!X(r,e,n):!Object.is(r,e))return!1}}return!0}function it(e){let t=Qe(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=z.useRef(i),l=z.useRef(s),u=z.useRef(void 0),d=z.useRef(n),f=z.useRef(r);l.current=s;let[p,m]=z.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=z.useCallback(e=>{let t=nt(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=z.useCallback(e=>{if(!a){let t=nt(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);X(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);et(()=>((d.current!==n||!X(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),z.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=z.useMemo(()=>{if(a)return null;let e=!_&&!X(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function at(e){let t=Qe(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Ve(i._names.array,n),l=it({control:i,name:n,defaultValue:z.useMemo(()=>W(i._formValues,n,W(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=tt({control:i,name:n,exact:s}),d=z.useRef(e),f=z.useRef(i.register(n,{...e.rules,value:l,...G(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let p=z.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!W(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!W(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!W(u.validatingFields,n)},error:{enumerable:!0,get:()=>W(u.errors,n)}}),[u,n]),m=z.useCallback(e=>f.current.onChange({target:{value:Be(e),name:n},type:qe.CHANGE}),[n]),h=z.useCallback(()=>f.current.onBlur({target:{value:W(i._formValues,n),name:n},type:qe.BLUR}),[n,i._formValues]),g=z.useCallback(e=>{let t=W(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>K(e.focus)&&e.focus(),select:()=>K(e.select)&&e.select(),setCustomValidity:t=>K(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>K(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),_=z.useMemo(()=>({name:n,value:l,...G(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:m,onBlur:h,ref:g}),[n,r,u.disabled,m,h,g,l]);return z.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...G(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=W(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=H(W(i._options.defaultValues,n,d.current.defaultValue));q(i._defaultValues,n,e),U(W(i._formValues,n))&&q(i._formValues,n,e)}return!c&&i.register(n),()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),z.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),z.useMemo(()=>({field:_,formState:u,fieldState:p}),[_,u,p])}var ot=e=>e.render(at(e)),st=z.createContext(null);st.displayName=`HookFormContext`;var ct=()=>z.useContext(st),lt=e=>{let{children:t,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}=e,v=z.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[o,m,l,i,r,f,h,d,u,a,g,s,_,c,p,n]);return z.createElement(st.Provider,{value:v},z.createElement(Ze.Provider,{value:v.control},t))},ut=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},dt=e=>Array.isArray(e)?e:[e],ft=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function pt(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&V(i)&&a){let e=pt(i,a);V(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var Z=e=>V(e)&&!Object.keys(e).length,mt=e=>e.type===`file`,ht=e=>{if(!Ue)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gt=e=>e.type===`select-multiple`,_t=e=>e.type===`radio`,vt=e=>_t(e)||Le(e),yt=e=>ht(e)&&e.isConnected;function bt(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(B(e)){e=void 0;break}e=e[t[r]],r++}return e}function xt(e){for(let t in e)if(e.hasOwnProperty(t)&&!U(e[t]))return!1;return!0}function Q(e,t){if(Y(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:We(t)?[t]:Ke(t),r=n.length===1?e:bt(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(V(r)&&Z(r)||Array.isArray(r)&&xt(r))&&Q(e,n.slice(0,-1)),e}var St=e=>{for(let t in e)if(K(e[t]))return!0;return!1};function Ct(e){return Array.isArray(e)||V(e)&&!St(e)}function wt(e,t={}){for(let n in e){let r=e[n];Ct(r)?(t[n]=Array.isArray(r)?[]:{},wt(r,t[n])):U(r)||(t[n]=!0)}return t}function Tt(e,t,n){n||=wt(t);for(let r in e){let i=e[r];if(Ct(i))U(t)||rt(n[r])?n[r]=wt(i,Array.isArray(i)?[]:{}):Tt(i,B(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!X(i,e)}}return n}var Et={value:!1,isValid:!1},Dt={value:!0,isValid:!0},Ot=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===``?Dt:{value:e[0].value,isValid:!0}:Dt:Et}return Et},kt=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>U(e)?e:t?e===``?NaN:e&&+e:n&&Y(e)?new Date(e):r?r(e):e,At={isValid:!1,value:null},jt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,At):At;function Mt(e){let t=e.ref;return mt(t)?t.files:_t(t)?jt(e.refs).value:gt(t)?[...t.selectedOptions].map(({value:e})=>e):Le(t)?Ot(e.refs).value:kt(U(t.value)?e.ref.value:t.value,e)}var Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Pt=(e,t,n,r)=>{let i={};for(let n of e){let e=W(t,n);e&&q(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Ft=e=>e instanceof RegExp,It=e=>U(e)?e:Ft(e)?e.source:V(e)?Ft(e.value)?e.value.source:e.value:e,Lt=e=>({isOnSubmit:!e||e===Je.onSubmit,isOnBlur:e===Je.onBlur,isOnChange:e===Je.onChange,isOnAll:e===Je.all,isOnTouch:e===Je.onTouched}),Rt=`AsyncFunction`,zt=e=>!!e&&!!e.validate&&!!(K(e.validate)&&e.validate.constructor.name===Rt||V(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Rt)),Bt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Vt=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),Ht=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=W(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(Ht(a,t))break}else if(V(a)&&Ht(a,t))break}}};function Ut(e,t,n){let r=W(e,n);if(r||We(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=W(t,r),o=W(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Wt=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return Z(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||Je.all))},Gt=(e,t,n)=>!e||!t||e===t||dt(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),Kt=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,qt=(e,t)=>!Ge(W(e,t)).length&&Q(e,t),Jt=(e,t,n)=>{let r=dt(W(e,n));return q(r,Xe,t[n]),q(e,n,r),e};function Yt(e,t,n=`validate`){if(Y(e)||Array.isArray(e)&&e.every(Y)||G(e)&&!e)return{type:n,message:Y(e)?e:``,ref:t}}var Xt=e=>V(e)&&!Ft(e)?e:{value:e,message:``},Zt=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=W(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(G(e)?``:e||``),y.reportValidity())},x={},S=_t(o),C=Le(o),w=S||C,T=(g||mt(o))&&U(o.value)&&U(v)||ht(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length||g&&typeof v==`number`&&isNaN(v),E=ut.bind(null,h,r,x),D=(e,t,n,r=J.maxLength,i=J.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||B(v))||G(v)&&!v||C&&!Ot(s).isValid||S&&!jt(s).isValid)){let{value:e,message:t}=Y(c)?{value:!!c,message:c}:Xt(c);if(e&&(x[h]={type:J.required,message:t,ref:y,...E(J.required,t)},!r))return b(t),x}if(!T&&(!B(d)||!B(f))){let e,t,n=Xt(f),i=Xt(d);if(!B(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;B(n.value)||(e=r>n.value),B(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;Y(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),Y(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,J.max,J.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(Y(v)||a&&Array.isArray(v))){let e=Xt(l),t=Xt(u),n=!B(e.value)&&v.length>+e.value,i=!B(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&Y(v)){let{value:e,message:t}=Xt(p);if(Ft(e)&&!v.match(e)&&(x[h]={type:J.pattern,message:t,ref:o,...E(J.pattern,t)},!r))return b(t),x}if(m){if(K(m)){let e=Yt(await m(v,n),y);if(e&&(x[h]={...e,...E(J.validate,e.message)},!r))return b(e.message),x}else if(V(m)){let e={};for(let t in m){if(!Z(e)&&!r)break;let i=Yt(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!Z(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},Qt={mode:Je.onSubmit,reValidateMode:Je.onChange,shouldFocusError:!0};function $t(e={}){let t={...Qt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:K(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(V(t.defaultValues)||V(t.values))&&H(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:H(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:ft(),state:ft()},m=t.criteriaMode===Je.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=Z((await T()).errors),_()):e=await O({fields:r,onlyCheckValid:!0,eventType:qe.VALID}),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?q(n.validatingFields,e,r):Q(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Z(n.validatingFields)}))},v=e=>{let t=Tt(i,a),r=Nt(e);q(n.dirtyFields,r,W(t,r))},y=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(W(r,e))){let t=s(W(r,e),c.argA,c.argB);l&&q(r,e,t)}if(u&&Array.isArray(W(n.errors,e))){let t=s(W(n.errors,e),c.argA,c.argB);l&&q(n.errors,e,t),qt(n.errors,e)}if((d.touchedFields||f.touchedFields)&&u&&Array.isArray(W(n.touchedFields,e))){let t=s(W(n.touchedFields,e),c.argA,c.argB);l&&q(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&v(e),p.state.next({name:e,isDirty:A(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else q(a,e,i)},b=(e,t)=>{q(n.errors,e,t),p.state.next({errors:n.errors})},x=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},S=(e,t,n,s)=>{let c=W(r,e);if(c){let r=W(a,e,U(n)?W(i,e):n);U(r)||s&&s.defaultChecked||t?q(a,e,t?r:Mt(c._f)):N(e,r),o.mount&&!o.action&&g()}},C=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=A(),c=l!==u.isDirty);let t=X(W(i,e),r);l=!!W(n.dirtyFields,e),t?Q(n.dirtyFields,e):q(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=W(n.touchedFields,e);t||(q(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},w=(e,r,i,a)=>{let o=W(n.errors,e),s=(d.isValid||f.isValid)&&G(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>b(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?q(n.errors,e,i):Q(n.errors,e)),(i?!X(o,i):o)||!Z(a)||s){let t={...a,...s&&G(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},T=async e=>(_(e,!0),await t.resolver(a,t.context,Pt(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),E=async e=>{let{errors:t}=await T(e);if(_(e),e)for(let r of e){let e=W(t,r);e?q(n.errors,r,e):Q(n.errors,r)}else n.errors=t;return t},D=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(V(i))for(let e in i)i[e]&&oe(`${Ye}.${e}`,{message:Y(i.message)?i.message:``,type:J.validate});else Y(i)||!i?oe(Ye,{message:i||``,type:J.validate}):ae(Ye);return i}return!0},O=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await D({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...f}=u;if(r){let o=s.array.has(r.name),c=u._f&&zt(u._f);c&&d.validatingFields&&_([r.name],!0);let f=await Zt(u,s.disabled,a,m,t.shouldUseNativeValidation&&!i,o);if(c&&d.validatingFields&&_([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(W(f,r.name)?o?Jt(n.errors,f,r.name):q(n.errors,r.name,f[r.name]):Q(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!Z(f)&&await O({context:l,onlyCheckValid:i,fields:f,name:o,eventType:c})}}return l.valid},k=()=>{for(let e of s.unMount){let t=W(r,e);t&&(t._f.refs?t._f.refs.every(e=>!yt(e)):!yt(t._f.ref))&&ue(e)}s.unMount=new Set},A=(e,n)=>!t.disabled&&(e&&n&&q(a,e,n),!X(I(),i)),j=(e,t,n)=>nt(e,s,{...o.mount?a:U(t)?i:Y(e)?{[e]:t}:t},n,t),M=e=>Ge(W(o.mount?a:i,e,t.shouldUnregister?W(i,e,[]):[])),N=(e,t,n={})=>{let i=W(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&q(a,e,kt(t,n)),o=ht(n.ref)&&B(t)?``:t,gt(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?Le(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):mt(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:H(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&re(e)},P=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=W(r,o);(s.array.has(e)||V(a)||c&&!c._f)&&!Re(a)?P(o,a,n):N(o,a,n)}},F=(e,t,i={})=>{let c=W(r,e),l=s.array.has(e),u=H(t),d=X(W(a,e),u);if(q(a,e,u),l)p.array.next({name:e,values:H(a)}),i.shouldDirty&&(v(e),p.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:A(e,u)}));else{let t=Array.isArray(u)&&!u.length||Z(u);!c||c._f||B(u)||t?N(e,u,i):P(e,u,i)}d||(Vt(e,s)?p.state.next({...n,name:e,values:H(a)}):p.state.next({name:o.mount?e:void 0,values:H(a)}))},ee=e=>{let t=K(e)?e(a):e;X(a,t)||(a={...a,...t},p.state.next({...n,values:a}))},te=async i=>{o.mount=!0;let l=i.target,u=l.name,h=!0,v=W(r,u),y=e=>{h=Number.isNaN(e)||Re(e)&&isNaN(e.getTime())||X(e,W(a,u,e))},b=Lt(t.mode),x=Lt(t.reValidateMode);if(v){let o,S,E=l.type?Mt(v._f):Be(i),k=i.type===qe.BLUR||i.type===qe.FOCUS_OUT,A=!Bt(v._f)&&!e.validate&&!t.resolver&&!W(n.errors,u)&&!v._f.deps||Kt(k,W(n.touchedFields,u),n.isSubmitted,x,b),j=Vt(u,s,k);q(a,u,E),k?(!l||!l.readOnly)&&(v._f.onBlur&&v._f.onBlur(i),c&&c(0)):v._f.onChange&&v._f.onChange(i);let M=C(u,E,k),N=!Z(M)||j;if(!k&&p.state.next({name:u,type:i.type,values:H(a)}),A)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?k&&g():k||g()),N&&p.state.next({name:u,...j?{}:M});if(!t.resolver&&e.validate&&await D({name:u,eventType:i.type}),!k&&j&&p.state.next({...n}),t.resolver){let{errors:e}=await T([u]);if(_([u]),y(E),h){let t=Ut(n.errors,r,u),i=Ut(e,r,t.name||u);o=i.error,u=i.name,S=Z(e)}}else _([u],!0),o=(await Zt(v,s.disabled,a,m,t.shouldUseNativeValidation))[u],_([u]),y(E),h&&(o?S=!1:(d.isValid||f.isValid)&&(S=await O({fields:r,onlyCheckValid:!0,name:u,eventType:i.type})));h&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&re(v._f.deps),w(u,S,o,M))}},ne=(e,t)=>{if(W(n.errors,t)&&e.focus)return e.focus(),1},re=async(e,i={})=>{let a,o,c=dt(e);if(t.resolver){let t=await E(U(e)?e:c);a=Z(t),o=e?!c.some(e=>W(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=W(r,e);return await O({fields:t&&t._f?{[e]:t}:t,eventType:qe.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await O({fields:r,name:e,eventType:qe.TRIGGER});return p.state.next({...!Y(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&Ht(r,ne,e?c:s.mount),o},I=(e,t)=>{let r={...o.mount?a:i};return t&&(r=pt(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),U(e)?r:Y(e)?W(r,e):e.map(e=>W(r,e))},ie=(e,t)=>({invalid:!!W((t||n).errors,e),isDirty:!!W((t||n).dirtyFields,e),error:W((t||n).errors,e),isValidating:!!W(n.validatingFields,e),isTouched:!!W((t||n).touchedFields,e)}),ae=e=>{let t=e?dt(e):void 0;t?.forEach(e=>Q(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},oe=(e,t,i)=>{let a=(W(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=W(n.errors,e)||{};q(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},se=(e,t)=>K(e)?p.state.subscribe({next:n=>`values`in n&&e(n.values||j(void 0,t),n)}):j(e,t,!0),ce=e=>p.state.subscribe({next:t=>{if(Gt(e.name,t.name,e.exact)&&Wt(t,e.formState||d,ye,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}}).unsubscribe,le=e=>(o.mount=!0,f={...f,...e.formState},ce({...e,formState:{...u,...e.formState}})),ue=(e,o={})=>{for(let c of e?dt(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(Q(r,c),Q(a,c)),!o.keepError&&Q(n.errors,c),!o.keepDirty&&Q(n.dirtyFields,c),!o.keepTouched&&Q(n.touchedFields,c),!o.keepIsValidating&&Q(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&Q(i,c);p.state.next({values:H(a)}),p.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&g()},de=({disabled:e,name:t})=>{if(G(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},fe=(e,n={})=>{let a=W(r,e),c=G(n.disabled)||G(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return q(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?de({disabled:G(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:It(n.min),max:It(n.max),minLength:It(n.minLength),maxLength:It(n.maxLength),pattern:It(n.pattern)}:{},name:e,onChange:te,onBlur:te,ref:c=>{if(c){s.registerName.add(e),fe(e,n),s.registerName.delete(e),a=W(r,e);let t=U(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=vt(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;q(r,e,{_f:{...a._f,...o?{refs:[...l.filter(yt),t,...Array.isArray(W(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=W(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Ve(s.array,e)&&o.action)&&s.unMount.add(e)}}},L=()=>t.shouldFocusError&&Ht(r,ne,s.mount),pe=e=>{G(e)&&(p.state.next({disabled:e}),Ht(r,(t,n)=>{let i=W(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},me=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=H(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await T();_(),n.errors=e,l=H(t)}else await O({fields:r,eventType:qe.SUBMIT});if(s.disabled.size)for(let e of s.disabled)Q(l,e);if(Q(n.errors,Xe),Z(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),L(),setTimeout(L);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},he=(e,t={})=>{W(r,e)&&(U(t.defaultValue)?F(e,H(W(i,e))):(F(e,t.defaultValue),q(i,e,H(t.defaultValue))),t.keepTouched||Q(n.touchedFields,e),t.keepDirty||(Q(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,H(W(i,e))):A()),t.keepError||(Q(n.errors,e),d.isValid&&g()),p.state.next({...n}))},ge=(e,c={})=>{let l=e?H(e):i,u=H(l),f=Z(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(Tt(i,a))]);for(let t of Array.from(e)){let e=W(n.dirtyFields,t),r=W(a,t),i=W(m,t);e&&!U(r)?q(m,t,r):!e&&!U(i)&&F(t,i)}}else{if(Ue&&U(e))for(let e of s.mount){let t=W(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ht(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)F(e,W(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?H(i):{}:H(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!Z(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!X(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?Tt(i,a):n.dirtyFields:c.keepDefaultValues&&e?Tt(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},_e=(e,n)=>ge(K(e)?e(a):e,{...t.resetOptions,...n}),ve=(e,t={})=>{let n=W(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&K(e.select)&&e.select()})}},ye=e=>{n={...n,...e}},be={control:{register:fe,unregister:ue,getFieldState:ie,handleSubmit:me,setError:oe,_subscribe:ce,_runSchema:T,_updateIsValidating:_,_focusError:L,_getWatch:j,_getDirty:A,_setValid:g,_setFieldArray:y,_setDisabledField:de,_setErrors:x,_getFieldArray:M,_reset:ge,_resetDefaultValues:()=>K(t.defaultValues)&&t.defaultValues().then(e=>{_e(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:pe,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:le,trigger:re,register:fe,handleSubmit:me,watch:se,setValue:F,setValues:ee,getValues:I,reset:_e,resetField:he,clearErrors:ae,unregister:ue,setError:oe,setFocus:ve,getFieldState:ie};return{...be,formControl:be}}function en(e={}){let t=z.useRef(void 0),n=z.useRef(void 0),[r,i]=z.useState({isDirty:!1,isValidating:!1,isLoading:K(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:K(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!K(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=$t(e);t.current={...i,formState:r}}let a=t.current.control;return a._options=e,et(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),z.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),z.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),z.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),z.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),z.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),z.useEffect(()=>{e.values&&!X(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),z.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=z.useMemo(()=>$e(r,a),[a,r]),t.current}var $=r(),tn=lt,nn=z.createContext({}),rn=e=>{let t=(0,R.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(ot,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(nn.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},an=()=>{let e=(0,R.c)(13),t=z.use(nn),n=z.use(on),{getFieldState:r}=ct(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=tt(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},on=z.createContext({});function sn(e){let t=(0,R.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=z.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=C(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(on.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function cn(e){let t=(0,R.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formItemId:a}=an(),o=!!i,s;t[3]===n?s=t[4]:(s=C(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(Fe,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ln(e){let t=(0,R.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=an(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(w,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function un(e){let t=(0,R.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{formDescriptionId:i}=an(),a;t[3]===n?a=t[4]:(a=C(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function dn(e){let t=(0,R.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formMessageId:a}=an(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=C(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}var fn=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),pn=new Map;function mn(e){let t=pn.get(e);if(t)return pn.delete(e),pn.set(e,t),t;let n=(0,fn.default)();if(n.add(e),pn.set(e,n),pn.size>256){let e=pn.keys().next().value;e!==void 0&&pn.delete(e)}return n}function hn(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=mn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var gn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function _n(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:gn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:gn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:gn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:gn[`trailing-backslash`]}),vn(n,`[`)>vn(n,`]`)&&t.push({code:`unmatched-bracket`,message:gn[`unmatched-bracket`]}),t}function vn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var yn=`https://openknowledge.ai/docs/features/ignore-patterns`,bn=1200,xn=150,Sn=150,Cn=5e3,wn=600,Tn=400,En=`okignore-show-advanced`;function Dn(e){let t=(0,R.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(On,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(kn,{binding:n}),t[1]=n,t[2]=i),i}function On(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:`Ignore patterns`}),(0,$.jsx)(L,{className:`h-4 w-72`})]}),(0,$.jsx)(L,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function kn(e){let t=(0,R.c)(70),{binding:n}=e,r;t[0]===n?r=t[1]:(r=()=>n.current(),t[0]=n,t[1]=r);let[i,a]=(0,z.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>n.subscribe(e=>{a(e)}),s=[n],t[2]=n,t[3]=o,t[4]=s),(0,z.useEffect)(o,s);let{pages:c,pageMeta:l,assetPaths:u}=b(),d;t[5]!==u||t[6]!==l||t[7]!==c?(d=Qn(c,l,u),t[5]=u,t[6]=l,t[7]=c,t[8]=d):d=t[8];let p=d,m,h;t[9]===i?(m=t[10],h=t[11]):(m=Te(i),h=_e(m),t[9]=i,t[10]=m,t[11]=h);let g=h,_=g.length===0,[v,y]=(0,z.useState)(null),x=(0,z.useRef)(null),S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>()=>{x.current&&clearTimeout(x.current)},C=[],t[12]=S,t[13]=C):(S=t[12],C=t[13]),(0,z.useEffect)(S,C);let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{y({key:e,ts:Date.now()}),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>y(null),bn)},t[14]=w):w=t[14];let T=w,[E,k]=(0,z.useState)(null),A=(0,z.useRef)(null),j,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{A.current&&clearTimeout(A.current)},j=[],t[15]=j,t[16]=M):(j=t[15],M=t[16]),(0,z.useEffect)(M,j);let N,P;t[17]===n?(N=t[18],P=t[19]):(N=()=>ye(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),P=[n],t[17]=n,t[18]=N,t[19]=P),(0,z.useEffect)(N,P);let F,ee;t[20]===n?(F=t[21],ee=t[22]):(F=()=>n.subscribeRejection(e=>{let{error:t}=e,n=Jn(t);k({message:n?.detail??f(t),lineNumber:n?.lineNumber,ts:Date.now()}),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>k(null),Cn)}),ee=[n],t[20]=n,t[21]=F,t[22]=ee),(0,z.useEffect)(F,ee);let ne;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[23]=ne):ne=t[23],(0,z.useEffect)(An,ne);let re;t[24]===n?re=t[25]:(re=e=>{n.patch(e)},t[24]=n,t[25]=re);let I=re,ie;t[26]!==I||t[27]!==m||t[28]!==g?(ie=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){I(Se(ue(m,e)));return}I(Se(we(m,e,n))),T(qn(n,e))}},t[26]=I,t[27]=m,t[28]=g,t[29]=ie):ie=t[29];let ae=ie,oe;t[30]!==I||t[31]!==m?(oe=e=>{I(Se(ue(m,e)))},t[30]=I,t[31]=m,t[32]=oe):oe=t[32];let se=oe,ce;t[33]!==I||t[34]!==m||t[35]!==g.length?(ce=e=>{let t=e.trim();if(t.length===0)return;let n=le(m,t);if(n>=0){T(qn(t,n));return}I(Se(xe(m,t))),T(qn(t,g.length))},t[33]=I,t[34]=m,t[35]=g.length,t[36]=ce):ce=t[36];let de=ce,L;t[37]!==I||t[38]!==m?(L=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=Kn(t),i=Kn(n);r<0||i<0||r===i||I(Se(fe(m,r,i)))},t[37]=I,t[38]=m,t[39]=L):L=t[39];let pe=L,me;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:4}},t[40]=me):me=t[40];let he;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ge},t[41]=he):he=t[41];let ve=De(te(O,me),te(D,he)),be=E===null?null:`rejection-${E.ts}`,[Ce,Ee]=tr(),Oe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:`Ignore patterns`}),t[42]=Oe):Oe=t[42];let ke;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[Oe,(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools.`,` `,(0,$.jsx)(`a`,{href:yn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`,children:`Learn more about patterns`}),`.`]})]}),t[43]=ke):ke=t[43];let Ae;t[44]===E?Ae=t[45]:(Ae=E===null?null:(0,$.jsx)(Pn,{rejection:E}),t[44]=E,t[45]=Ae);let je;t[46]!==n||t[47]!==p||t[48]!==de||t[49]!==pe||t[50]!==ae||t[51]!==se||t[52]!==_||t[53]!==g||t[54]!==be||t[55]!==v||t[56]!==ve||t[57]!==Ce||t[58]!==i?(je=Ce?(0,$.jsx)(Mn,{binding:n,text:i}):_?(0,$.jsx)(Fn,{onAdd:de,rejectionFlashKey:be,filePaths:p}):(0,$.jsx)(In,{patterns:g,sensors:ve,onDragEnd:pe,onEdit:ae,onRemove:se,onAdd:de,savedFlash:v,rejectionFlashKey:be,filePaths:p}),t[46]=n,t[47]=p,t[48]=de,t[49]=pe,t[50]=ae,t[51]=se,t[52]=_,t[53]=g,t[54]=be,t[55]=v,t[56]=ve,t[57]=Ce,t[58]=i,t[59]=je):je=t[59];let Me;t[60]!==Ee||t[61]!==Ce?(Me=()=>Ee(!Ce),t[60]=Ee,t[61]=Ce,t[62]=Me):Me=t[62];let Ne;t[63]!==Ce||t[64]!==Me?(Ne=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Nn,{enabled:Ce,onToggle:Me})}),t[63]=Ce,t[64]=Me,t[65]=Ne):Ne=t[65];let Pe;return t[66]!==Ae||t[67]!==je||t[68]!==Ne?(Pe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[ke,Ae,je,Ne]}),t[66]=Ae,t[67]=je,t[68]=Ne,t[69]=Pe):Pe=t[69],Pe}function An(){return he(jn)}function jn(e){je.error(`Nested .okignore error in ${e.path}`,{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}function Mn(e){let t=(0,R.c)(25),{binding:n,text:r}=e,[i,a]=(0,z.useState)(r),o=(0,z.useRef)(r),s=(0,z.useRef)(!1),c=(0,z.useRef)(r),l=(0,z.useRef)(null),u,d;t[0]===r?(u=t[1],d=t[2]):(u=()=>{s.current||r!==o.current&&(a(r),c.current=r,o.current=r)},d=[r],t[0]=r,t[1]=u,t[2]=d),(0,z.useEffect)(u,d);let f,p;t[3]===i?(f=t[4],p=t[5]):(f=()=>{c.current=i},p=[i],t[3]=i,t[4]=f,t[5]=p),(0,z.useEffect)(f,p);let m,h;t[6]===n?(m=t[7],h=t[8]):(m=()=>()=>{l.current&&(clearTimeout(l.current),l.current=null,c.current!==o.current&&(n.patch(c.current),o.current=c.current))},h=[n],t[6]=n,t[7]=m,t[8]=h),(0,z.useEffect)(m,h);let g;t[9]===n?g=t[10]:(g=e=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,e!==o.current&&(o.current=e,n.patch(e))},Tn)},t[9]=n,t[10]=g);let _=g,v;t[11]===n?v=t[12]:(v=()=>{l.current&&=(clearTimeout(l.current),null),c.current!==o.current&&(o.current=c.current,n.patch(c.current))},t[11]=n,t[12]=v);let y=v,b;t[13]===_?b=t[14]:(b=e=>{a(e.target.value),_(e.target.value)},t[13]=_,t[14]=b);let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{s.current=!0},t[15]=x):x=t[15];let S;t[16]===y?S=t[17]:(S=()=>{s.current=!1,y()},t[16]=y,t[17]=S);let C;t[18]===i?C=t[19]:(C=i.split(`
1
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{A as a,Cn as o,Sn as s,gn as c,hn as l}from"./DocumentContext-fSMev29P.js";import{D as u,E as d,Ln as f,Qn as p,ci as m,ct as h,ii as g,k as _,ni as v,ri as y,s as b,ut as x}from"./doc-hash-CMD_NjP8.js";import{C as S,S as C,g as w,t as T}from"./button-DBLnjjvQ.js";import{B as E,F as D,I as O,L as k,M as A,Mt as j,N as M,Nt as N,O as P,P as F,Q as ee,R as te,U as ne,V as re,W as I,X as ie,Z as ae,_ as oe,a as se,b as ce,c as le,d as ue,dt as de,f as fe,ft as L,g as pe,h as me,i as he,j as ge,l as _e,m as ve,n as ye,nt as be,o as xe,p as Se,rt as Ce,s as we,u as Te,v as Ee,z as De}from"./config-validation-events-BtPgkHlf.js";import{C as Oe,S as ke,t as Ae,x as je}from"./dialog-DSzqKgdW.js";import{i as Me}from"./collapsible-L2bca9Ur.js";import{n as Ne,t as Pe}from"./toggle-group-DQWMrY_b.js";import{t as Fe}from"./label-CdSs0Skc.js";var Ie=S(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),R=i(),z=e(n(),1),Le=e=>e.type===`checkbox`,Re=e=>e instanceof Date,B=e=>e==null,ze=e=>typeof e==`object`,V=e=>!B(e)&&!Array.isArray(e)&&ze(e)&&!Re(e),Be=e=>V(e)&&e.target?Le(e.target)?e.target.checked:e.target.value:e,Ve=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),He=e=>{let t=e.constructor&&e.constructor.prototype;return V(t)&&t.hasOwnProperty(`isPrototypeOf`)},Ue=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function H(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(Ue&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(V(e)&&He(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=H(e[t]));return r}var We=e=>/^\w*$/.test(e),U=e=>e===void 0,Ge=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>Ge(e.replace(/["|']|\]/g,``).split(/\.|\[/)),W=(e,t,n)=>{if(!t||!V(e))return n;let r=(We(t)?[t]:Ke(t)).reduce((e,t)=>B(e)?void 0:e[t],e);return U(r)||r===e?U(e[t])?n:e[t]:r},G=e=>typeof e==`boolean`,K=e=>typeof e==`function`,q=(e,t,n)=>{let r=-1,i=We(t)?[t]:Ke(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=V(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},qe={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},Je={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},J={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},Ye=`form`,Xe=`root`,Ze=z.createContext(null);Ze.displayName=`HookFormControlContext`;var Qe=()=>z.useContext(Ze),$e=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==Je.all&&(t._proxyFormState[i]=!r||Je.all),n&&(n[i]=!0),e[i]}});return i},et=typeof window<`u`?z.useLayoutEffect:z.useEffect;function tt(e){let t=Qe(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=z.useState(n._formState),c=z.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return et(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),z.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),z.useMemo(()=>$e(o,n,c.current,!1),[o,n])}var Y=e=>typeof e==`string`,nt=(e,t,n,r,i)=>Y(e)?(r&&t.watch.add(e),W(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),W(n,e))):(r&&(t.watchAll=!0),n),rt=e=>B(e)||!ze(e);function X(e,t,n=new WeakSet){if(e===t)return!0;if(rt(e)||rt(t))return Object.is(e,t);if(Re(e)&&Re(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(Re(r)&&Re(e)||(V(r)||Array.isArray(r))&&(V(e)||Array.isArray(e))?!X(r,e,n):!Object.is(r,e))return!1}}return!0}function it(e){let t=Qe(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=z.useRef(i),l=z.useRef(s),u=z.useRef(void 0),d=z.useRef(n),f=z.useRef(r);l.current=s;let[p,m]=z.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=z.useCallback(e=>{let t=nt(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=z.useCallback(e=>{if(!a){let t=nt(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);X(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);et(()=>((d.current!==n||!X(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),z.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=z.useMemo(()=>{if(a)return null;let e=!_&&!X(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function at(e){let t=Qe(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Ve(i._names.array,n),l=it({control:i,name:n,defaultValue:z.useMemo(()=>W(i._formValues,n,W(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=tt({control:i,name:n,exact:s}),d=z.useRef(e),f=z.useRef(i.register(n,{...e.rules,value:l,...G(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let p=z.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!W(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!W(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!W(u.validatingFields,n)},error:{enumerable:!0,get:()=>W(u.errors,n)}}),[u,n]),m=z.useCallback(e=>f.current.onChange({target:{value:Be(e),name:n},type:qe.CHANGE}),[n]),h=z.useCallback(()=>f.current.onBlur({target:{value:W(i._formValues,n),name:n},type:qe.BLUR}),[n,i._formValues]),g=z.useCallback(e=>{let t=W(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>K(e.focus)&&e.focus(),select:()=>K(e.select)&&e.select(),setCustomValidity:t=>K(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>K(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),_=z.useMemo(()=>({name:n,value:l,...G(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:m,onBlur:h,ref:g}),[n,r,u.disabled,m,h,g,l]);return z.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...G(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=W(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=H(W(i._options.defaultValues,n,d.current.defaultValue));q(i._defaultValues,n,e),U(W(i._formValues,n))&&q(i._formValues,n,e)}return!c&&i.register(n),()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),z.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),z.useMemo(()=>({field:_,formState:u,fieldState:p}),[_,u,p])}var ot=e=>e.render(at(e)),st=z.createContext(null);st.displayName=`HookFormContext`;var ct=()=>z.useContext(st),lt=e=>{let{children:t,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}=e,v=z.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[o,m,l,i,r,f,h,d,u,a,g,s,_,c,p,n]);return z.createElement(st.Provider,{value:v},z.createElement(Ze.Provider,{value:v.control},t))},ut=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},dt=e=>Array.isArray(e)?e:[e],ft=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function pt(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&V(i)&&a){let e=pt(i,a);V(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var Z=e=>V(e)&&!Object.keys(e).length,mt=e=>e.type===`file`,ht=e=>{if(!Ue)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gt=e=>e.type===`select-multiple`,_t=e=>e.type===`radio`,vt=e=>_t(e)||Le(e),yt=e=>ht(e)&&e.isConnected;function bt(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(B(e)){e=void 0;break}e=e[t[r]],r++}return e}function xt(e){for(let t in e)if(e.hasOwnProperty(t)&&!U(e[t]))return!1;return!0}function Q(e,t){if(Y(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:We(t)?[t]:Ke(t),r=n.length===1?e:bt(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(V(r)&&Z(r)||Array.isArray(r)&&xt(r))&&Q(e,n.slice(0,-1)),e}var St=e=>{for(let t in e)if(K(e[t]))return!0;return!1};function Ct(e){return Array.isArray(e)||V(e)&&!St(e)}function wt(e,t={}){for(let n in e){let r=e[n];Ct(r)?(t[n]=Array.isArray(r)?[]:{},wt(r,t[n])):U(r)||(t[n]=!0)}return t}function Tt(e,t,n){n||=wt(t);for(let r in e){let i=e[r];if(Ct(i))U(t)||rt(n[r])?n[r]=wt(i,Array.isArray(i)?[]:{}):Tt(i,B(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!X(i,e)}}return n}var Et={value:!1,isValid:!1},Dt={value:!0,isValid:!0},Ot=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===``?Dt:{value:e[0].value,isValid:!0}:Dt:Et}return Et},kt=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>U(e)?e:t?e===``?NaN:e&&+e:n&&Y(e)?new Date(e):r?r(e):e,At={isValid:!1,value:null},jt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,At):At;function Mt(e){let t=e.ref;return mt(t)?t.files:_t(t)?jt(e.refs).value:gt(t)?[...t.selectedOptions].map(({value:e})=>e):Le(t)?Ot(e.refs).value:kt(U(t.value)?e.ref.value:t.value,e)}var Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Pt=(e,t,n,r)=>{let i={};for(let n of e){let e=W(t,n);e&&q(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Ft=e=>e instanceof RegExp,It=e=>U(e)?e:Ft(e)?e.source:V(e)?Ft(e.value)?e.value.source:e.value:e,Lt=e=>({isOnSubmit:!e||e===Je.onSubmit,isOnBlur:e===Je.onBlur,isOnChange:e===Je.onChange,isOnAll:e===Je.all,isOnTouch:e===Je.onTouched}),Rt=`AsyncFunction`,zt=e=>!!e&&!!e.validate&&!!(K(e.validate)&&e.validate.constructor.name===Rt||V(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Rt)),Bt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Vt=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),Ht=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=W(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(Ht(a,t))break}else if(V(a)&&Ht(a,t))break}}};function Ut(e,t,n){let r=W(e,n);if(r||We(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=W(t,r),o=W(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Wt=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return Z(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||Je.all))},Gt=(e,t,n)=>!e||!t||e===t||dt(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),Kt=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,qt=(e,t)=>!Ge(W(e,t)).length&&Q(e,t),Jt=(e,t,n)=>{let r=dt(W(e,n));return q(r,Xe,t[n]),q(e,n,r),e};function Yt(e,t,n=`validate`){if(Y(e)||Array.isArray(e)&&e.every(Y)||G(e)&&!e)return{type:n,message:Y(e)?e:``,ref:t}}var Xt=e=>V(e)&&!Ft(e)?e:{value:e,message:``},Zt=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=W(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(G(e)?``:e||``),y.reportValidity())},x={},S=_t(o),C=Le(o),w=S||C,T=(g||mt(o))&&U(o.value)&&U(v)||ht(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length||g&&typeof v==`number`&&isNaN(v),E=ut.bind(null,h,r,x),D=(e,t,n,r=J.maxLength,i=J.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||B(v))||G(v)&&!v||C&&!Ot(s).isValid||S&&!jt(s).isValid)){let{value:e,message:t}=Y(c)?{value:!!c,message:c}:Xt(c);if(e&&(x[h]={type:J.required,message:t,ref:y,...E(J.required,t)},!r))return b(t),x}if(!T&&(!B(d)||!B(f))){let e,t,n=Xt(f),i=Xt(d);if(!B(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;B(n.value)||(e=r>n.value),B(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;Y(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),Y(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,J.max,J.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(Y(v)||a&&Array.isArray(v))){let e=Xt(l),t=Xt(u),n=!B(e.value)&&v.length>+e.value,i=!B(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&Y(v)){let{value:e,message:t}=Xt(p);if(Ft(e)&&!v.match(e)&&(x[h]={type:J.pattern,message:t,ref:o,...E(J.pattern,t)},!r))return b(t),x}if(m){if(K(m)){let e=Yt(await m(v,n),y);if(e&&(x[h]={...e,...E(J.validate,e.message)},!r))return b(e.message),x}else if(V(m)){let e={};for(let t in m){if(!Z(e)&&!r)break;let i=Yt(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!Z(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},Qt={mode:Je.onSubmit,reValidateMode:Je.onChange,shouldFocusError:!0};function $t(e={}){let t={...Qt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:K(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(V(t.defaultValues)||V(t.values))&&H(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:H(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:ft(),state:ft()},m=t.criteriaMode===Je.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=Z((await T()).errors),_()):e=await O({fields:r,onlyCheckValid:!0,eventType:qe.VALID}),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?q(n.validatingFields,e,r):Q(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Z(n.validatingFields)}))},v=e=>{let t=Tt(i,a),r=Nt(e);q(n.dirtyFields,r,W(t,r))},y=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(W(r,e))){let t=s(W(r,e),c.argA,c.argB);l&&q(r,e,t)}if(u&&Array.isArray(W(n.errors,e))){let t=s(W(n.errors,e),c.argA,c.argB);l&&q(n.errors,e,t),qt(n.errors,e)}if((d.touchedFields||f.touchedFields)&&u&&Array.isArray(W(n.touchedFields,e))){let t=s(W(n.touchedFields,e),c.argA,c.argB);l&&q(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&v(e),p.state.next({name:e,isDirty:A(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else q(a,e,i)},b=(e,t)=>{q(n.errors,e,t),p.state.next({errors:n.errors})},x=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},S=(e,t,n,s)=>{let c=W(r,e);if(c){let r=W(a,e,U(n)?W(i,e):n);U(r)||s&&s.defaultChecked||t?q(a,e,t?r:Mt(c._f)):N(e,r),o.mount&&!o.action&&g()}},C=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=A(),c=l!==u.isDirty);let t=X(W(i,e),r);l=!!W(n.dirtyFields,e),t?Q(n.dirtyFields,e):q(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=W(n.touchedFields,e);t||(q(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},w=(e,r,i,a)=>{let o=W(n.errors,e),s=(d.isValid||f.isValid)&&G(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>b(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?q(n.errors,e,i):Q(n.errors,e)),(i?!X(o,i):o)||!Z(a)||s){let t={...a,...s&&G(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},T=async e=>(_(e,!0),await t.resolver(a,t.context,Pt(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),E=async e=>{let{errors:t}=await T(e);if(_(e),e)for(let r of e){let e=W(t,r);e?q(n.errors,r,e):Q(n.errors,r)}else n.errors=t;return t},D=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(V(i))for(let e in i)i[e]&&oe(`${Ye}.${e}`,{message:Y(i.message)?i.message:``,type:J.validate});else Y(i)||!i?oe(Ye,{message:i||``,type:J.validate}):ae(Ye);return i}return!0},O=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await D({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...f}=u;if(r){let o=s.array.has(r.name),c=u._f&&zt(u._f);c&&d.validatingFields&&_([r.name],!0);let f=await Zt(u,s.disabled,a,m,t.shouldUseNativeValidation&&!i,o);if(c&&d.validatingFields&&_([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(W(f,r.name)?o?Jt(n.errors,f,r.name):q(n.errors,r.name,f[r.name]):Q(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!Z(f)&&await O({context:l,onlyCheckValid:i,fields:f,name:o,eventType:c})}}return l.valid},k=()=>{for(let e of s.unMount){let t=W(r,e);t&&(t._f.refs?t._f.refs.every(e=>!yt(e)):!yt(t._f.ref))&&ue(e)}s.unMount=new Set},A=(e,n)=>!t.disabled&&(e&&n&&q(a,e,n),!X(I(),i)),j=(e,t,n)=>nt(e,s,{...o.mount?a:U(t)?i:Y(e)?{[e]:t}:t},n,t),M=e=>Ge(W(o.mount?a:i,e,t.shouldUnregister?W(i,e,[]):[])),N=(e,t,n={})=>{let i=W(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&q(a,e,kt(t,n)),o=ht(n.ref)&&B(t)?``:t,gt(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?Le(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):mt(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:H(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&re(e)},P=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=W(r,o);(s.array.has(e)||V(a)||c&&!c._f)&&!Re(a)?P(o,a,n):N(o,a,n)}},F=(e,t,i={})=>{let c=W(r,e),l=s.array.has(e),u=H(t),d=X(W(a,e),u);if(q(a,e,u),l)p.array.next({name:e,values:H(a)}),i.shouldDirty&&(v(e),p.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:A(e,u)}));else{let t=Array.isArray(u)&&!u.length||Z(u);!c||c._f||B(u)||t?N(e,u,i):P(e,u,i)}d||(Vt(e,s)?p.state.next({...n,name:e,values:H(a)}):p.state.next({name:o.mount?e:void 0,values:H(a)}))},ee=e=>{let t=K(e)?e(a):e;X(a,t)||(a={...a,...t},p.state.next({...n,values:a}))},te=async i=>{o.mount=!0;let l=i.target,u=l.name,h=!0,v=W(r,u),y=e=>{h=Number.isNaN(e)||Re(e)&&isNaN(e.getTime())||X(e,W(a,u,e))},b=Lt(t.mode),x=Lt(t.reValidateMode);if(v){let o,S,E=l.type?Mt(v._f):Be(i),k=i.type===qe.BLUR||i.type===qe.FOCUS_OUT,A=!Bt(v._f)&&!e.validate&&!t.resolver&&!W(n.errors,u)&&!v._f.deps||Kt(k,W(n.touchedFields,u),n.isSubmitted,x,b),j=Vt(u,s,k);q(a,u,E),k?(!l||!l.readOnly)&&(v._f.onBlur&&v._f.onBlur(i),c&&c(0)):v._f.onChange&&v._f.onChange(i);let M=C(u,E,k),N=!Z(M)||j;if(!k&&p.state.next({name:u,type:i.type,values:H(a)}),A)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?k&&g():k||g()),N&&p.state.next({name:u,...j?{}:M});if(!t.resolver&&e.validate&&await D({name:u,eventType:i.type}),!k&&j&&p.state.next({...n}),t.resolver){let{errors:e}=await T([u]);if(_([u]),y(E),h){let t=Ut(n.errors,r,u),i=Ut(e,r,t.name||u);o=i.error,u=i.name,S=Z(e)}}else _([u],!0),o=(await Zt(v,s.disabled,a,m,t.shouldUseNativeValidation))[u],_([u]),y(E),h&&(o?S=!1:(d.isValid||f.isValid)&&(S=await O({fields:r,onlyCheckValid:!0,name:u,eventType:i.type})));h&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&re(v._f.deps),w(u,S,o,M))}},ne=(e,t)=>{if(W(n.errors,t)&&e.focus)return e.focus(),1},re=async(e,i={})=>{let a,o,c=dt(e);if(t.resolver){let t=await E(U(e)?e:c);a=Z(t),o=e?!c.some(e=>W(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=W(r,e);return await O({fields:t&&t._f?{[e]:t}:t,eventType:qe.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await O({fields:r,name:e,eventType:qe.TRIGGER});return p.state.next({...!Y(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&Ht(r,ne,e?c:s.mount),o},I=(e,t)=>{let r={...o.mount?a:i};return t&&(r=pt(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),U(e)?r:Y(e)?W(r,e):e.map(e=>W(r,e))},ie=(e,t)=>({invalid:!!W((t||n).errors,e),isDirty:!!W((t||n).dirtyFields,e),error:W((t||n).errors,e),isValidating:!!W(n.validatingFields,e),isTouched:!!W((t||n).touchedFields,e)}),ae=e=>{let t=e?dt(e):void 0;t?.forEach(e=>Q(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},oe=(e,t,i)=>{let a=(W(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=W(n.errors,e)||{};q(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},se=(e,t)=>K(e)?p.state.subscribe({next:n=>`values`in n&&e(n.values||j(void 0,t),n)}):j(e,t,!0),ce=e=>p.state.subscribe({next:t=>{if(Gt(e.name,t.name,e.exact)&&Wt(t,e.formState||d,ye,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}}).unsubscribe,le=e=>(o.mount=!0,f={...f,...e.formState},ce({...e,formState:{...u,...e.formState}})),ue=(e,o={})=>{for(let c of e?dt(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(Q(r,c),Q(a,c)),!o.keepError&&Q(n.errors,c),!o.keepDirty&&Q(n.dirtyFields,c),!o.keepTouched&&Q(n.touchedFields,c),!o.keepIsValidating&&Q(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&Q(i,c);p.state.next({values:H(a)}),p.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&g()},de=({disabled:e,name:t})=>{if(G(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},fe=(e,n={})=>{let a=W(r,e),c=G(n.disabled)||G(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return q(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?de({disabled:G(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:It(n.min),max:It(n.max),minLength:It(n.minLength),maxLength:It(n.maxLength),pattern:It(n.pattern)}:{},name:e,onChange:te,onBlur:te,ref:c=>{if(c){s.registerName.add(e),fe(e,n),s.registerName.delete(e),a=W(r,e);let t=U(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=vt(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;q(r,e,{_f:{...a._f,...o?{refs:[...l.filter(yt),t,...Array.isArray(W(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=W(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Ve(s.array,e)&&o.action)&&s.unMount.add(e)}}},L=()=>t.shouldFocusError&&Ht(r,ne,s.mount),pe=e=>{G(e)&&(p.state.next({disabled:e}),Ht(r,(t,n)=>{let i=W(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},me=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=H(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await T();_(),n.errors=e,l=H(t)}else await O({fields:r,eventType:qe.SUBMIT});if(s.disabled.size)for(let e of s.disabled)Q(l,e);if(Q(n.errors,Xe),Z(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),L(),setTimeout(L);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},he=(e,t={})=>{W(r,e)&&(U(t.defaultValue)?F(e,H(W(i,e))):(F(e,t.defaultValue),q(i,e,H(t.defaultValue))),t.keepTouched||Q(n.touchedFields,e),t.keepDirty||(Q(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,H(W(i,e))):A()),t.keepError||(Q(n.errors,e),d.isValid&&g()),p.state.next({...n}))},ge=(e,c={})=>{let l=e?H(e):i,u=H(l),f=Z(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(Tt(i,a))]);for(let t of Array.from(e)){let e=W(n.dirtyFields,t),r=W(a,t),i=W(m,t);e&&!U(r)?q(m,t,r):!e&&!U(i)&&F(t,i)}}else{if(Ue&&U(e))for(let e of s.mount){let t=W(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ht(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)F(e,W(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?H(i):{}:H(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!Z(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!X(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?Tt(i,a):n.dirtyFields:c.keepDefaultValues&&e?Tt(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},_e=(e,n)=>ge(K(e)?e(a):e,{...t.resetOptions,...n}),ve=(e,t={})=>{let n=W(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&K(e.select)&&e.select()})}},ye=e=>{n={...n,...e}},be={control:{register:fe,unregister:ue,getFieldState:ie,handleSubmit:me,setError:oe,_subscribe:ce,_runSchema:T,_updateIsValidating:_,_focusError:L,_getWatch:j,_getDirty:A,_setValid:g,_setFieldArray:y,_setDisabledField:de,_setErrors:x,_getFieldArray:M,_reset:ge,_resetDefaultValues:()=>K(t.defaultValues)&&t.defaultValues().then(e=>{_e(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:pe,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:le,trigger:re,register:fe,handleSubmit:me,watch:se,setValue:F,setValues:ee,getValues:I,reset:_e,resetField:he,clearErrors:ae,unregister:ue,setError:oe,setFocus:ve,getFieldState:ie};return{...be,formControl:be}}function en(e={}){let t=z.useRef(void 0),n=z.useRef(void 0),[r,i]=z.useState({isDirty:!1,isValidating:!1,isLoading:K(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:K(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!K(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=$t(e);t.current={...i,formState:r}}let a=t.current.control;return a._options=e,et(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),z.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),z.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),z.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),z.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),z.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),z.useEffect(()=>{e.values&&!X(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),z.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=z.useMemo(()=>$e(r,a),[a,r]),t.current}var $=r(),tn=lt,nn=z.createContext({}),rn=e=>{let t=(0,R.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(ot,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(nn.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},an=()=>{let e=(0,R.c)(13),t=z.use(nn),n=z.use(on),{getFieldState:r}=ct(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=tt(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},on=z.createContext({});function sn(e){let t=(0,R.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=z.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=C(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(on.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function cn(e){let t=(0,R.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formItemId:a}=an(),o=!!i,s;t[3]===n?s=t[4]:(s=C(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(Fe,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ln(e){let t=(0,R.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=an(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(w,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function un(e){let t=(0,R.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{formDescriptionId:i}=an(),a;t[3]===n?a=t[4]:(a=C(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function dn(e){let t=(0,R.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{error:i,formMessageId:a}=an(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=C(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}var fn=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),pn=new Map;function mn(e){let t=pn.get(e);if(t)return pn.delete(e),pn.set(e,t),t;let n=(0,fn.default)();if(n.add(e),pn.set(e,n),pn.size>256){let e=pn.keys().next().value;e!==void 0&&pn.delete(e)}return n}function hn(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=mn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var gn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function _n(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:gn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:gn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:gn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:gn[`trailing-backslash`]}),vn(n,`[`)>vn(n,`]`)&&t.push({code:`unmatched-bracket`,message:gn[`unmatched-bracket`]}),t}function vn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var yn=`https://openknowledge.ai/docs/features/ignore-patterns`,bn=1200,xn=150,Sn=150,Cn=5e3,wn=600,Tn=400,En=`okignore-show-advanced`;function Dn(e){let t=(0,R.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(On,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(kn,{binding:n}),t[1]=n,t[2]=i),i}function On(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:`Ignore patterns`}),(0,$.jsx)(L,{className:`h-4 w-72`})]}),(0,$.jsx)(L,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function kn(e){let t=(0,R.c)(70),{binding:n}=e,r;t[0]===n?r=t[1]:(r=()=>n.current(),t[0]=n,t[1]=r);let[i,a]=(0,z.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>n.subscribe(e=>{a(e)}),s=[n],t[2]=n,t[3]=o,t[4]=s),(0,z.useEffect)(o,s);let{pages:c,pageMeta:l,assetPaths:u}=b(),d;t[5]!==u||t[6]!==l||t[7]!==c?(d=Qn(c,l,u),t[5]=u,t[6]=l,t[7]=c,t[8]=d):d=t[8];let p=d,m,h;t[9]===i?(m=t[10],h=t[11]):(m=Te(i),h=_e(m),t[9]=i,t[10]=m,t[11]=h);let g=h,_=g.length===0,[v,y]=(0,z.useState)(null),x=(0,z.useRef)(null),S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>()=>{x.current&&clearTimeout(x.current)},C=[],t[12]=S,t[13]=C):(S=t[12],C=t[13]),(0,z.useEffect)(S,C);let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{y({key:e,ts:Date.now()}),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>y(null),bn)},t[14]=w):w=t[14];let T=w,[E,k]=(0,z.useState)(null),A=(0,z.useRef)(null),j,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{A.current&&clearTimeout(A.current)},j=[],t[15]=j,t[16]=M):(j=t[15],M=t[16]),(0,z.useEffect)(M,j);let N,P;t[17]===n?(N=t[18],P=t[19]):(N=()=>ye(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),P=[n],t[17]=n,t[18]=N,t[19]=P),(0,z.useEffect)(N,P);let F,ee;t[20]===n?(F=t[21],ee=t[22]):(F=()=>n.subscribeRejection(e=>{let{error:t}=e,n=Jn(t);k({message:n?.detail??f(t),lineNumber:n?.lineNumber,ts:Date.now()}),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>k(null),Cn)}),ee=[n],t[20]=n,t[21]=F,t[22]=ee),(0,z.useEffect)(F,ee);let ne;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[23]=ne):ne=t[23],(0,z.useEffect)(An,ne);let re;t[24]===n?re=t[25]:(re=e=>{n.patch(e)},t[24]=n,t[25]=re);let I=re,ie;t[26]!==I||t[27]!==m||t[28]!==g?(ie=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){I(Se(ue(m,e)));return}I(Se(we(m,e,n))),T(qn(n,e))}},t[26]=I,t[27]=m,t[28]=g,t[29]=ie):ie=t[29];let ae=ie,oe;t[30]!==I||t[31]!==m?(oe=e=>{I(Se(ue(m,e)))},t[30]=I,t[31]=m,t[32]=oe):oe=t[32];let se=oe,ce;t[33]!==I||t[34]!==m||t[35]!==g.length?(ce=e=>{let t=e.trim();if(t.length===0)return;let n=le(m,t);if(n>=0){T(qn(t,n));return}I(Se(xe(m,t))),T(qn(t,g.length))},t[33]=I,t[34]=m,t[35]=g.length,t[36]=ce):ce=t[36];let de=ce,L;t[37]!==I||t[38]!==m?(L=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=Kn(t),i=Kn(n);r<0||i<0||r===i||I(Se(fe(m,r,i)))},t[37]=I,t[38]=m,t[39]=L):L=t[39];let pe=L,me;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:4}},t[40]=me):me=t[40];let he;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ge},t[41]=he):he=t[41];let ve=De(te(O,me),te(D,he)),be=E===null?null:`rejection-${E.ts}`,[Ce,Ee]=tr(),Oe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:`Ignore patterns`}),t[42]=Oe):Oe=t[42];let ke;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[Oe,(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools.`,` `,(0,$.jsx)(`a`,{href:yn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`,children:`Learn more about patterns`}),`.`]})]}),t[43]=ke):ke=t[43];let Ae;t[44]===E?Ae=t[45]:(Ae=E===null?null:(0,$.jsx)(Pn,{rejection:E}),t[44]=E,t[45]=Ae);let je;t[46]!==n||t[47]!==p||t[48]!==de||t[49]!==pe||t[50]!==ae||t[51]!==se||t[52]!==_||t[53]!==g||t[54]!==be||t[55]!==v||t[56]!==ve||t[57]!==Ce||t[58]!==i?(je=Ce?(0,$.jsx)(Mn,{binding:n,text:i}):_?(0,$.jsx)(Fn,{onAdd:de,rejectionFlashKey:be,filePaths:p}):(0,$.jsx)(In,{patterns:g,sensors:ve,onDragEnd:pe,onEdit:ae,onRemove:se,onAdd:de,savedFlash:v,rejectionFlashKey:be,filePaths:p}),t[46]=n,t[47]=p,t[48]=de,t[49]=pe,t[50]=ae,t[51]=se,t[52]=_,t[53]=g,t[54]=be,t[55]=v,t[56]=ve,t[57]=Ce,t[58]=i,t[59]=je):je=t[59];let Me;t[60]!==Ee||t[61]!==Ce?(Me=()=>Ee(!Ce),t[60]=Ee,t[61]=Ce,t[62]=Me):Me=t[62];let Ne;t[63]!==Ce||t[64]!==Me?(Ne=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Nn,{enabled:Ce,onToggle:Me})}),t[63]=Ce,t[64]=Me,t[65]=Ne):Ne=t[65];let Pe;return t[66]!==Ae||t[67]!==je||t[68]!==Ne?(Pe=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[ke,Ae,je,Ne]}),t[66]=Ae,t[67]=je,t[68]=Ne,t[69]=Pe):Pe=t[69],Pe}function An(){return he(jn)}function jn(e){je.error(`Nested .okignore error in ${e.path}`,{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}function Mn(e){let t=(0,R.c)(25),{binding:n,text:r}=e,[i,a]=(0,z.useState)(r),o=(0,z.useRef)(r),s=(0,z.useRef)(!1),c=(0,z.useRef)(r),l=(0,z.useRef)(null),u,d;t[0]===r?(u=t[1],d=t[2]):(u=()=>{s.current||r!==o.current&&(a(r),c.current=r,o.current=r)},d=[r],t[0]=r,t[1]=u,t[2]=d),(0,z.useEffect)(u,d);let f,p;t[3]===i?(f=t[4],p=t[5]):(f=()=>{c.current=i},p=[i],t[3]=i,t[4]=f,t[5]=p),(0,z.useEffect)(f,p);let m,h;t[6]===n?(m=t[7],h=t[8]):(m=()=>()=>{l.current&&(clearTimeout(l.current),l.current=null,c.current!==o.current&&(n.patch(c.current),o.current=c.current))},h=[n],t[6]=n,t[7]=m,t[8]=h),(0,z.useEffect)(m,h);let g;t[9]===n?g=t[10]:(g=e=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,e!==o.current&&(o.current=e,n.patch(e))},Tn)},t[9]=n,t[10]=g);let _=g,v;t[11]===n?v=t[12]:(v=()=>{l.current&&=(clearTimeout(l.current),null),c.current!==o.current&&(o.current=c.current,n.patch(c.current))},t[11]=n,t[12]=v);let y=v,b;t[13]===_?b=t[14]:(b=e=>{a(e.target.value),_(e.target.value)},t[13]=_,t[14]=b);let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{s.current=!0},t[15]=x):x=t[15];let S;t[16]===y?S=t[17]:(S=()=>{s.current=!1,y()},t[16]=y,t[17]=S);let C;t[18]===i?C=t[19]:(C=i.split(`
2
2
  `),t[18]=i,t[19]=C);let w=Math.max(6,Math.min(20,C.length+1)),T;return t[20]!==i||t[21]!==S||t[22]!==w||t[23]!==b?(T=(0,$.jsx)(`textarea`,{value:i,onChange:b,onFocus:x,onBlur:S,spellCheck:!1,rows:w,"aria-label":`Ignore patterns (raw text)`,placeholder:`# One pattern per line.
3
3
  # Examples:
4
4
  # drafts/
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$t as i,Qt as a,U as o,Yt as s,Zt as c,an as l,b as u,dt as d,en as f,ft as p,in as m,k as h,nn as g,on as _,rn as v,sn as y,tn as b,v as ee,w as x,y as te}from"./DocumentContext-LS9HBbXh.js";import{fi as ne,xn as S}from"./doc-hash-CMD_NjP8.js";import{$ as C,Dt as re,Et as w,Ft as T,J as E,Ot as D,P as O,Q as k,Tt as A,X as j,jt as M,pt as N,ut as ie,xt as P}from"./dist-D3YXABda.js";import{a as ae,i as oe,r as se,t as F}from"./typing-burst-detector-mzjjQOqs.js";var I=e(t(),1),ce=r(),L=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:g(this.yanchor),yhead:g(this.yhead)}}static fromJSON(t){return new e(f(t.yanchor),f(t.yhead))}},R=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return b(this.ytext,e,t)}fromYPos(e){let t=i(f(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new L(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?w.cursor(n.pos,n.assoc):w.range(t.pos,n.pos)}},z=D.define({combine(e){return e[e.length-1]}}),B=P.define(),le=class{constructor(e){this.view=e,this.conf=e.state.facet(z),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[B.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(B)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$t as i,Qt as a,U as o,Yt as s,Zt as c,an as l,b as u,dt as d,en as f,ft as p,in as m,k as h,nn as g,on as _,rn as v,sn as y,tn as b,v as ee,w as x,y as te}from"./DocumentContext-fSMev29P.js";import{fi as ne,xn as S}from"./doc-hash-CMD_NjP8.js";import{$ as C,Dt as re,Et as w,Ft as T,J as E,Ot as D,P as O,Q as k,Tt as A,X as j,jt as M,pt as N,ut as ie,xt as P}from"./dist-D3YXABda.js";import{a as ae,i as oe,r as se,t as F}from"./typing-burst-detector-Cm3a_0Rp.js";var I=e(t(),1),ce=r(),L=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:g(this.yanchor),yhead:g(this.yhead)}}static fromJSON(t){return new e(f(t.yanchor),f(t.yhead))}},R=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return b(this.ytext,e,t)}fromYPos(e){let t=i(f(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new L(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?w.cursor(n.pos,n.assoc):w.range(t.pos,n.pos)}},z=D.define({combine(e){return e[e.length-1]}}),B=P.define(),le=class{constructor(e){this.view=e,this.conf=e.state.facet(z),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[B.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(B)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
2
  `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},V=k.fromClass(le),H=j.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),U=P.define(),W=class extends C{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return v(`span`,[l(`class`,`cm-ySelectionCaret`),l(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[m(`⁠`),v(`div`,[l(`class`,`cm-ySelectionCaretDot`)]),m(`⁠`),v(`div`,[l(`class`,`cm-ySelectionInfo`)],[m(this.name)]),m(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},ue=class{constructor(e){this.conf=e.state.facet(z),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[U.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=M.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,o=[],s=this.conf.awareness.getLocalState();if(s!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=s.cursor==null?null:f(s.cursor.anchor),c=s.cursor==null?null:f(s.cursor.head);if(i!=null){let e=b(t,i.anchor),n=b(t,i.head);(s.cursor==null||!a(o,e)||!a(c,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else s.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,s)=>{if(s===r.doc.clientID)return;let c=a.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=i(c.anchor,n),u=i(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:d=`#30bced`,name:f=`Anonymous`}=a.user||{},p=a.user&&a.user.colorLight||d+`33`,m=y(l.index,u.index),h=_(l.index,u.index),g=e.view.state.doc.lineAt(m),v=e.view.state.doc.lineAt(h);if(g.number===v.number)o.push({from:m,to:h,value:E.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});else{o.push({from:m,to:g.from+g.length,value:E.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})}),o.push({from:v.from,to:h,value:E.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});for(let t=g.number+1;t<v.number;t++){let n=e.view.state.doc.line(t).from;o.push({from:n,to:n,value:E.line({attributes:{style:`background-color: ${p}`,class:`cm-yLineSelection`}})})}}o.push({from:u.index,to:u.index,value:E.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new W(d,f)})})}),this.decorations=E.set(o,!0)}},de=k.fromClass(ue,{decorations:e=>e.decorations}),fe=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},G=D.define({combine(e){return e[e.length-1]}});P.define();var pe=class{constructor(e){this.view=e,this.conf=e.state.facet(G),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(z),this._beforeChangeSelection=null,this._mux=s(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[j.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(B)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},me=k.fromClass(pe),he=({state:e,dispatch:t})=>e.facet(G).undo()||!0,ge=({state:e,dispatch:t})=>e.facet(G).redo()||!0,_e=(e,t,{undoManager:n=new c(e)}={})=>{let r=new R(e,t),i=[z.of(r),V];return t&&i.push(H,de),n!==!1&&i.push(G.of(new fe(n)),me,j.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?he(t):e.inputType===`historyRedo`?ge(t):!1}})),i},ve=E.mark({class:`cm-link-ref-broken`}),K=/^\s{0,3}\[([^\]]+)\]:\s/,q=/\[([^\]]*)\]\[([^\]]*)\]/g,ye=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function J(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function be(e){let t=[];return O(e).iterate({enter(e){if(ye.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Y(e){let t=new Set,n=[],r=e.doc,i=be(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(J(n.from,i))continue;let a=K.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!J(t.from,i)&&!K.test(t.text))for(q.lastIndex=0;;){let e=q.exec(t.text);if(!e)break;let r=t.from+e.index;if(J(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ve.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),E.set(a)}var xe=T.define({create(e){return Y(e)},update(e,t){return t.docChanged?Y(t.state):e},provide:e=>j.decorations.from(e)}),Se=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Ce=E.mark({class:`cm-del`}),we=E.line({class:`cm-table-header`}),X=E.line({class:`cm-table-row`});function Te(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Ee(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(t.text!==`---`)return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(r.text===`---`)return{from:t.from,to:r.to}}return null}function Z(e,t){let n=[],r=O(e),i=Ee(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(Ce.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=Se.exec(r.text),a=i?i[1].length:2,o=E.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=Te(r.text),a=E.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(we.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(X.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(X.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),E.set(n)}var De=class{decorations;constructor(e){this.decorations=Z(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||O(e.startState)!==O(e.state))&&(this.decorations=Z(e.view.state,e.view.visibleRanges))}},Oe=k.fromClass(De,{decorations:e=>e.decorations});function Q(){return[Oe,xe]}var ke=n(),Ae=56;function $(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&n.line(1).text===`---`){for(let e=2;e<=n.lines;e++)if(n.line(e).text===`---`){r=e+1;break}}let i=S(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:w.cursor(r.from),effects:j.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function je(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:w.cursor(r),effects:j.scrollIntoView(r,{y:`center`})}),e.focus()})}function Me(e){let t=(0,ce.c)(28),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:s}=e,c=(0,I.useRef)(null),l=(0,I.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new A,t[0]=f):f=t[0];let m=(0,I.useRef)(f),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=new A,t[1]=g):g=t[1];let _=(0,I.useRef)(g),[v,y]=(0,I.useState)(null);if(v)throw v;let{resolvedTheme:b}=ne(),x=(0,I.useRef)(null),S;t[2]!==a||t[3]!==i||t[4]!==b||t[5]!==r?(S=()=>{let e=c.current;if(!e)return;let t=i.configuration.name??``,n,s=Pe;try{n=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=o({ydoc:i.document,ytext:r}),n=new j({state:re.create({doc:r.toString(),extensions:[se,ie.of([h]),_e(r,i.awareness),...ee({themeCompartment:m.current,resolvedTheme:b,ydoc:i.document}),Q(),t,_.current.of(N(a??``)),j.theme({"&":{height:`100%`}}),j.scrollMargins.of(Ne)]}),parent:e}),c=n.contentDOM;return c.addEventListener(`keydown`,s),c.addEventListener(`paste`,s),c.addEventListener(`drop`,s),c.addEventListener(`cut`,s),{view:n,ydoc:i.document,ytext:r,provider:i}}}),x.current=n,l.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),x.current=null,l.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=x.current;e&&p(e),x.current=null,l.current=null}},t[2]=a,t[3]=i,t[4]=b,t[5]=r,t[6]=S):S=t[6];let C;t[7]!==i||t[8]!==r?(C=[r,i],t[7]=i,t[8]=r,t[9]=C):C=t[9],(0,I.useEffect)(S,C);let w,T;t[10]===n?(w=t[11],T=t[12]):(w=()=>{},T=[n],t[10]=n,t[11]=w,t[12]=T),(0,I.useEffect)(w,T);let E,D;t[13]===b?(E=t[14],D=t[15]):(E=()=>{l.current&&l.current.dispatch({effects:m.current.reconfigure(b===`dark`?te:u)})},D=[b],t[13]=b,t[14]=E,t[15]=D),(0,I.useEffect)(E,D);let O,k;t[16]===a?(O=t[17],k=t[18]):(k=()=>{l.current&&l.current.dispatch({effects:_.current.reconfigure(N(a??``))})},O=[a],t[16]=a,t[17]=O,t[18]=k),(0,I.useEffect)(k,O);let M,P;t[19]!==n||t[20]!==s?(M=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!s)return;let r=l.current;r&&($(r,t),oe(n))};return window.addEventListener(F,e),()=>window.removeEventListener(F,e)},P=[n,s],t[19]=n,t[20]=s,t[21]=M,t[22]=P):(M=t[21],P=t[22]),(0,I.useEffect)(M,P);let L,R;t[23]!==n||t[24]!==s?(L=()=>{if(!s)return;let e=l.current;if(!e)return;let t=ae(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}je(e,t.detail)}},R=[n,s],t[23]=n,t[24]=s,t[25]=L,t[26]=R):(L=t[25],R=t[26]),(0,I.useEffect)(L,R);let z;return t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,ke.jsx)(`div`,{ref:c,className:`source-editor h-full pb-3`}),t[27]=z):z=t[27],z}function Ne(){return{top:Ae}}function Pe(){return x()}export{Me as SourceEditor};
@@ -1,4 +1,4 @@
1
- import{o as e,r as t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{En as a,Fn as o,Hn as s,Mt as c,Nt as l,Pt as u,Tn as d,Xt as f,gn as p,h as m,hn as h,n as g,qn as _,rt as v}from"./DocumentContext-LS9HBbXh.js";import{A as y,Ct as b,D as x,E as S,G as C,K as w,Ln as T,M as E,N as D,P as O,T as k,_ as A,an as j,ar as M,ci as N,ct as P,fi as F,g as I,h as L,j as R,k as ee,lt as z,sn as te,st as B,ui as ne,ut as V}from"./doc-hash-CMD_NjP8.js";import{C as re,S as H,_ as ie,a as ae,b as oe,c as se,d as U,h as ce,i as le,l as ue,m as de,n as fe,o as pe,p as me,s as he,t as W,w as ge,x as _e,y as ve}from"./button-DBLnjjvQ.js";import{C as ye,S as be,_ as xe,a as Se,c as Ce,g as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae,v as je,x as Me,y as Ne}from"./dialog-DSzqKgdW.js";import{a as Pe,i as Fe}from"./collapsible-L2bca9Ur.js";import{t as Ie}from"./checkbox-kroC1jEP.js";import{a as Le,i as Re,o as ze}from"./toggle-group-DQWMrY_b.js";import{t as Be}from"./label-CdSs0Skc.js";import{t as Ve}from"./textarea-5ach84qM.js";var He=re(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ue=re(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),We=re(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ge=re(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ke=re(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),qe=re(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Je=re(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Ye=re(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Xe=re(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),G=r(),K=i(),q=e(n(),1);function Ze(e,t){let n=(0,K.c)(7),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t})}),()=>{n=!0}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,q.useEffect)(r,i);let a,o;n[4]===e?(a=n[5],o=n[6]):(a=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},o=[e],n[4]=e,n[5]=a,n[6]=o),(0,q.useEffect)(a,o)}var Qe=e(ge());function $e(e,t){let n=window.okDesktop?.shell?.openExternal;n&&(e.preventDefault(),n(t))}var et=[`Enter`,` `],tt=[`ArrowDown`,`PageUp`,`Home`],nt=[`ArrowUp`,`PageDown`,`End`],rt=[...tt,...nt],it={ltr:[...et,`ArrowRight`],rtl:[...et,`ArrowLeft`]},at={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ot=`Menu`,[st,ct,lt]=w(ot),[ut,dt]=me(ot,[lt,O,ze]),ft=O(),pt=ze(),[mt,ht]=ut(ot),[gt,_t]=ut(ot),vt=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ft(t),[c,l]=q.useState(null),u=q.useRef(!1),d=pe(a),f=C(i);return q.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,G.jsx)(D,{...s,children:(0,G.jsx)(mt,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,G.jsx)(gt,{scope:t,onClose:q.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};vt.displayName=ot;var yt=`MenuAnchor`,bt=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ft(n);return(0,G.jsx)(y,{...i,...r,ref:t})});bt.displayName=yt;var xt=`MenuPortal`,[St,Ct]=ut(xt,{forceMount:void 0}),wt=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ht(xt,t);return(0,G.jsx)(St,{scope:t,forceMount:n,children:(0,G.jsx)(se,{present:n||a.open,children:(0,G.jsx)(le,{asChild:!0,container:i,children:r})})})};wt.displayName=xt;var Tt=`MenuContent`,[Et,Dt]=ut(Tt),Ot=q.forwardRef((e,t)=>{let n=Ct(Tt,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ht(Tt,e.__scopeMenu),o=_t(Tt,e.__scopeMenu);return(0,G.jsx)(st.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(se,{present:r||a.open,children:(0,G.jsx)(st.Slot,{scope:e.__scopeMenu,children:o.modal?(0,G.jsx)(kt,{...i,ref:t}):(0,G.jsx)(At,{...i,ref:t})})})})}),kt=q.forwardRef((e,t)=>{let n=ht(Tt,e.__scopeMenu),r=q.useRef(null),i=oe(t,r);return q.useEffect(()=>{let e=r.current;if(e)return we(e)},[]),(0,G.jsx)(Mt,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),At=q.forwardRef((e,t)=>{let n=ht(Tt,e.__scopeMenu);return(0,G.jsx)(Mt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jt=ie(`MenuContent.ScrollLock`),Mt=q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=ht(Tt,n),_=_t(Tt,n),v=ft(n),y=pt(n),b=ct(n),[x,S]=q.useState(null),C=q.useRef(null),w=oe(t,C,g.onContentChange),T=q.useRef(0),D=q.useRef(``),O=q.useRef(0),k=q.useRef(null),A=q.useRef(`right`),j=q.useRef(0),M=m?xe:q.Fragment,N=m?{as:jt,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=_n(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};q.useEffect(()=>()=>window.clearTimeout(T.current),[]),je();let F=q.useCallback(e=>A.current===k.current?.side&&yn(e,k.current?.area),[]);return(0,G.jsx)(Et,{scope:n,searchRef:D,onItemEnter:q.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:q.useCallback(e=>{F(e)||(C.current?.focus(),S(null))},[F]),onTriggerLeave:q.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:q.useCallback(e=>{k.current=e},[]),children:(0,G.jsx)(M,{...N,children:(0,G.jsx)(Ne,{asChild:!0,trapped:i,onMountAutoFocus:U(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,G.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,G.jsx)(Le,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:U(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,G.jsx)(E,{role:`menu`,"aria-orientation":`vertical`,"data-state":fn(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:U(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=C.current;if(e.target!==i||!rt.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);nt.includes(e.key)&&a.reverse(),hn(a)}),onBlur:U(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),D.current=``)}),onPointerMove:U(e.onPointerMove,bn(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});Ot.displayName=Tt;var Nt=`MenuGroup`,Pt=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{role:`group`,...r,ref:t})});Pt.displayName=Nt;var Ft=`MenuLabel`,It=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{...r,ref:t})});It.displayName=Ft;var Lt=`MenuItem`,Rt=`menu.itemSelect`,zt=q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=q.useRef(null),o=_t(Lt,e.__scopeMenu),s=Dt(Lt,e.__scopeMenu),c=oe(t,a),l=q.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Rt,{bubbles:!0,cancelable:!0});e.addEventListener(Rt,e=>r?.(e),{once:!0}),ce(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,G.jsx)(Bt,{...i,ref:c,disabled:n,onClick:U(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:U(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:U(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||et.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});zt.displayName=Lt;var Bt=q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Dt(Lt,n),s=pt(n),c=q.useRef(null),l=oe(t,c),[u,d]=q.useState(!1),[f,p]=q.useState(``);return q.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,G.jsx)(st.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,G.jsx)(Re,{asChild:!0,...s,focusable:!r,children:(0,G.jsx)(de.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:U(e.onPointerMove,bn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:U(e.onPointerLeave,bn(e=>o.onItemLeave(e))),onFocus:U(e.onFocus,()=>d(!0)),onBlur:U(e.onBlur,()=>d(!1))})})})}),Vt=`MenuCheckboxItem`,Ht=q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,G.jsx)(Xt,{scope:e.__scopeMenu,checked:n,children:(0,G.jsx)(zt,{role:`menuitemcheckbox`,"aria-checked":pn(n)?`mixed`:n,...i,ref:t,"data-state":mn(n),onSelect:U(i.onSelect,()=>r?.(pn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ht.displayName=Vt;var Ut=`MenuRadioGroup`,[Wt,Gt]=ut(Ut,{value:void 0,onValueChange:()=>{}}),Kt=q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=pe(r);return(0,G.jsx)(Wt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,G.jsx)(Pt,{...i,ref:t})})});Kt.displayName=Ut;var qt=`MenuRadioItem`,Jt=q.forwardRef((e,t)=>{let{value:n,...r}=e,i=Gt(qt,e.__scopeMenu),a=n===i.value;return(0,G.jsx)(Xt,{scope:e.__scopeMenu,checked:a,children:(0,G.jsx)(zt,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":mn(a),onSelect:U(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Jt.displayName=qt;var Yt=`MenuItemIndicator`,[Xt,Zt]=ut(Yt,{checked:!1}),Qt=q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Zt(Yt,n);return(0,G.jsx)(se,{present:r||pn(a.checked)||a.checked===!0,children:(0,G.jsx)(de.span,{...i,ref:t,"data-state":mn(a.checked)})})});Qt.displayName=Yt;var $t=`MenuSeparator`,en=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});en.displayName=$t;var tn=`MenuArrow`,nn=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ft(n);return(0,G.jsx)(R,{...i,...r,ref:t})});nn.displayName=tn;var rn=`MenuSub`,[an,on]=ut(rn),sn=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ht(rn,t),o=ft(t),[s,c]=q.useState(null),[l,u]=q.useState(null),d=pe(i);return q.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,G.jsx)(D,{...o,children:(0,G.jsx)(mt,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,G.jsx)(an,{scope:t,contentId:he(),triggerId:he(),trigger:s,onTriggerChange:c,children:n})})})};sn.displayName=rn;var cn=`MenuSubTrigger`,ln=q.forwardRef((e,t)=>{let n=ht(cn,e.__scopeMenu),r=_t(cn,e.__scopeMenu),i=on(cn,e.__scopeMenu),a=Dt(cn,e.__scopeMenu),o=q.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return q.useEffect(()=>u,[u]),q.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,G.jsx)(bt,{asChild:!0,...l,children:(0,G.jsx)(Bt,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":fn(n.open),...e,ref:ve(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:U(e.onPointerMove,bn(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:U(e.onPointerLeave,bn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:U(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||it[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ln.displayName=cn;var un=`MenuSubContent`,dn=q.forwardRef((e,t)=>{let n=Ct(Tt,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ht(Tt,e.__scopeMenu),o=_t(Tt,e.__scopeMenu),s=on(un,e.__scopeMenu),c=q.useRef(null),l=oe(t,c);return(0,G.jsx)(st.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(se,{present:r||a.open,children:(0,G.jsx)(st.Slot,{scope:e.__scopeMenu,children:(0,G.jsx)(Mt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:U(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:U(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=at[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});dn.displayName=un;function fn(e){return e?`open`:`closed`}function pn(e){return e===`indeterminate`}function mn(e){return pn(e)?`indeterminate`:e?`checked`:`unchecked`}function hn(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function gn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function _n(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=gn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function vn(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function yn(e,t){return t?vn({x:e.clientX,y:e.clientY},t):!1}function bn(e){return t=>t.pointerType===`mouse`?e(t):void 0}var xn=vt,Sn=bt,Cn=wt,wn=Ot,Tn=Pt,En=It,Dn=zt,On=Ht,kn=Kt,An=Jt,jn=Qt,Mn=en,Nn=nn,Pn=sn,Fn=ln,In=dn,Ln=`DropdownMenu`,[Rn,zn]=me(Ln,[dt]),Bn=dt(),[Vn,Hn]=Rn(Ln),Un=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Bn(t),l=q.useRef(null),[u,d]=ue({prop:i,defaultProp:a??!1,onChange:o,caller:Ln});return(0,G.jsx)(Vn,{scope:t,triggerId:he(),triggerRef:l,contentId:he(),open:u,onOpenChange:d,onOpenToggle:q.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,G.jsx)(xn,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Un.displayName=Ln;var Wn=`DropdownMenuTrigger`,Gn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Hn(Wn,n),o=Bn(n);return(0,G.jsx)(Sn,{asChild:!0,...o,children:(0,G.jsx)(de.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:ve(t,a.triggerRef),onPointerDown:U(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:U(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Gn.displayName=Wn;var Kn=`DropdownMenuPortal`,qn=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Bn(t);return(0,G.jsx)(Cn,{...r,...n})};qn.displayName=Kn;var Jn=`DropdownMenuContent`,Yn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Hn(Jn,n),a=Bn(n),o=q.useRef(!1);return(0,G.jsx)(wn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:U(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Yn.displayName=Jn;var Xn=`DropdownMenuGroup`,Zn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Tn,{...i,...r,ref:t})});Zn.displayName=Xn;var Qn=`DropdownMenuLabel`,$n=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(En,{...i,...r,ref:t})});$n.displayName=Qn;var er=`DropdownMenuItem`,tr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Dn,{...i,...r,ref:t})});tr.displayName=er;var nr=`DropdownMenuCheckboxItem`,rr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(On,{...i,...r,ref:t})});rr.displayName=nr;var ir=`DropdownMenuRadioGroup`,ar=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(kn,{...i,...r,ref:t})});ar.displayName=ir;var or=`DropdownMenuRadioItem`,sr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(An,{...i,...r,ref:t})});sr.displayName=or;var cr=`DropdownMenuItemIndicator`,lr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(jn,{...i,...r,ref:t})});lr.displayName=cr;var ur=`DropdownMenuSeparator`,dr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Mn,{...i,...r,ref:t})});dr.displayName=ur;var fr=`DropdownMenuArrow`,pr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Nn,{...i,...r,ref:t})});pr.displayName=fr;var mr=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Bn(t),[s,c]=ue({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,G.jsx)(Pn,{...o,open:s,onOpenChange:c,children:n})},hr=`DropdownMenuSubTrigger`,gr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Fn,{...i,...r,ref:t})});gr.displayName=hr;var _r=`DropdownMenuSubContent`,vr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(In,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});vr.displayName=_r;var yr=Un,br=Gn,xr=qn,Sr=Yn,Cr=$n,wr=tr,Tr=rr,Er=ar,Dr=sr,Or=lr,kr=dr,Ar=mr,jr=gr,Mr=vr,Nr=`Separator`,Pr=`horizontal`,Fr=[`horizontal`,`vertical`],Ir=q.forwardRef((e,t)=>{let{decorative:n,orientation:r=Pr,...i}=e,a=Lr(r)?r:Pr,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,G.jsx)(de.div,{"data-orientation":a,...o,...i,ref:t})});Ir.displayName=Nr;function Lr(e){return Fr.includes(e)}var Rr=Ir;function zr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Br(e){let t=(0,K.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,q.useState)(n),[a,o]=(0,q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return A(()=>{o(Wr)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Hr).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,frontmatterSources:e.frontmatter_sources??{}}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Vr),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Vr(e){return e+1}async function Hr(e){if(!e.ok){let t=await e.json().catch(Ur);throw Error(k(t)??`HTTP ${e.status}`)}return e.json()}function Ur(){return null}function Wr(e){return e+1}function Gr(e,t){let n=(0,K.c)(5),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},n[0]=r):r=n[0];let[i,a]=(0,q.useState)(r),o,s;return n[1]!==e||n[2]!==t?(o=()=>{if(!t||e===null){a({status:`idle`});return}let n=!1;a({status:`loading`});let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`;return fetch(`/api/template${r}`).then(Kr).then(e=>{if(!n){if(!e||typeof e!=`object`||!e.template){a({status:`error`,message:`Server returned an incomplete template response.`});return}a({status:`ready`,data:e.template})}}).catch(e=>{n||a({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{n=!0}},s=[e,t],n[1]=e,n[2]=t,n[3]=o,n[4]=s):(o=n[3],s=n[4]),(0,q.useEffect)(o,s),i}async function Kr(e){if(!e.ok){let t=await e.json().catch(qr);throw Error(k(t)??`HTTP ${e.status}`)}return e.json()}function qr(){return null}function Jr(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=H(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,G.jsx)(Rr,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function Yr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Xr=_e(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Zr(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=H(Xr({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Qr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $r(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Be,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ei(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ti(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ni(e){let t=(0,K.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(ii)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,G.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(ri)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=H(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,G.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function ri(e){return e?.message&&(0,G.jsx)(`li`,{children:e.message},e.message)}function ii(e){return[e?.message,e]}async function ai(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function oi(){return si().status}function si(){let e=(0,K.c)(8),[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ai().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,q.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>I(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,q.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var ci=(0,q.createContext)(null);function li(e,t,n,r){console.warn(JSON.stringify({event:`ok-${e}-${n}`,docName:t,code:r?.code,reason:r?.reason??void 0}))}function ui(e,t,n){let r=new f,i=new v({url:e,name:t,document:r,onDisconnect:({event:e})=>li(`config-provider`,t,`disconnect`,e),onClose:({event:e})=>li(`config-provider`,t,`close`,e)}),a=j(i,n);return{binding:a,config:a.current(),cleanup:()=>{a.dispose(),i.destroy(),r.destroy()}}}function di(e){let t=new f,n=new v({url:e,name:B,document:t,onDisconnect:({event:e})=>li(`okignore-provider`,B,`disconnect`,e),onClose:({event:e})=>li(`okignore-provider`,B,`close`,e)}),r=te(n);return{binding:r,provider:n,cleanup:()=>{r.dispose(),n.destroy(),t.destroy()}}}function fi(e){let t=(0,K.c)(26),{children:n}=e,{collabUrl:r}=g(),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),f,p;t[0]===r?(f=t[1],p=t[2]):(f=()=>{if(r===null)return;let e=ui(r,V,`user`),t=ui(r,P,`project`),n=ui(r,z,`project-local`),i=di(r);a({binding:e.binding,config:e.config,synced:e.binding.hasSynced()}),s({binding:t.binding,config:t.config}),l({binding:n.binding,config:n.config,synced:n.binding.hasSynced()}),d({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),c=e.binding.subscribeSynced(()=>{a(t=>t?.binding===e.binding?{...t,synced:!0}:t)}),u=t.binding.subscribe(e=>{s(n=>n?.binding===t.binding?{...n,config:e}:n)}),f=n.binding.subscribe(e=>{l(t=>t?.binding===n.binding?{...t,config:e}:t)}),p=n.binding.subscribeSynced(()=>{l(e=>e?.binding===n.binding?{...e,synced:!0}:e)}),m=()=>{d(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,m),()=>{o(),c(),u(),f(),p(),i.provider.off(`synced`,m),e.cleanup(),t.cleanup(),n.cleanup(),i.cleanup(),a(t=>t?.binding===e.binding?null:t),s(e=>e?.binding===t.binding?null:e),l(e=>e?.binding===n.binding?null:e),d(e=>e?.binding===i.binding?null:e)}},p=[r],t[0]=r,t[1]=f,t[2]=p),(0,q.useEffect)(f,p);let m;t[3]!==c?.config||t[4]!==o||t[5]!==i?(m=i&&o?M(i.config,o.config,c?.config):null,t[3]=c?.config,t[4]=o,t[5]=i,t[6]=m):m=t[6];let h=m,{setTheme:_}=F(),v=h?.appearance?.theme,y,b;t[7]!==_||t[8]!==v?(y=()=>{(v===`light`||v===`dark`||v===`system`)&&_(v)},b=[v,_],t[7]=_,t[8]=v,t[9]=y,t[10]=b):(y=t[9],b=t[10]),(0,q.useEffect)(y,b),Ze(typeof window<`u`?window.okDesktop:void 0,v??`system`);let x=i?.binding??null,S=i?.synced??!1,C=o?.binding??null,w=c?.binding??null,T=u?.binding??null,E=u?.synced??!1,D=i?.config??null,O=o?.config??null,k=c?.config??null,A=c?.synced??!1,j;t[11]!==h||t[12]!==T||t[13]!==E||t[14]!==D||t[15]!==O||t[16]!==k||t[17]!==A||t[18]!==x||t[19]!==S||t[20]!==C||t[21]!==w?(j={userBinding:x,userSynced:S,projectBinding:C,projectLocalBinding:w,okignoreBinding:T,okignoreSynced:E,userConfig:D,projectConfig:O,projectLocalConfig:k,projectLocalSynced:A,merged:h},t[11]=h,t[12]=T,t[13]=E,t[14]=D,t[15]=O,t[16]=k,t[17]=A,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=j):j=t[22];let N=j,I;return t[23]!==n||t[24]!==N?(I=(0,G.jsx)(ci,{value:N,children:n}),t[23]=n,t[24]=N,t[25]=I):I=t[25],I}function pi(){let e=(0,q.use)(ci);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function mi(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ce,{children:`Enable git auto-sync?`}),(0,G.jsx)(Se,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),e[0]=t):t=e[0],t}function hi(){let e=(0,K.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`p`,{className:`mb-2 font-medium`,children:`Before you enable it`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:[t,(0,G.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[(0,G.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,G.jsx)(`li`,{children:`Open Knowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync.`}),(0,G.jsx)(`li`,{children:`If this repo is shared, your in-progress edits become visible to collaborators as soon as they sync.`})]})]}),e[1]=n):n=e[1],n}function gi(){let e=(0,K.c)(2),{projectLocalBinding:t}=pi();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{enabled:e}});return n.ok?{ok:!0}:{ok:!1,error:T(n.error)}},e[0]=t,e[1]=n),n}function _i(e){let t=(0,K.c)(10),[n,r]=(0,q.useState)(!1),i;t[0]===e?i=t[1]:(i=function(t){if(e===null)return Me.error(`Sync settings not yet loaded — try again in a moment`),!1;let n=e(t);return n.ok?!0:(console.error(`[sync] toggle failed:`,n.error),Me.error(`Failed to ${t?`enable`:`disable`} sync — ${n.error}`),!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=function(e){if(e){r(!0);return}a(!1)},t[2]=a,t[3]=o);let s=o,c;t[4]===a?c=t[5]:(c=function(){a(!0)&&r(!1)},t[4]=a,t[5]=c);let l=c,u;return t[6]!==n||t[7]!==l||t[8]!==s?(u={confirmOpen:n,setConfirmOpen:r,onToggleRequest:s,onConfirm:l},t[6]=n,t[7]=l,t[8]=s,t[9]=u):u=t[9],u}function vi(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(yr,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function yi(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(br,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function bi(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=H(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,G.jsx)(xr,{children:(0,G.jsx)(Sr,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function xi(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=H(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,G.jsx)(wr,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Si(e){let t=(0,K.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=H(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,G.jsx)(Or,{children:(0,G.jsx)(ye,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,G.jsxs)(Tr,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function Ci(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Er,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function wi(e){let t=(0,K.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=H(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,G.jsx)(Or,{children:(0,G.jsx)(ye,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(Dr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ti(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=H(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,G.jsx)(Cr,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Ei(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(kr,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Di(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Ar,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Oi(e){let t=(0,K.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=H(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Pe,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(jr,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ki(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Mr,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ai(){var e=[...arguments];return(0,q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var ji=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Mi(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ni(e){return`nodeType`in e}function Pi(e){return e?Mi(e)?e:Ni(e)?e.ownerDocument?.defaultView??window:window:window}function Fi(e){let{Document:t}=Pi(e);return e instanceof t}function Ii(e){return Mi(e)?!1:e instanceof Pi(e).HTMLElement}function Li(e){return e instanceof Pi(e).SVGElement}function Ri(e){return e?Mi(e)?e.document:Ni(e)?Fi(e)?e:Ii(e)||Li(e)?e.ownerDocument:document:document:document}var zi=ji?q.useLayoutEffect:q.useEffect;function Bi(e){let t=(0,q.useRef)(e);return zi(()=>{t.current=e}),(0,q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Vi(){let e=(0,q.useRef)(null);return[(0,q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Hi(e,t){t===void 0&&(t=[e]);let n=(0,q.useRef)(e);return zi(()=>{n.current!==e&&(n.current=e)},t),n}function Ui(e,t){let n=(0,q.useRef)();return(0,q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Wi(e){let t=Bi(e),n=(0,q.useRef)(null);return[n,(0,q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Gi(e){let t=(0,q.useRef)();return(0,q.useEffect)(()=>{t.current=e},[e]),t.current}var Ki={};function qi(e,t){return(0,q.useMemo)(()=>{if(t)return t;let n=Ki[e]==null?0:Ki[e]+1;return Ki[e]=n,e+`-`+n},[e,t])}function Ji(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Yi=Ji(1),Xi=Ji(-1);function Zi(e){return`clientX`in e&&`clientY`in e}function Qi(e){if(!e)return!1;let{KeyboardEvent:t}=Pi(e.target);return t&&e instanceof t}function $i(e){if(!e)return!1;let{TouchEvent:t}=Pi(e.target);return t&&e instanceof t}function ea(e){if($i(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Zi(e)?{x:e.clientX,y:e.clientY}:null}var ta=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[ta.Translate.toString(e),ta.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),na=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function ra(e){return e.matches(na)?e:e.querySelector(na)}var ia={display:`none`};function aa(e){let{id:t,value:n}=e;return q.createElement(`div`,{id:t,style:ia},n)}function oa(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function sa(){let[e,t]=(0,q.useState)(``);return{announce:(0,q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ca=(0,q.createContext)(null);function la(e){let t=(0,q.useContext)(ca);(0,q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ua(){let[e]=(0,q.useState)(()=>new Set),t=(0,q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var da={draggable:`
1
+ import{o as e,r as t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{En as a,Fn as o,Hn as s,Mt as c,Nt as l,Pt as u,Tn as d,Xt as f,gn as p,h as m,hn as h,n as g,qn as _,rt as v}from"./DocumentContext-fSMev29P.js";import{A as y,Ct as b,D as x,E as S,G as C,K as w,Ln as T,M as E,N as D,P as O,T as k,_ as A,an as j,ar as M,ci as N,ct as P,fi as F,g as I,h as L,j as R,k as ee,lt as z,sn as te,st as B,ui as ne,ut as V}from"./doc-hash-CMD_NjP8.js";import{C as re,S as H,_ as ie,a as ae,b as oe,c as se,d as U,h as ce,i as le,l as ue,m as de,n as fe,o as pe,p as me,s as he,t as W,w as ge,x as _e,y as ve}from"./button-DBLnjjvQ.js";import{C as ye,S as be,_ as xe,a as Se,c as Ce,g as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae,v as je,x as Me,y as Ne}from"./dialog-DSzqKgdW.js";import{a as Pe,i as Fe}from"./collapsible-L2bca9Ur.js";import{t as Ie}from"./checkbox-kroC1jEP.js";import{a as Le,i as Re,o as ze}from"./toggle-group-DQWMrY_b.js";import{t as Be}from"./label-CdSs0Skc.js";import{t as Ve}from"./textarea-5ach84qM.js";var He=re(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ue=re(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),We=re(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ge=re(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ke=re(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),qe=re(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Je=re(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Ye=re(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Xe=re(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),G=r(),K=i(),q=e(n(),1);function Ze(e,t){let n=(0,K.c)(7),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t})}),()=>{n=!0}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,q.useEffect)(r,i);let a,o;n[4]===e?(a=n[5],o=n[6]):(a=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},o=[e],n[4]=e,n[5]=a,n[6]=o),(0,q.useEffect)(a,o)}var Qe=e(ge());function $e(e,t){let n=window.okDesktop?.shell?.openExternal;n&&(e.preventDefault(),n(t))}var et=[`Enter`,` `],tt=[`ArrowDown`,`PageUp`,`Home`],nt=[`ArrowUp`,`PageDown`,`End`],rt=[...tt,...nt],it={ltr:[...et,`ArrowRight`],rtl:[...et,`ArrowLeft`]},at={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ot=`Menu`,[st,ct,lt]=w(ot),[ut,dt]=me(ot,[lt,O,ze]),ft=O(),pt=ze(),[mt,ht]=ut(ot),[gt,_t]=ut(ot),vt=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ft(t),[c,l]=q.useState(null),u=q.useRef(!1),d=pe(a),f=C(i);return q.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,G.jsx)(D,{...s,children:(0,G.jsx)(mt,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,G.jsx)(gt,{scope:t,onClose:q.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};vt.displayName=ot;var yt=`MenuAnchor`,bt=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ft(n);return(0,G.jsx)(y,{...i,...r,ref:t})});bt.displayName=yt;var xt=`MenuPortal`,[St,Ct]=ut(xt,{forceMount:void 0}),wt=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ht(xt,t);return(0,G.jsx)(St,{scope:t,forceMount:n,children:(0,G.jsx)(se,{present:n||a.open,children:(0,G.jsx)(le,{asChild:!0,container:i,children:r})})})};wt.displayName=xt;var Tt=`MenuContent`,[Et,Dt]=ut(Tt),Ot=q.forwardRef((e,t)=>{let n=Ct(Tt,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ht(Tt,e.__scopeMenu),o=_t(Tt,e.__scopeMenu);return(0,G.jsx)(st.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(se,{present:r||a.open,children:(0,G.jsx)(st.Slot,{scope:e.__scopeMenu,children:o.modal?(0,G.jsx)(kt,{...i,ref:t}):(0,G.jsx)(At,{...i,ref:t})})})})}),kt=q.forwardRef((e,t)=>{let n=ht(Tt,e.__scopeMenu),r=q.useRef(null),i=oe(t,r);return q.useEffect(()=>{let e=r.current;if(e)return we(e)},[]),(0,G.jsx)(Mt,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),At=q.forwardRef((e,t)=>{let n=ht(Tt,e.__scopeMenu);return(0,G.jsx)(Mt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jt=ie(`MenuContent.ScrollLock`),Mt=q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=ht(Tt,n),_=_t(Tt,n),v=ft(n),y=pt(n),b=ct(n),[x,S]=q.useState(null),C=q.useRef(null),w=oe(t,C,g.onContentChange),T=q.useRef(0),D=q.useRef(``),O=q.useRef(0),k=q.useRef(null),A=q.useRef(`right`),j=q.useRef(0),M=m?xe:q.Fragment,N=m?{as:jt,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=_n(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};q.useEffect(()=>()=>window.clearTimeout(T.current),[]),je();let F=q.useCallback(e=>A.current===k.current?.side&&yn(e,k.current?.area),[]);return(0,G.jsx)(Et,{scope:n,searchRef:D,onItemEnter:q.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:q.useCallback(e=>{F(e)||(C.current?.focus(),S(null))},[F]),onTriggerLeave:q.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:q.useCallback(e=>{k.current=e},[]),children:(0,G.jsx)(M,{...N,children:(0,G.jsx)(Ne,{asChild:!0,trapped:i,onMountAutoFocus:U(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,G.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,G.jsx)(Le,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:U(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,G.jsx)(E,{role:`menu`,"aria-orientation":`vertical`,"data-state":fn(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:U(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=C.current;if(e.target!==i||!rt.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);nt.includes(e.key)&&a.reverse(),hn(a)}),onBlur:U(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),D.current=``)}),onPointerMove:U(e.onPointerMove,bn(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});Ot.displayName=Tt;var Nt=`MenuGroup`,Pt=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{role:`group`,...r,ref:t})});Pt.displayName=Nt;var Ft=`MenuLabel`,It=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{...r,ref:t})});It.displayName=Ft;var Lt=`MenuItem`,Rt=`menu.itemSelect`,zt=q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=q.useRef(null),o=_t(Lt,e.__scopeMenu),s=Dt(Lt,e.__scopeMenu),c=oe(t,a),l=q.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Rt,{bubbles:!0,cancelable:!0});e.addEventListener(Rt,e=>r?.(e),{once:!0}),ce(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,G.jsx)(Bt,{...i,ref:c,disabled:n,onClick:U(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:U(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:U(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||et.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});zt.displayName=Lt;var Bt=q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Dt(Lt,n),s=pt(n),c=q.useRef(null),l=oe(t,c),[u,d]=q.useState(!1),[f,p]=q.useState(``);return q.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,G.jsx)(st.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,G.jsx)(Re,{asChild:!0,...s,focusable:!r,children:(0,G.jsx)(de.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:U(e.onPointerMove,bn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:U(e.onPointerLeave,bn(e=>o.onItemLeave(e))),onFocus:U(e.onFocus,()=>d(!0)),onBlur:U(e.onBlur,()=>d(!1))})})})}),Vt=`MenuCheckboxItem`,Ht=q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,G.jsx)(Xt,{scope:e.__scopeMenu,checked:n,children:(0,G.jsx)(zt,{role:`menuitemcheckbox`,"aria-checked":pn(n)?`mixed`:n,...i,ref:t,"data-state":mn(n),onSelect:U(i.onSelect,()=>r?.(pn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ht.displayName=Vt;var Ut=`MenuRadioGroup`,[Wt,Gt]=ut(Ut,{value:void 0,onValueChange:()=>{}}),Kt=q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=pe(r);return(0,G.jsx)(Wt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,G.jsx)(Pt,{...i,ref:t})})});Kt.displayName=Ut;var qt=`MenuRadioItem`,Jt=q.forwardRef((e,t)=>{let{value:n,...r}=e,i=Gt(qt,e.__scopeMenu),a=n===i.value;return(0,G.jsx)(Xt,{scope:e.__scopeMenu,checked:a,children:(0,G.jsx)(zt,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":mn(a),onSelect:U(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Jt.displayName=qt;var Yt=`MenuItemIndicator`,[Xt,Zt]=ut(Yt,{checked:!1}),Qt=q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Zt(Yt,n);return(0,G.jsx)(se,{present:r||pn(a.checked)||a.checked===!0,children:(0,G.jsx)(de.span,{...i,ref:t,"data-state":mn(a.checked)})})});Qt.displayName=Yt;var $t=`MenuSeparator`,en=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(de.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});en.displayName=$t;var tn=`MenuArrow`,nn=q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ft(n);return(0,G.jsx)(R,{...i,...r,ref:t})});nn.displayName=tn;var rn=`MenuSub`,[an,on]=ut(rn),sn=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ht(rn,t),o=ft(t),[s,c]=q.useState(null),[l,u]=q.useState(null),d=pe(i);return q.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,G.jsx)(D,{...o,children:(0,G.jsx)(mt,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,G.jsx)(an,{scope:t,contentId:he(),triggerId:he(),trigger:s,onTriggerChange:c,children:n})})})};sn.displayName=rn;var cn=`MenuSubTrigger`,ln=q.forwardRef((e,t)=>{let n=ht(cn,e.__scopeMenu),r=_t(cn,e.__scopeMenu),i=on(cn,e.__scopeMenu),a=Dt(cn,e.__scopeMenu),o=q.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return q.useEffect(()=>u,[u]),q.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,G.jsx)(bt,{asChild:!0,...l,children:(0,G.jsx)(Bt,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":fn(n.open),...e,ref:ve(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:U(e.onPointerMove,bn(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:U(e.onPointerLeave,bn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:U(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||it[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ln.displayName=cn;var un=`MenuSubContent`,dn=q.forwardRef((e,t)=>{let n=Ct(Tt,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ht(Tt,e.__scopeMenu),o=_t(Tt,e.__scopeMenu),s=on(un,e.__scopeMenu),c=q.useRef(null),l=oe(t,c);return(0,G.jsx)(st.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(se,{present:r||a.open,children:(0,G.jsx)(st.Slot,{scope:e.__scopeMenu,children:(0,G.jsx)(Mt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:U(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:U(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=at[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});dn.displayName=un;function fn(e){return e?`open`:`closed`}function pn(e){return e===`indeterminate`}function mn(e){return pn(e)?`indeterminate`:e?`checked`:`unchecked`}function hn(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function gn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function _n(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=gn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function vn(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function yn(e,t){return t?vn({x:e.clientX,y:e.clientY},t):!1}function bn(e){return t=>t.pointerType===`mouse`?e(t):void 0}var xn=vt,Sn=bt,Cn=wt,wn=Ot,Tn=Pt,En=It,Dn=zt,On=Ht,kn=Kt,An=Jt,jn=Qt,Mn=en,Nn=nn,Pn=sn,Fn=ln,In=dn,Ln=`DropdownMenu`,[Rn,zn]=me(Ln,[dt]),Bn=dt(),[Vn,Hn]=Rn(Ln),Un=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Bn(t),l=q.useRef(null),[u,d]=ue({prop:i,defaultProp:a??!1,onChange:o,caller:Ln});return(0,G.jsx)(Vn,{scope:t,triggerId:he(),triggerRef:l,contentId:he(),open:u,onOpenChange:d,onOpenToggle:q.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,G.jsx)(xn,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Un.displayName=Ln;var Wn=`DropdownMenuTrigger`,Gn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Hn(Wn,n),o=Bn(n);return(0,G.jsx)(Sn,{asChild:!0,...o,children:(0,G.jsx)(de.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:ve(t,a.triggerRef),onPointerDown:U(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:U(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Gn.displayName=Wn;var Kn=`DropdownMenuPortal`,qn=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Bn(t);return(0,G.jsx)(Cn,{...r,...n})};qn.displayName=Kn;var Jn=`DropdownMenuContent`,Yn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Hn(Jn,n),a=Bn(n),o=q.useRef(!1);return(0,G.jsx)(wn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:U(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Yn.displayName=Jn;var Xn=`DropdownMenuGroup`,Zn=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Tn,{...i,...r,ref:t})});Zn.displayName=Xn;var Qn=`DropdownMenuLabel`,$n=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(En,{...i,...r,ref:t})});$n.displayName=Qn;var er=`DropdownMenuItem`,tr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Dn,{...i,...r,ref:t})});tr.displayName=er;var nr=`DropdownMenuCheckboxItem`,rr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(On,{...i,...r,ref:t})});rr.displayName=nr;var ir=`DropdownMenuRadioGroup`,ar=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(kn,{...i,...r,ref:t})});ar.displayName=ir;var or=`DropdownMenuRadioItem`,sr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(An,{...i,...r,ref:t})});sr.displayName=or;var cr=`DropdownMenuItemIndicator`,lr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(jn,{...i,...r,ref:t})});lr.displayName=cr;var ur=`DropdownMenuSeparator`,dr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Mn,{...i,...r,ref:t})});dr.displayName=ur;var fr=`DropdownMenuArrow`,pr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Nn,{...i,...r,ref:t})});pr.displayName=fr;var mr=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Bn(t),[s,c]=ue({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,G.jsx)(Pn,{...o,open:s,onOpenChange:c,children:n})},hr=`DropdownMenuSubTrigger`,gr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(Fn,{...i,...r,ref:t})});gr.displayName=hr;var _r=`DropdownMenuSubContent`,vr=q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Bn(n);return(0,G.jsx)(In,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});vr.displayName=_r;var yr=Un,br=Gn,xr=qn,Sr=Yn,Cr=$n,wr=tr,Tr=rr,Er=ar,Dr=sr,Or=lr,kr=dr,Ar=mr,jr=gr,Mr=vr,Nr=`Separator`,Pr=`horizontal`,Fr=[`horizontal`,`vertical`],Ir=q.forwardRef((e,t)=>{let{decorative:n,orientation:r=Pr,...i}=e,a=Lr(r)?r:Pr,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,G.jsx)(de.div,{"data-orientation":a,...o,...i,ref:t})});Ir.displayName=Nr;function Lr(e){return Fr.includes(e)}var Rr=Ir;function zr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Br(e){let t=(0,K.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,q.useState)(n),[a,o]=(0,q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return A(()=>{o(Wr)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Hr).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,frontmatterSources:e.frontmatter_sources??{}}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Vr),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Vr(e){return e+1}async function Hr(e){if(!e.ok){let t=await e.json().catch(Ur);throw Error(k(t)??`HTTP ${e.status}`)}return e.json()}function Ur(){return null}function Wr(e){return e+1}function Gr(e,t){let n=(0,K.c)(5),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},n[0]=r):r=n[0];let[i,a]=(0,q.useState)(r),o,s;return n[1]!==e||n[2]!==t?(o=()=>{if(!t||e===null){a({status:`idle`});return}let n=!1;a({status:`loading`});let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`;return fetch(`/api/template${r}`).then(Kr).then(e=>{if(!n){if(!e||typeof e!=`object`||!e.template){a({status:`error`,message:`Server returned an incomplete template response.`});return}a({status:`ready`,data:e.template})}}).catch(e=>{n||a({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{n=!0}},s=[e,t],n[1]=e,n[2]=t,n[3]=o,n[4]=s):(o=n[3],s=n[4]),(0,q.useEffect)(o,s),i}async function Kr(e){if(!e.ok){let t=await e.json().catch(qr);throw Error(k(t)??`HTTP ${e.status}`)}return e.json()}function qr(){return null}function Jr(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=H(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,G.jsx)(Rr,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function Yr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Xr=_e(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Zr(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=H(Xr({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Qr(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $r(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Be,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ei(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ti(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ni(e){let t=(0,K.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(ii)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,G.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(ri)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=H(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,G.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function ri(e){return e?.message&&(0,G.jsx)(`li`,{children:e.message},e.message)}function ii(e){return[e?.message,e]}async function ai(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function oi(){return si().status}function si(){let e=(0,K.c)(8),[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ai().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,q.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>I(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,q.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var ci=(0,q.createContext)(null);function li(e,t,n,r){console.warn(JSON.stringify({event:`ok-${e}-${n}`,docName:t,code:r?.code,reason:r?.reason??void 0}))}function ui(e,t,n){let r=new f,i=new v({url:e,name:t,document:r,onDisconnect:({event:e})=>li(`config-provider`,t,`disconnect`,e),onClose:({event:e})=>li(`config-provider`,t,`close`,e)}),a=j(i,n);return{binding:a,config:a.current(),cleanup:()=>{a.dispose(),i.destroy(),r.destroy()}}}function di(e){let t=new f,n=new v({url:e,name:B,document:t,onDisconnect:({event:e})=>li(`okignore-provider`,B,`disconnect`,e),onClose:({event:e})=>li(`okignore-provider`,B,`close`,e)}),r=te(n);return{binding:r,provider:n,cleanup:()=>{r.dispose(),n.destroy(),t.destroy()}}}function fi(e){let t=(0,K.c)(26),{children:n}=e,{collabUrl:r}=g(),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),f,p;t[0]===r?(f=t[1],p=t[2]):(f=()=>{if(r===null)return;let e=ui(r,V,`user`),t=ui(r,P,`project`),n=ui(r,z,`project-local`),i=di(r);a({binding:e.binding,config:e.config,synced:e.binding.hasSynced()}),s({binding:t.binding,config:t.config}),l({binding:n.binding,config:n.config,synced:n.binding.hasSynced()}),d({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),c=e.binding.subscribeSynced(()=>{a(t=>t?.binding===e.binding?{...t,synced:!0}:t)}),u=t.binding.subscribe(e=>{s(n=>n?.binding===t.binding?{...n,config:e}:n)}),f=n.binding.subscribe(e=>{l(t=>t?.binding===n.binding?{...t,config:e}:t)}),p=n.binding.subscribeSynced(()=>{l(e=>e?.binding===n.binding?{...e,synced:!0}:e)}),m=()=>{d(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,m),()=>{o(),c(),u(),f(),p(),i.provider.off(`synced`,m),e.cleanup(),t.cleanup(),n.cleanup(),i.cleanup(),a(t=>t?.binding===e.binding?null:t),s(e=>e?.binding===t.binding?null:e),l(e=>e?.binding===n.binding?null:e),d(e=>e?.binding===i.binding?null:e)}},p=[r],t[0]=r,t[1]=f,t[2]=p),(0,q.useEffect)(f,p);let m;t[3]!==c?.config||t[4]!==o||t[5]!==i?(m=i&&o?M(i.config,o.config,c?.config):null,t[3]=c?.config,t[4]=o,t[5]=i,t[6]=m):m=t[6];let h=m,{setTheme:_}=F(),v=h?.appearance?.theme,y,b;t[7]!==_||t[8]!==v?(y=()=>{(v===`light`||v===`dark`||v===`system`)&&_(v)},b=[v,_],t[7]=_,t[8]=v,t[9]=y,t[10]=b):(y=t[9],b=t[10]),(0,q.useEffect)(y,b),Ze(typeof window<`u`?window.okDesktop:void 0,v??`system`);let x=i?.binding??null,S=i?.synced??!1,C=o?.binding??null,w=c?.binding??null,T=u?.binding??null,E=u?.synced??!1,D=i?.config??null,O=o?.config??null,k=c?.config??null,A=c?.synced??!1,j;t[11]!==h||t[12]!==T||t[13]!==E||t[14]!==D||t[15]!==O||t[16]!==k||t[17]!==A||t[18]!==x||t[19]!==S||t[20]!==C||t[21]!==w?(j={userBinding:x,userSynced:S,projectBinding:C,projectLocalBinding:w,okignoreBinding:T,okignoreSynced:E,userConfig:D,projectConfig:O,projectLocalConfig:k,projectLocalSynced:A,merged:h},t[11]=h,t[12]=T,t[13]=E,t[14]=D,t[15]=O,t[16]=k,t[17]=A,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=j):j=t[22];let N=j,I;return t[23]!==n||t[24]!==N?(I=(0,G.jsx)(ci,{value:N,children:n}),t[23]=n,t[24]=N,t[25]=I):I=t[25],I}function pi(){let e=(0,q.use)(ci);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function mi(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ce,{children:`Enable git auto-sync?`}),(0,G.jsx)(Se,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),e[0]=t):t=e[0],t}function hi(){let e=(0,K.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`p`,{className:`mb-2 font-medium`,children:`Before you enable it`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:[t,(0,G.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[(0,G.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,G.jsx)(`li`,{children:`Open Knowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync.`}),(0,G.jsx)(`li`,{children:`If this repo is shared, your in-progress edits become visible to collaborators as soon as they sync.`})]})]}),e[1]=n):n=e[1],n}function gi(){let e=(0,K.c)(2),{projectLocalBinding:t}=pi();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{enabled:e}});return n.ok?{ok:!0}:{ok:!1,error:T(n.error)}},e[0]=t,e[1]=n),n}function _i(e){let t=(0,K.c)(10),[n,r]=(0,q.useState)(!1),i;t[0]===e?i=t[1]:(i=function(t){if(e===null)return Me.error(`Sync settings not yet loaded — try again in a moment`),!1;let n=e(t);return n.ok?!0:(console.error(`[sync] toggle failed:`,n.error),Me.error(`Failed to ${t?`enable`:`disable`} sync — ${n.error}`),!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=function(e){if(e){r(!0);return}a(!1)},t[2]=a,t[3]=o);let s=o,c;t[4]===a?c=t[5]:(c=function(){a(!0)&&r(!1)},t[4]=a,t[5]=c);let l=c,u;return t[6]!==n||t[7]!==l||t[8]!==s?(u={confirmOpen:n,setConfirmOpen:r,onToggleRequest:s,onConfirm:l},t[6]=n,t[7]=l,t[8]=s,t[9]=u):u=t[9],u}function vi(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(yr,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function yi(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(br,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function bi(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=H(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,G.jsx)(xr,{children:(0,G.jsx)(Sr,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function xi(e){let t=(0,K.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=H(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,G.jsx)(wr,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Si(e){let t=(0,K.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=H(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,G.jsx)(Or,{children:(0,G.jsx)(ye,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,G.jsxs)(Tr,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function Ci(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Er,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function wi(e){let t=(0,K.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=H(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,G.jsx)(Or,{children:(0,G.jsx)(ye,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(Dr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ti(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=H(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,G.jsx)(Cr,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Ei(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(kr,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Di(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(Ar,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Oi(e){let t=(0,K.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=H(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Pe,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(jr,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ki(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Mr,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ai(){var e=[...arguments];return(0,q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var ji=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Mi(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ni(e){return`nodeType`in e}function Pi(e){return e?Mi(e)?e:Ni(e)?e.ownerDocument?.defaultView??window:window:window}function Fi(e){let{Document:t}=Pi(e);return e instanceof t}function Ii(e){return Mi(e)?!1:e instanceof Pi(e).HTMLElement}function Li(e){return e instanceof Pi(e).SVGElement}function Ri(e){return e?Mi(e)?e.document:Ni(e)?Fi(e)?e:Ii(e)||Li(e)?e.ownerDocument:document:document:document}var zi=ji?q.useLayoutEffect:q.useEffect;function Bi(e){let t=(0,q.useRef)(e);return zi(()=>{t.current=e}),(0,q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Vi(){let e=(0,q.useRef)(null);return[(0,q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Hi(e,t){t===void 0&&(t=[e]);let n=(0,q.useRef)(e);return zi(()=>{n.current!==e&&(n.current=e)},t),n}function Ui(e,t){let n=(0,q.useRef)();return(0,q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Wi(e){let t=Bi(e),n=(0,q.useRef)(null);return[n,(0,q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Gi(e){let t=(0,q.useRef)();return(0,q.useEffect)(()=>{t.current=e},[e]),t.current}var Ki={};function qi(e,t){return(0,q.useMemo)(()=>{if(t)return t;let n=Ki[e]==null?0:Ki[e]+1;return Ki[e]=n,e+`-`+n},[e,t])}function Ji(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Yi=Ji(1),Xi=Ji(-1);function Zi(e){return`clientX`in e&&`clientY`in e}function Qi(e){if(!e)return!1;let{KeyboardEvent:t}=Pi(e.target);return t&&e instanceof t}function $i(e){if(!e)return!1;let{TouchEvent:t}=Pi(e.target);return t&&e instanceof t}function ea(e){if($i(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Zi(e)?{x:e.clientX,y:e.clientY}:null}var ta=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[ta.Translate.toString(e),ta.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),na=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function ra(e){return e.matches(na)?e:e.querySelector(na)}var ia={display:`none`};function aa(e){let{id:t,value:n}=e;return q.createElement(`div`,{id:t,style:ia},n)}function oa(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function sa(){let[e,t]=(0,q.useState)(``);return{announce:(0,q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ca=(0,q.createContext)(null);function la(e){let t=(0,q.useContext)(ca);(0,q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ua(){let[e]=(0,q.useState)(()=>new Set),t=(0,q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var da={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.