@leadertechie/personal-site-kit 0.1.0-alpha.7 → 0.1.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/api/content-utils.d.ts +27 -0
  2. package/dist/api/content-utils.d.ts.map +1 -0
  3. package/dist/api/handlers/about-me.d.ts.map +1 -1
  4. package/dist/api/handlers/content-api.d.ts +0 -1
  5. package/dist/api/handlers/content-api.d.ts.map +1 -1
  6. package/dist/api/website-api.d.ts.map +1 -1
  7. package/dist/api.js +2 -2
  8. package/dist/chunks/index-CGvOrVf8.js +213 -0
  9. package/dist/chunks/{index-Bq8WDk9L.js → index-CnSEOZse.js} +1285 -477
  10. package/dist/chunks/{template-Boh_MKY5.js → template-DWcsZW22.js} +8 -7
  11. package/dist/chunks/{website-api-XoeLwo_N.js → website-api-BEYGOsT3.js} +137 -156
  12. package/dist/index.js +19 -9
  13. package/dist/prerender/data-fetcher.d.ts +19 -0
  14. package/dist/prerender/data-fetcher.d.ts.map +1 -0
  15. package/dist/prerender/page-content.d.ts.map +1 -1
  16. package/dist/prerender/page-generators/about.d.ts +16 -0
  17. package/dist/prerender/page-generators/about.d.ts.map +1 -0
  18. package/dist/prerender/page-generators/base.d.ts +26 -0
  19. package/dist/prerender/page-generators/base.d.ts.map +1 -0
  20. package/dist/prerender/page-generators/blog-detail.d.ts +15 -0
  21. package/dist/prerender/page-generators/blog-detail.d.ts.map +1 -0
  22. package/dist/prerender/page-generators/blogs-list.d.ts +17 -0
  23. package/dist/prerender/page-generators/blogs-list.d.ts.map +1 -0
  24. package/dist/prerender/page-generators/home.d.ts +19 -0
  25. package/dist/prerender/page-generators/home.d.ts.map +1 -0
  26. package/dist/prerender/page-generators/index.d.ts +9 -0
  27. package/dist/prerender/page-generators/index.d.ts.map +1 -0
  28. package/dist/prerender/page-generators/not-found.d.ts +14 -0
  29. package/dist/prerender/page-generators/not-found.d.ts.map +1 -0
  30. package/dist/prerender/page-generators/stories-list.d.ts +17 -0
  31. package/dist/prerender/page-generators/stories-list.d.ts.map +1 -0
  32. package/dist/prerender/page-generators/story-detail.d.ts +15 -0
  33. package/dist/prerender/page-generators/story-detail.d.ts.map +1 -0
  34. package/dist/prerender.js +109 -102
  35. package/dist/shared.js +1 -1
  36. package/dist/ui/about-me/index.d.ts +2 -10
  37. package/dist/ui/about-me/index.d.ts.map +1 -1
  38. package/dist/ui/admin/api.d.ts +16 -0
  39. package/dist/ui/admin/api.d.ts.map +1 -0
  40. package/dist/ui/admin/components/AboutMeSection.d.ts +7 -0
  41. package/dist/ui/admin/components/AboutMeSection.d.ts.map +1 -0
  42. package/dist/ui/admin/components/AdminSection.d.ts +13 -0
  43. package/dist/ui/admin/components/AdminSection.d.ts.map +1 -0
  44. package/dist/ui/admin/components/BlogsSection.d.ts +7 -0
  45. package/dist/ui/admin/components/BlogsSection.d.ts.map +1 -0
  46. package/dist/ui/admin/components/HomeSection.d.ts +7 -0
  47. package/dist/ui/admin/components/HomeSection.d.ts.map +1 -0
  48. package/dist/ui/admin/components/ImagesSection.d.ts +7 -0
  49. package/dist/ui/admin/components/ImagesSection.d.ts.map +1 -0
  50. package/dist/ui/admin/components/LoginForm.d.ts +9 -0
  51. package/dist/ui/admin/components/LoginForm.d.ts.map +1 -0
  52. package/dist/ui/admin/components/LogoSection.d.ts +7 -0
  53. package/dist/ui/admin/components/LogoSection.d.ts.map +1 -0
  54. package/dist/ui/admin/components/ProfileSection.d.ts +7 -0
  55. package/dist/ui/admin/components/ProfileSection.d.ts.map +1 -0
  56. package/dist/ui/admin/components/StaticSection.d.ts +13 -0
  57. package/dist/ui/admin/components/StaticSection.d.ts.map +1 -0
  58. package/dist/ui/admin/components/StoriesSection.d.ts +7 -0
  59. package/dist/ui/admin/components/StoriesSection.d.ts.map +1 -0
  60. package/dist/ui/admin/components/index.d.ts +11 -0
  61. package/dist/ui/admin/components/index.d.ts.map +1 -0
  62. package/dist/ui/admin/index.d.ts +18 -26
  63. package/dist/ui/admin/index.d.ts.map +1 -1
  64. package/dist/ui/admin/types.d.ts +24 -0
  65. package/dist/ui/admin/types.d.ts.map +1 -0
  66. package/dist/ui/blog-viewer/index.d.ts.map +1 -1
  67. package/dist/ui/index.d.ts.map +1 -1
  68. package/dist/ui/story-viewer/index.d.ts.map +1 -1
  69. package/dist/ui.js +14 -4
  70. package/package.json +4 -4
  71. package/dist/ui/about-me/renderer.d.ts +0 -6
  72. package/dist/ui/about-me/renderer.d.ts.map +0 -1
  73. package/src/api/__tests__/info.test.ts +0 -44
  74. package/src/api/__tests__/utils.test.ts +0 -78
  75. package/src/api/handlers/about-me.ts +0 -99
  76. package/src/api/handlers/auth-handler.ts +0 -194
  77. package/src/api/handlers/auth.ts +0 -157
  78. package/src/api/handlers/content-api.ts +0 -268
  79. package/src/api/handlers/content.ts +0 -139
  80. package/src/api/handlers/home.ts +0 -79
  81. package/src/api/handlers/info.ts +0 -12
  82. package/src/api/handlers/logo.ts +0 -55
  83. package/src/api/handlers/static-details.ts +0 -48
  84. package/src/api/index.ts +0 -9
  85. package/src/api/utils.ts +0 -16
  86. package/src/api/website-api.ts +0 -138
  87. package/src/index.ts +0 -4
  88. package/src/prerender/__tests__/page-content.test.ts +0 -54
  89. package/src/prerender/__tests__/template.test.ts +0 -54
  90. package/src/prerender/index.ts +0 -7
  91. package/src/prerender/page-content.ts +0 -263
  92. package/src/prerender/prerender.ts +0 -25
  93. package/src/prerender/template.ts +0 -65
  94. package/src/prerender/website-prerender.ts +0 -152
  95. package/src/shared/config/api.ts +0 -16
  96. package/src/shared/config/index.ts +0 -43
  97. package/src/shared/config/types.ts +0 -16
  98. package/src/shared/core/__tests__/theme-toggle.test.ts +0 -204
  99. package/src/shared/core/site-store.ts +0 -38
  100. package/src/shared/core/theme-toggle.ts +0 -118
  101. package/src/shared/index.ts +0 -17
  102. package/src/shared/interfaces/ifooter-link.ts +0 -4
  103. package/src/shared/interfaces/iroute.ts +0 -4
  104. package/src/shared/models/theme-variables.css +0 -25
  105. package/src/shared/page-content.ts +0 -210
  106. package/src/shared/router.ts +0 -250
  107. package/src/shared/runtime.ts +0 -11
  108. package/src/shared/template.ts +0 -35
  109. package/src/shared/website-ui.ts +0 -92
  110. package/src/styles/markdown.css +0 -129
  111. package/src/ui/about-me/api.ts +0 -12
  112. package/src/ui/about-me/index.ts +0 -164
  113. package/src/ui/about-me/renderer.ts +0 -23
  114. package/src/ui/about-me/styles.ts +0 -85
  115. package/src/ui/admin/index.ts +0 -655
  116. package/src/ui/admin/styles.ts +0 -270
  117. package/src/ui/banner/index.ts +0 -38
  118. package/src/ui/banner/styles.ts +0 -95
  119. package/src/ui/blog-viewer/__tests__/blogviewer.test.ts +0 -7
  120. package/src/ui/blog-viewer/index.ts +0 -124
  121. package/src/ui/blog-viewer/styles.ts +0 -23
  122. package/src/ui/footer/index.ts +0 -37
  123. package/src/ui/footer/styles.ts +0 -50
  124. package/src/ui/index.ts +0 -6
  125. package/src/ui/story-viewer/__tests__/storyviewer.test.ts +0 -7
  126. package/src/ui/story-viewer/index.ts +0 -120
  127. package/src/ui/story-viewer/styles.ts +0 -54
  128. /package/{src/shared → dist}/styles/markdown.css +0 -0
  129. /package/{src → dist}/styles/theme.css +0 -0
@@ -84,91 +84,69 @@ const aboutmeStyles = css`
84
84
  font-family: Arial, sans-serif;
85
85
  }
86
86
  `;
87
- class AboutMeRenderer {
88
- renderContent(nodes) {
89
- return (nodes || []).map((node) => {
90
- switch (node.type) {
91
- case "heading":
92
- const level = node.level || 2;
93
- if (level === 1) return html`<h1>${node.content}</h1>`;
94
- if (level === 3) return html`<h3>${node.content}</h3>`;
95
- return html`<h2>${node.content}</h2>`;
96
- case "paragraph":
97
- return html`<p>${node.content}</p>`;
98
- case "list":
99
- const items = node.items || [];
100
- return html`<ul>${items.map((item) => html`<li>${item}</li>`)}</ul>`;
101
- default:
102
- return html`<div>${node.content}</div>`;
103
- }
104
- });
105
- }
106
- }
107
87
  async function fetchAboutMe(url) {
108
88
  const res = await fetch(`${url}/api/aboutme`);
109
89
  if (!res.ok) throw new Error("Failed to fetch");
110
90
  return res.json();
111
91
  }
112
- var __create$5 = Object.create;
113
- var __defProp$5 = Object.defineProperty;
114
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
115
- var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
116
- var __typeError$5 = (msg) => {
92
+ var __create$f = Object.create;
93
+ var __defProp$f = Object.defineProperty;
94
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
95
+ var __knownSymbol$f = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
96
+ var __typeError$f = (msg) => {
117
97
  throw TypeError(msg);
118
98
  };
119
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
120
- var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
121
- var __decoratorStart$5 = (base) => [, , , __create$5(base?.[__knownSymbol$5("metadata")] ?? null)];
122
- var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
123
- var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
124
- var __decoratorContext$5 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$5[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$5("Already initialized") : fns.push(__expectFn$5(fn || null)) });
125
- var __decoratorMetadata$5 = (array, target) => __defNormalProp$5(target, __knownSymbol$5("metadata"), array[3]);
126
- var __runInitializers$5 = (array, flags, self, value) => {
99
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
100
+ var __name$e = (target, value) => __defProp$f(target, "name", { value, configurable: true });
101
+ var __decoratorStart$f = (base) => [, , , __create$f(base?.[__knownSymbol$f("metadata")] ?? null)];
102
+ var __decoratorStrings$f = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
103
+ var __expectFn$f = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$f("Function expected") : fn;
104
+ var __decoratorContext$f = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$f[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$f("Already initialized") : fns.push(__expectFn$f(fn || null)) });
105
+ var __decoratorMetadata$f = (array, target) => __defNormalProp$f(target, __knownSymbol$f("metadata"), array[3]);
106
+ var __runInitializers$f = (array, flags, self, value) => {
127
107
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
128
108
  return value;
129
109
  };
130
- var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
110
+ var __decorateElement$f = (array, flags, name, decorators, target, extra) => {
131
111
  var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
132
- var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$5[k2 + 5];
112
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$f[k2 + 5];
133
113
  var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
134
- var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$5(k2 < 4 ? target : { get [name]() {
135
- return __privateGet$4(this, extra);
114
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$f(k2 < 4 ? target : { get [name]() {
115
+ return __privateGet$7(this, extra);
136
116
  }, set [name](x) {
137
- return __privateSet$4(this, extra, x);
117
+ return __privateSet$7(this, extra, x);
138
118
  } }, name));
139
- k2 ? p2 && k2 < 4 && __name$5(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$5(target, name);
119
+ k2 ? p2 && k2 < 4 && __name$e(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$e(target, name);
140
120
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
141
- ctx = __decoratorContext$5(k2, name, done = {}, array[3], extraInitializers);
121
+ ctx = __decoratorContext$f(k2, name, done = {}, array[3], extraInitializers);
142
122
  if (k2) {
143
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$4(target, x) : (x) => name in x };
144
- if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$4 : __privateMethod$4)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
145
- if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
123
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$6(target, x) : (x) => name in x };
124
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$7 : __privateMethod$6)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
125
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$7(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
146
126
  }
147
127
  it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
148
- if (k2 ^ 4 || it === void 0) __expectFn$5(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
149
- else if (typeof it !== "object" || it === null) __typeError$5("Object expected");
150
- else __expectFn$5(fn = it.get) && (desc.get = fn), __expectFn$5(fn = it.set) && (desc.set = fn), __expectFn$5(fn = it.init) && initializers.unshift(fn);
128
+ if (k2 ^ 4 || it === void 0) __expectFn$f(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
129
+ else if (typeof it !== "object" || it === null) __typeError$f("Object expected");
130
+ else __expectFn$f(fn = it.get) && (desc.get = fn), __expectFn$f(fn = it.set) && (desc.set = fn), __expectFn$f(fn = it.init) && initializers.unshift(fn);
151
131
  }
152
- return k2 || __decoratorMetadata$5(array, target), desc && __defProp$5(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
132
+ return k2 || __decoratorMetadata$f(array, target), desc && __defProp$f(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
153
133
  };
154
- var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
155
- var __privateIn$4 = (member, obj) => Object(obj) !== obj ? __typeError$5('Cannot use the "in" operator on this value') : member.has(obj);
156
- var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
157
- var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
158
- var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
159
- var __privateMethod$4 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
160
- var _loading_dec$2, _contentNodes_dec, _profile_dec, _baseUrl_dec, _a$5, _MyAboutme_decorators, _init$5, _baseUrl, _profile, _contentNodes, _loading$2;
134
+ var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$f("Cannot " + msg);
135
+ var __privateIn$6 = (member, obj) => Object(obj) !== obj ? __typeError$f('Cannot use the "in" operator on this value') : member.has(obj);
136
+ var __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
137
+ var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$f("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
138
+ var __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
139
+ var __privateMethod$6 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
140
+ var _loading_dec$2, _htmlContent_dec, _profile_dec, _baseUrl_dec, _a$f, _MyAboutme_decorators, _init$f, _baseUrl, _profile, _htmlContent, _loading$2;
161
141
  _MyAboutme_decorators = [customElement("my-aboutme")];
162
- class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: String })], _profile_dec = [state()], _contentNodes_dec = [state()], _loading_dec$2 = [state()], _a$5) {
163
- constructor(renderer) {
142
+ class MyAboutme extends (_a$f = LitElement, _baseUrl_dec = [property({ type: String })], _profile_dec = [state()], _htmlContent_dec = [state()], _loading_dec$2 = [state()], _a$f) {
143
+ constructor() {
164
144
  super();
165
- __privateAdd$4(this, _baseUrl, __runInitializers$5(_init$5, 8, this, "")), __runInitializers$5(_init$5, 11, this);
166
- __privateAdd$4(this, _profile, __runInitializers$5(_init$5, 12, this, null)), __runInitializers$5(_init$5, 15, this);
167
- __privateAdd$4(this, _contentNodes, __runInitializers$5(_init$5, 16, this, [])), __runInitializers$5(_init$5, 19, this);
168
- __privateAdd$4(this, _loading$2, __runInitializers$5(_init$5, 20, this, true)), __runInitializers$5(_init$5, 23, this);
169
- this.renderer = void 0;
145
+ __privateAdd$7(this, _baseUrl, __runInitializers$f(_init$f, 8, this, "")), __runInitializers$f(_init$f, 11, this);
146
+ __privateAdd$7(this, _profile, __runInitializers$f(_init$f, 12, this, null)), __runInitializers$f(_init$f, 15, this);
147
+ __privateAdd$7(this, _htmlContent, __runInitializers$f(_init$f, 16, this, "")), __runInitializers$f(_init$f, 19, this);
148
+ __privateAdd$7(this, _loading$2, __runInitializers$f(_init$f, 20, this, true)), __runInitializers$f(_init$f, 23, this);
170
149
  this.fetcher = fetchAboutMe;
171
- this.renderer = renderer || new AboutMeRenderer();
172
150
  }
173
151
  get apiBaseUrl() {
174
152
  return this.baseUrl || this.getAttribute("base-url") || "";
@@ -178,7 +156,7 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
178
156
  if (typeof window !== "undefined" && window.__HYDRATION_DATA__) {
179
157
  const hydrationData = window.__HYDRATION_DATA__;
180
158
  this.profile = hydrationData.profile;
181
- this.contentNodes = hydrationData.contentNodes;
159
+ this.htmlContent = hydrationData.processedMarkdown;
182
160
  this.loading = false;
183
161
  return;
184
162
  }
@@ -186,7 +164,7 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
186
164
  }
187
165
  updated(changedProperties) {
188
166
  super.updated(changedProperties);
189
- if (this.loading === false && this.profile && this.contentNodes.length > 0) {
167
+ if (this.loading === false && this.profile && this.htmlContent) {
190
168
  return;
191
169
  }
192
170
  if (changedProperties.has("baseUrl") || changedProperties.has("base-url")) {
@@ -202,10 +180,9 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
202
180
  }
203
181
  try {
204
182
  this.loading = true;
205
- const url2 = this.apiBaseUrl;
206
- const data = await this.fetcher(url2);
183
+ const data = await this.fetcher(url);
207
184
  this.profile = data.profile;
208
- this.contentNodes = data.contentNodes;
185
+ this.htmlContent = data.processedMarkdown;
209
186
  this.loading = false;
210
187
  await this.updateComplete;
211
188
  } catch (error) {
@@ -216,30 +193,18 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
216
193
  }
217
194
  setFallbackContent() {
218
195
  this.profile = null;
219
- this.contentNodes = [
220
- {
221
- type: "heading",
222
- content: "Profile Not Found"
223
- },
224
- {
225
- type: "paragraph",
226
- content: "Your about-me profile has not been initialized yet. Please run the seed command to get started:"
227
- },
228
- {
229
- type: "paragraph",
230
- content: "npm run seed -- <username> <password>"
231
- }
232
- ];
196
+ this.htmlContent = `
197
+ <h2>Profile Not Found</h2>
198
+ <p>Your about-me profile has not been initialized yet. Please run the seed command to get started:</p>
199
+ <pre>npm run seed -- &lt;username&gt; '&lt;password&gt;'</pre>
200
+ `;
233
201
  }
234
202
  render() {
235
203
  if (this.loading) {
236
204
  return html`<div class="aboutme"><div class="loading">Loading...</div></div>`;
237
205
  }
238
206
  if (!this.profile) {
239
- if (this.contentNodes && this.contentNodes.length > 0) {
240
- return html`<div class="aboutme">${this.renderer.renderContent(this.contentNodes)}</div>`;
241
- }
242
- return html`<div class="aboutme"><div class="loading">Failed to load content</div></div>`;
207
+ return html`<div class="aboutme"><div class="content-section" .innerHTML="${this.htmlContent}"></div></div>`;
243
208
  }
244
209
  const profileImageUrl = this.profile.profileImageUrl ? this.profile.profileImageUrl.startsWith("http") || this.profile.profileImageUrl.startsWith("/") ? this.profile.profileImageUrl : `images/${this.profile.profileImageUrl}` : "";
245
210
  return html`
@@ -252,25 +217,23 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
252
217
  <h1>${this.profile.name}</h1>
253
218
  <p class="profile-title">${this.profile.title} • ${this.profile.experience}</p>
254
219
  </div>
255
- <div class="content-section">
256
- ${this.renderer.renderContent(this.contentNodes)}
257
- </div>
220
+ <div class="content-section" .innerHTML="${this.htmlContent}"></div>
258
221
  </div>
259
222
  `;
260
223
  }
261
224
  }
262
- _init$5 = __decoratorStart$5(_a$5);
225
+ _init$f = __decoratorStart$f(_a$f);
263
226
  _baseUrl = /* @__PURE__ */ new WeakMap();
264
227
  _profile = /* @__PURE__ */ new WeakMap();
265
- _contentNodes = /* @__PURE__ */ new WeakMap();
228
+ _htmlContent = /* @__PURE__ */ new WeakMap();
266
229
  _loading$2 = /* @__PURE__ */ new WeakMap();
267
- __decorateElement$5(_init$5, 4, "baseUrl", _baseUrl_dec, MyAboutme, _baseUrl);
268
- __decorateElement$5(_init$5, 4, "profile", _profile_dec, MyAboutme, _profile);
269
- __decorateElement$5(_init$5, 4, "contentNodes", _contentNodes_dec, MyAboutme, _contentNodes);
270
- __decorateElement$5(_init$5, 4, "loading", _loading_dec$2, MyAboutme, _loading$2);
271
- MyAboutme = __decorateElement$5(_init$5, 0, "MyAboutme", _MyAboutme_decorators, MyAboutme);
230
+ __decorateElement$f(_init$f, 4, "baseUrl", _baseUrl_dec, MyAboutme, _baseUrl);
231
+ __decorateElement$f(_init$f, 4, "profile", _profile_dec, MyAboutme, _profile);
232
+ __decorateElement$f(_init$f, 4, "htmlContent", _htmlContent_dec, MyAboutme, _htmlContent);
233
+ __decorateElement$f(_init$f, 4, "loading", _loading_dec$2, MyAboutme, _loading$2);
234
+ MyAboutme = __decorateElement$f(_init$f, 0, "MyAboutme", _MyAboutme_decorators, MyAboutme);
272
235
  MyAboutme.styles = aboutmeStyles;
273
- __runInitializers$5(_init$5, 1, MyAboutme);
236
+ __runInitializers$f(_init$f, 1, MyAboutme);
274
237
  const adminStyles = css`
275
238
  :host {
276
239
  display: block;
@@ -539,467 +502,905 @@ input[type="file"]:hover {
539
502
  }
540
503
  }
541
504
  `;
542
- var __create$4 = Object.create;
543
- var __defProp$4 = Object.defineProperty;
544
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
545
- var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
546
- var __typeError$4 = (msg) => {
505
+ class AdminApiService {
506
+ constructor(apiUrl) {
507
+ this.apiUrl = apiUrl;
508
+ }
509
+ async checkAuthStatus() {
510
+ const res = await fetch(`${this.apiUrl}/api/auth/status`);
511
+ if (!res.ok) throw new Error("Auth status check failed");
512
+ return res.json();
513
+ }
514
+ async tryAutoLogin() {
515
+ const res = await fetch(`${this.apiUrl}/api/content`, {
516
+ credentials: "include"
517
+ });
518
+ if (!res.ok) throw new Error("Auto login failed");
519
+ return res.json();
520
+ }
521
+ async login(username, password) {
522
+ const res = await fetch(`${this.apiUrl}/api/auth/login`, {
523
+ method: "POST",
524
+ credentials: "include",
525
+ headers: { "Content-Type": "application/json" },
526
+ body: JSON.stringify({ username, password })
527
+ });
528
+ if (!res.ok) {
529
+ const data = await res.json();
530
+ throw new Error(data.error || "Login failed");
531
+ }
532
+ }
533
+ async setup(username, password) {
534
+ const res = await fetch(`${this.apiUrl}/api/auth/setup`, {
535
+ method: "POST",
536
+ credentials: "include",
537
+ headers: { "Content-Type": "application/json" },
538
+ body: JSON.stringify({ username, password })
539
+ });
540
+ if (!res.ok) {
541
+ const data = await res.json();
542
+ throw new Error(data.error || "Setup failed");
543
+ }
544
+ }
545
+ async logout() {
546
+ await fetch(`${this.apiUrl}/api/auth/logout`, {
547
+ method: "POST",
548
+ credentials: "include"
549
+ });
550
+ }
551
+ async fetchContent() {
552
+ const res = await fetch(`${this.apiUrl}/api/content`, {
553
+ credentials: "include"
554
+ });
555
+ if (!res.ok) throw new Error("Failed to fetch content");
556
+ return res.json();
557
+ }
558
+ async fetchStaticDetails() {
559
+ const res = await fetch(`${this.apiUrl}/api/static`, {
560
+ credentials: "include"
561
+ });
562
+ if (!res.ok) throw new Error("Failed to fetch static details");
563
+ return res.json();
564
+ }
565
+ async uploadContent(key, file) {
566
+ const res = await fetch(`${this.apiUrl}/api/content/${key}`, {
567
+ method: "PUT",
568
+ credentials: "include",
569
+ body: file
570
+ });
571
+ if (!res.ok) throw new Error("Upload failed");
572
+ }
573
+ async deleteContent(key) {
574
+ const res = await fetch(`${this.apiUrl}/api/content/${key}`, {
575
+ method: "DELETE",
576
+ credentials: "include"
577
+ });
578
+ if (!res.ok) throw new Error("Delete failed");
579
+ }
580
+ async clearCache() {
581
+ const res = await fetch(`${this.apiUrl}/api/cache-clear`, {
582
+ method: "POST",
583
+ credentials: "include"
584
+ });
585
+ if (!res.ok) throw new Error("Failed to clear cache");
586
+ }
587
+ }
588
+ var __create$e = Object.create;
589
+ var __defProp$e = Object.defineProperty;
590
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
591
+ var __knownSymbol$e = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
592
+ var __typeError$e = (msg) => {
547
593
  throw TypeError(msg);
548
594
  };
549
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
550
- var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
551
- var __decoratorStart$4 = (base) => [, , , __create$4(base?.[__knownSymbol$4("metadata")] ?? null)];
552
- var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
553
- var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
554
- var __decoratorContext$4 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$4[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$4("Already initialized") : fns.push(__expectFn$4(fn || null)) });
555
- var __decoratorMetadata$4 = (array, target) => __defNormalProp$4(target, __knownSymbol$4("metadata"), array[3]);
556
- var __runInitializers$4 = (array, flags, self, value) => {
595
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
596
+ var __decoratorStart$e = (base) => [, , , __create$e(base?.[__knownSymbol$e("metadata")] ?? null)];
597
+ var __decoratorStrings$e = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
598
+ var __expectFn$e = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$e("Function expected") : fn;
599
+ var __decoratorContext$e = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$e[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$e("Already initialized") : fns.push(__expectFn$e(fn || null)) });
600
+ var __decoratorMetadata$e = (array, target) => __defNormalProp$e(target, __knownSymbol$e("metadata"), array[3]);
601
+ var __runInitializers$e = (array, flags, self, value) => {
557
602
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
558
603
  return value;
559
604
  };
560
- var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
561
- var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
562
- var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$4[k2 + 5];
563
- var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
564
- var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$4(k2 < 4 ? target : { get [name]() {
565
- return __privateGet$3(this, extra);
605
+ var __decorateElement$e = (array, flags, name, decorators, target, extra) => {
606
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = false, p2 = false;
607
+ var j = array.length + 1, key = __decoratorStrings$e[k2 + 5];
608
+ var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
609
+ var desc = (target = target.prototype, __getOwnPropDesc$e({ get [name]() {
610
+ return __privateGet$6(this, extra);
566
611
  }, set [name](x) {
567
- return __privateSet$3(this, extra, x);
612
+ return __privateSet$6(this, extra, x);
568
613
  } }, name));
569
- k2 ? p2 && k2 < 4 && __name$4(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$4(target, name);
570
614
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
571
- ctx = __decoratorContext$4(k2, name, done = {}, array[3], extraInitializers);
572
- if (k2) {
573
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$3(target, x) : (x) => name in x };
574
- if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$3 : __privateMethod$3)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
575
- if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$3(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
615
+ ctx = __decoratorContext$e(k2, name, done = {}, array[3], extraInitializers);
616
+ {
617
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
618
+ access.get = (x) => x[name];
619
+ access.set = (x, y2) => x[name] = y2;
576
620
  }
577
- it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
578
- if (k2 ^ 4 || it === void 0) __expectFn$4(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
579
- else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
580
- else __expectFn$4(fn = it.get) && (desc.get = fn), __expectFn$4(fn = it.set) && (desc.set = fn), __expectFn$4(fn = it.init) && initializers.unshift(fn);
621
+ it = (0, decorators[i2])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
622
+ if (it === void 0) __expectFn$e(it) && (desc[key] = it);
623
+ else if (typeof it !== "object" || it === null) __typeError$e("Object expected");
624
+ else __expectFn$e(fn = it.get) && (desc.get = fn), __expectFn$e(fn = it.set) && (desc.set = fn), __expectFn$e(fn = it.init) && initializers.unshift(fn);
581
625
  }
582
- return k2 || __decoratorMetadata$4(array, target), desc && __defProp$4(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
626
+ return desc && __defProp$e(target, name, desc), target;
583
627
  };
584
- var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
585
- var __privateIn$3 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
586
- var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
587
- var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
588
- var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
589
- var __privateMethod$3 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
590
- var _loginError_dec, _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isLoading_dec, _isSetup_dec, _isAuthenticated_dec, _a$4, _AdminPortal_decorators, _init$4, _isAuthenticated, _isSetup, _isLoading, _contentList, _statusMessage, _activeSection, _staticDetails, _loginError;
591
- _AdminPortal_decorators = [customElement("admin-portal")];
592
- class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()], _isSetup_dec = [state()], _isLoading_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _loginError_dec = [state()], _a$4) {
628
+ var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$e("Cannot " + msg);
629
+ var __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), member.get(obj));
630
+ var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$e("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
631
+ var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
632
+ var _onStatusMessage_dec, _onDelete_dec, _onUpload_dec, _staticDetails_dec$1, _contentList_dec$1, _a$e, _init$e, _contentList$1, _staticDetails$1, _onUpload, _onDelete, _onStatusMessage;
633
+ class AdminSection extends (_a$e = LitElement, _contentList_dec$1 = [property({ type: Array })], _staticDetails_dec$1 = [property({ type: Object })], _onUpload_dec = [property({ type: Function })], _onDelete_dec = [property({ type: Function })], _onStatusMessage_dec = [property({ type: Function })], _a$e) {
593
634
  constructor() {
594
635
  super(...arguments);
595
- __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 8, this, false)), __runInitializers$4(_init$4, 11, this);
596
- __privateAdd$3(this, _isSetup, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
597
- __privateAdd$3(this, _isLoading, __runInitializers$4(_init$4, 16, this, true)), __runInitializers$4(_init$4, 19, this);
598
- __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 20, this, [])), __runInitializers$4(_init$4, 23, this);
599
- __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 24, this, "")), __runInitializers$4(_init$4, 27, this);
600
- __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 28, this, "profile")), __runInitializers$4(_init$4, 31, this);
601
- __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 32, this, {})), __runInitializers$4(_init$4, 35, this);
602
- __privateAdd$3(this, _loginError, __runInitializers$4(_init$4, 36, this, "")), __runInitializers$4(_init$4, 39, this);
636
+ __privateAdd$6(this, _contentList$1, __runInitializers$e(_init$e, 8, this, [])), __runInitializers$e(_init$e, 11, this);
637
+ __privateAdd$6(this, _staticDetails$1, __runInitializers$e(_init$e, 12, this, {})), __runInitializers$e(_init$e, 15, this);
638
+ __privateAdd$6(this, _onUpload, __runInitializers$e(_init$e, 16, this, async () => {
639
+ })), __runInitializers$e(_init$e, 19, this);
640
+ __privateAdd$6(this, _onDelete, __runInitializers$e(_init$e, 20, this, async () => {
641
+ })), __runInitializers$e(_init$e, 23, this);
642
+ __privateAdd$6(this, _onStatusMessage, __runInitializers$e(_init$e, 24, this, () => {
643
+ })), __runInitializers$e(_init$e, 27, this);
603
644
  }
604
- get apiUrl() {
605
- return window.__VITE_API_URL__ || void 0 || "http://localhost:8787";
645
+ getContent(key) {
646
+ return this.contentList.find((c2) => c2.key === key);
606
647
  }
607
- async connectedCallback() {
608
- super.connectedCallback();
609
- await this.checkAuthStatus();
648
+ getSectionFiles(prefix) {
649
+ return this.contentList.filter((c2) => c2.key.startsWith(prefix));
610
650
  }
611
- async checkAuthStatus() {
612
- try {
613
- const res = await fetch(`${this.apiUrl}/auth/status`, {
614
- credentials: "include"
615
- });
616
- if (res.ok) {
617
- const status = await res.json();
618
- this.isSetup = status.configured;
619
- if (status.configured) {
620
- await this.tryAutoLogin();
621
- } else {
622
- this.isLoading = false;
623
- }
624
- } else {
625
- this.isSetup = false;
626
- this.isLoading = false;
627
- }
628
- } catch (e2) {
629
- this.isSetup = false;
630
- this.isLoading = false;
651
+ }
652
+ _init$e = __decoratorStart$e(_a$e);
653
+ _contentList$1 = /* @__PURE__ */ new WeakMap();
654
+ _staticDetails$1 = /* @__PURE__ */ new WeakMap();
655
+ _onUpload = /* @__PURE__ */ new WeakMap();
656
+ _onDelete = /* @__PURE__ */ new WeakMap();
657
+ _onStatusMessage = /* @__PURE__ */ new WeakMap();
658
+ __decorateElement$e(_init$e, 4, "contentList", _contentList_dec$1, AdminSection, _contentList$1);
659
+ __decorateElement$e(_init$e, 4, "staticDetails", _staticDetails_dec$1, AdminSection, _staticDetails$1);
660
+ __decorateElement$e(_init$e, 4, "onUpload", _onUpload_dec, AdminSection, _onUpload);
661
+ __decorateElement$e(_init$e, 4, "onDelete", _onDelete_dec, AdminSection, _onDelete);
662
+ __decorateElement$e(_init$e, 4, "onStatusMessage", _onStatusMessage_dec, AdminSection, _onStatusMessage);
663
+ __decoratorMetadata$e(_init$e, AdminSection);
664
+ AdminSection.styles = css`
665
+ :host {
666
+ display: block;
667
+ width: 100%;
631
668
  }
632
- }
633
- async tryAutoLogin() {
634
- try {
635
- const res = await fetch(`${this.apiUrl}/content`, {
636
- credentials: "include"
637
- });
638
- if (res.ok) {
639
- this.contentList = await res.json();
640
- this.isAuthenticated = true;
641
- }
642
- } catch (e2) {
669
+
670
+ .section {
671
+ width: 100%;
672
+ border: none;
673
+ padding: 24px;
674
+ border-radius: 16px;
675
+ background: var(--card-bg, #fff);
676
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
677
+ margin-bottom: 20px;
678
+ min-height: 450px;
679
+ box-sizing: border-box;
643
680
  }
644
- this.isLoading = false;
645
- }
646
- async handleLogin(e2) {
647
- e2.preventDefault();
648
- this.loginError = "";
649
- const usernameInput = this.shadowRoot?.querySelector("#username");
650
- const passwordInput = this.shadowRoot?.querySelector("#password");
651
- if (!usernameInput?.value || !passwordInput?.value) {
652
- this.loginError = "Username and password required";
653
- return;
681
+
682
+ .section h3 {
683
+ margin: 0 0 0.5rem 0;
684
+ font-size: 1.25rem;
654
685
  }
655
- try {
656
- const res = await fetch(`${this.apiUrl}/auth/login`, {
657
- method: "POST",
658
- credentials: "include",
659
- headers: { "Content-Type": "application/json" },
660
- body: JSON.stringify({
661
- username: usernameInput.value,
662
- password: passwordInput.value
663
- })
664
- });
665
- if (res.ok) {
666
- this.isAuthenticated = true;
667
- await this.fetchContent();
668
- } else {
669
- const data = await res.json();
670
- this.loginError = data.error || "Login failed";
671
- }
672
- } catch (e22) {
673
- this.loginError = "Connection error";
686
+
687
+ .help-text {
688
+ color: var(--secondary-text, #666);
689
+ margin-bottom: 1rem;
674
690
  }
675
- }
676
- async handleSetup(e2) {
677
- e2.preventDefault();
678
- this.loginError = "";
679
- const usernameInput = this.shadowRoot?.querySelector("#username");
680
- const passwordInput = this.shadowRoot?.querySelector("#password");
681
- const confirmInput = this.shadowRoot?.querySelector("#confirmPassword");
682
- if (!usernameInput?.value || !passwordInput?.value) {
683
- this.loginError = "Username and password required";
684
- return;
691
+
692
+ .current-file {
693
+ margin-bottom: 1rem;
694
+ padding: 1rem;
695
+ background: var(--nav-link-hover-bg, #f5f5f5);
696
+ border-radius: 8px;
685
697
  }
686
- if (usernameInput.value.length < 3) {
687
- this.loginError = "Username must be at least 3 characters";
688
- return;
698
+
699
+ input[type="text"],
700
+ input[type="file"] {
701
+ width: 100%;
702
+ padding: 10px;
703
+ margin-bottom: 1rem;
704
+ border: 1px solid var(--border-color);
705
+ border-radius: 4px;
706
+ background: var(--background-color);
707
+ color: var(--text-color);
708
+ box-sizing: border-box;
689
709
  }
690
- if (passwordInput.value.length < 8) {
691
- this.loginError = "Password must be at least 8 characters";
692
- return;
710
+
711
+ input[type="file"] {
712
+ margin-bottom: 1rem;
693
713
  }
694
- if (passwordInput.value !== confirmInput?.value) {
695
- this.loginError = "Passwords do not match";
696
- return;
714
+
715
+ button {
716
+ padding: 10px 20px;
717
+ border: none;
718
+ border-radius: 4px;
719
+ cursor: pointer;
720
+ font-size: 1rem;
721
+ transition: background-color 0.3s ease;
722
+ margin-right: 10px;
697
723
  }
698
- try {
699
- const res = await fetch(`${this.apiUrl}/auth/setup`, {
700
- method: "POST",
701
- credentials: "include",
702
- headers: { "Content-Type": "application/json" },
703
- body: JSON.stringify({
704
- username: usernameInput.value,
705
- password: passwordInput.value
706
- })
707
- });
708
- if (res.ok) {
709
- this.isAuthenticated = true;
710
- this.isSetup = true;
711
- await this.fetchContent();
712
- } else {
713
- const data = await res.json();
714
- this.loginError = data.error || "Setup failed";
715
- }
716
- } catch (e22) {
717
- this.loginError = "Connection error";
724
+
725
+ .btn-primary {
726
+ background: var(--link-color, #646cff);
727
+ color: white;
718
728
  }
719
- }
720
- async handleLogout() {
721
- try {
722
- await fetch(`${this.apiUrl}/auth/logout`, {
723
- method: "POST",
724
- credentials: "include"
725
- });
726
- } catch (e2) {
729
+
730
+ .btn-primary:hover {
731
+ background: var(--link-hover-color, #535bf2);
727
732
  }
728
- this.isAuthenticated = false;
729
- this.contentList = [];
730
- }
731
- async fetchContent() {
732
- try {
733
- const res = await fetch(`${this.apiUrl}/content`, {
734
- credentials: "include"
735
- });
736
- if (res.ok) {
737
- this.contentList = await res.json();
738
- } else {
739
- this.statusMessage = "Failed to fetch content.";
740
- }
741
- } catch (e2) {
742
- this.statusMessage = "Error fetching content.";
733
+
734
+ .btn-secondary {
735
+ background: var(--nav-link-hover-bg, #f0f0f0);
736
+ color: var(--text-color, #213547);
743
737
  }
744
- }
745
- async fetchStaticDetails() {
746
- try {
747
- const res = await fetch(`${this.apiUrl}/static`, {
748
- credentials: "include"
749
- });
750
- if (res.ok) {
751
- this.staticDetails = await res.json();
752
- }
753
- } catch (e2) {
738
+
739
+ .btn-secondary:hover {
740
+ background: var(--border-color, #e0e0e0);
754
741
  }
755
- }
756
- async handleUpload(key, file) {
757
- try {
758
- this.statusMessage = "Uploading...";
759
- const res = await fetch(`${this.apiUrl}/content/${key}`, {
760
- method: "PUT",
761
- credentials: "include",
762
- body: file
763
- });
764
- if (res.ok) {
765
- this.statusMessage = "Upload successful!";
766
- this.fetchContent();
767
- } else {
768
- this.statusMessage = "Upload failed.";
769
- }
770
- } catch (e2) {
771
- this.statusMessage = "Error uploading.";
742
+
743
+ .btn-danger {
744
+ background: #dc3545;
745
+ color: white;
772
746
  }
773
- }
774
- async handleClearCache() {
775
- try {
776
- this.statusMessage = "Clearing cache...";
777
- const res = await fetch(`${this.apiUrl}/cache-clear`, {
778
- method: "POST",
779
- credentials: "include"
780
- });
781
- if (res.ok) {
782
- this.statusMessage = "Cache cleared!";
783
- } else {
784
- this.statusMessage = "Failed to clear cache.";
785
- }
786
- } catch (e2) {
787
- this.statusMessage = "Error clearing cache.";
747
+
748
+ .btn-danger:hover {
749
+ background: #c82333;
788
750
  }
789
- }
790
- async handleDelete(key) {
791
- if (!confirm(`Delete ${key}?`)) return;
792
- try {
793
- const res = await fetch(`${this.apiUrl}/content/${key}`, {
794
- method: "DELETE",
795
- credentials: "include"
796
- });
797
- if (res.ok) {
798
- this.fetchContent();
799
- } else {
800
- this.statusMessage = "Delete failed.";
801
- }
802
- } catch (e2) {
803
- this.statusMessage = "Error deleting.";
751
+
752
+ .file-list {
753
+ margin-top: 1rem;
754
+ }
755
+
756
+ .file-item {
757
+ display: flex;
758
+ justify-content: space-between;
759
+ align-items: center;
760
+ padding: 0.5rem;
761
+ border-bottom: 1px solid var(--border-color, #eee);
762
+ }
763
+
764
+ .file-item:last-child {
765
+ border-bottom: none;
766
+ }
767
+ `;
768
+ var __create$d = Object.create;
769
+ var __defProp$d = Object.defineProperty;
770
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
771
+ var __knownSymbol$d = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
772
+ var __typeError$d = (msg) => {
773
+ throw TypeError(msg);
774
+ };
775
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
776
+ var __name$d = (target, value) => __defProp$d(target, "name", { value, configurable: true });
777
+ var __decoratorStart$d = (base) => [, , , __create$d(base?.[__knownSymbol$d("metadata")] ?? null)];
778
+ var __decoratorStrings$d = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
779
+ var __expectFn$d = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$d("Function expected") : fn;
780
+ var __decoratorContext$d = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$d[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$d("Already initialized") : fns.push(__expectFn$d(fn || null)) });
781
+ var __decoratorMetadata$d = (array, target) => __defNormalProp$d(target, __knownSymbol$d("metadata"), array[3]);
782
+ var __runInitializers$d = (array, flags, self, value) => {
783
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
784
+ return value;
785
+ };
786
+ var __decorateElement$d = (array, flags, name, decorators, target, extra) => {
787
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
788
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$d[k2 + 5];
789
+ var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
790
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$d(k2 < 4 ? target : { get [name]() {
791
+ return __privateGet$5(this, extra);
792
+ }, set [name](x) {
793
+ return __privateSet$5(this, extra, x);
794
+ } }, name));
795
+ k2 ? p2 && k2 < 4 && __name$d(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$d(target, name);
796
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
797
+ ctx = __decoratorContext$d(k2, name, done = {}, array[3], extraInitializers);
798
+ if (k2) {
799
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$5(target, x) : (x) => name in x };
800
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$5 : __privateMethod$5)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
801
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$5(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
804
802
  }
803
+ it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
804
+ if (k2 ^ 4 || it === void 0) __expectFn$d(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
805
+ else if (typeof it !== "object" || it === null) __typeError$d("Object expected");
806
+ else __expectFn$d(fn = it.get) && (desc.get = fn), __expectFn$d(fn = it.set) && (desc.set = fn), __expectFn$d(fn = it.init) && initializers.unshift(fn);
805
807
  }
806
- getContent(key) {
807
- return this.contentList.find((c2) => c2.key === key);
808
+ return k2 || __decoratorMetadata$d(array, target), desc && __defProp$d(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
809
+ };
810
+ var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$d("Cannot " + msg);
811
+ var __privateIn$5 = (member, obj) => Object(obj) !== obj ? __typeError$d('Cannot use the "in" operator on this value') : member.has(obj);
812
+ var __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
813
+ var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$d("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
814
+ var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
815
+ var __privateMethod$5 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
816
+ var _isSetup_dec$1, _errorMessage_dec, _a$d, _AdminLoginForm_decorators, _init$d, _errorMessage, _isSetup$1;
817
+ _AdminLoginForm_decorators = [customElement("admin-login-form")];
818
+ class AdminLoginForm extends (_a$d = LitElement, _errorMessage_dec = [property({ type: String })], _isSetup_dec$1 = [property({ type: Boolean })], _a$d) {
819
+ constructor() {
820
+ super(...arguments);
821
+ __privateAdd$5(this, _errorMessage, __runInitializers$d(_init$d, 8, this, "")), __runInitializers$d(_init$d, 11, this);
822
+ __privateAdd$5(this, _isSetup$1, __runInitializers$d(_init$d, 12, this, false)), __runInitializers$d(_init$d, 15, this);
808
823
  }
809
- getSectionFiles(prefix) {
810
- return this.contentList.filter((c2) => c2.key.startsWith(prefix));
824
+ handleSubmit(e2) {
825
+ e2.preventDefault();
826
+ const formData = new FormData(e2.target);
827
+ const username = formData.get("username");
828
+ const password = formData.get("password");
829
+ const confirmPassword = formData.get("confirmPassword");
830
+ this.dispatchEvent(new CustomEvent("login-submit", {
831
+ detail: { username, password, confirmPassword },
832
+ bubbles: true,
833
+ composed: true
834
+ }));
811
835
  }
812
- renderLoginForm() {
836
+ render() {
813
837
  return html`
814
838
  <div class="container">
815
839
  <div class="login-box">
816
- <h2>Admin Setup</h2>
817
- <p>Create your admin credentials</p>
818
- <form @submit=${this.handleSetup}>
819
- <input type="text" id="username" placeholder="Username (3+ chars)" />
820
- <input type="password" id="password" placeholder="Password (8+ chars)" />
821
- <input type="password" id="confirmPassword" placeholder="Confirm Password" />
822
- ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
823
- <button type="submit" class="btn-primary">Create Account</button>
840
+ <h2>${this.isSetup ? "Admin Login" : "Admin Setup"}</h2>
841
+ <p>${this.isSetup ? "Enter your credentials" : "Create your admin credentials"}</p>
842
+ <form @submit=${this.handleSubmit}>
843
+ <input type="text" name="username" placeholder="Username${this.isSetup ? "" : " (3+ chars)"}" autocomplete="username" required />
844
+ <input type="password" name="password" placeholder="Password${this.isSetup ? "" : " (8+ chars)"}" autocomplete="current-password" required />
845
+ ${!this.isSetup ? html`<input type="password" name="confirmPassword" placeholder="Confirm Password" required />` : ""}
846
+ ${this.errorMessage ? html`<div class="error-message">${this.errorMessage}</div>` : ""}
847
+ <button type="submit" class="btn-primary">${this.isSetup ? "Login" : "Create Account"}</button>
824
848
  </form>
825
849
  </div>
826
850
  </div>
827
851
  `;
828
852
  }
829
- renderLogin() {
830
- return html`
831
- <div class="container">
832
- <div class="login-box">
833
- <h2>Admin Login</h2>
834
- <p>Enter your credentials</p>
835
- <form @submit=${this.handleLogin}>
836
- <input type="text" id="username" placeholder="Username" autocomplete="username" />
837
- <input type="password" id="password" placeholder="Password" autocomplete="current-password" />
838
- ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
839
- <button type="submit" class="btn-primary">Login</button>
840
- </form>
841
- </div>
842
- </div>
843
- `;
853
+ }
854
+ _init$d = __decoratorStart$d(_a$d);
855
+ _errorMessage = /* @__PURE__ */ new WeakMap();
856
+ _isSetup$1 = /* @__PURE__ */ new WeakMap();
857
+ __decorateElement$d(_init$d, 4, "errorMessage", _errorMessage_dec, AdminLoginForm, _errorMessage);
858
+ __decorateElement$d(_init$d, 4, "isSetup", _isSetup_dec$1, AdminLoginForm, _isSetup$1);
859
+ AdminLoginForm = __decorateElement$d(_init$d, 0, "AdminLoginForm", _AdminLoginForm_decorators, AdminLoginForm);
860
+ AdminLoginForm.styles = css`
861
+ :host {
862
+ display: block;
863
+ width: 100%;
864
+ }
865
+
866
+ .container {
867
+ width: 100%;
868
+ max-width: 900px;
869
+ margin: 0 auto;
870
+ padding: 1rem;
871
+ }
872
+
873
+ .login-box {
874
+ border: 1px solid var(--border-color, #e0e0e0);
875
+ padding: 3rem 2.5rem;
876
+ border-radius: 16px;
877
+ width: 100%;
878
+ max-width: 420px;
879
+ margin: 80px auto;
880
+ text-align: center;
881
+ background: var(--card-bg, #fff);
882
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
883
+ }
884
+
885
+ .login-box h2 {
886
+ margin: 0 0 0.5rem 0;
887
+ font-size: 1.75rem;
888
+ font-weight: 600;
889
+ color: var(--text-color, #213547);
890
+ }
891
+
892
+ .login-box p {
893
+ color: var(--secondary-text, #666);
894
+ margin-bottom: 1.5rem;
895
+ }
896
+
897
+ input {
898
+ width: 100%;
899
+ padding: 10px;
900
+ margin-bottom: 20px;
901
+ border: 1px solid var(--border-color);
902
+ border-radius: 4px;
903
+ background: var(--background-color);
904
+ color: var(--text-color);
905
+ box-sizing: border-box;
906
+ }
907
+
908
+ button {
909
+ padding: 10px 20px;
910
+ border: none;
911
+ border-radius: 4px;
912
+ cursor: pointer;
913
+ font-size: 1rem;
914
+ transition: background-color 0.3s ease;
915
+ }
916
+
917
+ .btn-primary {
918
+ background: var(--link-color, #646cff);
919
+ color: white;
920
+ }
921
+
922
+ .btn-primary:hover {
923
+ background: var(--link-hover-color, #535bf2);
924
+ }
925
+
926
+ .error-message {
927
+ color: red;
928
+ margin-bottom: 10px;
929
+ }
930
+ `;
931
+ __runInitializers$d(_init$d, 1, AdminLoginForm);
932
+ var __create$c = Object.create;
933
+ var __defProp$c = Object.defineProperty;
934
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
935
+ var __knownSymbol$c = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
936
+ var __typeError$c = (msg) => {
937
+ throw TypeError(msg);
938
+ };
939
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
940
+ var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
941
+ var __decoratorStart$c = (base) => [, , , __create$c(base?.[__knownSymbol$c("metadata")] ?? null)];
942
+ var __decoratorStrings$c = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
943
+ var __expectFn$c = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$c("Function expected") : fn;
944
+ var __decoratorContext$c = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$c[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$c("Already initialized") : fns.push(__expectFn$c(fn || null)) });
945
+ var __decoratorMetadata$c = (array, target) => __defNormalProp$c(target, __knownSymbol$c("metadata"), array[3]);
946
+ var __runInitializers$c = (array, flags, self, value) => {
947
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
948
+ return value;
949
+ };
950
+ var __decorateElement$c = (array, flags, name, decorators, target, extra) => {
951
+ var it, done, ctx, k2 = flags & 7, p2 = false;
952
+ var j = 0;
953
+ var extraInitializers = array[j] || (array[j] = []);
954
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$c(target, name));
955
+ __name$c(target, name);
956
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
957
+ ctx = __decoratorContext$c(k2, name, done = {}, array[3], extraInitializers);
958
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
959
+ __expectFn$c(it) && (target = it);
844
960
  }
845
- renderHomeSection() {
961
+ return __decoratorMetadata$c(array, target), desc && __defProp$c(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
962
+ };
963
+ var _AdminHomeSection_decorators, _init$c, _a$c;
964
+ _AdminHomeSection_decorators = [customElement("admin-home-section")];
965
+ class AdminHomeSection extends (_a$c = AdminSection) {
966
+ async handleUpload() {
967
+ const input = this.shadowRoot?.querySelector("#homeFile");
968
+ if (input.files?.[0]) {
969
+ try {
970
+ await this.onUpload("home.md", input.files[0]);
971
+ this.onStatusMessage("Upload successful!");
972
+ } catch (e2) {
973
+ this.onStatusMessage("Upload failed.");
974
+ }
975
+ }
976
+ }
977
+ async handleDelete() {
978
+ if (!confirm("Delete home.md?")) return;
979
+ try {
980
+ await this.onDelete("home.md");
981
+ } catch (e2) {
982
+ this.onStatusMessage("Delete failed.");
983
+ }
984
+ }
985
+ render() {
846
986
  const home = this.getContent("home.md");
847
987
  return html`
848
988
  <div class="section">
849
989
  <h3>Home Page</h3>
850
990
  <p class="help-text">Content for your home page. Upload home.md with your main content.</p>
851
-
991
+
852
992
  ${home ? html`
853
993
  <div class="current-file">
854
994
  <strong>Current:</strong> home.md (${home.size} bytes)
855
- <button class="btn-danger" @click=${() => this.handleDelete("home.md")}>Delete</button>
995
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
856
996
  </div>
857
997
  ` : ""}
858
998
 
859
999
  <input type="file" id="homeFile" accept=".md" />
860
- <button class="btn-primary" @click=${() => {
861
- const input = this.shadowRoot?.querySelector("#homeFile");
862
- if (input.files?.[0]) this.handleUpload("home.md", input.files[0]);
863
- }}>Upload home.md</button>
1000
+ <button class="btn-primary" @click=${this.handleUpload}>Upload home.md</button>
864
1001
  </div>
865
1002
  `;
866
1003
  }
867
- renderProfileSection() {
1004
+ }
1005
+ _init$c = __decoratorStart$c(_a$c);
1006
+ AdminHomeSection = __decorateElement$c(_init$c, 0, "AdminHomeSection", _AdminHomeSection_decorators, AdminHomeSection);
1007
+ __runInitializers$c(_init$c, 1, AdminHomeSection);
1008
+ var __create$b = Object.create;
1009
+ var __defProp$b = Object.defineProperty;
1010
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
1011
+ var __knownSymbol$b = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1012
+ var __typeError$b = (msg) => {
1013
+ throw TypeError(msg);
1014
+ };
1015
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1016
+ var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
1017
+ var __decoratorStart$b = (base) => [, , , __create$b(base?.[__knownSymbol$b("metadata")] ?? null)];
1018
+ var __decoratorStrings$b = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1019
+ var __expectFn$b = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$b("Function expected") : fn;
1020
+ var __decoratorContext$b = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$b[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$b("Already initialized") : fns.push(__expectFn$b(fn || null)) });
1021
+ var __decoratorMetadata$b = (array, target) => __defNormalProp$b(target, __knownSymbol$b("metadata"), array[3]);
1022
+ var __runInitializers$b = (array, flags, self, value) => {
1023
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1024
+ return value;
1025
+ };
1026
+ var __decorateElement$b = (array, flags, name, decorators, target, extra) => {
1027
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1028
+ var j = 0;
1029
+ var extraInitializers = array[j] || (array[j] = []);
1030
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$b(target, name));
1031
+ __name$b(target, name);
1032
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1033
+ ctx = __decoratorContext$b(k2, name, done = {}, array[3], extraInitializers);
1034
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1035
+ __expectFn$b(it) && (target = it);
1036
+ }
1037
+ return __decoratorMetadata$b(array, target), desc && __defProp$b(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1038
+ };
1039
+ var _AdminProfileSection_decorators, _init$b, _a$b;
1040
+ _AdminProfileSection_decorators = [customElement("admin-profile-section")];
1041
+ class AdminProfileSection extends (_a$b = AdminSection) {
1042
+ async handleUpload() {
1043
+ const input = this.shadowRoot?.querySelector("#profileFile");
1044
+ if (input.files?.[0]) {
1045
+ try {
1046
+ await this.onUpload("profile.json", input.files[0]);
1047
+ this.onStatusMessage("Upload successful!");
1048
+ } catch (e2) {
1049
+ this.onStatusMessage("Upload failed.");
1050
+ }
1051
+ }
1052
+ }
1053
+ async handleDelete() {
1054
+ if (!confirm("Delete profile.json?")) return;
1055
+ try {
1056
+ await this.onDelete("profile.json");
1057
+ } catch (e2) {
1058
+ this.onStatusMessage("Delete failed.");
1059
+ }
1060
+ }
1061
+ render() {
868
1062
  const profile = this.getContent("profile.json");
869
1063
  return html`
870
1064
  <div class="section">
871
1065
  <h3>Profile <span class="required-badge">Required</span></h3>
872
1066
  <p class="help-text">This file contains your profile information (name, title, experience).</p>
873
-
1067
+
874
1068
  ${profile ? html`
875
1069
  <div class="current-file">
876
1070
  <strong>Current:</strong> profile.json (${profile.size} bytes)
877
- <button class="btn-danger" @click=${() => this.handleDelete("profile.json")}>Delete</button>
1071
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
878
1072
  </div>
879
1073
  ` : ""}
880
1074
 
881
1075
  <input type="file" id="profileFile" accept=".json" />
882
- <button class="btn-primary" @click=${() => {
883
- const input = this.shadowRoot?.querySelector("#profileFile");
884
- if (input.files?.[0]) this.handleUpload("profile.json", input.files[0]);
885
- }}>Upload profile.json</button>
1076
+ <button class="btn-primary" @click=${this.handleUpload}>Upload profile.json</button>
886
1077
  </div>
887
1078
  `;
888
1079
  }
889
- renderAboutMeSection() {
1080
+ }
1081
+ _init$b = __decoratorStart$b(_a$b);
1082
+ AdminProfileSection = __decorateElement$b(_init$b, 0, "AdminProfileSection", _AdminProfileSection_decorators, AdminProfileSection);
1083
+ __runInitializers$b(_init$b, 1, AdminProfileSection);
1084
+ var __create$a = Object.create;
1085
+ var __defProp$a = Object.defineProperty;
1086
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
1087
+ var __knownSymbol$a = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1088
+ var __typeError$a = (msg) => {
1089
+ throw TypeError(msg);
1090
+ };
1091
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1092
+ var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
1093
+ var __decoratorStart$a = (base) => [, , , __create$a(base?.[__knownSymbol$a("metadata")] ?? null)];
1094
+ var __decoratorStrings$a = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1095
+ var __expectFn$a = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$a("Function expected") : fn;
1096
+ var __decoratorContext$a = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$a[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$a("Already initialized") : fns.push(__expectFn$a(fn || null)) });
1097
+ var __decoratorMetadata$a = (array, target) => __defNormalProp$a(target, __knownSymbol$a("metadata"), array[3]);
1098
+ var __runInitializers$a = (array, flags, self, value) => {
1099
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1100
+ return value;
1101
+ };
1102
+ var __decorateElement$a = (array, flags, name, decorators, target, extra) => {
1103
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1104
+ var j = 0;
1105
+ var extraInitializers = array[j] || (array[j] = []);
1106
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$a(target, name));
1107
+ __name$a(target, name);
1108
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1109
+ ctx = __decoratorContext$a(k2, name, done = {}, array[3], extraInitializers);
1110
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1111
+ __expectFn$a(it) && (target = it);
1112
+ }
1113
+ return __decoratorMetadata$a(array, target), desc && __defProp$a(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1114
+ };
1115
+ var _AdminAboutMeSection_decorators, _init$a, _a$a;
1116
+ _AdminAboutMeSection_decorators = [customElement("admin-about-me-section")];
1117
+ class AdminAboutMeSection extends (_a$a = AdminSection) {
1118
+ async handleUpload() {
1119
+ const input = this.shadowRoot?.querySelector("#aboutFile");
1120
+ if (input.files?.[0]) {
1121
+ try {
1122
+ await this.onUpload("about-me.md", input.files[0]);
1123
+ this.onStatusMessage("Upload successful!");
1124
+ } catch (e2) {
1125
+ this.onStatusMessage("Upload failed.");
1126
+ }
1127
+ }
1128
+ }
1129
+ async handleDelete() {
1130
+ if (!confirm("Delete about-me.md?")) return;
1131
+ try {
1132
+ await this.onDelete("about-me.md");
1133
+ } catch (e2) {
1134
+ this.onStatusMessage("Delete failed.");
1135
+ }
1136
+ }
1137
+ render() {
890
1138
  const aboutMe = this.getContent("about-me.md");
891
1139
  return html`
892
1140
  <div class="section">
893
1141
  <h3>About Me Page <span class="required-badge">Required</span></h3>
894
1142
  <p class="help-text">Content for your About Me page. Supports Markdown with frontmatter.</p>
895
-
1143
+
896
1144
  ${aboutMe ? html`
897
1145
  <div class="current-file">
898
1146
  <strong>Current:</strong> about-me.md (${aboutMe.size} bytes)
899
- <button class="btn-danger" @click=${() => this.handleDelete("about-me.md")}>Delete</button>
1147
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
900
1148
  </div>
901
1149
  ` : ""}
902
1150
 
903
1151
  <input type="file" id="aboutFile" accept=".md" />
904
- <button class="btn-primary" @click=${() => {
905
- const input = this.shadowRoot?.querySelector("#aboutFile");
906
- if (input.files?.[0]) this.handleUpload("about-me.md", input.files[0]);
907
- }}>Upload about-me.md</button>
1152
+ <button class="btn-primary" @click=${this.handleUpload}>Upload about-me.md</button>
908
1153
  </div>
909
1154
  `;
910
1155
  }
911
- renderBlogsSection() {
1156
+ }
1157
+ _init$a = __decoratorStart$a(_a$a);
1158
+ AdminAboutMeSection = __decorateElement$a(_init$a, 0, "AdminAboutMeSection", _AdminAboutMeSection_decorators, AdminAboutMeSection);
1159
+ __runInitializers$a(_init$a, 1, AdminAboutMeSection);
1160
+ var __create$9 = Object.create;
1161
+ var __defProp$9 = Object.defineProperty;
1162
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
1163
+ var __knownSymbol$9 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1164
+ var __typeError$9 = (msg) => {
1165
+ throw TypeError(msg);
1166
+ };
1167
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1168
+ var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
1169
+ var __decoratorStart$9 = (base) => [, , , __create$9(base?.[__knownSymbol$9("metadata")] ?? null)];
1170
+ var __decoratorStrings$9 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1171
+ var __expectFn$9 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$9("Function expected") : fn;
1172
+ var __decoratorContext$9 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$9[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$9("Already initialized") : fns.push(__expectFn$9(fn || null)) });
1173
+ var __decoratorMetadata$9 = (array, target) => __defNormalProp$9(target, __knownSymbol$9("metadata"), array[3]);
1174
+ var __runInitializers$9 = (array, flags, self, value) => {
1175
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1176
+ return value;
1177
+ };
1178
+ var __decorateElement$9 = (array, flags, name, decorators, target, extra) => {
1179
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1180
+ var j = 0;
1181
+ var extraInitializers = array[j] || (array[j] = []);
1182
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$9(target, name));
1183
+ __name$9(target, name);
1184
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1185
+ ctx = __decoratorContext$9(k2, name, done = {}, array[3], extraInitializers);
1186
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1187
+ __expectFn$9(it) && (target = it);
1188
+ }
1189
+ return __decoratorMetadata$9(array, target), desc && __defProp$9(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1190
+ };
1191
+ var _AdminBlogsSection_decorators, _init$9, _a$9;
1192
+ _AdminBlogsSection_decorators = [customElement("admin-blogs-section")];
1193
+ class AdminBlogsSection extends (_a$9 = AdminSection) {
1194
+ async handleUpload() {
1195
+ const metaInput = this.shadowRoot?.querySelector("#blogMetaFile");
1196
+ const contentInput = this.shadowRoot?.querySelector("#blogContentFile");
1197
+ const slugInput = this.shadowRoot?.querySelector("#blogSlug");
1198
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
1199
+ try {
1200
+ await this.onUpload(`blogs/${slugInput.value}.json`, metaInput.files[0]);
1201
+ await this.onUpload(`blogs/${slugInput.value}.md`, contentInput.files[0]);
1202
+ this.onStatusMessage("Upload successful!");
1203
+ } catch (e2) {
1204
+ this.onStatusMessage("Upload failed.");
1205
+ }
1206
+ }
1207
+ }
1208
+ async handleDelete(slug) {
1209
+ if (!confirm(`Delete blog ${slug}?`)) return;
1210
+ try {
1211
+ await this.onDelete(`blogs/${slug}.json`);
1212
+ await this.onDelete(`blogs/${slug}.md`);
1213
+ } catch (e2) {
1214
+ this.onStatusMessage("Delete failed.");
1215
+ }
1216
+ }
1217
+ render() {
912
1218
  const blogs = this.getSectionFiles("blogs/").filter((b) => b.key.endsWith(".json"));
913
1219
  return html`
914
1220
  <div class="section">
915
1221
  <h3>Blog Posts</h3>
916
1222
  <p class="help-text">Each blog needs 2 files: a JSON (metadata) and MD (content) file.</p>
917
-
1223
+
918
1224
  <h4>Upload New Blog</h4>
919
1225
  <input type="file" id="blogMetaFile" accept=".json" />
920
1226
  <input type="file" id="blogContentFile" accept=".md" />
921
1227
  <input type="text" id="blogSlug" placeholder="Slug (e.g., my-new-post)" class="mt-1" />
922
- <button class="btn-primary" @click=${() => {
923
- const metaInput = this.shadowRoot?.querySelector("#blogMetaFile");
924
- const contentInput = this.shadowRoot?.querySelector("#blogContentFile");
925
- const slugInput = this.shadowRoot?.querySelector("#blogSlug");
926
- if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
927
- this.handleUpload(`blogs/${slugInput.value}.json`, metaInput.files[0]);
928
- this.handleUpload(`blogs/${slugInput.value}.md`, contentInput.files[0]);
929
- }
930
- }}>Upload Blog (JSON + MD)</button>
1228
+ <button class="btn-primary" @click=${this.handleUpload}>Upload Blog (JSON + MD)</button>
931
1229
 
932
1230
  <div class="file-list">
933
1231
  <h4>Current Blogs (${blogs.length})</h4>
934
- ${blogs.map((b) => html`
935
- <div class="file-item">
936
- <span>${b.key.replace(".json", "")}</span>
937
- <button class="btn-danger" @click=${() => {
1232
+ ${blogs.map((b) => {
938
1233
  const slug = b.key.replace("blogs/", "").replace(".json", "");
939
- this.handleDelete(`blogs/${slug}.json`);
940
- this.handleDelete(`blogs/${slug}.md`);
941
- }}>Delete</button>
942
- </div>
943
- `)}
1234
+ return html`
1235
+ <div class="file-item">
1236
+ <span>${b.key.replace(".json", "")}</span>
1237
+ <button class="btn-danger" @click=${() => this.handleDelete(slug)}>Delete</button>
1238
+ </div>
1239
+ `;
1240
+ })}
944
1241
  ${blogs.length === 0 ? html`<p>No blogs yet.</p>` : ""}
945
1242
  </div>
946
1243
  </div>
947
1244
  `;
948
1245
  }
949
- renderStoriesSection() {
1246
+ }
1247
+ _init$9 = __decoratorStart$9(_a$9);
1248
+ AdminBlogsSection = __decorateElement$9(_init$9, 0, "AdminBlogsSection", _AdminBlogsSection_decorators, AdminBlogsSection);
1249
+ __runInitializers$9(_init$9, 1, AdminBlogsSection);
1250
+ var __create$8 = Object.create;
1251
+ var __defProp$8 = Object.defineProperty;
1252
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
1253
+ var __knownSymbol$8 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1254
+ var __typeError$8 = (msg) => {
1255
+ throw TypeError(msg);
1256
+ };
1257
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1258
+ var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
1259
+ var __decoratorStart$8 = (base) => [, , , __create$8(base?.[__knownSymbol$8("metadata")] ?? null)];
1260
+ var __decoratorStrings$8 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1261
+ var __expectFn$8 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$8("Function expected") : fn;
1262
+ var __decoratorContext$8 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$8[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$8("Already initialized") : fns.push(__expectFn$8(fn || null)) });
1263
+ var __decoratorMetadata$8 = (array, target) => __defNormalProp$8(target, __knownSymbol$8("metadata"), array[3]);
1264
+ var __runInitializers$8 = (array, flags, self, value) => {
1265
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1266
+ return value;
1267
+ };
1268
+ var __decorateElement$8 = (array, flags, name, decorators, target, extra) => {
1269
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1270
+ var j = 0;
1271
+ var extraInitializers = array[j] || (array[j] = []);
1272
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$8(target, name));
1273
+ __name$8(target, name);
1274
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1275
+ ctx = __decoratorContext$8(k2, name, done = {}, array[3], extraInitializers);
1276
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1277
+ __expectFn$8(it) && (target = it);
1278
+ }
1279
+ return __decoratorMetadata$8(array, target), desc && __defProp$8(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1280
+ };
1281
+ var _AdminStoriesSection_decorators, _init$8, _a$8;
1282
+ _AdminStoriesSection_decorators = [customElement("admin-stories-section")];
1283
+ class AdminStoriesSection extends (_a$8 = AdminSection) {
1284
+ async handleUpload() {
1285
+ const metaInput = this.shadowRoot?.querySelector("#storyMetaFile");
1286
+ const contentInput = this.shadowRoot?.querySelector("#storyContentFile");
1287
+ const slugInput = this.shadowRoot?.querySelector("#storySlug");
1288
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
1289
+ try {
1290
+ await this.onUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
1291
+ await this.onUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
1292
+ this.onStatusMessage("Upload successful!");
1293
+ } catch (e2) {
1294
+ this.onStatusMessage("Upload failed.");
1295
+ }
1296
+ }
1297
+ }
1298
+ async handleDelete(slug) {
1299
+ if (!confirm(`Delete story ${slug}?`)) return;
1300
+ try {
1301
+ await this.onDelete(`stories/${slug}.json`);
1302
+ await this.onDelete(`stories/${slug}.md`);
1303
+ } catch (e2) {
1304
+ this.onStatusMessage("Delete failed.");
1305
+ }
1306
+ }
1307
+ render() {
950
1308
  const stories = this.getSectionFiles("stories/").filter((s2) => s2.key.endsWith(".json"));
951
1309
  return html`
952
1310
  <div class="section">
953
1311
  <h3>Stories</h3>
954
1312
  <p class="help-text">Each story needs 2 files: a JSON (metadata) and MD (content) file.</p>
955
-
1313
+
956
1314
  <h4>Upload New Story</h4>
957
1315
  <input type="file" id="storyMetaFile" accept=".json" />
958
1316
  <input type="file" id="storyContentFile" accept=".md" />
959
1317
  <input type="text" id="storySlug" placeholder="Slug (e.g., my-story)" class="mt-1" />
960
- <button class="btn-primary" @click=${() => {
961
- const metaInput = this.shadowRoot?.querySelector("#storyMetaFile");
962
- const contentInput = this.shadowRoot?.querySelector("#storyContentFile");
963
- const slugInput = this.shadowRoot?.querySelector("#storySlug");
964
- if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
965
- this.handleUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
966
- this.handleUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
967
- }
968
- }}>Upload Story (JSON + MD)</button>
1318
+ <button class="btn-primary" @click=${this.handleUpload}>Upload Story (JSON + MD)</button>
969
1319
 
970
1320
  <div class="file-list">
971
1321
  <h4>Current Stories (${stories.length})</h4>
972
- ${stories.map((s2) => html`
973
- <div class="file-item">
974
- <span>${s2.key.replace(".json", "")}</span>
975
- <button class="btn-danger" @click=${() => {
1322
+ ${stories.map((s2) => {
976
1323
  const slug = s2.key.replace("stories/", "").replace(".json", "");
977
- this.handleDelete(`stories/${slug}.json`);
978
- this.handleDelete(`stories/${slug}.md`);
979
- }}>Delete</button>
980
- </div>
981
- `)}
1324
+ return html`
1325
+ <div class="file-item">
1326
+ <span>${s2.key.replace(".json", "")}</span>
1327
+ <button class="btn-danger" @click=${() => this.handleDelete(slug)}>Delete</button>
1328
+ </div>
1329
+ `;
1330
+ })}
982
1331
  ${stories.length === 0 ? html`<p>No stories yet.</p>` : ""}
983
1332
  </div>
984
1333
  </div>
985
1334
  `;
986
1335
  }
987
- renderImagesSection() {
1336
+ }
1337
+ _init$8 = __decoratorStart$8(_a$8);
1338
+ AdminStoriesSection = __decorateElement$8(_init$8, 0, "AdminStoriesSection", _AdminStoriesSection_decorators, AdminStoriesSection);
1339
+ __runInitializers$8(_init$8, 1, AdminStoriesSection);
1340
+ var __create$7 = Object.create;
1341
+ var __defProp$7 = Object.defineProperty;
1342
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
1343
+ var __knownSymbol$7 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1344
+ var __typeError$7 = (msg) => {
1345
+ throw TypeError(msg);
1346
+ };
1347
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1348
+ var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
1349
+ var __decoratorStart$7 = (base) => [, , , __create$7(base?.[__knownSymbol$7("metadata")] ?? null)];
1350
+ var __decoratorStrings$7 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1351
+ var __expectFn$7 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$7("Function expected") : fn;
1352
+ var __decoratorContext$7 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$7[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$7("Already initialized") : fns.push(__expectFn$7(fn || null)) });
1353
+ var __decoratorMetadata$7 = (array, target) => __defNormalProp$7(target, __knownSymbol$7("metadata"), array[3]);
1354
+ var __runInitializers$7 = (array, flags, self, value) => {
1355
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1356
+ return value;
1357
+ };
1358
+ var __decorateElement$7 = (array, flags, name, decorators, target, extra) => {
1359
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1360
+ var j = 0;
1361
+ var extraInitializers = array[j] || (array[j] = []);
1362
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$7(target, name));
1363
+ __name$7(target, name);
1364
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1365
+ ctx = __decoratorContext$7(k2, name, done = {}, array[3], extraInitializers);
1366
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1367
+ __expectFn$7(it) && (target = it);
1368
+ }
1369
+ return __decoratorMetadata$7(array, target), desc && __defProp$7(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1370
+ };
1371
+ var _AdminImagesSection_decorators, _init$7, _a$7;
1372
+ _AdminImagesSection_decorators = [customElement("admin-images-section")];
1373
+ class AdminImagesSection extends (_a$7 = AdminSection) {
1374
+ async handleUpload() {
1375
+ const fileInput = this.shadowRoot?.querySelector("#imageFile");
1376
+ const pathInput = this.shadowRoot?.querySelector("#imagePath");
1377
+ if (fileInput.files?.[0] && pathInput.value) {
1378
+ try {
1379
+ await this.onUpload(`images/${pathInput.value}`, fileInput.files[0]);
1380
+ this.onStatusMessage("Upload successful!");
1381
+ } catch (e2) {
1382
+ this.onStatusMessage("Upload failed.");
1383
+ }
1384
+ }
1385
+ }
1386
+ async handleDelete(key) {
1387
+ if (!confirm(`Delete ${key}?`)) return;
1388
+ try {
1389
+ await this.onDelete(key);
1390
+ } catch (e2) {
1391
+ this.onStatusMessage("Delete failed.");
1392
+ }
1393
+ }
1394
+ render() {
988
1395
  const images = this.getSectionFiles("images/");
989
1396
  return html`
990
1397
  <div class="section">
991
1398
  <h3>Images</h3>
992
1399
  <p class="help-text">Upload images for use in your content. In markdown, reference images by filename only (e.g., use <code>my-photo.jpg</code> not <code>/images/my-photo.jpg</code>). The renderer automatically prepends <code>images/</code>.</p>
993
-
1400
+
994
1401
  <input type="file" id="imageFile" accept="image/*" />
995
1402
  <input type="text" id="imagePath" placeholder="Image name (e.g., profile-photo.jpg)" class="mt-1" />
996
- <button class="btn-primary" @click=${() => {
997
- const fileInput = this.shadowRoot?.querySelector("#imageFile");
998
- const pathInput = this.shadowRoot?.querySelector("#imagePath");
999
- if (fileInput.files?.[0] && pathInput.value) {
1000
- this.handleUpload(`images/${pathInput.value}`, fileInput.files[0]);
1001
- }
1002
- }}>Upload to images/</button>
1403
+ <button class="btn-primary" @click=${this.handleUpload}>Upload to images/</button>
1003
1404
 
1004
1405
  <div class="file-list">
1005
1406
  <h4>Current Images (${images.length})</h4>
@@ -1014,25 +1415,79 @@ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()],
1014
1415
  </div>
1015
1416
  `;
1016
1417
  }
1017
- renderLogoSection() {
1418
+ }
1419
+ _init$7 = __decoratorStart$7(_a$7);
1420
+ AdminImagesSection = __decorateElement$7(_init$7, 0, "AdminImagesSection", _AdminImagesSection_decorators, AdminImagesSection);
1421
+ __runInitializers$7(_init$7, 1, AdminImagesSection);
1422
+ var __create$6 = Object.create;
1423
+ var __defProp$6 = Object.defineProperty;
1424
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
1425
+ var __knownSymbol$6 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1426
+ var __typeError$6 = (msg) => {
1427
+ throw TypeError(msg);
1428
+ };
1429
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1430
+ var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
1431
+ var __decoratorStart$6 = (base) => [, , , __create$6(base?.[__knownSymbol$6("metadata")] ?? null)];
1432
+ var __decoratorStrings$6 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1433
+ var __expectFn$6 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$6("Function expected") : fn;
1434
+ var __decoratorContext$6 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$6[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$6("Already initialized") : fns.push(__expectFn$6(fn || null)) });
1435
+ var __decoratorMetadata$6 = (array, target) => __defNormalProp$6(target, __knownSymbol$6("metadata"), array[3]);
1436
+ var __runInitializers$6 = (array, flags, self, value) => {
1437
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
1438
+ return value;
1439
+ };
1440
+ var __decorateElement$6 = (array, flags, name, decorators, target, extra) => {
1441
+ var it, done, ctx, k2 = flags & 7, p2 = false;
1442
+ var j = 0;
1443
+ var extraInitializers = array[j] || (array[j] = []);
1444
+ var desc = k2 && (target = target.prototype, k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$6(target, name));
1445
+ __name$6(target, name);
1446
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1447
+ ctx = __decoratorContext$6(k2, name, done = {}, array[3], extraInitializers);
1448
+ it = (0, decorators[i2])(target, ctx), done._ = 1;
1449
+ __expectFn$6(it) && (target = it);
1450
+ }
1451
+ return __decoratorMetadata$6(array, target), desc && __defProp$6(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1452
+ };
1453
+ var _AdminLogoSection_decorators, _init$6, _a$6;
1454
+ _AdminLogoSection_decorators = [customElement("admin-logo-section")];
1455
+ class AdminLogoSection extends (_a$6 = AdminSection) {
1456
+ async handleUpload() {
1457
+ const input = this.shadowRoot?.querySelector("#logoFile");
1458
+ if (input.files?.[0]) {
1459
+ try {
1460
+ await this.onUpload("logo.svg", input.files[0]);
1461
+ this.onStatusMessage("Upload successful!");
1462
+ } catch (e2) {
1463
+ this.onStatusMessage("Upload failed.");
1464
+ }
1465
+ }
1466
+ }
1467
+ async handleDelete() {
1468
+ if (!confirm("Delete logo.svg?")) return;
1469
+ try {
1470
+ await this.onDelete("logo.svg");
1471
+ } catch (e2) {
1472
+ this.onStatusMessage("Delete failed.");
1473
+ }
1474
+ }
1475
+ render() {
1018
1476
  const logo = this.getContent("logo.svg");
1019
1477
  return html`
1020
1478
  <div class="section">
1021
1479
  <h3>Site Logo</h3>
1022
1480
  <p class="help-text">Upload your site logo (SVG format recommended). This appears in the header of your site.</p>
1023
-
1481
+
1024
1482
  ${logo ? html`
1025
1483
  <div class="current-file">
1026
1484
  <strong>Current:</strong> logo.svg (${logo.size} bytes)
1027
- <button class="btn-danger" @click=${() => this.handleDelete("logo.svg")}>Delete</button>
1485
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
1028
1486
  </div>
1029
1487
  ` : ""}
1030
1488
 
1031
1489
  <input type="file" id="logoFile" accept=".svg,image/svg+xml" />
1032
- <button class="btn-primary mt-1 mb-1" @click=${() => {
1033
- const input = this.shadowRoot?.querySelector("#logoFile");
1034
- if (input.files?.[0]) this.handleUpload("logo.svg", input.files[0]);
1035
- }}>Upload logo.svg</button>
1490
+ <button class="btn-primary mt-1 mb-1" @click=${this.handleUpload}>Upload logo.svg</button>
1036
1491
 
1037
1492
  <div class="info-box">
1038
1493
  <strong>Tip:</strong> Use an SVG with transparent background. The logo will automatically adapt to light/dark themes.
@@ -1040,70 +1495,412 @@ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()],
1040
1495
  </div>
1041
1496
  `;
1042
1497
  }
1043
- renderStaticSection() {
1498
+ }
1499
+ _init$6 = __decoratorStart$6(_a$6);
1500
+ AdminLogoSection = __decorateElement$6(_init$6, 0, "AdminLogoSection", _AdminLogoSection_decorators, AdminLogoSection);
1501
+ __runInitializers$6(_init$6, 1, AdminLogoSection);
1502
+ var __create$5 = Object.create;
1503
+ var __defProp$5 = Object.defineProperty;
1504
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1505
+ var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1506
+ var __typeError$5 = (msg) => {
1507
+ throw TypeError(msg);
1508
+ };
1509
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1510
+ var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
1511
+ var __decoratorStart$5 = (base) => [, , , __create$5(base?.[__knownSymbol$5("metadata")] ?? null)];
1512
+ var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1513
+ var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
1514
+ var __decoratorContext$5 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$5[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$5("Already initialized") : fns.push(__expectFn$5(fn || null)) });
1515
+ var __decoratorMetadata$5 = (array, target) => __defNormalProp$5(target, __knownSymbol$5("metadata"), array[3]);
1516
+ var __runInitializers$5 = (array, flags, self, value) => {
1517
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
1518
+ return value;
1519
+ };
1520
+ var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
1521
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
1522
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$5[k2 + 5];
1523
+ var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
1524
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$5(k2 < 4 ? target : { get [name]() {
1525
+ return __privateGet$4(this, extra);
1526
+ }, set [name](x) {
1527
+ return __privateSet$4(this, extra, x);
1528
+ } }, name));
1529
+ k2 ? p2 && k2 < 4 && __name$5(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$5(target, name);
1530
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1531
+ ctx = __decoratorContext$5(k2, name, done = {}, array[3], extraInitializers);
1532
+ if (k2) {
1533
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$4(target, x) : (x) => name in x };
1534
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$4 : __privateMethod$4)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
1535
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
1536
+ }
1537
+ it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
1538
+ if (k2 ^ 4 || it === void 0) __expectFn$5(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
1539
+ else if (typeof it !== "object" || it === null) __typeError$5("Object expected");
1540
+ else __expectFn$5(fn = it.get) && (desc.get = fn), __expectFn$5(fn = it.set) && (desc.set = fn), __expectFn$5(fn = it.init) && initializers.unshift(fn);
1541
+ }
1542
+ return k2 || __decoratorMetadata$5(array, target), desc && __defProp$5(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1543
+ };
1544
+ var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
1545
+ var __privateIn$4 = (member, obj) => Object(obj) !== obj ? __typeError$5('Cannot use the "in" operator on this value') : member.has(obj);
1546
+ var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1547
+ var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1548
+ var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1549
+ var __privateMethod$4 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
1550
+ var _localDetails_dec, _a$5, _AdminStaticSection_decorators, _init$5, _localDetails;
1551
+ _AdminStaticSection_decorators = [customElement("admin-static-section")];
1552
+ class AdminStaticSection extends (_a$5 = AdminSection, _localDetails_dec = [state()], _a$5) {
1553
+ constructor() {
1554
+ super(...arguments);
1555
+ __privateAdd$4(this, _localDetails, __runInitializers$5(_init$5, 8, this, { ...this.staticDetails })), __runInitializers$5(_init$5, 11, this);
1556
+ }
1557
+ async handleSave() {
1558
+ const siteTitle = this.shadowRoot?.querySelector("#siteTitle")?.value;
1559
+ const copyright = this.shadowRoot?.querySelector("#copyright")?.value;
1560
+ const linkedin = this.shadowRoot?.querySelector("#linkedin")?.value;
1561
+ const github = this.shadowRoot?.querySelector("#github")?.value;
1562
+ const email = this.shadowRoot?.querySelector("#email")?.value;
1563
+ const data = {};
1564
+ if (siteTitle) data.siteTitle = siteTitle;
1565
+ if (copyright) data.copyright = copyright;
1566
+ if (linkedin) data.linkedin = linkedin;
1567
+ if (github) data.github = github;
1568
+ if (email) data.email = email;
1569
+ try {
1570
+ await this.onUpload("staticdetails.json", new File([JSON.stringify(data)], "staticdetails.json", { type: "application/json" }));
1571
+ this.onStatusMessage("Settings saved!");
1572
+ } catch (e2) {
1573
+ this.onStatusMessage("Failed to save settings.");
1574
+ }
1575
+ }
1576
+ render() {
1044
1577
  return html`
1045
1578
  <div class="section">
1046
1579
  <h3>Site Settings</h3>
1047
1580
  <p class="help-text">Manage your site's static details like title, footer links, etc.</p>
1048
-
1581
+
1049
1582
  <div class="mb-1">
1050
1583
  <label style="display:block;margin-bottom:4px;font-weight:500">Site Title</label>
1051
1584
  <input type="text" id="siteTitle" .value=${this.staticDetails?.siteTitle || ""} />
1052
1585
  </div>
1053
-
1586
+
1054
1587
  <div class="mb-1">
1055
1588
  <label style="display:block;margin-bottom:4px;font-weight:500">Copyright Text</label>
1056
1589
  <input type="text" id="copyright" .value=${this.staticDetails?.copyright || ""} />
1057
1590
  </div>
1058
-
1591
+
1059
1592
  <div class="mb-1">
1060
1593
  <label style="display:block;margin-bottom:4px;font-weight:500">LinkedIn URL</label>
1061
1594
  <input type="text" id="linkedin" .value=${this.staticDetails?.linkedin || ""} />
1062
1595
  </div>
1063
-
1596
+
1064
1597
  <div class="mb-1">
1065
1598
  <label style="display:block;margin-bottom:4px;font-weight:500">GitHub URL</label>
1066
1599
  <input type="text" id="github" .value=${this.staticDetails?.github || ""} />
1067
1600
  </div>
1068
-
1601
+
1069
1602
  <div class="mb-1">
1070
1603
  <label style="display:block;margin-bottom:4px;font-weight:500">Email</label>
1071
1604
  <input type="text" id="email" .value=${this.staticDetails?.email || ""} />
1072
1605
  </div>
1073
-
1074
- <button class="btn-primary" @click=${async () => {
1075
- const siteTitle = this.shadowRoot?.querySelector("#siteTitle")?.value;
1076
- const copyright = this.shadowRoot?.querySelector("#copyright")?.value;
1077
- const linkedin = this.shadowRoot?.querySelector("#linkedin")?.value;
1078
- const github = this.shadowRoot?.querySelector("#github")?.value;
1079
- const email = this.shadowRoot?.querySelector("#email")?.value;
1080
- const data = {};
1081
- if (siteTitle) data.siteTitle = siteTitle;
1082
- if (copyright) data.copyright = copyright;
1083
- if (linkedin) data.linkedin = linkedin;
1084
- if (github) data.github = github;
1085
- if (email) data.email = email;
1086
- try {
1087
- const url = `${this.apiUrl}/content/staticdetails.json`;
1088
- const res = await fetch(url, {
1089
- method: "PUT",
1090
- credentials: "include",
1091
- headers: { "Content-Type": "application/json" },
1092
- body: JSON.stringify(data)
1093
- });
1094
- if (res.ok) {
1095
- this.statusMessage = "Settings saved!";
1096
- this.fetchContent();
1097
- } else {
1098
- this.statusMessage = "Failed to save settings.";
1099
- }
1100
- } catch (e2) {
1101
- this.statusMessage = "Error saving settings.";
1102
- }
1103
- }}>Save Settings</button>
1606
+
1607
+ <button class="btn-primary" @click=${this.handleSave}>Save Settings</button>
1104
1608
  </div>
1105
1609
  `;
1106
1610
  }
1611
+ }
1612
+ _init$5 = __decoratorStart$5(_a$5);
1613
+ _localDetails = /* @__PURE__ */ new WeakMap();
1614
+ __decorateElement$5(_init$5, 4, "localDetails", _localDetails_dec, AdminStaticSection, _localDetails);
1615
+ AdminStaticSection = __decorateElement$5(_init$5, 0, "AdminStaticSection", _AdminStaticSection_decorators, AdminStaticSection);
1616
+ __runInitializers$5(_init$5, 1, AdminStaticSection);
1617
+ var __create$4 = Object.create;
1618
+ var __defProp$4 = Object.defineProperty;
1619
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1620
+ var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
1621
+ var __typeError$4 = (msg) => {
1622
+ throw TypeError(msg);
1623
+ };
1624
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1625
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
1626
+ var __decoratorStart$4 = (base) => [, , , __create$4(base?.[__knownSymbol$4("metadata")] ?? null)];
1627
+ var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
1628
+ var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
1629
+ var __decoratorContext$4 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$4[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$4("Already initialized") : fns.push(__expectFn$4(fn || null)) });
1630
+ var __decoratorMetadata$4 = (array, target) => __defNormalProp$4(target, __knownSymbol$4("metadata"), array[3]);
1631
+ var __runInitializers$4 = (array, flags, self, value) => {
1632
+ for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
1633
+ return value;
1634
+ };
1635
+ var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
1636
+ var fn, it, done, ctx, access, k2 = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
1637
+ var j = k2 > 3 ? array.length + 1 : k2 ? s2 ? 1 : 2 : 0, key = __decoratorStrings$4[k2 + 5];
1638
+ var initializers = k2 > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
1639
+ var desc = k2 && (!p2 && !s2 && (target = target.prototype), k2 < 5 && (k2 > 3 || !p2) && __getOwnPropDesc$4(k2 < 4 ? target : { get [name]() {
1640
+ return __privateGet$3(this, extra);
1641
+ }, set [name](x) {
1642
+ return __privateSet$3(this, extra, x);
1643
+ } }, name));
1644
+ k2 ? p2 && k2 < 4 && __name$4(extra, (k2 > 2 ? "set " : k2 > 1 ? "get " : "") + name) : __name$4(target, name);
1645
+ for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
1646
+ ctx = __decoratorContext$4(k2, name, done = {}, array[3], extraInitializers);
1647
+ if (k2) {
1648
+ ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$3(target, x) : (x) => name in x };
1649
+ if (k2 ^ 3) access.get = p2 ? (x) => (k2 ^ 1 ? __privateGet$3 : __privateMethod$3)(x, target, k2 ^ 4 ? extra : desc.get) : (x) => x[name];
1650
+ if (k2 > 2) access.set = p2 ? (x, y2) => __privateSet$3(x, target, y2, k2 ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
1651
+ }
1652
+ it = (0, decorators[i2])(k2 ? k2 < 4 ? p2 ? extra : desc[key] : k2 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
1653
+ if (k2 ^ 4 || it === void 0) __expectFn$4(it) && (k2 > 4 ? initializers.unshift(it) : k2 ? p2 ? extra = it : desc[key] = it : target = it);
1654
+ else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
1655
+ else __expectFn$4(fn = it.get) && (desc.get = fn), __expectFn$4(fn = it.set) && (desc.set = fn), __expectFn$4(fn = it.init) && initializers.unshift(fn);
1656
+ }
1657
+ return k2 || __decoratorMetadata$4(array, target), desc && __defProp$4(target, name, desc), p2 ? k2 ^ 4 ? extra : desc : target;
1658
+ };
1659
+ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
1660
+ var __privateIn$3 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
1661
+ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1662
+ var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1663
+ var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1664
+ var __privateMethod$3 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
1665
+ var _loginError_dec, _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isLoading_dec, _isSetup_dec, _isAuthenticated_dec, _a$4, _AdminPortal_decorators, _init$4, _isAuthenticated, _isSetup, _isLoading, _contentList, _statusMessage, _activeSection, _staticDetails, _loginError;
1666
+ _AdminPortal_decorators = [customElement("admin-portal")];
1667
+ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()], _isSetup_dec = [state()], _isLoading_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _loginError_dec = [state()], _a$4) {
1668
+ constructor() {
1669
+ super();
1670
+ __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 8, this, false)), __runInitializers$4(_init$4, 11, this);
1671
+ __privateAdd$3(this, _isSetup, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
1672
+ __privateAdd$3(this, _isLoading, __runInitializers$4(_init$4, 16, this, true)), __runInitializers$4(_init$4, 19, this);
1673
+ __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 20, this, [])), __runInitializers$4(_init$4, 23, this);
1674
+ __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 24, this, "")), __runInitializers$4(_init$4, 27, this);
1675
+ __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 28, this, "profile")), __runInitializers$4(_init$4, 31, this);
1676
+ __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 32, this, {})), __runInitializers$4(_init$4, 35, this);
1677
+ __privateAdd$3(this, _loginError, __runInitializers$4(_init$4, 36, this, "")), __runInitializers$4(_init$4, 39, this);
1678
+ this.apiService = void 0;
1679
+ const apiUrl = window.location.origin;
1680
+ this.apiService = new AdminApiService(apiUrl);
1681
+ }
1682
+ hasSessionCookie() {
1683
+ return document.cookie.includes("session=");
1684
+ }
1685
+ async connectedCallback() {
1686
+ super.connectedCallback();
1687
+ await this.checkAuthStatus();
1688
+ this.requestUpdate();
1689
+ }
1690
+ async checkAuthStatus() {
1691
+ try {
1692
+ const status = await this.apiService.checkAuthStatus();
1693
+ this.isSetup = status.configured;
1694
+ if (status.configured && this.hasSessionCookie()) {
1695
+ await this.tryAutoLogin();
1696
+ }
1697
+ } catch (e2) {
1698
+ console.error("Auth status check failed:", e2);
1699
+ } finally {
1700
+ this.isLoading = false;
1701
+ }
1702
+ }
1703
+ async tryAutoLogin() {
1704
+ try {
1705
+ this.contentList = await this.apiService.tryAutoLogin();
1706
+ this.isAuthenticated = true;
1707
+ } catch (e2) {
1708
+ console.error("Auto login failed:", e2);
1709
+ }
1710
+ }
1711
+ async handleLogin(e2) {
1712
+ const { username, password } = e2.detail;
1713
+ this.loginError = "";
1714
+ if (!username || !password) {
1715
+ this.loginError = "Username and password required";
1716
+ return;
1717
+ }
1718
+ try {
1719
+ await this.apiService.login(username, password);
1720
+ this.isAuthenticated = true;
1721
+ await this.fetchContent();
1722
+ } catch (e22) {
1723
+ this.loginError = e22.message;
1724
+ }
1725
+ }
1726
+ async handleSetup(e2) {
1727
+ const { username, password, confirmPassword } = e2.detail;
1728
+ this.loginError = "";
1729
+ if (!username || !password) {
1730
+ this.loginError = "Username and password required";
1731
+ return;
1732
+ }
1733
+ if (username.length < 3) {
1734
+ this.loginError = "Username must be at least 3 characters";
1735
+ return;
1736
+ }
1737
+ if (password.length < 8) {
1738
+ this.loginError = "Password must be at least 8 characters";
1739
+ return;
1740
+ }
1741
+ if (password !== confirmPassword) {
1742
+ this.loginError = "Passwords do not match";
1743
+ return;
1744
+ }
1745
+ try {
1746
+ await this.apiService.setup(username, password);
1747
+ this.isAuthenticated = true;
1748
+ this.isSetup = true;
1749
+ await this.fetchContent();
1750
+ } catch (e22) {
1751
+ this.loginError = e22.message;
1752
+ }
1753
+ }
1754
+ async handleLogout() {
1755
+ try {
1756
+ await this.apiService.logout();
1757
+ } catch (e2) {
1758
+ }
1759
+ this.isAuthenticated = false;
1760
+ this.contentList = [];
1761
+ }
1762
+ async fetchContent() {
1763
+ try {
1764
+ this.contentList = await this.apiService.fetchContent();
1765
+ } catch (e2) {
1766
+ this.statusMessage = "Error fetching content.";
1767
+ }
1768
+ }
1769
+ async fetchStaticDetails() {
1770
+ try {
1771
+ this.staticDetails = await this.apiService.fetchStaticDetails();
1772
+ } catch (e2) {
1773
+ }
1774
+ }
1775
+ async handleUpload(key, file) {
1776
+ try {
1777
+ this.statusMessage = "Uploading...";
1778
+ await this.apiService.uploadContent(key, file);
1779
+ this.statusMessage = "Upload successful!";
1780
+ await this.fetchContent();
1781
+ } catch (e2) {
1782
+ this.statusMessage = "Error uploading.";
1783
+ }
1784
+ }
1785
+ async handleClearCache() {
1786
+ try {
1787
+ this.statusMessage = "Clearing cache...";
1788
+ await this.apiService.clearCache();
1789
+ this.statusMessage = "Cache cleared!";
1790
+ } catch (e2) {
1791
+ this.statusMessage = "Error clearing cache.";
1792
+ }
1793
+ }
1794
+ async handleDelete(key) {
1795
+ try {
1796
+ await this.apiService.deleteContent(key);
1797
+ await this.fetchContent();
1798
+ } catch (e2) {
1799
+ this.statusMessage = "Error deleting.";
1800
+ }
1801
+ }
1802
+ handleStatusMessage(message) {
1803
+ this.statusMessage = message;
1804
+ }
1805
+ renderHomeSection() {
1806
+ return html`
1807
+ <admin-home-section
1808
+ .contentList=${this.contentList}
1809
+ .onUpload=${this.handleUpload.bind(this)}
1810
+ .onDelete=${this.handleDelete.bind(this)}
1811
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1812
+ ></admin-home-section>
1813
+ `;
1814
+ }
1815
+ renderProfileSection() {
1816
+ return html`
1817
+ <admin-profile-section
1818
+ .contentList=${this.contentList}
1819
+ .onUpload=${this.handleUpload.bind(this)}
1820
+ .onDelete=${this.handleDelete.bind(this)}
1821
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1822
+ ></admin-profile-section>
1823
+ `;
1824
+ }
1825
+ renderAboutMeSection() {
1826
+ return html`
1827
+ <admin-about-me-section
1828
+ .contentList=${this.contentList}
1829
+ .onUpload=${this.handleUpload.bind(this)}
1830
+ .onDelete=${this.handleDelete.bind(this)}
1831
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1832
+ ></admin-about-me-section>
1833
+ `;
1834
+ }
1835
+ renderBlogsSection() {
1836
+ return html`
1837
+ <admin-blogs-section
1838
+ .contentList=${this.contentList}
1839
+ .onUpload=${this.handleUpload.bind(this)}
1840
+ .onDelete=${this.handleDelete.bind(this)}
1841
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1842
+ ></admin-blogs-section>
1843
+ `;
1844
+ }
1845
+ renderStoriesSection() {
1846
+ return html`
1847
+ <admin-stories-section
1848
+ .contentList=${this.contentList}
1849
+ .onUpload=${this.handleUpload.bind(this)}
1850
+ .onDelete=${this.handleDelete.bind(this)}
1851
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1852
+ ></admin-stories-section>
1853
+ `;
1854
+ }
1855
+ renderImagesSection() {
1856
+ return html`
1857
+ <admin-images-section
1858
+ .contentList=${this.contentList}
1859
+ .onUpload=${this.handleUpload.bind(this)}
1860
+ .onDelete=${this.handleDelete.bind(this)}
1861
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1862
+ ></admin-images-section>
1863
+ `;
1864
+ }
1865
+ renderLogoSection() {
1866
+ return html`
1867
+ <admin-logo-section
1868
+ .contentList=${this.contentList}
1869
+ .onUpload=${this.handleUpload.bind(this)}
1870
+ .onDelete=${this.handleDelete.bind(this)}
1871
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1872
+ ></admin-logo-section>
1873
+ `;
1874
+ }
1875
+ renderStaticSection() {
1876
+ return html`
1877
+ <admin-static-section
1878
+ .contentList=${this.contentList}
1879
+ .staticDetails=${this.staticDetails}
1880
+ .onUpload=${this.handleUpload.bind(this)}
1881
+ .onDelete=${this.handleDelete.bind(this)}
1882
+ .onStatusMessage=${this.handleStatusMessage.bind(this)}
1883
+ ></admin-static-section>
1884
+ `;
1885
+ }
1886
+ renderLoginForm() {
1887
+ return html`
1888
+ <admin-login-form
1889
+ .errorMessage=${this.loginError}
1890
+ .isSetup=${false}
1891
+ @login-submit=${this.handleSetup}
1892
+ ></admin-login-form>
1893
+ `;
1894
+ }
1895
+ renderLogin() {
1896
+ return html`
1897
+ <admin-login-form
1898
+ .errorMessage=${this.loginError}
1899
+ .isSetup=${true}
1900
+ @login-submit=${this.handleLogin}
1901
+ ></admin-login-form>
1902
+ `;
1903
+ }
1107
1904
  render() {
1108
1905
  if (this.isLoading) {
1109
1906
  return html`<div class="container"><div class="loading">Loading...</div></div>`;
@@ -1121,11 +1918,11 @@ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()],
1121
1918
  <button class="btn-secondary" @click=${() => this.handleLogout()}>Logout</button>
1122
1919
  <button class="btn-secondary" @click=${() => this.handleClearCache()}>Clear Cache</button>
1123
1920
  </div>
1124
-
1921
+
1125
1922
  <div class="nav-tabs">
1126
- <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
1923
+ <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
1127
1924
  @click=${() => this.activeSection = "home"}>Home</button>
1128
- <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
1925
+ <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
1129
1926
  @click=${() => this.activeSection = "profile"}>Profile</button>
1130
1927
  <button class="nav-tab ${this.activeSection === "aboutme" ? "active" : ""}"
1131
1928
  @click=${() => this.activeSection = "aboutme"}>About Me</button>
@@ -1182,6 +1979,7 @@ __decorateElement$4(_init$4, 4, "loginError", _loginError_dec, AdminPortal, _log
1182
1979
  AdminPortal = __decorateElement$4(_init$4, 0, "AdminPortal", _AdminPortal_decorators, AdminPortal);
1183
1980
  AdminPortal.styles = adminStyles;
1184
1981
  __runInitializers$4(_init$4, 1, AdminPortal);
1982
+ const adminLoaded = true;
1185
1983
  const bannerStyles = css`
1186
1984
  :host {
1187
1985
  display: block;
@@ -1805,7 +2603,7 @@ class BlogViewer extends (_a$1 = LitElement, _slug_dec$1 = [property({ type: Str
1805
2603
  __privateAdd$1(this, _error$1, __runInitializers$1(_init$1, 20, this, "")), __runInitializers$1(_init$1, 23, this);
1806
2604
  }
1807
2605
  get apiBaseUrl() {
1808
- return "https://api.techieleader.com";
2606
+ return this.getAttribute("api-url") || window.__VITE_API_URL__ || void 0 || "https://api.exampledomain.com";
1809
2607
  }
1810
2608
  connectedCallback() {
1811
2609
  super.connectedCallback();
@@ -2004,7 +2802,7 @@ class StoryViewer extends (_a = LitElement, _slug_dec = [property({ type: String
2004
2802
  __privateAdd(this, _error, __runInitializers(_init, 20, this, "")), __runInitializers(_init, 23, this);
2005
2803
  }
2006
2804
  get apiBaseUrl() {
2007
- return "https://api.techieleader.com";
2805
+ return this.getAttribute("api-url") || window.__VITE_API_URL__ || void 0 || "https://api.exampledomain.com";
2008
2806
  }
2009
2807
  async connectedCallback() {
2010
2808
  super.connectedCallback();
@@ -2084,10 +2882,20 @@ StoryViewer = __decorateElement(_init, 0, "StoryViewer", _StoryViewer_decorators
2084
2882
  StoryViewer.styles = storyviewerStyles;
2085
2883
  __runInitializers(_init, 1, StoryViewer);
2086
2884
  export {
2087
- AdminPortal as A,
2885
+ AdminAboutMeSection as A,
2088
2886
  BlogViewer as B,
2089
2887
  FooterComponent as F,
2090
2888
  MyAboutme as M,
2091
2889
  StoryViewer as S,
2092
- MyBanner as a
2890
+ AdminBlogsSection as a,
2891
+ AdminHomeSection as b,
2892
+ AdminImagesSection as c,
2893
+ AdminLoginForm as d,
2894
+ AdminLogoSection as e,
2895
+ AdminPortal as f,
2896
+ AdminProfileSection as g,
2897
+ AdminStaticSection as h,
2898
+ AdminStoriesSection as i,
2899
+ MyBanner as j,
2900
+ adminLoaded as k
2093
2901
  };