@dooboostore/simple-web-component 1.0.25 → 1.0.27

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 (82) hide show
  1. package/README.md +284 -68
  2. package/dist/cjs/decorators/attribute.js +32 -43
  3. package/dist/cjs/decorators/attribute.js.map +3 -3
  4. package/dist/cjs/decorators/elementDefine.js +33 -19
  5. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  6. package/dist/cjs/decorators/index.js +1 -0
  7. package/dist/cjs/decorators/index.js.map +2 -2
  8. package/dist/cjs/decorators/lifecycles.js +5 -5
  9. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  10. package/dist/cjs/decorators/query.js +4 -4
  11. package/dist/cjs/decorators/query.js.map +2 -2
  12. package/dist/cjs/decorators/queryAll.js +4 -4
  13. package/dist/cjs/decorators/queryAll.js.map +2 -2
  14. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js +59 -0
  15. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  16. package/dist/cjs/elements/SwcAppEngine.js +18 -63
  17. package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
  18. package/dist/cjs/elements/SwcAppMixin.js +103 -24
  19. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  20. package/dist/cjs/elements/register.js +0 -1
  21. package/dist/cjs/elements/register.js.map +2 -2
  22. package/dist/cjs/utils/Utils.js +18 -0
  23. package/dist/cjs/utils/Utils.js.map +3 -3
  24. package/dist/esm/decorators/attribute.js +32 -43
  25. package/dist/esm/decorators/attribute.js.map +3 -3
  26. package/dist/esm/decorators/elementDefine.js +34 -20
  27. package/dist/esm/decorators/elementDefine.js.map +2 -2
  28. package/dist/esm/decorators/index.js +1 -0
  29. package/dist/esm/decorators/index.js.map +2 -2
  30. package/dist/esm/decorators/lifecycles.js +5 -5
  31. package/dist/esm/decorators/lifecycles.js.map +2 -2
  32. package/dist/esm/decorators/query.js +4 -4
  33. package/dist/esm/decorators/query.js.map +2 -2
  34. package/dist/esm/decorators/queryAll.js +4 -4
  35. package/dist/esm/decorators/queryAll.js.map +2 -2
  36. package/dist/esm/decorators/subscribeSwcAppRouteChange.js +40 -0
  37. package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  38. package/dist/esm/elements/SwcAppEngine.js +18 -63
  39. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  40. package/dist/esm/elements/SwcAppMixin.js +103 -24
  41. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  42. package/dist/esm/elements/register.js +0 -1
  43. package/dist/esm/elements/register.js.map +2 -2
  44. package/dist/esm/utils/Utils.js +18 -0
  45. package/dist/esm/utils/Utils.js.map +3 -3
  46. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +135 -2470
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  48. package/dist/types/decorators/attribute.d.ts +0 -1
  49. package/dist/types/decorators/attribute.d.ts.map +1 -1
  50. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  51. package/dist/types/decorators/index.d.ts +1 -0
  52. package/dist/types/decorators/index.d.ts.map +1 -1
  53. package/dist/types/decorators/lifecycles.d.ts +2 -2
  54. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  55. package/dist/types/decorators/query.d.ts +1 -1
  56. package/dist/types/decorators/query.d.ts.map +1 -1
  57. package/dist/types/decorators/queryAll.d.ts +1 -1
  58. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  59. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +18 -0
  60. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
  61. package/dist/types/elements/SwcAppEngine.d.ts +3 -5
  62. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  63. package/dist/types/elements/SwcAppMixin.d.ts +9 -0
  64. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  65. package/dist/types/elements/register.d.ts +1 -1
  66. package/dist/types/elements/register.d.ts.map +1 -1
  67. package/dist/types/utils/Utils.d.ts +3 -0
  68. package/dist/types/utils/Utils.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +135 -2470
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/decorators/attribute.ts +62 -53
  73. package/src/decorators/elementDefine.ts +79 -30
  74. package/src/decorators/index.ts +1 -0
  75. package/src/decorators/lifecycles.ts +2 -2
  76. package/src/decorators/query.ts +5 -5
  77. package/src/decorators/queryAll.ts +8 -7
  78. package/src/decorators/subscribeSwcAppRouteChange.ts +71 -0
  79. package/src/elements/SwcAppEngine.ts +25 -81
  80. package/src/elements/SwcAppMixin.ts +143 -28
  81. package/src/elements/register.ts +0 -2
  82. package/src/utils/Utils.ts +33 -0
@@ -303,8 +303,8 @@ var dooboostoreSimpleWebComponent = (() => {
303
303
  keys.push(key);
304
304
  }
305
305
  }
306
- for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
307
- var key = parentKeys_1[_a4];
306
+ for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
307
+ var key = parentKeys_1[_a];
308
308
  var hasKey = set.has(key);
309
309
  if (!hasKey) {
310
310
  set.add(key);
@@ -1139,10 +1139,11 @@ var dooboostoreSimpleWebComponent = (() => {
1139
1139
  ON_BEFORE_ADOPTED_METADATA_KEY: () => ON_BEFORE_ADOPTED_METADATA_KEY,
1140
1140
  ON_BEFORE_CONNECTED_METADATA_KEY: () => ON_BEFORE_CONNECTED_METADATA_KEY,
1141
1141
  ON_BEFORE_DISCONNECTED_METADATA_KEY: () => ON_BEFORE_DISCONNECTED_METADATA_KEY,
1142
- ON_CONSTRUCTOR_METADATA_KEY: () => ON_CONSTRUCTOR_METADATA_KEY,
1142
+ ON_INITIALIZE_METADATA_KEY: () => ON_INITIALIZE_METADATA_KEY,
1143
1143
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
1144
1144
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
1145
1145
  STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
1146
+ SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY: () => SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY,
1146
1147
  SWC_NOT_FOUND: () => SWC_NOT_FOUND,
1147
1148
  SwcUtils: () => SwcUtils,
1148
1149
  addClass: () => addClass,
@@ -1194,6 +1195,7 @@ var dooboostoreSimpleWebComponent = (() => {
1194
1195
  getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
1195
1196
  getQueryAllMetadata: () => getQueryAllMetadata,
1196
1197
  getQueryMetadata: () => getQueryMetadata,
1198
+ getSubscribeSwcAppRouteChangeMetadata: () => getSubscribeSwcAppRouteChangeMetadata,
1197
1199
  host: () => host,
1198
1200
  htmlAElement: () => htmlAElement,
1199
1201
  htmlArticleElement: () => htmlArticleElement,
@@ -1218,8 +1220,8 @@ var dooboostoreSimpleWebComponent = (() => {
1218
1220
  onBeforeDisconnected: () => onBeforeDisconnected,
1219
1221
  onConnected: () => onConnected,
1220
1222
  onConnectedInnerHtml: () => onConnectedInnerHtml,
1221
- onConstructor: () => onConstructor,
1222
1223
  onDisconnected: () => onDisconnected,
1224
+ onInitialize: () => onInitialize,
1223
1225
  parentHost: () => parentHost,
1224
1226
  query: () => query,
1225
1227
  queryAll: () => queryAll,
@@ -1238,6 +1240,7 @@ var dooboostoreSimpleWebComponent = (() => {
1238
1240
  setClassHost: () => setClassHost,
1239
1241
  setStyle: () => setStyle,
1240
1242
  setStyleHost: () => setStyleHost,
1243
+ subscribeSwcAppRouteChange: () => subscribeSwcAppRouteChange,
1241
1244
  textNode: () => textNode,
1242
1245
  toggleClass: () => toggleClass,
1243
1246
  toggleClassHost: () => toggleClassHost,
@@ -1248,10 +1251,10 @@ var dooboostoreSimpleWebComponent = (() => {
1248
1251
  updateStyle: () => updateStyle,
1249
1252
  updateStyleHost: () => updateStyleHost
1250
1253
  });
1251
- var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1254
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1252
1255
 
1253
1256
  // src/index.ts
1254
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1257
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
1255
1258
 
1256
1259
  // ../core/dist/esm/valid/ValidUtils.js
1257
1260
  var ValidUtils;
@@ -4927,107 +4930,6 @@ var dooboostoreSimpleWebComponent = (() => {
4927
4930
  }
4928
4931
  };
4929
4932
 
4930
- // ../core/dist/esm/message/Subject.js
4931
- var Subject = class extends Observable {
4932
- constructor() {
4933
- super((subscriber) => {
4934
- return this._subscribeToSubject(subscriber);
4935
- });
4936
- this._observers = /* @__PURE__ */ new Set();
4937
- this._isStopped = false;
4938
- this._hasError = false;
4939
- }
4940
- _subscribeToSubject(subscriber) {
4941
- const partialObserver = {
4942
- next: subscriber.next.bind(subscriber),
4943
- error: subscriber.error.bind(subscriber),
4944
- complete: subscriber.complete.bind(subscriber)
4945
- };
4946
- if (this._isStopped) {
4947
- if (this._hasError) {
4948
- partialObserver.error?.(this._error);
4949
- } else {
4950
- partialObserver.complete?.();
4951
- }
4952
- return Subscription.EMPTY;
4953
- }
4954
- this._observers.add(partialObserver);
4955
- return new Subscription(() => {
4956
- this._observers.delete(partialObserver);
4957
- });
4958
- }
4959
- next(data) {
4960
- if (this._isStopped) {
4961
- return;
4962
- }
4963
- this._observers.forEach((observer) => {
4964
- observer.next?.(data);
4965
- });
4966
- }
4967
- error(err) {
4968
- if (this._isStopped) {
4969
- return;
4970
- }
4971
- this._hasError = true;
4972
- this._error = err;
4973
- this._isStopped = true;
4974
- this._observers.forEach((observer) => observer.error?.(err));
4975
- this._observers.clear();
4976
- }
4977
- complete() {
4978
- if (this._isStopped) {
4979
- return;
4980
- }
4981
- this._isStopped = true;
4982
- this._observers.forEach((observer) => observer.complete?.());
4983
- this._observers.clear();
4984
- }
4985
- asObservable() {
4986
- return new Observable((subscriber) => {
4987
- return this._subscribeToSubject(subscriber);
4988
- });
4989
- }
4990
- };
4991
-
4992
- // ../core/dist/esm/message/ReplaySubject.js
4993
- var ReplaySubject = class extends Subject {
4994
- // Removed: private _error: E | undefined;
4995
- // Removed: private _isStopped = false;
4996
- constructor(bufferSize = Infinity) {
4997
- super();
4998
- this.bufferSize = bufferSize;
4999
- this._buffer = [];
5000
- }
5001
- next(data) {
5002
- if (this._isStopped) {
5003
- return;
5004
- }
5005
- this._buffer.push(data);
5006
- if (this._buffer.length > this.bufferSize) {
5007
- this._buffer.shift();
5008
- }
5009
- super.next(data);
5010
- }
5011
- error(err) {
5012
- super.error(err);
5013
- }
5014
- complete() {
5015
- super.complete();
5016
- }
5017
- _subscribeToSubject(subscriber) {
5018
- this._buffer.forEach((value) => subscriber.next(value));
5019
- if (this._isStopped) {
5020
- if (this._hasError) {
5021
- subscriber.error(this._error);
5022
- } else {
5023
- subscriber.complete();
5024
- }
5025
- return Subscription.EMPTY;
5026
- }
5027
- return super._subscribeToSubject(subscriber);
5028
- }
5029
- };
5030
-
5031
4933
  // ../core/dist/esm/message/AutoCloseSubscription.js
5032
4934
  var AutoCloseSubscription = class extends Subscription {
5033
4935
  constructor(userUnsubscribe) {
@@ -5362,284 +5264,6 @@ var dooboostoreSimpleWebComponent = (() => {
5362
5264
  })(Result = Promises2.Result || (Promises2.Result = {}));
5363
5265
  })(Promises || (Promises = {}));
5364
5266
 
5365
- // ../core/dist/esm/fetch/Fetcher.js
5366
- var Fetcher = class {
5367
- createPipe(config) {
5368
- return {};
5369
- }
5370
- fetch(config) {
5371
- return new Promise((resolve, reject) => {
5372
- const pipe = this.createPipe(config);
5373
- Promise.resolve().then(() => {
5374
- this.before(config, pipe);
5375
- config?.before?.();
5376
- }).then(() => {
5377
- return this.execute(config);
5378
- }).then((data) => {
5379
- const hasError = config.config?.hasErrorChecker?.(data);
5380
- if (hasError) {
5381
- throw hasError;
5382
- }
5383
- pipe.responseData = data;
5384
- this.afterSuccess(config, pipe);
5385
- config?.afterSuccess?.();
5386
- const gdata = config?.transform ? config.transform(data) : data;
5387
- this.afterSuccessTransform(config, pipe);
5388
- resolve(gdata);
5389
- }).catch(async (e) => {
5390
- this.error(config, pipe, e);
5391
- config?.error?.();
5392
- if (config?.errorTransform) {
5393
- e = await config.errorTransform(e);
5394
- }
5395
- e = await this.errorTransform(e);
5396
- reject(e);
5397
- }).finally(() => {
5398
- this.finally(config, pipe);
5399
- config?.finally?.();
5400
- });
5401
- });
5402
- }
5403
- };
5404
-
5405
- // ../core/dist/esm/fetch/HttpFetcher.js
5406
- var HttpResponseError = class extends Error {
5407
- };
5408
- var HttpFetcher = class extends Fetcher {
5409
- get(config) {
5410
- config.config ?? (config.config = {});
5411
- config.config.fetch = config.config?.fetch ?? {};
5412
- config.config.fetch.method = "GET";
5413
- return this.fetch(config);
5414
- }
5415
- post(config) {
5416
- config.config ?? (config.config = {});
5417
- config.config.fetch = config.config?.fetch ?? {};
5418
- config.config.fetch.method = "POST";
5419
- return this.fetch(config);
5420
- }
5421
- patch(config) {
5422
- config.config ?? (config.config = {});
5423
- config.config.fetch = config.config?.fetch ?? {};
5424
- config.config.fetch.method = "PATCH";
5425
- return this.fetch(config);
5426
- }
5427
- put(config) {
5428
- config.config ?? (config.config = {});
5429
- config.config.fetch = config.config?.fetch ?? {};
5430
- config.config.fetch.method = "PUT";
5431
- return this.fetch(config);
5432
- }
5433
- head(config) {
5434
- config.config ?? (config.config = {});
5435
- config.config.fetch = config.config?.fetch ?? {};
5436
- config.config.fetch.method = "HEAD";
5437
- return this.fetch(config);
5438
- }
5439
- delete(config) {
5440
- config.config ?? (config.config = {});
5441
- config.config.fetch = config.config?.fetch ?? {};
5442
- config.config.fetch.method = "DELETE";
5443
- return this.fetch(config);
5444
- }
5445
- async beforeProxyFetch(config) {
5446
- return config;
5447
- }
5448
- async afterProxyFetch(config) {
5449
- return config.response;
5450
- }
5451
- afterSuccess(config, pipe) {
5452
- }
5453
- afterSuccessTransform(config, pipe) {
5454
- }
5455
- before(config, pipe) {
5456
- }
5457
- error(config, pipe, e) {
5458
- }
5459
- finally(config, pipe) {
5460
- }
5461
- beforeFetch(fetch2) {
5462
- }
5463
- afterFetch(fetch2, response) {
5464
- }
5465
- // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5466
- async errorTransform(e) {
5467
- const httpResponseError = new HttpResponseError();
5468
- httpResponseError.error = e;
5469
- if (e instanceof Response) {
5470
- httpResponseError.response = e;
5471
- try {
5472
- httpResponseError.body = await e.clone().text();
5473
- httpResponseError.message = e.statusText;
5474
- } catch (e2) {
5475
- httpResponseError.body = e2;
5476
- httpResponseError.message = e2.message;
5477
- }
5478
- } else {
5479
- httpResponseError.body = e;
5480
- httpResponseError.message = e.message;
5481
- }
5482
- return httpResponseError;
5483
- }
5484
- async execute(fetcherRequest) {
5485
- let target = fetcherRequest.target;
5486
- let config = fetcherRequest.config;
5487
- if (!(target instanceof URL) && typeof target !== "string") {
5488
- const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5489
- try {
5490
- const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5491
- searchParams.forEach((value, key) => {
5492
- url.searchParams.append(key, value);
5493
- });
5494
- target = url;
5495
- } catch (e) {
5496
- if (typeof target.url === "string") {
5497
- const searchParamString = searchParams.toString();
5498
- target = target.url + (searchParamString ? "?" + searchParamString : "");
5499
- } else {
5500
- target = "";
5501
- }
5502
- }
5503
- }
5504
- const beforeProxyData = { requestInfo: target, init: config?.fetch };
5505
- let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5506
- beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5507
- target = beforeData.requestInfo;
5508
- if (beforeData.init) {
5509
- config ?? (config = {});
5510
- config.fetch = beforeData.init;
5511
- }
5512
- let abortedTimeout;
5513
- if (config?.fetch && "timeout" in config.fetch) {
5514
- const abortController = new AbortController();
5515
- abortedTimeout = setTimeout(() => {
5516
- if (config?.fetch?.signal) {
5517
- const inputSignal = config.fetch.signal;
5518
- const listener = () => {
5519
- if (!abortController.signal.aborted) {
5520
- abortController.abort();
5521
- }
5522
- inputSignal.removeEventListener("abort", listener);
5523
- };
5524
- inputSignal.addEventListener("abort", listener);
5525
- }
5526
- if (!abortController.signal.aborted) {
5527
- abortController.abort();
5528
- }
5529
- }, config.fetch.timeout);
5530
- config.fetch.signal = abortController.signal;
5531
- }
5532
- this.beforeFetch({ target, requestInit: config?.fetch });
5533
- return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5534
- this.afterFetch({ target, requestInit: config?.fetch }, it);
5535
- const afterProxyData = {
5536
- fetch: { target, requestInit: config.fetch },
5537
- config: beforeData,
5538
- response: it
5539
- };
5540
- it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5541
- it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5542
- config?.fetchResponseAfterCallBack?.(it, config);
5543
- if (!config?.allowedResponseNotOk && !it.ok) {
5544
- throw it;
5545
- }
5546
- const data = config?.hasResponseErrorChecker?.(it, config);
5547
- if (data) {
5548
- throw data;
5549
- }
5550
- return it;
5551
- }).finally(() => {
5552
- if (abortedTimeout) {
5553
- clearTimeout(abortedTimeout);
5554
- }
5555
- });
5556
- }
5557
- };
5558
-
5559
- // ../core/dist/esm/fetch/HttpJsonFetcher.js
5560
- var HttpJsonFetcher = class extends HttpFetcher {
5561
- updateJsonFetchConfigAndData(config) {
5562
- var _a4, _b2;
5563
- const headers = {
5564
- "Content-Type": "application/json",
5565
- Accept: "application/json, text/plain, */*"
5566
- };
5567
- config.config ?? (config.config = {});
5568
- (_a4 = config.config).fetch ?? (_a4.fetch = {});
5569
- (_b2 = config.config.fetch).headers ?? (_b2.headers = {});
5570
- config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5571
- if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5572
- config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5573
- }
5574
- return config;
5575
- }
5576
- get(config) {
5577
- return super.get(config);
5578
- }
5579
- delete(config) {
5580
- return super.delete(config);
5581
- }
5582
- post(config) {
5583
- return super.post(config);
5584
- }
5585
- patch(config) {
5586
- return super.patch(config);
5587
- }
5588
- put(config) {
5589
- return super.put(config);
5590
- }
5591
- head(config) {
5592
- return super.head(config);
5593
- }
5594
- postJson(config) {
5595
- return super.post(this.updateJsonFetchConfigAndData(config));
5596
- }
5597
- patchJson(config) {
5598
- return super.patch(this.updateJsonFetchConfigAndData(config));
5599
- }
5600
- putJson(config) {
5601
- return super.put(this.updateJsonFetchConfigAndData(config));
5602
- }
5603
- async errorTransform(e) {
5604
- const httpResponseError = new HttpResponseError();
5605
- httpResponseError.error = e;
5606
- if (e instanceof Response) {
5607
- httpResponseError.response = e;
5608
- try {
5609
- httpResponseError.body = await e.clone().json();
5610
- httpResponseError.message = e.statusText;
5611
- } catch (parseError) {
5612
- httpResponseError.body = parseError;
5613
- httpResponseError.message = parseError.message;
5614
- }
5615
- } else {
5616
- httpResponseError.body = e;
5617
- httpResponseError.message = e.message;
5618
- }
5619
- return httpResponseError;
5620
- }
5621
- // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5622
- execute(fetcherRequest) {
5623
- return super.execute(fetcherRequest).then((response) => {
5624
- const config = fetcherRequest.config;
5625
- const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5626
- if (transform === "response") {
5627
- return response;
5628
- } else if (transform === "text") {
5629
- return response?.text();
5630
- } else if (typeof transform === "function") {
5631
- return transform(response);
5632
- } else {
5633
- return response?.text().then((it) => {
5634
- if ((it ?? "").length > 0) {
5635
- return JSON.parse(it);
5636
- }
5637
- });
5638
- }
5639
- });
5640
- }
5641
- };
5642
-
5643
5267
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5644
5268
  var RenderDrawObj = class extends Obj {
5645
5269
  render(draw, config) {
@@ -6265,7 +5889,7 @@ var dooboostoreSimpleWebComponent = (() => {
6265
5889
  }
6266
5890
 
6267
5891
  // src/decorators/lifecycles.ts
6268
- var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
5892
+ var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6269
5893
  var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
6270
5894
  var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
6271
5895
  var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
@@ -6286,7 +5910,7 @@ var dooboostoreSimpleWebComponent = (() => {
6286
5910
  list.push(propertyKey);
6287
5911
  };
6288
5912
  }
6289
- var onConstructor = createLifecycleDecorator(ON_CONSTRUCTOR_METADATA_KEY);
5913
+ var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
6290
5914
  var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6291
5915
  var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6292
5916
  var onConnected = onAfterConnected;
@@ -6401,49 +6025,37 @@ var dooboostoreSimpleWebComponent = (() => {
6401
6025
  }
6402
6026
  });
6403
6027
  };
6404
- Object.defineProperty(target, propertyKey, {
6405
- get() {
6406
- const attrName = options.name || String(propertyKey);
6407
- const conf = getElementConfig(this);
6408
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6409
- const targetType = options.type || designType;
6410
- if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
6411
- return convertValue(this[privateKey], targetType);
6412
- }
6413
- const targets = resolveTargetEls(this, selector, options, currentWin);
6414
- const primaryTarget = targets[0];
6415
- if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
6416
- if (primaryTarget.hasAttribute(attrName)) {
6417
- const domVal = primaryTarget.getAttribute(attrName);
6418
- return convertValue(domVal, targetType);
6419
- }
6420
- return null;
6421
- }
6422
- return convertValue(this[privateKey], targetType);
6423
- },
6424
- set(nv) {
6425
- const attrName = options.name || String(propertyKey);
6426
- const conf = getElementConfig(this);
6427
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6428
- if (this.__swc_syncing_init) {
6429
- if (options.connectedInitialize === true) {
6430
- const targets2 = resolveTargetEls(this, selector, options, currentWin);
6431
- applySetAttribute(this, targets2, attrName, nv);
6432
- } else {
6433
- this[privateKey] = nv;
6028
+ try {
6029
+ Object.defineProperty(target, propertyKey, {
6030
+ get() {
6031
+ const attrName = options.name || String(propertyKey);
6032
+ const conf = getElementConfig(this);
6033
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6034
+ const targetType = options.type || designType;
6035
+ const targets = resolveTargetEls(this, selector, options, currentWin);
6036
+ const primaryTarget = targets[0];
6037
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
6038
+ if (primaryTarget.hasAttribute(attrName)) {
6039
+ const domVal = primaryTarget.getAttribute(attrName);
6040
+ return convertValue(domVal, targetType);
6041
+ }
6042
+ return null;
6434
6043
  }
6435
- return;
6436
- }
6437
- if (!this.__swc_connected) {
6438
- this[privateKey] = nv;
6439
- return;
6440
- }
6441
- const targets = resolveTargetEls(this, selector, options, currentWin);
6442
- applySetAttribute(this, targets, attrName, nv);
6443
- },
6444
- enumerable: true,
6445
- configurable: true
6446
- });
6044
+ return convertValue(this[privateKey], targetType);
6045
+ },
6046
+ set(nv) {
6047
+ const attrName = options.name || String(propertyKey);
6048
+ const conf = getElementConfig(this);
6049
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6050
+ const targets = resolveTargetEls(this, selector, options, currentWin);
6051
+ applySetAttribute(this, targets, attrName, nv);
6052
+ },
6053
+ enumerable: true,
6054
+ configurable: true
6055
+ });
6056
+ } catch (err) {
6057
+ console.error("[SWC] defineProperty error:", err);
6058
+ }
6447
6059
  };
6448
6060
  }
6449
6061
  function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
@@ -6466,7 +6078,8 @@ var dooboostoreSimpleWebComponent = (() => {
6466
6078
  }
6467
6079
  }
6468
6080
  var findAllAttributeMetadata = (target) => {
6469
- return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
6081
+ const actualTarget = target instanceof Function ? target : target.constructor;
6082
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
6470
6083
  };
6471
6084
 
6472
6085
  // src/decorators/changedAttributeHost.ts
@@ -6722,10 +6335,6 @@ var dooboostoreSimpleWebComponent = (() => {
6722
6335
  });
6723
6336
  };
6724
6337
  }
6725
- var getQueryMetadata = (target) => {
6726
- const constructor = target instanceof Function ? target : target.constructor;
6727
- return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6728
- };
6729
6338
  function queryHost(targetOrOptions, propertyKey) {
6730
6339
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6731
6340
  return query(":host", {})(targetOrOptions, propertyKey);
@@ -6797,6 +6406,10 @@ var dooboostoreSimpleWebComponent = (() => {
6797
6406
  return query(":lastAppHost", {});
6798
6407
  }
6799
6408
  }
6409
+ var getQueryMetadata = (target) => {
6410
+ const constructor = target instanceof Function ? target : target.constructor;
6411
+ return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6412
+ };
6800
6413
 
6801
6414
  // src/decorators/queryAll.ts
6802
6415
  var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
@@ -6890,10 +6503,6 @@ var dooboostoreSimpleWebComponent = (() => {
6890
6503
  });
6891
6504
  };
6892
6505
  }
6893
- var getQueryAllMetadata = (target) => {
6894
- const constructor = target instanceof Function ? target : target.constructor;
6895
- return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6896
- };
6897
6506
  function queryAllHost(targetOrOptions, propertyKey) {
6898
6507
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6899
6508
  return queryAll(":host", {})(targetOrOptions, propertyKey);
@@ -6965,6 +6574,10 @@ var dooboostoreSimpleWebComponent = (() => {
6965
6574
  return queryAll(":lastAppHost", {});
6966
6575
  }
6967
6576
  }
6577
+ var getQueryAllMetadata = (target) => {
6578
+ const constructor = target instanceof Function ? target : target.constructor;
6579
+ return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6580
+ };
6968
6581
 
6969
6582
  // src/decorators/applyClass.ts
6970
6583
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -7310,6 +6923,41 @@ var dooboostoreSimpleWebComponent = (() => {
7310
6923
  return result;
7311
6924
  };
7312
6925
 
6926
+ // src/decorators/subscribeSwcAppRouteChange.ts
6927
+ var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change");
6928
+ function createSwcAppRouteChangeSubscriber(options) {
6929
+ return (target, propertyKey, descriptor) => {
6930
+ const pathPattern = options?.path;
6931
+ const filter = options?.filter;
6932
+ const constructor = target.constructor;
6933
+ let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6934
+ if (!list) {
6935
+ list = [];
6936
+ ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);
6937
+ }
6938
+ list.push({ propertyKey, pathPattern, filter });
6939
+ return descriptor;
6940
+ };
6941
+ }
6942
+ function subscribeSwcAppRouteChange(targetOrOptions, propertyKey, descriptor) {
6943
+ if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6944
+ return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);
6945
+ }
6946
+ let options = {};
6947
+ if (Array.isArray(targetOrOptions)) {
6948
+ options.path = targetOrOptions;
6949
+ } else if (typeof targetOrOptions === "string") {
6950
+ options.path = targetOrOptions;
6951
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
6952
+ options = targetOrOptions;
6953
+ }
6954
+ return createSwcAppRouteChangeSubscriber(options);
6955
+ }
6956
+ var getSubscribeSwcAppRouteChangeMetadata = (target) => {
6957
+ const constructor = target instanceof Function ? target : target.constructor;
6958
+ return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6959
+ };
6960
+
7313
6961
  // src/utils/Utils.ts
7314
6962
  var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
7315
6963
  var htmlFragment = (html, doc) => {
@@ -7545,6 +7193,24 @@ var dooboostoreSimpleWebComponent = (() => {
7545
7193
  ...loopContext
7546
7194
  };
7547
7195
  };
7196
+ SwcUtils2.parsePathPattern = (pattern, currentPath) => {
7197
+ if (pattern === null || pattern === void 0) return {};
7198
+ const trimmedPattern = pattern.trim();
7199
+ if (trimmedPattern === "" && pattern !== "") return {};
7200
+ const paramNames = [];
7201
+ const regexPattern = trimmedPattern.replace(/{(\w+)(?::(.+?))?}/g, (match2, paramName, customRegex) => {
7202
+ paramNames.push(paramName);
7203
+ return `(${customRegex || "[^/]+"})`;
7204
+ });
7205
+ const regex = new RegExp(`^${regexPattern}$`);
7206
+ const match = currentPath.match(regex);
7207
+ if (!match) return null;
7208
+ const result = {};
7209
+ paramNames.forEach((name, index) => {
7210
+ result[name] = match[index + 1];
7211
+ });
7212
+ return result;
7213
+ };
7548
7214
  })(SwcUtils || (SwcUtils = {}));
7549
7215
 
7550
7216
  // src/decorators/emitCustomEvent.ts
@@ -7712,46 +7378,7 @@ var dooboostoreSimpleWebComponent = (() => {
7712
7378
  return this.containers.find(predicate);
7713
7379
  }
7714
7380
  };
7715
- var isTargetSymbol = (config) => {
7716
- return "symbol" in config && config.symbol !== void 0;
7717
- };
7718
- var isTargetType = (config) => {
7719
- return "type" in config && config.type !== void 0;
7720
- };
7721
- var isTargetScheme = (config) => {
7722
- return "scheme" in config && config.scheme !== void 0;
7723
- };
7724
- var isTargetFactory = (config) => {
7725
- return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7726
- };
7727
7381
  var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7728
- var injectProcess = (config, target, propertyKey, parameterIndex) => {
7729
- if (propertyKey && typeof target === "object") {
7730
- const otarget = target;
7731
- target = target.constructor;
7732
- const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
7733
- const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
7734
- saves.push({ index: parameterIndex, config, propertyKey, type });
7735
- ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
7736
- } else if (!propertyKey || typeof target === "function") {
7737
- const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
7738
- const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
7739
- existingInjectdParameters.push({ index: parameterIndex, config, type });
7740
- ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
7741
- }
7742
- };
7743
- function Inject(configOrTarget, propertyKey, parameterIndex) {
7744
- if (propertyKey && parameterIndex !== void 0) {
7745
- injectProcess({}, configOrTarget, propertyKey, parameterIndex);
7746
- } else {
7747
- return (target, propertyKey2, parameterIndex2) => {
7748
- injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
7749
- };
7750
- }
7751
- }
7752
- var getInject = (target, propertyKey) => {
7753
- return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7754
- };
7755
7382
 
7756
7383
  // src/types.ts
7757
7384
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7780,9 +7407,26 @@ var dooboostoreSimpleWebComponent = (() => {
7780
7407
  inst._emitHandlers = /* @__PURE__ */ new Map();
7781
7408
  inst._boundListeners = [];
7782
7409
  inst.__swc_initialized = true;
7410
+ const target = inst instanceof Function ? inst : inst.constructor;
7411
+ const attributeList = findAllAttributeMetadata(target);
7412
+ attributeList.forEach((meta) => {
7413
+ delete inst[meta.propertyKey];
7414
+ });
7415
+ const queryList = getQueryMetadata(target);
7416
+ if (queryList) {
7417
+ queryList.forEach((meta) => {
7418
+ delete inst[meta.propertyKey];
7419
+ });
7420
+ }
7421
+ const queryAllList = getQueryAllMetadata(target);
7422
+ if (queryAllList) {
7423
+ queryAllList.forEach((meta) => {
7424
+ delete inst[meta.propertyKey];
7425
+ });
7426
+ }
7783
7427
  const hostSet = SwcUtils.getHostSet(inst);
7784
7428
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
7785
- const cMethods = findAllLifecycleMetadata(inst, ON_CONSTRUCTOR_METADATA_KEY);
7429
+ const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
7786
7430
  if (cMethods) {
7787
7431
  for (const m of cMethods) inst._invokeLifecycleMethod(m, hostSet);
7788
7432
  }
@@ -7949,12 +7593,12 @@ var dooboostoreSimpleWebComponent = (() => {
7949
7593
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
7950
7594
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7951
7595
  const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7952
- const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
7596
+ const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
7953
7597
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7954
7598
  ...metadata.observedAttributes ?? [],
7955
7599
  ...attrChangeMap.keys(),
7956
7600
  ...attributeApplyNames,
7957
- ...attributeListNames,
7601
+ ...hostAttributes,
7958
7602
  ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7959
7603
  ...swcLifecycleAttributes,
7960
7604
  ...swcOnEvents
@@ -7965,30 +7609,18 @@ var dooboostoreSimpleWebComponent = (() => {
7965
7609
  const originalConnected = proto.connectedCallback;
7966
7610
  proto.connectedCallback = function() {
7967
7611
  ensureInit2(this);
7612
+ const hostSet = SwcUtils.getHostSet(this);
7613
+ const appHost2 = hostSet.$appHost;
7614
+ const conf = getElementConfig(this);
7615
+ const currentWin = this._resolveWindow(conf);
7968
7616
  if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
7969
7617
  this.attachShadow({ mode: "open" });
7970
7618
  }
7971
- const conf = getElementConfig(this);
7972
- const currentWin = this._resolveWindow(conf);
7973
- const hostSet = SwcUtils.getHostSet(this);
7974
7619
  this._executeSwcScript("swc-on-before-connected", hostSet);
7975
7620
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7976
7621
  if (bMethods) {
7977
7622
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7978
7623
  }
7979
- attributeList.forEach((meta) => {
7980
- if (meta.options.connectedInitialize === true) {
7981
- this.__swc_syncing_init = true;
7982
- try {
7983
- const memoryVal = this[meta.privateKey];
7984
- if (memoryVal !== void 0) {
7985
- this[meta.propertyKey] = memoryVal;
7986
- }
7987
- } finally {
7988
- this.__swc_syncing_init = false;
7989
- }
7990
- }
7991
- });
7992
7624
  if (connectedInnerHtmlList.length > 0) {
7993
7625
  let sContent = "", lContent = "";
7994
7626
  for (const meta of connectedInnerHtmlList) {
@@ -8124,6 +7756,9 @@ var dooboostoreSimpleWebComponent = (() => {
8124
7756
  this._executeSwcScript("swc-on-connected", hostSet);
8125
7757
  this._executeSwcScript("swc-on-after-connected", hostSet);
8126
7758
  this.__swc_connected = true;
7759
+ if (appHost2 && typeof appHost2._connected === "function") {
7760
+ appHost2._connected(this);
7761
+ }
8127
7762
  };
8128
7763
  const originalDisconnected = proto.disconnectedCallback;
8129
7764
  proto.disconnectedCallback = function() {
@@ -8145,6 +7780,10 @@ var dooboostoreSimpleWebComponent = (() => {
8145
7780
  this._executeSwcScript("swc-on-disconnected", hostSet);
8146
7781
  this._executeSwcScript("swc-on-after-disconnected", hostSet);
8147
7782
  this.__swc_connected = false;
7783
+ const appHost2 = hostSet.$appHost;
7784
+ if (appHost2 && typeof appHost2._disconnected === "function") {
7785
+ appHost2._disconnected(this);
7786
+ }
8148
7787
  };
8149
7788
  const originalAdopted = proto.adoptedCallback;
8150
7789
  proto.adoptedCallback = function() {
@@ -8193,1187 +7832,28 @@ var dooboostoreSimpleWebComponent = (() => {
8193
7832
  return constructor;
8194
7833
  };
8195
7834
 
8196
- // ../simple-boot/dist/esm/throwable/SimError.js
8197
- var SimError = class {
8198
- constructor(message, name, stack) {
8199
- this.message = message;
8200
- this.name = name;
8201
- this.stack = stack;
8202
- }
8203
- };
8204
-
8205
- // ../simple-boot/dist/esm/throwable/SimNoSuch.js
8206
- var SimNoSuch = class extends SimError {
8207
- constructor(message, name, stack) {
8208
- super(message, name, stack);
8209
- }
8210
- };
8211
-
8212
7835
  // ../simple-boot/dist/esm/decorators/SimDecorator.js
8213
- var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
8214
- Lifecycle2["Singleton"] = "Singleton";
8215
- Lifecycle2["Transient"] = "Transient";
8216
- return Lifecycle2;
8217
- })(Lifecycle || {});
8218
- var sims = /* @__PURE__ */ new Map();
8219
- var containers = /* @__PURE__ */ new Set();
8220
7836
  var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
8221
- var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
8222
- var simProcess = (config, inputTarget) => {
8223
- const target = (() => {
8224
- if (typeof inputTarget === "object") {
8225
- return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
8226
- }
8227
- if (ValidUtils.isArrowFunction(inputTarget)) {
8228
- return () => inputTarget();
8229
- }
8230
- return inputTarget;
8231
- })();
8232
- let targetType;
8233
- if (isNotNullObjetInstance(target)) {
8234
- targetType = target.constructor;
8235
- } else {
8236
- targetType = target;
8237
- }
8238
- config.scope = config?.scope ?? "Singleton";
8239
- ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
8240
- const adding = (targetKey, target2 = targetKey) => {
8241
- const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
8242
- items.add(target2);
8243
- sims.set(targetKey, items);
8244
- };
8245
- if (Array.isArray(config?.type)) {
8246
- config?.type.forEach((it) => {
8247
- adding(it, target);
8248
- });
8249
- } else if (config.type) {
8250
- adding(config?.type, target);
8251
- } else {
8252
- adding(target);
8253
- }
8254
- };
8255
- function Sim(configOrTarget) {
8256
- if (typeof configOrTarget === "function") {
8257
- simProcess({}, configOrTarget);
8258
- } else {
8259
- return (target) => {
8260
- simProcess(configOrTarget, target);
8261
- };
8262
- }
8263
- }
8264
- var getSim = (target) => {
8265
- if (target != null && target !== void 0 && typeof target === "object") {
8266
- target = Object.getPrototypeOf(target).constructor;
8267
- }
8268
- try {
8269
- return ReflectUtils.getMetadata(SimMetadataKey, target);
8270
- } catch (e) {
8271
- }
8272
- };
8273
7837
  var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
8274
- var getPostConstructs = (target) => {
8275
- return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
8276
- };
8277
-
8278
- // ../simple-boot/dist/esm/simstance/SimAtomic.js
8279
- var SimAtomic = class {
8280
- constructor(type, simstanceManager, config) {
8281
- this.type = type;
8282
- this.simstanceManager = simstanceManager;
8283
- this.config = config;
8284
- this.value = type.value;
8285
- }
8286
- getConfig(key = SimMetadataKey) {
8287
- return ReflectUtils.getMetadata(key, this.type.originalType);
8288
- }
8289
- getConfigs() {
8290
- return ReflectUtils.getMetadatas(this.type.originalType);
8291
- }
8292
- getValue(config) {
8293
- if (config?.refresh) {
8294
- this.value = void 0;
8295
- }
8296
- if (!this.value) {
8297
- if (typeof this.type.targetKeyType === "symbol") {
8298
- this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
8299
- } else {
8300
- this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
8301
- }
8302
- }
8303
- return this.value;
8304
- }
8305
- };
8306
-
8307
- // ../simple-boot/dist/esm/SimOption.js
8308
- var SimOption = class {
8309
- constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
8310
- this.rootRouter = rootRouter;
8311
- this.container = container;
8312
- this.advice = advice;
8313
- this.excludeProxys = excludeProxys;
8314
- this.proxy = proxy;
8315
- this.using = using;
8316
- this.cache = cache;
8317
- }
8318
- addAdvicce(advice) {
8319
- this.advice ?? (this.advice = []);
8320
- this.advice.push(advice);
8321
- }
8322
- setAdvice(...advice) {
8323
- this.advice = advice;
8324
- return this;
8325
- }
8326
- };
8327
-
8328
- // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
8329
- var MetaDataAtomic = class {
8330
- constructor(target, metaData) {
8331
- this.target = target;
8332
- this.metaData = metaData;
8333
- }
8334
- };
8335
- var MetaDataPropertyAtomic = class extends MetaDataAtomic {
8336
- constructor(target, metaData, property, parameter) {
8337
- super(target, metaData);
8338
- this.property = property;
8339
- this.parameter = parameter;
8340
- }
8341
- call(...parameter) {
8342
- return this.target[this.property](...parameter);
8343
- }
8344
- };
8345
7838
 
8346
7839
  // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8347
7840
  var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
8348
7841
  var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
8349
7842
  var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
8350
- var getAfter = (target, propertyKey) => {
8351
- return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
8352
- };
8353
- var getAfters = (target) => {
8354
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8355
- };
8356
- var getProtoAfters = (target, propertyKey, type) => {
8357
- return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8358
- };
8359
- var getBefore = (target, propertyKey) => {
8360
- return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
8361
- };
8362
- var getBefores = (target) => {
8363
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8364
- };
8365
- var getProtoBefores = (target, propertyKey, type) => {
8366
- return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8367
- };
8368
7843
 
8369
7844
  // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
8370
- var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
8371
- ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
8372
- ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
8373
- return ExceptionHandlerSituationType2;
8374
- })(ExceptionHandlerSituationType || {});
8375
7845
  var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
8376
- var getExceptionHandlers = (target) => {
8377
- if (target !== null && void 0 !== target && typeof target === "object") {
8378
- target = target.constructor;
8379
- }
8380
- return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
8381
- };
8382
- var targetExceptionHandlers = (target, error) => {
8383
- const exceptionHandlers = getExceptionHandlers(target);
8384
- const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
8385
- const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
8386
- const targetSorts = targets?.sort((a, b) => {
8387
- const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
8388
- const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
8389
- return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
8390
- });
8391
- return (targetSorts ?? []).concat(...emptyTargets ?? []);
8392
- };
8393
- var targetExceptionHandler = (target, error, excludeMethods = []) => {
8394
- let exceptionHandlers = targetExceptionHandlers(target, error);
8395
- exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
8396
- if (exceptionHandlers && exceptionHandlers.length > 0) {
8397
- return exceptionHandlers[0];
8398
- } else {
8399
- return void 0;
8400
- }
8401
- };
8402
-
8403
- // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
8404
- var SimProxyHandler = class {
8405
- constructor(simpleApplication, simstanceManager, simOption) {
8406
- this.simpleApplication = simpleApplication;
8407
- this.simstanceManager = simstanceManager;
8408
- this.simOption = simOption;
8409
- }
8410
- // 잘받게 해놨네 ㅋㅋ simstanceManager
8411
- get(target, name) {
8412
- if (name === "_SimpleBoot_application") {
8413
- return this.simpleApplication;
8414
- } else if (name === "_SimpleBoot_simstanceManager") {
8415
- return this.simstanceManager;
8416
- } else if (name === "_SimpleBoot_simOption") {
8417
- return this.simOption;
8418
- } else if (name === "_SimpleBoot_origin") {
8419
- return target;
8420
- } else {
8421
- return target[name];
8422
- }
8423
- }
8424
- set(obj, prop, value, receiver) {
8425
- value = this.simstanceManager?.proxy(value);
8426
- obj[prop] = value;
8427
- return true;
8428
- }
8429
- apply(target, thisArg, argumentsList) {
8430
- let r;
8431
- try {
8432
- this.aopBefore(thisArg, target);
8433
- try {
8434
- r = Reflect.apply(target, thisArg, argumentsList);
8435
- } catch (e) {
8436
- throw e;
8437
- } finally {
8438
- this.aopAfter(thisArg, target);
8439
- }
8440
- } catch (e) {
8441
- console.error(e);
8442
- const inHandlers = this.getExceptionHandler(e, thisArg, target);
8443
- if (inHandlers.length > 0 && inHandlers[0]) {
8444
- const inHandler = inHandlers[0];
8445
- this.executeExceptionHandler(e, inHandler, argumentsList);
8446
- } else {
8447
- throw e;
8448
- }
8449
- }
8450
- return r;
8451
- }
8452
- executeExceptionHandler(e, inHandler, argumentsList) {
8453
- const otherStorage = /* @__PURE__ */ new Map();
8454
- otherStorage.set(e.constructor, e);
8455
- const situationErrorTypeContainer = new SituationTypeContainer({
8456
- situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
8457
- data: e
8458
- });
8459
- const situationParameterTypeContainer = new SituationTypeContainer({
8460
- situationType: ExceptionHandlerSituationType.PARAMETER,
8461
- data: argumentsList
8462
- });
8463
- otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
8464
- argumentsList?.forEach((it) => {
8465
- otherStorage.set(it.constructor, it);
8466
- });
8467
- try {
8468
- this.simstanceManager.executeBindParameterSim(
8469
- {
8470
- target: inHandler.thisArg,
8471
- targetKey: inHandler.config.propertyKey
8472
- },
8473
- otherStorage
8474
- );
8475
- } catch (es) {
8476
- e = es;
8477
- }
8478
- if (inHandler.config.config.throw) {
8479
- const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
8480
- if ((exceptionHandler?.length ?? 0) > 0) {
8481
- this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
8482
- }
8483
- }
8484
- }
8485
- getExceptionHandler(e, thisArg, target) {
8486
- const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
8487
- return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
8488
- }) ?? [];
8489
- const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
8490
- const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
8491
- return inHandlers;
8492
- }
8493
- aopBefore(obj, protoType) {
8494
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8495
- if (propertyName && obj) {
8496
- getProtoBefores(obj, propertyName).forEach((it) => {
8497
- it.call(obj, protoType, propertyName);
8498
- });
8499
- for (let i = 0; i < this.simOption.advice.length; i++) {
8500
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8501
- const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
8502
- protoBefores.forEach((it) => {
8503
- it.call(obj, protoType, propertyName);
8504
- });
8505
- }
8506
- }
8507
- }
8508
- aopAfter(obj, protoType) {
8509
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8510
- if (propertyName) {
8511
- getProtoAfters(obj, propertyName).forEach((it) => {
8512
- it.call(obj, protoType, propertyName);
8513
- });
8514
- for (let i = 0; i < this.simOption.advice.length; i++) {
8515
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8516
- const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
8517
- protoBefores.forEach((it) => {
8518
- it.call(obj, protoType, propertyName);
8519
- });
8520
- }
8521
- }
8522
- }
8523
- has(target, key) {
8524
- if (key === "_SimpleBoot_isProxy") {
8525
- return true;
8526
- }
8527
- return key in target;
8528
- }
8529
- };
8530
-
8531
- // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
8532
- var isOnSimCreate = (obj) => {
8533
- return typeof obj?.onSimCreate === "function";
8534
- };
8535
-
8536
- // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
8537
- var isOnSimCreateProxyCompleted = (obj) => {
8538
- return typeof obj?.onSimCreateProxyCompleted === "function";
8539
- };
8540
7846
 
8541
7847
  // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8542
7848
  var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
8543
- var getSimNoProxy = (target, propertyKey) => {
8544
- try {
8545
- if (propertyKey === void 0) {
8546
- return Reflect.getMetadata(SimNoProxyKey, target);
8547
- }
8548
- return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
8549
- } catch (e) {
8550
- return void 0;
8551
- }
8552
- };
8553
- var isSimNoProxy = (target, propertyKey) => {
8554
- if (target === null || target === void 0) {
8555
- return false;
8556
- }
8557
- return getSimNoProxy(target, propertyKey) === true;
8558
- };
8559
-
8560
- // ../simple-boot/dist/esm/simstance/SimstanceManager.js
8561
- var SimstanceManager = class _SimstanceManager {
8562
- // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
8563
- constructor(simpleApplication, option) {
8564
- this.simpleApplication = simpleApplication;
8565
- this.option = option;
8566
- this._storage = /* @__PURE__ */ new Map();
8567
- this.name = "simstanceManager-" + RandomUtils.uuid4();
8568
- this.setStoreSet(SimpleApplication, this.simpleApplication);
8569
- this.setStoreSet(_SimstanceManager, this);
8570
- this.setStoreSet(option.constructor, option);
8571
- this.setStoreSet(SimOption, option);
8572
- this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
8573
- }
8574
- get storage() {
8575
- return this._storage;
8576
- }
8577
- getSimAtomics() {
8578
- const r = [];
8579
- Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
8580
- r.push(
8581
- ...Array.from(Array.from(targetMap.keys())).map(
8582
- (sit) => new SimAtomic(
8583
- {
8584
- targetKeyType,
8585
- originalType: sit
8586
- },
8587
- this
8588
- )
8589
- )
8590
- );
8591
- });
8592
- return r;
8593
- }
8594
- getSimConfig(schemeOrSymbol) {
8595
- const newVar = this.getSimAtomics().filter((it) => {
8596
- const config = it?.getConfig();
8597
- const symbols = ConvertUtils.flatArray(config?.symbol);
8598
- const schemes = ConvertUtils.flatArray(config?.scheme);
8599
- if (typeof schemeOrSymbol === "symbol") {
8600
- return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
8601
- } else if (typeof schemeOrSymbol === "string") {
8602
- return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
8603
- } else {
8604
- return false;
8605
- }
8606
- }) || [];
8607
- return newVar;
8608
- }
8609
- findSims(data) {
8610
- let r = [];
8611
- if (data) {
8612
- const simAtomics = this.getSimAtomics();
8613
- r = simAtomics.filter((it) => {
8614
- let b = false;
8615
- const config = it.getConfig();
8616
- const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
8617
- const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
8618
- if (typeof data === "symbol") {
8619
- b = symbols.includes(data);
8620
- } else {
8621
- const { scheme, type } = data;
8622
- b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
8623
- }
8624
- return b;
8625
- });
8626
- }
8627
- return r;
8628
- }
8629
- findFirstSim(data) {
8630
- if (typeof data === "symbol") {
8631
- return this.findSims(data)[0];
8632
- } else {
8633
- return this.findSims(data)[0];
8634
- }
8635
- }
8636
- findLastSim(data) {
8637
- if (typeof data === "symbol") {
8638
- return this.findSims(data).reverse()[0];
8639
- } else {
8640
- return this.findSims(data).reverse()[0];
8641
- }
8642
- }
8643
- flatStoreSets() {
8644
- return new Map(
8645
- Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
8646
- );
8647
- }
8648
- getStoreSets(targetKey) {
8649
- const map = this.storage.get(targetKey);
8650
- const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
8651
- return datas.map((it) => ({ type: it[0], instance: it[1] }));
8652
- }
8653
- getStoreSet(targetKey, target) {
8654
- const sets = this.getStoreSets(targetKey);
8655
- let find = sets.find((it) => it.type === target);
8656
- if (!find && (!target || target === targetKey)) {
8657
- find = sets.find((it) => it.instance);
8658
- }
8659
- if (!find?.instance) {
8660
- const type = target ?? targetKey;
8661
- if (typeof type === "object") {
8662
- const find2 = this.storage.get(type);
8663
- if (find2) {
8664
- return { type, instance: type };
8665
- }
8666
- }
8667
- const flatStoreSets = this.flatStoreSets();
8668
- const data = flatStoreSets.get(type);
8669
- if (data) {
8670
- this.setStoreSet(targetKey, data, type);
8671
- }
8672
- return { type, instance: data };
8673
- } else {
8674
- return find;
8675
- }
8676
- }
8677
- getStoreInstance(targetKey, target) {
8678
- return this.getStoreSet(targetKey, target)?.instance;
8679
- }
8680
- getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
8681
- if (target) {
8682
- const registed = this.getStoreSet(target, originTypeTarget);
8683
- if (registed?.type && !registed?.instance) {
8684
- return this.resolve({
8685
- targetKey: target,
8686
- target: originTypeTarget,
8687
- newInstanceCarrier
8688
- });
8689
- }
8690
- return registed?.instance;
8691
- }
8692
- }
8693
- setStoreSet(targetKey, obj, target = targetKey) {
8694
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8695
- itemMap.set(target, obj);
8696
- this.storage.set(targetKey, itemMap);
8697
- }
8698
- registerStore(targetKey, regTyps) {
8699
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8700
- regTyps.forEach((it) => {
8701
- const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
8702
- if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
8703
- itemMap.set(type, value);
8704
- }
8705
- });
8706
- this.storage.set(targetKey, itemMap);
8707
- }
8708
- // 진입점
8709
- resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
8710
- const registed = this.getStoreSet(targetKey, target);
8711
- if (registed?.instance) {
8712
- return registed.instance;
8713
- }
8714
- if (this.storage.has(targetKey) && void 0 === registed?.instance) {
8715
- newInstanceCarrier.depth++;
8716
- const newSim = this.newSim({
8717
- target: registed?.type ?? targetKey,
8718
- newInstanceCarrier,
8719
- simCreateAfter: (data) => {
8720
- if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
8721
- this.setStoreSet(targetKey, data, target);
8722
- }
8723
- }
8724
- });
8725
- newInstanceCarrier.depth--;
8726
- if (newInstanceCarrier.depth === 0) {
8727
- newInstanceCarrier.newInstances.forEach((it) => {
8728
- this.callBindPostConstruct(it);
8729
- });
8730
- }
8731
- if (isOnSimCreate(newSim)) {
8732
- newSim.onSimCreate();
8733
- }
8734
- return newSim;
8735
- }
8736
- const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
8737
- console.error(simNoSuch);
8738
- throw simNoSuch;
8739
- }
8740
- newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
8741
- const parameters = this.getParameterSim({
8742
- target,
8743
- otherStorage,
8744
- newInstanceCarrier
8745
- });
8746
- const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
8747
- let p = this.proxy(r);
8748
- const config = getSim(target);
8749
- if (config?.proxy) {
8750
- const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
8751
- proxys.forEach((it) => {
8752
- if (typeof it === "object") {
8753
- p = new Proxy(p, it);
8754
- } else {
8755
- const simConfig = getSim(it);
8756
- p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
8757
- }
8758
- });
8759
- }
8760
- newInstanceCarrier?.newInstances.push(p);
8761
- simCreateAfter?.(p);
8762
- if (isOnSimCreateProxyCompleted(p)) {
8763
- p.onSimCreateProxyCompleted(p);
8764
- }
8765
- return p;
8766
- }
8767
- callBindPostConstruct(obj) {
8768
- const postConstruct = getPostConstructs(obj);
8769
- postConstruct.forEach((it) => {
8770
- obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
8771
- });
8772
- }
8773
- async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8774
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8775
- if (typeof target === "object" && targetKey) {
8776
- const targetMethod = target[targetKey];
8777
- return targetMethod?.bind(target)?.(...binds);
8778
- } else if (typeof target === "function" && !targetKey) {
8779
- return new target(...binds);
8780
- }
8781
- }
8782
- executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8783
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8784
- if (typeof target === "object" && targetKey) {
8785
- const targetMethod = target[targetKey];
8786
- return targetMethod?.bind(target)?.(...binds);
8787
- } else if (typeof target === "function" && !targetKey) {
8788
- return new target(...binds);
8789
- }
8790
- }
8791
- getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
8792
- const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
8793
- let injections = [];
8794
- const injects = getInject(target, targetKey);
8795
- const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
8796
- const loopArray = new Array(loopCount).fill(void 0);
8797
- injections = loopArray.map((_, idx) => {
8798
- const token = paramTypes[idx];
8799
- const saveInject = injects?.find((it) => it.index === idx);
8800
- for (const f of firstCheckMaker ?? []) {
8801
- const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
8802
- if (void 0 !== firstCheckObj) {
8803
- return firstCheckObj;
8804
- }
8805
- }
8806
- if (saveInject) {
8807
- const inject = saveInject.config;
8808
- let obj = otherStorage?.get(token);
8809
- if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
8810
- const p = [];
8811
- if (isTargetType(inject) && inject.type) {
8812
- p.push(
8813
- ...this.getStoreSets(inject.type).map(
8814
- (it) => this.resolve({
8815
- targetKey: inject.type,
8816
- target: it.type,
8817
- newInstanceCarrier
8818
- })
8819
- ).reverse()
8820
- );
8821
- }
8822
- if (isTargetSymbol(inject)) {
8823
- p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
8824
- }
8825
- if (isTargetScheme(inject)) {
8826
- p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
8827
- }
8828
- return p;
8829
- }
8830
- if (inject.situationType && otherStorage) {
8831
- const situations = otherStorage.get(SituationTypeContainers);
8832
- const situation = otherStorage.get(SituationTypeContainer);
8833
- if (inject.situationType === situation?.situationType) {
8834
- obj = situation.data;
8835
- } else if (situations && situations.length > 0) {
8836
- const find = situations.find((a) => {
8837
- if (a.index !== void 0) {
8838
- return a.situationType === inject.situationType && a.index === idx;
8839
- } else {
8840
- return a.situationType === inject.situationType;
8841
- }
8842
- });
8843
- if (find) {
8844
- obj = find.data;
8845
- }
8846
- }
8847
- }
8848
- if (!obj) {
8849
- const currentInstance = typeof target === "object" ? target : void 0;
8850
- if (isTargetFactory(inject)) {
8851
- obj = inject.factory({
8852
- instance: currentInstance,
8853
- methodName: String(targetKey),
8854
- parameter: inputParameters,
8855
- application: this.simpleApplication
8856
- });
8857
- } else {
8858
- let findLastSim;
8859
- if (isTargetSymbol(inject)) {
8860
- findLastSim = this.findLastSim(inject.symbol);
8861
- } else if (isTargetType(inject) || isTargetScheme(inject)) {
8862
- findLastSim = this.findLastSim(inject);
8863
- }
8864
- try {
8865
- obj = findLastSim ? this.resolve({
8866
- targetKey: findLastSim?.type.targetKeyType ?? token,
8867
- newInstanceCarrier
8868
- }) : this.resolve({
8869
- targetKey: token,
8870
- newInstanceCarrier
8871
- });
8872
- if (inject.factory && obj) {
8873
- if (typeof inject.factory === "function") {
8874
- obj = inject.factory({
8875
- instance: currentInstance,
8876
- methodName: String(targetKey),
8877
- parameter: inputParameters,
8878
- application: this.simpleApplication,
8879
- injectInstance: obj
8880
- });
8881
- }
8882
- }
8883
- } catch (e) {
8884
- if (inject.optional) {
8885
- return void 0;
8886
- } else {
8887
- throw e;
8888
- }
8889
- }
8890
- }
8891
- }
8892
- if (inject.proxy && obj) {
8893
- if (ValidUtils.isConstructor(inject.proxy)) {
8894
- const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
8895
- if (handler) {
8896
- obj = new Proxy(obj, handler);
8897
- }
8898
- } else if (typeof inject.proxy === "function") {
8899
- const handler = inject.proxy({
8900
- application: this.simpleApplication,
8901
- instance: obj
8902
- });
8903
- if (handler) {
8904
- obj = new Proxy(obj, handler);
8905
- }
8906
- }
8907
- }
8908
- return obj;
8909
- } else {
8910
- return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
8911
- }
8912
- });
8913
- return injections;
8914
- }
8915
- proxy(target) {
8916
- try {
8917
- const noProxy = isSimNoProxy(target);
8918
- const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
8919
- if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
8920
- for (const key in target) {
8921
- if (!isSimNoProxy(target, key)) {
8922
- target[key] = this.proxy(target[key]);
8923
- }
8924
- }
8925
- const protoTypeName = ObjectUtils.ownPropertyNames(target);
8926
- protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
8927
- target[it] = new Proxy(target[it], this.simProxyHandler);
8928
- });
8929
- if (this.simProxyHandler) {
8930
- target = new Proxy(target, this.simProxyHandler);
8931
- }
8932
- }
8933
- if (this.option.proxy) {
8934
- target = this.option.proxy.onAfterProxy(target);
8935
- }
8936
- return target;
8937
- } catch (e) {
8938
- console.log("sim proxy error");
8939
- throw e;
8940
- }
8941
- }
8942
- run(otherInstanceSim = /* @__PURE__ */ new Map()) {
8943
- for (const [k, v] of Array.from(otherInstanceSim.entries())) {
8944
- const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
8945
- this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
8946
- if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
8947
- this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
8948
- }
8949
- }
8950
- const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
8951
- if (!myContainers.includes(this.simpleApplication)) {
8952
- myContainers.push(this.simpleApplication);
8953
- }
8954
- Array.from(sims.entries()).forEach(([type, implementations]) => {
8955
- const filteredSet = /* @__PURE__ */ new Set();
8956
- implementations.forEach((impl) => {
8957
- const config = getSim(impl);
8958
- const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
8959
- let isInclude = false;
8960
- if (targetContainers.length <= 0) {
8961
- isInclude = true;
8962
- } else {
8963
- isInclude = myContainers.some((it) => targetContainers.includes(it));
8964
- }
8965
- if (isInclude) {
8966
- filteredSet.add(impl);
8967
- }
8968
- });
8969
- if (filteredSet.size > 0) {
8970
- this.registerStore(type, filteredSet);
8971
- }
8972
- });
8973
- this.callBindPostConstruct(this);
8974
- this.getSimAtomics().forEach((it) => {
8975
- if (it.getConfig()?.autoCreate) {
8976
- it.getValue();
8977
- }
8978
- });
8979
- }
8980
- };
8981
-
8982
- // ../simple-boot/dist/esm/intent/Intent.js
8983
- var Intent = class {
8984
- constructor(uri, data, event) {
8985
- this.uri = uri;
8986
- this.data = data;
8987
- this.event = event;
8988
- this.sessionData = /* @__PURE__ */ new Map();
8989
- if (typeof uri === "string") {
8990
- const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
8991
- if (match) {
8992
- const symbol = Symbol.for(match[1]);
8993
- this.uri = {
8994
- symbol,
8995
- uri: match[2]
8996
- };
8997
- }
8998
- }
8999
- }
9000
- get symbols() {
9001
- if (typeof this.uri === "object") {
9002
- return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
9003
- }
9004
- return void 0;
9005
- }
9006
- get scheme() {
9007
- if (typeof this.uri === "string") {
9008
- const parts = this.uri.split("://");
9009
- if (parts.length > 1) {
9010
- return parts[0];
9011
- }
9012
- return void 0;
9013
- } else {
9014
- return void 0;
9015
- }
9016
- }
9017
- get paths() {
9018
- return this.pathname.split("/") ?? [];
9019
- }
9020
- get fullPath() {
9021
- const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
9022
- const paths = uri.split("://");
9023
- return paths[paths.length >= 2 ? 1 : 0] ?? "";
9024
- }
9025
- get pathname() {
9026
- const paths = this.fullPath.split("?");
9027
- return paths[0];
9028
- }
9029
- get query() {
9030
- const paths = this.fullPath.split("?");
9031
- return paths[1] ?? "";
9032
- }
9033
- getQueryParamDecodeURI(key) {
9034
- const p = this.queryParamsDecodeURI;
9035
- if (key) {
9036
- return p[key];
9037
- } else {
9038
- return p;
9039
- }
9040
- }
9041
- getQueryParamDecodeURIFirst(key) {
9042
- const param = this.getQueryParamDecodeURI(key);
9043
- if (Array.isArray(param)) {
9044
- return param[0];
9045
- } else {
9046
- return param;
9047
- }
9048
- }
9049
- getQueryParam(key) {
9050
- const p = this.queryParams;
9051
- if (key) {
9052
- return p[key];
9053
- } else {
9054
- return p;
9055
- }
9056
- }
9057
- getQueryParamFirst(key) {
9058
- const param = this.getQueryParam(key);
9059
- if (Array.isArray(param)) {
9060
- return param[0];
9061
- } else {
9062
- return param;
9063
- }
9064
- }
9065
- get queryParams() {
9066
- const param = {};
9067
- this.query.split("&")?.forEach((it) => {
9068
- const a = it.split("=");
9069
- if (param[a[0]]) {
9070
- if (Array.isArray(param[a[0]])) {
9071
- param[a[0]].push(a[1]);
9072
- } else {
9073
- param[a[0]] = [param[a[0]], a[1]];
9074
- }
9075
- } else {
9076
- param[a[0]] = a[1];
9077
- }
9078
- });
9079
- return param;
9080
- }
9081
- get queryParamsDecodeURI() {
9082
- const params = this.queryParams;
9083
- for (const key in params) {
9084
- if (params.hasOwnProperty(key)) {
9085
- const param = params[key];
9086
- if (Array.isArray(param)) {
9087
- params[key] = param.map((p) => decodeURIComponent(p));
9088
- } else {
9089
- params[key] = decodeURIComponent(param);
9090
- }
9091
- }
9092
- }
9093
- return params;
9094
- }
9095
- getPathnameData(urlExpression) {
9096
- return Expression.Path.pathNameData(this.pathname, urlExpression);
9097
- }
9098
- get isSymbolScheme() {
9099
- return this.symbols !== void 0;
9100
- }
9101
- };
9102
-
9103
- // ../simple-boot/dist/esm/intent/IntentSubscribe.js
9104
- var isIntentSubscribe = (obj) => {
9105
- return !!obj && typeof obj.intentSubscribe === "function";
9106
- };
9107
-
9108
- // ../simple-boot/dist/esm/intent/IntentManager.js
9109
- var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
9110
- var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
9111
- var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
9112
- var IntentManager = class {
9113
- constructor(simpleApplication, simstanceManager, routerManager, simOption) {
9114
- this.simpleApplication = simpleApplication;
9115
- this.simstanceManager = simstanceManager;
9116
- this.routerManager = routerManager;
9117
- this.simOption = simOption;
9118
- this.subject = new Subject();
9119
- }
9120
- get observable() {
9121
- return this.subject.asObservable();
9122
- }
9123
- async makeIntentData(it, data) {
9124
- const target = [];
9125
- const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
9126
- if (isRouterPublishType(it)) {
9127
- it = it.router;
9128
- }
9129
- const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
9130
- if (routerMatch && typeof it === "string") {
9131
- const routerBasePath = routerMatch[1];
9132
- const actualPath = routerMatch[2];
9133
- const routerModule = await this.routerManager.routing(routerBasePath, {
9134
- router: rootRouter
9135
- });
9136
- const instance = routerModule.getModuleInstance();
9137
- if (instance) {
9138
- target.push(instance);
9139
- }
9140
- it = new Intent(actualPath, data);
9141
- } else if (isSymbolPublishType(it)) {
9142
- it = new Intent({ symbol: it.symbol, uri: it.path }, data);
9143
- } else if (isSchemePublishType(it)) {
9144
- it = new Intent(`${it.scheme}://${it.path}`, data);
9145
- } else if (typeof it === "string") {
9146
- it = new Intent(it, data);
9147
- }
9148
- const intent = it;
9149
- if (!routerMatch) {
9150
- if (intent.symbols) {
9151
- target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
9152
- } else if (intent.scheme) {
9153
- target.push(...this.simstanceManager.getSimConfig(intent.scheme));
9154
- } else {
9155
- target.push(...this.simstanceManager.getSimAtomics());
9156
- }
9157
- }
9158
- return { intent, target };
9159
- }
9160
- async publishMeta(it, data) {
9161
- const { intent, target } = await this.makeIntentData(it, data);
9162
- const r = [];
9163
- const targetInstances = target.map((it2) => {
9164
- if (it2 instanceof SimAtomic) {
9165
- return it2.getValue();
9166
- } else {
9167
- return it2;
9168
- }
9169
- });
9170
- this.subject.next(intent);
9171
- for (let data2 of targetInstances) {
9172
- let orNewSim = data2;
9173
- if (orNewSim) {
9174
- const filteredPaths = intent.paths.filter((i) => i);
9175
- if (filteredPaths.length > 0) {
9176
- let callthis = orNewSim;
9177
- let lastProp = "";
9178
- filteredPaths.forEach((i) => {
9179
- callthis = orNewSim;
9180
- orNewSim = orNewSim?.[i];
9181
- lastProp = i;
9182
- });
9183
- if (orNewSim && typeof orNewSim === "function") {
9184
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9185
- const result = await this.simstanceManager.executeBindParameterSimPromise({
9186
- target: callthis,
9187
- targetKey: lastProp,
9188
- parameterCount: intentData.length,
9189
- inputParameters: intentData,
9190
- firstCheckMaker: [
9191
- (obj, token, idx) => {
9192
- if (idx < intentData.length) {
9193
- return intentData[idx];
9194
- }
9195
- if (token === Intent && idx === 0) {
9196
- return intent;
9197
- }
9198
- }
9199
- ]
9200
- });
9201
- r.push(result);
9202
- } else if (orNewSim) {
9203
- callthis[lastProp] = intent.data;
9204
- r.push(callthis[lastProp]);
9205
- }
9206
- } else {
9207
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9208
- if (isIntentSubscribe(orNewSim)) {
9209
- r.push(orNewSim.intentSubscribe(...intentData));
9210
- }
9211
- }
9212
- }
9213
- }
9214
- return { return: r, target };
9215
- }
9216
- async publish(it, data) {
9217
- const rdata = await this.publishMeta(it, data);
9218
- return rdata.return;
9219
- }
9220
- };
9221
7849
 
9222
7850
  // ../simple-boot/dist/esm/decorators/inject/Injection.js
9223
7851
  var InjectionMetadataKey = Symbol("Injection");
9224
- var getInjection = (target, propertyKey) => {
9225
- return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
9226
- };
9227
-
9228
- // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
9229
- var MethodNoSuch = class extends SimError {
9230
- constructor(message, name, propertyKeys, stack) {
9231
- super(message, name, stack);
9232
- this.propertyKeys = propertyKeys;
9233
- }
9234
- };
9235
7852
 
9236
7853
  // ../simple-boot/dist/esm/decorators/route/Router.js
9237
7854
  var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
9238
- var getRouter = (target) => {
9239
- if (target != null && typeof target === "object") {
9240
- target = target.constructor;
9241
- }
9242
- try {
9243
- return ReflectUtils.getMetadata(RouterMetadataKey, target);
9244
- } catch (e) {
9245
- }
9246
- };
9247
7855
  var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9248
7856
 
9249
- // ../simple-boot/dist/esm/route/RouterModule.js
9250
- var RouterModule = class {
9251
- constructor(simstanceManager, router, module, routerChains = []) {
9252
- this.simstanceManager = simstanceManager;
9253
- this.router = router;
9254
- this.module = module;
9255
- this.routerChains = routerChains;
9256
- }
9257
- get path() {
9258
- return this._path;
9259
- }
9260
- set path(value) {
9261
- this._path = value;
9262
- }
9263
- get data() {
9264
- return this._data;
9265
- }
9266
- set data(value) {
9267
- this._data = value;
9268
- }
9269
- get intent() {
9270
- return this._intent;
9271
- }
9272
- set intent(value) {
9273
- this._intent = value;
9274
- }
9275
- get propertyKeys() {
9276
- return this._propertyKeys;
9277
- }
9278
- set propertyKeys(value) {
9279
- this._propertyKeys = value;
9280
- }
9281
- get pathData() {
9282
- return this._pathData;
9283
- }
9284
- getPathData() {
9285
- return this._pathData;
9286
- }
9287
- set pathData(value) {
9288
- this._pathData = value;
9289
- }
9290
- getRouterPath(join = "") {
9291
- return this.getRouterPaths().map((it) => it ?? "").join(join);
9292
- }
9293
- getRouterPaths() {
9294
- return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
9295
- }
9296
- getRouterPathData(pathName) {
9297
- return Expression.Path.pathNameData(pathName, this.getRouterPath());
9298
- }
9299
- getModuleInstance(propertyKey, instanceBind = true) {
9300
- const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
9301
- if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
9302
- let instanceElement = instance[propertyKey];
9303
- if (instanceBind && typeof instanceBind === "boolean") {
9304
- instanceElement = instanceElement.bind(instance);
9305
- } else if (instanceBind && typeof instanceBind === "object") {
9306
- instanceElement = instanceElement.bind(instanceBind);
9307
- }
9308
- return instanceElement;
9309
- } else {
9310
- return instance;
9311
- }
9312
- }
9313
- executeModuleProperty(propertyKey, ...param) {
9314
- const target = this.getModuleInstance();
9315
- if (propertyKey) {
9316
- const config = getInjection(target, propertyKey);
9317
- if (config) {
9318
- const other = /* @__PURE__ */ new Map();
9319
- param.forEach((it) => other.set(it.constructor, it));
9320
- return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
9321
- } else {
9322
- if (target[propertyKey]) {
9323
- return target[propertyKey]?.(...param);
9324
- } else {
9325
- throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
9326
- }
9327
- }
9328
- }
9329
- }
9330
- get firstRouteChain() {
9331
- return this.routerChains[0];
9332
- }
9333
- get firstRouteChainValue() {
9334
- return this.firstRouteChain?.getValue();
9335
- }
9336
- get lastRouteChain() {
9337
- return this.routerChains[this.routerChains.length - 1];
9338
- }
9339
- get lastRouteChainValue() {
9340
- return this.lastRouteChain?.getValue();
9341
- }
9342
- hasActivateInLastRoute(obj) {
9343
- return this.lastRouteChainValue?.hasActivate(obj) === true;
9344
- }
9345
- getQueryParamDecodeURI(key) {
9346
- if (this.intent) {
9347
- return this.intent.getQueryParamDecodeURI(key);
9348
- }
9349
- }
9350
- getQueryParamDecodeURIFirst(key) {
9351
- if (this.intent) {
9352
- return this.intent.getQueryParamDecodeURIFirst(key);
9353
- }
9354
- }
9355
- getQueryParam(key) {
9356
- if (this.intent) {
9357
- return this.intent.getQueryParam(key);
9358
- }
9359
- }
9360
- getQueryParamFirst(key) {
9361
- if (this.intent) {
9362
- return this.intent.getQueryParamFirst(key);
9363
- }
9364
- }
9365
- get queryParams() {
9366
- if (this.intent) {
9367
- return this.intent.queryParams;
9368
- }
9369
- }
9370
- get queryParamsAfterDecodeURI() {
9371
- if (this.intent) {
9372
- return this.intent.queryParamsDecodeURI;
9373
- }
9374
- }
9375
- };
9376
-
9377
7857
  // ../simple-boot/dist/esm/route/RouterAction.js
9378
7858
  var RouterAction;
9379
7859
  ((RouterAction2) => {
@@ -9388,435 +7868,6 @@ var dooboostoreSimpleWebComponent = (() => {
9388
7868
  };
9389
7869
  })(RouterAction || (RouterAction = {}));
9390
7870
 
9391
- // ../simple-boot/dist/esm/route/RouterManager.js
9392
- var RouterManager = class {
9393
- constructor(simpleApplication, simstanceManager, simOption) {
9394
- this.simpleApplication = simpleApplication;
9395
- this.simstanceManager = simstanceManager;
9396
- this.simOption = simOption;
9397
- this.subject = new Subject();
9398
- }
9399
- // @SimNoProxy
9400
- get observable() {
9401
- return this.subject.asObservable();
9402
- }
9403
- routingMap(option) {
9404
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9405
- if (!targetRouter) {
9406
- throw new Error("no router");
9407
- }
9408
- const map = {};
9409
- if (targetRouter) {
9410
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9411
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9412
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9413
- const routerData = routerAtomic.getConfig(RouterMetadataKey);
9414
- if (routerData) {
9415
- const currentPrefix = (option?.prefix ?? "") + routerData.path;
9416
- if (routerData.route && routerData.route[""]) {
9417
- map[currentPrefix] = routerData.route[""];
9418
- }
9419
- if (routerData.route) {
9420
- Object.entries(routerData.route).forEach(([key, value]) => {
9421
- map[currentPrefix + key] = value;
9422
- });
9423
- }
9424
- routerData.routers?.forEach((it) => {
9425
- Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
9426
- });
9427
- }
9428
- }
9429
- return map;
9430
- }
9431
- /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
9432
- * @deprecated
9433
- */
9434
- async routings(intent, option) {
9435
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9436
- if (!targetRouter) {
9437
- throw new Error("no router");
9438
- }
9439
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9440
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9441
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9442
- const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
9443
- const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
9444
- if (exactModuleMatches.length > 0) {
9445
- exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9446
- return exactModuleMatches;
9447
- }
9448
- const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
9449
- if (exactPathMatches.length > 0) {
9450
- exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9451
- return exactPathMatches;
9452
- }
9453
- return [];
9454
- }
9455
- async routing(intent, option) {
9456
- if (typeof intent === "string") {
9457
- intent = new Intent(intent);
9458
- }
9459
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9460
- const callCheckOnRouting = option?.noOnRouting !== true;
9461
- if (!targetRouter) {
9462
- debugger;
9463
- throw new Error("no router");
9464
- }
9465
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9466
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9467
- const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9468
- const rootRouter = routerAtomic.getValue();
9469
- const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
9470
- if (executeModuleResult) {
9471
- const [executeModule, routerChains] = executeModuleResult;
9472
- executeModule.routerChains = routerChains;
9473
- this.activeRouterModule = executeModule;
9474
- const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
9475
- if (routerChains.length > 0) {
9476
- for (let i = 0; i < routerChains.length; i++) {
9477
- const current = routerChains[i];
9478
- const next = routerChains[i + 1];
9479
- const value = current.getValue();
9480
- if (RouterAction.isCanActivate(value) && next) {
9481
- await value.canActivate(routingDataSet, next.getValue());
9482
- }
9483
- if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
9484
- await value.onRouting(routingDataSet);
9485
- }
9486
- }
9487
- }
9488
- this.activeRouterModule = executeModule;
9489
- const moduleInstance = executeModule.getModuleInstance();
9490
- if (!executeModule?.module) {
9491
- const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
9492
- const value = routerChain?.getValue();
9493
- if (RouterAction.isCanActivate(value)) {
9494
- await value.canActivate(routingDataSet, moduleInstance);
9495
- }
9496
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9497
- await value.onRouting(routingDataSet);
9498
- }
9499
- } else {
9500
- const value = executeModule.router?.getValue();
9501
- if (RouterAction.isCanActivate(value)) {
9502
- await value.canActivate(routingDataSet, moduleInstance);
9503
- }
9504
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9505
- await value.onRouting(routingDataSet);
9506
- }
9507
- if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
9508
- await moduleInstance.onRouting(routingDataSet);
9509
- }
9510
- }
9511
- const find = this.activeRouterModule;
9512
- this.subject.next({ intent, routerModule: find, routerManager: this });
9513
- return find;
9514
- } else {
9515
- const empty = await this._handleNotFoundRouting(rootRouter, intent);
9516
- this.subject.next({ intent, routerModule: empty, routerManager: this });
9517
- return empty;
9518
- }
9519
- }
9520
- /**
9521
- * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
9522
- * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
9523
- * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
9524
- * @param rootRouter 앱의 최상위 라우터 인스턴스
9525
- * @param intent 확인에 실패한 원본 Intent 객체
9526
- * @private
9527
- */
9528
- async _handleNotFoundRouting(rootRouter, intent) {
9529
- const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
9530
- const routingDataSet = { intent, routerModule, routerManager: this };
9531
- const value = rootRouter;
9532
- if (RouterAction.isCanActivate(value)) {
9533
- await value.canActivate(routingDataSet, null);
9534
- }
9535
- if (RouterAction.isOnRouting(value)) {
9536
- await value.onRouting(routingDataSet);
9537
- }
9538
- this.activeRouterModule = routerModule;
9539
- return this.activeRouterModule;
9540
- }
9541
- getExecuteModule(router, intent, parentRouters, option) {
9542
- const path = intent.pathname;
9543
- const routerConfig = router.getConfig(RouterMetadataKey);
9544
- if (routerConfig) {
9545
- const filters = [];
9546
- if (Array.isArray(routerConfig.filters)) {
9547
- filters.push(...routerConfig.filters);
9548
- } else if (routerConfig.filters) {
9549
- filters.push(routerConfig.filters);
9550
- }
9551
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9552
- if (noAccept) {
9553
- return;
9554
- }
9555
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9556
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9557
- if (isRoot) {
9558
- const currentParentRouters = [...parentRouters, router];
9559
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9560
- let bestMatchModule = void 0;
9561
- let bestMatchLength = -1;
9562
- for (const child of routerConfig.routers) {
9563
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9564
- if (!routerAtomic) {
9565
- continue;
9566
- }
9567
- const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
9568
- if (executeModule) {
9569
- const [rm, chains] = executeModule;
9570
- const currentMatchLength = rm.path?.length || 0;
9571
- if (currentMatchLength > bestMatchLength) {
9572
- bestMatchLength = currentMatchLength;
9573
- bestMatchModule = executeModule;
9574
- } else if (currentMatchLength === bestMatchLength) {
9575
- if (option?.find?.router === "last") {
9576
- bestMatchModule = executeModule;
9577
- }
9578
- }
9579
- }
9580
- }
9581
- if (bestMatchModule) {
9582
- return bestMatchModule;
9583
- }
9584
- }
9585
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9586
- if (module) {
9587
- return [module, currentParentRouters];
9588
- }
9589
- }
9590
- }
9591
- }
9592
- // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
9593
- isRootUrl(path, parentRoots, url) {
9594
- const searchString = parentRoots.join("") + (path || "");
9595
- if (searchString === "/") {
9596
- return true;
9597
- }
9598
- const searchs = searchString.split("/");
9599
- const urls = url.split("/");
9600
- const trimmedUrls = urls.slice(0, searchs.length).join("/");
9601
- return !!Expression.Path.pathNameData(trimmedUrls, searchString);
9602
- }
9603
- _collectAllMatchingModules(router, intent, parentRouters) {
9604
- const matches = [];
9605
- const path = intent.pathname;
9606
- const routerConfig = router.getConfig(RouterMetadataKey);
9607
- if (routerConfig) {
9608
- const filters = [];
9609
- if (Array.isArray(routerConfig.filters)) {
9610
- filters.push(...routerConfig.filters);
9611
- } else if (routerConfig.filters) {
9612
- filters.push(routerConfig.filters);
9613
- }
9614
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9615
- if (noAccept) {
9616
- return matches;
9617
- }
9618
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9619
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9620
- if (isRoot) {
9621
- const currentParentRouters = [...parentRouters, router];
9622
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9623
- for (const child of routerConfig.routers) {
9624
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9625
- if (!routerAtomic) {
9626
- continue;
9627
- }
9628
- matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
9629
- }
9630
- }
9631
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9632
- if (module) {
9633
- module.routerChains = currentParentRouters;
9634
- matches.push(module);
9635
- }
9636
- }
9637
- }
9638
- return matches;
9639
- }
9640
- findRouterOrModule(router, routerData, parentRoots, intent) {
9641
- const module = this.findRouting(router, routerData, parentRoots, intent);
9642
- if (module?.module) {
9643
- module.intent = intent;
9644
- return module;
9645
- }
9646
- const urlRoot = parentRoots.join("") + (routerData.path || "");
9647
- if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
9648
- const rm = new RouterModule(this.simstanceManager, router);
9649
- rm.intent = intent;
9650
- rm.path = urlRoot;
9651
- rm.pathData = intent.getPathnameData(urlRoot);
9652
- return rm;
9653
- }
9654
- return void 0;
9655
- }
9656
- findRouting(router, routerData, parentRoots, intent) {
9657
- const urlRoot = parentRoots.join("") + routerData.path;
9658
- if (routerData.route) {
9659
- for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
9660
- const path = urlRoot + it;
9661
- const pathnameData = intent.getPathnameData(path);
9662
- if (pathnameData) {
9663
- try {
9664
- const dataSet = this.findRouteProperty(routerData.route, it, intent);
9665
- const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
9666
- rm.data = dataSet.data;
9667
- rm.path = path;
9668
- rm.pathData = pathnameData;
9669
- rm.propertyKeys = dataSet.propertyKeys;
9670
- return rm;
9671
- } catch (e) {
9672
- }
9673
- }
9674
- }
9675
- }
9676
- }
9677
- findRouteProperty(route, propertyName, intent) {
9678
- let child;
9679
- let data;
9680
- let propertyKeys;
9681
- const routeElement = route[propertyName];
9682
- if (typeof routeElement === "function") {
9683
- child = { targetKeyType: routeElement, originalType: routeElement };
9684
- } else if (typeof routeElement === "symbol") {
9685
- const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
9686
- if (findSimType?.originalType) {
9687
- child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
9688
- }
9689
- } else if (typeof routeElement === "string") {
9690
- return this.findRouteProperty(route, routeElement, intent);
9691
- } else if (Array.isArray(routeElement)) {
9692
- const r = routeElement?.[0];
9693
- if (typeof r === "object" && "filters" in r && "target" in r) {
9694
- const filters = [];
9695
- if (Array.isArray(r.filters)) {
9696
- filters.push(...r.filters);
9697
- } else if (r.filters) {
9698
- filters.push(r.filters);
9699
- }
9700
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9701
- if (!noAccept) {
9702
- child = { targetKeyType: r.target, originalType: r.target };
9703
- }
9704
- } else {
9705
- child = { targetKeyType: r, originalType: r };
9706
- }
9707
- data = routeElement?.[1];
9708
- } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
9709
- const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9710
- if (!noAccept) {
9711
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9712
- propertyKeys = routeElement.propertyKeys;
9713
- }
9714
- } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
9715
- const filters = [];
9716
- if (Array.isArray(routeElement.filters)) {
9717
- filters.push(...routeElement.filters);
9718
- } else if (routeElement.filters) {
9719
- filters.push(routeElement.filters);
9720
- }
9721
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9722
- if (!noAccept) {
9723
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9724
- }
9725
- }
9726
- return {
9727
- child,
9728
- data,
9729
- propertyKeys
9730
- };
9731
- }
9732
- };
9733
-
9734
- // ../simple-boot/dist/esm/SimpleApplication.js
9735
- var SimpleApplication = class _SimpleApplication {
9736
- // public rootRouter?: ConstructorType<any>;
9737
- // constructor();
9738
- // constructor(option: SimOption);
9739
- // constructor(rootRouter?: ConstructorType<Object> | Function);
9740
- // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
9741
- // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
9742
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
9743
- constructor(option = new SimOption()) {
9744
- this.option = option;
9745
- this.simstanceManager = new SimstanceManager(this, option);
9746
- this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
9747
- this.routerManager = new RouterManager(this, this.simstanceManager, option);
9748
- this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
9749
- this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
9750
- this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
9751
- containers.add(this);
9752
- }
9753
- getSimstanceManager() {
9754
- return this.simstanceManager;
9755
- }
9756
- getIntentManager() {
9757
- return this.intentManager;
9758
- }
9759
- getRouterManager() {
9760
- return this.routerManager;
9761
- }
9762
- run(otherInstanceSim) {
9763
- otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
9764
- otherInstanceSim.set(_SimpleApplication, this);
9765
- this.simstanceManager.run(otherInstanceSim);
9766
- return this;
9767
- }
9768
- simAtomic(type) {
9769
- if (typeof type === "symbol") {
9770
- return this.simstanceManager.findFirstSim(type);
9771
- } else if (typeof type === "function") {
9772
- return this.simstanceManager.findFirstSim({ type });
9773
- }
9774
- }
9775
- simAtomics(type) {
9776
- if (typeof type === "symbol") {
9777
- return this.simstanceManager.findSims(type) ?? [];
9778
- } else if (typeof type === "function") {
9779
- return this.simstanceManager.findSims({ type }) ?? [];
9780
- } else {
9781
- return [];
9782
- }
9783
- }
9784
- getInstance(type) {
9785
- const i = this.sim(type);
9786
- if (i) {
9787
- return i;
9788
- } else {
9789
- throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
9790
- }
9791
- }
9792
- sim(type) {
9793
- return this.simAtomic(type)?.getValue();
9794
- }
9795
- sims(type) {
9796
- return this.simAtomics(type).map((it) => it.getValue());
9797
- }
9798
- addSim(configOrTarget, target) {
9799
- const r = Sim(configOrTarget);
9800
- if (typeof r === "function" && target) {
9801
- r(target);
9802
- }
9803
- }
9804
- publishIntent(i, data) {
9805
- return this.intentManager.publish(i, data);
9806
- }
9807
- routing(i, option) {
9808
- if (i instanceof Intent) {
9809
- return this.routerManager.routing(i, option);
9810
- } else if (typeof i === "string") {
9811
- const intent = new Intent(i);
9812
- return this.routerManager.routing(intent, option);
9813
- } else {
9814
- const intent = new Intent(i.path, i.data);
9815
- return this.routerManager.routing(intent, option);
9816
- }
9817
- }
9818
- };
9819
-
9820
7871
  // ../core-web/dist/esm/element/CanvasUtils.js
9821
7872
  var CanvasUtils;
9822
7873
  ((CanvasUtils2) => {
@@ -10577,392 +8628,6 @@ var dooboostoreSimpleWebComponent = (() => {
10577
8628
  return /Mobi/i.test(targetWindow.navigator.userAgent);
10578
8629
  };
10579
8630
  })(ValidUtils2 || (ValidUtils2 = {}));
10580
-
10581
- // ../simple-boot/dist/esm/index.js
10582
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
10583
-
10584
- // ../simple-boot/dist/esm/alert/AlertAction.js
10585
- var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
10586
- AlertAction2["ACTIVE"] = "ACTIVE";
10587
- AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
10588
- return AlertAction2;
10589
- })(AlertAction || {});
10590
-
10591
- // ../simple-boot/dist/esm/alert/Alert.js
10592
- var Alert = class {
10593
- constructor(alertService, config) {
10594
- this.alertService = alertService;
10595
- this.config = config;
10596
- this.isActive = false;
10597
- this.activateBefore = [];
10598
- this.activateAfter = [];
10599
- this.deActivateBefore = [];
10600
- this.deActivateAfter = [];
10601
- this.data = /* @__PURE__ */ new Map();
10602
- if (config?.uuid) {
10603
- this.uuid = config.uuid;
10604
- } else {
10605
- this.uuid = RandomUtils.uuid();
10606
- }
10607
- }
10608
- addOpenBefore(fn) {
10609
- this.activateBefore.push(fn);
10610
- }
10611
- addOpenAfter(fn) {
10612
- this.activateAfter.push(fn);
10613
- }
10614
- addCloseBefore(fn) {
10615
- this.deActivateBefore.push(fn);
10616
- }
10617
- addCloseAfter(fn) {
10618
- this.deActivateAfter.push(fn);
10619
- }
10620
- setData(key, value) {
10621
- this.data.set(key, value);
10622
- }
10623
- getData(key) {
10624
- return this.data.get(key);
10625
- }
10626
- async activate() {
10627
- try {
10628
- await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
10629
- this.result = this.make();
10630
- this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
10631
- this.isActive = true;
10632
- if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
10633
- setTimeout(() => {
10634
- this.deActivate();
10635
- }, this.config.closeTime);
10636
- }
10637
- this.config?.activate?.(this.result, this);
10638
- });
10639
- } catch (e) {
10640
- } finally {
10641
- await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
10642
- });
10643
- }
10644
- }
10645
- async deActivate() {
10646
- try {
10647
- await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
10648
- this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
10649
- this.isActive = false;
10650
- this.config?.deActivate?.(this.result, this);
10651
- });
10652
- } catch (e) {
10653
- } finally {
10654
- await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
10655
- });
10656
- }
10657
- }
10658
- };
10659
-
10660
- // ../simple-boot/dist/esm/alert/AlertFactory.js
10661
- var __decorate = function(decorators, target, key, desc) {
10662
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10663
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10664
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10665
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10666
- };
10667
- var AlertFactory;
10668
- (function(AlertFactory2) {
10669
- AlertFactory2.SYMBOL = Symbol.for("simple-boot:alert-factory-token");
10670
- })(AlertFactory || (AlertFactory = {}));
10671
- var DefaultAlertFactory = class DefaultAlertFactory2 {
10672
- create(data) {
10673
- return void 0;
10674
- }
10675
- };
10676
- DefaultAlertFactory = __decorate([
10677
- Sim({ symbol: AlertFactory.SYMBOL })
10678
- ], DefaultAlertFactory);
10679
-
10680
- // ../simple-boot/dist/esm/alert/AlertType.js
10681
- var AlertType = /* @__PURE__ */ ((AlertType2) => {
10682
- AlertType2["DANGER"] = "DANGER";
10683
- AlertType2["NORMAL"] = "NORMAL";
10684
- AlertType2["PROGRESS"] = "PROGRESS";
10685
- AlertType2["SUCCESS"] = "SUCCESS";
10686
- AlertType2["ERROR"] = "ERROR";
10687
- AlertType2["INFO"] = "INFO";
10688
- AlertType2["WARNING"] = "WARNING";
10689
- AlertType2["CONSOLE"] = "CONSOLE";
10690
- AlertType2["ETC"] = "ETC";
10691
- return AlertType2;
10692
- })(AlertType || {});
10693
-
10694
- // ../simple-boot/dist/esm/alert/AlertService.js
10695
- var __decorate2 = function(decorators, target, key, desc) {
10696
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10697
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10698
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10699
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10700
- };
10701
- var __metadata = function(k, v) {
10702
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10703
- };
10704
- var __param = function(paramIndex, decorator) {
10705
- return function(target, key) {
10706
- decorator(target, key, paramIndex);
10707
- };
10708
- };
10709
- var _a;
10710
- var AlertService = class AlertService2 {
10711
- constructor(alertFactory) {
10712
- this.name = (/* @__PURE__ */ new Date()).toUTCString();
10713
- this.subject = new ReplaySubject();
10714
- this.alertFactory = alertFactory;
10715
- }
10716
- // @PostConstruct
10717
- // postConstruct(
10718
- // ) {
10719
- // this.alertFactory = alertFactory;
10720
- // }
10721
- get observable() {
10722
- return this.subject.asObservable();
10723
- }
10724
- publish(data) {
10725
- this.subject.next(data);
10726
- }
10727
- create(factory, config) {
10728
- return new class extends Alert {
10729
- make() {
10730
- return factory(this);
10731
- }
10732
- }(this, config);
10733
- }
10734
- createFromFactory(type, config) {
10735
- return this.alertFactory?.create({ caller: this, type, config });
10736
- }
10737
- danger(config) {
10738
- return this.createFromFactory(AlertType.DANGER, config);
10739
- }
10740
- progress(config) {
10741
- config = config ?? {};
10742
- return this.createFromFactory(AlertType.PROGRESS, config);
10743
- }
10744
- success(config) {
10745
- return this.createFromFactory(AlertType.SUCCESS, config);
10746
- }
10747
- info(config) {
10748
- return this.createFromFactory(AlertType.INFO, config);
10749
- }
10750
- error(config) {
10751
- return this.createFromFactory(AlertType.ERROR, config);
10752
- }
10753
- warning(config) {
10754
- return this.createFromFactory(AlertType.WARNING, config);
10755
- }
10756
- };
10757
- AlertService = __decorate2([
10758
- Sim,
10759
- __param(0, Inject({ symbol: AlertFactory.SYMBOL })),
10760
- __metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
10761
- ], AlertService);
10762
-
10763
- // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
10764
- var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
10765
- var getCacheSet = (simpleApplication) => {
10766
- return simpleApplicationCache.get(simpleApplication);
10767
- };
10768
- var findCacheByKey = (simpleApplication, key) => {
10769
- const storage = simpleApplicationCache.get(simpleApplication);
10770
- if (storage) {
10771
- return Array.from(storage.config.entries()).find(([k, v]) => k === key);
10772
- }
10773
- };
10774
- var findCacheByKeyStartWith = (simpleApplication, key) => {
10775
- const storage = simpleApplicationCache.get(simpleApplication);
10776
- if (storage) {
10777
- return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
10778
- } else {
10779
- return [];
10780
- }
10781
- };
10782
- var deleteCacheByKey = (simpleApplication, key) => {
10783
- const storage = simpleApplicationCache.get(simpleApplication);
10784
- if (storage) {
10785
- storage.storage.delete(key);
10786
- findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
10787
- const data = storage.config.get(k);
10788
- if (data?.expireTimeout) {
10789
- clearTimeout(data.expireTimeout);
10790
- }
10791
- storage.config.delete(k);
10792
- storage.storage.delete(k);
10793
- });
10794
- }
10795
- };
10796
- var deleteCacheByKeyStartWith = (simpleApplication, key) => {
10797
- findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
10798
- };
10799
- var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
10800
-
10801
- // ../simple-boot/dist/esm/cache/CacheManager.js
10802
- var __decorate3 = function(decorators, target, key, desc) {
10803
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10804
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10805
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10806
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10807
- };
10808
- var __metadata2 = function(k, v) {
10809
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10810
- };
10811
- var _a2;
10812
- var CacheManager = class CacheManager2 {
10813
- constructor(simpleApplication) {
10814
- this.simpleApplication = simpleApplication;
10815
- }
10816
- findCacheByKey(key) {
10817
- return findCacheByKey(this.simpleApplication, key);
10818
- }
10819
- findCacheByKeyStartWith(key) {
10820
- return findCacheByKeyStartWith(this.simpleApplication, key);
10821
- }
10822
- deleteCacheByKey(key) {
10823
- return deleteCacheByKey(this.simpleApplication, key);
10824
- }
10825
- deleteCacheByKeyStartWith(key) {
10826
- return deleteCacheByKeyStartWith(this.simpleApplication, key);
10827
- }
10828
- getCacheSet() {
10829
- return getCacheSet(this.simpleApplication);
10830
- }
10831
- };
10832
- CacheManager = __decorate3([
10833
- Sim,
10834
- __metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
10835
- ], CacheManager);
10836
-
10837
- // ../simple-boot/dist/esm/decorators/event/EventListener.js
10838
- var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
10839
-
10840
- // ../simple-boot/dist/esm/decorators/validate/Validation.js
10841
- var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
10842
- var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
10843
-
10844
- // ../simple-boot/dist/esm/fetch/ApiService.js
10845
- var __decorate4 = function(decorators, target, key, desc) {
10846
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10847
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10848
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10849
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10850
- };
10851
- var __metadata3 = function(k, v) {
10852
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10853
- };
10854
- var _a3;
10855
- var _b;
10856
- var ApiServiceInterceptor;
10857
- (function(ApiServiceInterceptor2) {
10858
- ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
10859
- ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10860
- try {
10861
- return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10862
- } catch (e) {
10863
- return [];
10864
- }
10865
- };
10866
- })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10867
- var ApiService = class ApiService2 extends HttpJsonFetcher {
10868
- constructor(simstanceManager, alertService) {
10869
- super();
10870
- this.simstanceManager = simstanceManager;
10871
- this.subject = new Subject();
10872
- this.alertService = alertService;
10873
- }
10874
- // @PostConstruct
10875
- // postConstruct(alertService: AlertService<any>) {
10876
- // this.alertService = alertService;
10877
- // }
10878
- get observable() {
10879
- return this.subject.asObservable();
10880
- }
10881
- createPipe(config) {
10882
- return {};
10883
- }
10884
- async beforeProxyFetch(config) {
10885
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10886
- for (const interceptor of interceptors) {
10887
- if (interceptor.beforeProxyFetch) {
10888
- config = await interceptor.beforeProxyFetch(config);
10889
- }
10890
- }
10891
- this.subject.next({ type: "beforeFetchData", config });
10892
- return config;
10893
- }
10894
- async afterProxyFetch(config) {
10895
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10896
- let r = config.response;
10897
- for (const interceptor of interceptors) {
10898
- if (interceptor.afterProxyFetch) {
10899
- r = await interceptor.afterProxyFetch(config);
10900
- }
10901
- }
10902
- this.subject.next({ type: "afterFetchData", response: r });
10903
- return r;
10904
- }
10905
- beforeFetch(fetch2) {
10906
- this.subject.next({ type: "beforeFetch", fetch: fetch2 });
10907
- }
10908
- afterFetch(fetch2, response) {
10909
- this.subject.next({ type: "afterFetch", fetch: fetch2, response });
10910
- }
10911
- before(config, pipe) {
10912
- this.subject.next({ type: "progress", config, pipe });
10913
- config.config?.config?.callBackProgress?.(config, pipe);
10914
- if (config.config?.config?.alertProgress) {
10915
- const alert = this.alertService?.progress({ title: config.config.config.title });
10916
- if (alert) {
10917
- pipe.progress = alert;
10918
- alert.activate();
10919
- }
10920
- }
10921
- }
10922
- afterSuccess(config, pipe) {
10923
- this.subject.next({ type: "success", config, pipe });
10924
- config.config?.config?.callBackSuccess?.(config, pipe);
10925
- if (config.config?.config?.alertSuccessMsg) {
10926
- this.alertService?.success({ title: config.config.config.title })?.activate();
10927
- }
10928
- }
10929
- afterSuccessTransform(config, pipe) {
10930
- }
10931
- finally(config, pipe) {
10932
- this.subject.next({ type: "final", config, pipe });
10933
- config.config?.config?.callBackFinal?.(config, pipe);
10934
- pipe.progress?.deActivate();
10935
- }
10936
- error(config, pipe, e) {
10937
- console.log("error", e);
10938
- this.subject.next({ type: "error", config, pipe, e });
10939
- config.config?.config?.callBackError?.(config, pipe, e);
10940
- if (config.config?.config?.alertErrorMsg) {
10941
- this.alertService?.danger({
10942
- title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
10943
- })?.activate();
10944
- }
10945
- if (config.config?.config?.enableErrorConsole) {
10946
- console.error(`apiService Error ${config?.config?.config?.title}`, e);
10947
- }
10948
- }
10949
- async execute(fetcherRequest) {
10950
- const target = fetcherRequest.target;
10951
- const config = fetcherRequest.config;
10952
- let r = { target, config };
10953
- const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
10954
- for (const apiServiceInterceptor of interceptor) {
10955
- if (apiServiceInterceptor.beforeProxyExecute) {
10956
- r = await apiServiceInterceptor.beforeProxyExecute?.(r);
10957
- }
10958
- }
10959
- return super.execute(r);
10960
- }
10961
- };
10962
- ApiService = __decorate4([
10963
- Sim,
10964
- __metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
10965
- ], ApiService);
10966
8631
  return __toCommonJS(bundle_entry_exports);
10967
8632
  })();
10968
8633
  /*! Bundled license information: