/ releases / firefox-mv3 / chunks / ArchivedWorkspacesModal-DYdYQ66b.js
ArchivedWorkspacesModal-DYdYQ66b.js
  1  var $t=Object.defineProperty;var en=(r,e,n)=>e in r?$t(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var ht=(r,e,n)=>en(r,typeof e!="symbol"?e+"":e,n);import{F as _t,G as Lt,g as t,H as Bt,I as Pt,J as tn,K as St,L as nn,M as Wt,N as Mt,O as an,P as Dt,Q as rn,R as sn,S as on,T as ln,U as Ye,V as jt,W as Gt,X as wt,Y as Kt,Z as cn,_ as dn,a0 as un,a1 as vn,t as U,a2 as Ft,a3 as gn,a4 as fn,a5 as hn,a6 as pt,a7 as pn,a8 as mn,a9 as xn,aa as kn,ab as _n,ac as Ht,ad as Vt,ae as wn,af as bn,ag as yn,ah as Cn,p as we,k as N,ai as Sn,aj as Tn,ak as An,al as Mn,am as En,an as On,d as Pe,f as P,i as L,a as w,c as g,h as p,D as ge,x as fe,C as be,m as Je,v as Ie,A as Ue,u as xe,j as qe,$ as In,n as Y,z as Et,s as q,r as Pn,B as T,w as it,o as Dn,l as mt}from"./global-imVxZN8Y.js";function wr(r,e){return e}function Rn(r,e,n){for(var l=[],s=e.length,a,o=e.length,v=0;v<s;v++){let k=e[v];Gt(k,()=>{if(a){if(a.pending.delete(k),a.done.add(k),a.pending.size===0){var m=r.outrogroups;Tt(Mt(a.done)),m.delete(a),m.size===0&&(r.outrogroups=null)}}else o-=1},!1)}if(o===0){var d=l.length===0&&n!==null;if(d){var u=n,c=u.parentNode;un(c),c.append(u),r.items.clear()}Tt(e,!d)}else a={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(a)}function Tt(r,e=!0){for(var n=0;n<r.length;n++)vn(r[n],e)}var Rt;function Te(r,e,n,l,s,a=null){var o=r,v=new Map,d=(e&Wt)!==0;if(d){var u=r;o=u.appendChild(_t())}var c=null,k=Bt(()=>{var M=n();return an(M)?M:M==null?[]:Mt(M)}),m,S=!0;function x(){f.fallback=c,Nn(f,m,o,e,l),c!==null&&(m.length===0?c.f&Ye?(c.f^=Ye,dt(c,null,o)):jt(c):Gt(c,()=>{c=null}))}var h=Lt(()=>{m=t(k);for(var M=m.length,H=new Set,z=tn,j=nn(),K=0;K<M;K+=1){var B=m[K],C=l(B,K),E=S?null:v.get(C);E?(E.v&&Pt(E.v,B),E.i&&Pt(E.i,K),j&&z.skipped_effects.delete(E.e)):(E=zn(v,S?o:Rt??(Rt=_t()),B,C,K,s,e,n),S||(E.e.f|=Ye),v.set(C,E)),H.add(C)}if(M===0&&a&&!c&&(S?c=St(()=>a(o)):(c=St(()=>a(Rt??(Rt=_t()))),c.f|=Ye)),!S)if(j){for(const[te,ye]of v)H.has(te)||z.skipped_effects.add(ye.e);z.oncommit(x),z.ondiscard(()=>{})}else x();t(k)}),f={effect:h,items:v,outrogroups:null,fallback:c};S=!1}function Nn(r,e,n,l,s){var ye,Xe,Ae,De,Re,D,O,ne,oe;var a=(l&dn)!==0,o=e.length,v=r.items,d=r.effect.first,u,c=null,k,m=[],S=[],x,h,f,M;if(a)for(M=0;M<o;M+=1)x=e[M],h=s(x,M),f=v.get(h).e,f.f&Ye||((Xe=(ye=f.nodes)==null?void 0:ye.a)==null||Xe.measure(),(k??(k=new Set)).add(f));for(M=0;M<o;M+=1){if(x=e[M],h=s(x,M),f=v.get(h).e,r.outrogroups!==null)for(const V of r.outrogroups)V.pending.delete(f),V.done.delete(f);if(f.f&Ye)if(f.f^=Ye,f===d)dt(f,null,n);else{var H=c?c.next:d;f===r.effect.last&&(r.effect.last=f.prev),f.prev&&(f.prev.next=f.next),f.next&&(f.next.prev=f.prev),et(r,c,f),et(r,f,H),dt(f,H,n),c=f,m=[],S=[],d=c.next;continue}if(f.f&wt&&(jt(f),a&&((De=(Ae=f.nodes)==null?void 0:Ae.a)==null||De.unfix(),(k??(k=new Set)).delete(f))),f!==d){if(u!==void 0&&u.has(f)){if(m.length<S.length){var z=S[0],j;c=z.prev;var K=m[0],B=m[m.length-1];for(j=0;j<m.length;j+=1)dt(m[j],z,n);for(j=0;j<S.length;j+=1)u.delete(S[j]);et(r,K.prev,B.next),et(r,c,K),et(r,B,z),d=z,c=B,M-=1,m=[],S=[]}else u.delete(f),dt(f,d,n),et(r,f.prev,f.next),et(r,f,c===null?r.effect.first:c.next),et(r,c,f),c=f;continue}for(m=[],S=[];d!==null&&d!==f;)(u??(u=new Set)).add(d),S.push(d),d=d.next;if(d===null)continue}f.f&Ye||m.push(f),c=f,d=f.next}if(r.outrogroups!==null){for(const V of r.outrogroups)V.pending.size===0&&(Tt(Mt(V.done)),(Re=r.outrogroups)==null||Re.delete(V));r.outrogroups.size===0&&(r.outrogroups=null)}if(d!==null||u!==void 0){var C=[];if(u!==void 0)for(f of u)f.f&wt||C.push(f);for(;d!==null;)!(d.f&wt)&&d!==r.fallback&&C.push(d),d=d.next;var E=C.length;if(E>0){var te=l&Wt&&o===0?n:null;if(a){for(M=0;M<E;M+=1)(O=(D=C[M].nodes)==null?void 0:D.a)==null||O.measure();for(M=0;M<E;M+=1)(oe=(ne=C[M].nodes)==null?void 0:ne.a)==null||oe.fix()}Rn(r,C,te)}}a&&Kt(()=>{var V,je;if(k!==void 0)for(f of k)(je=(V=f.nodes)==null?void 0:V.a)==null||je.apply()})}function zn(r,e,n,l,s,a,o,v){var d=o&on?o&ln?Dt(n):rn(n,!1,!1):null,u=o&sn?Dt(s):null;return{v:d,i:u,e:St(()=>(a(e,d??n,u??s,v),()=>{r.delete(l)}))}}function dt(r,e,n){if(r.nodes)for(var l=r.nodes.start,s=r.nodes.end,a=e&&!(e.f&Ye)?e.nodes.start:n;l!==null;){var o=cn(l);if(a.before(l),l===s)return;l=o}}function et(r,e,n){e===null?r.effect.first=n:e.next=n,n===null?r.effect.last=e:n.prev=e}function Ln(r,e,n=!1,l=!1,s=!1){var a=r,o="";U(()=>{var v=Ft;if(o!==(o=e()??"")&&(v.nodes!==null&&(gn(v.nodes.start,v.nodes.end),v.nodes=null),o!=="")){var d=o+"";n?d=`<svg>${d}</svg>`:l&&(d=`<math>${d}</math>`);var u=fn(d);if((n||l)&&(u=pt(u)),hn(pt(u),u.lastChild),n||l)for(;pt(u);)a.before(pt(u));else a.before(u)}})}function At(r,e,...n){var l=new mn(r);Lt(()=>{const s=e()??null;l.ensure(s,s&&(a=>s(a,...n)))},pn)}function Ot(r,e,n,l){var s=r.__style;if(s!==e){var a=xn(e);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}return l}function Nt(r,e){return r===e||(r==null?void 0:r[Vt])===e}function Bn(r={},e,n,l){return kn(()=>{var s,a;return _n(()=>{s=a,a=[],Ht(()=>{r!==n(...a)&&(e(r,...a),s&&Nt(n(...s),r)&&e(null,...s))})}),()=>{Kt(()=>{a&&Nt(n(...a),r)&&e(null,...a)})}}),r}let xt=!1;function Wn(r){var e=xt;try{return xt=!1,[r(),xt]}finally{xt=e}}function W(r,e,n,l){var H;var s=(n&An)!==0,a=(n&En)!==0,o=l,v=!0,d=()=>(v&&(v=!1,o=a?Ht(l):l),o),u;if(s){var c=Vt in r||On in r;u=((H=wn(r,e))==null?void 0:H.set)??(c&&e in r?z=>r[e]=z:void 0)}var k,m=!1;s?[k,m]=Wn(()=>r[e]):k=r[e],k===void 0&&l!==void 0&&(k=d(),u&&(bn(),u(k)));var S;if(S=()=>{var z=r[e];return z===void 0?d():(v=!0,z)},!(n&yn))return S;if(u){var x=r.$$legacy;return function(z,j){return arguments.length>0?((!j||x||m)&&u(j?S():z),z):S()}}var h=!1,f=(n&Mn?Cn:Bt)(()=>(h=!1,S()));s&&t(f);var M=Ft;return function(z,j){if(arguments.length>0){const K=j?t(f):s?we(z):z;return N(f,K),h=!0,o!==void 0&&(o=K),z}return Sn&&h||M.f&Tn?f.v:t(f)}}var jn=be('<svg class="animate-spin -ml-1 mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>'),Gn=P("<button><!> <!></button>");function Ve(r,e){let n=W(e,"variant",3,"primary"),l=W(e,"size",3,"md"),s=W(e,"disabled",3,!1),a=W(e,"loading",3,!1),o=W(e,"type",3,"button");const v={primary:"bg-phosphor text-mnemonic-bg hover:bg-phosphor-light focus:ring-phosphor shadow-phosphor hover:shadow-phosphor-lg",secondary:"bg-transparent border border-phosphor text-phosphor hover:bg-phosphor hover:text-mnemonic-bg focus:ring-phosphor",ghost:"bg-transparent text-text-secondary hover:text-phosphor hover:bg-surface-raised focus:ring-phosphor-dark",danger:"bg-status-error/20 text-status-error border border-status-error/50 hover:bg-status-error hover:text-white focus:ring-status-error"},d={sm:"px-2.5 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u="opacity-50 cursor-not-allowed pointer-events-none";var c=Gn();c.__click=function(...x){var h;(h=e.onclick)==null||h.apply(this,x)};var k=g(c);{var m=x=>{var h=jn();p(x,h)};L(k,x=>{a()&&x(m)})}var S=w(k,2);At(S,()=>e.children),U(()=>{ge(c,"type",o()),c.disabled=s(),fe(c,1,`inline-flex items-center justify-center font-mono rounded transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-mnemonic-bg ${v[n()]??""} ${d[l()]??""} ${s()||a()?u:""}`)}),p(r,c)}Pe(["click"]);var Kn=P('<div class="modal-header svelte-19jhfg1"><h2 class="text-lg font-semibold text-phosphor"> </h2> <button class="text-text-muted hover:text-phosphor transition-colors p-1" aria-label="Close"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div>'),Fn=P('<div class="modal-footer svelte-19jhfg1"><!></div>'),Hn=P('<div class="modal-overlay svelte-19jhfg1" role="dialog" aria-modal="true"><div class="modal-backdrop svelte-19jhfg1" role="presentation"></div> <div><!> <div class="modal-body svelte-19jhfg1"><!></div> <!></div></div>');function Ut(r,e){Je(e,!0);let n=W(e,"open",15),l=W(e,"size",3,"md");function s(c){c.target===c.currentTarget&&o()}function a(c){c.key==="Escape"&&o()}function o(){var c;n(!1),(c=e.onclose)==null||c.call(e)}var v=Ie();Ue("keydown",In,a);var d=xe(v);{var u=c=>{var k=Hn(),m=g(k);m.__click=s;var S=w(m,2);let x;var h=g(S);{var f=K=>{var B=Kn(),C=g(B),E=g(C),te=w(C,2);te.__click=o,U(()=>Y(E,e.title)),p(K,B)};L(h,K=>{e.title&&K(f)})}var M=w(h,2),H=g(M);At(H,()=>e.children);var z=w(M,2);{var j=K=>{var B=Fn(),C=g(B);At(C,()=>e.footer),p(K,B)};L(z,K=>{e.footer&&K(j)})}U(()=>x=fe(S,1,"modal-content svelte-19jhfg1",null,x,{"modal-sm":l()==="sm","modal-lg":l()==="lg"})),p(c,k)};L(d,c=>{n()&&c(u)})}p(r,v),qe()}Pe(["click"]);var Vn=P('<div class="fixed bottom-4 right-4 z-50 animate-in"><div><svg class="w-5 h-5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg> <span class="text-sm font-mono"> </span> <button class="ml-2 opacity-60 hover:opacity-100 transition-opacity" aria-label="Dismiss"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div></div>');function br(r,e){Je(e,!0);let n=W(e,"type",3,"info"),l=W(e,"visible",15,!0),s=W(e,"duration",3,3e3);const a={success:"border-status-success bg-status-success/10 text-status-success",error:"border-status-error bg-status-error/10 text-status-error",warning:"border-status-warning bg-status-warning/10 text-status-warning",info:"border-phosphor bg-phosphor/10 text-phosphor"},o={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"};Et(()=>{if(l()&&s()>0){const k=setTimeout(()=>{var m;l(!1),(m=e.onclose)==null||m.call(e)},s());return()=>clearTimeout(k)}});function v(){var k;l(!1),(k=e.onclose)==null||k.call(e)}var d=Ie(),u=xe(d);{var c=k=>{var m=Vn(),S=g(m),x=g(S),h=g(x),f=w(x,2),M=g(f),H=w(f,2);H.__click=v,U(()=>{fe(S,1,`flex items-center gap-3 px-4 py-3 rounded-lg border ${a[n()]??""} shadow-lg backdrop-blur-sm`),ge(h,"d",o[n()]),Y(M,e.message)}),p(k,m)};L(u,k=>{l()&&k(c)})}p(r,d),qe()}Pe(["click"]);q(we([]));const Un={autoSave:!0,autoSaveInterval:3e4,showOrphanPrompt:!0,syncBackend:"none",confirmContextSwitch:!0,restoreWindowPositions:!0,useSmartPositioning:!0,theme:"system",lazyLoadTabs:!0,pauseMediaSites:[]};q(we(Un));q(we([]));q(we([]));q(we({}));Pe(["click"]);var Yn=P('<label class="block text-sm font-mono text-text-secondary mb-1.5"> </label>'),Jn=P('<p class="mt-1 text-xs text-status-error font-mono"> </p>'),qn=P('<div class="w-full"><!> <input/> <!></div>');function yr(r,e){Je(e,!0);let n=W(e,"value",15,""),l=W(e,"placeholder",3,""),s=W(e,"type",3,"text"),a=W(e,"disabled",3,!1);const o=`input-${Math.random().toString(36).slice(2,9)}`,v=T(()=>e.id||o);var d=qn(),u=g(d);{var c=x=>{var h=Yn(),f=g(h);U(()=>{ge(h,"for",t(v)),Y(f,e.label)}),p(x,h)};L(u,x=>{e.label&&x(c)})}var k=w(u,2);k.__input=function(...x){var h;(h=e.oninput)==null||h.apply(this,x)},k.__keydown=function(...x){var h;(h=e.onkeydown)==null||h.apply(this,x)};var m=w(k,2);{var S=x=>{var h=Jn(),f=g(h);U(()=>Y(f,e.error)),p(x,h)};L(m,x=>{e.error&&x(S)})}U(()=>{ge(k,"type",s()),ge(k,"id",t(v)),ge(k,"placeholder",l()),k.disabled=a(),fe(k,1,`w-full bg-mnemonic-bg-dark border rounded px-3 py-2 text-text-primary placeholder:text-text-muted font-mono text-sm transition-colors
  2        ${e.error?"border-status-error focus:border-status-error focus:ring-status-error":"border-phosphor-dark/50 focus:border-phosphor focus:ring-phosphor"}
  3        focus:outline-none focus:ring-1
  4        disabled:opacity-50 disabled:cursor-not-allowed`)}),Pn(k,n),p(r,d),qe()}Pe(["input","keydown"]);var Xn=P("<!> <!>",1),Zn=P('<div class="flex items-start gap-4"><div><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></div> <p class="text-text-secondary text-sm"> </p></div>');function Qn(r,e){Je(e,!0);let n=W(e,"open",15),l=W(e,"title",3,"Confirm"),s=W(e,"confirmText",3,"Confirm"),a=W(e,"cancelText",3,"Cancel"),o=W(e,"variant",3,"info");function v(){var k;n(!1),(k=e.onconfirm)==null||k.call(e)}function d(){var k;n(!1),(k=e.oncancel)==null||k.call(e)}const u={danger:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",warning:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},c={danger:"text-status-error",warning:"text-status-warning",info:"text-phosphor"};Ut(r,{get title(){return l()},onclose:d,get open(){return n()},set open(m){n(m)},footer:m=>{var S=Xn(),x=xe(S);Ve(x,{variant:"ghost",onclick:d,children:(f,M)=>{var H=it();U(()=>Y(H,a())),p(f,H)},$$slots:{default:!0}});var h=w(x,2);{let f=T(()=>o()==="danger"?"danger":"primary");Ve(h,{get variant(){return t(f)},onclick:v,children:(M,H)=>{var z=it();U(()=>Y(z,s())),p(M,z)},$$slots:{default:!0}})}p(m,S)},children:(m,S)=>{var x=Zn(),h=g(x),f=g(h),M=g(f),H=w(h,2),z=g(H);U(()=>{fe(h,1,`flex-shrink-0 ${c[o()]??""}`),ge(M,"d",u[o()]),Y(z,e.message)}),p(m,x)},$$slots:{footer:!0,default:!0}}),qe()}var $n=P('<div class="separator svelte-1l7dmuu"></div>'),ea=P('<span class="icon svelte-1l7dmuu"><!></span>'),ta=P('<button role="menuitem"><!> <span class="label"> </span></button>'),na=P('<div class="context-menu svelte-1l7dmuu" role="menu"></div>');function Cr(r,e){Je(e,!0);let n=q(null),l=q(we({x:0,y:0}));const s=T(()=>e.x+t(l).x),a=T(()=>e.y+t(l).y);Dn(()=>{if(t(n)){t(n).scrollTop=0;const c=t(n).getBoundingClientRect(),k=window.innerWidth,m=window.innerHeight;let S=0,x=0;e.x+c.width>k&&(S=k-c.width-8-e.x),e.y+c.height>m&&(x=m-c.height-8-e.y),N(l,{x:S,y:x},!0)}function d(c){t(n)&&!t(n).contains(c.target)&&e.onClose()}function u(c){c.key==="Escape"&&e.onClose()}return document.addEventListener("click",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("click",d),document.removeEventListener("keydown",u)}});function o(d){d.disabled||d.separator||(e.onSelect(d.id),e.onClose())}var v=na();Te(v,21,()=>e.items,d=>d.id,(d,u)=>{var c=Ie(),k=xe(c);{var m=x=>{var h=$n();p(x,h)},S=x=>{var h=ta();let f;h.__click=()=>o(t(u));var M=g(h);{var H=K=>{var B=ea(),C=g(B);Ln(C,()=>t(u).icon),p(K,B)};L(M,K=>{t(u).icon&&K(H)})}var z=w(M,2),j=g(z);U(()=>{f=fe(h,1,"menu-item svelte-1l7dmuu",null,f,{danger:t(u).danger,disabled:t(u).disabled}),h.disabled=t(u).disabled,Y(j,t(u).label)}),p(x,h)};L(k,x=>{t(u).separator?x(m):x(S,!1)})}p(d,c)}),Bn(v,d=>N(n,d),()=>t(n)),U(()=>Ot(v,`left: ${t(s)??""}px; top: ${t(a)??""}px;`)),p(r,v),qe()}Pe(["click"]);function aa(r){return r.type==="child"||r.type==="standalone"}var ra=be('<path fill-rule="evenodd" clip-rule="evenodd"></path>'),sa=be("<path></path>"),oa=be("<path></path>"),ia=be('<path fill-rule="evenodd" clip-rule="evenodd"></path>'),la=be('<svg fill="currentColor" viewBox="0 0 20 20"><!></svg>');function ca(r,e){let n=W(e,"isTranscendent",3,!1),l=W(e,"expanded",3,!1),s=W(e,"size",3,"md");const a={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},o="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z",v="M2 6a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1H8a3 3 0 00-3 3v1.5a1.5 1.5 0 01-3 0V6z M6 12a2 2 0 012-2h8a2 2 0 012 2v2a2 2 0 01-2 2H8a2 2 0 01-2-2v-2z",d="M10 18a8 8 0 100-16 8 8 0 000 16zM4.332 8.027a6.012 6.012 0 011.912-2.706C6.512 5.73 6.974 6 7.5 6A1.5 1.5 0 019 7.5V8a2 2 0 004 0 2 2 0 011.523-1.943A5.977 5.977 0 0116 10c0 .34-.028.675-.083 1H15a2 2 0 00-2 2v2.197A5.973 5.973 0 0110 16v-2a2 2 0 00-2-2 2 2 0 01-2-2 2 2 0 00-1.668-1.973z",u="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z";var c=la(),k=g(c);{var m=x=>{var h=ra();ge(h,"d",u),p(x,h)},S=x=>{var h=Ie(),f=xe(h);{var M=z=>{var j=Ie(),K=xe(j);{var B=E=>{var te=sa();ge(te,"d",v),p(E,te)},C=E=>{var te=oa();ge(te,"d",o),p(E,te)};L(K,E=>{l()?E(B):E(C,!1)})}p(z,j)},H=z=>{var j=ia();ge(j,"d",d),p(z,j)};L(f,z=>{e.type==="parent"?z(M):z(H,!1)},!0)}p(x,h)};L(k,x=>{n()?x(m):x(S,!1)})}U(()=>fe(c,0,`${a[s()]??""} flex-shrink-0 ${n()?"text-phosphor":e.type==="parent"?"text-phosphor-light":"text-text-muted"}`)),p(r,c)}Pe(["click"]);var da=P('<button class="flex-shrink-0 p-0.5 rounded hover:bg-phosphor/20 transition-colors"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></button>'),ua=P('<span class="flex-shrink-0 w-2 h-2 rounded-full bg-status-success" title="Window open"></span>'),va=P('<span class="flex-shrink-0 text-status-success animate-pulse" title="Playing audio"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z" clip-rule="evenodd"></path></svg></span>'),ga=P('<span class="text-xs text-text-muted font-mono"> </span>'),fa=P('<span class="text-xs text-text-muted font-mono"> </span>'),ha=P('<div role="treeitem" tabindex="0"><!> <!> <div class="flex-1 min-w-0"><div class="flex items-center gap-2"><!> <span> </span> <!></div></div> <!> <!> <div class="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity"><button class="p-1 rounded hover:bg-phosphor/20 text-text-muted hover:text-phosphor transition-colors" title="More options"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path></svg></button></div></div>');function ot(r,e){Je(e,!0);let n=W(e,"selected",3,!1),l=W(e,"depth",3,0),s=W(e,"expanded",3,!1),a=W(e,"draggable",3,!1),o=W(e,"dragState",3,null),v=W(e,"isAudible",3,!1),d=W(e,"isOpen",3,!1),u=W(e,"openChildCount",3,0);const c=T(()=>{if(!o()||o().dropTargetId!==e.workspace.id)return"";switch(o().dropPosition){case"before":return"drop-indicator-before";case"after":return"drop-indicator-after";case"inside":return"drop-indicator-inside";default:return""}}),k=T(()=>{var i;return((i=o())==null?void 0:i.draggedId)===e.workspace.id}),m=T(()=>aa(e.workspace)?e.workspace.tabs.length:0);function S(){var i;(i=e.onselect)==null||i.call(e,e.workspace)}function x(i){var _;i.stopPropagation(),(_=e.ontoggle)==null||_.call(e,e.workspace)}function h(i){var _;i.preventDefault(),(_=e.oncontextmenu)==null||_.call(e,i,e.workspace)}function f(i){var _,I,F;(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),(_=e.onselect)==null||_.call(e,e.workspace)),i.key==="ArrowRight"&&e.workspace.type==="parent"&&!s()&&((I=e.ontoggle)==null||I.call(e,e.workspace)),i.key==="ArrowLeft"&&e.workspace.type==="parent"&&s()&&((F=e.ontoggle)==null||F.call(e,e.workspace))}function M(i){var _,I;if(!a()){i.preventDefault();return}(_=i.dataTransfer)==null||_.setData("text/plain",e.workspace.id),i.dataTransfer&&(i.dataTransfer.effectAllowed="move"),(I=e.ondragstart)==null||I.call(e,e.workspace)}function H(i){var X;if(i.preventDefault(),!i.dataTransfer)return;i.dataTransfer.dropEffect="move";const _=i.currentTarget.getBoundingClientRect(),I=i.clientY-_.top,F=_.height;let y;e.workspace.type==="parent"?I<F*.25?y="before":I>F*.75?y="after":y="inside":y=I<F/2?"before":"after",(X=e.ondragover)==null||X.call(e,e.workspace,y)}function z(i){var F;const _=i.relatedTarget,I=i.currentTarget;(!_||!I.contains(_))&&((F=e.ondragleave)==null||F.call(e))}function j(i){var _;i.preventDefault(),(_=e.ondrop)==null||_.call(e,e.workspace)}function K(){var i;(i=e.ondragleave)==null||i.call(e)}var B=ha();B.__click=S,B.__contextmenu=h,B.__keydown=f;var C=g(B);{var E=i=>{var _=da();_.__click=x;var I=g(_);U(()=>{ge(_,"aria-label",s()?"Collapse":"Expand"),fe(I,0,`w-4 h-4 text-text-muted transition-transform duration-150 ${s()?"rotate-90":""}`)}),p(i,_)};L(C,i=>{e.workspace.type==="parent"&&i(E)})}var te=w(C,2);ca(te,{get type(){return e.workspace.type},get isTranscendent(){return e.workspace.isTranscendent},get expanded(){return s()}});var ye=w(te,2),Xe=g(ye),Ae=g(Xe);{var De=i=>{var _=ua();p(i,_)};L(Ae,i=>{d()&&i(De)})}var Re=w(Ae,2),D=g(Re),O=w(Re,2);{var ne=i=>{var _=va();p(i,_)};L(O,i=>{v()&&i(ne)})}var oe=w(ye,2);{var V=i=>{var _=ga(),I=g(_);U(()=>Y(I,`${t(m)??""} tab${t(m)===1?"":"s"}`)),p(i,_)};L(oe,i=>{e.workspace.type!=="parent"&&t(m)>0&&i(V)})}var je=w(oe,2);{var b=i=>{const _=T(()=>e.workspace.children.length);var I=fa(),F=g(I);U(()=>Y(F,`${u()??""}/${t(_)??""} children`)),p(i,I)};L(je,i=>{e.workspace.type==="parent"&&i(b)})}var R=w(je,2),A=g(R);A.__click=i=>{i.stopPropagation(),h(i)},U(()=>{fe(B,1,`workspace-item group flex items-center gap-2 pr-3 py-2 rounded cursor-pointer transition-all duration-150
  5      ${n()?"bg-surface-raised border-l-2 border-phosphor":"hover:bg-surface-raised/50 border-l-2 border-transparent"}
  6      ${t(k)?"opacity-50":""}
  7      ${t(c)??""}`,"svelte-1yb6slk"),Ot(B,`padding-left: ${4+l()*8}px`),ge(B,"aria-selected",n()),ge(B,"aria-expanded",e.workspace.type==="parent"?s():void 0),ge(B,"draggable",a()),fe(Re,1,`text-sm font-medium whitespace-nowrap ${e.workspace.isTranscendent?"text-phosphor font-semibold":n()?"text-phosphor":"text-text-primary"}`),Y(D,e.workspace.name)}),Ue("dragstart",B,M),Ue("dragover",B,H),Ue("dragleave",B,z),Ue("drop",B,j),Ue("dragend",B,K),p(r,B),qe()}Pe(["click","contextmenu","keydown"]);var pa=P('<span class="flex-shrink-0 w-2 h-2 rounded-full"></span>'),ma=be('<svg class="flex-shrink-0 w-3.5 h-3.5 text-text-muted" fill="currentColor" viewBox="0 0 20 20"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg>'),xa=P('<div role="button" tabindex="0"><button class="flex-shrink-0 p-0.5 rounded hover:bg-phosphor/20 transition-colors"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></button> <!> <span class="flex-1 text-xs font-medium text-text-secondary truncate"> </span> <span class="flex-shrink-0 px-1.5 py-0.5 text-[10px] bg-surface-raised rounded-full text-text-muted"> </span></div>');function ka(r,e){Je(e,!0);let n=W(e,"childCount",3,0),l=W(e,"openCount",3,0),s=W(e,"isDropTarget",3,!1);const a=T(()=>e.group.collapsed??!1);function o(C){var E;C.stopPropagation(),(E=e.ontoggle)==null||E.call(e,e.group)}function v(C){var E;C.preventDefault(),(E=e.oncontextmenu)==null||E.call(e,C,e.group)}function d(C){var E;(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),(E=e.ontoggle)==null||E.call(e,e.group))}function u(C){var E;C.preventDefault(),C.stopPropagation(),C.dataTransfer&&(C.dataTransfer.dropEffect="move"),(E=e.ondragover)==null||E.call(e,C,e.group)}function c(C){var E;C.stopPropagation(),(E=e.ondragleave)==null||E.call(e,C)}function k(C){var E;C.preventDefault(),C.stopPropagation(),(E=e.ondrop)==null||E.call(e,C,e.group)}var m=xa();let S;m.__click=o,m.__contextmenu=v,m.__keydown=d;var x=g(m);x.__click=o;var h=g(x),f=w(x,2);{var M=C=>{var E=pa();U(()=>Ot(E,`background-color: ${e.group.color??""}`)),p(C,E)},H=C=>{var E=ma();p(C,E)};L(f,C=>{e.group.color?C(M):C(H,!1)})}var z=w(f,2),j=g(z),K=w(z,2),B=g(K);U(()=>{S=fe(m,1,"group-header flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors hover:bg-surface-raised/50 svelte-13ngo38",null,S,{"drop-target":s()}),ge(m,"aria-expanded",!t(a)),ge(x,"aria-label",t(a)?"Expand group":"Collapse group"),fe(h,0,`w-3.5 h-3.5 text-text-muted transition-transform duration-150 ${t(a)?"":"rotate-90"}`),Y(j,e.group.name),Y(B,`${l()??""}/${n()??""}`)}),Ue("dragover",m,u),Ue("dragleave",m,c),Ue("drop",m,k),p(r,m),qe()}Pe(["click","contextmenu","keydown"]);var _a=P('<div class="mt-1 border-l-2 border-phosphor/30 ml-3 pl-1"></div>'),wa=P('<div class="mb-4"><button class="w-full flex items-center justify-between px-3 py-1.5 text-xs font-mono uppercase tracking-wider text-phosphor hover:bg-phosphor/10 rounded transition-colors"><div class="flex items-center gap-2"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path d="M14.5 10c0 1.38-1.12 2.5-2.5 2.5-.83 0-1.57-.41-2.02-1.03L8.5 10l1.48-1.47A2.49 2.49 0 0112 7.5c1.38 0 2.5 1.12 2.5 2.5zm-9 0c0-1.38 1.12-2.5 2.5-2.5.83 0 1.57.41 2.02 1.03L11.5 10l-1.48 1.47A2.49 2.49 0 018 12.5c-1.38 0-2.5-1.12-2.5-2.5zm4.5 0l2-2c.78-.78 1.81-1.17 2.83-1.17 2.21 0 4 1.79 4 4s-1.79 4-4 4c-1.02 0-2.05-.39-2.83-1.17l-2-2-2 2c-.78.78-1.81 1.17-2.83 1.17-2.21 0-4-1.79-4-4s1.79-4 4-4c1.02 0 2.05.39 2.83 1.17l2 2z"></path></svg> <span>Transcendent</span> <span class="px-1.5 py-0.5 text-[10px] bg-phosphor/20 rounded-full"> </span></div> <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></button> <!></div>'),ba=P('<div class="py-1 text-xs text-text-muted italic pl-3">No workspaces in this group</div>'),ya=P('<div class="ml-4 border-l-2 border-text-muted/20 pl-1"><!> <!></div>'),Ca=P('<div class="group-section"><!> <!></div>'),Sa=P('<div class="ungrouped-section mt-1"><div class="flex items-center gap-2 px-2 py-1 text-xs text-text-muted"><svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg> <span>Ungrouped</span> <span class="px-1.5 py-0.5 text-[10px] bg-surface-raised rounded-full"> </span></div> <div class="ml-4 border-l-2 border-text-muted/20 pl-1"></div></div>'),Ta=P('<div class="py-2 text-xs text-text-muted italic pl-3">No child workspaces</div>'),Aa=P('<div class="mt-1 border-l-2 border-text-muted/30 ml-3 pl-1"><!> <!> <!> <!></div>'),Ma=P("<!> <!>",1),Ea=P('<div class="mb-4"><div class="px-3 py-1 text-xs font-mono uppercase tracking-wider text-text-muted flex items-center gap-2"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg> <span>Contexts</span> <span class="px-1.5 py-0.5 text-[10px] bg-surface-raised rounded-full"> </span></div> <!></div>'),Oa=P('<div class="mb-4"><div class="px-3 py-1 text-xs font-mono uppercase tracking-wider text-text-muted flex items-center gap-2"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM4.332 8.027a6.012 6.012 0 011.912-2.706C6.512 5.73 6.974 6 7.5 6A1.5 1.5 0 019 7.5V8a2 2 0 004 0 2 2 0 011.523-1.943A5.977 5.977 0 0116 10c0 .34-.028.675-.083 1H15a2 2 0 00-2 2v2.197A5.973 5.973 0 0110 16v-2a2 2 0 00-2-2 2 2 0 01-2-2 2 2 0 00-1.668-1.973z" clip-rule="evenodd"></path></svg> <span>Standalone</span> <span class="px-1.5 py-0.5 text-[10px] bg-surface-raised rounded-full"> </span></div> <div class="mt-1 border-l-2 border-text-muted/30 ml-3 pl-1"></div></div>'),Ia=P('<div class="flex flex-col items-center justify-center py-12 text-center"><svg class="w-12 h-12 text-text-muted mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> <p class="text-text-secondary mb-1">No workspaces yet</p> <p class="text-text-muted text-sm">Create your first workspace to get started</p></div>'),Pa=P('<div class="workspace-list" role="tree" aria-label="Workspaces"><!> <!> <!> <!></div>');function Sr(r,e){Je(e,!0);let n=W(e,"selectedId",3,null),l=W(e,"showTranscendentSection",3,!0),s=W(e,"enableDragDrop",3,!1),a=W(e,"dragState",3,null),o=W(e,"audibleWorkspaceIds",19,()=>new Set),v=W(e,"openWorkspaceIds",19,()=>new Set),d=q(null);function u(b){return s()?b.type==="standalone"||b.type==="child":!1}let c=q(we(new Set)),k=q(we(new Set)),m=q(!0);const S=T(()=>{const b=new Set;for(const R of e.workspaces)if(R.type==="child"&&v().has(R.id)){const A=R;b.add(A.parentId)}return b});let x=q(we(new Set));Et(()=>{const b=new Set(t(c)),R=new Set(t(x)),A=new Set(t(k));let i=!1;for(const _ of t(S))!b.has(_)&&!A.has(_)&&(b.add(_),R.add(_),i=!0);for(const _ of R)t(S).has(_)||(b.delete(_),R.delete(_),A.delete(_),i=!0);i&&(N(c,b,!0),N(x,R,!0),N(k,A,!0))});const h=T(()=>{const b=e.workspaces.filter(y=>!y.archivedAt),R=b.filter(y=>y.isTranscendent&&y.type!=="parent"),A=b.filter(y=>!y.isTranscendent||y.type==="parent"),i=A.filter(y=>y.type==="parent"),_=A.filter(y=>y.type==="standalone"),I=new Map;for(const y of A)if(y.type==="child"){const X=y,he=I.get(X.parentId)||[];he.push(X),I.set(X.parentId,he)}const F=b.filter(y=>y.isTranscendent&&y.type==="child");for(const y of F){const X=I.get(y.parentId)||[];X.find(he=>he.id===y.id)||(X.push(y),I.set(y.parentId,X))}return{transcendent:R,parents:i,standalone:_,childMap:I}}),f=T(()=>{const b=t(h).transcendent.filter(i=>v().has(i.id)).length,R=t(h).standalone.filter(i=>v().has(i.id)).length;let A=0;for(const i of t(h).parents)(t(h).childMap.get(i.id)||[]).some(F=>v().has(F.id))&&A++;return{transcendentOpen:b,standaloneOpen:R,parentsWithOpenChildren:A}});function M(b){const R=t(h).childMap.get(b)||[];return{open:R.filter(i=>v().has(i.id)).length,total:R.length}}function H(b){const R=t(h).childMap.get(b.id)||[],A=[],i=[];if(!b.groups||b.groups.length===0)return{groups:[],ungrouped:R};const _=new Map;for(const I of b.groups)_.set(I.id,[]);for(const I of R)I.groupId&&_.has(I.groupId)?_.get(I.groupId).push(I):i.push(I);for(const I of b.groups)A.push({group:I,children:_.get(I.id)||[]});return{groups:A,ungrouped:i}}function z(b){return{open:b.filter(A=>v().has(A.id)).length,total:b.length}}function j(b,R){var A;(A=e.ongrouptoggle)==null||A.call(e,b,R)}function K(b,R,A){var i;(i=e.ongroupcontextmenu)==null||i.call(e,b,R,A)}function B(b,R,A){var I;if(!((I=a())!=null&&I.draggedId))return;const i=e.workspaces.find(F=>F.id===a().draggedId);if(!i||i.type!=="child")return;const _=i;_.parentId===A.id&&_.groupId!==R.id&&N(d,R.id,!0)}function C(){N(d,null)}function E(b,R,A){var I,F;if(!((I=a())!=null&&I.draggedId)){N(d,null);return}const i=e.workspaces.find(y=>y.id===a().draggedId);if(!i||i.type!=="child"){N(d,null);return}const _=i;if(_.parentId!==A.id){N(d,null);return}(F=e.ongroupdrop)==null||F.call(e,_.id,R.id,A.id),N(d,null)}function te(b){if(b.type!=="parent")return;const R=new Set(t(c)),A=new Set(t(x)),i=new Set(t(k));R.has(b.id)?(R.delete(b.id),A.delete(b.id),t(S).has(b.id)&&i.add(b.id)):(R.add(b.id),i.delete(b.id)),N(c,R,!0),N(x,A,!0),N(k,i,!0)}function ye(b){return t(c).has(b)}function Xe(){N(m,!t(m))}var Ae=Pa(),De=g(Ae);{var Re=b=>{var R=wa(),A=g(R);A.__click=Xe;var i=g(A),_=w(g(i),4),I=g(_),F=w(i,2),y=w(A,2);{var X=he=>{var Ge=_a();Te(Ge,21,()=>t(h).transcendent,Ne=>Ne.id,(Ne,Ke)=>{{let Fe=T(()=>n()===t(Ke).id),pe=T(()=>u(t(Ke))),ie=T(()=>o().has(t(Ke).id)),me=T(()=>v().has(t(Ke).id));ot(Ne,{get workspace(){return t(Ke)},get selected(){return t(Fe)},get draggable(){return t(pe)},get isAudible(){return t(ie)},get isOpen(){return t(me)},get dragState(){return a()},get onselect(){return e.onselect},get oncontextmenu(){return e.oncontextmenu},get ondragstart(){return e.ondragstart},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}}),p(he,Ge)};L(y,he=>{t(m)&&he(X)})}U(()=>{Y(I,`${t(f).transcendentOpen??""}/${t(h).transcendent.length??""}`),fe(F,0,`w-4 h-4 transition-transform duration-200 ${t(m)?"rotate-180":""}`)}),p(b,R)};L(De,b=>{l()&&t(h).transcendent.length>0&&b(Re)})}var D=w(De,2);{var O=b=>{var R=Ea(),A=g(R),i=w(g(A),4),_=g(i),I=w(A,2);Te(I,17,()=>t(h).parents,F=>F.id,(F,y)=>{const X=T(()=>M(t(y).id));var he=Ma(),Ge=xe(he);{let Fe=T(()=>n()===t(y).id),pe=T(()=>ye(t(y).id)),ie=T(()=>o().has(t(y).id)),me=T(()=>v().has(t(y).id));ot(Ge,{get workspace(){return t(y)},get selected(){return t(Fe)},get expanded(){return t(pe)},draggable:!1,get isAudible(){return t(ie)},get isOpen(){return t(me)},get openChildCount(){return t(X).open},get dragState(){return a()},get onselect(){return e.onselect},ontoggle:te,get oncontextmenu(){return e.oncontextmenu},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}var Ne=w(Ge,2);{var Ke=Fe=>{const pe=T(()=>H(t(y))),ie=T(()=>t(pe).groups.length>0);var me=Aa(),ke=g(me);Te(ke,17,()=>t(pe).groups,({group:Z,children:J})=>Z.id,(Z,J)=>{let de=()=>t(J).group,ae=()=>t(J).children;const G=T(()=>z(ae()));var Q=Ca(),$=g(Q);{let Ce=T(()=>t(d)===de().id);ka($,{get group(){return de()},get childCount(){return t(G).total},get openCount(){return t(G).open},get isDropTarget(){return t(Ce)},ontoggle:re=>j(re,t(y)),oncontextmenu:(re,ue)=>K(re,ue,t(y)),ondragover:(re,ue)=>B(re,ue,t(y)),ondragleave:C,ondrop:(re,ue)=>E(re,ue,t(y))})}var le=w($,2);{var _e=Ce=>{var re=ya(),ue=g(re);Te(ue,17,ae,ve=>ve.id,(ve,ee)=>{{let Se=T(()=>n()===t(ee).id),Ee=T(()=>u(t(ee))),Le=T(()=>o().has(t(ee).id)),rt=T(()=>v().has(t(ee).id));ot(ve,{get workspace(){return t(ee)},get selected(){return t(Se)},get draggable(){return t(Ee)},get isAudible(){return t(Le)},get isOpen(){return t(rt)},get dragState(){return a()},get onselect(){return e.onselect},get oncontextmenu(){return e.oncontextmenu},get ondragstart(){return e.ondragstart},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}});var He=w(ue,2);{var Qe=ve=>{var ee=ba();p(ve,ee)};L(He,ve=>{ae().length===0&&ve(Qe)})}p(Ce,re)};L(le,Ce=>{de().collapsed||Ce(_e)})}p(Z,Q)});var Ze=w(ke,2);{var ze=Z=>{var J=Sa(),de=g(J),ae=w(g(de),4),G=g(ae),Q=w(de,2);Te(Q,21,()=>t(pe).ungrouped,$=>$.id,($,le)=>{{let _e=T(()=>n()===t(le).id),Ce=T(()=>u(t(le))),re=T(()=>o().has(t(le).id)),ue=T(()=>v().has(t(le).id));ot($,{get workspace(){return t(le)},get selected(){return t(_e)},get draggable(){return t(Ce)},get isAudible(){return t(re)},get isOpen(){return t(ue)},get dragState(){return a()},get onselect(){return e.onselect},get oncontextmenu(){return e.oncontextmenu},get ondragstart(){return e.ondragstart},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}}),U($=>Y(G,`${$??""}/${t(pe).ungrouped.length??""}`),[()=>t(pe).ungrouped.filter($=>v().has($.id)).length]),p(Z,J)};L(Ze,Z=>{t(ie)&&t(pe).ungrouped.length>0&&Z(ze)})}var Me=w(Ze,2);{var tt=Z=>{var J=Ie(),de=xe(J);Te(de,17,()=>t(pe).ungrouped,ae=>ae.id,(ae,G)=>{{let Q=T(()=>n()===t(G).id),$=T(()=>u(t(G))),le=T(()=>o().has(t(G).id)),_e=T(()=>v().has(t(G).id));ot(ae,{get workspace(){return t(G)},get selected(){return t(Q)},get draggable(){return t($)},get isAudible(){return t(le)},get isOpen(){return t(_e)},get dragState(){return a()},get onselect(){return e.onselect},get oncontextmenu(){return e.oncontextmenu},get ondragstart(){return e.ondragstart},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}}),p(Z,J)};L(Me,Z=>{t(ie)||Z(tt)})}var nt=w(Me,2);{var at=Z=>{var J=Ta();p(Z,J)};L(nt,Z=>{t(pe).groups.length===0&&t(pe).ungrouped.length===0&&Z(at)})}p(Fe,me)};L(Ne,Fe=>{ye(t(y).id)&&Fe(Ke)})}p(F,he)}),U(()=>Y(_,`${t(f).parentsWithOpenChildren??""}/${t(h).parents.length??""}`)),p(b,R)};L(D,b=>{t(h).parents.length>0&&b(O)})}var ne=w(D,2);{var oe=b=>{var R=Oa(),A=g(R),i=w(g(A),4),_=g(i),I=w(A,2);Te(I,21,()=>t(h).standalone,F=>F.id,(F,y)=>{{let X=T(()=>n()===t(y).id),he=T(()=>u(t(y))),Ge=T(()=>o().has(t(y).id)),Ne=T(()=>v().has(t(y).id));ot(F,{get workspace(){return t(y)},get selected(){return t(X)},get draggable(){return t(he)},get isAudible(){return t(Ge)},get isOpen(){return t(Ne)},get dragState(){return a()},get onselect(){return e.onselect},get oncontextmenu(){return e.oncontextmenu},get ondragstart(){return e.ondragstart},get ondragover(){return e.ondragover},get ondragleave(){return e.ondragleave},get ondrop(){return e.ondrop}})}}),U(()=>Y(_,`${t(f).standaloneOpen??""}/${t(h).standalone.length??""}`)),p(b,R)};L(ne,b=>{t(h).standalone.length>0&&b(oe)})}var V=w(ne,2);{var je=b=>{var R=Ia();p(b,R)};L(V,b=>{t(h).parents.length===0&&t(h).standalone.length===0&&t(h).transcendent.length===0&&b(je)})}p(r,Ae),qe()}Pe(["click"]);const Da="https://api.anthropic.com/v1/messages",Ra="2023-06-01",Na="claude-sonnet-4-20250514",za=1024;class We extends Error{constructor(e,n,l){super(e),this.statusCode=n,this.errorType=l,this.name="ClaudeAPIError"}}class La{constructor(){ht(this,"apiKey",null);ht(this,"model",Na)}setApiKey(e){this.apiKey=e}getApiKeyMasked(){return this.apiKey?this.apiKey.length<=8?"****":`${this.apiKey.slice(0,4)}...${this.apiKey.slice(-4)}`:null}isConfigured(){return this.apiKey!==null&&this.apiKey.length>0}setModel(e){this.model=e}async sendMessage(e,n,l){var a,o;if(!this.apiKey)throw new We("Claude API key not configured");const s={model:(l==null?void 0:l.model)||this.model,max_tokens:(l==null?void 0:l.maxTokens)||za,...n&&{system:n},messages:e,...(l==null?void 0:l.temperature)!==void 0&&{temperature:l.temperature},...(l==null?void 0:l.stopSequences)&&{stop_sequences:l.stopSequences}};try{const v=await fetch(Da,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey,"anthropic-version":Ra,"anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify(s)});if(!v.ok){const c=await v.json().catch(()=>({}));throw new We(((a=c.error)==null?void 0:a.message)||`API request failed with status ${v.status}`,v.status,(o=c.error)==null?void 0:o.type)}return(await v.json()).content.filter(c=>c.type==="text").map(c=>c.text).join("")}catch(v){throw v instanceof We?v:new We(v instanceof Error?v.message:"Unknown error occurred")}}async ask(e,n){return this.sendMessage([{role:"user",content:e}],n)}async testConnection(){try{return await this.sendMessage([{role:"user",content:'Respond with just the word "OK"'}],'You are a connection test. Respond with just "OK".',{maxTokens:10}),{success:!0}}catch(e){return{success:!1,error:e instanceof We?e.message:"Connection test failed"}}}}let bt=null;function Ba(){return bt||(bt=new La),bt}const Wa=`You are a workspace organization assistant for a browser extension called Mnemonic. Analyze the user's browser workspaces and suggest improvements.
  8  
  9  Types of suggestions you can make:
 10  1. "organize" - Group related standalone workspaces under a new parent workspace
 11  2. "merge" - Combine similar workspaces that have overlapping content
 12  3. "split" - Divide a workspace that contains unrelated tabs
 13  4. "rename" - Suggest better names for workspaces with unclear names
 14  5. "transcendent" - Suggest workspaces that should be marked as transcendent (persist across context switches, like Email or Calendar)
 15  
 16  Response format (JSON array):
 17  [
 18    {
 19      "type": "organize",
 20      "description": "Brief explanation of why this change helps",
 21      "affectedWorkspaces": ["workspace-id-1", "workspace-id-2"],
 22      "suggestedAction": {
 23        "type": "createParent",
 24        "params": { "name": "Suggested Parent Name", "children": ["id1", "id2"] }
 25      },
 26      "confidence": 0.85
 27    }
 28  ]
 29  
 30  Guidelines:
 31  - Be concise and practical
 32  - Only suggest changes that would meaningfully improve organization
 33  - Return empty array [] if no suggestions are needed
 34  - Confidence should be between 0 and 1
 35  - Consider tab domains and titles when grouping`,ja=`You categorize browser tabs into workspaces. Given a list of tabs and existing workspaces, assign each tab to the most appropriate workspace.
 36  
 37  Rules:
 38  1. Prefer existing workspaces when there's a good fit
 39  2. Suggest "NEW: [name]" for tabs that don't fit existing workspaces
 40  3. Group related tabs together in new workspaces
 41  4. Keep suggestions practical (3-7 tabs per workspace is ideal)
 42  5. Consider the domain and page title when categorizing
 43  
 44  Respond with JSON only: { "workspaceName": ["tab1 title", "tab2 title"], ... }`,Ga=`You suggest concise, descriptive names for parent workspaces based on their child workspaces.
 45  
 46  Guidelines:
 47  - Names should be 1-3 words
 48  - Capture the common theme
 49  - Be specific but not too narrow
 50  - Avoid generic names like "Misc" or "Other"
 51  
 52  Respond with exactly 3 names, one per line, no numbering or explanation.`,Ka=`You suggest a concise, descriptive name for a browser workspace based on the tabs it contains. Also suggest the best parent workspace to organize it under, if any.
 53  
 54  Guidelines for naming:
 55  - Name should be 1-4 words maximum
 56  - Capture the main theme or purpose of the tabs
 57  - Be specific but memorable (e.g., "React Docs" not "Programming Documentation")
 58  - Avoid generic names like "Research" or "Work" unless truly appropriate
 59  
 60  Guidelines for parent suggestion:
 61  - Suggest an existing parent workspace if the tabs clearly fit that category
 62  - Suggest null if the workspace should be standalone
 63  - Consider both the tab content and the parent workspace names
 64  
 65  Response format (JSON only):
 66  {
 67    "name": "Suggested Workspace Name",
 68    "parentId": "parent-id-or-null",
 69    "reasoning": "Brief explanation of why this name and parent were chosen"
 70  }`,Fa=`Identify workspaces that should be marked as "transcendent" - workspaces that should persist across all context switches because they are always needed.
 71  
 72  Common transcendent workspaces:
 73  - Email clients (Gmail, Outlook, etc.)
 74  - Calendar applications
 75  - Chat/messaging (Slack, Discord, etc.)
 76  - Password managers
 77  - Note-taking apps used across projects
 78  - Music/media players
 79  
 80  Return a JSON array of workspace IDs that should be transcendent:
 81  ["workspace-id-1", "workspace-id-2"]
 82  
 83  Only suggest workspaces that truly belong across all contexts.`,Ha=`You generate concise, abstract summaries describing what a workspace is FOR, based primarily on its name.
 84  
 85  Guidelines:
 86  - Write 1-2 sentences maximum
 87  - The WORKSPACE NAME is the primary indicator of purpose - use it as your main guide
 88  - The tabs are secondary context to help understand the general domain, but DO NOT describe their specific content
 89  - Describe the workspace's PURPOSE and intended use, not its current contents
 90  - The summary should remain accurate even if the tabs change completely
 91  - DO NOT mention specific websites, page titles, articles, topics, or content
 92  - DO NOT reference specific URLs, domains, services, or current events
 93  - Use language that describes the workspace's function: "A workspace for...", "Dedicated to...", "Used for..."
 94  - Keep it generic enough that any related content would fit
 95  
 96  Example - Workspace named "News Research":
 97  Good: "A workspace dedicated to news gathering and current events research. Used for collecting and organizing topical information from various sources."
 98  Bad: "Research into political developments and government affairs with focus on congressional oversight."
 99  
100  Example - Workspace named "Frontend Dev":
101  Good: "A workspace for frontend development work and web UI implementation. Supports coding, documentation, and technical reference needs."
102  Bad: "Learning focused on React patterns and Next.js architecture with component design exploration."
103  
104  Respond with just the summary text, no JSON or formatting.`,Va=`You generate concise, abstract summaries describing what a parent workspace context is FOR, based primarily on its name.
105  
106  Guidelines:
107  - Write 1-2 sentences maximum
108  - The PARENT WORKSPACE NAME is the primary indicator of purpose - use it as your main guide
109  - Child workspace names provide secondary context about the scope, but DO NOT list them
110  - Describe the parent context's PURPOSE and intended use as a container/project
111  - The summary should remain accurate even if child workspaces are added or removed
112  - DO NOT mention specific child workspace names
113  - Use language that describes the context's function: "A project context for...", "An organizational container for...", "A workspace collection dedicated to..."
114  - Keep it generic enough that related child workspaces would fit
115  
116  Example - Parent named "E-commerce Project":
117  Good: "A project context for e-commerce development work. Organizes related workspaces for building and maintaining online retail functionality."
118  Bad: "Contains the 'API Development' workspace for building endpoints and the 'Database Design' workspace for schema work."
119  
120  Respond with just the summary text, no JSON or formatting.`;function zt(r){return r.map(e=>{var o,v,d;const n=e.isTranscendent?" [TRANSCENDENT]":"";if(e.type==="parent")return`[Parent${n}] ${e.name} (ID: ${e.id}, ${((o=e.children)==null?void 0:o.length)||0} children)`;const l=(v=e.tabs)==null?void 0:v.slice(0,5).map(u=>{try{return`${new URL(u.url).hostname.replace("www.","")}: ${u.title.slice(0,40)}`}catch{return u.title.slice(0,50)}}),s=((d=e.tabs)==null?void 0:d.length)||0,a=s>5?` +${s-5} more`:"";return`[${e.type}${n}] ${e.name} (ID: ${e.id}):
121    ${l==null?void 0:l.join(`
122    `)}${a}`}).join(`
123  
124  `)}function yt(r){return r.map(e=>{try{const n=new URL(e.url).hostname.replace("www.",""),l=e.enrichedTitle||e.title;return e.description&&e.description!==l?`- ${l} [${n}]: ${e.description.slice(0,150)}`:`- ${l} [${n}]`}catch{return`- ${e.title} [${e.url}]`}}).join(`
125  `)}function Ua(r){return r.map(e=>`- ${e.name} (${e.type}, ID: ${e.id})`).join(`
126  `)}class Ya{constructor(){ht(this,"client",Ba())}async getSuggestions(e){if(!this.client.isConfigured())return{success:!1,suggestions:[],error:"Claude API key not configured"};if(e.length===0)return{success:!0,suggestions:[]};const l=[{role:"user",content:`Analyze these browser workspaces and suggest organizational improvements:
127  
128  ${zt(e.map(s=>({id:s.id,name:s.name,type:s.type,isTranscendent:s.isTranscendent,tabs:"tabs"in s?s.tabs:void 0,children:"children"in s?s.children:void 0})))}
129  
130  Provide suggestions in JSON format.`}];try{const s=await this.client.sendMessage(l,Wa,{maxTokens:2048});return{success:!0,suggestions:this.parseSuggestions(s)}}catch(s){const a=s instanceof We?s.message:"Failed to get suggestions";return console.error("[Claude] Suggestion error:",a),{success:!1,suggestions:[],error:a}}}async suggestParentName(e){if(!this.client.isConfigured())return["New Project","Workspace Group","Collection"];const l=[{role:"user",content:`Suggest 3 concise names for a parent workspace containing these child workspaces:
131  
132  ${e.map(s=>`${s.name}: ${s.tabs.slice(0,5).map(a=>a.title).join(", ")}${s.tabs.length>5?"...":""}`).join(`
133  `)}`}];try{const a=(await this.client.sendMessage(l,Ga,{maxTokens:100})).split(`
134  `).map(o=>o.trim()).filter(o=>o.length>0&&o.length<50).slice(0,3);return a.length>0?a:["New Project","Workspace Group","Collection"]}catch{return["New Project","Workspace Group","Collection"]}}async categorizeOrphanTabs(e,n){if(!this.client.isConfigured())return{success:!1,categories:[],error:"Claude API key not configured"};if(e.length===0)return{success:!0,categories:[]};const l=yt(e.map(o=>({url:o.url,title:o.title}))),s=Ua(n.map(o=>({name:o.name,type:o.type,id:o.id}))),a=[{role:"user",content:`Categorize these tabs into existing workspaces or suggest new ones:
135  
136  Tabs:
137  ${l}
138  
139  Existing workspaces:
140  ${s}
141  
142  Respond with JSON mapping workspace names to arrays of tab titles.`}];try{const o=await this.client.sendMessage(a,ja,{maxTokens:2048});return{success:!0,categories:this.parseCategorization(o)}}catch(o){const v=o instanceof We?o.message:"Failed to categorize tabs";return{success:!1,categories:[],error:v}}}async suggestTranscendent(e){if(!this.client.isConfigured())return[];const n=e.filter(a=>"tabs"in a&&a.tabs.length>0);if(n.length===0)return[];const s=[{role:"user",content:`Identify which of these workspaces should be marked as transcendent (persist across all context switches):
143  
144  ${zt(n.map(a=>({id:a.id,name:a.name,type:a.type,isTranscendent:a.isTranscendent,tabs:"tabs"in a?a.tabs:void 0})))}`}];try{const o=(await this.client.sendMessage(s,Fa,{maxTokens:500})).match(/\[[\s\S]*?\]/);if(o){const v=JSON.parse(o[0]);if(Array.isArray(v))return v.filter(d=>typeof d=="string")}return[]}catch{return[]}}async suggestWorkspaceNameAndParent(e,n){if(console.log("[SuggestionEngine] suggestWorkspaceNameAndParent called"),console.log("[SuggestionEngine] Client configured:",this.client.isConfigured()),!this.client.isConfigured())return console.log("[SuggestionEngine] Client not configured, returning error"),{success:!1,name:null,parentId:null,reasoning:null,error:"Claude API key not configured"};if(e.length===0)return console.log("[SuggestionEngine] No tabs provided"),{success:!1,name:null,parentId:null,reasoning:null,error:"No tabs provided"};const l=yt(e),s=n.length>0?n.map(o=>`- ${o.name} (ID: ${o.id})`).join(`
145  `):"No parent workspaces available",a=[{role:"user",content:`Suggest a name and parent workspace for a new workspace containing these tabs:
146  
147  Tabs:
148  ${l}
149  
150  Available parent workspaces:
151  ${s}
152  
153  Respond with JSON only.`}];console.log("[SuggestionEngine] Sending request to Claude API...");try{const o=await this.client.sendMessage(a,Ka,{maxTokens:300});console.log("[SuggestionEngine] Got response:",o);const v=o.match(/\{[\s\S]*\}/);if(v){const d=JSON.parse(v[0]),u=d.parentId==="null"||d.parentId===null?null:d.parentId,c=u&&n.some(k=>k.id===u)?u:null;return{success:!0,name:d.name||null,parentId:c,reasoning:d.reasoning||null}}return console.log("[SuggestionEngine] Failed to parse JSON from response"),{success:!1,name:null,parentId:null,reasoning:null,error:"Failed to parse response"}}catch(o){return console.error("[SuggestionEngine] API error:",o),{success:!1,name:null,parentId:null,reasoning:null,error:o instanceof We?o.message:"Failed to get naming suggestion"}}}async generateSummaryFromTabs(e,n){if(!this.client.isConfigured())return{success:!1,summary:null,error:"Claude API key not configured"};if(n.length===0)return{success:!1,summary:null,error:"No tabs provided"};const l=yt(n),s=[{role:"user",content:`Generate a brief summary for the workspace "${e}" based on these tabs:
154  
155  ${l}`}];try{return{success:!0,summary:(await this.client.sendMessage(s,Ha,{maxTokens:200})).trim()}}catch(a){return{success:!1,summary:null,error:a instanceof We?a.message:"Failed to generate summary"}}}async generateSummaryFromChildren(e,n){if(!this.client.isConfigured())return{success:!1,summary:null,error:"Claude API key not configured"};if(n.length===0)return{success:!1,summary:null,error:"No child workspaces provided"};const l=n.map(a=>a.summary?`- ${a.name}: ${a.summary}`:`- ${a.name}`).join(`
156  `),s=[{role:"user",content:`Generate a brief summary for the parent workspace context "${e}" based on these child workspaces:
157  
158  ${l}`}];try{return{success:!0,summary:(await this.client.sendMessage(s,Va,{maxTokens:200})).trim()}}catch(a){return{success:!1,summary:null,error:a instanceof We?a.message:"Failed to generate summary"}}}parseSuggestions(e){try{const n=e.match(/\[[\s\S]*\]/);if(n){const l=JSON.parse(n[0]);if(Array.isArray(l))return l.filter(s=>s&&typeof s.type=="string"&&typeof s.description=="string"&&Array.isArray(s.affectedWorkspaces)&&s.suggestedAction)}}catch{}return[]}parseCategorization(e){try{const n=e.match(/\{[\s\S]*\}/);if(n){const l=JSON.parse(n[0]);return Object.entries(l).map(([s,a])=>({workspaceName:s,tabTitles:Array.isArray(a)?a:[],isNew:s.startsWith("NEW:")}))}}catch{}return[]}}let Ct=null;function Tr(){return Ct||(Ct=new Ya),Ct}var Ja=P('<div class="error-banner svelte-1kxx0uv"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg> <span> </span> <button class="ml-auto text-xs hover:underline">Dismiss</button></div>'),qa=P('<div class="loading-state svelte-1kxx0uv"><svg class="animate-spin w-6 h-6 text-phosphor" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <span class="text-text-muted">Loading archived workspaces...</span></div>'),Xa=P('<div class="empty-state svelte-1kxx0uv"><svg class="w-12 h-12 text-text-muted opacity-50 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"></path></svg> <p>No archived workspaces</p> <p class="text-sm mt-1">Archived workspaces will appear here</p></div>'),Za=be('<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>'),Qa=be('<svg class="w-4 h-4 text-status-error" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>'),$a=be('<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>'),er=P('<div class="workspace-item child-item svelte-1kxx0uv"><div class="workspace-info svelte-1kxx0uv"><span class="workspace-name svelte-1kxx0uv"> </span> <span class="workspace-meta svelte-1kxx0uv"> </span></div> <!></div>'),tr=P('<div class="children-list svelte-1kxx0uv"></div>'),nr=P('<div class="workspace-group svelte-1kxx0uv"><div class="workspace-item parent-item svelte-1kxx0uv"><button class="expand-toggle svelte-1kxx0uv"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></button> <div class="workspace-info svelte-1kxx0uv"><span class="workspace-name svelte-1kxx0uv"> </span> <span class="workspace-meta svelte-1kxx0uv"> </span></div> <div class="workspace-actions svelte-1kxx0uv"><!> <!></div></div> <!></div>'),ar=P('<div class="workspace-list svelte-1kxx0uv"></div>'),rr=P('<section class="workspace-section svelte-1kxx0uv"><button class="section-header svelte-1kxx0uv"><div class="section-header-left svelte-1kxx0uv"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> <h3 class="section-title svelte-1kxx0uv">Archived Contexts</h3> <span class="section-count svelte-1kxx0uv"> </span></div></button> <!></section>'),sr=be('<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>'),or=be('<svg class="w-4 h-4 text-status-error" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>'),ir=P('<div class="workspace-item svelte-1kxx0uv"><div class="workspace-info svelte-1kxx0uv"><span class="workspace-name svelte-1kxx0uv"> </span> <span class="workspace-meta svelte-1kxx0uv"> </span></div> <div class="workspace-actions svelte-1kxx0uv"><!> <!></div></div>'),lr=P('<div class="workspace-list svelte-1kxx0uv"></div>'),cr=P('<section class="workspace-section svelte-1kxx0uv"><button class="section-header svelte-1kxx0uv"><div class="section-header-left svelte-1kxx0uv"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> <h3 class="section-title svelte-1kxx0uv">Archived Workspaces</h3> <span class="section-count svelte-1kxx0uv"> </span></div></button> <!></section>'),dr=be('<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>'),ur=be('<svg class="w-4 h-4 text-status-error" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>'),vr=P('<div class="workspace-item svelte-1kxx0uv"><div class="workspace-info svelte-1kxx0uv"><span class="workspace-name svelte-1kxx0uv"> </span> <span class="workspace-meta svelte-1kxx0uv"> </span></div> <div class="workspace-actions svelte-1kxx0uv"><!> <!></div></div>'),gr=P(`<div class="workspace-list svelte-1kxx0uv"><p class="orphan-notice svelte-1kxx0uv">These children's parent context was deleted or restored without them.</p> <!></div>`),fr=P('<section class="workspace-section svelte-1kxx0uv"><button class="section-header svelte-1kxx0uv"><div class="section-header-left svelte-1kxx0uv"><svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> <h3 class="section-title svelte-1kxx0uv">Orphan Children</h3> <span class="section-count svelte-1kxx0uv"> </span></div></button> <!></section>'),hr=P("<!> <!> <!>",1),pr=P('<div class="archived-content svelte-1kxx0uv"><!> <!></div>'),mr=P("<!> <!>",1);function Ar(r,e){Je(e,!0);let n=W(e,"open",15),l=q(!1),s=q(null),a=q(we([])),o=q(we(new Set)),v=q(!1),d=q(null),u=q(we(new Set)),c=q(we(new Set)),k=q(!0),m=q(!0),S=q(!0);Et(()=>{n()?x():(N(s,null),N(o,new Set,!0))});async function x(){N(l,!0),N(s,null);try{const D=await mt.runtime.sendMessage({type:"GET_ARCHIVED_WORKSPACES"});Array.isArray(D)?N(a,D,!0):D.error&&N(s,D.error,!0)}catch(D){N(s,D instanceof Error?D.message:"Failed to load archived workspaces",!0)}finally{N(l,!1)}}const h=T(()=>{const D=t(a).filter(V=>V.type==="parent"),O=t(a).filter(V=>V.type==="standalone"),ne=new Set(D.map(V=>V.id)),oe=t(a).filter(V=>V.type==="child"&&!ne.has(V.parentId));return{parents:D,standalone:O,orphanChildren:oe}});function f(D){return t(a).filter(O=>O.type==="child"&&O.parentId===D)}function M(D){const O=new Set(t(o));O.has(D)?O.delete(D):O.add(D),N(o,O,!0)}async function H(D){N(u,new Set([...t(u),D]),!0);try{const O=await mt.runtime.sendMessage({type:"RESTORE_WORKSPACE",payload:{id:D}});O.success?(await x(),e.onRestored()):N(s,O.error||"Failed to restore workspace",!0)}catch(O){N(s,O instanceof Error?O.message:"Failed to restore workspace",!0)}finally{N(u,new Set([...t(u)].filter(O=>O!==D)),!0)}}async function z(D){N(u,new Set([...t(u),D]),!0);try{const O=await mt.runtime.sendMessage({type:"RESTORE_CONTEXT",payload:{parentId:D}});O.success?(await x(),e.onRestored()):N(s,O.error||"Failed to restore context",!0)}catch(O){N(s,O instanceof Error?O.message:"Failed to restore context",!0)}finally{N(u,new Set([...t(u)].filter(O=>O!==D)),!0)}}function j(D){N(d,D,!0),N(v,!0)}async function K(){if(!t(d))return;const D=t(d).id;N(c,new Set([...t(c),D]),!0);try{const O=await mt.runtime.sendMessage({type:"PERMANENTLY_DELETE_WORKSPACE",payload:{id:D}});O.success?await x():N(s,O.error||"Failed to delete workspace",!0)}catch(O){N(s,O instanceof Error?O.message:"Failed to delete workspace",!0)}finally{N(c,new Set([...t(c)].filter(O=>O!==D)),!0),N(d,null),N(v,!1)}}function B(D){const O=new Date(D),oe=new Date().getTime()-O.getTime(),V=Math.floor(oe/864e5);return V===0?"Today":V===1?"Yesterday":V<7?`${V} days ago`:V<30?`${Math.floor(V/7)} week${V>=14?"s":""} ago`:O.toLocaleDateString()}function C(D){var ne;if(D.type==="parent")return`Context with ${f(D.id).length} archived children`;const O="tabs"in D&&((ne=D.tabs)==null?void 0:ne.length)||0;return`${O} tab${O!==1?"s":""}`}const E=T(()=>t(h).parents.length),te=T(()=>t(h).standalone.length),ye=T(()=>t(h).orphanChildren.length),Xe=T(()=>t(a).length);var Ae=mr(),De=xe(Ae);Ut(De,{title:"Archived Workspaces",get onclose(){return e.onclose},get open(){return n()},set open(D){n(D)},children:(D,O)=>{var ne=pr(),oe=g(ne);{var V=A=>{var i=Ja(),_=w(g(i),2),I=g(_),F=w(_,2);F.__click=()=>N(s,null),U(()=>Y(I,t(s))),p(A,i)};L(oe,A=>{t(s)&&A(V)})}var je=w(oe,2);{var b=A=>{var i=qa();p(A,i)},R=A=>{var i=Ie(),_=xe(i);{var I=y=>{var X=Xa();p(y,X)},F=y=>{var X=hr(),he=xe(X);{var Ge=ie=>{var me=rr(),ke=g(me);ke.__click=()=>N(k,!t(k));var Ze=g(ke),ze=g(Ze);let Me;var tt=w(ze,4),nt=g(tt),at=w(ke,2);{var Z=J=>{var de=ar();Te(de,21,()=>t(h).parents,ae=>ae.id,(ae,G)=>{const Q=T(()=>f(t(G).id));var $=nr(),le=g($),_e=g(le);_e.__click=()=>M(t(G).id);var Ce=g(_e);let re;var ue=w(_e,2),He=g(ue),Qe=g(He),ve=w(He,2),ee=g(ve),Se=w(ue,2),Ee=g(Se);{let ce=T(()=>t(u).has(t(G).id));Ve(Ee,{variant:"ghost",size:"sm",onclick:()=>z(t(G).id),get disabled(){return t(ce)},children:(se,Oe)=>{var Be=Ie(),ut=xe(Be);{var vt=$e=>{var ct=Za();p($e,ct)},gt=$e=>{var ct=it("Restore All");p($e,ct)};L(ut,$e=>{t(u).has(t(G).id)?$e(vt):$e(gt,!1)})}p(se,Be)},$$slots:{default:!0}})}var Le=w(Ee,2);{let ce=T(()=>t(c).has(t(G).id));Ve(Le,{variant:"ghost",size:"sm",onclick:()=>j(t(G)),get disabled(){return t(ce)},children:(se,Oe)=>{var Be=Qa();p(se,Be)},$$slots:{default:!0}})}var rt=w(le,2);{var lt=ce=>{var se=tr();Te(se,21,()=>t(Q),Oe=>Oe.id,(Oe,Be)=>{var ut=er(),vt=g(ut),gt=g(vt),$e=g(gt),ct=w(gt,2),Yt=g(ct),Jt=w(vt,2);{let ft=T(()=>t(u).has(t(Be).id));Ve(Jt,{variant:"ghost",size:"sm",onclick:()=>H(t(Be).id),get disabled(){return t(ft)},children:(qt,xr)=>{var It=Ie(),Xt=xe(It);{var Zt=st=>{var kt=$a();p(st,kt)},Qt=st=>{var kt=it("Restore");p(st,kt)};L(Xt,st=>{t(u).has(t(Be).id)?st(Zt):st(Qt,!1)})}p(qt,It)},$$slots:{default:!0}})}U(()=>{var ft;Y($e,t(Be).name),Y(Yt,`${(((ft=t(Be).tabs)==null?void 0:ft.length)||0)??""} tabs`)}),p(Oe,ut)}),p(ce,se)};L(rt,ce=>{t(o).has(t(G).id)&&t(Q).length>0&&ce(lt)})}U((ce,se,Oe)=>{re=fe(Ce,0,"chevron-small svelte-1kxx0uv",null,re,ce),Y(Qe,t(G).name),Y(ee,`${se??""} - Archived ${Oe??""}`)},[()=>({expanded:t(o).has(t(G).id)}),()=>C(t(G)),()=>B(t(G).archivedAt)]),p(ae,$)}),p(J,de)};L(at,J=>{t(k)&&J(Z)})}U(()=>{Me=fe(ze,0,"chevron-icon svelte-1kxx0uv",null,Me,{expanded:t(k)}),Y(nt,t(E))}),p(ie,me)};L(he,ie=>{t(E)>0&&ie(Ge)})}var Ne=w(he,2);{var Ke=ie=>{var me=cr(),ke=g(me);ke.__click=()=>N(m,!t(m));var Ze=g(ke),ze=g(Ze);let Me;var tt=w(ze,4),nt=g(tt),at=w(ke,2);{var Z=J=>{var de=lr();Te(de,21,()=>t(h).standalone,ae=>ae.id,(ae,G)=>{var Q=ir(),$=g(Q),le=g($),_e=g(le),Ce=w(le,2),re=g(Ce),ue=w($,2),He=g(ue);{let ve=T(()=>t(u).has(t(G).id));Ve(He,{variant:"ghost",size:"sm",onclick:()=>H(t(G).id),get disabled(){return t(ve)},children:(ee,Se)=>{var Ee=Ie(),Le=xe(Ee);{var rt=ce=>{var se=sr();p(ce,se)},lt=ce=>{var se=it("Restore");p(ce,se)};L(Le,ce=>{t(u).has(t(G).id)?ce(rt):ce(lt,!1)})}p(ee,Ee)},$$slots:{default:!0}})}var Qe=w(He,2);{let ve=T(()=>t(c).has(t(G).id));Ve(Qe,{variant:"ghost",size:"sm",onclick:()=>j(t(G)),get disabled(){return t(ve)},children:(ee,Se)=>{var Ee=or();p(ee,Ee)},$$slots:{default:!0}})}U((ve,ee)=>{Y(_e,t(G).name),Y(re,`${ve??""} - Archived ${ee??""}`)},[()=>C(t(G)),()=>B(t(G).archivedAt)]),p(ae,Q)}),p(J,de)};L(at,J=>{t(m)&&J(Z)})}U(()=>{Me=fe(ze,0,"chevron-icon svelte-1kxx0uv",null,Me,{expanded:t(m)}),Y(nt,t(te))}),p(ie,me)};L(Ne,ie=>{t(te)>0&&ie(Ke)})}var Fe=w(Ne,2);{var pe=ie=>{var me=fr(),ke=g(me);ke.__click=()=>N(S,!t(S));var Ze=g(ke),ze=g(Ze);let Me;var tt=w(ze,4),nt=g(tt),at=w(ke,2);{var Z=J=>{var de=gr(),ae=w(g(de),2);Te(ae,17,()=>t(h).orphanChildren,G=>G.id,(G,Q)=>{var $=vr(),le=g($),_e=g(le),Ce=g(_e),re=w(_e,2),ue=g(re),He=w(le,2),Qe=g(He);{let ee=T(()=>t(u).has(t(Q).id));Ve(Qe,{variant:"ghost",size:"sm",onclick:()=>H(t(Q).id),get disabled(){return t(ee)},title:"Restore as standalone workspace",children:(Se,Ee)=>{var Le=Ie(),rt=xe(Le);{var lt=se=>{var Oe=dr();p(se,Oe)},ce=se=>{var Oe=it("Restore");p(se,Oe)};L(rt,se=>{t(u).has(t(Q).id)?se(lt):se(ce,!1)})}p(Se,Le)},$$slots:{default:!0}})}var ve=w(Qe,2);{let ee=T(()=>t(c).has(t(Q).id));Ve(ve,{variant:"ghost",size:"sm",onclick:()=>j(t(Q)),get disabled(){return t(ee)},children:(Se,Ee)=>{var Le=ur();p(Se,Le)},$$slots:{default:!0}})}U(ee=>{var Se;Y(Ce,t(Q).name),Y(ue,`${(((Se=t(Q).tabs)==null?void 0:Se.length)||0)??""} tabs - Archived ${ee??""}`)},[()=>B(t(Q).archivedAt)]),p(G,$)}),p(J,de)};L(at,J=>{t(S)&&J(Z)})}U(()=>{Me=fe(ze,0,"chevron-icon svelte-1kxx0uv",null,Me,{expanded:t(S)}),Y(nt,t(ye))}),p(ie,me)};L(Fe,ie=>{t(ye)>0&&ie(pe)})}p(y,X)};L(_,y=>{t(Xe)===0?y(I):y(F,!1)},!0)}p(A,i)};L(je,A=>{t(l)?A(b):A(R,!1)})}p(D,ne)},$$slots:{default:!0}});var Re=w(De,2);{let D=T(()=>{var O,ne,oe;return((O=t(d))==null?void 0:O.type)==="parent"?`This will permanently delete "${(ne=t(d))==null?void 0:ne.name}" and all its children. This action cannot be undone.`:`This will permanently delete "${(oe=t(d))==null?void 0:oe.name}". This action cannot be undone.`});Qn(Re,{title:"Permanently Delete?",get message(){return t(D)},confirmText:"Delete Forever",variant:"danger",onconfirm:K,oncancel:()=>{N(v,!1),N(d,null)},get open(){return t(v)},set open(O){N(v,O,!0)}})}p(r,Ae),qe()}Pe(["click"]);export{Ar as A,Ve as B,Qn as C,yr as I,Ut as M,br as T,Sr as W,Tr as a,Cr as b,aa as c,Te as e,Ba as g,Ln as h,wr as i,W as p,Ot as s};