@inkeep/open-knowledge 0.0.0-dev-20260501144307 → 0.0.0-dev-20260501170533
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +6 -6
- package/dist/constants-B8HpPaWG.mjs +2 -0
- package/dist/{dist-B-uWyCj3.mjs → dist-BVnVlgjQ.mjs} +1 -1
- package/dist/{dist-WQbZIrx7.mjs → dist-CDuTCUx1.mjs} +7 -8
- package/dist/{dist-CUghvkAf.mjs → dist-oDoSs1Bl.mjs} +7 -7
- package/dist/index.mjs +1 -1
- package/dist/{init-qoXDcT6N.mjs → init-Bf7LOYAr.mjs} +2 -2
- package/dist/init-BhfL8UL0.mjs +1 -0
- package/dist/{init-DpiVQYhQ.mjs → init-CPq6B11A.mjs} +3 -3
- package/dist/init-DkzHwyzJ.mjs +1 -0
- package/dist/loader-5abUX3Eq.mjs +1 -0
- package/dist/{loader-BEUtMT2_.mjs → loader-C79dNoU-.mjs} +2 -2
- package/dist/paths-BIsyTDX6.mjs +1 -0
- package/dist/paths-Drz5vBVF.mjs +2 -0
- package/dist/{preview-BIrbsSSc.mjs → preview-AXEdeZ4w.mjs} +2 -2
- package/dist/preview-DUYE2XxR.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-C3KENqJ7.js → ActivityModeContent-CCJOMAyp.js} +1 -1
- package/dist/public/assets/DocumentContext-BHFNw5NZ.js +37 -0
- package/dist/public/assets/{GraphPanel-YIuSwj1X.js → GraphPanel-BuZEMdl-.js} +2 -2
- package/dist/public/assets/{McpConsentDialogBody-Dx67JoKA.js → McpConsentDialogBody-CI9rAMX9.js} +1 -1
- package/dist/public/assets/OutlinePanel-CnKUM65X.js +2 -0
- package/dist/public/assets/SettingsPane-B3rEEyMP.js +6 -0
- package/dist/public/assets/{SourceEditor-DGIgtF_h.js → SourceEditor-CE_X9auW.js} +2 -2
- package/dist/public/assets/{config-validation-events-Dlj9dOCp.js → config-validation-events-DqfR4UtM.js} +1 -1
- package/dist/public/assets/{index-DiLfeu2w.css → index-CKzUuzYV.css} +1 -1
- package/dist/public/assets/index-NVu982rh.js +1850 -0
- package/dist/public/assets/{target-navigation-intent-BeUCdVKa.js → target-navigation-intent-1238Z_HW.js} +1 -1
- package/dist/public/assets/{toggle-group-CyBGhndP.js → toggle-group-C5MXNna8.js} +3 -3
- package/dist/public/assets/{tooltip-FdwzzIbl.js → tooltip-BMlqVI54.js} +1 -1
- package/dist/public/index.html +9 -9
- package/dist/{server-Bc0tGxRk.mjs → server-Cb1yd7Zc.mjs} +2 -2
- package/dist/src-CPe0c6hz.mjs +1 -0
- package/dist/start-COO3npTl.mjs +1 -0
- package/dist/{start-BSqokDQs.mjs → start-Dl1pApAn.mjs} +2 -2
- package/package.json +2 -2
- package/dist/constants-D4b3yFb4.mjs +0 -2
- package/dist/init-CleqrmS6.mjs +0 -1
- package/dist/init-D1vMwuMO.mjs +0 -1
- package/dist/loader-CwvZAVlq.mjs +0 -1
- package/dist/paths-B1biT3Kh.mjs +0 -2
- package/dist/paths-BQoQfIvS.mjs +0 -1
- package/dist/preview-BNMytxTe.mjs +0 -1
- package/dist/public/assets/DocumentContext-gM6_1mHt.js +0 -34
- package/dist/public/assets/SettingsPane-tlYUoGwR.js +0 -6
- package/dist/public/assets/clipboard-CW1hOwDY.js +0 -5
- package/dist/public/assets/index-n9oW9uU-.js +0 -1848
- package/dist/src-CGZcpVS_.mjs +0 -1
- package/dist/start-C7hQj_dW.mjs +0 -1
- /package/dist/public/assets/{mcp-consent-store-BBTXqzE6.js → mcp-consent-store-B9QLSyUV.js} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Bt as i,Kt as a,T as o,bt as s,jt as c,n as l,q as u,qt as d,t as f,w as p}from"./toggle-group-C5MXNna8.js";import{S as m,g as h,r as g,t as _}from"./button-Dyz7QGIk.js";import{Bt as v,Ct as y,bt as b,n as x,q as S,rt as C,w,xt as T,zt as E}from"./DocumentContext-BHFNw5NZ.js";import{a as D,i as O,l as k,n as A,o as j,r as ee}from"./config-validation-events-DqfR4UtM.js";import{S as te,x as ne}from"./dialog-FUclf-NK.js";import{i as re,n as ie,t as ae}from"./tooltip-BMlqVI54.js";var oe=m(`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`}]]),M=r(),N=e(t(),1),se=e=>e.type===`checkbox`,P=e=>e instanceof Date,F=e=>e==null,ce=e=>typeof e==`object`,I=e=>!F(e)&&!Array.isArray(e)&&ce(e)&&!P(e),le=e=>I(e)&&e.target?se(e.target)?e.target.checked:e.target.value:e,ue=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),de=e=>{let t=e.constructor&&e.constructor.prototype;return I(t)&&t.hasOwnProperty(`isPrototypeOf`)},fe=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function L(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(fe&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(I(e)&&de(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=L(e[t]));return r}var R=e=>/^\w*$/.test(e),z=e=>e===void 0,pe=e=>Array.isArray(e)?e.filter(Boolean):[],me=e=>pe(e.replace(/["|']|\]/g,``).split(/\.|\[/)),B=(e,t,n)=>{if(!t||!I(e))return n;let r=(R(t)?[t]:me(t)).reduce((e,t)=>F(e)?void 0:e[t],e);return z(r)||r===e?z(e[t])?n:e[t]:r},V=e=>typeof e==`boolean`,H=e=>typeof e==`function`,U=(e,t,n)=>{let r=-1,i=R(t)?[t]:me(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=I(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},W={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},G={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},K={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},he=`form`,ge=`root`,_e=N.createContext(null);_e.displayName=`HookFormControlContext`;var ve=()=>N.useContext(_e),ye=(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]!==G.all&&(t._proxyFormState[i]=!r||G.all),n&&(n[i]=!0),e[i]}});return i},be=typeof window<`u`?N.useLayoutEffect:N.useEffect;function xe(e){let t=ve(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=N.useState(n._formState),c=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return be(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),N.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),N.useMemo(()=>ye(o,n,c.current,!1),[o,n])}var q=e=>typeof e==`string`,Se=(e,t,n,r,i)=>q(e)?(r&&t.watch.add(e),B(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),B(n,e))):(r&&(t.watchAll=!0),n),Ce=e=>F(e)||!ce(e);function J(e,t,n=new WeakSet){if(e===t)return!0;if(Ce(e)||Ce(t))return Object.is(e,t);if(P(e)&&P(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(P(r)&&P(e)||(I(r)||Array.isArray(r))&&(I(e)||Array.isArray(e))?!J(r,e,n):!Object.is(r,e))return!1}}return!0}function we(e){let t=ve(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=N.useRef(i),l=N.useRef(s),u=N.useRef(void 0),d=N.useRef(n),f=N.useRef(r);l.current=s;let[p,m]=N.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=N.useCallback(e=>{let t=Se(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=N.useCallback(e=>{if(!a){let t=Se(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);J(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);be(()=>((d.current!==n||!J(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]),N.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=N.useMemo(()=>{if(a)return null;let e=!_&&!J(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function Te(e){let t=ve(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=ue(i._names.array,n),l=we({control:i,name:n,defaultValue:N.useMemo(()=>B(i._formValues,n,B(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=xe({control:i,name:n,exact:s}),d=N.useRef(e),f=N.useRef(i.register(n,{...e.rules,value:l,...V(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let p=N.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!B(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!B(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!B(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!B(u.validatingFields,n)},error:{enumerable:!0,get:()=>B(u.errors,n)}}),[u,n]),m=N.useCallback(e=>f.current.onChange({target:{value:le(e),name:n},type:W.CHANGE}),[n]),h=N.useCallback(()=>f.current.onBlur({target:{value:B(i._formValues,n),name:n},type:W.BLUR}),[n,i._formValues]),g=N.useCallback(e=>{let t=B(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>H(e.focus)&&e.focus(),select:()=>H(e.select)&&e.select(),setCustomValidity:t=>H(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>H(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),_=N.useMemo(()=>({name:n,value:l,...V(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:m,onBlur:h,ref:g}),[n,r,u.disabled,m,h,g,l]);return N.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...V(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=B(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=L(B(i._options.defaultValues,n,d.current.defaultValue));U(i._defaultValues,n,e),z(B(i._formValues,n))&&U(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]),N.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),N.useMemo(()=>({field:_,formState:u,fieldState:p}),[_,u,p])}var Ee=e=>e.render(Te(e)),De=N.createContext(null);De.displayName=`HookFormContext`;var Oe=()=>N.useContext(De),ke=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=N.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 N.createElement(De.Provider,{value:v},N.createElement(_e.Provider,{value:v.control},t))},Ae=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Y=e=>Array.isArray(e)?e:[e],je=()=>{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 Me(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&I(i)&&a){let e=Me(i,a);I(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var X=e=>I(e)&&!Object.keys(e).length,Ne=e=>e.type===`file`,Pe=e=>{if(!fe)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Fe=e=>e.type===`select-multiple`,Ie=e=>e.type===`radio`,Le=e=>Ie(e)||se(e),Re=e=>Pe(e)&&e.isConnected;function ze(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(F(e)){e=void 0;break}e=e[t[r]],r++}return e}function Be(e){for(let t in e)if(e.hasOwnProperty(t)&&!z(e[t]))return!1;return!0}function Z(e,t){if(q(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:R(t)?[t]:me(t),r=n.length===1?e:ze(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(I(r)&&X(r)||Array.isArray(r)&&Be(r))&&Z(e,n.slice(0,-1)),e}var Ve=e=>{for(let t in e)if(H(e[t]))return!0;return!1};function He(e){return Array.isArray(e)||I(e)&&!Ve(e)}function Ue(e,t={}){for(let n in e){let r=e[n];He(r)?(t[n]=Array.isArray(r)?[]:{},Ue(r,t[n])):z(r)||(t[n]=!0)}return t}function We(e,t,n){n||=Ue(t);for(let r in e){let i=e[r];if(He(i))z(t)||Ce(n[r])?n[r]=Ue(i,Array.isArray(i)?[]:{}):We(i,F(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!J(i,e)}}return n}var Ge={value:!1,isValid:!1},Ke={value:!0,isValid:!0},qe=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&&!z(e[0].attributes.value)?z(e[0].value)||e[0].value===``?Ke:{value:e[0].value,isValid:!0}:Ke:Ge}return Ge},Je=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>z(e)?e:t?e===``?NaN:e&&+e:n&&q(e)?new Date(e):r?r(e):e,Ye={isValid:!1,value:null},Xe=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ye):Ye;function Ze(e){let t=e.ref;return Ne(t)?t.files:Ie(t)?Xe(e.refs).value:Fe(t)?[...t.selectedOptions].map(({value:e})=>e):se(t)?qe(e.refs).value:Je(z(t.value)?e.ref.value:t.value,e)}var Qe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,$e=(e,t,n,r)=>{let i={};for(let n of e){let e=B(t,n);e&&U(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},et=e=>e instanceof RegExp,tt=e=>z(e)?e:et(e)?e.source:I(e)?et(e.value)?e.value.source:e.value:e,nt=e=>({isOnSubmit:!e||e===G.onSubmit,isOnBlur:e===G.onBlur,isOnChange:e===G.onChange,isOnAll:e===G.all,isOnTouch:e===G.onTouched}),rt=`AsyncFunction`,it=e=>!!e&&!!e.validate&&!!(H(e.validate)&&e.validate.constructor.name===rt||I(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===rt)),at=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ot=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),st=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=B(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(st(a,t))break}else if(I(a)&&st(a,t))break}}};function ct(e,t,n){let r=B(e,n);if(r||R(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=B(t,r),o=B(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 lt=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return X(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||G.all))},ut=(e,t,n)=>!e||!t||e===t||Y(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),dt=(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,ft=(e,t)=>!pe(B(e,t)).length&&Z(e,t),pt=(e,t,n)=>{let r=Y(B(e,n));return U(r,ge,t[n]),U(e,n,r),e};function mt(e,t,n=`validate`){if(q(e)||Array.isArray(e)&&e.every(q)||V(e)&&!e)return{type:n,message:q(e)?e:``,ref:t}}var ht=e=>I(e)&&!et(e)?e:{value:e,message:``},gt=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=B(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(V(e)?``:e||``),y.reportValidity())},x={},S=Ie(o),C=se(o),w=S||C,T=(g||Ne(o))&&z(o.value)&&z(v)||Pe(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length||g&&typeof v==`number`&&isNaN(v),E=Ae.bind(null,h,r,x),D=(e,t,n,r=K.maxLength,i=K.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||F(v))||V(v)&&!v||C&&!qe(s).isValid||S&&!Xe(s).isValid)){let{value:e,message:t}=q(c)?{value:!!c,message:c}:ht(c);if(e&&(x[h]={type:K.required,message:t,ref:y,...E(K.required,t)},!r))return b(t),x}if(!T&&(!F(d)||!F(f))){let e,t,n=ht(f),i=ht(d);if(!F(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;F(n.value)||(e=r>n.value),F(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`;q(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),q(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,K.max,K.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(q(v)||a&&Array.isArray(v))){let e=ht(l),t=ht(u),n=!F(e.value)&&v.length>+e.value,i=!F(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&&q(v)){let{value:e,message:t}=ht(p);if(et(e)&&!v.match(e)&&(x[h]={type:K.pattern,message:t,ref:o,...E(K.pattern,t)},!r))return b(t),x}if(m){if(H(m)){let e=mt(await m(v,n),y);if(e&&(x[h]={...e,...E(K.validate,e.message)},!r))return b(e.message),x}else if(I(m)){let e={};for(let t in m){if(!X(e)&&!r)break;let i=mt(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!X(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},_t={mode:G.onSubmit,reValidateMode:G.onChange,shouldFocusError:!0};function vt(e={}){let t={..._t,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:H(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(I(t.defaultValues)||I(t.values))&&L(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:L(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:je(),state:je()},m=t.criteriaMode===G.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=X((await T()).errors),_()):e=await O({fields:r,onlyCheckValid:!0,eventType:W.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?U(n.validatingFields,e,r):Z(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!X(n.validatingFields)}))},v=e=>{let t=We(i,a),r=Qe(e);U(n.dirtyFields,r,B(t,r))},y=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(B(r,e))){let t=s(B(r,e),c.argA,c.argB);l&&U(r,e,t)}if(u&&Array.isArray(B(n.errors,e))){let t=s(B(n.errors,e),c.argA,c.argB);l&&U(n.errors,e,t),ft(n.errors,e)}if((d.touchedFields||f.touchedFields)&&u&&Array.isArray(B(n.touchedFields,e))){let t=s(B(n.touchedFields,e),c.argA,c.argB);l&&U(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 U(a,e,i)},b=(e,t)=>{U(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=B(r,e);if(c){let r=B(a,e,z(n)?B(i,e):n);z(r)||s&&s.defaultChecked||t?U(a,e,t?r:Ze(c._f)):te(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=J(B(i,e),r);l=!!B(n.dirtyFields,e),t?Z(n.dirtyFields,e):U(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=B(n.touchedFields,e);t||(U(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=B(n.errors,e),s=(d.isValid||f.isValid)&&V(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>b(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?U(n.errors,e,i):Z(n.errors,e)),(i?!J(o,i):o)||!X(a)||s){let t={...a,...s&&V(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,$e(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=B(t,r);e?U(n.errors,r,e):Z(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(I(i))for(let e in i)i[e]&&R(`${he}.${e}`,{message:q(i.message)?i.message:``,type:K.validate});else q(i)||!i?R(he,{message:i||``,type:K.validate}):de(he);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&&it(u._f);c&&d.validatingFields&&_([r.name],!0);let f=await gt(u,s.disabled,a,m,t.shouldUseNativeValidation&&!i,o);if(c&&d.validatingFields&&_([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(B(f,r.name)?o?pt(n.errors,f,r.name):U(n.errors,r.name,f[r.name]):Z(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!X(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=B(r,e);t&&(t._f.refs?t._f.refs.every(e=>!Re(e)):!Re(t._f.ref))&&ye(e)}s.unMount=new Set},A=(e,n)=>!t.disabled&&(e&&n&&U(a,e,n),!J(N(),i)),j=(e,t,n)=>Se(e,s,{...o.mount?a:z(t)?i:q(e)?{[e]:t}:t},n,t),ee=e=>pe(B(o.mount?a:i,e,t.shouldUnregister?B(i,e,[]):[])),te=(e,t,n={})=>{let i=B(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&U(a,e,Je(t,n)),o=Pe(n.ref)&&F(t)?``:t,Fe(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?se(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):Ne(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:L(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&M(e)},ne=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=B(r,o);(s.array.has(e)||I(a)||c&&!c._f)&&!P(a)?ne(o,a,n):te(o,a,n)}},re=(e,t,i={})=>{let c=B(r,e),l=s.array.has(e),u=L(t),d=J(B(a,e),u);if(U(a,e,u),l)p.array.next({name:e,values:L(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||X(u);!c||c._f||F(u)||t?te(e,u,i):ne(e,u,i)}d||(ot(e,s)?p.state.next({...n,name:e,values:L(a)}):p.state.next({name:o.mount?e:void 0,values:L(a)}))},ie=e=>{let t=H(e)?e(a):e;J(a,t)||(a={...a,...t},p.state.next({...n,values:a}))},ae=async i=>{o.mount=!0;let l=i.target,u=l.name,h=!0,v=B(r,u),y=e=>{h=Number.isNaN(e)||P(e)&&isNaN(e.getTime())||J(e,B(a,u,e))},b=nt(t.mode),x=nt(t.reValidateMode);if(v){let o,S,E=l.type?Ze(v._f):le(i),k=i.type===W.BLUR||i.type===W.FOCUS_OUT,A=!at(v._f)&&!e.validate&&!t.resolver&&!B(n.errors,u)&&!v._f.deps||dt(k,B(n.touchedFields,u),n.isSubmitted,x,b),j=ot(u,s,k);U(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 ee=C(u,E,k),te=!X(ee)||j;if(!k&&p.state.next({name:u,type:i.type,values:L(a)}),A)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?k&&g():k||g()),te&&p.state.next({name:u,...j?{}:ee});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=ct(n.errors,r,u),i=ct(e,r,t.name||u);o=i.error,u=i.name,S=X(e)}}else _([u],!0),o=(await gt(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)&&M(v._f.deps),w(u,S,o,ee))}},oe=(e,t)=>{if(B(n.errors,t)&&e.focus)return e.focus(),1},M=async(e,i={})=>{let a,o,c=Y(e);if(t.resolver){let t=await E(z(e)?e:c);a=X(t),o=e?!c.some(e=>B(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=B(r,e);return await O({fields:t&&t._f?{[e]:t}:t,eventType:W.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await O({fields:r,name:e,eventType:W.TRIGGER});return p.state.next({...!q(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&st(r,oe,e?c:s.mount),o},N=(e,t)=>{let r={...o.mount?a:i};return t&&(r=Me(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),z(e)?r:q(e)?B(r,e):e.map(e=>B(r,e))},ce=(e,t)=>({invalid:!!B((t||n).errors,e),isDirty:!!B((t||n).dirtyFields,e),error:B((t||n).errors,e),isValidating:!!B(n.validatingFields,e),isTouched:!!B((t||n).touchedFields,e)}),de=e=>{let t=e?Y(e):void 0;t?.forEach(e=>Z(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},R=(e,t,i)=>{let a=(B(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=B(n.errors,e)||{};U(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()},me=(e,t)=>H(e)?p.state.subscribe({next:n=>`values`in n&&e(n.values||j(void 0,t),n)}):j(e,t,!0),_e=e=>p.state.subscribe({next:t=>{if(ut(e.name,t.name,e.exact)&<(t,e.formState||d,Ae,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}}).unsubscribe,ve=e=>(o.mount=!0,f={...f,...e.formState},_e({...e,formState:{...u,...e.formState}})),ye=(e,o={})=>{for(let c of e?Y(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(Z(r,c),Z(a,c)),!o.keepError&&Z(n.errors,c),!o.keepDirty&&Z(n.dirtyFields,c),!o.keepTouched&&Z(n.touchedFields,c),!o.keepIsValidating&&Z(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&Z(i,c);p.state.next({values:L(a)}),p.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&g()},be=({disabled:e,name:t})=>{if(V(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()}},xe=(e,n={})=>{let a=B(r,e),c=V(n.disabled)||V(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return U(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?be({disabled:V(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:tt(n.min),max:tt(n.max),minLength:tt(n.minLength),maxLength:tt(n.maxLength),pattern:tt(n.pattern)}:{},name:e,onChange:ae,onBlur:ae,ref:c=>{if(c){s.registerName.add(e),xe(e,n),s.registerName.delete(e),a=B(r,e);let t=z(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Le(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;U(r,e,{_f:{...a._f,...o?{refs:[...l.filter(Re),t,...Array.isArray(B(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=B(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(ue(s.array,e)&&o.action)&&s.unMount.add(e)}}},Ce=()=>t.shouldFocusError&&st(r,oe,s.mount),we=e=>{V(e)&&(p.state.next({disabled:e}),st(r,(t,n)=>{let i=B(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))},Te=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=L(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await T();_(),n.errors=e,l=L(t)}else await O({fields:r,eventType:W.SUBMIT});if(s.disabled.size)for(let e of s.disabled)Z(l,e);if(Z(n.errors,ge),X(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),Ce(),setTimeout(Ce);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:X(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},Ee=(e,t={})=>{B(r,e)&&(z(t.defaultValue)?re(e,L(B(i,e))):(re(e,t.defaultValue),U(i,e,L(t.defaultValue))),t.keepTouched||Z(n.touchedFields,e),t.keepDirty||(Z(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,L(B(i,e))):A()),t.keepError||(Z(n.errors,e),d.isValid&&g()),p.state.next({...n}))},De=(e,c={})=>{let l=e?L(e):i,u=L(l),f=X(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(We(i,a))]);for(let t of Array.from(e)){let e=B(n.dirtyFields,t),r=B(a,t),i=B(m,t);e&&!z(r)?U(m,t,r):!e&&!z(i)&&re(t,i)}}else{if(fe&&z(e))for(let e of s.mount){let t=B(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Pe(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)re(e,B(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?L(i):{}:L(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&&!X(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&&!J(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?We(i,a):n.dirtyFields:c.keepDefaultValues&&e?We(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})},Oe=(e,n)=>De(H(e)?e(a):e,{...t.resetOptions,...n}),ke=(e,t={})=>{let n=B(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&H(e.select)&&e.select()})}},Ae=e=>{n={...n,...e}},Ie={control:{register:xe,unregister:ye,getFieldState:ce,handleSubmit:Te,setError:R,_subscribe:_e,_runSchema:T,_updateIsValidating:_,_focusError:Ce,_getWatch:j,_getDirty:A,_setValid:g,_setFieldArray:y,_setDisabledField:be,_setErrors:x,_getFieldArray:ee,_reset:De,_resetDefaultValues:()=>H(t.defaultValues)&&t.defaultValues().then(e=>{Oe(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:we,_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:ve,trigger:M,register:xe,handleSubmit:Te,watch:me,setValue:re,setValues:ie,getValues:N,reset:Oe,resetField:Ee,clearErrors:de,unregister:ye,setError:R,setFocus:ke,getFieldState:ce};return{...Ie,formControl:Ie}}var Q=()=>{if(typeof crypto<`u`&&crypto.randomUUID)return crypto.randomUUID();let e=typeof performance>`u`?Date.now():performance.now()*1e3;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(Math.random()*16+e)%16|0;return(t==`x`?n:n&3|8).toString(16)})},yt=(e,t,n={})=>n.shouldFocus||z(n.shouldFocus)?n.focusName||`${e}.${z(n.focusIndex)?t:n.focusIndex}.`:``,bt=(e,t)=>[...e,...Y(t)],xt=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function St(e,t,n){return[...e.slice(0,t),...Y(n),...e.slice(t)]}var Ct=(e,t,n)=>Array.isArray(e)?(z(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],wt=(e,t)=>[...Y(t),...Y(e)];function Tt(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return pe(r).length?r:[]}var Et=(e,t)=>z(t)?[]:Tt(e,Y(t).sort((e,t)=>e-t)),Dt=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Ot=(e,t,n)=>(e[t]=n,e);function kt(e){let t=ve(),{control:n=t,name:r,keyName:i=`id`,shouldUnregister:a,rules:o}=e,[s,c]=N.useState(n._getFieldArray(r)),l=N.useRef(n._getFieldArray(r).map(Q)),u=N.useRef(!1);n._names.array.add(r),N.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),be(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=B(e,r);Array.isArray(t)&&(c(t),l.current=t.map(Q))}}}).unsubscribe,[n,r]);let d=N.useCallback(e=>{u.current=!0,n._setFieldArray(r,e)},[n,r]);return N.useEffect(()=>{n._state.action=!1,ot(r,n._names)&&n._subjects.state.next({...n._formState});let e=nt(n._options.mode);if(u.current&&(!e.isOnSubmit||n._formState.isSubmitted)&&!nt(n._options.reValidateMode).isOnSubmit&&!e.isOnBlur)if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=B(e.errors,r),i=B(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?U(n._formState.errors,r,t):Z(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=B(n._fields,r);e&&e._f&&!(nt(n._options.reValidateMode).isOnSubmit&&nt(n._options.mode).isOnSubmit)&>(e,n._names.disabled,n._formValues,n._options.criteriaMode===G.all,n._options.shouldUseNativeValidation,!0).then(e=>!X(e)&&n._subjects.state.next({errors:pt(n._formState.errors,e,r)}))}n._subjects.state.next({name:r,values:L(n._formValues)}),n._names.focus&&st(n._fields,(e,t)=>{if(n._names.focus&&t.startsWith(n._names.focus)&&e.focus)return e.focus(),1}),n._names.focus=``,n._setValid(),u.current=!1},[s,r,n]),N.useEffect(()=>(!B(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=B(n._fields,e);r&&r._f&&(r._f.mount=t)})(r,!1)}),[r,n,i,a]),{swap:N.useCallback((e,t)=>{let i=n._getFieldArray(r);Dt(i,e,t),Dt(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Dt,{argA:e,argB:t},!1)},[d,r,n]),move:N.useCallback((e,t)=>{let i=n._getFieldArray(r);Ct(i,e,t),Ct(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Ct,{argA:e,argB:t},!1)},[d,r,n]),prepend:N.useCallback((e,t)=>{let i=Y(L(e)),a=wt(n._getFieldArray(r),i);n._names.focus=yt(r,0,t),l.current=wt(l.current,i.map(Q)),d(a),c(a),n._setFieldArray(r,a,wt,{argA:xt(e)})},[d,r,n]),append:N.useCallback((e,t)=>{let i=Y(L(e)),a=bt(n._getFieldArray(r),i);n._names.focus=yt(r,a.length-1,t),l.current=bt(l.current,i.map(Q)),d(a),c(a),n._setFieldArray(r,a,bt,{argA:xt(e)})},[d,r,n]),remove:N.useCallback(e=>{let t=Et(n._getFieldArray(r),e);l.current=Et(l.current,e),d(t),c(t),!Array.isArray(B(n._fields,r))&&U(n._fields,r,void 0),n._setFieldArray(r,t,Et,{argA:e})},[d,r,n]),insert:N.useCallback((e,t,i)=>{let a=Y(L(t)),o=St(n._getFieldArray(r),e,a);n._names.focus=yt(r,e,i),l.current=St(l.current,e,a.map(Q)),d(o),c(o),n._setFieldArray(r,o,St,{argA:e,argB:xt(t)})},[d,r,n]),update:N.useCallback((e,t)=>{let i=L(t),a=Ot(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?Q():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,Ot,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:N.useCallback(e=>{let t=Y(L(e));l.current=t.map(Q),d([...t]),c([...t]),n._setFieldArray(r,[...t],e=>e,{},!0,!1)},[d,r,n]),fields:N.useMemo(()=>s.map((e,t)=>({...e,[i]:l.current[t]||Q()})),[s,i])}}function At(e={}){let t=N.useRef(void 0),n=N.useRef(void 0),[r,i]=N.useState({isDirty:!1,isValidating:!1,isLoading:H(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:H(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!H(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=vt(e);t.current={...i,formState:r}}let a=t.current.control;return a._options=e,be(()=>{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]),N.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),N.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),N.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),N.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),N.useEffect(()=>{e.values&&!J(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]),N.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=N.useMemo(()=>ye(r,a),[a,r]),t.current}var $=n(),jt=ke,Mt=N.createContext({}),Nt=e=>{let t=(0,M.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)(Ee,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(Mt.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},Pt=()=>{let e=(0,M.c)(13),t=N.use(Mt),n=N.use(Ft),{getFieldState:r}=Oe(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=xe(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},Ft=N.createContext({});function It(e){let t=(0,M.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=N.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=g(`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)(Ft.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function Lt(e){let t=(0,M.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}=Pt(),o=!!i,s;t[3]===n?s=t[4]:(s=g(`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)(O,{"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 Rt(e){let t=(0,M.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}=Pt(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(h,{"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 zt(e){let t=(0,M.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}=Pt(),a;t[3]===n?a=t[4]:(a=g(`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 Bt(e){let t=(0,M.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}=Pt(),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=g(`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}function Vt(e){let t=(0,M.c)(40),{value:n,onChange:r,onBlur:i,placeholder:a,id:o,disabled:s,"aria-describedby":c,"aria-invalid":l,ref:u}=e,d=a===void 0?`Add tag…`:a,[f,p]=(0,N.useState)(``),m;t[0]!==r||t[1]!==n?(m=e=>{let t=e.trim();if(t){if(n.includes(t)){p(``);return}r([...n,t]),p(``)}},t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,_;t[3]!==r||t[4]!==n?(_=e=>{r(n.filter((t,n)=>n!==e))},t[3]=r,t[4]=n,t[5]=_):_=t[5];let v=_,y=s&&`pointer-events-none opacity-60`,x;t[6]===y?x=t[7]:(x=g(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,y),t[6]=y,t[7]=x);let S;if(t[8]!==s||t[9]!==v||t[10]!==n){let e;t[12]!==s||t[13]!==v?(e=(e,t)=>(0,$.jsxs)(b,{variant:`secondary`,className:`gap-1 pl-2 pr-1`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>v(t),"aria-label":`Remove ${e}`,className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:s,children:(0,$.jsx)(te,{className:`size-3`,"aria-hidden":`true`})})]},e),t[12]=s,t[13]=v,t[14]=e):e=t[14],S=n.map(e),t[8]=s,t[9]=v,t[10]=n,t[11]=S}else S=t[11];let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>p(e.target.value),t[15]=C):C=t[15];let w;t[16]!==h||t[17]!==f||t[18]!==v||t[19]!==n.length?(w=e=>{e.key===`Enter`?f.trim()&&(e.preventDefault(),h(f)):e.key===`,`?(e.preventDefault(),f.trim()&&h(f)):e.key===`Tab`?f.trim()&&(e.preventDefault(),h(f)):e.key===`Backspace`&&f===``&&n.length>0&&(e.preventDefault(),v(n.length-1))},t[16]=h,t[17]=f,t[18]=v,t[19]=n.length,t[20]=w):w=t[20];let T;t[21]!==h||t[22]!==f||t[23]!==i?(T=()=>{f.trim()&&h(f),i?.()},t[21]=h,t[22]=f,t[23]=i,t[24]=T):T=t[24];let E=n.length===0?d:``,D;t[25]!==c||t[26]!==l||t[27]!==s||t[28]!==f||t[29]!==o||t[30]!==u||t[31]!==E||t[32]!==w||t[33]!==T?(D=(0,$.jsx)(`input`,{id:o,ref:u,type:`text`,value:f,onChange:C,onKeyDown:w,onBlur:T,placeholder:E,"aria-describedby":c,"aria-invalid":l,disabled:s,className:`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`}),t[25]=c,t[26]=l,t[27]=s,t[28]=f,t[29]=o,t[30]=u,t[31]=E,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O;return t[35]!==l||t[36]!==D||t[37]!==x||t[38]!==S?(O=(0,$.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":l,className:x,children:[S,D]}),t[35]=l,t[36]=D,t[37]=x,t[38]=S,t[39]=O):O=t[39],O}var Ht=`folders`;function Ut(e){let t=(0,M.c)(36),{form:n,commitField:r,scope:i,flashedPath:a}=e,o;t[0]===n.control?o=t[1]:(o={control:n.control,name:`folders`},t[0]=n.control,t[1]=o);let{fields:s,append:c,remove:l,move:u}=kt(o),d;t[2]!==r||t[3]!==n?(d=()=>n.getFieldState(Ht).isDirty?r(Ht):!0,t[2]=r,t[3]=n,t[4]=d):d=t[4];let f=d,p;t[5]===r?p=t[6]:(p=()=>r(Ht),t[5]=r,t[6]=p);let m=p,h;t[7]===c?h=t[8]:(h=()=>{c({match:``,frontmatter:{}},{shouldFocus:!0})},t[7]=c,t[8]=h);let g=h,v;t[9]!==s.length||t[10]!==l||t[11]!==m?(v=e=>{let t=s.length-1,n=Math.min(e,t-1);l(e),m(),queueMicrotask(()=>{let e=document.querySelector(`[data-testid="settings-folders-section"]`);e&&(t>0?e.querySelector(`[data-folder-row="${n}"] [data-folder-action="remove"]`)?.focus():e.querySelector(`[data-folder-action="add"]`)?.focus())})},t[9]=s.length,t[10]=l,t[11]=m,t[12]=v):v=t[12];let y=v,b;t[13]!==u||t[14]!==m?(b=e=>{e!==0&&(u(e,e-1),m())},t[13]=u,t[14]=m,t[15]=b):b=t[15];let x=b,S;t[16]!==s.length||t[17]!==u||t[18]!==m?(S=e=>{e>=s.length-1||(u(e,e+1),m())},t[16]=s.length,t[17]=u,t[18]=m,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h2`,{id:`settings-folders-title`,className:`text-base font-semibold`,children:`Folders`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Default frontmatter applied to documents matching glob patterns. Order matters: later rules override earlier ones.`})]}),t[20]=w):w=t[20];let T;t[21]!==s||t[22]!==a||t[23]!==n||t[24]!==C||t[25]!==x||t[26]!==y||t[27]!==f?(T=s.length===0?(0,$.jsx)(`p`,{className:`rounded border border-dashed border-muted px-3 py-4 text-center text-xs text-muted-foreground`,children:`No folder rules yet. Add one to apply default frontmatter to a directory.`}):(0,$.jsx)(`ol`,{className:`space-y-3`,role:`list`,children:s.map((e,t)=>(0,$.jsx)(Wt,{index:t,total:s.length,form:n,flashedPath:a,onCommitIfDirty:f,onRemove:y,onMoveUp:x,onMoveDown:C},e.id))}),t[21]=s,t[22]=a,t[23]=n,t[24]=C,t[25]=x,t[26]=y,t[27]=f,t[28]=T):T=t[28];let E;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),t[29]=E):E=t[29];let D;t[30]===g?D=t[31]:(D=(0,$.jsx)(`div`,{children:(0,$.jsxs)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:g,"data-folder-action":`add`,children:[E,`Add folder rule`]})}),t[30]=g,t[31]=D);let O;return t[32]!==i||t[33]!==D||t[34]!==T?(O=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-folders-title`,className:`space-y-3`,"data-testid":`settings-folders-section`,"data-scope":i,children:[w,T,D]}),t[32]=i,t[33]=D,t[34]=T,t[35]=O):O=t[35],O}function Wt({index:e,total:t,form:n,flashedPath:r,onCommitIfDirty:i,onRemove:a,onMoveUp:o,onMoveDown:s}){"use no memo";let c=`folders.${e}.match`,l=`folders.${e}.frontmatter.title`,u=`folders.${e}.frontmatter.description`,d=`folders.${e}.frontmatter.tags`,f=n.getValues(c),p=typeof f==`string`&&f.trim()?`Remove folder rule ${f}`:`Remove untitled folder rule`;return(0,$.jsxs)(`li`,{"data-folder-row":e,className:`space-y-3 rounded-md border bg-background p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground`,"aria-hidden":`true`,children:[`#`,e+1]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-muted-foreground`,onClick:()=>o(e),disabled:e===0,"aria-label":`Move folder rule ${e+1} up`,children:(0,$.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`})}),(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-muted-foreground`,onClick:()=>s(e),disabled:e>=t-1,"aria-label":`Move folder rule ${e+1} down`,children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":`true`})}),(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-muted-foreground hover:text-destructive`,onClick:()=>a(e),"aria-label":p,"data-folder-action":`remove`,children:(0,$.jsx)(y,{className:`size-3.5`,"aria-hidden":`true`})})]})]}),(0,$.jsx)(Nt,{control:n.control,name:c,render:({field:e})=>(0,$.jsxs)(It,{className:`space-y-1 ${r===c?`animate-settings-flash`:``}`,"data-field":c,children:[(0,$.jsx)(Lt,{className:`text-sm font-medium`,children:`Match`}),(0,$.jsxs)(zt,{className:`text-xs text-muted-foreground`,children:[`Glob pattern (e.g. `,(0,$.jsx)(`code`,{className:`font-mono`,children:`specs/**`}),`).`]}),(0,$.jsx)(Rt,{children:(0,$.jsx)(T,{value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),i()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},className:`h-8 text-sm`,placeholder:`specs/**`})}),(0,$.jsx)(Bt,{"data-field-error":c})]})}),(0,$.jsx)(Nt,{control:n.control,name:l,render:({field:e})=>(0,$.jsxs)(It,{className:`space-y-1 ${r===l?`animate-settings-flash`:``}`,"data-field":l,children:[(0,$.jsx)(Lt,{className:`text-sm font-medium`,children:`Title`}),(0,$.jsxs)(zt,{className:`text-xs text-muted-foreground`,children:[`Default `,(0,$.jsx)(`code`,{className:`font-mono`,children:`title`}),` frontmatter for matched docs.`]}),(0,$.jsx)(Rt,{children:(0,$.jsx)(T,{value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),i()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},className:`h-8 text-sm`})}),(0,$.jsx)(Bt,{"data-field-error":l})]})}),(0,$.jsx)(Nt,{control:n.control,name:u,render:({field:e})=>(0,$.jsxs)(It,{className:`space-y-1 ${r===u?`animate-settings-flash`:``}`,"data-field":u,children:[(0,$.jsx)(Lt,{className:`text-sm font-medium`,children:`Description`}),(0,$.jsxs)(zt,{className:`text-xs text-muted-foreground`,children:[`Default `,(0,$.jsx)(`code`,{className:`font-mono`,children:`description`}),` frontmatter for matched docs.`]}),(0,$.jsx)(Rt,{children:(0,$.jsx)(T,{value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),i()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},className:`h-8 text-sm`})}),(0,$.jsx)(Bt,{"data-field-error":u})]})}),(0,$.jsx)(Nt,{control:n.control,name:d,render:({field:e})=>(0,$.jsxs)(It,{className:`space-y-1 ${r===d?`animate-settings-flash`:``}`,"data-field":d,children:[(0,$.jsx)(Lt,{className:`text-sm font-medium`,children:`Tags`}),(0,$.jsx)(zt,{className:`text-xs text-muted-foreground`,children:`Default tags applied to matched docs (unioned with file-level tags).`}),(0,$.jsx)(Rt,{children:(0,$.jsx)(Gt,{ctl:e,onCommit:i})}),(0,$.jsx)(Bt,{"data-field-error":d})]})})]})}function Gt({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value:[];return(0,$.jsx)(Vt,{...n,ref:e.ref,value:r,onChange:e.onChange,onBlur:()=>{e.onBlur(),t()}})}function Kt(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:Kt(r,t)}}function qt(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function Jt(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function Yt(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function Xt(e){let t=(0,M.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=At(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Zt(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,N.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Qt(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Zt(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Qt(e,t,n){let r=e.getValues(n),i=Kt(tn(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(c(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:$t(a.error,n)});return!1}function $t(e,t){if(c(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>en(e,t));if(n)return n.message}return s(e)}function en(e,t){return e.path.map(String).join(`.`)===t}function tn(e){return e.split(`.`)}var nn=[{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (project-only).`}]},{id:`folders`,title:`Folders`,description:`Default frontmatter applied to documents matching glob patterns. Order matters: later rules override earlier ones.`,fields:[],custom:`folders`},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function rn(e,t){let n=(0,M.c)(4),[r,i]=(0,N.useState)(null),a,s;return n[0]!==e||n[1]!==t?(a=()=>{if(e===null)return;let n=t===`project`?p:o,r=new C,a=new S({url:e,name:n,document:r}),s=u(a,t),c=!0,l=()=>{c&&i(e=>e?.provider===a?{...e,synced:!0}:e)};return a.on(`synced`,l),i({provider:a,binding:s,synced:!1}),()=>{c=!1,a.off(`synced`,l),s.dispose(),a.destroy(),r.destroy(),i(e=>e?.provider===a?null:e)}},s=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=s):(a=n[2],s=n[3]),(0,N.useEffect)(a,s),r}function an(e){let t=(0,M.c)(24),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=x(),o=rn(a,n),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=e=>{(e===`project`||e===`user`)&&i(e)},t[1]=i,t[2]=c);let u,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(l,{value:`project`,className:`text-xs`,children:`This project`}),d=(0,$.jsx)(l,{value:`user`,className:`text-xs`,children:`User`}),t[3]=u,t[4]=d):(u=t[3],d=t[4]);let p;t[5]!==n||t[6]!==c?(p=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[s,(0,$.jsxs)(f,{type:`single`,value:n,onValueChange:c,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[u,d]})]}),t[5]=n,t[6]=c,t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(te,{className:`size-4`}),t[8]=m):m=t[8];let h;t[9]===r?h=t[10]:(h=(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:m})}),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(ie,{children:`Close`}),t[11]=g):g=t[11];let v;t[12]===h?v=t[13]:(v=(0,$.jsxs)(ae,{children:[h,g]}),t[12]=h,t[13]=v);let y;t[14]!==p||t[15]!==v?(y=(0,$.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[p,v]}),t[14]=p,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==o||t[18]!==n?(b=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,$.jsx)(sn,{}):(0,$.jsx)(ln,{scope:n,binding:o.binding})}),t[17]=o,t[18]=n,t[19]=b):b=t[19];let S;return t[20]!==n||t[21]!==y||t[22]!==b?(S=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[y,b]}),t[20]=n,t[21]=y,t[22]=b,t[23]=S):S=t[23],S}function on(e){if(!c(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function sn(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(cn)}),e[0]=t):t=e[0],t}function cn(e,t){return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(D,{className:`h-5 w-32`}),(0,$.jsx)(D,{className:`h-4 w-64`}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(D,{className:`h-9 w-full`}),(0,$.jsx)(D,{className:`h-9 w-full`})]})]},t)}function ln(e){let t=(0,M.c)(12),{scope:n,binding:r}=e,{form:i,commitField:a}=Xt(r),[o,c]=(0,N.useState)(null),l=(0,N.useRef)(null),u,d;t[0]!==i||t[1]!==n?(u=()=>{let e=A(e=>{if(!(n===`project`&&e.docName===`__config__/project`||n===`user`&&e.docName===`__user__/config.yml`))return;ne.error(s(e.error),{duration:8e3});let t=on(e.error);t&&(i.setError(t,{type:`config-validation-rejected`,message:$t(e.error,t)}),i.setFocus(t),c(t),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{c(null),i.clearErrors(t)},600))});return()=>{e(),l.current&&clearTimeout(l.current)}},d=[n,i],t[0]=i,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,N.useEffect)(u,d);let f;t[4]!==a||t[5]!==o||t[6]!==i||t[7]!==n?(f=(0,$.jsx)(un,{scope:n,form:i,commitField:a,flashedPath:o}),t[4]=a,t[5]=o,t[6]=i,t[7]=n,t[8]=f):f=t[8];let p;return t[9]!==i||t[10]!==f?(p=(0,$.jsx)(jt,{...i,children:f}),t[9]=i,t[10]=f,t[11]=p):p=t[11],p}function un(e){let t=(0,M.c)(8),{scope:n,form:r,commitField:i,flashedPath:a}=e,o;t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==n?(o=nn.map(e=>{if(e.custom===`folders`)return(0,$.jsx)(Ut,{form:r,commitField:i,scope:n,flashedPath:a},e.id);let t=e.fields.filter(e=>dn(e.path,n));return t.length===0?null:(0,$.jsx)(fn,{section:e,children:t.map(e=>(0,$.jsx)(pn,{field:e,scope:n,commitField:i,isFlashed:a===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=i,t[1]=a,t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(bn,{}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[o,s]}),t[6]=o,t[7]=c),c}function dn(e,t){let n=i(a,e);if(!n)return!0;let r=d(n);return r?!(r.scope===`project`&&t!==`project`||r.scope===`user`&&t!==`user`):!0}function fn(e){let t=(0,M.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,$.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,$.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,$.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function pn({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let o=Oe(),s=i(a,e.path),c=s?Jt(s):void 0,l=s?qt(s):void 0,u=s?d(s):void 0,f=s?Yt(s):void 0,p=e.path.join(`.`),[m,h]=(0,N.useState)(!1),g=(0,N.useRef)(null);(0,N.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let v=()=>{h(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(!1),1200)},y=()=>{let e=n(p);return e&&v(),e},b=()=>o.getFieldState(p).isDirty?y():!0,x=()=>{let e=l===void 0?null:l;o.setValue(p,e,{shouldDirty:!1}),y()},S=u?.scope===`project`&&t!==`project`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:u?.scope===`user`&&t!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,C=`relative space-y-1 ${r?`animate-settings-flash`:``}`;return(0,$.jsx)(Nt,{control:o.control,name:p,render:({field:n})=>{let r=l===void 0?n.value!==void 0&&n.value!==null:!yn(n.value,l),i=!S&&(l!==void 0||n.value!==void 0),a=r?(0,$.jsx)(`span`,{"data-modified":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Modified from default`})}):null;return(0,$.jsxs)(It,{className:C,"data-field":e.path.join(`.`),"data-scope":t,children:[a,(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(Lt,{className:`text-sm font-medium`,children:e.label}),i?(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:x,"aria-label":`Reset ${e.label} to default`,children:(0,$.jsx)(oe,{className:`size-3.5`})})}),(0,$.jsx)(ie,{children:`Reset to default`})]}):null]}),e.description?(0,$.jsx)(zt,{className:`text-xs text-muted-foreground`,children:e.description}):null,S?(0,$.jsx)(Rt,{children:(0,$.jsx)(`div`,{role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:S})}):(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Rt,{children:(0,$.jsx)(mn,{field:e,ctl:n,typeTag:c,enumOptions:f,onCommit:b})}),(0,$.jsx)(vn,{visible:m})]}),(0,$.jsx)(Bt,{"data-field-error":e.path.join(`.`)})]})}})}function mn({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";if(n===`boolean`)return(0,$.jsx)(w,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...o}=a;return(0,$.jsx)(f,{...o,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":e.label,children:r.map((e,t)=>(0,$.jsx)(l,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(gn,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(_n,{ctl:t,onCommit:i,...a}):(0,$.jsx)(hn,{ctl:t,onCommit:i,...a})}function hn({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(T,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function gn({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,N.useState)(e.value===void 0?``:String(e.value)),a=(0,N.useRef)(e.value);(0,N.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(T,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function _n({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
|
|
2
|
+
`):``,[i,a]=(0,N.useState)(r),o=(0,N.useRef)(r);(0,N.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
|
|
3
|
+
`):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
|
|
4
|
+
`).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
|
|
5
|
+
`)};return(0,$.jsx)(`textarea`,{...n,value:i,ref:e.ref,onChange:e=>a(e.target.value),onBlur:()=>{e.onBlur(),s()},rows:Math.max(2,Math.min(6,i.split(`
|
|
6
|
+
`).length)),className:`min-h-16 w-full rounded-md border border-input bg-background px-3 py-1.5 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`})}function vn(e){let t=(0,M.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Saved`})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-emerald-600`,children:r}),t[2]=r,t[3]=i),i}function yn(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yn(e[n],t[n]))return!1;return!0}if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!yn(e[r],t[r]))return!1;return!0}return!1}function bn(){let e=(0,M.c)(7),[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)(!0),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=(typeof window<`u`?window.okDesktop:void 0)?.skill?.detectClaudeDesktop;if(!e){i(!0);return}let t=!1;return e().then(e=>{t||i(e)}).catch(()=>{t||i(!0)}),()=>{t=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,N.useEffect)(a,o),!r)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h2`,{id:`settings-integrations-title`,className:`text-base font-semibold`,children:`Integrations`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Open Knowledge to other tools you use.`})]}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:`Install in Claude Desktop`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Make this knowledge base available as a Claude Skill.`})]}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,(0,$.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>n(!0),"data-testid":`settings-install-claude-desktop`,children:`Install…`})]})}),e[4]=l):l=e[4];let u;return e[5]===t?u=e[6]:(u=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-integrations-title`,className:`space-y-3`,children:[s,l,(0,$.jsx)(ee,{open:t,onOpenChange:n})]}),e[5]=t,e[6]=u),u}export{an as SettingsPane};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{
|
|
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=A.fromClass(B),H=k.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=j.define(),W=class extends D{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return b(`span`,[m(`class`,`cm-ySelectionCaret`),m(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[u(``),b(`div`,[m(`class`,`cm-ySelectionCaretDot`)]),u(``),b(`div`,[m(`class`,`cm-ySelectionInfo`)],[u(this.name)]),u(``)])}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(R),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=C.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:p(a.cursor.anchor),s=a.cursor==null?null:p(a.cursor.head);if(i!=null){let e=c(t,i.anchor),n=c(t,i.head);(a.cursor==null||!g(o,e)||!g(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=y(s.anchor,n),l=y(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:f=`Anonymous`}=a.user||{},p=a.user&&a.user.colorLight||u+`33`,m=d(c.index,l.index),h=S(c.index,l.index),g=e.view.state.doc.lineAt(m),_=e.view.state.doc.lineAt(h);if(g.number===_.number)i.push({from:m,to:h,value:N.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});else{i.push({from:m,to:g.from+g.length,value:N.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})}),i.push({from:_.from,to:h,value:N.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});for(let t=g.number+1;t<_.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:N.line({attributes:{style:`background-color: ${p}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:N.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new W(u,f)})})}),this.decorations=N.set(i,!0)}},de=A.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=w.define({combine(e){return e[e.length-1]}});j.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(R),this._beforeChangeSelection=null,this._mux=o(),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:[k.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(z)!==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=A.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 x(e)}={})=>{let r=new le(e,t),i=[R.of(r),V];return t&&i.push(H,de),n!==!1&&i.push(G.of(new fe(n)),me,k.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?he(t):e.inputType===`historyRedo`?ge(t):!1}})),i},ve=N.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 T(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),N.set(a)}var xe=E.define({create(e){return Y(e)},update(e,t){return t.docChanged?Y(t.state):e},provide:e=>k.decorations.from(e)}),Se=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Ce=N.mark({class:`cm-del`}),we=N.line({class:`cm-table-header`}),X=N.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 Z(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 Q(e,t){let n=[],r=T(e),i=Z(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=N.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=N.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),N.set(n)}var Ee=class{decorations;constructor(e){this.decorations=Q(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||T(e.startState)!==T(e.state))&&(this.decorations=Q(e.view.state,e.view.visibleRanges))}},De=A.fromClass(Ee,{decorations:e=>e.decorations});function Oe(){return[De,xe]}var ke=n();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 a=i(),o=0;for(let i=r;i<=n.lines;i++){let r=n.line(i);if(!a(r.text)&&/^#{1,6}\s/.test(r.text)){if(o===t.index){e.dispatch({selection:O.cursor(r.from),effects:k.scrollIntoView(r.from,{y:`start`})}),e.focus();return}o++}}}function Ae(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:O.cursor(r),effects:k.scrollIntoView(r,{y:`center`})}),e.focus()})}function je(e){let t=(0,ce.c)(25),{docName:n,ytext:r,provider:i,placeholder:o,isSourceModeActive:c}=e,l=(0,I.useRef)(null),u=(0,I.useRef)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=new P,t[0]=d):d=t[0];let p=(0,I.useRef)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=new P,t[1]=m):m=t[1];let g=(0,I.useRef)(m),[_,y]=(0,I.useState)(null);if(_)throw _;let{resolvedTheme:b}=a(),x=(0,I.useRef)(null),S;t[2]!==o||t[3]!==i||t[4]!==b||t[5]!==r?(S=()=>{let e=l.current;if(!e)return;let t=i.configuration.name??``,n,a=Me;try{n=s({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=oe({ydoc:i.document,ytext:r}),n=new k({state:te.create({doc:r.toString(),extensions:[ae,ne.of([re]),_e(r,i.awareness),...ee({themeCompartment:p.current,resolvedTheme:b,ydoc:i.document}),Oe(),t,g.current.of(M(o??``)),k.theme({"&":{height:`100%`}})]}),parent:e}),s=n.contentDOM;return s.addEventListener(`keydown`,a),s.addEventListener(`paste`,a),s.addEventListener(`drop`,a),s.addEventListener(`cut`,a),{view:n,ydoc:i.document,ytext:r,provider:i}}}),x.current=n,u.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),x.current=null,u.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=x.current;e&&v(e),x.current=null,u.current=null}},t[2]=o,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]===b?(w=t[11],T=t[12]):(w=()=>{u.current&&u.current.dispatch({effects:p.current.reconfigure(b===`dark`?h:f)})},T=[b],t[10]=b,t[11]=w,t[12]=T),(0,I.useEffect)(w,T);let E,D;t[13]===o?(E=t[14],D=t[15]):(E=()=>{u.current&&u.current.dispatch({effects:g.current.reconfigure(M(o??``))})},D=[o],t[13]=o,t[14]=E,t[15]=D),(0,I.useEffect)(E,D);let O,A;t[16]!==n||t[17]!==c?(A=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!c)return;let r=u.current;r&&($(r,t),ie(n))};return window.addEventListener(F,e),()=>window.removeEventListener(F,e)},O=[n,c],t[16]=n,t[17]=c,t[18]=O,t[19]=A):(O=t[18],A=t[19]),(0,I.useEffect)(A,O);let j,N;t[20]!==n||t[21]!==c?(j=()=>{if(!c)return;let e=u.current;if(!e)return;let t=se(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}Ae(e,t.detail)}},N=[n,c],t[20]=n,t[21]=c,t[22]=j,t[23]=N):(j=t[22],N=t[23]),(0,I.useEffect)(j,N);let L;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,ke.jsx)(`div`,{ref:l,className:`source-editor h-full py-3`}),t[24]=L):L=t[24],L}function Me(){return l()}export{je as SourceEditor};
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Xn as i,ot as a}from"./toggle-group-C5MXNna8.js";import{J as o,R as s,X as c,at as l,b as u,ct as d,dt as f,ft as p,h as m,it as h,lt as g,m as ee,mt as _,nt as v,ot as y,p as te,pt as b,st as x,ut as S}from"./DocumentContext-BHFNw5NZ.js";import{At as C,Dt as w,Et as ne,N as T,Pt as E,Q as D,Tt as O,Y as k,Z as A,bt as j,ft as M,lt as re,q as N,wt as P}from"./dist-dkPJvrfr.js";import{a as ie,i as ae,o as oe,r as se,t as F}from"./OutlinePanel-CnKUM65X.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(x(t.yanchor),x(t.yhead))}},le=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new h(e)}toYPos(e,t=0){return d(this.ytext,e,t)}fromYPos(e){let t=y(x(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?O.cursor(n.pos,n.assoc):O.range(t.pos,n.pos)}},R=w.define({combine(e){return e[e.length-1]}}),z=j.define(),B=class{constructor(e){this.view=e,this.conf=e.state.facet(R),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:[z.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(z)===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
|
+
`);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=A.fromClass(B),H=k.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=j.define(),W=class extends D{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return S(`span`,[p(`class`,`cm-ySelectionCaret`),p(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[f(``),S(`div`,[p(`class`,`cm-ySelectionCaretDot`)]),f(``),S(`div`,[p(`class`,`cm-ySelectionInfo`)],[f(this.name)]),f(``)])}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(R),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=C.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:x(a.cursor.anchor),s=a.cursor==null?null:x(a.cursor.head);if(i!=null){let e=d(t,i.anchor),n=d(t,i.head);(a.cursor==null||!l(o,e)||!l(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=y(s.anchor,n),l=y(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,p=_(c.index,l.index),m=b(c.index,l.index),h=e.view.state.doc.lineAt(p),g=e.view.state.doc.lineAt(m);if(h.number===g.number)i.push({from:p,to:m,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:p,to:h.from+h.length,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:g.from,to:m,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=h.number+1;t<g.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:N.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:N.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new W(u,d)})})}),this.decorations=N.set(i,!0)}},de=A.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=w.define({combine(e){return e[e.length-1]}});j.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(R),this._beforeChangeSelection=null,this._mux=v(),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:[k.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(z)!==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=A.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 h(e)}={})=>{let r=new le(e,t),i=[R.of(r),V];return t&&i.push(H,de),n!==!1&&i.push(G.of(new fe(n)),me,k.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?he(t):e.inputType===`historyRedo`?ge(t):!1}})),i},ve=N.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 T(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),N.set(a)}var xe=E.define({create(e){return Y(e)},update(e,t){return t.docChanged?Y(t.state):e},provide:e=>k.decorations.from(e)}),Se=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Ce=N.mark({class:`cm-del`}),we=N.line({class:`cm-table-header`}),X=N.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 Z(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 Q(e,t){let n=[],r=T(e),i=Z(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=N.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=N.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),N.set(n)}var Ee=class{decorations;constructor(e){this.decorations=Q(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||T(e.startState)!==T(e.state))&&(this.decorations=Q(e.view.state,e.view.visibleRanges))}},De=A.fromClass(Ee,{decorations:e=>e.decorations});function Oe(){return[De,xe]}var ke=n();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=a(),o=0;for(let a=r;a<=n.lines;a++){let r=n.line(a);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(o===t.index){e.dispatch({selection:O.cursor(r.from),effects:k.scrollIntoView(r.from,{y:`start`})}),e.focus();return}o++}}}function Ae(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:O.cursor(r),effects:k.scrollIntoView(r,{y:`center`})}),e.focus()})}function je(e){let t=(0,ce.c)(25),{docName:n,ytext:r,provider:a,placeholder:l,isSourceModeActive:u}=e,d=(0,I.useRef)(null),f=(0,I.useRef)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new P,t[0]=p):p=t[0];let h=(0,I.useRef)(p),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=new P,t[1]=g):g=t[1];let _=(0,I.useRef)(g),[v,y]=(0,I.useState)(null);if(v)throw v;let{resolvedTheme:b}=i(),x=(0,I.useRef)(null),S;t[2]!==l||t[3]!==a||t[4]!==b||t[5]!==r?(S=()=>{let e=d.current;if(!e)return;let t=a.configuration.name??``,n,i=Me;try{n=o({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=s({ydoc:a.document,ytext:r}),n=new k({state:ne.create({doc:r.toString(),extensions:[se,re.of([ae]),_e(r,a.awareness),...te({themeCompartment:h.current,resolvedTheme:b,ydoc:a.document}),Oe(),t,_.current.of(M(l??``)),k.theme({"&":{height:`100%`}})]}),parent:e}),o=n.contentDOM;return o.addEventListener(`keydown`,i),o.addEventListener(`paste`,i),o.addEventListener(`drop`,i),o.addEventListener(`cut`,i),{view:n,ydoc:a.document,ytext:r,provider:a}}}),x.current=n,f.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),x.current=null,f.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=x.current;e&&c(e),x.current=null,f.current=null}},t[2]=l,t[3]=a,t[4]=b,t[5]=r,t[6]=S):S=t[6];let C;t[7]!==a||t[8]!==r?(C=[r,a],t[7]=a,t[8]=r,t[9]=C):C=t[9],(0,I.useEffect)(S,C);let w,T;t[10]===b?(w=t[11],T=t[12]):(w=()=>{f.current&&f.current.dispatch({effects:h.current.reconfigure(b===`dark`?ee:m)})},T=[b],t[10]=b,t[11]=w,t[12]=T),(0,I.useEffect)(w,T);let E,D;t[13]===l?(E=t[14],D=t[15]):(E=()=>{f.current&&f.current.dispatch({effects:_.current.reconfigure(M(l??``))})},D=[l],t[13]=l,t[14]=E,t[15]=D),(0,I.useEffect)(E,D);let O,A;t[16]!==n||t[17]!==u?(A=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!u)return;let r=f.current;r&&($(r,t),ie(n))};return window.addEventListener(F,e),()=>window.removeEventListener(F,e)},O=[n,u],t[16]=n,t[17]=u,t[18]=O,t[19]=A):(O=t[18],A=t[19]),(0,I.useEffect)(A,O);let j,N;t[20]!==n||t[21]!==u?(j=()=>{if(!u)return;let e=f.current;if(!e)return;let t=oe(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}Ae(e,t.detail)}},N=[n,u],t[20]=n,t[21]=u,t[22]=j,t[23]=N):(j=t[22],N=t[23]),(0,I.useEffect)(j,N);let L;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,ke.jsx)(`div`,{ref:d,className:`source-editor h-full py-3`}),t[24]=L):L=t[24],L}function Me(){return u()}export{je as SourceEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{S as i,m as a,r as o,t as s}from"./button-Dyz7QGIk.js";import{St as c}from"./DocumentContext-gM6_1mHt.js";import{t as l}from"./circle-check-C-DpX4dU.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g,x as _}from"./dialog-FUclf-NK.js";var v=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=i(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),b=i(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),x=i(`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`}]]),ee=i(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),S=i(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),C=e(t(),1),w=n(),T=`Label`,E=C.forwardRef((e,t)=>(0,w.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));E.displayName=T;var D=E,O=r();function k(e){let t=(0,O.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=o(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,w.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function A(e){let t=(0,O.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=o(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,w.jsx)(D,{"data-slot":`label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var te=`npx @inkeep/open-knowledge install-skill`,ne=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function re(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function j(e){let t=(0,O.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,w.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function M(e){let t=(0,O.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=o(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,w.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function N(e){let t=(0,O.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function P(){let e=(0,O.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsx)(M,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,w.jsx)(N,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,w.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(N,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,w.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,w.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,w.jsx)(N,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,w.jsx)(j,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,w.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,w.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,w.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function F(e){let t=(0,O.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,C.useState)(i),[v,y]=(0,C.useState)(!1),S,T;t[1]===n?(S=t[2],T=t[3]):(S=()=>{n||(o({kind:`idle`}),y(!1))},T=[n],t[1]=n,t[2]=S,t[3]=T),(0,C.useEffect)(S,T);let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;_.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=E):E=t[4];let D=E,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=async function(){try{await navigator.clipboard.writeText(te),y(!0),setTimeout(()=>y(!1),2e3)}catch(e){let t=e;_.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=k):k=t[5];let A=k,N;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(N=re(),t[6]=N):N=t[6];let F=N,I;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=I):I=t[7];let L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,w.jsxs)(h,{children:[I,(0,w.jsxs)(u,{children:[`Adds the Open Knowledge skill to the`,` `,(0,w.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=L):L=t[8];let R;t[9]===a.kind?R=t[10]:(R=a.kind===`idle`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(M,{className:`text-muted-foreground`,children:`Automatic`}),(0,w.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,w.jsx)(j,{children:`openknowledge.skill`}),`, save it to`,` `,(0,w.jsx)(j,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,w.jsx)(P,{})]}),t[9]=a.kind,t[10]=R);let z;t[11]!==v||t[12]!==a.kind?(z=a.kind===`idle`&&!F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(M,{children:`Run this in your terminal`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,w.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:te}),(0,w.jsx)(s,{variant:`ghost`,size:`sm`,onClick:A,"aria-label":`Copy command`,className:`h-7 gap-1`,children:v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(b,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,w.jsx)(j,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,w.jsx)(P,{})]}),t[11]=v,t[12]=a.kind,t[13]=z):z=t[13];let B;t[14]===a.kind?B=t[15]:(B=a.kind===`downloading`&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,w.jsx)(j,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=B);let V;t[16]!==a.kind||t[17]!==a.path?(V=a.kind===`handed-off`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,w.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,w.jsx)(P,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=V):V=t[18];let H;t[19]===a.kind?H=t[20]:(H=a.kind===`handed-off`&&!F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,w.jsx)(j,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,w.jsx)(P,{})]}),t[19]=a.kind,t[20]=H);let U;t[21]!==a.kind||t[22]!==a.message?(U=a.kind===`error`&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,w.jsx)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=U):U=t[23];let W;t[24]!==z||t[25]!==B||t[26]!==V||t[27]!==H||t[28]!==U||t[29]!==R?(W=(0,w.jsx)(p,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[R,z,B,V,H,U]})}),t[24]=z,t[25]=B,t[26]=V,t[27]=H,t[28]=U,t[29]=R,t[30]=W):W=t[30];let G;t[31]===a.kind?G=t[32]:(G=a.kind!==`error`&&(0,w.jsxs)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,w.jsx)(ee,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=G);let K;t[33]!==r||t[34]!==a.kind?(K=a.kind===`idle`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,w.jsxs)(s,{onClick:D,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=K):K=t[35];let q;t[36]!==r||t[37]!==a.kind?(q=a.kind===`idle`&&!F&&(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=q):q=t[38];let J;t[39]!==r||t[40]!==a.kind?(J=a.kind===`error`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,w.jsxs)(s,{onClick:D,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=J):J=t[41];let Y;t[42]===a.kind?Y=t[43]:(Y=a.kind===`downloading`&&(0,w.jsxs)(s,{disabled:!0,children:[(0,w.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=Y);let X;t[44]!==r||t[45]!==a.kind?(X=a.kind===`handed-off`&&(0,w.jsx)(s,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=X):X=t[46];let Z;t[47]!==G||t[48]!==K||t[49]!==q||t[50]!==J||t[51]!==Y||t[52]!==X?(Z=(0,w.jsxs)(m,{children:[G,K,q,J,Y,X]}),t[47]=G,t[48]=K,t[49]=q,t[50]=J,t[51]=Y,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==W||t[55]!==Z?(Q=(0,w.jsxs)(f,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[L,W,Z]}),t[54]=W,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==r||t[58]!==n||t[59]!==Q?($=(0,w.jsx)(g,{open:n,onOpenChange:r,children:Q}),t[57]=r,t[58]=n,t[59]=Q,t[60]=$):$=t[60],$}var I=new Set;function L(e){for(let t of I)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function R(e){return I.add(e),()=>{I.delete(e)}}export{k as a,b as c,A as i,y as l,R as n,S as o,F as r,x as s,L as t,v as u};
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{S as i,m as a,r as o,t as s}from"./button-Dyz7QGIk.js";import{Et as c}from"./DocumentContext-BHFNw5NZ.js";import{t as l}from"./circle-check-C-DpX4dU.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g,x as _}from"./dialog-FUclf-NK.js";var v=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=i(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),b=i(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),x=i(`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`}]]),ee=i(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),S=i(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),C=e(t(),1),w=n(),T=`Label`,E=C.forwardRef((e,t)=>(0,w.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));E.displayName=T;var D=E,O=r();function k(e){let t=(0,O.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=o(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,w.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function A(e){let t=(0,O.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=o(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,w.jsx)(D,{"data-slot":`label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var te=`npx @inkeep/open-knowledge install-skill`,ne=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function re(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function j(e){let t=(0,O.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,w.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function M(e){let t=(0,O.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=o(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,w.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function N(e){let t=(0,O.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function P(){let e=(0,O.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsx)(M,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,w.jsx)(N,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,w.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(N,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,w.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,w.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,w.jsx)(N,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,w.jsx)(j,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,w.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,w.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,w.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,w.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,w.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,w.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,w.jsx)(v,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function F(e){let t=(0,O.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,C.useState)(i),[v,y]=(0,C.useState)(!1),S,T;t[1]===n?(S=t[2],T=t[3]):(S=()=>{n||(o({kind:`idle`}),y(!1))},T=[n],t[1]=n,t[2]=S,t[3]=T),(0,C.useEffect)(S,T);let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;_.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=E):E=t[4];let D=E,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=async function(){try{await navigator.clipboard.writeText(te),y(!0),setTimeout(()=>y(!1),2e3)}catch(e){let t=e;_.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=k):k=t[5];let A=k,N;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(N=re(),t[6]=N):N=t[6];let F=N,I;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=I):I=t[7];let L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,w.jsxs)(h,{children:[I,(0,w.jsxs)(u,{children:[`Adds the Open Knowledge skill to the`,` `,(0,w.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=L):L=t[8];let R;t[9]===a.kind?R=t[10]:(R=a.kind===`idle`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(M,{className:`text-muted-foreground`,children:`Automatic`}),(0,w.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,w.jsx)(j,{children:`openknowledge.skill`}),`, save it to`,` `,(0,w.jsx)(j,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,w.jsx)(P,{})]}),t[9]=a.kind,t[10]=R);let z;t[11]!==v||t[12]!==a.kind?(z=a.kind===`idle`&&!F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(M,{children:`Run this in your terminal`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,w.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:te}),(0,w.jsx)(s,{variant:`ghost`,size:`sm`,onClick:A,"aria-label":`Copy command`,className:`h-7 gap-1`,children:v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(b,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,w.jsx)(j,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,w.jsx)(P,{})]}),t[11]=v,t[12]=a.kind,t[13]=z):z=t[13];let B;t[14]===a.kind?B=t[15]:(B=a.kind===`downloading`&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,w.jsx)(j,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=B);let V;t[16]!==a.kind||t[17]!==a.path?(V=a.kind===`handed-off`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,w.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,w.jsx)(P,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=V):V=t[18];let H;t[19]===a.kind?H=t[20]:(H=a.kind===`handed-off`&&!F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,w.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,w.jsx)(j,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,w.jsx)(P,{})]}),t[19]=a.kind,t[20]=H);let U;t[21]!==a.kind||t[22]!==a.message?(U=a.kind===`error`&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,w.jsx)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=U):U=t[23];let W;t[24]!==z||t[25]!==B||t[26]!==V||t[27]!==H||t[28]!==U||t[29]!==R?(W=(0,w.jsx)(p,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[R,z,B,V,H,U]})}),t[24]=z,t[25]=B,t[26]=V,t[27]=H,t[28]=U,t[29]=R,t[30]=W):W=t[30];let G;t[31]===a.kind?G=t[32]:(G=a.kind!==`error`&&(0,w.jsxs)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,w.jsx)(ee,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=G);let K;t[33]!==r||t[34]!==a.kind?(K=a.kind===`idle`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,w.jsxs)(s,{onClick:D,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=K):K=t[35];let q;t[36]!==r||t[37]!==a.kind?(q=a.kind===`idle`&&!F&&(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=q):q=t[38];let J;t[39]!==r||t[40]!==a.kind?(J=a.kind===`error`&&F&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,w.jsxs)(s,{onClick:D,children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=J):J=t[41];let Y;t[42]===a.kind?Y=t[43]:(Y=a.kind===`downloading`&&(0,w.jsxs)(s,{disabled:!0,children:[(0,w.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=Y);let X;t[44]!==r||t[45]!==a.kind?(X=a.kind===`handed-off`&&(0,w.jsx)(s,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=X):X=t[46];let Z;t[47]!==G||t[48]!==K||t[49]!==q||t[50]!==J||t[51]!==Y||t[52]!==X?(Z=(0,w.jsxs)(m,{children:[G,K,q,J,Y,X]}),t[47]=G,t[48]=K,t[49]=q,t[50]=J,t[51]=Y,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==W||t[55]!==Z?(Q=(0,w.jsxs)(f,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[L,W,Z]}),t[54]=W,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==r||t[58]!==n||t[59]!==Q?($=(0,w.jsx)(g,{open:n,onOpenChange:r,children:Q}),t[57]=r,t[58]=n,t[59]=Q,t[60]=$):$=t[60],$}var I=new Set;function L(e){for(let t of I)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function R(e){return I.add(e),()=>{I.delete(e)}}export{k as a,b as c,A as i,y as l,R as n,S as o,F as r,x as s,L as t,v as u};
|