widgies 0.1.0

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.
@@ -0,0 +1,882 @@
1
+ var Tt=Object.defineProperty;var _=(h,f)=>()=>(h&&(f=h(h=0)),f);var V=(h,f)=>{for(var e in f)Tt(h,e,{get:f[e],enumerable:!0})};var A,P=_(()=>{"use strict";A=class extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.attachEventListeners(),this.handleAccessibility()}disconnectedCallback(){this.cleanup()}attachEventListeners(){}cleanup(){}handleAccessibility(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",f=>{(f.key==="Enter"||f.key===" ")&&this.handleActivation(f)})}handleActivation(f){}getStyles(){return this.getBaseStyles()}getBaseStyles(){return`
2
+ :host {
3
+ ${this.getThemeVariables()}
4
+ display: inline-block;
5
+ font: var(--widgies-font);
6
+ border-radius: var(--widgies-radius);
7
+ background: var(--widgies-surface);
8
+ color: var(--widgies-text);
9
+ border: 1px solid color-mix(in srgb, var(--widgies-text) 20%, transparent);
10
+ padding: 1rem;
11
+ box-sizing: border-box;
12
+ overflow: hidden;
13
+ }
14
+
15
+ :host > * {
16
+ display: flex;
17
+ flex-direction: column;
18
+ align-items: center;
19
+ justify-content: center;
20
+ width: 100%;
21
+ height: 100%;
22
+ box-sizing: border-box;
23
+ }
24
+
25
+ :host(:focus-visible) {
26
+ outline: 3px solid var(--widgies-accent);
27
+ outline-offset: 2px;
28
+ }
29
+
30
+ button {
31
+ background: var(--widgies-accent);
32
+ color: white;
33
+ border: none;
34
+ border-radius: var(--widgies-radius);
35
+ padding: 0.5rem 1rem;
36
+ font: inherit;
37
+ cursor: pointer;
38
+ transition: background-color 0.2s ease;
39
+ }
40
+
41
+ button:hover {
42
+ background: color-mix(in srgb, var(--widgies-accent) 80%, black);
43
+ }
44
+
45
+ button:focus-visible {
46
+ outline: 2px solid var(--widgies-accent);
47
+ outline-offset: 2px;
48
+ }
49
+
50
+ button:disabled {
51
+ opacity: 0.5;
52
+ cursor: not-allowed;
53
+ }
54
+
55
+ @media (prefers-color-scheme: dark) {
56
+ :host {
57
+ --widgies-surface: var(--widgies-surface-dark);
58
+ --widgies-text: var(--widgies-text-dark);
59
+ --widgies-accent: var(--widgies-accent-dark);
60
+ }
61
+ }
62
+
63
+ @media (prefers-reduced-motion: reduce) {
64
+ *, *::before, *::after {
65
+ animation-duration: 0.01ms !important;
66
+ animation-iteration-count: 1 !important;
67
+ transition-duration: 0.01ms !important;
68
+ }
69
+ }
70
+ `}getThemeVariables(){return`
71
+ --widgies-font: 16px/1.4 Inter, sans-serif;
72
+ --widgies-radius: 0.5rem;
73
+ --widgies-surface-light: #ffffffe6;
74
+ --widgies-text-light: #1a1a1a;
75
+ --widgies-accent-light: #6c4cff;
76
+ --widgies-surface-dark: #181824e6;
77
+ --widgies-text-dark: #f5f5ff;
78
+ --widgies-accent-dark: #a88bff;
79
+ --widgies-surface: var(--widgies-surface-light);
80
+ --widgies-text: var(--widgies-text-light);
81
+ --widgies-accent: var(--widgies-accent-light);
82
+ `}createStyleSheet(){let f=this.getStyles();if("adoptedStyleSheets"in this.shadow)try{let t=new CSSStyleSheet;return t.replaceSync(f),this.shadow.adoptedStyleSheets=[t],null}catch{}let e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=f,e}}});var lt={};V(lt,{CalculatorWidget:()=>Y,register:()=>ot});function ot(){customElements.get("widgies-calculator")||customElements.define("widgies-calculator",Y)}var Y,X=_(()=>{"use strict";P();Y=class extends A{constructor(){super(...arguments);this.display=null;this.currentValue="0";this.previousValue="";this.operator="";this.waitingForOperand=!1}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e);let t=document.createElement("div");t.innerHTML=`
83
+ <div class="calculator">
84
+ <div class="display" role="textbox" aria-live="polite" aria-label="Calculator display">${this.currentValue}</div>
85
+ <div class="buttons">
86
+ <button class="btn clear" data-action="clear">C</button>
87
+ <button class="btn operator" data-action="operator" data-operator="/">\xF7</button>
88
+ <button class="btn operator" data-action="operator" data-operator="*">\xD7</button>
89
+ <button class="btn operator" data-action="operator" data-operator="-">\u2212</button>
90
+
91
+ <button class="btn number" data-action="input" data-number="7">7</button>
92
+ <button class="btn number" data-action="input" data-number="8">8</button>
93
+ <button class="btn number" data-action="input" data-number="9">9</button>
94
+ <button class="btn operator" data-action="operator" data-operator="+">+</button>
95
+
96
+ <button class="btn number" data-action="input" data-number="4">4</button>
97
+ <button class="btn number" data-action="input" data-number="5">5</button>
98
+ <button class="btn number" data-action="input" data-number="6">6</button>
99
+ <button class="btn equals" data-action="calculate" rowspan="2">=</button>
100
+
101
+ <button class="btn number" data-action="input" data-number="1">1</button>
102
+ <button class="btn number" data-action="input" data-number="2">2</button>
103
+ <button class="btn number" data-action="input" data-number="3">3</button>
104
+
105
+ <button class="btn number zero" data-action="input" data-number="0">0</button>
106
+ <button class="btn number" data-action="input" data-number=".">.</button>
107
+ </div>
108
+ </div>
109
+ `,this.shadow.appendChild(t),this.display=this.shadow.querySelector(".display")}attachEventListeners(){this.shadow.addEventListener("click",e=>{let t=e.target;if(!t.matches("button"))return;let n=t.dataset.action,s=t.dataset.number,r=t.dataset.operator;switch(n){case"input":this.inputNumber(s);break;case"operator":this.inputOperator(r);break;case"calculate":this.calculate();break;case"clear":this.clear();break}})}inputNumber(e){this.waitingForOperand?(this.currentValue=e,this.waitingForOperand=!1):this.currentValue=this.currentValue==="0"?e:this.currentValue+e,this.updateDisplay()}inputOperator(e){let t=parseFloat(this.currentValue);if(this.previousValue==="")this.previousValue=this.currentValue;else if(this.operator){let n=this.performCalculation();this.currentValue=String(n),this.previousValue=this.currentValue,this.updateDisplay()}this.waitingForOperand=!0,this.operator=e}calculate(){if(this.previousValue!==""&&this.operator){let e=this.performCalculation();this.currentValue=String(e),this.previousValue="",this.operator="",this.waitingForOperand=!0,this.updateDisplay()}}performCalculation(){let e=parseFloat(this.previousValue),t=parseFloat(this.currentValue);switch(this.operator){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;default:return t}}clear(){this.currentValue="0",this.previousValue="",this.operator="",this.waitingForOperand=!1,this.updateDisplay()}updateDisplay(){this.display&&(this.display.textContent=this.currentValue)}getStyles(){return`
110
+ ${this.getBaseStyles()}
111
+
112
+ .calculator {
113
+ width: 240px;
114
+ }
115
+
116
+ .display {
117
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)) 70%, var(--widgies-text, var(--widgies-text-light, #1a1a1a)));
118
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
119
+ padding: 1rem;
120
+ margin-bottom: 0.5rem;
121
+ border-radius: var(--widgies-radius, 0.5rem);
122
+ text-align: right;
123
+ font-size: 1.5rem;
124
+ font-weight: bold;
125
+ min-height: 1.5rem;
126
+ overflow: hidden;
127
+ }
128
+
129
+ .buttons {
130
+ display: grid;
131
+ grid-template-columns: repeat(4, 1fr);
132
+ gap: 0.5rem;
133
+ }
134
+
135
+ .btn {
136
+ height: 3rem;
137
+ font-size: 1.1rem;
138
+ font-weight: bold;
139
+ }
140
+
141
+ .btn.zero {
142
+ grid-column: span 2;
143
+ }
144
+
145
+ .btn.operator {
146
+ background: color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 80%, black);
147
+ }
148
+
149
+ .btn.equals {
150
+ background: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
151
+ grid-row: span 2;
152
+ }
153
+
154
+ .btn.number {
155
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)) 90%, var(--widgies-text, var(--widgies-text-light, #1a1a1a)));
156
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
157
+ }
158
+
159
+ @media (prefers-color-scheme: dark) {
160
+ .display {
161
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)) 70%, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)));
162
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
163
+ }
164
+
165
+ .btn.operator {
166
+ background: color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 80%, white);
167
+ }
168
+
169
+ .btn.equals {
170
+ background: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
171
+ }
172
+
173
+ .btn.number {
174
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)) 90%, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)));
175
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
176
+ }
177
+ }
178
+ `}};ot()});var ct={};V(ct,{RandomNumberWidget:()=>Q,register:()=>dt});function dt(){customElements.get("widgies-random-number")||customElements.define("widgies-random-number",Q)}var Q,Z=_(()=>{"use strict";P();Q=class extends A{constructor(){super(...arguments);this.display=null;this.generateButton=null;this.minInput=null;this.maxInput=null}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e);let t=document.createElement("div");t.innerHTML=`
179
+ <div class="random-number" role="application" aria-label="Random number generator">
180
+ <div class="controls">
181
+ <div class="range-inputs">
182
+ <label>
183
+ Min:
184
+ <input type="number" class="min-input" value="${this.getAttribute("min")||"1"}" aria-label="Minimum value">
185
+ </label>
186
+ <label>
187
+ Max:
188
+ <input type="number" class="max-input" value="${this.getAttribute("max")||"100"}" aria-label="Maximum value">
189
+ </label>
190
+ </div>
191
+ <button class="generate-btn" aria-describedby="random-display">Generate</button>
192
+ </div>
193
+ <div class="display" id="random-display" aria-live="polite" aria-label="Generated random number">
194
+
195
+ </div>
196
+ </div>
197
+ `,this.shadow.appendChild(t),this.display=this.shadow.querySelector(".display"),this.generateButton=this.shadow.querySelector(".generate-btn"),this.minInput=this.shadow.querySelector(".min-input"),this.maxInput=this.shadow.querySelector(".max-input")}attachEventListeners(){this.generateButton?.addEventListener("click",()=>{this.generateRandomNumber()}),this.minInput?.addEventListener("input",()=>{this.validateInputs()}),this.maxInput?.addEventListener("input",()=>{this.validateInputs()}),this.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.generateRandomNumber())})}validateInputs(){if(!this.minInput||!this.maxInput||!this.generateButton)return;let e=parseInt(this.minInput.value),t=parseInt(this.maxInput.value),n=!isNaN(e)&&!isNaN(t)&&e<=t;this.generateButton.disabled=!n,!n&&e>t?(this.minInput.setAttribute("aria-invalid","true"),this.maxInput.setAttribute("aria-invalid","true")):(this.minInput.removeAttribute("aria-invalid"),this.maxInput.removeAttribute("aria-invalid"))}generateRandomNumber(){if(!this.minInput||!this.maxInput||!this.display)return;let e=parseInt(this.minInput.value),t=parseInt(this.maxInput.value);if(isNaN(e)||isNaN(t)||e>t){this.display.textContent="Invalid range";return}let n=this.cryptoRandomInt(e,t+1);this.display.textContent=n.toString(),this.dispatchEvent(new CustomEvent("random-generated",{detail:{value:n,min:e,max:t},bubbles:!0}))}cryptoRandomInt(e,t){if(typeof crypto<"u"&&crypto.getRandomValues){let n=t-e,s=Math.ceil(Math.log2(n)/8),r=Math.pow(256,s),i=new Uint8Array(s),l;do{crypto.getRandomValues(i),l=0;for(let m=0;m<s;m++)l=(l<<8)+i[m]}while(l>=r-r%n);return e+l%n}else return Math.floor(Math.random()*(t-e))+e}static get observedAttributes(){return["min","max"]}attributeChangedCallback(e,t,n){e==="min"&&this.minInput&&(this.minInput.value=n||"1",this.validateInputs()),e==="max"&&this.maxInput&&(this.maxInput.value=n||"100",this.validateInputs())}connectedCallback(){super.connectedCallback(),setTimeout(()=>this.validateInputs(),0)}getStyles(){return`
198
+ ${this.getBaseStyles()}
199
+
200
+ .random-number {
201
+ width: 280px;
202
+ text-align: center;
203
+ }
204
+
205
+ .controls {
206
+ margin-bottom: 1rem;
207
+ }
208
+
209
+ .range-inputs {
210
+ display: flex;
211
+ gap: 1rem;
212
+ margin-bottom: 1rem;
213
+ justify-content: center;
214
+ }
215
+
216
+ .range-inputs label {
217
+ display: flex;
218
+ flex-direction: column;
219
+ align-items: center;
220
+ font-size: 0.9rem;
221
+ font-weight: 500;
222
+ }
223
+
224
+ .range-inputs input {
225
+ width: 80px;
226
+ padding: 0.5rem;
227
+ margin-top: 0.25rem;
228
+ border: 1px solid color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 30%, transparent);
229
+ border-radius: calc(var(--widgies-radius, 0.5rem) * 0.5);
230
+ background: var(--widgies-surface, var(--widgies-surface-light, #ffffffe6));
231
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
232
+ font: inherit;
233
+ text-align: center;
234
+ }
235
+
236
+ .range-inputs input:focus {
237
+ outline: 2px solid var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
238
+ outline-offset: 1px;
239
+ }
240
+
241
+ .range-inputs input[aria-invalid="true"] {
242
+ border-color: #dc2626;
243
+ background: color-mix(in srgb, #dc2626 10%, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)));
244
+ }
245
+
246
+ .generate-btn {
247
+ width: 100%;
248
+ padding: 0.75rem 1.5rem;
249
+ font-size: 1rem;
250
+ font-weight: 600;
251
+ }
252
+
253
+ .display {
254
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)) 70%, var(--widgies-text, var(--widgies-text-light, #1a1a1a)));
255
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
256
+ padding: 1.5rem;
257
+ border-radius: var(--widgies-radius, 0.5rem);
258
+ font-size: 2rem;
259
+ font-weight: bold;
260
+ min-height: 2rem;
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+ }
265
+
266
+ @media (prefers-color-scheme: dark) {
267
+ .range-inputs input {
268
+ background: var(--widgies-surface, var(--widgies-surface-dark, #181824e6));
269
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
270
+ border-color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 30%, transparent);
271
+ }
272
+
273
+ .range-inputs input:focus {
274
+ outline-color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
275
+ }
276
+
277
+ .range-inputs input[aria-invalid="true"] {
278
+ background: color-mix(in srgb, #dc2626 10%, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)));
279
+ }
280
+
281
+ .display {
282
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)) 70%, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)));
283
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
284
+ }
285
+ }
286
+ `}};dt()});var ft={};V(ft,{TimerWidget:()=>j,register:()=>ut});function ut(){customElements.get("widgies-timer")||customElements.define("widgies-timer",j)}var j,tt=_(()=>{"use strict";P();j=class extends A{constructor(){super(...arguments);this.display=null;this.playButton=null;this.resetButton=null;this.minutesInput=null;this.secondsInput=null;this.totalSeconds=0;this.remainingSeconds=0;this.isRunning=!1;this.intervalId=null}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e);let t=parseInt(this.getAttribute("minutes")||"0"),n=parseInt(this.getAttribute("seconds")||"0");(t>0||n>0)&&(this.totalSeconds=t*60+n,this.remainingSeconds=this.totalSeconds);let s=document.createElement("div");s.innerHTML=`
287
+ <div class="timer" role="timer" aria-label="Countdown timer">
288
+ <div class="time-inputs">
289
+ <label>
290
+ Minutes:
291
+ <input type="number" class="minutes-input" min="0" max="99" value="${t}" aria-label="Minutes">
292
+ </label>
293
+ <label>
294
+ Seconds:
295
+ <input type="number" class="seconds-input" min="0" max="59" value="${n}" aria-label="Seconds">
296
+ </label>
297
+ </div>
298
+
299
+ <div class="display" aria-live="polite" aria-label="Time remaining">
300
+ ${this.formatTime(this.remainingSeconds)}
301
+ </div>
302
+
303
+ <div class="controls">
304
+ <button class="play-btn" aria-label="Start or pause timer">
305
+ <span class="play-icon">\u25B6</span>
306
+ <span class="pause-icon" style="display: none">\u23F8</span>
307
+ </button>
308
+ <button class="reset-btn" aria-label="Reset timer">\u23F9</button>
309
+ </div>
310
+
311
+ <div class="progress-bar">
312
+ <div class="progress-fill" style="width: ${this.getProgressPercentage()}%"></div>
313
+ </div>
314
+ </div>
315
+ `,this.shadow.appendChild(s),this.display=this.shadow.querySelector(".display"),this.playButton=this.shadow.querySelector(".play-btn"),this.resetButton=this.shadow.querySelector(".reset-btn"),this.minutesInput=this.shadow.querySelector(".minutes-input"),this.secondsInput=this.shadow.querySelector(".seconds-input")}attachEventListeners(){this.playButton?.addEventListener("click",()=>{this.toggleTimer()}),this.resetButton?.addEventListener("click",()=>{this.resetTimer()}),this.minutesInput?.addEventListener("input",()=>{this.updateTimeFromInputs()}),this.secondsInput?.addEventListener("input",()=>{this.updateTimeFromInputs()}),this.addEventListener("keydown",e=>{e.key===" "?(e.preventDefault(),this.toggleTimer()):(e.key==="r"||e.key==="R")&&(e.preventDefault(),this.resetTimer())})}updateTimeFromInputs(){if(!this.minutesInput||!this.secondsInput||this.isRunning)return;let e=Math.max(0,Math.min(99,parseInt(this.minutesInput.value)||0)),t=Math.max(0,Math.min(59,parseInt(this.secondsInput.value)||0));this.minutesInput.value=e.toString(),this.secondsInput.value=t.toString(),this.totalSeconds=e*60+t,this.remainingSeconds=this.totalSeconds,this.updateDisplay()}toggleTimer(){this.remainingSeconds<=0&&!this.isRunning&&(this.updateTimeFromInputs(),this.remainingSeconds<=0)||(this.isRunning?this.pauseTimer():this.startTimer())}startTimer(){this.remainingSeconds<=0||(this.isRunning=!0,this.updateButtonStates(),this.intervalId=window.setInterval(()=>{this.remainingSeconds--,this.updateDisplay(),this.remainingSeconds<=0&&this.completeTimer()},1e3),this.dispatchEvent(new CustomEvent("timer-started",{detail:{remainingSeconds:this.remainingSeconds},bubbles:!0})))}pauseTimer(){this.isRunning=!1,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.updateButtonStates(),this.dispatchEvent(new CustomEvent("timer-paused",{detail:{remainingSeconds:this.remainingSeconds},bubbles:!0}))}resetTimer(){this.pauseTimer(),this.updateTimeFromInputs(),this.updateDisplay(),this.dispatchEvent(new CustomEvent("timer-reset",{detail:{totalSeconds:this.totalSeconds},bubbles:!0}))}completeTimer(){this.isRunning=!1,this.remainingSeconds=0,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.updateDisplay(),this.updateButtonStates(),this.dispatchEvent(new CustomEvent("timer-complete",{detail:{totalSeconds:this.totalSeconds},bubbles:!0})),this.shadow.querySelector(".timer")?.classList.add("completed"),"Notification"in window&&new Notification("Timer Complete!",{body:"Your countdown timer has finished.",icon:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="%236c4cff"/><path d="M9 12l2 2 4-4" stroke="white" stroke-width="2" fill="none"/></svg>'})}updateDisplay(){this.display&&(this.display.textContent=this.formatTime(this.remainingSeconds)),this.updateProgressBar()}updateProgressBar(){let e=this.shadow.querySelector(".progress-fill");e&&(e.style.width=`${this.getProgressPercentage()}%`)}getProgressPercentage(){return this.totalSeconds===0?0:Math.max(0,this.remainingSeconds/this.totalSeconds*100)}updateButtonStates(){let e=this.shadow.querySelector(".play-icon"),t=this.shadow.querySelector(".pause-icon");e&&t&&(this.isRunning?(e.style.display="none",t.style.display="inline"):(e.style.display="inline",t.style.display="none")),this.minutesInput&&this.secondsInput&&(this.minutesInput.disabled=this.isRunning,this.secondsInput.disabled=this.isRunning)}formatTime(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`}static get observedAttributes(){return["minutes","seconds"]}attributeChangedCallback(e,t,n){if((e==="minutes"||e==="seconds")&&!this.isRunning){let s=parseInt(this.getAttribute("minutes")||"0"),r=parseInt(this.getAttribute("seconds")||"0");this.totalSeconds=s*60+r,this.remainingSeconds=this.totalSeconds,this.minutesInput&&(this.minutesInput.value=s.toString()),this.secondsInput&&(this.secondsInput.value=r.toString()),this.updateDisplay()}}disconnectedCallback(){super.disconnectedCallback(),this.intervalId&&clearInterval(this.intervalId)}getStyles(){return`
316
+ ${this.getBaseStyles()}
317
+
318
+ .timer {
319
+ width: 300px;
320
+ text-align: center;
321
+ transition: all 0.3s ease;
322
+ }
323
+
324
+ .timer.completed {
325
+ animation: pulse 0.5s ease-in-out;
326
+ }
327
+
328
+ @keyframes pulse {
329
+ 0%, 100% { transform: scale(1); }
330
+ 50% { transform: scale(1.05); }
331
+ }
332
+
333
+ .time-inputs {
334
+ display: flex;
335
+ gap: 1rem;
336
+ margin-bottom: 1rem;
337
+ justify-content: center;
338
+ }
339
+
340
+ .time-inputs label {
341
+ display: flex;
342
+ flex-direction: column;
343
+ align-items: center;
344
+ font-size: 0.9rem;
345
+ font-weight: 500;
346
+ }
347
+
348
+ .time-inputs input {
349
+ width: 80px;
350
+ padding: 0.5rem;
351
+ margin-top: 0.25rem;
352
+ border: 1px solid color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 30%, transparent);
353
+ border-radius: calc(var(--widgies-radius, 0.5rem) * 0.5);
354
+ background: var(--widgies-surface, var(--widgies-surface-light, #ffffffe6));
355
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
356
+ font: inherit;
357
+ text-align: center;
358
+ }
359
+
360
+ .time-inputs input:focus {
361
+ outline: 2px solid var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
362
+ outline-offset: 1px;
363
+ }
364
+
365
+ .time-inputs input:disabled {
366
+ opacity: 0.5;
367
+ cursor: not-allowed;
368
+ }
369
+
370
+ .display {
371
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)) 70%, var(--widgies-text, var(--widgies-text-light, #1a1a1a)));
372
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
373
+ padding: 2rem;
374
+ margin: 1rem 0;
375
+ border-radius: var(--widgies-radius, 0.5rem);
376
+ font-size: 3rem;
377
+ font-weight: bold;
378
+ font-family: 'Courier New', monospace;
379
+ letter-spacing: 0.1em;
380
+ }
381
+
382
+ .controls {
383
+ display: flex;
384
+ gap: 1rem;
385
+ justify-content: center;
386
+ margin-bottom: 1rem;
387
+ }
388
+
389
+ .controls button {
390
+ width: 60px;
391
+ height: 60px;
392
+ border-radius: 50%;
393
+ font-size: 1.5rem;
394
+ display: flex;
395
+ align-items: center;
396
+ justify-content: center;
397
+ padding: 0;
398
+ }
399
+
400
+ .progress-bar {
401
+ height: 8px;
402
+ background: color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 20%, transparent);
403
+ border-radius: 4px;
404
+ overflow: hidden;
405
+ }
406
+
407
+ .progress-fill {
408
+ height: 100%;
409
+ background: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
410
+ transition: width 0.5s ease;
411
+ border-radius: 4px;
412
+ }
413
+
414
+ @media (prefers-color-scheme: dark) {
415
+ .time-inputs input {
416
+ background: var(--widgies-surface, var(--widgies-surface-dark, #181824e6));
417
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
418
+ border-color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 30%, transparent);
419
+ }
420
+
421
+ .time-inputs input:focus {
422
+ outline-color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
423
+ }
424
+
425
+ .display {
426
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)) 70%, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)));
427
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
428
+ }
429
+
430
+ .progress-bar {
431
+ background: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 20%, transparent);
432
+ }
433
+
434
+ .progress-fill {
435
+ background: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
436
+ }
437
+ }
438
+ `}};ut()});var gt={};V(gt,{AffirmationWidget:()=>G,register:()=>ht});function ht(){customElements.get("widgies-affirmation")||customElements.define("widgies-affirmation",G)}var G,et=_(()=>{"use strict";P();G=class extends A{constructor(){super(...arguments);this.display=null;this.newButton=null;this.intervalId=null;this.autoInterval=0;this.affirmations=["You are capable of amazing things.","Every challenge is an opportunity to grow.","You have the strength to overcome anything.","Your potential is limitless.","You are exactly where you need to be.","Progress, not perfection, is the goal.","You deserve good things in your life.","Your efforts are making a difference.","You are braver than you believe.","Today is full of possibilities.","You are worthy of love and respect.","Your unique perspective matters.","You have overcome challenges before.","Small steps lead to big changes.","You are learning and growing every day.","Your kindness makes the world better.","You have everything you need within you.","You are creating your own path.","Your dreams are valid and achievable.","You radiate positive energy.","You are enough, just as you are.","Every day is a fresh start.","You choose how to respond to life.","Your creativity knows no bounds.","You make a positive impact on others."];this.currentAffirmation=""}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e),this.autoInterval=parseInt(this.getAttribute("interval")||"0"),this.currentAffirmation=this.getRandomAffirmation();let t=document.createElement("div");t.innerHTML=`
439
+ <div class="affirmation" role="region" aria-label="Daily affirmation">
440
+ <div class="display" aria-live="polite" aria-label="Current affirmation">
441
+ ${this.currentAffirmation}
442
+ </div>
443
+ <button class="new-btn" aria-label="Get new affirmation">
444
+ \u2728 New Affirmation
445
+ </button>
446
+ ${this.autoInterval>0?'<div class="auto-indicator">Auto-refreshing</div>':""}
447
+ </div>
448
+ `,this.shadow.appendChild(t),this.display=this.shadow.querySelector(".display"),this.newButton=this.shadow.querySelector(".new-btn")}attachEventListeners(){this.newButton?.addEventListener("click",()=>{this.showNewAffirmation()}),this.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.showNewAffirmation())})}getRandomAffirmation(){let e;do{let t=Math.floor(Math.random()*this.affirmations.length);e=this.affirmations[t]}while(e===this.currentAffirmation&&this.affirmations.length>1);return e}showNewAffirmation(){this.display&&(this.display.classList.add("fade-out"),setTimeout(()=>{this.currentAffirmation=this.getRandomAffirmation(),this.display&&(this.display.textContent=this.currentAffirmation,this.display.classList.remove("fade-out"),this.display.classList.add("fade-in"),setTimeout(()=>{this.display?.classList.remove("fade-in")},300)),this.dispatchEvent(new CustomEvent("affirmation-changed",{detail:{affirmation:this.currentAffirmation},bubbles:!0}))},150))}startAutoInterval(){this.autoInterval>0&&(this.intervalId=window.setInterval(()=>{this.showNewAffirmation()},this.autoInterval))}stopAutoInterval(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}static get observedAttributes(){return["interval"]}attributeChangedCallback(e,t,n){if(e==="interval"){this.stopAutoInterval(),this.autoInterval=parseInt(n||"0"),this.autoInterval>0&&this.startAutoInterval();let s=this.shadow.querySelector(".auto-indicator");s&&(s.style.display=this.autoInterval>0?"block":"none")}}connectedCallback(){super.connectedCallback(),this.startAutoInterval()}disconnectedCallback(){super.disconnectedCallback(),this.stopAutoInterval()}getStyles(){return`
449
+ ${this.getBaseStyles()}
450
+
451
+ .affirmation {
452
+ width: 350px;
453
+ text-align: center;
454
+ }
455
+
456
+ .display {
457
+ padding: 2rem 1.5rem;
458
+ margin-bottom: 1rem;
459
+ border-radius: var(--widgies-radius, 0.5rem);
460
+ background: linear-gradient(135deg,
461
+ var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 0%,
462
+ color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 80%, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6))) 100%);
463
+ color: white;
464
+ font-size: 1.2rem;
465
+ font-weight: 500;
466
+ line-height: 1.6;
467
+ min-height: 4rem;
468
+ display: flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ text-align: center;
472
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 25%, transparent);
473
+ transition: opacity 0.15s ease, transform 0.15s ease;
474
+ }
475
+
476
+ .display.fade-out {
477
+ opacity: 0;
478
+ transform: translateY(-10px);
479
+ }
480
+
481
+ .display.fade-in {
482
+ opacity: 1;
483
+ transform: translateY(0);
484
+ }
485
+
486
+ .new-btn {
487
+ width: 100%;
488
+ padding: 0.75rem 1.5rem;
489
+ font-size: 1rem;
490
+ font-weight: 600;
491
+ background: var(--widgies-surface, var(--widgies-surface-light, #ffffffe6));
492
+ color: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
493
+ border: 2px solid var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
494
+ transition: all 0.2s ease;
495
+ }
496
+
497
+ .new-btn:hover {
498
+ background: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
499
+ color: white;
500
+ transform: translateY(-2px);
501
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 30%, transparent);
502
+ }
503
+
504
+ .new-btn:active {
505
+ transform: translateY(0);
506
+ }
507
+
508
+ .auto-indicator {
509
+ margin-top: 0.5rem;
510
+ font-size: 0.8rem;
511
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 70%, transparent);
512
+ font-style: italic;
513
+ }
514
+
515
+ .auto-indicator::before {
516
+ content: "\u{1F504} ";
517
+ animation: rotate 2s linear infinite;
518
+ }
519
+
520
+ @keyframes rotate {
521
+ from { transform: rotate(0deg); }
522
+ to { transform: rotate(360deg); }
523
+ }
524
+
525
+ @media (prefers-color-scheme: dark) {
526
+ .display {
527
+ background: linear-gradient(135deg,
528
+ var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 0%,
529
+ color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 80%, var(--widgies-surface, var(--widgies-surface-dark, #181824e6))) 100%);
530
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 25%, transparent);
531
+ }
532
+
533
+ .new-btn {
534
+ background: var(--widgies-surface, var(--widgies-surface-dark, #181824e6));
535
+ color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
536
+ border-color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
537
+ }
538
+
539
+ .new-btn:hover {
540
+ background: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
541
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 30%, transparent);
542
+ }
543
+
544
+ .auto-indicator {
545
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 70%, transparent);
546
+ }
547
+ }
548
+
549
+ @media (prefers-reduced-motion: reduce) {
550
+ .display {
551
+ transition: none;
552
+ }
553
+
554
+ .new-btn {
555
+ transition: none;
556
+ }
557
+
558
+ .new-btn:hover {
559
+ transform: none;
560
+ }
561
+
562
+ .auto-indicator::before {
563
+ animation: none;
564
+ }
565
+ }
566
+ `}};ht()});var mt={};V(mt,{AmbientWidget:()=>U,register:()=>pt});function pt(){customElements.get("widgies-ambient")||customElements.define("widgies-ambient",U)}var U,it=_(()=>{"use strict";P();U=class extends A{constructor(){super(...arguments);this.audioContext=null;this.oscillators=[];this.gainNodes=[];this.gainNode=null;this.isPlaying=!1;this.currentSound="rain";this.playButton=null;this.soundSelect=null;this.volumeSlider=null;this.sounds={rain:{name:"Rain",icon:"\u{1F327}\uFE0F"},ocean:{name:"Ocean Waves",icon:"\u{1F30A}"},forest:{name:"Forest",icon:"\u{1F332}"},river:{name:"River",icon:"\u{1F3DE}\uFE0F"},campfire:{name:"Crackling Campfire",icon:"\u{1F525}"}}}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e);let t=this.getAttribute("sound")||"rain";t in this.sounds&&(this.currentSound=t);let n=document.createElement("div");n.innerHTML=`
567
+ <div class="ambient" role="application" aria-label="Ambient sound player">
568
+ <div class="sound-display">
569
+ <span class="sound-icon">${this.sounds[this.currentSound].icon}</span>
570
+ <span class="sound-name">${this.sounds[this.currentSound].name}</span>
571
+ </div>
572
+
573
+ <div class="controls">
574
+ <select class="sound-select" aria-label="Choose ambient sound">
575
+ ${Object.entries(this.sounds).map(([s,r])=>`<option value="${s}" ${s===this.currentSound?"selected":""}>${r.icon} ${r.name}</option>`).join("")}
576
+ </select>
577
+
578
+ <button class="play-btn" aria-label="Play or pause ambient sound">
579
+ <span class="play-icon">\u25B6</span>
580
+ <span class="pause-icon" style="display: none">\u23F8</span>
581
+ </button>
582
+ </div>
583
+
584
+ <div class="volume-control">
585
+ <label>
586
+ <span class="volume-label">\u{1F50A} Volume</span>
587
+ <input type="range" class="volume-slider" min="0" max="100" value="50" aria-label="Volume control">
588
+ </label>
589
+ </div>
590
+
591
+ <div class="status" aria-live="polite" aria-label="Player status">
592
+ Ready to play
593
+ </div>
594
+ </div>
595
+ `,this.shadow.appendChild(n),this.playButton=this.shadow.querySelector(".play-btn"),this.soundSelect=this.shadow.querySelector(".sound-select"),this.volumeSlider=this.shadow.querySelector(".volume-slider")}attachEventListeners(){this.playButton?.addEventListener("click",()=>{this.togglePlayback()}),this.soundSelect?.addEventListener("change",()=>{this.changeSound(this.soundSelect.value)}),this.volumeSlider?.addEventListener("input",()=>{this.updateVolume()}),this.addEventListener("keydown",e=>{e.key===" "&&(e.preventDefault(),this.togglePlayback())})}async initAudioContext(){this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&await this.audioContext.resume(),this.gainNode||(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination))}createWhiteNoise(){if(!this.audioContext)throw new Error("AudioContext not initialized");let e=this.audioContext.sampleRate*2,t=this.audioContext.createBuffer(1,e,this.audioContext.sampleRate),n=t.getChannelData(0);for(let r=0;r<e;r++)n[r]=Math.random()*2-1;let s=this.audioContext.createBufferSource();return s.buffer=t,s.loop=!0,s}createRainSound(){let e=this.createWhiteNoise(),t=this.audioContext.createBiquadFilter();return t.type="lowpass",t.frequency.value=1e3,e.connect(t),t.connect(this.gainNode),e}createOceanSound(){let e=this.createWhiteNoise(),t=this.audioContext.createBiquadFilter();t.type="lowpass",t.frequency.value=400;let n=this.audioContext.createOscillator(),s=this.audioContext.createGain();return n.frequency.value=.1,s.gain.value=200,n.connect(s),s.connect(t.frequency),e.connect(t),t.connect(this.gainNode),n.start(),e}createForestSound(){let e=this.createWhiteNoise(),t=this.audioContext.createBiquadFilter();return t.type="bandpass",t.frequency.value=800,t.Q.value=.5,e.connect(t),t.connect(this.gainNode),e}createCampfireSound(){let e=this.createWhiteNoise(),t=this.audioContext.createBiquadFilter();return t.type="lowpass",t.frequency.value=300,e.connect(t),t.connect(this.gainNode),e}async togglePlayback(){try{await this.initAudioContext(),this.isPlaying?this.stopSound():await this.playSound()}catch{this.updateStatus("Audio not available")}}async playSound(){if(!this.audioContext||!this.gainNode)return;let e=this.sounds[this.currentSound],t=parseInt(this.volumeSlider?.value||"50")/100;this.gainNode.gain.setValueAtTime(t*.3,this.audioContext.currentTime);let n;switch(this.currentSound){case"rain":n=this.createRainSound();break;case"ocean":n=this.createOceanSound();break;case"forest":n=this.createForestSound();break;case"campfire":n=this.createCampfireSound();break;case"river":n=this.createForestSound();break;default:n=this.createRainSound()}n.start(),this.oscillators=[n],this.isPlaying=!0,this.updatePlayButton(),this.updateStatus(`Playing ${e.name}`),this.dispatchEvent(new CustomEvent("ambient-started",{detail:{sound:this.currentSound,volume:t},bubbles:!0}))}stopSound(){this.oscillators.forEach(e=>{this.audioContext&&e.stop&&e.stop(this.audioContext.currentTime+.1)}),this.gainNode&&this.audioContext&&this.gainNode.gain.linearRampToValueAtTime(0,this.audioContext.currentTime+.1),this.oscillators=[],this.gainNodes=[],this.isPlaying=!1,this.updatePlayButton(),this.updateStatus("Stopped"),this.dispatchEvent(new CustomEvent("ambient-stopped",{detail:{sound:this.currentSound},bubbles:!0}))}changeSound(e){let t=this.isPlaying;this.isPlaying&&this.stopSound(),this.currentSound=e,this.updateSoundDisplay(),t&&setTimeout(()=>this.playSound(),200),this.dispatchEvent(new CustomEvent("ambient-changed",{detail:{sound:this.currentSound},bubbles:!0}))}updateVolume(){if(!this.volumeSlider||!this.isPlaying||!this.gainNode||!this.audioContext)return;let e=parseInt(this.volumeSlider.value)/100;this.gainNode.gain.linearRampToValueAtTime(e*.3,this.audioContext.currentTime+.1)}updatePlayButton(){let e=this.shadow.querySelector(".play-icon"),t=this.shadow.querySelector(".pause-icon");e&&t&&(this.isPlaying?(e.style.display="none",t.style.display="inline"):(e.style.display="inline",t.style.display="none"))}updateSoundDisplay(){let e=this.shadow.querySelector(".sound-icon"),t=this.shadow.querySelector(".sound-name"),n=this.sounds[this.currentSound];e&&(e.textContent=n.icon),t&&(t.textContent=n.name)}updateStatus(e){let t=this.shadow.querySelector(".status");t&&(t.textContent=e)}static get observedAttributes(){return["sound"]}attributeChangedCallback(e,t,n){e==="sound"&&n&&n in this.sounds&&(this.changeSound(n),this.soundSelect&&(this.soundSelect.value=n))}disconnectedCallback(){super.disconnectedCallback(),this.isPlaying&&this.stopSound(),this.audioContext&&this.audioContext.close()}getStyles(){return`
596
+ ${this.getBaseStyles()}
597
+
598
+ .ambient {
599
+ width: 300px;
600
+ text-align: center;
601
+ }
602
+
603
+ .sound-display {
604
+ display: flex;
605
+ align-items: center;
606
+ justify-content: center;
607
+ gap: 0.75rem;
608
+ margin-bottom: 1.5rem;
609
+ padding: 1rem;
610
+ background: linear-gradient(135deg,
611
+ var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 10%,
612
+ transparent 50%);
613
+ border-radius: var(--widgies-radius, 0.5rem);
614
+ border: 1px solid color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 30%, transparent);
615
+ }
616
+
617
+ .sound-icon {
618
+ font-size: 2rem;
619
+ }
620
+
621
+ .sound-name {
622
+ font-size: 1.2rem;
623
+ font-weight: 600;
624
+ color: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
625
+ }
626
+
627
+ .controls {
628
+ display: flex;
629
+ gap: 1rem;
630
+ margin-bottom: 1.5rem;
631
+ align-items: center;
632
+ }
633
+
634
+ .sound-select {
635
+ flex: 1;
636
+ padding: 0.75rem;
637
+ border: 1px solid color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 30%, transparent);
638
+ border-radius: var(--widgies-radius, 0.5rem);
639
+ background: var(--widgies-surface, var(--widgies-surface-light, #ffffffe6));
640
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
641
+ font: inherit;
642
+ }
643
+
644
+ .sound-select:focus {
645
+ outline: 2px solid var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
646
+ outline-offset: 1px;
647
+ }
648
+
649
+ .play-btn {
650
+ width: 60px;
651
+ height: 60px;
652
+ border-radius: 50%;
653
+ font-size: 1.5rem;
654
+ display: flex;
655
+ align-items: center;
656
+ justify-content: center;
657
+ padding: 0;
658
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 25%, transparent);
659
+ }
660
+
661
+ .volume-control {
662
+ margin-bottom: 1rem;
663
+ }
664
+
665
+ .volume-control label {
666
+ display: flex;
667
+ flex-direction: column;
668
+ gap: 0.5rem;
669
+ align-items: center;
670
+ }
671
+
672
+ .volume-label {
673
+ font-size: 0.9rem;
674
+ font-weight: 500;
675
+ }
676
+
677
+ .volume-slider {
678
+ width: 100%;
679
+ height: 8px;
680
+ border-radius: 4px;
681
+ background: color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 20%, transparent);
682
+ outline: none;
683
+ -webkit-appearance: none;
684
+ }
685
+
686
+ .volume-slider::-webkit-slider-thumb {
687
+ -webkit-appearance: none;
688
+ width: 20px;
689
+ height: 20px;
690
+ border-radius: 50%;
691
+ background: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
692
+ cursor: pointer;
693
+ box-shadow: 0 2px 6px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 40%, transparent);
694
+ }
695
+
696
+ .volume-slider::-moz-range-thumb {
697
+ width: 20px;
698
+ height: 20px;
699
+ border-radius: 50%;
700
+ background: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
701
+ cursor: pointer;
702
+ border: none;
703
+ box-shadow: 0 2px 6px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-light, #6c4cff)) 40%, transparent);
704
+ }
705
+
706
+ .status {
707
+ font-size: 0.9rem;
708
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 70%, transparent);
709
+ font-style: italic;
710
+ }
711
+
712
+ @media (prefers-color-scheme: dark) {
713
+ .sound-display {
714
+ background: linear-gradient(135deg,
715
+ var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 10%,
716
+ transparent 50%);
717
+ border-color: color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 30%, transparent);
718
+ }
719
+
720
+ .sound-name {
721
+ color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
722
+ }
723
+
724
+ .sound-select {
725
+ background: var(--widgies-surface, var(--widgies-surface-dark, #181824e6));
726
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
727
+ border-color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 30%, transparent);
728
+ }
729
+
730
+ .sound-select:focus {
731
+ outline-color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
732
+ }
733
+
734
+ .play-btn {
735
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 25%, transparent);
736
+ }
737
+
738
+ .volume-slider {
739
+ background: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 20%, transparent);
740
+ }
741
+
742
+ .volume-slider::-webkit-slider-thumb {
743
+ background: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
744
+ box-shadow: 0 2px 6px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 40%, transparent);
745
+ }
746
+
747
+ .volume-slider::-moz-range-thumb {
748
+ background: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
749
+ box-shadow: 0 2px 6px color-mix(in srgb, var(--widgies-accent, var(--widgies-accent-dark, #a88bff)) 40%, transparent);
750
+ }
751
+
752
+ .status {
753
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 70%, transparent);
754
+ }
755
+ }
756
+ `}};pt()});var xt={};V(xt,{default:()=>Pt,qrcode:()=>$,stringToBytes:()=>Ht});var $,T,W,H,q,O,K,vt,bt,At,Bt,Mt,Lt,wt,Dt,Rt,Nt,_t,Pt,Ht,yt=_(()=>{$=function(h,f){let n=h,s=W[f],r=null,i=0,l=null,m=[],b={},p=function(o,u){i=n*4+17,r=function(a){let c=new Array(a);for(let d=0;d<a;d+=1){c[d]=new Array(a);for(let v=0;v<a;v+=1)c[d][v]=null}return c}(i),g(0,0),g(i-7,0),g(0,i-7),I(),L(),R(o,u),n>=7&&B(o),l==null&&(l=Et(n,s,m)),D(l,u)},g=function(o,u){for(let a=-1;a<=7;a+=1)if(!(o+a<=-1||i<=o+a))for(let c=-1;c<=7;c+=1)u+c<=-1||i<=u+c||(0<=a&&a<=6&&(c==0||c==6)||0<=c&&c<=6&&(a==0||a==6)||2<=a&&a<=4&&2<=c&&c<=4?r[o+a][u+c]=!0:r[o+a][u+c]=!1)},y=function(){let o=0,u=0;for(let a=0;a<8;a+=1){p(!0,a);let c=q.getLostPoint(b);(a==0||o>c)&&(o=c,u=a)}return u},L=function(){for(let o=8;o<i-8;o+=1)r[o][6]==null&&(r[o][6]=o%2==0);for(let o=8;o<i-8;o+=1)r[6][o]==null&&(r[6][o]=o%2==0)},I=function(){let o=q.getPatternPosition(n);for(let u=0;u<o.length;u+=1)for(let a=0;a<o.length;a+=1){let c=o[u],d=o[a];if(r[c][d]==null)for(let v=-2;v<=2;v+=1)for(let w=-2;w<=2;w+=1)v==-2||v==2||w==-2||w==2||v==0&&w==0?r[c+v][d+w]=!0:r[c+v][d+w]=!1}},B=function(o){let u=q.getBCHTypeNumber(n);for(let a=0;a<18;a+=1){let c=!o&&(u>>a&1)==1;r[Math.floor(a/3)][a%3+i-8-3]=c}for(let a=0;a<18;a+=1){let c=!o&&(u>>a&1)==1;r[a%3+i-8-3][Math.floor(a/3)]=c}},R=function(o,u){let a=s<<3|u,c=q.getBCHTypeInfo(a);for(let d=0;d<15;d+=1){let v=!o&&(c>>d&1)==1;d<6?r[d][8]=v:d<8?r[d+1][8]=v:r[i-15+d][8]=v}for(let d=0;d<15;d+=1){let v=!o&&(c>>d&1)==1;d<8?r[8][i-d-1]=v:d<9?r[8][15-d-1+1]=v:r[8][15-d-1]=v}r[i-8][8]=!o},D=function(o,u){let a=-1,c=i-1,d=7,v=0,w=q.getMaskFunction(u);for(let k=i-1;k>0;k-=2)for(k==6&&(k-=1);;){for(let C=0;C<2;C+=1)if(r[c][k-C]==null){let E=!1;v<o.length&&(E=(o[v]>>>d&1)==1),w(c,k-C)&&(E=!E),r[c][k-C]=E,d-=1,d==-1&&(v+=1,d=7)}if(c+=a,c<0||i<=c){c-=a,a=-a;break}}},St=function(o,u){let a=0,c=0,d=0,v=new Array(u.length),w=new Array(u.length);for(let x=0;x<u.length;x+=1){let S=u[x].dataCount,M=u[x].totalCount-S;c=Math.max(c,S),d=Math.max(d,M),v[x]=new Array(S);for(let N=0;N<v[x].length;N+=1)v[x][N]=255&o.getBuffer()[N+a];a+=S;let J=q.getErrorCorrectPolynomial(M),at=K(v[x],J.getLength()-1).mod(J);w[x]=new Array(J.getLength()-1);for(let N=0;N<w[x].length;N+=1){let st=N+at.getLength()-w[x].length;w[x][N]=st>=0?at.getAt(st):0}}let k=0;for(let x=0;x<u.length;x+=1)k+=u[x].totalCount;let C=new Array(k),E=0;for(let x=0;x<c;x+=1)for(let S=0;S<u.length;S+=1)x<v[S].length&&(C[E]=v[S][x],E+=1);for(let x=0;x<d;x+=1)for(let S=0;S<u.length;S+=1)x<w[S].length&&(C[E]=w[S][x],E+=1);return C},Et=function(o,u,a){let c=vt.getRSBlocks(o,u),d=bt();for(let w=0;w<a.length;w+=1){let k=a[w];d.put(k.getMode(),4),d.put(k.getLength(),q.getLengthInBits(k.getMode(),o)),k.write(d)}let v=0;for(let w=0;w<c.length;w+=1)v+=c[w].dataCount;if(d.getLengthInBits()>v*8)throw"code length overflow. ("+d.getLengthInBits()+">"+v*8+")";for(d.getLengthInBits()+4<=v*8&&d.put(0,4);d.getLengthInBits()%8!=0;)d.putBit(!1);for(;!(d.getLengthInBits()>=v*8||(d.put(236,8),d.getLengthInBits()>=v*8));)d.put(17,8);return St(d,c)};b.addData=function(o,u){u=u||"Byte";let a=null;switch(u){case"Numeric":a=At(o);break;case"Alphanumeric":a=Bt(o);break;case"Byte":a=Mt(o);break;case"Kanji":a=Lt(o);break;default:throw"mode:"+u}m.push(a),l=null},b.isDark=function(o,u){if(o<0||i<=o||u<0||i<=u)throw o+","+u;return r[o][u]},b.getModuleCount=function(){return i},b.make=function(){if(n<1){let o=1;for(;o<40;o++){let u=vt.getRSBlocks(o,s),a=bt();for(let d=0;d<m.length;d++){let v=m[d];a.put(v.getMode(),4),a.put(v.getLength(),q.getLengthInBits(v.getMode(),o)),v.write(a)}let c=0;for(let d=0;d<u.length;d++)c+=u[d].dataCount;if(a.getLengthInBits()<=c*8)break}n=o}p(!1,y())},b.createTableTag=function(o,u){o=o||2,u=typeof u>"u"?o*4:u;let a="";a+='<table style="',a+=" border-width: 0px; border-style: none;",a+=" border-collapse: collapse;",a+=" padding: 0px; margin: "+u+"px;",a+='">',a+="<tbody>";for(let c=0;c<b.getModuleCount();c+=1){a+="<tr>";for(let d=0;d<b.getModuleCount();d+=1)a+='<td style="',a+=" border-width: 0px; border-style: none;",a+=" border-collapse: collapse;",a+=" padding: 0px; margin: 0px;",a+=" width: "+o+"px;",a+=" height: "+o+"px;",a+=" background-color: ",a+=b.isDark(c,d)?"#000000":"#ffffff",a+=";",a+='"/>';a+="</tr>"}return a+="</tbody>",a+="</table>",a},b.createSvgTag=function(o,u,a,c){let d={};typeof arguments[0]=="object"&&(d=arguments[0],o=d.cellSize,u=d.margin,a=d.alt,c=d.title),o=o||2,u=typeof u>"u"?o*4:u,a=typeof a=="string"?{text:a}:a||{},a.text=a.text||null,a.id=a.text?a.id||"qrcode-description":null,c=typeof c=="string"?{text:c}:c||{},c.text=c.text||null,c.id=c.text?c.id||"qrcode-title":null;let v=b.getModuleCount()*o+u*2,w,k,C,E,x="",S;for(S="l"+o+",0 0,"+o+" -"+o+",0 0,-"+o+"z ",x+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',x+=d.scalable?"":' width="'+v+'px" height="'+v+'px"',x+=' viewBox="0 0 '+v+" "+v+'" ',x+=' preserveAspectRatio="xMinYMin meet"',x+=c.text||a.text?' role="img" aria-labelledby="'+F([c.id,a.id].join(" ").trim())+'"':"",x+=">",x+=c.text?'<title id="'+F(c.id)+'">'+F(c.text)+"</title>":"",x+=a.text?'<description id="'+F(a.id)+'">'+F(a.text)+"</description>":"",x+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',x+='<path d="',C=0;C<b.getModuleCount();C+=1)for(E=C*o+u,w=0;w<b.getModuleCount();w+=1)b.isDark(C,w)&&(k=w*o+u,x+="M"+k+","+E+S);return x+='" stroke="transparent" fill="black"/>',x+="</svg>",x},b.createDataURL=function(o,u){o=o||2,u=typeof u>"u"?o*4:u;let a=b.getModuleCount()*o+u*2,c=u,d=a-u;return _t(a,a,function(v,w){if(c<=v&&v<d&&c<=w&&w<d){let k=Math.floor((v-c)/o),C=Math.floor((w-c)/o);return b.isDark(C,k)?0:1}else return 1})},b.createImgTag=function(o,u,a){o=o||2,u=typeof u>"u"?o*4:u;let c=b.getModuleCount()*o+u*2,d="";return d+="<img",d+=' src="',d+=b.createDataURL(o,u),d+='"',d+=' width="',d+=c,d+='"',d+=' height="',d+=c,d+='"',a&&(d+=' alt="',d+=F(a),d+='"'),d+="/>",d};let F=function(o){let u="";for(let a=0;a<o.length;a+=1){let c=o.charAt(a);switch(c){case"<":u+="&lt;";break;case">":u+="&gt;";break;case"&":u+="&amp;";break;case'"':u+="&quot;";break;default:u+=c;break}}return u},It=function(o){o=typeof o>"u"?1*2:o;let a=b.getModuleCount()*1+o*2,c=o,d=a-o,v,w,k,C,E,x={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},S={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},M="";for(v=0;v<a;v+=2){for(k=Math.floor((v-c)/1),C=Math.floor((v+1-c)/1),w=0;w<a;w+=1)E="\u2588",c<=w&&w<d&&c<=v&&v<d&&b.isDark(k,Math.floor((w-c)/1))&&(E=" "),c<=w&&w<d&&c<=v+1&&v+1<d&&b.isDark(C,Math.floor((w-c)/1))?E+=" ":E+="\u2588",M+=o<1&&v+1>=d?S[E]:x[E];M+=`
757
+ `}return a%2&&o>0?M.substring(0,M.length-a-1)+Array(a+1).join("\u2580"):M.substring(0,M.length-1)};return b.createASCII=function(o,u){if(o=o||1,o<2)return It(u);o-=1,u=typeof u>"u"?o*2:u;let a=b.getModuleCount()*o+u*2,c=u,d=a-u,v,w,k,C,E=Array(o+1).join("\u2588\u2588"),x=Array(o+1).join(" "),S="",M="";for(v=0;v<a;v+=1){for(k=Math.floor((v-c)/o),M="",w=0;w<a;w+=1)C=1,c<=w&&w<d&&c<=v&&v<d&&b.isDark(k,Math.floor((w-c)/o))&&(C=0),M+=C?E:x;for(k=0;k<o;k+=1)S+=M+`
758
+ `}return S.substring(0,S.length-1)},b.renderTo2dContext=function(o,u){u=u||2;let a=b.getModuleCount();for(let c=0;c<a;c++)for(let d=0;d<a;d++)o.fillStyle=b.isDark(c,d)?"black":"white",o.fillRect(c*u,d*u,u,u)},b};$.stringToBytes=function(h){let f=[];for(let e=0;e<h.length;e+=1){let t=h.charCodeAt(e);f.push(t&255)}return f};$.createStringToBytes=function(h,f){let e=function(){let n=Rt(h),s=function(){let l=n.read();if(l==-1)throw"eof";return l},r=0,i={};for(;;){let l=n.read();if(l==-1)break;let m=s(),b=s(),p=s(),g=String.fromCharCode(l<<8|m),y=b<<8|p;i[g]=y,r+=1}if(r!=f)throw r+" != "+f;return i}(),t=63;return function(n){let s=[];for(let r=0;r<n.length;r+=1){let i=n.charCodeAt(r);if(i<128)s.push(i);else{let l=e[n.charAt(r)];typeof l=="number"?(l&255)==l?s.push(l):(s.push(l>>>8),s.push(l&255)):s.push(t)}}return s}};T={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},W={L:1,M:0,Q:3,H:2},H={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},q=function(){let h=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],f=1335,e=7973,t=21522,n={},s=function(r){let i=0;for(;r!=0;)i+=1,r>>>=1;return i};return n.getBCHTypeInfo=function(r){let i=r<<10;for(;s(i)-s(f)>=0;)i^=f<<s(i)-s(f);return(r<<10|i)^t},n.getBCHTypeNumber=function(r){let i=r<<12;for(;s(i)-s(e)>=0;)i^=e<<s(i)-s(e);return r<<12|i},n.getPatternPosition=function(r){return h[r-1]},n.getMaskFunction=function(r){switch(r){case H.PATTERN000:return function(i,l){return(i+l)%2==0};case H.PATTERN001:return function(i,l){return i%2==0};case H.PATTERN010:return function(i,l){return l%3==0};case H.PATTERN011:return function(i,l){return(i+l)%3==0};case H.PATTERN100:return function(i,l){return(Math.floor(i/2)+Math.floor(l/3))%2==0};case H.PATTERN101:return function(i,l){return i*l%2+i*l%3==0};case H.PATTERN110:return function(i,l){return(i*l%2+i*l%3)%2==0};case H.PATTERN111:return function(i,l){return(i*l%3+(i+l)%2)%2==0};default:throw"bad maskPattern:"+r}},n.getErrorCorrectPolynomial=function(r){let i=K([1],0);for(let l=0;l<r;l+=1)i=i.multiply(K([1,O.gexp(l)],0));return i},n.getLengthInBits=function(r,i){if(1<=i&&i<10)switch(r){case T.MODE_NUMBER:return 10;case T.MODE_ALPHA_NUM:return 9;case T.MODE_8BIT_BYTE:return 8;case T.MODE_KANJI:return 8;default:throw"mode:"+r}else if(i<27)switch(r){case T.MODE_NUMBER:return 12;case T.MODE_ALPHA_NUM:return 11;case T.MODE_8BIT_BYTE:return 16;case T.MODE_KANJI:return 10;default:throw"mode:"+r}else if(i<41)switch(r){case T.MODE_NUMBER:return 14;case T.MODE_ALPHA_NUM:return 13;case T.MODE_8BIT_BYTE:return 16;case T.MODE_KANJI:return 12;default:throw"mode:"+r}else throw"type:"+i},n.getLostPoint=function(r){let i=r.getModuleCount(),l=0;for(let p=0;p<i;p+=1)for(let g=0;g<i;g+=1){let y=0,L=r.isDark(p,g);for(let I=-1;I<=1;I+=1)if(!(p+I<0||i<=p+I))for(let B=-1;B<=1;B+=1)g+B<0||i<=g+B||I==0&&B==0||L==r.isDark(p+I,g+B)&&(y+=1);y>5&&(l+=3+y-5)}for(let p=0;p<i-1;p+=1)for(let g=0;g<i-1;g+=1){let y=0;r.isDark(p,g)&&(y+=1),r.isDark(p+1,g)&&(y+=1),r.isDark(p,g+1)&&(y+=1),r.isDark(p+1,g+1)&&(y+=1),(y==0||y==4)&&(l+=3)}for(let p=0;p<i;p+=1)for(let g=0;g<i-6;g+=1)r.isDark(p,g)&&!r.isDark(p,g+1)&&r.isDark(p,g+2)&&r.isDark(p,g+3)&&r.isDark(p,g+4)&&!r.isDark(p,g+5)&&r.isDark(p,g+6)&&(l+=40);for(let p=0;p<i;p+=1)for(let g=0;g<i-6;g+=1)r.isDark(g,p)&&!r.isDark(g+1,p)&&r.isDark(g+2,p)&&r.isDark(g+3,p)&&r.isDark(g+4,p)&&!r.isDark(g+5,p)&&r.isDark(g+6,p)&&(l+=40);let m=0;for(let p=0;p<i;p+=1)for(let g=0;g<i;g+=1)r.isDark(g,p)&&(m+=1);let b=Math.abs(100*m/i/i-50)/5;return l+=b*10,l},n}(),O=function(){let h=new Array(256),f=new Array(256);for(let t=0;t<8;t+=1)h[t]=1<<t;for(let t=8;t<256;t+=1)h[t]=h[t-4]^h[t-5]^h[t-6]^h[t-8];for(let t=0;t<255;t+=1)f[h[t]]=t;let e={};return e.glog=function(t){if(t<1)throw"glog("+t+")";return f[t]},e.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return h[t]},e}(),K=function(h,f){if(typeof h.length>"u")throw h.length+"/"+f;let e=function(){let n=0;for(;n<h.length&&h[n]==0;)n+=1;let s=new Array(h.length-n+f);for(let r=0;r<h.length-n;r+=1)s[r]=h[r+n];return s}(),t={};return t.getAt=function(n){return e[n]},t.getLength=function(){return e.length},t.multiply=function(n){let s=new Array(t.getLength()+n.getLength()-1);for(let r=0;r<t.getLength();r+=1)for(let i=0;i<n.getLength();i+=1)s[r+i]^=O.gexp(O.glog(t.getAt(r))+O.glog(n.getAt(i)));return K(s,0)},t.mod=function(n){if(t.getLength()-n.getLength()<0)return t;let s=O.glog(t.getAt(0))-O.glog(n.getAt(0)),r=new Array(t.getLength());for(let i=0;i<t.getLength();i+=1)r[i]=t.getAt(i);for(let i=0;i<n.getLength();i+=1)r[i]^=O.gexp(O.glog(n.getAt(i))+s);return K(r,0).mod(n)},t},vt=function(){let h=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],f=function(n,s){let r={};return r.totalCount=n,r.dataCount=s,r},e={},t=function(n,s){switch(s){case W.L:return h[(n-1)*4+0];case W.M:return h[(n-1)*4+1];case W.Q:return h[(n-1)*4+2];case W.H:return h[(n-1)*4+3];default:return}};return e.getRSBlocks=function(n,s){let r=t(n,s);if(typeof r>"u")throw"bad rs block @ typeNumber:"+n+"/errorCorrectionLevel:"+s;let i=r.length/3,l=[];for(let m=0;m<i;m+=1){let b=r[m*3+0],p=r[m*3+1],g=r[m*3+2];for(let y=0;y<b;y+=1)l.push(f(p,g))}return l},e}(),bt=function(){let h=[],f=0,e={};return e.getBuffer=function(){return h},e.getAt=function(t){let n=Math.floor(t/8);return(h[n]>>>7-t%8&1)==1},e.put=function(t,n){for(let s=0;s<n;s+=1)e.putBit((t>>>n-s-1&1)==1)},e.getLengthInBits=function(){return f},e.putBit=function(t){let n=Math.floor(f/8);h.length<=n&&h.push(0),t&&(h[n]|=128>>>f%8),f+=1},e},At=function(h){let f=T.MODE_NUMBER,e=h,t={};t.getMode=function(){return f},t.getLength=function(r){return e.length},t.write=function(r){let i=e,l=0;for(;l+2<i.length;)r.put(n(i.substring(l,l+3)),10),l+=3;l<i.length&&(i.length-l==1?r.put(n(i.substring(l,l+1)),4):i.length-l==2&&r.put(n(i.substring(l,l+2)),7))};let n=function(r){let i=0;for(let l=0;l<r.length;l+=1)i=i*10+s(r.charAt(l));return i},s=function(r){if("0"<=r&&r<="9")return r.charCodeAt(0)-48;throw"illegal char :"+r};return t},Bt=function(h){let f=T.MODE_ALPHA_NUM,e=h,t={};t.getMode=function(){return f},t.getLength=function(s){return e.length},t.write=function(s){let r=e,i=0;for(;i+1<r.length;)s.put(n(r.charAt(i))*45+n(r.charAt(i+1)),11),i+=2;i<r.length&&s.put(n(r.charAt(i)),6)};let n=function(s){if("0"<=s&&s<="9")return s.charCodeAt(0)-48;if("A"<=s&&s<="Z")return s.charCodeAt(0)-65+10;switch(s){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+s}};return t},Mt=function(h){let f=T.MODE_8BIT_BYTE,e=h,t=$.stringToBytes(h),n={};return n.getMode=function(){return f},n.getLength=function(s){return t.length},n.write=function(s){for(let r=0;r<t.length;r+=1)s.put(t[r],8)},n},Lt=function(h){let f=T.MODE_KANJI,e=h,t=$.stringToBytes;(function(r,i){let l=t(r);if(l.length!=2||(l[0]<<8|l[1])!=i)throw"sjis not supported."})("\u53CB",38726);let n=t(h),s={};return s.getMode=function(){return f},s.getLength=function(r){return~~(n.length/2)},s.write=function(r){let i=n,l=0;for(;l+1<i.length;){let m=(255&i[l])<<8|255&i[l+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw"illegal char at "+(l+1)+"/"+m;m=(m>>>8&255)*192+(m&255),r.put(m,13),l+=2}if(l<i.length)throw"illegal char at "+(l+1)},s},wt=function(){let h=[],f={};return f.writeByte=function(e){h.push(e&255)},f.writeShort=function(e){f.writeByte(e),f.writeByte(e>>>8)},f.writeBytes=function(e,t,n){t=t||0,n=n||e.length;for(let s=0;s<n;s+=1)f.writeByte(e[s+t])},f.writeString=function(e){for(let t=0;t<e.length;t+=1)f.writeByte(e.charCodeAt(t))},f.toByteArray=function(){return h},f.toString=function(){let e="";e+="[";for(let t=0;t<h.length;t+=1)t>0&&(e+=","),e+=h[t];return e+="]",e},f},Dt=function(){let h=0,f=0,e=0,t="",n={},s=function(i){t+=String.fromCharCode(r(i&63))},r=function(i){if(i<0)throw"n:"+i;if(i<26)return 65+i;if(i<52)return 97+(i-26);if(i<62)return 48+(i-52);if(i==62)return 43;if(i==63)return 47;throw"n:"+i};return n.writeByte=function(i){for(h=h<<8|i&255,f+=8,e+=1;f>=6;)s(h>>>f-6),f-=6},n.flush=function(){if(f>0&&(s(h<<6-f),h=0,f=0),e%3!=0){let i=3-e%3;for(let l=0;l<i;l+=1)t+="="}},n.toString=function(){return t},n},Rt=function(h){let f=h,e=0,t=0,n=0,s={};s.read=function(){for(;n<8;){if(e>=f.length){if(n==0)return-1;throw"unexpected end of file./"+n}let l=f.charAt(e);if(e+=1,l=="=")return n=0,-1;if(l.match(/^\s$/))continue;t=t<<6|r(l.charCodeAt(0)),n+=6}let i=t>>>n-8&255;return n-=8,i};let r=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw"c:"+i};return s},Nt=function(h,f){let e=h,t=f,n=new Array(h*f),s={};s.setPixel=function(m,b,p){n[b*e+m]=p},s.write=function(m){m.writeString("GIF87a"),m.writeShort(e),m.writeShort(t),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(e),m.writeShort(t),m.writeByte(0);let b=2,p=i(b);m.writeByte(b);let g=0;for(;p.length-g>255;)m.writeByte(255),m.writeBytes(p,g,255),g+=255;m.writeByte(p.length-g),m.writeBytes(p,g,p.length-g),m.writeByte(0),m.writeString(";")};let r=function(m){let b=m,p=0,g=0,y={};return y.write=function(L,I){if(L>>>I)throw"length over";for(;p+I>=8;)b.writeByte(255&(L<<p|g)),I-=8-p,L>>>=8-p,g=0,p=0;g=L<<p|g,p=p+I},y.flush=function(){p>0&&b.writeByte(g)},y},i=function(m){let b=1<<m,p=(1<<m)+1,g=m+1,y=l();for(let D=0;D<b;D+=1)y.add(String.fromCharCode(D));y.add(String.fromCharCode(b)),y.add(String.fromCharCode(p));let L=wt(),I=r(L);I.write(b,g);let B=0,R=String.fromCharCode(n[B]);for(B+=1;B<n.length;){let D=String.fromCharCode(n[B]);B+=1,y.contains(R+D)?R=R+D:(I.write(y.indexOf(R),g),y.size()<4095&&(y.size()==1<<g&&(g+=1),y.add(R+D)),R=D)}return I.write(y.indexOf(R),g),I.write(p,g),I.flush(),L.toByteArray()},l=function(){let m={},b=0,p={};return p.add=function(g){if(p.contains(g))throw"dup key:"+g;m[g]=b,b+=1},p.size=function(){return b},p.indexOf=function(g){return m[g]},p.contains=function(g){return typeof m[g]<"u"},p};return s},_t=function(h,f,e){let t=Nt(h,f);for(let i=0;i<f;i+=1)for(let l=0;l<h;l+=1)t.setPixel(l,i,e(l,i));let n=wt();t.write(n);let s=Dt(),r=n.toByteArray();for(let i=0;i<r.length;i+=1)s.writeByte(r[i]);return s.flush(),"data:image/gif;base64,"+s},Pt=$,Ht=$.stringToBytes});var Ct={};V(Ct,{QRCodeWidget:()=>z,register:()=>kt});function kt(){customElements.get("widgies-qr-code")||customElements.define("widgies-qr-code",z)}var nt,z,rt=_(()=>{"use strict";P();nt=null,z=class extends A{constructor(){super(...arguments);this.textInput=null;this.generateButton=null;this.qrDisplay=null;this.downloadButton=null}render(){this.shadow.innerHTML="";let e=this.createStyleSheet();e&&this.shadow.appendChild(e);let t=document.createElement("div");t.innerHTML=`
759
+ <div class="qr-generator" role="application" aria-label="QR code generator">
760
+ <div class="input-section">
761
+ <label for="qr-text">Text to encode:</label>
762
+ <input
763
+ type="text"
764
+ id="qr-text"
765
+ class="text-input"
766
+ placeholder="Enter text or URL"
767
+ value="${this.getAttribute("text")||""}"
768
+ maxlength="256"
769
+ aria-describedby="qr-display"
770
+ >
771
+ <button class="generate-btn" type="button">Generate QR Code</button>
772
+ </div>
773
+ <div class="qr-display" id="qr-display" aria-live="polite" aria-label="Generated QR code">
774
+ <div class="placeholder">Enter text above to generate QR code</div>
775
+ </div>
776
+ <button class="download-btn" type="button" style="display: none;" aria-label="Download QR code as PNG">
777
+ Download PNG
778
+ </button>
779
+ </div>
780
+ `,this.shadow.appendChild(t),this.textInput=this.shadow.querySelector(".text-input"),this.generateButton=this.shadow.querySelector(".generate-btn"),this.qrDisplay=this.shadow.querySelector(".qr-display"),this.downloadButton=this.shadow.querySelector(".download-btn")}attachEventListeners(){this.generateButton?.addEventListener("click",()=>{this.generateQRCode()}),this.textInput?.addEventListener("input",()=>{this.validateInput()}),this.textInput?.addEventListener("keydown",e=>{e.key==="Enter"&&(e.preventDefault(),this.generateQRCode())}),this.downloadButton?.addEventListener("click",()=>{this.downloadQRCode()})}handleActivation(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.textInput?.value&&this.generateQRCode())}validateInput(){if(!this.textInput||!this.generateButton)return;let e=this.textInput.value.trim();this.generateButton.disabled=e.length===0}async generateQRCode(){if(!this.textInput||!this.qrDisplay)return;let e=this.textInput.value.trim();if(!e){this.showError("Please enter text to encode");return}try{if(!nt){this.showLoading("Loading QR code generator...");try{nt=(await Promise.resolve().then(()=>(yt(),xt))).default}catch{this.showError("Failed to load QR code generator. Please ensure the library is available.");return}}let t=this.createQRCode(e);this.renderQRCode(t),this.downloadButton.style.display="block",this.dispatchEvent(new CustomEvent("qr-generated",{detail:{text:e,size:t.length},bubbles:!0}))}catch{this.showError("Failed to generate QR code")}}createQRCode(e){try{let t=nt(0,"L");t.addData(e),t.make();let n=t.getModuleCount(),s=[];for(let r=0;r<n;r++){s[r]=[];for(let i=0;i<n;i++)s[r][i]=t.isDark(r,i)?1:0}return s}catch(t){return console.error("QR Code generation failed:",t),[[1,1,1],[1,0,1],[1,1,1]]}}renderQRCode(e){if(!this.qrDisplay)return;let t=e.length,n=8,s=document.createElement("canvas"),r=s.getContext("2d");if(s.width=t*n,s.height=t*n,s.setAttribute("aria-label",`QR code for: ${this.textInput?.value}`),r){r.fillStyle="#ffffff",r.fillRect(0,0,s.width,s.height),r.fillStyle="#000000";for(let i=0;i<t;i++)for(let l=0;l<t;l++)e[i][l]===1&&r.fillRect(l*n,i*n,n,n)}this.qrDisplay.innerHTML="",this.qrDisplay.appendChild(s)}downloadQRCode(){let e=this.qrDisplay?.querySelector("canvas");if(e)try{let t=document.createElement("a");t.download=`qr-code-${Date.now()}.png`,t.href=e.toDataURL("image/png"),t.click()}catch{this.showError("Download failed")}}showError(e){this.qrDisplay&&(this.qrDisplay.innerHTML=`<div class="error" role="alert">${e}</div>`,this.downloadButton.style.display="none")}showLoading(e){this.qrDisplay&&(this.qrDisplay.innerHTML=`<div class="loading" role="status">${e}</div>`,this.downloadButton.style.display="none")}static get observedAttributes(){return["text"]}attributeChangedCallback(e,t,n){e==="text"&&this.textInput&&(this.textInput.value=n||"",this.validateInput())}connectedCallback(){super.connectedCallback(),this.generateButton&&(this.generateButton.disabled=!0),setTimeout(()=>this.validateInput(),0)}getStyles(){return`
781
+ ${this.getBaseStyles()}
782
+
783
+ .qr-generator {
784
+ width: 300px;
785
+ text-align: center;
786
+ }
787
+
788
+ .input-section {
789
+ margin-bottom: 1rem;
790
+ }
791
+
792
+ .input-section label {
793
+ display: block;
794
+ margin-bottom: 0.5rem;
795
+ font-weight: 500;
796
+ font-size: 0.9rem;
797
+ }
798
+
799
+ .text-input {
800
+ width: 100%;
801
+ padding: 0.75rem;
802
+ margin-bottom: 1rem;
803
+ border: 1px solid color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 30%, transparent);
804
+ border-radius: calc(var(--widgies-radius, 0.5rem) * 0.5);
805
+ background: var(--widgies-surface, var(--widgies-surface-light, #ffffffe6));
806
+ color: var(--widgies-text, var(--widgies-text-light, #1a1a1a));
807
+ font: inherit;
808
+ box-sizing: border-box;
809
+ }
810
+
811
+ .text-input:focus {
812
+ outline: 2px solid var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
813
+ outline-offset: 1px;
814
+ }
815
+
816
+ .generate-btn, .download-btn {
817
+ width: 100%;
818
+ padding: 0.75rem 1.5rem;
819
+ font-size: 1rem;
820
+ font-weight: 600;
821
+ margin-bottom: 0.5rem;
822
+ }
823
+
824
+ .qr-display {
825
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-light, #ffffffe6)) 70%, var(--widgies-text, var(--widgies-text-light, #1a1a1a)));
826
+ padding: 1rem;
827
+ border-radius: var(--widgies-radius, 0.5rem);
828
+ margin-bottom: 1rem;
829
+ min-height: 200px;
830
+ display: flex;
831
+ align-items: center;
832
+ justify-content: center;
833
+ }
834
+
835
+ .placeholder {
836
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-light, #1a1a1a)) 60%, transparent);
837
+ font-style: italic;
838
+ }
839
+
840
+ .error {
841
+ color: #dc2626;
842
+ font-weight: 500;
843
+ }
844
+
845
+ .loading {
846
+ color: var(--widgies-accent, var(--widgies-accent-light, #6c4cff));
847
+ font-weight: 500;
848
+ animation: pulse 1.5s ease-in-out infinite;
849
+ }
850
+
851
+ @keyframes pulse {
852
+ 0%, 100% { opacity: 1; }
853
+ 50% { opacity: 0.5; }
854
+ }
855
+
856
+ canvas {
857
+ max-width: 100%;
858
+ height: auto;
859
+ image-rendering: pixelated;
860
+ border-radius: calc(var(--widgies-radius, 0.5rem) * 0.5);
861
+ }
862
+
863
+ @media (prefers-color-scheme: dark) {
864
+ .text-input {
865
+ background: var(--widgies-surface, var(--widgies-surface-dark, #181824e6));
866
+ color: var(--widgies-text, var(--widgies-text-dark, #f5f5ff));
867
+ border-color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 30%, transparent);
868
+ }
869
+
870
+ .text-input:focus {
871
+ outline-color: var(--widgies-accent, var(--widgies-accent-dark, #a88bff));
872
+ }
873
+
874
+ .qr-display {
875
+ background: color-mix(in srgb, var(--widgies-surface, var(--widgies-surface-dark, #181824e6)) 70%, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)));
876
+ }
877
+
878
+ .placeholder {
879
+ color: color-mix(in srgb, var(--widgies-text, var(--widgies-text-dark, #f5f5ff)) 60%, transparent);
880
+ }
881
+ }
882
+ `}};kt()});P();X();Z();tt();et();it();rt();function Ut(){Promise.resolve().then(()=>X()),Promise.resolve().then(()=>Z()),Promise.resolve().then(()=>tt()),Promise.resolve().then(()=>et()),Promise.resolve().then(()=>it()),Promise.resolve().then(()=>rt())}export{G as AffirmationWidget,U as AmbientWidget,A as BaseWidget,Y as CalculatorWidget,z as QRCodeWidget,Q as RandomNumberWidget,j as TimerWidget,Ut as registerAllWidgets};