gudu-programs 1.0.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,859 @@
1
+ import { Link as e, NavLink as t, Route as n, Routes as r } from "react-router-dom";
2
+ import i, { useState as a } from "react";
3
+ //#region \0rolldown/runtime.js
4
+ var o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
5
+ if (typeof require < "u") return require.apply(this, arguments);
6
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
7
+ }), c = /* @__PURE__ */ o(((e) => {
8
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
9
+ function r(e, n, r) {
10
+ var i = null;
11
+ if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
12
+ else r = n;
13
+ return n = r.ref, {
14
+ $$typeof: t,
15
+ type: e,
16
+ key: i,
17
+ ref: n === void 0 ? null : n,
18
+ props: r
19
+ };
20
+ }
21
+ e.Fragment = n, e.jsx = r, e.jsxs = r;
22
+ })), l = /* @__PURE__ */ o(((e) => {
23
+ process.env.NODE_ENV !== "production" && (function() {
24
+ function t(e) {
25
+ if (e == null) return null;
26
+ if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
27
+ if (typeof e == "string") return e;
28
+ switch (e) {
29
+ case v: return "Fragment";
30
+ case b: return "Profiler";
31
+ case y: return "StrictMode";
32
+ case w: return "Suspense";
33
+ case T: return "SuspenseList";
34
+ case O: return "Activity";
35
+ }
36
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
37
+ case _: return "Portal";
38
+ case S: return e.displayName || "Context";
39
+ case x: return (e._context.displayName || "Context") + ".Consumer";
40
+ case C:
41
+ var n = e.render;
42
+ return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
43
+ case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
44
+ case D:
45
+ n = e._payload, e = e._init;
46
+ try {
47
+ return t(e(n));
48
+ } catch {}
49
+ }
50
+ return null;
51
+ }
52
+ function n(e) {
53
+ return "" + e;
54
+ }
55
+ function r(e) {
56
+ try {
57
+ n(e);
58
+ var t = !1;
59
+ } catch {
60
+ t = !0;
61
+ }
62
+ if (t) {
63
+ t = console;
64
+ var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
65
+ return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
66
+ }
67
+ }
68
+ function i(e) {
69
+ if (e === v) return "<>";
70
+ if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
71
+ try {
72
+ var n = t(e);
73
+ return n ? "<" + n + ">" : "<...>";
74
+ } catch {
75
+ return "<...>";
76
+ }
77
+ }
78
+ function a() {
79
+ var e = A.A;
80
+ return e === null ? null : e.getOwner();
81
+ }
82
+ function o() {
83
+ return Error("react-stack-top-frame");
84
+ }
85
+ function c(e) {
86
+ if (j.call(e, "key")) {
87
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
88
+ if (t && t.isReactWarning) return !1;
89
+ }
90
+ return e.key !== void 0;
91
+ }
92
+ function l(e, t) {
93
+ function n() {
94
+ P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
95
+ }
96
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
97
+ get: n,
98
+ configurable: !0
99
+ });
100
+ }
101
+ function u() {
102
+ var e = t(this.type);
103
+ return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
104
+ }
105
+ function d(e, t, n, r, i, a) {
106
+ var o = n.ref;
107
+ return e = {
108
+ $$typeof: g,
109
+ type: e,
110
+ key: t,
111
+ props: n,
112
+ _owner: r
113
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
114
+ enumerable: !1,
115
+ value: null
116
+ }) : Object.defineProperty(e, "ref", {
117
+ enumerable: !1,
118
+ get: u
119
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
120
+ configurable: !1,
121
+ enumerable: !1,
122
+ writable: !0,
123
+ value: 0
124
+ }), Object.defineProperty(e, "_debugInfo", {
125
+ configurable: !1,
126
+ enumerable: !1,
127
+ writable: !0,
128
+ value: null
129
+ }), Object.defineProperty(e, "_debugStack", {
130
+ configurable: !1,
131
+ enumerable: !1,
132
+ writable: !0,
133
+ value: i
134
+ }), Object.defineProperty(e, "_debugTask", {
135
+ configurable: !1,
136
+ enumerable: !1,
137
+ writable: !0,
138
+ value: a
139
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
140
+ }
141
+ function f(e, n, i, o, s, u) {
142
+ var f = n.children;
143
+ if (f !== void 0) if (o) if (M(f)) {
144
+ for (o = 0; o < f.length; o++) p(f[o]);
145
+ Object.freeze && Object.freeze(f);
146
+ } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
147
+ else p(f);
148
+ if (j.call(n, "key")) {
149
+ f = t(e);
150
+ var m = Object.keys(n).filter(function(e) {
151
+ return e !== "key";
152
+ });
153
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
154
+ }
155
+ if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
156
+ else i = n;
157
+ return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), s, u);
158
+ }
159
+ function p(e) {
160
+ m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
161
+ }
162
+ function m(e) {
163
+ return typeof e == "object" && !!e && e.$$typeof === g;
164
+ }
165
+ var h = s("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
166
+ return null;
167
+ };
168
+ h = { react_stack_bottom_frame: function(e) {
169
+ return e();
170
+ } };
171
+ var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
172
+ e.Fragment = v, e.jsx = function(e, t, n) {
173
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
174
+ return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
175
+ }, e.jsxs = function(e, t, n) {
176
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
177
+ return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
178
+ };
179
+ })();
180
+ })), u = (/* @__PURE__ */ o(((e, t) => {
181
+ process.env.NODE_ENV === "production" ? t.exports = c() : t.exports = l();
182
+ })))(), d = [
183
+ {
184
+ id: 1,
185
+ title: "Dynamic Input",
186
+ desc: "Stateful input that updates as you type"
187
+ },
188
+ {
189
+ id: 2,
190
+ title: "Props Demo",
191
+ desc: "Parent -> child data passing with Header/Footer"
192
+ },
193
+ {
194
+ id: 3,
195
+ title: "Counter",
196
+ desc: "Increment, decrement, reset and custom step"
197
+ },
198
+ {
199
+ id: 4,
200
+ title: "To-Do List",
201
+ desc: "Add, delete, and complete tasks"
202
+ },
203
+ {
204
+ id: 5,
205
+ title: "Figure Gallery",
206
+ desc: "Add/remove images with captions"
207
+ },
208
+ {
209
+ id: 6,
210
+ title: "Form Validation",
211
+ desc: "Name, email, password with validation"
212
+ },
213
+ {
214
+ id: 7,
215
+ title: "Profile Card",
216
+ desc: "Profile UI demonstrating CSS + inline styles"
217
+ },
218
+ {
219
+ id: 8,
220
+ title: "Reminder App",
221
+ desc: "Tasks with due dates and filters"
222
+ },
223
+ {
224
+ id: 9,
225
+ title: "Routing Example",
226
+ desc: "Home/About/Contact using react-router"
227
+ },
228
+ {
229
+ id: 10,
230
+ title: "API Fetcher",
231
+ desc: "Class component using lifecycle methods"
232
+ }
233
+ ];
234
+ function f() {
235
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [
236
+ /* @__PURE__ */ (0, u.jsx)("h1", { children: "React Programs Collection" }),
237
+ /* @__PURE__ */ (0, u.jsx)("p", {
238
+ className: "lead",
239
+ children: "Click any card to open the program."
240
+ }),
241
+ /* @__PURE__ */ (0, u.jsx)("div", {
242
+ className: "cards-grid",
243
+ children: d.map((t) => /* @__PURE__ */ (0, u.jsx)(e, {
244
+ to: `/program-${t.id}`,
245
+ className: "program-card",
246
+ children: /* @__PURE__ */ (0, u.jsxs)("div", {
247
+ className: "card-inner",
248
+ children: [
249
+ /* @__PURE__ */ (0, u.jsx)("div", {
250
+ className: "card-icon",
251
+ children: t.id
252
+ }),
253
+ /* @__PURE__ */ (0, u.jsx)("h3", { children: t.title }),
254
+ /* @__PURE__ */ (0, u.jsx)("p", { children: t.desc })
255
+ ]
256
+ })
257
+ }, t.id))
258
+ })
259
+ ] });
260
+ }
261
+ //#endregion
262
+ //#region src/program-1/Program1.jsx
263
+ function p() {
264
+ let [e, t] = a("");
265
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
266
+ className: "program-page",
267
+ children: [/* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 1 — Dynamic Input" }), /* @__PURE__ */ (0, u.jsxs)("div", {
268
+ className: "controls",
269
+ children: [/* @__PURE__ */ (0, u.jsx)("input", {
270
+ placeholder: "Type something...",
271
+ value: e,
272
+ onChange: (e) => t(e.target.value),
273
+ style: {
274
+ padding: 10,
275
+ width: "100%",
276
+ maxWidth: 520,
277
+ borderRadius: 8,
278
+ border: "1px solid #e4eefb"
279
+ }
280
+ }), /* @__PURE__ */ (0, u.jsxs)("p", {
281
+ style: { marginTop: 12 },
282
+ children: ["You typed: ", /* @__PURE__ */ (0, u.jsx)("strong", { children: e || /* @__PURE__ */ (0, u.jsx)("em", { children: "nothing yet" }) })]
283
+ })]
284
+ })]
285
+ });
286
+ }
287
+ //#endregion
288
+ //#region src/program-2/Header.jsx
289
+ function m({ title: e }) {
290
+ return /* @__PURE__ */ (0, u.jsx)("header", { children: /* @__PURE__ */ (0, u.jsx)("h2", { children: e }) });
291
+ }
292
+ //#endregion
293
+ //#region src/program-2/Footer.jsx
294
+ function h({ tagline: e, copyright: t }) {
295
+ return /* @__PURE__ */ (0, u.jsxs)("footer", {
296
+ style: { marginTop: 12 },
297
+ children: [/* @__PURE__ */ (0, u.jsx)("small", { children: e }), /* @__PURE__ */ (0, u.jsx)("div", {
298
+ style: { color: "#666" },
299
+ children: t
300
+ })]
301
+ });
302
+ }
303
+ //#endregion
304
+ //#region src/program-2/Program2.jsx
305
+ function g() {
306
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
307
+ className: "program-page",
308
+ children: [
309
+ /* @__PURE__ */ (0, u.jsx)(m, { title: "My Props Demo App" }),
310
+ /* @__PURE__ */ (0, u.jsx)("main", { children: /* @__PURE__ */ (0, u.jsx)("p", { children: "This app shows how props pass data from parent to children." }) }),
311
+ /* @__PURE__ */ (0, u.jsx)(h, {
312
+ tagline: "Passing data via props is simple and powerful.",
313
+ copyright: "© 2026 Example Corp."
314
+ })
315
+ ]
316
+ });
317
+ }
318
+ //#endregion
319
+ //#region src/program-3/Program3.jsx
320
+ function _() {
321
+ let [e, t] = a(0), [n, r] = a(1);
322
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
323
+ className: "program-page",
324
+ children: [
325
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 3 — Counter" }),
326
+ /* @__PURE__ */ (0, u.jsx)("div", {
327
+ style: {
328
+ fontSize: 48,
329
+ margin: "12px 0",
330
+ fontWeight: 700
331
+ },
332
+ children: e
333
+ }),
334
+ /* @__PURE__ */ (0, u.jsxs)("div", {
335
+ style: {
336
+ display: "flex",
337
+ gap: 8
338
+ },
339
+ children: [
340
+ /* @__PURE__ */ (0, u.jsx)("button", {
341
+ onClick: () => t((e) => Math.max(0, e - Number(n))),
342
+ className: "btn",
343
+ children: "-"
344
+ }),
345
+ /* @__PURE__ */ (0, u.jsx)("button", {
346
+ onClick: () => t((e) => e + Number(n)),
347
+ className: "btn",
348
+ children: "+"
349
+ }),
350
+ /* @__PURE__ */ (0, u.jsx)("button", {
351
+ onClick: () => t(0),
352
+ className: "btn",
353
+ children: "Reset"
354
+ })
355
+ ]
356
+ }),
357
+ /* @__PURE__ */ (0, u.jsx)("div", {
358
+ style: { marginTop: 12 },
359
+ children: /* @__PURE__ */ (0, u.jsxs)("label", { children: [
360
+ "Step:",
361
+ " ",
362
+ /* @__PURE__ */ (0, u.jsx)("input", {
363
+ type: "number",
364
+ value: n,
365
+ min: "1",
366
+ onChange: (e) => r(e.target.value),
367
+ style: { width: 80 }
368
+ })
369
+ ] })
370
+ })
371
+ ]
372
+ });
373
+ }
374
+ //#endregion
375
+ //#region src/program-4/ToDoFunction.jsx
376
+ function v() {
377
+ let [e, t] = a([]), [n, r] = a(""), i = () => {
378
+ let e = n.trim();
379
+ e && (t((t) => [...t, {
380
+ id: Date.now(),
381
+ text: e,
382
+ done: !1
383
+ }]), r(""));
384
+ }, o = (e) => t((t) => t.map((t) => t.id === e ? {
385
+ ...t,
386
+ done: !t.done
387
+ } : t)), s = (e) => t((t) => t.filter((t) => t.id !== e));
388
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [
389
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 4 — To-Do List" }),
390
+ /* @__PURE__ */ (0, u.jsxs)("div", {
391
+ style: {
392
+ display: "flex",
393
+ gap: 8
394
+ },
395
+ children: [/* @__PURE__ */ (0, u.jsx)("input", {
396
+ value: n,
397
+ onChange: (e) => r(e.target.value),
398
+ placeholder: "New task"
399
+ }), /* @__PURE__ */ (0, u.jsx)("button", {
400
+ onClick: i,
401
+ children: "Add"
402
+ })]
403
+ }),
404
+ /* @__PURE__ */ (0, u.jsx)("ul", {
405
+ style: { marginTop: 12 },
406
+ children: e.map((e) => /* @__PURE__ */ (0, u.jsxs)("li", {
407
+ style: {
408
+ display: "flex",
409
+ gap: 8,
410
+ alignItems: "center"
411
+ },
412
+ children: [
413
+ /* @__PURE__ */ (0, u.jsx)("input", {
414
+ type: "checkbox",
415
+ checked: e.done,
416
+ onChange: () => o(e.id)
417
+ }),
418
+ /* @__PURE__ */ (0, u.jsx)("span", {
419
+ style: { textDecoration: e.done ? "line-through" : "none" },
420
+ children: e.text
421
+ }),
422
+ /* @__PURE__ */ (0, u.jsx)("button", {
423
+ onClick: () => s(e.id),
424
+ style: { marginLeft: "auto" },
425
+ children: "Delete"
426
+ })
427
+ ]
428
+ }, e.id))
429
+ })
430
+ ] });
431
+ }
432
+ //#endregion
433
+ //#region src/program-4/Program4.jsx
434
+ function y() {
435
+ return /* @__PURE__ */ (0, u.jsx)("div", {
436
+ className: "program-page",
437
+ children: /* @__PURE__ */ (0, u.jsx)(v, {})
438
+ });
439
+ }
440
+ //#endregion
441
+ //#region src/program-5/BasicFigure.jsx
442
+ function b({ src: e, caption: t, onRemove: n }) {
443
+ return /* @__PURE__ */ (0, u.jsxs)("figure", {
444
+ style: {
445
+ border: "1px solid #ddd",
446
+ padding: 8,
447
+ borderRadius: 6
448
+ },
449
+ children: [
450
+ /* @__PURE__ */ (0, u.jsx)("img", {
451
+ src: e,
452
+ alt: t,
453
+ style: {
454
+ maxWidth: 200,
455
+ display: "block",
456
+ marginBottom: 6
457
+ }
458
+ }),
459
+ /* @__PURE__ */ (0, u.jsx)("figcaption", { children: t }),
460
+ n && /* @__PURE__ */ (0, u.jsx)("button", {
461
+ onClick: n,
462
+ style: { marginTop: 6 },
463
+ children: "Remove"
464
+ })
465
+ ]
466
+ });
467
+ }
468
+ //#endregion
469
+ //#region src/program-5/FigureList.jsx
470
+ var x = [{
471
+ id: 1,
472
+ src: "https://via.placeholder.com/200",
473
+ caption: "Placeholder 1"
474
+ }, {
475
+ id: 2,
476
+ src: "https://via.placeholder.com/200?text=2",
477
+ caption: "Placeholder 2"
478
+ }];
479
+ function S() {
480
+ let [e, t] = a(x), [n, r] = a(""), [i, o] = a(""), s = () => {
481
+ n.trim() && (t((e) => [...e, {
482
+ id: Date.now(),
483
+ src: n.trim(),
484
+ caption: i.trim()
485
+ }]), r(""), o(""));
486
+ }, c = (e) => t((t) => t.filter((t) => t.id !== e));
487
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [
488
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Figures" }),
489
+ /* @__PURE__ */ (0, u.jsxs)("div", {
490
+ style: {
491
+ display: "flex",
492
+ gap: 8,
493
+ marginBottom: 8
494
+ },
495
+ children: [
496
+ /* @__PURE__ */ (0, u.jsx)("input", {
497
+ placeholder: "Image URL",
498
+ value: n,
499
+ onChange: (e) => r(e.target.value)
500
+ }),
501
+ /* @__PURE__ */ (0, u.jsx)("input", {
502
+ placeholder: "Caption",
503
+ value: i,
504
+ onChange: (e) => o(e.target.value)
505
+ }),
506
+ /* @__PURE__ */ (0, u.jsx)("button", {
507
+ onClick: s,
508
+ children: "Add"
509
+ })
510
+ ]
511
+ }),
512
+ /* @__PURE__ */ (0, u.jsx)("div", {
513
+ style: {
514
+ display: "grid",
515
+ gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
516
+ gap: 12
517
+ },
518
+ children: e.map((e) => /* @__PURE__ */ (0, u.jsx)(b, {
519
+ src: e.src,
520
+ caption: e.caption,
521
+ onRemove: () => c(e.id)
522
+ }, e.id))
523
+ })
524
+ ] });
525
+ }
526
+ //#endregion
527
+ //#region src/program-5/Program5.jsx
528
+ function C() {
529
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
530
+ className: "program-page",
531
+ children: [/* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 5 — Figure Gallery" }), /* @__PURE__ */ (0, u.jsx)(S, {})]
532
+ });
533
+ }
534
+ //#endregion
535
+ //#region src/program-6/Program6.jsx
536
+ var w = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
537
+ function T() {
538
+ let [e, t] = a(""), [n, r] = a(""), [i, o] = a(""), [s, c] = a(!1), [l, d] = a({}), f = (e) => e.replace(/[<>]/g, "");
539
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
540
+ className: "program-page",
541
+ children: [/* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 6 — Form Validation" }), /* @__PURE__ */ (0, u.jsxs)("form", {
542
+ onSubmit: (t) => {
543
+ t.preventDefault();
544
+ let r = {};
545
+ if (e.trim() || (r.name = "Name required"), w.test(n) || (r.email = "Invalid email"), i.length < 6 && (r.password = "Password too short"), d(r), Object.keys(r).length === 0) {
546
+ let t = {
547
+ name: f(e),
548
+ email: f(n),
549
+ password: "***"
550
+ };
551
+ alert("Submitted: " + JSON.stringify(t));
552
+ }
553
+ },
554
+ noValidate: !0,
555
+ children: [
556
+ /* @__PURE__ */ (0, u.jsxs)("div", { children: [
557
+ /* @__PURE__ */ (0, u.jsx)("label", { children: "Name" }),
558
+ /* @__PURE__ */ (0, u.jsx)("input", {
559
+ value: e,
560
+ onChange: (e) => t(e.target.value),
561
+ style: { borderColor: l.name ? "red" : void 0 }
562
+ }),
563
+ /* @__PURE__ */ (0, u.jsx)("div", {
564
+ style: { color: "red" },
565
+ children: l.name
566
+ })
567
+ ] }),
568
+ /* @__PURE__ */ (0, u.jsxs)("div", { children: [
569
+ /* @__PURE__ */ (0, u.jsx)("label", { children: "Email" }),
570
+ /* @__PURE__ */ (0, u.jsx)("input", {
571
+ value: n,
572
+ onChange: (e) => r(e.target.value),
573
+ style: { borderColor: l.email ? "red" : void 0 }
574
+ }),
575
+ /* @__PURE__ */ (0, u.jsx)("div", {
576
+ style: { color: "red" },
577
+ children: l.email
578
+ })
579
+ ] }),
580
+ /* @__PURE__ */ (0, u.jsxs)("div", { children: [
581
+ /* @__PURE__ */ (0, u.jsx)("label", { children: "Password" }),
582
+ /* @__PURE__ */ (0, u.jsx)("input", {
583
+ type: s ? "text" : "password",
584
+ value: i,
585
+ onChange: (e) => o(e.target.value),
586
+ style: { borderColor: l.password ? "red" : void 0 }
587
+ }),
588
+ /* @__PURE__ */ (0, u.jsx)("div", {
589
+ style: { color: "red" },
590
+ children: l.password
591
+ })
592
+ ] }),
593
+ /* @__PURE__ */ (0, u.jsxs)("label", { children: [/* @__PURE__ */ (0, u.jsx)("input", {
594
+ type: "checkbox",
595
+ checked: s,
596
+ onChange: (e) => c(e.target.checked)
597
+ }), " Show Password"] }),
598
+ /* @__PURE__ */ (0, u.jsx)("div", { children: /* @__PURE__ */ (0, u.jsx)("button", {
599
+ type: "submit",
600
+ children: "Submit"
601
+ }) })
602
+ ]
603
+ })]
604
+ });
605
+ }
606
+ //#endregion
607
+ //#region src/program-7/ProfileCard.jsx
608
+ function E({ name: e, bio: t, img: n, bg: r }) {
609
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
610
+ className: "profile-card",
611
+ style: { background: r || "#fff" },
612
+ children: [
613
+ /* @__PURE__ */ (0, u.jsx)("img", {
614
+ src: n,
615
+ alt: e
616
+ }),
617
+ /* @__PURE__ */ (0, u.jsx)("h3", { children: e }),
618
+ /* @__PURE__ */ (0, u.jsx)("p", { children: t })
619
+ ]
620
+ });
621
+ }
622
+ //#endregion
623
+ //#region src/program-7/Program7.jsx
624
+ function D() {
625
+ let [e, t] = a("#ffffff");
626
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
627
+ className: "program-page",
628
+ children: [
629
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 7 — Profile Card" }),
630
+ /* @__PURE__ */ (0, u.jsx)("div", {
631
+ className: "controls",
632
+ children: /* @__PURE__ */ (0, u.jsxs)("label", { children: ["Card background: ", /* @__PURE__ */ (0, u.jsx)("input", {
633
+ value: e,
634
+ onChange: (e) => t(e.target.value)
635
+ })] })
636
+ }),
637
+ /* @__PURE__ */ (0, u.jsx)("div", {
638
+ style: { marginTop: 12 },
639
+ children: /* @__PURE__ */ (0, u.jsx)(E, {
640
+ name: "Jane Doe",
641
+ bio: "Frontend engineer and React enthusiast.",
642
+ img: "https://via.placeholder.com/150",
643
+ bg: e
644
+ })
645
+ })
646
+ ]
647
+ });
648
+ }
649
+ //#endregion
650
+ //#region src/program-8/Program8.jsx
651
+ function O() {
652
+ let [e, t] = a([]), [n, r] = a(""), [i, o] = a(""), [s, c] = a(""), [l, d] = a("all"), f = () => {
653
+ n.trim() && (t((e) => [...e, {
654
+ id: Date.now(),
655
+ name: n.trim(),
656
+ date: i,
657
+ desc: s,
658
+ done: !1
659
+ }]), r(""), o(""), c(""));
660
+ }, p = (e) => t((t) => t.map((t) => t.id === e ? {
661
+ ...t,
662
+ done: !t.done
663
+ } : t)), m = e.filter((e) => l === "all" ? !0 : l === "done" ? e.done : !e.done);
664
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
665
+ className: "program-page",
666
+ children: [
667
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 8 — Reminder App" }),
668
+ /* @__PURE__ */ (0, u.jsxs)("div", { children: [
669
+ /* @__PURE__ */ (0, u.jsx)("input", {
670
+ placeholder: "Task",
671
+ value: n,
672
+ onChange: (e) => r(e.target.value)
673
+ }),
674
+ /* @__PURE__ */ (0, u.jsx)("input", {
675
+ type: "date",
676
+ value: i,
677
+ onChange: (e) => o(e.target.value)
678
+ }),
679
+ /* @__PURE__ */ (0, u.jsx)("input", {
680
+ placeholder: "Description (optional)",
681
+ value: s,
682
+ onChange: (e) => c(e.target.value)
683
+ }),
684
+ /* @__PURE__ */ (0, u.jsx)("button", {
685
+ onClick: f,
686
+ children: "Add"
687
+ })
688
+ ] }),
689
+ /* @__PURE__ */ (0, u.jsxs)("div", {
690
+ style: { marginTop: 8 },
691
+ children: [
692
+ /* @__PURE__ */ (0, u.jsxs)("label", { children: [/* @__PURE__ */ (0, u.jsx)("input", {
693
+ type: "radio",
694
+ name: "f",
695
+ checked: l === "all",
696
+ onChange: () => d("all")
697
+ }), " All"] }),
698
+ /* @__PURE__ */ (0, u.jsxs)("label", { children: [/* @__PURE__ */ (0, u.jsx)("input", {
699
+ type: "radio",
700
+ name: "f",
701
+ checked: l === "done",
702
+ onChange: () => d("done")
703
+ }), " Completed"] }),
704
+ /* @__PURE__ */ (0, u.jsxs)("label", { children: [/* @__PURE__ */ (0, u.jsx)("input", {
705
+ type: "radio",
706
+ name: "f",
707
+ checked: l === "pending",
708
+ onChange: () => d("pending")
709
+ }), " Pending"] })
710
+ ]
711
+ }),
712
+ /* @__PURE__ */ (0, u.jsx)("ul", {
713
+ style: { marginTop: 12 },
714
+ children: m.map((e) => /* @__PURE__ */ (0, u.jsxs)("li", {
715
+ style: {
716
+ display: "flex",
717
+ gap: 8,
718
+ alignItems: "center"
719
+ },
720
+ children: [/* @__PURE__ */ (0, u.jsx)("input", {
721
+ type: "checkbox",
722
+ checked: e.done,
723
+ onChange: () => p(e.id)
724
+ }), /* @__PURE__ */ (0, u.jsxs)("div", { children: [/* @__PURE__ */ (0, u.jsxs)("div", {
725
+ style: { fontWeight: 600 },
726
+ children: [
727
+ e.name,
728
+ " ",
729
+ /* @__PURE__ */ (0, u.jsx)("small", {
730
+ style: { color: "#666" },
731
+ children: e.date
732
+ })
733
+ ]
734
+ }), /* @__PURE__ */ (0, u.jsx)("div", {
735
+ style: { color: "#444" },
736
+ children: e.desc
737
+ })] })]
738
+ }, e.id))
739
+ })
740
+ ]
741
+ });
742
+ }
743
+ //#endregion
744
+ //#region src/program-9/Program9.jsx
745
+ function k() {
746
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [/* @__PURE__ */ (0, u.jsx)("h3", { children: "Home" }), /* @__PURE__ */ (0, u.jsx)("p", { children: "Welcome to the Home page." })] });
747
+ }
748
+ function A() {
749
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [/* @__PURE__ */ (0, u.jsx)("h3", { children: "About" }), /* @__PURE__ */ (0, u.jsx)("p", { children: "About page content." })] });
750
+ }
751
+ function j() {
752
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [/* @__PURE__ */ (0, u.jsx)("h3", { children: "Contact" }), /* @__PURE__ */ (0, u.jsx)("p", { children: "Contact details here." })] });
753
+ }
754
+ function M() {
755
+ return /* @__PURE__ */ (0, u.jsxs)("div", {
756
+ className: "program-page",
757
+ children: [
758
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 9 — Routing Example" }),
759
+ /* @__PURE__ */ (0, u.jsxs)("nav", {
760
+ style: {
761
+ display: "flex",
762
+ gap: 8,
763
+ marginBottom: 8
764
+ },
765
+ children: [
766
+ /* @__PURE__ */ (0, u.jsx)(t, {
767
+ to: "/program-9/",
768
+ end: !0,
769
+ children: "Home"
770
+ }),
771
+ /* @__PURE__ */ (0, u.jsx)(t, {
772
+ to: "/program-9/about",
773
+ children: "About"
774
+ }),
775
+ /* @__PURE__ */ (0, u.jsx)(t, {
776
+ to: "/program-9/contact",
777
+ children: "Contact"
778
+ })
779
+ ]
780
+ }),
781
+ /* @__PURE__ */ (0, u.jsx)("div", {
782
+ style: { background: "#fff" },
783
+ children: /* @__PURE__ */ (0, u.jsxs)(r, { children: [
784
+ /* @__PURE__ */ (0, u.jsx)(n, {
785
+ path: "/",
786
+ element: /* @__PURE__ */ (0, u.jsx)(k, {})
787
+ }),
788
+ /* @__PURE__ */ (0, u.jsx)(n, {
789
+ path: "about",
790
+ element: /* @__PURE__ */ (0, u.jsx)(A, {})
791
+ }),
792
+ /* @__PURE__ */ (0, u.jsx)(n, {
793
+ path: "contact",
794
+ element: /* @__PURE__ */ (0, u.jsx)(j, {})
795
+ })
796
+ ] })
797
+ })
798
+ ]
799
+ });
800
+ }
801
+ //#endregion
802
+ //#region src/program-10/Program10.jsx
803
+ var N = class extends i.Component {
804
+ constructor(e) {
805
+ super(e), this.state = {
806
+ items: [],
807
+ loading: !1,
808
+ error: null,
809
+ query: ""
810
+ };
811
+ }
812
+ componentDidMount() {
813
+ this.fetchData();
814
+ }
815
+ componentDidUpdate(e, t) {
816
+ t.query !== this.state.query && this.fetchData();
817
+ }
818
+ fetchData() {
819
+ this.setState({
820
+ loading: !0,
821
+ error: null
822
+ });
823
+ let e = this.state.query || "";
824
+ fetch(`https://jsonplaceholder.typicode.com/posts${e ? "?_limit=5" : "?_limit=10"}`).then((e) => e.json()).then((e) => this.setState({
825
+ items: e,
826
+ loading: !1
827
+ })).catch((e) => this.setState({
828
+ error: e.message,
829
+ loading: !1
830
+ }));
831
+ }
832
+ render() {
833
+ let { items: e, loading: t, error: n } = this.state;
834
+ return /* @__PURE__ */ (0, u.jsxs)("div", { children: [
835
+ /* @__PURE__ */ (0, u.jsx)("h2", { children: "Program 10 — Class Component & API" }),
836
+ /* @__PURE__ */ (0, u.jsxs)("div", {
837
+ style: { marginBottom: 8 },
838
+ children: [/* @__PURE__ */ (0, u.jsxs)("label", { children: ["Query (not used for API but triggers update): ", /* @__PURE__ */ (0, u.jsx)("input", { onChange: (e) => this.setState({ query: e.target.value }) })] }), /* @__PURE__ */ (0, u.jsx)("button", {
839
+ onClick: () => this.fetchData(),
840
+ children: "Refresh"
841
+ })]
842
+ }),
843
+ t && /* @__PURE__ */ (0, u.jsx)("div", { children: "Loading..." }),
844
+ n && /* @__PURE__ */ (0, u.jsx)("div", {
845
+ style: { color: "red" },
846
+ children: n
847
+ }),
848
+ /* @__PURE__ */ (0, u.jsx)("ul", { children: e.map((e) => /* @__PURE__ */ (0, u.jsxs)("li", { children: [/* @__PURE__ */ (0, u.jsx)("strong", { children: e.title }), /* @__PURE__ */ (0, u.jsx)("div", { children: e.body })] }, e.id)) })
849
+ ] });
850
+ }
851
+ };
852
+ function P() {
853
+ return /* @__PURE__ */ (0, u.jsx)("div", {
854
+ className: "program-page",
855
+ children: /* @__PURE__ */ (0, u.jsx)(N, {})
856
+ });
857
+ }
858
+ //#endregion
859
+ export { f as Home, p as Program1, P as Program10, g as Program2, _ as Program3, y as Program4, C as Program5, T as Program6, D as Program7, O as Program8, M as Program9 };