@stacksjs/stx 0.2.195 → 0.2.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0ae6chzd.js +4 -0
- package/dist/chunk-0w0mrtme.js +2 -0
- package/dist/chunk-0y46fbkx.js +3 -0
- package/dist/chunk-118a77bs.js +4471 -0
- package/dist/chunk-12nvcvtn.js +3 -0
- package/dist/chunk-14ynv5ah.js +2 -0
- package/dist/chunk-1e25ksp6.js +3 -0
- package/dist/chunk-1mhc4g86.js +43 -0
- package/dist/chunk-1thssz8x.js +2 -0
- package/dist/chunk-1yk07x7b.js +2 -0
- package/dist/chunk-2zkj69dg.js +13 -0
- package/dist/chunk-338316c2.js +2 -0
- package/dist/chunk-3952ykhb.js +1655 -0
- package/dist/chunk-3es366z4.js +3 -0
- package/dist/chunk-3m49eb4v.js +2 -0
- package/dist/chunk-3nmpfsw5.js +2 -0
- package/dist/chunk-3vy1q9da.js +2 -0
- package/dist/chunk-4a4h28pp.js +3022 -0
- package/dist/chunk-4pf61rcb.js +2 -0
- package/dist/chunk-5anpcnde.js +2 -0
- package/dist/chunk-5mkkre22.js +505 -0
- package/dist/chunk-5n0dt838.js +2 -0
- package/dist/chunk-5s2y052b.js +2 -0
- package/dist/chunk-5v64c8tr.js +2 -0
- package/dist/chunk-5xd7vge2.js +2 -0
- package/dist/chunk-6bxcjdp4.js +2 -0
- package/dist/chunk-6msvxnbr.js +2 -0
- package/dist/chunk-7kger0se.js +1280 -0
- package/dist/chunk-7ry55nms.js +3 -0
- package/dist/chunk-7s0wfa4e.js +24 -0
- package/dist/chunk-7w4c5w2b.js +2 -0
- package/dist/chunk-8src5smc.js +15 -0
- package/dist/chunk-937effkz.js +2 -0
- package/dist/chunk-9b82d4g5.js +3 -0
- package/dist/chunk-9xh78snm.js +3 -0
- package/dist/chunk-a2899x2t.js +2 -0
- package/dist/chunk-abpw3b39.js +2 -0
- package/dist/chunk-avwj12at.js +194 -0
- package/dist/chunk-b6jhznkh.js +71 -0
- package/dist/chunk-bpa2jeyw.js +3 -0
- package/dist/chunk-cbc56wpd.js +3 -0
- package/dist/chunk-dhpy0h9y.js +2 -0
- package/dist/chunk-dtmwr674.js +302 -0
- package/dist/chunk-dxfcyj8t.js +2 -0
- package/dist/chunk-e0460y7f.js +29 -0
- package/dist/chunk-ede7zpjf.js +2 -0
- package/dist/chunk-ehfzp7xe.js +2 -0
- package/dist/chunk-fd77g6t6.js +2 -0
- package/dist/chunk-fnkxbnka.js +30 -0
- package/dist/chunk-fvjh7rx0.js +84 -0
- package/dist/chunk-g19skgmw.js +18 -0
- package/dist/chunk-gcnrdgrq.js +3 -0
- package/dist/chunk-h2wpnxrh.js +8 -0
- package/dist/chunk-hb83d0qc.js +2 -0
- package/dist/chunk-hncp9gz6.js +8 -0
- package/dist/chunk-ht51fz7w.js +4 -0
- package/dist/chunk-hyrjade7.js +321 -0
- package/dist/chunk-hyyzp99b.js +2 -0
- package/dist/chunk-jpbk42j7.js +2 -0
- package/dist/chunk-jr5tp4ks.js +2 -0
- package/dist/chunk-k03b9z9e.js +898 -0
- package/dist/chunk-kjr22neh.js +3 -0
- package/dist/chunk-mjt5e2jy.js +2 -0
- package/dist/chunk-mkm91b6w.js +2 -0
- package/dist/chunk-mtr2f82n.js +2 -0
- package/dist/chunk-n8zpm7xb.js +397 -0
- package/dist/chunk-ndnc7k2n.js +22 -0
- package/dist/chunk-nenge2m2.js +2 -0
- package/dist/chunk-nngpktr2.js +2 -0
- package/dist/chunk-nsjyn31z.js +2 -0
- package/dist/chunk-nye9brje.js +147 -0
- package/dist/chunk-p5kp35dy.js +2 -0
- package/dist/chunk-pw0rzgpv.js +3 -0
- package/dist/chunk-q020t182.js +2 -0
- package/dist/chunk-q4gp9egt.js +4 -0
- package/dist/chunk-q8szpd6w.js +3 -0
- package/dist/chunk-q9n5swx7.js +3 -0
- package/dist/chunk-qpcwahse.js +2 -0
- package/dist/chunk-qz75kx6n.js +231 -0
- package/dist/chunk-r41nsgym.js +116 -0
- package/dist/chunk-r4qnvxhv.js +18 -0
- package/dist/chunk-r6p4ws0a.js +3809 -0
- package/dist/chunk-rdf7d42n.js +2 -0
- package/dist/chunk-rs2fa3g1.js +2 -0
- package/dist/chunk-ryjpp51z.js +499 -0
- package/dist/chunk-s018d32j.js +30 -0
- package/dist/chunk-spn8e3b3.js +2 -0
- package/dist/chunk-sry9atvv.js +2 -0
- package/dist/chunk-st5qggks.js +3 -0
- package/dist/chunk-tywvd1zc.js +11 -0
- package/dist/chunk-v3ryxw4v.js +2 -0
- package/dist/chunk-va9k88da.js +2 -0
- package/dist/chunk-vgk5v31k.js +216 -0
- package/dist/chunk-vj320kyr.js +2 -0
- package/dist/chunk-vr3qtsj4.js +2 -0
- package/dist/chunk-w0ng9e1m.js +341 -0
- package/dist/chunk-w29sv5jf.js +2 -0
- package/dist/chunk-whq99ytc.js +7987 -0
- package/dist/chunk-wnaddtv3.js +288 -0
- package/dist/chunk-wtengj6h.js +2 -0
- package/dist/chunk-x0ks1fer.js +1194 -0
- package/dist/chunk-x0zh76yv.js +4 -0
- package/dist/chunk-x13f5bbe.js +358 -0
- package/dist/chunk-xfp10a23.js +2 -0
- package/dist/chunk-xp3fp266.js +11 -0
- package/dist/chunk-xz019t7t.js +2 -0
- package/dist/chunk-y35rktea.js +12 -0
- package/dist/chunk-y4hkqsgw.js +4 -0
- package/dist/chunk-yab6d6kb.js +28 -0
- package/dist/chunk-yckd6ks5.js +3 -0
- package/dist/chunk-ycn1vnv2.js +5 -0
- package/dist/chunk-yf3bmmkk.js +8 -0
- package/dist/chunk-ygr11tgz.js +3 -0
- package/dist/chunk-ymccpdg6.js +351 -0
- package/dist/chunk-yr2wc2pa.js +3 -0
- package/dist/chunk-yv340gxj.js +2 -0
- package/dist/chunk-z2sp0k8d.js +3 -0
- package/dist/chunk-z5cm0bwn.js +11 -0
- package/dist/chunk-zda3hvde.js +14 -0
- package/dist/chunk-zgvga8rc.js +5 -0
- package/dist/chunk-zqbw8zqq.js +3 -0
- package/dist/cli.js +108 -27481
- package/dist/craft-entry.js +9 -5
- package/dist/craft.js +7 -18503
- package/dist/database.js +2 -2
- package/dist/pwa.js +8 -16603
- package/dist/ssg.js +52 -15512
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hu as v}from"./chunk-pw0rzgpv.js";function W4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function zZ(){return typeof window<"u"&&typeof document<"u"}async function D4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var y=new Map;function L4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function M4(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function _4(Z="top-right"){if(!zZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function T4(Z){let{options:Y}=Z,$=M4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
|
|
3
|
+
<div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
|
+
<div class="stx-toast-icon">${$}</div>
|
|
5
|
+
<div class="stx-toast-content">
|
|
6
|
+
${Y.title?`<div class="stx-toast-title">${EZ(Y.title)}</div>`:""}
|
|
7
|
+
<div class="stx-toast-message">${EZ(Y.message)}</div>
|
|
8
|
+
</div>
|
|
9
|
+
${Q?'<button class="stx-toast-close" aria-label="Close">×</button>':""}
|
|
10
|
+
</div>
|
|
11
|
+
`}function EZ(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(Z){if(Z.timeout)clearTimeout(Z.timeout);if(y.delete(Z.id),Z.element&&zZ())Z.element.classList.add("dismissing"),setTimeout(()=>{Z.element?.remove()},200)}async function RZ(Z){let Y=L4(),$=W4(),J=Z.duration??5000,Q={id:Y,options:Z};if(y.set(Y,Q),$&&Z.type!=="error")try{let X=new Notification(Z.title||"Notification",{body:Z.message,icon:Z.type==="success"?"\u2713":Z.type==="warning"?"\u26A0":"\u2139",tag:Y});if(X.onclick=()=>{if(Z.onClick)Z.onClick();X.close()},J>0)Q.timeout=setTimeout(()=>{X.close(),y.delete(Y)},J);return}catch{}if(zZ())try{let X=_4(Z.position),F=document.createElement("div");F.innerHTML=T4(Q);let z=F.firstElementChild;if(!z){let R=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${R}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`);return}Q.element=z;try{X.appendChild(z)}catch{let R=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${R}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`);return}if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>{try{z.classList.add("visible")}catch{}});try{z.addEventListener("click",(R)=>{if(R.target.classList?.contains("stx-toast-close")){s(Q);return}if(Z.onClick)Z.onClick()})}catch{}if(J>0)Q.timeout=setTimeout(()=>{s(Q)},J)}catch{let X=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${X}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`)}else{let X=(Z.type||"info").toUpperCase();if(console.log(`[stx-alert] ${X}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`),J>0)Q.timeout=setTimeout(()=>{y.delete(Y)},J)}}async function p(Z){return RZ({...Z,position:Z.position||"top-right"})}async function N4(Z,Y=3000){return p({message:Z,type:"info",duration:Y})}async function E4(Z,Y=3000){return p({message:Z,type:"success",duration:Y})}async function A4(Z,Y=3000){return p({message:Z,type:"warning",duration:Y})}async function k4(Z,Y=5000){return p({message:Z,type:"error",duration:Y})}async function H4(Z,Y,$="info"){return RZ({title:Z,message:Y,type:$})}function x4(Z){let Y=y.get(Z);if(Y)s(Y)}function C4(){for(let Z of y.values())s(Z)}function I4(){return y.size}var w4=`
|
|
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 _(Z="stx"){return`${Z}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function q(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L(...Z){return Z.filter(Boolean).join(" ")}function D(Z){if(!Z)return"";return Object.entries(Z).map(([Y,$])=>`${Y.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${$}`).join("; ")}function S4(Z){let{text:Y,variant:$="primary",size:J="medium",disabled:Q=!1,loading:X=!1,icon:F,iconPosition:z="left",id:R=_("btn"),className:O,style:j}=Z,V=L("stx-button",`stx-button--${$}`,`stx-button--${J}`,Q&&"stx-button--disabled",X&&"stx-button--loading",O),K=D(j),U=F?`<span class="stx-button-icon">${F}</span>`:"",W=X?'<span class="stx-button-spinner"></span>':"",T=z==="left"?`${U}${W}<span class="stx-button-text">${q(Y)}</span>`:`<span class="stx-button-text">${q(Y)}</span>${U}${W}`;return`<button id="${R}" class="${V}" ${Q||X?"disabled":""} ${K?`style='${K}'`:""}>${T}</button>`}function B4(Z){let{value:Y="",placeholder:$="",type:J="text",disabled:Q=!1,readonly:X=!1,maxLength:F,minLength:z,pattern:R,required:O=!1,autocomplete:j,label:V,error:K,hint:U,id:W=_("input"),className:T,style:N}=Z,E=L("stx-input",K&&"stx-input--error",Q&&"stx-input--disabled",T),w=D(N),i=[`type="${J}"`,`id="${W}"`,`class="${E}"`,Y&&`value="${q(Y)}"`,$&&`placeholder="${q($)}"`,Q&&"disabled",X&&"readonly",O&&"required",F&&`maxlength="${F}"`,z&&`minlength="${z}"`,R&&`pattern="${q(R)}"`,j&&`autocomplete="${j}"`,w&&`style="${w}"`].filter(Boolean).join(" "),S="";if(V)S+=`<label class="stx-input-label" for="${W}">${q(V)}</label>`;if(S+=`<input ${i} />`,K)S+=`<div class="stx-input-error">${q(K)}</div>`;else if(U)S+=`<div class="stx-input-hint">${q(U)}</div>`;return`<div class="stx-input-wrapper">${S}</div>`}function f4(Z){let{checked:Y=!1,label:$,disabled:J=!1,indeterminate:Q=!1,id:X=_("checkbox"),className:F,style:z}=Z,R=L("stx-checkbox",J&&"stx-checkbox--disabled",F),O=D(z),j=['type="checkbox"',`id="${X}"`,Y&&"checked",J&&"disabled",Q&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
114
|
+
<label class="${R}" ${O?`style="${O}"`:""}>
|
|
115
|
+
<input ${j} />
|
|
116
|
+
<span class="stx-checkbox-box"></span>
|
|
117
|
+
${$?`<span class="stx-checkbox-label">${q($)}</span>`:""}
|
|
118
|
+
</label>
|
|
119
|
+
`}function v4(Z){let{value:Y=50,min:$=0,max:J=100,step:Q=1,disabled:X=!1,label:F,showValue:z=!0,id:R=_("slider"),className:O,style:j}=Z,V=L("stx-slider",X&&"stx-slider--disabled",O),K=D(j),U=['type="range"',`id="${R}"`,`value="${Y}"`,`min="${$}"`,`max="${J}"`,`step="${Q}"`,X&&"disabled"].filter(Boolean).join(" "),W="";if(F)W+=`<label class="stx-slider-label" for="${R}">${q(F)}</label>`;if(W+=`<div class="stx-slider-track"><input ${U} /></div>`,z)W+=`<span class="stx-slider-value">${Y}</span>`;return`<div class="${V}" ${K?`style='${K}'`:""}>${W}</div>`}function y4(Z){let{value:Y,max:$=100,variant:J="default",size:Q="medium",showLabel:X=!1,indeterminate:F=!1,id:z=_("progress"),className:R,style:O}=Z,j=Math.min(100,Math.max(0,Y/$*100)),V=L("stx-progress",`stx-progress--${J}`,`stx-progress--${Q}`,F&&"stx-progress--indeterminate",R),K=D(O);return`
|
|
120
|
+
<div id="${z}" class="${V}" role="progressbar" aria-valuenow="${Y}" aria-valuemin="0" aria-valuemax="${$}" ${K?`style="${K}"`:""}>
|
|
121
|
+
<div class="stx-progress-bar" style="width: ${F?"100%":`${j}%`}"></div>
|
|
122
|
+
${X?`<span class="stx-progress-label">${Math.round(j)}%</span>`:""}
|
|
123
|
+
</div>
|
|
124
|
+
`}function g4(Z){let{text:Y,variant:$="default",size:J="medium",id:Q=_("badge"),className:X,style:F}=Z,z=L("stx-badge",`stx-badge--${$}`,`stx-badge--${J}`,X),R=D(F);return`<span id="${Q}" class="${z}" ${R?`style='${R}'`:""}>${q(Y)}</span>`}function b4(Z){let{src:Y,alt:$="",name:J,size:Q="medium",shape:X="circle",id:F=_("avatar"),className:z,style:R}=Z,O=typeof Q==="number"?"":`stx-avatar--${Q}`,j=typeof Q==="number"?`width: ${Q}px; height: ${Q}px;`:"",V=L("stx-avatar",O,`stx-avatar--${X}`,z),K=[j,D(R)].filter(Boolean).join(" "),U=J?J.split(" ").map((W)=>W[0]).join("").toUpperCase().slice(0,2):"";if(Y)return`<div id="${F}" class="${V}" ${K?`style="${K}"`:""}>
|
|
125
|
+
<img src="${q(Y)}" alt="${q($)}" class="stx-avatar-img" />
|
|
126
|
+
</div>`;return`<div id="${F}" class="${V}" ${K?`style="${K}"`:""}>
|
|
127
|
+
<span class="stx-avatar-initials">${U}</span>
|
|
128
|
+
</div>`}function u4(Z){let{title:Y,subtitle:$,content:J,image:Q,footer:X,variant:F="default",id:z=_("card"),className:R,style:O}=Z,j=L("stx-card",`stx-card--${F}`,R),V=D(O),K="";if(Q)K+=`<div class="stx-card-image"><img src="${q(Q)}" alt="" /></div>`;if(K+='<div class="stx-card-body">',Y)K+=`<h3 class="stx-card-title">${q(Y)}</h3>`;if($)K+=`<p class="stx-card-subtitle">${q($)}</p>`;if(J)K+=`<div class="stx-card-content">${q(J)}</div>`;if(K+="</div>",X)K+=`<div class="stx-card-footer">${q(X)}</div>`;return`<div id="${z}" class="${j}" ${V?`style='${V}'`:""}>${K}</div>`}function m4(Z){let{tabs:Y,activeTab:$,variant:J="default",id:Q=_("tabs"),className:X,style:F}=Z,z=L("stx-tabs",`stx-tabs--${J}`,X),R=D(F),O=Y.map((j,V)=>{let K=$?j.value===$:V===0;return`<button class="${L("stx-tab",K&&"stx-tab--active",j.disabled&&"stx-tab--disabled")}" data-value="${q(j.value)}" ${j.disabled?"disabled":""} role="tab" aria-selected="${K}">${q(j.label)}</button>`}).join("");return`<div id="${Q}" class="${z}" role="tablist" ${R?`style='${R}'`:""}>${O}</div>`}function h4(Z){let{options:Y,value:$,placeholder:J="Select...",disabled:Q=!1,id:X=_("dropdown"),className:F,style:z}=Z,R=L("stx-dropdown",Q&&"stx-dropdown--disabled",F),O=D(z),j=Y.map((K)=>{let U=K.value===$?"selected":"",W=K.disabled?"disabled":"";return`<option value="${q(K.value)}" ${U} ${W}>${q(K.label)}</option>`}).join(""),V=$?"":`<option value="" disabled selected>${q(J)}</option>`;return`<select id="${X}" class="${R}" ${Q?"disabled":""} ${O?`style='${O}'`:""}>${V}${j}</select>`}function c4(Z){let{value:Y=0,max:$=5,readonly:J=!1,size:Q="medium",allowHalf:X=!1,id:F=_("rating"),className:z,style:R}=Z,O=L("stx-rating",`stx-rating--${Q}`,J&&"stx-rating--readonly",z),j=D(R),V="";for(let K=1;K<=$;K++){let U=K<=Y,W=X&&K-0.5===Y;V+=`<span class="stx-star ${U?"stx-star--filled":W?"stx-star--half":""}" data-value="${K}">\u2605</span>`}return`<div id="${F}" class="${O}" role="slider" aria-valuenow="${Y}" aria-valuemin="0" aria-valuemax="${$}" ${j?`style='${j}'`:""}>${V}</div>`}function p4(Z){let{value:Y,name:$,checked:J=!1,label:Q,disabled:X=!1,id:F=_("radio"),className:z,style:R}=Z,O=L("stx-radio",X&&"stx-radio--disabled",z),j=D(R),V=['type="radio"',`id="${F}"`,`name="${q($)}"`,`value="${q(Y)}"`,J&&"checked",X&&"disabled"].filter(Boolean).join(" ");return`
|
|
129
|
+
<label class="${O}" ${j?`style="${j}"`:""}>
|
|
130
|
+
<input ${V} />
|
|
131
|
+
<span class="stx-radio-circle"></span>
|
|
132
|
+
${Q?`<span class="stx-radio-label">${q(Q)}</span>`:""}
|
|
133
|
+
</label>
|
|
134
|
+
`}function l4(Z){let{value:Y="#3498db",disabled:$=!1,label:J,presetColors:Q=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:X=_("color"),className:F,style:z}=Z,R=L("stx-color-picker",$&&"stx-color-picker--disabled",F),O=D(z),j="";if(J)j+=`<label class="stx-color-picker-label" for="${X}">${q(J)}</label>`;if(j+=`<div class="stx-color-picker-input">
|
|
135
|
+
<input type="color" id="${X}" value="${q(Y)}" ${$?"disabled":""} />
|
|
136
|
+
<span class="stx-color-picker-value">${q(Y)}</span>
|
|
137
|
+
</div>`,Q.length>0){j+='<div class="stx-color-picker-presets">';for(let V of Q)j+=`<button class="stx-color-preset" style="background: ${q(V)}" data-color="${q(V)}" ${$?"disabled":""}></button>`;j+="</div>"}return`<div class="${R}" ${O?`style='${O}'`:""}>${j}</div>`}function d4(Z){let{value:Y,min:$,max:J,disabled:Q=!1,label:X,placeholder:F="Select date",showClear:z=!0,id:R=_("date"),className:O,style:j}=Z,V=L("stx-date-picker",Q&&"stx-date-picker--disabled",O),K=D(j),U=Y instanceof Date?Y.toISOString().split("T")[0]:Y||"",W=$ instanceof Date?$.toISOString().split("T")[0]:$,T=J instanceof Date?J.toISOString().split("T")[0]:J,N=['type="date"',`id="${R}"`,U&&`value="${U}"`,W&&`min="${W}"`,T&&`max="${T}"`,Q&&"disabled",`placeholder="${q(F)}"`].filter(Boolean).join(" "),E="";if(X)E+=`<label class="stx-date-picker-label" for="${R}">${q(X)}</label>`;return E+=`<div class="stx-date-picker-input">
|
|
138
|
+
<input ${N} />
|
|
139
|
+
${z&&U?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
140
|
+
</div>`,`<div class="${V}" ${K?`style='${K}'`:""}>${E}</div>`}function r4(Z){let{value:Y="",disabled:$=!1,label:J,step:Q=60,min:X,max:F,id:z=_("time"),className:R,style:O}=Z,j=L("stx-time-picker",$&&"stx-time-picker--disabled",R),V=D(O),K=['type="time"',`id="${z}"`,Y&&`value="${q(Y)}"`,`step="${Q}"`,X&&`min="${q(X)}"`,F&&`max="${q(F)}"`,$&&"disabled"].filter(Boolean).join(" "),U="";if(J)U+=`<label class="stx-time-picker-label" for="${z}">${q(J)}</label>`;return U+=`<input ${K} class="stx-time-picker-input" />`,`<div class="${j}" ${V?`style='${V}'`:""}>${U}</div>`}function n4(Z){let{options:Y,value:$="",placeholder:J="Search...",disabled:Q=!1,label:X,loading:F=!1,id:z=_("autocomplete"),className:R,style:O}=Z,j=L("stx-autocomplete",Q&&"stx-autocomplete--disabled",R),V=D(O),K=Y.find((T)=>T.value===$),U=K?K.label:$,W="";if(X)W+=`<label class="stx-autocomplete-label" for="${z}">${q(X)}</label>`;W+=`<div class="stx-autocomplete-input-wrapper">
|
|
141
|
+
<input type="text" id="${z}" value="${q(U)}" placeholder="${q(J)}" ${Q?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
142
|
+
${F?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
143
|
+
</div>`,W+='<ul class="stx-autocomplete-list">';for(let T of Y)W+=`<li class="stx-autocomplete-item ${T.value===$?"stx-autocomplete-item--selected":""}" data-value="${q(T.value)}">${q(T.label)}</li>`;return W+="</ul>",`<div class="${j}" ${V?`style='${V}'`:""}>${W}</div>`}function o4(Z){let{text:Y,htmlFor:$,required:J=!1,size:Q="medium",id:X=_("label"),className:F,style:z}=Z,R=L("stx-label",`stx-label--${Q}`,F),O=D(z);return`<label id="${X}" class="${R}" ${$?`for='${q($)}'`:""} ${O?`style='${O}'`:""}>${q(Y)}${J?'<span class="stx-label-required">*</span>':""}</label>`}function a4(Z){let{src:Y,alt:$="",width:J,height:Q,objectFit:X="cover",fallback:F,loading:z="lazy",id:R=_("image"),className:O,style:j}=Z,V=L("stx-image",O),K={objectFit:X};if(J)K.width=typeof J==="number"?`${J}px`:J;if(Q)K.height=typeof Q==="number"?`${Q}px`:Q;let U=[D(K),D(j)].filter(Boolean).join("; "),W=F?`onerror="this.src='${q(F)}'"`:"";return`<img id="${R}" class="${V}" src="${q(Y)}" alt="${q($)}" loading="${z}" ${U?`style='${U}'`:""} ${W} />`}function i4(Z){let{text:Y,variant:$="default",size:J="medium",removable:Q=!1,icon:X,id:F=_("chip"),className:z,style:R}=Z,O=L("stx-chip",`stx-chip--${$}`,`stx-chip--${J}`,z),j=D(R),V="";if(X)V+=`<span class="stx-chip-icon">${X}</span>`;if(V+=`<span class="stx-chip-text">${q(Y)}</span>`,Q)V+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${F}" class="${O}" ${j?`style='${j}'`:""}>${V}</span>`}function s4(Z){let{text:Y,position:$="top",delay:J=200,children:Q,id:X=_("tooltip"),className:F,style:z}=Z,R=L("stx-tooltip-wrapper",F),O=D(z);return`<div id="${X}" class="${R}" ${O?`style="${O}"`:""} data-tooltip="${q(Y)}" data-position="${$}" data-delay="${J}">
|
|
144
|
+
${Q}
|
|
145
|
+
<span class="stx-tooltip stx-tooltip--${$}">${q(Y)}</span>
|
|
146
|
+
</div>`}function t4(Z){let{direction:Y="vertical",showScrollbar:$=!0,smooth:J=!0,height:Q,width:X,children:F,id:z=_("scroll"),className:R,style:O}=Z,j=L("stx-scroll-view",`stx-scroll-view--${Y}`,!$&&"stx-scroll-view--hide-scrollbar",J&&"stx-scroll-view--smooth",R),V={};if(Q)V.height=typeof Q==="number"?`${Q}px`:Q;if(X)V.width=typeof X==="number"?`${X}px`:X;let K=[D(V),D(O)].filter(Boolean).join("; ");return`<div id="${z}" class="${j}" ${K?`style='${K}'`:""}>${F}</div>`}function e4(Z){let{direction:Y="horizontal",sizes:$=[50,50],resizable:J=!0,children:Q,id:X=_("split"),className:F,style:z}=Z,R=L("stx-split-view",`stx-split-view--${Y}`,J&&"stx-split-view--resizable",F),O=D(z),j=Y==="horizontal"?"width":"height";return`<div id="${X}" class="${R}" ${O?`style="${O}"`:""}>
|
|
147
|
+
<div class="stx-split-pane" style="${j}: ${$[0]}%">${Q[0]}</div>
|
|
148
|
+
${J?'<div class="stx-split-divider"></div>':""}
|
|
149
|
+
<div class="stx-split-pane" style="${j}: ${$[1]}%">${Q[1]}</div>
|
|
150
|
+
</div>`}function ZY(Z){let{items:Y,multiple:$=!1,defaultOpen:J=[],id:Q=_("accordion"),className:X,style:F}=Z,z=L("stx-accordion",X),R=D(F),O="";return Y.forEach((j,V)=>{let K=J.includes(V),U=L("stx-accordion-item",K&&"stx-accordion-item--open",j.disabled&&"stx-accordion-item--disabled");O+=`<div class="${U}" data-index="${V}">
|
|
151
|
+
<button class="stx-accordion-header" ${j.disabled?"disabled":""} aria-expanded="${K}" data-multiple="${$}">
|
|
152
|
+
<span class="stx-accordion-title">${q(j.title)}</span>
|
|
153
|
+
<span class="stx-accordion-icon">\u25BC</span>
|
|
154
|
+
</button>
|
|
155
|
+
<div class="stx-accordion-content" ${K?"":"hidden"}>
|
|
156
|
+
${q(j.content)}
|
|
157
|
+
</div>
|
|
158
|
+
</div>`}),`<div id="${Q}" class="${z}" ${R?`style='${R}'`:""}>${O}</div>`}function YY(Z){let{steps:Y,currentStep:$,orientation:J="horizontal",id:Q=_("stepper"),className:X,style:F}=Z,z=L("stx-stepper",`stx-stepper--${J}`,X),R=D(F),O="";return Y.forEach((j,V)=>{let K=L("stx-step",V<$&&"stx-step--completed",V===$&&"stx-step--active");if(O+=`<div class="${K}" data-step="${V}">
|
|
159
|
+
<div class="stx-step-indicator">
|
|
160
|
+
${V<$?"\u2713":V+1}
|
|
161
|
+
</div>
|
|
162
|
+
<div class="stx-step-content">
|
|
163
|
+
<div class="stx-step-label">${q(j.label)}</div>
|
|
164
|
+
${j.description?`<div class="stx-step-description">${q(j.description)}</div>`:""}
|
|
165
|
+
</div>
|
|
166
|
+
</div>`,V<Y.length-1)O+='<div class="stx-step-connector"></div>'}),`<div id="${Q}" class="${z}" ${R?`style='${R}'`:""}>${O}</div>`}function $Y(Z){let{open:Y=!1,title:$,size:J="medium",closable:Q=!0,children:X,footer:F,id:z=_("modal"),className:R,style:O}=Z,j=L("stx-modal-component",`stx-modal-component--${J}`,R),V=D(O);if(!Y)return`<div id="${z}" class="${j} stx-modal-component--hidden" ${V?`style='${V}'`:""}></div>`;let K='<div class="stx-modal-component-overlay">';if(K+='<div class="stx-modal-component-dialog">',$||Q){if(K+='<div class="stx-modal-component-header">',$)K+=`<h3 class="stx-modal-component-title">${q($)}</h3>`;if(Q)K+='<button class="stx-modal-component-close">×</button>';K+="</div>"}if(K+=`<div class="stx-modal-component-body">${X}</div>`,F)K+=`<div class="stx-modal-component-footer">${F}</div>`;return K+="</div></div>",`<div id="${z}" class="${j}" ${V?`style='${V}'`:""}>${K}</div>`}function JY(Z){let{items:Y,selectable:$=!1,multiSelect:J=!1,emptyMessage:Q="No items",id:X=_("list"),className:F,style:z}=Z,R=L("stx-list-view",$&&"stx-list-view--selectable",J&&"stx-list-view--multi",F),O=D(z);if(Y.length===0)return`<div id="${X}" class="${R}" ${O?`style="${O}"`:""}>
|
|
167
|
+
<div class="stx-list-view-empty">${q(Q)}</div>
|
|
168
|
+
</div>`;let j='<ul class="stx-list-view-items">';for(let V of Y){let K=L("stx-list-view-item",V.selected&&"stx-list-view-item--selected");j+=`<li class="${K}" data-id="${q(V.id)}" ${$?'tabindex="0"':""}>${V.content}</li>`}return j+="</ul>",`<div id="${X}" class="${R}" ${O?`style='${O}'`:""}>${j}</div>`}function GY(Z){let{columns:Y,data:$,striped:J=!1,bordered:Q=!1,hoverable:X=!0,sortBy:F,sortOrder:z,id:R=_("table"),className:O,style:j}=Z,V=L("stx-table",J&&"stx-table--striped",Q&&"stx-table--bordered",X&&"stx-table--hoverable",O),K=D(j),U="<table>";U+="<thead><tr>";for(let W of Y){let N=W.key===F?`stx-table-sorted stx-table-sorted--${z}`:"",E=W.sortable?'data-sortable="true"':"",w=W.width?`style="width: ${W.width}"`:"";U+=`<th class="${N}" ${E} ${w} data-key="${q(W.key)}">${q(W.label)}${W.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}U+="</tr></thead>",U+="<tbody>";for(let W of $){U+="<tr>";for(let T of Y){let N=W[T.key];U+=`<td>${N!=null?q(String(N)):""}</td>`}U+="</tr>"}return U+="</tbody></table>",`<div id="${R}" class="${V}" ${K?`style='${K}'`:""}>${U}</div>`}function AZ(Z,Y,$,J){let Q=Y.includes(Z.key),X=$.includes(Z.key),F=Z.children&&Z.children.length>0,R=`<div class="${L("stx-tree-node",X&&"stx-tree-node--selected",Z.disabled&&"stx-tree-node--disabled")}" data-key="${q(Z.key)}">`;if(R+='<div class="stx-tree-node-content">',F)R+=`<span class="stx-tree-toggle ${Q?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else R+='<span class="stx-tree-toggle-placeholder"></span>';if(J)R+=`<input type="checkbox" class="stx-tree-checkbox" ${X?"checked":""} ${Z.disabled?"disabled":""} />`;if(Z.icon)R+=`<span class="stx-tree-icon">${Z.icon}</span>`;if(R+=`<span class="stx-tree-label">${q(Z.label)}</span>`,R+="</div>",F&&Q){R+='<div class="stx-tree-children">';for(let O of Z.children)R+=AZ(O,Y,$,J);R+="</div>"}return R+="</div>",R}function QY(Z){let{nodes:Y,expandedKeys:$=[],selectedKeys:J=[],checkable:Q=!1,id:X=_("tree"),className:F,style:z}=Z,R=L("stx-tree-view",Q&&"stx-tree-view--checkable",F),O=D(z),j="";for(let V of Y)j+=AZ(V,$,J,Q);return`<div id="${X}" class="${R}" role="tree" ${O?`style='${O}'`:""}>${j}</div>`}function XY(Z){let{columns:Y,data:$,pagination:J,selectable:Q=!1,id:X=_("datagrid"),className:F,style:z}=Z,R=L("stx-data-grid",Q&&"stx-data-grid--selectable",F),O=D(z),j='<div class="stx-data-grid-table-wrapper">';if(j+='<table class="stx-data-grid-table">',j+="<thead><tr>",Q)j+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let V of Y){let K=V.width?`style="width: ${V.width}"`:"";j+=`<th ${K}>
|
|
169
|
+
<div class="stx-data-grid-header-cell">
|
|
170
|
+
<span>${q(V.label)}</span>
|
|
171
|
+
${V.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
172
|
+
${V.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
|
|
173
|
+
</div>
|
|
174
|
+
</th>`}j+="</tr></thead>",j+="<tbody>";for(let V of $){if(j+="<tr>",Q)j+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let K of Y){let U=V[K.key];j+=`<td>${U!=null?q(String(U)):""}</td>`}j+="</tr>"}if(j+="</tbody></table></div>",J){let V=Math.ceil(J.total/J.pageSize);j+=`<div class="stx-data-grid-pagination">
|
|
175
|
+
<span class="stx-data-grid-page-info">Page ${J.page} of ${V} (${J.total} items)</span>
|
|
176
|
+
<div class="stx-data-grid-page-buttons">
|
|
177
|
+
<button class="stx-data-grid-page-btn" ${J.page<=1?"disabled":""}>\u25C0</button>
|
|
178
|
+
<button class="stx-data-grid-page-btn" ${J.page>=V?"disabled":""}>\u25B6</button>
|
|
179
|
+
</div>
|
|
180
|
+
</div>`}return`<div id="${X}" class="${R}" ${O?`style='${O}'`:""}>${j}</div>`}function zY(Z){let{type:Y,data:$,options:J={},width:Q="100%",height:X=300,id:F=_("chart"),className:z,style:R}=Z,O=L("stx-chart",`stx-chart--${Y}`,z),j={width:typeof Q==="number"?`${Q}px`:Q,height:typeof X==="number"?`${X}px`:X},V=[D(j),D(R)].filter(Boolean).join("; "),K=JSON.stringify({type:Y,data:$,options:J});return`<div id="${F}" class="${O}" style="${V}" data-chart='${q(K)}'>
|
|
181
|
+
<div class="stx-chart-placeholder">
|
|
182
|
+
${J.title?`<div class="stx-chart-title">${q(J.title)}</div>`:""}
|
|
183
|
+
<div class="stx-chart-type">${Y.charAt(0).toUpperCase()+Y.slice(1)} Chart</div>
|
|
184
|
+
<div class="stx-chart-info">${$.datasets.length} dataset(s), ${$.labels.length} labels</div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>`}function RY(Z){let{value:Y="",language:$="plaintext",theme:J="dark",lineNumbers:Q=!0,readOnly:X=!1,height:F=300,tabSize:z=2,wordWrap:R=!1,id:O=_("code"),className:j,style:V}=Z,K=L("stx-code-editor",`stx-code-editor--${J}`,Q&&"stx-code-editor--line-numbers",X&&"stx-code-editor--readonly",R&&"stx-code-editor--wrap",j),U={height:typeof F==="number"?`${F}px`:F},W=[D(U),D(V)].filter(Boolean).join("; "),T=Y.split(`
|
|
187
|
+
`),N="";if(Q){N+='<div class="stx-code-editor-gutter">';for(let E=1;E<=T.length;E++)N+=`<div class="stx-code-editor-line-number">${E}</div>`;N+="</div>"}return N+=`<pre class="stx-code-editor-content"><code class="language-${q($)}">${q(Y)}</code></pre>`,`<div id="${O}" class="${K}" style="${W}" data-language="${q($)}" data-tab-size="${z}">${N}</div>`}function FY(Z){let{src:Y,type:$="video",poster:J,autoplay:Q=!1,loop:X=!1,muted:F=!1,controls:z=!0,width:R,height:O,id:j=_("media"),className:V,style:K}=Z,U=L("stx-media-player",`stx-media-player--${$}`,V),W={};if(R)W.width=typeof R==="number"?`${R}px`:R;if(O)W.height=typeof O==="number"?`${O}px`:O;let T=[D(W),D(K)].filter(Boolean).join("; "),N=[`id="${j}-media"`,`src="${q(Y)}"`,z&&"controls",Q&&"autoplay",X&&"loop",F&&"muted",$==="video"&&J&&`poster="${q(J)}"`].filter(Boolean).join(" "),E=$==="video"?`<video ${N}>Your browser does not support the video tag.</video>`:`<audio ${N}>Your browser does not support the audio tag.</audio>`;return`<div id="${j}" class="${U}" ${T?`style='${T}'`:""}>${E}</div>`}function OY(Z){if(Z===void 0)return"";let Y=["B","KB","MB","GB"],$=Z,J=0;while($>=1024&&J<Y.length-1)$/=1024,J++;return`${$.toFixed(1)} ${Y[J]}`}function KY(Z){let{files:Y,viewMode:$="list",showHidden:J=!1,selectable:Q=!0,id:X=_("files"),className:F,style:z}=Z,R=L("stx-file-explorer",`stx-file-explorer--${$}`,F),O=D(z),j=J?Y:Y.filter((K)=>!K.name.startsWith(".")),V="";if($==="list"){V='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let K of j){let U=K.icon||(K.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),W=K.type==="file"?OY(K.size):"",T=K.modified?K.modified.toLocaleDateString():"";V+=`<tr class="stx-file-explorer-item ${Q?"stx-file-explorer-item--selectable":""}" data-path="${q(K.path)}" data-type="${K.type}">
|
|
188
|
+
<td><span class="stx-file-explorer-icon">${U}</span>${q(K.name)}</td>
|
|
189
|
+
<td>${W}</td>
|
|
190
|
+
<td>${T}</td>
|
|
191
|
+
</tr>`}V+="</tbody></table>"}else{V='<div class="stx-file-explorer-grid">';for(let K of j){let U=K.icon||(K.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");V+=`<div class="stx-file-explorer-item ${Q?"stx-file-explorer-item--selectable":""}" data-path="${q(K.path)}" data-type="${K.type}">
|
|
192
|
+
<div class="stx-file-explorer-icon">${U}</div>
|
|
193
|
+
<div class="stx-file-explorer-name">${q(K.name)}</div>
|
|
194
|
+
</div>`}V+="</div>"}return`<div id="${X}" class="${R}" ${O?`style='${O}'`:""}>${V}</div>`}function jY(Z){let{url:Y,width:$="100%",height:J=400,sandbox:Q=!0,allowScripts:X=!0,id:F=_("webview"),className:z,style:R}=Z,O=L("stx-webview",z),j={width:typeof $==="number"?`${$}px`:$,height:typeof J==="number"?`${J}px`:J},V=[D(j),D(R)].filter(Boolean).join("; "),K=[];if(Q){if(K.push("allow-same-origin"),X)K.push("allow-scripts")}let U=Q?`sandbox="${K.join(" ")}"`:"";return`<iframe id="${F}" class="${O}" src="${q(Y)}" style="${V}" ${U} loading="lazy" frameborder="0"></iframe>`}var VY=["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"],qY=`
|
|
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 PY(){return!1}function FZ(){return typeof window<"u"&&typeof document<"u"}var g=[];function UY(){return`modal-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function WY(Z){switch(Z){case"info":return"ℹ";case"warning":return"⚠";case"error":return"✖";case"success":return"✔";case"question":return"❓";default:return"ℹ"}}function t(Z){if(Z==="question")return[{label:"No",style:"default"},{label:"Yes",style:"primary"}];return[{label:"OK",style:"primary"}]}function DY(Z){let{options:Y}=Z,$=WY(Y.type),J=Y.buttons||t(Y.type),Q=Y.type||"info",X="";return J.forEach((F,z)=>{let R=F.style==="destructive"?"destructive":F.style==="primary"?"primary":"default",O=z===(Y.defaultButton??J.length-1)?"autofocus":"";X+=`<button class="stx-modal-btn ${R}" data-index="${z}" ${O}>${F.label}</button>`}),`
|
|
552
|
+
<div class="stx-modal-overlay" data-modal-id="${Z.id}">
|
|
553
|
+
<div class="stx-modal ${Q}" role="dialog" aria-modal="true" aria-labelledby="${Z.id}-title">
|
|
554
|
+
<div class="stx-modal-icon">${$}</div>
|
|
555
|
+
<div class="stx-modal-content">
|
|
556
|
+
${Y.title?`<h2 id="${Z.id}-title" class="stx-modal-title">${kZ(Y.title)}</h2>`:""}
|
|
557
|
+
<p class="stx-modal-message">${kZ(Y.message)}</p>
|
|
558
|
+
</div>
|
|
559
|
+
<div class="stx-modal-buttons">${X}</div>
|
|
560
|
+
</div>
|
|
561
|
+
</div>
|
|
562
|
+
`}function kZ(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(Z,Y,$=!1){let J=g.indexOf(Z);if(J>-1)g.splice(J,1);if(Z.element&&FZ())Z.element.remove();let X=(Z.options.buttons||t(Z.options.type))[Y];if(X?.action)X.action();Z.resolve({buttonIndex:Y,cancelled:$})}async function u(Z){let Y=PY(),$=UY();return new Promise((J)=>{let Q={id:$,options:Z,resolve:J};if(g.push(Q),Y)console.log(`[stx-modal] Showing native modal: ${Z.title||"Modal"}`),setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0);else if(FZ())try{let X=document.createElement("div");X.innerHTML=DY(Q);let F=X.firstElementChild;if(!F){console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0);return}Q.element=F;try{document.body.appendChild(F)}catch{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0);return}try{F.querySelectorAll(".stx-modal-btn").forEach((z)=>{z.addEventListener("click",()=>{let R=Number.parseInt(z.dataset.index||"0",10);x(Q,R,!1)})})}catch{}try{F.addEventListener("click",(z)=>{if(z.target===F){let R=Z.cancelButton??0;x(Q,R,!0)}})}catch{}try{let z=(R)=>{if(R.key==="Escape"){let O=Z.cancelButton??0;x(Q,O,!0),document.removeEventListener("keydown",z)}else if(R.key==="Enter"){let O=Z.defaultButton??(Z.buttons||t(Z.type)).length-1;x(Q,O,!1),document.removeEventListener("keydown",z)}};document.addEventListener("keydown",z)}catch{}try{let z=F.querySelector(".stx-modal-btn[autofocus]");if(z)z.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`);let X=Z.buttons||t(Z.type);console.log(`[stx-modal] Buttons: ${X.map((F)=>F.label).join(", ")}`),setTimeout(()=>{x(Q,Z.defaultButton??0,!1)},0)}})}async function HZ(Z,Y){return u({title:Z,message:Y,type:"info"})}async function LY(Z,Y){return u({title:Z,message:Y,type:"warning"})}async function MY(Z,Y){return u({title:Z,message:Y,type:"error"})}async function _Y(Z,Y){return u({title:Z,message:Y,type:"success"})}async function xZ(Z,Y){return u({title:Z,message:Y,type:"question",buttons:[{label:"No",style:"default"},{label:"Yes",style:"primary"}],defaultButton:1,cancelButton:0})}async function TY(Z,Y="Confirm"){return(await xZ(Y,Z)).buttonIndex===1}async function NY(Z,Y="Alert"){await HZ(Y,Z)}async function EY(Z,Y="",$="Input"){if(FZ()&&typeof window.prompt==="function")return window.prompt(Z,Y);return console.log(`[stx-modal] PROMPT: ${$}`),console.log(`[stx-modal] ${Z}`),console.log(`[stx-modal] Default: ${Y}`),Y}function AY(){return g.length}function kY(){while(g.length>0){let Z=g[g.length-1];x(Z,0,!0)}}var HY=`
|
|
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
|
+
`;import CZ from"process";function xY(){if(CZ.platform)return CZ.platform;return"unknown"}function wZ(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function SZ(Z,Y){if(Z.type==="separator")return{id:`sep-${Y}`,label:"",type:"separator"};let $={id:`item-${Y}-${Z.label.replace(/\s+/g,"-").toLowerCase()}`,label:Z.label,type:Z.type||"normal",enabled:Z.enabled!==!1};if(Z.accelerator)$.shortcut=Z.accelerator;if(Z.type==="checkbox")$.checked=Z.checked||!1;if(Z.type==="submenu"&&Z.submenu)$.submenu=Z.submenu.map((J,Q)=>SZ(J,Q));return $}function OZ(Z){return Z.map((Y,$)=>SZ(Y,$))}function BZ(Z,Y=0){if(Z.type==="separator")return'<hr class="stx-tray-separator" />';let $=" ".repeat(Y),J=Z.enabled===!1?"disabled":"",Q=Z.checked?"\u2713 ":"",X=Z.accelerator?`<span class="accelerator">${Z.accelerator}</span>`:"",F=`${$}<div class="stx-tray-item ${J}" data-action="${Z.label}">`;if(F+=`<span class="label">${Q}${Z.label}</span>${X}`,Z.type==="submenu"&&Z.submenu){F+='<span class="arrow">\u25B8</span>',F+='<div class="stx-tray-submenu">';for(let z of Z.submenu)F+=BZ(z,Y+1);F+="</div>"}return F+="</div>",F}function CY(Z){let Y='<div class="stx-tray-menu">';for(let $ of Z)Y+=BZ($);return Y+="</div>",Y}var f=new Map;function IY(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var IZ=!1;function wY(){if(IZ||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Z)=>{let{action:Y}=Z.detail;for(let $ of f.values()){let J=$.handlers.get(Y);if(J){J();break}}}),IZ=!0}async function fZ(Z={}){let Y=IY(),$=xY(),J=wZ(),Q={icon:Z.icon||"",tooltip:Z.tooltip||"stx Application",menu:Z.menu||[],visible:!0},X=new Map;for(let z of Z.menu||[]){if(z.type!=="separator"&&z.onClick)X.set(z.label,z.onClick);if(z.type==="submenu"&&z.submenu){for(let R of z.submenu)if(R.type!=="separator"&&R.onClick)X.set(R.label,R.onClick)}}if(f.set(Y,{state:Q,handlers:X}),J){wY();let z=window;try{if(Q.tooltip)await z.craft.tray.setTitle({title:Q.tooltip}),await z.craft.tray.setTooltip({tooltip:Q.tooltip});if(Q.icon)await z.craft.tray.setIcon({icon:Q.icon});let R=OZ(Q.menu);await z.craft.tray.setMenu({items:R}),console.log(`[stx-tray] Native tray created for ${$}`)}catch(R){console.warn("[stx-tray] Failed to create native tray:",R)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Y}`),console.log(`[stx-tray] Tooltip: ${Q.tooltip}`),console.log(`[stx-tray] Menu items: ${Q.menu.length}`);return{id:Y,setIcon:(z)=>{if(Q.icon=z,J)window.craft.tray.setIcon({icon:z}).catch((O)=>{console.warn("[stx-tray] Failed to set icon:",O)});console.log(`[stx-tray:${Y}] Icon updated`)},setTooltip:(z)=>{if(Q.tooltip=z,J)window.craft.tray.setTooltip({tooltip:z}).catch((O)=>{console.warn("[stx-tray] Failed to set tooltip:",O)});console.log(`[stx-tray:${Y}] Tooltip: ${z}`)},setMenu:(z)=>{Q.menu=z,X.clear();for(let R of z){if(R.type!=="separator"&&R.onClick)X.set(R.label,R.onClick);if(R.type==="submenu"&&R.submenu){for(let O of R.submenu)if(O.type!=="separator"&&O.onClick)X.set(O.label,O.onClick)}}if(J){let R=window,O=OZ(z);R.craft.tray.setMenu({items:O}).catch((j)=>{console.warn("[stx-tray] Failed to set menu:",j)})}console.log(`[stx-tray:${Y}] Menu updated (${z.length} items)`)},destroy:()=>{if(Q.visible=!1,f.delete(Y),J)window.craft.tray.destroy?.().catch((R)=>{console.warn("[stx-tray] Failed to destroy tray:",R)});console.log(`[stx-tray:${Y}] Destroyed`)}}}var SY=fZ;function BY(){return Array.from(f.keys())}function fY(Z){let Y=f.get(Z);if(!Y)return null;let $=wZ();return{id:Z,setIcon:(J)=>{if(Y.state.icon=J,$)window.craft.tray.setIcon({icon:J}).catch(()=>{})},setTooltip:(J)=>{if(Y.state.tooltip=J,$)window.craft.tray.setTooltip({tooltip:J}).catch(()=>{})},setMenu:(J)=>{if(Y.state.menu=J,$){let Q=window,X=OZ(J);Q.craft.tray.setMenu({items:X}).catch(()=>{})}},destroy:()=>{if(f.delete(Z),$)window.craft.tray.destroy?.().catch(()=>{})}}}function vY(Z,Y){let $=f.get(Z);if(!$)return!1;let J=$.handlers.get(Y);if(J)return J(),!0;return!1}function yY(Z){let Y=f.get(Z);if(!Y)return null;return CY(Y.state.menu)}function gY(){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 bY=`
|
|
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 e(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function uY(Z={}){if(e()){let Y=window;try{return await Y.craft.dialog.showOpenDialog(Z)}catch($){console.warn("[stx-dialog] Failed to show native open dialog:",$)}}return new Promise((Y)=>{if(typeof document>"u"){Y({canceled:!0,filePaths:[]});return}let $=document.createElement("input");if($.type="file",$.multiple=Z.multiSelections??!1,Z.filters?.length){let J=Z.filters.flatMap((Q)=>Q.extensions.map((X)=>`.${X}`));$.accept=J.join(",")}if(Z.canChooseDirectories&&!Z.canChooseFiles)$.webkitdirectory=!0;$.onchange=()=>{let J=Array.from($.files||[]);if(J.length===0)Y({canceled:!0,filePaths:[]});else{let Q=J.map((X)=>X.name);Y({canceled:!1,filePaths:Q})}},$.oncancel=()=>{Y({canceled:!0,filePaths:[]})},$.click()})}async function mY(Z={}){if(e()){let $=window;try{return await $.craft.dialog.showSaveDialog(Z)}catch(J){console.warn("[stx-dialog] Failed to show native save dialog:",J)}}if(typeof window<"u"&&"showSaveFilePicker"in window)try{let $=Z.filters?.map((Q)=>({description:Q.name,accept:{"*/*":Q.extensions.map((X)=>`.${X}`)}}));return{canceled:!1,filePath:(await window.showSaveFilePicker({suggestedName:Z.defaultPath,types:$})).name}}catch($){return{canceled:!0}}console.warn("[stx-dialog] Save dialog not available, using prompt fallback");let Y=prompt("Enter filename:",Z.defaultPath||"file.txt");if(Y)return{canceled:!1,filePath:Y};return{canceled:!0}}async function l(Z){if(e()){let J=window;try{return await J.craft.dialog.showMessageBox(Z)}catch(Q){console.warn("[stx-dialog] Failed to show native message box:",Q)}}let Y=Z.buttons||["OK"];if(Y.length===1)return alert(Z.message),{response:0};if(Y.length===2&&Z.type==="question")return{response:confirm(Z.message)?1:0};return console.warn("[stx-dialog] Complex message box not fully supported in browser, using confirm"),{response:confirm(`${Z.message}
|
|
774
|
+
|
|
775
|
+
${Y.join(" / ")}`)?Y.length-1:0}}async function hY(Z={}){if(e()){let Y=window;try{return await Y.craft.dialog.showColorPicker(Z)}catch($){console.warn("[stx-dialog] Failed to show native color picker:",$)}}return new Promise((Y)=>{if(typeof document>"u"){Y({canceled:!0});return}let $=document.createElement("input");$.type="color",$.value=Z.color||"#000000",$.onchange=()=>{Y({canceled:!1,color:$.value})},$.oncancel=()=>{Y({canceled:!0})},$.click()})}async function cY(Z,Y){await l({type:"info",title:Y||"Alert",message:Z,buttons:["OK"]})}async function pY(Z,Y){return(await l({type:"question",title:Y||"Confirm",message:Z,buttons:["Cancel","OK"],defaultButton:1,cancelButton:0})).response===1}async function lY(Z,Y){await l({type:"error",title:Y||"Error",message:Z,buttons:["OK"]})}async function dY(Z,Y){await l({type:"warning",title:Y||"Warning",message:Z,buttons:["OK"]})}function rY(){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
|
+
`}import I from"process";import{existsSync as nY}from"fs";import{dirname as oY,join as aY}from"path";import{craftBinaryNotFoundMessage as vZ,resolveCraftBinary as iY}from"craft-native";var m={};function sY(Z){m={...m,...Z}}function tY(){return{...m}}function eY(){m={}}function KZ(Z){if(!Z.sidebarConfig)return;let Y={...Z.sidebarConfig};if(Y.variant==="desktop")Y.material=Y.material??"sidebar",Y.backgroundEffect=Y.backgroundEffect??"shimmer",Y.allowsVibrancy=Y.allowsVibrancy??!0;return Y}function ZZ(){let Z=[I.env.CRAFT_BINARY_PATH,m.craftBinaryPath,...m.additionalSearchPaths||[],aY(oY(I.execPath),"craft")];for(let Y of Z)if(Y&&nY(Y))return Y;return iY()}var C=new Map;function Z6(){return Array.from(C.keys())}function Y6(Z){let Y=C.get(Z);if(!Y)return null;return YZ(Z,Y.app)}function $6(){for(let[Z,Y]of C)try{Y.app?.close?.()}catch($){console.warn(`Failed to close window ${Z}:`,$)}C.clear()}function YZ(Z,Y){return{id:Z,show:()=>{console.log(`[stx/desktop] Window ${Z} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let $=C.get(Z);if($?.app)$.app.close(),C.delete(Z),console.log(`[stx/desktop] Window ${Z} 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:($)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${$}" }) from inside the webview`)},loadURL:($)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${$}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function jZ(Z,Y={}){let $=["--url",Z,"--title",Y.title||"stx Desktop","--width",String(Y.width??1200),"--height",String(Y.height??800)];if(Y.darkMode)$.push("--dark");if(Y.hotReload)$.push("--hot-reload");if(Y.resizable===!1)$.push("--no-resize");if(Y.frameless)$.push("--frameless");if(Y.alwaysOnTop)$.push("--always-on-top");if(Y.titlebarHidden)$.push("--titlebar-hidden");if(Y.systemTray)$.push("--system-tray");if(Y.hideDockIcon)$.push("--hide-dock-icon");if(Y.devTools===!1)$.push("--no-devtools");if(Y.nativeSidebar)$.push("--native-sidebar");if(Y.sidebarWidth!==void 0)$.push("--sidebar-width",String(Y.sidebarWidth));let J=KZ(Y);if(J)$.push("--sidebar-config",JSON.stringify(J));return $}async function J6(Z,Y={}){let $=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J=ZZ();try{let{createApp:Q}=await import("craft-native"),X=Q({url:Z,craftPath:J,window:{title:Y.title||"stx Desktop",width:Y.width??1200,height:Y.height??800,darkMode:Y.darkMode??!1,hotReload:Y.hotReload??!1,resizable:Y.resizable??!0,frameless:Y.frameless??!1,alwaysOnTop:Y.alwaysOnTop??!1,titlebarHidden:Y.titlebarHidden??!1,systemTray:Y.systemTray??!1,hideDockIcon:Y.hideDockIcon??!1,devTools:Y.devTools??!1,nativeSidebar:Y.nativeSidebar??!1,sidebarWidth:Y.sidebarWidth,sidebarConfig:KZ(Y)}});return C.set($,{app:X,url:Z,options:Y}),await X.show(),YZ($,X)}catch{try{let{spawn:Q}=await import("child_process"),X=Q(J,jZ(Z,Y),{stdio:"inherit"});X.on("error",(z)=>{console.error(z.code==="ENOENT"?vZ(J):`craft child error: ${z.message}`)});let F={close:()=>X.kill()};return C.set($,{app:F,url:Z,options:Y}),YZ($,F)}catch(Q){return console.error("Failed to spawn craft binary:",Q.message),null}}}async function G6(Z,Y={}){let $=`http://localhost:${Z}/`;if(I.env.NODE_ENV==="test"||I.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:Q}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let X=!Y.nativeSidebar,F=KZ(Y),z=Q({url:$,craftPath:ZZ(),window:{title:Y.title||"stx Development",width:Y.width||1400,height:Y.height||900,resizable:!0,systemTray:X,darkMode:Y.darkMode??!0,hotReload:Y.hotReload??!0,devTools:!0,titlebarHidden:Y.titlebarHidden??!1,nativeSidebar:Y.nativeSidebar??!1,sidebarWidth:Y.sidebarWidth??260,sidebarConfig:F}}),R=`dev-window-${Z}`;return C.set(R,{app:z,url:$,options:Y}),await z.show(),console.log(`\u2713 Native window opened at ${$}`),!0}catch{let Q=ZZ();try{console.log(`\u26A1 Opening native window via craft binary (${Q})\u2026`);let{spawn:X}=await import("child_process"),F=X(Q,jZ($,{title:"stx Development",width:1400,height:900,hotReload:!0,...Y}),{stdio:"inherit"});F.on("exit",()=>I.exit(0)),F.on("error",(R)=>{console.warn(R.code==="ENOENT"?vZ(Q):`craft child error: ${R.message}`)});let z=`dev-window-${Z}`;return C.set(z,{app:{close:()=>F.kill()},url:$,options:Y}),console.log(`\u2713 Native window opened at ${$}`),!0}catch(X){console.warn("\u26A0 Could not spawn craft binary:",X.message)}if(I.env.NODE_ENV==="test"||I.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:X}=await import("child_process"),F=I.platform;return X(F==="darwin"?"open":F==="win32"?"cmd":"xdg-open",F==="win32"?["/c","start",$]:[$],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${$}`),!0}catch(X){return console.error("Could not open browser:",X),console.log(`Please open manually: ${$}`),!1}}}async function Q6(Z,Y={}){let{title:$="stx Desktop",width:J=1200,height:Q=800,darkMode:X=!1,hotReload:F=!1,resizable:z=!0,frameless:R=!1,alwaysOnTop:O=!1}=Y;try{let{createApp:j}=await import("craft-native"),V=ZZ(),K=j({html:Z,craftPath:V,window:{title:$,width:J,height:Q,darkMode:X,hotReload:F,resizable:z,frameless:R,alwaysOnTop:O}}),U=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return C.set(U,{app:K,url:"html-content",options:Y}),await K.show(),YZ(U,K)}catch(j){return console.error("Failed to create window with HTML:",j),null}}function X6(){try{return v.resolve("craft-native"),!0}catch{return!1}}function z6(){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
|
+
`}import{pack as R6,packageApp as F6}from"craft-native";import{craftBinaryNotFoundMessage as O6,resolveCraftBinary as K6}from"craft-native";import{AutoUpdater as yZ,generateUpdateManifest as gZ}from"craft-native";var bZ="update.json";function uZ(Z,Y){return`https://github.com/${Z}/releases/latest/download/${Y}`}function mZ(Z,Y,$){return`https://github.com/${Z}/releases/download/${Y}/${$}`}function j6(Z){let{repository:Y,manifestAsset:$=bZ,...J}=Z;return new yZ({...J,updateUrl:uZ(Y,$)})}function V6(Z){let Y=Z.tag??`v${Z.version}`,$={};for(let[J,Q]of Object.entries(Z.artifacts)){if(!Q)continue;$[J]={path:Q,url:mZ(Z.repository,Y,Q.split("/").pop())}}return gZ({version:Z.version,releaseNotes:Z.releaseNotes,platforms:$})}var VZ=null,A=null;class hZ{_process;_startedAt;_endsAt;_options;_expireHandlers=[];_expireTimer=null;_stopped=!1;constructor(Z,Y){this._process=Z,this._options=Y,this._startedAt=new Date;let $=Y.duration;if($&&$>0){let J=$*60*1000;this._endsAt=new Date(this._startedAt.getTime()+J),this._expireTimer=setTimeout(()=>{this._stopped=!0;for(let Q of this._expireHandlers)try{Q()}catch{}},J)}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 Z=this._endsAt.getTime()-Date.now();return Math.max(0,Z)}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(Z){this._expireHandlers.push(Z)}}function q6(Z={}){cZ();let{duration:Y,preventDisplaySleep:$=!0,preventIdleSleep:J=!0,preventSystemSleep:Q=!0,preventDiskSleep:X=!1,assertUserActivity:F=!0}=Z,z=[];if($)z.push("-d");if(J)z.push("-i");if(Q)z.push("-s");if(X)z.push("-m");if(F)z.push("-u");let R=[...z];if(Y&&Y>0)R.push("-t",String(Y*60));let O=Bun.spawn(["/usr/bin/caffeinate",...R],{stdio:["ignore","ignore","ignore"]}),j=new hZ(O,Z);return VZ=O,A=j,j}function cZ(Z){if(Z){if(Z.stop(),A===Z)VZ=null,A=null;return}if(A)A.stop();VZ=null,A=null}function P6(){return A!==null&&A.isActive}function U6(){if(!A||!A.isActive)return{active:!1,instance:null,startedAt:null,endsAt:null,durationMinutes:null};let Y=A.options.duration;return{active:!0,instance:A,startedAt:A.startedAt,endsAt:A.endsAt,durationMinutes:Y&&Y>0?Y:-1}}function W6(Z){let Y=Z||A;if(!Y||!Y.isActive)return"0:00";let $=Y.remainingMs;if($===null)return"\u221E";let J=Math.ceil($/1000),Q=Math.floor(J/3600),X=Math.floor(J%3600/60),F=J%60;if(Q>0)return`${Q}:${String(X).padStart(2,"0")}:${String(F).padStart(2,"0")}`;return`${X}:${String(F).padStart(2,"0")}`}function D6(Z){if(Z<=0||Z===-1)return"Indefinitely";if(Z<60)return`${Z} minutes`;if(Z===60)return"1 hour";if(Z%60===0)return`${Z/60} hours`;let Y=Math.floor(Z/60),$=Z%60;return`${Y}h ${$}m`}import{existsSync as qZ,mkdirSync as L6,readFileSync as M6,watch as _6,writeFileSync as T6}from"fs";import{homedir as N6,platform as E6}from"os";import{dirname as A6,join as d}from"path";function k6(Z){let Y=E6(),$=N6();switch(Y){case"darwin":return d($,"Library","Application Support",Z);case"win32":return d(process.env.APPDATA||d($,"AppData","Roaming"),Z);default:return d($,".config",Z)}}class pZ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Z){this._defaults={...Z.defaults};let Y=Z.path?A6(Z.path):k6(Z.name);if(this._path=Z.path||d(Y,"preferences.json"),!qZ(Y))L6(Y,{recursive:!0});if(this._data=this._load(),Z.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Z){if(Z in this._data)return this._data[Z];return this._defaults[Z]}set(Z,Y){let $=this.get(Z);if(JSON.stringify($)===JSON.stringify(Y))return;this._data[Z]=Y,this._scheduleSave(),this._notifyChange(Z,Y,$)}getAll(){return{...this._defaults,...this._data}}has(Z){return Z in this._data}delete(Z){if(!(Z in this._data))return;let Y=this._data[Z];delete this._data[Z],this._scheduleSave(),this._notifyChange(Z,this._defaults[Z],Y)}reset(){let Z={...this._data};this._data={},this._save();for(let Y of Object.keys(Z)){let $=this._defaults[Y];this._notifyChange(Y,$,Z[Y])}}onChange(Z,Y){let $=Z;if(!this._changeHandlers.has($))this._changeHandlers.set($,new Set);return this._changeHandlers.get($).add(Y),()=>{this._changeHandlers.get($)?.delete(Y)}}onAnyChange(Z){return this._anyChangeHandlers.add(Z),()=>{this._anyChangeHandlers.delete(Z)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(qZ(this._path)){let Z=M6(this._path,"utf-8");return JSON.parse(Z)}}catch{}return{}}_save(){this._writing=!0;try{let Z=JSON.stringify({...this._defaults,...this._data},null,2);T6(this._path,Z,"utf-8")}catch(Z){console.error(`Failed to save preferences to ${this._path}:`,Z)}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(!qZ(this._path))this._save();this._watcher=_6(this._path,()=>{if(this._writing)return;let Z=this._load(),Y={...this._data};this._data=Z;let $=new Set([...Object.keys(Y),...Object.keys(Z)]);for(let J of $){let Q=J in Y?Y[J]:this._defaults[J],X=J in Z?Z[J]:this._defaults[J];if(JSON.stringify(Q)!==JSON.stringify(X))this._notifyChange(J,X,Q)}})}catch{}}_notifyChange(Z,Y,$){let J=this._changeHandlers.get(Z);if(J)for(let Q of J)try{Q(Y,$)}catch{}for(let Q of this._anyChangeHandlers)try{Q(Z,Y,$)}catch{}}}function H6(Z){return new pZ(Z)}import{existsSync as h,mkdirSync as lZ,readFileSync as x6,unlinkSync as dZ,writeFileSync as rZ}from"fs";import{homedir as $Z,platform as nZ}from"os";import{join as c}from"path";function oZ(Z){let Y=Z.toLowerCase().replace(/[^a-z0-9]/g,"-");return c($Z(),"Library","LaunchAgents",`com.${Y}.plist`)}function aZ(Z){let Y=process.env.XDG_CONFIG_HOME||c($Z(),".config");return c(Y,"autostart",`${Z.toLowerCase()}.desktop`)}async function C6(Z,Y){let $=Y.appName||"StxApp",J=oZ($),Q=c($Z(),"Library","LaunchAgents");if(Z){let X=Y.appPath||process.execPath,F=Y.args||[],z=[X,...F],R=`<?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.${$.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
|
|
871
|
+
<key>ProgramArguments</key>
|
|
872
|
+
<array>
|
|
873
|
+
${z.map((O)=>` <string>${B6(O)}</string>`).join(`
|
|
874
|
+
`)}
|
|
875
|
+
</array>
|
|
876
|
+
<key>RunAtLoad</key>
|
|
877
|
+
<true/>
|
|
878
|
+
<key>KeepAlive</key>
|
|
879
|
+
<false/>
|
|
880
|
+
${Y.isHidden?` <key>ProcessType</key>
|
|
881
|
+
<string>Background</string>`:""}
|
|
882
|
+
</dict>
|
|
883
|
+
</plist>`;if(!h(Q))lZ(Q,{recursive:!0});rZ(J,R,"utf-8")}else if(h(J))dZ(J)}async function I6(Z,Y){let $=Y.appName||"StxApp",J=aZ($),Q=c(process.env.XDG_CONFIG_HOME||c($Z(),".config"),"autostart");if(Z){let X=Y.appPath||process.execPath,F=Y.args||[],z=[X,...F].join(" "),R=`[Desktop Entry]
|
|
884
|
+
Type=Application
|
|
885
|
+
Name=${$}
|
|
886
|
+
Exec=${z}
|
|
887
|
+
Terminal=false
|
|
888
|
+
StartupNotify=false
|
|
889
|
+
${Y.isHidden?`X-GNOME-Autostart-enabled=true
|
|
890
|
+
NoDisplay=true`:""}
|
|
891
|
+
`;if(!h(Q))lZ(Q,{recursive:!0});rZ(J,R,"utf-8")}else if(h(J))dZ(J)}async function w6(Z){return h(oZ(Z))}async function S6(Z){let Y=aZ(Z);if(!h(Y))return!1;try{let $=x6(Y,"utf-8");if($.includes("X-GNOME-Autostart-enabled=false"))return!1;if($.includes("Hidden=true"))return!1;return!0}catch{return!1}}function B6(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function f6(Z,Y={}){let $=nZ();switch($){case"darwin":return C6(Z,Y);case"linux":return I6(Z,Y);default:throw Error(`Auto-launch is not yet supported on ${$}`)}}async function v6(Z){let Y=Z||"StxApp";switch(nZ()){case"darwin":return w6(Y);case"linux":return S6(Y);default:return!1}}var B=new Map,y6=0,JZ=!1;function iZ(Z){let Y=Z.split("+").map((J)=>J.trim()),$={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let J of Y){let Q=J.toLowerCase();switch(Q){case"cmd":case"command":case"meta":case"\u2318":$.meta=!0;break;case"ctrl":case"control":case"\u2303":$.ctrl=!0;break;case"shift":case"\u21E7":$.shift=!0;break;case"alt":case"option":case"opt":case"\u2325":$.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")$.meta=!0;else $.ctrl=!0;break;default:$.key=Q}}return $}function g6(Z){let Y=[];if(Z.ctrl)Y.push("\u2303");if(Z.alt)Y.push("\u2325");if(Z.shift)Y.push("\u21E7");if(Z.meta)Y.push("\u2318");return Y.push(Z.key.toUpperCase()),Y.join("")}function b6(Z,Y){if(Y.meta!==Z.metaKey)return!1;if(Y.ctrl!==Z.ctrlKey)return!1;if(Y.shift!==Z.shiftKey)return!1;if(Y.alt!==Z.altKey)return!1;return Z.key.toLowerCase()===Y.key||Z.code.toLowerCase()===`key${Y.key}`}function sZ(Z){for(let[,Y]of B)if(b6(Z,Y.parsed)){Z.preventDefault(),Z.stopPropagation();try{Y.handler()}catch{}break}}function u6(){if(JZ)return;if(typeof document>"u")return;document.addEventListener("keydown",sZ,!0),JZ=!0}function PZ(){if(!JZ)return;if(typeof document>"u")return;document.removeEventListener("keydown",sZ,!0),JZ=!1}async function m6(Z,Y){if(typeof window>"u")return!1;let $=window.craft;if(!$?.hotkeys?.register)return!1;try{return await $.hotkeys.register(Z,Y),!0}catch{return!1}}async function UZ(Z){if(typeof window>"u")return;let Y=window.craft;if(!Y?.hotkeys?.unregister)return;try{await Y.hotkeys.unregister(Z)}catch{}}function h6(Z,Y){let $=`hotkey_${++y6}_${Date.now()}`,J=iZ(Z);B.set($,{shortcut:Z,handler:Y,parsed:J}),m6($,Z),u6();let Q={shortcut:Z,id:$,unregister(){tZ(Q)}};return Q}function tZ(Z){if(B.delete(Z.id),UZ(Z.id),B.size===0)PZ()}function c6(){for(let[Z]of B)UZ(Z);B.clear(),PZ()}function p6(){return Array.from(B.entries()).map(([Z,Y])=>({shortcut:Y.shortcut,id:Z,unregister(){if(B.delete(Z),UZ(Z),B.size===0)PZ()}}))}class eZ{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(Z){if(this._duration=Z.duration,this._tickInterval=Z.tickInterval||1000,this._remaining=Z.duration,Z.onComplete)this._completionHandlers.add(Z.onComplete);if(Z.onTick)this._tickHandlers.add(Z.onTick);if(Z.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 Z=Date.now()-this._lastTick;return Math.max(0,this._remaining-Z)}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 Z=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-Z),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(Z){return this._completionHandlers.add(Z),()=>{this._completionHandlers.delete(Z)}}onTick(Z){return this._tickHandlers.add(Z),()=>{this._tickHandlers.delete(Z)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let Z=Date.now(),Y=Z-this._lastTick;this._lastTick=Z,this._remaining=Math.max(0,this._remaining-Y);for(let $ of this._tickHandlers)try{$(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let $ of this._completionHandlers)try{$()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class Z4{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(Z){if(this._interval=Z.interval,this._handler=Z.handler,this._immediate=Z.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 l6(Z){return new eZ(Z)}function d6(Z){return new Z4(Z)}function r6(Z){return new Promise((Y)=>setTimeout(Y,Z))}function n6(Z){let Y=Math.ceil(Z/1000),$=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if($>0)return`${$}:${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`;return`${J}:${String(Q).padStart(2,"0")}`}function o6(Z){let Y=Math.ceil(Z/1000),$=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if($>0){if(J>0)return`${$}h ${J}m`;return`${$}h`}if(J>0){if(Q>0)return`${J}m ${Q}s`;return`${J}m`}return`${Q}s`}function G(Z){if(typeof window>"u")return!1;let Y=window.craft;return!!(Y&&Y[Z])}function M(Z){if(!G(Z))throw Error(`craft.${Z} is not available \u2014 this API requires a Craft native window`);return window.craft[Z]}function P(Z,Y){if(typeof window>"u")return()=>{};let $=(J)=>Y(J.detail??{});return window.addEventListener(Z,$),()=>window.removeEventListener(Z,$)}var a6={async writeText(Z){if(G("clipboard")){await window.craft.clipboard.writeText(Z);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(Z)},async readText(){if(G("clipboard")){let Z=await window.craft.clipboard.readText();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(Z){if(G("clipboard")){await window.craft.clipboard.writeHTML(Z);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let Y=new window.ClipboardItem({"text/html":new Blob([Z],{type:"text/html"}),"text/plain":new Blob([i6(Z)],{type:"text/plain"})});await navigator.clipboard.write([Y])}catch{}},async readHTML(){if(G("clipboard")){let Z=await window.craft.clipboard.readHTML();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let Z=await navigator.clipboard.read();for(let Y of Z)if(Y.types.includes("text/html"))return await(await Y.getType("text/html")).text()}catch{}return""},async clear(){if(G("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(G("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(G("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(G("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function i6(Z){return Z.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
|
|
892
|
+
`).replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\n{3,}/g,`
|
|
893
|
+
|
|
894
|
+
`).trim()}var s6={async show(Z){if(!Z.title)throw Error("notification title is required");if(G("notifications")){await window.craft.notifications.show(Z);return}if(typeof window<"u"&&"Notification"in window){let Y=window.Notification;if(Y.permission==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon});else if(Y.permission==="default"){if(await Y.requestPermission()==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon})}}},async schedule(Z){if(G("notifications")){let J={...Z};if(J.triggerAt instanceof Date)J.triggerAt=J.triggerAt.toISOString();await window.craft.notifications.schedule(J);return}let Y=t6(Z.triggerAt),$=Math.max(0,Y-Date.now());setTimeout(()=>{this.show(Z).catch(()=>{})},$)},async cancel(Z){if(G("notifications"))await window.craft.notifications.cancel(Z)},async cancelAll(){if(G("notifications"))await window.craft.notifications.cancelAll()},async setBadge(Z){let Y=Math.max(0,Math.round(Number.isFinite(Z)?Z:0));if(G("notifications")){await window.craft.notifications.setBadge(Y);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(Y)}catch{}},async clearBadge(){if(G("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(G("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")return!0;if(Z.permission==="denied")return!1;return await Z.requestPermission()==="granted"}return!1},async registerCategories(Z){if(!Array.isArray(Z)||Z.length===0)return;if(G("notifications")){let Y=window.craft.notifications.registerCategories;if(typeof Y==="function")await Y(Z)}},onActionClicked(Z){return P("craft:notification:actionClicked",Z)},onReply(Z){return P("craft:notification:reply",Z)}};function t6(Z){if(Z==null)return Date.now();if(Z instanceof Date)return Z.getTime();if(typeof Z==="number")return Z;let Y=Date.parse(Z);return Number.isNaN(Y)?Date.now():Y}var e6={async readFile(Z){let Y=await M("fs").readFile(Z);return Y&&Y.data||""},async readBuffer(Z){let Y=await M("fs").readFile(Z),$=Y&&Y.data||"";if(Y&&Y.base64===!0)return Y8($);return new TextEncoder().encode($)},async writeFile(Z,Y){await M("fs").writeFile(Z,Y)},async writeBuffer(Z,Y){let $=Z8(Y),J=M("fs");if(typeof J.writeFileBytes==="function")await J.writeFileBytes(Z,$);else await J.writeFile(Z,$)},async copy(Z,Y){if(Z===Y)throw Error("fs.copy: source and destination must differ");await M("fs").copy(Z,Y)},async move(Z,Y){if(Z===Y)throw Error("fs.move: source and destination must differ");await M("fs").move(Z,Y)},async appendFile(Z,Y){await M("fs").appendFile(Z,Y)},async deleteFile(Z){await M("fs").deleteFile(Z)},async exists(Z){return await M("fs").exists(Z)},async stat(Z){return $8(await M("fs").stat(Z))},async readDir(Z){let Y=await M("fs").readDir(Z),$=Y&&Y.entries||[],J=Z.endsWith("/")?Z.slice(0,-1):Z;return $.map((Q)=>({name:Q.name,path:`${J}/${Q.name}`,isDirectory:!!Q.isDirectory}))},async mkdir(Z,Y){await M("fs").mkdir(Z,Y)},async rmdir(Z,Y){await M("fs").rmdir(Z,Y)},async watch(Z,Y){await M("fs").watch(Z,Y)},async unwatch(Z){await M("fs").unwatch(Z)},onChange(Z){return P("craft:fs:change",Z)},async watchTree(Z,Y,$){let J=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Q=M("fs");await Q.watch(Z,J,{recursive:!!Y.recursive});let X=Y.kinds&&Y.kinds.length>0?new Set(Y.kinds):null,F=Math.max(0,Math.floor(Y.coalesceMs??0)),z=[],R=null,O=!1,j=()=>{if(R=null,z.length===0)return;let K=z;z=[];try{$(K)}catch{}},V=P("craft:fs:change",(K)=>{if(O)return;if(K.id!==J)return;if(X&&K.kind&&!X.has(K.kind))return;if(z.push(K),F===0){j();return}if(R==null)R=setTimeout(j,F)});return{id:J,async stop(){if(O)return;if(O=!0,V(),R)clearTimeout(R),R=null;if(z.length>0)j();try{await Q.unwatch(J)}catch{}}}},async homeDir(){return await M("fs").homeDir()},async tempDir(){return await M("fs").tempDir()},async appDataDir(){return await M("fs").appDataDir()}};function Z8(Z){let Y="";for(let $=0;$<Z.length;$++)Y+=String.fromCharCode(Z[$]);return typeof btoa==="function"?btoa(Y):Buffer.from(Z).toString("base64")}function Y8(Z){let Y=typeof atob==="function"?atob(Z):Buffer.from(Z,"base64").toString("binary"),$=new Uint8Array(Y.length);for(let J=0;J<Y.length;J++)$[J]=Y.charCodeAt(J);return $}function $8(Z){return{isFile:!!Z.isFile,isDirectory:!!Z.isDirectory,isSymlink:!!Z.isSymlink,size:Number(Z.size)||0,modifiedAt:Z.modifiedAt!=null?Z.modifiedAt<1000000000000?Z.modifiedAt*1000:Z.modifiedAt:0}}var r=new Set,Y4=!1;function J8(){if(Y4)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let Y=Z.detail;if(Y?.id)r.delete(Y.id)}),Y4=!0}var G8=new Set(["javascript:","data:","file:","vbscript:"]),Q8={async openExternal(Z){let Y=Z.trim().toLowerCase();for(let $ of G8)if(Y.startsWith($))throw Error(`shell.openExternal: ${$} URLs are blocked for safety`);if(G("shell")){await window.craft.shell.openExternal(Z);return}if(typeof window<"u"&&typeof window.open==="function")window.open(Z,"_blank","noopener,noreferrer")},async openPath(Z){await M("shell").openPath(Z)},async showInFinder(Z){await M("shell").showInFinder(Z)},async spawn(Z,Y,$=[],J={}){if(J8(),!Z||typeof Z!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!Y||typeof Y!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray($))throw Error("shell.spawn: args must be an array");for(let Q of $)if(typeof Q!=="string")throw Error("shell.spawn: args entries must be strings");if(r.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);r.add(Z);try{await M("shell").spawn(Z,Y,$,J)}catch(Q){throw r.delete(Z),Q}},async kill(Z){await M("shell").kill(Z),r.delete(Z)},async getEnv(Z){if(G("shell")){let Y=await window.craft.shell.getEnv(Z);return Y==null?void 0:String(Y)}return},async setEnv(Z,Y){await M("shell").setEnv(Z,Y)},onStdout(Z){return P("craft:shell:stdout",Z)},onStderr(Z){return P("craft:shell:stderr",Z)},onExit(Z){return P("craft:shell:exit",Z)}};var X8={async register(Z,Y,$){if(!G("shortcuts"))return;await window.craft.shortcuts.register(Z,Y,$)},async unregister(Z){if(!G("shortcuts"))return;await window.craft.shortcuts.unregister(Z)},async unregisterAll(){if(!G("shortcuts"))return;await window.craft.shortcuts.unregisterAll()},async enable(Z){if(!G("shortcuts"))return;await window.craft.shortcuts.enable(Z)},async disable(Z){if(!G("shortcuts"))return;await window.craft.shortcuts.disable(Z)},async isRegistered(Z){if(!G("shortcuts"))return!1;return await window.craft.shortcuts.isRegistered(Z)},async list(){if(!G("shortcuts"))return[];return await window.craft.shortcuts.list()},on(Z){return P("craft:shortcut",Z)}};var z8={get(){if(G("theme"))try{return window.craft.theme.get()}catch{}return{appearance:R8()}},onChange(Z){if(Z(this.get()),G("theme"))return P("craft:theme",Z);if(typeof window<"u"&&window.matchMedia){let Y=window.matchMedia("(prefers-color-scheme: dark)"),$=()=>Z({appearance:Y.matches?"dark":"light"});return Y.addEventListener("change",$),()=>Y.removeEventListener("change",$)}return()=>{}},async current(){return this.get()}};function R8(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function F8(Z,Y={}){if(!G("dragOut"))throw Error("dragOut requires a Craft native window");let $=Array.isArray(Z)?Z:[Z];if($.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start($,Y)}function O8(){return G("dragOut")}var K8={onUrl(Z){if(!G("deepLink"))return()=>{};return P("craft:deepLink",Z)},getInitialUrl(){if(typeof window>"u")return null;if(G("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let Z=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return Z},isAvailable(){return G("deepLink")}};var j8={async isCharging(){if(G("power"))return await window.craft.power.isCharging();let Z=await GZ();return Z?!!Z.charging:!1},async isPluggedIn(){if(G("power"))return await window.craft.power.isPluggedIn();let Z=await GZ();return Z?!!Z.charging||Z.level>=0.999:!1},async isLowPowerMode(){if(G("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(G("power")){let Y=await window.craft.power.batteryLevel();return typeof Y==="number"?Y:null}let Z=await GZ();return Z?Z.level:null},async timeRemaining(){if(G("power")){let $=await window.craft.power.timeRemaining();return typeof $==="number"?$:null}let Z=await GZ();if(!Z)return null;let Y=Z.charging?Z.chargingTime:Z.dischargingTime;return Number.isFinite(Y)?Math.round(Y/60):null},async thermalState(){if(G("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(G("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(Z="app is busy"){if(G("power")){await window.craft.power.preventSleep(Z);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let Y=window;if(Y.__craftWebWakeLock?.release){try{await Y.__craftWebWakeLock.release()}catch{}Y.__craftWebWakeLock=null}try{let $=await navigator.wakeLock.request("screen");Y.__craftWebWakeLock=$}catch{}},async allowSleep(){if(G("power")){await window.craft.power.allowSleep();return}let Z=window.__craftWebWakeLock;if(Z&&typeof Z.release==="function"){try{await Z.release()}catch{}window.__craftWebWakeLock=null}},onSleep(Z){return P("craft:powerSleep",Z)},onWake(Z){return P("craft:powerWake",Z)}};async function GZ(){if(typeof navigator>"u")return null;let Z=navigator;if(typeof Z.getBattery!=="function")return null;try{return await Z.getBattery()}catch{return null}}var V8={async connectionType(){if(G("network"))return await window.craft.network.connectionType();return $4()},async wifiSSID(){if(G("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(G("network")){let Z=await window.craft.network.wifiSignalStrength();return typeof Z==="number"?Z:void 0}return},async ipAddress(){if(G("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(G("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(G("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(G("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(G("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(G("network"))await window.craft.network.openPreferences()},onChange(Z){if(G("network"))return P("craft:networkChange",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({type:$4(),online:!0}),$=()=>Z({type:"none",online:!1});return window.addEventListener("online",Y),window.addEventListener("offline",$),()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",$)}}};function $4(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let Z=navigator.connection;if(!Z)return"unknown";let Y=String(Z.type||Z.effectiveType||"unknown").toLowerCase();if(Y==="wifi"||Y==="cellular"||Y==="ethernet"||Y==="bluetooth"||Y==="none")return Y;return"unknown"}var q8={async checkForUpdates(){if(!G("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!G("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(Z){if(!G("updater"))return;await window.craft.updater.setAutomaticChecks(Z)},async setCheckInterval(Z){if(!G("updater"))return;if(!Number.isFinite(Z))throw Error("setCheckInterval: must be a finite number");let Y=Z<=0?0:Math.max(60,Math.round(Z));await window.craft.updater.setCheckInterval(Y)},async setFeedURL(Z){if(!G("updater"))return;await window.craft.updater.setFeedURL(Z)},async getLastUpdateCheckDate(){if(!G("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!G("updater"))return null;let Z=await window.craft.updater.getUpdateInfo();if(!Z||typeof Z.version!=="string"||Z.version.length===0)return null;return Z},onAvailable(Z){return P("craft:updateAvailable",Z)},onDownloaded(Z){return P("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:Y,publicKeyB64:$}){let J=J4(Z),Q;try{Q=await crypto.subtle.importKey("raw",QZ($),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",Q,QZ(Y),J)}catch{return!1}},async verifyDownload({url:Z,signatureB64:Y,publicKeyB64:$,fetchInit:J}){let Q;try{Q=await fetch(Z,J)}catch{return{ok:!1,reason:"fetch-failed"}}if(!Q.ok)return{ok:!1,reason:"http-error",status:Q.status};let X=new Uint8Array(await Q.arrayBuffer()),F;try{F=await crypto.subtle.importKey("raw",QZ($),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let z=!1;try{z=await crypto.subtle.verify("Ed25519",F,QZ(Y),J4(X))}catch{z=!1}if(!z)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:X}}};function J4(Z){if(Z instanceof ArrayBuffer)return new Uint8Array(Z);let Y=new ArrayBuffer(Z.byteLength),$=new Uint8Array(Y);return $.set(Z),$}function QZ(Z){if(typeof atob==="function"){let J=atob(Z),Q=new ArrayBuffer(J.length),X=new Uint8Array(Q);for(let F=0;F<J.length;F++)X[F]=J.charCodeAt(F);return X}let Y=Buffer.from(Z,"base64"),$=new ArrayBuffer(Y.length);return new Uint8Array($).set(Y),new Uint8Array($)}var P8={onFocus(Z){if(G("window"))return P("craft:window:focus",()=>Z());return WZ("focus",Z)},onBlur(Z){if(G("window"))return P("craft:window:blur",()=>Z());return WZ("blur",Z)},onResize(Z){if(G("window"))return P("craft:window:resize",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},onMove(Z){if(G("window"))return P("craft:window:move",Z);return()=>{}},onClose(Z){if(G("window"))return P("craft:window:close",()=>Z());return WZ("beforeunload",Z)},onMinimize(Z){if(G("window"))return P("craft:window:minimize",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="hidden")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},onRestore(Z){if(G("window"))return P("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)}};function WZ(Z,Y){if(typeof window>"u")return()=>{};let $=()=>Y();return window.addEventListener(Z,$),()=>window.removeEventListener(Z,$)}var G4={name:"",version:"0.0.0"},U8={async hideDockIcon(){if(G("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(G("app"))await window.craft.app.showDockIcon()},async quit(){if(G("app"))await window.craft.app.quit()},async getInfo(){if(!G("app"))return G4;let Z=await window.craft.app.getInfo();return{...G4,...Z||{}}},async notify(Z){if(!Z.title)throw Error("notify: title is required");if(G("app"))await window.craft.app.notify(Z)},async setBadge(Z){if(G("app"))await window.craft.app.setBadge(Z)},async bounce(Z="informational"){if(G("app"))await window.craft.app.bounce(Z)}};var W8={async set(Z){if(G("menu"))await window.craft.menu.set(Z)},async setDock(Z){if(G("menu"))await window.craft.menu.setDock(Z)},async addItem(Z,Y){if(G("menu"))await window.craft.menu.addItem(Z,Y)},async removeItem(Z){if(G("menu"))await window.craft.menu.removeItem(Z)},async enableItem(Z){if(G("menu"))await window.craft.menu.enableItem(Z)},async disableItem(Z){if(G("menu"))await window.craft.menu.disableItem(Z)},async checkItem(Z){if(G("menu"))await window.craft.menu.checkItem(Z)},async uncheckItem(Z){if(G("menu"))await window.craft.menu.uncheckItem(Z)},async setItemLabel(Z,Y){if(G("menu"))await window.craft.menu.setItemLabel(Z,Y)},async clearDock(){if(G("menu"))await window.craft.menu.clearDock()},onAction(Z){return P("craft:menu:action",Z)}};var D8={accentColor:()=>H("system","accentColor",()=>""),highlightColor:()=>H("system","highlightColor",()=>""),language:()=>H("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>H("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>H("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>H("system","is24HourTime",()=>{try{let Z=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Z.hourCycle==="h23"||Z.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>H("system","reduceMotion",()=>DZ("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>H("system","reduceTransparency",()=>DZ("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>H("system","increaseContrast",()=>DZ("(prefers-contrast: more)")),systemVersion:()=>H("system","systemVersion",()=>""),hostname:()=>H("system","hostname",()=>""),username:()=>H("system","username",()=>""),async openPreferences(){if(G("system"))await window.craft.system.openPreferences()}};async function H(Z,Y,$){if(G(Z))return await window.craft[Z][Y]();return await $()}function DZ(Z){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Z).matches}var L8={async getDisplays(){if(G("screen"))return await window.craft.screen.getDisplays();return Q4()},async getPrimary(){if(G("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return Q4()[0]??null},onChange(Z){if(G("screen"))return P("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let Y=()=>Z();return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)}};function Q4(){if(typeof window>"u"||!window.screen)return[];let Z=window.screen;return[{id:0,x:Z.left??0,y:Z.top??0,width:Z.width||0,height:Z.height||0,workX:Z.availLeft??0,workY:Z.availTop??0,workWidth:Z.availWidth??Z.width??0,workHeight:Z.availHeight??Z.height??0,scaleFactor:window.devicePixelRatio||1}]}var M8={async set(Z,Y,$){if(!Z)throw Error("keychain.set: service is required");if(!Y)throw Error("keychain.set: account is required");await M("keychain").set(Z,Y,$)},async get(Z,Y){if(!Z)throw Error("keychain.get: service is required");if(!Y)throw Error("keychain.get: account is required");let $=await M("keychain").get(Z,Y);return typeof $==="string"?$:null},async delete(Z,Y){if(!Z)throw Error("keychain.delete: service is required");if(!Y)throw Error("keychain.delete: account is required");await M("keychain").delete(Z,Y)},async has(Z,Y){if(!Z)throw Error("keychain.has: service is required");if(!Y)throw Error("keychain.has: account is required");return await M("keychain").has(Z,Y)}};var _8={async check(Z){if(G("permissions"))return await window.craft.permissions.check(Z);return await X4(Z)},async request(Z){if(G("permissions"))return await window.craft.permissions.request(Z);return await T8(Z)},async openSettings(Z){if(G("permissions"))await window.craft.permissions.openSettings(Z)}};async function X4(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let Y=await navigator.permissions.query({name:Z});return N8(Y.state)}catch{return"not-supported"}}async function T8(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let Y=await window.Notification.requestPermission();return Y==="granted"?"granted":Y==="denied"?"denied":"undetermined"}return await X4(Z)}function N8(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var E8={async print(){if(G("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(Z){if(!Z)throw Error("printToPDF: path is required");let Y=Z.startsWith("/"),$=/^[a-zA-Z]:[\\/]/.test(Z)||Z.startsWith("\\\\");if(!Y&&!$)throw Error("printToPDF: path must be absolute");let J=await M("printing").printToPDF(Z);return{ok:!!(J&&J.ok),path:J?.path}}};var A8={async enable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};var k8={async addItem(Z){if(G("touchbar"))await window.craft.touchbar.addItem(Z)},async removeItem(Z){if(G("touchbar"))await window.craft.touchbar.removeItem(Z)},async updateItem(Z,Y){if(G("touchbar"))await window.craft.touchbar.updateItem(Z,Y)},async setLabel(Z,Y){if(G("touchbar"))await window.craft.touchbar.setLabel(Z,Y)},async setIcon(Z,Y){if(G("touchbar"))await window.craft.touchbar.setIcon(Z,Y)},async setEnabled(Z,Y){if(G("touchbar"))await window.craft.touchbar.setEnabled(Z,Y)},async setSliderValue(Z,Y){if(G("touchbar"))await window.craft.touchbar.setSliderValue(Z,Y)},async clear(){if(G("touchbar"))await window.craft.touchbar.clear()},async show(){if(G("touchbar"))await window.craft.touchbar.show()},async hide(){if(G("touchbar"))await window.craft.touchbar.hide()},onAction(Z){return P("craft:touchbar:action",Z)}};var H8=/^[\da-f]*$/i;function x8(Z,Y){if(typeof Y!=="string"||!H8.test(Y)||Y.length%2!==0)throw Error(`${Z}: must be a hex string with even length, got ${JSON.stringify(Y)}`)}var C8={async isEnabled(){return G("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return G("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return G("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return G("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return G("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(Z){if(G("bluetooth"))await window.craft.bluetooth.connect(Z)},async disconnect(Z){if(G("bluetooth"))await window.craft.bluetooth.disconnect(Z)},async openPreferences(){if(G("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(Z){if(!Z)throw Error("bluetooth.discoverServices: deviceId is required");if(!G("bluetooth"))return[];let Y=await window.craft.bluetooth.discoverServices(Z);return Array.isArray(Y)?Y:[]},async discoverCharacteristics(Z,Y){if(!Z||!Y)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!G("bluetooth"))return[];let $=await window.craft.bluetooth.discoverCharacteristics(Z,Y);return Array.isArray($)?$:[]},async readCharacteristic(Z,Y,$){if(!Z||!Y||!$)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(Z,Y,$)},async writeCharacteristic(Z,Y,$,J,Q="with-response"){if(!Z||!Y||!$)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(x8("bluetooth.writeCharacteristic.valueHex",J),!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(Z,Y,$,J,Q)},async setCharacteristicNotify(Z,Y,$,J){if(!Z||!Y||!$)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(Z,Y,$,J)},onDeviceFound(Z){return P("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return P("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return P("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return P("craft:bluetooth:characteristicValue",Z)}};var I8={async speak(Z,Y){if(!Z)throw Error("speech.speak: text is required");if(G("speech")){await window.craft.speech.speak(Z,Y);return}if(typeof window<"u"&&window.speechSynthesis){let $=new window.SpeechSynthesisUtterance(Z);if(Y){if(Y.rate!=null)$.rate=Y.rate;if(Y.pitch!=null)$.pitch=Y.pitch;if(Y.volume!=null)$.volume=Y.volume;if(Y.voice){let Q=window.speechSynthesis.getVoices().find((X)=>X.voiceURI===Y.voice||X.name===Y.voice||X.lang===Y.voice);if(Q)$.voice=Q}}window.speechSynthesis.speak($)}},async stop(){if(G("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(G("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(G("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(G("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(G("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((Y)=>({id:Y.voiceURI||Y.name,name:Y.name,language:Y.lang||"",quality:"default"}));return[]}};var n=[],LZ=!0,MZ,_Z,o={async report(Z){if(G("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!LZ)return;let Y=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:MZ,appVersion:_Z}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:MZ,appVersion:_Z};if(n.length>=64)n.shift();n.push(Y)},async flush(){if(G("crashReporter"))return await window.craft.crashReporter.flush();return[...n]},async clear(){if(G("crashReporter")){await window.craft.crashReporter.clear();return}n.length=0},async setEnabled(Z){if(G("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}LZ=Z},async isEnabled(){if(G("crashReporter"))return await window.craft.crashReporter.isEnabled();return LZ},async setUser(Z){if(G("crashReporter")){await window.craft.crashReporter.setUser(Z);return}MZ=Z||void 0},async setAppVersion(Z){if(G("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}_Z=Z||void 0},attachGlobalHandlers(){if(G("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=($)=>{o.report({severity:"error",message:$.message,source:"js",stack:$.error?.stack||`${$.message}
|
|
895
|
+
at ${$.filename}:${$.lineno}:${$.colno}`}).catch(()=>{})},Y=($)=>{let J=$.reason;o.report({severity:"error",message:J?.message||String(J),source:"js",stack:J?.stack||""}).catch(()=>{})};return window.addEventListener("error",Z),window.addEventListener("unhandledrejection",Y),()=>{window.removeEventListener("error",Z),window.removeEventListener("unhandledrejection",Y)}},forwardTo(Z){return y8(Z)}},w8="craft:crashReporter:pending",S8=/[\w.+-]+@[\w-]+\.[\w.-]+/g,B8=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,f8=/\/(?:Users|home)\/[^\s/'"`]+/g;function R4(Z){let Y=($)=>$.replace(S8,"<email>").replace(B8,"<ip>").replace(f8,"/<home>");return{...Z,message:Y(Z.message),stack:Y(Z.stack)}}async function F4(Z,Y){let $=new TextEncoder,J=await crypto.subtle.importKey("raw",$.encode(Z),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),Q=await crypto.subtle.sign("HMAC",J,$.encode(Y));return[...new Uint8Array(Q)].map((X)=>X.toString(16).padStart(2,"0")).join("")}function v8(Z){if(!Z||typeof localStorage>"u")return[];try{let Y=localStorage.getItem(Z);if(!Y)return[];let $=JSON.parse(Y);return Array.isArray($)?$:[]}catch{return[]}}function z4(Z,Y){if(!Z||typeof localStorage>"u")return;try{if(Y.length===0)localStorage.removeItem(Z);else localStorage.setItem(Z,JSON.stringify(Y))}catch{}}function y8(Z){let{endpoint:Y,intervalMs:$=60000,signingSecret:J,redact:Q=!0,headers:X={},maxRetries:F=5,persistKey:z}=Z,R=z===null?null:z??w8,O=v8(R),j=!1,V=null,K=null,U=typeof Q==="function"?Q:Q===!1?(N)=>N:R4;async function W(N){let E=JSON.stringify({entries:N}),w={"Content-Type":"application/json",...X};if(J)w["X-Craft-Signature"]=await F4(J,E);let i=0,S=1000;while(!j)try{let b=await fetch(Y,{method:"POST",headers:w,body:E});if(b.ok)return;if(b.status>=400&&b.status<500)return;throw Error(`HTTP ${b.status}`)}catch(b){if(i+=1,i>F)throw O=[...N,...O],z4(R,O),b;await new Promise((U4)=>{setTimeout(U4,S)}),S=Math.min(S*2,60000)}}async function T(){if(j||K)return K??void 0;let N=await o.flush();if(N.length>0)await o.clear();if(O=[...O,...N.map((w)=>U(w))],O.length===0)return;let E=O;return O=[],z4(R,O),K=W(E).catch(()=>{}).finally(()=>{K=null}),K}if($>0)V=setInterval(()=>{T().catch(()=>{})},$);return{async flushNow(){await T()},stop(){if(j=!0,V)clearInterval(V);V=null},pending(){return[...O]}}}var g8={async isAvailable(){if(!G("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(Z){if(!G("iap"))return[];let Y=Array.isArray(Z)?Z:[String(Z)];return await window.craft.iap.getProducts(Y)},async purchase(Z){if(!G("iap"))return{queued:!1,productId:Z,reason:"IAP bridge not available"};let Y=await window.craft.iap.purchase(Z);return{queued:!!(Y&&Y.queued),productId:Y?.productId,reason:Y?.reason}},async restorePurchases(){if(!G("iap"))return{ok:!1};let Z=await window.craft.iap.restorePurchases();return{ok:!!(Z&&Z.ok)}},async finishTransaction(Z){if(!G("iap"))return;await window.craft.iap.finishTransaction(Z)},async getReceiptData(){if(!G("iap"))return null;let Z=await window.craft.iap.getReceiptData();return Z?String(Z):null},onPurchased(Z){return P("craft:iap:purchased",Z)},onFailed(Z){return P("craft:iap:failed",Z)},onRestored(Z){return P("craft:iap:restored",Z)},onProductsLoaded(Z){return P("craft:iap:productsLoaded",(Y)=>Z(Y.products||[]))},onRefunded(Z){return P("craft:iap:refunded",Z)},onSubscriptionStatusChanged(Z){return P("craft:iap:subscriptionStatusChanged",Z)},async getActiveSubscriptions(){if(!G("iap"))return[];let Z=window.craft.iap.getActiveSubscriptions;if(typeof Z!=="function")return[];let Y=await Z();return Array.isArray(Y)?Y:[]},async isEligibleForIntroOffer(Z){if(!G("iap"))return!1;let Y=window.craft.iap.isEligibleForIntroOffer;if(typeof Y!=="function")return!1;return!!await Y(Z)}};var a={async startActivity(Z,Y){if(!Z)throw Error("handoff.startActivity: type is required");if(!G("handoff"))return!1;let $=await window.craft.handoff.startActivity(Z,Y);return typeof $==="boolean"?$:!!($&&$.ok)},async updateActivity(Z){if(!G("handoff"))return!1;let Y=await window.craft.handoff.updateActivity(Z);return typeof Y==="boolean"?Y:!!(Y&&Y.ok)},async stopActivity(){if(!G("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!G("handoff"))return null;let Z=await window.craft.handoff.getCurrentActivity();return Z&&typeof Z.type==="string"?Z:null},onIncoming(Z){return P("craft:handoff:incoming",Z)}};var b8={async start(Z,Y){return a.startActivity(Z,{title:Y?.title,webpageURL:Y?.webpageURL,userInfo:Y?.state})},async update(Z){return a.updateActivity({title:Z.title,webpageURL:Z.webpageURL,userInfo:Z.state})},async stop(){await a.stopActivity()}};var u8={async requestPermission(Z="whenInUse"){if(G("location"))return await window.craft.location.requestPermission(Z);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(G("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(G("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((Z)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:Z.coords.latitude,longitude:Z.coords.longitude,altitude:Z.coords.altitude,horizontalAccuracy:Z.coords.accuracy,verticalAccuracy:Z.coords.altitudeAccuracy,speed:Z.coords.speed}}))},(Z)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:Z.message||String(Z)}}))}),{requested:!0};return{requested:!1}},async startWatching(Z){if(G("location"))return await window.craft.location.startWatching(Z);if(typeof navigator<"u"&&navigator.geolocation){let Y=navigator.geolocation.watchPosition(($)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:$.coords.latitude,longitude:$.coords.longitude,altitude:$.coords.altitude,horizontalAccuracy:$.coords.accuracy,verticalAccuracy:$.coords.altitudeAccuracy,speed:$.coords.speed}}))});return window.__craftWebLocationWatchId=Y,!0}return!1},async stopWatching(){if(G("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let Z=window.__craftWebLocationWatchId;if(Z!=null)navigator.geolocation.clearWatch(Z),window.__craftWebLocationWatchId=null}},onUpdate(Z){return P("craft:location:update",Z)},onError(Z){return P("craft:location:error",Z)},onAuthChanged(Z){return P("craft:location:authChanged",Z)}};var m8={async captureScreen(){if(!G("screenCapture"))return null;let Z=await window.craft.screenCapture.captureScreen();return Z?String(Z):null},async captureWindow(Z){if(!G("screenCapture"))return null;if(!Number.isFinite(Z)||Z<=0)throw Error("captureWindow: id must be a positive number");let Y=await window.craft.screenCapture.captureWindow(Z);return Y?String(Y):null},async listWindows(){if(!G("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var K4=250,j4=60000,TZ=2000,O4={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function h8(){return{...O4,signals:{...O4.signals},sources:[]}}var XZ={async getState(){if(!G("screenSharing"))return h8();return await window.craft.screenSharing.getState()},async watch(Z=TZ){let Y=Math.min(j4,Math.max(K4,Math.round(Z)));if(!G("screenSharing"))return Y;let $=await window.craft.screenSharing.watch(Y);return $&&$.intervalMs||Y},async stop(){if(!G("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(Z){return P("craft:screenSharing:change",Z)}};async function c8(Z,Y=TZ){let $=XZ.onChange(Z);return await XZ.watch(Y),()=>{$(),XZ.stop()}}var p8={supported:!1,isFocused:null,authorization:"unsupported"};function V4(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var NZ={async getStatus(){if(!G("focus"))return{...p8};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!G("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(Z,Y={}){if(!G("focus"))return V4();if(!(Z?Y.onShortcut:Y.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${Z?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(Z,Y)},async runShortcut(Z){if(!G("focus"))return V4();if(!Z)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(Z)},async listShortcuts(){if(!G("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!G("focus"))return{canList:!1,shortcuts:[]};let Z=await window.craft.focus.listShortcutsResult();return{canList:Boolean(Z?.canList),shortcuts:Z?.shortcuts||[]}}};async function l8(...Z){if(Z.length===0)return!1;let Y=new Set(await NZ.listShortcuts());return Z.every(($)=>Y.has($))}async function d8(...Z){if(Z.length===0)return!1;let{canList:Y,shortcuts:$}=await NZ.listShortcutsResult();if(!Y)return"unknown";let J=new Set($);return Z.every((Q)=>J.has(Q))}var r8={async start(Z=0,Y="127.0.0.1"){if(!G("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(Z,Y)},async stop(){if(!G("localServer"))return;await window.craft.localServer.stop()},async respond(Z){if(!G("localServer"))return;await window.craft.localServer.respond(Z||{status:200,body:"OK"})},onRequest(Z){return P("craft:localServer:request",Z)},async awaitOAuthCallback(Z={}){M("localServer");let{port:Y=0,host:$="127.0.0.1",timeoutMs:J=300000,successHTML:Q}=Z,X=await this.start(Y,$);if(!X.started)throw Error(`localServer: start failed${X.reason?` \u2014 ${X.reason}`:""}`);return new Promise((F,z)=>{let R=setTimeout(()=>{O(),this.stop().catch(()=>{}),z(Error("localServer: OAuth callback timed out"))},J),O=this.onRequest(({url:j})=>{clearTimeout(R),O();let V=Q??`<!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:V,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),F({url:j,port:X.port})})})}};var n8={async isAvailable(){if(!G("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!G("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(Z,Y){if(!Z)throw Error("biometric.evaluate: reason is required");if(!G("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(Z,Y)}};var k=null,o8={async play(Z,Y){if(G("audio"))return await window.craft.audio.play(Z,Y);if(typeof window>"u"||typeof Audio>"u")return!1;if(k)k.pause(),k=null;if(k=new Audio(Z),Y?.volume!=null)k.volume=Y.volume;if(Y?.loops)k.loop=!0;try{return await k.play(),!0}catch{return!1}},async playSystemSound(Z){if(G("audio"))return await window.craft.audio.playSystemSound(Z);if(typeof window>"u"||typeof Audio>"u")return!1;try{return k=new Audio(`/System/Library/Sounds/${Z}.aiff`),await k.play(),!0}catch{return!1}},async stop(){if(G("audio")){await window.craft.audio.stop();return}if(k)k.pause(),k.currentTime=0,k=null},async isPlaying(){if(G("audio"))return await window.craft.audio.isPlaying();return!!(k&&!k.paused)},async startRecording(Z,Y){if(G("audio"))return await window.craft.audio.startRecording(Z,Y);return!1},async stopRecording(){if(G("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(G("audio"))return await window.craft.audio.isRecording();return!1}};var a8={async execute(Z){if(!Z)throw Error("appleScript.execute: source is required");if(!G("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(Z)}};var i8={async getDefault(Z){if(!Z)throw Error("fileAssociations.getDefault: uti is required");if(!G("fileAssociations"))return null;let Y=await window.craft.fileAssociations.getDefault(Z);return Y?String(Y):null},async setDefault(Z,Y){if(!Z||!Y)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!G("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(Z,Y)}};var s8={async get(Z){if(!Z)throw Error("tags.get: path is required");if(!G("tags"))return[];return await window.craft.tags.get(Z)},async set(Z,Y){if(!Z)throw Error("tags.set: path is required");if(!G("tags"))return!1;let $=Array.isArray(Y)?Y:[String(Y)];return await window.craft.tags.set(Z,$)},async clear(Z){if(!Z)throw Error("tags.clear: path is required");if(!G("tags"))return!1;return await window.craft.tags.clear(Z)}};var t8={async countPages(Z){if(!Z)throw Error("pdf.countPages: path is required");if(!G("pdf"))return 0;return await window.craft.pdf.countPages(Z)},async extractText(Z){if(!Z)throw Error("pdf.extractText: path is required");if(!G("pdf"))return"";return await window.craft.pdf.extractText(Z)}};var e8={async debug(Z){if(G("log"))await window.craft.log.debug(Z);else console.debug(Z)},async info(Z){if(G("log"))await window.craft.log.info(Z);else console.info(Z)},async warn(Z){if(G("log"))await window.craft.log.warn(Z);else console.warn(Z)},async error(Z){if(G("log"))await window.craft.log.error(Z);else console.error(Z)}};var Z9={async browse(Z){if(!G("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(Z)},async stop(){if(G("bonjour"))await window.craft.bonjour.stop()},onFound(Z){return P("craft:bonjour:found",Z)},onLost(Z){return P("craft:bonjour:lost",Z)}};var Y9={async index(Z){if(!G("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(Z)},async remove(Z){if(!G("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(Z)},async removeAll(){if(!G("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}};var $9={async isAvailable(){if(!G("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(Z){if(!G("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(Z)},async stop(){if(G("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(Z){return P("craft:speechRecognition:partial",Z)},onFinal(Z){return P("craft:speechRecognition:final",Z)}};var J9={async recognizeText(Z){if(!Z)throw Error("vision.recognizeText: path is required");if(!G("vision"))return[];return await window.craft.vision.recognizeText(Z)},async detectFaces(Z){if(!Z)throw Error("vision.detectFaces: path is required");if(!G("vision"))return[];return await window.craft.vision.detectFaces(Z)},async detectBarcodes(Z){if(!Z)throw Error("vision.detectBarcodes: path is required");if(!G("vision"))return[];return await window.craft.vision.detectBarcodes(Z)}};var G9={async listSources(){if(!G("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!G("midi"))return[];return await window.craft.midi.listDestinations()},async send(Z,Y){if(!G("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(Z,Y)},async subscribe(Z){if(!G("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(Z)},async unsubscribe(Z){if(!G("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(Z)},onMessage(Z){return P("craft:midi:message",Z)}};var Q9={async loadModel(Z,Y){if(!Z||!Y)throw Error("coreml.loadModel: id and path are required");if(!G("coreml"))return!1;return await window.craft.coreml.loadModel(Z,Y)},async unloadModel(Z){if(!G("coreml"))return;await window.craft.coreml.unloadModel(Z)},async predict(Z,Y){if(!Z)throw Error("coreml.predict: id is required");if(!G("coreml"))return null;return await window.craft.coreml.predict(Z,Y)}};var X9={async listCameras(){if(!G("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}};var z9={async register(Z){if(!Z)throw Error("serviceMenu.register: name is required");if(!G("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(Z)},async unregister(Z){if(!Z)throw Error("serviceMenu.unregister: name is required");if(!G("serviceMenu"))return;await window.craft.serviceMenu.unregister(Z)},onInvoked(Z){return P("craft:serviceMenu:invoked",Z)}};var R9={async list(){if(!G("serial"))return[];return await window.craft.serial.list()},async open(Z,Y=9600){if(!Z)throw Error("serial.open: path is required");if(!G("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(Z,Y)},async write(Z,Y){if(!Z)throw Error("serial.write: id is required");if(!G("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(Z,Y)},async close(Z){if(!G("serial"))return;await window.craft.serial.close(Z)},onData(Z){return P("craft:serial:data",Z)}};var q4=[{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 F9(){return q4.map(({name:Z,support:Y})=>({name:Z,support:Y,available:G(Z)}))}function P4(Z){let Y=q4.find(($)=>$.name===Z);if(!Y)return;return{...Y,available:G(Z)}}function O9(Z){let Y=P4(Z);return!!Y&&Y.available}export{P8 as windowEvents,c8 as watchScreenSharing,J9 as vision,q8 as updater,tZ as unregisterHotkey,c6 as unregisterAllHotkeys,vY as triggerTrayAction,k8 as touchbar,z8 as theme,s8 as tags,D8 as system,Y9 as spotlight,$9 as speechRecognition,I8 as speech,F4 as signPayload,A4 as showWarningToast,LY as showWarningModal,dY as showWarningDialog,p as showToast,E4 as showSuccessToast,_Y as showSuccessModal,mY as showSaveDialog,xZ as showQuestionModal,uY as showOpenDialog,u as showModal,l as showMessageBox,N4 as showInfoToast,HZ as showInfoModal,k4 as showErrorToast,MY as showErrorModal,lY as showErrorDialog,pY as showConfirmDialog,hY as showColorPicker,cY as showAlertDialog,RZ as showAlert,Q8 as shell,sY as setDesktopConfig,f6 as setAutoLaunch,z9 as serviceMenu,R9 as serial,XZ as screenSharing,m8 as screenCapture,L8 as screen,K6 as resolveCraftBinary,eY as resetDesktopConfig,D4 as requestNotificationPermission,h6 as registerHotkey,R4 as redactPII,EY as prompt,E8 as printing,_8 as permissions,t8 as pdf,iZ as parseShortcut,F6 as packageApp,R6 as pack,G6 as openDevWindow,H4 as notify,s6 as notifications,V8 as network,A8 as nativeAutoLaunch,G9 as midi,W8 as menu,e8 as log,u8 as location,r8 as localServer,b8 as liveActivities,M8 as keychain,X6 as isWebviewAvailable,O8 as isDragOutAvailable,P6 as isCaffeinated,O9 as isAvailable,v6 as isAutoLaunchEnabled,g8 as iap,l8 as hasFocusShortcuts,a as handoff,X8 as globalShortcuts,mZ as githubReleaseAssetUrl,uZ as githubLatestAssetUrl,z6 as getWindowBridgeScript,Y6 as getWindow,fY as getTrayInstance,gY as getTrayBridgeScript,yY as getSimulatedTrayHTML,p6 as getRegisteredHotkeys,rY as getDialogBridgeScript,tY as getDesktopConfig,P4 as getCapability,F9 as getCapabilities,U6 as getCaffeinateStatus,Z6 as getActiveWindowIds,BY as getActiveTrayInstances,AY as getActiveModalCount,I4 as getActiveAlertCount,gZ as generateUpdateManifest,e6 as fs,n6 as formatTime,g6 as formatShortcut,W6 as formatRemainingTime,D6 as formatDuration,o6 as formatCompact,d8 as focusShortcutsReady,NZ as focus,i8 as fileAssociations,F8 as dragOut,C4 as dismissAllAlerts,x4 as dismissAlertById,r6 as delay,K8 as deepLinks,cZ as decaffeinate,Q6 as createWindowWithHTML,J6 as createWindow,jY as createWebView,QY as createTreeView,s4 as createTooltip,l6 as createTimer,r4 as createTimePicker,B4 as createTextInput,m4 as createTabs,GY as createTable,fZ as createSystemTray,YY as createStepper,e4 as createSplitView,v4 as createSlider,t4 as createScrollView,c4 as createRating,p4 as createRadioButton,y4 as createProgressBar,H6 as createPreferences,$Y as createModalComponent,SY as createMenubar,FY as createMediaPlayer,JY as createListView,o4 as createLabel,d6 as createInterval,a4 as createImageView,j6 as createGitHubUpdater,V6 as createGitHubUpdateManifest,KY as createFileExplorer,h4 as createDropdown,d4 as createDatePicker,XY as createDataGrid,l4 as createColorPicker,RY as createCodeEditor,i4 as createChip,f4 as createCheckbox,zY as createChart,u4 as createCard,S4 as createButton,g4 as createBadge,b4 as createAvatar,n4 as createAutocomplete,ZY as createAccordion,o as crashReporter,jZ as craftWindowArguments,O6 as craftBinaryNotFoundMessage,Q9 as coreml,X9 as continuityCamera,TY as confirm,$6 as closeAllWindows,kY as closeAllModals,a6 as clipboard,q6 as caffeinate,Z9 as bonjour,C8 as bluetooth,n8 as biometric,j8 as battery,o8 as audio,a8 as appleScript,U8 as appInfo,NY as alert,bZ as UPDATE_MANIFEST_ASSET,bY as TRAY_MENU_STYLES,w4 as TOAST_STYLES,HY as MODAL_STYLES,K4 as MIN_WATCH_INTERVAL_MS,j4 as MAX_WATCH_INTERVAL_MS,TZ as DEFAULT_WATCH_INTERVAL_MS,qY as COMPONENT_STYLES,yZ as AutoUpdater,VY as AVAILABLE_COMPONENTS};
|