@inkeep/open-knowledge 0.5.0-beta.18 → 0.5.0-beta.19
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/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-BT7SSbsG.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-B37C2mnX.mjs +1 -0
- package/dist/{init-CJjj7SKR.mjs → init-CBK3jVFm.mjs} +3 -3
- package/dist/{loader-muqLro6E.mjs → loader-C9W9Ku8P.mjs} +2 -2
- package/dist/loader-CB9s8RtR.mjs +1 -0
- package/dist/{preview-viMhTOSc.mjs → preview-Bgn64VT6.mjs} +2 -2
- package/dist/preview-Br7fmPTh.mjs +1 -0
- package/dist/public/assets/index-CYoaXU_X.css +1 -0
- package/dist/public/assets/{index-C4KiMV-Z.js → index-DWXWBg9l.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/{repair-mcp-configs-BeZWSiY1.mjs → repair-mcp-configs-CjCe_H4H.mjs} +2 -2
- package/dist/{src-ct_-cWOI.mjs → src-BuMYrDyu.mjs} +2 -2
- package/dist/{start-ClRV9jYM.mjs → start-CQnixsr-.mjs} +2 -2
- package/dist/start-Cozi1OSq.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-B4KnJDAZ.mjs +0 -2
- package/dist/init-CS6mOIgn.mjs +0 -1
- package/dist/loader-H7wE7QNZ.mjs +0 -1
- package/dist/preview-BeYDA-OZ.mjs +0 -1
- package/dist/public/assets/index-C5eHVirw.css +0 -1
- package/dist/start-CC-R8Mvd.mjs +0 -1
|
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
|
|
|
10
10
|
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Nt(e,``+r);break;case`className`:_t(e,`class`,r);break;case`tabIndex`:_t(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:_t(e,n,r);break;case`style`:It(e,r,o);break;case`data`:if(t!==`object`){_t(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Bt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),gt(e,`popover`,r);break;case`xlinkActuate`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:gt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Rt.get(n)||n,gt(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:It(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Nt(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!lt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[Ye]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):gt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,o,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Md(e,t,r,d,n,null)}}Ot(e,o,c,l,u,s,i,!1);return;case`select`:for(i in vd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&At(e,!!r,n,!0):At(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:Md(e,t,s,c,n,null)}Mt(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Lt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Dt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?At(e,!!n,n?[]:``,!1):At(e,!!n,t,!0)):At(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&Md(e,t,s,i,r,o)}jt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Lt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),nt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[tt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);nt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=it(e);t!==null&&t.tag===5&&t.type===`form`?gs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Et(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),st(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Et(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Et(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Et(n.imageSizes)+`"]`)):i+=`[href="`+Et(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),st(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Et(r)+`"][href="`+Et(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),st(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ot(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);st(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=ot(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),st(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=ot(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),st(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=W.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=ot(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=ot(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=ot(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+Et(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),st(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Et(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Et(n.href)+`"]`);if(r)return t.instance=r,st(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),st(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,st(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),st(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,st(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),st(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[tt]||a[Je]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,st(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),st(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:x,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Le(0),this.hiddenUpdates=Le(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Yr(3,null,null,t),e.current=a,a.stateNode=e,t=Xi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ka(a),e}function tp(e){return e?(e=Jr,e):Jr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ma(e,r,t),n!==null&&(fu(n,e,t),Na(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Gr(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=Ue(t);var n=Gr(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=it(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Me(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Te(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=me()+500,nd(0,!1))}}break;case 31:case 13:s=Gr(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Ut(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=rt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(he()){case ge:return 2;case _e:return 8;case ve:case ye:return 32;case be:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=it(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=rt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,Ke(e.priority,function(){op(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,Ke(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ht=r,n.target.dispatchEvent(r),Ht=null}else return t=it(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=it(n);a!==null&&(e.splice(t,3),t-=3,ms(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ye]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ye]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[Xe]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ge();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(a(527,Lp,`19.2.5`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ce=zp.inject(Rp),J=zp}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=Ls,s=Rs,c=zs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,s,c,Pp),e[Xe]=t.current,xd(e),new Fp(t)}})),rs=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ns()})),is=zr(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),as=zr(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),os=zr(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),ss=zr(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Z=a(),Q=e(i(),1),cs=e(Xr(),1),ls=rs(),$=o(),us=[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]];zr(`bot`,us);var ds=zr(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),fs=zr(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),ps=zr(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ms=zr(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),hs=zr(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),gs=zr(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_s=zr(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),vs=zr(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),ys=zr(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),bs=zr(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),xs=zr(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ss=zr(`contrast`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 18a6 6 0 0 0 0-12v12z`,key:`j4l70d`}]]),Cs=zr(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ws=zr(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Ts=zr(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),Es=zr(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Ds=zr(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Os=zr(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ks=zr(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),As=zr(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),js=zr(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ms=zr(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ns=zr(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ps=zr(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Fs=zr(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),Is=zr(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Ls=zr(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),Rs=zr(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),zs=zr(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Bs=zr(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),Vs=[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]],Hs=zr(`link-2`,Vs),Us=zr(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Ws=zr(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),Gs=zr(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),Ks=zr(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),qs=zr(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Js=zr(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ys=zr(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Xs=zr(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Zs=zr(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Qs=zr(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),$s=zr(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ec=zr(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),tc=zr(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),nc=zr(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),rc=zr(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),ic=zr(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),ac=zr(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),oc=zr(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),sc=zr(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),cc=zr(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),lc=zr(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),uc=zr(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),dc=zr(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),fc=zr(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pc=zr(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),mc=zr(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),hc=zr(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),gc=zr(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),_c=zr(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),vc=zr(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),yc=zr(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),bc=zr(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),xc=zr(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Sc=zr(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),Cc=zr(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),wc=zr(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]);function Tc(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=typeof window<`u`?window.okDesktop:void 0;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(Ec),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function Ec(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function Dc(e,t){return e instanceof Error&&e.message?e.message:t}async function Oc(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(Dc(e,t))}}async function kc(e,t,n=eo,r=`action`){await Oc(e,t,e=>{e!==null&&n.error(e)},r)}async function Ac(e){try{let t=await e.json(),n=Sn.safeParse(t);if(n.success)return n.data.title}catch{}}async function jc(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}function Mc(e){let t=e.split(`
|
|
11
11
|
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Nc(){return{async status(e){let t=e?.host??`github.com`,n=await jc(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Ac(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}},async repos(e){let t=e?.host??`github.com`,n=await jc(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Ac(n)??`Failed to fetch repositories`};let r=Mc(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}}}}function Pc(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Fc(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
12
12
|
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Ic(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}function Lc(){return{start(){return Ic((e,t)=>{(async()=>{try{let n=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:t});if(!n.ok){let t=`Failed to start sign-in — try again`;try{let e=await n.json(),r=Sn.safeParse(e);r.success&&(t=r.data.title)}catch{}e({type:`error`,message:t});return}if(!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await Fc(n.body,t=>{let n;try{n=JSON.parse(t)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,t.slice(0,100)),`continue`}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let t=n.problem;return e({type:`error`,message:t?.detail||t?.title||`Unknown error`}),`terminal`}let r=n;return e(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})&&!t.aborted&&e({type:`error`,message:`Sign-in stream ended without confirmation — please try again`})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;e({type:`error`,message:`Connection error — try again`})}})()})}}}function Rc(e){return{start(){return e.localOp.auth.start()}}}function zc(){return{start(e){return Ic((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=Sn.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
|
|
13
|
-
`);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function Bc(e){return{start(t){return e.localOp.clone.start(t)}}}var Vc=`ContextMenu`,[Hc,Uc]=Wr(Vc,[Ii]),Wc=Ii(),[Gc,Kc]=Hc(Vc),qc=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Wc(t),l=Vr(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Gc,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ki,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};qc.displayName=Vc;var Jc=`ContextMenuTrigger`,Yc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Kc(Jc,n),o=Wc(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ha,{...o,virtualRef:c}),(0,Z.jsx)(qr.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Yr(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Yr(e.onPointerDown,wl(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Yr(e.onPointerMove,wl(u)),onPointerCancel:r?e.onPointerCancel:Yr(e.onPointerCancel,wl(u)),onPointerUp:r?e.onPointerUp:Yr(e.onPointerUp,wl(u))})]})});Yc.displayName=Jc;var Xc=`ContextMenuPortal`,Zc=e=>{let{__scopeContextMenu:t,...n}=e,r=Wc(t);return(0,Z.jsx)(pa,{...r,...n})};Zc.displayName=Xc;var Qc=`ContextMenuContent`,$c=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kc(Qc,n),a=Wc(n),o=Q.useRef(!1);return(0,Z.jsx)(da,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});$c.displayName=Qc;var el=`ContextMenuGroup`,tl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(wa,{...i,...r,ref:t})});tl.displayName=el;var nl=`ContextMenuLabel`,rl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(_a,{...i,...r,ref:t})});rl.displayName=nl;var il=`ContextMenuItem`,al=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Qi,{...i,...r,ref:t})});al.displayName=il;var ol=`ContextMenuCheckboxItem`,sl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Zi,{...i,...r,ref:t})});sl.displayName=ol;var cl=`ContextMenuRadioGroup`,ll=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(aa,{...i,...r,ref:t})});ll.displayName=cl;var ul=`ContextMenuRadioItem`,dl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(ra,{...i,...r,ref:t})});dl.displayName=ul;var fl=`ContextMenuItemIndicator`,pl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(ta,{...i,...r,ref:t})});pl.displayName=fl;var ml=`ContextMenuSeparator`,hl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Ea,{...i,...r,ref:t})});hl.displayName=ml;var gl=`ContextMenuArrow`,_l=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(xa,{...i,...r,ref:t})});_l.displayName=gl;var vl=`ContextMenuSub`,yl=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Wc(t),[s,c]=Ur({prop:i,defaultProp:a??!1,onChange:r,caller:vl});return(0,Z.jsx)(Ma,{...o,open:s,onOpenChange:c,children:n})};yl.displayName=vl;var bl=`ContextMenuSubTrigger`,xl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Aa,{...i,...r,ref:t})});xl.displayName=bl;var Sl=`ContextMenuSubContent`,Cl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Xi,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Cl.displayName=Sl;function wl(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Tl=qc,El=Yc,Dl=Zc,Ol=$c,kl=al,Al=hl,jl=`Radio`,[Ml,Nl]=Wr(jl),[Pl,Fl]=Ml(jl),Il=Q.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=Q.useState(null),p=Zr(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(Pl,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(qr.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Vl(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:Yr(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Bl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});Il.displayName=jl;var Ll=`RadioIndicator`,Rl=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=Fl(Ll,n);return(0,Z.jsx)(Jr,{present:r||a.checked,children:(0,Z.jsx)(qr.span,{"data-state":Vl(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Rl.displayName=Ll;var zl=`RadioBubbleInput`,Bl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Zr(o,a),c=Ra(n),l=to(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Z.jsx)(qr.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Bl.displayName=zl;function Vl(e){return e?`checked`:`unchecked`}var Hl=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ul=`RadioGroup`,[Wl,Gl]=Wr(Ul,[ao,Nl]),Kl=ao(),ql=Nl(),[Jl,Yl]=Wl(Ul),Xl=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,p=Kl(n),m=On(l),[h,g]=Ur({prop:a,defaultProp:i??null,onChange:d,caller:Ul});return(0,Z.jsx)(Jl,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(oo,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(qr.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Xl.displayName=Ul;var Zl=`RadioGroupItem`,Ql=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Yl(Zl,n),o=a.disabled||r,s=Kl(n),c=ql(n),l=Q.useRef(null),u=Zr(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Hl.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,Z.jsx)(co,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(Il,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:Yr(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:Yr(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ql.displayName=Zl;var $l=`RadioGroupIndicator`,eu=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Rl,{...ql(n),...r,ref:t})});eu.displayName=$l;var tu=Xl,nu=Ql,ru=eu;async function iu(e){try{await navigator.clipboard.writeText(e)}catch{}}var au=120*1e3;function ou(e){let t=(0,$.c)(26),{onSuccess:n,onCancel:r,transport:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`https://github.com/login/device`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(au),_=(0,Q.useRef)(null),v=(0,Q.useRef)(null),y;t[0]!==n||t[1]!==i?(y=async function(){f(null),m(!0);try{let e=i.start();_.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,a=await t.next();for(;!a.done;){let e=a.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),g(e.expires_in*1e3),iu(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){r=!0,m(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,f(e.message),m(!1);break}a=await t.next()}r||(f(`Sign-in stream ended without confirmation — please try again`),m(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(`Connection error — try again`),m(!1)}},t[0]=n,t[1]=i,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=()=>{let e=!1;return queueMicrotask(()=>{e||b()}),()=>{e=!0,_.current?.(),_.current=null,v.current&&clearInterval(v.current)}},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[5]=S):S=t[5],(0,Q.useEffect)(x,S);let C,w;t[6]===a?(C=t[7],w=t[8]):(C=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=au-(Date.now()-e);t<=0?(g(0),v.current&&clearInterval(v.current),f(`Code expired — please try again`)):g(t)},1e3),()=>{v.current&&clearInterval(v.current)}},w=[a],t[6]=a,t[7]=C,t[8]=w),(0,Q.useEffect)(C,w);let T=Math.floor(h/6e4),E=Math.floor(h%6e4/1e3),D;t[9]===E?D=t[10]:(D=E.toString().padStart(2,`0`),t[9]=E,t[10]=D);let O=`${T}:${D}`,k;t[11]!==l||t[12]!==d||t[13]!==O||t[14]!==a||t[15]!==s?(k=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Open`,` `,(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>gi(e,s),onAuxClick:e=>gi(e,s),className:`underline underline-offset-2`,children:s}),` `,`and enter this code:`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`flex-1 text-center text-2xl font-mono font-bold tracking-widest border rounded-md py-3 bg-muted`,children:a}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void iu(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),children:l?`Copied!`:`Copy`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),`Waiting for authorization`]}),(0,Z.jsxs)(`span`,{children:[`Expires in `,O]})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:`Starting sign-in flow`}),t[11]=l,t[12]=d,t[13]=O,t[14]=a,t[15]=s,t[16]=k):k=t[16];let A;t[17]===d?A=t[18]:(A=d&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),t[17]=d,t[18]=A);let j;t[19]!==r||t[20]!==p?(j=p&&(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),t[19]=r,t[20]=p,t[21]=j):j=t[21];let M;return t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25],M}function su(e){let t=(0,$.c)(32),{onSuccess:n,onCancel:r}=e,[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{u.current?.abort()},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]!==n||t[3]!==i?(p=async function(){if(!i.trim()){l(`Paste a personal access token`);return}u.current?.abort();let e=new AbortController;u.current=e,s(!0),l(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:i.trim()}),signal:e.signal});if(!t.ok){let e=`Invalid token — check that it has repo scope`;try{let n=await t.json(),r=Sn.safeParse(n);r.success&&(e=r.data.title)}catch{}l(e),s(!1);return}if(!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await Fc(t.body,e=>{let t;try{t=JSON.parse(e)}catch{return`continue`}return t.type===`complete`?(n({login:t.login,name:t.name,email:t.email}),s(!1),`terminal`):`continue`})||l(`No response — try again`)}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&l(`Connection error — try again`)}s(!1)},t[2]=n,t[3]=i,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:lu,onAuxClick:cu,className:`underline underline-offset-2`,children:`github.com/settings/tokens`}),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Create a token at`,` `,h,` `,`with `,(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`repo`}),` scope.`]}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),t[7]=_):_=t[7];let v;t[8]===m?v=t[9]:(v=e=>{e.key===`Enter`&&m()},t[8]=m,t[9]=v);let y;t[10]!==o||t[11]!==i||t[12]!==v?(y=(0,Z.jsx)(go,{type:`password`,"aria-label":`Personal access token`,placeholder:`ghp_…`,value:i,onChange:_,disabled:o,onKeyDown:v}),t[10]=o,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]===c?b=t[15]:(b=c&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),t[14]=c,t[15]=b);let x;t[16]===m?x=t[17]:(x=()=>void m(),t[16]=m,t[17]=x);let S=o?`Validating`:`Add token`,C;t[18]!==o||t[19]!==x||t[20]!==S?(C=(0,Z.jsx)(Y,{className:`flex-1`,onClick:x,disabled:o,children:S}),t[18]=o,t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==o||t[23]!==r?(w=(0,Z.jsx)(Y,{variant:`ghost`,onClick:r,disabled:o,children:`Cancel`}),t[22]=o,t[23]=r,t[24]=w):w=t[24];let T;t[25]!==C||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==y||t[30]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,y,b,T]}),t[28]=T,t[29]=y,t[30]=b,t[31]=E):E=t[31],E}function cu(e){return gi(e,`https://github.com/settings/tokens`)}function lu(e){return gi(e,`https://github.com/settings/tokens`)}function uu(e){let t=(0,$.c)(27),{login:n,onSave:r,onSkip:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Before syncing, set your identity for git commits:`}),t[0]=l):l=t[0];let u=`Name (e.g. ${n})`,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[1]=d):d=t[1];let f;t[2]!==a||t[3]!==u?(f=(0,Z.jsx)(go,{"aria-label":`Name`,placeholder:u,value:a,onChange:d}),t[2]=a,t[3]=u,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>c(e.target.value),t[5]=p):p=t[5];let m;t[6]===s?m=t[7]:(m=(0,Z.jsx)(go,{type:`email`,"aria-label":`Email`,placeholder:`Email`,value:s,onChange:p}),t[6]=s,t[7]=m);let h;t[8]!==s||t[9]!==a||t[10]!==r?(h=()=>r(a.trim(),s.trim()),t[8]=s,t[9]=a,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==a?(g=!a.trim()||!s.trim(),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(Y,{className:`flex-1`,onClick:h,disabled:g,children:`Save`}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===i?v=t[19]:(v=(0,Z.jsx)(Y,{variant:`ghost`,onClick:i,children:`Skip`}),t[18]=i,t[19]=v);let y;t[20]!==v||t[21]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[_,v]}),t[20]=v,t[21]=_,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==f||t[25]!==m?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f,m,y]}),t[23]=y,t[24]=f,t[25]=m,t[26]=b):b=t[26],b}function du(e){let t=(0,$.c)(42),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,c;t[0]===s?c=t[1]:(c=s??Lc(),t[0]=s,t[1]=c);let l=c,[u,d]=(0,Q.useState)(`device`),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(null),g,_;t[2]===n?(g=t[3],_=t[4]):(g=()=>{n&&(d(`device`),p(`auth`),h(null))},_=[n],t[2]=n,t[3]=g,t[4]=_),(0,Q.useEffect)(g,_);let v;t[5]!==a||t[6]!==r||t[7]!==i?(v=function(e){h(e),a&&(!e.name||!e.email)?p(`identity`):(p(`done`),i?.(e),r(!1),eo.success(`Signed in as @${e.login}`))},t[5]=a,t[6]=r,t[7]=i,t[8]=v):v=t[8];let y=v,b;t[9]!==m||t[10]!==r||t[11]!==i?(b=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(fu);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),eo.success(`Signed in as @${n.login}`)},t[9]=m,t[10]=r,t[11]=i,t[12]=b):b=t[12];let x=b,S;t[13]!==m||t[14]!==r||t[15]!==i?(S=function(){m&&(p(`done`),i?.(m),r(!1),eo.success(`Signed in as @${m.login}`))},t[13]=m,t[14]=r,t[15]=i,t[16]=S):S=t[16];let C=S,w;t[17]===r?w=t[18]:(w=function(){r(!1)},t[17]=r,t[18]=w);let T=w,E=o?`Re-authenticate with GitHub`:`Sign in to GitHub`,D;t[19]===E?D=t[20]:(D=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ha,{children:E})}),t[19]=E,t[20]=D);let O;t[21]!==y||t[22]!==T||t[23]!==l||t[24]!==f||t[25]!==u?(O=f===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1 border-b pb-2 mb-1`,children:[(0,Z.jsx)(Y,{variant:u===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`device`),children:`GitHub App`}),(0,Z.jsx)(Y,{variant:u===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`pat`),children:`Token`})]}),u===`device`?(0,Z.jsx)(ou,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(su,{onSuccess:y,onCancel:T})]}),t[21]=y,t[22]=T,t[23]=l,t[24]=f,t[25]=u,t[26]=O):O=t[26];let k;t[27]!==m||t[28]!==x||t[29]!==C||t[30]!==f?(k=f===`identity`&&m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as @`,m.login]}),(0,Z.jsx)(uu,{login:m.login,onSave:x,onSkip:C})]}),t[27]=m,t[28]=x,t[29]=C,t[30]=f,t[31]=k):k=t[31];let A;t[32]!==k||t[33]!==O?(A=(0,Z.jsxs)(Ja,{children:[O,k]}),t[32]=k,t[33]=O,t[34]=A):A=t[34];let j;t[35]!==A||t[36]!==D?(j=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,children:[D,A]}),t[35]=A,t[36]=D,t[37]=j):j=t[37];let M;return t[38]!==r||t[39]!==n||t[40]!==j?(M=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function fu(){}function pu(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=Tc();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(Qe,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function mu(e){switch(e){case`receiving`:return`Receiving objects`;case`resolving`:return`Resolving deltas`;case`checking`:return`Checking out files`;case`init`:return`Initializing project`;case`done`:return`Complete`;default:return`Cloning`}}function hu(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function gu(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c}=e,l;t[0]===o?l=t[1]:(l=o??zc(),t[0]=o,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s??Nc(),t[2]=s,t[3]=d);let f=d,p=c!==void 0,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;t[4]!==n||t[5]!==f?(A=()=>{if(!n)return;let e=!1;return f.status().then(t=>{e||T(t.authenticated)}).catch(()=>{e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=f,t[6]=A):A=t[6];let j;t[7]===n?j=t[8]:(j=[n],t[7]=n,t[8]=j),(0,Q.useEffect)(A,j);let M;t[9]!==w||t[10]!==n||t[11]!==f?(M=()=>{if(!w||!n)return;let e=!1;return x(!0),f.repos().then(t=>{e||(y(t.ok?t.repos:[]),x(!1))}).catch(()=>{e||(y([]),x(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=f,t[12]=M):M=t[12];let N;t[13]!==w||t[14]!==n?(N=[w,n],t[13]=w,t[14]=n,t[15]=N):N=t[15],(0,Q.useEffect)(M,N);let P;t[16]===p?P=t[17]:(P=function(e){if(h(e),p)return;let t=hu(e);t&&_(`~/Documents/${t}`)},t[16]=p,t[17]=P);let F=P,I;t[18]===p?I=t[19]:(I=function(e){if(h(e.clone_url),p)return;let t=e.full_name.split(`/`)[1];_(`~/Documents/${t}`)},t[18]=p,t[19]=I);let L=I,R;t[20]!==g||t[21]!==a||t[22]!==r||t[23]!==c||t[24]!==u||t[25]!==m?(R=async function(){let e=m.trim();if(!e){eo.error(`Enter a repository URL or owner/repo`);return}let t=g||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=hu(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=eo.loading(`Starting clone`,{duration:1/0});k.current=n;let i=u.start({url:e,dir:t});O.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`)eo.loading(`${mu(i.phase)} — ${i.pct}%`,{id:n});else if(i.type===`complete`){eo.success(`Clone complete — opening project`,{id:n}),r(!1),D(!1),O.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){eo.error(`Clone failed: ${i.message}`,{id:n}),D(!1),O.current=null;return}t=await e.next()}eo.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:n}),D(!1),O.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),eo.error(`Clone failed — connection error`,{id:n}),D(!1),O.current=null}},t[20]=g,t[21]=a,t[22]=r,t[23]=c,t[24]=u,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){O.current?.(),O.current=null,D(!1),eo.dismiss(k.current??void 0)},t[27]=B):B=t[27];let V=B,H;t[28]!==E||t[29]!==r||t[30]!==p?(H=function(e){E||(r(e),e||(h(``),p||_(``),C(``)))},t[28]=E,t[29]=r,t[30]=p,t[31]=H):H=t[31];let U=H,W,G,K,q,ee,te,ne,re,ie,ae;if(t[32]!==E||t[33]!==U||t[34]!==L||t[35]!==F||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==S||t[40]!==v||t[41]!==m){let e=v?.filter(e=>e.full_name.toLowerCase().includes(S.toLowerCase()));K=Qa,ie=n,ae=U,G=Ga,ne=`sm:max-w-lg`,t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ha,{children:`Clone from GitHub`})}),t[52]=re):re=t[52],W=Ja,q=`flex flex-col gap-4`;let r;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`label`,{htmlFor:`clone-url`,className:`text-sm font-medium`,children:`Repository URL or owner/repo`}),t[53]=r):r=t[53];let i;t[54]===F?i=t[55]:(i=e=>F(e.target.value),t[54]=F,t[55]=i),t[56]!==E||t[57]!==i||t[58]!==m?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(go,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:m,onChange:i,disabled:E})]}),t[56]=E,t[57]=i,t[58]=m,t[59]=ee):ee=t[59],te=w&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`repo-filter`,className:`text-sm font-medium`,children:`Your repositories`}),(0,Z.jsx)(go,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories`,value:S,onChange:e=>C(e.target.value),disabled:E||b&&v===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":b&&v===null,children:b&&v===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(Ji,{className:`h-4 w-2/3`}),(0,Z.jsx)(Ji,{className:`h-4 w-1/2`}),(0,Z.jsx)(Ji,{className:`h-4 w-3/4`}),(0,Z.jsx)(Ji,{className:`h-4 w-2/5`}),(0,Z.jsx)(Ji,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v?.length===0?`No repositories found.`:`No matches.`}):e?.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-muted flex items-center gap-2 truncate disabled:opacity-50`,onClick:()=>L(e),disabled:E,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[32]=E,t[33]=U,t[34]=L,t[35]=F,t[36]=w,t[37]=b,t[38]=n,t[39]=S,t[40]=v,t[41]=m,t[42]=W,t[43]=G,t[44]=K,t[45]=q,t[46]=ee,t[47]=te,t[48]=ne,t[49]=re,t[50]=ie,t[51]=ae}else W=t[42],G=t[43],K=t[44],q=t[45],ee=t[46],te=t[47],ne=t[48],re=t[49],ie=t[50],ae=t[51];let oe;t[60]!==E||t[61]!==w||t[62]!==i?(oe=!w&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:`Browse your repos:`}),(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:`Sign in to GitHub`})]}),t[60]=E,t[61]=w,t[62]=i,t[63]=oe):oe=t[63];let se;t[64]!==E||t[65]!==g||t[66]!==p?(se=!p&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),(0,Z.jsx)(go,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:g,onChange:e=>_(e.target.value),disabled:E})]}),t[64]=E,t[65]=g,t[66]=p,t[67]=se):se=t[67];let ce;t[68]!==q||t[69]!==ee||t[70]!==te||t[71]!==oe||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{className:q,children:[ee,te,oe,se]}),t[68]=q,t[69]=ee,t[70]=te,t[71]=oe,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==W||t[75]!==ce?(le=(0,Z.jsx)(W,{children:ce}),t[74]=W,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==E||t[78]!==z||t[79]!==U||t[80]!==m||t[81]!==p?(ue=(0,Z.jsx)(Ya,{children:E?(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:V,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>U(!1),children:`Cancel`}),(0,Z.jsx)(Y,{onClick:()=>void z(),disabled:!m.trim(),"aria-describedby":p?`clone-picker-hint`:void 0,children:`Clone`}),p&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:`Opens a folder picker to choose where to clone the repository.`})]})}),t[77]=E,t[78]=z,t[79]=U,t[80]=m,t[81]=p,t[82]=ue):ue=t[82];let de;t[83]!==G||t[84]!==ne||t[85]!==re||t[86]!==le||t[87]!==ue?(de=(0,Z.jsxs)(G,{className:ne,children:[re,le,ue]}),t[83]=G,t[84]=ne,t[85]=re,t[86]=le,t[87]=ue,t[88]=de):de=t[88];let fe;return t[89]!==K||t[90]!==ie||t[91]!==ae||t[92]!==de?(fe=(0,Z.jsx)(K,{open:ie,onOpenChange:ae,children:de}),t[89]=K,t[90]=ie,t[91]=ae,t[92]=de,t[93]=fe):fe=t[93],fe}var _u=(0,Q.lazy)(()=>r(()=>import(`./ConsentDialogBody-BpM_eICS.js`),__vite__mapDeps([5,1,6,7,8,9,10,11]),import.meta.url));function vu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(yo.subscribe,bu,yu))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(_u,{})}),e[0]=t):t=e[0],t}function yu(){return!1}function bu(){return yo.getSnapshot()!==null}var xu=180,Su=5e3;function Cu(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function wu(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function Tu(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function Eu(e){let t=e instanceof Error?e.message:String(e);for(let e of Gn)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function Du(e){switch(e.reason){case`nested-project`:return`A project already exists at this location. Pick a different parent folder.`;case`target-not-empty`:return`A non-empty folder with this name already exists. Use a different name.`;case`invalid-args`:return`Invalid input — please check the name and try again.`;case`mkdir-failed`:return`Could not create the project folder. Try a different name or location.`;case`git-init-failed`:return`Project folder created, but git init failed. Try again.`;case`init-failed`:return`Could not write project files. Try a different location.`;case`discovery-failed`:return`Could not finalize project setup. Try again.`;case`unknown`:return`Could not create project. Try again or pick a different location.`}}function Ou(e){let t=(0,$.c)(123),{open:n,onOpenChange:r,bridge:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(Pu),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={kind:`idle`},t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b={kind:`idle`},t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),[C,w]=(0,Q.useState)(0),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=new Set,t[2]=T):T=t[2];let E=(0,Q.useRef)(T),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)(0),j,M;t[3]!==i||t[4]!==n?(j=()=>{if(!n)return;E.current.clear(),y(null),h({kind:`idle`}),_(!1),o(``),f(new Set(Pn)),S({kind:`idle`}),A.current+=1;let e=!1;u(!0),i.fs.defaultProjectsRoot().then(t=>{e||c(t)}).catch(Nu).finally(()=>{e||u(!1)});let t=requestAnimationFrame(()=>{k.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},M=[n,i],t[3]=i,t[4]=n,t[5]=j,t[6]=M):(j=t[5],M=t[6]),(0,Q.useEffect)(j,M);let N;t[7]!==i||t[8]!==a||t[9]!==n||t[10]!==s?(N=()=>{if(!n)return;O.current!==null&&clearTimeout(O.current),D.current!==null&&D.current.abort();let e=zn(a);if(s===``||e===``){h({kind:`idle`});return}let t=Cu(s,e);h({kind:`pending`});let r=new AbortController;return D.current=r,O.current=setTimeout(()=>{Promise.all([i.fs.findEnclosingProjectRoot(s),i.fs.findEnclosingGitRoot(s),i.fs.folderState(t)]).then(t=>{let[n,i,a]=t;r.signal.aborted||h(Tu({parent:s,sanitizedName:e,enclosingProject:n,enclosingGit:i,targetState:a}))}).catch(e=>{r.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),h({kind:`free`}))})},xu),()=>{O.current!==null&&clearTimeout(O.current),r.abort()}},t[7]=i,t[8]=a,t[9]=n,t[10]=s,t[11]=N):N=t[11];let P;t[12]!==i||t[13]!==a||t[14]!==n||t[15]!==s||t[16]!==C?(P=[n,a,s,i,C],t[12]=i,t[13]=a,t[14]=n,t[15]=s,t[16]=C,t[17]=P):P=t[17],(0,Q.useEffect)(N,P);let F,I;t[18]===n?(F=t[19],I=t[20]):(F=()=>{if(!n)return;let e=()=>w(Mu);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},I=[n],t[18]=n,t[19]=F,t[20]=I),(0,Q.useEffect)(F,I);let L,R;t[21]!==m.kind||t[22]!==n?(L=()=>{if(!n||m.kind!==`confirm-git`)return;let e=setInterval(()=>{w(ju)},Su);return()=>clearInterval(e)},R=[n,m.kind],t[21]=m.kind,t[22]=n,t[23]=L,t[24]=R):(L=t[23],R=t[24]),(0,Q.useEffect)(L,R);let z;t[25]!==m.gitRoot||t[26]!==m.kind||t[27]!==x.gitRoot||t[28]!==x.kind?(z=()=>{if(m.kind!==`confirm-git`){x.kind!==`idle`&&(A.current+=1,S({kind:`idle`}));return}x.kind===`confirming`&&x.gitRoot!==m.gitRoot&&S({kind:`idle`}),x.kind===`pending`&&x.gitRoot!==m.gitRoot&&(A.current+=1,S({kind:`idle`}))},t[25]=m.gitRoot,t[26]=m.kind,t[27]=x.gitRoot,t[28]=x.kind,t[29]=z):z=t[29];let B;t[30]!==m||t[31]!==x?(B=[m,x],t[30]=m,t[31]=x,t[32]=B):B=t[32],(0,Q.useEffect)(z,B);let V;t[33]!==i||t[34]!==m.kind||t[35]!==n?(V=()=>{if(!n)return;let e=null;m.kind===`block-nested`?e=`nested`:m.kind===`block-nonempty`?e=`nonempty`:m.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(E.current.has(e)||(E.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Au)))},t[33]=i,t[34]=m.kind,t[35]=n,t[36]=V):V=t[36];let H;t[37]!==i||t[38]!==m||t[39]!==n?(H=[n,m,i],t[37]=i,t[38]=m,t[39]=n,t[40]=H):H=t[40],(0,Q.useEffect)(V,H);let U,W;t[41]!==a||t[42]!==s?(U=zn(a),W=U===``||s===``?``:Cu(s,U),t[41]=a,t[42]=s,t[43]=U,t[44]=W):(U=t[43],W=t[44]);let G=W,K=G===``?s:G,q=!g&&U!==``&&s!==``&&(m.kind===`free`||m.kind===`confirm-git`),ee;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[45]=ee):ee=t[45];let te=ee,ne;t[46]===i?ne=t[47]:(ne=async function(){try{let e=await i.dialog.openFolder();if(e===null)return;c(e)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[46]=i,t[47]=ne);let re=ne,ie;t[48]!==i||t[49]!==q||t[50]!==d||t[51]!==r||t[52]!==s||t[53]!==U?(ie=async function(e){if(e.preventDefault(),q){_(!0),y(null);try{await i.project.createNew({parent:s,name:U,editors:Array.from(d)}),r(!1)}catch(e){y(Eu(e)),_(!1)}}},t[48]=i,t[49]=q,t[50]=d,t[51]=r,t[52]=s,t[53]=U,t[54]=ie):ie=t[54];let ae=ie,oe;t[55]!==g||t[56]!==r?(oe=function(e){g||r(e)},t[55]=g,t[56]=r,t[57]=oe):oe=t[57];let se=oe,ce;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ce=async function(e){S({kind:`confirming`,gitRoot:e})},t[58]=ce):ce=t[58];let le=ce,ue;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ue=async function(){S({kind:`idle`})},t[59]=ue):ue=t[59];let de=ue,fe;t[60]===i?fe=t[61]:(fe=async function(e){let t=A.current+1;A.current=t,S({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),A.current!==t)return;w(ku),S({kind:`idle`})}catch(e){let n=e;if(A.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),S({kind:`error`,message:r})}},t[60]=i,t[61]=fe);let pe=fe,me;t[62]!==i||t[63]!==r?(me=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[62]=i,t[63]=r,t[64]=me):me=t[64];let he=me,ge;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ha,{children:`Create new project`}),(0,Z.jsx)(Ba,{children:`Make a new folder for a brand-new Open Knowledge project.`})]}),t[65]=ge):ge=t[65];let _e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(uo,{htmlFor:`create-name`,className:`block`,children:`Name`}),t[66]=_e):_e=t[66];let ve;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{o(e.target.value),y(null)},t[67]=ve):ve=t[67];let ye;t[68]!==g||t[69]!==a?(ye=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[_e,(0,Z.jsx)(go,{id:`create-name`,ref:k,value:a,onChange:ve,disabled:g,placeholder:`My Notes`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`create-target-caption`,"data-testid":`create-name`})]}),t[68]=g,t[69]=a,t[70]=ye):ye=t[70];let be;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(uo,{htmlFor:`create-location`,className:`block`,children:`Location`}),t[71]=be):be=t[71];let xe=g||l,Se;t[72]===re?Se=t[73]:(Se=()=>void re(),t[72]=re,t[73]=Se);let Ce;t[74]!==xe||t[75]!==Se?(Ce=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(Y,{id:`create-location`,type:`button`,variant:`outline`,disabled:xe,onClick:Se,"data-testid":`create-browse`,children:`Browse`})}),t[74]=xe,t[75]=Se,t[76]=Ce):Ce=t[76];let J;t[77]===K?J=t[78]:(J=K===``?(0,Z.jsx)(`span`,{className:`sr-only`,children:`No target path yet`}):K,t[77]=K,t[78]=J);let we;t[79]===J?we=t[80]:(we=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-xs text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:J}),t[79]=J,t[80]=we);let Te;t[81]!==Ce||t[82]!==we?(Te=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[be,Ce,we]}),t[81]=Ce,t[82]=we,t[83]=Te):Te=t[83];let Ee;t[84]!==m||t[85]!==pe||t[86]!==he||t[87]!==x?(Ee=(0,Z.jsx)(Fu,{cascade:m,onOpenNested:he,removeGitState:x,onRequestRemoveGit:le,onCancelRemoveGit:de,onConfirmRemoveGit:pe}),t[84]=m,t[85]=pe,t[86]=he,t[87]=x,t[88]=Ee):Ee=t[88];let De,Oe;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Connect AI editors`}),Oe=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All editors are checked by default — uncheck the ones you don't use.`}),t[89]=De,t[90]=Oe):(De=t[89],Oe=t[90]);let ke;t[91]!==g||t[92]!==d?(ke=Pn.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(uo,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(ro,{id:t,checked:d.has(e),onCheckedChange:()=>te(e),disabled:g,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:gr[e]})]},e)}),t[91]=g,t[92]=d,t[93]=ke):ke=t[93];let Ae;t[94]===ke?Ae=t[95]:(Ae=(0,Z.jsxs)(`fieldset`,{className:`space-y-2 pb-2`,children:[De,Oe,ke]}),t[94]=ke,t[95]=Ae);let je;t[96]===v?je=t[97]:(je=v===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:Du(v)}),t[96]=v,t[97]=je);let Me;t[98]!==ye||t[99]!==Te||t[100]!==Ee||t[101]!==Ae||t[102]!==je?(Me=(0,Z.jsxs)(Ja,{className:`space-y-4`,children:[ye,Te,Ee,Ae,je]}),t[98]=ye,t[99]=Te,t[100]=Ee,t[101]=Ae,t[102]=je,t[103]=Me):Me=t[103];let Ne;t[104]===r?Ne=t[105]:(Ne=()=>r(!1),t[104]=r,t[105]=Ne);let Pe;t[106]!==g||t[107]!==Ne?(Pe=(0,Z.jsx)(Y,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Ne,disabled:g,"data-testid":`create-cancel`,children:`Cancel`}),t[106]=g,t[107]=Ne,t[108]=Pe):Pe=t[108];let Fe=!q,Ie=g?`Creating`:`Create`,Le;t[109]!==Fe||t[110]!==Ie?(Le=(0,Z.jsx)(Y,{type:`submit`,disabled:Fe,"data-testid":`create-submit`,children:Ie}),t[109]=Fe,t[110]=Ie,t[111]=Le):Le=t[111];let Re;t[112]!==Pe||t[113]!==Le?(Re=(0,Z.jsxs)(Ya,{children:[Pe,Le]}),t[112]=Pe,t[113]=Le,t[114]=Re):Re=t[114];let ze;t[115]!==ae||t[116]!==Me||t[117]!==Re?(ze=(0,Z.jsxs)(Ga,{className:`sm:max-w-lg motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,"data-testid":`create-project-dialog`,children:[ge,(0,Z.jsxs)(`form`,{onSubmit:ae,"data-testid":`create-project-form`,className:`flex min-h-0 flex-1 flex-col`,children:[Me,Re]})]}),t[115]=ae,t[116]=Me,t[117]=Re,t[118]=ze):ze=t[118];let Be;return t[119]!==se||t[120]!==n||t[121]!==ze?(Be=(0,Z.jsx)(Qa,{open:n,onOpenChange:se,children:ze}),t[119]=se,t[120]=n,t[121]=ze,t[122]=Be):Be=t[122],Be}function ku(e){return e+1}function Au(){}function ju(e){return e+1}function Mu(e){return e+1}function Nu(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Pu(){return new Set(Pn)}function Fu(e){let t=(0,$.c)(33),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`pending`||n.kind===`free`)return null;if(n.kind===`block-nested`){let e;t[0]===n.rootPath?e=t[1]:(e=wu(n.rootPath),t[0]=n.rootPath,t[1]=e);let i=e,a;t[2]===n.rootPath?a=t[3]:(a=(0,Z.jsxs)(`p`,{className:`mb-2`,children:[`Can't nest projects. An Open Knowledge project already exists at`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:n.rootPath}),`. Choose a location outside it, or open that project instead.`]}),t[2]=n.rootPath,t[3]=a);let o;t[4]!==n.rootPath||t[5]!==r?(o=()=>r(n.rootPath),t[4]=n.rootPath,t[5]=r,t[6]=o):o=t[6];let s;t[7]!==i||t[8]!==o?(s=(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:o,"data-testid":`create-banner-nested-open`,children:[`Open `,i]}),t[7]=i,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[13]!==e){let n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[15]=n):n=t[15],r=e.replace(n,``),t[13]=e,t[14]=r}else r=t[14];let c=`${r}/.git`,l;t[16]===e?l=t[17]:(l=(0,Z.jsx)(`code`,{children:e}),t[16]=e,t[17]=l);let u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`code`,{children:`.git`}),t[18]=u):u=t[18];let d;t[19]===l?d=t[20]:(d=(0,Z.jsxs)(`p`,{children:[`Open Knowledge will be initialized at `,l,` — the parent of your new folder, because it contains a `,u,` folder (one project per git repo).`]}),t[19]=l,t[20]=d);let f;t[21]!==e||t[22]!==o||t[23]!==s||t[24]!==a||t[25]!==i.kind||t[26]!==i.message||t[27]!==c?(f=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:[`Remove the parent `,(0,Z.jsx)(`code`,{children:`.git`}),` folder`]}),i.kind===`error`?(0,Z.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:[`Couldn't remove `,(0,Z.jsx)(`code`,{children:c}),`: `,i.message]}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsxs)(`p`,{className:`text-xs`,children:[`This will permanently delete`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:c}),`. All git history in that folder is lost; the working files stay in place. Only confirm if the parent git repository is unintended. If the parent is intentionally a git repository (you cloned it on purpose), cancel and pick a location outside it instead.`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?`Removing…`:`Delete ${c}`}),(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:`Cancel`})]})]}),t[21]=e,t[22]=o,t[23]=s,t[24]=a,t[25]=i.kind,t[26]=i.message,t[27]=c,t[28]=f):f=t[28];let p;return t[29]!==d||t[30]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[d,f]}),t[29]=d,t[30]=f,t[31]=p):p=t[31],p}let c;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-nonempty`,children:(0,Z.jsx)(`p`,{children:`A non-empty folder with this name already exists. Use "Open folder on disk" instead.`})}),t[32]=c):c=t[32],c}function Iu(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function Lu(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Open Knowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`Open Knowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Ru=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-BDYRADff.js`),__vite__mapDeps([12,1,6,7,13,14,15,8,16]),import.meta.url));function zu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(no.subscribe,Vu,Bu))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Ru,{})}),e[0]=t):t=e[0],t}function Bu(){return!1}function Vu(){return no.getSnapshot()!==null}var Hu=(e,t,n)=>Oc(e,t,n,`NavigatorApp`);function Uu(e,t){return e.filter(e=>e.path!==t)}function Wu(e){let t=(0,$.c)(77),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=typeof window<`u`&&window.okDesktop!=null,[y,b]=(0,Q.useState)(`auth`),{channel:x}=Tc(),{theme:S}=Ln();Oa(n,S??`system`);let C;t[1]===n.project?C=t[2]:(C=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>Hu(e,t,l),t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[6]=D):D=t[6];let O=D,k;t[7]===n?k=t[8]:(k=()=>E(async()=>{let e=await n.dialog.openFolder();e&&await qu(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=k);let A=k,j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>p(!0),t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=e=>E(async()=>{await qu(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=N);let P=N,F;t[12]===n.project?F=t[13]:(F=e=>E(async()=>{await n.project.removeRecent(e),a(t=>Uu(t,e))},`Failed to remove project.`),t[12]=n.project,t[13]=F);let I=F,L;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Lu,{className:`size-12 shrink-0`}),t[14]=L):L=t[14];let R;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),(0,Z.jsx)(pu,{})]}),t[15]=R):R=t[15];let z;t[16]===n.appVersion?z=t[17]:(z=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]}),t[16]=n.appVersion,t[17]=z);let B;t[18]===x?B=t[19]:(B=x!==null&&(0,Z.jsx)(Qe,{variant:`gray`,className:`text-2xs font-mono`,children:x===`beta`?`Beta`:`Stable`}),t[18]=x,t[19]=B);let V;t[20]!==z||t[21]!==B?(V=(0,Z.jsx)(`div`,{className:`shrink-0 ${v?`[-webkit-app-region:drag]`:``}`,"data-testid":`nav-chrome-row`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-5xl px-12 pt-12 pb-10`,children:(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[L,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[R,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[z,B]})]})]})})}),t[20]=z,t[21]=B,t[22]=V):V=t[22];let H=`mx-auto flex w-full max-w-5xl flex-1 flex-col overflow-hidden px-12 pb-12 space-y-10 ${!o&&i.length===0?`justify-center`:``}`,U;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Gu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:O,dataTestId:`nav-clone`,Icon:Iu}),t[23]=U):U=t[23];let W;t[24]===A?W=t[25]:(W=(0,Z.jsx)(Gu,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:A,dataTestId:`nav-open`,Icon:_t}),t[24]=A,t[25]=W);let G;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Gu,{title:`Create new project`,description:`Make a new folder for a brand-new project.`,onClick:M,dataTestId:`nav-create-new`,Icon:Ri}),t[26]=G):G=t[26];let K;t[27]===W?K=t[28]:(K=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[U,W,G]}),t[27]=W,t[28]=K);let q;t[29]===c?q=t[30]:(q=c===null?null:(0,Z.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[29]=c,t[30]=q);let ee;t[31]!==o||t[32]!==P||t[33]!==I||t[34]!==i?(ee=o?(0,Z.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(Ne,{className:`size-4 animate-spin text-muted-foreground/60`})})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:`Recent`}),(0,Z.jsx)(`ul`,{className:`min-h-0 flex-1 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(Ku,{project:e,onOpen:()=>P(e.path),onRemove:()=>I(e.path)},e.path))})]}):null,t[31]=o,t[32]=P,t[33]=I,t[34]=i,t[35]=ee):ee=t[35];let te;t[36]!==H||t[37]!==K||t[38]!==q||t[39]!==ee?(te=(0,Z.jsxs)(`div`,{className:H,children:[K,q,ee]}),t[36]=H,t[37]=K,t[38]=q,t[39]=ee,t[40]=te):te=t[40];let ne,re;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(zu,{}),re=(0,Z.jsx)(vu,{}),t[41]=ne,t[42]=re):(ne=t[41],re=t[42]);let ie;t[43]!==n||t[44]!==f?(ie=(0,Z.jsx)(Ou,{open:f,onOpenChange:p,bridge:n}),t[43]=n,t[44]=f,t[45]=ie):ie=t[45];let ae;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{h(e),e||_(!1)},t[46]=ae):ae=t[46];let oe;t[47]===n?oe=t[48]:(oe=Rc(n),t[47]=n,t[48]=oe);let se=y===`identity`,ce;t[49]===g?ce=t[50]:(ce=()=>{h(!1),g&&(_(!1),d(!0))},t[49]=g,t[50]=ce);let le;t[51]!==m||t[52]!==oe||t[53]!==se||t[54]!==ce?(le=(0,Z.jsx)(du,{open:m,onOpenChange:ae,transport:oe,identityPrompt:se,onSuccess:ce}),t[51]=m,t[52]=oe,t[53]=se,t[54]=ce,t[55]=le):le=t[55];let ue;t[56]===n?ue=t[57]:(ue=Bc(n),t[56]=n,t[57]=ue);let de;t[58]===n?de=t[59]:(de=Pc(n),t[58]=n,t[59]=de);let fe;t[60]===n.dialog?fe=t[61]:(fe=()=>n.dialog.openFolder(),t[60]=n.dialog,t[61]=fe);let pe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1),b(`auth`),_(!0),h(!0)},t[62]=pe):pe=t[62];let me;t[63]===n?me=t[64]:(me=e=>{let{dir:t}=e;E(()=>qu(n,t,`pick-existing`),`Failed to open cloned project.`)},t[63]=n,t[64]=me);let he;t[65]!==u||t[66]!==ue||t[67]!==de||t[68]!==fe||t[69]!==me?(he=(0,Z.jsx)(gu,{open:u,onOpenChange:d,transport:ue,authQueryTransport:de,pickParentFolder:fe,onSignIn:pe,onCloneComplete:me}),t[65]=u,t[66]=ue,t[67]=de,t[68]=fe,t[69]=me,t[70]=he):he=t[70];let ge;return t[71]!==V||t[72]!==te||t[73]!==ie||t[74]!==le||t[75]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[V,te,ne,re,ie,le,he]}),t[71]=V,t[72]=te,t[73]=ie,t[74]=le,t[75]=he,t[76]=ge):ge=t[76],ge}function Gu(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Ku(e){let t=(0,$.c)(25),{project:n,onOpen:r,onRemove:i}=e,a=n.missing,o=n.missing&&`opacity-50`,s;t[0]===o?s=t[1]:(s=X(`flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md py-3.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed`,o),t[0]=o,t[1]=s);let c;t[2]===n.name?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=c);let l;t[4]===n.path?l=t[5]:(l=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.missing?d=t[10]:(d=n.missing?(0,Z.jsx)(Qe,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[9]=n.missing,t[10]=d);let f;t[11]!==r||t[12]!==n.missing||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,disabled:a,className:s,children:[u,d]}),t[11]=r,t[12]=n.missing,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16];let p=`Remove ${n.name} from recent projects`,m=`nav-recent-remove-${n.path}`,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(za,{"aria-hidden":`true`}),t[17]=h):h=t[17];let g;t[18]!==i||t[19]!==m||t[20]!==p?(g=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":p,title:`Remove from recent projects`,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":m,children:h}),t[18]=i,t[19]=m,t[20]=p,t[21]=g):g=t[21];let _;return t[22]!==g||t[23]!==f?(_=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[f,g]}),t[22]=g,t[23]=f,t[24]=_):_=t[24],_}async function qu(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var Ju=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Ln(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Cr,{className:`size-4`}),info:(0,Z.jsx)(St,{className:`size-4`}),warning:(0,Z.jsx)(gn,{className:`size-4`}),error:(0,Z.jsx)(Xs,{className:`size-4`}),loading:(0,Z.jsx)(Ne,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(Va,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c};function Yu(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(Xu(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function Xu(e,t){return e.startsWith(`/api/`)?t+e:e}function Zu(e){return`#/${encodeURIComponent(e)}`}function Qu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(Zu(e.doc))})}var $u=4e3,ed=1440*60*1e3;function td(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){eo.success(`Opened existing OK project at ${e.ancestorPath}`,{duration:$u});return}if(e.kind===`mcp-repaired`){let t=e.editors.map(e=>gr[e]??e).join(`, `);eo.success(`Repaired ${t} MCP integration. Restart ${t} if already open.`,{duration:ed});return}if(e.kind===`mcp-repair-failed`){eo.error(`MCP auto-repair failed — open Settings → AI Tool Integration to fix.`,{duration:ed});return}let t=vo(e.gitRoot,e.pickedPath)??e.pickedPath;eo.success(`Initialized OK at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:$u})})}var nd=!1;function rd(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Ie(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function id(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var ad=0,od=0,sd=0,cd=0,ld=null,ud=[`linkResolutionDecoration$`],dd=new WeakSet,fd=new WeakSet;function pd(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function md(){return!1}function hd(){return!md()}function gd(e,t){if(hd())return t;let n=`ok/cold/nodeview-factory-${pd(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ie(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function _d(e){if(hd())return;let t=e.state.plugins;for(let e of t){if(fd.has(e))continue;let t=e.spec?.key?.key;if(!t||!ud.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){fd.add(e);continue}let i=`ok/cold/decoration-${pd(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ie(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},fd.add(e)}}function vd(e){if(hd())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=gd(e,n);r.__okWrapped=!0,t[e]=r}}function yd(e){return hd()?e:e.map(e=>{let t=e.name??`unknown`,n=pd(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function bd(){if(!nd){nd=!0,rd(Yn.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return hd()||(ld=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:id(i.editorState),durationMs:r}}),rd(Yn.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!hd()&&!dd.has(e)&&t.view&&(_d(t.view),vd(t.view),dd.add(e)),{docSize:id(t.editorState)}}),rd(Yn.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{cd+=1;let i=e;return!hd()&&i.view&&vd(i.view),{docSize:id(i.view),seq:cd,durationMs:r}}),rd(sn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(od+=1,{seq:od,docSize:id(e.state),durationMs:r})),rd(sn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(sd+=1,{seq:sd,docSize:id(e.state),durationMs:r})),rd(M.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{ad+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:ad,topLevelYElements:a,durationMs:r}}),rd(we.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Ie(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!hd()&&e===`first-paint`&&ld!==null)){let e=ld,n=Math.max(0,t.startTime-e);Ie(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),ld=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var xd=`Relaunch`,Sd=`Release notes`,Cd=`Updates paused`,wd=`Download`,Td=`Reset to defaults`,Ed=`Relaunch failed — please restart manually`,Dd=`Recovery action failed — please try again`;function Od(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function kd(e){return`Version ${e} ready to install`}function Ad(e){return`Updated to Version ${e}`}function jd(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Md=0,Nd=0,Pd=1,Fd=2,Id=3;function Ld(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:kd(r),priority:Fd,action:{label:xd,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:Od(Ed,e),variant:`error`,priority:Pd})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:Ad(n),priority:Id,action:{label:Sd,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:Cd,priority:Nd,action:{label:wd,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function Rd(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Od(Dd,e),variant:`error`,priority:Md})};n({id:i,body:jd(t.currentBuild),priority:Md,action:{label:Td,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var zd=[],Bd=new Set,Vd=!1;function Hd(){for(let e of Bd)e()}function Ud(e){let t=zd.findIndex(t=>t.id===e.id);if(t===-1)zd=[...zd,e];else{let n=zd.slice();n[t]=e,zd=n}Hd()}function Wd(e){let t=zd.filter(t=>t.id!==e);t.length!==zd.length&&(zd=t,Hd())}function Gd(){return zd}function Kd(e){return Bd.add(e),()=>{Bd.delete(e)}}function qd(){if(Vd||typeof window>`u`)return;let e=window.okDesktop;e&&(Vd=!0,Ld(e,Ud,Wd),e.state.query().then(t=>{t.schemaIncompatibility&&Rd(e,t.schemaIncompatibility,Ud,Wd)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Jd=`ok-omnibar-recents-v1`,Yd=10;function Xd(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function Zd(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Qd(e,t){return`${e}:${t}`}function $d(e){let t=Zd(e);if(!t)return[];try{let e=t.getItem(Jd);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Xd).slice(0,Yd):[]}catch{return[]}}function ef(e,t){let n=Zd(t);if(n)try{n.setItem(Jd,JSON.stringify(e.slice(0,Yd)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function tf(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Yd)}function nf(e,t){return e.filter(e=>t.has(Qd(e.kind,e.path)))}var rf=50,af=30,of=``,sf=null;function cf(e){return e.trim().toLowerCase()}function lf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function uf(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function df(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:sr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:sr(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function ff(e){return Zn({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function pf(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:kr(e.map(ff))}}function mf(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function hf(e){let t=mf(e);return sf&&of===t?sf:(of=t,sf=pf(e),sf)}function gf(e,t,n=rf){return _f(hf(e),t,n)}function _f(e,t,n=rf){let r=cf(t);return r?En(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function vf(e,t){let n=uf(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(lf).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function yf(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=sr(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function bf(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??af}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(An(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(yf).filter(e=>!!e)}function xf(e,t,n=[]){let r=cf(t);return r?cf([e,...n].join(` `)).includes(r):!0}var Sf=`tag:`;function Cf(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function wf(e,t){return S(e,t)}var Tf=U;async function Ef(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var Df=`open-knowledge:doc-panel-tab`,Of=null;function kf(){let e=Of;return Of=null,e}function Af(e,t=typeof window>`u`?new EventTarget:window){Of=e,t.dispatchEvent(new CustomEvent(Df,{detail:{tab:e}}))}function jf(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(Df,n),()=>t.removeEventListener(Df,n)}var Mf=[`.md`,`.mdx`];function Nf(e){let t=e.toLowerCase();for(let e of Mf)if(t.endsWith(e))return e;return null}function Pf(e){let t=Nf(e);return t?e.slice(0,-t.length):e}var Ff=`__blank__`,If={local:0,inherited:1,user:2};function Lf(e){return[...e].sort((e,t)=>{let n=If[e.scope]-If[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function Rf(e){return e.trim()?e.includes(`..`)?`Path cannot contain ".."`:e.startsWith(`/`)?`Path cannot start with "/"`:e.includes(`\\`)?`Path cannot contain backslashes`:e.includes(`\0`)?`Path cannot contain null bytes`:null:`Name cannot be empty`}function zf(e){let t=e.fileName.trim(),n=Nf(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function Bf(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function Vf(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Hf(e){let t=(0,$.c)(120),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{addPage:d}=Tr(),f=oa(u?null:a),p=u??f,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`.md`),[b,x]=(0,Q.useState)(Ff),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=(0,Q.useId)(),k=(0,Q.useId)(),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),[N,P]=(0,Q.useState)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(null),L,R;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(L=()=>{if(n){C(null),D(null),T(!1),_(``),x(i===`file`&&s?s:Ff),P(!1);let e=i===`file`?o??`untitled`:`index`,t=Nf(e);y(t??`.md`),h(t?Pf(e):e)}},R=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=L,t[5]=R):(L=t[4],R=t[5]),(0,Q.useEffect)(L,R);let z;t[6]!==p.state.data||t[7]!==p.state.status?(z=p.state.status===`ready`?Lf(p.state.data.folder.templates_available??[]):[],t[6]=p.state.data,t[7]=p.state.status,t[8]=z):z=t[8];let B=z,V;t[9]!==p.state.data||t[10]!==p.state.status||t[11]!==n||t[12]!==b?(V=()=>{n&&b!==Ff&&p.state.status===`ready`&&((p.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(Ff))},t[9]=p.state.data,t[10]=p.state.status,t[11]=n,t[12]=b,t[13]=V):V=t[13];let H;t[14]!==p.state||t[15]!==n||t[16]!==b?(H=[n,b,p.state],t[14]=p.state,t[15]=n,t[16]=b,t[17]=H):H=t[17],(0,Q.useEffect)(V,H);let U=i===`file`,W=p.state.status===`loading`||p.state.status===`idle`,G=p.state.status===`error`?p.state.message:null,K;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){let t=Nf(e);t?(y(t),h(Pf(e))):h(e),C(null)},t[18]=K):K=t[18];let q=K,ee;t[19]!==v||t[20]!==m||t[21]!==g||t[22]!==a||t[23]!==i?(ee=function(){return zf({kind:i,initialDir:a,fileName:m,fileExtension:v,folderName:g})},t[19]=v,t[20]=m,t[21]=g,t[22]=a,t[23]=i,t[24]=ee):ee=t[24];let te=ee,ne;t[25]!==m||t[26]!==g||t[27]!==i?(ne=function(){if(i===`folder`){let e=Rf(g.trim());if(e)return{message:`Folder name: ${e}`,field:`folder`}}let e=Rf(m.trim());return e?{message:e,field:`file`}:null},t[25]=m,t[26]=g,t[27]=i,t[28]=ne):ne=t[28];let re=ne,ie;t[29]!==w||t[30]!==m||t[31]!==g||t[32]!==i?(ie=w||!m.trim()||i===`folder`&&!g.trim(),t[29]=w,t[30]=m,t[31]=g,t[32]=i,t[33]=ie):ie=t[33];let ae=ie,oe;t[34]!==d||t[35]!==te||t[36]!==re||t[37]!==i||t[38]!==l||t[39]!==r||t[40]!==b?(oe=async function(){let e=re();if(e){C(e.message),D(e.field);return}T(!0),C(null),D(null);let t=te(),n=i===`file`&&b!==Ff?b:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=await xt(e,`Server error (HTTP ${e.status})`);if(!t.ok){T(!1),C(t.title),D(`form`);return}let n=mr.safeParse(t.body);if(T(!1),!n.success){C(`Failed to create ${i}`),D(`form`);return}let o=n.data.docName;r(!1),window.location.hash=`#/${o}`,d(o),er([`files`,`backlinks`,`graph`]),l?.(o)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),T(!1),C(`Network error — please try again`),D(`form`)}},t[34]=d,t[35]=te,t[36]=re,t[37]=i,t[38]=l,t[39]=r,t[40]=b,t[41]=oe):oe=t[41];let se=oe,ce=a||`(root)`,le=i===`file`?`New file`:`New folder`,ue;t[42]===le?ue=t[43]:(ue=(0,Z.jsx)(Ha,{children:le}),t[42]=le,t[43]=ue);let de;t[44]!==c||t[45]!==ce?(de=c??(0,Z.jsxs)(Z.Fragment,{children:[`Create in `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:ce})]}),t[44]=c,t[45]=ce,t[46]=de):de=t[46];let fe;t[47]===de?fe=t[48]:(fe=(0,Z.jsx)(Ba,{children:de}),t[47]=de,t[48]=fe);let pe;t[49]!==ue||t[50]!==fe?(pe=(0,Z.jsxs)(Za,{children:[ue,fe]}),t[49]=ue,t[50]=fe,t[51]=pe):pe=t[51];let me;t[52]!==b||t[53]!==U||t[54]!==j||t[55]!==N||t[56]!==M||t[57]!==B||t[58]!==G||t[59]!==W?(me=U&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:j,className:`mb-1.5 block text-sm font-medium`,children:`Start from`}),G?(0,Z.jsxs)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:[`Could not load templates: `,G,`. You can still create a blank note.`]}):null,(0,Z.jsx)(Gf,{triggerId:M,labelledById:j,open:N,onOpenChange:P,value:b,onValueChange:x,templates:B,loading:W}),!W&&!G&&B.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`No templates resolve here. Add one in this folder's Templates section, or in Settings → User templates.`}):null]}),t[52]=b,t[53]=U,t[54]=j,t[55]=N,t[56]=M,t[57]=B,t[58]=G,t[59]=W,t[60]=me):me=t[60];let he;t[61]!==S||t[62]!==E||t[63]!==O||t[64]!==k||t[65]!==g||t[66]!==i?(he=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:k,children:`Folder name`}),(0,Z.jsx)(go,{ref:I,id:k,value:g,onChange:e=>{_(e.target.value),C(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":S&&(E===`folder`||E===`form`)?O:void 0,"aria-invalid":S&&(E===`folder`||E===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Rf(g.trim());if(t){C(`Folder name: ${t}`),D(`folder`);return}F.current?.focus()}}})]}),t[61]=S,t[62]=E,t[63]=O,t[64]=k,t[65]=g,t[66]=i,t[67]=he):he=t[67];let ge=i===`folder`?`First file name`:`File name`,_e;t[68]!==A||t[69]!==ge?(_e=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:A,children:ge}),t[68]=A,t[69]=ge,t[70]=_e):_e=t[70];let ve;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>q(e.target.value),t[71]=ve):ve=t[71];let ye=i===`file`,be=S&&(E===`file`||E===`form`)?O:void 0,xe=S&&(E===`file`||E===`form`)?!0:void 0,Se;t[72]!==se||t[73]!==ae?(Se=e=>{e.key===`Enter`&&!ae&&se()},t[72]=se,t[73]=ae,t[74]=Se):Se=t[74];let Ce;t[75]!==A||t[76]!==m||t[77]!==ye||t[78]!==be||t[79]!==xe||t[80]!==Se?(Ce=(0,Z.jsx)(go,{ref:F,id:A,value:m,onChange:ve,placeholder:`my-note`,autoFocus:ye,"aria-describedby":be,"aria-invalid":xe,onFocus:Wf,onKeyDown:Se,className:`flex-1`}),t[75]=A,t[76]=m,t[77]=ye,t[78]=be,t[79]=xe,t[80]=Se,t[81]=Ce):Ce=t[81];let J;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{(e===`.md`||e===`.mdx`)&&y(e)},t[82]=J):J=t[82];let we;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(we=Mf.map(Uf),t[83]=we):we=t[83];let Te;t[84]===v?Te=t[85]:(Te=(0,Z.jsx)(lo,{type:`single`,value:v,onValueChange:J,variant:`outline`,"aria-label":`File extension`,className:`shrink-0`,children:we}),t[84]=v,t[85]=Te);let Ee;t[86]!==Ce||t[87]!==Te?(Ee=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ce,Te]}),t[86]=Ce,t[87]=Te,t[88]=Ee):Ee=t[88];let De;t[89]!==S||t[90]!==O?(De=S&&(0,Z.jsx)(`p`,{id:O,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:S}),t[89]=S,t[90]=O,t[91]=De):De=t[91];let Oe;t[92]!==_e||t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(`div`,{children:[_e,Ee,De]}),t[92]=_e,t[93]=Ee,t[94]=De,t[95]=Oe):Oe=t[95];let ke;t[96]!==me||t[97]!==he||t[98]!==Oe?(ke=(0,Z.jsx)(Ja,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[me,he,Oe]})}),t[96]=me,t[97]=he,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]===r?Ae=t[101]:(Ae=()=>r(!1),t[100]=r,t[101]=Ae);let je;t[102]!==w||t[103]!==Ae?(je=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:w,children:`Cancel`}),t[102]=w,t[103]=Ae,t[104]=je):je=t[104];let Me=w?`Creating`:`Create`,Ne;t[105]!==se||t[106]!==ae||t[107]!==Me?(Ne=(0,Z.jsx)(Y,{onClick:se,disabled:ae,children:Me}),t[105]=se,t[106]=ae,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==je||t[110]!==Ne?(Pe=(0,Z.jsxs)(Ya,{children:[je,Ne]}),t[109]=je,t[110]=Ne,t[111]=Pe):Pe=t[111];let Fe;t[112]!==pe||t[113]!==ke||t[114]!==Pe?(Fe=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[pe,ke,Pe]}),t[112]=pe,t[113]=ke,t[114]=Pe,t[115]=Fe):Fe=t[115];let Ie;return t[116]!==r||t[117]!==n||t[118]!==Fe?(Ie=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:Fe}),t[116]=r,t[117]=n,t[118]=Fe,t[119]=Ie):Ie=t[119],Ie}function Uf(e){return(0,Z.jsx)(so,{value:e,"aria-label":`Use ${e} extension`,children:e},e)}function Wf(e){return Vf(e.currentTarget)}function Gf(e){let t=(0,$.c)(53),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,h=o===Ff,g=i?d:void 0,_=`${r} ${n}`,v=l?`Loading templates`:h?`Blank note`:p?.title??p?.name??o,b;t[5]===v?b=t[6]:(b=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[5]=v,t[6]=b);let x;t[7]!==h||t[8]!==l||t[9]!==p?(x=!l&&!h&&p?(0,Z.jsx)(Yf,{entry:p}):null,t[7]=h,t[8]=l,t[9]=p,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ms,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==i||t[17]!==g||t[18]!==_||t[19]!==S||t[20]!==n?(w=(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(Y,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:l,className:`w-full justify-between font-normal`,children:[S,C]})}),t[15]=l,t[16]=i,t[17]=g,t[18]=_,t[19]=S,t[20]=n,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(u,{placeholder:`Search templates`}),t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(B,{children:`No templates found.`}),t[23]=E):E=t[23];let D;t[24]!==a||t[25]!==s?(D=()=>{s(Ff),a(!1)},t[24]=a,t[25]=s,t[26]=D):D=t[26];let O=o===Ff?`opacity-100`:`opacity-0`,k;t[27]===O?k=t[28]:(k=X(`mt-1 size-4 shrink-0`,O),t[27]=O,t[28]=k);let A;t[29]===k?A=t[30]:(A=(0,Z.jsx)(La,{className:k,"aria-hidden":`true`}),t[29]=k,t[30]=A);let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:`Blank note`}),(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:`Empty starting content`})]}),t[31]=j):j=t[31];let M;t[32]!==D||t[33]!==A?(M=(0,Z.jsxs)(ze,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[A,j]}),t[32]=D,t[33]=A,t[34]=M):M=t[34];let N;if(t[35]!==a||t[36]!==s||t[37]!==c||t[38]!==o){let e;t[40]!==a||t[41]!==s||t[42]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(ze,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(La,{className:X(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Yf,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[40]=a,t[41]=s,t[42]=o,t[43]=e):e=t[43],N=c.map(e),t[35]=a,t[36]=s,t[37]=c,t[38]=o,t[39]=N}else N=t[39];let P;t[44]!==d||t[45]!==M||t[46]!==N?(P=(0,Z.jsx)(vt,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Jf,onWheel:qf,onTouchMove:Kf,children:(0,Z.jsxs)(y,{children:[T,(0,Z.jsxs)(F,{id:d,className:`subtle-scrollbar`,children:[E,M,N]})]})}),t[44]=d,t[45]=M,t[46]=N,t[47]=P):P=t[47];let I;return t[48]!==a||t[49]!==i||t[50]!==P||t[51]!==w?(I=(0,Z.jsxs)(m,{open:i,onOpenChange:a,children:[w,P]}),t[48]=a,t[49]=i,t[50]=P,t[51]=w,t[52]=I):I=t[52],I}function Kf(e){e.stopPropagation()}function qf(e){e.stopPropagation()}function Jf(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Yf(e){let t=(0,$.c)(9),{entry:n,className:r}=e;if(n.scope===`user`){let e;t[0]===r?e=t[1]:(e=X(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,Z.jsx)(Qe,{variant:`primary`,className:e,children:`user`}),t[2]=e,t[3]=n),n}if(n.scope===`inherited`){let e;t[4]===r?e=t[5]:(e=X(`shrink-0 text-2xs`,r),t[4]=r,t[5]=e);let i=n.source_folder||`root`,a;return t[6]!==e||t[7]!==i?(a=(0,Z.jsx)(Qe,{variant:`gray`,className:e,children:i}),t[6]=e,t[7]=i,t[8]=a):a=t[8],a}return null}function Xf(e){return e.split(`/`).pop()??e}function Zf(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(Xf(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:Xf(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function Qf(e){let t=(0,$.c)(24),{plan:n,selectedPack:r}=e,i,a,o,s,c,l,u;if(t[0]!==n||t[1]!==r){let e=Zf(n,r);i=n.personalTemplates?.willWrite.length??0;let d=[...e].sort(tp),f=new Set(d.map(ep));l=`space-y-2`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),`What gets created`]}),t[9]=u):u=t[9],c=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,a=`Items to be created`,o=`py-1.5`,s=d.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);f.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},$f),a?(0,Z.jsx)(Ns,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:i}),a&&e.description?(0,Z.jsxs)(ho,{children:[(0,Z.jsx)(fo,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(po,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];let d;t[10]!==a||t[11]!==o||t[12]!==s?(d=(0,Z.jsx)(`ul`,{"aria-label":a,className:o,children:s}),t[10]=a,t[11]=o,t[12]=s,t[13]=d):d=t[13];let f;t[14]===i?f=t[15]:(f=i>0?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-t border-border/60 bg-muted/10 px-3 py-1.5`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0`,children:`~/.ok/templates/`}),(0,Z.jsxs)(`span`,{className:`truncate text-1sm text-muted-foreground`,children:[`— `,i,` personal `,i===1?`template`:`templates`]})]}):null,t[14]=i,t[15]=f);let p;t[16]!==c||t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:c,children:[d,f]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p):p=t[19];let m;return t[20]!==l||t[21]!==u||t[22]!==p?(m=(0,Z.jsxs)(`section`,{className:l,children:[u,p]}),t[20]=l,t[21]=u,t[22]=p,t[23]=m):m=t[23],m}function $f(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function ep(e){return e.name.replace(/\/$/,``)}function tp(e,t){return e.name.localeCompare(t.name)}async function np(e){let t=await e.json().catch(()=>null),n=Sn.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function rp(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId),e?.includePersonalTemplates&&t.set(`includePersonalTemplates`,`true`);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await np(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId,includePersonalTemplates:t?.includePersonalTemplates})});if(!n.ok)return{ok:!1,error:await np(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result,personalTemplates:r.personalTemplates}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var ip={"knowledge-base":Bs,"software-lifecycle":Ps,"plain-notes":hc,worldbuilding:xs,"writing-pipeline":ec,gbrain:Ys};function ap(e){return ip[e]??Bs}function op(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await rp().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=X(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},cp).map(sp),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=X(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(lp,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function sp(e){return(0,Z.jsx)(dp,{},`skeleton-${e}`)}function cp(e,t){return t}function lp(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=ap(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=up({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function up({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function dp(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(Ne,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function fp(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(tu,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pp(e){let t=(0,$.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 i;t[3]===n?i=t[4]:(i=X(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ru,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(nu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var mp=`knowledge-base`;function hp(e){let t=(0,$.c)(77),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={kind:`loading`},t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(a??mp),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(`project-root`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(a===void 0?`pick`:`configure`),x=(0,Q.useRef)(!0),S;t[1]!==l||t[2]!==d?(S=l?.find(e=>e.id===d),t[1]=l,t[2]=d,t[3]=S):S=t[3];let C=S,w,T;t[4]!==n||t[5]!==l?(w=()=>{if(!n||l!==null)return;let e=!1;return(async()=>{try{let t=await rp().listPacks();if(e)return;t.ok?u(t.packs):(u([]),c({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;u([]),c({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},T=[n,l],t[4]=n,t[5]=l,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]!==a||t[9]!==n?(E=()=>{n&&(f(a??mp),m(!0),g(`project-root`),v(``),b(a===void 0?`pick`:`configure`),c({kind:`loading`}),x.current=!0)},D=[n,a],t[8]=a,t[9]=n,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O,k;t[12]===C?(O=t[13],k=t[14]):(O=()=>{C&&v(C.defaultSubfolder??``)},k=[C],t[12]=C,t[13]=O,t[14]=k),(0,Q.useEffect)(O,k);let A;t[15]===_?A=t[16]:(A=_.trim(),t[15]=_,t[16]=A);let j=A,M=h===`subfolder`&&j===``,N,P;t[17]!==p||t[18]!==n||t[19]!==l||t[20]!==h||t[21]!==d||t[22]!==y||t[23]!==M||t[24]!==j?(N=()=>{if(!n||y!==`configure`||l===null)return;if(M){c({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=h===`project-root`?void 0:j,t=x.current?0:200;x.current=!1;let r=!1,i=setTimeout(()=>{r||(c(gp),rp().plan({rootDir:e,packId:d,includePersonalTemplates:p}).then(e=>{if(!r){if(!e.ok){c({kind:`error`,message:e.error.message});return}c(e.plan.created.length>0||(e.plan.personalTemplates?.willWrite.length??0)>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||c({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},P=[n,y,l,d,p,h,j,M],t[17]=p,t[18]=n,t[19]=l,t[20]=h,t[21]=d,t[22]=y,t[23]=M,t[24]=j,t[25]=N,t[26]=P):(N=t[25],P=t[26]),(0,Q.useEffect)(N,P);let F;t[27]!==p||t[28]!==r||t[29]!==i||t[30]!==s.kind||t[31]!==s.plan||t[32]!==C?.name||t[33]!==d?(F=async function(){if(s.kind!==`plan`)return;let e=s.plan;c({kind:`applying`,plan:e});let t;try{t=await rp().apply(e,{packId:d,includePersonalTemplates:p})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);eo.error(`Initialize failed: ${r}`),c({kind:`plan`,plan:e});return}if(t.ok){let e=C?.name??`starter pack`,n=t.result.applied,a=t.personalTemplates?.written.length??0,o=n===0&&a>0?`${a} personal template${a===1?``:`s`} written to ~/.ok/templates/`:n===0?`${e} was already set up. Nothing to do.`:a>0?`${e} initialized (${n} ${n===1?`entry`:`entries`}) + ${a} personal template${a===1?``:`s`}`:`${e} initialized (${n} ${n===1?`entry`:`entries`})`;eo.success(o),i?.(),r(!1)}else eo.error(`Initialize failed: ${t.error.message}`),c({kind:`plan`,plan:e})},t[27]=p,t[28]=r,t[29]=i,t[30]=s.kind,t[31]=s.plan,t[32]=C?.name,t[33]=d,t[34]=F):F=t[34];let I=F,L=a!==void 0,R=y===`configure`&&C?`Initialize ${C.name}`:`Initialize a starter pack`,z=y===`configure`&&C?C.description:`Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later.`,B;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(e),b(`configure`),x.current=!0},t[35]=B):B=t[35];let V=B,H;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){b(`pick`),c({kind:`loading`}),x.current=!0},t[36]=H):H=t[36];let U=H,W;t[37]===R?W=t[38]:(W=(0,Z.jsx)(Ha,{children:R}),t[37]=R,t[38]=W);let G;t[39]===z?G=t[40]:(G=(0,Z.jsx)(Ba,{children:z}),t[39]=z,t[40]=G);let K;t[41]!==W||t[42]!==G?(K=(0,Z.jsxs)(Za,{children:[W,G]}),t[41]=W,t[42]=G,t[43]=K):K=t[43];let q;t[44]!==p||t[45]!==l||t[46]!==s||t[47]!==h||t[48]!==C||t[49]!==y||t[50]!==_?(q=y===`pick`?(0,Z.jsx)(Ja,{children:(0,Z.jsx)(op,{packs:l,onPackSelect:V})}):(0,Z.jsxs)(Ja,{className:`space-y-6`,children:[(0,Z.jsx)(_p,{checked:p,onCheckedChange:m}),(0,Z.jsx)(vp,{choice:h,subfolder:_,placeholder:C?.defaultSubfolder??`subfolder`,onChoiceChange:g,onSubfolderChange:v}),(0,Z.jsx)(yp,{phase:s,selectedPack:C})]}),t[44]=p,t[45]=l,t[46]=s,t[47]=h,t[48]=C,t[49]=y,t[50]=_,t[51]=q):q=t[51];let ee;t[52]!==L||t[53]!==y?(ee=y===`configure`&&!L?(0,Z.jsxs)(Y,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:U,children:[(0,Z.jsx)(ii,{"aria-hidden":`true`,className:`h-4 w-4`}),`Back`]}):null,t[52]=L,t[53]=y,t[54]=ee):ee=t[54];let te;t[55]===r?te=t[56]:(te=()=>r(!1),t[55]=r,t[56]=te);let ne=s.kind===`already-seeded`||s.kind===`error`?`Close`:`Cancel`,re;t[57]!==te||t[58]!==ne?(re=(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,onClick:te,children:ne}),t[57]=te,t[58]=ne,t[59]=re):re=t[59];let ie;t[60]!==I||t[61]!==s.kind||t[62]!==y||t[63]!==M?(ie=y===`configure`&&s.kind===`plan`?(0,Z.jsx)(Y,{onClick:I,disabled:M,children:`Initialize`}):y===`configure`&&s.kind===`applying`?(0,Z.jsxs)(Y,{disabled:!0,children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up`]}):null,t[60]=I,t[61]=s.kind,t[62]=y,t[63]=M,t[64]=ie):ie=t[64];let ae;t[65]!==ee||t[66]!==re||t[67]!==ie?(ae=(0,Z.jsxs)(Ya,{children:[ee,re,ie]}),t[65]=ee,t[66]=re,t[67]=ie,t[68]=ae):ae=t[68];let oe;t[69]!==K||t[70]!==q||t[71]!==ae?(oe=(0,Z.jsxs)(Ga,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[K,q,ae]}),t[69]=K,t[70]=q,t[71]=ae,t[72]=oe):oe=t[72];let se;return t[73]!==r||t[74]!==n||t[75]!==oe?(se=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:oe}),t[73]=r,t[74]=n,t[75]=oe,t[76]=se):se=t[76],se}function gp(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function _p(e){let t=(0,$.c)(7),{checked:n,onCheckedChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ma,{children:`Include personal templates`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(fi,{children:[i,(0,Z.jsxs)($i,{className:`text-1sm`,children:[`Adds daily journal, reading log, recipes, and more to `,(0,Z.jsx)(`code`,{children:`~/.ok/templates/`}),`. Idempotent. Never overwrites your edits.`]})]}),t[1]=a):a=t[1];let o;t[2]===r?o=t[3]:(o=e=>r(e===!0),t[2]=r,t[3]=o);let s;return t[4]!==n||t[5]!==o?(s=(0,Z.jsx)(Ca,{htmlFor:`seed-include-personal-templates`,className:`cursor-pointer`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[a,(0,Z.jsx)(ro,{id:`seed-include-personal-templates`,checked:n,onCheckedChange:o})]})}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function vp(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Where should it live?`}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ca,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[(0,Z.jsxs)(fi,{children:[(0,Z.jsx)(ma,{children:`Project root`}),(0,Z.jsx)($i,{className:`text-1sm`,children:`Scaffold the pack's folders directly under this project.`})]}),(0,Z.jsx)(pp,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=l):l=t[3];let u,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ma,{children:`In a subfolder`}),d=(0,Z.jsx)($i,{className:`nth-last-2:mt-0 text-1sm`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=u,t[5]=d):(u=t[4],d=t[5]);let f;t[6]===o?f=t[7]:(f=e=>o(e.target.value),t[6]=o,t[7]=f);let p;t[8]===a?p=t[9]:(p=()=>a(`subfolder`),t[8]=a,t[9]=p);let m;t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(fi,{children:[u,d,(0,Z.jsx)(go,{value:r,onChange:f,onFocus:p,placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=i,t[11]=r,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pp,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=h):h=t[15];let g;t[16]===m?g=t[17]:(g=(0,Z.jsx)(Ca,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[m,h]})}),t[16]=m,t[17]=g);let _;return t[18]!==n||t[19]!==g||t[20]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(fp,{className:`sm:flex`,value:n,onValueChange:c,children:[l,g]})]}),t[18]=n,t[19]=g,t[20]=c,t[21]=_):_=t[21],_}function yp(e){let t=(0,$.c)(12),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan`]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`This pack is already set up here.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The folders and templates are in place; there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let i;t[4]!==n.plan||t[5]!==r?(i=(0,Z.jsx)(Qf,{plan:n.plan,selectedPack:r}),t[4]=n.plan,t[5]=r,t[6]=i):i=t[6];let a;t[7]===n.plan.warnings?a=t[8]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(bp)}):null,t[7]=n.plan.warnings,t[8]=a);let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}function bp(e){return(0,Z.jsx)(`p`,{children:e},e)}var xp=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],Sp=`#settings`;function Cp(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function wp(e){return e.replace(/^#/,``)===`settings`}function Tp(){return typeof window>`u`?``:window.location.hash}function Ep(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(Op),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(wp(Tp()))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=Dp,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Dp(){typeof window>`u`||wp(Tp())&&window.history.back()}function Op(){return wp(Tp())}function kp(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Mp),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(jp);if(!e||!t.ok)return;let i=_n.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(Ap),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Ap(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function jp(){return null}function Mp(){return Np()}function Np(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function Pp(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Fp(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=An(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ip(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Pp(e):Fp()}var Lp=`ok:skill:cowork:installed`,Rp=`1`,zp=250,Bp=`/api/skill/install-state`;function Vp(e){return`${Lp}:v${e}`}var Hp=new Map;async function Up(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Hp.get(n);if(r)return r;let i=Wp(e,t);return Hp.set(n,i),i.finally(()=>{Hp.get(n)===i&&Hp.delete(n)}),i}async function Wp(e,t){let n=e.installer===void 0?Ip():e.installer,r=Gp(e.storage),i=e.fetchSnapshot??qp,a=e.serverTimeoutMs??zp,o=null;if(!t.force){try{o=await Jp(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Vp(o?.currentVersion??e.fallbackSkillVersion??Kp());if(!t.force&&r?.getItem(s)===Rp)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Rp)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Gp(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Kp(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function qp(){let e;try{e=await fetch(Bp,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Jp(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Yp(e){return Up({},e)}function Xp(){return Up({},{force:!0})}async function Zp(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Qp(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Zp({target:`claude-cowork`,url:Dn({mode:`cowork`},e)},n);case`claude-code`:return Zp({target:`claude-code`,url:Dn({mode:`code`},e)},n);case`codex`:return Zp({target:`codex`,url:nn(e)},n);case`cursor`:return Zp({target:`cursor`,url:Qn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function $p(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:em(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:em(e)}}}function em(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function tm(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function nm(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function rm(e){return`${e}.md`}function im(e){if(!e.docName||!e.workspace)return null;let t=rm(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:nm(n,t,r)}}function am(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function om(e){return $p(e.installUrl).then(()=>void 0)}function sm(e){return`Opened in ${e}.`}function cm(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function lm(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function um(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}async function dm(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:t.docContext===null?``:yr(t.docContext)},a=await n.dispatchHandoff(i),o=um(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(sm(s));else{let i=lm(r),a=cm(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{dm(e,t,n,r+1)}}})}return a}function fm(e){return xp.find(t=>t.id===e)?.displayName??e}function pm(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function mm(){return{dispatchHandoff:Qp,recordHandoff:tm,toast:{success:e=>{eo.success(e)},error:(e,t)=>{eo.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>pm(),getDisplayName:fm,ensureCoworkSkillInstalled:Yp}}function hm(){return{dispatch:(e,t)=>dm(e,t,mm()),reinstallCoworkSkill:Xp}}var gm=[...new Set(xp.flatMap(e=>e.schemes))];function _m(e,t){let n=t.now?.()??Date.now(),r={};for(let t of xp){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function vm(e){return _m({},e)}async function ym(e){let t=e.schemes??gm,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var bm=Object.fromEntries(gm.map(e=>[e,{installed:!1}]));async function xm(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return bm}if(!t.ok)return bm;let n;try{n=await t.json()}catch{return bm}if(typeof n!=`object`||!n||Array.isArray(n))return bm;let r=n,i={};for(let e of gm)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Sm(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Cm(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=vm({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=_m(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Sm(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function wm(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Tm(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>ym({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>xm({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Em(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Dm),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Cm(Tm());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return typeof window<`u`&&window.addEventListener(`focus`,i),()=>{typeof window<`u`&&window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Dm(){return vm({isElectronHost:wm(),now:Date.now})}var Om=3e3,km=(e,t,n)=>kc(e,t,n,`CommandPalette`);function Am(e){window.location.assign(or(e))}function jm(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Ar(t)}function Mm(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?_t:Os,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(Nm,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Nm,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(Nm,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(ze,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function Nm(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=vf(n,r).map(Pm),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function Pm(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function Fm({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function Im(e){let t=(0,$.c)(113),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,[o,s]=(0,Q.useState)(``),c=(0,Q.useDeferredValue)(o),l=c.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,m]=(0,Q.useState)(d),[h,_]=(0,Q.useState)(`idle`),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],t[1]=y):y=t[1];let[b,x]=(0,Q.useState)(y),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[2]=S):S=t[2];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(!1),k;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],t[3]=k):k=t[3];let[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(`idle`),P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[4]=P):P=t[4];let[I,L]=(0,Q.useState)(P),[z,V]=(0,Q.useState)(`idle`),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),{activeDocName:K,activeTarget:q}=Je(),{pages:ee,pageTitles:te,pageMeta:ne,folderPaths:re}=Tr(),ie=kp(),{states:ae,refresh:oe}=Em(),{dispatch:se}=hm(),ce=im({docName:K,workspace:ie}),le=df(ee,re,te,ne),ue=nf(C,new Set(le.map(zm))),de=a?.config.projectPath??null,fe=a?b.filter(e=>e.path!==de):[],pe;t[5]!==K||t[6]!==q?(pe=jm(q,K),t[5]=K,t[6]=q,t[7]=pe):pe=t[7];let me=pe,he=l===``?[]:gf(le,l,8),ge,_e;t[8]!==i||t[9]!==r?(ge=()=>{let e=function(e){e.key===`k`&&(Br()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_e=[i,r],t[8]=i,t[9]=r,t[10]=ge,t[11]=_e):(ge=t[10],_e=t[11]),(0,Q.useEffect)(ge,_e);let ve,ye;t[12]!==a||t[13]!==r||t[14]!==oe?(ve=()=>{if(r){if(w($d()),oe(),a){let e=!1;return km(async()=>{let t=await a.project.listRecent();e||x(t)},`Failed to load recent projects.`),()=>{e=!0}}return}s(``),j([]),N(`idle`),U.current=!1,L([]),V(`idle`)},ye=[r,a,oe],t[12]=a,t[13]=r,t[14]=oe,t[15]=ve,t[16]=ye):(ve=t[15],ye=t[16]),(0,Q.useEffect)(ve,ye);let be;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{W.current&&(W.current.scrollTop=0)},t[17]=be):be=t[17];let xe;t[18]===o?xe=t[19]:(xe=[o],t[18]=o,t[19]=xe),(0,Q.useEffect)(be,xe);let Se=Cf(c,new Set(A.map(Rm))),Ce=Se.kind!==`normal`,J,we;t[20]!==Ce||t[21]!==r?(J=()=>{if(!r||!Ce||U.current)return;U.current=!0,N(`loading`);let e=!1;return Tf().then(t=>{e||(j(t),N(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),j([]),N(`error`))}),()=>{e=!0}},we=[r,Ce],t[20]=Ce,t[21]=r,t[22]=J,t[23]=we):(J=t[22],we=t[23]),(0,Q.useEffect)(J,we);let Te=Se.kind===`tag-docs`?Se.tagName:null;(0,Q.useEffect)(()=>{if(!r||Te===null){L([]),V(`idle`);return}V(`loading`),L([]);let e=!1;return Ef(Te).then(t=>{e||(L(t),V(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),L([]),V(`error`))}),()=>{e=!0}},[r,Te]),(0,Q.useEffect)(()=>{if(!r||!l||Ce){m([]),_(`idle`);return}let e=new AbortController;_(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),m([]),_(`error`)},Om);return bf(l,{signal:e.signal}).then(e=>{window.clearTimeout(n),m(e),_(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(m([]),_(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,l,Ce]);let Ee;t[24]===i?Ee=t[25]:(Ee=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),km(async()=>{await e()},n)},t[24]=i,t[25]=Ee);let De=Ee,Oe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=tf($d(),t);ef(n),w(n)},t[26]=Oe):Oe=t[26];let ke=Oe,Ae;t[27]===i?Ae=t[28]:(Ae=function(e){i(!1),ke(e),Am(e.path)},t[27]=i,t[28]=Ae);let je=Ae,Me=!Ce&&l===``&&ue.length>0,Ne=Fm({searchResults:f,fallbackSearchResults:he,searchStatus:h}),Pe=!Ce&&Ne.length>0,Fe=!Ce&&l!==``&&h===`loading`&&!Pe,Ie;t[29]!==c||t[30]!==Ce?(Ie=!Ce&&xf(`New file`,c,[`create file`]),t[29]=c,t[30]=Ce,t[31]=Ie):Ie=t[31];let Le=Ie,Re;t[32]!==c||t[33]!==Ce?(Re=!Ce&&xf(`New folder`,c,[`create folder`]),t[32]=c,t[33]=Ce,t[34]=Re):Re=t[34];let Be=Re,He;t[35]!==K||t[36]!==c||t[37]!==Ce?(He=!Ce&&K!==null&&xf(`Open graph`,c,[`graph panel network`]),t[35]=K,t[36]=c,t[37]=Ce,t[38]=He):He=t[38];let Ue=He,We;t[39]!==c||t[40]!==Ce?(We=!Ce&&xf(`Initialize starter pack`,c,[`scaffold`,`seed`,`pack`,`starter`]),t[39]=c,t[40]=Ce,t[41]=We):We=t[41];let Ge=We,Ke=!Ce&&a!==null&&xf(`Open folder on disk`,c,[`project`]),qe=!Ce&&a!==null&&xf(`Switch Project`,c,[`switch project navigator projects`]),Ye=!Ce&&xf(`Settings`,c,[`preferences config`]),Xe=!Ce&&xf(`Install for Claude Chat & Cowork (Desktop App)`,c,[`claude desktop install cowork`]),Ze=!Ce&&a!==null&&fe.length>0&&(l===``||fe.some(e=>xf(`${e.name} ${e.path}`,c,[`recent project`]))),Qe=!Ce&&ce!==null&&(l===``||xp.some(e=>xf(`Open in ${e.displayName}`,c,[e.id,`agent handoff`]))),$e=Se.kind===`tag-list`?wf(A,Se.query):[],et=Se.kind===`tag-list`&&M!==`loading`&&$e.length===0,tt=Se.kind===`tag-docs`&&z===`success`&&I.length===0,nt=Ce||Me||Pe||Fe||Le||Be||Ue||Ge||Ke||qe||Ye||Xe||Ze||Qe,rt;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(rt=function(e){s(`${Sf}${e}`)},t[42]=rt):rt=t[42];let it=rt,at=g,ot;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ot={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[43]=ot):ot=t[43];let st;t[44]===o?st=t[45]:(st=(0,Z.jsx)(u,{ref:G,value:o,onValueChange:s,placeholder:`Search files, folders, or commands`}),t[44]=o,t[45]=st);let ct;t[46]===Ce?ct=t[47]:(ct=()=>{s(Ce?``:Sf),G.current?.focus()},t[46]=Ce,t[47]=ct);let lt=Ce?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,ut;t[48]===lt?ut=t[49]:(ut=X(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,lt),t[48]=lt,t[49]=ut);let dt,ft;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(p,{className:`size-3.5`}),ft=(0,Z.jsx)(`span`,{children:`By tag`}),t[50]=dt,t[51]=ft):(dt=t[50],ft=t[51]);let pt;t[52]!==Ce||t[53]!==ct||t[54]!==ut?(pt=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:ct,"data-testid":`command-palette-filter-tag`,"data-active":Ce,"aria-pressed":Ce,className:ut,children:[dt,ft]})}),t[52]=Ce,t[53]=ct,t[54]=ut,t[55]=pt):pt=t[55];let mt=F,ht;t[56]!==Pe||t[57]!==Fe?(ht=Fe&&!Pe?(0,Z.jsx)(B,{children:`Searching`}):null,t[56]=Pe,t[57]=Fe,t[58]=ht):ht=t[58];let gt=nt?null:(0,Z.jsx)(B,{children:h===`error`?`Search failed.`:`No matching commands.`}),vt=Se.kind===`tag-list`?(0,Z.jsxs)(Ve,{heading:Se.query?`Tags matching "${Se.query}"`:`All tags`,children:[M===`loading`?(0,Z.jsx)(B,{children:`Loading tags`}):null,M===`error`?(0,Z.jsx)(B,{children:`Failed to load tags. Press Escape and re-open to retry.`}):null,et?(0,Z.jsx)(B,{children:Se.query?`No tags match "${Se.query}".`:"No tags yet — author `#tagname` in any doc to populate the index."}):null,$e.map(e=>(0,Z.jsxs)(ze,{value:`tag ${e.name}`,onSelect:()=>it(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(p,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:[e.count,` `,e.count===1?`doc`:`docs`]})]},`tag:${e.name}`))]}):null,yt;t[59]!==i||t[60]!==Se||t[61]!==tt||t[62]!==I||t[63]!==z?(yt=Se.kind===`tag-docs`?(0,Z.jsxs)(Ve,{heading:`Docs tagged #${Se.tagName}`,children:[z===`loading`?(0,Z.jsx)(B,{children:`Loading docs`}):null,z===`error`?(0,Z.jsx)(B,{children:`Failed to load docs. Press Escape and re-open to retry.`}):null,tt?(0,Z.jsx)(B,{children:`No docs registered under #${Se.tagName}.`}):null,I.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName;return(0,Z.jsxs)(ze,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),Am(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Os,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==Se.tagName)?(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:[`via`,` `,e.matchingTags.filter(e=>e!==Se.tagName).map(Lm).join(`, `)]}):null]})]},`tag-doc:${e.docName}`)})]}):null,t[59]=i,t[60]=Se,t[61]=tt,t[62]=I,t[63]=z,t[64]=yt):yt=t[64];let bt=Me?(0,Z.jsx)(Ve,{heading:`Recently opened`,children:ue.map(e=>(0,Z.jsx)(Mm,{entry:e,onSelect:()=>je(e)},Qd(e.kind,e.path)))}):null,xt;t[65]!==K||t[66]!==i||t[67]!==E||t[68]!==O||t[69]!==Le||t[70]!==Be||t[71]!==Ue||t[72]!==Ge?(xt=Le||Be||Ue||Ge?(0,Z.jsxs)(Ve,{heading:`Commands`,children:[Le?(0,Z.jsxs)(ze,{value:`new file create file`,onSelect:()=>{i(!1),E(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(v,{}),(0,Z.jsx)(`span`,{children:`New file`})]}):null,Be?(0,Z.jsxs)(ze,{value:`new folder create folder`,onSelect:()=>{i(!1),E(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Ms,{}),(0,Z.jsx)(`span`,{children:`New folder`})]}):null,Ue?(0,Z.jsxs)(ze,{value:`open graph graph panel network`,onSelect:()=>{K&&(i(!1),Af(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Ys,{}),(0,Z.jsx)(`span`,{children:`Open graph`})]}):null,Ge?(0,Z.jsxs)(ze,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),O(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Zs,{}),(0,Z.jsx)(`span`,{children:`Initialize starter pack`})]}):null]}):null,t[65]=K,t[66]=i,t[67]=E,t[68]=O,t[69]=Le,t[70]=Be,t[71]=Ue,t[72]=Ge,t[73]=xt):xt=t[73];let St=Qe?(0,Z.jsx)(Ve,{heading:`Open in agent`,children:xp.filter(e=>xf(`Open in ${e.displayName}`,c,[e.id,`agent handoff`])).map(e=>{let t=ae[e.id],n=t.installed===!0&&ce!==null,r=t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(ze,{value:`open in ${e.displayName} ${e.id} agent`,disabled:!n,onSelect:()=>{!n||!ce||(i(!1),se(e.id,ce))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})}):null,Ct=Ke||qe||Ye||Xe||Ze?(0,Z.jsxs)(Ve,{heading:`Project`,children:[Ke&&a?(0,Z.jsxs)(ze,{value:`open folder on disk project`,onSelect:()=>De(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(_t,{}),(0,Z.jsx)(`span`,{children:`Open folder on disk`}),(0,Z.jsx)(R,{children:`⌘O`})]}):null,qe&&a?(0,Z.jsxs)(ze,{value:`switch-project navigator projects`,onSelect:()=>De(()=>a.navigator.open(),`Failed to open Project Navigator.`),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(zs,{}),(0,Z.jsx)(`span`,{children:`Switch Project`}),(0,Z.jsx)(R,{children:`⌘⇧N`})]}):null,Ye?(0,Z.jsxs)(ze,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Sp)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(cc,{}),(0,Z.jsx)(`span`,{children:`Settings`}),(0,Z.jsx)(R,{children:`⌘,`})]}):null,Xe?(0,Z.jsxs)(ze,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(ji,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)`})]}):null,Ze&&a?fe.filter(e=>xf(`${e.name} ${e.path}`,c,[`recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(ze,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>De(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(H,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]})]},e.path)):null]}):null,wt=Pe?(0,Z.jsx)(Ve,{heading:`Search`,children:Ne.map(e=>(0,Z.jsx)(Mm,{entry:e,query:l,onSelect:()=>je(e)},Qd(e.kind,e.path)))}):null,Tt;t[74]!==mt||t[75]!==ht||t[76]!==gt||t[77]!==vt||t[78]!==yt||t[79]!==bt||t[80]!==xt||t[81]!==St||t[82]!==Ct||t[83]!==wt?(Tt=(0,Z.jsxs)(mt,{ref:W,className:`subtle-scrollbar`,children:[ht,gt,vt,yt,bt,xt,St,Ct,wt]}),t[74]=mt,t[75]=ht,t[76]=gt,t[77]=vt,t[78]=yt,t[79]=bt,t[80]=xt,t[81]=St,t[82]=Ct,t[83]=wt,t[84]=Tt):Tt=t[84];let Et;t[85]!==at||t[86]!==i||t[87]!==r||t[88]!==ot||t[89]!==st||t[90]!==pt||t[91]!==Tt?(Et=(0,Z.jsxs)(at,{open:r,onOpenChange:i,title:`Workspace Command Palette`,description:`Search files, folders, and commands for the current workspace.`,className:`sm:max-w-2xl`,commandProps:ot,children:[st,pt,Tt]}),t[85]=at,t[86]=i,t[87]=r,t[88]=ot,t[89]=st,t[90]=pt,t[91]=Tt,t[92]=Et):Et=t[92];let Dt=T===`file`,Ot;t[93]===E?Ot=t[94]:(Ot=e=>{e||E(null)},t[93]=E,t[94]=Ot);let kt;t[95]!==me||t[96]!==Dt||t[97]!==Ot?(kt=(0,Z.jsx)(Hf,{open:Dt,onOpenChange:Ot,kind:`file`,initialDir:me}),t[95]=me,t[96]=Dt,t[97]=Ot,t[98]=kt):kt=t[98];let At=T===`folder`,jt;t[99]===E?jt=t[100]:(jt=e=>{e||E(null)},t[99]=E,t[100]=jt);let Mt;t[101]!==me||t[102]!==At||t[103]!==jt?(Mt=(0,Z.jsx)(Hf,{open:At,onOpenChange:jt,kind:`folder`,initialDir:me}),t[101]=me,t[102]=At,t[103]=jt,t[104]=Mt):Mt=t[104];let Nt;t[105]!==D||t[106]!==O?(Nt=(0,Z.jsx)(hp,{open:D,onOpenChange:O}),t[105]=D,t[106]=O,t[107]=Nt):Nt=t[107];let Pt;return t[108]!==Et||t[109]!==kt||t[110]!==Mt||t[111]!==Nt?(Pt=(0,Z.jsxs)(Z.Fragment,{children:[Et,kt,Mt,Nt]}),t[108]=Et,t[109]=kt,t[110]=Mt,t[111]=Nt,t[112]=Pt):Pt=t[112],Pt}function Lm(e){return`#${e}`}function Rm(e){return e.name}function zm(e){return Qd(e.kind,e.path)}var Bm=500;function Vm(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Hm(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function Um(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=Je(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),Bm);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=Vm(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Hm(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function Wm(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(An(e)??`Server error: ${t.status} ${t.statusText}`)}return(await t.json()).docs??[]}function Gm(){let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),Wm(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Ge,e),()=>document.removeEventListener(Ge,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(or(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m=(0,Z.jsx)(Za,{children:(0,Z.jsxs)(Ha,{children:[`Documents tagged `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,p]})]})}),e[4]=p,e[5]=m);let h=r??``,g;e[6]!==o||e[7]!==h?(g=(0,Z.jsx)(Ja,{children:(0,Z.jsx)(Km,{fetchState:o,tag:h,onSelectDoc:f})}),e[6]=o,e[7]=h,e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==g?(_=(0,Z.jsxs)(Ga,{children:[m,g]}),e[9]=m,e[10]=g,e[11]=_):_=e[11];let v;return e[12]!==t||e[13]!==_?(v=(0,Z.jsx)(Qa,{open:t,onOpenChange:n,children:_}),e[12]=t,e[13]=_,e[14]=v):v=e[14],v}function Km(e){let t=(0,$.c)(12),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:`Loading`}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:[`Only the current document uses `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,r]}),`.`]}),t[3]=r,t[4]=e),e}let a;if(t[5]!==n.docs||t[6]!==i){let e;t[8]===i?e=t[9]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(qm)}):null]})},e.docName)},t[8]=i,t[9]=e),a=n.docs.map(e),t[5]=n.docs,t[6]=i,t[7]=a}else a=t[7];let o;return t[10]===a?o=t[11]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[10]=a,t[11]=o),o}function qm(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var Jm=`raw-mdx-nav`,Ym=`ok-editor-mode-v1`,Xm=[`wysiwyg`,`source`],Zm=`wysiwyg`;function Qm(e){return Xm.includes(e)}function $m(e=localStorage){try{let t=e.getItem(Ym);if(t===null)return Zm;if(Qm(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Zm}function eh(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Qm(n)?n:$m(t)}function th(e,t=localStorage){try{return t.setItem(Ym,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function nh(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eh),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),th(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function rh(e){let t=(0,$.c)(21),{open:n,onResolved:r}=e,i=Si(),a;t[0]!==r||t[1]!==i?(a=function(e){if(i===null){eo.error(`Sync settings not yet loaded — try again in a moment`);return}let t=i(e);if(!t.ok){eo.error(`Could not ${e?`enable sync`:`save sync preference`}: ${t.error}`);return}r()},t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ei,{})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ja,{children:(0,Z.jsx)(va,{})}),t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=()=>o(!1),t[5]=o,t[6]=l);let u=i===null,d;t[7]!==l||t[8]!==u?(d=(0,Z.jsx)(Y,{variant:`ghost`,className:`uppercase font-mono`,onClick:l,disabled:u,children:`Keep disabled`}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]===o?f=t[11]:(f=()=>o(!0),t[10]=o,t[11]=f);let p=i===null,m;t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(Y,{onClick:f,disabled:p,children:`Enable auto-sync`}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(Ga,{className:`sm:max-w-lg`,showCloseButton:!1,children:[s,c,(0,Z.jsxs)(Ya,{children:[d,m]})]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==n||t[19]!==h?(g=(0,Z.jsx)(Qa,{open:n,onOpenChange:ih,children:h}),t[18]=n,t[19]=h,t[20]=g):g=t[20],g}function ih(){}function ah(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=Hi();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(gn,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var oh=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function sh(e,t,n,r,i,a){if(e==r)return[];let o=_h(e,t,n,r,i,a),s=vh(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new oh(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new oh(t,t+o,i,i),new oh(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new oh(t,t,i,i+o),new oh(n,n,i+o+c,a)]}if(c==1||l==1)return[new oh(t,n,i,a)];let u=bh(e,t,n,r,i,a);if(u){let[o,s,c]=u;return sh(e,t,o,r,i,s).concat(sh(e,o+c,n,r,s+c,a))}return dh(e,t,n,r,i,a)}var ch=1e9,lh=0,uh=!1;function dh(e,t,n,r,i,a){let o=n-t,s=a-i;if(ch<1e9&&Math.min(o,s)>ch*16||lh>0&&Date.now()>lh)return Math.min(o,s)>ch*64?[new oh(t,n,i,a)]:xh(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);ph.reset(c),mh.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:mh,f=d?null:ph;for(let p=0;p<c;p++){if(p>ch||lh>0&&!(p&63)&&Date.now()>lh)return xh(e,t,n,r,i,a);let m=ph.advance(p,o,s,c,d,!1,l)||mh.advance(p,o,s,c,f,!0,u);if(m)return hh(e,t,n,t+m[0],r,i,a,i+m[1])}return[new oh(t,n,i,a)]}var fh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},ph=new fh,mh=new fh;function hh(e,t,n,r,i,a,o,s){let c=!1;return!Ih(e,r)&&++r==n&&(c=!0),!Ih(i,s)&&++s==o&&(c=!0),c?[new oh(t,n,a,o)]:sh(e,t,r,i,a,s).concat(sh(e,r,n,i,s,o))}function gh(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function _h(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=gh(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Ih(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function vh(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=gh(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Ih(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function yh(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Ih(e,s)||s++;let u=s+o;if(Ih(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=_h(e,u,n,r,i+f+d.length,a),c=vh(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function bh(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=bh(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:yh(e,t,n,r,i,a,Math.floor(o/4),-1)}function xh(e,t,n,r,i,a){uh=!0;let o=n-t,s=a-i,c;if(o<s){let s=yh(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=yh(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new oh(t,n,i,a)];let[l,u,d]=c;return sh(e,t,l,r,i,u).concat(sh(e,l+d,n,r,u+d,a))}function Sh(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new oh(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Ch(e,t,n){for(;;){Sh(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=_h(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new oh(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=vh(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new oh(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new oh(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new oh(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function wh(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=jh(t,a.fromA,l),f=Ah(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new oh(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Ah(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new oh(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=jh(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new oh(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Nh(n,a.fromB,a.toB),r,o=t<0?-1:Mh(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Nh(t,a.fromA,a.toA),r,o=n<0?-1:Mh(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return Sh(e,3),e}var Th;try{Th=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Eh(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Dh(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Eh(n):Th?!Ph(n)||t==e.length-1?+!!Th.test(String.fromCharCode(n)):Th.test(e.slice(t,t+2))?2:0:0}function Oh(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Eh(n):Th?!Fh(n)||t==1?+!!Th.test(String.fromCharCode(n)):Th.test(e.slice(t-2,t))?2:0:0}var kh=8;function Ah(e,t,n){if(t==e.length||!Oh(e,t))return t;for(let r=t,i=t+n,a=0;a<kh;a++){let t=Dh(e,r);if(!t||r+t>i)return r;r+=t}return t}function jh(e,t,n){if(!t||!Dh(e,t))return t;for(let r=t,i=t-n,a=0;a<kh;a++){let t=Oh(e,r);if(!t||r-t<i)return r;r-=t}return t}function Mh(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Nh(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Ph=e=>e>=55296&&e<=56319,Fh=e=>e>=56320&&e<=57343;function Ih(e,t){return!t||t==e.length||!Ph(e.charCodeAt(t-1))||!Fh(e.charCodeAt(t))}function Lh(e,t,n){let r=n?.override;return r?r(e,t):(ch=(n?.scanLimit??1e9)>>1,lh=n?.timeout?Date.now()+n.timeout:0,uh=!1,Ch(e,t,sh(e,0,e.length,t,0,t.length)))}function Rh(){return!uh}function zh(e,t,n){return wh(Lh(e,t,n),e,t)}var Bh=ko.define({combine:e=>e[0]}),Vh=Ao.define(),Hh=ko.define(),Uh=wo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Vh)&&(e=n.value);for(let n of t.state.facet(Hh))e=n(e,t);return e}});function Wh(e){let t=e.field(Uh,!1);if(!t)return null;let n=e.facet(Bh);return{chunks:t,side:n?n.side:null}}var Gh=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Jh(zh(e.toString(),t.toString(),n),e,t,0,0,Rh())}static updateA(e,t,n,r,i){return Qh(Zh(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Qh(Zh(e,r,!1,t.length),e,t,n,i)}};function Kh(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function qh(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Jh(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Kh(c.fromA+r,c.fromB+i,t,n),[d,f]=qh(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Kh(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=qh(a.toA+r,a.toB+i,t,n),s++}o.push(new Gh(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Yh=1e3;function Xh(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Zh(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Yh&&([l,d]=Xh(e,a-Yh,n,!0)),o<t.length-Yh&&([u,f]=Xh(e,o+Yh,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function Qh(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=zh(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Jh(h,n,r,d,f,Rh()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var $h={scanLimit:500},eg=jo.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=ug(e))}update(e){(e.docChanged||e.viewportChanged||ng(e.startState,e.state)||rg(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=ug(e.view))}},{decorations:e=>e.deco}),tg=xo.low(Fo({class:`cm-changeGutter`,markers:e=>e.plugin(eg)?.gutter||Lo.empty}));function ng(e,t){return e.field(Uh,!1)!=t.field(Uh,!1)}function rg(e,t){return e.facet(Bh)!=t.facet(Bh)}var ig=Do.line({class:`cm-changedLine`}),ag=Do.mark({class:`cm-changedText`}),og=Do.mark({tagName:`ins`,class:`cm-insertedLine`}),sg=Do.mark({tagName:`del`,class:`cm-deletedLine`}),cg=new class extends Po{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function lg(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,ig),i.add(o,s,n?sg:og),a&&a.add(o,o,cg);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,ig),a&&a.add(u,u,cg);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,ag),s<t)c++;else break}u=t}}}function ug(e){let t=e.state.field(Uh),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Bh),o=n==`a`,s=new Oo,c=i?new Oo:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&lg(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var dg=class extends bo{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},fg=Ao.define({map:(e,t)=>e.map(t)}),pg=wo.define({create:()=>Do.none,update:(e,t)=>{for(let e of t.effects)if(e.is(fg))return e.value;return e.map(t.changes)},provide:e=>No.decorations.from(e)}),mg=.01;function hg(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function gg(e,t,n){let r=new Oo,i=new Oo,a=e.state.field(pg).iter(),o=t.state.field(pg).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-mg?(l-=n,r.add(s,s,Do.widget({widget:new dg(-n),block:!0,side:-1}))):n>mg&&(u+=n,i.add(c,c,Do.widget({widget:new dg(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<mg?r.add(e.state.doc.length,e.state.doc.length,Do.widget({widget:new dg(-p),block:!0,side:1})):p>mg&&i.add(t.state.doc.length,t.state.doc.length,Do.widget({widget:new dg(p),block:!0,side:1}));let m=r.finish(),h=i.finish();hg(m,e.state.field(pg))||e.dispatch({effects:fg.of(m)}),hg(h,t.state.field(pg))||t.dispatch({effects:fg.of(h)})}var _g=Ao.define({map:(e,t)=>t.mapPos(e)}),vg=class extends bo{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:_g.of(n)});let{side:r,sibling:i}=e.state.facet(Bh);i&&i().dispatch({effects:_g.of(yg(n,e.state.field(Uh),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function yg(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var bg=wo.define({create(e){return Do.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(_g)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>No.decorations.from(e)});function xg({margin:e=3,minSize:t=4}){return bg.init(n=>Sg(n,e,t))}function Sg(e,t,n){let r=new Oo,i=e.facet(Bh).side==`a`,a=e.field(Uh),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,Do.replace({widget:new vg(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Cg=No.styleModule.of(new Io({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),wg=No.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),Tg=new Mo,Eg=new Mo,Dg=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||$h;let t=[xo.low(eg),wg,Cg,pg,No.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(fg)))&&this.measure()})],n=[Bh.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(tg);let r=Co.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],No.editorAttributes.of({class:`cm-merge-a`}),Eg.of(n),t]}),i=[Bh.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(tg);let a=Co.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],No.editorAttributes.of({class:`cm-merge-b`}),Eg.of(i),t]});this.chunks=Gh.build(r.doc,a.doc,this.diffConf);let o=[Uh.init(()=>this.chunks),Tg.of(e.collapseUnchanged?xg(e.collapseUnchanged):[])];r=r.update({effects:Ao.appendConfig.of(o)}).state,a=a.update({effects:Ao.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new No({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new No({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),So.empty(e[0].startState.doc.length));this.chunks=t==this.a?Gh.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Gh.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Vh.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Vh.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(Bh),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Eg.reconfigure([Bh.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?tg:[]])),a.push(Eg.reconfigure([Bh.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?tg:[]]))}if(r){let t=Tg.reconfigure(e.collapseUnchanged?xg(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){gg(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=Og(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=Og(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function Og(e){let t=e.nextSibling;return e.remove(),t}var kg=new class extends Po{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Ag=xo.low(Fo({class:`cm-changeGutter`,markers:e=>e.plugin(eg)?.gutter||Lo.empty,widgetMarker:(e,t)=>t instanceof Fg?kg:null}));function jg(e){let t=typeof e.original==`string`?Eo.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||$h;return[xo.low(eg),Bg,wg,No.editorAttributes.of({class:`cm-merge-b`}),Hh.of((e,t)=>{let r=t.effects.find(e=>e.is(Mg));return r&&(e=Gh.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Gh.updateB(e,t.state.field(Ng),t.newDoc,t.changes,n)),e}),Bh.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Kg:void 0,side:`b`}),Ng.init(()=>t),e.gutter===!1?[]:Ag,e.collapseUnchanged?xg(e.collapseUnchanged):[],Uh.init(e=>Gh.build(t,e.doc,n))]}var Mg=Ao.define(),Ng=wo.define({create:()=>Eo.empty,update(e,t){for(let n of t.effects)n.is(Mg)&&(e=n.value.doc);return e}}),Pg=new WeakMap,Fg=class extends bo{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function Ig(e,t,n){let r=Pg.get(t.changes);if(r)return r;let i=Do.widget({block:!0,side:-1,widget:new Fg(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Bh),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),Lg(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Rg(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(Ng).sliceString(t.fromA,t.endA),u=a&&e.facet(Ro),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
13
|
+
`);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function Bc(e){return{start(t){return e.localOp.clone.start(t)}}}var Vc=`ContextMenu`,[Hc,Uc]=Wr(Vc,[Ii]),Wc=Ii(),[Gc,Kc]=Hc(Vc),qc=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Wc(t),l=Vr(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Gc,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ki,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};qc.displayName=Vc;var Jc=`ContextMenuTrigger`,Yc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Kc(Jc,n),o=Wc(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ha,{...o,virtualRef:c}),(0,Z.jsx)(qr.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Yr(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Yr(e.onPointerDown,wl(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Yr(e.onPointerMove,wl(u)),onPointerCancel:r?e.onPointerCancel:Yr(e.onPointerCancel,wl(u)),onPointerUp:r?e.onPointerUp:Yr(e.onPointerUp,wl(u))})]})});Yc.displayName=Jc;var Xc=`ContextMenuPortal`,Zc=e=>{let{__scopeContextMenu:t,...n}=e,r=Wc(t);return(0,Z.jsx)(pa,{...r,...n})};Zc.displayName=Xc;var Qc=`ContextMenuContent`,$c=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kc(Qc,n),a=Wc(n),o=Q.useRef(!1);return(0,Z.jsx)(da,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});$c.displayName=Qc;var el=`ContextMenuGroup`,tl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(wa,{...i,...r,ref:t})});tl.displayName=el;var nl=`ContextMenuLabel`,rl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(_a,{...i,...r,ref:t})});rl.displayName=nl;var il=`ContextMenuItem`,al=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Qi,{...i,...r,ref:t})});al.displayName=il;var ol=`ContextMenuCheckboxItem`,sl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Zi,{...i,...r,ref:t})});sl.displayName=ol;var cl=`ContextMenuRadioGroup`,ll=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(aa,{...i,...r,ref:t})});ll.displayName=cl;var ul=`ContextMenuRadioItem`,dl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(ra,{...i,...r,ref:t})});dl.displayName=ul;var fl=`ContextMenuItemIndicator`,pl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(ta,{...i,...r,ref:t})});pl.displayName=fl;var ml=`ContextMenuSeparator`,hl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Ea,{...i,...r,ref:t})});hl.displayName=ml;var gl=`ContextMenuArrow`,_l=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(xa,{...i,...r,ref:t})});_l.displayName=gl;var vl=`ContextMenuSub`,yl=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Wc(t),[s,c]=Ur({prop:i,defaultProp:a??!1,onChange:r,caller:vl});return(0,Z.jsx)(Ma,{...o,open:s,onOpenChange:c,children:n})};yl.displayName=vl;var bl=`ContextMenuSubTrigger`,xl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Aa,{...i,...r,ref:t})});xl.displayName=bl;var Sl=`ContextMenuSubContent`,Cl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Wc(n);return(0,Z.jsx)(Xi,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Cl.displayName=Sl;function wl(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Tl=qc,El=Yc,Dl=Zc,Ol=$c,kl=al,Al=hl,jl=`Radio`,[Ml,Nl]=Wr(jl),[Pl,Fl]=Ml(jl),Il=Q.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=Q.useState(null),p=Zr(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(Pl,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(qr.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Vl(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:Yr(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Bl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});Il.displayName=jl;var Ll=`RadioIndicator`,Rl=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=Fl(Ll,n);return(0,Z.jsx)(Jr,{present:r||a.checked,children:(0,Z.jsx)(qr.span,{"data-state":Vl(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Rl.displayName=Ll;var zl=`RadioBubbleInput`,Bl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Zr(o,a),c=Ra(n),l=to(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Z.jsx)(qr.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Bl.displayName=zl;function Vl(e){return e?`checked`:`unchecked`}var Hl=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ul=`RadioGroup`,[Wl,Gl]=Wr(Ul,[ao,Nl]),Kl=ao(),ql=Nl(),[Jl,Yl]=Wl(Ul),Xl=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,p=Kl(n),m=On(l),[h,g]=Ur({prop:a,defaultProp:i??null,onChange:d,caller:Ul});return(0,Z.jsx)(Jl,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(oo,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(qr.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Xl.displayName=Ul;var Zl=`RadioGroupItem`,Ql=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Yl(Zl,n),o=a.disabled||r,s=Kl(n),c=ql(n),l=Q.useRef(null),u=Zr(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Hl.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,Z.jsx)(co,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(Il,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:Yr(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:Yr(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ql.displayName=Zl;var $l=`RadioGroupIndicator`,eu=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Rl,{...ql(n),...r,ref:t})});eu.displayName=$l;var tu=Xl,nu=Ql,ru=eu;async function iu(e){try{await navigator.clipboard.writeText(e)}catch{}}var au=120*1e3;function ou(e){let t=(0,$.c)(26),{onSuccess:n,onCancel:r,transport:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`https://github.com/login/device`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(au),_=(0,Q.useRef)(null),v=(0,Q.useRef)(null),y;t[0]!==n||t[1]!==i?(y=async function(){f(null),m(!0);try{let e=i.start();_.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,a=await t.next();for(;!a.done;){let e=a.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),g(e.expires_in*1e3),iu(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){r=!0,m(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,f(e.message),m(!1);break}a=await t.next()}r||(f(`Sign-in stream ended without confirmation — please try again`),m(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(`Connection error — try again`),m(!1)}},t[0]=n,t[1]=i,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=()=>{let e=!1;return queueMicrotask(()=>{e||b()}),()=>{e=!0,_.current?.(),_.current=null,v.current&&clearInterval(v.current)}},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[5]=S):S=t[5],(0,Q.useEffect)(x,S);let C,w;t[6]===a?(C=t[7],w=t[8]):(C=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=au-(Date.now()-e);t<=0?(g(0),v.current&&clearInterval(v.current),f(`Code expired — please try again`)):g(t)},1e3),()=>{v.current&&clearInterval(v.current)}},w=[a],t[6]=a,t[7]=C,t[8]=w),(0,Q.useEffect)(C,w);let T=Math.floor(h/6e4),E=Math.floor(h%6e4/1e3),D;t[9]===E?D=t[10]:(D=E.toString().padStart(2,`0`),t[9]=E,t[10]=D);let O=`${T}:${D}`,k;t[11]!==l||t[12]!==d||t[13]!==O||t[14]!==a||t[15]!==s?(k=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Open`,` `,(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>gi(e,s),onAuxClick:e=>gi(e,s),className:`underline underline-offset-2`,children:s}),` `,`and enter this code:`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`flex-1 text-center text-2xl font-mono font-bold tracking-widest border rounded-md py-3 bg-muted`,children:a}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void iu(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),children:l?`Copied!`:`Copy`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),`Waiting for authorization`]}),(0,Z.jsxs)(`span`,{children:[`Expires in `,O]})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:`Starting sign-in flow`}),t[11]=l,t[12]=d,t[13]=O,t[14]=a,t[15]=s,t[16]=k):k=t[16];let A;t[17]===d?A=t[18]:(A=d&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),t[17]=d,t[18]=A);let j;t[19]!==r||t[20]!==p?(j=p&&(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),t[19]=r,t[20]=p,t[21]=j):j=t[21];let M;return t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25],M}function su(e){let t=(0,$.c)(32),{onSuccess:n,onCancel:r}=e,[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{u.current?.abort()},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]!==n||t[3]!==i?(p=async function(){if(!i.trim()){l(`Paste a personal access token`);return}u.current?.abort();let e=new AbortController;u.current=e,s(!0),l(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:i.trim()}),signal:e.signal});if(!t.ok){let e=`Invalid token — check that it has repo scope`;try{let n=await t.json(),r=Sn.safeParse(n);r.success&&(e=r.data.title)}catch{}l(e),s(!1);return}if(!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await Fc(t.body,e=>{let t;try{t=JSON.parse(e)}catch{return`continue`}return t.type===`complete`?(n({login:t.login,name:t.name,email:t.email}),s(!1),`terminal`):`continue`})||l(`No response — try again`)}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&l(`Connection error — try again`)}s(!1)},t[2]=n,t[3]=i,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:lu,onAuxClick:cu,className:`underline underline-offset-2`,children:`github.com/settings/tokens`}),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Create a token at`,` `,h,` `,`with `,(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`repo`}),` scope.`]}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),t[7]=_):_=t[7];let v;t[8]===m?v=t[9]:(v=e=>{e.key===`Enter`&&m()},t[8]=m,t[9]=v);let y;t[10]!==o||t[11]!==i||t[12]!==v?(y=(0,Z.jsx)(go,{type:`password`,"aria-label":`Personal access token`,placeholder:`ghp_…`,value:i,onChange:_,disabled:o,onKeyDown:v}),t[10]=o,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]===c?b=t[15]:(b=c&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),t[14]=c,t[15]=b);let x;t[16]===m?x=t[17]:(x=()=>void m(),t[16]=m,t[17]=x);let S=o?`Validating`:`Add token`,C;t[18]!==o||t[19]!==x||t[20]!==S?(C=(0,Z.jsx)(Y,{className:`flex-1`,onClick:x,disabled:o,children:S}),t[18]=o,t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==o||t[23]!==r?(w=(0,Z.jsx)(Y,{variant:`ghost`,onClick:r,disabled:o,children:`Cancel`}),t[22]=o,t[23]=r,t[24]=w):w=t[24];let T;t[25]!==C||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==y||t[30]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,y,b,T]}),t[28]=T,t[29]=y,t[30]=b,t[31]=E):E=t[31],E}function cu(e){return gi(e,`https://github.com/settings/tokens`)}function lu(e){return gi(e,`https://github.com/settings/tokens`)}function uu(e){let t=(0,$.c)(27),{login:n,onSave:r,onSkip:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Before syncing, set your identity for git commits:`}),t[0]=l):l=t[0];let u=`Name (e.g. ${n})`,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[1]=d):d=t[1];let f;t[2]!==a||t[3]!==u?(f=(0,Z.jsx)(go,{"aria-label":`Name`,placeholder:u,value:a,onChange:d}),t[2]=a,t[3]=u,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>c(e.target.value),t[5]=p):p=t[5];let m;t[6]===s?m=t[7]:(m=(0,Z.jsx)(go,{type:`email`,"aria-label":`Email`,placeholder:`Email`,value:s,onChange:p}),t[6]=s,t[7]=m);let h;t[8]!==s||t[9]!==a||t[10]!==r?(h=()=>r(a.trim(),s.trim()),t[8]=s,t[9]=a,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==a?(g=!a.trim()||!s.trim(),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(Y,{className:`flex-1`,onClick:h,disabled:g,children:`Save`}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===i?v=t[19]:(v=(0,Z.jsx)(Y,{variant:`ghost`,onClick:i,children:`Skip`}),t[18]=i,t[19]=v);let y;t[20]!==v||t[21]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[_,v]}),t[20]=v,t[21]=_,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==f||t[25]!==m?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f,m,y]}),t[23]=y,t[24]=f,t[25]=m,t[26]=b):b=t[26],b}function du(e){let t=(0,$.c)(42),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,c;t[0]===s?c=t[1]:(c=s??Lc(),t[0]=s,t[1]=c);let l=c,[u,d]=(0,Q.useState)(`device`),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(null),g,_;t[2]===n?(g=t[3],_=t[4]):(g=()=>{n&&(d(`device`),p(`auth`),h(null))},_=[n],t[2]=n,t[3]=g,t[4]=_),(0,Q.useEffect)(g,_);let v;t[5]!==a||t[6]!==r||t[7]!==i?(v=function(e){h(e),a&&(!e.name||!e.email)?p(`identity`):(p(`done`),i?.(e),r(!1),eo.success(`Signed in as @${e.login}`))},t[5]=a,t[6]=r,t[7]=i,t[8]=v):v=t[8];let y=v,b;t[9]!==m||t[10]!==r||t[11]!==i?(b=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(fu);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),eo.success(`Signed in as @${n.login}`)},t[9]=m,t[10]=r,t[11]=i,t[12]=b):b=t[12];let x=b,S;t[13]!==m||t[14]!==r||t[15]!==i?(S=function(){m&&(p(`done`),i?.(m),r(!1),eo.success(`Signed in as @${m.login}`))},t[13]=m,t[14]=r,t[15]=i,t[16]=S):S=t[16];let C=S,w;t[17]===r?w=t[18]:(w=function(){r(!1)},t[17]=r,t[18]=w);let T=w,E=o?`Re-authenticate with GitHub`:`Sign in to GitHub`,D;t[19]===E?D=t[20]:(D=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ha,{children:E})}),t[19]=E,t[20]=D);let O;t[21]!==y||t[22]!==T||t[23]!==l||t[24]!==f||t[25]!==u?(O=f===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1 border-b pb-2 mb-1`,children:[(0,Z.jsx)(Y,{variant:u===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`device`),children:`GitHub App`}),(0,Z.jsx)(Y,{variant:u===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`pat`),children:`Token`})]}),u===`device`?(0,Z.jsx)(ou,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(su,{onSuccess:y,onCancel:T})]}),t[21]=y,t[22]=T,t[23]=l,t[24]=f,t[25]=u,t[26]=O):O=t[26];let k;t[27]!==m||t[28]!==x||t[29]!==C||t[30]!==f?(k=f===`identity`&&m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as @`,m.login]}),(0,Z.jsx)(uu,{login:m.login,onSave:x,onSkip:C})]}),t[27]=m,t[28]=x,t[29]=C,t[30]=f,t[31]=k):k=t[31];let A;t[32]!==k||t[33]!==O?(A=(0,Z.jsxs)(Ja,{children:[O,k]}),t[32]=k,t[33]=O,t[34]=A):A=t[34];let j;t[35]!==A||t[36]!==D?(j=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,children:[D,A]}),t[35]=A,t[36]=D,t[37]=j):j=t[37];let M;return t[38]!==r||t[39]!==n||t[40]!==j?(M=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function fu(){}function pu(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=Tc();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(Qe,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function mu(e){switch(e){case`receiving`:return`Receiving objects`;case`resolving`:return`Resolving deltas`;case`checking`:return`Checking out files`;case`init`:return`Initializing project`;case`done`:return`Complete`;default:return`Cloning`}}function hu(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function gu(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c}=e,l;t[0]===o?l=t[1]:(l=o??zc(),t[0]=o,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s??Nc(),t[2]=s,t[3]=d);let f=d,p=c!==void 0,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;t[4]!==n||t[5]!==f?(A=()=>{if(!n)return;let e=!1;return f.status().then(t=>{e||T(t.authenticated)}).catch(()=>{e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=f,t[6]=A):A=t[6];let j;t[7]===n?j=t[8]:(j=[n],t[7]=n,t[8]=j),(0,Q.useEffect)(A,j);let M;t[9]!==w||t[10]!==n||t[11]!==f?(M=()=>{if(!w||!n)return;let e=!1;return x(!0),f.repos().then(t=>{e||(y(t.ok?t.repos:[]),x(!1))}).catch(()=>{e||(y([]),x(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=f,t[12]=M):M=t[12];let N;t[13]!==w||t[14]!==n?(N=[w,n],t[13]=w,t[14]=n,t[15]=N):N=t[15],(0,Q.useEffect)(M,N);let P;t[16]===p?P=t[17]:(P=function(e){if(h(e),p)return;let t=hu(e);t&&_(`~/Documents/${t}`)},t[16]=p,t[17]=P);let F=P,I;t[18]===p?I=t[19]:(I=function(e){if(h(e.clone_url),p)return;let t=e.full_name.split(`/`)[1];_(`~/Documents/${t}`)},t[18]=p,t[19]=I);let L=I,R;t[20]!==g||t[21]!==a||t[22]!==r||t[23]!==c||t[24]!==u||t[25]!==m?(R=async function(){let e=m.trim();if(!e){eo.error(`Enter a repository URL or owner/repo`);return}let t=g||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=hu(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=eo.loading(`Starting clone`,{duration:1/0});k.current=n;let i=u.start({url:e,dir:t});O.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`)eo.loading(`${mu(i.phase)} — ${i.pct}%`,{id:n});else if(i.type===`complete`){eo.success(`Clone complete — opening project`,{id:n}),r(!1),D(!1),O.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){eo.error(`Clone failed: ${i.message}`,{id:n}),D(!1),O.current=null;return}t=await e.next()}eo.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:n}),D(!1),O.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),eo.error(`Clone failed — connection error`,{id:n}),D(!1),O.current=null}},t[20]=g,t[21]=a,t[22]=r,t[23]=c,t[24]=u,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){O.current?.(),O.current=null,D(!1),eo.dismiss(k.current??void 0)},t[27]=B):B=t[27];let V=B,H;t[28]!==E||t[29]!==r||t[30]!==p?(H=function(e){E||(r(e),e||(h(``),p||_(``),C(``)))},t[28]=E,t[29]=r,t[30]=p,t[31]=H):H=t[31];let U=H,W,G,K,q,ee,te,ne,re,ie,ae;if(t[32]!==E||t[33]!==U||t[34]!==L||t[35]!==F||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==S||t[40]!==v||t[41]!==m){let e=v?.filter(e=>e.full_name.toLowerCase().includes(S.toLowerCase()));K=Qa,ie=n,ae=U,G=Ga,ne=`sm:max-w-lg`,t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ha,{children:`Clone from GitHub`})}),t[52]=re):re=t[52],W=Ja,q=`flex flex-col gap-4`;let r;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`label`,{htmlFor:`clone-url`,className:`text-sm font-medium`,children:`Repository URL or owner/repo`}),t[53]=r):r=t[53];let i;t[54]===F?i=t[55]:(i=e=>F(e.target.value),t[54]=F,t[55]=i),t[56]!==E||t[57]!==i||t[58]!==m?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(go,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:m,onChange:i,disabled:E})]}),t[56]=E,t[57]=i,t[58]=m,t[59]=ee):ee=t[59],te=w&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`repo-filter`,className:`text-sm font-medium`,children:`Your repositories`}),(0,Z.jsx)(go,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories`,value:S,onChange:e=>C(e.target.value),disabled:E||b&&v===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":b&&v===null,children:b&&v===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(Ji,{className:`h-4 w-2/3`}),(0,Z.jsx)(Ji,{className:`h-4 w-1/2`}),(0,Z.jsx)(Ji,{className:`h-4 w-3/4`}),(0,Z.jsx)(Ji,{className:`h-4 w-2/5`}),(0,Z.jsx)(Ji,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v?.length===0?`No repositories found.`:`No matches.`}):e?.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-muted flex items-center gap-2 truncate disabled:opacity-50`,onClick:()=>L(e),disabled:E,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[32]=E,t[33]=U,t[34]=L,t[35]=F,t[36]=w,t[37]=b,t[38]=n,t[39]=S,t[40]=v,t[41]=m,t[42]=W,t[43]=G,t[44]=K,t[45]=q,t[46]=ee,t[47]=te,t[48]=ne,t[49]=re,t[50]=ie,t[51]=ae}else W=t[42],G=t[43],K=t[44],q=t[45],ee=t[46],te=t[47],ne=t[48],re=t[49],ie=t[50],ae=t[51];let oe;t[60]!==E||t[61]!==w||t[62]!==i?(oe=!w&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:`Browse your repos:`}),(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:`Sign in to GitHub`})]}),t[60]=E,t[61]=w,t[62]=i,t[63]=oe):oe=t[63];let se;t[64]!==E||t[65]!==g||t[66]!==p?(se=!p&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),(0,Z.jsx)(go,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:g,onChange:e=>_(e.target.value),disabled:E})]}),t[64]=E,t[65]=g,t[66]=p,t[67]=se):se=t[67];let ce;t[68]!==q||t[69]!==ee||t[70]!==te||t[71]!==oe||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{className:q,children:[ee,te,oe,se]}),t[68]=q,t[69]=ee,t[70]=te,t[71]=oe,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==W||t[75]!==ce?(le=(0,Z.jsx)(W,{children:ce}),t[74]=W,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==E||t[78]!==z||t[79]!==U||t[80]!==m||t[81]!==p?(ue=(0,Z.jsx)(Ya,{children:E?(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:V,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>U(!1),children:`Cancel`}),(0,Z.jsx)(Y,{onClick:()=>void z(),disabled:!m.trim(),"aria-describedby":p?`clone-picker-hint`:void 0,children:`Clone`}),p&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:`Opens a folder picker to choose where to clone the repository.`})]})}),t[77]=E,t[78]=z,t[79]=U,t[80]=m,t[81]=p,t[82]=ue):ue=t[82];let de;t[83]!==G||t[84]!==ne||t[85]!==re||t[86]!==le||t[87]!==ue?(de=(0,Z.jsxs)(G,{className:ne,children:[re,le,ue]}),t[83]=G,t[84]=ne,t[85]=re,t[86]=le,t[87]=ue,t[88]=de):de=t[88];let fe;return t[89]!==K||t[90]!==ie||t[91]!==ae||t[92]!==de?(fe=(0,Z.jsx)(K,{open:ie,onOpenChange:ae,children:de}),t[89]=K,t[90]=ie,t[91]=ae,t[92]=de,t[93]=fe):fe=t[93],fe}var _u=(0,Q.lazy)(()=>r(()=>import(`./ConsentDialogBody-BpM_eICS.js`),__vite__mapDeps([5,1,6,7,8,9,10,11]),import.meta.url));function vu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(yo.subscribe,bu,yu))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(_u,{})}),e[0]=t):t=e[0],t}function yu(){return!1}function bu(){return yo.getSnapshot()!==null}var xu=180,Su=5e3;function Cu(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function wu(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function Tu(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function Eu(e){let t=e instanceof Error?e.message:String(e);for(let e of Gn)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function Du(e){switch(e.reason){case`nested-project`:return`A project already exists at this location. Pick a different parent folder.`;case`target-not-empty`:return`A non-empty folder with this name already exists. Use a different name.`;case`invalid-args`:return`Invalid input — please check the name and try again.`;case`mkdir-failed`:return`Could not create the project folder. Try a different name or location.`;case`git-init-failed`:return`Project folder created, but git init failed. Try again.`;case`init-failed`:return`Could not write project files. Try a different location.`;case`discovery-failed`:return`Could not finalize project setup. Try again.`;case`unknown`:return`Could not create project. Try again or pick a different location.`}}function Ou(e){let t=(0,$.c)(123),{open:n,onOpenChange:r,bridge:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(Pu),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={kind:`idle`},t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b={kind:`idle`},t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),[C,w]=(0,Q.useState)(0),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=new Set,t[2]=T):T=t[2];let E=(0,Q.useRef)(T),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)(0),j,M;t[3]!==i||t[4]!==n?(j=()=>{if(!n)return;E.current.clear(),y(null),h({kind:`idle`}),_(!1),o(``),f(new Set(Pn)),S({kind:`idle`}),A.current+=1;let e=!1;u(!0),i.fs.defaultProjectsRoot().then(t=>{e||c(t)}).catch(Nu).finally(()=>{e||u(!1)});let t=requestAnimationFrame(()=>{k.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},M=[n,i],t[3]=i,t[4]=n,t[5]=j,t[6]=M):(j=t[5],M=t[6]),(0,Q.useEffect)(j,M);let N;t[7]!==i||t[8]!==a||t[9]!==n||t[10]!==s?(N=()=>{if(!n)return;O.current!==null&&clearTimeout(O.current),D.current!==null&&D.current.abort();let e=zn(a);if(s===``||e===``){h({kind:`idle`});return}let t=Cu(s,e);h({kind:`pending`});let r=new AbortController;return D.current=r,O.current=setTimeout(()=>{Promise.all([i.fs.findEnclosingProjectRoot(s),i.fs.findEnclosingGitRoot(s),i.fs.folderState(t)]).then(t=>{let[n,i,a]=t;r.signal.aborted||h(Tu({parent:s,sanitizedName:e,enclosingProject:n,enclosingGit:i,targetState:a}))}).catch(e=>{r.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),h({kind:`free`}))})},xu),()=>{O.current!==null&&clearTimeout(O.current),r.abort()}},t[7]=i,t[8]=a,t[9]=n,t[10]=s,t[11]=N):N=t[11];let P;t[12]!==i||t[13]!==a||t[14]!==n||t[15]!==s||t[16]!==C?(P=[n,a,s,i,C],t[12]=i,t[13]=a,t[14]=n,t[15]=s,t[16]=C,t[17]=P):P=t[17],(0,Q.useEffect)(N,P);let F,I;t[18]===n?(F=t[19],I=t[20]):(F=()=>{if(!n)return;let e=()=>w(Mu);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},I=[n],t[18]=n,t[19]=F,t[20]=I),(0,Q.useEffect)(F,I);let L,R;t[21]!==m.kind||t[22]!==n?(L=()=>{if(!n||m.kind!==`confirm-git`)return;let e=setInterval(()=>{w(ju)},Su);return()=>clearInterval(e)},R=[n,m.kind],t[21]=m.kind,t[22]=n,t[23]=L,t[24]=R):(L=t[23],R=t[24]),(0,Q.useEffect)(L,R);let z;t[25]!==m.gitRoot||t[26]!==m.kind||t[27]!==x.gitRoot||t[28]!==x.kind?(z=()=>{if(m.kind!==`confirm-git`){x.kind!==`idle`&&(A.current+=1,S({kind:`idle`}));return}x.kind===`confirming`&&x.gitRoot!==m.gitRoot&&S({kind:`idle`}),x.kind===`pending`&&x.gitRoot!==m.gitRoot&&(A.current+=1,S({kind:`idle`}))},t[25]=m.gitRoot,t[26]=m.kind,t[27]=x.gitRoot,t[28]=x.kind,t[29]=z):z=t[29];let B;t[30]!==m||t[31]!==x?(B=[m,x],t[30]=m,t[31]=x,t[32]=B):B=t[32],(0,Q.useEffect)(z,B);let V;t[33]!==i||t[34]!==m.kind||t[35]!==n?(V=()=>{if(!n)return;let e=null;m.kind===`block-nested`?e=`nested`:m.kind===`block-nonempty`?e=`nonempty`:m.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(E.current.has(e)||(E.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Au)))},t[33]=i,t[34]=m.kind,t[35]=n,t[36]=V):V=t[36];let H;t[37]!==i||t[38]!==m||t[39]!==n?(H=[n,m,i],t[37]=i,t[38]=m,t[39]=n,t[40]=H):H=t[40],(0,Q.useEffect)(V,H);let U,W;t[41]!==a||t[42]!==s?(U=zn(a),W=U===``||s===``?``:Cu(s,U),t[41]=a,t[42]=s,t[43]=U,t[44]=W):(U=t[43],W=t[44]);let G=W,K=G===``?s:G,q=!g&&U!==``&&s!==``&&(m.kind===`free`||m.kind===`confirm-git`),ee;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[45]=ee):ee=t[45];let te=ee,ne;t[46]===i?ne=t[47]:(ne=async function(){try{let e=await i.dialog.openFolder();if(e===null)return;c(e)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[46]=i,t[47]=ne);let re=ne,ie;t[48]!==i||t[49]!==q||t[50]!==d||t[51]!==r||t[52]!==s||t[53]!==U?(ie=async function(e){if(e.preventDefault(),q){_(!0),y(null);try{await i.project.createNew({parent:s,name:U,editors:Array.from(d)}),r(!1)}catch(e){y(Eu(e)),_(!1)}}},t[48]=i,t[49]=q,t[50]=d,t[51]=r,t[52]=s,t[53]=U,t[54]=ie):ie=t[54];let ae=ie,oe;t[55]!==g||t[56]!==r?(oe=function(e){g||r(e)},t[55]=g,t[56]=r,t[57]=oe):oe=t[57];let se=oe,ce;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ce=async function(e){S({kind:`confirming`,gitRoot:e})},t[58]=ce):ce=t[58];let le=ce,ue;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ue=async function(){S({kind:`idle`})},t[59]=ue):ue=t[59];let de=ue,fe;t[60]===i?fe=t[61]:(fe=async function(e){let t=A.current+1;A.current=t,S({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),A.current!==t)return;w(ku),S({kind:`idle`})}catch(e){let n=e;if(A.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),S({kind:`error`,message:r})}},t[60]=i,t[61]=fe);let pe=fe,me;t[62]!==i||t[63]!==r?(me=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[62]=i,t[63]=r,t[64]=me):me=t[64];let he=me,ge;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ha,{children:`Create new project`}),(0,Z.jsx)(Ba,{children:`Make a new folder for a brand-new Open Knowledge project.`})]}),t[65]=ge):ge=t[65];let _e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(uo,{htmlFor:`create-name`,className:`block`,children:`Name`}),t[66]=_e):_e=t[66];let ve;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{o(e.target.value),y(null)},t[67]=ve):ve=t[67];let ye;t[68]!==g||t[69]!==a?(ye=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[_e,(0,Z.jsx)(go,{id:`create-name`,ref:k,value:a,onChange:ve,disabled:g,placeholder:`My Notes`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`create-target-caption`,"data-testid":`create-name`})]}),t[68]=g,t[69]=a,t[70]=ye):ye=t[70];let be;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(uo,{htmlFor:`create-location`,className:`block`,children:`Location`}),t[71]=be):be=t[71];let xe=g||l,Se;t[72]===re?Se=t[73]:(Se=()=>void re(),t[72]=re,t[73]=Se);let Ce;t[74]!==xe||t[75]!==Se?(Ce=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(Y,{id:`create-location`,type:`button`,variant:`outline`,disabled:xe,onClick:Se,"data-testid":`create-browse`,children:`Browse`})}),t[74]=xe,t[75]=Se,t[76]=Ce):Ce=t[76];let J;t[77]===K?J=t[78]:(J=K===``?(0,Z.jsx)(`span`,{className:`sr-only`,children:`No target path yet`}):K,t[77]=K,t[78]=J);let we;t[79]===J?we=t[80]:(we=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-xs text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:J}),t[79]=J,t[80]=we);let Te;t[81]!==Ce||t[82]!==we?(Te=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[be,Ce,we]}),t[81]=Ce,t[82]=we,t[83]=Te):Te=t[83];let Ee;t[84]!==m||t[85]!==pe||t[86]!==he||t[87]!==x?(Ee=(0,Z.jsx)(Fu,{cascade:m,onOpenNested:he,removeGitState:x,onRequestRemoveGit:le,onCancelRemoveGit:de,onConfirmRemoveGit:pe}),t[84]=m,t[85]=pe,t[86]=he,t[87]=x,t[88]=Ee):Ee=t[88];let De,Oe;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Connect AI editors`}),Oe=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All editors are checked by default — uncheck the ones you don't use.`}),t[89]=De,t[90]=Oe):(De=t[89],Oe=t[90]);let ke;t[91]!==g||t[92]!==d?(ke=Pn.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(uo,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(ro,{id:t,checked:d.has(e),onCheckedChange:()=>te(e),disabled:g,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:gr[e]})]},e)}),t[91]=g,t[92]=d,t[93]=ke):ke=t[93];let Ae;t[94]===ke?Ae=t[95]:(Ae=(0,Z.jsxs)(`fieldset`,{className:`space-y-2 pb-2`,children:[De,Oe,ke]}),t[94]=ke,t[95]=Ae);let je;t[96]===v?je=t[97]:(je=v===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:Du(v)}),t[96]=v,t[97]=je);let Me;t[98]!==ye||t[99]!==Te||t[100]!==Ee||t[101]!==Ae||t[102]!==je?(Me=(0,Z.jsxs)(Ja,{className:`space-y-4`,children:[ye,Te,Ee,Ae,je]}),t[98]=ye,t[99]=Te,t[100]=Ee,t[101]=Ae,t[102]=je,t[103]=Me):Me=t[103];let Ne;t[104]===r?Ne=t[105]:(Ne=()=>r(!1),t[104]=r,t[105]=Ne);let Pe;t[106]!==g||t[107]!==Ne?(Pe=(0,Z.jsx)(Y,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Ne,disabled:g,"data-testid":`create-cancel`,children:`Cancel`}),t[106]=g,t[107]=Ne,t[108]=Pe):Pe=t[108];let Fe=!q,Ie=g?`Creating`:`Create`,Le;t[109]!==Fe||t[110]!==Ie?(Le=(0,Z.jsx)(Y,{type:`submit`,disabled:Fe,"data-testid":`create-submit`,children:Ie}),t[109]=Fe,t[110]=Ie,t[111]=Le):Le=t[111];let Re;t[112]!==Pe||t[113]!==Le?(Re=(0,Z.jsxs)(Ya,{children:[Pe,Le]}),t[112]=Pe,t[113]=Le,t[114]=Re):Re=t[114];let ze;t[115]!==ae||t[116]!==Me||t[117]!==Re?(ze=(0,Z.jsxs)(Ga,{className:`sm:max-w-lg motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,"data-testid":`create-project-dialog`,children:[ge,(0,Z.jsxs)(`form`,{onSubmit:ae,"data-testid":`create-project-form`,className:`flex min-h-0 flex-1 flex-col`,children:[Me,Re]})]}),t[115]=ae,t[116]=Me,t[117]=Re,t[118]=ze):ze=t[118];let Be;return t[119]!==se||t[120]!==n||t[121]!==ze?(Be=(0,Z.jsx)(Qa,{open:n,onOpenChange:se,children:ze}),t[119]=se,t[120]=n,t[121]=ze,t[122]=Be):Be=t[122],Be}function ku(e){return e+1}function Au(){}function ju(e){return e+1}function Mu(e){return e+1}function Nu(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Pu(){return new Set(Pn)}function Fu(e){let t=(0,$.c)(33),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`pending`||n.kind===`free`)return null;if(n.kind===`block-nested`){let e;t[0]===n.rootPath?e=t[1]:(e=wu(n.rootPath),t[0]=n.rootPath,t[1]=e);let i=e,a;t[2]===n.rootPath?a=t[3]:(a=(0,Z.jsxs)(`p`,{className:`mb-2`,children:[`Can't nest projects. An Open Knowledge project already exists at`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:n.rootPath}),`. Choose a location outside it, or open that project instead.`]}),t[2]=n.rootPath,t[3]=a);let o;t[4]!==n.rootPath||t[5]!==r?(o=()=>r(n.rootPath),t[4]=n.rootPath,t[5]=r,t[6]=o):o=t[6];let s;t[7]!==i||t[8]!==o?(s=(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:o,"data-testid":`create-banner-nested-open`,children:[`Open `,i]}),t[7]=i,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[13]!==e){let n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[15]=n):n=t[15],r=e.replace(n,``),t[13]=e,t[14]=r}else r=t[14];let c=`${r}/.git`,l;t[16]===e?l=t[17]:(l=(0,Z.jsx)(`code`,{children:e}),t[16]=e,t[17]=l);let u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`code`,{children:`.git`}),t[18]=u):u=t[18];let d;t[19]===l?d=t[20]:(d=(0,Z.jsxs)(`p`,{children:[`Open Knowledge will be initialized at `,l,` — the parent of your new folder, because it contains a `,u,` folder (one project per git repo).`]}),t[19]=l,t[20]=d);let f;t[21]!==e||t[22]!==o||t[23]!==s||t[24]!==a||t[25]!==i.kind||t[26]!==i.message||t[27]!==c?(f=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:[`Remove the parent `,(0,Z.jsx)(`code`,{children:`.git`}),` folder`]}),i.kind===`error`?(0,Z.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:[`Couldn't remove `,(0,Z.jsx)(`code`,{children:c}),`: `,i.message]}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsxs)(`p`,{className:`text-xs`,children:[`This will permanently delete`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:c}),`. All git history in that folder is lost; the working files stay in place. Only confirm if the parent git repository is unintended. If the parent is intentionally a git repository (you cloned it on purpose), cancel and pick a location outside it instead.`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?`Removing…`:`Delete ${c}`}),(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:`Cancel`})]})]}),t[21]=e,t[22]=o,t[23]=s,t[24]=a,t[25]=i.kind,t[26]=i.message,t[27]=c,t[28]=f):f=t[28];let p;return t[29]!==d||t[30]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[d,f]}),t[29]=d,t[30]=f,t[31]=p):p=t[31],p}let c;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-nonempty`,children:(0,Z.jsx)(`p`,{children:`A non-empty folder with this name already exists. Use "Open folder on disk" instead.`})}),t[32]=c):c=t[32],c}function Iu(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function Lu(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Open Knowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`Open Knowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Ru=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-BDYRADff.js`),__vite__mapDeps([12,1,6,7,13,14,15,8,16]),import.meta.url));function zu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(no.subscribe,Vu,Bu))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Ru,{})}),e[0]=t):t=e[0],t}function Bu(){return!1}function Vu(){return no.getSnapshot()!==null}var Hu=(e,t,n)=>Oc(e,t,n,`NavigatorApp`);function Uu(e,t){return e.filter(e=>e.path!==t)}function Wu(e){let t=(0,$.c)(77),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=typeof window<`u`&&window.okDesktop!=null,[y,b]=(0,Q.useState)(`auth`),{channel:x}=Tc(),{theme:S}=Ln();Oa(n,S??`system`);let C;t[1]===n.project?C=t[2]:(C=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>Hu(e,t,l),t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[6]=D):D=t[6];let O=D,k;t[7]===n?k=t[8]:(k=()=>E(async()=>{let e=await n.dialog.openFolder();e&&await qu(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=k);let A=k,j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>p(!0),t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=e=>E(async()=>{await qu(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=N);let P=N,F;t[12]===n.project?F=t[13]:(F=e=>E(async()=>{await n.project.removeRecent(e),a(t=>Uu(t,e))},`Failed to remove project.`),t[12]=n.project,t[13]=F);let I=F,L;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${v?`[-webkit-app-region:drag]`:``}`,"data-testid":`nav-chrome-row`}),t[14]=L):L=t[14];let R;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Lu,{className:`size-12 shrink-0`}),t[15]=R):R=t[15];let z;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),(0,Z.jsx)(pu,{})]}),t[16]=z):z=t[16];let B;t[17]===n.appVersion?B=t[18]:(B=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]}),t[17]=n.appVersion,t[18]=B);let V;t[19]===x?V=t[20]:(V=x!==null&&(0,Z.jsx)(Qe,{variant:`gray`,className:`text-2xs font-mono`,children:x===`beta`?`Beta`:`Stable`}),t[19]=x,t[20]=V);let H;t[21]!==B||t[22]!==V?(H=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[R,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[z,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[B,V]})]})]}),t[21]=B,t[22]=V,t[23]=H):H=t[23];let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Gu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:O,dataTestId:`nav-clone`,Icon:Iu}),t[24]=U):U=t[24];let W;t[25]===A?W=t[26]:(W=(0,Z.jsx)(Gu,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:A,dataTestId:`nav-open`,Icon:_t}),t[25]=A,t[26]=W);let G;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Gu,{title:`Create new project`,description:`Make a new folder for a brand-new project.`,onClick:M,dataTestId:`nav-create-new`,Icon:Ri}),t[27]=G):G=t[27];let K;t[28]===W?K=t[29]:(K=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[U,W,G]}),t[28]=W,t[29]=K);let q;t[30]===c?q=t[31]:(q=c===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[30]=c,t[31]=q);let ee;t[32]!==o||t[33]!==P||t[34]!==I||t[35]!==i?(ee=o?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(Ne,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:`Recent`}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(Ku,{project:e,onOpen:()=>P(e.path),onRemove:()=>I(e.path)},e.path))})]}):null,t[32]=o,t[33]=P,t[34]=I,t[35]=i,t[36]=ee):ee=t[36];let te;t[37]!==H||t[38]!==K||t[39]!==q||t[40]!==ee?(te=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-6`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[H,K,q,ee]})}),t[37]=H,t[38]=K,t[39]=q,t[40]=ee,t[41]=te):te=t[41];let ne,re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(zu,{}),re=(0,Z.jsx)(vu,{}),t[42]=ne,t[43]=re):(ne=t[42],re=t[43]);let ie;t[44]!==n||t[45]!==f?(ie=(0,Z.jsx)(Ou,{open:f,onOpenChange:p,bridge:n}),t[44]=n,t[45]=f,t[46]=ie):ie=t[46];let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{h(e),e||_(!1)},t[47]=ae):ae=t[47];let oe;t[48]===n?oe=t[49]:(oe=Rc(n),t[48]=n,t[49]=oe);let se=y===`identity`,ce;t[50]===g?ce=t[51]:(ce=()=>{h(!1),g&&(_(!1),d(!0))},t[50]=g,t[51]=ce);let le;t[52]!==m||t[53]!==oe||t[54]!==se||t[55]!==ce?(le=(0,Z.jsx)(du,{open:m,onOpenChange:ae,transport:oe,identityPrompt:se,onSuccess:ce}),t[52]=m,t[53]=oe,t[54]=se,t[55]=ce,t[56]=le):le=t[56];let ue;t[57]===n?ue=t[58]:(ue=Bc(n),t[57]=n,t[58]=ue);let de;t[59]===n?de=t[60]:(de=Pc(n),t[59]=n,t[60]=de);let fe;t[61]===n.dialog?fe=t[62]:(fe=()=>n.dialog.openFolder(),t[61]=n.dialog,t[62]=fe);let pe;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1),b(`auth`),_(!0),h(!0)},t[63]=pe):pe=t[63];let me;t[64]===n?me=t[65]:(me=e=>{let{dir:t}=e;E(()=>qu(n,t,`pick-existing`),`Failed to open cloned project.`)},t[64]=n,t[65]=me);let he;t[66]!==u||t[67]!==ue||t[68]!==de||t[69]!==fe||t[70]!==me?(he=(0,Z.jsx)(gu,{open:u,onOpenChange:d,transport:ue,authQueryTransport:de,pickParentFolder:fe,onSignIn:pe,onCloneComplete:me}),t[66]=u,t[67]=ue,t[68]=de,t[69]=fe,t[70]=me,t[71]=he):he=t[71];let ge;return t[72]!==te||t[73]!==ie||t[74]!==le||t[75]!==he?(ge=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[L,te,ne,re,ie,le,he]}),t[72]=te,t[73]=ie,t[74]=le,t[75]=he,t[76]=ge):ge=t[76],ge}function Gu(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Ku(e){let t=(0,$.c)(25),{project:n,onOpen:r,onRemove:i}=e,a=n.missing,o=n.missing&&`opacity-50`,s;t[0]===o?s=t[1]:(s=X(`flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md py-3.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed`,o),t[0]=o,t[1]=s);let c;t[2]===n.name?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=c);let l;t[4]===n.path?l=t[5]:(l=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.missing?d=t[10]:(d=n.missing?(0,Z.jsx)(Qe,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[9]=n.missing,t[10]=d);let f;t[11]!==r||t[12]!==n.missing||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,disabled:a,className:s,children:[u,d]}),t[11]=r,t[12]=n.missing,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16];let p=`Remove ${n.name} from recent projects`,m=`nav-recent-remove-${n.path}`,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(za,{"aria-hidden":`true`}),t[17]=h):h=t[17];let g;t[18]!==i||t[19]!==m||t[20]!==p?(g=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":p,title:`Remove from recent projects`,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":m,children:h}),t[18]=i,t[19]=m,t[20]=p,t[21]=g):g=t[21];let _;return t[22]!==g||t[23]!==f?(_=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[f,g]}),t[22]=g,t[23]=f,t[24]=_):_=t[24],_}async function qu(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var Ju=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Ln(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Cr,{className:`size-4`}),info:(0,Z.jsx)(St,{className:`size-4`}),warning:(0,Z.jsx)(gn,{className:`size-4`}),error:(0,Z.jsx)(Xs,{className:`size-4`}),loading:(0,Z.jsx)(Ne,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(Va,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c};function Yu(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(Xu(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function Xu(e,t){return e.startsWith(`/api/`)?t+e:e}function Zu(e){return`#/${encodeURIComponent(e)}`}function Qu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(Zu(e.doc))})}var $u=4e3,ed=1440*60*1e3;function td(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){eo.success(`Opened existing OK project at ${e.ancestorPath}`,{duration:$u});return}if(e.kind===`mcp-repaired`){let t=e.editors.map(e=>gr[e]??e).join(`, `);eo.success(`Repaired ${t} MCP integration. Restart ${t} if already open.`,{duration:ed});return}if(e.kind===`mcp-repair-failed`){eo.error(`MCP auto-repair failed — open Settings → AI Tool Integration to fix.`,{duration:ed});return}let t=vo(e.gitRoot,e.pickedPath)??e.pickedPath;eo.success(`Initialized OK at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:$u})})}var nd=!1;function rd(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Ie(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function id(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var ad=0,od=0,sd=0,cd=0,ld=null,ud=[`linkResolutionDecoration$`],dd=new WeakSet,fd=new WeakSet;function pd(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function md(){return!1}function hd(){return!md()}function gd(e,t){if(hd())return t;let n=`ok/cold/nodeview-factory-${pd(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ie(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function _d(e){if(hd())return;let t=e.state.plugins;for(let e of t){if(fd.has(e))continue;let t=e.spec?.key?.key;if(!t||!ud.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){fd.add(e);continue}let i=`ok/cold/decoration-${pd(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ie(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},fd.add(e)}}function vd(e){if(hd())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=gd(e,n);r.__okWrapped=!0,t[e]=r}}function yd(e){return hd()?e:e.map(e=>{let t=e.name??`unknown`,n=pd(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ie(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function bd(){if(!nd){nd=!0,rd(Yn.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return hd()||(ld=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:id(i.editorState),durationMs:r}}),rd(Yn.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!hd()&&!dd.has(e)&&t.view&&(_d(t.view),vd(t.view),dd.add(e)),{docSize:id(t.editorState)}}),rd(Yn.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{cd+=1;let i=e;return!hd()&&i.view&&vd(i.view),{docSize:id(i.view),seq:cd,durationMs:r}}),rd(sn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(od+=1,{seq:od,docSize:id(e.state),durationMs:r})),rd(sn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(sd+=1,{seq:sd,docSize:id(e.state),durationMs:r})),rd(M.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{ad+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:ad,topLevelYElements:a,durationMs:r}}),rd(we.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Ie(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!hd()&&e===`first-paint`&&ld!==null)){let e=ld,n=Math.max(0,t.startTime-e);Ie(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),ld=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var xd=`Relaunch`,Sd=`Release notes`,Cd=`Updates paused`,wd=`Download`,Td=`Reset to defaults`,Ed=`Relaunch failed — please restart manually`,Dd=`Recovery action failed — please try again`;function Od(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function kd(e){return`Version ${e} ready to install`}function Ad(e){return`Updated to Version ${e}`}function jd(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Md=0,Nd=0,Pd=1,Fd=2,Id=3;function Ld(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:kd(r),priority:Fd,action:{label:xd,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:Od(Ed,e),variant:`error`,priority:Pd})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:Ad(n),priority:Id,action:{label:Sd,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:Cd,priority:Nd,action:{label:wd,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function Rd(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Od(Dd,e),variant:`error`,priority:Md})};n({id:i,body:jd(t.currentBuild),priority:Md,action:{label:Td,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var zd=[],Bd=new Set,Vd=!1;function Hd(){for(let e of Bd)e()}function Ud(e){let t=zd.findIndex(t=>t.id===e.id);if(t===-1)zd=[...zd,e];else{let n=zd.slice();n[t]=e,zd=n}Hd()}function Wd(e){let t=zd.filter(t=>t.id!==e);t.length!==zd.length&&(zd=t,Hd())}function Gd(){return zd}function Kd(e){return Bd.add(e),()=>{Bd.delete(e)}}function qd(){if(Vd||typeof window>`u`)return;let e=window.okDesktop;e&&(Vd=!0,Ld(e,Ud,Wd),e.state.query().then(t=>{t.schemaIncompatibility&&Rd(e,t.schemaIncompatibility,Ud,Wd)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Jd=`ok-omnibar-recents-v1`,Yd=10;function Xd(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function Zd(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Qd(e,t){return`${e}:${t}`}function $d(e){let t=Zd(e);if(!t)return[];try{let e=t.getItem(Jd);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Xd).slice(0,Yd):[]}catch{return[]}}function ef(e,t){let n=Zd(t);if(n)try{n.setItem(Jd,JSON.stringify(e.slice(0,Yd)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function tf(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Yd)}function nf(e,t){return e.filter(e=>t.has(Qd(e.kind,e.path)))}var rf=50,af=30,of=``,sf=null;function cf(e){return e.trim().toLowerCase()}function lf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function uf(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function df(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:sr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:sr(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function ff(e){return Zn({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function pf(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:kr(e.map(ff))}}function mf(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function hf(e){let t=mf(e);return sf&&of===t?sf:(of=t,sf=pf(e),sf)}function gf(e,t,n=rf){return _f(hf(e),t,n)}function _f(e,t,n=rf){let r=cf(t);return r?En(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function vf(e,t){let n=uf(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(lf).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function yf(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=sr(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function bf(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??af}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(An(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(yf).filter(e=>!!e)}function xf(e,t,n=[]){let r=cf(t);return r?cf([e,...n].join(` `)).includes(r):!0}var Sf=`tag:`;function Cf(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function wf(e,t){return S(e,t)}var Tf=U;async function Ef(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var Df=`open-knowledge:doc-panel-tab`,Of=null;function kf(){let e=Of;return Of=null,e}function Af(e,t=typeof window>`u`?new EventTarget:window){Of=e,t.dispatchEvent(new CustomEvent(Df,{detail:{tab:e}}))}function jf(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(Df,n),()=>t.removeEventListener(Df,n)}var Mf=[`.md`,`.mdx`];function Nf(e){let t=e.toLowerCase();for(let e of Mf)if(t.endsWith(e))return e;return null}function Pf(e){let t=Nf(e);return t?e.slice(0,-t.length):e}var Ff=`__blank__`,If={local:0,inherited:1,user:2};function Lf(e){return[...e].sort((e,t)=>{let n=If[e.scope]-If[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function Rf(e){return e.trim()?e.includes(`..`)?`Path cannot contain ".."`:e.startsWith(`/`)?`Path cannot start with "/"`:e.includes(`\\`)?`Path cannot contain backslashes`:e.includes(`\0`)?`Path cannot contain null bytes`:null:`Name cannot be empty`}function zf(e){let t=e.fileName.trim(),n=Nf(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function Bf(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function Vf(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Hf(e){let t=(0,$.c)(120),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{addPage:d}=Tr(),f=oa(u?null:a),p=u??f,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`.md`),[b,x]=(0,Q.useState)(Ff),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=(0,Q.useId)(),k=(0,Q.useId)(),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),[N,P]=(0,Q.useState)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(null),L,R;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(L=()=>{if(n){C(null),D(null),T(!1),_(``),x(i===`file`&&s?s:Ff),P(!1);let e=i===`file`?o??`untitled`:`index`,t=Nf(e);y(t??`.md`),h(t?Pf(e):e)}},R=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=L,t[5]=R):(L=t[4],R=t[5]),(0,Q.useEffect)(L,R);let z;t[6]!==p.state.data||t[7]!==p.state.status?(z=p.state.status===`ready`?Lf(p.state.data.folder.templates_available??[]):[],t[6]=p.state.data,t[7]=p.state.status,t[8]=z):z=t[8];let B=z,V;t[9]!==p.state.data||t[10]!==p.state.status||t[11]!==n||t[12]!==b?(V=()=>{n&&b!==Ff&&p.state.status===`ready`&&((p.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(Ff))},t[9]=p.state.data,t[10]=p.state.status,t[11]=n,t[12]=b,t[13]=V):V=t[13];let H;t[14]!==p.state||t[15]!==n||t[16]!==b?(H=[n,b,p.state],t[14]=p.state,t[15]=n,t[16]=b,t[17]=H):H=t[17],(0,Q.useEffect)(V,H);let U=i===`file`,W=p.state.status===`loading`||p.state.status===`idle`,G=p.state.status===`error`?p.state.message:null,K;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){let t=Nf(e);t?(y(t),h(Pf(e))):h(e),C(null)},t[18]=K):K=t[18];let q=K,ee;t[19]!==v||t[20]!==m||t[21]!==g||t[22]!==a||t[23]!==i?(ee=function(){return zf({kind:i,initialDir:a,fileName:m,fileExtension:v,folderName:g})},t[19]=v,t[20]=m,t[21]=g,t[22]=a,t[23]=i,t[24]=ee):ee=t[24];let te=ee,ne;t[25]!==m||t[26]!==g||t[27]!==i?(ne=function(){if(i===`folder`){let e=Rf(g.trim());if(e)return{message:`Folder name: ${e}`,field:`folder`}}let e=Rf(m.trim());return e?{message:e,field:`file`}:null},t[25]=m,t[26]=g,t[27]=i,t[28]=ne):ne=t[28];let re=ne,ie;t[29]!==w||t[30]!==m||t[31]!==g||t[32]!==i?(ie=w||!m.trim()||i===`folder`&&!g.trim(),t[29]=w,t[30]=m,t[31]=g,t[32]=i,t[33]=ie):ie=t[33];let ae=ie,oe;t[34]!==d||t[35]!==te||t[36]!==re||t[37]!==i||t[38]!==l||t[39]!==r||t[40]!==b?(oe=async function(){let e=re();if(e){C(e.message),D(e.field);return}T(!0),C(null),D(null);let t=te(),n=i===`file`&&b!==Ff?b:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=await xt(e,`Server error (HTTP ${e.status})`);if(!t.ok){T(!1),C(t.title),D(`form`);return}let n=mr.safeParse(t.body);if(T(!1),!n.success){C(`Failed to create ${i}`),D(`form`);return}let o=n.data.docName;r(!1),window.location.hash=`#/${o}`,d(o),er([`files`,`backlinks`,`graph`]),l?.(o)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),T(!1),C(`Network error — please try again`),D(`form`)}},t[34]=d,t[35]=te,t[36]=re,t[37]=i,t[38]=l,t[39]=r,t[40]=b,t[41]=oe):oe=t[41];let se=oe,ce=a||`(root)`,le=i===`file`?`New file`:`New folder`,ue;t[42]===le?ue=t[43]:(ue=(0,Z.jsx)(Ha,{children:le}),t[42]=le,t[43]=ue);let de;t[44]!==c||t[45]!==ce?(de=c??(0,Z.jsxs)(Z.Fragment,{children:[`Create in `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:ce})]}),t[44]=c,t[45]=ce,t[46]=de):de=t[46];let fe;t[47]===de?fe=t[48]:(fe=(0,Z.jsx)(Ba,{children:de}),t[47]=de,t[48]=fe);let pe;t[49]!==ue||t[50]!==fe?(pe=(0,Z.jsxs)(Za,{children:[ue,fe]}),t[49]=ue,t[50]=fe,t[51]=pe):pe=t[51];let me;t[52]!==b||t[53]!==U||t[54]!==j||t[55]!==N||t[56]!==M||t[57]!==B||t[58]!==G||t[59]!==W?(me=U&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:j,className:`mb-1.5 block text-sm font-medium`,children:`Start from`}),G?(0,Z.jsxs)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:[`Could not load templates: `,G,`. You can still create a blank note.`]}):null,(0,Z.jsx)(Gf,{triggerId:M,labelledById:j,open:N,onOpenChange:P,value:b,onValueChange:x,templates:B,loading:W}),!W&&!G&&B.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`No templates resolve here. Add one in this folder's Templates section, or in Settings → User templates.`}):null]}),t[52]=b,t[53]=U,t[54]=j,t[55]=N,t[56]=M,t[57]=B,t[58]=G,t[59]=W,t[60]=me):me=t[60];let he;t[61]!==S||t[62]!==E||t[63]!==O||t[64]!==k||t[65]!==g||t[66]!==i?(he=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:k,children:`Folder name`}),(0,Z.jsx)(go,{ref:I,id:k,value:g,onChange:e=>{_(e.target.value),C(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":S&&(E===`folder`||E===`form`)?O:void 0,"aria-invalid":S&&(E===`folder`||E===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Rf(g.trim());if(t){C(`Folder name: ${t}`),D(`folder`);return}F.current?.focus()}}})]}),t[61]=S,t[62]=E,t[63]=O,t[64]=k,t[65]=g,t[66]=i,t[67]=he):he=t[67];let ge=i===`folder`?`First file name`:`File name`,_e;t[68]!==A||t[69]!==ge?(_e=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:A,children:ge}),t[68]=A,t[69]=ge,t[70]=_e):_e=t[70];let ve;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>q(e.target.value),t[71]=ve):ve=t[71];let ye=i===`file`,be=S&&(E===`file`||E===`form`)?O:void 0,xe=S&&(E===`file`||E===`form`)?!0:void 0,Se;t[72]!==se||t[73]!==ae?(Se=e=>{e.key===`Enter`&&!ae&&se()},t[72]=se,t[73]=ae,t[74]=Se):Se=t[74];let Ce;t[75]!==A||t[76]!==m||t[77]!==ye||t[78]!==be||t[79]!==xe||t[80]!==Se?(Ce=(0,Z.jsx)(go,{ref:F,id:A,value:m,onChange:ve,placeholder:`my-note`,autoFocus:ye,"aria-describedby":be,"aria-invalid":xe,onFocus:Wf,onKeyDown:Se,className:`flex-1`}),t[75]=A,t[76]=m,t[77]=ye,t[78]=be,t[79]=xe,t[80]=Se,t[81]=Ce):Ce=t[81];let J;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{(e===`.md`||e===`.mdx`)&&y(e)},t[82]=J):J=t[82];let we;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(we=Mf.map(Uf),t[83]=we):we=t[83];let Te;t[84]===v?Te=t[85]:(Te=(0,Z.jsx)(lo,{type:`single`,value:v,onValueChange:J,variant:`outline`,"aria-label":`File extension`,className:`shrink-0`,children:we}),t[84]=v,t[85]=Te);let Ee;t[86]!==Ce||t[87]!==Te?(Ee=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ce,Te]}),t[86]=Ce,t[87]=Te,t[88]=Ee):Ee=t[88];let De;t[89]!==S||t[90]!==O?(De=S&&(0,Z.jsx)(`p`,{id:O,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:S}),t[89]=S,t[90]=O,t[91]=De):De=t[91];let Oe;t[92]!==_e||t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(`div`,{children:[_e,Ee,De]}),t[92]=_e,t[93]=Ee,t[94]=De,t[95]=Oe):Oe=t[95];let ke;t[96]!==me||t[97]!==he||t[98]!==Oe?(ke=(0,Z.jsx)(Ja,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[me,he,Oe]})}),t[96]=me,t[97]=he,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]===r?Ae=t[101]:(Ae=()=>r(!1),t[100]=r,t[101]=Ae);let je;t[102]!==w||t[103]!==Ae?(je=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:w,children:`Cancel`}),t[102]=w,t[103]=Ae,t[104]=je):je=t[104];let Me=w?`Creating`:`Create`,Ne;t[105]!==se||t[106]!==ae||t[107]!==Me?(Ne=(0,Z.jsx)(Y,{onClick:se,disabled:ae,children:Me}),t[105]=se,t[106]=ae,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==je||t[110]!==Ne?(Pe=(0,Z.jsxs)(Ya,{children:[je,Ne]}),t[109]=je,t[110]=Ne,t[111]=Pe):Pe=t[111];let Fe;t[112]!==pe||t[113]!==ke||t[114]!==Pe?(Fe=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[pe,ke,Pe]}),t[112]=pe,t[113]=ke,t[114]=Pe,t[115]=Fe):Fe=t[115];let Ie;return t[116]!==r||t[117]!==n||t[118]!==Fe?(Ie=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:Fe}),t[116]=r,t[117]=n,t[118]=Fe,t[119]=Ie):Ie=t[119],Ie}function Uf(e){return(0,Z.jsx)(so,{value:e,"aria-label":`Use ${e} extension`,children:e},e)}function Wf(e){return Vf(e.currentTarget)}function Gf(e){let t=(0,$.c)(53),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,h=o===Ff,g=i?d:void 0,_=`${r} ${n}`,v=l?`Loading templates`:h?`Blank note`:p?.title??p?.name??o,b;t[5]===v?b=t[6]:(b=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[5]=v,t[6]=b);let x;t[7]!==h||t[8]!==l||t[9]!==p?(x=!l&&!h&&p?(0,Z.jsx)(Yf,{entry:p}):null,t[7]=h,t[8]=l,t[9]=p,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ms,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==i||t[17]!==g||t[18]!==_||t[19]!==S||t[20]!==n?(w=(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(Y,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:l,className:`w-full justify-between font-normal`,children:[S,C]})}),t[15]=l,t[16]=i,t[17]=g,t[18]=_,t[19]=S,t[20]=n,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(u,{placeholder:`Search templates`}),t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(B,{children:`No templates found.`}),t[23]=E):E=t[23];let D;t[24]!==a||t[25]!==s?(D=()=>{s(Ff),a(!1)},t[24]=a,t[25]=s,t[26]=D):D=t[26];let O=o===Ff?`opacity-100`:`opacity-0`,k;t[27]===O?k=t[28]:(k=X(`mt-1 size-4 shrink-0`,O),t[27]=O,t[28]=k);let A;t[29]===k?A=t[30]:(A=(0,Z.jsx)(La,{className:k,"aria-hidden":`true`}),t[29]=k,t[30]=A);let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:`Blank note`}),(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:`Empty starting content`})]}),t[31]=j):j=t[31];let M;t[32]!==D||t[33]!==A?(M=(0,Z.jsxs)(ze,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[A,j]}),t[32]=D,t[33]=A,t[34]=M):M=t[34];let N;if(t[35]!==a||t[36]!==s||t[37]!==c||t[38]!==o){let e;t[40]!==a||t[41]!==s||t[42]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(ze,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(La,{className:X(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Yf,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[40]=a,t[41]=s,t[42]=o,t[43]=e):e=t[43],N=c.map(e),t[35]=a,t[36]=s,t[37]=c,t[38]=o,t[39]=N}else N=t[39];let P;t[44]!==d||t[45]!==M||t[46]!==N?(P=(0,Z.jsx)(vt,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Jf,onWheel:qf,onTouchMove:Kf,children:(0,Z.jsxs)(y,{children:[T,(0,Z.jsxs)(F,{id:d,className:`subtle-scrollbar`,children:[E,M,N]})]})}),t[44]=d,t[45]=M,t[46]=N,t[47]=P):P=t[47];let I;return t[48]!==a||t[49]!==i||t[50]!==P||t[51]!==w?(I=(0,Z.jsxs)(m,{open:i,onOpenChange:a,children:[w,P]}),t[48]=a,t[49]=i,t[50]=P,t[51]=w,t[52]=I):I=t[52],I}function Kf(e){e.stopPropagation()}function qf(e){e.stopPropagation()}function Jf(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Yf(e){let t=(0,$.c)(9),{entry:n,className:r}=e;if(n.scope===`user`){let e;t[0]===r?e=t[1]:(e=X(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,Z.jsx)(Qe,{variant:`primary`,className:e,children:`user`}),t[2]=e,t[3]=n),n}if(n.scope===`inherited`){let e;t[4]===r?e=t[5]:(e=X(`shrink-0 text-2xs`,r),t[4]=r,t[5]=e);let i=n.source_folder||`root`,a;return t[6]!==e||t[7]!==i?(a=(0,Z.jsx)(Qe,{variant:`gray`,className:e,children:i}),t[6]=e,t[7]=i,t[8]=a):a=t[8],a}return null}function Xf(e){return e.split(`/`).pop()??e}function Zf(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(Xf(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:Xf(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function Qf(e){let t=(0,$.c)(24),{plan:n,selectedPack:r}=e,i,a,o,s,c,l,u;if(t[0]!==n||t[1]!==r){let e=Zf(n,r);i=n.personalTemplates?.willWrite.length??0;let d=[...e].sort(tp),f=new Set(d.map(ep));l=`space-y-2`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),`What gets created`]}),t[9]=u):u=t[9],c=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,a=`Items to be created`,o=`py-1.5`,s=d.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);f.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},$f),a?(0,Z.jsx)(Ns,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:i}),a&&e.description?(0,Z.jsxs)(ho,{children:[(0,Z.jsx)(fo,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(po,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];let d;t[10]!==a||t[11]!==o||t[12]!==s?(d=(0,Z.jsx)(`ul`,{"aria-label":a,className:o,children:s}),t[10]=a,t[11]=o,t[12]=s,t[13]=d):d=t[13];let f;t[14]===i?f=t[15]:(f=i>0?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-t border-border/60 bg-muted/10 px-3 py-1.5`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0`,children:`~/.ok/templates/`}),(0,Z.jsxs)(`span`,{className:`truncate text-1sm text-muted-foreground`,children:[`— `,i,` personal `,i===1?`template`:`templates`]})]}):null,t[14]=i,t[15]=f);let p;t[16]!==c||t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:c,children:[d,f]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p):p=t[19];let m;return t[20]!==l||t[21]!==u||t[22]!==p?(m=(0,Z.jsxs)(`section`,{className:l,children:[u,p]}),t[20]=l,t[21]=u,t[22]=p,t[23]=m):m=t[23],m}function $f(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function ep(e){return e.name.replace(/\/$/,``)}function tp(e,t){return e.name.localeCompare(t.name)}async function np(e){let t=await e.json().catch(()=>null),n=Sn.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function rp(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId),e?.includePersonalTemplates&&t.set(`includePersonalTemplates`,`true`);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await np(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId,includePersonalTemplates:t?.includePersonalTemplates})});if(!n.ok)return{ok:!1,error:await np(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result,personalTemplates:r.personalTemplates}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var ip={"knowledge-base":Bs,"software-lifecycle":Ps,"plain-notes":hc,worldbuilding:xs,"writing-pipeline":ec,gbrain:Ys};function ap(e){return ip[e]??Bs}function op(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await rp().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=X(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},cp).map(sp),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=X(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(lp,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function sp(e){return(0,Z.jsx)(dp,{},`skeleton-${e}`)}function cp(e,t){return t}function lp(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=ap(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=up({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function up({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function dp(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(Ne,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function fp(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(tu,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pp(e){let t=(0,$.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 i;t[3]===n?i=t[4]:(i=X(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ru,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(nu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var mp=`knowledge-base`;function hp(e){let t=(0,$.c)(77),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={kind:`loading`},t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(a??mp),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(`project-root`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(a===void 0?`pick`:`configure`),x=(0,Q.useRef)(!0),S;t[1]!==l||t[2]!==d?(S=l?.find(e=>e.id===d),t[1]=l,t[2]=d,t[3]=S):S=t[3];let C=S,w,T;t[4]!==n||t[5]!==l?(w=()=>{if(!n||l!==null)return;let e=!1;return(async()=>{try{let t=await rp().listPacks();if(e)return;t.ok?u(t.packs):(u([]),c({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;u([]),c({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},T=[n,l],t[4]=n,t[5]=l,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]!==a||t[9]!==n?(E=()=>{n&&(f(a??mp),m(!0),g(`project-root`),v(``),b(a===void 0?`pick`:`configure`),c({kind:`loading`}),x.current=!0)},D=[n,a],t[8]=a,t[9]=n,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O,k;t[12]===C?(O=t[13],k=t[14]):(O=()=>{C&&v(C.defaultSubfolder??``)},k=[C],t[12]=C,t[13]=O,t[14]=k),(0,Q.useEffect)(O,k);let A;t[15]===_?A=t[16]:(A=_.trim(),t[15]=_,t[16]=A);let j=A,M=h===`subfolder`&&j===``,N,P;t[17]!==p||t[18]!==n||t[19]!==l||t[20]!==h||t[21]!==d||t[22]!==y||t[23]!==M||t[24]!==j?(N=()=>{if(!n||y!==`configure`||l===null)return;if(M){c({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=h===`project-root`?void 0:j,t=x.current?0:200;x.current=!1;let r=!1,i=setTimeout(()=>{r||(c(gp),rp().plan({rootDir:e,packId:d,includePersonalTemplates:p}).then(e=>{if(!r){if(!e.ok){c({kind:`error`,message:e.error.message});return}c(e.plan.created.length>0||(e.plan.personalTemplates?.willWrite.length??0)>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||c({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},P=[n,y,l,d,p,h,j,M],t[17]=p,t[18]=n,t[19]=l,t[20]=h,t[21]=d,t[22]=y,t[23]=M,t[24]=j,t[25]=N,t[26]=P):(N=t[25],P=t[26]),(0,Q.useEffect)(N,P);let F;t[27]!==p||t[28]!==r||t[29]!==i||t[30]!==s.kind||t[31]!==s.plan||t[32]!==C?.name||t[33]!==d?(F=async function(){if(s.kind!==`plan`)return;let e=s.plan;c({kind:`applying`,plan:e});let t;try{t=await rp().apply(e,{packId:d,includePersonalTemplates:p})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);eo.error(`Initialize failed: ${r}`),c({kind:`plan`,plan:e});return}if(t.ok){let e=C?.name??`starter pack`,n=t.result.applied,a=t.personalTemplates?.written.length??0,o=n===0&&a>0?`${a} personal template${a===1?``:`s`} written to ~/.ok/templates/`:n===0?`${e} was already set up. Nothing to do.`:a>0?`${e} initialized (${n} ${n===1?`entry`:`entries`}) + ${a} personal template${a===1?``:`s`}`:`${e} initialized (${n} ${n===1?`entry`:`entries`})`;eo.success(o),i?.(),r(!1)}else eo.error(`Initialize failed: ${t.error.message}`),c({kind:`plan`,plan:e})},t[27]=p,t[28]=r,t[29]=i,t[30]=s.kind,t[31]=s.plan,t[32]=C?.name,t[33]=d,t[34]=F):F=t[34];let I=F,L=a!==void 0,R=y===`configure`&&C?`Initialize ${C.name}`:`Initialize a starter pack`,z=y===`configure`&&C?C.description:`Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later.`,B;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(e),b(`configure`),x.current=!0},t[35]=B):B=t[35];let V=B,H;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){b(`pick`),c({kind:`loading`}),x.current=!0},t[36]=H):H=t[36];let U=H,W;t[37]===R?W=t[38]:(W=(0,Z.jsx)(Ha,{children:R}),t[37]=R,t[38]=W);let G;t[39]===z?G=t[40]:(G=(0,Z.jsx)(Ba,{children:z}),t[39]=z,t[40]=G);let K;t[41]!==W||t[42]!==G?(K=(0,Z.jsxs)(Za,{children:[W,G]}),t[41]=W,t[42]=G,t[43]=K):K=t[43];let q;t[44]!==p||t[45]!==l||t[46]!==s||t[47]!==h||t[48]!==C||t[49]!==y||t[50]!==_?(q=y===`pick`?(0,Z.jsx)(Ja,{children:(0,Z.jsx)(op,{packs:l,onPackSelect:V})}):(0,Z.jsxs)(Ja,{className:`space-y-6`,children:[(0,Z.jsx)(_p,{checked:p,onCheckedChange:m}),(0,Z.jsx)(vp,{choice:h,subfolder:_,placeholder:C?.defaultSubfolder??`subfolder`,onChoiceChange:g,onSubfolderChange:v}),(0,Z.jsx)(yp,{phase:s,selectedPack:C})]}),t[44]=p,t[45]=l,t[46]=s,t[47]=h,t[48]=C,t[49]=y,t[50]=_,t[51]=q):q=t[51];let ee;t[52]!==L||t[53]!==y?(ee=y===`configure`&&!L?(0,Z.jsxs)(Y,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:U,children:[(0,Z.jsx)(ii,{"aria-hidden":`true`,className:`h-4 w-4`}),`Back`]}):null,t[52]=L,t[53]=y,t[54]=ee):ee=t[54];let te;t[55]===r?te=t[56]:(te=()=>r(!1),t[55]=r,t[56]=te);let ne=s.kind===`already-seeded`||s.kind===`error`?`Close`:`Cancel`,re;t[57]!==te||t[58]!==ne?(re=(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,onClick:te,children:ne}),t[57]=te,t[58]=ne,t[59]=re):re=t[59];let ie;t[60]!==I||t[61]!==s.kind||t[62]!==y||t[63]!==M?(ie=y===`configure`&&s.kind===`plan`?(0,Z.jsx)(Y,{onClick:I,disabled:M,children:`Initialize`}):y===`configure`&&s.kind===`applying`?(0,Z.jsxs)(Y,{disabled:!0,children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up`]}):null,t[60]=I,t[61]=s.kind,t[62]=y,t[63]=M,t[64]=ie):ie=t[64];let ae;t[65]!==ee||t[66]!==re||t[67]!==ie?(ae=(0,Z.jsxs)(Ya,{children:[ee,re,ie]}),t[65]=ee,t[66]=re,t[67]=ie,t[68]=ae):ae=t[68];let oe;t[69]!==K||t[70]!==q||t[71]!==ae?(oe=(0,Z.jsxs)(Ga,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[K,q,ae]}),t[69]=K,t[70]=q,t[71]=ae,t[72]=oe):oe=t[72];let se;return t[73]!==r||t[74]!==n||t[75]!==oe?(se=(0,Z.jsx)(Qa,{open:n,onOpenChange:r,children:oe}),t[73]=r,t[74]=n,t[75]=oe,t[76]=se):se=t[76],se}function gp(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function _p(e){let t=(0,$.c)(7),{checked:n,onCheckedChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ma,{children:`Include personal templates`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(fi,{children:[i,(0,Z.jsxs)($i,{className:`text-1sm`,children:[`Adds daily journal, reading log, recipes, and more to `,(0,Z.jsx)(`code`,{children:`~/.ok/templates/`}),`. Idempotent. Never overwrites your edits.`]})]}),t[1]=a):a=t[1];let o;t[2]===r?o=t[3]:(o=e=>r(e===!0),t[2]=r,t[3]=o);let s;return t[4]!==n||t[5]!==o?(s=(0,Z.jsx)(Ca,{htmlFor:`seed-include-personal-templates`,className:`cursor-pointer`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[a,(0,Z.jsx)(ro,{id:`seed-include-personal-templates`,checked:n,onCheckedChange:o})]})}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function vp(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Where should it live?`}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ca,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[(0,Z.jsxs)(fi,{children:[(0,Z.jsx)(ma,{children:`Project root`}),(0,Z.jsx)($i,{className:`text-1sm`,children:`Scaffold the pack's folders directly under this project.`})]}),(0,Z.jsx)(pp,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=l):l=t[3];let u,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ma,{children:`In a subfolder`}),d=(0,Z.jsx)($i,{className:`nth-last-2:mt-0 text-1sm`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=u,t[5]=d):(u=t[4],d=t[5]);let f;t[6]===o?f=t[7]:(f=e=>o(e.target.value),t[6]=o,t[7]=f);let p;t[8]===a?p=t[9]:(p=()=>a(`subfolder`),t[8]=a,t[9]=p);let m;t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(fi,{children:[u,d,(0,Z.jsx)(go,{value:r,onChange:f,onFocus:p,placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=i,t[11]=r,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pp,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=h):h=t[15];let g;t[16]===m?g=t[17]:(g=(0,Z.jsx)(Ca,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Ni,{orientation:`horizontal`,children:[m,h]})}),t[16]=m,t[17]=g);let _;return t[18]!==n||t[19]!==g||t[20]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(fp,{className:`sm:flex`,value:n,onValueChange:c,children:[l,g]})]}),t[18]=n,t[19]=g,t[20]=c,t[21]=_):_=t[21],_}function yp(e){let t=(0,$.c)(12),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan`]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`This pack is already set up here.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The folders and templates are in place; there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let i;t[4]!==n.plan||t[5]!==r?(i=(0,Z.jsx)(Qf,{plan:n.plan,selectedPack:r}),t[4]=n.plan,t[5]=r,t[6]=i):i=t[6];let a;t[7]===n.plan.warnings?a=t[8]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(bp)}):null,t[7]=n.plan.warnings,t[8]=a);let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}function bp(e){return(0,Z.jsx)(`p`,{children:e},e)}var xp=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],Sp=`#settings`;function Cp(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function wp(e){return e.replace(/^#/,``)===`settings`}function Tp(){return typeof window>`u`?``:window.location.hash}function Ep(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(Op),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(wp(Tp()))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=Dp,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Dp(){typeof window>`u`||wp(Tp())&&window.history.back()}function Op(){return wp(Tp())}function kp(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Mp),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(jp);if(!e||!t.ok)return;let i=_n.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(Ap),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Ap(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function jp(){return null}function Mp(){return Np()}function Np(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function Pp(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Fp(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=An(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ip(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Pp(e):Fp()}var Lp=`ok:skill:cowork:installed`,Rp=`1`,zp=250,Bp=`/api/skill/install-state`;function Vp(e){return`${Lp}:v${e}`}var Hp=new Map;async function Up(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Hp.get(n);if(r)return r;let i=Wp(e,t);return Hp.set(n,i),i.finally(()=>{Hp.get(n)===i&&Hp.delete(n)}),i}async function Wp(e,t){let n=e.installer===void 0?Ip():e.installer,r=Gp(e.storage),i=e.fetchSnapshot??qp,a=e.serverTimeoutMs??zp,o=null;if(!t.force){try{o=await Jp(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Vp(o?.currentVersion??e.fallbackSkillVersion??Kp());if(!t.force&&r?.getItem(s)===Rp)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Rp)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Gp(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Kp(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function qp(){let e;try{e=await fetch(Bp,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Jp(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Yp(e){return Up({},e)}function Xp(){return Up({},{force:!0})}async function Zp(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Qp(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Zp({target:`claude-cowork`,url:Dn({mode:`cowork`},e)},n);case`claude-code`:return Zp({target:`claude-code`,url:Dn({mode:`code`},e)},n);case`codex`:return Zp({target:`codex`,url:nn(e)},n);case`cursor`:return Zp({target:`cursor`,url:Qn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function $p(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:em(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:em(e)}}}function em(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function tm(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function nm(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function rm(e){return`${e}.md`}function im(e){if(!e.docName||!e.workspace)return null;let t=rm(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:nm(n,t,r)}}function am(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function om(e){return $p(e.installUrl).then(()=>void 0)}function sm(e){return`Opened in ${e}.`}function cm(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function lm(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function um(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}async function dm(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:t.docContext===null?``:yr(t.docContext)},a=await n.dispatchHandoff(i),o=um(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(sm(s));else{let i=lm(r),a=cm(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{dm(e,t,n,r+1)}}})}return a}function fm(e){return xp.find(t=>t.id===e)?.displayName??e}function pm(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function mm(){return{dispatchHandoff:Qp,recordHandoff:tm,toast:{success:e=>{eo.success(e)},error:(e,t)=>{eo.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>pm(),getDisplayName:fm,ensureCoworkSkillInstalled:Yp}}function hm(){return{dispatch:(e,t)=>dm(e,t,mm()),reinstallCoworkSkill:Xp}}var gm=[...new Set(xp.flatMap(e=>e.schemes))];function _m(e,t){let n=t.now?.()??Date.now(),r={};for(let t of xp){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function vm(e){return _m({},e)}async function ym(e){let t=e.schemes??gm,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var bm=Object.fromEntries(gm.map(e=>[e,{installed:!1}]));async function xm(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return bm}if(!t.ok)return bm;let n;try{n=await t.json()}catch{return bm}if(typeof n!=`object`||!n||Array.isArray(n))return bm;let r=n,i={};for(let e of gm)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Sm(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Cm(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=vm({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=_m(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Sm(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function wm(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Tm(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>ym({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>xm({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Em(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Dm),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Cm(Tm());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return typeof window<`u`&&window.addEventListener(`focus`,i),()=>{typeof window<`u`&&window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Dm(){return vm({isElectronHost:wm(),now:Date.now})}var Om=3e3,km=(e,t,n)=>kc(e,t,n,`CommandPalette`);function Am(e){window.location.assign(or(e))}function jm(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Ar(t)}function Mm(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?_t:Os,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(Nm,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Nm,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(Nm,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(ze,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function Nm(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=vf(n,r).map(Pm),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function Pm(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function Fm({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function Im(e){let t=(0,$.c)(113),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,[o,s]=(0,Q.useState)(``),c=(0,Q.useDeferredValue)(o),l=c.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,m]=(0,Q.useState)(d),[h,_]=(0,Q.useState)(`idle`),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],t[1]=y):y=t[1];let[b,x]=(0,Q.useState)(y),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[2]=S):S=t[2];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(!1),k;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],t[3]=k):k=t[3];let[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(`idle`),P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[4]=P):P=t[4];let[I,L]=(0,Q.useState)(P),[z,V]=(0,Q.useState)(`idle`),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),{activeDocName:K,activeTarget:q}=Je(),{pages:ee,pageTitles:te,pageMeta:ne,folderPaths:re}=Tr(),ie=kp(),{states:ae,refresh:oe}=Em(),{dispatch:se}=hm(),ce=im({docName:K,workspace:ie}),le=df(ee,re,te,ne),ue=nf(C,new Set(le.map(zm))),de=a?.config.projectPath??null,fe=a?b.filter(e=>e.path!==de):[],pe;t[5]!==K||t[6]!==q?(pe=jm(q,K),t[5]=K,t[6]=q,t[7]=pe):pe=t[7];let me=pe,he=l===``?[]:gf(le,l,8),ge,_e;t[8]!==i||t[9]!==r?(ge=()=>{let e=function(e){e.key===`k`&&(Br()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_e=[i,r],t[8]=i,t[9]=r,t[10]=ge,t[11]=_e):(ge=t[10],_e=t[11]),(0,Q.useEffect)(ge,_e);let ve,ye;t[12]!==a||t[13]!==r||t[14]!==oe?(ve=()=>{if(r){if(w($d()),oe(),a){let e=!1;return km(async()=>{let t=await a.project.listRecent();e||x(t)},`Failed to load recent projects.`),()=>{e=!0}}return}s(``),j([]),N(`idle`),U.current=!1,L([]),V(`idle`)},ye=[r,a,oe],t[12]=a,t[13]=r,t[14]=oe,t[15]=ve,t[16]=ye):(ve=t[15],ye=t[16]),(0,Q.useEffect)(ve,ye);let be;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{W.current&&(W.current.scrollTop=0)},t[17]=be):be=t[17];let xe;t[18]===o?xe=t[19]:(xe=[o],t[18]=o,t[19]=xe),(0,Q.useEffect)(be,xe);let Se=Cf(c,new Set(A.map(Rm))),Ce=Se.kind!==`normal`,J,we;t[20]!==Ce||t[21]!==r?(J=()=>{if(!r||!Ce||U.current)return;U.current=!0,N(`loading`);let e=!1;return Tf().then(t=>{e||(j(t),N(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),j([]),N(`error`))}),()=>{e=!0}},we=[r,Ce],t[20]=Ce,t[21]=r,t[22]=J,t[23]=we):(J=t[22],we=t[23]),(0,Q.useEffect)(J,we);let Te=Se.kind===`tag-docs`?Se.tagName:null;(0,Q.useEffect)(()=>{if(!r||Te===null){L([]),V(`idle`);return}V(`loading`),L([]);let e=!1;return Ef(Te).then(t=>{e||(L(t),V(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),L([]),V(`error`))}),()=>{e=!0}},[r,Te]),(0,Q.useEffect)(()=>{if(!r||!l||Ce){m([]),_(`idle`);return}let e=new AbortController;_(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),m([]),_(`error`)},Om);return bf(l,{signal:e.signal}).then(e=>{window.clearTimeout(n),m(e),_(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(m([]),_(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,l,Ce]);let Ee;t[24]===i?Ee=t[25]:(Ee=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),km(async()=>{await e()},n)},t[24]=i,t[25]=Ee);let De=Ee,Oe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=tf($d(),t);ef(n),w(n)},t[26]=Oe):Oe=t[26];let ke=Oe,Ae;t[27]===i?Ae=t[28]:(Ae=function(e){i(!1),ke(e),Am(e.path)},t[27]=i,t[28]=Ae);let je=Ae,Me=!Ce&&l===``&&ue.length>0,Ne=Fm({searchResults:f,fallbackSearchResults:he,searchStatus:h}),Pe=!Ce&&Ne.length>0,Fe=!Ce&&l!==``&&h===`loading`&&!Pe,Ie;t[29]!==c||t[30]!==Ce?(Ie=!Ce&&xf(`New file`,c,[`create file`]),t[29]=c,t[30]=Ce,t[31]=Ie):Ie=t[31];let Le=Ie,Re;t[32]!==c||t[33]!==Ce?(Re=!Ce&&xf(`New folder`,c,[`create folder`]),t[32]=c,t[33]=Ce,t[34]=Re):Re=t[34];let Be=Re,He;t[35]!==K||t[36]!==c||t[37]!==Ce?(He=!Ce&&K!==null&&xf(`Open graph`,c,[`graph panel network`]),t[35]=K,t[36]=c,t[37]=Ce,t[38]=He):He=t[38];let Ue=He,We;t[39]!==c||t[40]!==Ce?(We=!Ce&&xf(`Initialize starter pack`,c,[`scaffold`,`seed`,`pack`,`starter`]),t[39]=c,t[40]=Ce,t[41]=We):We=t[41];let Ge=We,Ke=!Ce&&a!==null&&xf(`Open folder on disk`,c,[`project`]),qe=!Ce&&a!==null&&xf(`Switch Project`,c,[`switch project navigator projects`]),Ye=!Ce&&xf(`Settings`,c,[`preferences config`]),Xe=!Ce&&xf(`Install for Claude Chat & Cowork (Desktop App)`,c,[`claude desktop install cowork`]),Ze=!Ce&&a!==null&&fe.length>0&&(l===``||fe.some(e=>xf(`${e.name} ${e.path}`,c,[`recent project`]))),Qe=!Ce&&ce!==null&&(l===``||xp.some(e=>xf(`Open in ${e.displayName}`,c,[e.id,`agent handoff`]))),$e=Se.kind===`tag-list`?wf(A,Se.query):[],et=Se.kind===`tag-list`&&M!==`loading`&&$e.length===0,tt=Se.kind===`tag-docs`&&z===`success`&&I.length===0,nt=Ce||Me||Pe||Fe||Le||Be||Ue||Ge||Ke||qe||Ye||Xe||Ze||Qe,rt;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(rt=function(e){s(`${Sf}${e}`)},t[42]=rt):rt=t[42];let it=rt,at=g,ot;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ot={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[43]=ot):ot=t[43];let st;t[44]===o?st=t[45]:(st=(0,Z.jsx)(u,{ref:G,value:o,onValueChange:s,placeholder:`Search files, folders, or commands`}),t[44]=o,t[45]=st);let ct;t[46]===Ce?ct=t[47]:(ct=()=>{s(Ce?``:Sf),G.current?.focus()},t[46]=Ce,t[47]=ct);let lt=Ce?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,ut;t[48]===lt?ut=t[49]:(ut=X(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,lt),t[48]=lt,t[49]=ut);let dt,ft;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(p,{className:`size-3.5`}),ft=(0,Z.jsx)(`span`,{children:`By tag`}),t[50]=dt,t[51]=ft):(dt=t[50],ft=t[51]);let pt;t[52]!==Ce||t[53]!==ct||t[54]!==ut?(pt=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:ct,"data-testid":`command-palette-filter-tag`,"data-active":Ce,"aria-pressed":Ce,className:ut,children:[dt,ft]})}),t[52]=Ce,t[53]=ct,t[54]=ut,t[55]=pt):pt=t[55];let mt=F,ht;t[56]!==Pe||t[57]!==Fe?(ht=Fe&&!Pe?(0,Z.jsx)(B,{children:`Searching`}):null,t[56]=Pe,t[57]=Fe,t[58]=ht):ht=t[58];let gt=nt?null:(0,Z.jsx)(B,{children:h===`error`?`Search failed.`:`No matching commands.`}),vt=Se.kind===`tag-list`?(0,Z.jsxs)(Ve,{heading:Se.query?`Tags matching "${Se.query}"`:`All tags`,children:[M===`loading`?(0,Z.jsx)(B,{children:`Loading tags`}):null,M===`error`?(0,Z.jsx)(B,{children:`Failed to load tags. Press Escape and re-open to retry.`}):null,et?(0,Z.jsx)(B,{children:Se.query?`No tags match "${Se.query}".`:"No tags yet — author `#tagname` in any doc to populate the index."}):null,$e.map(e=>(0,Z.jsxs)(ze,{value:`tag ${e.name}`,onSelect:()=>it(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(p,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:[e.count,` `,e.count===1?`doc`:`docs`]})]},`tag:${e.name}`))]}):null,yt;t[59]!==i||t[60]!==Se||t[61]!==tt||t[62]!==I||t[63]!==z?(yt=Se.kind===`tag-docs`?(0,Z.jsxs)(Ve,{heading:`Docs tagged #${Se.tagName}`,children:[z===`loading`?(0,Z.jsx)(B,{children:`Loading docs`}):null,z===`error`?(0,Z.jsx)(B,{children:`Failed to load docs. Press Escape and re-open to retry.`}):null,tt?(0,Z.jsx)(B,{children:`No docs registered under #${Se.tagName}.`}):null,I.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName;return(0,Z.jsxs)(ze,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),Am(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Os,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==Se.tagName)?(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:[`via`,` `,e.matchingTags.filter(e=>e!==Se.tagName).map(Lm).join(`, `)]}):null]})]},`tag-doc:${e.docName}`)})]}):null,t[59]=i,t[60]=Se,t[61]=tt,t[62]=I,t[63]=z,t[64]=yt):yt=t[64];let bt=Me?(0,Z.jsx)(Ve,{heading:`Recently opened`,children:ue.map(e=>(0,Z.jsx)(Mm,{entry:e,onSelect:()=>je(e)},Qd(e.kind,e.path)))}):null,xt;t[65]!==K||t[66]!==i||t[67]!==E||t[68]!==O||t[69]!==Le||t[70]!==Be||t[71]!==Ue||t[72]!==Ge?(xt=Le||Be||Ue||Ge?(0,Z.jsxs)(Ve,{heading:`Commands`,children:[Le?(0,Z.jsxs)(ze,{value:`new file create file`,onSelect:()=>{i(!1),E(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(v,{}),(0,Z.jsx)(`span`,{children:`New file`})]}):null,Be?(0,Z.jsxs)(ze,{value:`new folder create folder`,onSelect:()=>{i(!1),E(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Ms,{}),(0,Z.jsx)(`span`,{children:`New folder`})]}):null,Ue?(0,Z.jsxs)(ze,{value:`open graph graph panel network`,onSelect:()=>{K&&(i(!1),Af(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Ys,{}),(0,Z.jsx)(`span`,{children:`Open graph`})]}):null,Ge?(0,Z.jsxs)(ze,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),O(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Zs,{}),(0,Z.jsx)(`span`,{children:`Initialize starter pack`})]}):null]}):null,t[65]=K,t[66]=i,t[67]=E,t[68]=O,t[69]=Le,t[70]=Be,t[71]=Ue,t[72]=Ge,t[73]=xt):xt=t[73];let St=Qe?(0,Z.jsx)(Ve,{heading:`Open in agent`,children:xp.filter(e=>xf(`Open in ${e.displayName}`,c,[e.id,`agent handoff`])).map(e=>{let t=ae[e.id],n=t.installed===!0&&ce!==null,r=t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(ze,{value:`open in ${e.displayName} ${e.id} agent`,disabled:!n,onSelect:()=>{!n||!ce||(i(!1),se(e.id,ce))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})}):null,Ct=Ke||qe||Ye||Xe||Ze?(0,Z.jsxs)(Ve,{heading:`Project`,children:[Ke&&a?(0,Z.jsxs)(ze,{value:`open folder on disk project`,onSelect:()=>De(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(_t,{}),(0,Z.jsx)(`span`,{children:`Open folder on disk`}),(0,Z.jsx)(R,{children:`⌘O`})]}):null,qe&&a?(0,Z.jsxs)(ze,{value:`switch-project navigator projects`,onSelect:()=>De(()=>a.navigator.open(),`Failed to open Project Navigator.`),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(zs,{}),(0,Z.jsx)(`span`,{children:`Switch Project`}),(0,Z.jsx)(R,{children:`⌘⇧N`})]}):null,Ye?(0,Z.jsxs)(ze,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Sp)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(cc,{}),(0,Z.jsx)(`span`,{children:`Settings`}),(0,Z.jsx)(R,{children:`⌘,`})]}):null,Xe?(0,Z.jsxs)(ze,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(ji,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)`})]}):null,Ze&&a?fe.filter(e=>xf(`${e.name} ${e.path}`,c,[`recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(ze,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>De(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(H,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]})]},e.path)):null]}):null,wt=Pe?(0,Z.jsx)(Ve,{heading:`Search`,children:Ne.map(e=>(0,Z.jsx)(Mm,{entry:e,query:l,onSelect:()=>je(e)},Qd(e.kind,e.path)))}):null,Tt;t[74]!==mt||t[75]!==ht||t[76]!==gt||t[77]!==vt||t[78]!==yt||t[79]!==bt||t[80]!==xt||t[81]!==St||t[82]!==Ct||t[83]!==wt?(Tt=(0,Z.jsxs)(mt,{ref:W,className:`subtle-scrollbar`,children:[ht,gt,vt,yt,bt,xt,St,Ct,wt]}),t[74]=mt,t[75]=ht,t[76]=gt,t[77]=vt,t[78]=yt,t[79]=bt,t[80]=xt,t[81]=St,t[82]=Ct,t[83]=wt,t[84]=Tt):Tt=t[84];let Et;t[85]!==at||t[86]!==i||t[87]!==r||t[88]!==ot||t[89]!==st||t[90]!==pt||t[91]!==Tt?(Et=(0,Z.jsxs)(at,{open:r,onOpenChange:i,title:`Workspace Command Palette`,description:`Search files, folders, and commands for the current workspace.`,className:`sm:max-w-2xl`,commandProps:ot,children:[st,pt,Tt]}),t[85]=at,t[86]=i,t[87]=r,t[88]=ot,t[89]=st,t[90]=pt,t[91]=Tt,t[92]=Et):Et=t[92];let Dt=T===`file`,Ot;t[93]===E?Ot=t[94]:(Ot=e=>{e||E(null)},t[93]=E,t[94]=Ot);let kt;t[95]!==me||t[96]!==Dt||t[97]!==Ot?(kt=(0,Z.jsx)(Hf,{open:Dt,onOpenChange:Ot,kind:`file`,initialDir:me}),t[95]=me,t[96]=Dt,t[97]=Ot,t[98]=kt):kt=t[98];let At=T===`folder`,jt;t[99]===E?jt=t[100]:(jt=e=>{e||E(null)},t[99]=E,t[100]=jt);let Mt;t[101]!==me||t[102]!==At||t[103]!==jt?(Mt=(0,Z.jsx)(Hf,{open:At,onOpenChange:jt,kind:`folder`,initialDir:me}),t[101]=me,t[102]=At,t[103]=jt,t[104]=Mt):Mt=t[104];let Nt;t[105]!==D||t[106]!==O?(Nt=(0,Z.jsx)(hp,{open:D,onOpenChange:O}),t[105]=D,t[106]=O,t[107]=Nt):Nt=t[107];let Pt;return t[108]!==Et||t[109]!==kt||t[110]!==Mt||t[111]!==Nt?(Pt=(0,Z.jsxs)(Z.Fragment,{children:[Et,kt,Mt,Nt]}),t[108]=Et,t[109]=kt,t[110]=Mt,t[111]=Nt,t[112]=Pt):Pt=t[112],Pt}function Lm(e){return`#${e}`}function Rm(e){return e.name}function zm(e){return Qd(e.kind,e.path)}var Bm=500;function Vm(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Hm(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function Um(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=Je(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),Bm);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=Vm(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Hm(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function Wm(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(An(e)??`Server error: ${t.status} ${t.statusText}`)}return(await t.json()).docs??[]}function Gm(){let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),Wm(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Ge,e),()=>document.removeEventListener(Ge,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(or(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m=(0,Z.jsx)(Za,{children:(0,Z.jsxs)(Ha,{children:[`Documents tagged `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,p]})]})}),e[4]=p,e[5]=m);let h=r??``,g;e[6]!==o||e[7]!==h?(g=(0,Z.jsx)(Ja,{children:(0,Z.jsx)(Km,{fetchState:o,tag:h,onSelectDoc:f})}),e[6]=o,e[7]=h,e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==g?(_=(0,Z.jsxs)(Ga,{children:[m,g]}),e[9]=m,e[10]=g,e[11]=_):_=e[11];let v;return e[12]!==t||e[13]!==_?(v=(0,Z.jsx)(Qa,{open:t,onOpenChange:n,children:_}),e[12]=t,e[13]=_,e[14]=v):v=e[14],v}function Km(e){let t=(0,$.c)(12),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:`Loading`}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:[`Only the current document uses `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,r]}),`.`]}),t[3]=r,t[4]=e),e}let a;if(t[5]!==n.docs||t[6]!==i){let e;t[8]===i?e=t[9]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(qm)}):null]})},e.docName)},t[8]=i,t[9]=e),a=n.docs.map(e),t[5]=n.docs,t[6]=i,t[7]=a}else a=t[7];let o;return t[10]===a?o=t[11]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[10]=a,t[11]=o),o}function qm(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var Jm=`raw-mdx-nav`,Ym=`ok-editor-mode-v1`,Xm=[`wysiwyg`,`source`],Zm=`wysiwyg`;function Qm(e){return Xm.includes(e)}function $m(e=localStorage){try{let t=e.getItem(Ym);if(t===null)return Zm;if(Qm(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Zm}function eh(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Qm(n)?n:$m(t)}function th(e,t=localStorage){try{return t.setItem(Ym,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function nh(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eh),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),th(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function rh(e){let t=(0,$.c)(21),{open:n,onResolved:r}=e,i=Si(),a;t[0]!==r||t[1]!==i?(a=function(e){if(i===null){eo.error(`Sync settings not yet loaded — try again in a moment`);return}let t=i(e);if(!t.ok){eo.error(`Could not ${e?`enable sync`:`save sync preference`}: ${t.error}`);return}r()},t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Za,{children:(0,Z.jsx)(Ei,{})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ja,{children:(0,Z.jsx)(va,{})}),t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=()=>o(!1),t[5]=o,t[6]=l);let u=i===null,d;t[7]!==l||t[8]!==u?(d=(0,Z.jsx)(Y,{variant:`ghost`,className:`uppercase font-mono`,onClick:l,disabled:u,children:`Keep disabled`}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]===o?f=t[11]:(f=()=>o(!0),t[10]=o,t[11]=f);let p=i===null,m;t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(Y,{onClick:f,disabled:p,children:`Enable auto-sync`}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(Ga,{className:`sm:max-w-lg`,showCloseButton:!1,children:[s,c,(0,Z.jsxs)(Ya,{children:[d,m]})]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==n||t[19]!==h?(g=(0,Z.jsx)(Qa,{open:n,onOpenChange:ih,children:h}),t[18]=n,t[19]=h,t[20]=g):g=t[20],g}function ih(){}function ah(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=Hi();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(gn,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var oh=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function sh(e,t,n,r,i,a){if(e==r)return[];let o=_h(e,t,n,r,i,a),s=vh(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new oh(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new oh(t,t+o,i,i),new oh(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new oh(t,t,i,i+o),new oh(n,n,i+o+c,a)]}if(c==1||l==1)return[new oh(t,n,i,a)];let u=bh(e,t,n,r,i,a);if(u){let[o,s,c]=u;return sh(e,t,o,r,i,s).concat(sh(e,o+c,n,r,s+c,a))}return dh(e,t,n,r,i,a)}var ch=1e9,lh=0,uh=!1;function dh(e,t,n,r,i,a){let o=n-t,s=a-i;if(ch<1e9&&Math.min(o,s)>ch*16||lh>0&&Date.now()>lh)return Math.min(o,s)>ch*64?[new oh(t,n,i,a)]:xh(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);ph.reset(c),mh.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:mh,f=d?null:ph;for(let p=0;p<c;p++){if(p>ch||lh>0&&!(p&63)&&Date.now()>lh)return xh(e,t,n,r,i,a);let m=ph.advance(p,o,s,c,d,!1,l)||mh.advance(p,o,s,c,f,!0,u);if(m)return hh(e,t,n,t+m[0],r,i,a,i+m[1])}return[new oh(t,n,i,a)]}var fh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},ph=new fh,mh=new fh;function hh(e,t,n,r,i,a,o,s){let c=!1;return!Ih(e,r)&&++r==n&&(c=!0),!Ih(i,s)&&++s==o&&(c=!0),c?[new oh(t,n,a,o)]:sh(e,t,r,i,a,s).concat(sh(e,r,n,i,s,o))}function gh(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function _h(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=gh(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Ih(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function vh(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=gh(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Ih(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function yh(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Ih(e,s)||s++;let u=s+o;if(Ih(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=_h(e,u,n,r,i+f+d.length,a),c=vh(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function bh(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=bh(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:yh(e,t,n,r,i,a,Math.floor(o/4),-1)}function xh(e,t,n,r,i,a){uh=!0;let o=n-t,s=a-i,c;if(o<s){let s=yh(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=yh(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new oh(t,n,i,a)];let[l,u,d]=c;return sh(e,t,l,r,i,u).concat(sh(e,l+d,n,r,u+d,a))}function Sh(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new oh(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Ch(e,t,n){for(;;){Sh(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=_h(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new oh(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=vh(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new oh(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new oh(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new oh(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function wh(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=jh(t,a.fromA,l),f=Ah(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new oh(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Ah(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new oh(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=jh(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new oh(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Nh(n,a.fromB,a.toB),r,o=t<0?-1:Mh(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Nh(t,a.fromA,a.toA),r,o=n<0?-1:Mh(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return Sh(e,3),e}var Th;try{Th=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Eh(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Dh(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Eh(n):Th?!Ph(n)||t==e.length-1?+!!Th.test(String.fromCharCode(n)):Th.test(e.slice(t,t+2))?2:0:0}function Oh(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Eh(n):Th?!Fh(n)||t==1?+!!Th.test(String.fromCharCode(n)):Th.test(e.slice(t-2,t))?2:0:0}var kh=8;function Ah(e,t,n){if(t==e.length||!Oh(e,t))return t;for(let r=t,i=t+n,a=0;a<kh;a++){let t=Dh(e,r);if(!t||r+t>i)return r;r+=t}return t}function jh(e,t,n){if(!t||!Dh(e,t))return t;for(let r=t,i=t-n,a=0;a<kh;a++){let t=Oh(e,r);if(!t||r-t<i)return r;r-=t}return t}function Mh(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Nh(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Ph=e=>e>=55296&&e<=56319,Fh=e=>e>=56320&&e<=57343;function Ih(e,t){return!t||t==e.length||!Ph(e.charCodeAt(t-1))||!Fh(e.charCodeAt(t))}function Lh(e,t,n){let r=n?.override;return r?r(e,t):(ch=(n?.scanLimit??1e9)>>1,lh=n?.timeout?Date.now()+n.timeout:0,uh=!1,Ch(e,t,sh(e,0,e.length,t,0,t.length)))}function Rh(){return!uh}function zh(e,t,n){return wh(Lh(e,t,n),e,t)}var Bh=ko.define({combine:e=>e[0]}),Vh=Ao.define(),Hh=ko.define(),Uh=wo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Vh)&&(e=n.value);for(let n of t.state.facet(Hh))e=n(e,t);return e}});function Wh(e){let t=e.field(Uh,!1);if(!t)return null;let n=e.facet(Bh);return{chunks:t,side:n?n.side:null}}var Gh=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Jh(zh(e.toString(),t.toString(),n),e,t,0,0,Rh())}static updateA(e,t,n,r,i){return Qh(Zh(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Qh(Zh(e,r,!1,t.length),e,t,n,i)}};function Kh(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function qh(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Jh(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Kh(c.fromA+r,c.fromB+i,t,n),[d,f]=qh(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Kh(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=qh(a.toA+r,a.toB+i,t,n),s++}o.push(new Gh(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Yh=1e3;function Xh(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Zh(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Yh&&([l,d]=Xh(e,a-Yh,n,!0)),o<t.length-Yh&&([u,f]=Xh(e,o+Yh,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function Qh(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=zh(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Jh(h,n,r,d,f,Rh()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var $h={scanLimit:500},eg=jo.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=ug(e))}update(e){(e.docChanged||e.viewportChanged||ng(e.startState,e.state)||rg(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=ug(e.view))}},{decorations:e=>e.deco}),tg=xo.low(Fo({class:`cm-changeGutter`,markers:e=>e.plugin(eg)?.gutter||Lo.empty}));function ng(e,t){return e.field(Uh,!1)!=t.field(Uh,!1)}function rg(e,t){return e.facet(Bh)!=t.facet(Bh)}var ig=Do.line({class:`cm-changedLine`}),ag=Do.mark({class:`cm-changedText`}),og=Do.mark({tagName:`ins`,class:`cm-insertedLine`}),sg=Do.mark({tagName:`del`,class:`cm-deletedLine`}),cg=new class extends Po{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function lg(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,ig),i.add(o,s,n?sg:og),a&&a.add(o,o,cg);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,ig),a&&a.add(u,u,cg);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,ag),s<t)c++;else break}u=t}}}function ug(e){let t=e.state.field(Uh),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Bh),o=n==`a`,s=new Oo,c=i?new Oo:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&lg(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var dg=class extends bo{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},fg=Ao.define({map:(e,t)=>e.map(t)}),pg=wo.define({create:()=>Do.none,update:(e,t)=>{for(let e of t.effects)if(e.is(fg))return e.value;return e.map(t.changes)},provide:e=>No.decorations.from(e)}),mg=.01;function hg(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function gg(e,t,n){let r=new Oo,i=new Oo,a=e.state.field(pg).iter(),o=t.state.field(pg).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-mg?(l-=n,r.add(s,s,Do.widget({widget:new dg(-n),block:!0,side:-1}))):n>mg&&(u+=n,i.add(c,c,Do.widget({widget:new dg(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<mg?r.add(e.state.doc.length,e.state.doc.length,Do.widget({widget:new dg(-p),block:!0,side:1})):p>mg&&i.add(t.state.doc.length,t.state.doc.length,Do.widget({widget:new dg(p),block:!0,side:1}));let m=r.finish(),h=i.finish();hg(m,e.state.field(pg))||e.dispatch({effects:fg.of(m)}),hg(h,t.state.field(pg))||t.dispatch({effects:fg.of(h)})}var _g=Ao.define({map:(e,t)=>t.mapPos(e)}),vg=class extends bo{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:_g.of(n)});let{side:r,sibling:i}=e.state.facet(Bh);i&&i().dispatch({effects:_g.of(yg(n,e.state.field(Uh),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function yg(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var bg=wo.define({create(e){return Do.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(_g)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>No.decorations.from(e)});function xg({margin:e=3,minSize:t=4}){return bg.init(n=>Sg(n,e,t))}function Sg(e,t,n){let r=new Oo,i=e.facet(Bh).side==`a`,a=e.field(Uh),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,Do.replace({widget:new vg(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Cg=No.styleModule.of(new Io({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),wg=No.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),Tg=new Mo,Eg=new Mo,Dg=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||$h;let t=[xo.low(eg),wg,Cg,pg,No.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(fg)))&&this.measure()})],n=[Bh.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(tg);let r=Co.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],No.editorAttributes.of({class:`cm-merge-a`}),Eg.of(n),t]}),i=[Bh.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(tg);let a=Co.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],No.editorAttributes.of({class:`cm-merge-b`}),Eg.of(i),t]});this.chunks=Gh.build(r.doc,a.doc,this.diffConf);let o=[Uh.init(()=>this.chunks),Tg.of(e.collapseUnchanged?xg(e.collapseUnchanged):[])];r=r.update({effects:Ao.appendConfig.of(o)}).state,a=a.update({effects:Ao.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new No({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new No({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),So.empty(e[0].startState.doc.length));this.chunks=t==this.a?Gh.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Gh.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Vh.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Vh.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(Bh),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Eg.reconfigure([Bh.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?tg:[]])),a.push(Eg.reconfigure([Bh.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?tg:[]]))}if(r){let t=Tg.reconfigure(e.collapseUnchanged?xg(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){gg(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=Og(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=Og(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function Og(e){let t=e.nextSibling;return e.remove(),t}var kg=new class extends Po{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Ag=xo.low(Fo({class:`cm-changeGutter`,markers:e=>e.plugin(eg)?.gutter||Lo.empty,widgetMarker:(e,t)=>t instanceof Fg?kg:null}));function jg(e){let t=typeof e.original==`string`?Eo.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||$h;return[xo.low(eg),Bg,wg,No.editorAttributes.of({class:`cm-merge-b`}),Hh.of((e,t)=>{let r=t.effects.find(e=>e.is(Mg));return r&&(e=Gh.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Gh.updateB(e,t.state.field(Ng),t.newDoc,t.changes,n)),e}),Bh.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Kg:void 0,side:`b`}),Ng.init(()=>t),e.gutter===!1?[]:Ag,e.collapseUnchanged?xg(e.collapseUnchanged):[],Uh.init(e=>Gh.build(t,e.doc,n))]}var Mg=Ao.define(),Ng=wo.define({create:()=>Eo.empty,update(e,t){for(let n of t.effects)n.is(Mg)&&(e=n.value.doc);return e}}),Pg=new WeakMap,Fg=class extends bo{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function Ig(e,t,n){let r=Pg.get(t.changes);if(r)return r;let i=Do.widget({block:!0,side:-1,widget:new Fg(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Bh),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),Lg(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Rg(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(Ng).sliceString(t.fromA,t.endA),u=a&&e.facet(Ro),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
14
14
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
15
15
|
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;To(t,{style:t=>zo(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return Pg.set(t.changes,i),i}function Lg(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Uh).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(Ng);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=So.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Mg.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Rg(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Uh).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Ng).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function zg(e){let t=new Oo;for(let n of e.field(Uh)){let r=e.facet(Bh).overrideChunk&&Hg(e,n);t.add(n.fromB,n.fromB,Ig(e,n,!!r))}return t.finish()}var Bg=wo.define({create:e=>zg(e),update(e,t){return t.state.field(Uh,!1)==t.startState.field(Uh,!1)?e:zg(t.state)},provide:e=>No.decorations.from(e)}),Vg=new WeakMap;function Hg(e,t){let n=Vg.get(t);if(n!==void 0)return n;n=null;let r=e.field(Ng),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(Do.widget({widget:new Ug(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(ag.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Vg.set(t,n),n}var Ug=class extends bo{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},Wg=new class extends Po{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Gg=Do.line({class:`cm-inlineChangedLine`});function Kg(e,t,n,r){let i=Hg(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Wg),n.add(o.from,o.from,Gg);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var qg=q({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Jg=yt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Yg(e){let t=(0,$.c)(20),{oldContent:n,newContent:r,layout:i,conflictMode:a,onResolve:o,onAbort:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),{resolvedTheme:u}=Ln(),d=(0,Q.useRef)(o),f=(0,Q.useRef)(s),[p,m]=(0,Q.useState)(null),h;t[0]!==s||t[1]!==o?(h=()=>{d.current=o,f.current=s},t[0]=s,t[1]=o,t[2]=h):h=t[2],(0,Q.useEffect)(h);let g,v;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?qg:Jg,t=[No.editable.of(!1),Co.readOnly.of(!0)],o=[Ho,_(),...t,e,No.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new No({doc:r,extensions:[Ho,_(),No.editable.of(!1),e,No.lineWrapping,jg({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),No.updateListener.of(e=>{let t=Wh(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=Wh(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new Dg({a:{doc:n,extensions:o},b:{doc:r,extensions:o},parent:c.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):l.current=new No({doc:r,extensions:[...o,jg({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},v=[n,r,i,u,a],t[3]=a,t[4]=i,t[5]=r,t[6]=n,t[7]=u,t[8]=g,t[9]=v):(g=t[8],v=t[9]),(0,Q.useEffect)(g,v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){let e=l.current;!e||!(e instanceof No)||d.current?.(e.state.doc.toString())},t[10]=y):y=t[10];let b=y,x=p===0,S=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=C):C=t[11];let w;t[12]!==x||t[13]!==a||t[14]!==S||t[15]!==s||t[16]!==o?(w=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${x?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:S}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:s,children:`Exit merge`}),o&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!x,onClick:b,children:`Save resolution`})]})]}),t[12]=x,t[13]=a,t[14]=S,t[15]=s,t[16]=o,t[17]=w):w=t[17];let T;return t[18]===w?T=t[19]:(T=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[C,w]}),t[18]=w,t[19]=T),T}function Xg(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(qa,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Zg(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Xa,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Qg(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ua,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $g(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Qg,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=X(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsx)(Ka,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(za,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(Zg,{children:[l,(0,Z.jsxs)($a,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function e_(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function t_(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wa,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function n_(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:{conflicts:[],error:`server`}}catch{return{conflicts:[],error:`network`}}}async function r_(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}`);if(!t.ok)return{ours:``,theirs:``,base:``};let n=await t.json();return{ours:n.ours??``,theirs:n.theirs??``,base:n.base??``}}catch{return{ours:``,theirs:``,base:``}}}async function i_(e,t,n){try{let r={file:e,strategy:t};return n!==void 0&&(r.content=n),(await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})).ok}catch{return!1}}var a_=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function o_(e){let t=(0,$.c)(31),{file:n,onResolve:r,onAbort:i}=e,[a,o]=(0,Q.useState)(null),s,c;if(t[0]===n?(s=t[1],c=t[2]):(s=()=>{let e=!1;return r_(n).then(t=>{e||o(t)}),()=>{e=!0}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c),a===null){let e;t[3]===i?e=t[4]:(e=e=>!e&&i(),t[3]=i,t[4]=e);let r;t[5]===n?r=t[6]:(r=(0,Z.jsx)(Za,{className:`shrink-0`,children:(0,Z.jsxs)(Ha,{children:[`Resolving: `,n]})}),t[5]=n,t[6]=r);let a;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground`,children:`Loading`}),t[7]=a):a=t[7];let o;t[8]===r?o=t[9]:(o=(0,Z.jsxs)(Ga,{className:a_,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(Qa,{open:!0,onOpenChange:e,children:o}),t[10]=e,t[11]=o,t[12]=s):s=t[12],s}let l;t[13]===i?l=t[14]:(l=e=>!e&&i(),t[13]=i,t[14]=l);let u;t[15]===n?u=t[16]:(u=(0,Z.jsxs)(Ha,{className:`text-sm font-medium`,children:[`Resolving: `,n]}),t[15]=n,t[16]=u);let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Red = your version (ours). Green = team's version (theirs). Accept each hunk to take theirs, reject to keep yours, then save.`}),t[17]=d):d=t[17];let f;t[18]===u?f=t[19]:(f=(0,Z.jsxs)(Za,{className:`px-4 pt-4 pb-2 shrink-0`,children:[u,d]}),t[18]=u,t[19]=f);let p;t[20]!==i||t[21]!==r||t[22]!==a.ours||t[23]!==a.theirs?(p=(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Z.jsx)(Yg,{oldContent:a.ours,newContent:a.theirs,layout:`unified`,conflictMode:!0,onResolve:r,onAbort:i})}),t[20]=i,t[21]=r,t[22]=a.ours,t[23]=a.theirs,t[24]=p):p=t[24];let m;t[25]!==f||t[26]!==p?(m=(0,Z.jsxs)(Ga,{className:`${a_} p-0`,children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27];let h;return t[28]!==l||t[29]!==m?(h=(0,Z.jsx)(Qa,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function s_(e){let t=(0,$.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Set,t[1]=l):l=t[1];let[u,d]=(0,Q.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[2]=f):f=t[2];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(null),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){n_().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(c_));return new Set([...e].filter(e=>!n.has(e)))})})},t[3]=_):_=t[3];let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{n&&v()},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,Q.useEffect)(y,b);let x,S;t[7]===n?(x=t[8],S=t[9]):(x=()=>hr(e=>{e.includes(`sync-status`)&&n&&v()}),S=[n],t[7]=n,t[8]=x,t[9]=S),(0,Q.useEffect)(x,S);let C,w;t[10]!==a.length||t[11]!==r||t[12]!==n||t[13]!==u.size?(w=()=>{n&&a.length>0&&u.size>=a.length&&(eo.success(`All conflicts resolved — sync resuming`),r(!1),d(new Set))},C=[n,a.length,u.size,r],t[10]=a.length,t[11]=r,t[12]=n,t[13]=u.size,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,Q.useEffect)(w,C);let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(e,t,n){m(t=>new Set([...t,e]));let r=await i_(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):eo.error(`Failed to resolve ${e}`)},t[16]=T):T=t[16];let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){g(e)},t[17]=D):D=t[17];let O=D,k;t[18]===h?k=t[19]:(k=async function(e){if(!h)return;let t=h;g(null),await E(t,`content`,e)},t[18]=h,t[19]=k);let A=k,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){g(null)},t[20]=j):j=t[20];let M=j,N;t[21]===r?N=t[22]:(N=async function(){try{(await fetch(`/api/sync/abort-merge`,{method:`POST`})).ok?eo.info(`Merge aborted — sync paused`):eo.error(`Failed to abort merge`)}catch{eo.error(`Failed to abort merge — connection error`)}r(!1),d(new Set)},t[21]=r,t[22]=N);let P=N,F=a.length,I=u.size,L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(t_,{className:`text-sm font-medium`,children:`Resolve conflicts`}),t[23]=L):L=t[23];let R;t[24]!==I||t[25]!==F?(R=F>0&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[I,` of `,F,` resolved`]}),t[24]=I,t[25]=F,t[26]=R):R=t[26];let z;t[27]===R?z=t[28]:(z=(0,Z.jsxs)(e_,{className:`px-4 py-3 border-b shrink-0`,children:[L,R]}),t[27]=R,t[28]=z);let B;t[29]!==a||t[30]!==s||t[31]!==u||t[32]!==p?(B=(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar`,children:s?(0,Z.jsxs)(`div`,{className:`px-4 py-6 text-sm text-center space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-destructive`,children:s===`network`?`Could not reach the sync server — check your connection.`:`Sync server error — try again in a moment.`}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,onClick:v,children:`Retry`})]}):a.length===0?(0,Z.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground text-center`,children:`No conflicts found.`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:a.map(e=>{let t=u.has(e.file),n=p.has(e.file),r=e.file.split(`/`).pop()??e.file;return(0,Z.jsxs)(`li`,{className:`px-4 py-3 ${t?`opacity-50`:``}`,children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium truncate mb-2`,title:e.file,children:[t?`✓ `:``,r]}),!t&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`mine`),children:`Keep my version`}),(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`theirs`),children:`Keep team's version`}),(0,Z.jsx)(Y,{variant:`ghost`,size:`xs`,disabled:n,onClick:()=>O(e.file),children:`Resolve manually`})]})]},e.file)})})}),t[29]=a,t[30]=s,t[31]=u,t[32]=p,t[33]=B):B=t[33];let V;t[34]===P?V=t[35]:(V=(0,Z.jsx)(`div`,{className:`px-4 py-3 border-t shrink-0`,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:P,children:`Exit merge`})}),t[34]=P,t[35]=V);let H;t[36]!==z||t[37]!==B||t[38]!==V?(H=(0,Z.jsxs)($g,{side:`right`,className:`w-80 sm:w-96 flex flex-col gap-0 p-0`,children:[z,B,V]}),t[36]=z,t[37]=B,t[38]=V,t[39]=H):H=t[39];let U;t[40]!==r||t[41]!==n||t[42]!==H?(U=(0,Z.jsx)(Xg,{open:n,onOpenChange:r,children:H}),t[40]=r,t[41]=n,t[42]=H,t[43]=U):U=t[43];let W;t[44]!==A||t[45]!==h?(W=h&&(0,Z.jsx)(o_,{file:h,onResolve:e=>void A(e),onAbort:M}),t[44]=A,t[45]=h,t[46]=W):W=t[46];let G;return t[47]!==U||t[48]!==W?(G=(0,Z.jsxs)(Z.Fragment,{children:[U,W]}),t[47]=U,t[48]=W,t[49]=G):G=t[49],G}function c_(e){return e.file}var l_=5;async function u_(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=Sn.safeParse(n);throw e.success?Error(e.data.title):new ue(`Failed to parse backlinks error response (HTTP ${t.status})`,{status:t.status})}let r=pn.safeParse(n);if(!r.success)throw new ue(`Backlinks response did not match expected shape.`,{status:t.status});return r.data.backlinks}async function d_(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=Sn.safeParse(n);throw e.success?Error(e.data.title):new ue(`Failed to parse forward-links error response (HTTP ${t.status})`,{status:t.status})}let r=Nr.safeParse(n);if(!r.success)throw new ue(`Forward-links response did not match expected shape.`,{status:t.status});return r.data.forwardLinks}function f_(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function p_(e){window.location.hash=or(e)}function m_(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(L,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(Jt,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(qt,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(V,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function h_(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=l_)return null;let a=n-l_,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(L,{className:`size-3`}):(0,Z.jsx)(P,{className:`size-3`}),t[0]=r,t[1]=o);let s=r?`Show fewer`:`Show ${a} more`,c;return t[2]!==r||t[3]!==i||t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function g_(e){let t=(0,$.c)(38),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m,hoverAction:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=X(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsx)(`span`,{className:`sr-only`,children:` (opens in new tab)`}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:X(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsxs)(ho,{children:[(0,Z.jsx)(fo,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":h.tooltip,disabled:h.disabled,className:`relative z-10 shrink-0 cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground group-hover:opacity-100`,onClick:h.onClick,children:h.icon})}),(0,Z.jsx)(po,{side:`top`,children:h.tooltip})]}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(fo,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(po,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(ho,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function __(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=Tr(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>u_(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==a||t[5]!==i?(c=!a&&i.has(n),t[3]=n,t[4]=a,t[5]=i,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=It(l),p;t[11]===u?p=t[12]:(p=u===void 0?[]:u,t[11]=u,t[12]=p);let m=p,[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(n);_!==n&&(v(n),g(!1));let y;t[13]!==m||t[14]!==h?(y=h?m:m.slice(0,l_),t[13]=m,t[14]=h,t[15]=y):y=t[15];let b=y,x;t[16]!==m.length||t[17]!==d?(x=(0,Z.jsx)(m_,{title:`Backlinks`,count:m.length,isLoading:d}),t[16]=m.length,t[17]=d,t[18]=x):x=t[18];let S;t[19]!==m.length||t[20]!==f||t[21]!==h||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==b?(S=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Pt,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):m.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Vt,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:b.map((e,t)=>{let n=Ia(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(g_,{icon:(0,Z.jsx)(re,{className:`size-3.5`}),title:e.title,path:f_(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:or(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(h_,{total:m.length,expanded:h,onToggle:()=>g(v_)})]}),t[19]=m.length,t[20]=f,t[21]=h,t[22]=r,t[23]=d,t[24]=i,t[25]=b,t[26]=S):S=t[26];let C;t[27]!==d||t[28]!==S?(C=(0,Z.jsx)(I,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:S})}),t[27]=d,t[28]=S,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==x?(w=(0,Z.jsxs)(N,{defaultOpen:!0,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32],w}function v_(e){return!e}function y_(e){let t=(0,$.c)(42),{docName:n}=e,{addPage:r,folderPaths:i,pages:a,pagesBySlug:o,loading:s}=Tr(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>d_(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==a||t[5]!==s?(u=!s&&a.has(n),t[3]=n,t[4]=a,t[5]=s,t[6]=u):u=t[6];let f;t[7]!==c||t[8]!==l||t[9]!==u?(f={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=It(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(n);S!==n&&(C(n),x(!1),y(null));let w;t[13]!==b||t[14]!==_?(w=b?_:_.slice(0,l_),t[13]=b,t[14]=_,t[15]=w):w=t[15];let T=w,E;t[16]!==r||t[17]!==v?(E=async function(e,t){if(!v){y(t);try{await G(e,{addPage:r,onCreated:p_}),y(null)}catch(e){let t=e;eo.error(t instanceof Error?t.message:`Failed to create page`),y(null)}}},t[16]=r,t[17]=v,t[18]=E):E=t[18];let D=E,O;t[19]!==v||t[20]!==i||t[21]!==D||t[22]!==a||t[23]!==o||t[24]!==s?(O=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(g_,{icon:(0,Z.jsx)(Fa,{className:`size-3.5`}),rowTooltip:`Opens in a new tab`,title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let t=d(e.docName,{pages:a,folderPaths:i,pagesBySlug:o}),n=!s&&t.kind===`create`,r=!s&&t.kind===`navigate`&&t.displayState===`folder`,c=f_(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,f=or(t.kind===`navigate`?t.hashDocName:e.docName,e.anchor);if(n&&t.kind===`create`){let n={initialDir:t.initialDir,suggestedName:t.suggestedName};return(0,Z.jsx)(g_,{icon:(0,Z.jsx)(gn,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:v===u?`Creating page`:`Missing page — click to create`,ariaLabel:v===u?`Creating page: ${e.title}.`:`Missing page: ${e.title}. Click to create.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:v!==null,onClick:()=>void D(n,u)},u)}if(r&&t.kind===`navigate`){let n=wt(t);return(0,Z.jsx)(g_,{icon:(0,Z.jsx)(Ns,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:`Folder target: ${e.title}. Click to open the overview.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:f,hoverAction:{icon:(0,Z.jsx)(Ri,{className:`size-3.5`}),tooltip:v===u?`Creating index note`:`Create index note`,disabled:v!==null||n===null,onClick:()=>{n&&D(n,u)}}},u)}return(0,Z.jsx)(g_,{icon:(0,Z.jsx)(re,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:f},u)},t[19]=v,t[20]=i,t[21]=D,t[22]=a,t[23]=o,t[24]=s,t[25]=O):O=t[25];let k=O,A;t[26]!==m||t[27]!==_.length?(A=(0,Z.jsx)(m_,{title:`Outgoing`,count:_.length,isLoading:m}),t[26]=m,t[27]=_.length,t[28]=A):A=t[28];let j;t[29]!==h||t[30]!==b||t[31]!==m||t[32]!==_.length||t[33]!==k||t[34]!==T?(j=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Pt,{children:h instanceof Error?h.message:`Failed to load outgoing links`})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Vt,{children:`This page doesn't link to anything yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:T.map(k)}),(0,Z.jsx)(h_,{total:_.length,expanded:b,onToggle:()=>x(b_)})]}),t[29]=h,t[30]=b,t[31]=m,t[32]=_.length,t[33]=k,t[34]=T,t[35]=j):j=t[35];let M;t[36]!==m||t[37]!==j?(M=(0,Z.jsx)(I,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:j})}),t[36]=m,t[37]=j,t[38]=M):M=t[38];let P;return t[39]!==A||t[40]!==M?(P=(0,Z.jsxs)(N,{defaultOpen:!0,children:[A,M]}),t[39]=A,t[40]=M,t[41]=P):P=t[41],P}function b_(e){return!e}function x_(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(y_,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ba,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(__,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Gt,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(Yt,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var S_=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends S_{};function C_(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function w_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function T_(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function E_(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function D_(e,t){return T_(e,t,``)}function O_(e,t){return E_(e,t,``)}function k_(e,t){return t.slice(0,A_(e,t))}function A_(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function j_(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function M_(e,t){if(t)return P_(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function N_(e,t){if(t)return P_(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function P_(e,t){if(!t)return[N_(e),M_(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=j_(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var F_=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,I_=RegExp(`[${F_}]+|\\s+|[^${F_}]`,`ug`);new class extends S_{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=j_(e,r)}else n=e.match(I_)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&L_(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&L_(n,i,r,null,t.intlSegmenter),e}};function L_(e,t,n,r,i){if(t&&n){let[a,o]=P_(t.value,i),[s,c]=P_(n.value,i);if(e){let r=C_(a,s);e.value=E_(e.value,s,r),t.value=D_(t.value,r),n.value=D_(n.value,r)}if(r){let e=w_(o,c);r.value=T_(r.value,c,e),t.value=O_(t.value,e),n.value=O_(n.value,e)}}else if(n){if(e){let e=N_(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=N_(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=N_(r.value,i),[a,o]=P_(t.value,i),s=C_(n,a);t.value=D_(t.value,s);let c=w_(D_(n,s),o);t.value=O_(t.value,c),r.value=T_(r.value,n,c),e.value=E_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=N_(r.value,i),n=k_(M_(t.value,i),e);t.value=O_(t.value,n)}else if(e){let n=k_(M_(e.value,i),N_(t.value,i));t.value=D_(t.value,n)}}new class extends S_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${F_}]+|[^\\S\\n\\r]+|[^${F_}]`,`ug`);return e.match(t)||[]}};var R_=new class extends S_{constructor(){super(...arguments),this.tokenize=B_}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
16
16
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|