@stacksjs/bun-router 0.1.0 → 0.1.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 (150) hide show
  1. package/dist/chunk-03m2j6h7.js +2 -0
  2. package/dist/chunk-08cw7ejr.js +3 -0
  3. package/dist/chunk-0e4g0fyv.js +62 -0
  4. package/dist/chunk-0mmn02yw.js +2 -0
  5. package/dist/chunk-126c9qm3.js +2 -0
  6. package/dist/chunk-12p13817.js +2 -0
  7. package/dist/chunk-14v65c37.js +4 -0
  8. package/dist/{chunk-s3dn1kwx.js → chunk-1b6a7t3v.js} +2 -2
  9. package/dist/chunk-1wenkmk0.js +2 -0
  10. package/dist/chunk-2152npfd.js +2 -0
  11. package/dist/chunk-26w23krx.js +2 -0
  12. package/dist/chunk-2g8m379z.js +10 -0
  13. package/dist/{chunk-5mxby3fd.js → chunk-2rr178et.js} +2 -2
  14. package/dist/chunk-2w8f3swz.js +29 -0
  15. package/dist/chunk-3y4gaz7v.js +82 -0
  16. package/dist/chunk-4r1x4afz.js +12 -0
  17. package/dist/chunk-4wyw66zk.js +2 -0
  18. package/dist/chunk-4z5sf8ag.js +2 -0
  19. package/dist/{chunk-krkchy8v.js → chunk-58tfvayh.js} +3 -3
  20. package/dist/{chunk-ex5fkjah.js → chunk-5dp83qcx.js} +43 -43
  21. package/dist/chunk-5f0d9j9a.js +2 -0
  22. package/dist/{chunk-zhx0hxdd.js → chunk-5z52b0fc.js} +7 -7
  23. package/dist/{chunk-kc659vhx.js → chunk-5zrnk2kq.js} +3 -3
  24. package/dist/chunk-6dmqtdnq.js +2 -0
  25. package/dist/{chunk-5s1pr62n.js → chunk-6e91956t.js} +2 -2
  26. package/dist/{chunk-jrf5a2ap.js → chunk-6rv8w5jk.js} +1 -1
  27. package/dist/{chunk-5n0ckcmc.js → chunk-6x1feysm.js} +2 -2
  28. package/dist/chunk-7y72hm1x.js +2 -0
  29. package/dist/{chunk-zetqzgf3.js → chunk-8hbhfh6b.js} +6 -6
  30. package/dist/{chunk-5ncn73tp.js → chunk-8kfzygg5.js} +2 -2
  31. package/dist/chunk-8wydx2we.js +2 -0
  32. package/dist/chunk-8zjnjvv7.js +2 -0
  33. package/dist/chunk-988h4bzr.js +2 -0
  34. package/dist/chunk-9b6a58ac.js +2 -0
  35. package/dist/chunk-a8fcaywb.js +2 -0
  36. package/dist/chunk-bfjwn7yg.js +2 -0
  37. package/dist/chunk-bp2522mm.js +2 -0
  38. package/dist/chunk-bswe62q4.js +48 -0
  39. package/dist/chunk-c3v796c8.js +943 -0
  40. package/dist/chunk-ccqmwdry.js +2 -0
  41. package/dist/chunk-ck0crwnx.js +2 -0
  42. package/dist/chunk-cqgkxcb4.js +2 -0
  43. package/dist/chunk-dntnakjy.js +2 -0
  44. package/dist/{chunk-67wgad4f.js → chunk-ettdpnrw.js} +2 -2
  45. package/dist/{chunk-csfrpsp7.js → chunk-ezqwq17j.js} +10 -10
  46. package/dist/chunk-ezx3qsez.js +2 -0
  47. package/dist/{chunk-73k79n7q.js → chunk-f72nnjy4.js} +360 -360
  48. package/dist/chunk-fna5n0ey.js +246 -0
  49. package/dist/chunk-fqhckdt8.js +2 -0
  50. package/dist/chunk-fr6hbx25.js +2 -0
  51. package/dist/{chunk-vr10sbbh.js → chunk-g9cwng6w.js} +1 -1
  52. package/dist/chunk-gd3za5x0.js +2 -0
  53. package/dist/chunk-gf28608k.js +2 -0
  54. package/dist/chunk-h1dj6v8q.js +3 -0
  55. package/dist/chunk-hjxe7k2g.js +2 -0
  56. package/dist/chunk-hrkgznbn.js +2 -0
  57. package/dist/chunk-j6h5v0br.js +2 -0
  58. package/dist/{chunk-0gjq8ttx.js → chunk-mgb01qdv.js} +2 -2
  59. package/dist/chunk-n24c9whp.js +2 -0
  60. package/dist/{chunk-kxp888dn.js → chunk-n2j24b0h.js} +244 -244
  61. package/dist/{chunk-vv3gb1m5.js → chunk-nhmtg01n.js} +2 -2
  62. package/dist/chunk-p0qhpnqh.js +70 -0
  63. package/dist/chunk-p0w1x8y2.js +3 -0
  64. package/dist/{chunk-9ght4n4r.js → chunk-p3dk1w2w.js} +11 -11
  65. package/dist/{chunk-6sjvhy5f.js → chunk-q4e9pxs7.js} +2 -2
  66. package/dist/chunk-q5dv1kyy.js +2 -0
  67. package/dist/chunk-qnqgf9tq.js +2 -0
  68. package/dist/chunk-qvwy1808.js +898 -0
  69. package/dist/{chunk-5s0pnsd6.js → chunk-r18f77vc.js} +4 -4
  70. package/dist/chunk-r63za1mr.js +2 -0
  71. package/dist/{chunk-6s1kbajm.js → chunk-rft8gw92.js} +1 -1
  72. package/dist/chunk-ryvmyskt.js +4211 -0
  73. package/dist/chunk-sa6mx308.js +2 -0
  74. package/dist/chunk-va0pc7hx.js +2 -0
  75. package/dist/chunk-vcp8dnjq.js +412 -0
  76. package/dist/chunk-vg1erq1q.js +2 -0
  77. package/dist/{chunk-hmgedrmr.js → chunk-w0jv49ch.js} +3 -3
  78. package/dist/{chunk-0t5vz87j.js → chunk-wm805tte.js} +19 -19
  79. package/dist/chunk-xj9h6mc9.js +2 -0
  80. package/dist/chunk-ytvzwrq3.js +51 -0
  81. package/dist/{chunk-w4r464v5.js → chunk-zde7ebc4.js} +2 -2
  82. package/dist/chunk-zmqsv2xy.js +2 -0
  83. package/dist/cli.js +57 -66
  84. package/dist/container/index.js +1 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.js +29 -29
  87. package/dist/typed/client.d.ts +89 -0
  88. package/dist/typed/contract.d.ts +34 -0
  89. package/dist/typed/endpoint.d.ts +90 -0
  90. package/dist/typed/index.d.ts +14 -0
  91. package/dist/typed/router.d.ts +141 -0
  92. package/package.json +1 -1
  93. package/dist/chunk-30rkn2ym.js +0 -2
  94. package/dist/chunk-38cmrard.js +0 -2
  95. package/dist/chunk-3qna6dwd.js +0 -2
  96. package/dist/chunk-4d5fmta0.js +0 -2
  97. package/dist/chunk-4x3b4b4q.js +0 -2
  98. package/dist/chunk-6xed4va1.js +0 -2
  99. package/dist/chunk-748n6ydj.js +0 -2
  100. package/dist/chunk-7rsf8tes.js +0 -898
  101. package/dist/chunk-8aspmtf1.js +0 -2
  102. package/dist/chunk-8yfdg595.js +0 -2
  103. package/dist/chunk-90eze7av.js +0 -3
  104. package/dist/chunk-9dvwyej7.js +0 -2
  105. package/dist/chunk-a2w45krb.js +0 -2
  106. package/dist/chunk-a547f2ab.js +0 -48
  107. package/dist/chunk-bqdycvtc.js +0 -2
  108. package/dist/chunk-cd03rk3x.js +0 -2
  109. package/dist/chunk-ct0m17q5.js +0 -2
  110. package/dist/chunk-dhbvvr5h.js +0 -2
  111. package/dist/chunk-dhptcsya.js +0 -943
  112. package/dist/chunk-dq93zag9.js +0 -2
  113. package/dist/chunk-edrtesh7.js +0 -2
  114. package/dist/chunk-ejcws37w.js +0 -2
  115. package/dist/chunk-ex890p45.js +0 -51
  116. package/dist/chunk-f69cpnhw.js +0 -2
  117. package/dist/chunk-fjf53b44.js +0 -2
  118. package/dist/chunk-fjzye4qj.js +0 -2
  119. package/dist/chunk-gfd23b6t.js +0 -2
  120. package/dist/chunk-habv0vef.js +0 -12
  121. package/dist/chunk-hz6fc788.js +0 -2
  122. package/dist/chunk-jff6j9y3.js +0 -10
  123. package/dist/chunk-jmeb7n8k.js +0 -70
  124. package/dist/chunk-jy2jhcpy.js +0 -246
  125. package/dist/chunk-m249t3je.js +0 -3
  126. package/dist/chunk-m9yabnjx.js +0 -2
  127. package/dist/chunk-mekrq9wd.js +0 -2
  128. package/dist/chunk-mmxv535f.js +0 -82
  129. package/dist/chunk-mypn7jss.js +0 -2
  130. package/dist/chunk-n18x1k3c.js +0 -2
  131. package/dist/chunk-nkddjzsa.js +0 -2
  132. package/dist/chunk-pjmhqmr9.js +0 -2
  133. package/dist/chunk-qyrnsaq1.js +0 -2
  134. package/dist/chunk-r19ff2qm.js +0 -62
  135. package/dist/chunk-r338fssq.js +0 -2
  136. package/dist/chunk-s36z58x2.js +0 -29
  137. package/dist/chunk-s79dd325.js +0 -471
  138. package/dist/chunk-ta38j9em.js +0 -2
  139. package/dist/chunk-tpfgntwj.js +0 -4211
  140. package/dist/chunk-vw8rwv6e.js +0 -2
  141. package/dist/chunk-wcrqs5z9.js +0 -2
  142. package/dist/chunk-x6d1rmwa.js +0 -2
  143. package/dist/chunk-x7ft15zz.js +0 -2
  144. package/dist/chunk-x8trwn7j.js +0 -3
  145. package/dist/chunk-xhepdj1f.js +0 -2
  146. package/dist/chunk-xv2em0q4.js +0 -4
  147. package/dist/chunk-ypw6g0te.js +0 -2
  148. package/dist/chunk-z8szsm21.js +0 -2
  149. package/dist/chunk-zfbh14qe.js +0 -2
  150. /package/dist/{chunk-a3wahyg7.js → chunk-nf3kv7kv.js} +0 -0
@@ -0,0 +1,898 @@
1
+ // @bun
2
+ import{$ as gt,Nd as zt,Od as Nt,aa as rt,ba as ie,ca as oe}from"./chunk-c3v796c8.js";import{Zu as R}from"./chunk-nf3kv7kv.js";import At from"process";import M from"process";import{existsSync as Ae}from"fs";import{dirname as _e,join as Ce}from"path";import{existsSync as st,mkdirSync as Ie,readFileSync as Le,watch as Pe,writeFileSync as ze}from"fs";import{homedir as Ne,platform as Be}from"os";import{dirname as Fe,join as j}from"path";import{existsSync as O,mkdirSync as Ut,readFileSync as We,unlinkSync as Vt,writeFileSync as Kt}from"fs";import{homedir as ot,platform as Yt}from"os";import{join as q}from"path";var se=import.meta.require;function ce(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function yt(){return typeof window<"u"&&typeof document<"u"}async function kr(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var N=new Map;function le(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function de(t){switch(t){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function ue(t="top-right"){if(!yt())throw Error("Toast container requires browser environment");try{let r=document.querySelector(`.stx-toast-container[data-position="${t}"]`);if(r)return r}catch{}let e=document.createElement("div");e.className=`stx-toast-container ${t}`,e.dataset.position=t;try{if(document.body)document.body.appendChild(e)}catch{}return e}function fe(t){let{options:e}=t,r=de(e.type),a=e.type||"info",n=e.duration!==0;return`
3
+ <div class="stx-toast ${a}" data-alert-id="${t.id}" role="alert" aria-live="polite">
4
+ <div class="stx-toast-icon">${r}</div>
5
+ <div class="stx-toast-content">
6
+ ${e.title?`<div class="stx-toast-title">${kt(e.title)}</div>`:""}
7
+ <div class="stx-toast-message">${kt(e.message)}</div>
8
+ </div>
9
+ ${n?'<button class="stx-toast-close" aria-label="Close">&times;</button>':""}
10
+ </div>
11
+ `}function kt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function G(t){if(t.timeout)clearTimeout(t.timeout);if(N.delete(t.id),t.element&&yt())t.element.classList.add("dismissing"),setTimeout(()=>{t.element?.remove()},200)}async function Bt(t){let e=le(),r=ce(),a=t.duration??5000,n={id:e,options:t};if(N.set(e,n),r&&t.type!=="error")try{let o=new Notification(t.title||"Notification",{body:t.message,icon:t.type==="success"?"\u2713":t.type==="warning"?"\u26A0":"\u2139",tag:e});if(o.onclick=()=>{if(t.onClick)t.onClick();o.close()},a>0)n.timeout=setTimeout(()=>{o.close(),N.delete(e)},a);return}catch{}if(yt())try{let o=ue(t.position),l=document.createElement("div");l.innerHTML=fe(n);let s=l.firstElementChild;if(!s){let c=(t.type||"info").toUpperCase();console.log(`[stx-alert] ${c}: ${t.title||""}`),console.log(`[stx-alert] ${t.message}`);return}n.element=s;try{o.appendChild(s)}catch{let c=(t.type||"info").toUpperCase();console.log(`[stx-alert] ${c}: ${t.title||""}`),console.log(`[stx-alert] ${t.message}`);return}if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>{try{s.classList.add("visible")}catch{}});try{s.addEventListener("click",(c)=>{if(c.target.classList?.contains("stx-toast-close")){G(n);return}if(t.onClick)t.onClick()})}catch{}if(a>0)n.timeout=setTimeout(()=>{G(n)},a)}catch{let o=(t.type||"info").toUpperCase();console.log(`[stx-alert] ${o}: ${t.title||""}`),console.log(`[stx-alert] ${t.message}`)}else{let o=(t.type||"info").toUpperCase();if(console.log(`[stx-alert] ${o}: ${t.title||""}`),console.log(`[stx-alert] ${t.message}`),a>0)n.timeout=setTimeout(()=>{N.delete(e)},a)}}async function at(t){return Bt({...t,position:t.position||"top-right"})}async function Sr(t,e=3000){return at({message:t,type:"info",duration:e})}async function Ar(t,e=3000){return at({message:t,type:"success",duration:e})}async function _r(t,e=3000){return at({message:t,type:"warning",duration:e})}async function Cr(t,e=5000){return at({message:t,type:"error",duration:e})}async function Tr(t,e,r="info"){return Bt({title:t,message:e,type:r})}function Er(t){let e=N.get(t);if(e)G(e)}function Dr(){for(let t of N.values())G(t)}function Mr(){return N.size}var Ir=`
12
+ .stx-toast-container {
13
+ position: fixed;
14
+ z-index: 10001;
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 8px;
18
+ max-width: 400px;
19
+ pointer-events: none;
20
+ }
21
+
22
+ .stx-toast-container.top-left { top: 16px; left: 16px; }
23
+ .stx-toast-container.top-center { top: 16px; left: 50%; transform: translateX(-50%); }
24
+ .stx-toast-container.top-right { top: 16px; right: 16px; }
25
+ .stx-toast-container.bottom-left { bottom: 16px; left: 16px; }
26
+ .stx-toast-container.bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); }
27
+ .stx-toast-container.bottom-right { bottom: 16px; right: 16px; }
28
+
29
+ .stx-toast {
30
+ display: flex;
31
+ align-items: flex-start;
32
+ gap: 12px;
33
+ padding: 12px 16px;
34
+ background: #fff;
35
+ border-radius: 8px;
36
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
37
+ pointer-events: auto;
38
+ cursor: pointer;
39
+ opacity: 0;
40
+ transform: translateY(-10px);
41
+ transition: opacity 0.2s, transform 0.2s;
42
+ }
43
+
44
+ .stx-toast.visible {
45
+ opacity: 1;
46
+ transform: translateY(0);
47
+ }
48
+
49
+ .stx-toast.dismissing {
50
+ opacity: 0;
51
+ transform: translateX(100%);
52
+ }
53
+
54
+ @media (prefers-color-scheme: dark) {
55
+ .stx-toast {
56
+ background: #2d2d2d;
57
+ color: #fff;
58
+ }
59
+ }
60
+
61
+ .stx-toast-icon {
62
+ font-size: 20px;
63
+ flex-shrink: 0;
64
+ margin-top: 2px;
65
+ }
66
+
67
+ .stx-toast.info .stx-toast-icon { color: #3498db; }
68
+ .stx-toast.success .stx-toast-icon { color: #27ae60; }
69
+ .stx-toast.warning .stx-toast-icon { color: #f39c12; }
70
+ .stx-toast.error .stx-toast-icon { color: #e74c3c; }
71
+
72
+ .stx-toast-content {
73
+ flex: 1;
74
+ min-width: 0;
75
+ }
76
+
77
+ .stx-toast-title {
78
+ font-weight: 600;
79
+ margin-bottom: 4px;
80
+ }
81
+
82
+ .stx-toast-message {
83
+ color: #666;
84
+ font-size: 14px;
85
+ line-height: 1.4;
86
+ }
87
+
88
+ @media (prefers-color-scheme: dark) {
89
+ .stx-toast-message { color: #aaa; }
90
+ }
91
+
92
+ .stx-toast-close {
93
+ background: none;
94
+ border: none;
95
+ font-size: 20px;
96
+ cursor: pointer;
97
+ opacity: 0.5;
98
+ padding: 0;
99
+ line-height: 1;
100
+ color: inherit;
101
+ transition: opacity 0.15s;
102
+ }
103
+
104
+ .stx-toast-close:hover {
105
+ opacity: 1;
106
+ }
107
+
108
+ /* Border accent for different types */
109
+ .stx-toast.info { border-left: 4px solid #3498db; }
110
+ .stx-toast.success { border-left: 4px solid #27ae60; }
111
+ .stx-toast.warning { border-left: 4px solid #f39c12; }
112
+ .stx-toast.error { border-left: 4px solid #e74c3c; }
113
+ `;function b(t="stx"){return`${t}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function w(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function x(...t){return t.filter(Boolean).join(" ")}function y(t){if(!t)return"";return Object.entries(t).map(([e,r])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${r}`).join("; ")}function Lr(t){let{text:e,variant:r="primary",size:a="medium",disabled:n=!1,loading:o=!1,icon:l,iconPosition:s="left",id:c=b("btn"),className:d,style:f}=t,p=x("stx-button",`stx-button--${r}`,`stx-button--${a}`,n&&"stx-button--disabled",o&&"stx-button--loading",d),u=y(f),h=l?`<span class="stx-button-icon">${l}</span>`:"",m=o?'<span class="stx-button-spinner"></span>':"",k=s==="left"?`${h}${m}<span class="stx-button-text">${w(e)}</span>`:`<span class="stx-button-text">${w(e)}</span>${h}${m}`;return`<button id="${c}" class="${p}" ${n||o?"disabled":""} ${u?`style='${u}'`:""}>${k}</button>`}function Pr(t){let{value:e="",placeholder:r="",type:a="text",disabled:n=!1,readonly:o=!1,maxLength:l,minLength:s,pattern:c,required:d=!1,autocomplete:f,label:p,error:u,hint:h,id:m=b("input"),className:k,style:S}=t,A=x("stx-input",u&&"stx-input--error",n&&"stx-input--disabled",k),I=y(S),K=[`type="${a}"`,`id="${m}"`,`class="${A}"`,e&&`value="${w(e)}"`,r&&`placeholder="${w(r)}"`,n&&"disabled",o&&"readonly",d&&"required",l&&`maxlength="${l}"`,s&&`minlength="${s}"`,c&&`pattern="${w(c)}"`,f&&`autocomplete="${f}"`,I&&`style="${I}"`].filter(Boolean).join(" "),L="";if(p)L+=`<label class="stx-input-label" for="${m}">${w(p)}</label>`;if(L+=`<input ${K} />`,u)L+=`<div class="stx-input-error">${w(u)}</div>`;else if(h)L+=`<div class="stx-input-hint">${w(h)}</div>`;return`<div class="stx-input-wrapper">${L}</div>`}function zr(t){let{checked:e=!1,label:r,disabled:a=!1,indeterminate:n=!1,id:o=b("checkbox"),className:l,style:s}=t,c=x("stx-checkbox",a&&"stx-checkbox--disabled",l),d=y(s),f=['type="checkbox"',`id="${o}"`,e&&"checked",a&&"disabled",n&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
114
+ <label class="${c}" ${d?`style="${d}"`:""}>
115
+ <input ${f} />
116
+ <span class="stx-checkbox-box"></span>
117
+ ${r?`<span class="stx-checkbox-label">${w(r)}</span>`:""}
118
+ </label>
119
+ `}function Nr(t){let{value:e=50,min:r=0,max:a=100,step:n=1,disabled:o=!1,label:l,showValue:s=!0,id:c=b("slider"),className:d,style:f}=t,p=x("stx-slider",o&&"stx-slider--disabled",d),u=y(f),h=['type="range"',`id="${c}"`,`value="${e}"`,`min="${r}"`,`max="${a}"`,`step="${n}"`,o&&"disabled"].filter(Boolean).join(" "),m="";if(l)m+=`<label class="stx-slider-label" for="${c}">${w(l)}</label>`;if(m+=`<div class="stx-slider-track"><input ${h} /></div>`,s)m+=`<span class="stx-slider-value">${e}</span>`;return`<div class="${p}" ${u?`style='${u}'`:""}>${m}</div>`}function Br(t){let{value:e,max:r=100,variant:a="default",size:n="medium",showLabel:o=!1,indeterminate:l=!1,id:s=b("progress"),className:c,style:d}=t,f=Math.min(100,Math.max(0,e/r*100)),p=x("stx-progress",`stx-progress--${a}`,`stx-progress--${n}`,l&&"stx-progress--indeterminate",c),u=y(d);return`
120
+ <div id="${s}" class="${p}" role="progressbar" aria-valuenow="${e}" aria-valuemin="0" aria-valuemax="${r}" ${u?`style="${u}"`:""}>
121
+ <div class="stx-progress-bar" style="width: ${l?"100%":`${f}%`}"></div>
122
+ ${o?`<span class="stx-progress-label">${Math.round(f)}%</span>`:""}
123
+ </div>
124
+ `}function Fr(t){let{text:e,variant:r="default",size:a="medium",id:n=b("badge"),className:o,style:l}=t,s=x("stx-badge",`stx-badge--${r}`,`stx-badge--${a}`,o),c=y(l);return`<span id="${n}" class="${s}" ${c?`style='${c}'`:""}>${w(e)}</span>`}function Rr(t){let{src:e,alt:r="",name:a,size:n="medium",shape:o="circle",id:l=b("avatar"),className:s,style:c}=t,d=typeof n==="number"?"":`stx-avatar--${n}`,f=typeof n==="number"?`width: ${n}px; height: ${n}px;`:"",p=x("stx-avatar",d,`stx-avatar--${o}`,s),u=[f,y(c)].filter(Boolean).join(" "),h=a?a.split(" ").map((m)=>m[0]).join("").toUpperCase().slice(0,2):"";if(e)return`<div id="${l}" class="${p}" ${u?`style="${u}"`:""}>
125
+ <img src="${w(e)}" alt="${w(r)}" class="stx-avatar-img" />
126
+ </div>`;return`<div id="${l}" class="${p}" ${u?`style="${u}"`:""}>
127
+ <span class="stx-avatar-initials">${h}</span>
128
+ </div>`}function Wr(t){let{title:e,subtitle:r,content:a,image:n,footer:o,variant:l="default",id:s=b("card"),className:c,style:d}=t,f=x("stx-card",`stx-card--${l}`,c),p=y(d),u="";if(n)u+=`<div class="stx-card-image"><img src="${w(n)}" alt="" /></div>`;if(u+='<div class="stx-card-body">',e)u+=`<h3 class="stx-card-title">${w(e)}</h3>`;if(r)u+=`<p class="stx-card-subtitle">${w(r)}</p>`;if(a)u+=`<div class="stx-card-content">${w(a)}</div>`;if(u+="</div>",o)u+=`<div class="stx-card-footer">${w(o)}</div>`;return`<div id="${s}" class="${f}" ${p?`style='${p}'`:""}>${u}</div>`}function Or(t){let{tabs:e,activeTab:r,variant:a="default",id:n=b("tabs"),className:o,style:l}=t,s=x("stx-tabs",`stx-tabs--${a}`,o),c=y(l),d=e.map((f,p)=>{let u=r?f.value===r:p===0;return`<button class="${x("stx-tab",u&&"stx-tab--active",f.disabled&&"stx-tab--disabled")}" data-value="${w(f.value)}" ${f.disabled?"disabled":""} role="tab" aria-selected="${u}">${w(f.label)}</button>`}).join("");return`<div id="${n}" class="${s}" role="tablist" ${c?`style='${c}'`:""}>${d}</div>`}function qr(t){let{options:e,value:r,placeholder:a="Select...",disabled:n=!1,id:o=b("dropdown"),className:l,style:s}=t,c=x("stx-dropdown",n&&"stx-dropdown--disabled",l),d=y(s),f=e.map((u)=>{let h=u.value===r?"selected":"",m=u.disabled?"disabled":"";return`<option value="${w(u.value)}" ${h} ${m}>${w(u.label)}</option>`}).join(""),p=r?"":`<option value="" disabled selected>${w(a)}</option>`;return`<select id="${o}" class="${c}" ${n?"disabled":""} ${d?`style='${d}'`:""}>${p}${f}</select>`}function Hr(t){let{value:e=0,max:r=5,readonly:a=!1,size:n="medium",allowHalf:o=!1,id:l=b("rating"),className:s,style:c}=t,d=x("stx-rating",`stx-rating--${n}`,a&&"stx-rating--readonly",s),f=y(c),p="";for(let u=1;u<=r;u++){let h=u<=e,m=o&&u-0.5===e;p+=`<span class="stx-star ${h?"stx-star--filled":m?"stx-star--half":""}" data-value="${u}">\u2605</span>`}return`<div id="${l}" class="${d}" role="slider" aria-valuenow="${e}" aria-valuemin="0" aria-valuemax="${r}" ${f?`style='${f}'`:""}>${p}</div>`}function jr(t){let{value:e,name:r,checked:a=!1,label:n,disabled:o=!1,id:l=b("radio"),className:s,style:c}=t,d=x("stx-radio",o&&"stx-radio--disabled",s),f=y(c),p=['type="radio"',`id="${l}"`,`name="${w(r)}"`,`value="${w(e)}"`,a&&"checked",o&&"disabled"].filter(Boolean).join(" ");return`
129
+ <label class="${d}" ${f?`style="${f}"`:""}>
130
+ <input ${p} />
131
+ <span class="stx-radio-circle"></span>
132
+ ${n?`<span class="stx-radio-label">${w(n)}</span>`:""}
133
+ </label>
134
+ `}function Ur(t){let{value:e="#3498db",disabled:r=!1,label:a,presetColors:n=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:o=b("color"),className:l,style:s}=t,c=x("stx-color-picker",r&&"stx-color-picker--disabled",l),d=y(s),f="";if(a)f+=`<label class="stx-color-picker-label" for="${o}">${w(a)}</label>`;if(f+=`<div class="stx-color-picker-input">
135
+ <input type="color" id="${o}" value="${w(e)}" ${r?"disabled":""} />
136
+ <span class="stx-color-picker-value">${w(e)}</span>
137
+ </div>`,n.length>0){f+='<div class="stx-color-picker-presets">';for(let p of n)f+=`<button class="stx-color-preset" style="background: ${w(p)}" data-color="${w(p)}" ${r?"disabled":""}></button>`;f+="</div>"}return`<div class="${c}" ${d?`style='${d}'`:""}>${f}</div>`}function Vr(t){let{value:e,min:r,max:a,disabled:n=!1,label:o,placeholder:l="Select date",showClear:s=!0,id:c=b("date"),className:d,style:f}=t,p=x("stx-date-picker",n&&"stx-date-picker--disabled",d),u=y(f),h=e instanceof Date?e.toISOString().split("T")[0]:e||"",m=r instanceof Date?r.toISOString().split("T")[0]:r,k=a instanceof Date?a.toISOString().split("T")[0]:a,S=['type="date"',`id="${c}"`,h&&`value="${h}"`,m&&`min="${m}"`,k&&`max="${k}"`,n&&"disabled",`placeholder="${w(l)}"`].filter(Boolean).join(" "),A="";if(o)A+=`<label class="stx-date-picker-label" for="${c}">${w(o)}</label>`;return A+=`<div class="stx-date-picker-input">
138
+ <input ${S} />
139
+ ${s&&h?'<button class="stx-date-picker-clear" type="button">&times;</button>':""}
140
+ </div>`,`<div class="${p}" ${u?`style='${u}'`:""}>${A}</div>`}function Kr(t){let{value:e="",disabled:r=!1,label:a,step:n=60,min:o,max:l,id:s=b("time"),className:c,style:d}=t,f=x("stx-time-picker",r&&"stx-time-picker--disabled",c),p=y(d),u=['type="time"',`id="${s}"`,e&&`value="${w(e)}"`,`step="${n}"`,o&&`min="${w(o)}"`,l&&`max="${w(l)}"`,r&&"disabled"].filter(Boolean).join(" "),h="";if(a)h+=`<label class="stx-time-picker-label" for="${s}">${w(a)}</label>`;return h+=`<input ${u} class="stx-time-picker-input" />`,`<div class="${f}" ${p?`style='${p}'`:""}>${h}</div>`}function Yr(t){let{options:e,value:r="",placeholder:a="Search...",disabled:n=!1,label:o,loading:l=!1,id:s=b("autocomplete"),className:c,style:d}=t,f=x("stx-autocomplete",n&&"stx-autocomplete--disabled",c),p=y(d),u=e.find((k)=>k.value===r),h=u?u.label:r,m="";if(o)m+=`<label class="stx-autocomplete-label" for="${s}">${w(o)}</label>`;m+=`<div class="stx-autocomplete-input-wrapper">
141
+ <input type="text" id="${s}" value="${w(h)}" placeholder="${w(a)}" ${n?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
142
+ ${l?'<span class="stx-autocomplete-spinner"></span>':""}
143
+ </div>`,m+='<ul class="stx-autocomplete-list">';for(let k of e)m+=`<li class="stx-autocomplete-item ${k.value===r?"stx-autocomplete-item--selected":""}" data-value="${w(k.value)}">${w(k.label)}</li>`;return m+="</ul>",`<div class="${f}" ${p?`style='${p}'`:""}>${m}</div>`}function Xr(t){let{text:e,htmlFor:r,required:a=!1,size:n="medium",id:o=b("label"),className:l,style:s}=t,c=x("stx-label",`stx-label--${n}`,l),d=y(s);return`<label id="${o}" class="${c}" ${r?`for='${w(r)}'`:""} ${d?`style='${d}'`:""}>${w(e)}${a?'<span class="stx-label-required">*</span>':""}</label>`}function Gr(t){let{src:e,alt:r="",width:a,height:n,objectFit:o="cover",fallback:l,loading:s="lazy",id:c=b("image"),className:d,style:f}=t,p=x("stx-image",d),u={objectFit:o};if(a)u.width=typeof a==="number"?`${a}px`:a;if(n)u.height=typeof n==="number"?`${n}px`:n;let h=[y(u),y(f)].filter(Boolean).join("; "),m=l?`onerror="this.src='${w(l)}'"`:"";return`<img id="${c}" class="${p}" src="${w(e)}" alt="${w(r)}" loading="${s}" ${h?`style='${h}'`:""} ${m} />`}function Jr(t){let{text:e,variant:r="default",size:a="medium",removable:n=!1,icon:o,id:l=b("chip"),className:s,style:c}=t,d=x("stx-chip",`stx-chip--${r}`,`stx-chip--${a}`,s),f=y(c),p="";if(o)p+=`<span class="stx-chip-icon">${o}</span>`;if(p+=`<span class="stx-chip-text">${w(e)}</span>`,n)p+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${l}" class="${d}" ${f?`style='${f}'`:""}>${p}</span>`}function Zr(t){let{text:e,position:r="top",delay:a=200,children:n,id:o=b("tooltip"),className:l,style:s}=t,c=x("stx-tooltip-wrapper",l),d=y(s);return`<div id="${o}" class="${c}" ${d?`style="${d}"`:""} data-tooltip="${w(e)}" data-position="${r}" data-delay="${a}">
144
+ ${n}
145
+ <span class="stx-tooltip stx-tooltip--${r}">${w(e)}</span>
146
+ </div>`}function Qr(t){let{direction:e="vertical",showScrollbar:r=!0,smooth:a=!0,height:n,width:o,children:l,id:s=b("scroll"),className:c,style:d}=t,f=x("stx-scroll-view",`stx-scroll-view--${e}`,!r&&"stx-scroll-view--hide-scrollbar",a&&"stx-scroll-view--smooth",c),p={};if(n)p.height=typeof n==="number"?`${n}px`:n;if(o)p.width=typeof o==="number"?`${o}px`:o;let u=[y(p),y(d)].filter(Boolean).join("; ");return`<div id="${s}" class="${f}" ${u?`style='${u}'`:""}>${l}</div>`}function ta(t){let{direction:e="horizontal",sizes:r=[50,50],resizable:a=!0,children:n,id:o=b("split"),className:l,style:s}=t,c=x("stx-split-view",`stx-split-view--${e}`,a&&"stx-split-view--resizable",l),d=y(s),f=e==="horizontal"?"width":"height";return`<div id="${o}" class="${c}" ${d?`style="${d}"`:""}>
147
+ <div class="stx-split-pane" style="${f}: ${r[0]}%">${n[0]}</div>
148
+ ${a?'<div class="stx-split-divider"></div>':""}
149
+ <div class="stx-split-pane" style="${f}: ${r[1]}%">${n[1]}</div>
150
+ </div>`}function ea(t){let{items:e,multiple:r=!1,defaultOpen:a=[],id:n=b("accordion"),className:o,style:l}=t,s=x("stx-accordion",o),c=y(l),d="";return e.forEach((f,p)=>{let u=a.includes(p),h=x("stx-accordion-item",u&&"stx-accordion-item--open",f.disabled&&"stx-accordion-item--disabled");d+=`<div class="${h}" data-index="${p}">
151
+ <button class="stx-accordion-header" ${f.disabled?"disabled":""} aria-expanded="${u}" data-multiple="${r}">
152
+ <span class="stx-accordion-title">${w(f.title)}</span>
153
+ <span class="stx-accordion-icon">\u25BC</span>
154
+ </button>
155
+ <div class="stx-accordion-content" ${u?"":"hidden"}>
156
+ ${w(f.content)}
157
+ </div>
158
+ </div>`}),`<div id="${n}" class="${s}" ${c?`style='${c}'`:""}>${d}</div>`}function ra(t){let{steps:e,currentStep:r,orientation:a="horizontal",id:n=b("stepper"),className:o,style:l}=t,s=x("stx-stepper",`stx-stepper--${a}`,o),c=y(l),d="";return e.forEach((f,p)=>{let u=x("stx-step",p<r&&"stx-step--completed",p===r&&"stx-step--active");if(d+=`<div class="${u}" data-step="${p}">
159
+ <div class="stx-step-indicator">
160
+ ${p<r?"\u2713":p+1}
161
+ </div>
162
+ <div class="stx-step-content">
163
+ <div class="stx-step-label">${w(f.label)}</div>
164
+ ${f.description?`<div class="stx-step-description">${w(f.description)}</div>`:""}
165
+ </div>
166
+ </div>`,p<e.length-1)d+='<div class="stx-step-connector"></div>'}),`<div id="${n}" class="${s}" ${c?`style='${c}'`:""}>${d}</div>`}function aa(t){let{open:e=!1,title:r,size:a="medium",closable:n=!0,children:o,footer:l,id:s=b("modal"),className:c,style:d}=t,f=x("stx-modal-component",`stx-modal-component--${a}`,c),p=y(d);if(!e)return`<div id="${s}" class="${f} stx-modal-component--hidden" ${p?`style='${p}'`:""}></div>`;let u='<div class="stx-modal-component-overlay">';if(u+='<div class="stx-modal-component-dialog">',r||n){if(u+='<div class="stx-modal-component-header">',r)u+=`<h3 class="stx-modal-component-title">${w(r)}</h3>`;if(n)u+='<button class="stx-modal-component-close">&times;</button>';u+="</div>"}if(u+=`<div class="stx-modal-component-body">${o}</div>`,l)u+=`<div class="stx-modal-component-footer">${l}</div>`;return u+="</div></div>",`<div id="${s}" class="${f}" ${p?`style='${p}'`:""}>${u}</div>`}function na(t){let{items:e,selectable:r=!1,multiSelect:a=!1,emptyMessage:n="No items",id:o=b("list"),className:l,style:s}=t,c=x("stx-list-view",r&&"stx-list-view--selectable",a&&"stx-list-view--multi",l),d=y(s);if(e.length===0)return`<div id="${o}" class="${c}" ${d?`style="${d}"`:""}>
167
+ <div class="stx-list-view-empty">${w(n)}</div>
168
+ </div>`;let f='<ul class="stx-list-view-items">';for(let p of e){let u=x("stx-list-view-item",p.selected&&"stx-list-view-item--selected");f+=`<li class="${u}" data-id="${w(p.id)}" ${r?'tabindex="0"':""}>${p.content}</li>`}return f+="</ul>",`<div id="${o}" class="${c}" ${d?`style='${d}'`:""}>${f}</div>`}function ia(t){let{columns:e,data:r,striped:a=!1,bordered:n=!1,hoverable:o=!0,sortBy:l,sortOrder:s,id:c=b("table"),className:d,style:f}=t,p=x("stx-table",a&&"stx-table--striped",n&&"stx-table--bordered",o&&"stx-table--hoverable",d),u=y(f),h="<table>";h+="<thead><tr>";for(let m of e){let S=m.key===l?`stx-table-sorted stx-table-sorted--${s}`:"",A=m.sortable?'data-sortable="true"':"",I=m.width?`style="width: ${m.width}"`:"";h+=`<th class="${S}" ${A} ${I} data-key="${w(m.key)}">${w(m.label)}${m.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}h+="</tr></thead>",h+="<tbody>";for(let m of r){h+="<tr>";for(let k of e){let S=m[k.key];h+=`<td>${S!=null?w(String(S)):""}</td>`}h+="</tr>"}return h+="</tbody></table>",`<div id="${c}" class="${p}" ${u?`style='${u}'`:""}>${h}</div>`}function Ft(t,e,r,a){let n=e.includes(t.key),o=r.includes(t.key),l=t.children&&t.children.length>0,c=`<div class="${x("stx-tree-node",o&&"stx-tree-node--selected",t.disabled&&"stx-tree-node--disabled")}" data-key="${w(t.key)}">`;if(c+='<div class="stx-tree-node-content">',l)c+=`<span class="stx-tree-toggle ${n?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else c+='<span class="stx-tree-toggle-placeholder"></span>';if(a)c+=`<input type="checkbox" class="stx-tree-checkbox" ${o?"checked":""} ${t.disabled?"disabled":""} />`;if(t.icon)c+=`<span class="stx-tree-icon">${t.icon}</span>`;if(c+=`<span class="stx-tree-label">${w(t.label)}</span>`,c+="</div>",l&&n){c+='<div class="stx-tree-children">';for(let d of t.children)c+=Ft(d,e,r,a);c+="</div>"}return c+="</div>",c}function oa(t){let{nodes:e,expandedKeys:r=[],selectedKeys:a=[],checkable:n=!1,id:o=b("tree"),className:l,style:s}=t,c=x("stx-tree-view",n&&"stx-tree-view--checkable",l),d=y(s),f="";for(let p of e)f+=Ft(p,r,a,n);return`<div id="${o}" class="${c}" role="tree" ${d?`style='${d}'`:""}>${f}</div>`}function sa(t){let{columns:e,data:r,pagination:a,selectable:n=!1,id:o=b("datagrid"),className:l,style:s}=t,c=x("stx-data-grid",n&&"stx-data-grid--selectable",l),d=y(s),f='<div class="stx-data-grid-table-wrapper">';if(f+='<table class="stx-data-grid-table">',f+="<thead><tr>",n)f+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let p of e){let u=p.width?`style="width: ${p.width}"`:"";f+=`<th ${u}>
169
+ <div class="stx-data-grid-header-cell">
170
+ <span>${w(p.label)}</span>
171
+ ${p.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
172
+ ${p.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
173
+ </div>
174
+ </th>`}f+="</tr></thead>",f+="<tbody>";for(let p of r){if(f+="<tr>",n)f+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let u of e){let h=p[u.key];f+=`<td>${h!=null?w(String(h)):""}</td>`}f+="</tr>"}if(f+="</tbody></table></div>",a){let p=Math.ceil(a.total/a.pageSize);f+=`<div class="stx-data-grid-pagination">
175
+ <span class="stx-data-grid-page-info">Page ${a.page} of ${p} (${a.total} items)</span>
176
+ <div class="stx-data-grid-page-buttons">
177
+ <button class="stx-data-grid-page-btn" ${a.page<=1?"disabled":""}>\u25C0</button>
178
+ <button class="stx-data-grid-page-btn" ${a.page>=p?"disabled":""}>\u25B6</button>
179
+ </div>
180
+ </div>`}return`<div id="${o}" class="${c}" ${d?`style='${d}'`:""}>${f}</div>`}function ca(t){let{type:e,data:r,options:a={},width:n="100%",height:o=300,id:l=b("chart"),className:s,style:c}=t,d=x("stx-chart",`stx-chart--${e}`,s),f={width:typeof n==="number"?`${n}px`:n,height:typeof o==="number"?`${o}px`:o},p=[y(f),y(c)].filter(Boolean).join("; "),u=JSON.stringify({type:e,data:r,options:a});return`<div id="${l}" class="${d}" style="${p}" data-chart='${w(u)}'>
181
+ <div class="stx-chart-placeholder">
182
+ ${a.title?`<div class="stx-chart-title">${w(a.title)}</div>`:""}
183
+ <div class="stx-chart-type">${e.charAt(0).toUpperCase()+e.slice(1)} Chart</div>
184
+ <div class="stx-chart-info">${r.datasets.length} dataset(s), ${r.labels.length} labels</div>
185
+ </div>
186
+ </div>`}function la(t){let{value:e="",language:r="plaintext",theme:a="dark",lineNumbers:n=!0,readOnly:o=!1,height:l=300,tabSize:s=2,wordWrap:c=!1,id:d=b("code"),className:f,style:p}=t,u=x("stx-code-editor",`stx-code-editor--${a}`,n&&"stx-code-editor--line-numbers",o&&"stx-code-editor--readonly",c&&"stx-code-editor--wrap",f),h={height:typeof l==="number"?`${l}px`:l},m=[y(h),y(p)].filter(Boolean).join("; "),k=e.split(`
187
+ `),S="";if(n){S+='<div class="stx-code-editor-gutter">';for(let A=1;A<=k.length;A++)S+=`<div class="stx-code-editor-line-number">${A}</div>`;S+="</div>"}return S+=`<pre class="stx-code-editor-content"><code class="language-${w(r)}">${w(e)}</code></pre>`,`<div id="${d}" class="${u}" style="${m}" data-language="${w(r)}" data-tab-size="${s}">${S}</div>`}function da(t){let{src:e,type:r="video",poster:a,autoplay:n=!1,loop:o=!1,muted:l=!1,controls:s=!0,width:c,height:d,id:f=b("media"),className:p,style:u}=t,h=x("stx-media-player",`stx-media-player--${r}`,p),m={};if(c)m.width=typeof c==="number"?`${c}px`:c;if(d)m.height=typeof d==="number"?`${d}px`:d;let k=[y(m),y(u)].filter(Boolean).join("; "),S=[`id="${f}-media"`,`src="${w(e)}"`,s&&"controls",n&&"autoplay",o&&"loop",l&&"muted",r==="video"&&a&&`poster="${w(a)}"`].filter(Boolean).join(" "),A=r==="video"?`<video ${S}>Your browser does not support the video tag.</video>`:`<audio ${S}>Your browser does not support the audio tag.</audio>`;return`<div id="${f}" class="${h}" ${k?`style='${k}'`:""}>${A}</div>`}function pe(t){if(t===void 0)return"";let e=["B","KB","MB","GB"],r=t,a=0;while(r>=1024&&a<e.length-1)r/=1024,a++;return`${r.toFixed(1)} ${e[a]}`}function ua(t){let{files:e,viewMode:r="list",showHidden:a=!1,selectable:n=!0,id:o=b("files"),className:l,style:s}=t,c=x("stx-file-explorer",`stx-file-explorer--${r}`,l),d=y(s),f=a?e:e.filter((u)=>!u.name.startsWith(".")),p="";if(r==="list"){p='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let u of f){let h=u.icon||(u.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),m=u.type==="file"?pe(u.size):"",k=u.modified?u.modified.toLocaleDateString():"";p+=`<tr class="stx-file-explorer-item ${n?"stx-file-explorer-item--selectable":""}" data-path="${w(u.path)}" data-type="${u.type}">
188
+ <td><span class="stx-file-explorer-icon">${h}</span>${w(u.name)}</td>
189
+ <td>${m}</td>
190
+ <td>${k}</td>
191
+ </tr>`}p+="</tbody></table>"}else{p='<div class="stx-file-explorer-grid">';for(let u of f){let h=u.icon||(u.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");p+=`<div class="stx-file-explorer-item ${n?"stx-file-explorer-item--selectable":""}" data-path="${w(u.path)}" data-type="${u.type}">
192
+ <div class="stx-file-explorer-icon">${h}</div>
193
+ <div class="stx-file-explorer-name">${w(u.name)}</div>
194
+ </div>`}p+="</div>"}return`<div id="${o}" class="${c}" ${d?`style='${d}'`:""}>${p}</div>`}function fa(t){let{url:e,width:r="100%",height:a=400,sandbox:n=!0,allowScripts:o=!0,id:l=b("webview"),className:s,style:c}=t,d=x("stx-webview",s),f={width:typeof r==="number"?`${r}px`:r,height:typeof a==="number"?`${a}px`:a},p=[y(f),y(c)].filter(Boolean).join("; "),u=[];if(n){if(u.push("allow-same-origin"),o)u.push("allow-scripts")}let h=n?`sandbox="${u.join(" ")}"`:"";return`<iframe id="${l}" class="${d}" src="${w(e)}" style="${p}" ${h} loading="lazy" frameborder="0"></iframe>`}var pa=["Button","TextInput","Checkbox","RadioButton","Slider","ColorPicker","DatePicker","TimePicker","Autocomplete","Label","ImageView","ProgressBar","Avatar","Badge","Chip","Card","Tooltip","Toast","ScrollView","SplitView","Accordion","Stepper","Modal","Tabs","Dropdown","ListView","Table","TreeView","DataGrid","Chart","Rating","CodeEditor","MediaPlayer","FileExplorer","WebView"],wa=`
195
+ /* Button */
196
+ .stx-button {
197
+ display: inline-flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ gap: 8px;
201
+ padding: 8px 16px;
202
+ border: none;
203
+ border-radius: 6px;
204
+ font-size: 14px;
205
+ font-weight: 500;
206
+ cursor: pointer;
207
+ transition: all 0.15s;
208
+ }
209
+ .stx-button--primary { background: #3498db; color: #fff; }
210
+ .stx-button--primary:hover { background: #2980b9; }
211
+ .stx-button--secondary { background: #6c757d; color: #fff; }
212
+ .stx-button--outline { background: transparent; border: 1px solid #3498db; color: #3498db; }
213
+ .stx-button--ghost { background: transparent; color: #3498db; }
214
+ .stx-button--destructive { background: #e74c3c; color: #fff; }
215
+ .stx-button--small { padding: 4px 8px; font-size: 12px; }
216
+ .stx-button--large { padding: 12px 24px; font-size: 16px; }
217
+ .stx-button--disabled { opacity: 0.5; cursor: not-allowed; }
218
+ .stx-button--loading { pointer-events: none; }
219
+ .stx-button-spinner { width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }
220
+ @keyframes spin { to { transform: rotate(360deg); } }
221
+
222
+ /* Input */
223
+ .stx-input-wrapper { display: flex; flex-direction: column; gap: 4px; }
224
+ .stx-input-label { font-size: 14px; font-weight: 500; color: #333; }
225
+ .stx-input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.15s; }
226
+ .stx-input:focus { outline: none; border-color: #3498db; }
227
+ .stx-input--error { border-color: #e74c3c; }
228
+ .stx-input-error { font-size: 12px; color: #e74c3c; }
229
+ .stx-input-hint { font-size: 12px; color: #666; }
230
+
231
+ /* Checkbox */
232
+ .stx-checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
233
+ .stx-checkbox input { display: none; }
234
+ .stx-checkbox-box { width: 18px; height: 18px; border: 2px solid #ddd; border-radius: 4px; transition: all 0.15s; }
235
+ .stx-checkbox input:checked + .stx-checkbox-box { background: #3498db; border-color: #3498db; }
236
+ .stx-checkbox--disabled { opacity: 0.5; cursor: not-allowed; }
237
+
238
+ /* Progress */
239
+ .stx-progress { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; position: relative; }
240
+ .stx-progress-bar { height: 100%; background: #3498db; transition: width 0.3s; }
241
+ .stx-progress--success .stx-progress-bar { background: #27ae60; }
242
+ .stx-progress--warning .stx-progress-bar { background: #f39c12; }
243
+ .stx-progress--error .stx-progress-bar { background: #e74c3c; }
244
+ .stx-progress--indeterminate .stx-progress-bar { animation: progress-indeterminate 1.5s infinite; }
245
+ @keyframes progress-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
246
+
247
+ /* Badge */
248
+ .stx-badge { display: inline-flex; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; }
249
+ .stx-badge--default { background: #e0e0e0; color: #333; }
250
+ .stx-badge--primary { background: #3498db; color: #fff; }
251
+ .stx-badge--success { background: #27ae60; color: #fff; }
252
+ .stx-badge--warning { background: #f39c12; color: #fff; }
253
+ .stx-badge--error { background: #e74c3c; color: #fff; }
254
+
255
+ /* Avatar */
256
+ .stx-avatar { display: inline-flex; align-items: center; justify-content: center; background: #3498db; color: #fff; overflow: hidden; }
257
+ .stx-avatar--circle { border-radius: 50%; }
258
+ .stx-avatar--square { border-radius: 0; }
259
+ .stx-avatar--rounded { border-radius: 8px; }
260
+ .stx-avatar--small { width: 32px; height: 32px; font-size: 12px; }
261
+ .stx-avatar--medium { width: 40px; height: 40px; font-size: 14px; }
262
+ .stx-avatar--large { width: 56px; height: 56px; font-size: 18px; }
263
+ .stx-avatar-img { width: 100%; height: 100%; object-fit: cover; }
264
+
265
+ /* Card */
266
+ .stx-card { background: #fff; border-radius: 8px; overflow: hidden; }
267
+ .stx-card--outlined { border: 1px solid #e0e0e0; }
268
+ .stx-card--elevated { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
269
+ .stx-card-image img { width: 100%; display: block; }
270
+ .stx-card-body { padding: 16px; }
271
+ .stx-card-title { margin: 0 0 4px; font-size: 18px; }
272
+ .stx-card-subtitle { margin: 0 0 8px; color: #666; font-size: 14px; }
273
+ .stx-card-footer { padding: 12px 16px; border-top: 1px solid #e0e0e0; }
274
+
275
+ /* Tabs */
276
+ .stx-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e0e0e0; }
277
+ .stx-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; color: #666; border-bottom: 2px solid transparent; transition: all 0.15s; }
278
+ .stx-tab:hover { color: #333; }
279
+ .stx-tab--active { color: #3498db; border-bottom-color: #3498db; }
280
+ .stx-tab--disabled { opacity: 0.5; cursor: not-allowed; }
281
+ .stx-tabs--pills { border-bottom: none; }
282
+ .stx-tabs--pills .stx-tab { border-radius: 20px; border-bottom: none; }
283
+ .stx-tabs--pills .stx-tab--active { background: #3498db; color: #fff; }
284
+
285
+ /* Dropdown */
286
+ .stx-dropdown { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; background: #fff; cursor: pointer; min-width: 150px; }
287
+ .stx-dropdown:focus { outline: none; border-color: #3498db; }
288
+ .stx-dropdown--disabled { opacity: 0.5; cursor: not-allowed; }
289
+
290
+ /* Rating */
291
+ .stx-rating { display: inline-flex; gap: 4px; }
292
+ .stx-star { color: #ddd; cursor: pointer; transition: color 0.15s; }
293
+ .stx-star--filled { color: #f1c40f; }
294
+ .stx-star--half { background: linear-gradient(90deg, #f1c40f 50%, #ddd 50%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
295
+ .stx-rating--readonly .stx-star { cursor: default; }
296
+ .stx-rating--small .stx-star { font-size: 16px; }
297
+ .stx-rating--medium .stx-star { font-size: 24px; }
298
+ .stx-rating--large .stx-star { font-size: 32px; }
299
+
300
+ /* Slider */
301
+ .stx-slider { display: flex; align-items: center; gap: 12px; }
302
+ .stx-slider-track { flex: 1; }
303
+ .stx-slider input[type="range"] { width: 100%; }
304
+ .stx-slider-value { min-width: 40px; text-align: right; font-size: 14px; }
305
+
306
+ /* Radio Button */
307
+ .stx-radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
308
+ .stx-radio input { display: none; }
309
+ .stx-radio-circle { width: 18px; height: 18px; border: 2px solid #ddd; border-radius: 50%; position: relative; transition: all 0.15s; }
310
+ .stx-radio input:checked + .stx-radio-circle { border-color: #3498db; }
311
+ .stx-radio input:checked + .stx-radio-circle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 8px; height: 8px; background: #3498db; border-radius: 50%; }
312
+ .stx-radio--disabled { opacity: 0.5; cursor: not-allowed; }
313
+
314
+ /* Color Picker */
315
+ .stx-color-picker { display: flex; flex-direction: column; gap: 8px; }
316
+ .stx-color-picker-input { display: flex; align-items: center; gap: 8px; }
317
+ .stx-color-picker-input input[type="color"] { width: 40px; height: 40px; border: none; cursor: pointer; }
318
+ .stx-color-picker-value { font-family: monospace; }
319
+ .stx-color-picker-presets { display: flex; gap: 4px; flex-wrap: wrap; }
320
+ .stx-color-preset { width: 24px; height: 24px; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
321
+ .stx-color-preset:hover { border-color: #333; }
322
+
323
+ /* Date/Time Picker */
324
+ .stx-date-picker, .stx-time-picker { display: flex; flex-direction: column; gap: 4px; }
325
+ .stx-date-picker-input, .stx-time-picker-input { display: flex; align-items: center; gap: 4px; }
326
+ .stx-date-picker-input input, .stx-time-picker-input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
327
+ .stx-date-picker-clear { background: none; border: none; cursor: pointer; font-size: 16px; }
328
+
329
+ /* Autocomplete */
330
+ .stx-autocomplete { position: relative; }
331
+ .stx-autocomplete-input-wrapper { position: relative; }
332
+ .stx-autocomplete-input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
333
+ .stx-autocomplete-spinner { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border: 2px solid #ddd; border-top-color: #3498db; border-radius: 50%; animation: spin 0.6s linear infinite; }
334
+ .stx-autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ddd; border-radius: 6px; max-height: 200px; overflow-y: auto; display: none; z-index: 10; }
335
+ .stx-autocomplete:focus-within .stx-autocomplete-list { display: block; }
336
+ .stx-autocomplete-item { padding: 8px 12px; cursor: pointer; }
337
+ .stx-autocomplete-item:hover { background: #f5f5f5; }
338
+ .stx-autocomplete-item--selected { background: #e8f4fc; }
339
+
340
+ /* Label */
341
+ .stx-label { display: inline-block; font-weight: 500; }
342
+ .stx-label--small { font-size: 12px; }
343
+ .stx-label--medium { font-size: 14px; }
344
+ .stx-label--large { font-size: 16px; }
345
+ .stx-label-required { color: #e74c3c; margin-left: 2px; }
346
+
347
+ /* Image */
348
+ .stx-image { display: block; max-width: 100%; }
349
+
350
+ /* Chip */
351
+ .stx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 16px; font-size: 13px; }
352
+ .stx-chip--default { background: #e0e0e0; color: #333; }
353
+ .stx-chip--primary { background: #e8f4fc; color: #3498db; }
354
+ .stx-chip--success { background: #e8f8f0; color: #27ae60; }
355
+ .stx-chip--warning { background: #fef5e7; color: #f39c12; }
356
+ .stx-chip--error { background: #fdebeb; color: #e74c3c; }
357
+ .stx-chip--small { padding: 2px 8px; font-size: 11px; }
358
+ .stx-chip--large { padding: 6px 16px; font-size: 15px; }
359
+ .stx-chip-remove { background: none; border: none; cursor: pointer; opacity: 0.6; padding: 0 2px; }
360
+ .stx-chip-remove:hover { opacity: 1; }
361
+
362
+ /* Tooltip */
363
+ .stx-tooltip-wrapper { position: relative; display: inline-block; }
364
+ .stx-tooltip { position: absolute; background: #333; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; z-index: 1000; }
365
+ .stx-tooltip-wrapper:hover .stx-tooltip { opacity: 1; visibility: visible; }
366
+ .stx-tooltip--top { bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; }
367
+ .stx-tooltip--bottom { top: 100%; left: 50%; transform: translateX(-50%); margin-top: 8px; }
368
+ .stx-tooltip--left { right: 100%; top: 50%; transform: translateY(-50%); margin-right: 8px; }
369
+ .stx-tooltip--right { left: 100%; top: 50%; transform: translateY(-50%); margin-left: 8px; }
370
+
371
+ /* Scroll View */
372
+ .stx-scroll-view { overflow: auto; }
373
+ .stx-scroll-view--vertical { overflow-x: hidden; overflow-y: auto; }
374
+ .stx-scroll-view--horizontal { overflow-x: auto; overflow-y: hidden; }
375
+ .stx-scroll-view--hide-scrollbar::-webkit-scrollbar { display: none; }
376
+ .stx-scroll-view--hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
377
+ .stx-scroll-view--smooth { scroll-behavior: smooth; }
378
+
379
+ /* Split View */
380
+ .stx-split-view { display: flex; }
381
+ .stx-split-view--horizontal { flex-direction: row; }
382
+ .stx-split-view--vertical { flex-direction: column; }
383
+ .stx-split-pane { overflow: auto; }
384
+ .stx-split-divider { background: #e0e0e0; flex-shrink: 0; }
385
+ .stx-split-view--horizontal .stx-split-divider { width: 4px; cursor: col-resize; }
386
+ .stx-split-view--vertical .stx-split-divider { height: 4px; cursor: row-resize; }
387
+ .stx-split-divider:hover { background: #3498db; }
388
+
389
+ /* Accordion */
390
+ .stx-accordion { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
391
+ .stx-accordion-item { border-bottom: 1px solid #e0e0e0; }
392
+ .stx-accordion-item:last-child { border-bottom: none; }
393
+ .stx-accordion-header { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: none; border: none; cursor: pointer; font-size: 14px; }
394
+ .stx-accordion-header:hover { background: #f5f5f5; }
395
+ .stx-accordion-icon { transition: transform 0.2s; }
396
+ .stx-accordion-item--open .stx-accordion-icon { transform: rotate(180deg); }
397
+ .stx-accordion-content { padding: 0 16px 16px; }
398
+ .stx-accordion-item--disabled { opacity: 0.5; }
399
+ .stx-accordion-item--disabled .stx-accordion-header { cursor: not-allowed; }
400
+
401
+ /* Stepper */
402
+ .stx-stepper { display: flex; }
403
+ .stx-stepper--horizontal { flex-direction: row; align-items: flex-start; }
404
+ .stx-stepper--vertical { flex-direction: column; }
405
+ .stx-step { display: flex; align-items: center; }
406
+ .stx-stepper--vertical .stx-step { flex-direction: row; }
407
+ .stx-step-indicator { width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; flex-shrink: 0; }
408
+ .stx-step--completed .stx-step-indicator { background: #27ae60; color: #fff; }
409
+ .stx-step--active .stx-step-indicator { background: #3498db; color: #fff; }
410
+ .stx-step-content { margin-left: 12px; }
411
+ .stx-step-label { font-size: 14px; font-weight: 500; }
412
+ .stx-step-description { font-size: 12px; color: #666; }
413
+ .stx-step-connector { flex: 1; height: 2px; background: #e0e0e0; margin: 0 8px; min-width: 20px; }
414
+ .stx-stepper--vertical .stx-step-connector { width: 2px; height: 20px; margin: 8px 0 8px 15px; }
415
+
416
+ /* Modal Component */
417
+ .stx-modal-component--hidden { display: none; }
418
+ .stx-modal-component-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10000; }
419
+ .stx-modal-component-dialog { background: #fff; border-radius: 12px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
420
+ .stx-modal-component--small .stx-modal-component-dialog { width: 300px; }
421
+ .stx-modal-component--medium .stx-modal-component-dialog { width: 500px; }
422
+ .stx-modal-component--large .stx-modal-component-dialog { width: 800px; }
423
+ .stx-modal-component--fullscreen .stx-modal-component-dialog { width: 100%; height: 100%; border-radius: 0; }
424
+ .stx-modal-component-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid #e0e0e0; }
425
+ .stx-modal-component-title { margin: 0; font-size: 18px; }
426
+ .stx-modal-component-close { background: none; border: none; font-size: 24px; cursor: pointer; opacity: 0.6; }
427
+ .stx-modal-component-close:hover { opacity: 1; }
428
+ .stx-modal-component-body { padding: 16px; overflow-y: auto; flex: 1; }
429
+ .stx-modal-component-footer { padding: 16px; border-top: 1px solid #e0e0e0; display: flex; justify-content: flex-end; gap: 8px; }
430
+
431
+ /* List View */
432
+ .stx-list-view { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
433
+ .stx-list-view-items { list-style: none; margin: 0; padding: 0; }
434
+ .stx-list-view-item { padding: 12px 16px; border-bottom: 1px solid #e0e0e0; }
435
+ .stx-list-view-item:last-child { border-bottom: none; }
436
+ .stx-list-view--selectable .stx-list-view-item { cursor: pointer; }
437
+ .stx-list-view--selectable .stx-list-view-item:hover { background: #f5f5f5; }
438
+ .stx-list-view-item--selected { background: #e8f4fc; }
439
+ .stx-list-view-empty { padding: 24px; text-align: center; color: #666; }
440
+
441
+ /* Table */
442
+ .stx-table { overflow-x: auto; }
443
+ .stx-table table { width: 100%; border-collapse: collapse; }
444
+ .stx-table th, .stx-table td { padding: 12px; text-align: left; }
445
+ .stx-table th { font-weight: 600; background: #f5f5f5; }
446
+ .stx-table--bordered th, .stx-table--bordered td { border: 1px solid #e0e0e0; }
447
+ .stx-table--striped tbody tr:nth-child(even) { background: #f9f9f9; }
448
+ .stx-table--hoverable tbody tr:hover { background: #f5f5f5; }
449
+ .stx-table th[data-sortable] { cursor: pointer; }
450
+ .stx-table-sort-icon::after { content: '\u21C5'; margin-left: 4px; opacity: 0.3; }
451
+ .stx-table-sorted .stx-table-sort-icon::after { opacity: 1; }
452
+ .stx-table-sorted--asc .stx-table-sort-icon::after { content: '\u2191'; }
453
+ .stx-table-sorted--desc .stx-table-sort-icon::after { content: '\u2193'; }
454
+
455
+ /* Tree View */
456
+ .stx-tree-view { font-size: 14px; }
457
+ .stx-tree-node { padding-left: 20px; }
458
+ .stx-tree-node-content { display: flex; align-items: center; gap: 4px; padding: 4px; cursor: pointer; border-radius: 4px; }
459
+ .stx-tree-node-content:hover { background: #f5f5f5; }
460
+ .stx-tree-node--selected > .stx-tree-node-content { background: #e8f4fc; }
461
+ .stx-tree-node--disabled { opacity: 0.5; }
462
+ .stx-tree-toggle { width: 16px; cursor: pointer; transition: transform 0.2s; }
463
+ .stx-tree-toggle--expanded { transform: rotate(90deg); }
464
+ .stx-tree-toggle-placeholder { width: 16px; }
465
+ .stx-tree-children { padding-left: 8px; }
466
+
467
+ /* Data Grid */
468
+ .stx-data-grid { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
469
+ .stx-data-grid-table-wrapper { overflow-x: auto; }
470
+ .stx-data-grid-table { width: 100%; border-collapse: collapse; }
471
+ .stx-data-grid-table th, .stx-data-grid-table td { padding: 12px; text-align: left; border-bottom: 1px solid #e0e0e0; }
472
+ .stx-data-grid-table th { background: #f5f5f5; }
473
+ .stx-data-grid-header-cell { display: flex; align-items: center; gap: 8px; }
474
+ .stx-data-grid-sort, .stx-data-grid-filter { background: none; border: none; cursor: pointer; opacity: 0.5; }
475
+ .stx-data-grid-sort:hover, .stx-data-grid-filter:hover { opacity: 1; }
476
+ .stx-data-grid-pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #e0e0e0; }
477
+ .stx-data-grid-page-buttons { display: flex; gap: 4px; }
478
+ .stx-data-grid-page-btn { padding: 4px 8px; border: 1px solid #e0e0e0; background: #fff; cursor: pointer; border-radius: 4px; }
479
+ .stx-data-grid-page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
480
+
481
+ /* Chart */
482
+ .stx-chart { background: #f9f9f9; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
483
+ .stx-chart-placeholder { text-align: center; padding: 20px; }
484
+ .stx-chart-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
485
+ .stx-chart-type { font-size: 14px; color: #666; }
486
+ .stx-chart-info { font-size: 12px; color: #999; margin-top: 4px; }
487
+
488
+ /* Code Editor */
489
+ .stx-code-editor { display: flex; font-family: 'Monaco', 'Menlo', monospace; font-size: 13px; line-height: 1.5; overflow: hidden; border-radius: 8px; }
490
+ .stx-code-editor--dark { background: #1e1e1e; color: #d4d4d4; }
491
+ .stx-code-editor--light { background: #fff; color: #333; border: 1px solid #e0e0e0; }
492
+ .stx-code-editor-gutter { padding: 12px 8px; background: rgba(0,0,0,0.1); text-align: right; user-select: none; }
493
+ .stx-code-editor-line-number { color: #858585; }
494
+ .stx-code-editor-content { flex: 1; padding: 12px; overflow: auto; }
495
+ .stx-code-editor-content pre { margin: 0; }
496
+ .stx-code-editor--wrap .stx-code-editor-content { white-space: pre-wrap; word-wrap: break-word; }
497
+
498
+ /* Media Player */
499
+ .stx-media-player video, .stx-media-player audio { width: 100%; display: block; }
500
+ .stx-media-player--video { background: #000; }
501
+
502
+ /* File Explorer */
503
+ .stx-file-explorer { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
504
+ .stx-file-explorer-list { width: 100%; border-collapse: collapse; }
505
+ .stx-file-explorer-list th { text-align: left; padding: 8px 12px; background: #f5f5f5; font-weight: 500; }
506
+ .stx-file-explorer-list td { padding: 8px 12px; border-top: 1px solid #e0e0e0; }
507
+ .stx-file-explorer-item--selectable { cursor: pointer; }
508
+ .stx-file-explorer-item--selectable:hover { background: #f5f5f5; }
509
+ .stx-file-explorer-icon { margin-right: 8px; }
510
+ .stx-file-explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px; padding: 16px; }
511
+ .stx-file-explorer--grid .stx-file-explorer-item { text-align: center; padding: 12px; border-radius: 8px; }
512
+ .stx-file-explorer--grid .stx-file-explorer-icon { font-size: 32px; display: block; margin-bottom: 8px; }
513
+ .stx-file-explorer--grid .stx-file-explorer-name { font-size: 12px; word-break: break-all; }
514
+
515
+ /* WebView */
516
+ .stx-webview { border: none; display: block; }
517
+
518
+ /* Dark mode support */
519
+ @media (prefers-color-scheme: dark) {
520
+ .stx-input-label { color: #eee; }
521
+ .stx-input { background: #333; border-color: #555; color: #fff; }
522
+ .stx-card { background: #2d2d2d; color: #fff; }
523
+ .stx-card-subtitle { color: #aaa; }
524
+ .stx-progress { background: #444; }
525
+ .stx-dropdown { background: #333; border-color: #555; color: #fff; }
526
+ .stx-accordion { border-color: #444; }
527
+ .stx-accordion-item { border-color: #444; }
528
+ .stx-accordion-header:hover { background: #333; }
529
+ .stx-list-view { border-color: #444; }
530
+ .stx-list-view-item { border-color: #444; }
531
+ .stx-list-view--selectable .stx-list-view-item:hover { background: #333; }
532
+ .stx-table th { background: #333; }
533
+ .stx-table--bordered th, .stx-table--bordered td { border-color: #444; }
534
+ .stx-tree-node-content:hover { background: #333; }
535
+ .stx-data-grid { border-color: #444; }
536
+ .stx-data-grid-table th, .stx-data-grid-table td { border-color: #444; }
537
+ .stx-data-grid-table th { background: #333; }
538
+ .stx-modal-component-dialog { background: #2d2d2d; color: #fff; }
539
+ .stx-modal-component-header, .stx-modal-component-footer { border-color: #444; }
540
+ .stx-file-explorer { border-color: #444; }
541
+ .stx-file-explorer-list th { background: #333; }
542
+ .stx-file-explorer-list td { border-color: #444; }
543
+ .stx-autocomplete-list { background: #333; border-color: #444; }
544
+ .stx-autocomplete-item:hover { background: #444; }
545
+ .stx-chip--default { background: #444; color: #eee; }
546
+ .stx-chip--primary { background: #1a3a52; }
547
+ .stx-chip--success { background: #1a3a2a; }
548
+ .stx-chip--warning { background: #3a2a1a; }
549
+ .stx-chip--error { background: #3a1a1a; }
550
+ }
551
+ `;function we(){return!1}function xt(){return typeof window<"u"&&typeof document<"u"}var B=[];function he(){return`modal-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function me(t){switch(t){case"info":return"&#x2139;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";case"success":return"&#x2714;";case"question":return"&#x2753;";default:return"&#x2139;"}}function J(t){if(t==="question")return[{label:"No",style:"default"},{label:"Yes",style:"primary"}];return[{label:"OK",style:"primary"}]}function ge(t){let{options:e}=t,r=me(e.type),a=e.buttons||J(e.type),n=e.type||"info",o="";return a.forEach((l,s)=>{let c=l.style==="destructive"?"destructive":l.style==="primary"?"primary":"default",d=s===(e.defaultButton??a.length-1)?"autofocus":"";o+=`<button class="stx-modal-btn ${c}" data-index="${s}" ${d}>${l.label}</button>`}),`
552
+ <div class="stx-modal-overlay" data-modal-id="${t.id}">
553
+ <div class="stx-modal ${n}" role="dialog" aria-modal="true" aria-labelledby="${t.id}-title">
554
+ <div class="stx-modal-icon">${r}</div>
555
+ <div class="stx-modal-content">
556
+ ${e.title?`<h2 id="${t.id}-title" class="stx-modal-title">${St(e.title)}</h2>`:""}
557
+ <p class="stx-modal-message">${St(e.message)}</p>
558
+ </div>
559
+ <div class="stx-modal-buttons">${o}</div>
560
+ </div>
561
+ </div>
562
+ `}function St(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function E(t,e,r=!1){let a=B.indexOf(t);if(a>-1)B.splice(a,1);if(t.element&&xt())t.element.remove();let o=(t.options.buttons||J(t.options.type))[e];if(o?.action)o.action();t.resolve({buttonIndex:e,cancelled:r})}async function V(t){let e=we(),r=he();return new Promise((a)=>{let n={id:r,options:t,resolve:a};if(B.push(n),e)console.log(`[stx-modal] Showing native modal: ${t.title||"Modal"}`),setTimeout(()=>{E(n,t.defaultButton??0,!1)},0);else if(xt())try{let o=document.createElement("div");o.innerHTML=ge(n);let l=o.firstElementChild;if(!l){console.log(`[stx-modal] ${t.type?.toUpperCase()||"INFO"}: ${t.title||"Modal"}`),console.log(`[stx-modal] ${t.message}`),setTimeout(()=>{E(n,t.defaultButton??0,!1)},0);return}n.element=l;try{document.body.appendChild(l)}catch{console.log(`[stx-modal] ${t.type?.toUpperCase()||"INFO"}: ${t.title||"Modal"}`),console.log(`[stx-modal] ${t.message}`),setTimeout(()=>{E(n,t.defaultButton??0,!1)},0);return}try{l.querySelectorAll(".stx-modal-btn").forEach((s)=>{s.addEventListener("click",()=>{let c=Number.parseInt(s.dataset.index||"0",10);E(n,c,!1)})})}catch{}try{l.addEventListener("click",(s)=>{if(s.target===l){let c=t.cancelButton??0;E(n,c,!0)}})}catch{}try{let s=(c)=>{if(c.key==="Escape"){let d=t.cancelButton??0;E(n,d,!0),document.removeEventListener("keydown",s)}else if(c.key==="Enter"){let d=t.defaultButton??(t.buttons||J(t.type)).length-1;E(n,d,!1),document.removeEventListener("keydown",s)}};document.addEventListener("keydown",s)}catch{}try{let s=l.querySelector(".stx-modal-btn[autofocus]");if(s)s.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{E(n,t.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${t.type?.toUpperCase()||"INFO"}: ${t.title||"Modal"}`),console.log(`[stx-modal] ${t.message}`),setTimeout(()=>{E(n,t.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${t.type?.toUpperCase()||"INFO"}: ${t.title||"Modal"}`),console.log(`[stx-modal] ${t.message}`);let o=t.buttons||J(t.type);console.log(`[stx-modal] Buttons: ${o.map((l)=>l.label).join(", ")}`),setTimeout(()=>{E(n,t.defaultButton??0,!1)},0)}})}async function ye(t,e){return V({title:t,message:e,type:"info"})}async function ha(t,e){return V({title:t,message:e,type:"warning"})}async function ma(t,e){return V({title:t,message:e,type:"error"})}async function ga(t,e){return V({title:t,message:e,type:"success"})}async function xe(t,e){return V({title:t,message:e,type:"question",buttons:[{label:"No",style:"default"},{label:"Yes",style:"primary"}],defaultButton:1,cancelButton:0})}async function ya(t,e="Confirm"){return(await xe(e,t)).buttonIndex===1}async function xa(t,e="Alert"){await ye(e,t)}async function ba(t,e="",r="Input"){if(xt()&&typeof window.prompt==="function")return window.prompt(t,e);return console.log(`[stx-modal] PROMPT: ${r}`),console.log(`[stx-modal] ${t}`),console.log(`[stx-modal] Default: ${e}`),e}function va(){return B.length}function $a(){while(B.length>0){let t=B[B.length-1];E(t,0,!0)}}var ka=`
563
+ .stx-modal-overlay {
564
+ position: fixed;
565
+ inset: 0;
566
+ background: rgba(0, 0, 0, 0.5);
567
+ display: flex;
568
+ align-items: center;
569
+ justify-content: center;
570
+ z-index: 10000;
571
+ animation: stx-modal-fade-in 0.15s ease-out;
572
+ }
573
+
574
+ @keyframes stx-modal-fade-in {
575
+ from { opacity: 0; }
576
+ to { opacity: 1; }
577
+ }
578
+
579
+ .stx-modal {
580
+ background: #fff;
581
+ border-radius: 12px;
582
+ padding: 24px;
583
+ max-width: 400px;
584
+ width: 90%;
585
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
586
+ animation: stx-modal-slide-up 0.2s ease-out;
587
+ }
588
+
589
+ @keyframes stx-modal-slide-up {
590
+ from { transform: translateY(20px); opacity: 0; }
591
+ to { transform: translateY(0); opacity: 1; }
592
+ }
593
+
594
+ @media (prefers-color-scheme: dark) {
595
+ .stx-modal {
596
+ background: #2d2d2d;
597
+ color: #fff;
598
+ }
599
+ }
600
+
601
+ .stx-modal-icon {
602
+ font-size: 48px;
603
+ text-align: center;
604
+ margin-bottom: 16px;
605
+ }
606
+
607
+ .stx-modal.info .stx-modal-icon { color: #3498db; }
608
+ .stx-modal.warning .stx-modal-icon { color: #f39c12; }
609
+ .stx-modal.error .stx-modal-icon { color: #e74c3c; }
610
+ .stx-modal.success .stx-modal-icon { color: #27ae60; }
611
+ .stx-modal.question .stx-modal-icon { color: #9b59b6; }
612
+
613
+ .stx-modal-content {
614
+ text-align: center;
615
+ margin-bottom: 24px;
616
+ }
617
+
618
+ .stx-modal-title {
619
+ margin: 0 0 8px;
620
+ font-size: 20px;
621
+ font-weight: 600;
622
+ }
623
+
624
+ .stx-modal-message {
625
+ margin: 0;
626
+ color: #666;
627
+ line-height: 1.5;
628
+ }
629
+
630
+ @media (prefers-color-scheme: dark) {
631
+ .stx-modal-message { color: #aaa; }
632
+ }
633
+
634
+ .stx-modal-buttons {
635
+ display: flex;
636
+ gap: 8px;
637
+ justify-content: center;
638
+ }
639
+
640
+ .stx-modal-btn {
641
+ padding: 10px 24px;
642
+ border-radius: 6px;
643
+ font-size: 14px;
644
+ font-weight: 500;
645
+ cursor: pointer;
646
+ border: none;
647
+ transition: background 0.15s, transform 0.1s;
648
+ }
649
+
650
+ .stx-modal-btn:hover {
651
+ transform: translateY(-1px);
652
+ }
653
+
654
+ .stx-modal-btn:active {
655
+ transform: translateY(0);
656
+ }
657
+
658
+ .stx-modal-btn.default {
659
+ background: #e0e0e0;
660
+ color: #333;
661
+ }
662
+
663
+ .stx-modal-btn.default:hover {
664
+ background: #d0d0d0;
665
+ }
666
+
667
+ .stx-modal-btn.primary {
668
+ background: #3498db;
669
+ color: #fff;
670
+ }
671
+
672
+ .stx-modal-btn.primary:hover {
673
+ background: #2980b9;
674
+ }
675
+
676
+ .stx-modal-btn.destructive {
677
+ background: #e74c3c;
678
+ color: #fff;
679
+ }
680
+
681
+ .stx-modal-btn.destructive:hover {
682
+ background: #c0392b;
683
+ }
684
+
685
+ @media (prefers-color-scheme: dark) {
686
+ .stx-modal-btn.default {
687
+ background: #444;
688
+ color: #fff;
689
+ }
690
+ .stx-modal-btn.default:hover {
691
+ background: #555;
692
+ }
693
+ }
694
+ `;function be(){if(At.platform)return At.platform;return"unknown"}function Rt(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function Wt(t,e){if(t.type==="separator")return{id:`sep-${e}`,label:"",type:"separator"};let r={id:`item-${e}-${t.label.replace(/\s+/g,"-").toLowerCase()}`,label:t.label,type:t.type||"normal",enabled:t.enabled!==!1};if(t.accelerator)r.shortcut=t.accelerator;if(t.type==="checkbox")r.checked=t.checked||!1;if(t.type==="submenu"&&t.submenu)r.submenu=t.submenu.map((a,n)=>Wt(a,n));return r}function ht(t){return t.map((e,r)=>Wt(e,r))}function Ot(t,e=0){if(t.type==="separator")return'<hr class="stx-tray-separator" />';let r=" ".repeat(e),a=t.enabled===!1?"disabled":"",n=t.checked?"\u2713 ":"",o=t.accelerator?`<span class="accelerator">${t.accelerator}</span>`:"",l=`${r}<div class="stx-tray-item ${a}" data-action="${t.label}">`;if(l+=`<span class="label">${n}${t.label}</span>${o}`,t.type==="submenu"&&t.submenu){l+='<span class="arrow">\u25B8</span>',l+='<div class="stx-tray-submenu">';for(let s of t.submenu)l+=Ot(s,e+1);l+="</div>"}return l+="</div>",l}function ve(t){let e='<div class="stx-tray-menu">';for(let r of t)e+=Ot(r);return e+="</div>",e}var z=new Map;function $e(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var _t=!1;function ke(){if(_t||typeof window>"u")return;window.addEventListener("craft:tray:menu",(t)=>{let{action:e}=t.detail;for(let r of z.values()){let a=r.handlers.get(e);if(a){a();break}}}),_t=!0}async function Se(t={}){let e=$e(),r=be(),a=Rt(),n={icon:t.icon||"",tooltip:t.tooltip||"stx Application",menu:t.menu||[],visible:!0},o=new Map;for(let s of t.menu||[]){if(s.type!=="separator"&&s.onClick)o.set(s.label,s.onClick);if(s.type==="submenu"&&s.submenu){for(let c of s.submenu)if(c.type!=="separator"&&c.onClick)o.set(c.label,c.onClick)}}if(z.set(e,{state:n,handlers:o}),a){ke();let s=window;try{if(n.tooltip)await s.craft.tray.setTitle({title:n.tooltip}),await s.craft.tray.setTooltip({tooltip:n.tooltip});if(n.icon)await s.craft.tray.setIcon({icon:n.icon});let c=ht(n.menu);await s.craft.tray.setMenu({items:c}),console.log(`[stx-tray] Native tray created for ${r}`)}catch(c){console.warn("[stx-tray] Failed to create native tray:",c)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${e}`),console.log(`[stx-tray] Tooltip: ${n.tooltip}`),console.log(`[stx-tray] Menu items: ${n.menu.length}`);return{id:e,setIcon:(s)=>{if(n.icon=s,a)window.craft.tray.setIcon({icon:s}).catch((d)=>{console.warn("[stx-tray] Failed to set icon:",d)});console.log(`[stx-tray:${e}] Icon updated`)},setTooltip:(s)=>{if(n.tooltip=s,a)window.craft.tray.setTooltip({tooltip:s}).catch((d)=>{console.warn("[stx-tray] Failed to set tooltip:",d)});console.log(`[stx-tray:${e}] Tooltip: ${s}`)},setMenu:(s)=>{n.menu=s,o.clear();for(let c of s){if(c.type!=="separator"&&c.onClick)o.set(c.label,c.onClick);if(c.type==="submenu"&&c.submenu){for(let d of c.submenu)if(d.type!=="separator"&&d.onClick)o.set(d.label,d.onClick)}}if(a){let c=window,d=ht(s);c.craft.tray.setMenu({items:d}).catch((f)=>{console.warn("[stx-tray] Failed to set menu:",f)})}console.log(`[stx-tray:${e}] Menu updated (${s.length} items)`)},destroy:()=>{if(n.visible=!1,z.delete(e),a)window.craft.tray.destroy?.().catch((c)=>{console.warn("[stx-tray] Failed to destroy tray:",c)});console.log(`[stx-tray:${e}] Destroyed`)}}}var Aa=Se;function _a(){return Array.from(z.keys())}function Ca(t){let e=z.get(t);if(!e)return null;let r=Rt();return{id:t,setIcon:(a)=>{if(e.state.icon=a,r)window.craft.tray.setIcon({icon:a}).catch(()=>{})},setTooltip:(a)=>{if(e.state.tooltip=a,r)window.craft.tray.setTooltip({tooltip:a}).catch(()=>{})},setMenu:(a)=>{if(e.state.menu=a,r){let n=window,o=ht(a);n.craft.tray.setMenu({items:o}).catch(()=>{})}},destroy:()=>{if(z.delete(t),r)window.craft.tray.destroy?.().catch(()=>{})}}}function Ta(t,e){let r=z.get(t);if(!r)return!1;let a=r.handlers.get(e);if(a)return a(),!0;return!1}function Ea(t){let e=z.get(t);if(!e)return null;return ve(e.state.menu)}function Da(){return`
695
+ // STX Desktop Tray Bridge
696
+ // Provides convenient wrappers around window.craft.tray APIs
697
+ window.stxTray = {
698
+ setTitle: (title) => window.craft?.tray?.setTitle({ title }),
699
+ setTooltip: (tooltip) => window.craft?.tray?.setTooltip({ tooltip }),
700
+ setIcon: (icon) => window.craft?.tray?.setIcon({ icon }),
701
+ setMenu: (items) => window.craft?.tray?.setMenu({ items }),
702
+ destroy: () => window.craft?.tray?.destroy(),
703
+
704
+ // Check if tray is available
705
+ isAvailable: () => typeof window.craft?.tray !== 'undefined',
706
+ };
707
+ `}var Ma=`
708
+ .stx-tray-menu {
709
+ background: #2d2d2d;
710
+ border-radius: 8px;
711
+ padding: 4px 0;
712
+ min-width: 200px;
713
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
714
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
715
+ font-size: 13px;
716
+ color: #fff;
717
+ }
718
+
719
+ .stx-tray-item {
720
+ padding: 6px 12px;
721
+ display: flex;
722
+ align-items: center;
723
+ justify-content: space-between;
724
+ cursor: pointer;
725
+ position: relative;
726
+ }
727
+
728
+ .stx-tray-item:hover {
729
+ background: #3d3d3d;
730
+ }
731
+
732
+ .stx-tray-item.disabled {
733
+ opacity: 0.5;
734
+ cursor: not-allowed;
735
+ }
736
+
737
+ .stx-tray-item .label {
738
+ flex: 1;
739
+ }
740
+
741
+ .stx-tray-item .accelerator {
742
+ margin-left: 20px;
743
+ opacity: 0.6;
744
+ font-size: 12px;
745
+ }
746
+
747
+ .stx-tray-item .arrow {
748
+ margin-left: 8px;
749
+ font-size: 10px;
750
+ }
751
+
752
+ .stx-tray-separator {
753
+ margin: 4px 0;
754
+ border: none;
755
+ border-top: 1px solid #444;
756
+ }
757
+
758
+ .stx-tray-submenu {
759
+ position: absolute;
760
+ left: 100%;
761
+ top: 0;
762
+ background: #2d2d2d;
763
+ border-radius: 8px;
764
+ padding: 4px 0;
765
+ min-width: 150px;
766
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
767
+ display: none;
768
+ }
769
+
770
+ .stx-tray-item:hover > .stx-tray-submenu {
771
+ display: block;
772
+ }
773
+ `;function nt(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function Ia(t={}){if(nt()){let e=window;try{return await e.craft.dialog.showOpenDialog(t)}catch(r){console.warn("[stx-dialog] Failed to show native open dialog:",r)}}return new Promise((e)=>{if(typeof document>"u"){e({canceled:!0,filePaths:[]});return}let r=document.createElement("input");if(r.type="file",r.multiple=t.multiSelections??!1,t.filters?.length){let a=t.filters.flatMap((n)=>n.extensions.map((o)=>`.${o}`));r.accept=a.join(",")}if(t.canChooseDirectories&&!t.canChooseFiles)r.webkitdirectory=!0;r.onchange=()=>{let a=Array.from(r.files||[]);if(a.length===0)e({canceled:!0,filePaths:[]});else{let n=a.map((o)=>o.name);e({canceled:!1,filePaths:n})}},r.oncancel=()=>{e({canceled:!0,filePaths:[]})},r.click()})}async function La(t={}){if(nt()){let r=window;try{return await r.craft.dialog.showSaveDialog(t)}catch(a){console.warn("[stx-dialog] Failed to show native save dialog:",a)}}if(typeof window<"u"&&"showSaveFilePicker"in window)try{let r=t.filters?.map((n)=>({description:n.name,accept:{"*/*":n.extensions.map((o)=>`.${o}`)}}));return{canceled:!1,filePath:(await window.showSaveFilePicker({suggestedName:t.defaultPath,types:r})).name}}catch(r){return{canceled:!0}}console.warn("[stx-dialog] Save dialog not available, using prompt fallback");let e=prompt("Enter filename:",t.defaultPath||"file.txt");if(e)return{canceled:!1,filePath:e};return{canceled:!0}}async function it(t){if(nt()){let a=window;try{return await a.craft.dialog.showMessageBox(t)}catch(n){console.warn("[stx-dialog] Failed to show native message box:",n)}}let e=t.buttons||["OK"];if(e.length===1)return alert(t.message),{response:0};if(e.length===2&&t.type==="question")return{response:confirm(t.message)?1:0};return console.warn("[stx-dialog] Complex message box not fully supported in browser, using confirm"),{response:confirm(`${t.message}
774
+
775
+ ${e.join(" / ")}`)?e.length-1:0}}async function Pa(t={}){if(nt()){let e=window;try{return await e.craft.dialog.showColorPicker(t)}catch(r){console.warn("[stx-dialog] Failed to show native color picker:",r)}}return new Promise((e)=>{if(typeof document>"u"){e({canceled:!0});return}let r=document.createElement("input");r.type="color",r.value=t.color||"#000000",r.onchange=()=>{e({canceled:!1,color:r.value})},r.oncancel=()=>{e({canceled:!0})},r.click()})}async function za(t,e){await it({type:"info",title:e||"Alert",message:t,buttons:["OK"]})}async function Na(t,e){return(await it({type:"question",title:e||"Confirm",message:t,buttons:["Cancel","OK"],defaultButton:1,cancelButton:0})).response===1}async function Ba(t,e){await it({type:"error",title:e||"Error",message:t,buttons:["OK"]})}async function Fa(t,e){await it({type:"warning",title:e||"Warning",message:t,buttons:["OK"]})}function Ra(){return`
776
+ // STX Desktop Dialog Bridge
777
+ // Provides convenient wrappers around window.craft.dialog APIs
778
+ window.stxDialog = {
779
+ // File dialogs
780
+ showOpenDialog: (options) => window.craft?.dialog?.showOpenDialog(options),
781
+ showSaveDialog: (options) => window.craft?.dialog?.showSaveDialog(options),
782
+
783
+ // Message dialogs
784
+ showMessageBox: (options) => window.craft?.dialog?.showMessageBox(options),
785
+
786
+ // Color picker
787
+ showColorPicker: (options) => window.craft?.dialog?.showColorPicker(options),
788
+
789
+ // Font picker
790
+ showFontPicker: (options) => window.craft?.dialog?.showFontPicker(options),
791
+
792
+ // Convenience functions
793
+ alert: async (message, title) => {
794
+ return window.craft?.dialog?.showMessageBox({
795
+ type: 'info',
796
+ title: title || 'Alert',
797
+ message,
798
+ buttons: ['OK'],
799
+ });
800
+ },
801
+
802
+ confirm: async (message, title) => {
803
+ const result = await window.craft?.dialog?.showMessageBox({
804
+ type: 'question',
805
+ title: title || 'Confirm',
806
+ message,
807
+ buttons: ['Cancel', 'OK'],
808
+ });
809
+ return result?.response === 1;
810
+ },
811
+
812
+ error: async (message, title) => {
813
+ return window.craft?.dialog?.showMessageBox({
814
+ type: 'error',
815
+ title: title || 'Error',
816
+ message,
817
+ buttons: ['OK'],
818
+ });
819
+ },
820
+
821
+ // Check if dialog is available
822
+ isAvailable: () => typeof window.craft?.dialog !== 'undefined',
823
+ };
824
+ `}var W={};function ja(t){W={...W,...t}}function Ua(){return{...W}}function Va(){W={}}function bt(t){if(!t.sidebarConfig)return;let e={...t.sidebarConfig};if(e.variant==="desktop")e.material=e.material??"sidebar",e.backgroundEffect=e.backgroundEffect??"shimmer",e.allowsVibrancy=e.allowsVibrancy??!0;return e}function Z(){let t=[M.env.CRAFT_BINARY_PATH,W.craftBinaryPath,...W.additionalSearchPaths||[],Ce(_e(M.execPath),"craft")];for(let e of t)if(e&&Ae(e))return e;return gt()}var D=new Map;function Ka(){return Array.from(D.keys())}function Ya(t){let e=D.get(t);if(!e)return null;return Q(t,e.app)}function Xa(){for(let[t,e]of D)try{e.app?.close?.()}catch(r){console.warn(`Failed to close window ${t}:`,r)}D.clear()}function Q(t,e){return{id:t,show:()=>{console.log(`[stx/desktop] Window ${t} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let r=D.get(t);if(r?.app)r.app.close(),D.delete(t),console.log(`[stx/desktop] Window ${t} closed`)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:(r)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${r}" }) from inside the webview`)},loadURL:(r)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${r}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function qt(t,e={}){let r=["--url",t,"--title",e.title||"stx Desktop","--width",String(e.width??1200),"--height",String(e.height??800)];if(e.darkMode)r.push("--dark");if(e.hotReload)r.push("--hot-reload");if(e.resizable===!1)r.push("--no-resize");if(e.frameless)r.push("--frameless");if(e.alwaysOnTop)r.push("--always-on-top");if(e.titlebarHidden)r.push("--titlebar-hidden");if(e.systemTray)r.push("--system-tray");if(e.hideDockIcon)r.push("--hide-dock-icon");if(e.devTools===!1)r.push("--no-devtools");if(e.nativeSidebar)r.push("--native-sidebar");if(e.sidebarWidth!==void 0)r.push("--sidebar-width",String(e.sidebarWidth));let a=bt(e);if(a)r.push("--sidebar-config",JSON.stringify(a));return r}async function Ga(t,e={}){let r=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,a=Z();try{let{createApp:n}=await import("./chunk-va0pc7hx.js"),o=n({url:t,craftPath:a,window:{title:e.title||"stx Desktop",width:e.width??1200,height:e.height??800,darkMode:e.darkMode??!1,hotReload:e.hotReload??!1,resizable:e.resizable??!0,frameless:e.frameless??!1,alwaysOnTop:e.alwaysOnTop??!1,titlebarHidden:e.titlebarHidden??!1,systemTray:e.systemTray??!1,hideDockIcon:e.hideDockIcon??!1,devTools:e.devTools??!1,nativeSidebar:e.nativeSidebar??!1,sidebarWidth:e.sidebarWidth,sidebarConfig:bt(e)}});return D.set(r,{app:o,url:t,options:e}),await o.show(),Q(r,o)}catch{try{let{spawn:n}=await import("child_process"),o=n(a,qt(t,e),{stdio:"inherit"});o.on("error",(s)=>{console.error(s.code==="ENOENT"?rt(a):`craft child error: ${s.message}`)});let l={close:()=>o.kill()};return D.set(r,{app:l,url:t,options:e}),Q(r,l)}catch(n){return console.error("Failed to spawn craft binary:",n.message),null}}}async function Ja(t,e={}){let r=`http://localhost:${t}/`;if(M.env.NODE_ENV==="test"||M.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:n}=await import("./chunk-va0pc7hx.js");console.log("\u26A1 Opening native window via craft-native\u2026");let o=!e.nativeSidebar,l=bt(e),s=n({url:r,craftPath:Z(),window:{title:e.title||"stx Development",width:e.width||1400,height:e.height||900,resizable:!0,systemTray:o,darkMode:e.darkMode??!0,hotReload:e.hotReload??!0,devTools:!0,titlebarHidden:e.titlebarHidden??!1,nativeSidebar:e.nativeSidebar??!1,sidebarWidth:e.sidebarWidth??260,sidebarConfig:l}}),c=`dev-window-${t}`;return D.set(c,{app:s,url:r,options:e}),await s.show(),console.log(`\u2713 Native window opened at ${r}`),!0}catch{let n=Z();try{console.log(`\u26A1 Opening native window via craft binary (${n})\u2026`);let{spawn:o}=await import("child_process"),l=o(n,qt(r,{title:"stx Development",width:1400,height:900,hotReload:!0,...e}),{stdio:"inherit"});l.on("exit",()=>M.exit(0)),l.on("error",(c)=>{console.warn(c.code==="ENOENT"?rt(n):`craft child error: ${c.message}`)});let s=`dev-window-${t}`;return D.set(s,{app:{close:()=>l.kill()},url:r,options:e}),console.log(`\u2713 Native window opened at ${r}`),!0}catch(o){console.warn("\u26A0 Could not spawn craft binary:",o.message)}if(M.env.NODE_ENV==="test"||M.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:o}=await import("child_process"),l=M.platform;return o(l==="darwin"?"open":l==="win32"?"cmd":"xdg-open",l==="win32"?["/c","start",r]:[r],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${r}`),!0}catch(o){return console.error("Could not open browser:",o),console.log(`Please open manually: ${r}`),!1}}}async function Za(t,e={}){let{title:r="stx Desktop",width:a=1200,height:n=800,darkMode:o=!1,hotReload:l=!1,resizable:s=!0,frameless:c=!1,alwaysOnTop:d=!1}=e;try{let{createApp:f}=await import("./chunk-va0pc7hx.js"),p=Z(),u=f({html:t,craftPath:p,window:{title:r,width:a,height:n,darkMode:o,hotReload:l,resizable:s,frameless:c,alwaysOnTop:d}}),h=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(h,{app:u,url:"html-content",options:e}),await u.show(),Q(h,u)}catch(f){return console.error("Failed to create window with HTML:",f),null}}function Qa(){try{return se.resolve("craft-native"),!0}catch{return!1}}function tn(){return`
825
+ // STX Desktop Window Bridge
826
+ // Provides convenient wrappers around window.craft APIs
827
+ window.stxWindow = {
828
+ // Window control
829
+ hide: () => window.craft?.window?.hide(),
830
+ show: () => window.craft?.window?.show(),
831
+ toggle: () => window.craft?.window?.toggle(),
832
+ close: () => window.craft?.window?.close(),
833
+ minimize: () => window.craft?.window?.minimize(),
834
+ maximize: () => window.craft?.window?.maximize(),
835
+ focus: () => window.craft?.window?.focus(),
836
+ center: () => window.craft?.window?.center(),
837
+ reload: () => window.craft?.window?.reload(),
838
+ toggleFullscreen: () => window.craft?.window?.toggleFullscreen(),
839
+
840
+ // Window properties
841
+ setTitle: (title) => window.craft?.window?.setTitle({ title }),
842
+ setSize: (width, height) => window.craft?.window?.setSize({ width, height }),
843
+ setPosition: (x, y) => window.craft?.window?.setPosition({ x, y }),
844
+ setAlwaysOnTop: (alwaysOnTop) => window.craft?.window?.setAlwaysOnTop({ alwaysOnTop }),
845
+ setResizable: (resizable) => window.craft?.window?.setResizable({ resizable }),
846
+ setOpacity: (opacity) => window.craft?.window?.setOpacity({ opacity }),
847
+
848
+ // macOS-specific
849
+ setVibrancy: (vibrancy) => window.craft?.window?.setVibrancy({ vibrancy }),
850
+
851
+ // App control
852
+ quit: () => window.craft?.app?.quit(),
853
+ isDarkMode: () => window.craft?.app?.isDarkMode(),
854
+ getLocale: () => window.craft?.app?.getLocale(),
855
+
856
+ // Notifications
857
+ notify: (options) => window.craft?.app?.notify(options),
858
+
859
+ // Check if running in Craft
860
+ isCraftAvailable: () => typeof window.craft !== 'undefined',
861
+ };
862
+
863
+ // Expose as global for backwards compatibility
864
+ window.desktop = window.stxWindow;
865
+ `}var Te="update.json";function Ee(t,e){return`https://github.com/${t}/releases/latest/download/${e}`}function De(t,e,r){return`https://github.com/${t}/releases/download/${e}/${r}`}function nn(t){let{repository:e,manifestAsset:r=Te,...a}=t;return new zt({...a,updateUrl:Ee(e,r)})}function on(t){let e=t.tag??`v${t.version}`,r={};for(let[a,n]of Object.entries(t.artifacts)){if(!n)continue;r[a]={path:n,url:De(t.repository,e,n.split("/").pop())}}return Nt({version:t.version,releaseNotes:t.releaseNotes,platforms:r})}var mt=null,C=null;class Ht{_process;_startedAt;_endsAt;_options;_expireHandlers=[];_expireTimer=null;_stopped=!1;constructor(t,e){this._process=t,this._options=e,this._startedAt=new Date;let r=e.duration;if(r&&r>0){let a=r*60*1000;this._endsAt=new Date(this._startedAt.getTime()+a),this._expireTimer=setTimeout(()=>{this._stopped=!0;for(let n of this._expireHandlers)try{n()}catch{}},a)}else this._endsAt=null}get pid(){return this._process.pid}get startedAt(){return this._startedAt}get endsAt(){return this._endsAt}get options(){return{...this._options}}get isActive(){if(this._stopped)return!1;return this._process.exitCode===null}get remainingMs(){if(!this._endsAt)return null;let t=this._endsAt.getTime()-Date.now();return Math.max(0,t)}get elapsedMs(){return Date.now()-this._startedAt.getTime()}stop(){if(this._stopped)return;if(this._stopped=!0,this._expireTimer)clearTimeout(this._expireTimer),this._expireTimer=null;try{this._process.kill()}catch{}}onExpire(t){this._expireHandlers.push(t)}}function sn(t={}){Me();let{duration:e,preventDisplaySleep:r=!0,preventIdleSleep:a=!0,preventSystemSleep:n=!0,preventDiskSleep:o=!1,assertUserActivity:l=!0}=t,s=[];if(r)s.push("-d");if(a)s.push("-i");if(n)s.push("-s");if(o)s.push("-m");if(l)s.push("-u");let c=[...s];if(e&&e>0)c.push("-t",String(e*60));let d=Bun.spawn(["/usr/bin/caffeinate",...c],{stdio:["ignore","ignore","ignore"]}),f=new Ht(d,t);return mt=d,C=f,f}function Me(t){if(t){if(t.stop(),C===t)mt=null,C=null;return}if(C)C.stop();mt=null,C=null}function cn(){return C!==null&&C.isActive}function ln(){if(!C||!C.isActive)return{active:!1,instance:null,startedAt:null,endsAt:null,durationMinutes:null};let e=C.options.duration;return{active:!0,instance:C,startedAt:C.startedAt,endsAt:C.endsAt,durationMinutes:e&&e>0?e:-1}}function dn(t){let e=t||C;if(!e||!e.isActive)return"0:00";let r=e.remainingMs;if(r===null)return"\u221E";let a=Math.ceil(r/1000),n=Math.floor(a/3600),o=Math.floor(a%3600/60),l=a%60;if(n>0)return`${n}:${String(o).padStart(2,"0")}:${String(l).padStart(2,"0")}`;return`${o}:${String(l).padStart(2,"0")}`}function un(t){if(t<=0||t===-1)return"Indefinitely";if(t<60)return`${t} minutes`;if(t===60)return"1 hour";if(t%60===0)return`${t/60} hours`;let e=Math.floor(t/60),r=t%60;return`${e}h ${r}m`}function Re(t){let e=Be(),r=Ne();switch(e){case"darwin":return j(r,"Library","Application Support",t);case"win32":return j(process.env.APPDATA||j(r,"AppData","Roaming"),t);default:return j(r,".config",t)}}class jt{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(t){this._defaults={...t.defaults};let e=t.path?Fe(t.path):Re(t.name);if(this._path=t.path||j(e,"preferences.json"),!st(e))Ie(e,{recursive:!0});if(this._data=this._load(),t.watch!==!1)this._setupWatcher()}get path(){return this._path}get(t){if(t in this._data)return this._data[t];return this._defaults[t]}set(t,e){let r=this.get(t);if(JSON.stringify(r)===JSON.stringify(e))return;this._data[t]=e,this._scheduleSave(),this._notifyChange(t,e,r)}getAll(){return{...this._defaults,...this._data}}has(t){return t in this._data}delete(t){if(!(t in this._data))return;let e=this._data[t];delete this._data[t],this._scheduleSave(),this._notifyChange(t,this._defaults[t],e)}reset(){let t={...this._data};this._data={},this._save();for(let e of Object.keys(t)){let r=this._defaults[e];this._notifyChange(e,r,t[e])}}onChange(t,e){let r=t;if(!this._changeHandlers.has(r))this._changeHandlers.set(r,new Set);return this._changeHandlers.get(r).add(e),()=>{this._changeHandlers.get(r)?.delete(e)}}onAnyChange(t){return this._anyChangeHandlers.add(t),()=>{this._anyChangeHandlers.delete(t)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(st(this._path)){let t=Le(this._path,"utf-8");return JSON.parse(t)}}catch{}return{}}_save(){this._writing=!0;try{let t=JSON.stringify({...this._defaults,...this._data},null,2);ze(this._path,t,"utf-8")}catch(t){console.error(`Failed to save preferences to ${this._path}:`,t)}finally{setTimeout(()=>{this._writing=!1},100)}}_scheduleSave(){if(this._writeTimer)clearTimeout(this._writeTimer);this._writeTimer=setTimeout(()=>{this._writeTimer=null,this._save()},50)}_setupWatcher(){try{if(!st(this._path))this._save();this._watcher=Pe(this._path,()=>{if(this._writing)return;let t=this._load(),e={...this._data};this._data=t;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let a of r){let n=a in e?e[a]:this._defaults[a],o=a in t?t[a]:this._defaults[a];if(JSON.stringify(n)!==JSON.stringify(o))this._notifyChange(a,o,n)}})}catch{}}_notifyChange(t,e,r){let a=this._changeHandlers.get(t);if(a)for(let n of a)try{n(e,r)}catch{}for(let n of this._anyChangeHandlers)try{n(t,e,r)}catch{}}}function hn(t){return new jt(t)}function Xt(t){let e=t.toLowerCase().replace(/[^a-z0-9]/g,"-");return q(ot(),"Library","LaunchAgents",`com.${e}.plist`)}function Gt(t){let e=process.env.XDG_CONFIG_HOME||q(ot(),".config");return q(e,"autostart",`${t.toLowerCase()}.desktop`)}async function Oe(t,e){let r=e.appName||"StxApp",a=Xt(r),n=q(ot(),"Library","LaunchAgents");if(t){let o=e.appPath||process.execPath,l=e.args||[],s=[o,...l],c=`<?xml version="1.0" encoding="UTF-8"?>
866
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
867
+ <plist version="1.0">
868
+ <dict>
869
+ <key>Label</key>
870
+ <string>com.${r.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
871
+ <key>ProgramArguments</key>
872
+ <array>
873
+ ${s.map((d)=>` <string>${Ue(d)}</string>`).join(`
874
+ `)}
875
+ </array>
876
+ <key>RunAtLoad</key>
877
+ <true/>
878
+ <key>KeepAlive</key>
879
+ <false/>
880
+ ${e.isHidden?` <key>ProcessType</key>
881
+ <string>Background</string>`:""}
882
+ </dict>
883
+ </plist>`;if(!O(n))Ut(n,{recursive:!0});Kt(a,c,"utf-8")}else if(O(a))Vt(a)}async function qe(t,e){let r=e.appName||"StxApp",a=Gt(r),n=q(process.env.XDG_CONFIG_HOME||q(ot(),".config"),"autostart");if(t){let o=e.appPath||process.execPath,l=e.args||[],s=[o,...l].join(" "),c=`[Desktop Entry]
884
+ Type=Application
885
+ Name=${r}
886
+ Exec=${s}
887
+ Terminal=false
888
+ StartupNotify=false
889
+ ${e.isHidden?`X-GNOME-Autostart-enabled=true
890
+ NoDisplay=true`:""}
891
+ `;if(!O(n))Ut(n,{recursive:!0});Kt(a,c,"utf-8")}else if(O(a))Vt(a)}async function He(t){return O(Xt(t))}async function je(t){let e=Gt(t);if(!O(e))return!1;try{let r=We(e,"utf-8");if(r.includes("X-GNOME-Autostart-enabled=false"))return!1;if(r.includes("Hidden=true"))return!1;return!0}catch{return!1}}function Ue(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function xn(t,e={}){let r=Yt();switch(r){case"darwin":return Oe(t,e);case"linux":return qe(t,e);default:throw Error(`Auto-launch is not yet supported on ${r}`)}}async function bn(t){let e=t||"StxApp";switch(Yt()){case"darwin":return He(e);case"linux":return je(e);default:return!1}}var P=new Map,Ve=0,tt=!1;function Ke(t){let e=t.split("+").map((a)=>a.trim()),r={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let a of e){let n=a.toLowerCase();switch(n){case"cmd":case"command":case"meta":case"\u2318":r.meta=!0;break;case"ctrl":case"control":case"\u2303":r.ctrl=!0;break;case"shift":case"\u21E7":r.shift=!0;break;case"alt":case"option":case"opt":case"\u2325":r.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")r.meta=!0;else r.ctrl=!0;break;default:r.key=n}}return r}function vn(t){let e=[];if(t.ctrl)e.push("\u2303");if(t.alt)e.push("\u2325");if(t.shift)e.push("\u21E7");if(t.meta)e.push("\u2318");return e.push(t.key.toUpperCase()),e.join("")}function Ye(t,e){if(e.meta!==t.metaKey)return!1;if(e.ctrl!==t.ctrlKey)return!1;if(e.shift!==t.shiftKey)return!1;if(e.alt!==t.altKey)return!1;return t.key.toLowerCase()===e.key||t.code.toLowerCase()===`key${e.key}`}function Jt(t){for(let[,e]of P)if(Ye(t,e.parsed)){t.preventDefault(),t.stopPropagation();try{e.handler()}catch{}break}}function Xe(){if(tt)return;if(typeof document>"u")return;document.addEventListener("keydown",Jt,!0),tt=!0}function vt(){if(!tt)return;if(typeof document>"u")return;document.removeEventListener("keydown",Jt,!0),tt=!1}async function Ge(t,e){if(typeof window>"u")return!1;let r=window.craft;if(!r?.hotkeys?.register)return!1;try{return await r.hotkeys.register(t,e),!0}catch{return!1}}async function $t(t){if(typeof window>"u")return;let e=window.craft;if(!e?.hotkeys?.unregister)return;try{await e.hotkeys.unregister(t)}catch{}}function $n(t,e){let r=`hotkey_${++Ve}_${Date.now()}`,a=Ke(t);P.set(r,{shortcut:t,handler:e,parsed:a}),Ge(r,t),Xe();let n={shortcut:t,id:r,unregister(){Je(n)}};return n}function Je(t){if(P.delete(t.id),$t(t.id),P.size===0)vt()}function kn(){for(let[t]of P)$t(t);P.clear(),vt()}function Sn(){return Array.from(P.entries()).map(([t,e])=>({shortcut:e.shortcut,id:t,unregister(){if(P.delete(t),$t(t),P.size===0)vt()}}))}class Zt{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(t){if(this._duration=t.duration,this._tickInterval=t.tickInterval||1000,this._remaining=t.duration,t.onComplete)this._completionHandlers.add(t.onComplete);if(t.onTick)this._tickHandlers.add(t.onTick);if(t.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let t=Date.now()-this._lastTick;return Math.max(0,this._remaining-t)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let t=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-t),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(t){return this._completionHandlers.add(t),()=>{this._completionHandlers.delete(t)}}onTick(t){return this._tickHandlers.add(t),()=>{this._tickHandlers.delete(t)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let t=Date.now(),e=t-this._lastTick;this._lastTick=t,this._remaining=Math.max(0,this._remaining-e);for(let r of this._tickHandlers)try{r(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let r of this._completionHandlers)try{r()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class Qt{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(t){if(this._interval=t.interval,this._handler=t.handler,this._immediate=t.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function An(t){return new Zt(t)}function _n(t){return new Qt(t)}function Cn(t){return new Promise((e)=>setTimeout(e,t))}function Tn(t){let e=Math.ceil(t/1000),r=Math.floor(e/3600),a=Math.floor(e%3600/60),n=e%60;if(r>0)return`${r}:${String(a).padStart(2,"0")}:${String(n).padStart(2,"0")}`;return`${a}:${String(n).padStart(2,"0")}`}function En(t){let e=Math.ceil(t/1000),r=Math.floor(e/3600),a=Math.floor(e%3600/60),n=e%60;if(r>0){if(a>0)return`${r}h ${a}m`;return`${r}h`}if(a>0){if(n>0)return`${a}m ${n}s`;return`${a}m`}return`${n}s`}function i(t){if(typeof window>"u")return!1;let e=window.craft;return!!(e&&e[t])}function v(t){if(!i(t))throw Error(`craft.${t} is not available \u2014 this API requires a Craft native window`);return window.craft[t]}function g(t,e){if(typeof window>"u")return()=>{};let r=(a)=>e(a.detail??{});return window.addEventListener(t,r),()=>window.removeEventListener(t,r)}var Dn={async writeText(t){if(i("clipboard")){await window.craft.clipboard.writeText(t);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(t)},async readText(){if(i("clipboard")){let t=await window.craft.clipboard.readText();return typeof t==="string"?t:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(t){if(i("clipboard")){await window.craft.clipboard.writeHTML(t);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let e=new window.ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([Ze(t)],{type:"text/plain"})});await navigator.clipboard.write([e])}catch{}},async readHTML(){if(i("clipboard")){let t=await window.craft.clipboard.readHTML();return typeof t==="string"?t:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let t=await navigator.clipboard.read();for(let e of t)if(e.types.includes("text/html"))return await(await e.getType("text/html")).text()}catch{}return""},async clear(){if(i("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(i("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(i("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(i("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function Ze(t){return t.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
892
+ `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/\n{3,}/g,`
893
+
894
+ `).trim()}var Mn={async show(t){if(!t.title)throw Error("notification title is required");if(i("notifications")){await window.craft.notifications.show(t);return}if(typeof window<"u"&&"Notification"in window){let e=window.Notification;if(e.permission==="granted")new e(t.title,{body:t.body,icon:t.icon});else if(e.permission==="default"){if(await e.requestPermission()==="granted")new e(t.title,{body:t.body,icon:t.icon})}}},async schedule(t){if(i("notifications")){let a={...t};if(a.triggerAt instanceof Date)a.triggerAt=a.triggerAt.toISOString();await window.craft.notifications.schedule(a);return}let e=Qe(t.triggerAt),r=Math.max(0,e-Date.now());setTimeout(()=>{this.show(t).catch(()=>{})},r)},async cancel(t){if(i("notifications"))await window.craft.notifications.cancel(t)},async cancelAll(){if(i("notifications"))await window.craft.notifications.cancelAll()},async setBadge(t){let e=Math.max(0,Math.round(Number.isFinite(t)?t:0));if(i("notifications")){await window.craft.notifications.setBadge(e);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(e)}catch{}},async clearBadge(){if(i("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(i("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let t=window.Notification;if(t.permission==="granted")return!0;if(t.permission==="denied")return!1;return await t.requestPermission()==="granted"}return!1},async registerCategories(t){if(!Array.isArray(t)||t.length===0)return;if(i("notifications")){let e=window.craft.notifications.registerCategories;if(typeof e==="function")await e(t)}},onActionClicked(t){return g("craft:notification:actionClicked",t)},onReply(t){return g("craft:notification:reply",t)}};function Qe(t){if(t==null)return Date.now();if(t instanceof Date)return t.getTime();if(typeof t==="number")return t;let e=Date.parse(t);return Number.isNaN(e)?Date.now():e}var In={async readFile(t){let e=await v("fs").readFile(t);return e&&e.data||""},async readBuffer(t){let e=await v("fs").readFile(t),r=e&&e.data||"";if(e&&e.base64===!0)return er(r);return new TextEncoder().encode(r)},async writeFile(t,e){await v("fs").writeFile(t,e)},async writeBuffer(t,e){let r=tr(e),a=v("fs");if(typeof a.writeFileBytes==="function")await a.writeFileBytes(t,r);else await a.writeFile(t,r)},async copy(t,e){if(t===e)throw Error("fs.copy: source and destination must differ");await v("fs").copy(t,e)},async move(t,e){if(t===e)throw Error("fs.move: source and destination must differ");await v("fs").move(t,e)},async appendFile(t,e){await v("fs").appendFile(t,e)},async deleteFile(t){await v("fs").deleteFile(t)},async exists(t){return await v("fs").exists(t)},async stat(t){return rr(await v("fs").stat(t))},async readDir(t){let e=await v("fs").readDir(t),r=e&&e.entries||[],a=t.endsWith("/")?t.slice(0,-1):t;return r.map((n)=>({name:n.name,path:`${a}/${n.name}`,isDirectory:!!n.isDirectory}))},async mkdir(t,e){await v("fs").mkdir(t,e)},async rmdir(t,e){await v("fs").rmdir(t,e)},async watch(t,e){await v("fs").watch(t,e)},async unwatch(t){await v("fs").unwatch(t)},onChange(t){return g("craft:fs:change",t)},async watchTree(t,e,r){let a=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,n=v("fs");await n.watch(t,a,{recursive:!!e.recursive});let o=e.kinds&&e.kinds.length>0?new Set(e.kinds):null,l=Math.max(0,Math.floor(e.coalesceMs??0)),s=[],c=null,d=!1,f=()=>{if(c=null,s.length===0)return;let u=s;s=[];try{r(u)}catch{}},p=g("craft:fs:change",(u)=>{if(d)return;if(u.id!==a)return;if(o&&u.kind&&!o.has(u.kind))return;if(s.push(u),l===0){f();return}if(c==null)c=setTimeout(f,l)});return{id:a,async stop(){if(d)return;if(d=!0,p(),c)clearTimeout(c),c=null;if(s.length>0)f();try{await n.unwatch(a)}catch{}}}},async homeDir(){return await v("fs").homeDir()},async tempDir(){return await v("fs").tempDir()},async appDataDir(){return await v("fs").appDataDir()}};function tr(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return typeof btoa==="function"?btoa(e):Buffer.from(t).toString("base64")}function er(t){let e=typeof atob==="function"?atob(t):Buffer.from(t,"base64").toString("binary"),r=new Uint8Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a);return r}function rr(t){return{isFile:!!t.isFile,isDirectory:!!t.isDirectory,isSymlink:!!t.isSymlink,size:Number(t.size)||0,modifiedAt:t.modifiedAt!=null?t.modifiedAt<1000000000000?t.modifiedAt*1000:t.modifiedAt:0}}var U=new Set,Ct=!1;function ar(){if(Ct)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(t)=>{let e=t.detail;if(e?.id)U.delete(e.id)}),Ct=!0}var nr=new Set(["javascript:","data:","file:","vbscript:"]),Ln={async openExternal(t){let e=t.trim().toLowerCase();for(let r of nr)if(e.startsWith(r))throw Error(`shell.openExternal: ${r} URLs are blocked for safety`);if(i("shell")){await window.craft.shell.openExternal(t);return}if(typeof window<"u"&&typeof window.open==="function")window.open(t,"_blank","noopener,noreferrer")},async openPath(t){await v("shell").openPath(t)},async showInFinder(t){await v("shell").showInFinder(t)},async spawn(t,e,r=[],a={}){if(ar(),!t||typeof t!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!e||typeof e!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(r))throw Error("shell.spawn: args must be an array");for(let n of r)if(typeof n!=="string")throw Error("shell.spawn: args entries must be strings");if(U.has(t))throw Error(`shell.spawn: id "${t}" is already in use \u2014 call kill(id) first or pick a different id`);U.add(t);try{await v("shell").spawn(t,e,r,a)}catch(n){throw U.delete(t),n}},async kill(t){await v("shell").kill(t),U.delete(t)},async getEnv(t){if(i("shell")){let e=await window.craft.shell.getEnv(t);return e==null?void 0:String(e)}return},async setEnv(t,e){await v("shell").setEnv(t,e)},onStdout(t){return g("craft:shell:stdout",t)},onStderr(t){return g("craft:shell:stderr",t)},onExit(t){return g("craft:shell:exit",t)}},Pn={async register(t,e,r){if(!i("shortcuts"))return;await window.craft.shortcuts.register(t,e,r)},async unregister(t){if(!i("shortcuts"))return;await window.craft.shortcuts.unregister(t)},async unregisterAll(){if(!i("shortcuts"))return;await window.craft.shortcuts.unregisterAll()},async enable(t){if(!i("shortcuts"))return;await window.craft.shortcuts.enable(t)},async disable(t){if(!i("shortcuts"))return;await window.craft.shortcuts.disable(t)},async isRegistered(t){if(!i("shortcuts"))return!1;return await window.craft.shortcuts.isRegistered(t)},async list(){if(!i("shortcuts"))return[];return await window.craft.shortcuts.list()},on(t){return g("craft:shortcut",t)}},zn={get(){if(i("theme"))try{return window.craft.theme.get()}catch{}return{appearance:ir()}},onChange(t){if(t(this.get()),i("theme"))return g("craft:theme",t);if(typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>t({appearance:e.matches?"dark":"light"});return e.addEventListener("change",r),()=>e.removeEventListener("change",r)}return()=>{}},async current(){return this.get()}};function ir(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function Nn(t,e={}){if(!i("dragOut"))throw Error("dragOut requires a Craft native window");let r=Array.isArray(t)?t:[t];if(r.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(r,e)}function Bn(){return i("dragOut")}var Fn={onUrl(t){if(!i("deepLink"))return()=>{};return g("craft:deepLink",t)},getInitialUrl(){if(typeof window>"u")return null;if(i("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let t=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return t},isAvailable(){return i("deepLink")}},Rn={async isCharging(){if(i("power"))return await window.craft.power.isCharging();let t=await Y();return t?!!t.charging:!1},async isPluggedIn(){if(i("power"))return await window.craft.power.isPluggedIn();let t=await Y();return t?!!t.charging||t.level>=0.999:!1},async isLowPowerMode(){if(i("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(i("power")){let e=await window.craft.power.batteryLevel();return typeof e==="number"?e:null}let t=await Y();return t?t.level:null},async timeRemaining(){if(i("power")){let r=await window.craft.power.timeRemaining();return typeof r==="number"?r:null}let t=await Y();if(!t)return null;let e=t.charging?t.chargingTime:t.dischargingTime;return Number.isFinite(e)?Math.round(e/60):null},async thermalState(){if(i("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(i("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(t="app is busy"){if(i("power")){await window.craft.power.preventSleep(t);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let e=window;if(e.__craftWebWakeLock?.release){try{await e.__craftWebWakeLock.release()}catch{}e.__craftWebWakeLock=null}try{let r=await navigator.wakeLock.request("screen");e.__craftWebWakeLock=r}catch{}},async allowSleep(){if(i("power")){await window.craft.power.allowSleep();return}let t=window.__craftWebWakeLock;if(t&&typeof t.release==="function"){try{await t.release()}catch{}window.__craftWebWakeLock=null}},onSleep(t){return g("craft:powerSleep",t)},onWake(t){return g("craft:powerWake",t)}};async function Y(){if(typeof navigator>"u")return null;let t=navigator;if(typeof t.getBattery!=="function")return null;try{return await t.getBattery()}catch{return null}}var Wn={async connectionType(){if(i("network"))return await window.craft.network.connectionType();return Tt()},async wifiSSID(){if(i("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(i("network")){let t=await window.craft.network.wifiSignalStrength();return typeof t==="number"?t:void 0}return},async ipAddress(){if(i("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(i("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(i("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(i("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(i("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(i("network"))await window.craft.network.openPreferences()},onChange(t){if(i("network"))return g("craft:networkChange",t);if(typeof window>"u")return()=>{};let e=()=>t({type:Tt(),online:!0}),r=()=>t({type:"none",online:!1});return window.addEventListener("online",e),window.addEventListener("offline",r),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}};function Tt(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let t=navigator.connection;if(!t)return"unknown";let e=String(t.type||t.effectiveType||"unknown").toLowerCase();if(e==="wifi"||e==="cellular"||e==="ethernet"||e==="bluetooth"||e==="none")return e;return"unknown"}var On={async checkForUpdates(){if(!i("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!i("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(t){if(!i("updater"))return;await window.craft.updater.setAutomaticChecks(t)},async setCheckInterval(t){if(!i("updater"))return;if(!Number.isFinite(t))throw Error("setCheckInterval: must be a finite number");let e=t<=0?0:Math.max(60,Math.round(t));await window.craft.updater.setCheckInterval(e)},async setFeedURL(t){if(!i("updater"))return;await window.craft.updater.setFeedURL(t)},async getLastUpdateCheckDate(){if(!i("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!i("updater"))return null;let t=await window.craft.updater.getUpdateInfo();if(!t||typeof t.version!=="string"||t.version.length===0)return null;return t},onAvailable(t){return g("craft:updateAvailable",t)},onDownloaded(t){return g("craft:updateDownloaded",t)},async verifySignature({payload:t,signatureB64:e,publicKeyB64:r}){let a=Et(t),n;try{n=await crypto.subtle.importKey("raw",X(r),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",n,X(e),a)}catch{return!1}},async verifyDownload({url:t,signatureB64:e,publicKeyB64:r,fetchInit:a}){let n;try{n=await fetch(t,a)}catch{return{ok:!1,reason:"fetch-failed"}}if(!n.ok)return{ok:!1,reason:"http-error",status:n.status};let o=new Uint8Array(await n.arrayBuffer()),l;try{l=await crypto.subtle.importKey("raw",X(r),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let s=!1;try{s=await crypto.subtle.verify("Ed25519",l,X(e),Et(o))}catch{s=!1}if(!s)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:o}}};function Et(t){if(t instanceof ArrayBuffer)return new Uint8Array(t);let e=new ArrayBuffer(t.byteLength),r=new Uint8Array(e);return r.set(t),r}function X(t){if(typeof atob==="function"){let a=atob(t),n=new ArrayBuffer(a.length),o=new Uint8Array(n);for(let l=0;l<a.length;l++)o[l]=a.charCodeAt(l);return o}let e=Buffer.from(t,"base64"),r=new ArrayBuffer(e.length);return new Uint8Array(r).set(e),new Uint8Array(r)}var qn={onFocus(t){if(i("window"))return g("craft:window:focus",()=>t());return ct("focus",t)},onBlur(t){if(i("window"))return g("craft:window:blur",()=>t());return ct("blur",t)},onResize(t){if(i("window"))return g("craft:window:resize",t);if(typeof window>"u")return()=>{};let e=()=>t({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},onMove(t){if(i("window"))return g("craft:window:move",t);return()=>{}},onClose(t){if(i("window"))return g("craft:window:close",()=>t());return ct("beforeunload",t)},onMinimize(t){if(i("window"))return g("craft:window:minimize",()=>t());if(typeof document>"u")return()=>{};let e=()=>{if(document.visibilityState==="hidden")t()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},onRestore(t){if(i("window"))return g("craft:window:restore",()=>t());if(typeof document>"u")return()=>{};let e=()=>{if(document.visibilityState==="visible")t()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)}};function ct(t,e){if(typeof window>"u")return()=>{};let r=()=>e();return window.addEventListener(t,r),()=>window.removeEventListener(t,r)}var Dt={name:"",version:"0.0.0"},Hn={async hideDockIcon(){if(i("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(i("app"))await window.craft.app.showDockIcon()},async quit(){if(i("app"))await window.craft.app.quit()},async getInfo(){if(!i("app"))return Dt;let t=await window.craft.app.getInfo();return{...Dt,...t||{}}},async notify(t){if(!t.title)throw Error("notify: title is required");if(i("app"))await window.craft.app.notify(t)},async setBadge(t){if(i("app"))await window.craft.app.setBadge(t)},async bounce(t="informational"){if(i("app"))await window.craft.app.bounce(t)}},jn={async set(t){if(i("menu"))await window.craft.menu.set(t)},async setDock(t){if(i("menu"))await window.craft.menu.setDock(t)},async addItem(t,e){if(i("menu"))await window.craft.menu.addItem(t,e)},async removeItem(t){if(i("menu"))await window.craft.menu.removeItem(t)},async enableItem(t){if(i("menu"))await window.craft.menu.enableItem(t)},async disableItem(t){if(i("menu"))await window.craft.menu.disableItem(t)},async checkItem(t){if(i("menu"))await window.craft.menu.checkItem(t)},async uncheckItem(t){if(i("menu"))await window.craft.menu.uncheckItem(t)},async setItemLabel(t,e){if(i("menu"))await window.craft.menu.setItemLabel(t,e)},async clearDock(){if(i("menu"))await window.craft.menu.clearDock()},onAction(t){return g("craft:menu:action",t)}},Un={accentColor:()=>T("system","accentColor",()=>""),highlightColor:()=>T("system","highlightColor",()=>""),language:()=>T("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>T("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>T("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>T("system","is24HourTime",()=>{try{let t=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return t.hourCycle==="h23"||t.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>T("system","reduceMotion",()=>lt("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>T("system","reduceTransparency",()=>lt("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>T("system","increaseContrast",()=>lt("(prefers-contrast: more)")),systemVersion:()=>T("system","systemVersion",()=>""),hostname:()=>T("system","hostname",()=>""),username:()=>T("system","username",()=>""),async openPreferences(){if(i("system"))await window.craft.system.openPreferences()}};async function T(t,e,r){if(i(t))return await window.craft[t][e]();return await r()}function lt(t){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(t).matches}var Vn={async getDisplays(){if(i("screen"))return await window.craft.screen.getDisplays();return Mt()},async getPrimary(){if(i("screen")){let t=await window.craft.screen.getPrimary();return t&&typeof t.width==="number"?t:null}return Mt()[0]??null},onChange(t){if(i("screen"))return g("craft:screen:change",()=>t());if(typeof window>"u")return()=>{};let e=()=>t();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}};function Mt(){if(typeof window>"u"||!window.screen)return[];let t=window.screen;return[{id:0,x:t.left??0,y:t.top??0,width:t.width||0,height:t.height||0,workX:t.availLeft??0,workY:t.availTop??0,workWidth:t.availWidth??t.width??0,workHeight:t.availHeight??t.height??0,scaleFactor:window.devicePixelRatio||1}]}var Kn={async set(t,e,r){if(!t)throw Error("keychain.set: service is required");if(!e)throw Error("keychain.set: account is required");await v("keychain").set(t,e,r)},async get(t,e){if(!t)throw Error("keychain.get: service is required");if(!e)throw Error("keychain.get: account is required");let r=await v("keychain").get(t,e);return typeof r==="string"?r:null},async delete(t,e){if(!t)throw Error("keychain.delete: service is required");if(!e)throw Error("keychain.delete: account is required");await v("keychain").delete(t,e)},async has(t,e){if(!t)throw Error("keychain.has: service is required");if(!e)throw Error("keychain.has: account is required");return await v("keychain").has(t,e)}},Yn={async check(t){if(i("permissions"))return await window.craft.permissions.check(t);return await te(t)},async request(t){if(i("permissions"))return await window.craft.permissions.request(t);return await or(t)},async openSettings(t){if(i("permissions"))await window.craft.permissions.openSettings(t)}};async function te(t){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let e=await navigator.permissions.query({name:t});return sr(e.state)}catch{return"not-supported"}}async function or(t){if(t==="notifications"&&typeof window<"u"&&"Notification"in window){let e=await window.Notification.requestPermission();return e==="granted"?"granted":e==="denied"?"denied":"undetermined"}return await te(t)}function sr(t){if(t==="granted")return"granted";if(t==="denied")return"denied";if(t==="prompt")return"undetermined";return"undetermined"}var Xn={async print(){if(i("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(t){if(!t)throw Error("printToPDF: path is required");let e=t.startsWith("/"),r=/^[a-zA-Z]:[\\/]/.test(t)||t.startsWith("\\\\");if(!e&&!r)throw Error("printToPDF: path must be absolute");let a=await v("printing").printToPDF(t);return{ok:!!(a&&a.ok),path:a?.path}}},Gn={async enable(){if(!i("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!i("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!i("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}},Jn={async addItem(t){if(i("touchbar"))await window.craft.touchbar.addItem(t)},async removeItem(t){if(i("touchbar"))await window.craft.touchbar.removeItem(t)},async updateItem(t,e){if(i("touchbar"))await window.craft.touchbar.updateItem(t,e)},async setLabel(t,e){if(i("touchbar"))await window.craft.touchbar.setLabel(t,e)},async setIcon(t,e){if(i("touchbar"))await window.craft.touchbar.setIcon(t,e)},async setEnabled(t,e){if(i("touchbar"))await window.craft.touchbar.setEnabled(t,e)},async setSliderValue(t,e){if(i("touchbar"))await window.craft.touchbar.setSliderValue(t,e)},async clear(){if(i("touchbar"))await window.craft.touchbar.clear()},async show(){if(i("touchbar"))await window.craft.touchbar.show()},async hide(){if(i("touchbar"))await window.craft.touchbar.hide()},onAction(t){return g("craft:touchbar:action",t)}},cr=/^[\da-f]*$/i;function lr(t,e){if(typeof e!=="string"||!cr.test(e)||e.length%2!==0)throw Error(`${t}: must be a hex string with even length, got ${JSON.stringify(e)}`)}var Zn={async isEnabled(){return i("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return i("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return i("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return i("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(i("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(i("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return i("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(t){if(i("bluetooth"))await window.craft.bluetooth.connect(t)},async disconnect(t){if(i("bluetooth"))await window.craft.bluetooth.disconnect(t)},async openPreferences(){if(i("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(t){if(!t)throw Error("bluetooth.discoverServices: deviceId is required");if(!i("bluetooth"))return[];let e=await window.craft.bluetooth.discoverServices(t);return Array.isArray(e)?e:[]},async discoverCharacteristics(t,e){if(!t||!e)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!i("bluetooth"))return[];let r=await window.craft.bluetooth.discoverCharacteristics(t,e);return Array.isArray(r)?r:[]},async readCharacteristic(t,e,r){if(!t||!e||!r)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!i("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(t,e,r)},async writeCharacteristic(t,e,r,a,n="with-response"){if(!t||!e||!r)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(lr("bluetooth.writeCharacteristic.valueHex",a),!i("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(t,e,r,a,n)},async setCharacteristicNotify(t,e,r,a){if(!t||!e||!r)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!i("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(t,e,r,a)},onDeviceFound(t){return g("craft:bluetooth:deviceFound",t)},onDeviceConnected(t){return g("craft:bluetooth:deviceConnected",t)},onDeviceDisconnected(t){return g("craft:bluetooth:deviceDisconnected",t)},onCharacteristicValue(t){return g("craft:bluetooth:characteristicValue",t)}},Qn={async speak(t,e){if(!t)throw Error("speech.speak: text is required");if(i("speech")){await window.craft.speech.speak(t,e);return}if(typeof window<"u"&&window.speechSynthesis){let r=new window.SpeechSynthesisUtterance(t);if(e){if(e.rate!=null)r.rate=e.rate;if(e.pitch!=null)r.pitch=e.pitch;if(e.volume!=null)r.volume=e.volume;if(e.voice){let n=window.speechSynthesis.getVoices().find((o)=>o.voiceURI===e.voice||o.name===e.voice||o.lang===e.voice);if(n)r.voice=n}}window.speechSynthesis.speak(r)}},async stop(){if(i("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(i("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(i("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(i("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(i("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((e)=>({id:e.voiceURI||e.name,name:e.name,language:e.lang||"",quality:"default"}));return[]}},H=[],dt=!0,ut,ft,et={async report(t){if(i("crashReporter")){await window.craft.crashReporter.report(t);return}if(!dt)return;let e=t instanceof Error?{timestamp:Date.now(),severity:"error",message:t.message,source:"js",stack:t.stack||"",userId:ut,appVersion:ft}:{timestamp:Date.now(),severity:t.severity||"error",message:t.message||"",source:t.source||"js",stack:t.stack||"",userId:ut,appVersion:ft};if(H.length>=64)H.shift();H.push(e)},async flush(){if(i("crashReporter"))return await window.craft.crashReporter.flush();return[...H]},async clear(){if(i("crashReporter")){await window.craft.crashReporter.clear();return}H.length=0},async setEnabled(t){if(i("crashReporter")){await window.craft.crashReporter.setEnabled(t);return}dt=t},async isEnabled(){if(i("crashReporter"))return await window.craft.crashReporter.isEnabled();return dt},async setUser(t){if(i("crashReporter")){await window.craft.crashReporter.setUser(t);return}ut=t||void 0},async setAppVersion(t){if(i("crashReporter")){await window.craft.crashReporter.setAppVersion(t);return}ft=t||void 0},attachGlobalHandlers(){if(i("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let t=(r)=>{et.report({severity:"error",message:r.message,source:"js",stack:r.error?.stack||`${r.message}
895
+ at ${r.filename}:${r.lineno}:${r.colno}`}).catch(()=>{})},e=(r)=>{let a=r.reason;et.report({severity:"error",message:a?.message||String(a),source:"js",stack:a?.stack||""}).catch(()=>{})};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",e),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",e)}},forwardTo(t){return gr(t)}},dr="craft:crashReporter:pending",ur=/[\w.+-]+@[\w-]+\.[\w.-]+/g,fr=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,pr=/\/(?:Users|home)\/[^\s/'"`]+/g;function wr(t){let e=(r)=>r.replace(ur,"<email>").replace(fr,"<ip>").replace(pr,"/<home>");return{...t,message:e(t.message),stack:e(t.stack)}}async function hr(t,e){let r=new TextEncoder,a=await crypto.subtle.importKey("raw",r.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),n=await crypto.subtle.sign("HMAC",a,r.encode(e));return[...new Uint8Array(n)].map((o)=>o.toString(16).padStart(2,"0")).join("")}function mr(t){if(!t||typeof localStorage>"u")return[];try{let e=localStorage.getItem(t);if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function It(t,e){if(!t||typeof localStorage>"u")return;try{if(e.length===0)localStorage.removeItem(t);else localStorage.setItem(t,JSON.stringify(e))}catch{}}function gr(t){let{endpoint:e,intervalMs:r=60000,signingSecret:a,redact:n=!0,headers:o={},maxRetries:l=5,persistKey:s}=t,c=s===null?null:s??dr,d=mr(c),f=!1,p=null,u=null,h=typeof n==="function"?n:n===!1?(S)=>S:wr;async function m(S){let A=JSON.stringify({entries:S}),I={"Content-Type":"application/json",...o};if(a)I["X-Craft-Signature"]=await hr(a,A);let K=0,L=1000;while(!f)try{let F=await fetch(e,{method:"POST",headers:I,body:A});if(F.ok)return;if(F.status>=400&&F.status<500)return;throw Error(`HTTP ${F.status}`)}catch(F){if(K+=1,K>l)throw d=[...S,...d],It(c,d),F;await new Promise((ne)=>{setTimeout(ne,L)}),L=Math.min(L*2,60000)}}async function k(){if(f||u)return u??void 0;let S=await et.flush();if(S.length>0)await et.clear();if(d=[...d,...S.map((I)=>h(I))],d.length===0)return;let A=d;return d=[],It(c,d),u=m(A).catch(()=>{}).finally(()=>{u=null}),u}if(r>0)p=setInterval(()=>{k().catch(()=>{})},r);return{async flushNow(){await k()},stop(){if(f=!0,p)clearInterval(p);p=null},pending(){return[...d]}}}var ti={async isAvailable(){if(!i("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(t){if(!i("iap"))return[];let e=Array.isArray(t)?t:[String(t)];return await window.craft.iap.getProducts(e)},async purchase(t){if(!i("iap"))return{queued:!1,productId:t,reason:"IAP bridge not available"};let e=await window.craft.iap.purchase(t);return{queued:!!(e&&e.queued),productId:e?.productId,reason:e?.reason}},async restorePurchases(){if(!i("iap"))return{ok:!1};let t=await window.craft.iap.restorePurchases();return{ok:!!(t&&t.ok)}},async finishTransaction(t){if(!i("iap"))return;await window.craft.iap.finishTransaction(t)},async getReceiptData(){if(!i("iap"))return null;let t=await window.craft.iap.getReceiptData();return t?String(t):null},onPurchased(t){return g("craft:iap:purchased",t)},onFailed(t){return g("craft:iap:failed",t)},onRestored(t){return g("craft:iap:restored",t)},onProductsLoaded(t){return g("craft:iap:productsLoaded",(e)=>t(e.products||[]))},onRefunded(t){return g("craft:iap:refunded",t)},onSubscriptionStatusChanged(t){return g("craft:iap:subscriptionStatusChanged",t)},async getActiveSubscriptions(){if(!i("iap"))return[];let t=window.craft.iap.getActiveSubscriptions;if(typeof t!=="function")return[];let e=await t();return Array.isArray(e)?e:[]},async isEligibleForIntroOffer(t){if(!i("iap"))return!1;let e=window.craft.iap.isEligibleForIntroOffer;if(typeof e!=="function")return!1;return!!await e(t)}},pt={async startActivity(t,e){if(!t)throw Error("handoff.startActivity: type is required");if(!i("handoff"))return!1;let r=await window.craft.handoff.startActivity(t,e);return typeof r==="boolean"?r:!!(r&&r.ok)},async updateActivity(t){if(!i("handoff"))return!1;let e=await window.craft.handoff.updateActivity(t);return typeof e==="boolean"?e:!!(e&&e.ok)},async stopActivity(){if(!i("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!i("handoff"))return null;let t=await window.craft.handoff.getCurrentActivity();return t&&typeof t.type==="string"?t:null},onIncoming(t){return g("craft:handoff:incoming",t)}},ei={async start(t,e){return pt.startActivity(t,{title:e?.title,webpageURL:e?.webpageURL,userInfo:e?.state})},async update(t){return pt.updateActivity({title:t.title,webpageURL:t.webpageURL,userInfo:t.state})},async stop(){await pt.stopActivity()}},ri={async requestPermission(t="whenInUse"){if(i("location"))return await window.craft.location.requestPermission(t);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(i("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(i("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((t)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:t.coords.latitude,longitude:t.coords.longitude,altitude:t.coords.altitude,horizontalAccuracy:t.coords.accuracy,verticalAccuracy:t.coords.altitudeAccuracy,speed:t.coords.speed}}))},(t)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:t.message||String(t)}}))}),{requested:!0};return{requested:!1}},async startWatching(t){if(i("location"))return await window.craft.location.startWatching(t);if(typeof navigator<"u"&&navigator.geolocation){let e=navigator.geolocation.watchPosition((r)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:r.coords.latitude,longitude:r.coords.longitude,altitude:r.coords.altitude,horizontalAccuracy:r.coords.accuracy,verticalAccuracy:r.coords.altitudeAccuracy,speed:r.coords.speed}}))});return window.__craftWebLocationWatchId=e,!0}return!1},async stopWatching(){if(i("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let t=window.__craftWebLocationWatchId;if(t!=null)navigator.geolocation.clearWatch(t),window.__craftWebLocationWatchId=null}},onUpdate(t){return g("craft:location:update",t)},onError(t){return g("craft:location:error",t)},onAuthChanged(t){return g("craft:location:authChanged",t)}},ai={async captureScreen(){if(!i("screenCapture"))return null;let t=await window.craft.screenCapture.captureScreen();return t?String(t):null},async captureWindow(t){if(!i("screenCapture"))return null;if(!Number.isFinite(t)||t<=0)throw Error("captureWindow: id must be a positive number");let e=await window.craft.screenCapture.captureWindow(t);return e?String(e):null},async listWindows(){if(!i("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}},yr=250,xr=60000,ee=2000,Lt={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function br(){return{...Lt,signals:{...Lt.signals},sources:[]}}var wt={async getState(){if(!i("screenSharing"))return br();return await window.craft.screenSharing.getState()},async watch(t=ee){let e=Math.min(xr,Math.max(yr,Math.round(t)));if(!i("screenSharing"))return e;let r=await window.craft.screenSharing.watch(e);return r&&r.intervalMs||e},async stop(){if(!i("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(t){return g("craft:screenSharing:change",t)}};async function ni(t,e=ee){let r=wt.onChange(t);return await wt.watch(e),()=>{r(),wt.stop()}}var vr={supported:!1,isFocused:null,authorization:"unsupported"};function Pt(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var re={async getStatus(){if(!i("focus"))return{...vr};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!i("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(t,e={}){if(!i("focus"))return Pt();if(!(t?e.onShortcut:e.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${t?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(t,e)},async runShortcut(t){if(!i("focus"))return Pt();if(!t)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(t)},async listShortcuts(){if(!i("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!i("focus"))return{canList:!1,shortcuts:[]};let t=await window.craft.focus.listShortcutsResult();return{canList:Boolean(t?.canList),shortcuts:t?.shortcuts||[]}}};async function ii(...t){if(t.length===0)return!1;let e=new Set(await re.listShortcuts());return t.every((r)=>e.has(r))}async function oi(...t){if(t.length===0)return!1;let{canList:e,shortcuts:r}=await re.listShortcutsResult();if(!e)return"unknown";let a=new Set(r);return t.every((n)=>a.has(n))}var si={async start(t=0,e="127.0.0.1"){if(!i("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(t,e)},async stop(){if(!i("localServer"))return;await window.craft.localServer.stop()},async respond(t){if(!i("localServer"))return;await window.craft.localServer.respond(t||{status:200,body:"OK"})},onRequest(t){return g("craft:localServer:request",t)},async awaitOAuthCallback(t={}){v("localServer");let{port:e=0,host:r="127.0.0.1",timeoutMs:a=300000,successHTML:n}=t,o=await this.start(e,r);if(!o.started)throw Error(`localServer: start failed${o.reason?` \u2014 ${o.reason}`:""}`);return new Promise((l,s)=>{let c=setTimeout(()=>{d(),this.stop().catch(()=>{}),s(Error("localServer: OAuth callback timed out"))},a),d=this.onRequest(({url:f})=>{clearTimeout(c),d();let p=n??`<!doctype html><meta charset="utf-8"><title>Done</title>
896
+ <style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
897
+ <div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
898
+ <script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:p,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),l({url:f,port:o.port})})})}},ci={async isAvailable(){if(!i("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!i("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(t,e){if(!t)throw Error("biometric.evaluate: reason is required");if(!i("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(t,e)}},_=null,li={async play(t,e){if(i("audio"))return await window.craft.audio.play(t,e);if(typeof window>"u"||typeof Audio>"u")return!1;if(_)_.pause(),_=null;if(_=new Audio(t),e?.volume!=null)_.volume=e.volume;if(e?.loops)_.loop=!0;try{return await _.play(),!0}catch{return!1}},async playSystemSound(t){if(i("audio"))return await window.craft.audio.playSystemSound(t);if(typeof window>"u"||typeof Audio>"u")return!1;try{return _=new Audio(`/System/Library/Sounds/${t}.aiff`),await _.play(),!0}catch{return!1}},async stop(){if(i("audio")){await window.craft.audio.stop();return}if(_)_.pause(),_.currentTime=0,_=null},async isPlaying(){if(i("audio"))return await window.craft.audio.isPlaying();return!!(_&&!_.paused)},async startRecording(t,e){if(i("audio"))return await window.craft.audio.startRecording(t,e);return!1},async stopRecording(){if(i("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(i("audio"))return await window.craft.audio.isRecording();return!1}},di={async execute(t){if(!t)throw Error("appleScript.execute: source is required");if(!i("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(t)}},ui={async getDefault(t){if(!t)throw Error("fileAssociations.getDefault: uti is required");if(!i("fileAssociations"))return null;let e=await window.craft.fileAssociations.getDefault(t);return e?String(e):null},async setDefault(t,e){if(!t||!e)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!i("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(t,e)}},fi={async get(t){if(!t)throw Error("tags.get: path is required");if(!i("tags"))return[];return await window.craft.tags.get(t)},async set(t,e){if(!t)throw Error("tags.set: path is required");if(!i("tags"))return!1;let r=Array.isArray(e)?e:[String(e)];return await window.craft.tags.set(t,r)},async clear(t){if(!t)throw Error("tags.clear: path is required");if(!i("tags"))return!1;return await window.craft.tags.clear(t)}},pi={async countPages(t){if(!t)throw Error("pdf.countPages: path is required");if(!i("pdf"))return 0;return await window.craft.pdf.countPages(t)},async extractText(t){if(!t)throw Error("pdf.extractText: path is required");if(!i("pdf"))return"";return await window.craft.pdf.extractText(t)}},wi={async debug(t){if(i("log"))await window.craft.log.debug(t);else console.debug(t)},async info(t){if(i("log"))await window.craft.log.info(t);else console.info(t)},async warn(t){if(i("log"))await window.craft.log.warn(t);else console.warn(t)},async error(t){if(i("log"))await window.craft.log.error(t);else console.error(t)}},hi={async browse(t){if(!i("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(t)},async stop(){if(i("bonjour"))await window.craft.bonjour.stop()},onFound(t){return g("craft:bonjour:found",t)},onLost(t){return g("craft:bonjour:lost",t)}},mi={async index(t){if(!i("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(t)},async remove(t){if(!i("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(t)},async removeAll(){if(!i("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}},gi={async isAvailable(){if(!i("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(t){if(!i("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(t)},async stop(){if(i("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(t){return g("craft:speechRecognition:partial",t)},onFinal(t){return g("craft:speechRecognition:final",t)}},yi={async recognizeText(t){if(!t)throw Error("vision.recognizeText: path is required");if(!i("vision"))return[];return await window.craft.vision.recognizeText(t)},async detectFaces(t){if(!t)throw Error("vision.detectFaces: path is required");if(!i("vision"))return[];return await window.craft.vision.detectFaces(t)},async detectBarcodes(t){if(!t)throw Error("vision.detectBarcodes: path is required");if(!i("vision"))return[];return await window.craft.vision.detectBarcodes(t)}},xi={async listSources(){if(!i("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!i("midi"))return[];return await window.craft.midi.listDestinations()},async send(t,e){if(!i("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(t,e)},async subscribe(t){if(!i("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(t)},async unsubscribe(t){if(!i("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(t)},onMessage(t){return g("craft:midi:message",t)}},bi={async loadModel(t,e){if(!t||!e)throw Error("coreml.loadModel: id and path are required");if(!i("coreml"))return!1;return await window.craft.coreml.loadModel(t,e)},async unloadModel(t){if(!i("coreml"))return;await window.craft.coreml.unloadModel(t)},async predict(t,e){if(!t)throw Error("coreml.predict: id is required");if(!i("coreml"))return null;return await window.craft.coreml.predict(t,e)}},vi={async listCameras(){if(!i("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}},$i={async register(t){if(!t)throw Error("serviceMenu.register: name is required");if(!i("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(t)},async unregister(t){if(!t)throw Error("serviceMenu.unregister: name is required");if(!i("serviceMenu"))return;await window.craft.serviceMenu.unregister(t)},onInvoked(t){return g("craft:serviceMenu:invoked",t)}},ki={async list(){if(!i("serial"))return[];return await window.craft.serial.list()},async open(t,e=9600){if(!t)throw Error("serial.open: path is required");if(!i("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(t,e)},async write(t,e){if(!t)throw Error("serial.write: id is required");if(!i("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(t,e)},async close(t){if(!i("serial"))return;await window.craft.serial.close(t)},onData(t){return g("craft:serial:data",t)}},ae=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function Si(){return ae.map(({name:t,support:e})=>({name:t,support:e,available:i(t)}))}function $r(t){let e=ae.find((r)=>r.name===t);if(!e)return;return{...e,available:i(t)}}function Ai(t){let e=$r(t);return!!e&&e.available}export{pa as AVAILABLE_COMPONENTS,zt as AutoUpdater,wa as COMPONENT_STYLES,ee as DEFAULT_WATCH_INTERVAL_MS,xr as MAX_WATCH_INTERVAL_MS,yr as MIN_WATCH_INTERVAL_MS,ka as MODAL_STYLES,Ir as TOAST_STYLES,Ma as TRAY_MENU_STYLES,Te as UPDATE_MANIFEST_ASSET,xa as alert,Hn as appInfo,di as appleScript,li as audio,Rn as battery,ci as biometric,Zn as bluetooth,hi as bonjour,sn as caffeinate,Dn as clipboard,$a as closeAllModals,Xa as closeAllWindows,ya as confirm,vi as continuityCamera,bi as coreml,rt as craftBinaryNotFoundMessage,qt as craftWindowArguments,et as crashReporter,ea as createAccordion,Yr as createAutocomplete,Rr as createAvatar,Fr as createBadge,Lr as createButton,Wr as createCard,ca as createChart,zr as createCheckbox,Jr as createChip,la as createCodeEditor,Ur as createColorPicker,sa as createDataGrid,Vr as createDatePicker,qr as createDropdown,ua as createFileExplorer,on as createGitHubUpdateManifest,nn as createGitHubUpdater,Gr as createImageView,_n as createInterval,Xr as createLabel,na as createListView,da as createMediaPlayer,Aa as createMenubar,aa as createModalComponent,hn as createPreferences,Br as createProgressBar,jr as createRadioButton,Hr as createRating,Qr as createScrollView,Nr as createSlider,ta as createSplitView,ra as createStepper,Se as createSystemTray,ia as createTable,Or as createTabs,Pr as createTextInput,Kr as createTimePicker,An as createTimer,Zr as createTooltip,oa as createTreeView,fa as createWebView,Ga as createWindow,Za as createWindowWithHTML,Me as decaffeinate,Fn as deepLinks,Cn as delay,Er as dismissAlertById,Dr as dismissAllAlerts,Nn as dragOut,ui as fileAssociations,re as focus,oi as focusShortcutsReady,En as formatCompact,un as formatDuration,dn as formatRemainingTime,vn as formatShortcut,Tn as formatTime,In as fs,Nt as generateUpdateManifest,Mr as getActiveAlertCount,va as getActiveModalCount,_a as getActiveTrayInstances,Ka as getActiveWindowIds,ln as getCaffeinateStatus,Si as getCapabilities,$r as getCapability,Ua as getDesktopConfig,Ra as getDialogBridgeScript,Sn as getRegisteredHotkeys,Ea as getSimulatedTrayHTML,Da as getTrayBridgeScript,Ca as getTrayInstance,Ya as getWindow,tn as getWindowBridgeScript,Ee as githubLatestAssetUrl,De as githubReleaseAssetUrl,Pn as globalShortcuts,pt as handoff,ii as hasFocusShortcuts,ti as iap,bn as isAutoLaunchEnabled,Ai as isAvailable,cn as isCaffeinated,Bn as isDragOutAvailable,Qa as isWebviewAvailable,Kn as keychain,ei as liveActivities,si as localServer,ri as location,wi as log,jn as menu,xi as midi,Gn as nativeAutoLaunch,Wn as network,Mn as notifications,Tr as notify,Ja as openDevWindow,oe as pack,ie as packageApp,Ke as parseShortcut,pi as pdf,Yn as permissions,Xn as printing,ba as prompt,wr as redactPII,$n as registerHotkey,kr as requestNotificationPermission,Va as resetDesktopConfig,gt as resolveCraftBinary,Vn as screen,ai as screenCapture,wt as screenSharing,ki as serial,$i as serviceMenu,xn as setAutoLaunch,ja as setDesktopConfig,Ln as shell,Bt as showAlert,za as showAlertDialog,Pa as showColorPicker,Na as showConfirmDialog,Ba as showErrorDialog,ma as showErrorModal,Cr as showErrorToast,ye as showInfoModal,Sr as showInfoToast,it as showMessageBox,V as showModal,Ia as showOpenDialog,xe as showQuestionModal,La as showSaveDialog,ga as showSuccessModal,Ar as showSuccessToast,at as showToast,Fa as showWarningDialog,ha as showWarningModal,_r as showWarningToast,hr as signPayload,Qn as speech,gi as speechRecognition,mi as spotlight,Un as system,fi as tags,zn as theme,Jn as touchbar,Ta as triggerTrayAction,kn as unregisterAllHotkeys,Je as unregisterHotkey,On as updater,yi as vision,ni as watchScreenSharing,qn as windowEvents};