heyiam 0.3.3 → 0.3.4

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.
@@ -9,7 +9,7 @@ Error generating stack: `+e.message+`
9
9
  `).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(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=Qt(``+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`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(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=Qt(``+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`:Q(`beforetoggle`,e),Q(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(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=Xt.get(n)||n,Ot(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Jt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(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`:Q(`error`,e),Q(`load`,e);var r=!1,a=!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`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,o,s,n,null)}}a&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=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(i(137,t));break;default:$(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:$(e,t,s,c,n,null)}Wt(e,r,a,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:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)Q(_d[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`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(i(137,t));default:$(e,t,u,r,n,null)}return;default:if(Yt(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&&$(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 a=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)||$(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`:a=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(i(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,o,a);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)||$(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&$(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&$(e,t,s,a,r,o)}Ut(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:$(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:$(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)&&$(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(i(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(Yt(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)&&$(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||$(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[pt]||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),mt(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[pt])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(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(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=I.d;I.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=bu();return e||t}function yf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?Es(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=Rt(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),yt(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="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({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),yt(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="`+Rt(r)+`"][href="`+Rt(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=h({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),yt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=vt(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=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);yt(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=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(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=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(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 a=(a=se.current)?gf(a):null;if(!a)throw Error(i(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=vt(a).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=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.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(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(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=vt(a).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(i(444,e))}}function Af(e){return`href="`+Rt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},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),yt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Rt(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~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(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),(a=e.querySelector(Ff(o)))?(t.instance=a,yt(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(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[pt]||a[ot]||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,yt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),yt(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:C,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_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=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(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=si(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ba(a),e}function tp(e){return e?(e=ai,e):ai}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ha(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ua(e,r,t),n!==null&&(hu(n,e,t),Wa(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=ni(e,67108864);t!==null&&hu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=pu();t=tt(t);var n=ni(e,t);n!==null&&hu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=2,up(e,t,n,r)}finally{I.p=a,F.T=i}}function lp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=8,up(e,t,n,r)}finally{I.p=a,F.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)wd(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=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}rd(a),!(K&6)&&(tu=Te()+500,id(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&hu(s,a,2),bu(),ip(a,2)}if(a=dp(r),a===null&&wd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function dp(e){return e=tn(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ht(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je: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=gt(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=ht(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,it(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(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);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(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=gt(n);a!==null&&(e.splice(t,3),t-=3,ws(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[st]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||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(i(409));var n=t.current;np(n,pu(),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),bu(),t[ct]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();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.4`)throw Error(i(527,Lp,`19.2.4`));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Pe=zp.inject(Rp),Fe=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=qs,s=Js,c=Ys;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=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,o,s,c,Pp),e[ct]=t.current,Sd(e),new Fp(t)}})),g=o(((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=h()})),_=c(u(),1),v=g(),y=`modulepreload`,b=function(e){return`/`+e},x={},S=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=b(t,n),t in x)return;x[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:y,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},C=`popstate`;function w(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function T(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return A(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:j(t)}return N(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function O(){return Math.random().toString(36).substring(2,10)}function k(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function A(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?M(t):t,state:n,key:t&&t.key||r||O(),unstable_mask:i}}function j({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function M(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function N(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=w(e)?e:A(h.location,e,t);n&&n(r,e),l=u()+1;let d=k(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=w(e)?e:A(h.location,e,t);n&&n(r,e),l=u();let i=k(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return P(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(C,d),c=e,()=>{i.removeEventListener(C,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function P(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),E(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:j(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function ee(e,t,n=`/`){return F(e,t,n,!1)}function F(e,t,n,r){let i=he((typeof t==`string`?M(t):t).pathname||`/`,n);if(i==null)return null;let a=te(e);ne(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=me(i);o=de(a[e],t,r)}return o}function I(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function te(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Ce([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),te(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of L(e.path))a(e,t,!0,n)}),t}function L(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=L(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ne(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var re=/^:[\w-]+$/,ie=3,R=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=R),n.filter(e=>!ce(e)).reduce((e,t)=>e+(re.test(t)?ie:t===``?ae:oe),r)}function ue(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=fe({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=fe({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Ce([a,u.pathname]),pathnameBase:we(Ce([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Ce([a,u.pathnameBase]))}return o}function fe(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=pe(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function pe(e,t=!1,n=!0){D(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function he(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?M(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:Te(r),hash:Ee(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=M(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ce=e=>e.join(`/`).replace(/\/\/+/g,`/`),we=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Te=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ee=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,De=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Oe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ke(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Ae=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function je(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ae)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=he(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Me=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Me);var Ne=[`GET`,...Me];new Set(Ne);var Pe=_.createContext(null);Pe.displayName=`DataRouter`;var Fe=_.createContext(null);Fe.displayName=`DataRouterState`;var Ie=_.createContext(!1),Le=_.createContext({isTransitioning:!1});Le.displayName=`ViewTransition`;var Re=_.createContext(new Map);Re.displayName=`Fetchers`;var ze=_.createContext(null);ze.displayName=`Await`;var Be=_.createContext(null);Be.displayName=`Navigation`;var Ve=_.createContext(null);Ve.displayName=`Location`;var He=_.createContext({outlet:null,matches:[],isDataRoute:!1});He.displayName=`Route`;var Ue=_.createContext(null);Ue.displayName=`RouteError`;var We=`REACT_ROUTER_ERROR`,Ge=`REDIRECT`,Ke=`ROUTE_ERROR_RESPONSE`;function qe(e){if(e.startsWith(`${We}:${Ge}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Je(e){if(e.startsWith(`${We}:${Ke}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new De(t.status,t.statusText,t.data)}catch{}}function Ye(e,{relative:t}={}){E(Xe(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=_.useContext(Be),{hash:i,pathname:a,search:o}=rt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Ce([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Xe(){return _.useContext(Ve)!=null}function Ze(){return E(Xe(),`useLocation() may be used only in the context of a <Router> component.`),_.useContext(Ve).location}var Qe=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function $e(e){_.useContext(Be).static||_.useLayoutEffect(e)}function et(){let{isDataRoute:e}=_.useContext(He);return e?St():tt()}function tt(){E(Xe(),`useNavigate() may be used only in the context of a <Router> component.`);let e=_.useContext(Pe),{basename:t,navigator:n}=_.useContext(Be),{matches:r}=_.useContext(He),{pathname:i}=Ze(),a=JSON.stringify(xe(r)),o=_.useRef(!1);return $e(()=>{o.current=!0}),_.useCallback((r,s={})=>{if(D(o.current,Qe),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Ce([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}_.createContext(null);function nt(){let{matches:e}=_.useContext(He),t=e[e.length-1];return t?t.params:{}}function rt(e,{relative:t}={}){let{matches:n}=_.useContext(He),{pathname:r}=Ze(),i=JSON.stringify(xe(n));return _.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function it(e,t){return at(e,t)}function at(e,t,n){E(Xe(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=_.useContext(Be),{matches:i}=_.useContext(He),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;wt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
10
 
11
11
  Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Ze(),d;if(t){let e=typeof t==`string`?M(t):t;E(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=ee(e,{pathname:p});D(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),D(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ft(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ce([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ce([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?_.createElement(Ve.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function ot(){let e=xt(),t=Oe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=_.createElement(_.Fragment,null,_.createElement(`p`,null,`💿 Hey developer 👋`),_.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,_.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,_.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),_.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:i},n):null,o)}var st=_.createElement(ot,null),ct=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Je(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:_.createElement(He.Provider,{value:this.props.routeContext},_.createElement(Ue.Provider,{value:e,children:this.props.component}));return this.context?_.createElement(ut,{error:e},t):t}};ct.contextType=Ie;var lt=new WeakMap;function ut({children:e,error:t}){let{basename:n}=_.useContext(Be);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=qe(t.digest);if(e){let r=lt.get(t);if(r)throw r;let i=je(e.location,n);if(Ae&&!lt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw lt.set(t,n),n}return _.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function dt({routeContext:e,match:t,children:n}){let r=_.useContext(Pe);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(He.Provider,{value:e},n)}function ft(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:ke(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||st,o&&(s<0&&c===0?(wt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?_.createElement(n.route.Component,null):n.route.element?n.route.element:e,_.createElement(dt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?_.createElement(ct,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function pt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mt(e){let t=_.useContext(Pe);return E(t,pt(e)),t}function ht(e){let t=_.useContext(Fe);return E(t,pt(e)),t}function gt(e){let t=_.useContext(He);return E(t,pt(e)),t}function _t(e){let t=gt(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vt(){return _t(`useRouteId`)}function yt(){return ht(`useNavigation`).navigation}function bt(){let{matches:e,loaderData:t}=ht(`useMatches`);return _.useMemo(()=>e.map(e=>I(e,t)),[e,t])}function xt(){let e=_.useContext(Ue),t=ht(`useRouteError`),n=_t(`useRouteError`);return e===void 0?t.errors?.[n]:e}function St(){let{router:e}=mt(`useNavigate`),t=_t(`useNavigate`),n=_.useRef(!1);return $e(()=>{n.current=!0}),_.useCallback(async(r,i={})=>{D(n.current,Qe),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ct={};function wt(e,t,n){!t&&!Ct[e]&&(Ct[e]=!0,D(!1,n))}_.useOptimistic,_.memo(Tt);function Tt({routes:e,future:t,state:n,isStatic:r,onError:i}){return at(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Et(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Dt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){E(!Xe(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=_.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=M(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=_.useMemo(()=>{let e=he(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return D(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:_.createElement(Be.Provider,{value:c},_.createElement(Ve.Provider,{children:t,value:h}))}function Ot({children:e,location:t}){return it(kt(e),t)}_.Component;function kt(e,t=[]){let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,kt(e.props.children,i));return}E(e.type===Et,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=kt(e.props.children,i)),n.push(a)}),n}var At=`get`,jt=`application/x-www-form-urlencoded`;function Mt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Nt(e){return Mt(e)&&e.tagName.toLowerCase()===`button`}function Pt(e){return Mt(e)&&e.tagName.toLowerCase()===`form`}function Ft(e){return Mt(e)&&e.tagName.toLowerCase()===`input`}function It(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lt(e,t){return e.button===0&&(!t||t===`_self`)&&!It(e)}function Rt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function zt(e,t){let n=Rt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Bt=null;function Vt(){if(Bt===null)try{new FormData(document.createElement(`form`),0),Bt=!1}catch{Bt=!0}return Bt}var Ht=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ut(e){return e!=null&&!Ht.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jt}"`),null):e}function Wt(e,t){let n,r,i,a,o;if(Pt(e)){let o=e.getAttribute(`action`);r=o?he(o,t):null,n=e.getAttribute(`method`)||At,i=Ut(e.getAttribute(`enctype`))||jt,a=new FormData(e)}else if(Nt(e)||Ft(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?he(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||At,i=Ut(e.getAttribute(`formenctype`))||Ut(o.getAttribute(`enctype`))||jt,a=new FormData(o,e),!Vt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Mt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=At,r=null,i=jt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Gt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Kt=/[&><\u2028\u2029]/g;function qt(e){return e.replace(Kt,e=>Gt[e])}function Jt(e,t){if(e===!1||e==null)throw Error(t)}function Yt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&he(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function Xt(e,t){if(e.id in t)return t[e.id];try{let n=await S(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Zt(e){return e!=null&&typeof e.page==`string`}function Qt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function $t(e,t,n){return an((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Xt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Qt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function en(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function tn(e,t,{includeHydrateFallback:n}={}){return nn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function nn(e){return[...new Set(e)]}function rn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function an(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Zt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(rn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function on(){let e=_.useContext(Pe);return Jt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function sn(){let e=_.useContext(Fe);return Jt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var cn=_.createContext(void 0);cn.displayName=`FrameworkContext`;function ln(){let e=_.useContext(cn);return Jt(e,`You must render this element inside a <HydratedRouter> element`),e}function un(e,t){let n=_.useContext(cn),[r,i]=_.useState(!1),[a,o]=_.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=_.useRef(null);_.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),_.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:dn(s,p),onBlur:dn(c,m),onMouseEnter:dn(l,p),onMouseLeave:dn(u,m),onTouchStart:dn(d,p)}]:[a,f,{}]:[!1,f,{}]}function dn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function fn({page:e,...t}){let{router:n}=on(),r=_.useMemo(()=>ee(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(mn,{page:e,matches:r,...t}):null}function pn(e){let{manifest:t,routeModules:n}=ln(),[r,i]=_.useState([]);return _.useEffect(()=>{let r=!1;return $t(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function mn({page:e,matches:t,...n}){let r=Ze(),{future:i,manifest:a,routeModules:o}=ln(),{basename:s}=on(),{loaderData:c,matches:l}=sn(),u=_.useMemo(()=>en(e,t,l,a,r,`data`),[e,t,l,a,r]),d=_.useMemo(()=>en(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Yt(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=_.useMemo(()=>tn(d,a),[d,a]),m=pn(d);return _.createElement(_.Fragment,null,f.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>_.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>_.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function hn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}_.Component;var gn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{gn&&(window.__reactRouterVersion=`7.13.2`)}catch{}function _n({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=_.useRef();i.current??=T({window:r,v5Compat:!0});let a=i.current,[o,s]=_.useState({action:a.action,location:a.location}),c=_.useCallback(e=>{n===!1?s(e):_.startTransition(()=>s(e))},[n]);return _.useLayoutEffect(()=>a.listen(c),[a,c]),_.createElement(Dt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function vn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=_.useState({action:n.action,location:n.location}),o=_.useCallback(e=>{r===!1?a(e):_.startTransition(()=>a(e))},[r]);return _.useLayoutEffect(()=>n.listen(o),[n,o]),_.createElement(Dt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}vn.displayName=`unstable_HistoryRouter`;var yn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bn=_.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:v}=_.useContext(Be),y=typeof l==`string`&&yn.test(l),b=je(l,h);l=b.to;let x=Ye(l,{relative:r}),S=Ze(),C=null;if(o){let e=Se(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Ce([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=un(n,p),D=Dn(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:v});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=_.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:hn(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?_.createElement(_.Fragment,null,A,_.createElement(fn,{page:x})):A});bn.displayName=`Link`;var xn=_.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=rt(a,{relative:c.relative}),d=Ze(),f=_.useContext(Fe),{navigator:p,basename:m}=_.useContext(Be),h=f!=null&&Rn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=he(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=v===g||!r&&v.startsWith(g)&&v.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return _.createElement(bn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});xn.displayName=`NavLink`;var Sn=_.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=At,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=_.useContext(Be),g=jn(),v=Mn(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&yn.test(s);return _.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?_.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Sn.displayName=`Form`;function Cn({getKey:e,storageKey:t,...n}){let r=_.useContext(cn),{basename:i}=_.useContext(Be),a=Ze(),o=bt();In({getKey:e,storageKey:t});let s=_.useMemo(()=>{if(!r||!e)return null;let t=Fn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return _.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${qt(JSON.stringify(t||Nn))}, ${qt(JSON.stringify(s))})`}})}Cn.displayName=`ScrollRestoration`;function wn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tn(e){let t=_.useContext(Pe);return E(t,wn(e)),t}function En(e){let t=_.useContext(Fe);return E(t,wn(e)),t}function Dn(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=et(),d=Ze(),f=rt(e,{relative:o});return _.useCallback(p=>{if(Lt(p,t)){p.preventDefault();let t=n===void 0?j(d)===j(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?_.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function On(e){D(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(Rt(e)),n=_.useRef(!1),r=Ze(),i=_.useMemo(()=>zt(r.search,n.current?null:t.current),[r.search]),a=et();return[i,_.useCallback((e,t)=>{let r=Rt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var kn=0,An=()=>`__${String(++kn)}__`;function jn(){let{router:e}=Tn(`useSubmit`),{basename:t}=_.useContext(Be),n=vt(),r=e.fetch,i=e.navigate;return _.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Wt(e,t);a.navigate===!1?await r(a.fetcherKey||An(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Mn(e,{relative:t}={}){let{basename:n}=_.useContext(Be),r=_.useContext(He);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...rt(e||`.`,{relative:t})},o=Ze();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Ce([n,a.pathname])),j(a)}var Nn=`react-router-scroll-positions`,Pn={};function Fn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:he(e.pathname,n)||e.pathname},t)),i??=e.key,i}function In({getKey:e,storageKey:t}={}){let{router:n}=Tn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=En(`useScrollRestoration`),{basename:a}=_.useContext(Be),o=Ze(),s=bt(),c=yt();_.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ln(_.useCallback(()=>{if(c.state===`idle`){let t=Fn(o,s,a,e);Pn[t]=window.scrollY}try{sessionStorage.setItem(t||Nn,JSON.stringify(Pn))}catch(e){D(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(_.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Nn);e&&(Pn=JSON.parse(e))}catch{}},[t]),_.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Pn,()=>window.scrollY,e?(t,n)=>Fn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),_.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{D(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Ln(e,t){let{capture:n}=t||{};_.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Rn(e,{relative:t}={}){let n=_.useContext(Le);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Tn(`useViewTransitionState`),i=rt(e,{relative:t});if(!n.isTransitioning)return!1;let a=he(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=he(n.nextLocation.pathname,r)||n.nextLocation.pathname;return fe(i.pathname,o)!=null||fe(i.pathname,a)!=null}var zn=`/api`;function Bn(e){return encodeURIComponent(e)}async function Vn(e){let t=await fetch(`${zn}${e}`);if(!t.ok)throw Error(`GET ${e} failed: ${t.status}`);return t.json()}async function Hn(e,t){let n=await fetch(`${zn}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)});if(!n.ok){let t=await n.json().catch(()=>({error:{message:`POST ${e} failed`}}));throw Error(t.error?.message??`POST ${e} failed: ${n.status}`)}return n.json()}async function Un(e,t){let n=await fetch(`${zn}${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)});if(!n.ok){let t=await n.json().catch(()=>({error:{message:`PUT ${e} failed`}}));throw Error(t.error?.message??`PUT ${e} failed: ${n.status}`)}return n.json()}async function Wn(e,t){let n=await fetch(`${zn}${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)});if(!n.ok){let t=await n.json().catch(()=>({error:{message:`PATCH ${e} failed`}}));throw Error(t.error?.message??`PATCH ${e} failed: ${n.status}`)}return n.json()}async function Gn(e){let t=await fetch(`${zn}${e}`,{method:`DELETE`});if(!t.ok){let n=await t.json().catch(()=>({error:{message:`DELETE ${e} failed`}}));throw Error(n.error?.message??`DELETE ${e} failed: ${t.status}`)}return t.json()}function Kn(e,t,n){let r=new AbortController;return fetch(`${zn}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:r.signal}).then(async e=>{if(e.status===401){n({type:`error`,message:`AUTH_REQUIRED`});return}if(!e.ok){n({type:`error`,message:(await e.json().catch(()=>({error:{message:`Request failed`}}))).error?.message??`Request failed`});return}let t=e.body?.getReader();if(!t){n({type:`error`,message:`No response stream`});return}let r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await t.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
12
- `);i=o.pop()??``;for(let e of o){if(!e.startsWith(`data: `))continue;let t=e.slice(6).trim();if(t)try{n(JSON.parse(t))}catch{}}}}).catch(e=>{e.name!==`AbortError`&&n({type:`error`,message:e.message})}),r}async function qn(){return(await Vn(`/projects`)).projects}async function Jn(e){return(await Vn(`/projects/${Bn(e)}/sessions`)).sessions}async function Yn(e,t){return(await Vn(`/projects/${Bn(e)}/sessions/${Bn(t)}`)).session}async function Xn(){return Vn(`/source-audit`)}async function Zn(){return Vn(`/archive/stats`)}async function Qn(){return Vn(`/local-data`)}async function $n(){return Hn(`/archive/sync`)}async function er(){let e=await fetch(`${zn}/archive/export`);if(!e.ok){let t=await e.json().catch(()=>({error:`Export failed`}));throw Error(t.error??`Export failed: ${e.status}`)}let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`heyiam-archive.tar.gz`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}async function tr(e){return Vn(`/projects/${Bn(e)}/detail`)}async function nr(e){return Vn(`/projects/${Bn(e)}/boundaries`)}async function rr(e,t){return Un(`/projects/${Bn(e)}/boundaries`,t)}async function ir(e,t){return Wn(`/sessions/${Bn(e)}/enhanced`,t)}async function ar(e,t){return Hn(`/projects/${Bn(e)}/sessions/${Bn(t)}/enhance`)}function or(e,t){return Kn(`/projects/${Bn(e)}/triage`,{},t)}function sr(e,t,n,r,i){return Kn(`/projects/${Bn(e)}/enhance-project`,{selectedSessionIds:t,skippedSessions:n,force:i},r)}async function cr(e,t,n,r){return Hn(`/projects/${Bn(e)}/refine-narrative`,{draftNarrative:t,draftTimeline:n,answers:r})}function lr(e,t,n){return Kn(`/projects/${Bn(e)}/upload`,t,n)}async function ur(){try{return await Vn(`/settings/api-key`)}catch{return{hasKey:!1}}}async function dr(e){await Hn(`/settings/api-key`,{apiKey:e})}async function fr(){try{return(await Vn(`/templates`)).templates}catch{return[]}}async function pr(){try{return await Vn(`/settings/theme`)}catch{return{template:`editorial`}}}async function mr(e){await Hn(`/settings/theme`,{template:e})}async function hr(){try{return await Vn(`/portfolio`)}catch{return{}}}async function gr(e){await Hn(`/portfolio`,e)}async function _r(){try{return await Vn(`/portfolio/state`)}catch{return{targets:{}}}}async function vr(e){if(e!==`heyi.am`)throw Error(`Unsupported publish target: ${e}`);return Hn(`/portfolio/upload`)}async function yr(){let e=await fetch(`${zn}/portfolio/export`,{method:`POST`,headers:{"Content-Type":`application/json`}});if(!e.ok){let t=`Portfolio export failed: ${e.status}`;try{let n=await e.json();n?.error?.message&&(t=n.error.message)}catch{}throw Error(t)}let t=await e.blob(),n=URL.createObjectURL(t),r=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`portfolio.zip`,i=document.createElement(`a`);return i.href=n,i.download=r,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(n),{ok:!0,filename:r}}var br=class extends Error{code;status;constructor(e,t,n){super(t),this.code=e,this.status=n}};async function xr(e,t){let n=await fetch(`${zn}${e}`,{headers:{"Content-Type":`application/json`},...t});if(!n.ok){let t=`HTTP_${n.status}`,r=`${e} failed: ${n.status}`;try{let e=await n.json();e?.error?.code&&(t=e.error.code),e?.error?.message&&(r=e.error.message)}catch{}throw new br(t,r,n.status)}return await n.json()}async function Sr(){return xr(`/github/device-code`,{method:`POST`})}async function Cr(e){return xr(`/github/poll-token`,{method:`POST`,body:JSON.stringify(e)})}async function wr(){return(await xr(`/github/account`)).account}async function Tr(){await xr(`/github/account`,{method:`DELETE`})}async function Er(){return(await xr(`/github/repos`)).repos}async function Dr(e){return xr(`/github/publish`,{method:`POST`,body:JSON.stringify(e)})}async function Or(e){return Gn(`/projects/${Bn(e)}/remote`)}async function kr(e,t){return Gn(`/projects/${Bn(e)}/sessions/${Bn(t)}/remote`)}async function Ar(e){return Vn(`/sessions/${Bn(e)}/transcript-setting`)}async function jr(e,t){return Un(`/sessions/${Bn(e)}/transcript-setting`,{included:t})}async function Mr(e){try{return await Vn(e)}catch{return null}}function Nr(e){return Mr(`/projects/${encodeURIComponent(e)}/render`)}function Pr(e){return Mr(`/sessions/${encodeURIComponent(e)}/render`)}function Fr(e){if(!e.username)return e;let t=e.username.toLowerCase();return t===e.username?e:{...e,username:t}}async function Ir(){try{return Fr(await Vn(`/auth/status`))}catch{return{authenticated:!1}}}async function Lr(e,t){let n=new URLSearchParams;return e&&n.set(`q`,e),t?.source&&n.set(`source`,t.source),t?.project&&n.set(`project`,t.project),t?.skill&&n.set(`skill`,t.skill),Vn(`/search?${n.toString()}`)}async function Rr(e){return(await Vn(`/sessions/${Bn(e)}`)).session}async function zr(e,t=`summary`){return Vn(`/sessions/${Bn(e)}/context?format=${t}`)}async function Br(e){return Vn(`/sessions/${Bn(e)}/transcript`)}async function Vr(e,t,n,r){try{return await Hn(`/projects/${Bn(e)}/enhance-save`,{selectedSessionIds:t,result:n,...r}),!0}catch{return!1}}async function Hr(e){try{return await Vn(`/projects/${Bn(e)}/git-remote`)}catch{return{url:null}}}async function Ur(e,t,n){return Hn(`/projects/${Bn(e)}/screenshot-capture`,{url:n,slug:t})}async function Wr(e){return Fr(await Hn(`/auth/poll`,{device_code:e}))}async function Gr(e){return Vn(`/auth/check-username?username=${encodeURIComponent(e)}`)}async function Kr(e){return Hn(`/auth/signup`,{username:e})}async function qr(){return Hn(`/auth/login`)}async function Jr(){await Hn(`/auth/logout`)}async function Yr(){return Vn(`/dashboard`)}async function Xr(){await Hn(`/onboarding/complete`)}function Zr(e){let t=new EventSource(`${zn}/sync/progress`);return t.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},t.onerror=()=>{t.close()},()=>t.close()}var Qr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),z=o(((e,t)=>{t.exports=Qr()}))(),$r={default:`bg-surface-low text-on-surface-variant`,green:`bg-green-bg text-green`,amber:`bg-amber-bg text-amber`,violet:`bg-violet-bg text-violet`,primary:`bg-primary/10 text-primary`};function ei({variant:e=`default`,children:t}){return(0,z.jsx)(`span`,{className:`font-mono text-[11px] leading-tight py-0.5 px-2 rounded-sm ${$r[e]}`,children:t})}function ti({value:e,onChange:t,onSubmit:n,compact:r=!1,placeholder:i=`Search sessions...`,autoFocus:a=!1}){let o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{function e(e){e.key===`/`&&!e.ctrlKey&&!e.metaKey&&document.activeElement?.tagName!==`INPUT`&&document.activeElement?.tagName!==`TEXTAREA`&&(e.preventDefault(),o.current?.focus())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsxs)(`svg`,{className:`absolute top-1/2 -translate-y-1/2 text-on-surface-variant ${r?`left-2 w-3.5 h-3.5`:`left-3 w-4 h-4`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,z.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,z.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,z.jsx)(`input`,{ref:o,type:`text`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n&&n(),e.key===`Escape`&&o.current?.blur()},placeholder:i,autoFocus:a,className:[`w-full bg-surface-low border border-ghost rounded-md font-mono text-on-surface placeholder:text-outline transition-colors`,`focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20`,r?`text-xs pl-7 pr-2 py-1`:`text-sm pl-9 pr-3 py-2`].join(` `)}),!r&&(0,z.jsx)(`kbd`,{className:`absolute right-3 top-1/2 -translate-y-1/2 font-mono text-[10px] text-outline bg-surface-mid px-1.5 py-0.5 rounded-sm border border-ghost`,children:`/`})]})}var ni=[{label:`Dashboard`,to:`/`,match:e=>e===`/`},{label:`Projects`,to:`/projects`,match:e=>e===`/projects`||e.startsWith(`/project/`)},{label:`Portfolio`,to:`/portfolio`,match:e=>e.startsWith(`/portfolio`)},{label:`Sessions`,to:`/search`,match:e=>e===`/search`||e.startsWith(`/session/`)},{label:`Settings`,to:`/settings`,match:e=>e.startsWith(`/settings`)}];function ri({back:e,chips:t,actions:n,children:r}){let i=et(),a=Ze(),o=a.pathname===`/search`,[s,c]=(0,_.useState)(``);return(0,z.jsxs)(`div`,{className:`min-h-screen flex flex-col bg-surface-mid`,children:[(0,z.jsx)(`header`,{className:`sticky top-0 z-50 bg-surface-lowest border-b border-ghost`,children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between h-12 px-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsxs)(bn,{to:`/`,className:`flex items-center gap-2 shrink-0`,children:[(0,z.jsx)(`span`,{className:`w-6 h-6 bg-primary rounded-md flex items-center justify-center text-on-primary font-display text-xs font-bold`,children:`h`}),(0,z.jsx)(`span`,{className:`font-display text-sm font-semibold text-on-surface`,children:`heyi.am`})]}),e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-outline text-xs`,children:`/`}),(0,z.jsx)(bn,{to:e.to,className:`text-sm text-on-surface-variant hover:text-on-surface transition-colors`,children:e.label})]}),t&&t.length>0&&(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 ml-1`,children:t.map(e=>(0,z.jsx)(ei,{variant:e.variant,children:e.label},e.label))})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!o&&(0,z.jsx)(`div`,{className:`w-48`,children:(0,z.jsx)(ti,{value:s,onChange:c,onSubmit:()=>{i(`/search?q=${encodeURIComponent(s)}`),c(``)},compact:!0})}),(0,z.jsxs)(`button`,{type:`button`,"data-testid":`cmdk-pill`,onClick:()=>console.log(`cmd-k`),className:`hidden md:inline-flex items-center gap-1.5 h-7 px-2 rounded-sm border border-ghost text-[0.6875rem] font-mono text-on-surface-variant hover:text-on-surface hover:border-outline transition-colors`,"aria-label":`Open command palette`,children:[(0,z.jsx)(`span`,{children:`⌘K`}),(0,z.jsx)(`span`,{children:`Search`})]}),n]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,z.jsx)(`nav`,{"aria-label":`Primary`,className:`w-[220px] shrink-0 border-r border-ghost bg-surface-lowest py-3 overflow-y-auto`,children:(0,z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2`,children:ni.map(e=>{let t=e.match(a.pathname);return(0,z.jsx)(`li`,{children:(0,z.jsx)(bn,{to:e.to,"aria-current":t?`page`:void 0,className:t?`block px-3 py-1.5 rounded-sm text-[0.8125rem] font-semibold text-primary bg-surface-low`:`block px-3 py-1.5 rounded-sm text-[0.8125rem] text-on-surface-variant hover:text-on-surface hover:bg-surface-low transition-colors`,children:e.label})},e.to)})})}),(0,z.jsx)(`main`,{className:`flex-1 overflow-y-auto`,children:r})]})]})}function ii({hover:e,className:t=``,children:n}){return(0,z.jsx)(`div`,{className:[`bg-surface-lowest border border-ghost rounded-md p-4`,e?`transition-shadow hover:shadow-md`:``,t].filter(Boolean).join(` `),children:n})}var ai={refined:`bg-green-bg text-green`,local:`bg-surface-low text-on-surface-variant`,exported:`bg-amber-bg text-amber`,violet:`bg-violet-bg text-violet`};function oi({variant:e,children:t}){return(0,z.jsx)(`span`,{className:`font-mono text-[9px] leading-tight uppercase tracking-wider py-0.5 px-1.5 rounded-sm ${ai[e]}`,children:t})}function si({label:e,value:t,valueSize:n=`text-2xl`}){return(0,z.jsxs)(`div`,{className:`bg-surface-lowest border border-ghost rounded-md p-4`,children:[(0,z.jsx)(`div`,{className:`font-mono text-[9px] uppercase tracking-wider text-on-surface-variant mb-1`,children:e}),(0,z.jsx)(`div`,{className:`font-display font-bold text-on-surface ${n}`,children:t})]})}function ci({title:e,children:t}){return(0,z.jsxs)(`div`,{className:`bg-surface-low border border-ghost rounded-sm p-2.5`,children:[e&&(0,z.jsx)(`div`,{className:`font-body text-sm font-semibold text-on-surface mb-1`,children:e}),(0,z.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:t})]})}function li({title:e,meta:t,children:n}){return(0,z.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,z.jsx)(`h3`,{className:`font-display text-base font-semibold text-on-surface`,children:e}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,z.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-on-surface-variant`,children:t}),n]})]})}function ui({title:e,message:t,confirmLabel:n=`Confirm`,cancelLabel:r=`Cancel`,destructive:i=!1,details:a,busy:o=!1,error:s,onConfirm:c,onCancel:l}){let u=(0,_.useRef)(null);(0,_.useEffect)(()=>{u.current?.focus()},[]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&!o&&(e.stopPropagation(),l())}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,l]);let d=i?`font-mono text-[0.8125rem] text-white bg-red-600 rounded-md px-3 py-1 hover:bg-red-700 transition-colors disabled:opacity-50`:`font-mono text-[0.8125rem] text-on-primary bg-primary rounded-md px-3 py-1 hover:bg-primary-hover transition-colors disabled:opacity-50`;return(0,z.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`confirm-modal-title`,className:`fixed inset-0 z-[80] flex items-center justify-center bg-black/40`,children:(0,z.jsxs)(`div`,{className:`bg-surface-lowest rounded-md border border-ghost shadow-lg w-full max-w-md`,children:[(0,z.jsx)(`div`,{className:`px-4 py-3 border-b border-ghost`,children:(0,z.jsx)(`span`,{id:`confirm-modal-title`,className:`font-mono text-[0.8125rem] font-semibold text-on-surface`,children:e})}),(0,z.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,z.jsx)(`p`,{className:`text-sm text-on-surface leading-relaxed`,children:t}),a&&(0,z.jsx)(`p`,{className:`mt-2 text-xs text-on-surface-variant leading-relaxed`,children:a}),s&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-error font-mono`,role:`alert`,children:s})]}),(0,z.jsxs)(`div`,{className:`px-4 py-3 border-t border-ghost flex justify-end gap-2`,children:[(0,z.jsx)(`button`,{ref:u,type:`button`,disabled:o,onClick:l,className:`font-mono text-[0.8125rem] text-on-surface-variant hover:text-on-surface px-3 py-1 disabled:opacity-50`,children:r}),(0,z.jsx)(`button`,{type:`button`,disabled:o,onClick:c,className:d,children:o?`Working...`:n})]})]})})}function di({dashboard:e,stats:t,projects:n}){let r=n.slice(0,4),i=t?.enhancedCount??0;return(0,z.jsxs)(`div`,{className:`p-6`,children:[(0,z.jsx)(`h1`,{className:`font-display text-[1.75rem] leading-[1.1] font-bold text-on-surface`,children:`Turn your AI sessions into a dev portfolio.`}),t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`h-6`}),(0,z.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,z.jsx)(pi,{label:`Sessions indexed`,value:t.sessionCount,to:`/archive`,color:`var(--primary)`}),(0,z.jsx)(pi,{label:`Projects`,value:t.projectCount,to:`/projects`}),(0,z.jsx)(pi,{label:`Enhanced`,value:i,to:`/projects?filter=unenhanced`,color:i>0?`#34d399`:void 0}),(0,z.jsx)(pi,{label:`Sources`,value:t.sourceCount,to:`/sources`})]})]}),(0,z.jsx)(`div`,{className:`h-6`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,z.jsx)(bn,{to:`/sources`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm bg-primary text-on-primary hover:bg-primary-hover transition-colors`,children:`Sync new sessions`}),(0,z.jsx)(bn,{to:`/projects`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`View projects`}),(0,z.jsx)(bn,{to:`/search`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`Search sessions`}),(0,z.jsx)(bn,{to:`/portfolio`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`Open Portfolio`}),e?.sync.status===`syncing`&&(0,z.jsxs)(`span`,{className:`text-xs text-on-surface-variant`,children:[`syncing `,e.sync.current,`/`,e.sync.total,e.sync.currentProject?` — ${e.sync.currentProject}`:``,`...`]})]}),(0,z.jsx)(`div`,{className:`h-10`}),r.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,z.jsx)(`h2`,{className:`font-semibold text-sm text-on-surface`,children:`Recent projects`}),(0,z.jsx)(bn,{to:`/projects`,className:`text-xs text-primary hover:underline`,children:`View all →`})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:r.map(e=>(0,z.jsx)(fi,{project:e},e.projectDir))}),(0,z.jsx)(`div`,{className:`h-10`})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,z.jsx)(mi,{to:`/archive`,label:`Archive`,title:`Back up sessions`,desc:`Import from local AI tools before they expire. Everything stays on your machine.`}),(0,z.jsx)(mi,{to:`/projects`,label:`Build`,title:`AI case studies`,desc:`AI reads your sessions, extracts skills, and drafts a narrative for each project.`}),(0,z.jsx)(mi,{to:`/search`,label:`Search`,title:`Find past work`,desc:`Full-text search across all sessions. Filter by tool, project, or skill.`}),(0,z.jsx)(mi,{to:`/portfolio`,label:`Export`,title:`HTML, markdown, or publish`,desc:`Export your full portfolio as a static site, publish to heyi.am, or push to GitHub Pages.`})]}),(0,z.jsx)(`div`,{className:`h-8`}),(0,z.jsxs)(`div`,{className:`border-t border-ghost pt-4 flex items-start gap-6 text-xs text-on-surface-variant`,children:[(0,z.jsx)(`span`,{children:`Everything is local by default.`}),(0,z.jsx)(`span`,{children:`Nothing is published unless you choose to.`}),(0,z.jsx)(`span`,{children:`No account required to archive or export.`})]})]})}function fi({project:e}){return(0,z.jsxs)(bn,{to:`/project/${encodeURIComponent(e.projectDir)}`,className:`group block bg-white border border-ghost rounded-sm p-3.5 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`font-semibold text-sm text-on-surface truncate`,children:e.projectName}),(0,z.jsxs)(`div`,{className:`text-xs text-on-surface-variant mt-0.5`,children:[e.sessionCount,` session`,e.sessionCount===1?``:`s`,e.enhancedAt&&(0,z.jsx)(`span`,{className:`ml-2`,style:{color:`#34d399`},children:`enhanced`})]}),e.skills.length>0&&(0,z.jsx)(`div`,{className:`flex gap-1 mt-2 flex-wrap`,children:e.skills.slice(0,3).map(e=>(0,z.jsx)(ei,{children:e},e))})]})}function pi({label:e,value:t,to:n,color:r}){return(0,z.jsxs)(bn,{to:n,className:`block bg-white border border-ghost rounded-sm px-4 py-3 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`text-2xl font-bold`,style:r?{color:r}:{color:`var(--on-surface)`},children:t}),(0,z.jsx)(`div`,{className:`text-xs text-on-surface-variant mt-0.5`,children:e})]})}function mi({to:e,label:t,title:n,desc:r}){return(0,z.jsxs)(bn,{to:e,className:`group block bg-white border border-ghost rounded-sm p-4 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`font-mono text-[9px] uppercase tracking-wider text-primary mb-1.5`,children:t}),(0,z.jsx)(`div`,{className:`font-semibold text-sm text-on-surface mb-1`,children:n}),(0,z.jsx)(`div`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:r})]})}var hi={main:`#084471`,orchestrator:`#084471`,"frontend-dev":`#7c3aed`,frontend:`#7c3aed`,"backend-dev":`#0891b2`,backend:`#0891b2`,"qa-engineer":`#059669`,qa:`#059669`,"ux-designer":`#d97706`,ux:`#d97706`,"product-manager":`#dc2626`,pm:`#dc2626`,"security-engineer":`#475569`,"team-lead":`#475569`,explore:`#94a3b8`,"code-reviewer":`#e11d48`,reviewer:`#e11d48`,"code-explorer":`#2563eb`,explorer:`#2563eb`,"code-architect":`#7e22ce`,architect:`#7e22ce`,"test-runner":`#16a34a`,tester:`#16a34a`,"build-fix":`#ea580c`,fixer:`#ea580c`,planner:`#0d9488`,plan:`#0d9488`,research:`#6366f1`,researcher:`#6366f1`,agent:`#2563eb`,wiring:`#c026d3`,enhance:`#0891b2`},gi=`#084471`,_i=`#d1d5db`,vi=`'IBM Plex Mono', monospace`,yi=`#6b7280`,bi=`#9ca3af`,xi=[`#e11d48`,`#2563eb`,`#7e22ce`,`#ea580c`,`#0d9488`,`#6366f1`,`#c026d3`,`#0891b2`,`#ca8a04`,`#16a34a`,`#be185d`,`#4f46e5`,`#0e7490`,`#b45309`,`#059669`];function Si(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Ci(e){if(!e)return yi;let t=e.toLowerCase();if(hi[t])return hi[t];for(let[e,n]of Object.entries(hi))if(t.includes(e)||e.includes(t))return n;return xi[Si(t)%xi.length]}function wi(e){return new Date(e.date).getTime()}function Ti(e){if(e.endTime)return new Date(e.endTime).getTime();let t=e.wallClockMinutes??e.durationMinutes;return wi(e)+t*6e4}function Ei(e){let t=e/36e5;if(t<20)return`${Math.round(t)}h gap`;let n=Math.round(t/24);return n===1?`1 day gap`:`${n} days gap`}function Di(e){let t=new Date(e),n=t.toLocaleString(`en-US`,{month:`short`}),r=t.getDate(),i=t.getHours(),a=t.getMinutes().toString().padStart(2,`0`),o=i>=12?`PM`:`AM`;return`${n} ${r}, ${i%12||12}:${a} ${o}`}function Oi(e){if(e<60)return`${Math.round(e)}m`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}var ki=36e5,Ai=160,ji=480;function Mi(e){return Math.min(Math.max(e*3,Ai),ji)}function Ni(e){if(!e.length)return[];let t=[...e].sort((e,t)=>wi(e)-wi(t)),n=[],r=null;for(let e of t){let t=wi(e),i=Ti(e);!r||t>=r.e?(r&&n.push(r),r={sessions:[e],s:t,e:i}):(r.sessions.push(e),i>r.e&&(r.e=i))}r&&n.push(r);let i=[];for(let e=0;e<n.length;e++){let t=n[e];if(e>0){let r=t.s-n[e-1].e;r>ki&&i.push({type:`gap`,durationMs:r})}t.sessions.length===1?i.push({type:`session`,session:t.sessions[0],startMs:t.s,endMs:t.e}):i.push({type:`concurrent`,sessions:t.sessions,startMs:t.s,endMs:t.e})}return i}function Pi(e){let t=[...e].sort((e,t)=>wi(e)-wi(t)),n=[],r=new Map;for(let e of t){let t=wi(e),i=-1;for(let e=0;e<n.length;e++)if(n[e]<=t){i=e;break}i===-1&&(i=n.length,n.push(0));let a=((e.children?.length??0)>5?30:15)*6e4;n[i]=Ti(e)+a,r.set(e.id,i)}return r}function Fi(e,t,n,r,i){return n===t?r:r+(e-t)/(n-t)*(i-r)}function Ii(e){return e.children?.length?e.children.map(e=>({id:e.sessionId,role:e.role,durationMinutes:e.durationMinutes??0,linesOfCode:e.linesOfCode??0,date:e.date})):[]}var Li=2*6e4;function Ri(e,t){let n=e.map(e=>({...e,startMs:e.date?new Date(e.date).getTime():t,endMs:(e.date?new Date(e.date).getTime():t)+e.durationMinutes*6e4})).sort((e,t)=>e.startMs-t.startMs),r=[],i=null;for(let e of n)!i||e.startMs>i.startMs+Li?(i&&r.push({children:i.children,startMs:i.startMs,endMs:i.endMs}),i={children:[e],startMs:e.startMs,endMs:e.endMs}):(i.children.push(e),e.endMs>i.endMs&&(i.endMs=e.endMs));return i&&r.push({children:i.children,startMs:i.startMs,endMs:i.endMs}),r}function zi(e,t){let n=e.map(e=>{let n=e.date?new Date(e.date).getTime():t,r=n+e.durationMinutes*6e4;return{...e,startMs:n,endMs:r}}).sort((e,t)=>e.startMs-t.startMs),r=new Map;return n.forEach((e,t)=>r.set(e.id,t)),{laneMap:r,laneCount:n.length}}function Bi(e){let t=Ii(e);return{title:e.title,timestamp:Di(e.date),duration:Oi(e.wallClockMinutes??e.durationMinutes),linesOfCode:e.linesOfCode,agentCount:t.length,session:e}}var Vi=6,Hi=30;function Ui(e){let t=new Map;for(let n of e){let e=n.role??`agent`,r=t.get(e);r?(r.totalMin+=n.durationMinutes,r.count+=1):t.set(e,{totalMin:n.durationMinutes,count:1})}return[...t.entries()].sort((e,t)=>t[1].totalMin-e[1].totalMin).map(([e,{totalMin:t,count:n}])=>({role:e,color:Ci(e),duration:Oi(t),count:n}))}function Wi(e){return e.map(e=>{let t=Ii(e.session);return{title:e.session.title,timestamp:Di(e.session.date),agents:Ui(t),totalAgents:t.length,xStart:e.xStart,xEnd:e.xEnd}})}var Gi=30,Ki=56,qi=50,Ji=140,Yi=4,Xi=300,Zi=1200,Qi=140,$i=32;function ea(e){return e<=5?44:e<=10?32:e<=20?22:16}function ta(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function na(e,t,n,r){if(r===n)return`M ${e} ${n} L ${t} ${n}`;let i=Math.min(qi,(t-e)/4);return[`M ${e} ${n}`,`C ${e+i} ${n}, ${e+i} ${r}, ${e+i*2} ${r}`,`L ${t-i*2} ${r}`,`C ${t-i} ${r}, ${t-i} ${n}, ${t} ${n}`].join(` `)}var ra=8;function ia(e,t=ra,n,r){let i=n??gi,a=r??bi,o=[],s=[],c=[],l=!1,u=48,d=0,f=0,p=u,m=(e,t)=>{e<d&&(d=e),e+t>f&&(f=e+t)};for(let n of e){if(n.type===`gap`){s.push({path:`M ${u} 0 L ${u+72} 0`,color:a,width:1.5,dashed:!0}),o.push({kind:`gap`,pos:{x:u,y:16},label:Ei(n.durationMs),durationMs:n.durationMs}),m(-8,40),u+=72+Ki;continue}if(n.type===`session`){let e=n.session,t=Ii(e),r=e.durationMinutes,a=t.length>0?Math.max(Ai,t.length*30+100):Ai,l=t.length>0?Math.min(Math.max(r*Yi,a),Zi):Math.min(Math.max(Mi(r),Ai),ji),d=Oi(e.durationMinutes),f=Bi(e),p=Di(e.date);if(t.length>0){let n=t.slice(0,Gi),r=wi(e),a=r+e.durationMinutes*6e4,h=Math.max(a,...n.map(e=>(e.date?new Date(e.date).getTime():r)+e.durationMinutes*6e4)),g=Ri(n,r),_=Math.max(...g.map(e=>e.children.length),1),v=ea(_),y=Math.min((_-1)*v,120),b=u,x=u+l,S=0-y/2-16,C=b+qi*2;o.push({kind:`label`,pos:{x:C+8,y:S},title:ta(e.title,$i),sub:d,timestamp:p,color:i,above:!0,session:e,tooltip:f}),m(S-4,16),o.push({kind:`dot`,pos:{x:b,y:0},color:i,size:`lg`,tooltip:f}),s.push({path:`M ${b} 0 L ${x} 0`,color:i,width:1.5});for(let e of g){let t=e.children.length,n=Math.min((t-1)*v,y),i=t>1?n/(t-1):0,a=0-n/2,o=Fi(e.startMs,r,h,b,x);e.children.forEach((e,t)=>{let n=a+t*i,c=Ci(e.role),l=(e.date?new Date(e.date).getTime():r)+e.durationMinutes*6e4,u=Fi(Math.min(l,h),r,h,b,x),d=Math.max(u,o+100);s.push({path:na(o,Math.min(d,x),0,n),color:c,width:1.5}),m(n-2,4)})}o.push({kind:`dot`,pos:{x,y:0},color:i,size:`lg`,tooltip:f}),c.push({session:e,xStart:b,xEnd:x}),u=x+Ki}else o.push({kind:`label`,pos:{x:u+14,y:-16},title:ta(e.title,$i),sub:d,timestamp:p,color:i,above:!0,session:e,tooltip:f}),m(-20,16),o.push({kind:`dot`,pos:{x:u,y:0},color:i,size:`sm`,tooltip:f}),o.push({kind:`dot`,pos:{x:u+l,y:0},color:i,size:`sm`,tooltip:f}),s.push({path:`M ${u} 0 L ${u+l} 0`,color:i,width:3}),c.push({session:e,xStart:u,xEnd:u+l}),u+=l+Ki;continue}if(n.type===`concurrent`){let e=[...n.sessions].sort((e,t)=>wi(e)-wi(t)),r=e.slice(0,t),d=Pi(r),f=Math.max(...d.values())+1,p=e.length-r.length;p>0&&(l=!0);let h=Math.max(...r.map(e=>Ii(e).length),0),g=h>15?Math.max(Ji,h*5+60):h>5?Math.max(Ji,h*8+40):Ji,_=n.startMs,v=n.endMs,y=(v-_)/6e4,b=Math.min(Math.max(y*Yi,Xi),Zi),x=u,S=u+b,C=Array(f).fill(0);for(let n of e.slice(0,t)){let e=d.get(n.id)??0,t=0+e*g,r=Ii(n),a=Bi(n),l=Di(n.date),u=Oi(n.durationMinutes),f=Fi(wi(n),_,v,x,S),p=f+Math.min(Math.max(n.durationMinutes*Yi,20),S-f);if(r.length>0){let d=r.slice(0,Gi),h=wi(n),_=Ti(n),{laneMap:v,laneCount:y}=zi(d,h),b=ea(y),x=Math.min((y-1)*b,g-40),S=y>1?x/(y-1):0,w=t-x/2,T=w-32;(C[e]===0||f>=C[e])&&(o.push({kind:`label`,pos:{x:f+8,y:T},title:ta(n.title,$i),sub:u,timestamp:l,color:i,above:!0,session:n,tooltip:a}),C[e]=f+Qi),m(T-4,28),o.push({kind:`dot`,pos:{x:f,y:t},color:i,size:`lg`,tooltip:a}),s.push({path:`M ${f} ${t} L ${p} ${t}`,color:i,width:1.5});let E=y>15?.4:y>8?.6:.8,D=y>15?1:1.5;d.forEach(e=>{let n=w+(v.get(e.id)??0)*S,r=Ci(e.role),i=e.date?new Date(e.date).getTime():h,a=i+e.durationMinutes*6e4,o=Fi(i,h,_,f,p),c=Math.min(Fi(Math.min(a,_),h,_,f,p),p),l=Math.max(c,o+60);s.push({path:na(o,Math.min(l,p),t,n),color:r,width:D,opacity:E}),m(n-2,4)}),o.push({kind:`dot`,pos:{x:p,y:t},color:i,size:`lg`,tooltip:a}),c.push({session:n,xStart:f,xEnd:p})}else (C[e]===0||f>=C[e])&&(o.push({kind:`label`,pos:{x:f+8,y:t-16},title:ta(n.title,$i),sub:u,timestamp:l,color:i,above:!0,session:n,tooltip:a}),C[e]=f+Qi),m(t-32,28),o.push({kind:`dot`,pos:{x:f,y:t},color:i,size:`sm`,tooltip:a}),o.push({kind:`dot`,pos:{x:p,y:t},color:i,size:`sm`,tooltip:a}),s.push({path:`M ${f} ${t} L ${p} ${t}`,color:i,width:3}),c.push({session:n,xStart:f,xEnd:p});m(t-4,8)}if(p>0){let e=0+f*g;o.push({kind:`label`,pos:{x:x+8,y:e},title:`+${p} more sessions`,color:a,above:!1}),m(e,16)}u=S+Ki}}let h=u-Ki,g=-d+4,_=f-d+8;return{nodes:o.map(e=>({...e,pos:{x:e.pos.x,y:e.pos.y+g}})),tracks:s,sessionRanges:c,hasConcurrentOverflow:l,threadStart:p,threadEnd:h,totalW:u+48,totalH:Math.max(_,100),centerY:0+g}}function aa(e,t,n){if(!n.length)return null;let r=e+t/2,i=null,a=1/0;for(let e of n){let t=(e.xStart+e.xEnd)/2,n=Math.abs(r-t);n<a&&(a=n,i=e)}return i}function oa({entry:e,textSecondaryColor:t,textMutedColor:n}){if(!e||e.agents.length===0)return null;let r=e.agents.slice(0,Vi),i=e.agents.length-r.length,a=e.totalAgents>=Hi;return(0,z.jsxs)(`div`,{style:{fontFamily:vi,fontSize:10,display:`flex`,alignItems:`baseline`,gap:14,padding:`2px 0`,minHeight:20},children:[a?(0,z.jsxs)(`span`,{style:{fontSize:10,fontWeight:700,letterSpacing:`0.06em`,color:`#d97706`,flexShrink:0},children:[`LEGENDARY AGENTIC USE — `,e.totalAgents,` agents:`]}):(0,z.jsxs)(`span`,{style:{fontSize:10,color:t,fontWeight:600,flexShrink:0},children:[e.totalAgents,` agents:`]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:10,alignItems:`center`},children:[r.map(e=>(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5},children:[(0,z.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:e.color,boxShadow:`0 0 4px ${e.color}40`,flexShrink:0}}),(0,z.jsx)(`span`,{style:{fontWeight:600,color:e.color,letterSpacing:`0.03em`},children:e.role.toUpperCase()}),e.count>1&&(0,z.jsxs)(`span`,{style:{color:n},children:[`×`,e.count]}),(0,z.jsx)(`span`,{style:{color:n},children:e.duration})]},e.role)),i>0&&(0,z.jsxs)(`span`,{style:{color:n,fontStyle:`italic`},children:[`+`,i,` more`]})]})]})}function sa({data:e,pos:t}){return(0,z.jsxs)(`div`,{style:{position:`absolute`,left:t.x,top:t.y-8,transform:`translateY(-100%)`,background:`#1f2937`,color:`#f9fafb`,borderRadius:6,padding:`10px 14px`,fontFamily:vi,fontSize:11,lineHeight:1.5,whiteSpace:`nowrap`,zIndex:100,pointerEvents:`none`,boxShadow:`0 4px 16px rgba(0,0,0,0.18)`},children:[(0,z.jsx)(`div`,{style:{fontWeight:700,fontSize:12,marginBottom:4,color:`#fff`},children:e.title}),(0,z.jsx)(`div`,{style:{color:`#d1d5db`},children:e.timestamp}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:4},children:[(0,z.jsx)(`span`,{children:e.duration}),(0,z.jsxs)(`span`,{children:[e.linesOfCode.toLocaleString(),` lines`]}),e.agentCount>0&&(0,z.jsxs)(`span`,{children:[e.agentCount,` agents`]})]})]})}function ca({sessions:e,onSessionClick:t,maxHeight:n,accentColor:r,isDark:i}){let a=r??(i?`#f97316`:gi),o=i?`rgba(255,255,255,0.15)`:_i,s=i?`rgba(255,255,255,0.65)`:yi,c=i?`rgba(255,255,255,0.4)`:bi,l=(0,_.useMemo)(()=>Ni(e),[e]),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=u?999:ra,y=(0,_.useMemo)(()=>ia(l,v,a,c),[l,v,a,c]),b=(0,_.useMemo)(()=>Wi(y.sessionRanges),[y.sessionRanges]),x=(0,_.useRef)(null),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=b.filter(e=>e.agents.length>0);e.length>0&&T(e[0])},[b]);let E=(0,_.useCallback)(()=>{let e=x.current;if(!e)return;let t=b.filter(e=>e.agents.length>0),n=aa(e.scrollLeft,e.clientWidth,t);n&&T(n)},[b]),D=(0,_.useCallback)(()=>{if(m){g.current&&cancelAnimationFrame(g.current),g.current=null,h(!1);return}h(!0);let e=()=>{let t=x.current;if(t){if(t.scrollLeft>=t.scrollWidth-t.clientWidth-1){h(!1),g.current=null;return}t.scrollLeft+=1.2,g.current=requestAnimationFrame(e)}};g.current=requestAnimationFrame(e)},[m]);(0,_.useEffect)(()=>()=>{g.current&&cancelAnimationFrame(g.current)},[]),(0,_.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[f]);let O=(0,_.useCallback)((e,t)=>{e&&C({tooltip:e,pos:t})},[]),k=(0,_.useCallback)(()=>C(null),[]);if(!e.length)return(0,z.jsx)(`div`,{"data-testid":`work-timeline-empty`,children:(0,z.jsx)(`p`,{style:{fontFamily:vi,fontSize:`0.8125rem`,color:s},children:`No sessions to display.`})});let A=b.some(e=>e.agents.length>0),j=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,z.jsx)(`div`,{style:{flex:1,minWidth:0},children:A&&(0,z.jsx)(oa,{entry:w,textSecondaryColor:s,textMutedColor:c})}),(0,z.jsx)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:y.totalW>600&&(0,z.jsx)(`button`,{onClick:D,style:(e=>({padding:`3px 10px`,fontSize:10,fontWeight:600,border:`1px solid ${o}`,borderRadius:4,background:e?a:i?`rgba(255,255,255,0.08)`:`#fff`,color:e?`#fff`:a,cursor:`pointer`,fontFamily:vi,letterSpacing:`0.03em`,flexShrink:0}))(m),children:m?`PAUSE`:`PLAY`})})]}),(0,z.jsx)(`div`,{ref:x,onScroll:E,style:{overflowX:`auto`,overflowY:f?`auto`:`hidden`,WebkitOverflowScrolling:`touch`,maxHeight:f?`calc(100vh - 80px)`:void 0},children:(0,z.jsxs)(`div`,{style:{position:`relative`,width:y.totalW,height:y.totalH,fontFamily:vi},children:[(0,z.jsxs)(`svg`,{style:{position:`absolute`,inset:0,width:y.totalW,height:y.totalH,pointerEvents:`none`},children:[(0,z.jsx)(`line`,{x1:y.threadStart,y1:y.centerY,x2:y.threadEnd,y2:y.centerY,stroke:o,strokeWidth:1.5}),y.tracks.map((e,t)=>(0,z.jsx)(`path`,{d:e.path,fill:`none`,stroke:e.color,strokeWidth:e.width,opacity:e.opacity??.8,strokeDasharray:e.dashed?`6 4`:void 0,transform:`translate(0, ${y.centerY})`},`t-${t}`))]}),y.nodes.map((e,n)=>{if(e.kind===`label`)return(0,z.jsxs)(`div`,{style:{position:`absolute`,left:e.pos.x,top:e.pos.y,cursor:t&&e.session?`pointer`:`default`,whiteSpace:`nowrap`},onClick:t&&e.session?()=>t(e.session):void 0,onMouseEnter:e.tooltip?()=>O(e.tooltip,e.pos):void 0,onMouseLeave:e.tooltip?k:void 0,children:[(0,z.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:e.color,letterSpacing:`0.01em`,display:`block`},children:e.title}),(0,z.jsxs)(`span`,{style:{fontSize:10,color:c,display:`flex`,gap:8,marginTop:1},children:[e.sub&&(0,z.jsx)(`span`,{children:e.sub}),e.timestamp&&(0,z.jsx)(`span`,{style:{color:s},children:e.timestamp})]})]},`l-${n}`);if(e.kind===`dot`){let t=e.size===`lg`?6:4;return(0,z.jsx)(`div`,{onMouseEnter:e.tooltip?()=>O(e.tooltip,e.pos):void 0,onMouseLeave:e.tooltip?k:void 0,style:{position:`absolute`,left:e.pos.x-t,top:e.pos.y-t,width:t*2,height:t*2,borderRadius:`50%`,background:e.color,boxShadow:`0 0 ${e.size===`lg`?10:5}px ${e.color}50`,zIndex:2,cursor:e.tooltip?`pointer`:`default`}},`d-${n}`)}return e.kind===`gap`?(0,z.jsx)(`div`,{style:{position:`absolute`,left:e.pos.x,top:e.pos.y,width:72,height:22,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:10,color:c,letterSpacing:`0.04em`},children:e.label},`g-${n}`):null}),S&&(0,z.jsx)(sa,{data:S.tooltip,pos:S.pos})]})})]});if(f)return(0,z.jsxs)(`div`,{style:{position:`fixed`,inset:0,zIndex:9998,background:i?`#111`:`#f8f9fb`,display:`flex`,flexDirection:`column`,padding:`16px 24px`},children:[(0,z.jsx)(`button`,{onClick:()=>p(!1),style:{position:`absolute`,top:16,right:24,zIndex:1,padding:`6px 14px`,fontSize:12,fontWeight:700,border:`1px solid ${o}`,borderRadius:4,background:i?`rgba(255,255,255,0.08)`:`#fff`,color:a,cursor:`pointer`,fontFamily:vi},children:`Close`}),(0,z.jsx)(`div`,{"data-testid":`work-timeline`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:j})]});let M=n&&y.totalH>n;return(0,z.jsxs)(`div`,{"data-testid":`work-timeline`,style:{position:`relative`},children:[(0,z.jsx)(`div`,{style:M?{maxHeight:n,overflow:`hidden`}:void 0,children:j}),M&&(0,z.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,height:64,background:i?`linear-gradient(transparent, #111)`:`linear-gradient(transparent, #f8f9fb)`,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,paddingBottom:10},children:(0,z.jsx)(`button`,{onClick:()=>{d(!0),p(!0)},style:{padding:`5px 16px`,fontSize:11,fontWeight:700,border:`1px solid ${o}`,borderRadius:4,background:i?`rgba(255,255,255,0.08)`:`#fff`,color:a,cursor:`pointer`,fontFamily:vi,letterSpacing:`0.03em`,boxShadow:`0 2px 8px rgba(0,0,0,0.08)`},children:`EXPAND TIMELINE`})})]})}function la(e){let t=e/60;return t>=1?`${t.toFixed(1)}h`:`${Math.round(e)}m`}function ua(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var da=`'IBM Plex Mono', monospace`,fa=`#084471`,pa=`#9ca3af`,ma=`#6b7280`,ha=`#e4e4e7`;function ga(e){return e===0?`0`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function _a(e){if(e<=0)return[0];let t=e/4,n=10**Math.floor(Math.log10(t)),r=[1,2,2.5,5,10],i=n;for(let e of r)if(e*n>=t){i=e*n;break}let a=[];for(let t=0;t<=e+i*.1;t+=i)a.push(Math.round(t));return a[a.length-1]<e&&a.push(a[a.length-1]+Math.round(i)),a}function va(e){let t=[...e].filter(e=>e.date).sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime());if(t.length===0)return[];let n=0,r=0;return t.map((e,t)=>{let i=0,a=0;if(e.filesChanged&&e.filesChanged.length>0)for(let t of e.filesChanged)i+=t.additions,a+=t.deletions;else i=Math.max(0,e.linesOfCode);return n+=i,r+=a,{dateMs:new Date(e.date).getTime(),cumulativeAdded:n,cumulativeDeleted:r,sessionIndex:t,sessionId:e.id,title:e.title,added:i,deleted:a}})}var ya=3600*1e3,ba=600*1e3;function xa(e){if(e.length===0)return{visualTimes:[],totalVisualTime:0};let t=[0],n=0;for(let r=1;r<e.length;r++){let i=e[r].dateMs-e[r-1].dateMs;n+=i>ya?ba:Math.max(i,0),t.push(n)}return{visualTimes:t,totalVisualTime:n}}function Sa(e,t,n){if(e.length<2)return[];let r=e[0].dateMs,i=e[e.length-1].dateMs;if(i-r<14*864e5)return[];let a=[],o=new Date(r),s=new Date(i),c=new Date(o.getFullYear(),o.getMonth()+1,1);for(;c<=s;){let r=c.getTime(),i=0,o=1/0;for(let t=0;t<e.length;t++){let n=Math.abs(e[t].dateMs-r);n<o&&(o=n,i=t)}a.push({x:n(t[i]),label:c.toLocaleString(`en-US`,{month:`short`}).toUpperCase()}),c.setMonth(c.getMonth()+1)}return a}function Ca({sessions:e,totalLoc:t,totalFiles:n,keyMoments:r,onSessionClick:i,isDark:a,accentColor:o,dualPositive:s,variant:c=`default`}){let l=c===`radar`,u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=l?a?`#22d3ee`:`#0891b2`:o||(a?`#f97316`:fa),g=a?{textMuted:l?`#94a3b8`:`rgba(255,255,255,0.4)`,textSecondary:l?`#cbd5e1`:`rgba(255,255,255,0.65)`,grid:l?`rgba(34,211,238,0.04)`:`rgba(255,255,255,0.06)`,gridAxis:l?`rgba(34,211,238,0.08)`:`rgba(255,255,255,0.06)`,text:`#fafafa`,accent:h,dotStroke:`rgba(0,0,0,0.3)`}:{textMuted:l?`#64748b`:pa,textSecondary:l?`#64748b`:ma,grid:l?`rgba(100,116,139,0.08)`:ha,gridAxis:l?`rgba(100,116,139,0.15)`:ha,text:`#191c1e`,accent:h,dotStroke:`#fff`},v=va(e);if(v.length===0)return(0,z.jsx)(`div`,{style:{fontFamily:da,fontSize:`0.75rem`,color:g.textSecondary,padding:16},children:`No session data available for growth chart.`});let{visualTimes:y,totalVisualTime:b}=xa(v),x=new Map;if(r)for(let e of r)x.set(e.sessionId,e.label);let S=v[v.length-1].cumulativeAdded,C=v[v.length-1].cumulativeDeleted,w=C>0,T=Math.round(b/6e4*.8)+120,E=v.length*12+120,D=Math.max(700,T,E),O=b||1,k=e=>48+e/O*(D-48-16),A,j,M,N,P,ee,F,I,te,L,ne;s?(I=_a(Math.max(S,C,1)),ee=I[I.length-1]||1,te=[],F=0,A=160,j=0,M=0,N=24+A+36,P=24+A,L=e=>P-e/ee*A,ne=L):(I=_a(Math.max(S,1)),ee=I[I.length-1]||1,te=w?_a(C):[],F=w?te[te.length-1]||1:0,A=140,j=w?50:0,M=w?2:0,N=24+A+M+j+36,P=24+A,L=e=>P-e/ee*A,ne=e=>P+M+e/F*j);let re=v.map((e,t)=>({x:k(y[t]),y:L(e.cumulativeAdded)})),ie=w?v.map((e,t)=>({x:k(y[t]),y:ne(e.cumulativeDeleted)})):[];function R(e){if(e.length===0)return``;let t=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=1;n<e.length;n++)t+=` L${e[n].x.toFixed(1)},${e[n-1].y.toFixed(1)}`,t+=` L${e[n].x.toFixed(1)},${e[n].y.toFixed(1)}`;return t}function ae(e){return e.length===0?``:e.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `)}let oe=l?ae:R,se=oe(re),ce=se+` L${re[re.length-1].x.toFixed(1)},${P} L${re[0].x.toFixed(1)},${P} Z`,le=w?oe(ie):``,ue=w?le+` L${ie[ie.length-1].x.toFixed(1)},${P+M} L${ie[0].x.toFixed(1)},${P+M} Z`:``,de=new Set,fe=-1/0;for(let e=0;e<v.length;e++){let t=k(y[e]);t-fe>=90&&(de.add(e),fe=t)}v.length>1&&de.add(v.length-1);let pe=Sa(v,y,k),me=D>700,he=[...e].filter(e=>e.date).sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime());return(0,_.useEffect)(()=>{if(!l)return;let e=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t=[u.current,d.current].filter(e=>e!==null),n=[f.current,p.current].filter(e=>e!==null);if(e){for(let e of n)e.style.opacity=`1`;return}for(let e of t){let t=e.getTotalLength();e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=`${t}`,e.style.transition=`none`}for(let e of n)e.style.opacity=`0`,e.style.transition=`none`;let r=new IntersectionObserver(e=>{for(let i of e)i.isIntersecting&&(requestAnimationFrame(()=>{for(let e of t)e.style.transition=`stroke-dashoffset 1.2s ease-out`,e.style.strokeDashoffset=`0`;setTimeout(()=>{for(let e of n)e.style.transition=`opacity 0.8s ease-out`,e.style.opacity=`1`},400)}),r.disconnect())},{threshold:.2});return m.current&&r.observe(m.current),()=>r.disconnect()},[l,v.length]),(0,z.jsxs)(`div`,{ref:m,children:[(0,z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,padding:`8px 12px`,borderBottom:`1px solid ${g.grid}`,fontFamily:da},children:[(0,z.jsx)(`span`,{style:{fontSize:10,fontWeight:700,color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`},children:s?`Lines Changed`:`Code Changes Over Time`}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11,fontWeight:600},children:[(0,z.jsxs)(`span`,{style:{color:g.accent},children:[`+`,ua(S)]}),w&&(0,z.jsxs)(`span`,{style:{color:g.textSecondary},children:[`-`,ua(C)]}),(0,z.jsxs)(`span`,{style:{color:g.text},children:[ua(t),` total`]})]})]}),(0,z.jsx)(`div`,{style:me?{overflowX:`auto`}:{padding:`4px 0`},children:(0,z.jsxs)(`svg`,{viewBox:`0 0 ${D} ${N}`,width:me?D:`100%`,height:me?N:void 0,preserveAspectRatio:`xMidYMid meet`,style:{display:`block`},children:[(0,z.jsxs)(`defs`,{children:[(0,z.jsxs)(`linearGradient`,{id:`addGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,z.jsx)(`stop`,{offset:`0%`,stopColor:g.accent,stopOpacity:l?.05:.12}),(0,z.jsx)(`stop`,{offset:`100%`,stopColor:g.accent,stopOpacity:l?.05:.02})]}),(0,z.jsxs)(`linearGradient`,{id:`delGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,z.jsx)(`stop`,{offset:`0%`,stopColor:g.accent,stopOpacity:l?.05:s?.12:.02}),(0,z.jsx)(`stop`,{offset:`100%`,stopColor:g.accent,stopOpacity:l?.05:s?.02:.1})]}),l&&(0,z.jsxs)(`filter`,{id:`dotGlow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,z.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`blur`}),(0,z.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`blur`,operator:`over`})]})]}),I.map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`line`,{x1:48,y1:L(e),x2:D-16,y2:L(e),stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`4,4`}),(0,z.jsx)(`text`,{x:40,y:L(e)+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:e===0?``:s?ga(e):`+${ga(e)}`})]},`ya-${e}`)),l&&(0,z.jsx)(`line`,{x1:48,y1:24,x2:48,y2:P+M+j,stroke:g.gridAxis,strokeWidth:`1`}),(0,z.jsx)(`line`,{x1:48,y1:P,x2:D-16,y2:P,stroke:l?g.gridAxis:g.grid,strokeWidth:`1`}),(0,z.jsx)(`text`,{x:40,y:P+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textSecondary,fontWeight:`600`,children:`0`}),!s&&w&&te.filter(e=>e>0).map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`line`,{x1:48,y1:ne(e),x2:D-16,y2:ne(e),stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`4,4`}),(0,z.jsx)(`text`,{x:40,y:ne(e)+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:`-${ga(e)}`})]},`yd-${e}`)),pe.map((e,t)=>(0,z.jsx)(`line`,{x1:e.x,y1:24,x2:e.x,y2:P+M+j,stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`2,4`},`m-${t}`)),l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{ref:f,d:ce,fill:`${g.accent}0D`}),(0,z.jsx)(`polyline`,{ref:u,points:re.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),fill:`none`,stroke:g.accent,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:ce,fill:`url(#addGrad)`}),(0,z.jsx)(`path`,{d:se,fill:`none`,stroke:g.accent,strokeWidth:`1.5`})]}),w&&(0,z.jsx)(`g`,{opacity:`0.4`,children:l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{ref:p,d:ue,fill:`${g.accent}0D`}),(0,z.jsx)(`polyline`,{ref:d,points:ie.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),fill:`none`,stroke:g.accent,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:ue,fill:`url(#delGrad)`}),(0,z.jsx)(`path`,{d:le,fill:`none`,stroke:g.accent,strokeWidth:`1.5`})]})}),v.map((e,t)=>{let n=k(y[t]),r=x.has(e.sessionId),a=de.has(t);return(0,z.jsxs)(`g`,{style:i?{cursor:`pointer`}:void 0,onClick:i?()=>i(he[t]):void 0,children:[r?(0,z.jsx)(`circle`,{cx:n,cy:L(e.cumulativeAdded),r:`5`,fill:g.accent,stroke:g.dotStroke,strokeWidth:`2`,filter:l?`url(#dotGlow)`:void 0}):a?(0,z.jsx)(`circle`,{cx:n,cy:L(e.cumulativeAdded),r:`3`,fill:g.accent,filter:l?`url(#dotGlow)`:void 0}):null,w&&e.cumulativeDeleted>0&&a&&(0,z.jsx)(`circle`,{cx:n,cy:ne(e.cumulativeDeleted),r:`2.5`,opacity:`0.4`,fill:g.accent,filter:l?`url(#dotGlow)`:void 0}),r&&(0,z.jsx)(`text`,{x:n,y:L(e.cumulativeAdded)-12,textAnchor:`middle`,fontFamily:da,fontSize:`8`,fill:g.textSecondary,children:x.get(e.sessionId)}),a&&(0,z.jsx)(`text`,{x:n,y:N-8,textAnchor:`middle`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:new Date(e.dateMs).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})})]},`pt-${t}`)})]})}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:24,padding:`8px 12px`,borderTop:`1px solid ${g.grid}`,fontFamily:da,fontSize:10},children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,z.jsx)(`span`,{style:{width:16,height:3,background:g.accent,borderRadius:1,flexShrink:0}}),(0,z.jsxs)(`span`,{style:{fontSize:14,fontWeight:700,color:g.accent},children:[`+`,ua(S)]})]}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600,marginTop:2},children:`Added`})]}),w&&(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,z.jsx)(`span`,{style:{width:16,height:3,background:g.accent,opacity:.4,borderRadius:1,flexShrink:0}}),(0,z.jsxs)(`span`,{style:{fontSize:14,fontWeight:700,color:g.textSecondary},children:[`-`,ua(C)]})]}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600,marginTop:2},children:`Removed`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:ua(t)}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Lines changed`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:n}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Files`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:v.length}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Sessions`})]})]})]})}var wa=[`preview_project`,`preview_enhanced`,`prompt_enhance`];function Ta(){let e=et(),[t,n]=(0,_.useState)(`loading`),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(new Set),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(`idle`),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)(``),M=(0,_.useCallback)(()=>{Xr().catch(()=>{}),n(`dashboard`),e(`/`)},[e]);(0,_.useEffect)(()=>{let e=!1,t=null;return Yr().then(r=>{if(!e){if(i(r),r.onboardingComplete){n(`dashboard`);return}r.sync.status===`syncing`?(n(`syncing`),o(r.sync),t=Zr(t=>{e||(o(t),t.currentProject&&c(e=>new Set(e).add(t.currentProject)),t.status===`done`&&Yr().then(t=>{e||(i(t),t.isEmpty?M():setTimeout(()=>{e||n(`reveal`)},800))}))})):r.isEmpty?n(`dashboard`):n(`reveal`)}}).catch(()=>{e||n(`dashboard`)}),()=>{e=!0,t?.()}},[M]),(0,_.useEffect)(()=>{if(t!==`reveal`)return;let e=[];for(let t=1;t<=4;t++)e.push(setTimeout(()=>u(t),t*400));return e.push(setTimeout(()=>n(`prompt_project`),3100)),()=>e.forEach(clearTimeout)},[t]);let N=r?.stats,P=r?.projects??[],ee=P.length>0?P.reduce((e,t)=>t.sessionCount>e.sessionCount?t:e,P[0]):null,F=t!==`dashboard`&&t!==`loading`,I=wa.includes(t),te=[`This is what a project looks like.
12
+ `);i=o.pop()??``;for(let e of o){if(!e.startsWith(`data: `))continue;let t=e.slice(6).trim();if(t)try{n(JSON.parse(t))}catch{}}}}).catch(e=>{e.name!==`AbortError`&&n({type:`error`,message:e.message})}),r}async function qn(){return(await Vn(`/projects`)).projects}async function Jn(e){return(await Vn(`/projects/${Bn(e)}/sessions`)).sessions}async function Yn(e,t){return(await Vn(`/projects/${Bn(e)}/sessions/${Bn(t)}`)).session}async function Xn(){return Vn(`/source-audit`)}async function Zn(){return Vn(`/archive/stats`)}async function Qn(){return Vn(`/local-data`)}async function $n(){return Hn(`/archive/sync`)}async function er(){let e=await fetch(`${zn}/archive/export`);if(!e.ok){let t=await e.json().catch(()=>({error:`Export failed`}));throw Error(t.error??`Export failed: ${e.status}`)}let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`heyiam-archive.tar.gz`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}async function tr(e){return Vn(`/projects/${Bn(e)}/detail`)}async function nr(e){return Vn(`/projects/${Bn(e)}/boundaries`)}async function rr(e,t){return Un(`/projects/${Bn(e)}/boundaries`,t)}async function ir(e,t){return Wn(`/sessions/${Bn(e)}/enhanced`,t)}async function ar(e,t){return Hn(`/projects/${Bn(e)}/sessions/${Bn(t)}/enhance`)}function or(e,t){return Kn(`/projects/${Bn(e)}/triage`,{},t)}function sr(e,t,n,r,i){return Kn(`/projects/${Bn(e)}/enhance-project`,{selectedSessionIds:t,skippedSessions:n,force:i},r)}async function cr(e,t,n,r){return Hn(`/projects/${Bn(e)}/refine-narrative`,{draftNarrative:t,draftTimeline:n,answers:r})}function lr(e,t,n){return Kn(`/projects/${Bn(e)}/upload`,t,n)}async function ur(){try{return await Vn(`/settings/api-key`)}catch{return{hasKey:!1}}}async function dr(e){await Hn(`/settings/api-key`,{apiKey:e})}async function fr(){try{return(await Vn(`/templates`)).templates}catch{return[]}}async function pr(){try{return await Vn(`/settings/theme`)}catch{return{template:`editorial`}}}async function mr(e){await Hn(`/settings/theme`,{template:e})}async function hr(){try{return await Vn(`/portfolio`)}catch{return{}}}async function gr(e){await Hn(`/portfolio`,e)}async function _r(){try{return await Vn(`/portfolio/state`)}catch{return{targets:{}}}}async function vr(e){if(e!==`heyi.am`)throw Error(`Unsupported publish target: ${e}`);return Hn(`/portfolio/upload`)}async function yr(){let e=await fetch(`${zn}/portfolio/export`,{method:`POST`,headers:{"Content-Type":`application/json`}});if(!e.ok){let t=`Portfolio export failed: ${e.status}`;try{let n=await e.json();n?.error?.message&&(t=n.error.message)}catch{}throw Error(t)}let t=await e.blob(),n=URL.createObjectURL(t),r=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`portfolio.zip`,i=document.createElement(`a`);return i.href=n,i.download=r,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(n),{ok:!0,filename:r}}var br=class extends Error{code;status;constructor(e,t,n){super(t),this.code=e,this.status=n}};async function xr(e,t){let n=await fetch(`${zn}${e}`,{headers:{"Content-Type":`application/json`},...t});if(!n.ok){let t=`HTTP_${n.status}`,r=`${e} failed: ${n.status}`;try{let e=await n.json();e?.error?.code&&(t=e.error.code),e?.error?.message&&(r=e.error.message)}catch{}throw new br(t,r,n.status)}return await n.json()}async function Sr(){return xr(`/github/device-code`,{method:`POST`})}async function Cr(e){return xr(`/github/poll-token`,{method:`POST`,body:JSON.stringify(e)})}async function wr(){return(await xr(`/github/account`)).account}async function Tr(){await xr(`/github/account`,{method:`DELETE`})}async function Er(){return(await xr(`/github/repos`)).repos}async function Dr(e){return xr(`/github/publish`,{method:`POST`,body:JSON.stringify(e)})}async function Or(e){return Gn(`/projects/${Bn(e)}/remote`)}async function kr(e,t){return Gn(`/projects/${Bn(e)}/sessions/${Bn(t)}/remote`)}async function Ar(e){return Vn(`/sessions/${Bn(e)}/transcript-setting`)}async function jr(e,t){return Un(`/sessions/${Bn(e)}/transcript-setting`,{included:t})}async function Mr(e){try{return await Vn(e)}catch{return null}}function Nr(e){return Mr(`/projects/${encodeURIComponent(e)}/render`)}function Pr(e){return Mr(`/sessions/${encodeURIComponent(e)}/render`)}function Fr(e){if(!e.username)return e;let t=e.username.toLowerCase();return t===e.username?e:{...e,username:t}}async function Ir(){try{return Fr(await Vn(`/auth/status`))}catch{return{authenticated:!1}}}async function Lr(e,t){let n=new URLSearchParams;return e&&n.set(`q`,e),t?.source&&n.set(`source`,t.source),t?.project&&n.set(`project`,t.project),t?.skill&&n.set(`skill`,t.skill),Vn(`/search?${n.toString()}`)}async function Rr(e){return(await Vn(`/sessions/${Bn(e)}`)).session}async function zr(e,t=`summary`){return Vn(`/sessions/${Bn(e)}/context?format=${t}`)}async function Br(e){return Vn(`/sessions/${Bn(e)}/transcript`)}async function Vr(e,t,n,r){try{return await Hn(`/projects/${Bn(e)}/enhance-save`,{selectedSessionIds:t,result:n,...r}),!0}catch{return!1}}async function Hr(e){try{return await Vn(`/projects/${Bn(e)}/git-remote`)}catch{return{url:null}}}async function Ur(e,t,n){return Hn(`/projects/${Bn(e)}/screenshot-capture`,{url:n,slug:t})}async function Wr(e){return Fr(await Hn(`/auth/poll`,{device_code:e}))}async function Gr(e){return Vn(`/auth/check-username?username=${encodeURIComponent(e)}`)}async function Kr(e){return Hn(`/auth/signup`,{username:e})}async function qr(){return Hn(`/auth/login`)}async function Jr(){await Hn(`/auth/logout`)}async function Yr(){return Vn(`/dashboard`)}async function Xr(){await Hn(`/onboarding/complete`)}function Zr(e){let t=new EventSource(`${zn}/sync/progress`);return t.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},t.onerror=()=>{t.close()},()=>t.close()}var Qr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),z=o(((e,t)=>{t.exports=Qr()}))(),$r={default:`bg-surface-low text-on-surface-variant`,green:`bg-green-bg text-green`,amber:`bg-amber-bg text-amber`,violet:`bg-violet-bg text-violet`,primary:`bg-primary/10 text-primary`};function ei({variant:e=`default`,children:t}){return(0,z.jsx)(`span`,{className:`font-mono text-[11px] leading-tight py-0.5 px-2 rounded-sm ${$r[e]}`,children:t})}function ti({value:e,onChange:t,onSubmit:n,compact:r=!1,placeholder:i=`Search sessions...`,autoFocus:a=!1}){let o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{function e(e){e.key===`/`&&!e.ctrlKey&&!e.metaKey&&document.activeElement?.tagName!==`INPUT`&&document.activeElement?.tagName!==`TEXTAREA`&&(e.preventDefault(),o.current?.focus())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsxs)(`svg`,{className:`absolute top-1/2 -translate-y-1/2 text-on-surface-variant ${r?`left-2 w-3.5 h-3.5`:`left-3 w-4 h-4`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,z.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,z.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,z.jsx)(`input`,{ref:o,type:`text`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n&&n(),e.key===`Escape`&&o.current?.blur()},placeholder:i,autoFocus:a,className:[`w-full bg-surface-low border border-ghost rounded-md font-mono text-on-surface placeholder:text-outline transition-colors`,`focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20`,r?`text-xs pl-7 pr-2 py-1`:`text-sm pl-9 pr-3 py-2`].join(` `)}),!r&&(0,z.jsx)(`kbd`,{className:`absolute right-3 top-1/2 -translate-y-1/2 font-mono text-[10px] text-outline bg-surface-mid px-1.5 py-0.5 rounded-sm border border-ghost`,children:`/`})]})}var ni=[{label:`Dashboard`,to:`/`,match:e=>e===`/`},{label:`Portfolio`,to:`/portfolio`,match:e=>e.startsWith(`/portfolio`)},{label:`Projects`,to:`/projects`,match:e=>e===`/projects`||e.startsWith(`/project/`)},{label:`Search sessions`,to:`/search`,match:e=>e===`/search`||e.startsWith(`/session/`)},{label:`Settings`,to:`/settings`,match:e=>e.startsWith(`/settings`)}];function ri({back:e,chips:t,actions:n,children:r}){let i=et(),a=Ze(),o=a.pathname===`/search`,[s,c]=(0,_.useState)(``);return(0,z.jsxs)(`div`,{className:`min-h-screen flex flex-col bg-surface-mid`,children:[(0,z.jsx)(`header`,{className:`sticky top-0 z-50 bg-surface-lowest border-b border-ghost`,children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between h-12 px-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsxs)(bn,{to:`/`,className:`flex items-center gap-2 shrink-0`,children:[(0,z.jsx)(`span`,{className:`w-6 h-6 bg-primary rounded-md flex items-center justify-center text-on-primary font-display text-xs font-bold`,children:`h`}),(0,z.jsx)(`span`,{className:`font-display text-sm font-semibold text-on-surface`,children:`heyi.am`})]}),e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-outline text-xs`,children:`/`}),(0,z.jsx)(bn,{to:e.to,className:`text-sm text-on-surface-variant hover:text-on-surface transition-colors`,children:e.label})]}),t&&t.length>0&&(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 ml-1`,children:t.map(e=>(0,z.jsx)(ei,{variant:e.variant,children:e.label},e.label))})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!o&&(0,z.jsx)(`div`,{className:`w-48`,children:(0,z.jsx)(ti,{value:s,onChange:c,onSubmit:()=>{i(`/search?q=${encodeURIComponent(s)}`),c(``)},compact:!0})}),(0,z.jsxs)(`button`,{type:`button`,"data-testid":`cmdk-pill`,onClick:()=>console.log(`cmd-k`),className:`hidden md:inline-flex items-center gap-1.5 h-7 px-2 rounded-sm border border-ghost text-[0.6875rem] font-mono text-on-surface-variant hover:text-on-surface hover:border-outline transition-colors`,"aria-label":`Open command palette`,children:[(0,z.jsx)(`span`,{children:`⌘K`}),(0,z.jsx)(`span`,{children:`Search`})]}),n]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,z.jsx)(`nav`,{"aria-label":`Primary`,className:`w-[220px] shrink-0 border-r border-ghost bg-surface-lowest py-3 overflow-y-auto`,children:(0,z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2`,children:ni.map(e=>{let t=e.match(a.pathname);return(0,z.jsx)(`li`,{children:(0,z.jsx)(bn,{to:e.to,"aria-current":t?`page`:void 0,className:t?`block px-3 py-1.5 rounded-sm text-[0.8125rem] font-semibold text-primary bg-surface-low`:`block px-3 py-1.5 rounded-sm text-[0.8125rem] text-on-surface-variant hover:text-on-surface hover:bg-surface-low transition-colors`,children:e.label})},e.to)})})}),(0,z.jsx)(`main`,{className:`flex-1 overflow-y-auto`,children:r})]})]})}function ii({hover:e,className:t=``,children:n}){return(0,z.jsx)(`div`,{className:[`bg-surface-lowest border border-ghost rounded-md p-4`,e?`transition-shadow hover:shadow-md`:``,t].filter(Boolean).join(` `),children:n})}var ai={refined:`bg-green-bg text-green`,local:`bg-surface-low text-on-surface-variant`,exported:`bg-amber-bg text-amber`,violet:`bg-violet-bg text-violet`};function oi({variant:e,children:t}){return(0,z.jsx)(`span`,{className:`font-mono text-[9px] leading-tight uppercase tracking-wider py-0.5 px-1.5 rounded-sm ${ai[e]}`,children:t})}function si({label:e,value:t,valueSize:n=`text-2xl`}){return(0,z.jsxs)(`div`,{className:`bg-surface-lowest border border-ghost rounded-md p-4`,children:[(0,z.jsx)(`div`,{className:`font-mono text-[9px] uppercase tracking-wider text-on-surface-variant mb-1`,children:e}),(0,z.jsx)(`div`,{className:`font-display font-bold text-on-surface ${n}`,children:t})]})}function ci({title:e,children:t}){return(0,z.jsxs)(`div`,{className:`bg-surface-low border border-ghost rounded-sm p-2.5`,children:[e&&(0,z.jsx)(`div`,{className:`font-body text-sm font-semibold text-on-surface mb-1`,children:e}),(0,z.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:t})]})}function li({title:e,meta:t,children:n}){return(0,z.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,z.jsx)(`h3`,{className:`font-display text-base font-semibold text-on-surface`,children:e}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,z.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-on-surface-variant`,children:t}),n]})]})}function ui({title:e,message:t,confirmLabel:n=`Confirm`,cancelLabel:r=`Cancel`,destructive:i=!1,details:a,busy:o=!1,error:s,onConfirm:c,onCancel:l}){let u=(0,_.useRef)(null);(0,_.useEffect)(()=>{u.current?.focus()},[]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&!o&&(e.stopPropagation(),l())}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,l]);let d=i?`font-mono text-[0.8125rem] text-white bg-red-600 rounded-md px-3 py-1 hover:bg-red-700 transition-colors disabled:opacity-50`:`font-mono text-[0.8125rem] text-on-primary bg-primary rounded-md px-3 py-1 hover:bg-primary-hover transition-colors disabled:opacity-50`;return(0,z.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`confirm-modal-title`,className:`fixed inset-0 z-[80] flex items-center justify-center bg-black/40`,children:(0,z.jsxs)(`div`,{className:`bg-surface-lowest rounded-md border border-ghost shadow-lg w-full max-w-md`,children:[(0,z.jsx)(`div`,{className:`px-4 py-3 border-b border-ghost`,children:(0,z.jsx)(`span`,{id:`confirm-modal-title`,className:`font-mono text-[0.8125rem] font-semibold text-on-surface`,children:e})}),(0,z.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,z.jsx)(`p`,{className:`text-sm text-on-surface leading-relaxed`,children:t}),a&&(0,z.jsx)(`p`,{className:`mt-2 text-xs text-on-surface-variant leading-relaxed`,children:a}),s&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-error font-mono`,role:`alert`,children:s})]}),(0,z.jsxs)(`div`,{className:`px-4 py-3 border-t border-ghost flex justify-end gap-2`,children:[(0,z.jsx)(`button`,{ref:u,type:`button`,disabled:o,onClick:l,className:`font-mono text-[0.8125rem] text-on-surface-variant hover:text-on-surface px-3 py-1 disabled:opacity-50`,children:r}),(0,z.jsx)(`button`,{type:`button`,disabled:o,onClick:c,className:d,children:o?`Working...`:n})]})]})})}function di({dashboard:e,stats:t,projects:n}){let r=n.slice(0,4),i=t?.enhancedCount??0;return(0,z.jsxs)(`div`,{className:`p-6`,children:[(0,z.jsx)(`h1`,{className:`font-display text-[1.75rem] leading-[1.1] font-bold text-on-surface`,children:`Turn your AI sessions into a dev portfolio.`}),t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`h-6`}),(0,z.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,z.jsx)(pi,{label:`Sessions indexed`,value:t.sessionCount,to:`/archive`,color:`var(--primary)`}),(0,z.jsx)(pi,{label:`Projects`,value:t.projectCount,to:`/projects`}),(0,z.jsx)(pi,{label:`Enhanced`,value:i,to:`/projects?filter=unenhanced`,color:i>0?`#34d399`:void 0}),(0,z.jsx)(pi,{label:`Sources`,value:t.sourceCount,to:`/sources`})]})]}),(0,z.jsx)(`div`,{className:`h-6`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,z.jsx)(bn,{to:`/sources`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm bg-primary text-on-primary hover:bg-primary-hover transition-colors`,children:`Sync new sessions`}),(0,z.jsx)(bn,{to:`/projects`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`View projects`}),(0,z.jsx)(bn,{to:`/search`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`Search sessions`}),(0,z.jsx)(bn,{to:`/portfolio`,className:`inline-flex items-center gap-1.5 font-semibold text-[0.8125rem] px-4 py-2 rounded-sm text-primary border border-ghost hover:border-outline transition-colors`,children:`Open Portfolio`}),e?.sync.status===`syncing`&&(0,z.jsxs)(`span`,{className:`text-xs text-on-surface-variant`,children:[`syncing `,e.sync.current,`/`,e.sync.total,e.sync.currentProject?` — ${e.sync.currentProject}`:``,`...`]})]}),(0,z.jsx)(`div`,{className:`h-10`}),r.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,z.jsx)(`h2`,{className:`font-semibold text-sm text-on-surface`,children:`Recent projects`}),(0,z.jsx)(bn,{to:`/projects`,className:`text-xs text-primary hover:underline`,children:`View all →`})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:r.map(e=>(0,z.jsx)(fi,{project:e},e.projectDir))}),(0,z.jsx)(`div`,{className:`h-10`})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,z.jsx)(mi,{to:`/archive`,label:`Archive`,title:`Back up sessions`,desc:`Import from local AI tools before they expire. Everything stays on your machine.`}),(0,z.jsx)(mi,{to:`/projects`,label:`Build`,title:`AI case studies`,desc:`AI reads your sessions, extracts skills, and drafts a narrative for each project.`}),(0,z.jsx)(mi,{to:`/search`,label:`Search`,title:`Find past work`,desc:`Full-text search across all sessions. Filter by tool, project, or skill.`}),(0,z.jsx)(mi,{to:`/portfolio`,label:`Export`,title:`HTML, markdown, or publish`,desc:`Export your full portfolio as a static site, publish to heyi.am, or push to GitHub Pages.`})]}),(0,z.jsx)(`div`,{className:`h-8`}),(0,z.jsxs)(`div`,{className:`border-t border-ghost pt-4 flex items-start gap-6 text-xs text-on-surface-variant`,children:[(0,z.jsx)(`span`,{children:`Everything is local by default.`}),(0,z.jsx)(`span`,{children:`Nothing is published unless you choose to.`}),(0,z.jsx)(`span`,{children:`No account required to archive or export.`})]})]})}function fi({project:e}){return(0,z.jsxs)(bn,{to:`/project/${encodeURIComponent(e.projectDir)}`,className:`group block bg-white border border-ghost rounded-sm p-3.5 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`font-semibold text-sm text-on-surface truncate`,children:e.projectName}),(0,z.jsxs)(`div`,{className:`text-xs text-on-surface-variant mt-0.5`,children:[e.sessionCount,` session`,e.sessionCount===1?``:`s`,e.enhancedAt&&(0,z.jsx)(`span`,{className:`ml-2`,style:{color:`#34d399`},children:`enhanced`})]}),e.skills.length>0&&(0,z.jsx)(`div`,{className:`flex gap-1 mt-2 flex-wrap`,children:e.skills.slice(0,3).map(e=>(0,z.jsx)(ei,{children:e},e))})]})}function pi({label:e,value:t,to:n,color:r}){return(0,z.jsxs)(bn,{to:n,className:`block bg-white border border-ghost rounded-sm px-4 py-3 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`text-2xl font-bold`,style:r?{color:r}:{color:`var(--on-surface)`},children:t}),(0,z.jsx)(`div`,{className:`text-xs text-on-surface-variant mt-0.5`,children:e})]})}function mi({to:e,label:t,title:n,desc:r}){return(0,z.jsxs)(bn,{to:e,className:`group block bg-white border border-ghost rounded-sm p-4 hover:border-outline transition-colors`,children:[(0,z.jsx)(`div`,{className:`font-mono text-[9px] uppercase tracking-wider text-primary mb-1.5`,children:t}),(0,z.jsx)(`div`,{className:`font-semibold text-sm text-on-surface mb-1`,children:n}),(0,z.jsx)(`div`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:r})]})}var hi={main:`#084471`,orchestrator:`#084471`,"frontend-dev":`#7c3aed`,frontend:`#7c3aed`,"backend-dev":`#0891b2`,backend:`#0891b2`,"qa-engineer":`#059669`,qa:`#059669`,"ux-designer":`#d97706`,ux:`#d97706`,"product-manager":`#dc2626`,pm:`#dc2626`,"security-engineer":`#475569`,"team-lead":`#475569`,explore:`#94a3b8`,"code-reviewer":`#e11d48`,reviewer:`#e11d48`,"code-explorer":`#2563eb`,explorer:`#2563eb`,"code-architect":`#7e22ce`,architect:`#7e22ce`,"test-runner":`#16a34a`,tester:`#16a34a`,"build-fix":`#ea580c`,fixer:`#ea580c`,planner:`#0d9488`,plan:`#0d9488`,research:`#6366f1`,researcher:`#6366f1`,agent:`#2563eb`,wiring:`#c026d3`,enhance:`#0891b2`},gi=`#084471`,_i=`#d1d5db`,vi=`'IBM Plex Mono', monospace`,yi=`#6b7280`,bi=`#9ca3af`,xi=[`#e11d48`,`#2563eb`,`#7e22ce`,`#ea580c`,`#0d9488`,`#6366f1`,`#c026d3`,`#0891b2`,`#ca8a04`,`#16a34a`,`#be185d`,`#4f46e5`,`#0e7490`,`#b45309`,`#059669`];function Si(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Ci(e){if(!e)return yi;let t=e.toLowerCase();if(hi[t])return hi[t];for(let[e,n]of Object.entries(hi))if(t.includes(e)||e.includes(t))return n;return xi[Si(t)%xi.length]}function wi(e){return new Date(e.date).getTime()}function Ti(e){if(e.endTime)return new Date(e.endTime).getTime();let t=e.wallClockMinutes??e.durationMinutes;return wi(e)+t*6e4}function Ei(e){let t=e/36e5;if(t<20)return`${Math.round(t)}h gap`;let n=Math.round(t/24);return n===1?`1 day gap`:`${n} days gap`}function Di(e){let t=new Date(e),n=t.toLocaleString(`en-US`,{month:`short`}),r=t.getDate(),i=t.getHours(),a=t.getMinutes().toString().padStart(2,`0`),o=i>=12?`PM`:`AM`;return`${n} ${r}, ${i%12||12}:${a} ${o}`}function Oi(e){if(e<60)return`${Math.round(e)}m`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}var ki=36e5,Ai=160,ji=480;function Mi(e){return Math.min(Math.max(e*3,Ai),ji)}function Ni(e){if(!e.length)return[];let t=[...e].sort((e,t)=>wi(e)-wi(t)),n=[],r=null;for(let e of t){let t=wi(e),i=Ti(e);!r||t>=r.e?(r&&n.push(r),r={sessions:[e],s:t,e:i}):(r.sessions.push(e),i>r.e&&(r.e=i))}r&&n.push(r);let i=[];for(let e=0;e<n.length;e++){let t=n[e];if(e>0){let r=t.s-n[e-1].e;r>ki&&i.push({type:`gap`,durationMs:r})}t.sessions.length===1?i.push({type:`session`,session:t.sessions[0],startMs:t.s,endMs:t.e}):i.push({type:`concurrent`,sessions:t.sessions,startMs:t.s,endMs:t.e})}return i}function Pi(e){let t=[...e].sort((e,t)=>wi(e)-wi(t)),n=[],r=new Map;for(let e of t){let t=wi(e),i=-1;for(let e=0;e<n.length;e++)if(n[e]<=t){i=e;break}i===-1&&(i=n.length,n.push(0));let a=((e.children?.length??0)>5?30:15)*6e4;n[i]=Ti(e)+a,r.set(e.id,i)}return r}function Fi(e,t,n,r,i){return n===t?r:r+(e-t)/(n-t)*(i-r)}function Ii(e){return e.children?.length?e.children.map(e=>({id:e.sessionId,role:e.role,durationMinutes:e.durationMinutes??0,linesOfCode:e.linesOfCode??0,date:e.date})):[]}var Li=2*6e4;function Ri(e,t){let n=e.map(e=>({...e,startMs:e.date?new Date(e.date).getTime():t,endMs:(e.date?new Date(e.date).getTime():t)+e.durationMinutes*6e4})).sort((e,t)=>e.startMs-t.startMs),r=[],i=null;for(let e of n)!i||e.startMs>i.startMs+Li?(i&&r.push({children:i.children,startMs:i.startMs,endMs:i.endMs}),i={children:[e],startMs:e.startMs,endMs:e.endMs}):(i.children.push(e),e.endMs>i.endMs&&(i.endMs=e.endMs));return i&&r.push({children:i.children,startMs:i.startMs,endMs:i.endMs}),r}function zi(e,t){let n=e.map(e=>{let n=e.date?new Date(e.date).getTime():t,r=n+e.durationMinutes*6e4;return{...e,startMs:n,endMs:r}}).sort((e,t)=>e.startMs-t.startMs),r=new Map;return n.forEach((e,t)=>r.set(e.id,t)),{laneMap:r,laneCount:n.length}}function Bi(e){let t=Ii(e);return{title:e.title,timestamp:Di(e.date),duration:Oi(e.wallClockMinutes??e.durationMinutes),linesOfCode:e.linesOfCode,agentCount:t.length,session:e}}var Vi=6,Hi=30;function Ui(e){let t=new Map;for(let n of e){let e=n.role??`agent`,r=t.get(e);r?(r.totalMin+=n.durationMinutes,r.count+=1):t.set(e,{totalMin:n.durationMinutes,count:1})}return[...t.entries()].sort((e,t)=>t[1].totalMin-e[1].totalMin).map(([e,{totalMin:t,count:n}])=>({role:e,color:Ci(e),duration:Oi(t),count:n}))}function Wi(e){return e.map(e=>{let t=Ii(e.session);return{title:e.session.title,timestamp:Di(e.session.date),agents:Ui(t),totalAgents:t.length,xStart:e.xStart,xEnd:e.xEnd}})}var Gi=30,Ki=56,qi=50,Ji=140,Yi=4,Xi=300,Zi=1200,Qi=140,$i=32;function ea(e){return e<=5?44:e<=10?32:e<=20?22:16}function ta(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function na(e,t,n,r){if(r===n)return`M ${e} ${n} L ${t} ${n}`;let i=Math.min(qi,(t-e)/4);return[`M ${e} ${n}`,`C ${e+i} ${n}, ${e+i} ${r}, ${e+i*2} ${r}`,`L ${t-i*2} ${r}`,`C ${t-i} ${r}, ${t-i} ${n}, ${t} ${n}`].join(` `)}var ra=8;function ia(e,t=ra,n,r){let i=n??gi,a=r??bi,o=[],s=[],c=[],l=!1,u=48,d=0,f=0,p=u,m=(e,t)=>{e<d&&(d=e),e+t>f&&(f=e+t)};for(let n of e){if(n.type===`gap`){s.push({path:`M ${u} 0 L ${u+72} 0`,color:a,width:1.5,dashed:!0}),o.push({kind:`gap`,pos:{x:u,y:16},label:Ei(n.durationMs),durationMs:n.durationMs}),m(-8,40),u+=72+Ki;continue}if(n.type===`session`){let e=n.session,t=Ii(e),r=e.durationMinutes,a=t.length>0?Math.max(Ai,t.length*30+100):Ai,l=t.length>0?Math.min(Math.max(r*Yi,a),Zi):Math.min(Math.max(Mi(r),Ai),ji),d=Oi(e.durationMinutes),f=Bi(e),p=Di(e.date);if(t.length>0){let n=t.slice(0,Gi),r=wi(e),a=r+e.durationMinutes*6e4,h=Math.max(a,...n.map(e=>(e.date?new Date(e.date).getTime():r)+e.durationMinutes*6e4)),g=Ri(n,r),_=Math.max(...g.map(e=>e.children.length),1),v=ea(_),y=Math.min((_-1)*v,120),b=u,x=u+l,S=0-y/2-16,C=b+qi*2;o.push({kind:`label`,pos:{x:C+8,y:S},title:ta(e.title,$i),sub:d,timestamp:p,color:i,above:!0,session:e,tooltip:f}),m(S-4,16),o.push({kind:`dot`,pos:{x:b,y:0},color:i,size:`lg`,tooltip:f}),s.push({path:`M ${b} 0 L ${x} 0`,color:i,width:1.5});for(let e of g){let t=e.children.length,n=Math.min((t-1)*v,y),i=t>1?n/(t-1):0,a=0-n/2,o=Fi(e.startMs,r,h,b,x);e.children.forEach((e,t)=>{let n=a+t*i,c=Ci(e.role),l=(e.date?new Date(e.date).getTime():r)+e.durationMinutes*6e4,u=Fi(Math.min(l,h),r,h,b,x),d=Math.max(u,o+100);s.push({path:na(o,Math.min(d,x),0,n),color:c,width:1.5}),m(n-2,4)})}o.push({kind:`dot`,pos:{x,y:0},color:i,size:`lg`,tooltip:f}),c.push({session:e,xStart:b,xEnd:x}),u=x+Ki}else o.push({kind:`label`,pos:{x:u+14,y:-16},title:ta(e.title,$i),sub:d,timestamp:p,color:i,above:!0,session:e,tooltip:f}),m(-20,16),o.push({kind:`dot`,pos:{x:u,y:0},color:i,size:`sm`,tooltip:f}),o.push({kind:`dot`,pos:{x:u+l,y:0},color:i,size:`sm`,tooltip:f}),s.push({path:`M ${u} 0 L ${u+l} 0`,color:i,width:3}),c.push({session:e,xStart:u,xEnd:u+l}),u+=l+Ki;continue}if(n.type===`concurrent`){let e=[...n.sessions].sort((e,t)=>wi(e)-wi(t)),r=e.slice(0,t),d=Pi(r),f=Math.max(...d.values())+1,p=e.length-r.length;p>0&&(l=!0);let h=Math.max(...r.map(e=>Ii(e).length),0),g=h>15?Math.max(Ji,h*5+60):h>5?Math.max(Ji,h*8+40):Ji,_=n.startMs,v=n.endMs,y=(v-_)/6e4,b=Math.min(Math.max(y*Yi,Xi),Zi),x=u,S=u+b,C=Array(f).fill(0);for(let n of e.slice(0,t)){let e=d.get(n.id)??0,t=0+e*g,r=Ii(n),a=Bi(n),l=Di(n.date),u=Oi(n.durationMinutes),f=Fi(wi(n),_,v,x,S),p=f+Math.min(Math.max(n.durationMinutes*Yi,20),S-f);if(r.length>0){let d=r.slice(0,Gi),h=wi(n),_=Ti(n),{laneMap:v,laneCount:y}=zi(d,h),b=ea(y),x=Math.min((y-1)*b,g-40),S=y>1?x/(y-1):0,w=t-x/2,T=w-32;(C[e]===0||f>=C[e])&&(o.push({kind:`label`,pos:{x:f+8,y:T},title:ta(n.title,$i),sub:u,timestamp:l,color:i,above:!0,session:n,tooltip:a}),C[e]=f+Qi),m(T-4,28),o.push({kind:`dot`,pos:{x:f,y:t},color:i,size:`lg`,tooltip:a}),s.push({path:`M ${f} ${t} L ${p} ${t}`,color:i,width:1.5});let E=y>15?.4:y>8?.6:.8,D=y>15?1:1.5;d.forEach(e=>{let n=w+(v.get(e.id)??0)*S,r=Ci(e.role),i=e.date?new Date(e.date).getTime():h,a=i+e.durationMinutes*6e4,o=Fi(i,h,_,f,p),c=Math.min(Fi(Math.min(a,_),h,_,f,p),p),l=Math.max(c,o+60);s.push({path:na(o,Math.min(l,p),t,n),color:r,width:D,opacity:E}),m(n-2,4)}),o.push({kind:`dot`,pos:{x:p,y:t},color:i,size:`lg`,tooltip:a}),c.push({session:n,xStart:f,xEnd:p})}else (C[e]===0||f>=C[e])&&(o.push({kind:`label`,pos:{x:f+8,y:t-16},title:ta(n.title,$i),sub:u,timestamp:l,color:i,above:!0,session:n,tooltip:a}),C[e]=f+Qi),m(t-32,28),o.push({kind:`dot`,pos:{x:f,y:t},color:i,size:`sm`,tooltip:a}),o.push({kind:`dot`,pos:{x:p,y:t},color:i,size:`sm`,tooltip:a}),s.push({path:`M ${f} ${t} L ${p} ${t}`,color:i,width:3}),c.push({session:n,xStart:f,xEnd:p});m(t-4,8)}if(p>0){let e=0+f*g;o.push({kind:`label`,pos:{x:x+8,y:e},title:`+${p} more sessions`,color:a,above:!1}),m(e,16)}u=S+Ki}}let h=u-Ki,g=-d+4,_=f-d+8;return{nodes:o.map(e=>({...e,pos:{x:e.pos.x,y:e.pos.y+g}})),tracks:s,sessionRanges:c,hasConcurrentOverflow:l,threadStart:p,threadEnd:h,totalW:u+48,totalH:Math.max(_,100),centerY:0+g}}function aa(e,t,n){if(!n.length)return null;let r=e+t/2,i=null,a=1/0;for(let e of n){let t=(e.xStart+e.xEnd)/2,n=Math.abs(r-t);n<a&&(a=n,i=e)}return i}function oa({entry:e,textSecondaryColor:t,textMutedColor:n}){if(!e||e.agents.length===0)return null;let r=e.agents.slice(0,Vi),i=e.agents.length-r.length,a=e.totalAgents>=Hi;return(0,z.jsxs)(`div`,{style:{fontFamily:vi,fontSize:10,display:`flex`,alignItems:`baseline`,gap:14,padding:`2px 0`,minHeight:20},children:[a?(0,z.jsxs)(`span`,{style:{fontSize:10,fontWeight:700,letterSpacing:`0.06em`,color:`#d97706`,flexShrink:0},children:[`LEGENDARY AGENTIC USE — `,e.totalAgents,` agents:`]}):(0,z.jsxs)(`span`,{style:{fontSize:10,color:t,fontWeight:600,flexShrink:0},children:[e.totalAgents,` agents:`]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:10,alignItems:`center`},children:[r.map(e=>(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5},children:[(0,z.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:e.color,boxShadow:`0 0 4px ${e.color}40`,flexShrink:0}}),(0,z.jsx)(`span`,{style:{fontWeight:600,color:e.color,letterSpacing:`0.03em`},children:e.role.toUpperCase()}),e.count>1&&(0,z.jsxs)(`span`,{style:{color:n},children:[`×`,e.count]}),(0,z.jsx)(`span`,{style:{color:n},children:e.duration})]},e.role)),i>0&&(0,z.jsxs)(`span`,{style:{color:n,fontStyle:`italic`},children:[`+`,i,` more`]})]})]})}function sa({data:e,pos:t}){return(0,z.jsxs)(`div`,{style:{position:`absolute`,left:t.x,top:t.y-8,transform:`translateY(-100%)`,background:`#1f2937`,color:`#f9fafb`,borderRadius:6,padding:`10px 14px`,fontFamily:vi,fontSize:11,lineHeight:1.5,whiteSpace:`nowrap`,zIndex:100,pointerEvents:`none`,boxShadow:`0 4px 16px rgba(0,0,0,0.18)`},children:[(0,z.jsx)(`div`,{style:{fontWeight:700,fontSize:12,marginBottom:4,color:`#fff`},children:e.title}),(0,z.jsx)(`div`,{style:{color:`#d1d5db`},children:e.timestamp}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:16,marginTop:4},children:[(0,z.jsx)(`span`,{children:e.duration}),(0,z.jsxs)(`span`,{children:[e.linesOfCode.toLocaleString(),` lines`]}),e.agentCount>0&&(0,z.jsxs)(`span`,{children:[e.agentCount,` agents`]})]})]})}function ca({sessions:e,onSessionClick:t,maxHeight:n,accentColor:r,isDark:i}){let a=r??(i?`#f97316`:gi),o=i?`rgba(255,255,255,0.15)`:_i,s=i?`rgba(255,255,255,0.65)`:yi,c=i?`rgba(255,255,255,0.4)`:bi,l=(0,_.useMemo)(()=>Ni(e),[e]),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=u?999:ra,y=(0,_.useMemo)(()=>ia(l,v,a,c),[l,v,a,c]),b=(0,_.useMemo)(()=>Wi(y.sessionRanges),[y.sessionRanges]),x=(0,_.useRef)(null),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=b.filter(e=>e.agents.length>0);e.length>0&&T(e[0])},[b]);let E=(0,_.useCallback)(()=>{let e=x.current;if(!e)return;let t=b.filter(e=>e.agents.length>0),n=aa(e.scrollLeft,e.clientWidth,t);n&&T(n)},[b]),D=(0,_.useCallback)(()=>{if(m){g.current&&cancelAnimationFrame(g.current),g.current=null,h(!1);return}h(!0);let e=()=>{let t=x.current;if(t){if(t.scrollLeft>=t.scrollWidth-t.clientWidth-1){h(!1),g.current=null;return}t.scrollLeft+=1.2,g.current=requestAnimationFrame(e)}};g.current=requestAnimationFrame(e)},[m]);(0,_.useEffect)(()=>()=>{g.current&&cancelAnimationFrame(g.current)},[]),(0,_.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[f]);let O=(0,_.useCallback)((e,t)=>{e&&C({tooltip:e,pos:t})},[]),k=(0,_.useCallback)(()=>C(null),[]);if(!e.length)return(0,z.jsx)(`div`,{"data-testid":`work-timeline-empty`,children:(0,z.jsx)(`p`,{style:{fontFamily:vi,fontSize:`0.8125rem`,color:s},children:`No sessions to display.`})});let A=b.some(e=>e.agents.length>0),j=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,z.jsx)(`div`,{style:{flex:1,minWidth:0},children:A&&(0,z.jsx)(oa,{entry:w,textSecondaryColor:s,textMutedColor:c})}),(0,z.jsx)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:y.totalW>600&&(0,z.jsx)(`button`,{onClick:D,style:(e=>({padding:`3px 10px`,fontSize:10,fontWeight:600,border:`1px solid ${o}`,borderRadius:4,background:e?a:i?`rgba(255,255,255,0.08)`:`#fff`,color:e?`#fff`:a,cursor:`pointer`,fontFamily:vi,letterSpacing:`0.03em`,flexShrink:0}))(m),children:m?`PAUSE`:`PLAY`})})]}),(0,z.jsx)(`div`,{ref:x,onScroll:E,style:{overflowX:`auto`,overflowY:f?`auto`:`hidden`,WebkitOverflowScrolling:`touch`,maxHeight:f?`calc(100vh - 80px)`:void 0},children:(0,z.jsxs)(`div`,{style:{position:`relative`,width:y.totalW,height:y.totalH,fontFamily:vi},children:[(0,z.jsxs)(`svg`,{style:{position:`absolute`,inset:0,width:y.totalW,height:y.totalH,pointerEvents:`none`},children:[(0,z.jsx)(`line`,{x1:y.threadStart,y1:y.centerY,x2:y.threadEnd,y2:y.centerY,stroke:o,strokeWidth:1.5}),y.tracks.map((e,t)=>(0,z.jsx)(`path`,{d:e.path,fill:`none`,stroke:e.color,strokeWidth:e.width,opacity:e.opacity??.8,strokeDasharray:e.dashed?`6 4`:void 0,transform:`translate(0, ${y.centerY})`},`t-${t}`))]}),y.nodes.map((e,n)=>{if(e.kind===`label`)return(0,z.jsxs)(`div`,{style:{position:`absolute`,left:e.pos.x,top:e.pos.y,cursor:t&&e.session?`pointer`:`default`,whiteSpace:`nowrap`},onClick:t&&e.session?()=>t(e.session):void 0,onMouseEnter:e.tooltip?()=>O(e.tooltip,e.pos):void 0,onMouseLeave:e.tooltip?k:void 0,children:[(0,z.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:e.color,letterSpacing:`0.01em`,display:`block`},children:e.title}),(0,z.jsxs)(`span`,{style:{fontSize:10,color:c,display:`flex`,gap:8,marginTop:1},children:[e.sub&&(0,z.jsx)(`span`,{children:e.sub}),e.timestamp&&(0,z.jsx)(`span`,{style:{color:s},children:e.timestamp})]})]},`l-${n}`);if(e.kind===`dot`){let t=e.size===`lg`?6:4;return(0,z.jsx)(`div`,{onMouseEnter:e.tooltip?()=>O(e.tooltip,e.pos):void 0,onMouseLeave:e.tooltip?k:void 0,style:{position:`absolute`,left:e.pos.x-t,top:e.pos.y-t,width:t*2,height:t*2,borderRadius:`50%`,background:e.color,boxShadow:`0 0 ${e.size===`lg`?10:5}px ${e.color}50`,zIndex:2,cursor:e.tooltip?`pointer`:`default`}},`d-${n}`)}return e.kind===`gap`?(0,z.jsx)(`div`,{style:{position:`absolute`,left:e.pos.x,top:e.pos.y,width:72,height:22,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:10,color:c,letterSpacing:`0.04em`},children:e.label},`g-${n}`):null}),S&&(0,z.jsx)(sa,{data:S.tooltip,pos:S.pos})]})})]});if(f)return(0,z.jsxs)(`div`,{style:{position:`fixed`,inset:0,zIndex:9998,background:i?`#111`:`#f8f9fb`,display:`flex`,flexDirection:`column`,padding:`16px 24px`},children:[(0,z.jsx)(`button`,{onClick:()=>p(!1),style:{position:`absolute`,top:16,right:24,zIndex:1,padding:`6px 14px`,fontSize:12,fontWeight:700,border:`1px solid ${o}`,borderRadius:4,background:i?`rgba(255,255,255,0.08)`:`#fff`,color:a,cursor:`pointer`,fontFamily:vi},children:`Close`}),(0,z.jsx)(`div`,{"data-testid":`work-timeline`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:j})]});let M=n&&y.totalH>n;return(0,z.jsxs)(`div`,{"data-testid":`work-timeline`,style:{position:`relative`},children:[(0,z.jsx)(`div`,{style:M?{maxHeight:n,overflow:`hidden`}:void 0,children:j}),M&&(0,z.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,height:64,background:i?`linear-gradient(transparent, #111)`:`linear-gradient(transparent, #f8f9fb)`,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,paddingBottom:10},children:(0,z.jsx)(`button`,{onClick:()=>{d(!0),p(!0)},style:{padding:`5px 16px`,fontSize:11,fontWeight:700,border:`1px solid ${o}`,borderRadius:4,background:i?`rgba(255,255,255,0.08)`:`#fff`,color:a,cursor:`pointer`,fontFamily:vi,letterSpacing:`0.03em`,boxShadow:`0 2px 8px rgba(0,0,0,0.08)`},children:`EXPAND TIMELINE`})})]})}function la(e){let t=e/60;return t>=1?`${t.toFixed(1)}h`:`${Math.round(e)}m`}function ua(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var da=`'IBM Plex Mono', monospace`,fa=`#084471`,pa=`#9ca3af`,ma=`#6b7280`,ha=`#e4e4e7`;function ga(e){return e===0?`0`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function _a(e){if(e<=0)return[0];let t=e/4,n=10**Math.floor(Math.log10(t)),r=[1,2,2.5,5,10],i=n;for(let e of r)if(e*n>=t){i=e*n;break}let a=[];for(let t=0;t<=e+i*.1;t+=i)a.push(Math.round(t));return a[a.length-1]<e&&a.push(a[a.length-1]+Math.round(i)),a}function va(e){let t=[...e].filter(e=>e.date).sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime());if(t.length===0)return[];let n=0,r=0;return t.map((e,t)=>{let i=0,a=0;if(e.filesChanged&&e.filesChanged.length>0)for(let t of e.filesChanged)i+=t.additions,a+=t.deletions;else i=Math.max(0,e.linesOfCode);return n+=i,r+=a,{dateMs:new Date(e.date).getTime(),cumulativeAdded:n,cumulativeDeleted:r,sessionIndex:t,sessionId:e.id,title:e.title,added:i,deleted:a}})}var ya=3600*1e3,ba=600*1e3;function xa(e){if(e.length===0)return{visualTimes:[],totalVisualTime:0};let t=[0],n=0;for(let r=1;r<e.length;r++){let i=e[r].dateMs-e[r-1].dateMs;n+=i>ya?ba:Math.max(i,0),t.push(n)}return{visualTimes:t,totalVisualTime:n}}function Sa(e,t,n){if(e.length<2)return[];let r=e[0].dateMs,i=e[e.length-1].dateMs;if(i-r<14*864e5)return[];let a=[],o=new Date(r),s=new Date(i),c=new Date(o.getFullYear(),o.getMonth()+1,1);for(;c<=s;){let r=c.getTime(),i=0,o=1/0;for(let t=0;t<e.length;t++){let n=Math.abs(e[t].dateMs-r);n<o&&(o=n,i=t)}a.push({x:n(t[i]),label:c.toLocaleString(`en-US`,{month:`short`}).toUpperCase()}),c.setMonth(c.getMonth()+1)}return a}function Ca({sessions:e,totalLoc:t,totalFiles:n,keyMoments:r,onSessionClick:i,isDark:a,accentColor:o,dualPositive:s,variant:c=`default`}){let l=c===`radar`,u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=l?a?`#22d3ee`:`#0891b2`:o||(a?`#f97316`:fa),g=a?{textMuted:l?`#94a3b8`:`rgba(255,255,255,0.4)`,textSecondary:l?`#cbd5e1`:`rgba(255,255,255,0.65)`,grid:l?`rgba(34,211,238,0.04)`:`rgba(255,255,255,0.06)`,gridAxis:l?`rgba(34,211,238,0.08)`:`rgba(255,255,255,0.06)`,text:`#fafafa`,accent:h,dotStroke:`rgba(0,0,0,0.3)`}:{textMuted:l?`#64748b`:pa,textSecondary:l?`#64748b`:ma,grid:l?`rgba(100,116,139,0.08)`:ha,gridAxis:l?`rgba(100,116,139,0.15)`:ha,text:`#191c1e`,accent:h,dotStroke:`#fff`},v=va(e);if(v.length===0)return(0,z.jsx)(`div`,{style:{fontFamily:da,fontSize:`0.75rem`,color:g.textSecondary,padding:16},children:`No session data available for growth chart.`});let{visualTimes:y,totalVisualTime:b}=xa(v),x=new Map;if(r)for(let e of r)x.set(e.sessionId,e.label);let S=v[v.length-1].cumulativeAdded,C=v[v.length-1].cumulativeDeleted,w=C>0,T=Math.round(b/6e4*.8)+120,E=v.length*12+120,D=Math.max(700,T,E),O=b||1,k=e=>48+e/O*(D-48-16),A,j,M,N,P,ee,F,I,te,L,ne;s?(I=_a(Math.max(S,C,1)),ee=I[I.length-1]||1,te=[],F=0,A=160,j=0,M=0,N=24+A+36,P=24+A,L=e=>P-e/ee*A,ne=L):(I=_a(Math.max(S,1)),ee=I[I.length-1]||1,te=w?_a(C):[],F=w?te[te.length-1]||1:0,A=140,j=w?50:0,M=w?2:0,N=24+A+M+j+36,P=24+A,L=e=>P-e/ee*A,ne=e=>P+M+e/F*j);let re=v.map((e,t)=>({x:k(y[t]),y:L(e.cumulativeAdded)})),ie=w?v.map((e,t)=>({x:k(y[t]),y:ne(e.cumulativeDeleted)})):[];function R(e){if(e.length===0)return``;let t=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=1;n<e.length;n++)t+=` L${e[n].x.toFixed(1)},${e[n-1].y.toFixed(1)}`,t+=` L${e[n].x.toFixed(1)},${e[n].y.toFixed(1)}`;return t}function ae(e){return e.length===0?``:e.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `)}let oe=l?ae:R,se=oe(re),ce=se+` L${re[re.length-1].x.toFixed(1)},${P} L${re[0].x.toFixed(1)},${P} Z`,le=w?oe(ie):``,ue=w?le+` L${ie[ie.length-1].x.toFixed(1)},${P+M} L${ie[0].x.toFixed(1)},${P+M} Z`:``,de=new Set,fe=-1/0;for(let e=0;e<v.length;e++){let t=k(y[e]);t-fe>=90&&(de.add(e),fe=t)}v.length>1&&de.add(v.length-1);let pe=Sa(v,y,k),me=D>700,he=[...e].filter(e=>e.date).sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime());return(0,_.useEffect)(()=>{if(!l)return;let e=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t=[u.current,d.current].filter(e=>e!==null),n=[f.current,p.current].filter(e=>e!==null);if(e){for(let e of n)e.style.opacity=`1`;return}for(let e of t){let t=e.getTotalLength();e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=`${t}`,e.style.transition=`none`}for(let e of n)e.style.opacity=`0`,e.style.transition=`none`;let r=new IntersectionObserver(e=>{for(let i of e)i.isIntersecting&&(requestAnimationFrame(()=>{for(let e of t)e.style.transition=`stroke-dashoffset 1.2s ease-out`,e.style.strokeDashoffset=`0`;setTimeout(()=>{for(let e of n)e.style.transition=`opacity 0.8s ease-out`,e.style.opacity=`1`},400)}),r.disconnect())},{threshold:.2});return m.current&&r.observe(m.current),()=>r.disconnect()},[l,v.length]),(0,z.jsxs)(`div`,{ref:m,children:[(0,z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,padding:`8px 12px`,borderBottom:`1px solid ${g.grid}`,fontFamily:da},children:[(0,z.jsx)(`span`,{style:{fontSize:10,fontWeight:700,color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`},children:s?`Lines Changed`:`Code Changes Over Time`}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11,fontWeight:600},children:[(0,z.jsxs)(`span`,{style:{color:g.accent},children:[`+`,ua(S)]}),w&&(0,z.jsxs)(`span`,{style:{color:g.textSecondary},children:[`-`,ua(C)]}),(0,z.jsxs)(`span`,{style:{color:g.text},children:[ua(t),` total`]})]})]}),(0,z.jsx)(`div`,{style:me?{overflowX:`auto`}:{padding:`4px 0`},children:(0,z.jsxs)(`svg`,{viewBox:`0 0 ${D} ${N}`,width:me?D:`100%`,height:me?N:void 0,preserveAspectRatio:`xMidYMid meet`,style:{display:`block`},children:[(0,z.jsxs)(`defs`,{children:[(0,z.jsxs)(`linearGradient`,{id:`addGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,z.jsx)(`stop`,{offset:`0%`,stopColor:g.accent,stopOpacity:l?.05:.12}),(0,z.jsx)(`stop`,{offset:`100%`,stopColor:g.accent,stopOpacity:l?.05:.02})]}),(0,z.jsxs)(`linearGradient`,{id:`delGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,z.jsx)(`stop`,{offset:`0%`,stopColor:g.accent,stopOpacity:l?.05:s?.12:.02}),(0,z.jsx)(`stop`,{offset:`100%`,stopColor:g.accent,stopOpacity:l?.05:s?.02:.1})]}),l&&(0,z.jsxs)(`filter`,{id:`dotGlow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,z.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`blur`}),(0,z.jsx)(`feComposite`,{in:`SourceGraphic`,in2:`blur`,operator:`over`})]})]}),I.map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`line`,{x1:48,y1:L(e),x2:D-16,y2:L(e),stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`4,4`}),(0,z.jsx)(`text`,{x:40,y:L(e)+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:e===0?``:s?ga(e):`+${ga(e)}`})]},`ya-${e}`)),l&&(0,z.jsx)(`line`,{x1:48,y1:24,x2:48,y2:P+M+j,stroke:g.gridAxis,strokeWidth:`1`}),(0,z.jsx)(`line`,{x1:48,y1:P,x2:D-16,y2:P,stroke:l?g.gridAxis:g.grid,strokeWidth:`1`}),(0,z.jsx)(`text`,{x:40,y:P+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textSecondary,fontWeight:`600`,children:`0`}),!s&&w&&te.filter(e=>e>0).map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`line`,{x1:48,y1:ne(e),x2:D-16,y2:ne(e),stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`4,4`}),(0,z.jsx)(`text`,{x:40,y:ne(e)+3,textAnchor:`end`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:`-${ga(e)}`})]},`yd-${e}`)),pe.map((e,t)=>(0,z.jsx)(`line`,{x1:e.x,y1:24,x2:e.x,y2:P+M+j,stroke:g.grid,strokeWidth:`0.5`,strokeDasharray:`2,4`},`m-${t}`)),l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{ref:f,d:ce,fill:`${g.accent}0D`}),(0,z.jsx)(`polyline`,{ref:u,points:re.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),fill:`none`,stroke:g.accent,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:ce,fill:`url(#addGrad)`}),(0,z.jsx)(`path`,{d:se,fill:`none`,stroke:g.accent,strokeWidth:`1.5`})]}),w&&(0,z.jsx)(`g`,{opacity:`0.4`,children:l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{ref:p,d:ue,fill:`${g.accent}0D`}),(0,z.jsx)(`polyline`,{ref:d,points:ie.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),fill:`none`,stroke:g.accent,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:ue,fill:`url(#delGrad)`}),(0,z.jsx)(`path`,{d:le,fill:`none`,stroke:g.accent,strokeWidth:`1.5`})]})}),v.map((e,t)=>{let n=k(y[t]),r=x.has(e.sessionId),a=de.has(t);return(0,z.jsxs)(`g`,{style:i?{cursor:`pointer`}:void 0,onClick:i?()=>i(he[t]):void 0,children:[r?(0,z.jsx)(`circle`,{cx:n,cy:L(e.cumulativeAdded),r:`5`,fill:g.accent,stroke:g.dotStroke,strokeWidth:`2`,filter:l?`url(#dotGlow)`:void 0}):a?(0,z.jsx)(`circle`,{cx:n,cy:L(e.cumulativeAdded),r:`3`,fill:g.accent,filter:l?`url(#dotGlow)`:void 0}):null,w&&e.cumulativeDeleted>0&&a&&(0,z.jsx)(`circle`,{cx:n,cy:ne(e.cumulativeDeleted),r:`2.5`,opacity:`0.4`,fill:g.accent,filter:l?`url(#dotGlow)`:void 0}),r&&(0,z.jsx)(`text`,{x:n,y:L(e.cumulativeAdded)-12,textAnchor:`middle`,fontFamily:da,fontSize:`8`,fill:g.textSecondary,children:x.get(e.sessionId)}),a&&(0,z.jsx)(`text`,{x:n,y:N-8,textAnchor:`middle`,fontFamily:da,fontSize:`8`,fill:g.textMuted,children:new Date(e.dateMs).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})})]},`pt-${t}`)})]})}),(0,z.jsxs)(`div`,{style:{display:`flex`,gap:24,padding:`8px 12px`,borderTop:`1px solid ${g.grid}`,fontFamily:da,fontSize:10},children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,z.jsx)(`span`,{style:{width:16,height:3,background:g.accent,borderRadius:1,flexShrink:0}}),(0,z.jsxs)(`span`,{style:{fontSize:14,fontWeight:700,color:g.accent},children:[`+`,ua(S)]})]}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600,marginTop:2},children:`Added`})]}),w&&(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,z.jsx)(`span`,{style:{width:16,height:3,background:g.accent,opacity:.4,borderRadius:1,flexShrink:0}}),(0,z.jsxs)(`span`,{style:{fontSize:14,fontWeight:700,color:g.textSecondary},children:[`-`,ua(C)]})]}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600,marginTop:2},children:`Removed`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:ua(t)}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Lines changed`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:n}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Files`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:g.text},children:v.length}),(0,z.jsx)(`div`,{style:{color:g.textMuted,textTransform:`uppercase`,letterSpacing:`0.06em`,fontWeight:600},children:`Sessions`})]})]})]})}var wa=[`preview_project`,`preview_enhanced`,`prompt_enhance`];function Ta(){let e=et(),[t,n]=(0,_.useState)(`loading`),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(new Set),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(`idle`),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)(``),M=(0,_.useCallback)(()=>{Xr().catch(()=>{}),n(`dashboard`),e(`/`)},[e]);(0,_.useEffect)(()=>{let e=!1,t=null;return Yr().then(r=>{if(!e){if(i(r),r.onboardingComplete){n(`dashboard`);return}r.sync.status===`syncing`?(n(`syncing`),o(r.sync),t=Zr(t=>{e||(o(t),t.currentProject&&c(e=>new Set(e).add(t.currentProject)),t.status===`done`&&Yr().then(t=>{e||(i(t),t.isEmpty?M():setTimeout(()=>{e||n(`reveal`)},800))}))})):r.isEmpty?n(`dashboard`):n(`reveal`)}}).catch(()=>{e||n(`dashboard`)}),()=>{e=!0,t?.()}},[M]),(0,_.useEffect)(()=>{if(t!==`reveal`)return;let e=[];for(let t=1;t<=4;t++)e.push(setTimeout(()=>u(t),t*400));return e.push(setTimeout(()=>n(`prompt_project`),3100)),()=>e.forEach(clearTimeout)},[t]);let N=r?.stats,P=r?.projects??[],ee=P.length>0?P.reduce((e,t)=>t.sessionCount>e.sessionCount?t:e,P[0]):null,F=t!==`dashboard`&&t!==`loading`,I=wa.includes(t),te=[`This is what a project looks like.
13
13
  Scroll down to explore.`,`The work timeline shows every
14
14
  session as a bar — longer bars
15
15
  mean longer sessions.`,`The growth chart tracks your
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>app</title>
8
- <script type="module" crossorigin src="/assets/index-qyd5sXR0.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-Cq04whgG.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CMyamplX.css">
10
10
  </head>
11
11
  <body>
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Shared session upload pipeline used by single-project publish (SSE) and
3
+ * portfolio publish (batch). Keeps POST /api/sessions payloads identical.
4
+ */
5
+ import { readFileSync } from 'node:fs';
6
+ import { API_URL } from '../config.js';
7
+ import { loadEnhancedData, saveEnhancedData, getDefaultTemplate, isTranscriptIncluded, } from '../settings.js';
8
+ import { redactSession, redactText, scanTextSync, formatFindings, stripHomePathsInText } from '../redact.js';
9
+ import { renderSessionHtml } from '../render/index.js';
10
+ import { buildSessionRenderData, buildSessionCard } from '../render/build-render-data.js';
11
+ import { buildAgentSummary } from './context.js';
12
+ import { toSlug } from '../format-utils.js';
13
+ import { getFileCountWithChildren } from '../db.js';
14
+ export async function uploadSelectedSessions(ctx, auth, options) {
15
+ const { proj, projectData, selectedSessionIds, send } = options;
16
+ const notify = send ?? ((_evt) => { });
17
+ let uploadedCount = 0;
18
+ const failedSessions = [];
19
+ const uploadedSessionCards = [];
20
+ const selectedTemplate = getDefaultTemplate() || 'editorial';
21
+ for (const sessionId of selectedSessionIds) {
22
+ const meta = proj.sessions.find((s) => s.sessionId === sessionId);
23
+ if (!meta)
24
+ continue;
25
+ notify({ type: 'session', sessionId, status: 'uploading' });
26
+ try {
27
+ const session = await ctx.loadSession(meta.path, proj.name, sessionId);
28
+ const enhanced = loadEnhancedData(sessionId);
29
+ const sessionSlug = toSlug(enhanced?.title ?? session.title ?? sessionId, 80);
30
+ const includeTranscript = isTranscriptIncluded(sessionId);
31
+ const agentSummary = await buildAgentSummary(meta.children ?? [], (c) => ctx.getSessionStats(c, proj.name), { deduplicate: true });
32
+ const devTake = (enhanced?.developerTake ?? session.developerTake ?? '').slice(0, 2000);
33
+ const sessionNarrative = enhanced?.narrative ?? '';
34
+ const sessionTitle = enhanced?.title ?? session.title;
35
+ const sessionSkills = enhanced?.skills ?? session.skills ?? [];
36
+ const sessionSourceTool = session.source ?? meta.source ?? 'claude';
37
+ const sessionRecordedAt = session.date ? new Date(session.date).toISOString() : new Date().toISOString();
38
+ const renderOpts = {
39
+ sessionId,
40
+ session,
41
+ enhanced,
42
+ username: auth.username,
43
+ projectSlug: projectData.slug,
44
+ sessionSlug,
45
+ sourceTool: sessionSourceTool,
46
+ agentSummary,
47
+ template: selectedTemplate,
48
+ };
49
+ let sessionRenderedHtml = null;
50
+ try {
51
+ const sessionRenderData = buildSessionRenderData(renderOpts);
52
+ sessionRenderedHtml = renderSessionHtml(sessionRenderData, selectedTemplate);
53
+ }
54
+ catch (renderErr) {
55
+ console.error(`[upload] Session render failed for ${sessionId}:`, renderErr.message);
56
+ }
57
+ uploadedSessionCards.push(buildSessionCard(renderOpts));
58
+ const childLoc = agentSummary?.agents?.reduce((s, a) => s + (a.loc_changed ?? 0), 0) ?? 0;
59
+ const totalLocChanged = (session.linesOfCode ?? 0) + childLoc;
60
+ const totalFilesChanged = getFileCountWithChildren(ctx.db, sessionId) || session.filesChanged?.length || 0;
61
+ const sessionPayload = {
62
+ session: {
63
+ title: sessionTitle,
64
+ dev_take: devTake,
65
+ context: enhanced?.context ?? '',
66
+ duration_minutes: session.durationMinutes ?? 0,
67
+ turns: session.turns ?? 0,
68
+ files_changed: totalFilesChanged,
69
+ loc_changed: totalLocChanged,
70
+ recorded_at: sessionRecordedAt,
71
+ end_time: session.endTime ? new Date(session.endTime).toISOString() : null,
72
+ cwd: session.cwd ?? null,
73
+ wall_clock_minutes: session.wallClockMinutes ?? null,
74
+ template: selectedTemplate,
75
+ language: null,
76
+ tools: session.toolBreakdown?.map((t) => t.tool) ?? [],
77
+ skills: sessionSkills,
78
+ narrative: sessionNarrative,
79
+ project_name: proj.name,
80
+ project_id: projectData.project_id,
81
+ slug: sessionSlug,
82
+ status: 'unlisted',
83
+ source_tool: sessionSourceTool,
84
+ agent_summary: agentSummary,
85
+ rendered_html: sessionRenderedHtml,
86
+ },
87
+ };
88
+ const turnTimeline = (session.turnTimeline ?? []).map((t) => ({
89
+ timestamp: t.timestamp,
90
+ type: t.type,
91
+ content: (t.content ?? '').slice(0, 200),
92
+ tools: t.tools ?? [],
93
+ }));
94
+ const transcriptExcerpt = (session.rawLog ?? []).slice(0, 10).map((line, i) => {
95
+ const role = line.startsWith('> ') ? 'dev' : 'ai';
96
+ const text = role === 'dev' ? line.slice(2) : line;
97
+ return { role, id: `Turn ${i + 1}`, text, timestamp: null };
98
+ });
99
+ const sessionData = {
100
+ version: 1,
101
+ id: sessionId,
102
+ title: sessionTitle,
103
+ dev_take: devTake,
104
+ context: enhanced?.context ?? '',
105
+ duration_minutes: session.durationMinutes ?? 0,
106
+ turns: session.turns ?? 0,
107
+ files_changed: (session.filesChanged ?? []).slice(0, 20).map((f) => (typeof f === 'string' ? { path: f, additions: 0, deletions: 0 } : f)),
108
+ loc_changed: totalLocChanged,
109
+ date: sessionRecordedAt,
110
+ end_time: (() => {
111
+ if (!session.endTime || !session.date)
112
+ return null;
113
+ const wallMs = new Date(session.endTime).getTime() - new Date(session.date).getTime();
114
+ const activeMs = (session.durationMinutes ?? 0) * 60_000;
115
+ return wallMs <= activeMs * 3 ? new Date(session.endTime).toISOString() : null;
116
+ })(),
117
+ cwd: session.cwd ?? null,
118
+ wall_clock_minutes: session.wallClockMinutes ?? null,
119
+ template: selectedTemplate,
120
+ skills: sessionSkills,
121
+ tools: session.toolBreakdown?.map((t) => t.tool) ?? [],
122
+ source: sessionSourceTool,
123
+ slug: sessionSlug,
124
+ project_name: proj.name,
125
+ narrative: sessionNarrative,
126
+ status: 'unlisted',
127
+ raw_log: [],
128
+ execution_path: (enhanced?.executionSteps ?? session.executionPath ?? []).map((s, i) => ({
129
+ label: s.title ?? `Step ${i + 1}`,
130
+ description: s.description ?? s.body ?? '',
131
+ })),
132
+ qa_pairs: enhanced?.qaPairs ?? session.qaPairs ?? [],
133
+ highlights: [],
134
+ tool_breakdown: (session.toolBreakdown ?? []).map((t) => ({ tool: t.tool, count: t.count })),
135
+ top_files: (session.filesChanged ?? []).slice(0, 20).map((f) => (typeof f === 'string' ? { path: f, additions: 0, deletions: 0 } : f)),
136
+ ...(includeTranscript ? { turn_timeline: turnTimeline } : {}),
137
+ ...(includeTranscript ? { transcript_excerpt: transcriptExcerpt } : {}),
138
+ agent_summary: agentSummary,
139
+ children: agentSummary?.agents?.map((a) => ({
140
+ sessionId: a.role,
141
+ role: a.role,
142
+ durationMinutes: a.duration_minutes,
143
+ linesOfCode: a.loc_changed,
144
+ })) ?? [],
145
+ };
146
+ const sessionCwd = session.cwd ?? undefined;
147
+ const redactedPayload = redactSession(sessionPayload, 'high', sessionCwd);
148
+ const redactedData = redactSession(sessionData, 'high', sessionCwd);
149
+ const payloadFindings = scanTextSync(JSON.stringify(sessionPayload));
150
+ if (payloadFindings.length > 0) {
151
+ const summary = formatFindings(payloadFindings);
152
+ notify({ type: 'redaction', sessionId, message: summary });
153
+ }
154
+ const sessionRes = await fetch(`${API_URL}/api/sessions`, {
155
+ method: 'POST',
156
+ headers: {
157
+ 'Content-Type': 'application/json',
158
+ Authorization: `Bearer ${auth.token}`,
159
+ },
160
+ body: JSON.stringify(redactedPayload),
161
+ });
162
+ if (sessionRes.ok) {
163
+ uploadedCount++;
164
+ try {
165
+ const sesData = await sessionRes.json();
166
+ if (sesData.upload_urls && includeTranscript) {
167
+ const { raw: rawUrl, log: logUrl } = sesData.upload_urls;
168
+ if (rawUrl && meta.path && !meta.path.startsWith('cursor://')) {
169
+ try {
170
+ const rawText = readFileSync(meta.path, 'utf-8');
171
+ let redactedRaw = redactText(rawText);
172
+ redactedRaw = stripHomePathsInText(redactedRaw, sessionCwd);
173
+ await fetch(rawUrl, { method: 'PUT', body: Buffer.from(redactedRaw, 'utf-8'), headers: { 'Content-Type': 'application/octet-stream' } });
174
+ }
175
+ catch { /* S3 upload is best-effort */ }
176
+ }
177
+ if (logUrl && session.rawLog && session.rawLog.length > 0) {
178
+ try {
179
+ const redactedLog = session.rawLog.map((line) => {
180
+ let cleaned = redactText(line);
181
+ cleaned = stripHomePathsInText(cleaned, sessionCwd);
182
+ return cleaned;
183
+ });
184
+ await fetch(logUrl, { method: 'PUT', body: JSON.stringify(redactedLog), headers: { 'Content-Type': 'application/json' } });
185
+ }
186
+ catch { /* S3 upload is best-effort */ }
187
+ }
188
+ if (sesData.upload_urls.session) {
189
+ try {
190
+ await fetch(sesData.upload_urls.session, {
191
+ method: 'PUT',
192
+ body: JSON.stringify(redactedData),
193
+ headers: { 'Content-Type': 'application/json' },
194
+ });
195
+ }
196
+ catch { /* S3 upload is best-effort */ }
197
+ }
198
+ }
199
+ }
200
+ catch { /* Response already consumed or no upload_urls -- not fatal */ }
201
+ if (enhanced) {
202
+ saveEnhancedData(sessionId, { ...enhanced, uploaded: true });
203
+ }
204
+ notify({ type: 'session', sessionId, status: 'uploaded' });
205
+ }
206
+ else {
207
+ const sesErrBody = await sessionRes.json().catch(() => null);
208
+ const rawSesErr = sesErrBody && typeof sesErrBody === 'object' ? sesErrBody.error : null;
209
+ const errMsg = typeof rawSesErr === 'string' ? rawSesErr
210
+ : (rawSesErr && typeof rawSesErr === 'object' && 'message' in rawSesErr) ? rawSesErr.message
211
+ : `HTTP ${sessionRes.status}`;
212
+ failedSessions.push({ sessionId, error: errMsg });
213
+ notify({ type: 'session', sessionId, status: 'failed', error: errMsg });
214
+ }
215
+ }
216
+ catch (err) {
217
+ const errMsg = err.message;
218
+ failedSessions.push({ sessionId, error: errMsg });
219
+ notify({ type: 'session', sessionId, status: 'failed', error: errMsg });
220
+ }
221
+ }
222
+ return { uploadedCount, failedSessions, uploadedSessionCards };
223
+ }
@@ -5,20 +5,19 @@ import path from 'node:path';
5
5
  import { randomUUID } from 'node:crypto';
6
6
  import { getAuthToken } from '../auth.js';
7
7
  import { API_URL, PUBLIC_URL, warnIfNonDefaultApiUrl } from '../config.js';
8
- import { loadEnhancedData, saveEnhancedData, saveUploadedState, getDefaultTemplate, getPortfolioProfile, hashPortfolioProfile, updatePortfolioPublishTarget, getPortfolioPublishState, isTranscriptIncluded, DEFAULT_PORTFOLIO_TARGET, } from '../settings.js';
8
+ import { loadEnhancedData, saveUploadedState, getDefaultTemplate, getPortfolioProfile, hashPortfolioProfile, updatePortfolioPublishTarget, getPortfolioPublishState, DEFAULT_PORTFOLIO_TARGET, } from '../settings.js';
9
9
  import { generatePortfolioHtmlFragment, generateProjectHtmlFragment, generatePortfolioSite, createZipBuffer } from '../export.js';
10
10
  import { buildPortfolioRenderData } from './portfolio-render-data.js';
11
11
  import { buildProjectDetail } from './context.js';
12
12
  import { captureScreenshot } from '../screenshot.js';
13
- import { redactSession, redactText, scanTextSync, formatFindings, stripHomePathsInText } from '../redact.js';
14
- import { renderProjectHtml, renderSessionHtml } from '../render/index.js';
15
- import { buildSessionRenderData, buildSessionCard, buildProjectRenderData } from '../render/build-render-data.js';
16
- import { buildAgentSummary } from './context.js';
13
+ import { renderProjectHtml } from '../render/index.js';
14
+ import { buildProjectRenderData } from '../render/build-render-data.js';
15
+ import { uploadSelectedSessions } from './project-session-upload.js';
17
16
  import { invalidatePortfolioPreviewCache } from './preview.js';
18
17
  import { startSSE } from './sse.js';
19
18
  import { displayNameFromDir } from '../sync.js';
20
19
  import { toSlug } from '../format-utils.js';
21
- import { getProjectUuid, getFileCountWithChildren } from '../db.js';
20
+ import { getProjectUuid } from '../db.js';
22
21
  const IMAGE_KEY_PREFIX = 'images/';
23
22
  export function createPublishRouter(ctx) {
24
23
  const router = Router();
@@ -210,220 +209,17 @@ export function createPublishRouter(ctx) {
210
209
  const proj = projects.find((p) => p.dirName === project);
211
210
  let uploadedCount = 0;
212
211
  const failedSessions = [];
213
- const uploadedSessionCards = [];
212
+ let uploadedSessionCards = [];
214
213
  if (proj) {
215
- const selectedTemplate = getDefaultTemplate() || 'editorial';
216
- for (const sessionId of selectedSessionIds) {
217
- const meta = proj.sessions.find((s) => s.sessionId === sessionId);
218
- if (!meta)
219
- continue;
220
- send({ type: 'session', sessionId, status: 'uploading' });
221
- try {
222
- const session = await ctx.loadSession(meta.path, proj.name, sessionId);
223
- const enhanced = loadEnhancedData(sessionId);
224
- const sessionSlug = toSlug(enhanced?.title ?? session.title ?? sessionId, 80);
225
- const includeTranscript = isTranscriptIncluded(sessionId);
226
- const agentSummary = await buildAgentSummary(meta.children ?? [], (c) => ctx.getSessionStats(c, proj.name), { deduplicate: true });
227
- const devTake = (enhanced?.developerTake ?? session.developerTake ?? '').slice(0, 2000);
228
- const sessionNarrative = enhanced?.narrative ?? '';
229
- const sessionTitle = enhanced?.title ?? session.title;
230
- const sessionSkills = enhanced?.skills ?? session.skills ?? [];
231
- const sessionSourceTool = session.source ?? meta.source ?? 'claude';
232
- const sessionRecordedAt = session.date ? new Date(session.date).toISOString() : new Date().toISOString();
233
- const renderOpts = {
234
- sessionId,
235
- session,
236
- enhanced,
237
- username: auth.username,
238
- projectSlug: projectData.slug,
239
- sessionSlug,
240
- sourceTool: sessionSourceTool,
241
- agentSummary,
242
- template: selectedTemplate,
243
- };
244
- let sessionRenderedHtml = null;
245
- try {
246
- const sessionRenderData = buildSessionRenderData(renderOpts);
247
- sessionRenderedHtml = renderSessionHtml(sessionRenderData, selectedTemplate);
248
- }
249
- catch (renderErr) {
250
- console.error(`[upload] Session render failed for ${sessionId}:`, renderErr.message);
251
- }
252
- uploadedSessionCards.push(buildSessionCard(renderOpts));
253
- const childLoc = agentSummary?.agents?.reduce((s, a) => s + (a.loc_changed ?? 0), 0) ?? 0;
254
- const totalLocChanged = (session.linesOfCode ?? 0) + childLoc;
255
- const totalFilesChanged = getFileCountWithChildren(ctx.db, sessionId) || session.filesChanged?.length || 0;
256
- const sessionPayload = {
257
- session: {
258
- title: sessionTitle,
259
- dev_take: devTake,
260
- context: enhanced?.context ?? '',
261
- duration_minutes: session.durationMinutes ?? 0,
262
- turns: session.turns ?? 0,
263
- files_changed: totalFilesChanged,
264
- loc_changed: totalLocChanged,
265
- recorded_at: sessionRecordedAt,
266
- end_time: session.endTime ? new Date(session.endTime).toISOString() : null,
267
- cwd: session.cwd ?? null,
268
- wall_clock_minutes: session.wallClockMinutes ?? null,
269
- template: selectedTemplate,
270
- language: null,
271
- tools: session.toolBreakdown?.map((t) => t.tool) ?? [],
272
- skills: sessionSkills,
273
- narrative: sessionNarrative,
274
- project_name: proj.name,
275
- project_id: projectData.project_id,
276
- slug: sessionSlug,
277
- status: 'unlisted',
278
- source_tool: sessionSourceTool,
279
- agent_summary: agentSummary,
280
- rendered_html: sessionRenderedHtml,
281
- },
282
- };
283
- // Transcript-derived fields. When the user has toggled the
284
- // transcript OFF for this session we omit them from the
285
- // uploaded JSON entirely — see the spread below. The
286
- // session's main payload (dev take, skills, Q&A, etc.) is
287
- // unaffected.
288
- const turnTimeline = (session.turnTimeline ?? []).map((t) => ({
289
- timestamp: t.timestamp,
290
- type: t.type,
291
- content: (t.content ?? '').slice(0, 200),
292
- tools: t.tools ?? [],
293
- }));
294
- const transcriptExcerpt = (session.rawLog ?? []).slice(0, 10).map((line, i) => {
295
- const role = line.startsWith('> ') ? 'dev' : 'ai';
296
- const text = role === 'dev' ? line.slice(2) : line;
297
- return { role, id: `Turn ${i + 1}`, text, timestamp: null };
298
- });
299
- const sessionData = {
300
- version: 1,
301
- id: sessionId,
302
- title: sessionTitle,
303
- dev_take: devTake,
304
- context: enhanced?.context ?? '',
305
- duration_minutes: session.durationMinutes ?? 0,
306
- turns: session.turns ?? 0,
307
- files_changed: (session.filesChanged ?? []).slice(0, 20).map((f) => (typeof f === 'string' ? { path: f, additions: 0, deletions: 0 } : f)),
308
- loc_changed: totalLocChanged,
309
- date: sessionRecordedAt,
310
- end_time: (() => {
311
- if (!session.endTime || !session.date)
312
- return null;
313
- const wallMs = new Date(session.endTime).getTime() - new Date(session.date).getTime();
314
- const activeMs = (session.durationMinutes ?? 0) * 60_000;
315
- return wallMs <= activeMs * 3 ? new Date(session.endTime).toISOString() : null;
316
- })(),
317
- cwd: session.cwd ?? null,
318
- wall_clock_minutes: session.wallClockMinutes ?? null,
319
- template: selectedTemplate,
320
- skills: sessionSkills,
321
- tools: session.toolBreakdown?.map((t) => t.tool) ?? [],
322
- source: sessionSourceTool,
323
- slug: sessionSlug,
324
- project_name: proj.name,
325
- narrative: sessionNarrative,
326
- status: 'unlisted',
327
- raw_log: [],
328
- execution_path: (enhanced?.executionSteps ?? session.executionPath ?? []).map((s, i) => ({
329
- label: s.title ?? `Step ${i + 1}`,
330
- description: s.description ?? s.body ?? '',
331
- })),
332
- qa_pairs: enhanced?.qaPairs ?? session.qaPairs ?? [],
333
- highlights: [],
334
- tool_breakdown: (session.toolBreakdown ?? []).map((t) => ({ tool: t.tool, count: t.count })),
335
- top_files: (session.filesChanged ?? []).slice(0, 20).map((f) => (typeof f === 'string' ? { path: f, additions: 0, deletions: 0 } : f)),
336
- ...(includeTranscript ? { turn_timeline: turnTimeline } : {}),
337
- ...(includeTranscript ? { transcript_excerpt: transcriptExcerpt } : {}),
338
- agent_summary: agentSummary,
339
- children: agentSummary?.agents?.map((a) => ({
340
- sessionId: a.role,
341
- role: a.role,
342
- durationMinutes: a.duration_minutes,
343
- linesOfCode: a.loc_changed,
344
- })) ?? [],
345
- };
346
- const sessionCwd = session.cwd ?? undefined;
347
- const redactedPayload = redactSession(sessionPayload, 'high', sessionCwd);
348
- const redactedData = redactSession(sessionData, 'high', sessionCwd);
349
- const payloadFindings = scanTextSync(JSON.stringify(sessionPayload));
350
- if (payloadFindings.length > 0) {
351
- const summary = formatFindings(payloadFindings);
352
- send({ type: 'redaction', sessionId, message: summary });
353
- }
354
- const sessionRes = await fetch(`${API_URL}/api/sessions`, {
355
- method: 'POST',
356
- headers: {
357
- 'Content-Type': 'application/json',
358
- Authorization: `Bearer ${auth.token}`,
359
- },
360
- body: JSON.stringify(redactedPayload),
361
- });
362
- if (sessionRes.ok) {
363
- uploadedCount++;
364
- try {
365
- const sesData = await sessionRes.json();
366
- if (sesData.upload_urls && includeTranscript) {
367
- // Transcript-bearing S3 uploads. Skipped entirely when
368
- // the user has toggled the transcript OFF for this
369
- // session — the server never sees raw_log, turn
370
- // timeline, or the bundled session-data JSON in that
371
- // case.
372
- const { raw: rawUrl, log: logUrl } = sesData.upload_urls;
373
- if (rawUrl && meta.path && !meta.path.startsWith('cursor://')) {
374
- try {
375
- const rawText = readFileSync(meta.path, 'utf-8');
376
- let redactedRaw = redactText(rawText);
377
- redactedRaw = stripHomePathsInText(redactedRaw, sessionCwd);
378
- await fetch(rawUrl, { method: 'PUT', body: Buffer.from(redactedRaw, 'utf-8'), headers: { 'Content-Type': 'application/octet-stream' } });
379
- }
380
- catch { /* S3 upload is best-effort */ }
381
- }
382
- if (logUrl && session.rawLog && session.rawLog.length > 0) {
383
- try {
384
- const redactedLog = session.rawLog.map((line) => {
385
- let cleaned = redactText(line);
386
- cleaned = stripHomePathsInText(cleaned, sessionCwd);
387
- return cleaned;
388
- });
389
- await fetch(logUrl, { method: 'PUT', body: JSON.stringify(redactedLog), headers: { 'Content-Type': 'application/json' } });
390
- }
391
- catch { /* S3 upload is best-effort */ }
392
- }
393
- if (sesData.upload_urls.session) {
394
- try {
395
- await fetch(sesData.upload_urls.session, {
396
- method: 'PUT',
397
- body: JSON.stringify(redactedData),
398
- headers: { 'Content-Type': 'application/json' },
399
- });
400
- }
401
- catch { /* S3 upload is best-effort */ }
402
- }
403
- }
404
- }
405
- catch { /* Response already consumed or no upload_urls -- not fatal */ }
406
- if (enhanced) {
407
- saveEnhancedData(sessionId, { ...enhanced, uploaded: true });
408
- }
409
- send({ type: 'session', sessionId, status: 'uploaded' });
410
- }
411
- else {
412
- const sesErrBody = await sessionRes.json().catch(() => null);
413
- const rawSesErr = sesErrBody && typeof sesErrBody === 'object' ? sesErrBody.error : null;
414
- const errMsg = typeof rawSesErr === 'string' ? rawSesErr
415
- : (rawSesErr && typeof rawSesErr === 'object' && 'message' in rawSesErr) ? rawSesErr.message
416
- : `HTTP ${sessionRes.status}`;
417
- failedSessions.push({ sessionId, error: errMsg });
418
- send({ type: 'session', sessionId, status: 'failed', error: errMsg });
419
- }
420
- }
421
- catch (err) {
422
- const errMsg = err.message;
423
- failedSessions.push({ sessionId, error: errMsg });
424
- send({ type: 'session', sessionId, status: 'failed', error: errMsg });
425
- }
426
- }
214
+ const sessionResult = await uploadSelectedSessions(ctx, auth, {
215
+ proj,
216
+ projectData,
217
+ selectedSessionIds,
218
+ send,
219
+ });
220
+ uploadedCount = sessionResult.uploadedCount;
221
+ failedSessions.push(...sessionResult.failedSessions);
222
+ uploadedSessionCards = sessionResult.uploadedSessionCards;
427
223
  }
428
224
  // Step 3: Render project HTML using the same path as HTML export
429
225
  if (uploadedSessionCards.length > 0) {
@@ -563,44 +359,156 @@ export function createPublishRouter(ctx) {
563
359
  // Upload individual project pages for every project included in the
564
360
  // portfolio. This ensures project detail pages exist on heyi.am even
565
361
  // if the user never published them individually.
362
+ const MAX_SLUG_RETRIES = 10;
566
363
  for (const rawProj of filteredProjects) {
567
364
  try {
365
+ const allProjectsList = await ctx.getProjects();
366
+ const projInfo = allProjectsList.find((p) => p.dirName === rawProj.dirName);
367
+ if (!projInfo) {
368
+ console.warn(`[portfolio-upload] project not found: ${rawProj.dirName}`);
369
+ continue;
370
+ }
568
371
  const detail = buildProjectDetail(ctx.db, rawProj);
569
- const proj = detail.project;
570
- const cache = detail.enhanceCache
571
- ?? { fingerprint: 'portfolio-upload', enhancedAt: new Date().toISOString(), selectedSessionIds: detail.sessions.map((s) => s.id), result: { narrative: '', arc: [], skills: [], timeline: [], questions: [] } };
372
+ const enhance = detail.enhanceCache;
373
+ const cache = enhance ?? {
374
+ fingerprint: 'portfolio-upload',
375
+ enhancedAt: new Date().toISOString(),
376
+ selectedSessionIds: detail.sessions.map((s) => s.id),
377
+ result: { narrative: '', arc: [], skills: [], timeline: [], questions: [] },
378
+ };
379
+ const selectedSessionIds = enhance !== null && enhance.selectedSessionIds !== undefined
380
+ ? enhance.selectedSessionIds
381
+ : detail.sessions.map((s) => s.id);
382
+ const projRecord = detail.project;
572
383
  const title = cache.title
573
- || proj.name || displayNameFromDir(rawProj.dirName);
574
- const slug = toSlug(title);
384
+ || projRecord.name || displayNameFromDir(rawProj.dirName);
385
+ const baseSlug = toSlug(title);
575
386
  const clientProjectId = getProjectUuid(ctx.db, rawProj.dirName);
576
- const projectHtml = generateProjectHtmlFragment(rawProj.dirName, cache, detail.sessions, auth.username, {
577
- totalFilesChanged: proj.totalFiles,
578
- totalAgentDurationMinutes: proj.totalAgentDuration,
579
- totalInputTokens: proj.totalInputTokens,
580
- totalOutputTokens: proj.totalOutputTokens,
387
+ const projectHtmlPreview = generateProjectHtmlFragment(rawProj.dirName, cache, detail.sessions, auth.username, {
388
+ totalFilesChanged: projRecord.totalFiles,
389
+ totalAgentDurationMinutes: projRecord.totalAgentDuration,
390
+ totalInputTokens: projRecord.totalInputTokens,
391
+ totalOutputTokens: projRecord.totalOutputTokens,
581
392
  });
582
- await fetch(`${API_URL}/api/projects`, {
583
- method: 'POST',
584
- headers: {
585
- 'Content-Type': 'application/json',
586
- Authorization: `Bearer ${auth.token}`,
587
- },
588
- body: JSON.stringify({
589
- project: {
590
- client_project_id: clientProjectId,
591
- title, slug,
592
- narrative: cache.result?.narrative ?? '',
593
- skills: cache.result?.skills ?? [],
594
- total_sessions: proj.sessionCount,
595
- total_loc: proj.totalLoc,
596
- total_duration_minutes: proj.totalDuration,
597
- total_agent_duration_minutes: proj.totalAgentDuration || null,
598
- total_files_changed: proj.totalFiles,
599
- total_input_tokens: proj.totalInputTokens,
600
- total_output_tokens: proj.totalOutputTokens,
601
- rendered_html: projectHtml,
393
+ const projectBodyBase = {
394
+ client_project_id: clientProjectId,
395
+ title,
396
+ narrative: cache.result?.narrative ?? '',
397
+ repo_url: cache.repoUrl || null,
398
+ project_url: cache.projectUrl || null,
399
+ timeline: cache.result?.timeline ?? [],
400
+ skills: cache.result?.skills ?? [],
401
+ total_sessions: projRecord.sessionCount,
402
+ total_loc: projRecord.totalLoc,
403
+ total_duration_minutes: projRecord.totalDuration,
404
+ total_agent_duration_minutes: projRecord.totalAgentDuration || null,
405
+ total_files_changed: projRecord.totalFiles,
406
+ total_input_tokens: projRecord.totalInputTokens,
407
+ total_output_tokens: projRecord.totalOutputTokens,
408
+ skipped_sessions: [],
409
+ };
410
+ let slug = baseSlug;
411
+ let projectRes = null;
412
+ if (selectedSessionIds.length === 0) {
413
+ for (let attempt = 0; attempt <= MAX_SLUG_RETRIES; attempt++) {
414
+ projectRes = await fetch(`${API_URL}/api/projects`, {
415
+ method: 'POST',
416
+ headers: {
417
+ 'Content-Type': 'application/json',
418
+ Authorization: `Bearer ${auth.token}`,
419
+ },
420
+ body: JSON.stringify({
421
+ project: {
422
+ ...projectBodyBase,
423
+ slug,
424
+ rendered_html: projectHtmlPreview,
425
+ },
426
+ }),
427
+ });
428
+ if (projectRes.status === 409) {
429
+ slug = `${baseSlug}-${attempt + 1}`;
430
+ continue;
431
+ }
432
+ break;
433
+ }
434
+ if (!projectRes?.ok) {
435
+ const errText = await projectRes?.text().catch(() => '');
436
+ console.warn(`[portfolio-upload] project ${rawProj.dirName} create failed:`, projectRes?.status, errText);
437
+ }
438
+ continue;
439
+ }
440
+ for (let attempt = 0; attempt <= MAX_SLUG_RETRIES; attempt++) {
441
+ projectRes = await fetch(`${API_URL}/api/projects`, {
442
+ method: 'POST',
443
+ headers: {
444
+ 'Content-Type': 'application/json',
445
+ Authorization: `Bearer ${auth.token}`,
602
446
  },
603
- }),
447
+ body: JSON.stringify({
448
+ project: {
449
+ ...projectBodyBase,
450
+ slug,
451
+ },
452
+ }),
453
+ });
454
+ if (projectRes.status === 409) {
455
+ slug = `${baseSlug}-${attempt + 1}`;
456
+ continue;
457
+ }
458
+ break;
459
+ }
460
+ if (!projectRes || !projectRes.ok) {
461
+ const errText = await projectRes?.text().catch(() => '') ?? '';
462
+ console.warn(`[portfolio-upload] project ${rawProj.dirName} create failed:`, projectRes?.status, errText);
463
+ continue;
464
+ }
465
+ const projectData = await projectRes.json();
466
+ const { uploadedSessionCards } = await uploadSelectedSessions(ctx, auth, {
467
+ proj: projInfo,
468
+ projectData,
469
+ selectedSessionIds,
470
+ });
471
+ if (uploadedSessionCards.length === 0) {
472
+ continue;
473
+ }
474
+ try {
475
+ const detailAfter = buildProjectDetail(ctx.db, rawProj);
476
+ const cacheAfter = detailAfter.enhanceCache ?? cache;
477
+ const totalFiles = detailAfter.project.totalFiles;
478
+ const projectHtmlFinal = generateProjectHtmlFragment(rawProj.dirName, cacheAfter, detailAfter.sessions, auth.username, {
479
+ totalFilesChanged: totalFiles,
480
+ totalInputTokens: detailAfter.project.totalInputTokens,
481
+ totalOutputTokens: detailAfter.project.totalOutputTokens,
482
+ });
483
+ const renderRes = await fetch(`${API_URL}/api/projects`, {
484
+ method: 'POST',
485
+ headers: {
486
+ 'Content-Type': 'application/json',
487
+ Authorization: `Bearer ${auth.token}`,
488
+ },
489
+ body: JSON.stringify({
490
+ project: {
491
+ ...projectBodyBase,
492
+ slug: projectData.slug,
493
+ rendered_html: projectHtmlFinal,
494
+ },
495
+ }),
496
+ });
497
+ if (!renderRes.ok) {
498
+ console.warn(`[portfolio-upload] project ${rawProj.dirName} rendered_html update failed:`, renderRes.status);
499
+ }
500
+ }
501
+ catch (renderErr) {
502
+ console.warn(`[portfolio-upload] project render update ${rawProj.dirName}:`, renderErr.message);
503
+ }
504
+ const uploadedSessionIds = selectedSessionIds.filter((sid) => {
505
+ const enhanced = loadEnhancedData(sid);
506
+ return enhanced?.uploaded;
507
+ });
508
+ saveUploadedState(rawProj.dirName, {
509
+ slug: projectData.slug,
510
+ projectId: projectData.project_id,
511
+ uploadedSessions: uploadedSessionIds,
604
512
  });
605
513
  }
606
514
  catch (projErr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyiam",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Turn AI coding sessions into portfolio case studies",
5
5
  "type": "module",
6
6
  "license": "MIT",