efficient-shell 7.56.1 → 7.56.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{Browser-HTH7GWNA.js → Browser-VHEWBYAB.js} +10 -10
  2. package/dist/Calculator-Z6JA6D6Q.js +29 -0
  3. package/dist/{CurrencyConverter-2A45OUOD.js → CurrencyConverter-XFICWUGP.js} +5 -5
  4. package/dist/{Documents-X33TJJFX.js → Documents-P76C2K5Q.js} +15 -15
  5. package/dist/{Files-KIJPNW23.js → Files-ZEM5LZTQ.js} +87 -87
  6. package/dist/{Notepad-O6GFW5XQ.js → Notepad-ORU67CGY.js} +10 -10
  7. package/dist/PdfViewer-NW6NQ6NP.js +1 -0
  8. package/dist/{PomodoroTimer-LXUCEGO2.js → PomodoroTimer-ZEPPQYCU.js} +6 -6
  9. package/dist/{Preview-KKLHDTZC.js → Preview-2NIAXPZV.js} +46 -46
  10. package/dist/{Sidebar-5LMCOUCB.js → Sidebar-LKER76LS.js} +28 -28
  11. package/dist/{Spreadsheet-WOUU5DK7.js → Spreadsheet-3YSTQGWR.js} +11 -11
  12. package/dist/{Stock-L2W6WRVP.js → Stock-M6GGO7XF.js} +1 -1
  13. package/dist/{Weather-7GK4V2SQ.js → Weather-VU7VGUDO.js} +17 -17
  14. package/dist/{WorldClock-2D2YSOTH.js → WorldClock-QAMG23XA.js} +6 -6
  15. package/dist/ai/index.js +13 -13
  16. package/dist/apps/index.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/{chunk-BVEUHQOE.js → chunk-56DUNIS6.js} +16 -16
  19. package/dist/{chunk-JIRDFTVN.js → chunk-5OM7IOYE.js} +1 -1
  20. package/dist/{chunk-UHRGYZRP.js → chunk-7ZYZDQ5V.js} +4 -4
  21. package/dist/{chunk-HKISG22R.js → chunk-AIWVDJVQ.js} +1 -1
  22. package/dist/{chunk-INXHIPJ5.js → chunk-FP4N53XC.js} +1 -1
  23. package/dist/{chunk-ONEEJJK5.js → chunk-H4SBJXBL.js} +1 -1
  24. package/dist/{chunk-6ATKOYTG.js → chunk-HCC7EJUD.js} +1 -1
  25. package/dist/{chunk-MPAW7WHG.js → chunk-J4NEE4AO.js} +26 -26
  26. package/dist/{chunk-RUJK3FOM.js → chunk-L37CPWIB.js} +13 -13
  27. package/dist/chunk-LOT6WJ5F.js +1 -0
  28. package/dist/{chunk-VT6TBIVE.js → chunk-MRQLTNG6.js} +321 -321
  29. package/dist/{chunk-EYOYUZFK.js → chunk-OWXCXFL6.js} +2 -2
  30. package/dist/{chunk-GXGRCLNE.js → chunk-V4Y32XF3.js} +2 -2
  31. package/dist/{chunk-4OKCSGQU.js → chunk-WFQIEKM3.js} +31 -31
  32. package/dist/{chunk-OGVC2IS3.js → chunk-YIIFH7CK.js} +1 -1
  33. package/dist/index.js +101 -101
  34. package/dist/map/index.js +7 -7
  35. package/dist/page-tabs/index.js +5 -5
  36. package/dist/pdf/index.js +1 -1
  37. package/dist/telemetry/index.js +1 -1
  38. package/dist/ui/index.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/Calculator-WUFXRLVM.js +0 -29
  41. package/dist/PdfViewer-A4WWSSFU.js +0 -1
  42. package/dist/chunk-7L7CUVCD.js +0 -1
@@ -1,2 +1,2 @@
1
- import{toast_default as t}from"./chunk-OGVC2IS3.js";import{useShellPrefs as e}from"./chunk-2H3XIWVB.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(G(),V()):"none"!==t&&0!==m||G()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&V())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),G())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);G(),N(s,{volume:u,repeat:d});const e="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(e)}catch{}try{t.info(e)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,O={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function _(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function V(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=_(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*O[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function G(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function R(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=_(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*O[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var F="pomodoro_tasks",W="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function q(){/* @__PURE__ */
2
- return(new Date).toISOString()}var E=null,H=[],J=!1,L=null,X=/* @__PURE__ */new Set;function $(){for(const t of X)t()}function z(t){H=t,$()}function K(){const t=E;return t?L=t.list().then(e=>{E===t&&(H=e,J=!0,$())}).catch(()=>{E===t&&(J=!0,$())}).finally(()=>{L=null}):(H=[],J=!0,$(),Promise.resolve())}function Q(t){E=t,H=[],J=!1,t?K():$()}function U(t){return X.add(t),!E||J||L||K(),()=>{X.delete(t)}}function Y(){return H}function Z(){const t=function(){const{prefs:t,save:n}=e(),r=a(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=q(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:q()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(U,Y,Y),i=o(e=>{const n=E;if(!n)return t.addTask(e);const o="tmp-"+j(),a=q(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return z([...H,r]),n.create({...e,name:e.name.trim()}).then(t=>z(H.map(e=>e.id===o?{...r,...t}:e))).catch(()=>z(H.filter(t=>t.id!==o))),o},[t]),c=o((e,n)=>{const o=E;if(!o)return t.updateTask(e,n);z(H.map(t=>t.id===e?{...t,...n,id:e,updatedAt:q()}:t)),o.update(e,n).catch(()=>{K()})},[t]),l=o(e=>{const n=E;if(!n)return t.removeTask(e);const o=H;z(H.filter(t=>t.id!==e)),n.remove(e).catch(()=>z(o))},[t]),s=o(e=>{if(!E)return t.toggleDone(e);const n=H.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=o(e=>{E||t.setAllTasks(e)},[t]);return null===E?t:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(W))return;const n=localStorage.getItem(F);if(!n)return void localStorage.setItem(W,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(F),void localStorage.setItem(W,"1");const a=q(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(F),localStorage.setItem(W,"1")}catch{try{localStorage.setItem(W,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,R as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,Q as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
1
+ import{toast_default as t}from"./chunk-YIIFH7CK.js";import{useShellPrefs as e}from"./chunk-2H3XIWVB.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function I(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(R(),F()):"none"!==t&&0!==m||R()}function A(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&F())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),R())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);R(),N(s,{volume:u,repeat:d});const e="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(e)}catch{}try{t.info(e)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>A(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>A(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function F(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function R(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function V(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var G="pomodoro_tasks",W="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function H(){/* @__PURE__ */
2
+ return(new Date).toISOString()}var q=null,E=[],J=!1,K=null,L=/* @__PURE__ */new Set;function X(){for(const t of L)t()}function Y(t){E=t,X()}function $(){const t=q;return t?K=t.list().then(e=>{q===t&&(E=e,J=!0,X())}).catch(()=>{q===t&&(J=!0,X())}).finally(()=>{K=null}):(E=[],J=!0,X(),Promise.resolve())}function z(t){q=t,E=[],J=!1,t?$():X()}function Q(t){return L.add(t),!q||J||K||$(),()=>{L.delete(t)}}function U(){return E}function Z(){const t=function(){const{prefs:t,save:n}=e(),r=a(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=H(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:H()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(Q,U,U),i=o(e=>{const n=q;if(!n)return t.addTask(e);const o="tmp-"+j(),a=H(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return Y([...E,r]),n.create({...e,name:e.name.trim()}).then(t=>Y(E.map(e=>e.id===o?{...r,...t}:e))).catch(()=>Y(E.filter(t=>t.id!==o))),o},[t]),c=o((e,n)=>{const o=q;if(!o)return t.updateTask(e,n);Y(E.map(t=>t.id===e?{...t,...n,id:e,updatedAt:H()}:t)),o.update(e,n).catch(()=>{$()})},[t]),l=o(e=>{const n=q;if(!n)return t.removeTask(e);const o=E;Y(E.filter(t=>t.id!==e)),n.remove(e).catch(()=>Y(o))},[t]),s=o(e=>{if(!q)return t.toggleDone(e);const n=E.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=o(e=>{q||t.setAllTasks(e)},[t]);return null===q?t:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(W))return;const n=localStorage.getItem(G);if(!n)return void localStorage.setItem(W,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(G),void localStorage.setItem(W,"1");const a=H(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(G),localStorage.setItem(W,"1")}catch{try{localStorage.setItem(W,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,A as pomoStart,B as pomoSwitchMode,V as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,I as setPomoFocusSound,z as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
@@ -1,4 +1,4 @@
1
- import{useWindowMenuItem as e,Modal as t}from"./chunk-4OKCSGQU.js";import{navIcons as r}from"./chunk-DSSLOQDW.js";import{VERSION as s}from"./chunk-7L7CUVCD.js";import{Icon as o}from"./chunk-TAUIAKU3.js";import{DEFAULT_SHELL_STRINGS as n,useShellStrings as i,splitAround as a}from"./chunk-BLMDTJOK.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=n.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(o,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(o,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const n=f[o],[u,w]=m(!1),g=c(()=>w(!0),[]),N=i().aboutApp,b=N.title(n.name);if(e(b,g,x),!u)return null;const y=r[n.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,D]=a(N.partOf);/* @__PURE__ */
1
+ import{useWindowMenuItem as e,Modal as t}from"./chunk-WFQIEKM3.js";import{navIcons as r}from"./chunk-DSSLOQDW.js";import{VERSION as s}from"./chunk-LOT6WJ5F.js";import{Icon as o}from"./chunk-TAUIAKU3.js";import{DEFAULT_SHELL_STRINGS as n,useShellStrings as i,splitAround as a}from"./chunk-BLMDTJOK.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=n.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(o,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(o,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const n=f[o],[u,w]=m(!1),g=c(()=>w(!0),[]),N=i().aboutApp,b=N.title(n.name);if(e(b,g,x),!u)return null;const y=r[n.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,W]=a(N.partOf);/* @__PURE__ */
2
2
  return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */h("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
3
3
  /* @__PURE__ */p("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
4
4
  /* @__PURE__ */p("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:n.name}),
@@ -6,4 +6,4 @@ return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1
6
6
  /* @__PURE__ */p("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:N[o]}),
7
7
  /* @__PURE__ */h("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
8
8
  /* @__PURE__ */h("p",{className:"text-2xs text-gray-500",children:[j,
9
- /* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),D]}),s&&/* @__PURE__ */p("p",{className:"mt-0.5 text-2xs font-mono text-gray-400",children:N.shellVersion(s)})]})]})})}export{w as AboutApp,f as BUILTIN_APP_INFO};
9
+ /* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),W]}),s&&/* @__PURE__ */p("p",{className:"mt-0.5 text-2xs font-mono text-gray-400",children:N.shellVersion(s)})]})]})})}export{w as AboutApp,f as BUILTIN_APP_INFO};
@@ -1,42 +1,42 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-GEHGFIQ6.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,Result as p,useIsMobile as f,useIsPhone as w,useShellPrefs as y,StatusBadge as g,ColoredBadge as b}from"./chunk-2H3XIWVB.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-4AHFABYE.js";import{reportBoundaryError as C}from"./chunk-KNUR2UEG.js";import{confirm as M,dialogA11y as N}from"./chunk-J5USRYOM.js";import{Button_default as S}from"./chunk-DELNCIUK.js";import{Z_LAYERS as L,runEscapeInterceptors as T}from"./chunk-FIEA5CGB.js";import{Icon as z}from"./chunk-TAUIAKU3.js";import{useShellStrings as A}from"./chunk-BLMDTJOK.js";import{LoadingSpinner as D}from"./chunk-2J6F4EE7.js";import{createContext as I,useContext as P,Component as K,useLayoutEffect as $,useRef as W,useEffect as O,useState as R,useSyncExternalStore as F,useCallback as q,isValidElement as j,Fragment as B,Children as H,cloneElement as U,useMemo as Y,useId as X,useReducer as V,Suspense as _}from"react";import{jsxs as J,jsx as G,Fragment as Q}from"react/jsx-runtime";import{createPortal as Z}from"react-dom";import{useLocation as ee}from"react-router-dom";import{useQueryClient as te,useQuery as ne}from"@tanstack/react-query";function re(e){return"component"in e}function oe(e){return"endpoint"in e}var ie={};function ae(e){ie=e}var se=new Proxy({},{get:(e,t)=>ie[t],has:(e,t)=>t in ie,ownKeys:()=>Object.keys(ie),getOwnPropertyDescriptor(e,t){if(t in ie)return{configurable:!0,enumerable:!0,value:ie[t]}}}),le=null;function ce(e){le=e}function de(){return null!==le}var ue=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),he=new Proxy({},{get:(e,t)=>le?le[t]:"string"==typeof t&&ue.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),me=I(null);function pe(){return P(me)?.pageSearch??""}var fe=null,we=/* @__PURE__ */new Set;function ye(e){fe!==e&&(fe=e,we.forEach(e=>e()))}function ge(){return fe}function be(e){return we.add(e),()=>{we.delete(e)}}function ve({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
1
+ import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-GEHGFIQ6.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,Result as p,useIsMobile as f,useIsPhone as w,useShellPrefs as y,StatusBadge as g,ColoredBadge as b}from"./chunk-2H3XIWVB.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-4AHFABYE.js";import{reportBoundaryError as C}from"./chunk-KNUR2UEG.js";import{confirm as M,dialogA11y as N}from"./chunk-J5USRYOM.js";import{Button_default as S}from"./chunk-DELNCIUK.js";import{Z_LAYERS as L,runEscapeInterceptors as T}from"./chunk-FIEA5CGB.js";import{LoadingSpinner as z}from"./chunk-2J6F4EE7.js";import{Icon as A}from"./chunk-TAUIAKU3.js";import{useShellStrings as D}from"./chunk-BLMDTJOK.js";import{createContext as I,useContext as P,Component as K,useLayoutEffect as $,useRef as W,useEffect as O,useState as R,useSyncExternalStore as F,useCallback as q,isValidElement as j,Fragment as B,Children as H,cloneElement as U,useMemo as Y,useId as X,useReducer as V,Suspense as _}from"react";import{jsxs as J,jsx as G,Fragment as Q}from"react/jsx-runtime";import{createPortal as Z}from"react-dom";import{useLocation as ee}from"react-router-dom";import{useQueryClient as te,useQuery as ne}from"@tanstack/react-query";function re(e){return"component"in e}function oe(e){return"endpoint"in e}var ie={};function ae(e){ie=e}var se=new Proxy({},{get:(e,t)=>ie[t],has:(e,t)=>t in ie,ownKeys:()=>Object.keys(ie),getOwnPropertyDescriptor(e,t){if(t in ie)return{configurable:!0,enumerable:!0,value:ie[t]}}}),le=null;function ce(e){le=e}function de(){return null!==le}var ue=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),he=new Proxy({},{get:(e,t)=>le?le[t]:"string"==typeof t&&ue.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),me=I(null);function pe(){return P(me)?.pageSearch??""}var fe=null,we=/* @__PURE__ */new Set;function ye(e){fe!==e&&(fe=e,we.forEach(e=>e()))}function ge(){return fe}function be(e){return we.add(e),()=>{we.delete(e)}}function ve({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
2
2
  return J("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
- /* @__PURE__ */G(z,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
3
+ /* @__PURE__ */G(A,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
4
  /* @__PURE__ */J("div",{className:"min-w-0",children:[
5
5
  /* @__PURE__ */G("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
6
  /* @__PURE__ */G("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
- /* @__PURE__ */G("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var xe=class extends K{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),C(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */G(ve,{error:e,onReload:this.reset}):this.props.children}},ke=I(null),Ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ce({className:e="",auto:t=!1}){const n=P(ke),r=A().undo,o=n?.claimOwnMount;if($(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
7
+ /* @__PURE__ */G("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var xe=class extends K{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),C(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */G(ve,{error:e,onReload:this.reset}):this.props.children}},ke=I(null),Ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ce({className:e="",auto:t=!1}){const n=P(ke),r=D().undo,o=n?.claimOwnMount;if($(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
8
8
  return J("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
9
  /* @__PURE__ */G("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",h):r.nothingToUndo,className:Ee,children:r.undo}),
10
- /* @__PURE__ */G("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:Ee,children:r.redo})]})}var Me=/* @__PURE__ */new Set([408,429]);function Ne(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Se(e){const t=Ne(e);return null!=t&&(t>=400&&t<500&&!Me.has(t))}function Le(e,t){return!Se(t)&&e<3}function Te(){const e=A().loading;/* @__PURE__ */
11
- return G(D,{size:"sm",padding:"p-8",label:e.label})}var ze="flex-1 min-h-0";function Ae(){const e=A().record;/* @__PURE__ */
12
- return G(D,{label:e.loading,padding:"",className:ze})}function De(e){return e??void 0}function Ie({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=A().record;if(t||e&&n)/* @__PURE__ */return G(Ae,{});if(r){const e=Ne(r);if(401===e)/* @__PURE__ */
10
+ /* @__PURE__ */G("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:Ee,children:r.redo})]})}var Me=/* @__PURE__ */new Set([408,429]);function Ne(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Se(e){const t=Ne(e);return null!=t&&(t>=400&&t<500&&!Me.has(t))}function Le(e,t){return!Se(t)&&e<3}function Te(){const e=D().loading;/* @__PURE__ */
11
+ return G(z,{size:"sm",padding:"p-8",label:e.label})}var ze="flex-1 min-h-0";function Ae(){const e=D().record;/* @__PURE__ */
12
+ return G(z,{label:e.loading,padding:"",className:ze})}function De(e){return e??void 0}function Ie({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=D().record;if(t||e&&n)/* @__PURE__ */return G(Ae,{});if(r){const e=Ne(r);if(401===e)/* @__PURE__ */
13
13
  return G(p,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:ze});if(403===e)/* @__PURE__ */
14
14
  return G(p,{status:"403",className:ze});if(404===e||410===e)/* @__PURE__ */
15
15
  return G(p,{status:"404",title:i.notFound,className:ze});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
16
  return G(p,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */G(S,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:ze})}/* @__PURE__ */
17
17
  return G(p,{status:"404",title:i.notFound,className:ze})}function Pe({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */G(Q,{children:t(e)}):/* @__PURE__ */G(Ie,{...n})}var Ke=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function $e(e){return"string"==typeof e&&(e.startsWith("new-")||Ke.test(e))}function We(e){if($e(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Oe=I({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Re=I(null);function Fe(e){const t=P(Re),n=W(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),$(()=>{if(t)return t(n.current,e)},[t,e]),O(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function qe(){const e=W(/* @__PURE__ */new Map),[t,n]=R(!1);return{dirty:t,registerDirty:q((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function je(){return P(Oe)}function Be(e){if("page"!==e.type&&We(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function He({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=qe(),i=se[e.route];if(!i||!re(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
- return G(Kr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */G(Re.Provider,{value:o,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */G(Te,{})}),children:/* @__PURE__ */G(s,{})})})})}function Ue({entityType:e,entityId:t,label:n}){const r=A(),o=te(),{data:i}=ne({queryKey:["my-profile-sidebar"],enabled:de(),queryFn:()=>he.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return G("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];he.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */G(z,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ye=/* @__PURE__ */new Set;function Xe({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=se[e.entityType];if(!o||!oe(o))return null;const i=o,[a,s]=R(!1),{dirty:l,registerDirty:d}=qe(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=$e(e.entityId),p=!i.selfFetching&&!h&&!m&&de(),f=ne({queryKey:[u,e.entityId],queryFn:()=>{return he.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:De(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Se(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Le}),w=f.data,y=f.refetch;O(()=>{var t;if(p)return t=t=>{t!==e.id||Ye.has(t)||y({cancelRefetch:!1})},Rn.add(t),()=>{Rn.delete(t)}},[y,e.id,p]);const g=q(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Te,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ae,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ie,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */G(Kr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */G(Re.Provider,{value:d,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Ae,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */G(Pe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ve(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function _e(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Je(e){const t=Ve(e),n=t??_e(e);if(!n)return;if(t&&!Gn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Fn(o)}function Ge(e){if("page"!==e.type)return!0;const t=e.route?se[e.route]:void 0;if(!t||!re(t))return!0;const n=t;return!n.widget&&!n.utility}function Qe(){const e=ur();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ze=/* @__PURE__ */new Map;function et(){const e=Qe();if(e)return Ze.get(e)}function tt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var nt="rosh-peek-style",rt=L.peek,ot=L.taskbarPreview;function it(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(nt))return;const e=document.createElement("style");e.id=nt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${rt}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function at(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function st({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=A(),l=W(null),[c,d]=R({w:n,h:Math.round(.75*r)}),[u,h]=R(!1);return $(()=>{const o=l.current;if(!o)return;const i=Ve(e)??tt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */J("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
18
+ return G(Kr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */G(Re.Provider,{value:o,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */G(Te,{})}),children:/* @__PURE__ */G(s,{})})})})}function Ue({entityType:e,entityId:t,label:n}){const r=D(),o=te(),{data:i}=ne({queryKey:["my-profile-sidebar"],enabled:de(),queryFn:()=>he.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
+ return G("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];he.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */G(A,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Ye=/* @__PURE__ */new Set;function Xe({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=se[e.entityType];if(!o||!oe(o))return null;const i=o,[a,s]=R(!1),{dirty:l,registerDirty:d}=qe(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=$e(e.entityId),p=!i.selfFetching&&!h&&!m&&de(),f=ne({queryKey:[u,e.entityId],queryFn:()=>{return he.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:De(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Se(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Le}),w=f.data,y=f.refetch;O(()=>{var t;if(p)return t=t=>{t!==e.id||Ye.has(t)||y({cancelRefetch:!1})},Rn.add(t),()=>{Rn.delete(t)}},[y,e.id,p]);const g=q(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Te,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ae,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */G(Kr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */G(Ie,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */G(Kr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */G(Re.Provider,{value:d,children:/* @__PURE__ */G(_,{fallback:/* @__PURE__ */G(Ae,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */G(Pe,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ve(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function _e(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Je(e){const t=Ve(e),n=t??_e(e);if(!n)return;if(t&&!Gn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Fn(o)}function Ge(e){if("page"!==e.type)return!0;const t=e.route?se[e.route]:void 0;if(!t||!re(t))return!0;const n=t;return!n.widget&&!n.utility}function Qe(){const e=ur();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ze=/* @__PURE__ */new Map;function et(){const e=Qe();if(e)return Ze.get(e)}function tt(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var nt="rosh-peek-style",rt=L.peek,ot=L.taskbarPreview;function it(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(nt))return;const e=document.createElement("style");e.id=nt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${rt}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function at(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function st({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=D(),l=W(null),[c,d]=R({w:n,h:Math.round(.75*r)}),[u,h]=R(!1);return $(()=>{const o=l.current;if(!o)return;const i=Ve(e)??tt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */J("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
20
20
  /* @__PURE__ */G("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */J("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
- /* @__PURE__ */G(z,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
- /* @__PURE__ */G("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */G("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */G("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */G(z,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function lt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=A(),s=e.length>1,l=W(null),[c,d]=R({left:-9999,top:-9999,ready:!1}),[u,h]=R(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");$(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),O(()=>at,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return Z(
21
+ /* @__PURE__ */G(A,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
+ /* @__PURE__ */G("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */G("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */G("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */G(A,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function lt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=D(),s=e.length>1,l=W(null),[c,d]=R({left:-9999,top:-9999,ready:!1}),[u,h]=R(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");$(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),O(()=>at,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return Z(
23
23
  /* @__PURE__ */G("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:ot,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{at(),i()},children:e.map(e=>{const t=Ve(e.id)??tt(e.label),o=t?function(e){if(Gn(e))return null;const t=e.getBoundingClientRect(),n=Un(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
24
24
  return J("div",{className:"group flex flex-col items-center",onMouseEnter:()=>it(t),children:[!m&&/* @__PURE__ */G("span",{className:p,children:e.label}),
25
25
  /* @__PURE__ */G(st,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */G("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */J("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-white shadow-sm",children:[
26
- /* @__PURE__ */G(z,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ct(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function dt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=A(),[a,s]=R(null);O(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=F(hr,ur),[,d]=R(0);O(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=R(0);O(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=R(null),[f,w]=R(null),[y,g]=R(null),b=W(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!se[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?se[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return Z(
26
+ /* @__PURE__ */G(A,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function ct(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function dt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=D(),[a,s]=R(null);O(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=F(hr,ur),[,d]=R(0);O(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=R(0);O(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=R(null),[f,w]=R(null),[y,g]=R(null),b=W(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!se[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?se[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return Z(
27
27
  /* @__PURE__ */J(Q,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,d=e.items.some(e=>{const t=Ve(e.id)??tt(e.label);return!!t&&!Gn(t)});/* @__PURE__ */
28
- return J("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&j(n)?U(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */G(z,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
- /* @__PURE__ */G("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */G("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */G("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */G("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */G(z,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
28
+ return J("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&j(n)?U(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */G(A,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
+ /* @__PURE__ */G("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */G("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */G("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */G("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */G(A,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
30
  /* @__PURE__ */G("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */J("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
31
- /* @__PURE__ */G(z,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */J(v,{portal:!0,minWidth:200,style:ct(y.x,y.y),onClose:()=>g(null),children:[
31
+ /* @__PURE__ */G(A,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */J(v,{portal:!0,minWidth:200,style:ct(y.x,y.y),onClose:()=>g(null),children:[
32
32
  /* @__PURE__ */G(E,{children:y.label}),
33
33
  /* @__PURE__ */J(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Sn.get(e);t&&qn(t)}(e.id))},children:[
34
- /* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
34
+ /* @__PURE__ */G(A,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
35
35
  /* @__PURE__ */J(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
36
36
  /* @__PURE__ */G("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */G("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
37
37
  /* @__PURE__ */G(k,{}),
38
38
  /* @__PURE__ */J(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */G(z,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */G(lt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var ut=["/login","/forgot-password","/reset-password","/force-change-password"];function ht({children:e,windowAccentForRoute:t}){const n=ee(),r=ut.some(e=>n.pathname.startsWith(e)),[o,i]=R([]),a=W(o);$(()=>{a.current=o},[o]);const s=F(be,ge,ge),l=W(/* @__PURE__ */new Map),c=e=>{const t=Ge(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};O(()=>{Ze.clear();for(const e of o)e.route&&Ze.set(e.id,e.route)},[o]);const d=q(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=q(e=>{var t;Ve(e)||_e(e)?(t=e,window.dispatchEvent(new CustomEvent(mr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=kn;t&&Ye.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(En.get(i)??-1)>a)||Fn(o),t&&Ye.delete(e)},50)},m=q((e,t,n,r,o)=>{if(!se[e]||!oe(se[e]))return;const a=`${e}:${t}`,s=Qe();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:De(n),openedFrom:s}])})},[]),p=q((e,t={})=>{if(!se[e]||!re(se[e]))return;const n=se[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Dn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=Qe();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=q(()=>{},[]),w=q(()=>{},[]),y=u,g=u;/* @__PURE__ */
39
+ /* @__PURE__ */G(A,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */G(lt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var ut=["/login","/forgot-password","/reset-password","/force-change-password"];function ht({children:e,windowAccentForRoute:t}){const n=ee(),r=ut.some(e=>n.pathname.startsWith(e)),[o,i]=R([]),a=W(o);$(()=>{a.current=o},[o]);const s=F(be,ge,ge),l=W(/* @__PURE__ */new Map),c=e=>{const t=Ge(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};O(()=>{Ze.clear();for(const e of o)e.route&&Ze.set(e.id,e.route)},[o]);const d=q(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=q(e=>{var t;Ve(e)||_e(e)?(t=e,window.dispatchEvent(new CustomEvent(mr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=kn;t&&Ye.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(En.get(i)??-1)>a)||Fn(o),t&&Ye.delete(e)},50)},m=q((e,t,n,r,o)=>{if(!se[e]||!oe(se[e]))return;const a=`${e}:${t}`,s=Qe();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:De(n),openedFrom:s}])})},[]),p=q((e,t={})=>{if(!se[e]||!re(se[e]))return;const n=se[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Dn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=Qe();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=q(()=>{},[]),w=q(()=>{},[]),y=u,g=u;/* @__PURE__ */
40
40
  return J(Oe.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
41
41
  /* @__PURE__ */G(dt,{openWindows:o,onRemove:u,onSplitView:Ir,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&Fn(e)}})},onActivateById:Je}),
42
42
  /* @__PURE__ */G(Pr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
@@ -46,7 +46,7 @@ return G(Rt.Provider,{value:e,children:t})}var qt=/* @__PURE__ */new Set(["butto
46
46
  return G("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-ZWVAYCJQ.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var nn="erp_window_positions",rn={};try{const e=localStorage.getItem(nn);e&&(rn=JSON.parse(e))}catch{}var on=null;function an(){on&&clearTimeout(on),on=setTimeout(()=>{try{localStorage.setItem(nn,JSON.stringify(rn))}catch{}},500)}var sn="erp_activation_order",ln=[];try{const e=localStorage.getItem(sn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(ln=t)}catch{}var cn=null;function dn(){cn&&clearTimeout(cn),cn=setTimeout(()=>{try{localStorage.setItem(sn,JSON.stringify(ln))}catch{}},500)}function un(e,t){rn[e]||(rn[e]=t,an())}function hn(e){return rn[e]?{...rn[e]}:null}function mn(e,t){rn[e]=t,an()}function pn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(rn))n(rn[e],r,o)&&(delete rn[e],i=!0);i&&an()}var fn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},wn=4e3,yn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},gn={small:.8,medium:1,large:1.25,maximized:1.25},bn=[],vn=/* @__PURE__ */new Set,xn=/* @__PURE__ */new Set,kn=0,En=/* @__PURE__ */new Map;var Cn=0;function Mn(){return Cn}function Nn(){Cn++,vn.forEach(e=>e())}var Sn=/* @__PURE__ */new Map,Ln=/* @__PURE__ */new Map,Tn=/* @__PURE__ */new Map;function zn(){for(let e=bn.length-1;e>=0;e--){const t=Tn.get(bn[e]);if(t?.tab)return t.owner}return null}function An(){return F(hr,zn,()=>null)}var Dn=/* @__PURE__ */new Set;var In=null;function Pn(e){In=null,Fn(e)}function Kn(e){In=e;const t=Sn.get(e);t&&Pn(t)}function $n(e){In===e&&(In=null)}function Wn(e,t,n){if(n&&Tn.set(e,n),t)if(Sn.set(t,e),Ln.set(e,t),Dn.delete(t)){bn.unshift(e);const n=ln.indexOf(t);-1!==n&&ln.splice(n,1),ln.unshift(t),dn()}else!function(e,t){const n=ln.indexOf(t);if(-1===n)return void bn.push(e);let r=bn.length;for(let e=0;e<bn.length;e++){const t=Ln.get(bn[e]);if(t&&ln.indexOf(t)>n){r=e;break}}bn.splice(r,0,e)}(e,t),-1===ln.indexOf(t)&&(ln.push(t),dn());else bn.push(e);Nn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&In===t&&Pn(e)}function On(e){return e?Tn.get(e)?.owner??Ln.get(e)??null:null}var Rn=/* @__PURE__ */new Set;function Fn(e){const t=On(ur()),n=bn.indexOf(e);-1!==n&&bn.splice(n,1),bn.push(e);const o=Tn.get(e);if(o?.root&&o.tab&&r()){const e=bn.filter(e=>{const t=Tn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)bn.splice(bn.indexOf(t),1),bn.push(t)}xn.delete(e);const i=Ln.get(e);if(i){const e=ln.indexOf(i);-1!==e&&ln.splice(e,1),ln.push(i),dn(),In&&In!==i&&(In=null)}Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=On(ur());a&&a!==t&&Rn.forEach(e=>e(a))}function qn(e){const t=bn.indexOf(e);-1!==t&&bn.splice(t,1),xn.add(e),En.set(e,++kn);const n=Ln.get(e);if(n){const e=ln.indexOf(n);-1!==e&&(ln.splice(e,1),dn())}Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var jn=/* @__PURE__ */new Set;var Bn=8,Hn=32;function Un(){return e()}var Yn=40,Xn=80,Vn=384,_n=400;function Jn(e,t=Un()){const n=Math.min(Math.max(e.x,t.x+Xn-e.w),t.x+t.w-Xn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Yn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Gn(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Un();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function Qn(e){const t=Un(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var Zn=null;function er(e){const t=(Zn||((Zn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${L.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(Zn)),Zn);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function tr(){Zn&&(Zn.style.opacity="0",Zn.style.display="none")}var nr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],rr=350,or=200;function ir({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=R(!1),s=W(void 0),l=W(void 0);O(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),rr)},d=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),or)};/* @__PURE__ */
47
47
  return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
48
48
  /* @__PURE__ */G("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */G("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:nr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */G("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */G("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var ar="rosh-gesture-style";var sr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},lr=4;function cr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(ar))return;const e=document.createElement("style");e.id=ar,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=Et(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function dr(e){const t=bn.indexOf(e);if(-1===t)return-1;const n=L.window+t*L.windowStep,o=Tn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of Tn){if(!t.root||t.owner!==o.owner)continue;const n=bn.indexOf(e);-1!==n&&(i=Math.max(i,L.window+n*L.windowStep))}return i>=n?i+2+Math.min(t,7):n}function ur(){return bn[bn.length-1]||null}function hr(e){return vn.add(e),()=>{vn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=bn.length-1;e>=0;e--)jn.has(bn[e])||bn.splice(e,1);ln=ln.filter(e=>{const t=Sn.get(e);return null!=t&&jn.has(t)}),dn(),Nn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var mr="modal-close-request";function pr(e){F(hr,Mn);const t=P(Gt);if(bn.length<=1)return!0;if(e){const t=Sn.get(e);if(null!=t)return ur()===t}return t?.active??null!=ur()}var fr=!1,wr=/* @__PURE__ */new Set;function yr(e){return wr.add(e),()=>wr.delete(e)}function gr(){return fr}function br(e){fr!==e&&(fr=e,wr.forEach(e=>e()))}function vr(){br(!fr)}function xr(){br(!1)}var kr=null,Er=/* @__PURE__ */new Set;function Cr(e){return Er.add(e),()=>Er.delete(e)}function Mr(){return kr}function Nr(e){kr!==e&&(kr=e,Er.forEach(e=>e()))}var Sr=null,Lr=/* @__PURE__ */new Set;function Tr(e){return Lr.add(e),()=>Lr.delete(e)}function zr(){return Sr}function Ar(e){Sr!==e&&(Sr=e,Lr.forEach(e=>e()))}function Dr(){if(!Sr)return void br(!1);Nr(Sr),Ar(null),br(!1)}function Ir(){br(!fr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Pr(){const e=F(yr,gr),[t,n]=R(e),[r,o]=R(e);return O(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?Z(
49
- /* @__PURE__ */G("div",{onMouseDown:e=>{e.stopPropagation(),br(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:L.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Kr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:g,footer:b,bodyScroll:E,onMinimize:C,initialBox:S,actions:D,actionsLeft:I,editing:K=!1,allowPinOnTop:B,initialPosition:H,widget:V,compact:_,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[ue,he]=R(()=>r()),pe=f()&&!ue,fe=w()&&!!V,[we,ye]=R(0),[ge,be]=R(!1),ve=W(null),Ee=W(0);O(()=>{Ee.current=we},[we]);const Me=q(e=>{pe&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),wt(le??null))},[pe,le]),Ne=F(yt,ft);O(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void wt(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),wt(null)},180)):(ye(0),wt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ge]);const[Se,Le]=R(c),Te=A(),ze=Te.window;O(()=>{Le(c)},[c]);const Ae=Y(()=>Ht(Se).trim()||void 0,[Se]),De=X(),[Ie,Pe]=R(!1),Ke=W(!1),[$e,We]=R(!1),[Oe,Re]=R(null),qe=P(Rt),Be=P(me),{prefs:He,save:Ue}=y(),Ye=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!qe&&Xe.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),_e=q(()=>{if(!qe)return;const e=Ve?Xe.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Xe,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ve,Xe,Ue]),[Je,Ge]=R(null),[Qe,Ze]=R("top-right"===H?"right":"left"),et=W(!1),tt=W(null);$(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=W(!1),rt=W(null),ot=W(null),it=W(null),[at,st]=R(!1),lt=W(null),ct=!!(b||D||I)||at,dt=P(ke),ut=""!==P(Ot),ht=W(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const mt=se||(Be&&!ut?Be.key:null),pt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(K||dt.declaredEditable)&&!dt.handMounted&&ct&&!V&&!_&&!ee&&!pe,gt=/* @__PURE__ */G(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=d&&j(d)?U(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??gt,vt=()=>/* @__PURE__ */G("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Re(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Mt}=je(),Nt=W(`modal-${Math.random().toString(36).slice(2,8)}`).current;O(()=>{if(V)return jn.add(Nt),()=>{jn.delete(Nt)}},[V,Nt]),O(()=>{const e=e=>{const t=e.detail;t?.id===Nt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Nt]);const[St,Lt]=R(L.window),zt=function(e){const t=F(hr,ur);return bn.length<=1||t===e}(Nt),Dt=function(e){return F(hr,()=>xn.has(e))}(Nt),It=F(yr,gr),Kt=F(Cr,Mr),$t=F(Tr,zr),Wt=!B&&!V,Ft=It&&Wt,[qt,Ut]=R(!1),Yt=Ft&&$t===Nt,[Vt,_t]=R(!1),Jt=Vt&&Wt&&Kt===Nt?"picked":null,Qt=W(Ft);O(()=>{if(Qt.current&&!Ft){_t(!0);const e=setTimeout(()=>{_t(!1),kr===Nt&&Nr(null)},700);return Qt.current=Ft,()=>clearTimeout(e)}Qt.current=Ft},[Ft,Nt]),O(()=>{Ft||Ut(!1)},[Ft]),O(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),O(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Zt=W(!1),en=q(e,[]),tn=q(()=>{const t=e(),n=ae?ae[0]:fn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=gn[yn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(bn.length-1),d=Math.max(xt,(i-l)/2),u=(o-a)/2,m=t.h-xt-l-d;return"top-right"===H?{x:t.x+t.w-a-xt,y:t.y+xt,w:a,h:l}:"top-left"===H?{x:t.x+xt,y:t.y+xt,w:a,h:l}:{x:t.x+Math.max(xt,(o-a)/2+xt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=W(!1);t||(nn.current=!1);const on=se||u||null;O(()=>{if(!t)return;Wn(Nt,on,ht.current??void 0),se||Fn(Nt),Zt.current=!1,Lt(dr(Nt));const e=()=>{Lt(dr(Nt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Fn(Nt),kn.current)return;const t=Un(),n=Math.min(In.current.w,t.w-40),o=Math.min(In.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&(Fn(Nt),Re({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Fn(Nt);const t=In.current,n=function(e,t=Un()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=tt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}cn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=bn.indexOf(e);-1!==t&&(bn.splice(t,1),Nn()),xn.delete(e),En.delete(e),Tn.delete(e);const n=Ln.get(e);n&&(Ln.delete(e),Sn.delete(n))}(Nt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,Nt,on,en]);const sn=!V&&"maximized"===yn(),[ln,cn]=R(()=>{if(on&&rn[on]){const e={...rn[on]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Jn(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:sn?en():tn()}),[dn,un]=R(()=>!ne),hn=W(ue),mn=W(null);O(()=>{const e=()=>{const e=r();e!==hn.current&&mn.current?.(e),hn.current=e,he(e),Lt(dr(Nt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Nt]);const pn=ue&&!!Be?.tab&&!ut&&!V&&!pe,vn=pn,kn=W(vn);kn.current=vn;const Cn=An(),Mn=ue&&!!Be?.tab&&!V&&!pe&&!It&&Cn!==Be.key,[zn,Dn]=R(()=>on&&rn[on]||S?vn:vn||sn),In=W(ln);In.current=ln;const Pn=W(zn);$(()=>{Pn.current=zn},[zn]),$(()=>{if(dn||pn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,In.current.y)-24),g=w?Math.min(In.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,V,re,ct,pn]),$(()=>{if(!ne||!dn||V||!t)return;const e=lt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||zn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,In.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,dn,V,t,zn,re]);const Kn=!1!==oe&&!V&&!ee&&!pe,[$n,On]=R(()=>!Kn);$(()=>{if($n||!t)return;if(!Kn||zn)return void On(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=In.current.w,c=0;const d=()=>On(!0),u=()=>{c=0;const t=In.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),u,xt);b!==t&&(i=b.w,cn(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[$n,t,Kn,zn]);const Rn=W(null),Yn=!(!Be?.tab||ut||V||pe);mn.current=t=>{if(!Yn)return;if(t)return Rn.current||(Rn.current={box:{...In.current},maximized:Pn.current}),void(Pn.current=!0);const r=Rn.current;Rn.current=null;const o=e();if(r?.maximized)return Pn.current=!0,Dn(!0),void cn(o);const i=r?.box??(on?rn[on]:void 0);if(Pn.current=!1,Dn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Jn(e))}else cn(tn())},O(()=>{vn&&(Pn.current=!0,Dn(!0),cn(en()))},[vn,en]),O(()=>{if(V)return;const e=()=>{const e=on?rn[on]:void 0;if(Pn.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Jn(t))}else cn(tn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,tn,on]),O(()=>{t&&on&&!pn&&(rn[on]=ln,an()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,t,on,pn]),O(()=>{if(!t)return;const e=()=>{Pn.current?cn(en()):document.body.classList.contains("rosh-gesturing")||cn(Jn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return zn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,zn,en]),O(()=>{if(t&&(Pe(!1),Ke.current=!1,et.current=!1,On(!Kn),!kn.current)){if(on&&rn[on]){const e=rn[on];return void cn(t=>Jn({...e,...ne?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}S&&(cn({x:S.x,y:S.y,w:S.w,h:S.h}),Dn(S.maximized))}},[t]),O(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>Pe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Xn="auto"===m?Ie:!0===m,Gn=Be&&!ut?Be.key:null,Zn=Y(()=>Tt(Se),[Se]),nr=W({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});$(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=W(null);rr.current||(rr.current={open:(e,t)=>Re({x:e,y:t}),items:()=>{const e=nr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Xt[Nt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),O(()=>{if(t&&Gn)return()=>{return e=Gn,void(At.delete(e)&&Pt());var e}},[t,Gn]),Fe(!(se||!t)&&Xn);const or=q(async()=>{if(!et.current){if(Xn||"auto"===m&&Ke.current){et.current=!0;const e=Ae,t=await M({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(et.current=!1,!t)return}i()}},[Xn,m,i,Ae]);$(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&or()};return window.addEventListener(mr,e),()=>window.removeEventListener(mr,e)},[t,mt,or]);const ar=W(null),pr=q(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Re(null),Fn(Nt),kn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(ar.current){const t=ar.current;ar.current=null,u=t.w,d=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:In.current.x,c=s?s.top:In.current.y,d=s?s.height:In.current.h,u=s?s.width:In.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<lr&&Math.abs(e.clientY-i)<lr)return;r=cr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),In.current={...In.current,x:s,y:d},!V){const t=function(e,t){const n=Un(),r=e<=n.x+Bn,o=e>=n.x+n.w-Bn,i=t<=n.y+Bn,a=t>=n.y+n.h-Bn,s=e<=n.x+Hn,l=e>=n.x+n.w-Hn,c=t<=n.y+Hn,d=t>=n.y+n.h-Hn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?er(Qn(t)):tr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),tr();const e=Jn({...In.current});if(In.current=e,!V&&h){ar.current={x:l,y:c,w:u,h:d};const e=Qn(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void cn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),fr=q((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:In.current.x,d=l?l.top:In.current.y,u=l?l.width:In.current.w,h=l?l.height:In.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Dn(!1),cn({x:c,y:d,w:u,h:h}),In.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,In.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<lr&&Math.abs(e.clientY-a)<lr)return;o=cr(n,r,sr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Vn,u+e)),w&&(i=Math.max(_n,h+t)),m){const t=Math.max(Vn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(_n,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),cn({...In.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),wr=q(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Fn(Nt),"Enter"===e.key)return void(zn?(Dn(!1),cn(tn())):(Dn(!0),cn(en())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ar.current||(ar.current={...In.current})};if(r<0)return e(),Dn(!0),void cn(en());if(r>0){if(zn)return Dn(!1),void cn(tn());if(ar.current){const e=Jn(ar.current);return ar.current=null,In.current=e,void cn(e)}return void qn(Nt)}e(),Dn(!1);const t=Qn(n<0?"left":"right");return In.current=t,void cn(t)}if(zn)return;const o=In.current,i=e.shiftKey?{...o,w:Math.max(Vn,o.w+24*n),h:Math.max(_n,o.h+24*r)}:Jn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});In.current=i,cn(i)},[Nt,zn,tn,en]),vr=q(e=>{ar.current||(ar.current={...In.current}),Dn(!1);const t=Qn(e);In.current=t,cn(t),Fn(Nt)},[Nt]),xr=vn||Ft?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:wr},Er=()=>{Dn(!0),cn(en())},Sr=q(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(jt);t&&!t.disabled&&t.click()}},[]);O(()=>{if(!t)return;if(V)return;const e=e=>{if(bn[bn.length-1]===Nt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Bt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,Nt,V]),O(()=>{if(!t)return;const e=e=>{bn[bn.length-1]===Nt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Nt}})),Ke.current=!1,Pe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Nt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),O(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&bn[bn.length-1]===Nt){if(T(e))return e.preventDefault(),void e.stopPropagation();if(pn&&!K)return;e.preventDefault(),e.stopPropagation(),or()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,or,Nt,V,pn,K]);const Lr=t&&(void 0!==p||void 0!==g),[Ar]=R(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Dr=pn&&!Be?.home&&(Zn.actions.length>0||Lr);O(()=>{t&&Gn&&function(e,t){const n=At.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(At.set(e,t),Pt())}(Gn,{title:Zn.text||Ae,dirty:Xn,copy:Zn.copy,actions:Dr&&Ar?Ar:void 0,menu:rr.current??void 0})},[t,Gn,Ae,Xn,Zn.text,Zn.copy,Dr,Ar]);const Ir=q(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(O(()=>{if(!t)return;const e=e=>{if(bn[bn.length-1]!==Nt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),p?p():Ir("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),g?g():Ir("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,g,Lr,Ir,Nt]),!t||nn.current)return null;const Pr=Ft?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Un(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Nt):null,Kr=Ft&&Pr?Math.min(Pr.w/ln.w,Pr.h/ln.h):1,$r=(()=>{if(Ft&&Pr){const e=Kr,t=ln.w*e,n=ln.h*e,r=Pr.x+(Pr.w-t)/2-ln.x,o=Pr.y+(Pr.h-n)/2-ln.y,i=qt||Yt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:L.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Vt&&Wt){const e="picked"===Jt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:L.expose+30}:{}}}return null})(),Wr=N({modal:!1,titleId:!V&&(pn?!Be?.home:!pe)?De:void 0,label:Zn.text||Ae}),Or=/* @__PURE__ */J("div",{children:[
49
+ /* @__PURE__ */G("div",{onMouseDown:e=>{e.stopPropagation(),br(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:L.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Kr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:g,footer:b,bodyScroll:E,onMinimize:C,initialBox:S,actions:z,actionsLeft:I,editing:K=!1,allowPinOnTop:B,initialPosition:H,widget:V,compact:_,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[ue,he]=R(()=>r()),pe=f()&&!ue,fe=w()&&!!V,[we,ye]=R(0),[ge,be]=R(!1),ve=W(null),Ee=W(0);O(()=>{Ee.current=we},[we]);const Me=q(e=>{pe&&(ve.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},be(!0),wt(le??null))},[pe,le]),Ne=F(yt,ft);O(()=>{if(!ge)return;const e=e=>{if(!ve.current)return;const t=e.clientX-ve.current.startX;if(Math.abs(e.clientY-ve.current.startY)>Math.abs(t)+12)return ve.current=null,be(!1),ye(0),void wt(null);ye(Math.max(0,t))},t=()=>{if(!ve.current)return;const e=.3*window.innerWidth,t=Ee.current>e;ve.current=null,be(!1),t?(ye(window.innerWidth),setTimeout(()=>{i(),ye(0),wt(null)},180)):(ye(0),wt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ge]);const[Se,Le]=R(c),Te=D(),ze=Te.window;O(()=>{Le(c)},[c]);const Ae=Y(()=>Ht(Se).trim()||void 0,[Se]),De=X(),[Ie,Pe]=R(!1),Ke=W(!1),[$e,We]=R(!1),[Oe,Re]=R(null),qe=P(Rt),Be=P(me),{prefs:He,save:Ue}=y(),Ye=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!qe&&Xe.some(e=>e.entityType===qe.entityType&&e.entityId===qe.entityId),_e=q(()=>{if(!qe)return;const e=Ve?Xe.filter(e=>!(e.entityType===qe.entityType&&e.entityId===qe.entityId)):[...Xe,{entityType:qe.entityType,entityId:qe.entityId,label:qe.label}];Ue({favorite_documents:e})},[qe,Ve,Xe,Ue]),[Je,Ge]=R(null),[Qe,Ze]=R("top-right"===H?"right":"left"),et=W(!1),tt=W(null);$(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=W(!1),rt=W(null),ot=W(null),it=W(null),[at,st]=R(!1),lt=W(null),ct=!!(b||z||I)||at,dt=P(ke),ut=""!==P(Ot),ht=W(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const mt=se||(Be&&!ut?Be.key:null),pt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(K||dt.declaredEditable)&&!dt.handMounted&&ct&&!V&&!_&&!ee&&!pe,gt=/* @__PURE__ */G(A,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=d&&j(d)?U(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??gt,vt=()=>/* @__PURE__ */G("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Re(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Mt}=je(),Nt=W(`modal-${Math.random().toString(36).slice(2,8)}`).current;O(()=>{if(V)return jn.add(Nt),()=>{jn.delete(Nt)}},[V,Nt]),O(()=>{const e=e=>{const t=e.detail;t?.id===Nt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Nt]);const[St,Lt]=R(L.window),zt=function(e){const t=F(hr,ur);return bn.length<=1||t===e}(Nt),Dt=function(e){return F(hr,()=>xn.has(e))}(Nt),It=F(yr,gr),Kt=F(Cr,Mr),$t=F(Tr,zr),Wt=!B&&!V,Ft=It&&Wt,[qt,Ut]=R(!1),Yt=Ft&&$t===Nt,[Vt,_t]=R(!1),Jt=Vt&&Wt&&Kt===Nt?"picked":null,Qt=W(Ft);O(()=>{if(Qt.current&&!Ft){_t(!0);const e=setTimeout(()=>{_t(!1),kr===Nt&&Nr(null)},700);return Qt.current=Ft,()=>clearTimeout(e)}Qt.current=Ft},[Ft,Nt]),O(()=>{Ft||Ut(!1)},[Ft]),O(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),O(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Zt=W(!1),en=q(e,[]),tn=q(()=>{const t=e(),n=ae?ae[0]:fn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=gn[yn()],l=ae?Math.min(ae[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(bn.length-1),d=Math.max(xt,(i-l)/2),u=(o-a)/2,m=t.h-xt-l-d;return"top-right"===H?{x:t.x+t.w-a-xt,y:t.y+xt,w:a,h:l}:"top-left"===H?{x:t.x+xt,y:t.y+xt,w:a,h:l}:{x:t.x+Math.max(xt,(o-a)/2+xt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),nn=W(!1);t||(nn.current=!1);const on=se||u||null;O(()=>{if(!t)return;Wn(Nt,on,ht.current??void 0),se||Fn(Nt),Zt.current=!1,Lt(dr(Nt));const e=()=>{Lt(dr(Nt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Fn(Nt),kn.current)return;const t=Un(),n=Math.min(In.current.w,t.w-40),o=Math.min(In.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&(Fn(Nt),Re({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Fn(Nt);const t=In.current,n=function(e,t=Un()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=tt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}cn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=bn.indexOf(e);-1!==t&&(bn.splice(t,1),Nn()),xn.delete(e),En.delete(e),Tn.delete(e);const n=Ln.get(e);n&&(Ln.delete(e),Sn.delete(n))}(Nt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,Nt,on,en]);const sn=!V&&"maximized"===yn(),[ln,cn]=R(()=>{if(on&&rn[on]){const e={...rn[on]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Jn(e)}return S?{x:S.x,y:S.y,w:S.w,h:S.h}:sn?en():tn()}),[dn,un]=R(()=>!ne),hn=W(ue),mn=W(null);O(()=>{const e=()=>{const e=r();e!==hn.current&&mn.current?.(e),hn.current=e,he(e),Lt(dr(Nt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Nt]);const pn=ue&&!!Be?.tab&&!ut&&!V&&!pe,vn=pn,kn=W(vn);kn.current=vn;const Cn=An(),Mn=ue&&!!Be?.tab&&!V&&!pe&&!It&&Cn!==Be.key,[zn,Dn]=R(()=>on&&rn[on]||S?vn:vn||sn),In=W(ln);In.current=ln;const Pn=W(zn);$(()=>{Pn.current=zn},[zn]),$(()=>{if(dn||pn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,In.current.y)-24),g=w?Math.min(In.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&un(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,V,re,ct,pn]),$(()=>{if(!ne||!dn||V||!t)return;const e=lt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||zn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,In.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ne,dn,V,t,zn,re]);const Kn=!1!==oe&&!V&&!ee&&!pe,[$n,On]=R(()=>!Kn);$(()=>{if($n||!t)return;if(!Kn||zn)return void On(!0);const n=tt.current,r=rt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=In.current.w,c=0;const d=()=>On(!0),u=()=>{c=0;const t=In.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),u,xt);b!==t&&(i=b.w,cn(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[$n,t,Kn,zn]);const Rn=W(null),Yn=!(!Be?.tab||ut||V||pe);mn.current=t=>{if(!Yn)return;if(t)return Rn.current||(Rn.current={box:{...In.current},maximized:Pn.current}),void(Pn.current=!0);const r=Rn.current;Rn.current=null;const o=e();if(r?.maximized)return Pn.current=!0,Dn(!0),void cn(o);const i=r?.box??(on?rn[on]:void 0);if(Pn.current=!1,Dn(!1),i&&!n(i,o,!1)){const e={...i};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Jn(e))}else cn(tn())},O(()=>{vn&&(Pn.current=!0,Dn(!0),cn(en()))},[vn,en]),O(()=>{if(V)return;const e=()=>{const e=on?rn[on]:void 0;if(Pn.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Jn(t))}else cn(tn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,tn,on]),O(()=>{t&&on&&!pn&&(rn[on]=ln,an()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,t,on,pn]),O(()=>{if(!t)return;const e=()=>{Pn.current?cn(en()):document.body.classList.contains("rosh-gesturing")||cn(Jn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return zn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,zn,en]),O(()=>{if(t&&(Pe(!1),Ke.current=!1,et.current=!1,On(!Kn),!kn.current)){if(on&&rn[on]){const e=rn[on];return void cn(t=>Jn({...e,...ne?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}S&&(cn({x:S.x,y:S.y,w:S.w,h:S.h}),Dn(S.maximized))}},[t]),O(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{tt.current?.contains(t.target)&&!Ke.current&&(Ke.current=!0,e=setTimeout(()=>Pe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Xn="auto"===m?Ie:!0===m,Gn=Be&&!ut?Be.key:null,Zn=Y(()=>Tt(Se),[Se]),nr=W({shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});$(()=>{nr.current={shortcutSpec:qe,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const rr=W(null);rr.current||(rr.current={open:(e,t)=>Re({x:e,y:t}),items:()=>{const e=nr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Xt[Nt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),O(()=>{if(t&&Gn)return()=>{return e=Gn,void(At.delete(e)&&Pt());var e}},[t,Gn]),Fe(!(se||!t)&&Xn);const or=q(async()=>{if(!et.current){if(Xn||"auto"===m&&Ke.current){et.current=!0;const e=Ae,t=await M({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(et.current=!1,!t)return}i()}},[Xn,m,i,Ae]);$(()=>{if(!t||!mt)return;const e=e=>{e.detail?.windowKey===mt&&or()};return window.addEventListener(mr,e),()=>window.removeEventListener(mr,e)},[t,mt,or]);const ar=W(null),pr=q(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Re(null),Fn(Nt),kn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(ar.current){const t=ar.current;ar.current=null,u=t.w,d=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:In.current.x,c=s?s.top:In.current.y,d=s?s.height:In.current.h,u=s?s.width:In.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<lr&&Math.abs(e.clientY-i)<lr)return;r=cr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),In.current={...In.current,x:s,y:d},!V){const t=function(e,t){const n=Un(),r=e<=n.x+Bn,o=e>=n.x+n.w-Bn,i=t<=n.y+Bn,a=t>=n.y+n.h-Bn,s=e<=n.x+Hn,l=e>=n.x+n.w-Hn,c=t<=n.y+Hn,d=t>=n.y+n.h-Hn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?er(Qn(t)):tr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),tr();const e=Jn({...In.current});if(In.current=e,!V&&h){ar.current={x:l,y:c,w:u,h:d};const e=Qn(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void cn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),fr=q((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:In.current.x,d=l?l.top:In.current.y,u=l?l.width:In.current.w,h=l?l.height:In.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Dn(!1),cn({x:c,y:d,w:u,h:h}),In.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,In.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<lr&&Math.abs(e.clientY-a)<lr)return;o=cr(n,r,sr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Vn,u+e)),w&&(i=Math.max(_n,h+t)),m){const t=Math.max(Vn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(_n,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),cn({...In.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),wr=q(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),Fn(Nt),"Enter"===e.key)return void(zn?(Dn(!1),cn(tn())):(Dn(!0),cn(en())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ar.current||(ar.current={...In.current})};if(r<0)return e(),Dn(!0),void cn(en());if(r>0){if(zn)return Dn(!1),void cn(tn());if(ar.current){const e=Jn(ar.current);return ar.current=null,In.current=e,void cn(e)}return void qn(Nt)}e(),Dn(!1);const t=Qn(n<0?"left":"right");return In.current=t,void cn(t)}if(zn)return;const o=In.current,i=e.shiftKey?{...o,w:Math.max(Vn,o.w+24*n),h:Math.max(_n,o.h+24*r)}:Jn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});In.current=i,cn(i)},[Nt,zn,tn,en]),vr=q(e=>{ar.current||(ar.current={...In.current}),Dn(!1);const t=Qn(e);In.current=t,cn(t),Fn(Nt)},[Nt]),xr=vn||Ft?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:wr},Er=()=>{Dn(!0),cn(en())},Sr=q(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(jt);t&&!t.disabled&&t.click()}},[]);O(()=>{if(!t)return;if(V)return;const e=e=>{if(bn[bn.length-1]===Nt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Bt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,Nt,V]),O(()=>{if(!t)return;const e=e=>{bn[bn.length-1]===Nt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Nt}})),Ke.current=!1,Pe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Nt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),O(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&bn[bn.length-1]===Nt){if(T(e))return e.preventDefault(),void e.stopPropagation();if(pn&&!K)return;e.preventDefault(),e.stopPropagation(),or()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,or,Nt,V,pn,K]);const Lr=t&&(void 0!==p||void 0!==g),[Ar]=R(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Dr=pn&&!Be?.home&&(Zn.actions.length>0||Lr);O(()=>{t&&Gn&&function(e,t){const n=At.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(At.set(e,t),Pt())}(Gn,{title:Zn.text||Ae,dirty:Xn,copy:Zn.copy,actions:Dr&&Ar?Ar:void 0,menu:rr.current??void 0})},[t,Gn,Ae,Xn,Zn.text,Zn.copy,Dr,Ar]);const Ir=q(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(O(()=>{if(!t)return;const e=e=>{if(bn[bn.length-1]!==Nt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),p?p():Ir("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),g?g():Ir("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,g,Lr,Ir,Nt]),!t||nn.current)return null;const Pr=Ft?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Un(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Nt):null,Kr=Ft&&Pr?Math.min(Pr.w/ln.w,Pr.h/ln.h):1,$r=(()=>{if(Ft&&Pr){const e=Kr,t=ln.w*e,n=ln.h*e,r=Pr.x+(Pr.w-t)/2-ln.x,o=Pr.y+(Pr.h-n)/2-ln.y,i=qt||Yt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:L.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Vt&&Wt){const e="picked"===Jt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:L.expose+30}:{}}}return null})(),Wr=N({modal:!1,titleId:!V&&(pn?!Be?.home:!pe)?De:void 0,label:Zn.text||Ae}),Or=/* @__PURE__ */J("div",{children:[
50
50
  /* @__PURE__ */J("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":Nt,"data-window-key":se||void 0,...B?{"data-utility":""}:{},...$e?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!ut?{"data-window-root":""}:{},...pn?{"data-window-tab":""}:{},...Wr,className:pn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?zt?"shadow-xl":"shadow-lg":"border "+(zt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(nt.current=!1,Ft){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Nr(Nt),br(!1),void Fn(Nt)}if(!zt&&!V&&!$e&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===tt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),nt.current=!0,Re(null),Fn(Nt),window.addEventListener("mouseup",()=>{setTimeout(()=>{nt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{nt.current&&(nt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Ft)return;Re(null);e.target.closest("[data-modal-panel]")===tt.current&&(e.target.closest("button, input, a, select, textarea")||Fn(Nt))},style:pe?{zIndex:St+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${we}px)`,transition:ge?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...St<0?{display:"none"}:{},...zt||$e||Ne&&se===Ne?{}:{display:"none"}}:{zIndex:$e?L.pinnedWindow:St+1,width:ln.w,height:ln.h,top:ln.y,...V&&"right"===Qe?{right:window.innerWidth-ln.x-ln.w}:{left:ln.x},...St<0&&!$e?{display:"none"}:{},...fe?{display:"none"}:{},...Mn?{visibility:"hidden",pointerEvents:"none"}:{},...$r??{}},children:[pe&&!V&&/* @__PURE__ */G("div",{onPointerDown:Me,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),V?null:pn?Be?.home?null:/* @__PURE__ */J(Q,{children:[
51
51
  /* @__PURE__ */G("h2",{id:De,"data-window-title":!0,className:"sr-only",children:Zn.text||Ae}),Dr&&Ar&&Z(
52
52
  /* @__PURE__ */J(Q,{children:[Zn.actions,Lr&&/* @__PURE__ */J("span",{className:"flex items-center gap-1 shrink-0 text-2xs text-gray-400",children:[
@@ -54,34 +54,34 @@ return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
54
54
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium text-gray-500",title:ze.next,children:"J"})]})]}),Ar),Zn.badges.length>0&&/* @__PURE__ */G("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:Zn.badges})]}):pe?null:
55
55
  /* @__PURE__ */J("div",_?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
56
56
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ft&&vt(),
57
- /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
58
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"})})]})]}:ee?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
57
+ /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
58
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"})})]})]}:ee?{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
59
59
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ft&&vt(),
60
- /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
60
+ /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
61
61
  /* @__PURE__ */G("button",{onClick:()=>qn(Nt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!vn&&/* @__PURE__ */G(ir,{maximized:zn,onToggleMax:()=>{zn?(Dn(!1),cn(tn())):Er()},onSnap:vr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:ze}),
62
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
62
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:pr,"data-window-chrome":"",...xr,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(zt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:zt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
63
63
  /* @__PURE__ */J("div",{"data-window-title":!0,title:Ae,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:zt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ft&&vt(),
64
64
  /* @__PURE__ */G("span",{id:De,className:"truncate",children:Ft?Ht(Se):Se})]}),!Ft&&/* @__PURE__ */J("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[Lr&&/* @__PURE__ */J("span",{className:"flex items-center gap-1 mr-1 text-2xs text-gray-400",children:[
65
65
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
66
66
  /* @__PURE__ */G("span",{children:ze.prev}),
67
67
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
68
- /* @__PURE__ */G("span",{children:ze.next})]}),B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(z,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
68
+ /* @__PURE__ */G("span",{children:ze.next})]}),B&&/* @__PURE__ */G("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */G(A,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
69
69
  /* @__PURE__ */G("button",{onClick:()=>qn(Nt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!vn&&/* @__PURE__ */G(ir,{maximized:zn,onToggleMax:()=>{zn?(Dn(!1),cn(tn())):Er()},onSnap:vr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:ze}),
70
70
  /* @__PURE__ */G("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 text-2xs font-medium text-gray-400",children:"ESC"}),
71
- /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */G(z,{name:"close",className:"h-5 w-5"})})]})]}),ce&&Ye&&!V&&!pe&&/* @__PURE__ */G("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
71
+ /* @__PURE__ */G("button",{type:"button",onClick:or,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */G(A,{name:"close",className:"h-5 w-5"})})]})]}),ce&&Ye&&!V&&!pe&&/* @__PURE__ */G("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${zt?.9:.55})`}}),
72
72
  /* @__PURE__ */G(Ot.Provider,{value:Nt,children:/* @__PURE__ */G(Gt.Provider,{value:{rightRef:ot,leftRef:it,notify:()=>st(!0),active:zt,isDirty:Xn,footerOpen:ct&&!V&&!_&&!ee&&!pe},children:/* @__PURE__ */G("div",{ref:rt,...V?{onPointerDown:pr,onContextMenu:e=>{e.preventDefault(),Ge({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":ee||te?"p-0":_?"p-2":"p-4"} ${V||pn?"":"backdrop-blur-sm"} ${!1===E||ee||te?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V?"transparent":pn?"rgb(var(--window-content-rgb))":zt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */G(xe,{children:de})})})}),V&&Je&&/* @__PURE__ */J(v,{minWidth:160,style:{left:Je.x,top:Je.y},onClose:()=>Ge(null),children:[
73
73
  /* @__PURE__ */G(x,{onClick:()=>{Ge(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Nt}))},children:"Settings"}),
74
74
  /* @__PURE__ */G(k,{}),ie&&/* @__PURE__ */J(Q,{children:[ie,
75
75
  /* @__PURE__ */G(k,{})]}),
76
76
  /* @__PURE__ */J(x,{onClick:()=>{Ge(null),We(e=>!e)},children:[
77
- /* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */G(z,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
77
+ /* @__PURE__ */G("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */G(A,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
78
78
  /* @__PURE__ */G(k,{}),
79
79
  /* @__PURE__ */G(x,{onClick:()=>{Ge(null),or()},children:"Close"})]}),
80
80
  /* @__PURE__ */J("div",{onPointerDown:pr,ref:lt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${pn?"":" cursor-move"}${zt&&!pn?" backdrop-blur-sm":""}${V||_||ee||pe||!ct?" hidden":""}`,style:{touchAction:"none",backgroundColor:pn?"rgb(var(--window-footer-rgb))":zt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
81
81
  /* @__PURE__ */J("div",{className:"flex items-center gap-2 min-w-0",children:[pt&&/* @__PURE__ */G(Ce,{auto:!0}),I,
82
82
  /* @__PURE__ */G("div",{ref:it,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),b]}),
83
83
  /* @__PURE__ */J("div",{className:"flex items-center gap-2 ml-auto",children:[
84
- /* @__PURE__ */G("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),D]})]}),!V&&!pe&&!Ft&&zt&&!vn&&/* @__PURE__ */J(Q,{children:[
84
+ /* @__PURE__ */G("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),z]})]}),!V&&!pe&&!Ft&&zt&&!vn&&/* @__PURE__ */J(Q,{children:[
85
85
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
86
86
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
87
87
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
@@ -89,16 +89,16 @@ return J("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
89
89
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
90
90
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
91
91
  /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
92
- /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Ft&&/* @__PURE__ */G("div",{className:"absolute inset-0",style:{zIndex:L.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Fn(Nt),br(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:qt&&/* @__PURE__ */G("button",{type:"button","data-expose-close":!0,"aria-label":Te.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Kr})`,transformOrigin:"top right",zIndex:L.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),or()},children:/* @__PURE__ */G(z,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Ft&&Pr&&/* @__PURE__ */G("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Pr.x,top:Pr.y+Pr.h+4,width:Pr.w,zIndex:L.expose+(qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ht(Se)})]}),Rr=Oe&&/* @__PURE__ */J(v,{style:{left:Oe.x,top:Oe.y},onClose:()=>Re(null),minWidth:160,children:[!V&&!_&&!pn&&/* @__PURE__ */J(Q,{children:[
92
+ /* @__PURE__ */G("div",{onPointerDown:e=>fr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Ft&&/* @__PURE__ */G("div",{className:"absolute inset-0",style:{zIndex:L.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Fn(Nt),br(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:qt&&/* @__PURE__ */G("button",{type:"button","data-expose-close":!0,"aria-label":Te.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Kr})`,transformOrigin:"top right",zIndex:L.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),or()},children:/* @__PURE__ */G(A,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Ft&&Pr&&/* @__PURE__ */G("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Pr.x,top:Pr.y+Pr.h+4,width:Pr.w,zIndex:L.expose+(qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ht(Se)})]}),Rr=Oe&&/* @__PURE__ */J(v,{style:{left:Oe.x,top:Oe.y},onClose:()=>Re(null),minWidth:160,children:[!V&&!_&&!pn&&/* @__PURE__ */J(Q,{children:[
93
93
  /* @__PURE__ */J(x,{onClick:()=>{qn(Nt),Re(null)},children:[
94
- /* @__PURE__ */G(z,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!vn&&/* @__PURE__ */J(x,zn?{onClick:()=>{Dn(!1),cn(tn()),Re(null)},children:[
94
+ /* @__PURE__ */G(A,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!vn&&/* @__PURE__ */J(x,zn?{onClick:()=>{Dn(!1),cn(tn()),Re(null)},children:[
95
95
  /* @__PURE__ */G("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */G("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),ze.windowed]}:{onClick:()=>{Er(),Re(null)},children:[
96
- /* @__PURE__ */G(z,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */J(x,{onClick:()=>{We(e=>!e),Re(null)},children:[
97
- /* @__PURE__ */G(z,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?ze.unpin:ze.pinOnTop]}),qe&&/* @__PURE__ */J(x,{onClick:()=>{Re(null),_e()},children:[
98
- /* @__PURE__ */G(z,{name:"star",className:"h-4 w-4",fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(Xt[Nt]||[]).length>0&&/* @__PURE__ */G(Q,{children:(Xt[Nt]||[]).map((e,t)=>/* @__PURE__ */J(x,{onClick:()=>{Re(null),e.onClick()},children:[e.icon,e.label]},t))}),!(pn&&Be?.home)&&/* @__PURE__ */J(Q,{children:[
96
+ /* @__PURE__ */G(A,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),B&&!pn&&/* @__PURE__ */J(x,{onClick:()=>{We(e=>!e),Re(null)},children:[
97
+ /* @__PURE__ */G(A,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?ze.unpin:ze.pinOnTop]}),qe&&/* @__PURE__ */J(x,{onClick:()=>{Re(null),_e()},children:[
98
+ /* @__PURE__ */G(A,{name:"star",className:"h-4 w-4",fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(Xt[Nt]||[]).length>0&&/* @__PURE__ */G(Q,{children:(Xt[Nt]||[]).map((e,t)=>/* @__PURE__ */J(x,{onClick:()=>{Re(null),e.onClick()},children:[e.icon,e.label]},t))}),!(pn&&Be?.home)&&/* @__PURE__ */J(Q,{children:[
99
99
  /* @__PURE__ */G(k,{}),
100
100
  /* @__PURE__ */J(x,{danger:!0,onClick:()=>{Re(null),or()},children:[
101
- /* @__PURE__ */G(z,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Fr=!!se&&Mt.some(e=>e.id===se),qr=!Dt||Fr||V?null:/* @__PURE__ */J("div",{"data-modal-restore-tab":!0,"data-modal-id":Nt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
101
+ /* @__PURE__ */G(A,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Fr=!!se&&Mt.some(e=>e.id===se),qr=!Dt||Fr||V?null:/* @__PURE__ */J("div",{"data-modal-restore-tab":!0,"data-modal-id":Nt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
102
102
  /* @__PURE__ */G("button",{type:"button",onClick:()=>Fn(Nt),title:ze.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Ae||ze.windowSuffix}),
103
103
  /* @__PURE__ */G("button",{type:"button",onClick:()=>Fn(Nt),title:ze.restore,"aria-label":ze.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
104
104
  /* @__PURE__ */G("button",{type:"button",onClick:()=>{or()},title:ze.close,"aria-label":ze.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return Z(
@@ -1 +1 @@
1
- import{buttonClasses as t}from"./chunk-K7PQXJO7.js";import{currentShellStrings as e}from"./chunk-BLMDTJOK.js";import{SPINNER_RING as n}from"./chunk-2J6F4EE7.js";var o="http://www.w3.org/2000/svg",s={},r=/* @__PURE__ */new Map;function i(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var a={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function c(t,e){const n=document.createElementNS(o,"svg");n.setAttribute("class",e),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2");const s=document.createElementNS(o,"path");return s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",a[t]),n.appendChild(s),n}function l(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function d(e,o,a){const d={...s,...a},u=d.placement??"top",m=d.sticky??!1,p=`${u}|${e}|${o}`;if(d.dedupe){const t=r.get(p);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==e&&!1!==d.sound&&import("./sounds-E5OTSJLX.js").then(t=>{"success"===e?t.playSuccess():"error"===e?t.playError():t.playNotification()}).catch(()=>{});const f="bottom"===u?i("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):i("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),h="bottom"===u?"translateY(10px)":"translateY(-10px)",y=l("pointer-events-auto cursor-pointer rosh-toast");if(y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,y.setAttribute("role","error"===e?"alert":"status"),y.setAttribute("aria-atomic","true"),"loading"===e){const t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.className=`${n} h-4 w-4 rosh-tone-loading`,y.appendChild(t)}else y.appendChild(c(e,`h-4 w-4 rosh-tone-${e}`));const v=document.createElement("span");if(v.textContent=o,y.appendChild(v),d.action){const{label:e,onClick:n}=d.action,o=document.createElement("button");o.type="button",o.className=t({variant:"link",size:"sm"}),o.textContent=e,o.addEventListener("click",t=>{t.stopPropagation(),g||(n(),x("action"))}),y.appendChild(o)}let b;f.appendChild(y),requestAnimationFrame(()=>{y.style.opacity="1",y.style.transform="translateY(0) scale(1)"});let g=!1;const x=t=>{g||(g=!0,b&&clearTimeout(b),r.delete(p),y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,setTimeout(()=>y.remove(),300),d.onClose?.(t))},E=()=>x("dismissed"),w=d.duration??("info"===e?4500:3e3),C=()=>{b&&clearTimeout(b),m||(b=setTimeout(()=>x("timeout"),w))};return C(),y.addEventListener("mouseenter",()=>{b&&clearTimeout(b)}),y.addEventListener("mouseleave",()=>{g||C()}),y.addEventListener("click",E),r.set(p,{el:y,restart:C,dismiss:E}),{dismiss:E}}var u=8e3,m=/* @__PURE__ */new Map,p=!1;var f={success:(t,e)=>d("success",t,e),error:(t,e)=>d("error",t,e),warning:(t,e)=>d("warning",t,e),info:(t,e)=>d("info",t,e),notify:(t,n)=>function(t,n){!1!==(n?.sound??s.sound)&&import("./sounds-E5OTSJLX.js").then(t=>t.playNotification()).catch(()=>{});const o=i("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),r=l("pointer-events-auto cursor-pointer rosh-notif");r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)";const a=l("rosh-notif-badge");a.appendChild(c("bell","h-5 w-5"));const d=l("rosh-notif-body");d.append(l("rosh-notif-title",e().toast.notification),l("notif-msg rosh-notif-msg",t));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",r.append(a,d,u);const m=()=>{r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>r.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),r.addEventListener("click",m),o.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateX(0) scale(1)"}),setTimeout(m,n?.duration??1e4)}(t,n),promise:(t,e,n)=>{const o=d("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),d("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),d("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{s={...t}},undoable:function(t,n){p||"undefined"==typeof window||(p=!0,window.addEventListener("pagehide",()=>{const t=[...m.values()];m.clear();for(const e of t)e.run({keepalive:!0})}));const o=/* @__PURE__ */Symbol("undoable");let s=!1,r=null;const i=async t=>{if(!s){s=!0,m.delete(o);try{await(t?n.commit(t):n.commit())}catch(t){n.onFail?.(t)}}},a=()=>!s&&(s=!0,m.delete(o),n.undo(),!0);return m.set(o,{run:i}),r=d("success",t,{sound:!1,placement:n.placement,duration:n.duration??8e3,action:{label:n.actionLabel??e().toast.undo,onClick:()=>{a()}},onClose:t=>{"action"!==t&&i()}}),{undo:()=>{const t=a();return t&&r?.dismiss(),t},commit:async()=>{if(s)return;const t=i();r?.dismiss(),await t}}}};export{u as UNDOABLE_MS,f as toast_default};
1
+ import{buttonClasses as t}from"./chunk-K7PQXJO7.js";import{SPINNER_RING as e}from"./chunk-2J6F4EE7.js";import{currentShellStrings as n}from"./chunk-BLMDTJOK.js";var o="http://www.w3.org/2000/svg",s={},r=/* @__PURE__ */new Map;function i(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var a={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function c(t,e){const n=document.createElementNS(o,"svg");n.setAttribute("class",e),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2");const s=document.createElementNS(o,"path");return s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",a[t]),n.appendChild(s),n}function l(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function d(n,o,a){const d={...s,...a},u=d.placement??"top",m=d.sticky??!1,p=`${u}|${n}|${o}`;if(d.dedupe){const t=r.get(p);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==n&&!1!==d.sound&&import("./sounds-E5OTSJLX.js").then(t=>{"success"===n?t.playSuccess():"error"===n?t.playError():t.playNotification()}).catch(()=>{});const f="bottom"===u?i("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):i("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),h="bottom"===u?"translateY(10px)":"translateY(-10px)",y=l("pointer-events-auto cursor-pointer rosh-toast");if(y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,y.setAttribute("role","error"===n?"alert":"status"),y.setAttribute("aria-atomic","true"),"loading"===n){const t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.className=`${e} h-4 w-4 rosh-tone-loading`,y.appendChild(t)}else y.appendChild(c(n,`h-4 w-4 rosh-tone-${n}`));const v=document.createElement("span");if(v.textContent=o,y.appendChild(v),d.action){const{label:e,onClick:n}=d.action,o=document.createElement("button");o.type="button",o.className=t({variant:"link",size:"sm"}),o.textContent=e,o.addEventListener("click",t=>{t.stopPropagation(),g||(n(),x("action"))}),y.appendChild(o)}let b;f.appendChild(y),requestAnimationFrame(()=>{y.style.opacity="1",y.style.transform="translateY(0) scale(1)"});let g=!1;const x=t=>{g||(g=!0,b&&clearTimeout(b),r.delete(p),y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,setTimeout(()=>y.remove(),300),d.onClose?.(t))},E=()=>x("dismissed"),w=d.duration??("info"===n?4500:3e3),C=()=>{b&&clearTimeout(b),m||(b=setTimeout(()=>x("timeout"),w))};return C(),y.addEventListener("mouseenter",()=>{b&&clearTimeout(b)}),y.addEventListener("mouseleave",()=>{g||C()}),y.addEventListener("click",E),r.set(p,{el:y,restart:C,dismiss:E}),{dismiss:E}}var u=8e3,m=/* @__PURE__ */new Map,p=!1;var f={success:(t,e)=>d("success",t,e),error:(t,e)=>d("error",t,e),warning:(t,e)=>d("warning",t,e),info:(t,e)=>d("info",t,e),notify:(t,e)=>function(t,e){!1!==(e?.sound??s.sound)&&import("./sounds-E5OTSJLX.js").then(t=>t.playNotification()).catch(()=>{});const o=i("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),r=l("pointer-events-auto cursor-pointer rosh-notif");r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)";const a=l("rosh-notif-badge");a.appendChild(c("bell","h-5 w-5"));const d=l("rosh-notif-body");d.append(l("rosh-notif-title",n().toast.notification),l("notif-msg rosh-notif-msg",t));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",r.append(a,d,u);const m=()=>{r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>r.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),r.addEventListener("click",m),o.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateX(0) scale(1)"}),setTimeout(m,e?.duration??1e4)}(t,e),promise:(t,e,n)=>{const o=d("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),d("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),d("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{s={...t}},undoable:function(t,e){p||"undefined"==typeof window||(p=!0,window.addEventListener("pagehide",()=>{const t=[...m.values()];m.clear();for(const e of t)e.run({keepalive:!0})}));const o=/* @__PURE__ */Symbol("undoable");let s=!1,r=null;const i=async t=>{if(!s){s=!0,m.delete(o);try{await(t?e.commit(t):e.commit())}catch(t){e.onFail?.(t)}}},a=()=>!s&&(s=!0,m.delete(o),e.undo(),!0);return m.set(o,{run:i}),r=d("success",t,{sound:!1,placement:e.placement,duration:e.duration??8e3,action:{label:e.actionLabel??n().toast.undo,onClick:()=>{a()}},onClose:t=>{"action"!==t&&i()}}),{undo:()=>{const t=a();return t&&r?.dismiss(),t},commit:async()=>{if(s)return;const t=i();r?.dismiss(),await t}}}};export{u as UNDOABLE_MS,f as toast_default};