@mhmo91/schmancy 0.4.97 → 0.5.1

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 (35) hide show
  1. package/dist/area.cjs +1 -1
  2. package/dist/{area.component-5hvsA6_h.js → area.component-Oe5ARA8j.js} +37 -25
  3. package/dist/area.component-Oe5ARA8j.js.map +1 -0
  4. package/dist/area.component-VxW9QIje.cjs +12 -0
  5. package/dist/area.component-VxW9QIje.cjs.map +1 -0
  6. package/dist/area.js +19 -17
  7. package/dist/{avatar-B51KRC34.cjs → avatar-8S9Tq43j.cjs} +2 -2
  8. package/dist/{avatar-B51KRC34.cjs.map → avatar-8S9Tq43j.cjs.map} +1 -1
  9. package/dist/{avatar-Dpy9JzIW.js → avatar-KoZsr-CS.js} +2 -2
  10. package/dist/{avatar-Dpy9JzIW.js.map → avatar-KoZsr-CS.js.map} +1 -1
  11. package/dist/badge.cjs +1 -1
  12. package/dist/badge.js +1 -1
  13. package/dist/content-drawer.cjs +1 -1
  14. package/dist/content-drawer.js +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +213 -211
  17. package/dist/nav-drawer.cjs +1 -1
  18. package/dist/nav-drawer.js +1 -1
  19. package/dist/teleport.cjs +1 -1
  20. package/dist/teleport.js +1 -1
  21. package/dist/{lazy-DObpkuL6.cjs → utils-C38P63L6.cjs} +2 -2
  22. package/dist/utils-C38P63L6.cjs.map +1 -0
  23. package/dist/{lazy-E2LCDm7n.js → utils-CYOVFxSx.js} +68 -60
  24. package/dist/utils-CYOVFxSx.js.map +1 -0
  25. package/package.json +4 -236
  26. package/types/src/area/area.component.d.ts +2 -4
  27. package/types/src/area/index.d.ts +3 -2
  28. package/types/src/area/route.component.d.ts +3 -7
  29. package/types/src/area/router.types.d.ts +2 -3
  30. package/types/src/area/utils.d.ts +2 -2
  31. package/dist/area.component-5hvsA6_h.js.map +0 -1
  32. package/dist/area.component-DSAxybsX.cjs +0 -12
  33. package/dist/area.component-DSAxybsX.cjs.map +0 -1
  34. package/dist/lazy-DObpkuL6.cjs.map +0 -1
  35. package/dist/lazy-E2LCDm7n.js.map +0 -1
package/dist/area.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./area.component-DSAxybsX.cjs"),e=require("./lazy-DObpkuL6.cjs");exports.FINDING_MORTIES=t.FINDING_MORTIES,exports.HERE_RICKY=t.HERE_RICKY,exports.HISTORY_STRATEGY=t.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>t.SchmancyArea}),Object.defineProperty(exports,"SchmancyRoute",{enumerable:!0,get:()=>t.SchmancyRoute}),exports.area=t.area,exports.routerHistory=t.routerHistory,exports.buildQueryString=e.buildQueryString,exports.compareActiveRoutes=e.compareActiveRoutes,exports.compareCustomElementConstructors=e.compareCustomElementConstructors,exports.compareRouteActions=e.compareRouteActions,exports.createRouteCacheKey=e.createRouteCacheKey,exports.debounce=e.debounce,exports.decodeRouteState=e.decodeRouteState,exports.deepMerge=e.deepMerge,exports.encodeRouteState=e.encodeRouteState,exports.extractQueryParams=e.extractQueryParams,exports.getTagName=e.getTagName,exports.isObject=e.isObject,exports.lazy=e.lazy,exports.normalizeTagName=e.normalizeTagName,exports.sanitizeRouteState=e.sanitizeRouteState;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./area.component-VxW9QIje.cjs"),e=require("./utils-C38P63L6.cjs");exports.FINDING_MORTIES=t.FINDING_MORTIES,exports.HERE_RICKY=t.HERE_RICKY,exports.HISTORY_STRATEGY=t.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>t.SchmancyArea}),Object.defineProperty(exports,"SchmancyRoute",{enumerable:!0,get:()=>t.SchmancyRoute}),exports.area=t.area,exports.routerHistory=t.routerHistory,exports.buildQueryString=e.buildQueryString,exports.compareActiveRoutes=e.compareActiveRoutes,exports.compareCustomElementConstructors=e.compareCustomElementConstructors,exports.compareRouteActions=e.compareRouteActions,exports.createRouteCacheKey=e.createRouteCacheKey,exports.debounce=e.debounce,exports.decodeData=e.decodeData,exports.decodeRouteState=e.decodeRouteState,exports.deepMerge=e.deepMerge,exports.encodeData=e.encodeData,exports.encodeRouteState=e.encodeRouteState,exports.extractQueryParams=e.extractQueryParams,exports.getTagName=e.getTagName,exports.isObject=e.isObject,exports.lazy=e.lazy,exports.normalizeTagName=e.normalizeTagName,exports.sanitizeRouteState=e.sanitizeRouteState;
2
2
  //# sourceMappingURL=area.cjs.map
@@ -1,11 +1,11 @@
1
- import { Subject as B, ReplaySubject as R, fromEvent as P, distinctUntilChanged as y, shareReplay as U, skip as q, map as c, filter as l, catchError as d, EMPTY as m, zip as F, of as f, bufferTime as T, tap as x, timeout as _, merge as W, take as z, switchMap as $, takeUntil as D } from "rxjs";
1
+ import { Subject as W, ReplaySubject as R, fromEvent as P, distinctUntilChanged as y, shareReplay as U, skip as q, map as c, filter as l, catchError as d, EMPTY as m, zip as B, of as f, bufferTime as F, tap as x, timeout as T, merge as _, take as z, switchMap as $, takeUntil as D } from "rxjs";
2
2
  import "lit/directives/class-map.js";
3
3
  import "lit/directives/style-map.js";
4
4
  import { property as O, customElement as L, queryAssignedElements as Q } from "lit/decorators.js";
5
5
  import "./tailwind.mixin-DRrIaNCZ.js";
6
6
  import { $ as M } from "./litElement.mixin-CAQ8pH9g.js";
7
7
  import { css as H, html as I } from "lit";
8
- const J = new B(), Y = "FINDING_MORTIES", G = "HERE_RICKY", k = /* @__PURE__ */ new WeakMap();
8
+ const J = new W(), Y = "FINDING_MORTIES", G = "HERE_RICKY", k = /* @__PURE__ */ new WeakMap();
9
9
  class E {
10
10
  constructor() {
11
11
  this.prettyURL = !1, this.mode = "HISTORY", this.request = new R(1), this.current = /* @__PURE__ */ new Map(), this.$current = new R(1), this.enableHistoryMode = !0, this.findingMortiesEvent = new CustomEvent(Y), this.disposed = !1, this.isProcessingPopstate = !1, this.$current.next(this.current), this.$current.subscribe((e) => {
@@ -68,7 +68,7 @@ class E {
68
68
  return this.props(e).pipe(c((r) => r[t]), l((r) => r !== void 0), y(), c((r) => r), d((r) => m));
69
69
  }
70
70
  find() {
71
- return F([P(window, G).pipe(c((e) => e.detail), T(0)), f(1).pipe(x(() => window.dispatchEvent(this.findingMortiesEvent)))]).pipe(c(([e]) => e), _(1), d(() => m));
71
+ return B([P(window, G).pipe(c((e) => e.detail), F(0)), f(1).pipe(x(() => window.dispatchEvent(this.findingMortiesEvent)))]).pipe(c(([e]) => e), T(1), d(() => m));
72
72
  }
73
73
  push(e) {
74
74
  if (!e.area) throw new Error("Area is required for route action");
@@ -104,8 +104,8 @@ class E {
104
104
  if (i) {
105
105
  let u = a === "/" ? `/${i.component}` : `${a}${i.component}`;
106
106
  const v = new URLSearchParams(p);
107
- i.params && Object.entries(i.params).forEach(([w, N]) => {
108
- typeof N != "string" && typeof N != "number" || v.set(w, String(N));
107
+ i.params && Object.entries(i.params).forEach(([b, N]) => {
108
+ typeof N != "string" && typeof N != "number" || v.set(b, String(N));
109
109
  });
110
110
  const h = v.toString();
111
111
  return u + (h ? `?${h}` : "");
@@ -114,8 +114,8 @@ class E {
114
114
  try {
115
115
  const i = {};
116
116
  if (Object.entries(e).forEach(([v, h]) => {
117
- const w = { component: h.component };
118
- h.state && Object.keys(h.state).length > 0 && (w.state = h.state), h.params && Object.keys(h.params).length > 0 && (w.params = h.params), h.props && Object.keys(h.props).length > 0 && (w.props = h.props), i[v] = w;
117
+ const b = { component: h.component };
118
+ h.state && Object.keys(h.state).length > 0 && (b.state = h.state), h.params && Object.keys(h.params).length > 0 && (b.params = h.params), h.props && Object.keys(h.props).length > 0 && (b.props = h.props), i[v] = b;
119
119
  }), Object.keys(i).length === 0)
120
120
  return `${a === "/" ? "" : a.replace(/\/$/, "")}${p}`;
121
121
  const u = encodeURIComponent(JSON.stringify(i));
@@ -207,7 +207,7 @@ let g = class extends M(H`
207
207
  }
208
208
  };
209
209
  A([O({ type: String })], g.prototype, "when", 2), A([O({ type: Object })], g.prototype, "component", 2), A([O({ type: Boolean })], g.prototype, "exact", 2), A([O({ type: Object })], g.prototype, "guard", 2), g = A([L("schmancy-route")], g);
210
- var b = ((s) => (s.push = "push", s.replace = "replace", s.pop = "pop", s.silent = "silent", s))(b || {}), X = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, C = (s, e, t, r) => {
210
+ var w = ((s) => (s.push = "push", s.replace = "replace", s.pop = "pop", s.silent = "silent", s))(w || {}), X = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, C = (s, e, t, r) => {
211
211
  for (var n, a = r > 1 ? void 0 : r ? Z(e, t) : e, o = s.length - 1; o >= 0; o--) (n = s[o]) && (a = (r ? n(e, t, a) : n(a)) || a);
212
212
  return r && a && X(e, t, a), a;
213
213
  };
@@ -220,37 +220,49 @@ let j = class extends M(H`
220
220
  `) {
221
221
  firstUpdated() {
222
222
  if (!this.name) throw new Error("Area name is required");
223
- W(S.request.pipe(l(({ area: s }) => s === this.name)), f(location.pathname).pipe(z(1), $(() => {
223
+ _(S.request.pipe(l(({ area: s }) => s === this.name), c((s) => {
224
+ if (typeof s.component == "string") {
225
+ const e = this.routes?.find((t) => t.when === s.component);
226
+ if (e) return { ...s, component: e.component, originalWhen: e.when };
227
+ }
228
+ return s;
229
+ })), f(location.pathname).pipe(z(1), $(() => {
224
230
  const s = location.pathname, e = s.split("/").pop() || "";
225
231
  let t, r;
226
232
  if (e && (e.includes("{") || e.includes("%7B"))) try {
227
233
  const a = JSON.parse(decodeURIComponent(e));
228
234
  if (a[this.name]) {
229
235
  const o = a[this.name];
230
- return t = this.routes?.find((p) => p.when === o.component), r = o.component, f(t ? { area: this.name, component: t.component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: b.replace, originalWhen: r } : { area: this.name, component: a[this.name].component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: b.replace, originalWhen: a[this.name].component });
236
+ return t = this.routes?.find((p) => p.when === o.component), r = t?.when || o.component, f(t ? { area: this.name, component: t.component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: w.replace, originalWhen: r } : { area: this.name, component: a[this.name].component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: w.replace, originalWhen: o.component });
231
237
  }
232
238
  } catch {
233
239
  }
234
240
  const n = s.split("/").filter(Boolean);
235
- return t = this.routes?.find((a) => n.includes(a.when)), r = t?.when, t ? f({ area: this.name, component: t.component, state: {}, params: {}, historyStrategy: b.silent, originalWhen: r }) : this.default ? f({ area: this.name, component: this.default, state: {}, params: {}, historyStrategy: b.silent }) : m;
236
- })), P(window, "popstate").pipe(c((s) => s.state?.schmancyAreas?.[this.name] ? { area: this.name, component: s.state.schmancyAreas[this.name].component, state: s.state.schmancyAreas[this.name].state || {}, params: s.state.schmancyAreas[this.name].params || {}, historyStrategy: b.pop } : null), l((s) => s !== null))).pipe(l((s) => s?.component !== void 0), $(async (s) => {
241
+ return t = this.routes?.find((a) => n.includes(a.when)), r = t?.when, t ? f({ area: this.name, component: t.component, state: {}, params: {}, historyStrategy: w.silent, originalWhen: r }) : this.default ? f({ area: this.name, component: this.default, state: {}, params: {}, historyStrategy: w.silent }) : m;
242
+ })), P(window, "popstate").pipe(c((s) => {
243
+ if (s.state?.schmancyAreas?.[this.name]) {
244
+ const e = s.state.schmancyAreas[this.name], t = e.component, r = this.routes?.find((n) => n.when === t);
245
+ return { area: this.name, component: r ? r.component : t, state: e.state || {}, params: e.params || {}, historyStrategy: w.pop, originalWhen: t };
246
+ }
247
+ return null;
248
+ }), l((s) => s !== null))).pipe(l((s) => s?.component !== void 0), $(async (s) => {
237
249
  let e = s.component;
238
250
  if (typeof e == "function" && ("preload" in e || "_promise" in e || "_module" in e)) try {
239
251
  e = (await e()).default;
240
252
  } catch {
241
253
  return { component: null, route: s };
242
254
  }
243
- return { component: e, route: s };
255
+ return { component: e, route: { ...s, originalWhen: s.originalWhen } };
244
256
  }), c(({ component: s, route: e }) => {
245
257
  let t = "";
246
- return s && s !== "" ? typeof s == "string" ? t = s : s instanceof HTMLElement ? t = s.tagName : typeof s == "function" && (t = s.name || "CustomElement") : t = "null", { component: s, route: e, key: `${t}${JSON.stringify(e.params)}${JSON.stringify(e.state)}`, tagName: t };
258
+ return s && s !== "" ? typeof s == "string" ? t = s : s instanceof HTMLElement ? t = s.tagName : typeof s == "function" && (t = s.name || "CustomElement") : t = "null", { component: s, route: e, key: `${t}${JSON.stringify(e.params)}${JSON.stringify(e.state)}`, tagName: t, originalWhen: e?.originalWhen || t };
247
259
  }), y((s, e) => s.key === e.key), $((s) => {
248
- const e = this.routes.find((t) => t.when === s.tagName);
249
- return e?.guard ? e.guard.pipe(x((t) => {
250
- }), $((t) => {
251
- if (t === !0) return f(s);
252
- const r = new CustomEvent("redirect", { detail: { blockedRoute: s.tagName, area: this.name, params: s.route?.params || {}, state: s.route?.state || {}, redirectTarget: typeof t == "object" ? t : void 0 }, bubbles: !0, composed: !0 });
253
- return e.dispatchEvent(r), m;
260
+ const e = s.originalWhen || s.tagName, t = this.routes.find((r) => r.when === e);
261
+ return t?.guard ? t.guard.pipe(x((r) => {
262
+ }), $((r) => {
263
+ if (r === !0) return f(s);
264
+ const n = new CustomEvent("redirect", { detail: { blockedRoute: s.tagName, area: this.name, params: s.route?.params || {}, state: s.route?.state || {}, redirectTarget: typeof r == "object" ? r : void 0 }, bubbles: !0, composed: !0 });
265
+ return t.dispatchEvent(n), m;
254
266
  })) : f(s);
255
267
  }), c(({ component: s, route: e }) => {
256
268
  let t = null;
@@ -279,7 +291,7 @@ let j = class extends M(H`
279
291
  }
280
292
  if (S.enableHistoryMode && s) {
281
293
  const r = { component: s.tagName.toLowerCase(), state: e.state || {}, area: this.name, params: e.params || {} };
282
- S._updateBrowserHistory(this.name, r, e.historyStrategy || b.push, e.clearQueryParams);
294
+ S._updateBrowserHistory(this.name, r, e.historyStrategy || w.push, e.clearQueryParams);
283
295
  }
284
296
  } else t && t.remove();
285
297
  }
@@ -312,9 +324,9 @@ export {
312
324
  Y as F,
313
325
  G as H,
314
326
  j as S,
315
- g as a,
316
- S as b,
317
- b as c,
327
+ S as a,
328
+ g as b,
329
+ w as c,
318
330
  J as r
319
331
  };
320
- //# sourceMappingURL=area.component-5hvsA6_h.js.map
332
+ //# sourceMappingURL=area.component-Oe5ARA8j.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area.component-Oe5ARA8j.js","sources":["../src/area/area.service.ts","../src/area/route.component.ts","../src/area/router.types.ts","../src/area/area.component.ts"],"sourcesContent":["import {\n\tbufferTime,\n\tcatchError,\n\tdistinctUntilChanged,\n\tEMPTY,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tObservable,\n\tof,\n\tReplaySubject,\n\tshareReplay,\n\tskip,\n\tSubject,\n\tSubscription,\n\ttap,\n\ttimeout,\n\tzip\n} from 'rxjs'\nimport { SchmancyTeleportation } from '../teleport'\nimport { ActiveRoute, AreaSubscription, RouteAction } from './router.types'\n\nexport const routerHistory = new Subject<RouteAction>()\n\nexport const FINDING_MORTIES = 'FINDING_MORTIES'\nexport const HERE_RICKY = 'HERE_RICKY'\nexport type HERE_RICKY_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\nexport type FINDING_MORTIES_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\n\n// WeakMap for better memory management of area subjects\nconst areaSubjectsCache = new WeakMap<AreaService, Map<string, ReplaySubject<ActiveRoute>>>()\n\n// Track navigation source to prevent history conflicts\ntype NavigationSource = 'programmatic' | 'browser' | 'initial'\n\nclass AreaService implements AreaSubscription {\n\tprivate static instance: AreaService\n\tpublic prettyURL = false\n\tpublic mode: 'SILENT' | 'HISTORY' = 'HISTORY'\n\tpublic request = new ReplaySubject<RouteAction>(1)\n\tpublic current = new Map<string, ActiveRoute>()\n\tpublic $current = new ReplaySubject<Map<string, ActiveRoute>>(1)\n\t\n\t// Create a dictionary of ReplaySubjects for area-specific subscriptions\n\tprivate get areaSubjects(): Map<string, ReplaySubject<ActiveRoute>> {\n\t\tlet subjects = areaSubjectsCache.get(this)\n\t\tif (!subjects) {\n\t\t\tsubjects = new Map()\n\t\t\tareaSubjectsCache.set(this, subjects)\n\t\t}\n\t\treturn subjects\n\t}\n\t\n\tpublic enableHistoryMode = true\n\tprivate findingMortiesEvent = new CustomEvent<FINDING_MORTIES_EVENT['detail']>(FINDING_MORTIES)\n\tprivate disposed = false\n\tpublic isProcessingPopstate = false\n\tprivate unloadSubscription?: Subscription\n\n\tconstructor() {\n\t\tthis.$current.next(this.current)\n\t\t\n\t\t// Subscribe to current changes to update area-specific subjects\n\t\tthis.$current.subscribe(currentAreas => {\n\t\t\tif (this.disposed) return\n\t\t\t\n\t\t\t// For each area in the current map\n\t\t\tcurrentAreas.forEach((route, areaName) => {\n\t\t\t\t// Get or create a subject for this area\n\t\t\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\t\t\t// Emit the updated route to area-specific subscribers\n\t\t\t\tareaSubject.next(route)\n\t\t\t})\n\t\t})\n\n\t\t// Initialize from browser state if available\n\t\tthis.initializeFromBrowserState()\n\n\t\t// Setup unload subscription using RxJS\n\t\tif (typeof window !== 'undefined') {\n\t\t\tthis.unloadSubscription = fromEvent(window, 'unload').subscribe(() => {\n\t\t\t\tthis.dispose()\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Initialize router state from browser history state\n\t */\n\tprivate initializeFromBrowserState() {\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\tObject.entries(browserState.schmancyAreas).forEach(([areaName, route]) => {\n\t\t\t\t\tthis.current.set(areaName, route as ActiveRoute)\n\t\t\t\t})\n\t\t\t\tthis.$current.next(this.current)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to initialize from browser state:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Get or create a ReplaySubject for a specific area with proper cleanup\n\t */\n\tprivate getOrCreateAreaSubject(areaName: string): ReplaySubject<ActiveRoute> {\n\t\tlet subject = this.areaSubjects.get(areaName)\n\t\t\n\t\tif (!subject || subject.closed) {\n\t\t\tsubject = new ReplaySubject<ActiveRoute>(1)\n\t\t\tthis.areaSubjects.set(areaName, subject)\n\t\t\t\n\t\t\t// If the area already exists in current, emit it immediately\n\t\t\tconst currentRoute = this.current.get(areaName)\n\t\t\tif (currentRoute) {\n\t\t\t\tsubject.next({\n\t\t\t\t\t...currentRoute,\n\t\t\t\t\t// Ensure state, params and props are initialized if undefined\n\t\t\t\t\tstate: currentRoute.state || {},\n\t\t\t\t\tparams: currentRoute.params || {},\n\t\t\t\t\tprops: currentRoute.props || {}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn subject\n\t}\n\n\t/**\n\t * Subscribe to a specific area with caching\n\t */\n\ton(areaName: string, skipCurrent = false): Observable<ActiveRoute> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\tconst observable = areaSubject.asObservable().pipe(\n\t\t\t// Add distinct to prevent duplicate emissions - now includes state\n\t\t\tdistinctUntilChanged((a, b) => \n\t\t\t\ta.component === b.component &&\n\t\t\t\tJSON.stringify(a.state) === JSON.stringify(b.state) &&\n\t\t\t\tJSON.stringify(a.params) === JSON.stringify(b.params)\n\t\t\t),\n\t\t\t// Share the subscription\n\t\t\tshareReplay(1)\n\t\t)\n\t\t\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Subscribe to all areas\n\t */\n\tall(skipCurrent = false): Observable<Map<string, ActiveRoute>> {\n\t\tconst observable = this.$current.asObservable().pipe(\n\t\t\tshareReplay(1)\n\t\t)\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Get state from an area with type safety\n\t */\n\tgetState<T = unknown>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.state),\n\t\t\tfilter((state): state is NonNullable<Record<string, unknown>> => \n\t\t\t\tstate !== undefined && state !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(state => state as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting state for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get params from an area with type safety\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.params),\n\t\t\tfilter((params): params is NonNullable<Record<string, unknown>> => \n\t\t\t\tparams !== undefined && params !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(params => params as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting params for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific param from an area with null safety\n\t */\n\tparam<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.params<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(params => params[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting param \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get props from an area with type safety\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.props),\n\t\t\tfilter((props): props is NonNullable<Record<string, unknown>> => \n\t\t\t\tprops !== undefined && props !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(props => props as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting props for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific prop from an area with null safety\n\t */\n\tprop<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.props<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(props => props[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting prop \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\n\t/**\n\t * Find teleportation components\n\t */\n\tfind() {\n\t\treturn zip([\n\t\t\tfromEvent<HERE_RICKY_EVENT>(window, HERE_RICKY).pipe(\n\t\t\t\tmap(e => e.detail),\n\t\t\t\tbufferTime(0),\n\t\t\t),\n\t\t\tof(1).pipe(tap(() => window.dispatchEvent(this.findingMortiesEvent))),\n\t\t]).pipe(\n\t\t\tmap(([component]) => component),\n\t\t\ttimeout(1),\n\t\t\tcatchError(() => EMPTY)\n\t\t)\n\t}\n\n\t/**\n\t * Push a new route action with validation\n\t */\n\tpush(r: RouteAction) {\n\t\tif (!r.area) {\n\t\t\tthrow new Error('Area is required for route action')\n\t\t}\n\t\t\n\t\t// Prevent processing during popstate handling\n\t\tif (this.isProcessingPopstate) {\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// Ensure state, params and props are initialized\n\t\tconst routeAction: RouteAction = {\n\t\t\t...r,\n\t\t\tstate: r.state || {},\n\t\t\tparams: r.params || {},\n\t\t\tprops: r.props || {},\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t}\n\t\t\n\t\t// Add to history if enabled\n\t\tif (this.enableHistoryMode) {\n\t\t\trouterHistory.next(routeAction)\n\t\t}\n\t\t\n\t\tthis.request.next(routeAction)\n\t\t// Emit an area-specific event for those who want to listen directly to DOM events\n\t\tthis.dispatchAreaEvent(routeAction.area, routeAction)\n\t}\n\n\t/**\n\t * Internal method to update route from browser navigation\n\t * This should only be called by area components during popstate handling\n\t */\n\t_updateFromBrowser(routeAction: RouteAction) {\n\t\tconst enhancedRoute: RouteAction = {\n\t\t\t...routeAction,\n\t\t\tstate: routeAction.state || {},\n\t\t\tparams: routeAction.params || {},\n\t\t\tprops: routeAction.props || {},\n\t\t\t_source: 'browser' as NavigationSource\n\t\t}\n\t\t\n\t\tthis.isProcessingPopstate = true\n\t\tthis.request.next(enhancedRoute)\n\t\tthis.isProcessingPopstate = false\n\t}\n\n\t/**\n\t * Update browser history state (called by area components)\n\t */\n\t_updateBrowserHistory(areaName: string, route: ActiveRoute, historyStrategy?: string, clearQueryParams?: string[] | boolean | null) {\n\t\tif (!this.enableHistoryMode) return\n\t\t\n\t\ttry {\n\t\t\t// Get current browser state or create new one\n\t\t\tconst currentState = history.state || {}\n\t\t\tconst schmancyAreas = currentState.schmancyAreas || {}\n\t\t\t\n\t\t\t// Update the specific area - only include non-empty state/params/props\n\t\t\tconst areaData: any = {\n\t\t\t\tcomponent: route.component,\n\t\t\t\tarea: route.area\n\t\t\t}\n\t\t\t\n\t\t\t// Only include state if it has content\n\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\tareaData.state = route.state\n\t\t\t}\n\t\t\t\n\t\t\t// Only include params if it has content\n\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\tareaData.params = route.params\n\t\t\t}\n\t\t\t\n\t\t\t// Only include props if it has content\n\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\tareaData.props = route.props\n\t\t\t}\n\t\t\t\n\t\t\tschmancyAreas[areaName] = areaData\n\t\t\t\n\t\t\tconst newState = {\n\t\t\t\t...currentState,\n\t\t\t\tschmancyAreas\n\t\t\t}\n\t\t\t\n\t\t\t// Create clean URL\n\t\t\tconst url = this.createCleanURL(schmancyAreas, clearQueryParams)\n\t\t\t\n\t\t\t// Update browser history\n\t\t\tif (historyStrategy === 'replace' || historyStrategy === 'pop') {\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} else if (historyStrategy === 'push' || !historyStrategy) {\n\t\t\t\thistory.pushState(newState, '', url)\n\t\t\t}\n\t\t\t// 'silent' strategy doesn't update browser history\n\t\t\t\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to update browser history:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Create a clean URL from area states\n\t */\n\tprivate createCleanURL(areas: Record<string, ActiveRoute>, clearQueryParams?: string[] | boolean | null): string {\n\t\t// Get the current base path (everything except the last segment which might be encoded state)\n\t\tconst currentPath = location.pathname\n\t\tconst pathSegments = currentPath.split('/')\n\t\tlet basePath = '/'\n\n\t\t// Check if the last segment is encoded state (contains { or %7B)\n\t\tconst lastSegment = pathSegments[pathSegments.length - 1]\n\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t// Remove the encoded state segment to get the base path\n\t\t\tpathSegments.pop()\n\t\t\tbasePath = pathSegments.join('/') || '/'\n\t\t} else {\n\t\t\t// Keep the current path as base path\n\t\t\tbasePath = currentPath\n\t\t}\n\n\t\t// Ensure base path ends properly\n\t\tif (basePath !== '/' && !basePath.endsWith('/')) {\n\t\t\tbasePath += '/'\n\t\t}\n\n\t\t// Handle query parameters\n\t\tlet queryString = ''\n\n\t\tif (clearQueryParams !== true) {\n\t\t\t// Get current query params\n\t\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\t\t// Clear specific params if provided\n\t\t\tif (Array.isArray(clearQueryParams)) {\n\t\t\t\tclearQueryParams.forEach(param => urlParams.delete(param))\n\t\t\t}\n\n\t\t\t// Convert back to string\n\t\t\tqueryString = urlParams.toString()\n\t\t\tqueryString = queryString ? `?${queryString}` : ''\n\t\t}\n\t\t// If clearQueryParams === true, queryString remains empty (all params cleared)\n\n\t\tif (this.prettyURL) {\n\t\t\t// Create pretty URLs - customize this based on your routing needs\n\t\t\tconst mainArea = areas.main\n\t\t\tif (mainArea) {\n\t\t\t\tlet path = basePath === '/' ? `/${mainArea.component}` : `${basePath}${mainArea.component}`\n\n\t\t\t\t// Add simple params to URL\n\t\t\t\tconst searchParams = new URLSearchParams(queryString)\n\t\t\t\tif (mainArea.params) {\n\t\t\t\t\tObject.entries(mainArea.params).forEach(([key, value]) => {\n\t\t\t\t\t\tif (typeof value === 'string' || typeof value === 'number') {\n\t\t\t\t\t\t\tsearchParams.set(key, String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tconst query = searchParams.toString()\n\t\t\t\treturn path + (query ? `?${query}` : '')\n\t\t\t}\n\t\t}\n\n\t\t// Fallback to encoded state in URL (original behavior)\n\t\ttry {\n\t\t\t// Clean up empty objects before encoding\n\t\t\tconst cleanedAreas: Record<string, any> = {}\n\t\t\tObject.entries(areas).forEach(([areaName, route]) => {\n\t\t\t\tconst cleanRoute: any = { component: route.component }\n\n\t\t\t\t// Only include state if it has content\n\t\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\t\tcleanRoute.state = route.state\n\t\t\t\t}\n\n\t\t\t\t// Only include params if it has content\n\t\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\t\tcleanRoute.params = route.params\n\t\t\t\t}\n\n\t\t\t\t// Only include props if it has content\n\t\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\t\tcleanRoute.props = route.props\n\t\t\t\t}\n\n\t\t\t\tcleanedAreas[areaName] = cleanRoute\n\t\t\t})\n\n\t\t\t// If cleanedAreas is empty, preserve the base path\n\t\t\tif (Object.keys(cleanedAreas).length === 0) {\n\t\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\t\treturn `${cleanBasePath}${queryString}`\n\t\t\t}\n\n\t\t\tconst encoded = encodeURIComponent(JSON.stringify(cleanedAreas))\n\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\treturn `${cleanBasePath}/${encoded}${queryString}`\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to encode URL state:', error)\n\t\t\treturn location.pathname\n\t\t}\n\t}\n\n\t/**\n\t * Restore state from browser history state\n\t */\n\trestoreFromBrowserState(browserState: any): Record<string, ActiveRoute> {\n\t\ttry {\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to restore from browser state:', error)\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\n\t/**\n\t * Parse state from URL (fallback method)\n\t */\n\tprivate parseStateFromURL(): Record<string, ActiveRoute> {\n\t\tconst pathname = location.pathname.split('/').pop()\n\t\tif (!pathname) return {}\n\t\t\n\t\ttry {\n\t\t\tconst decoded = decodeURIComponent(pathname)\n\t\t\tconst parsed = JSON.parse(decoded)\n\t\t\t\n\t\t\tif (typeof parsed === 'object' && parsed !== null) {\n\t\t\t\treturn parsed\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore parse errors\n\t\t}\n\t\t\n\t\treturn {}\n\t}\n\t\n\t/**\n\t * Dispatch a DOM event for a specific area change\n\t */\n\tprivate dispatchAreaEvent(areaName: string, routeAction: RouteAction) {\n\t\tconst eventName = `schmancy-area-${areaName}-changed`\n\t\tconst event = new CustomEvent(eventName, { \n\t\t\tdetail: { \n\t\t\t\tarea: areaName,\n\t\t\t\tcomponent: routeAction.component,\n\t\t\t\tstate: routeAction.state,\n\t\t\t\tparams: routeAction.params,\n\t\t\t\tprops: routeAction.props,\n\t\t\t\thistoryStrategy: routeAction.historyStrategy\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t})\n\t\twindow.dispatchEvent(event)\n\t}\n\n\t/**\n\t * Remove an area from the current state\n\t */\n\tpop(name: string) {\n\t\tif (!name) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\n\t\t// Before removing from current map, emit a clearing signal to the area's subject\n\t\t// This notifies the area component to clear itself\n\t\tconst areaSubject = this.areaSubjects.get(name)\n\t\tif (areaSubject && !areaSubject.closed) {\n\t\t\t// Send a route with null component to signal clearing\n\t\t\tareaSubject.next({\n\t\t\t\tcomponent: null as any,\n\t\t\t\tstate: {},\n\t\t\t\tarea: name,\n\t\t\t\tparams: {},\n\t\t\t\tprops: {}\n\t\t\t})\n\t\t}\n\n\t\t// Send a clearing signal through the request pipeline\n\t\t// This ensures the area component receives the signal to clear\n\t\tthis.request.next({\n\t\t\tarea: name,\n\t\t\tcomponent: null as any,\n\t\t\tstate: {},\n\t\t\tparams: {},\n\t\t\tprops: {},\n\t\t\thistoryStrategy: 'silent' as any,\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t})\n\n\t\t// Remove from current map\n\t\tthis.current.delete(name)\n\t\tthis.$current.next(this.current)\n\n\t\t// Update browser history\n\t\tif (this.enableHistoryMode) {\n\t\t\ttry {\n\t\t\t\tconst currentState = history.state || {}\n\t\t\t\tconst schmancyAreas = { ...(currentState.schmancyAreas || {}) }\n\t\t\t\tdelete schmancyAreas[name]\n\n\t\t\t\tconst newState = {\n\t\t\t\t\t...currentState,\n\t\t\t\t\tschmancyAreas\n\t\t\t\t}\n\n\t\t\t\tconst url = this.createCleanURL(schmancyAreas)\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to update history after pop:', error)\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * Clear all areas\n\t */\n\tclear() {\n\t\t// Complete all area subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\t// Clear current state\n\t\tthis.current.clear()\n\t\tthis.$current.next(this.current)\n\n\t\t// Update URL\n\t\tif (this.enableHistoryMode) {\n\t\t\tconst url = this.createCleanURL({})\n\t\t\thistory.replaceState({ schmancyAreas: {} }, '', url)\n\t\t}\n\t}\n\t\n\t/**\n\t * Dispose of the service and clean up resources\n\t */\n\tdispose() {\n\t\tif (this.disposed) return\n\n\t\tthis.disposed = true\n\n\t\t// Unsubscribe from unload event\n\t\tif (this.unloadSubscription) {\n\t\t\tthis.unloadSubscription.unsubscribe()\n\t\t\tthis.unloadSubscription = undefined\n\t\t}\n\n\t\t// Complete all subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\tthis.request.complete()\n\t\tthis.$current.complete()\n\t\trouterHistory.complete()\n\n\t\t// Clear references\n\t\tthis.current.clear()\n\t\tareaSubjectsCache.delete(this)\n\t}\n\t\n\t/**\n\t * Get singleton instance\n\t */\n\tstatic getInstance() {\n\t\tif (!AreaService.instance) {\n\t\t\tAreaService.instance = new AreaService()\n\t\t}\n\t\treturn AreaService.instance\n\t}\n\n\t/**\n\t * Get current state from URL (deprecated - use browser state instead)\n\t */\n\tget state(): Record<string, unknown> {\n\t\t// Try browser state first\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fallback to URL parsing\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\t\n\t/**\n\t * Check if an area exists in current state\n\t */\n\thasArea(areaName: string): boolean {\n\t\treturn this.current.has(areaName)\n\t}\n\t\n\t/**\n\t * Get all active area names\n\t */\n\tgetActiveAreas(): string[] {\n\t\treturn Array.from(this.current.keys())\n\t}\n\t\n\t/**\n\t * Get route for a specific area synchronously\n\t */\n\tgetRoute(areaName: string): ActiveRoute | undefined {\n\t\treturn this.current.get(areaName)\n\t}\n}\n\nexport const area = AreaService.getInstance()\nexport default area","import { $LitElement } from '@mixins/index';\nimport { css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { Observable } from 'rxjs';\nimport { LazyComponent } from './lazy';\n\nexport type ObservableGuardResult = Observable<boolean>;\n\n// Component types that can be passed to routes\nexport type RouteComponent =\n | string // Tag name\n | CustomElementConstructor // Constructor function\n | HTMLElement // Existing element\n | LazyComponent<any> \n\nexport interface RouteConfig {\n when: string;\n component: RouteComponent;\n exact?: boolean;\n guard?: ObservableGuardResult;\n}\n\n/**\n * A marker component that holds route configuration.\n * This component doesn't render anything - it's used by schmancy-area\n * to configure routing via slot change detection.\n *\n * @example\n * ```html\n * <schmancy-area>\n * <schmancy-route\n * when=\"users\"\n * .component=${UserComponent}\n * exact\n * ></schmancy-route>\n * </schmancy-area>\n * ```\n */\n@customElement('schmancy-route')\nexport class SchmancyRoute extends $LitElement(css`\n :host {\n display: none;\n }\n`) {\n @property({ type: String })\n when!: string;\n\n @property({ type: Object })\n component!: RouteComponent;\n\n @property({ type: Boolean })\n exact?: boolean = false;\n\n @property({ type: Object })\n guard?:ObservableGuardResult ;\n\n /**\n * Returns the route configuration object\n */\n getConfig(): RouteConfig {\n return {\n when: this.when,\n component: this.component,\n exact: this.exact,\n guard: this.guard\n };\n }\n\n render() {\n // This is a marker component - no visual output\n return html``;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-route': SchmancyRoute;\n }\n}","import { LazyComponent } from './lazy'\n\nexport type RouteAction = {\n\tcomponent: CustomElementConstructor | string | HTMLElement | LazyComponent<any>\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown> // Alias for params\n\thistoryStrategy?: THistoryStrategy\n\tclearQueryParams?: string[] | boolean | null\n\t_source?: 'programmatic' | 'browser' | 'initial' // Internal use only\n}\n\nexport type ActiveRoute = {\n\tcomponent: string\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown>\n}\n\n/**\n * Interface for subscribing to area changes\n */\nexport interface AreaSubscription {\n\t/**\n\t * Subscribe to a specific area\n\t * @param areaName Name of the area to subscribe to\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of the active route for the specified area\n\t */\n\ton(areaName: string, skipCurrent?: boolean): import('rxjs').Observable<ActiveRoute>\n\t\n\t/**\n\t * Subscribe to all areas\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of all active routes\n\t */\n\tall(skipCurrent?: boolean): import('rxjs').Observable<Map<string, ActiveRoute>>\n\t\n\t/**\n\t * Get state from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's state\n\t */\n\tgetState<T = unknown>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get params from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's params\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific param from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the param to select\n\t * @returns Observable of the param value\n\t */\n\tparam<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get props from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's props\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific prop from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the prop to select\n\t * @returns Observable of the prop value\n\t */\n\tprop<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n}\n\nexport type THistoryStrategy = 'push' | 'replace' | 'pop' | 'silent'\n\nexport enum HISTORY_STRATEGY {\n\tpush = 'push',\n\treplace = 'replace',\n\tpop = 'pop',\n\tsilent = 'silent',\n}\n\n/**\n * Browser history state structure used by Schmancy Area\n */\nexport interface SchmancyHistoryState {\n\tschmancyAreas: Record<string, ActiveRoute>\n\t[key: string]: any // Allow other apps to store additional state\n}","import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport {\n\tEMPTY,\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tof,\n\tshareReplay,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n} from 'rxjs'\nimport area from './area.service'\nimport { RouteComponent, SchmancyRoute } from './route.component'\nimport { ActiveRoute, HISTORY_STRATEGY, RouteAction } from './router.types'\n\n@customElement('schmancy-area')\nexport class SchmancyArea extends $LitElement(css`\n\t:host {\n\t\tposition: relative;\n\t\tdisplay: block;\n\t\tinset: 0;\n\t}\n`) {\n\t/**\n\t * The name of the router outlet\n\t * @attr\n\t * @type {string}\n\t * @public\n\t * @required\n\t */\n\t@property() name!: string\n\n\t@property() default!: RouteComponent\n\n\t/**\n\t * Query for assigned route elements in the slot\n\t * This will automatically update when slot content changes\n\t */\n\t@queryAssignedElements({ selector: 'schmancy-route', flatten: true })\n\tprivate routes!: SchmancyRoute[]\n\n\tprotected firstUpdated(): void {\n\t\tif (!this.name) throw new Error('Area name is required')\n\t\t// Single unified routing pipeline - all logic inline\n\t\tmerge(\n\t\t\t// Programmatic navigation\n\t\t\tarea.request.pipe(\n\t\t\t\tfilter(({ area }) => area === this.name),\n\t\t\t\tmap(action => {\n\t\t\t\t\t// If component is a string, try to find the matching route to get the original 'when'\n\t\t\t\t\tif (typeof action.component === 'string') {\n\t\t\t\t\t\tconst route = this.routes?.find(r => r.when === action.component);\n\t\t\t\t\t\tif (route) {\n\t\t\t\t\t\t\t// Use the route's actual component (which might be lazy) and track the 'when'\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Found route for '${action.component}', using component:`, route.component);\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...action,\n\t\t\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\t\t\toriginalWhen: route.when\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn action;\n\t\t\t\t})\n\t\t\t),\n\n\t\t\t// Initial load - simplified to use this.routes directly\n\t\t\tof(location.pathname).pipe(\n\t\t\t\ttake(1),\n\t\t\t\tswitchMap(() => {\n\t\t\t\t\tconst path = location.pathname\n\t\t\t\t\tconst lastSegment = path.split('/').pop() || ''\n\t\t\t\t\tlet route: SchmancyRoute\n\t\t\t\t\tlet originalWhen: string | undefined\n\n\t\t\t\t\t// Check for JSON encoded route\n\t\t\t\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst parsed = JSON.parse(decodeURIComponent(lastSegment)) as Record<string, ActiveRoute>\n\t\t\t\t\t\t\tif (parsed[this.name]) {\n\t\t\t\t\t\t\t\tconst componentTag = parsed[this.name]\n\t\t\t\t\t\t\t\troute = this.routes?.find(r => r.when === componentTag.component)\n\t\t\t\t\t\t\t\toriginalWhen = route?.when || componentTag.component // Track the route's actual 'when' value\n\t\t\t\t\t\t\t\t// if the route.component is a lazy loaded module we need to load it\n\t\t\t\t\t\t\t\tif (route)\n\t\t\t\t\t\t\t\t\treturn of({\n\t\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\t\t\t\t\tstate: parsed[this.name].state || {},\n\t\t\t\t\t\t\t\t\t\tparams: parsed[this.name].params || {},\n\t\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.replace,\n\t\t\t\t\t\t\t\t\t\toriginalWhen, // Pass along the original route identifier\n\t\t\t\t\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\n\t\t\t\t\t\t\t\treturn of({\n\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\tcomponent: parsed[this.name].component,\n\t\t\t\t\t\t\t\t\tstate: parsed[this.name].state || {},\n\t\t\t\t\t\t\t\t\tparams: parsed[this.name].params || {},\n\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.replace,\n\t\t\t\t\t\t\t\t\toriginalWhen: componentTag.component, // Track even for direct component references\n\t\t\t\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Segment-based routing\n\t\t\t\t\tconst segments = path.split('/').filter(Boolean)\n\t\t\t\t\troute = this.routes?.find(r => segments.includes(r.when))\n\t\t\t\t\toriginalWhen = route?.when // Track the original 'when' value\n\t\t\t\t\t// if the route.component is a lazy loaded module we need to load it\n\n\t\t\t\t\tif (!route) {\n\t\t\t\t\t\treturn this.default\n\t\t\t\t\t\t\t? of({\n\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\t\t\t} as RouteAction)\n\t\t\t\t\t\t\t: EMPTY\n\t\t\t\t\t}\n\n\t\t\t\t\treturn of({\n\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\toriginalWhen, // Pass along the original route identifier\n\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\t\t\t\t}),\n\t\t\t),\n\n\t\t\t// Browser back/forward - simplified to directly use popstate\n\t\t\tfromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\tmap(event => {\n\t\t\t\t\tif (event.state?.schmancyAreas?.[this.name]) {\n\t\t\t\t\t\tconst stateData = event.state.schmancyAreas[this.name];\n\t\t\t\t\t\tconst componentTag = stateData.component;\n\t\t\t\t\t\t// Try to find the matching route to get the original 'when'\n\t\t\t\t\t\tconst route = this.routes?.find(r => r.when === componentTag);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: route ? route.component : componentTag,\n\t\t\t\t\t\t\tstate: stateData.state || {},\n\t\t\t\t\t\t\tparams: stateData.params || {},\n\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.pop,\n\t\t\t\t\t\t\toriginalWhen: componentTag\n\t\t\t\t\t\t} as RouteAction & { originalWhen?: string };\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t}),\n\t\t\t\tfilter(route => route !== null),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tfilter(route => route?.component !== undefined),\n\t\t\t\t// Step 1: Resolve ONLY lazy components to constructors (no element creation)\n\t\t\t\tswitchMap(async route => {\n\t\t\t\t\tlet component = route.component\n\t\t\t\t\tconsole.log(`[${this.name}] Processing route with originalWhen:`, (route as any).originalWhen);\n\n\t\t\t\t\t// Resolve lazy components first\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof component === 'function' &&\n\t\t\t\t\t\t('preload' in component || '_promise' in component || '_module' in component)\n\t\t\t\t\t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy loading component...`);\n\t\t\t\t\t\t\tconst module = await (component as () => Promise<{ default: CustomElementConstructor }>)()\n\t\t\t\t\t\t\tcomponent = module.default\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy load succeeded, component:`, component);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Lazy load failed:`, e)\n\t\t\t\t\t\t\treturn { component: null, route }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { component, route: { ...route, originalWhen: (route as any).originalWhen } }\n\t\t\t\t}),\n\n\t\t\t\t// Step 2: Extract component identifier for comparison (without creating elements)\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tlet identifier = ''\n\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\tidentifier = 'null'\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\tidentifier = component\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\tidentifier = component.tagName\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\tidentifier = component.name || 'CustomElement'\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t\tconst key = `${identifier}${JSON.stringify(route.params)}${JSON.stringify(route.state)}`\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\troute,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\ttagName: identifier,\n\t\t\t\t\t\toriginalWhen: (route as any)?.originalWhen || identifier\n\t\t\t\t\t}\n\t\t\t\t}),\n\n\t\t\t\t// Step 3: Deduplicate using the identifier (before creating expensive elements)\n\t\t\t\tdistinctUntilChanged((a, b) => {\n\t\t\t\t\treturn a.key === b.key\n\t\t\t\t}),\n\t\t\t\t// Step 0: Guard\n\t\t\t\tswitchMap(r => {\n\t\t\t\t\t// Use originalWhen if available, otherwise fall back to tagName\n\t\t\t\t\tconst routeWhen = r.originalWhen || r.tagName;\n\t\t\t\t\tconsole.log('Guard check - originalWhen:', r.originalWhen, 'tagName:', r.tagName, 'using:', routeWhen);\n\t\t\t\t\tconst route = this.routes.find(route => route.when === routeWhen);\n\n\t\t\t\t\t// If route has a guard, evaluate it\n\t\t\t\t\tif (route?.guard) {\n\t\t\t\t\t\treturn route.guard.pipe(\n\t\t\t\t\t\t\ttap(guardResult => {\n\t\t\t\t\t\t\t\tconsole.log(`[${this.name}] Guard evaluation for route '${route.when}':`, guardResult)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tswitchMap(guardResult => {\n\t\t\t\t\t\t\t\tif (guardResult === true) return of(r);\n\n\t\t\t\t\t\t\t\t// Guard failed, dispatch redirect event\n\t\t\t\t\t\t\t\tconst redirectEvent = new CustomEvent('redirect', {\n\t\t\t\t\t\t\t\t\tdetail: {\n\t\t\t\t\t\t\t\t\t\tblockedRoute: r.tagName,\n\t\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\t\tparams: r.route?.params || {},\n\t\t\t\t\t\t\t\t\t\tstate: r.route?.state || {},\n\t\t\t\t\t\t\t\t\t\tredirectTarget: typeof guardResult === 'object' ? guardResult : undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\troute.dispatchEvent(redirectEvent);\n\n\t\t\t\t\t\t\t\treturn EMPTY;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// No guard, allow navigation\n\t\t\t\t\treturn of(r);\n\t\t\t\t}),\n\n\t\t\t\t// Step 4: Create the HTMLElement and apply properties\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tlet element: HTMLElement | null = null\n\t\t\t\t\tconsole.log(component,route)\n\n\t\t\t\t\t// Now resolve to HTMLElement\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\telement = null\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = document.createElement(component)\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to create element:`, component)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\telement = component\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = new (component as CustomElementConstructor)()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to instantiate:`, e)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply properties inline\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\tif (route.params) Object.assign(element, route.params)\n\t\t\t\t\t\tif (route.props) Object.assign(element, route.props)\n\t\t\t\t\t\tif (route.state) (element as any).state = route.state\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { element, route }\n\t\t\t\t}),\n\n\t\t\t\tshareReplay(1),\n\n\t\t\t\t// Swap components\n\t\t\t\ttap(({ element, route }) => this.swapComponents(element, route)),\n\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(`[${this.name}] Navigation error:`, error)\n\t\t\t\t\treturn EMPTY\n\t\t\t\t}),\n\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\t/**\n\t * Swap components with animation following the original pattern\n\t */\n\tprivate swapComponents(newComponent: HTMLElement | null, routeAction: RouteAction) {\n\t\t// Important: We need to work with the light DOM, not shadow DOM\n\t\t// The slot should remain in shadow DOM, and we append content to light DOM\n\n\t\t// Find the current routed component (not the route definitions)\n\t\t// Route definitions have display:none, actual components don't\n\t\tconst oldComponent = Array.from(this.children).find(\n\t\t\tchild => !(child instanceof SchmancyRoute)\n\t\t) as HTMLElement | undefined\n\n\t\t// If no new component, just clear\n\t\tif (!newComponent) {\n\t\t\tif (oldComponent) {\n\t\t\t\toldComponent.remove()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Animate transition\n\t\tif (oldComponent) {\n\t\t\t// Fade out old component\n\t\t\tconst fadeOut = oldComponent.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, easing: 'ease-out' })\n\n\t\t\tfadeOut.onfinish = () => {\n\t\t\t\toldComponent.remove()\n\t\t\t\t// Add new component to light DOM (not shadow DOM!)\n\t\t\t\tthis.appendChild(newComponent)\n\t\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: 'ease-in' })\n\t\t\t}\n\t\t} else {\n\t\t\t// No old component, just add and fade in to light DOM\n\t\t\tthis.appendChild(newComponent)\n\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 100, easing: 'ease-in' })\n\t\t}\n\n\t\t// Update internal state\n\t\tif (newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea.current.set(this.name, activeRoute)\n\t\t\tarea.$current.next(area.current)\n\t\t}\n\n\t\t// Update browser history\n\t\tif (area.enableHistoryMode && newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea._updateBrowserHistory(\n\t\t\t\tthis.name,\n\t\t\t\tactiveRoute,\n\t\t\t\trouteAction.historyStrategy || HISTORY_STRATEGY.push,\n\t\t\t\trouteAction.clearQueryParams,\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Create URL path for the route (legacy method, now handled by service)\n\t */\n\tnewPath(tag: string, route: RouteAction) {\n\t\tconst oldPathname = location.pathname.split('/').pop()\n\t\tlet oldAreaState = {}\n\t\ttry {\n\t\t\toldAreaState = oldPathname ? JSON.parse(decodeURIComponent(oldPathname)) : {}\n\t\t} catch {\n\t\t\toldAreaState = {}\n\t\t}\n\t\troute.state = route.state ?? {}\n\t\tconst queryParams = route.clearQueryParams ? this.queryParamClear(route.clearQueryParams) : document.location.search\n\n\t\treturn encodeURIComponent(\n\t\t\tJSON.stringify({\n\t\t\t\t...oldAreaState,\n\t\t\t\t[this.name]: { component: tag.toLowerCase(), state: route.state, params: route.params },\n\t\t\t}),\n\t\t).concat(`${queryParams}`)\n\t}\n\n\t/**\n\t * Clear query parameters\n\t */\n\tqueryParamClear(params?: string[] | boolean) {\n\t\tif (!params) {\n\t\t\treturn ''\n\t\t}\n\t\t// get query params from url\n\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\tif (params === true) {\n\t\t\t// Clear all query params\n\t\t\treturn ''\n\t\t} else {\n\t\t\t// Clear specific query params\n\t\t\tparams.forEach(param => urlParams.delete(param))\n\t\t\t// update url\n\t\t\tif (urlParams.toString() === '') return ''\n\t\t\treturn `?${urlParams.toString()}`\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t}\n\n\trender() {\n\t\treturn html`<slot></slot>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-area': SchmancyArea\n\t}\n}\n"],"names":["routerHistory","Subject","FINDING_MORTIES","HERE_RICKY","areaSubjectsCache","WeakMap","AreaService","constructor","this","prettyURL","mode","request","ReplaySubject","current","Map","$current","enableHistoryMode","findingMortiesEvent","CustomEvent","disposed","isProcessingPopstate","next","subscribe","currentAreas","forEach","route","areaName","getOrCreateAreaSubject","initializeFromBrowserState","window","unloadSubscription","fromEvent","dispose","areaSubjects","subjects","get","set","browserState","history","state","schmancyAreas","Object","entries","error","subject","closed","currentRoute","params","props","skipCurrent","Error","observable","asObservable","pipe","distinctUntilChanged","a","b","component","JSON","stringify","shareReplay","skip","on","map","filter","catchError","err","EMPTY","key","value","find","zip","e","detail","bufferTime","of","tap","dispatchEvent","timeout","r","area","routeAction","_source","dispatchAreaEvent","enhancedRoute","historyStrategy","clearQueryParams","currentState","areaData","keys","length","newState","url","createCleanURL","replaceState","pushState","areas","currentPath","location","pathname","pathSegments","split","basePath","lastSegment","includes","pop","join","endsWith","queryString","urlParams","URLSearchParams","search","Array","isArray","param","delete","toString","mainArea","main","path","searchParams","String","query","cleanedAreas","cleanRoute","replace","encoded","encodeURIComponent","parseStateFromURL","decoded","decodeURIComponent","parsed","parse","event","bubbles","composed","name","areaSubject","clear","complete","unsubscribe","getInstance","instance","has","getActiveAreas","from","SchmancyRoute","$LitElement","css","super","arguments","exact","getConfig","when","guard","render","html","__decorateClass","property","type","prototype","Boolean","customElement","HISTORY_STRATEGY","SchmancyArea","firstUpdated","merge","action","routes","originalWhen","take","switchMap","componentTag","segments","silent","default","stateData","async","module","identifier","HTMLElement","tagName","routeWhen","guardResult","redirectEvent","blockedRoute","redirectTarget","element","document","createElement","assign","swapComponents","takeUntil","disconnecting","newComponent","oldComponent","children","child","animate","opacity","duration","easing","onfinish","remove","appendChild","activeRoute","toLowerCase","_updateBrowserHistory","push","tag","oldPathname","oldAreaState","queryParams","queryParamClear","concat","disconnectedCallback","queryAssignedElements","selector","flatten"],"mappings":";;;;;;;AAsBO,MAAMA,IAAgB,IAAIC,KAEpBC,IAAkB,mBAClBC,IAAa,cASpBC,wBAAwBC;AAK9B,MAAMC,EAAAA;AAAAA,EAwBL,cAAAC;AAtBAC,SAAOC,YAAAA,IACPD,KAAOE,OAA6B,WACpCF,KAAOG,UAAU,IAAIC,EAA2B,IAChDJ,KAAOK,8BAAcC,OACrBN,KAAOO,WAAW,IAAIH,EAAwC,CAAA,GAY9DJ,KAAOQ,oBAAAA,IACPR,KAAQS,sBAAsB,IAAIC,YAA6ChB,CAAAA,GAC/EM,KAAQW,WAAAA,IACR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gBAAAA,IAAoBsG,SAAS1F,SAASa;AAE9G,WAAOgB,mBACNrE,KAAKC,UAAU,EAAA,GACXwJ,GACH,CAAC3M,KAAKgI,IAAAA,GAAO,EAAE/E,WAAWwJ,EAAIH,YAAAA,GAAevK,OAAOd,EAAMc,OAAOQ,QAAQtB,EAAMsB,OAAAA,EAAAA,CAAAA,CAAAA,EAE/EuK,OAAO,GAAGF,CAAAA,EAAAA;AAAAA,EAAa;AAAA,EAM1B,gBAAgBrK,GAAAA;AACf,SAAKA,EACJ,QAAO;AAGR,UAAM8D,IAAY,IAAIC,gBAAgBZ,SAASa,MAAAA;AAE/C,WAAIhE,WAEI,MAGPA,EAAOvB,QAAQ0F,OAASL,EAAUM,OAAOD,CAAAA,CAAAA,GAErCL,EAAUO,SAAAA,MAAe,KAAW,KACjC,IAAIP,EAAUO,SAAAA,CAAAA;AAAAA,EACtB;AAAA,EAGD,uBAAAmG;AACClE,UAAMkE,qBAAAA;AAAAA,EAAqB;AAAA,EAG5B,SAAA5D;AACC,WAAOC;AAAAA,EAAA;AAAA;AArYIC,EAAA,CAAXC,EAAAA,CAAAA,GAdWM,EAcAJ,WAAA,QAAA,CAAA,GAEAH,EAAA,CAAXC,EAAAA,CAAAA,GAhBWM,EAgBAJ,WAAA,WAAA,CAAA,GAOJH,EAAA,CADP2D,EAAsB,EAAEC,UAAU,kBAAkBC,SAAAA,GAAS,CAAA,CAAA,GAtBlDtD,EAuBJJ,WAAA,UAAA,IAvBII,IAANP,EAAA,CADNK,EAAc,eAAA,CAAA,GACFE,CAAAA;"}
@@ -0,0 +1,12 @@
1
+ "use strict";const n=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const m=require("lit/decorators.js");require("./tailwind.mixin-DvXzFSLc.cjs");const R=require("./litElement.mixin-BnXm63YO.cjs"),b=require("lit"),A=new n.Subject,C="FINDING_MORTIES",j="HERE_RICKY",O=new WeakMap;class f{constructor(){this.prettyURL=!1,this.mode="HISTORY",this.request=new n.ReplaySubject(1),this.current=new Map,this.$current=new n.ReplaySubject(1),this.enableHistoryMode=!0,this.findingMortiesEvent=new CustomEvent(C),this.disposed=!1,this.isProcessingPopstate=!1,this.$current.next(this.current),this.$current.subscribe(e=>{this.disposed||e.forEach((t,r)=>{this.getOrCreateAreaSubject(r).next(t)})}),this.initializeFromBrowserState(),typeof window<"u"&&(this.unloadSubscription=n.fromEvent(window,"unload").subscribe(()=>{this.dispose()}))}get areaSubjects(){let e=O.get(this);return e||(e=new Map,O.set(this,e)),e}initializeFromBrowserState(){try{const e=history.state;e&&e.schmancyAreas&&(Object.entries(e.schmancyAreas).forEach(([t,r])=>{this.current.set(t,r)}),this.$current.next(this.current))}catch{}}getOrCreateAreaSubject(e){let t=this.areaSubjects.get(e);if(!t||t.closed){t=new n.ReplaySubject(1),this.areaSubjects.set(e,t);const r=this.current.get(e);r&&t.next({...r,state:r.state||{},params:r.params||{},props:r.props||{}})}return t}on(e,t=!1){if(!e)throw new Error("Area name is required");const r=this.getOrCreateAreaSubject(e).asObservable().pipe(n.distinctUntilChanged((o,s)=>o.component===s.component&&JSON.stringify(o.state)===JSON.stringify(s.state)&&JSON.stringify(o.params)===JSON.stringify(s.params)),n.shareReplay(1));return t?r.pipe(n.skip(1)):r}all(e=!1){const t=this.$current.asObservable().pipe(n.shareReplay(1));return e?t.pipe(n.skip(1)):t}getState(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(n.map(t=>t.state),n.filter(t=>t!=null),n.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),n.map(t=>t),n.catchError(t=>n.EMPTY))}params(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(n.map(t=>t.params),n.filter(t=>t!=null),n.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),n.map(t=>t),n.catchError(t=>n.EMPTY))}param(e,t){if(!e||!t)throw new Error("Area name and key are required");return this.params(e).pipe(n.map(r=>r[t]),n.filter(r=>r!==void 0),n.distinctUntilChanged(),n.map(r=>r),n.catchError(r=>n.EMPTY))}props(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(n.map(t=>t.props),n.filter(t=>t!=null),n.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),n.map(t=>t),n.catchError(t=>n.EMPTY))}prop(e,t){if(!e||!t)throw new Error("Area name and key are required");return this.props(e).pipe(n.map(r=>r[t]),n.filter(r=>r!==void 0),n.distinctUntilChanged(),n.map(r=>r),n.catchError(r=>n.EMPTY))}find(){return n.zip([n.fromEvent(window,j).pipe(n.map(e=>e.detail),n.bufferTime(0)),n.of(1).pipe(n.tap(()=>window.dispatchEvent(this.findingMortiesEvent)))]).pipe(n.map(([e])=>e),n.timeout(1),n.catchError(()=>n.EMPTY))}push(e){if(!e.area)throw new Error("Area is required for route action");if(this.isProcessingPopstate)return;const t={...e,state:e.state||{},params:e.params||{},props:e.props||{},_source:"programmatic"};this.enableHistoryMode&&A.next(t),this.request.next(t),this.dispatchAreaEvent(t.area,t)}_updateFromBrowser(e){const t={...e,state:e.state||{},params:e.params||{},props:e.props||{},_source:"browser"};this.isProcessingPopstate=!0,this.request.next(t),this.isProcessingPopstate=!1}_updateBrowserHistory(e,t,r,o){if(this.enableHistoryMode)try{const s=history.state||{},i=s.schmancyAreas||{},p={component:t.component,area:t.area};t.state&&Object.keys(t.state).length>0&&(p.state=t.state),t.params&&Object.keys(t.params).length>0&&(p.params=t.params),t.props&&Object.keys(t.props).length>0&&(p.props=t.props),i[e]=p;const c={...s,schmancyAreas:i},u=this.createCleanURL(i,o);r==="replace"||r==="pop"?history.replaceState(c,"",u):r!=="push"&&r||history.pushState(c,"",u)}catch{}}createCleanURL(e,t){const r=location.pathname,o=r.split("/");let s="/";const i=o[o.length-1];i&&(i.includes("{")||i.includes("%7B"))?(o.pop(),s=o.join("/")||"/"):s=r,s==="/"||s.endsWith("/")||(s+="/");let p="";if(t!==!0){const c=new URLSearchParams(location.search);Array.isArray(t)&&t.forEach(u=>c.delete(u)),p=c.toString(),p=p?`?${p}`:""}if(this.prettyURL){const c=e.main;if(c){let u=s==="/"?`/${c.component}`:`${s}${c.component}`;const S=new URLSearchParams(p);c.params&&Object.entries(c.params).forEach(([d,E])=>{typeof E!="string"&&typeof E!="number"||S.set(d,String(E))});const h=S.toString();return u+(h?`?${h}`:"")}}try{const c={};if(Object.entries(e).forEach(([S,h])=>{const d={component:h.component};h.state&&Object.keys(h.state).length>0&&(d.state=h.state),h.params&&Object.keys(h.params).length>0&&(d.params=h.params),h.props&&Object.keys(h.props).length>0&&(d.props=h.props),c[S]=d}),Object.keys(c).length===0)return`${s==="/"?"":s.replace(/\/$/,"")}${p}`;const u=encodeURIComponent(JSON.stringify(c));return`${s==="/"?"":s.replace(/\/$/,"")}/${u}${p}`}catch{return location.pathname}}restoreFromBrowserState(e){try{if(e&&e.schmancyAreas)return e.schmancyAreas}catch{}return this.parseStateFromURL()}parseStateFromURL(){const e=location.pathname.split("/").pop();if(!e)return{};try{const t=decodeURIComponent(e),r=JSON.parse(t);if(typeof r=="object"&&r!==null)return r}catch{}return{}}dispatchAreaEvent(e,t){const r=new CustomEvent(`schmancy-area-${e}-changed`,{detail:{area:e,component:t.component,state:t.state,params:t.params,props:t.props,historyStrategy:t.historyStrategy},bubbles:!0,composed:!0});window.dispatchEvent(r)}pop(e){if(!e)throw new Error("Area name is required");const t=this.areaSubjects.get(e);if(t&&!t.closed&&t.next({component:null,state:{},area:e,params:{},props:{}}),this.request.next({area:e,component:null,state:{},params:{},props:{},historyStrategy:"silent",_source:"programmatic"}),this.current.delete(e),this.$current.next(this.current),this.enableHistoryMode)try{const r=history.state||{},o={...r.schmancyAreas||{}};delete o[e];const s={...r,schmancyAreas:o},i=this.createCleanURL(o);history.replaceState(s,"",i)}catch{}}clear(){if(this.areaSubjects.forEach(e=>e.complete()),this.areaSubjects.clear(),this.current.clear(),this.$current.next(this.current),this.enableHistoryMode){const e=this.createCleanURL({});history.replaceState({schmancyAreas:{}},"",e)}}dispose(){this.disposed||(this.disposed=!0,this.unloadSubscription&&(this.unloadSubscription.unsubscribe(),this.unloadSubscription=void 0),this.areaSubjects.forEach(e=>e.complete()),this.areaSubjects.clear(),this.request.complete(),this.$current.complete(),A.complete(),this.current.clear(),O.delete(this))}static getInstance(){return f.instance||(f.instance=new f),f.instance}get state(){try{const e=history.state;if(e&&e.schmancyAreas)return e.schmancyAreas}catch{}return this.parseStateFromURL()}hasArea(e){return this.current.has(e)}getActiveAreas(){return Array.from(this.current.keys())}getRoute(e){return this.current.get(e)}}const y=f.getInstance();var v=Object.defineProperty,P=Object.getOwnPropertyDescriptor,g=(a,e,t,r)=>{for(var o,s=r>1?void 0:r?P(e,t):e,i=a.length-1;i>=0;i--)(o=a[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&v(e,t,s),s};exports.SchmancyRoute=class extends R.$LitElement(b.css`
2
+ :host {
3
+ display: none;
4
+ }
5
+ `){constructor(){super(...arguments),this.exact=!1}getConfig(){return{when:this.when,component:this.component,exact:this.exact,guard:this.guard}}render(){return b.html``}},g([m.property({type:String})],exports.SchmancyRoute.prototype,"when",2),g([m.property({type:Object})],exports.SchmancyRoute.prototype,"component",2),g([m.property({type:Boolean})],exports.SchmancyRoute.prototype,"exact",2),g([m.property({type:Object})],exports.SchmancyRoute.prototype,"guard",2),exports.SchmancyRoute=g([m.customElement("schmancy-route")],exports.SchmancyRoute);var l=(a=>(a.push="push",a.replace="replace",a.pop="pop",a.silent="silent",a))(l||{}),$=Object.defineProperty,M=Object.getOwnPropertyDescriptor,w=(a,e,t,r)=>{for(var o,s=r>1?void 0:r?M(e,t):e,i=a.length-1;i>=0;i--)(o=a[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&$(e,t,s),s};exports.SchmancyArea=class extends R.$LitElement(b.css`
6
+ :host {
7
+ position: relative;
8
+ display: block;
9
+ inset: 0;
10
+ }
11
+ `){firstUpdated(){if(!this.name)throw new Error("Area name is required");n.merge(y.request.pipe(n.filter(({area:a})=>a===this.name),n.map(a=>{if(typeof a.component=="string"){const e=this.routes?.find(t=>t.when===a.component);if(e)return{...a,component:e.component,originalWhen:e.when}}return a})),n.of(location.pathname).pipe(n.take(1),n.switchMap(()=>{const a=location.pathname,e=a.split("/").pop()||"";let t,r;if(e&&(e.includes("{")||e.includes("%7B")))try{const s=JSON.parse(decodeURIComponent(e));if(s[this.name]){const i=s[this.name];return t=this.routes?.find(p=>p.when===i.component),r=t?.when||i.component,t?n.of({area:this.name,component:t.component,state:s[this.name].state||{},params:s[this.name].params||{},historyStrategy:l.replace,originalWhen:r}):n.of({area:this.name,component:s[this.name].component,state:s[this.name].state||{},params:s[this.name].params||{},historyStrategy:l.replace,originalWhen:i.component})}}catch{}const o=a.split("/").filter(Boolean);return t=this.routes?.find(s=>o.includes(s.when)),r=t?.when,t?n.of({area:this.name,component:t.component,state:{},params:{},historyStrategy:l.silent,originalWhen:r}):this.default?n.of({area:this.name,component:this.default,state:{},params:{},historyStrategy:l.silent}):n.EMPTY})),n.fromEvent(window,"popstate").pipe(n.map(a=>{if(a.state?.schmancyAreas?.[this.name]){const e=a.state.schmancyAreas[this.name],t=e.component,r=this.routes?.find(o=>o.when===t);return{area:this.name,component:r?r.component:t,state:e.state||{},params:e.params||{},historyStrategy:l.pop,originalWhen:t}}return null}),n.filter(a=>a!==null))).pipe(n.filter(a=>a?.component!==void 0),n.switchMap(async a=>{let e=a.component;if(typeof e=="function"&&("preload"in e||"_promise"in e||"_module"in e))try{e=(await e()).default}catch{return{component:null,route:a}}return{component:e,route:{...a,originalWhen:a.originalWhen}}}),n.map(({component:a,route:e})=>{let t="";return a&&a!==""?typeof a=="string"?t=a:a instanceof HTMLElement?t=a.tagName:typeof a=="function"&&(t=a.name||"CustomElement"):t="null",{component:a,route:e,key:`${t}${JSON.stringify(e.params)}${JSON.stringify(e.state)}`,tagName:t,originalWhen:e?.originalWhen||t}}),n.distinctUntilChanged((a,e)=>a.key===e.key),n.switchMap(a=>{const e=a.originalWhen||a.tagName,t=this.routes.find(r=>r.when===e);return t?.guard?t.guard.pipe(n.tap(r=>{}),n.switchMap(r=>{if(r===!0)return n.of(a);const o=new CustomEvent("redirect",{detail:{blockedRoute:a.tagName,area:this.name,params:a.route?.params||{},state:a.route?.state||{},redirectTarget:typeof r=="object"?r:void 0},bubbles:!0,composed:!0});return t.dispatchEvent(o),n.EMPTY})):n.of(a)}),n.map(({component:a,route:e})=>{let t=null;if(a&&a!==""){if(typeof a=="string")try{t=document.createElement(a)}catch{}else if(a instanceof HTMLElement)t=a;else if(typeof a=="function")try{t=new a}catch{}}else t=null;return t&&(e.params&&Object.assign(t,e.params),e.props&&Object.assign(t,e.props),e.state&&(t.state=e.state)),{element:t,route:e}}),n.shareReplay(1),n.tap(({element:a,route:e})=>this.swapComponents(a,e)),n.catchError(a=>n.EMPTY),n.takeUntil(this.disconnecting)).subscribe()}swapComponents(a,e){const t=Array.from(this.children).find(r=>!(r instanceof exports.SchmancyRoute));if(a){if(t?t.animate([{opacity:1},{opacity:0}],{duration:150,easing:"ease-out"}).onfinish=()=>{t.remove(),this.appendChild(a),a.animate([{opacity:0},{opacity:1}],{duration:150,easing:"ease-in"})}:(this.appendChild(a),a.animate([{opacity:0},{opacity:1}],{duration:100,easing:"ease-in"})),a){const r={component:a.tagName.toLowerCase(),state:e.state||{},area:this.name,params:e.params||{}};y.current.set(this.name,r),y.$current.next(y.current)}if(y.enableHistoryMode&&a){const r={component:a.tagName.toLowerCase(),state:e.state||{},area:this.name,params:e.params||{}};y._updateBrowserHistory(this.name,r,e.historyStrategy||l.push,e.clearQueryParams)}}else t&&t.remove()}newPath(a,e){const t=location.pathname.split("/").pop();let r={};try{r=t?JSON.parse(decodeURIComponent(t)):{}}catch{r={}}e.state=e.state??{};const o=e.clearQueryParams?this.queryParamClear(e.clearQueryParams):document.location.search;return encodeURIComponent(JSON.stringify({...r,[this.name]:{component:a.toLowerCase(),state:e.state,params:e.params}})).concat(`${o}`)}queryParamClear(a){if(!a)return"";const e=new URLSearchParams(location.search);return a===!0?"":(a.forEach(t=>e.delete(t)),e.toString()===""?"":`?${e.toString()}`)}disconnectedCallback(){super.disconnectedCallback()}render(){return b.html`<slot></slot>`}},w([m.property()],exports.SchmancyArea.prototype,"name",2),w([m.property()],exports.SchmancyArea.prototype,"default",2),w([m.queryAssignedElements({selector:"schmancy-route",flatten:!0})],exports.SchmancyArea.prototype,"routes",2),exports.SchmancyArea=w([m.customElement("schmancy-area")],exports.SchmancyArea),exports.FINDING_MORTIES=C,exports.HERE_RICKY=j,exports.HISTORY_STRATEGY=l,exports.area=y,exports.routerHistory=A;
12
+ //# sourceMappingURL=area.component-VxW9QIje.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area.component-VxW9QIje.cjs","sources":["../src/area/area.service.ts","../src/area/route.component.ts","../src/area/router.types.ts","../src/area/area.component.ts"],"sourcesContent":["import {\n\tbufferTime,\n\tcatchError,\n\tdistinctUntilChanged,\n\tEMPTY,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tObservable,\n\tof,\n\tReplaySubject,\n\tshareReplay,\n\tskip,\n\tSubject,\n\tSubscription,\n\ttap,\n\ttimeout,\n\tzip\n} from 'rxjs'\nimport { SchmancyTeleportation } from '../teleport'\nimport { ActiveRoute, AreaSubscription, RouteAction } from './router.types'\n\nexport const routerHistory = new Subject<RouteAction>()\n\nexport const FINDING_MORTIES = 'FINDING_MORTIES'\nexport const HERE_RICKY = 'HERE_RICKY'\nexport type HERE_RICKY_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\nexport type FINDING_MORTIES_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\n\n// WeakMap for better memory management of area subjects\nconst areaSubjectsCache = new WeakMap<AreaService, Map<string, ReplaySubject<ActiveRoute>>>()\n\n// Track navigation source to prevent history conflicts\ntype NavigationSource = 'programmatic' | 'browser' | 'initial'\n\nclass AreaService implements AreaSubscription {\n\tprivate static instance: AreaService\n\tpublic prettyURL = false\n\tpublic mode: 'SILENT' | 'HISTORY' = 'HISTORY'\n\tpublic request = new ReplaySubject<RouteAction>(1)\n\tpublic current = new Map<string, ActiveRoute>()\n\tpublic $current = new ReplaySubject<Map<string, ActiveRoute>>(1)\n\t\n\t// Create a dictionary of ReplaySubjects for area-specific subscriptions\n\tprivate get areaSubjects(): Map<string, ReplaySubject<ActiveRoute>> {\n\t\tlet subjects = areaSubjectsCache.get(this)\n\t\tif (!subjects) {\n\t\t\tsubjects = new Map()\n\t\t\tareaSubjectsCache.set(this, subjects)\n\t\t}\n\t\treturn subjects\n\t}\n\t\n\tpublic enableHistoryMode = true\n\tprivate findingMortiesEvent = new CustomEvent<FINDING_MORTIES_EVENT['detail']>(FINDING_MORTIES)\n\tprivate disposed = false\n\tpublic isProcessingPopstate = false\n\tprivate unloadSubscription?: Subscription\n\n\tconstructor() {\n\t\tthis.$current.next(this.current)\n\t\t\n\t\t// Subscribe to current changes to update area-specific subjects\n\t\tthis.$current.subscribe(currentAreas => {\n\t\t\tif (this.disposed) return\n\t\t\t\n\t\t\t// For each area in the current map\n\t\t\tcurrentAreas.forEach((route, areaName) => {\n\t\t\t\t// Get or create a subject for this area\n\t\t\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\t\t\t// Emit the updated route to area-specific subscribers\n\t\t\t\tareaSubject.next(route)\n\t\t\t})\n\t\t})\n\n\t\t// Initialize from browser state if available\n\t\tthis.initializeFromBrowserState()\n\n\t\t// Setup unload subscription using RxJS\n\t\tif (typeof window !== 'undefined') {\n\t\t\tthis.unloadSubscription = fromEvent(window, 'unload').subscribe(() => {\n\t\t\t\tthis.dispose()\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Initialize router state from browser history state\n\t */\n\tprivate initializeFromBrowserState() {\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\tObject.entries(browserState.schmancyAreas).forEach(([areaName, route]) => {\n\t\t\t\t\tthis.current.set(areaName, route as ActiveRoute)\n\t\t\t\t})\n\t\t\t\tthis.$current.next(this.current)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to initialize from browser state:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Get or create a ReplaySubject for a specific area with proper cleanup\n\t */\n\tprivate getOrCreateAreaSubject(areaName: string): ReplaySubject<ActiveRoute> {\n\t\tlet subject = this.areaSubjects.get(areaName)\n\t\t\n\t\tif (!subject || subject.closed) {\n\t\t\tsubject = new ReplaySubject<ActiveRoute>(1)\n\t\t\tthis.areaSubjects.set(areaName, subject)\n\t\t\t\n\t\t\t// If the area already exists in current, emit it immediately\n\t\t\tconst currentRoute = this.current.get(areaName)\n\t\t\tif (currentRoute) {\n\t\t\t\tsubject.next({\n\t\t\t\t\t...currentRoute,\n\t\t\t\t\t// Ensure state, params and props are initialized if undefined\n\t\t\t\t\tstate: currentRoute.state || {},\n\t\t\t\t\tparams: currentRoute.params || {},\n\t\t\t\t\tprops: currentRoute.props || {}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn subject\n\t}\n\n\t/**\n\t * Subscribe to a specific area with caching\n\t */\n\ton(areaName: string, skipCurrent = false): Observable<ActiveRoute> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\tconst observable = areaSubject.asObservable().pipe(\n\t\t\t// Add distinct to prevent duplicate emissions - now includes state\n\t\t\tdistinctUntilChanged((a, b) => \n\t\t\t\ta.component === b.component &&\n\t\t\t\tJSON.stringify(a.state) === JSON.stringify(b.state) &&\n\t\t\t\tJSON.stringify(a.params) === JSON.stringify(b.params)\n\t\t\t),\n\t\t\t// Share the subscription\n\t\t\tshareReplay(1)\n\t\t)\n\t\t\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Subscribe to all areas\n\t */\n\tall(skipCurrent = false): Observable<Map<string, ActiveRoute>> {\n\t\tconst observable = this.$current.asObservable().pipe(\n\t\t\tshareReplay(1)\n\t\t)\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Get state from an area with type safety\n\t */\n\tgetState<T = unknown>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.state),\n\t\t\tfilter((state): state is NonNullable<Record<string, unknown>> => \n\t\t\t\tstate !== undefined && state !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(state => state as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting state for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get params from an area with type safety\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.params),\n\t\t\tfilter((params): params is NonNullable<Record<string, unknown>> => \n\t\t\t\tparams !== undefined && params !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(params => params as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting params for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific param from an area with null safety\n\t */\n\tparam<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.params<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(params => params[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting param \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get props from an area with type safety\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.props),\n\t\t\tfilter((props): props is NonNullable<Record<string, unknown>> => \n\t\t\t\tprops !== undefined && props !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(props => props as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting props for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific prop from an area with null safety\n\t */\n\tprop<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.props<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(props => props[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting prop \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\n\t/**\n\t * Find teleportation components\n\t */\n\tfind() {\n\t\treturn zip([\n\t\t\tfromEvent<HERE_RICKY_EVENT>(window, HERE_RICKY).pipe(\n\t\t\t\tmap(e => e.detail),\n\t\t\t\tbufferTime(0),\n\t\t\t),\n\t\t\tof(1).pipe(tap(() => window.dispatchEvent(this.findingMortiesEvent))),\n\t\t]).pipe(\n\t\t\tmap(([component]) => component),\n\t\t\ttimeout(1),\n\t\t\tcatchError(() => EMPTY)\n\t\t)\n\t}\n\n\t/**\n\t * Push a new route action with validation\n\t */\n\tpush(r: RouteAction) {\n\t\tif (!r.area) {\n\t\t\tthrow new Error('Area is required for route action')\n\t\t}\n\t\t\n\t\t// Prevent processing during popstate handling\n\t\tif (this.isProcessingPopstate) {\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// Ensure state, params and props are initialized\n\t\tconst routeAction: RouteAction = {\n\t\t\t...r,\n\t\t\tstate: r.state || {},\n\t\t\tparams: r.params || {},\n\t\t\tprops: r.props || {},\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t}\n\t\t\n\t\t// Add to history if enabled\n\t\tif (this.enableHistoryMode) {\n\t\t\trouterHistory.next(routeAction)\n\t\t}\n\t\t\n\t\tthis.request.next(routeAction)\n\t\t// Emit an area-specific event for those who want to listen directly to DOM events\n\t\tthis.dispatchAreaEvent(routeAction.area, routeAction)\n\t}\n\n\t/**\n\t * Internal method to update route from browser navigation\n\t * This should only be called by area components during popstate handling\n\t */\n\t_updateFromBrowser(routeAction: RouteAction) {\n\t\tconst enhancedRoute: RouteAction = {\n\t\t\t...routeAction,\n\t\t\tstate: routeAction.state || {},\n\t\t\tparams: routeAction.params || {},\n\t\t\tprops: routeAction.props || {},\n\t\t\t_source: 'browser' as NavigationSource\n\t\t}\n\t\t\n\t\tthis.isProcessingPopstate = true\n\t\tthis.request.next(enhancedRoute)\n\t\tthis.isProcessingPopstate = false\n\t}\n\n\t/**\n\t * Update browser history state (called by area components)\n\t */\n\t_updateBrowserHistory(areaName: string, route: ActiveRoute, historyStrategy?: string, clearQueryParams?: string[] | boolean | null) {\n\t\tif (!this.enableHistoryMode) return\n\t\t\n\t\ttry {\n\t\t\t// Get current browser state or create new one\n\t\t\tconst currentState = history.state || {}\n\t\t\tconst schmancyAreas = currentState.schmancyAreas || {}\n\t\t\t\n\t\t\t// Update the specific area - only include non-empty state/params/props\n\t\t\tconst areaData: any = {\n\t\t\t\tcomponent: route.component,\n\t\t\t\tarea: route.area\n\t\t\t}\n\t\t\t\n\t\t\t// Only include state if it has content\n\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\tareaData.state = route.state\n\t\t\t}\n\t\t\t\n\t\t\t// Only include params if it has content\n\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\tareaData.params = route.params\n\t\t\t}\n\t\t\t\n\t\t\t// Only include props if it has content\n\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\tareaData.props = route.props\n\t\t\t}\n\t\t\t\n\t\t\tschmancyAreas[areaName] = areaData\n\t\t\t\n\t\t\tconst newState = {\n\t\t\t\t...currentState,\n\t\t\t\tschmancyAreas\n\t\t\t}\n\t\t\t\n\t\t\t// Create clean URL\n\t\t\tconst url = this.createCleanURL(schmancyAreas, clearQueryParams)\n\t\t\t\n\t\t\t// Update browser history\n\t\t\tif (historyStrategy === 'replace' || historyStrategy === 'pop') {\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} else if (historyStrategy === 'push' || !historyStrategy) {\n\t\t\t\thistory.pushState(newState, '', url)\n\t\t\t}\n\t\t\t// 'silent' strategy doesn't update browser history\n\t\t\t\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to update browser history:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Create a clean URL from area states\n\t */\n\tprivate createCleanURL(areas: Record<string, ActiveRoute>, clearQueryParams?: string[] | boolean | null): string {\n\t\t// Get the current base path (everything except the last segment which might be encoded state)\n\t\tconst currentPath = location.pathname\n\t\tconst pathSegments = currentPath.split('/')\n\t\tlet basePath = '/'\n\n\t\t// Check if the last segment is encoded state (contains { or %7B)\n\t\tconst lastSegment = pathSegments[pathSegments.length - 1]\n\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t// Remove the encoded state segment to get the base path\n\t\t\tpathSegments.pop()\n\t\t\tbasePath = pathSegments.join('/') || '/'\n\t\t} else {\n\t\t\t// Keep the current path as base path\n\t\t\tbasePath = currentPath\n\t\t}\n\n\t\t// Ensure base path ends properly\n\t\tif (basePath !== '/' && !basePath.endsWith('/')) {\n\t\t\tbasePath += '/'\n\t\t}\n\n\t\t// Handle query parameters\n\t\tlet queryString = ''\n\n\t\tif (clearQueryParams !== true) {\n\t\t\t// Get current query params\n\t\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\t\t// Clear specific params if provided\n\t\t\tif (Array.isArray(clearQueryParams)) {\n\t\t\t\tclearQueryParams.forEach(param => urlParams.delete(param))\n\t\t\t}\n\n\t\t\t// Convert back to string\n\t\t\tqueryString = urlParams.toString()\n\t\t\tqueryString = queryString ? `?${queryString}` : ''\n\t\t}\n\t\t// If clearQueryParams === true, queryString remains empty (all params cleared)\n\n\t\tif (this.prettyURL) {\n\t\t\t// Create pretty URLs - customize this based on your routing needs\n\t\t\tconst mainArea = areas.main\n\t\t\tif (mainArea) {\n\t\t\t\tlet path = basePath === '/' ? `/${mainArea.component}` : `${basePath}${mainArea.component}`\n\n\t\t\t\t// Add simple params to URL\n\t\t\t\tconst searchParams = new URLSearchParams(queryString)\n\t\t\t\tif (mainArea.params) {\n\t\t\t\t\tObject.entries(mainArea.params).forEach(([key, value]) => {\n\t\t\t\t\t\tif (typeof value === 'string' || typeof value === 'number') {\n\t\t\t\t\t\t\tsearchParams.set(key, String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tconst query = searchParams.toString()\n\t\t\t\treturn path + (query ? `?${query}` : '')\n\t\t\t}\n\t\t}\n\n\t\t// Fallback to encoded state in URL (original behavior)\n\t\ttry {\n\t\t\t// Clean up empty objects before encoding\n\t\t\tconst cleanedAreas: Record<string, any> = {}\n\t\t\tObject.entries(areas).forEach(([areaName, route]) => {\n\t\t\t\tconst cleanRoute: any = { component: route.component }\n\n\t\t\t\t// Only include state if it has content\n\t\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\t\tcleanRoute.state = route.state\n\t\t\t\t}\n\n\t\t\t\t// Only include params if it has content\n\t\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\t\tcleanRoute.params = route.params\n\t\t\t\t}\n\n\t\t\t\t// Only include props if it has content\n\t\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\t\tcleanRoute.props = route.props\n\t\t\t\t}\n\n\t\t\t\tcleanedAreas[areaName] = cleanRoute\n\t\t\t})\n\n\t\t\t// If cleanedAreas is empty, preserve the base path\n\t\t\tif (Object.keys(cleanedAreas).length === 0) {\n\t\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\t\treturn `${cleanBasePath}${queryString}`\n\t\t\t}\n\n\t\t\tconst encoded = encodeURIComponent(JSON.stringify(cleanedAreas))\n\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\treturn `${cleanBasePath}/${encoded}${queryString}`\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to encode URL state:', error)\n\t\t\treturn location.pathname\n\t\t}\n\t}\n\n\t/**\n\t * Restore state from browser history state\n\t */\n\trestoreFromBrowserState(browserState: any): Record<string, ActiveRoute> {\n\t\ttry {\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to restore from browser state:', error)\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\n\t/**\n\t * Parse state from URL (fallback method)\n\t */\n\tprivate parseStateFromURL(): Record<string, ActiveRoute> {\n\t\tconst pathname = location.pathname.split('/').pop()\n\t\tif (!pathname) return {}\n\t\t\n\t\ttry {\n\t\t\tconst decoded = decodeURIComponent(pathname)\n\t\t\tconst parsed = JSON.parse(decoded)\n\t\t\t\n\t\t\tif (typeof parsed === 'object' && parsed !== null) {\n\t\t\t\treturn parsed\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore parse errors\n\t\t}\n\t\t\n\t\treturn {}\n\t}\n\t\n\t/**\n\t * Dispatch a DOM event for a specific area change\n\t */\n\tprivate dispatchAreaEvent(areaName: string, routeAction: RouteAction) {\n\t\tconst eventName = `schmancy-area-${areaName}-changed`\n\t\tconst event = new CustomEvent(eventName, { \n\t\t\tdetail: { \n\t\t\t\tarea: areaName,\n\t\t\t\tcomponent: routeAction.component,\n\t\t\t\tstate: routeAction.state,\n\t\t\t\tparams: routeAction.params,\n\t\t\t\tprops: routeAction.props,\n\t\t\t\thistoryStrategy: routeAction.historyStrategy\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t})\n\t\twindow.dispatchEvent(event)\n\t}\n\n\t/**\n\t * Remove an area from the current state\n\t */\n\tpop(name: string) {\n\t\tif (!name) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\n\t\t// Before removing from current map, emit a clearing signal to the area's subject\n\t\t// This notifies the area component to clear itself\n\t\tconst areaSubject = this.areaSubjects.get(name)\n\t\tif (areaSubject && !areaSubject.closed) {\n\t\t\t// Send a route with null component to signal clearing\n\t\t\tareaSubject.next({\n\t\t\t\tcomponent: null as any,\n\t\t\t\tstate: {},\n\t\t\t\tarea: name,\n\t\t\t\tparams: {},\n\t\t\t\tprops: {}\n\t\t\t})\n\t\t}\n\n\t\t// Send a clearing signal through the request pipeline\n\t\t// This ensures the area component receives the signal to clear\n\t\tthis.request.next({\n\t\t\tarea: name,\n\t\t\tcomponent: null as any,\n\t\t\tstate: {},\n\t\t\tparams: {},\n\t\t\tprops: {},\n\t\t\thistoryStrategy: 'silent' as any,\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t})\n\n\t\t// Remove from current map\n\t\tthis.current.delete(name)\n\t\tthis.$current.next(this.current)\n\n\t\t// Update browser history\n\t\tif (this.enableHistoryMode) {\n\t\t\ttry {\n\t\t\t\tconst currentState = history.state || {}\n\t\t\t\tconst schmancyAreas = { ...(currentState.schmancyAreas || {}) }\n\t\t\t\tdelete schmancyAreas[name]\n\n\t\t\t\tconst newState = {\n\t\t\t\t\t...currentState,\n\t\t\t\t\tschmancyAreas\n\t\t\t\t}\n\n\t\t\t\tconst url = this.createCleanURL(schmancyAreas)\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to update history after pop:', error)\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * Clear all areas\n\t */\n\tclear() {\n\t\t// Complete all area subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\t// Clear current state\n\t\tthis.current.clear()\n\t\tthis.$current.next(this.current)\n\n\t\t// Update URL\n\t\tif (this.enableHistoryMode) {\n\t\t\tconst url = this.createCleanURL({})\n\t\t\thistory.replaceState({ schmancyAreas: {} }, '', url)\n\t\t}\n\t}\n\t\n\t/**\n\t * Dispose of the service and clean up resources\n\t */\n\tdispose() {\n\t\tif (this.disposed) return\n\n\t\tthis.disposed = true\n\n\t\t// Unsubscribe from unload event\n\t\tif (this.unloadSubscription) {\n\t\t\tthis.unloadSubscription.unsubscribe()\n\t\t\tthis.unloadSubscription = undefined\n\t\t}\n\n\t\t// Complete all subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\tthis.request.complete()\n\t\tthis.$current.complete()\n\t\trouterHistory.complete()\n\n\t\t// Clear references\n\t\tthis.current.clear()\n\t\tareaSubjectsCache.delete(this)\n\t}\n\t\n\t/**\n\t * Get singleton instance\n\t */\n\tstatic getInstance() {\n\t\tif (!AreaService.instance) {\n\t\t\tAreaService.instance = new AreaService()\n\t\t}\n\t\treturn AreaService.instance\n\t}\n\n\t/**\n\t * Get current state from URL (deprecated - use browser state instead)\n\t */\n\tget state(): Record<string, unknown> {\n\t\t// Try browser state first\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fallback to URL parsing\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\t\n\t/**\n\t * Check if an area exists in current state\n\t */\n\thasArea(areaName: string): boolean {\n\t\treturn this.current.has(areaName)\n\t}\n\t\n\t/**\n\t * Get all active area names\n\t */\n\tgetActiveAreas(): string[] {\n\t\treturn Array.from(this.current.keys())\n\t}\n\t\n\t/**\n\t * Get route for a specific area synchronously\n\t */\n\tgetRoute(areaName: string): ActiveRoute | undefined {\n\t\treturn this.current.get(areaName)\n\t}\n}\n\nexport const area = AreaService.getInstance()\nexport default area","import { $LitElement } from '@mixins/index';\nimport { css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { Observable } from 'rxjs';\nimport { LazyComponent } from './lazy';\n\nexport type ObservableGuardResult = Observable<boolean>;\n\n// Component types that can be passed to routes\nexport type RouteComponent =\n | string // Tag name\n | CustomElementConstructor // Constructor function\n | HTMLElement // Existing element\n | LazyComponent<any> \n\nexport interface RouteConfig {\n when: string;\n component: RouteComponent;\n exact?: boolean;\n guard?: ObservableGuardResult;\n}\n\n/**\n * A marker component that holds route configuration.\n * This component doesn't render anything - it's used by schmancy-area\n * to configure routing via slot change detection.\n *\n * @example\n * ```html\n * <schmancy-area>\n * <schmancy-route\n * when=\"users\"\n * .component=${UserComponent}\n * exact\n * ></schmancy-route>\n * </schmancy-area>\n * ```\n */\n@customElement('schmancy-route')\nexport class SchmancyRoute extends $LitElement(css`\n :host {\n display: none;\n }\n`) {\n @property({ type: String })\n when!: string;\n\n @property({ type: Object })\n component!: RouteComponent;\n\n @property({ type: Boolean })\n exact?: boolean = false;\n\n @property({ type: Object })\n guard?:ObservableGuardResult ;\n\n /**\n * Returns the route configuration object\n */\n getConfig(): RouteConfig {\n return {\n when: this.when,\n component: this.component,\n exact: this.exact,\n guard: this.guard\n };\n }\n\n render() {\n // This is a marker component - no visual output\n return html``;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-route': SchmancyRoute;\n }\n}","import { LazyComponent } from './lazy'\n\nexport type RouteAction = {\n\tcomponent: CustomElementConstructor | string | HTMLElement | LazyComponent<any>\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown> // Alias for params\n\thistoryStrategy?: THistoryStrategy\n\tclearQueryParams?: string[] | boolean | null\n\t_source?: 'programmatic' | 'browser' | 'initial' // Internal use only\n}\n\nexport type ActiveRoute = {\n\tcomponent: string\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown>\n}\n\n/**\n * Interface for subscribing to area changes\n */\nexport interface AreaSubscription {\n\t/**\n\t * Subscribe to a specific area\n\t * @param areaName Name of the area to subscribe to\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of the active route for the specified area\n\t */\n\ton(areaName: string, skipCurrent?: boolean): import('rxjs').Observable<ActiveRoute>\n\t\n\t/**\n\t * Subscribe to all areas\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of all active routes\n\t */\n\tall(skipCurrent?: boolean): import('rxjs').Observable<Map<string, ActiveRoute>>\n\t\n\t/**\n\t * Get state from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's state\n\t */\n\tgetState<T = unknown>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get params from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's params\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific param from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the param to select\n\t * @returns Observable of the param value\n\t */\n\tparam<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get props from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's props\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific prop from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the prop to select\n\t * @returns Observable of the prop value\n\t */\n\tprop<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n}\n\nexport type THistoryStrategy = 'push' | 'replace' | 'pop' | 'silent'\n\nexport enum HISTORY_STRATEGY {\n\tpush = 'push',\n\treplace = 'replace',\n\tpop = 'pop',\n\tsilent = 'silent',\n}\n\n/**\n * Browser history state structure used by Schmancy Area\n */\nexport interface SchmancyHistoryState {\n\tschmancyAreas: Record<string, ActiveRoute>\n\t[key: string]: any // Allow other apps to store additional state\n}","import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport {\n\tEMPTY,\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tof,\n\tshareReplay,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n} from 'rxjs'\nimport area from './area.service'\nimport { RouteComponent, SchmancyRoute } from './route.component'\nimport { ActiveRoute, HISTORY_STRATEGY, RouteAction } from './router.types'\n\n@customElement('schmancy-area')\nexport class SchmancyArea extends $LitElement(css`\n\t:host {\n\t\tposition: relative;\n\t\tdisplay: block;\n\t\tinset: 0;\n\t}\n`) {\n\t/**\n\t * The name of the router outlet\n\t * @attr\n\t * @type {string}\n\t * @public\n\t * @required\n\t */\n\t@property() name!: string\n\n\t@property() default!: RouteComponent\n\n\t/**\n\t * Query for assigned route elements in the slot\n\t * This will automatically update when slot content changes\n\t */\n\t@queryAssignedElements({ selector: 'schmancy-route', flatten: true })\n\tprivate routes!: SchmancyRoute[]\n\n\tprotected firstUpdated(): void {\n\t\tif (!this.name) throw new Error('Area name is required')\n\t\t// Single unified routing pipeline - all logic inline\n\t\tmerge(\n\t\t\t// Programmatic navigation\n\t\t\tarea.request.pipe(\n\t\t\t\tfilter(({ area }) => area === this.name),\n\t\t\t\tmap(action => {\n\t\t\t\t\t// If component is a string, try to find the matching route to get the original 'when'\n\t\t\t\t\tif (typeof action.component === 'string') {\n\t\t\t\t\t\tconst route = this.routes?.find(r => r.when === action.component);\n\t\t\t\t\t\tif (route) {\n\t\t\t\t\t\t\t// Use the route's actual component (which might be lazy) and track the 'when'\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Found route for '${action.component}', using component:`, route.component);\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...action,\n\t\t\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\t\t\toriginalWhen: route.when\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn action;\n\t\t\t\t})\n\t\t\t),\n\n\t\t\t// Initial load - simplified to use this.routes directly\n\t\t\tof(location.pathname).pipe(\n\t\t\t\ttake(1),\n\t\t\t\tswitchMap(() => {\n\t\t\t\t\tconst path = location.pathname\n\t\t\t\t\tconst lastSegment = path.split('/').pop() || ''\n\t\t\t\t\tlet route: SchmancyRoute\n\t\t\t\t\tlet originalWhen: string | undefined\n\n\t\t\t\t\t// Check for JSON encoded route\n\t\t\t\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst parsed = JSON.parse(decodeURIComponent(lastSegment)) as Record<string, ActiveRoute>\n\t\t\t\t\t\t\tif (parsed[this.name]) {\n\t\t\t\t\t\t\t\tconst componentTag = parsed[this.name]\n\t\t\t\t\t\t\t\troute = this.routes?.find(r => r.when === componentTag.component)\n\t\t\t\t\t\t\t\toriginalWhen = route?.when || componentTag.component // Track the route's actual 'when' value\n\t\t\t\t\t\t\t\t// if the route.component is a lazy loaded module we need to load it\n\t\t\t\t\t\t\t\tif (route)\n\t\t\t\t\t\t\t\t\treturn of({\n\t\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\t\t\t\t\tstate: parsed[this.name].state || {},\n\t\t\t\t\t\t\t\t\t\tparams: parsed[this.name].params || {},\n\t\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.replace,\n\t\t\t\t\t\t\t\t\t\toriginalWhen, // Pass along the original route identifier\n\t\t\t\t\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\n\t\t\t\t\t\t\t\treturn of({\n\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\tcomponent: parsed[this.name].component,\n\t\t\t\t\t\t\t\t\tstate: parsed[this.name].state || {},\n\t\t\t\t\t\t\t\t\tparams: parsed[this.name].params || {},\n\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.replace,\n\t\t\t\t\t\t\t\t\toriginalWhen: componentTag.component, // Track even for direct component references\n\t\t\t\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Segment-based routing\n\t\t\t\t\tconst segments = path.split('/').filter(Boolean)\n\t\t\t\t\troute = this.routes?.find(r => segments.includes(r.when))\n\t\t\t\t\toriginalWhen = route?.when // Track the original 'when' value\n\t\t\t\t\t// if the route.component is a lazy loaded module we need to load it\n\n\t\t\t\t\tif (!route) {\n\t\t\t\t\t\treturn this.default\n\t\t\t\t\t\t\t? of({\n\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\t\t\t} as RouteAction)\n\t\t\t\t\t\t\t: EMPTY\n\t\t\t\t\t}\n\n\t\t\t\t\treturn of({\n\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\tcomponent: route.component,\n\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\toriginalWhen, // Pass along the original route identifier\n\t\t\t\t\t} as RouteAction & { originalWhen?: string })\n\t\t\t\t}),\n\t\t\t),\n\n\t\t\t// Browser back/forward - simplified to directly use popstate\n\t\t\tfromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\tmap(event => {\n\t\t\t\t\tif (event.state?.schmancyAreas?.[this.name]) {\n\t\t\t\t\t\tconst stateData = event.state.schmancyAreas[this.name];\n\t\t\t\t\t\tconst componentTag = stateData.component;\n\t\t\t\t\t\t// Try to find the matching route to get the original 'when'\n\t\t\t\t\t\tconst route = this.routes?.find(r => r.when === componentTag);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: route ? route.component : componentTag,\n\t\t\t\t\t\t\tstate: stateData.state || {},\n\t\t\t\t\t\t\tparams: stateData.params || {},\n\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.pop,\n\t\t\t\t\t\t\toriginalWhen: componentTag\n\t\t\t\t\t\t} as RouteAction & { originalWhen?: string };\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t}),\n\t\t\t\tfilter(route => route !== null),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tfilter(route => route?.component !== undefined),\n\t\t\t\t// Step 1: Resolve ONLY lazy components to constructors (no element creation)\n\t\t\t\tswitchMap(async route => {\n\t\t\t\t\tlet component = route.component\n\t\t\t\t\tconsole.log(`[${this.name}] Processing route with originalWhen:`, (route as any).originalWhen);\n\n\t\t\t\t\t// Resolve lazy components first\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof component === 'function' &&\n\t\t\t\t\t\t('preload' in component || '_promise' in component || '_module' in component)\n\t\t\t\t\t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy loading component...`);\n\t\t\t\t\t\t\tconst module = await (component as () => Promise<{ default: CustomElementConstructor }>)()\n\t\t\t\t\t\t\tcomponent = module.default\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy load succeeded, component:`, component);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Lazy load failed:`, e)\n\t\t\t\t\t\t\treturn { component: null, route }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { component, route: { ...route, originalWhen: (route as any).originalWhen } }\n\t\t\t\t}),\n\n\t\t\t\t// Step 2: Extract component identifier for comparison (without creating elements)\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tlet identifier = ''\n\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\tidentifier = 'null'\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\tidentifier = component\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\tidentifier = component.tagName\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\tidentifier = component.name || 'CustomElement'\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t\tconst key = `${identifier}${JSON.stringify(route.params)}${JSON.stringify(route.state)}`\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\troute,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\ttagName: identifier,\n\t\t\t\t\t\toriginalWhen: (route as any)?.originalWhen || identifier\n\t\t\t\t\t}\n\t\t\t\t}),\n\n\t\t\t\t// Step 3: Deduplicate using the identifier (before creating expensive elements)\n\t\t\t\tdistinctUntilChanged((a, b) => {\n\t\t\t\t\treturn a.key === b.key\n\t\t\t\t}),\n\t\t\t\t// Step 0: Guard\n\t\t\t\tswitchMap(r => {\n\t\t\t\t\t// Use originalWhen if available, otherwise fall back to tagName\n\t\t\t\t\tconst routeWhen = r.originalWhen || r.tagName;\n\t\t\t\t\tconsole.log('Guard check - originalWhen:', r.originalWhen, 'tagName:', r.tagName, 'using:', routeWhen);\n\t\t\t\t\tconst route = this.routes.find(route => route.when === routeWhen);\n\n\t\t\t\t\t// If route has a guard, evaluate it\n\t\t\t\t\tif (route?.guard) {\n\t\t\t\t\t\treturn route.guard.pipe(\n\t\t\t\t\t\t\ttap(guardResult => {\n\t\t\t\t\t\t\t\tconsole.log(`[${this.name}] Guard evaluation for route '${route.when}':`, guardResult)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tswitchMap(guardResult => {\n\t\t\t\t\t\t\t\tif (guardResult === true) return of(r);\n\n\t\t\t\t\t\t\t\t// Guard failed, dispatch redirect event\n\t\t\t\t\t\t\t\tconst redirectEvent = new CustomEvent('redirect', {\n\t\t\t\t\t\t\t\t\tdetail: {\n\t\t\t\t\t\t\t\t\t\tblockedRoute: r.tagName,\n\t\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\t\tparams: r.route?.params || {},\n\t\t\t\t\t\t\t\t\t\tstate: r.route?.state || {},\n\t\t\t\t\t\t\t\t\t\tredirectTarget: typeof guardResult === 'object' ? guardResult : undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\troute.dispatchEvent(redirectEvent);\n\n\t\t\t\t\t\t\t\treturn EMPTY;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// No guard, allow navigation\n\t\t\t\t\treturn of(r);\n\t\t\t\t}),\n\n\t\t\t\t// Step 4: Create the HTMLElement and apply properties\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tlet element: HTMLElement | null = null\n\t\t\t\t\tconsole.log(component,route)\n\n\t\t\t\t\t// Now resolve to HTMLElement\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\telement = null\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = document.createElement(component)\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to create element:`, component)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\telement = component\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = new (component as CustomElementConstructor)()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to instantiate:`, e)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply properties inline\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\tif (route.params) Object.assign(element, route.params)\n\t\t\t\t\t\tif (route.props) Object.assign(element, route.props)\n\t\t\t\t\t\tif (route.state) (element as any).state = route.state\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { element, route }\n\t\t\t\t}),\n\n\t\t\t\tshareReplay(1),\n\n\t\t\t\t// Swap components\n\t\t\t\ttap(({ element, route }) => this.swapComponents(element, route)),\n\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(`[${this.name}] Navigation error:`, error)\n\t\t\t\t\treturn EMPTY\n\t\t\t\t}),\n\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\t/**\n\t * Swap components with animation following the original pattern\n\t */\n\tprivate swapComponents(newComponent: HTMLElement | null, routeAction: RouteAction) {\n\t\t// Important: We need to work with the light DOM, not shadow DOM\n\t\t// The slot should remain in shadow DOM, and we append content to light DOM\n\n\t\t// Find the current routed component (not the route definitions)\n\t\t// Route definitions have display:none, actual components don't\n\t\tconst oldComponent = Array.from(this.children).find(\n\t\t\tchild => !(child instanceof SchmancyRoute)\n\t\t) as HTMLElement | undefined\n\n\t\t// If no new component, just clear\n\t\tif (!newComponent) {\n\t\t\tif (oldComponent) {\n\t\t\t\toldComponent.remove()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Animate transition\n\t\tif (oldComponent) {\n\t\t\t// Fade out old component\n\t\t\tconst fadeOut = oldComponent.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, easing: 'ease-out' })\n\n\t\t\tfadeOut.onfinish = () => {\n\t\t\t\toldComponent.remove()\n\t\t\t\t// Add new component to light DOM (not shadow DOM!)\n\t\t\t\tthis.appendChild(newComponent)\n\t\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: 'ease-in' })\n\t\t\t}\n\t\t} else {\n\t\t\t// No old component, just add and fade in to light DOM\n\t\t\tthis.appendChild(newComponent)\n\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 100, easing: 'ease-in' })\n\t\t}\n\n\t\t// Update internal state\n\t\tif (newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea.current.set(this.name, activeRoute)\n\t\t\tarea.$current.next(area.current)\n\t\t}\n\n\t\t// Update browser history\n\t\tif (area.enableHistoryMode && newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea._updateBrowserHistory(\n\t\t\t\tthis.name,\n\t\t\t\tactiveRoute,\n\t\t\t\trouteAction.historyStrategy || HISTORY_STRATEGY.push,\n\t\t\t\trouteAction.clearQueryParams,\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Create URL path for the route (legacy method, now handled by service)\n\t */\n\tnewPath(tag: string, route: RouteAction) {\n\t\tconst oldPathname = location.pathname.split('/').pop()\n\t\tlet oldAreaState = {}\n\t\ttry {\n\t\t\toldAreaState = oldPathname ? JSON.parse(decodeURIComponent(oldPathname)) : {}\n\t\t} catch {\n\t\t\toldAreaState = {}\n\t\t}\n\t\troute.state = route.state ?? {}\n\t\tconst queryParams = route.clearQueryParams ? this.queryParamClear(route.clearQueryParams) : document.location.search\n\n\t\treturn encodeURIComponent(\n\t\t\tJSON.stringify({\n\t\t\t\t...oldAreaState,\n\t\t\t\t[this.name]: { component: tag.toLowerCase(), state: route.state, params: route.params },\n\t\t\t}),\n\t\t).concat(`${queryParams}`)\n\t}\n\n\t/**\n\t * Clear query parameters\n\t */\n\tqueryParamClear(params?: string[] | boolean) {\n\t\tif (!params) {\n\t\t\treturn ''\n\t\t}\n\t\t// get query params from url\n\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\tif (params === true) {\n\t\t\t// Clear all query params\n\t\t\treturn ''\n\t\t} else {\n\t\t\t// Clear specific query params\n\t\t\tparams.forEach(param => urlParams.delete(param))\n\t\t\t// update url\n\t\t\tif (urlParams.toString() === '') return ''\n\t\t\treturn `?${urlParams.toString()}`\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t}\n\n\trender() {\n\t\treturn html`<slot></slot>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-area': SchmancyArea\n\t}\n}\n"],"names":["routerHistory","Subject","FINDING_MORTIES","HERE_RICKY","areaSubjectsCache","WeakMap","AreaService","constructor","this","prettyURL","mode","request","ReplaySubject","current","Map","$current","enableHistoryMode","findingMortiesEvent","CustomEvent","disposed","isProcessingPopstate","next","subscribe","currentAreas","forEach","route","areaName","getOrCreateAreaSubject","initializeFromBrowserState","window","unloadSubscription","fromEvent","dispose","areaSubjects","subjects","get","set","browserState","history","state","schmancyAreas","Object","entries","error","subject","closed","currentRoute","params","props","skipCurrent","Error","observable","asObservable","pipe","distinctUntilChanged","a","b","component","JSON","stringify","shareReplay","skip","on","map","filter","catchError","err","EMPTY","key","value","zip","e","detail","bufferTime","of","tap","dispatchEvent","timeout","r","area","routeAction","_source","dispatchAreaEvent","enhancedRoute","historyStrategy","clearQueryParams","currentState","areaData","keys","length","newState","url","createCleanURL","replaceState","pushState","areas","currentPath","location","pathname","pathSegments","split","basePath","lastSegment","includes","pop","join","endsWith","queryString","urlParams","URLSearchParams","search","Array","isArray","param","delete","toString","mainArea","main","path","searchParams","String","query","cleanedAreas","cleanRoute","replace","encoded","encodeURIComponent","parseStateFromURL","decoded","decodeURIComponent","parsed","parse","event","bubbles","composed","name","areaSubject","complete","clear","unsubscribe","getInstance","instance","has","getActiveAreas","from","SchmancyRoute","$LitElement","css","super","arguments","exact","getConfig","when","guard","render","html","__decorateClass","property","type","prototype","Boolean","customElement","HISTORY_STRATEGY","SchmancyArea","firstUpdated","merge","action","routes","find","originalWhen","take","switchMap","componentTag","segments","silent","default","stateData","async","module","identifier","HTMLElement","tagName","routeWhen","guardResult","redirectEvent","blockedRoute","redirectTarget","element","document","createElement","assign","swapComponents","takeUntil","disconnecting","newComponent","oldComponent","children","child","animate","opacity","duration","easing","onfinish","remove","appendChild","activeRoute","toLowerCase","_updateBrowserHistory","push","tag","oldPathname","oldAreaState","queryParams","queryParamClear","concat","disconnectedCallback","queryAssignedElements","selector","flatten"],"mappings":"qQAsBaA,EAAgB,IAAIC,EAAAA,QAEpBC,EAAkB,kBAClBC,EAAa,aASpBC,MAAwBC,QAK9B,MAAMC,CAAAA,CAwBL,aAAAC,CAtBAC,KAAOC,aACPD,KAAOE,KAA6B,UACpCF,KAAOG,QAAU,IAAIC,EAAAA,cAA2B,GAChDJ,KAAO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AASa,MAAAA,EAE/C,OAAI/D,OAEI,IAGPA,EAAOvB,QAAQyF,GAASL,EAAUM,OAAOD,CAAAA,CAAAA,EAErCL,EAAUO,SAAAA,IAAe,GAAW,GACjC,IAAIP,EAAUO,SAAAA,CAAAA,GACtB,CAGD,sBAAAoG,CACCnE,MAAMmE,qBAAAA,CAAqB,CAG5B,QAAA7D,CACC,OAAOC,EAAAA,mBAAA,GArYIC,EAAA,CAAXC,EAAAA,SAAAA,CAAAA,EAdWM,qBAcAJ,UAAA,OAAA,CAAA,EAEAH,EAAA,CAAXC,EAAAA,SAAAA,CAAAA,EAhBWM,qBAgBAJ,UAAA,UAAA,CAAA,EAOJH,EAAA,CADP4D,EAAAA,sBAAsB,CAAEC,SAAU,iBAAkBC,QAAAA,EAAS,CAAA,CAAA,EAtBlDvD,qBAuBJJ,UAAA,SAAA,CAAA,EAvBII,QAAAA,aAANP,EAAA,CADNK,EAAAA,cAAc,eAAA,CAAA,EACFE"}
package/dist/area.js CHANGED
@@ -1,5 +1,5 @@
1
- import { F as s, H as t, c as o, S as r, a as c, b as m, r as u } from "./area.component-5hvsA6_h.js";
2
- import { l as n, h as i, c as S, f as d, j as y, a as g, b as p, d as T, e as b, k as l, g as E, i as I, m as h, n as A, s as C } from "./lazy-E2LCDm7n.js";
1
+ import { F as s, H as t, c as o, S as r, b as c, a as m, r as u } from "./area.component-Oe5ARA8j.js";
2
+ import { p as R, k as d, c as i, j as S, m as p, b as y, d as g, h as T, a as b, e as l, f as E, o as I, g as h, i as A, l as C, n as H, s as N } from "./utils-CYOVFxSx.js";
3
3
  export {
4
4
  s as FINDING_MORTIES,
5
5
  t as HERE_RICKY,
@@ -7,21 +7,23 @@ export {
7
7
  r as SchmancyArea,
8
8
  c as SchmancyRoute,
9
9
  m as area,
10
- n as buildQueryString,
11
- i as compareActiveRoutes,
12
- S as compareCustomElementConstructors,
13
- d as compareRouteActions,
14
- y as createRouteCacheKey,
15
- g as debounce,
16
- p as decodeRouteState,
17
- T as deepMerge,
18
- b as encodeRouteState,
19
- l as extractQueryParams,
20
- E as getTagName,
21
- I as isObject,
22
- h as lazy,
23
- A as normalizeTagName,
10
+ R as buildQueryString,
11
+ d as compareActiveRoutes,
12
+ i as compareCustomElementConstructors,
13
+ S as compareRouteActions,
14
+ p as createRouteCacheKey,
15
+ y as debounce,
16
+ g as decodeData,
17
+ T as decodeRouteState,
18
+ b as deepMerge,
19
+ l as encodeData,
20
+ E as encodeRouteState,
21
+ I as extractQueryParams,
22
+ h as getTagName,
23
+ A as isObject,
24
+ C as lazy,
25
+ H as normalizeTagName,
24
26
  u as routerHistory,
25
- C as sanitizeRouteState
27
+ N as sanitizeRouteState
26
28
  };
27
29
  //# sourceMappingURL=area.js.map
@@ -1,4 +1,4 @@
1
- "use strict";const l=require("lit"),a=require("lit/decorators.js"),n=require("rxjs");require("./animated-text-DBRSI9xt.cjs");const $=require("./area.component-DSAxybsX.cjs");require("./autocomplete-BFN4UGNs.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const _=require("./tailwind.mixin-DvXzFSLc.cjs"),C=require("./ripple-DqQrvaTe.cjs");require("lit/directives/guard.js"),require("./boat-CsVNMu2n.cjs"),require("./spinner-Cm2yObux.cjs"),require("./icon-button-B9Xckdkv.cjs"),require("./media-v4K8T9FY.cjs"),require("./checkbox-B5XA1Ugc.cjs"),require("./chips-BWSXmedd.cjs"),require("./code-preview-U3CqjP3A.cjs"),require("./payment-card-form-BzGdWKH-.cjs");const p=require("./types.cjs"),m=require("./provide-BxZ2kn_p.cjs"),b=require("./litElement.mixin-BnXm63YO.cjs"),d=require("./consume-edta5ng5.cjs");require("./date-range-1smHimq3.cjs"),require("./date-range-inline-DyGBs-PG.cjs"),require("./delay-R0ZUrPTI.cjs"),require("./details-CudVyRmo.cjs"),require("./dialog-content-D1aMHnPF.cjs"),require("./dialog-service-CgJH8clD.cjs"),require("./divider-PDyRDKLg.cjs"),require("./dropdown-content-4VFUPSIJ.cjs"),require("./timezone-BGgX7VU3.cjs"),require("./form-Cl1dBHEC.cjs"),require("./icon-6lRY13IZ.cjs"),require("./input-BJ73v2t7.cjs"),require("./flex-BNyBqVQE.cjs"),require("./list-Cr5bjF_6.cjs"),require("./email-recipients-CWuZ6PTF.cjs"),require("./map-C89AQAh-.cjs"),require("./menu-9KPQvqqI.cjs");const W=require("lit/directives/when.js");require("./notification-service-7NEpiPIR.cjs"),require("./option-C4G7DGtI.cjs"),require("./progress-Bkugth6y.cjs"),require("./radio-button-DCKG8p75.cjs"),require("./index-CCi1otmh.cjs"),require("./select-BTIUXOs_.cjs"),require("./sheet-BiElPoDB.cjs");const P=require("./sheet.service-BxvWBGsJ.cjs");require("./slider-CwX-MWmI.cjs"),require("./schmancy-steps-container-xIqWhNoQ.cjs"),require("./context-object-bNADqf9U.cjs");const N=require("rxjs/operators");require("./surface-BbQxucUq.cjs"),require("./table-D-GttRq4.cjs"),require("./tabs-compatibility-CdydM7pv.cjs"),require("./textarea-BxmPIhSX.cjs"),require("./theme.component-BWpLpI0u.cjs"),require("./theme-button-EkMBPnXv.cjs"),require("./tooltip-BvM1QM9r.cjs"),require("./tree-BGHP-zFq.cjs"),require("./typewriter-ovVSo7i3.cjs"),require("./typography-BKpY6oL9.cjs");const o=require("./theme.interface-Xg5Zi46a.cjs");var R=Object.defineProperty,X=Object.getOwnPropertyDescriptor,g=(e,t,s,i)=>{for(var c,r=i>1?void 0:i?X(t,s):t,h=e.length-1;h>=0;h--)(c=e[h])&&(r=(i?c(t,s,r):c(r))||r);return i&&r&&R(t,s,r),r};exports.SchmancyBadgeV2=class extends _.TailwindElement(l.css`
1
+ "use strict";const l=require("lit"),a=require("lit/decorators.js"),n=require("rxjs");require("./animated-text-DBRSI9xt.cjs");const $=require("./area.component-VxW9QIje.cjs");require("./autocomplete-BFN4UGNs.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const _=require("./tailwind.mixin-DvXzFSLc.cjs"),C=require("./ripple-DqQrvaTe.cjs");require("lit/directives/guard.js"),require("./boat-CsVNMu2n.cjs"),require("./spinner-Cm2yObux.cjs"),require("./icon-button-B9Xckdkv.cjs"),require("./media-v4K8T9FY.cjs"),require("./checkbox-B5XA1Ugc.cjs"),require("./chips-BWSXmedd.cjs"),require("./code-preview-U3CqjP3A.cjs"),require("./payment-card-form-BzGdWKH-.cjs");const p=require("./types.cjs"),m=require("./provide-BxZ2kn_p.cjs"),b=require("./litElement.mixin-BnXm63YO.cjs"),d=require("./consume-edta5ng5.cjs");require("./date-range-1smHimq3.cjs"),require("./date-range-inline-DyGBs-PG.cjs"),require("./delay-R0ZUrPTI.cjs"),require("./details-CudVyRmo.cjs"),require("./dialog-content-D1aMHnPF.cjs"),require("./dialog-service-CgJH8clD.cjs"),require("./divider-PDyRDKLg.cjs"),require("./dropdown-content-4VFUPSIJ.cjs"),require("./timezone-BGgX7VU3.cjs"),require("./form-Cl1dBHEC.cjs"),require("./icon-6lRY13IZ.cjs"),require("./input-BJ73v2t7.cjs"),require("./flex-BNyBqVQE.cjs"),require("./list-Cr5bjF_6.cjs"),require("./email-recipients-CWuZ6PTF.cjs"),require("./map-C89AQAh-.cjs"),require("./menu-9KPQvqqI.cjs");const W=require("lit/directives/when.js");require("./notification-service-7NEpiPIR.cjs"),require("./option-C4G7DGtI.cjs"),require("./progress-Bkugth6y.cjs"),require("./radio-button-DCKG8p75.cjs"),require("./index-CCi1otmh.cjs"),require("./select-BTIUXOs_.cjs"),require("./sheet-BiElPoDB.cjs");const P=require("./sheet.service-BxvWBGsJ.cjs");require("./slider-CwX-MWmI.cjs"),require("./schmancy-steps-container-xIqWhNoQ.cjs"),require("./context-object-bNADqf9U.cjs");const N=require("rxjs/operators");require("./surface-BbQxucUq.cjs"),require("./table-D-GttRq4.cjs"),require("./tabs-compatibility-CdydM7pv.cjs"),require("./textarea-BxmPIhSX.cjs"),require("./theme.component-BWpLpI0u.cjs"),require("./theme-button-EkMBPnXv.cjs"),require("./tooltip-BvM1QM9r.cjs"),require("./tree-BGHP-zFq.cjs"),require("./typewriter-ovVSo7i3.cjs"),require("./typography-BKpY6oL9.cjs");const o=require("./theme.interface-Xg5Zi46a.cjs");var R=Object.defineProperty,X=Object.getOwnPropertyDescriptor,g=(e,t,s,i)=>{for(var c,r=i>1?void 0:i?X(t,s):t,h=e.length-1;h>=0;h--)(c=e[h])&&(r=(i?c(t,s,r):c(r))||r);return i&&r&&R(t,s,r),r};exports.SchmancyBadgeV2=class extends _.TailwindElement(l.css`
2
2
  :host {
3
3
  display: inline-flex;
4
4
  }
@@ -154,4 +154,4 @@
154
154
  `}getColorAttributes(){const e={primary:{bgColor:o.SchmancyTheme.sys.color.primary.container,color:o.SchmancyTheme.sys.color.primary.onContainer},secondary:{bgColor:o.SchmancyTheme.sys.color.secondary.container,color:o.SchmancyTheme.sys.color.secondary.onContainer},tertiary:{bgColor:o.SchmancyTheme.sys.color.tertiary.container,color:o.SchmancyTheme.sys.color.tertiary.onContainer},success:{bgColor:o.SchmancyTheme.sys.color.success.container,color:o.SchmancyTheme.sys.color.success.onContainer},error:{bgColor:o.SchmancyTheme.sys.color.error.container,color:o.SchmancyTheme.sys.color.error.onContainer},neutral:{bgColor:o.SchmancyTheme.sys.color.surface.container,color:o.SchmancyTheme.sys.color.surface.on}};return C.color(e[this.color])}renderStatusIndicator(){const e={online:o.SchmancyTheme.sys.color.success.default,offline:o.SchmancyTheme.sys.color.surface.onVariant,busy:o.SchmancyTheme.sys.color.error.default,away:o.SchmancyTheme.sys.color.tertiary.default},t={"absolute bottom-0 right-0 rounded-full border-2 border-surface-default":!0,[{xs:"w-1.5 h-1.5",sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3",xl:"w-4 h-4"}[this.size]]:!0};return l.html`
155
155
  <div class="${this.classMap(t)}" style="background-color: ${e[this.status]};"></div>
156
156
  `}},u([a.property({type:String})],exports.SchmancyAvatar.prototype,"initials",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"src",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"icon",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"size",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"color",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"shape",2),u([a.property({type:Boolean})],exports.SchmancyAvatar.prototype,"bordered",2),u([a.property({type:String})],exports.SchmancyAvatar.prototype,"status",2),exports.SchmancyAvatar=u([a.customElement("schmancy-avatar")],exports.SchmancyAvatar),exports.$drawer=Q,exports.HereMorty=B,exports.SchmancyContentDrawerID=A,exports.SchmancyContentDrawerMaxHeight=M,exports.SchmancyContentDrawerMinWidth=k,exports.SchmancyContentDrawerSheetMode=q,exports.SchmancyContentDrawerSheetState=j,exports.SchmancyDrawerNavbarMode=O,exports.SchmancyDrawerNavbarState=z,exports.WhereAreYouRicky=I,exports.schmancyContentDrawer=V,exports.schmancyNavDrawer=H,exports.teleport=x;
157
- //# sourceMappingURL=avatar-B51KRC34.cjs.map
157
+ //# sourceMappingURL=avatar-8S9Tq43j.cjs.map