@dooboostore/simple-web-component 1.0.23 → 1.0.25

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 (149) hide show
  1. package/README.md +64 -3212
  2. package/dist/cjs/decorators/addEventListener.js +1 -1
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +148 -0
  5. package/dist/cjs/decorators/applyAttribute.js.map +7 -0
  6. package/dist/cjs/decorators/applyClass.js +164 -0
  7. package/dist/cjs/decorators/applyClass.js.map +7 -0
  8. package/dist/cjs/decorators/applyNode.js +97 -109
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applyStyle.js +135 -0
  11. package/dist/cjs/decorators/applyStyle.js.map +7 -0
  12. package/dist/cjs/decorators/attribute.js +24 -11
  13. package/dist/cjs/decorators/attribute.js.map +2 -2
  14. package/dist/cjs/decorators/changedAttributeHost.js +1 -1
  15. package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
  16. package/dist/cjs/decorators/elementDefine.js +14 -23
  17. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  18. package/dist/cjs/decorators/emitCustomEvent.js +5 -2
  19. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  20. package/dist/cjs/decorators/index.js +3 -3
  21. package/dist/cjs/decorators/index.js.map +2 -2
  22. package/dist/cjs/decorators/lifecycles.js +9 -9
  23. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  24. package/dist/cjs/decorators/query.js +78 -3
  25. package/dist/cjs/decorators/query.js.map +2 -2
  26. package/dist/cjs/decorators/queryAll.js +78 -3
  27. package/dist/cjs/decorators/queryAll.js.map +2 -2
  28. package/dist/cjs/elements/SwcAppEngine.js +19 -4
  29. package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
  30. package/dist/cjs/elements/SwcAppMixin.js +2 -0
  31. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  32. package/dist/cjs/index.js +4 -4
  33. package/dist/cjs/index.js.map +2 -2
  34. package/dist/cjs/utils/Utils.js +141 -2
  35. package/dist/cjs/utils/Utils.js.map +2 -2
  36. package/dist/esm/decorators/addEventListener.js +1 -1
  37. package/dist/esm/decorators/addEventListener.js.map +2 -2
  38. package/dist/esm/decorators/applyAttribute.js +129 -0
  39. package/dist/esm/decorators/applyAttribute.js.map +7 -0
  40. package/dist/esm/decorators/applyClass.js +145 -0
  41. package/dist/esm/decorators/applyClass.js.map +7 -0
  42. package/dist/esm/decorators/applyNode.js +97 -109
  43. package/dist/esm/decorators/applyNode.js.map +2 -2
  44. package/dist/esm/decorators/applyStyle.js +116 -0
  45. package/dist/esm/decorators/applyStyle.js.map +7 -0
  46. package/dist/esm/decorators/attribute.js +24 -11
  47. package/dist/esm/decorators/attribute.js.map +2 -2
  48. package/dist/esm/decorators/changedAttributeHost.js +1 -1
  49. package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
  50. package/dist/esm/decorators/elementDefine.js +14 -23
  51. package/dist/esm/decorators/elementDefine.js.map +2 -2
  52. package/dist/esm/decorators/emitCustomEvent.js +5 -2
  53. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  54. package/dist/esm/decorators/index.js +3 -3
  55. package/dist/esm/decorators/index.js.map +1 -1
  56. package/dist/esm/decorators/lifecycles.js +9 -9
  57. package/dist/esm/decorators/lifecycles.js.map +2 -2
  58. package/dist/esm/decorators/query.js +78 -3
  59. package/dist/esm/decorators/query.js.map +2 -2
  60. package/dist/esm/decorators/queryAll.js +78 -3
  61. package/dist/esm/decorators/queryAll.js.map +2 -2
  62. package/dist/esm/elements/SwcAppEngine.js +19 -4
  63. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  64. package/dist/esm/elements/SwcAppMixin.js +2 -0
  65. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  66. package/dist/esm/index.js +4 -4
  67. package/dist/esm/index.js.map +2 -2
  68. package/dist/esm/utils/Utils.js +141 -2
  69. package/dist/esm/utils/Utils.js.map +2 -2
  70. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3191 -506
  71. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  72. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  73. package/dist/types/decorators/applyAttribute.d.ts +22 -0
  74. package/dist/types/decorators/applyAttribute.d.ts.map +1 -0
  75. package/dist/types/decorators/applyClass.d.ts +65 -0
  76. package/dist/types/decorators/applyClass.d.ts.map +1 -0
  77. package/dist/types/decorators/applyNode.d.ts +18 -104
  78. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  79. package/dist/types/decorators/applyStyle.d.ts +21 -0
  80. package/dist/types/decorators/applyStyle.d.ts.map +1 -0
  81. package/dist/types/decorators/attribute.d.ts +12 -14
  82. package/dist/types/decorators/attribute.d.ts.map +1 -1
  83. package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -1
  84. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  85. package/dist/types/decorators/emitCustomEvent.d.ts +1 -1
  86. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  87. package/dist/types/decorators/index.d.ts +3 -3
  88. package/dist/types/decorators/index.d.ts.map +1 -1
  89. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  90. package/dist/types/decorators/query.d.ts +68 -4
  91. package/dist/types/decorators/query.d.ts.map +1 -1
  92. package/dist/types/decorators/queryAll.d.ts +70 -1
  93. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  94. package/dist/types/elements/SwcAppEngine.d.ts +7 -0
  95. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  96. package/dist/types/elements/SwcAppMixin.d.ts +1 -1
  97. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  98. package/dist/types/index.d.ts +1 -2
  99. package/dist/types/index.d.ts.map +1 -1
  100. package/dist/types/utils/Utils.d.ts +49 -0
  101. package/dist/types/utils/Utils.d.ts.map +1 -1
  102. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3191 -506
  103. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  104. package/package.json +3 -3
  105. package/src/decorators/addEventListener.ts +1 -1
  106. package/src/decorators/applyAttribute.ts +147 -0
  107. package/src/decorators/applyClass.ts +158 -0
  108. package/src/decorators/applyNode.ts +126 -225
  109. package/src/decorators/applyStyle.ts +128 -0
  110. package/src/decorators/attribute.ts +42 -43
  111. package/src/decorators/changedAttributeHost.ts +2 -2
  112. package/src/decorators/elementDefine.ts +18 -39
  113. package/src/decorators/emitCustomEvent.ts +6 -3
  114. package/src/decorators/index.ts +3 -3
  115. package/src/decorators/lifecycles.ts +9 -11
  116. package/src/decorators/query.ts +148 -6
  117. package/src/decorators/queryAll.ts +149 -3
  118. package/src/elements/SwcAppEngine.ts +32 -4
  119. package/src/elements/SwcAppMixin.ts +2 -0
  120. package/src/index.ts +6 -6
  121. package/src/utils/Utils.ts +146 -1
  122. package/dist/cjs/decorators/classList.js +0 -134
  123. package/dist/cjs/decorators/classList.js.map +0 -7
  124. package/dist/cjs/decorators/setAttribute.js +0 -111
  125. package/dist/cjs/decorators/setAttribute.js.map +0 -7
  126. package/dist/cjs/decorators/style.js +0 -114
  127. package/dist/cjs/decorators/style.js.map +0 -7
  128. package/dist/cjs/utils/TemplateUtils.js +0 -109
  129. package/dist/cjs/utils/TemplateUtils.js.map +0 -7
  130. package/dist/esm/decorators/classList.js +0 -115
  131. package/dist/esm/decorators/classList.js.map +0 -7
  132. package/dist/esm/decorators/setAttribute.js +0 -92
  133. package/dist/esm/decorators/setAttribute.js.map +0 -7
  134. package/dist/esm/decorators/style.js +0 -95
  135. package/dist/esm/decorators/style.js.map +0 -7
  136. package/dist/esm/utils/TemplateUtils.js +0 -90
  137. package/dist/esm/utils/TemplateUtils.js.map +0 -7
  138. package/dist/types/decorators/classList.d.ts +0 -61
  139. package/dist/types/decorators/classList.d.ts.map +0 -1
  140. package/dist/types/decorators/setAttribute.d.ts +0 -23
  141. package/dist/types/decorators/setAttribute.d.ts.map +0 -1
  142. package/dist/types/decorators/style.d.ts +0 -49
  143. package/dist/types/decorators/style.d.ts.map +0 -1
  144. package/dist/types/utils/TemplateUtils.d.ts +0 -59
  145. package/dist/types/utils/TemplateUtils.d.ts.map +0 -1
  146. package/src/decorators/classList.ts +0 -172
  147. package/src/decorators/setAttribute.ts +0 -113
  148. package/src/decorators/style.ts +0 -140
  149. package/src/utils/TemplateUtils.ts +0 -92
@@ -297,8 +297,8 @@ var require_Reflect = __commonJS({
297
297
  keys.push(key);
298
298
  }
299
299
  }
300
- for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
301
- var key = parentKeys_1[_a];
300
+ for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
301
+ var key = parentKeys_1[_a4];
302
302
  var hasKey = set.has(key);
303
303
  if (!hasKey) {
304
304
  set.add(key);
@@ -1110,10 +1110,10 @@ var require_Reflect = __commonJS({
1110
1110
  });
1111
1111
 
1112
1112
  // src/bundle-entry.ts
1113
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1113
+ var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1114
1114
 
1115
1115
  // src/index.ts
1116
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
1116
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1117
1117
 
1118
1118
  // ../core/dist/esm/valid/ValidUtils.js
1119
1119
  var ValidUtils;
@@ -4789,6 +4789,107 @@ var Observable = class {
4789
4789
  }
4790
4790
  };
4791
4791
 
4792
+ // ../core/dist/esm/message/Subject.js
4793
+ var Subject = class extends Observable {
4794
+ constructor() {
4795
+ super((subscriber) => {
4796
+ return this._subscribeToSubject(subscriber);
4797
+ });
4798
+ this._observers = /* @__PURE__ */ new Set();
4799
+ this._isStopped = false;
4800
+ this._hasError = false;
4801
+ }
4802
+ _subscribeToSubject(subscriber) {
4803
+ const partialObserver = {
4804
+ next: subscriber.next.bind(subscriber),
4805
+ error: subscriber.error.bind(subscriber),
4806
+ complete: subscriber.complete.bind(subscriber)
4807
+ };
4808
+ if (this._isStopped) {
4809
+ if (this._hasError) {
4810
+ partialObserver.error?.(this._error);
4811
+ } else {
4812
+ partialObserver.complete?.();
4813
+ }
4814
+ return Subscription.EMPTY;
4815
+ }
4816
+ this._observers.add(partialObserver);
4817
+ return new Subscription(() => {
4818
+ this._observers.delete(partialObserver);
4819
+ });
4820
+ }
4821
+ next(data) {
4822
+ if (this._isStopped) {
4823
+ return;
4824
+ }
4825
+ this._observers.forEach((observer) => {
4826
+ observer.next?.(data);
4827
+ });
4828
+ }
4829
+ error(err) {
4830
+ if (this._isStopped) {
4831
+ return;
4832
+ }
4833
+ this._hasError = true;
4834
+ this._error = err;
4835
+ this._isStopped = true;
4836
+ this._observers.forEach((observer) => observer.error?.(err));
4837
+ this._observers.clear();
4838
+ }
4839
+ complete() {
4840
+ if (this._isStopped) {
4841
+ return;
4842
+ }
4843
+ this._isStopped = true;
4844
+ this._observers.forEach((observer) => observer.complete?.());
4845
+ this._observers.clear();
4846
+ }
4847
+ asObservable() {
4848
+ return new Observable((subscriber) => {
4849
+ return this._subscribeToSubject(subscriber);
4850
+ });
4851
+ }
4852
+ };
4853
+
4854
+ // ../core/dist/esm/message/ReplaySubject.js
4855
+ var ReplaySubject = class extends Subject {
4856
+ // Removed: private _error: E | undefined;
4857
+ // Removed: private _isStopped = false;
4858
+ constructor(bufferSize = Infinity) {
4859
+ super();
4860
+ this.bufferSize = bufferSize;
4861
+ this._buffer = [];
4862
+ }
4863
+ next(data) {
4864
+ if (this._isStopped) {
4865
+ return;
4866
+ }
4867
+ this._buffer.push(data);
4868
+ if (this._buffer.length > this.bufferSize) {
4869
+ this._buffer.shift();
4870
+ }
4871
+ super.next(data);
4872
+ }
4873
+ error(err) {
4874
+ super.error(err);
4875
+ }
4876
+ complete() {
4877
+ super.complete();
4878
+ }
4879
+ _subscribeToSubject(subscriber) {
4880
+ this._buffer.forEach((value) => subscriber.next(value));
4881
+ if (this._isStopped) {
4882
+ if (this._hasError) {
4883
+ subscriber.error(this._error);
4884
+ } else {
4885
+ subscriber.complete();
4886
+ }
4887
+ return Subscription.EMPTY;
4888
+ }
4889
+ return super._subscribeToSubject(subscriber);
4890
+ }
4891
+ };
4892
+
4792
4893
  // ../core/dist/esm/message/AutoCloseSubscription.js
4793
4894
  var AutoCloseSubscription = class extends Subscription {
4794
4895
  constructor(userUnsubscribe) {
@@ -5123,6 +5224,284 @@ var Promises;
5123
5224
  })(Result = Promises2.Result || (Promises2.Result = {}));
5124
5225
  })(Promises || (Promises = {}));
5125
5226
 
5227
+ // ../core/dist/esm/fetch/Fetcher.js
5228
+ var Fetcher = class {
5229
+ createPipe(config) {
5230
+ return {};
5231
+ }
5232
+ fetch(config) {
5233
+ return new Promise((resolve, reject) => {
5234
+ const pipe = this.createPipe(config);
5235
+ Promise.resolve().then(() => {
5236
+ this.before(config, pipe);
5237
+ config?.before?.();
5238
+ }).then(() => {
5239
+ return this.execute(config);
5240
+ }).then((data) => {
5241
+ const hasError = config.config?.hasErrorChecker?.(data);
5242
+ if (hasError) {
5243
+ throw hasError;
5244
+ }
5245
+ pipe.responseData = data;
5246
+ this.afterSuccess(config, pipe);
5247
+ config?.afterSuccess?.();
5248
+ const gdata = config?.transform ? config.transform(data) : data;
5249
+ this.afterSuccessTransform(config, pipe);
5250
+ resolve(gdata);
5251
+ }).catch(async (e) => {
5252
+ this.error(config, pipe, e);
5253
+ config?.error?.();
5254
+ if (config?.errorTransform) {
5255
+ e = await config.errorTransform(e);
5256
+ }
5257
+ e = await this.errorTransform(e);
5258
+ reject(e);
5259
+ }).finally(() => {
5260
+ this.finally(config, pipe);
5261
+ config?.finally?.();
5262
+ });
5263
+ });
5264
+ }
5265
+ };
5266
+
5267
+ // ../core/dist/esm/fetch/HttpFetcher.js
5268
+ var HttpResponseError = class extends Error {
5269
+ };
5270
+ var HttpFetcher = class extends Fetcher {
5271
+ get(config) {
5272
+ config.config ?? (config.config = {});
5273
+ config.config.fetch = config.config?.fetch ?? {};
5274
+ config.config.fetch.method = "GET";
5275
+ return this.fetch(config);
5276
+ }
5277
+ post(config) {
5278
+ config.config ?? (config.config = {});
5279
+ config.config.fetch = config.config?.fetch ?? {};
5280
+ config.config.fetch.method = "POST";
5281
+ return this.fetch(config);
5282
+ }
5283
+ patch(config) {
5284
+ config.config ?? (config.config = {});
5285
+ config.config.fetch = config.config?.fetch ?? {};
5286
+ config.config.fetch.method = "PATCH";
5287
+ return this.fetch(config);
5288
+ }
5289
+ put(config) {
5290
+ config.config ?? (config.config = {});
5291
+ config.config.fetch = config.config?.fetch ?? {};
5292
+ config.config.fetch.method = "PUT";
5293
+ return this.fetch(config);
5294
+ }
5295
+ head(config) {
5296
+ config.config ?? (config.config = {});
5297
+ config.config.fetch = config.config?.fetch ?? {};
5298
+ config.config.fetch.method = "HEAD";
5299
+ return this.fetch(config);
5300
+ }
5301
+ delete(config) {
5302
+ config.config ?? (config.config = {});
5303
+ config.config.fetch = config.config?.fetch ?? {};
5304
+ config.config.fetch.method = "DELETE";
5305
+ return this.fetch(config);
5306
+ }
5307
+ async beforeProxyFetch(config) {
5308
+ return config;
5309
+ }
5310
+ async afterProxyFetch(config) {
5311
+ return config.response;
5312
+ }
5313
+ afterSuccess(config, pipe) {
5314
+ }
5315
+ afterSuccessTransform(config, pipe) {
5316
+ }
5317
+ before(config, pipe) {
5318
+ }
5319
+ error(config, pipe, e) {
5320
+ }
5321
+ finally(config, pipe) {
5322
+ }
5323
+ beforeFetch(fetch2) {
5324
+ }
5325
+ afterFetch(fetch2, response) {
5326
+ }
5327
+ // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5328
+ async errorTransform(e) {
5329
+ const httpResponseError = new HttpResponseError();
5330
+ httpResponseError.error = e;
5331
+ if (e instanceof Response) {
5332
+ httpResponseError.response = e;
5333
+ try {
5334
+ httpResponseError.body = await e.clone().text();
5335
+ httpResponseError.message = e.statusText;
5336
+ } catch (e2) {
5337
+ httpResponseError.body = e2;
5338
+ httpResponseError.message = e2.message;
5339
+ }
5340
+ } else {
5341
+ httpResponseError.body = e;
5342
+ httpResponseError.message = e.message;
5343
+ }
5344
+ return httpResponseError;
5345
+ }
5346
+ async execute(fetcherRequest) {
5347
+ let target = fetcherRequest.target;
5348
+ let config = fetcherRequest.config;
5349
+ if (!(target instanceof URL) && typeof target !== "string") {
5350
+ const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5351
+ try {
5352
+ const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5353
+ searchParams.forEach((value, key) => {
5354
+ url.searchParams.append(key, value);
5355
+ });
5356
+ target = url;
5357
+ } catch (e) {
5358
+ if (typeof target.url === "string") {
5359
+ const searchParamString = searchParams.toString();
5360
+ target = target.url + (searchParamString ? "?" + searchParamString : "");
5361
+ } else {
5362
+ target = "";
5363
+ }
5364
+ }
5365
+ }
5366
+ const beforeProxyData = { requestInfo: target, init: config?.fetch };
5367
+ let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5368
+ beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5369
+ target = beforeData.requestInfo;
5370
+ if (beforeData.init) {
5371
+ config ?? (config = {});
5372
+ config.fetch = beforeData.init;
5373
+ }
5374
+ let abortedTimeout;
5375
+ if (config?.fetch && "timeout" in config.fetch) {
5376
+ const abortController = new AbortController();
5377
+ abortedTimeout = setTimeout(() => {
5378
+ if (config?.fetch?.signal) {
5379
+ const inputSignal = config.fetch.signal;
5380
+ const listener = () => {
5381
+ if (!abortController.signal.aborted) {
5382
+ abortController.abort();
5383
+ }
5384
+ inputSignal.removeEventListener("abort", listener);
5385
+ };
5386
+ inputSignal.addEventListener("abort", listener);
5387
+ }
5388
+ if (!abortController.signal.aborted) {
5389
+ abortController.abort();
5390
+ }
5391
+ }, config.fetch.timeout);
5392
+ config.fetch.signal = abortController.signal;
5393
+ }
5394
+ this.beforeFetch({ target, requestInit: config?.fetch });
5395
+ return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5396
+ this.afterFetch({ target, requestInit: config?.fetch }, it);
5397
+ const afterProxyData = {
5398
+ fetch: { target, requestInit: config.fetch },
5399
+ config: beforeData,
5400
+ response: it
5401
+ };
5402
+ it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5403
+ it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5404
+ config?.fetchResponseAfterCallBack?.(it, config);
5405
+ if (!config?.allowedResponseNotOk && !it.ok) {
5406
+ throw it;
5407
+ }
5408
+ const data = config?.hasResponseErrorChecker?.(it, config);
5409
+ if (data) {
5410
+ throw data;
5411
+ }
5412
+ return it;
5413
+ }).finally(() => {
5414
+ if (abortedTimeout) {
5415
+ clearTimeout(abortedTimeout);
5416
+ }
5417
+ });
5418
+ }
5419
+ };
5420
+
5421
+ // ../core/dist/esm/fetch/HttpJsonFetcher.js
5422
+ var HttpJsonFetcher = class extends HttpFetcher {
5423
+ updateJsonFetchConfigAndData(config) {
5424
+ var _a4, _b2;
5425
+ const headers = {
5426
+ "Content-Type": "application/json",
5427
+ Accept: "application/json, text/plain, */*"
5428
+ };
5429
+ config.config ?? (config.config = {});
5430
+ (_a4 = config.config).fetch ?? (_a4.fetch = {});
5431
+ (_b2 = config.config.fetch).headers ?? (_b2.headers = {});
5432
+ config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5433
+ if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5434
+ config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5435
+ }
5436
+ return config;
5437
+ }
5438
+ get(config) {
5439
+ return super.get(config);
5440
+ }
5441
+ delete(config) {
5442
+ return super.delete(config);
5443
+ }
5444
+ post(config) {
5445
+ return super.post(config);
5446
+ }
5447
+ patch(config) {
5448
+ return super.patch(config);
5449
+ }
5450
+ put(config) {
5451
+ return super.put(config);
5452
+ }
5453
+ head(config) {
5454
+ return super.head(config);
5455
+ }
5456
+ postJson(config) {
5457
+ return super.post(this.updateJsonFetchConfigAndData(config));
5458
+ }
5459
+ patchJson(config) {
5460
+ return super.patch(this.updateJsonFetchConfigAndData(config));
5461
+ }
5462
+ putJson(config) {
5463
+ return super.put(this.updateJsonFetchConfigAndData(config));
5464
+ }
5465
+ async errorTransform(e) {
5466
+ const httpResponseError = new HttpResponseError();
5467
+ httpResponseError.error = e;
5468
+ if (e instanceof Response) {
5469
+ httpResponseError.response = e;
5470
+ try {
5471
+ httpResponseError.body = await e.clone().json();
5472
+ httpResponseError.message = e.statusText;
5473
+ } catch (parseError) {
5474
+ httpResponseError.body = parseError;
5475
+ httpResponseError.message = parseError.message;
5476
+ }
5477
+ } else {
5478
+ httpResponseError.body = e;
5479
+ httpResponseError.message = e.message;
5480
+ }
5481
+ return httpResponseError;
5482
+ }
5483
+ // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5484
+ execute(fetcherRequest) {
5485
+ return super.execute(fetcherRequest).then((response) => {
5486
+ const config = fetcherRequest.config;
5487
+ const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5488
+ if (transform === "response") {
5489
+ return response;
5490
+ } else if (transform === "text") {
5491
+ return response?.text();
5492
+ } else if (typeof transform === "function") {
5493
+ return transform(response);
5494
+ } else {
5495
+ return response?.text().then((it) => {
5496
+ if ((it ?? "").length > 0) {
5497
+ return JSON.parse(it);
5498
+ }
5499
+ });
5500
+ }
5501
+ });
5502
+ }
5503
+ };
5504
+
5126
5505
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5127
5506
  var RenderDrawObj = class extends Obj {
5128
5507
  render(draw, config) {
@@ -5399,7 +5778,7 @@ _RenderTransactionDrawObj.DEFAULT_BEZIER = { p1x: 0.61, p1y: 1, p2x: 0.88, p2y:
5399
5778
  // ../core/dist/esm/schedule/Schedule.js
5400
5779
  var Schedule;
5401
5780
  ((Schedule2) => {
5402
- Schedule2.SYMBOL = Symbol("Schedule");
5781
+ Schedule2.SYMBOL = Symbol.for("core:schedule-token");
5403
5782
  })(Schedule || (Schedule = {}));
5404
5783
 
5405
5784
  // ../core/dist/esm/url/UrlUtils.js
@@ -5553,6 +5932,17 @@ var ReflectUtils;
5553
5932
  Reflect.defineMetadata(metadataKey, value, target);
5554
5933
  }
5555
5934
  };
5935
+ ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
5936
+ const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
5937
+ for (const key of keys) {
5938
+ const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
5939
+ if (propertyKey) {
5940
+ Reflect.defineMetadata(key, data, to, propertyKey);
5941
+ } else {
5942
+ Reflect.defineMetadata(key, data, to);
5943
+ }
5944
+ }
5945
+ };
5556
5946
  })(ReflectUtils || (ReflectUtils = {}));
5557
5947
 
5558
5948
  // ../core/dist/esm/function/FunctionUtils.js
@@ -5716,7 +6106,7 @@ var Expression;
5716
6106
  })(Expression || (Expression = {}));
5717
6107
 
5718
6108
  // src/decorators/addEventListener.ts
5719
- var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
6109
+ var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
5720
6110
  function addEventListener(selectorOrTarget, type, options = {}) {
5721
6111
  return (targetObj, propertyKey, descriptor) => {
5722
6112
  const constructor = targetObj.constructor;
@@ -5737,15 +6127,15 @@ function addEventListenerHost(type, options) {
5737
6127
  }
5738
6128
 
5739
6129
  // src/decorators/lifecycles.ts
5740
- var ON_CONSTRUCTOR_METADATA_KEY = Symbol("simple-web-component:on-constructor");
5741
- var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-connected");
5742
- var ON_AFTER_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-connected");
5743
- var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-disconnected");
5744
- var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-disconnected");
5745
- var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
5746
- var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
5747
- var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
5748
- var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
6130
+ var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6131
+ var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
6132
+ var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
6133
+ var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
6134
+ var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
6135
+ var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
6136
+ var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
6137
+ var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
6138
+ var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
5749
6139
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
5750
6140
  function createLifecycleDecorator(metadataKey) {
5751
6141
  return (target, propertyKey) => {
@@ -5796,7 +6186,7 @@ var getOnConnectedInnerHtmlMetadata = (target) => {
5796
6186
  };
5797
6187
 
5798
6188
  // src/decorators/attribute.ts
5799
- var ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:attribute");
6189
+ var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
5800
6190
  var convertValue = (val, type) => {
5801
6191
  if (val === null || val === void 0) return val;
5802
6192
  if (type === Number) return Number(val);
@@ -5854,15 +6244,14 @@ function attribute(selector, options = {}) {
5854
6244
  const constructor = target.constructor;
5855
6245
  const privateKey = Symbol(String(propertyKey));
5856
6246
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
5857
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
6247
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
5858
6248
  if (!metaList) {
5859
6249
  metaList = [];
5860
- ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
6250
+ ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
5861
6251
  }
5862
6252
  metaList.push({ propertyKey, selector, options, privateKey });
5863
6253
  const applySetAttribute = (inst, targets, attrName, nv) => {
5864
6254
  targets.forEach((it) => {
5865
- console.log("----->", it);
5866
6255
  if (it && typeof it.setAttribute === "function") {
5867
6256
  if (nv === null) {
5868
6257
  it.removeAttribute(attrName);
@@ -5880,7 +6269,6 @@ function attribute(selector, options = {}) {
5880
6269
  const conf = getElementConfig(this);
5881
6270
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
5882
6271
  const targetType = options.type || designType;
5883
- console.log("type-->", propertyKey, targetType);
5884
6272
  if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
5885
6273
  return convertValue(this[privateKey], targetType);
5886
6274
  }
@@ -5896,7 +6284,6 @@ function attribute(selector, options = {}) {
5896
6284
  return convertValue(this[privateKey], targetType);
5897
6285
  },
5898
6286
  set(nv) {
5899
- const targetType = options.type || designType;
5900
6287
  const attrName = options.name || String(propertyKey);
5901
6288
  const conf = getElementConfig(this);
5902
6289
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
@@ -5921,15 +6308,31 @@ function attribute(selector, options = {}) {
5921
6308
  });
5922
6309
  };
5923
6310
  }
6311
+ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
6312
+ if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
6313
+ return attribute(":host", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
6314
+ }
6315
+ if (typeof targetOrAttrOrOptions === "string") {
6316
+ const attrName = targetOrAttrOrOptions;
6317
+ const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
6318
+ return attribute(":host", { ...options, name: attrName });
6319
+ } else if (typeof targetOrAttrOrOptions === "object") {
6320
+ const options = targetOrAttrOrOptions;
6321
+ return (target, propertyKey) => {
6322
+ return attribute(":host", { ...options, name: String(propertyKey) })(target, propertyKey);
6323
+ };
6324
+ } else {
6325
+ return (target, propertyKey) => {
6326
+ return attribute(":host", { name: String(propertyKey) })(target, propertyKey);
6327
+ };
6328
+ }
6329
+ }
5924
6330
  var findAllAttributeMetadata = (target) => {
5925
- return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
6331
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
5926
6332
  };
5927
- function attributeHost(attrName, options = {}) {
5928
- return attribute(":host", { ...options, name: attrName });
5929
- }
5930
6333
 
5931
6334
  // src/decorators/changedAttributeHost.ts
5932
- var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol("simple-web-component:on-attribute-changed");
6335
+ var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
5933
6336
  function changedAttributeHost(attributeName) {
5934
6337
  return (target, propertyKey) => {
5935
6338
  const constructor = target.constructor;
@@ -5955,102 +6358,43 @@ var findAllAttributeChangedMetadata = (target) => {
5955
6358
  return ReflectUtils.findAllMapMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, target);
5956
6359
  };
5957
6360
 
5958
- // src/decorators/setAttribute.ts
5959
- var SET_ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:set-attribute");
5960
- function setAttribute(selector, name, options = {}) {
5961
- return (target, propertyKey, descriptor) => {
5962
- const constructor = target.constructor;
5963
- let metaList = ReflectUtils.getOwnMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
5964
- if (!metaList) {
5965
- metaList = /* @__PURE__ */ new Map();
5966
- ReflectUtils.defineMetadata(SET_ATTRIBUTE_METADATA_KEY, metaList, constructor);
5967
- }
5968
- metaList.set(propertyKey, { propertyKey, selector, name, options });
5969
- const original = descriptor.value;
5970
- descriptor.value = async function(...args) {
5971
- ensureInit2(this);
5972
- const res = await original.apply(this, args);
5973
- if (res !== void 0) {
5974
- const hostSet = SwcUtils.getHostSet(this);
5975
- const conf = getElementConfig(this);
5976
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
5977
- const targetEls = [];
5978
- const r = options.root || "auto";
5979
- const applyRoot = (t) => {
5980
- if (!t) return;
5981
- if (r === "auto") {
5982
- targetEls.push(t.shadowRoot || t);
5983
- return;
5984
- }
5985
- if (r === "light" || r === "all") targetEls.push(t);
5986
- if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
5987
- };
5988
- if (selector === ":window") targetEls.push(currentWin);
5989
- else if (selector === ":document") targetEls.push(currentWin.document);
5990
- else if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
5991
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
5992
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
5993
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
5994
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
5995
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
5996
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
5997
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
5998
- else if (selector === ":host" || !selector) applyRoot(this);
5999
- else {
6000
- const roots = [];
6001
- if (r === "shadow") {
6002
- if (this.shadowRoot) roots.push(this.shadowRoot);
6003
- } else if (r === "light") {
6004
- roots.push(this);
6005
- } else if (r === "all") {
6006
- roots.push(this);
6007
- if (this.shadowRoot) roots.push(this.shadowRoot);
6008
- } else {
6009
- roots.push(this.shadowRoot || this);
6010
- }
6011
- roots.forEach((root) => targetEls.push(...root.querySelectorAll(selector)));
6012
- }
6013
- targetEls.forEach((targetEl) => {
6014
- if (!targetEl || typeof targetEl.setAttribute !== "function") return;
6015
- if (res === null) targetEl.removeAttribute(name);
6016
- else targetEl.setAttribute(name, String(res));
6017
- });
6018
- }
6019
- return res;
6020
- };
6021
- };
6022
- }
6023
- var getSetAttributeMetadata = (target) => {
6024
- const constructor = target instanceof Function ? target : target.constructor;
6025
- return ReflectUtils.getMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
6026
- };
6027
- var findAllSetAttributeMetadata = (target) => {
6028
- const result = /* @__PURE__ */ new Map();
6029
- const maps = ReflectUtils.findAllMetadata(SET_ATTRIBUTE_METADATA_KEY, target);
6030
- maps.forEach((map) => {
6031
- if (map instanceof Map) {
6032
- map.forEach((v, k) => result.set(k, v));
6033
- }
6034
- });
6035
- return result;
6036
- };
6037
- function setAttributeHost(name, options) {
6038
- return setAttribute(":host", name, options);
6039
- }
6040
-
6041
6361
  // src/decorators/applyNode.ts
6042
- var APPLY_NODE_METADATA_KEY = Symbol("simple-web-component:apply-node");
6362
+ var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
6043
6363
  var normalizeNodes = (res, doc) => {
6044
6364
  const items = Array.isArray(res) ? res : [res];
6045
6365
  return items.map((it) => {
6046
- if (it instanceof Node)
6047
- return it;
6366
+ if (it instanceof Node) return it;
6048
6367
  return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
6049
6368
  });
6050
6369
  };
6370
+ var applyToDom = (targetEl, res, pos, doc) => {
6371
+ if (!targetEl) return;
6372
+ if (pos === "innerHtml") {
6373
+ targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6374
+ return;
6375
+ }
6376
+ if (pos === "innerText") {
6377
+ if (targetEl.innerText !== void 0) {
6378
+ targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6379
+ }
6380
+ return;
6381
+ }
6382
+ const isShadowRoot = targetEl instanceof ShadowRoot;
6383
+ const nodes = normalizeNodes(res, doc);
6384
+ if (pos === "replace") {
6385
+ if (!isShadowRoot) targetEl.replaceWith(...nodes);
6386
+ } else if (pos === "replaceChildren") {
6387
+ targetEl.replaceChildren(...nodes);
6388
+ } else {
6389
+ if (pos === "beforeEnd") targetEl.append(...nodes);
6390
+ else if (pos === "afterBegin") targetEl.prepend(...nodes);
6391
+ else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
6392
+ else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
6393
+ }
6394
+ };
6051
6395
  function applyNode(selector, options = { position: "beforeEnd" }) {
6052
- return (target, propertyKey, descriptor) => {
6053
- const constructor = target.constructor;
6396
+ return (targetObj, propertyKey, descriptor) => {
6397
+ const constructor = targetObj.constructor;
6054
6398
  let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
6055
6399
  if (!metaList) {
6056
6400
  metaList = /* @__PURE__ */ new Map();
@@ -6058,81 +6402,58 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
6058
6402
  }
6059
6403
  metaList.set(propertyKey, { propertyKey, selector, options });
6060
6404
  const original = descriptor.value;
6061
- descriptor.value = async function(...args) {
6405
+ descriptor.value = function(...args) {
6062
6406
  ensureInit2(this);
6063
- const res = await original.apply(this, args);
6064
- if (res !== void 0) {
6065
- const conf = getElementConfig(this);
6066
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6067
- const currentDoc = currentWin.document;
6068
- const pos = options.position || "beforeEnd";
6407
+ const conf = getElementConfig(this);
6408
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6409
+ const currentDoc = currentWin.document;
6410
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
6411
+ const getTarget = () => {
6069
6412
  const r = options.root || "auto";
6070
- const getTargetRoot = () => {
6071
- if (r === "shadow")
6072
- return this.shadowRoot;
6073
- if (r === "light")
6074
- return this;
6075
- if (r === "all")
6076
- return this.shadowRoot || this;
6077
- return this.shadowRoot || this;
6413
+ const applyRoot = (t) => {
6414
+ if (!t) return t;
6415
+ if (r === "auto") return t.shadowRoot || t;
6416
+ if (r === "shadow") return t.shadowRoot;
6417
+ if (r === "light") return t;
6418
+ if (r === "all") return t.shadowRoot || t;
6419
+ return t;
6078
6420
  };
6079
- if (pos === "remove") {
6080
- if (res) {
6081
- if (selector === ":host" || !selector) {
6082
- if (r === "shadow" && this.shadowRoot) {
6083
- this.shadowRoot.replaceChildren();
6084
- } else {
6085
- this.remove();
6086
- }
6087
- } else {
6088
- const targetRoot = getTargetRoot();
6089
- if (targetRoot) {
6090
- const targets = targetRoot.querySelectorAll(selector);
6091
- targets.forEach((el) => el.remove());
6092
- }
6093
- }
6094
- }
6095
- } else {
6096
- let targetEl = null;
6097
- if (selector === ":host" || !selector) {
6098
- if (r === "shadow") {
6099
- targetEl = this.shadowRoot;
6100
- } else {
6101
- targetEl = this;
6102
- }
6103
- } else {
6104
- const targetRoot = getTargetRoot();
6105
- targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
6106
- }
6107
- if (targetEl) {
6108
- const isShadowRoot = targetEl instanceof ShadowRoot;
6109
- const nodes = normalizeNodes(res, currentDoc);
6110
- if (pos === "replace") {
6111
- if (!isShadowRoot) {
6112
- targetEl.replaceWith(...nodes);
6113
- }
6114
- } else if (pos === "replaceChildren") {
6115
- targetEl.replaceChildren(...nodes);
6116
- } else if (pos === "innerHtml") {
6117
- targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6118
- } else if (pos === "innerText") {
6119
- if (targetEl.innerText !== void 0) {
6120
- targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6121
- }
6122
- } else {
6123
- if (pos === "beforeEnd")
6124
- targetEl.append(...nodes);
6125
- else if (pos === "afterBegin")
6126
- targetEl.prepend(...nodes);
6127
- else if (pos === "beforeBegin" && !isShadowRoot)
6128
- targetEl.before(...nodes);
6129
- else if (pos === "afterEnd" && !isShadowRoot)
6130
- targetEl.after(...nodes);
6131
- }
6132
- }
6421
+ if (selector === ":host") return applyRoot(this);
6422
+ if (selector === ":parentHost") return applyRoot(hostSet.$parentHost);
6423
+ if (selector === ":appHost") return applyRoot(hostSet.$appHost);
6424
+ if (selector === ":firstHost") return applyRoot(hostSet.$firstHost);
6425
+ if (selector === ":lastHost") return applyRoot(hostSet.$lastHost);
6426
+ const targetRoot = applyRoot(this);
6427
+ return targetRoot ? targetRoot.querySelector(selector) : null;
6428
+ };
6429
+ const targetEl = getTarget();
6430
+ const res = original.apply(this, args);
6431
+ const runApply = (target, val) => {
6432
+ const pos = options.position || "beforeEnd";
6433
+ const defaultFilter = (t, v) => {
6434
+ if (v instanceof Node) return !t.contains(v);
6435
+ if (pos === "innerHtml" && typeof v === "string") return t.innerHTML !== v;
6436
+ if (pos === "replaceChildren" && v instanceof Node) return !t.contains(v);
6437
+ return true;
6438
+ };
6439
+ const activeFilter = options.filter || defaultFilter;
6440
+ if (activeFilter(target, val, hostSet)) {
6441
+ applyToDom(target, val, pos, currentDoc);
6133
6442
  }
6443
+ };
6444
+ if (res instanceof Promise) {
6445
+ if (targetEl && options.loading) {
6446
+ const loadingRes = options.loading.call(this, hostSet);
6447
+ applyToDom(targetEl, loadingRes, options.position || "beforeEnd", currentDoc);
6448
+ }
6449
+ return res.then((finalRes) => {
6450
+ if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
6451
+ return finalRes;
6452
+ });
6453
+ } else {
6454
+ if (res !== void 0 && targetEl) runApply(targetEl, res);
6455
+ return res;
6134
6456
  }
6135
- return res;
6136
6457
  };
6137
6458
  };
6138
6459
  }
@@ -6146,30 +6467,30 @@ var findAllApplyNodeMetadata = (target) => {
6146
6467
  });
6147
6468
  return result;
6148
6469
  };
6149
- function applyNodeHost(options = { position: "beforeEnd" }) {
6150
- return applyNode(":host", options);
6470
+ function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
6471
+ if (propertyKey !== void 0) return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
6472
+ const opt = targetOrOptions || {};
6473
+ return applyNode(":host", { position: "beforeEnd", ...opt });
6474
+ }
6475
+ function applyReplaceChildrenNodeHost(targetOrOptions, propertyKey, descriptor) {
6476
+ if (propertyKey !== void 0) return applyNode(":host", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
6477
+ const opt = targetOrOptions || {};
6478
+ return applyNode(":host", { position: "replaceChildren", ...opt });
6479
+ }
6480
+ function applyInnerHtmlNodeHost(targetOrOptions, propertyKey, descriptor) {
6481
+ if (propertyKey !== void 0) return applyNode(":host", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
6482
+ const opt = targetOrOptions || {};
6483
+ return applyNode(":host", { position: "innerHtml", ...opt });
6484
+ }
6485
+ function applyReplaceChildrenNode(selector, options = {}) {
6486
+ return applyNode(selector, { ...options, position: "replaceChildren" });
6487
+ }
6488
+ function applyInnerHtmlNode(selector, options = {}) {
6489
+ return applyNode(selector, { ...options, position: "innerHtml" });
6151
6490
  }
6152
- var applyBeforeBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeBegin" });
6153
- var applyAfterBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterBegin" });
6154
- var applyBeforeEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeEnd" });
6155
- var applyAfterEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterEnd" });
6156
- var applyReplaceNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replace" });
6157
- var applyReplaceChildrenNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replaceChildren" });
6158
- var applyInnerHtmlNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerHtml" });
6159
- var applyInnerTextNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerText" });
6160
- var applyRemoveNode = (selector, options = {}) => applyNode(selector, { ...options, position: "remove" });
6161
- var applyBeforeBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeBegin" });
6162
- var applyAfterBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterBegin" });
6163
- var applyBeforeEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeEnd" });
6164
- var applyAfterEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterEnd" });
6165
- var applyReplaceNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replace" });
6166
- var applyReplaceChildrenNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replaceChildren" });
6167
- var applyInnerHtmlNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerHtml" });
6168
- var applyInnerTextNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerText" });
6169
- var applyRemoveNodeHost = (options = {}) => applyNode(":host", { ...options, position: "remove" });
6170
6491
 
6171
6492
  // src/decorators/query.ts
6172
- var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
6493
+ var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
6173
6494
  function query(selectorOrTarget, options = {}) {
6174
6495
  return (targetObj, propertyKey, descriptor) => {
6175
6496
  if (descriptor !== void 0) {
@@ -6267,12 +6588,80 @@ var getQueryMetadata = (target) => {
6267
6588
  const constructor = target instanceof Function ? target : target.constructor;
6268
6589
  return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6269
6590
  };
6270
- function queryHost(options) {
6271
- return query(":host", options);
6591
+ function queryHost(targetOrOptions, propertyKey) {
6592
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6593
+ return query(":host", {})(targetOrOptions, propertyKey);
6594
+ }
6595
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6596
+ return query(":host", targetOrOptions);
6597
+ } else {
6598
+ return query(":host", {});
6599
+ }
6600
+ }
6601
+ var host = queryHost;
6602
+ function parentHost(targetOrOptions, propertyKey) {
6603
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6604
+ return query(":parentHost", {})(targetOrOptions, propertyKey);
6605
+ }
6606
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6607
+ return query(":parentHost", targetOrOptions);
6608
+ } else {
6609
+ return query(":parentHost", {});
6610
+ }
6611
+ }
6612
+ function appHost(targetOrOptions, propertyKey) {
6613
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6614
+ return query(":appHost", {})(targetOrOptions, propertyKey);
6615
+ }
6616
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6617
+ return query(":appHost", targetOrOptions);
6618
+ } else {
6619
+ return query(":appHost", {});
6620
+ }
6621
+ }
6622
+ function firstHost(targetOrOptions, propertyKey) {
6623
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6624
+ return query(":firstHost", {})(targetOrOptions, propertyKey);
6625
+ }
6626
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6627
+ return query(":firstHost", targetOrOptions);
6628
+ } else {
6629
+ return query(":firstHost", {});
6630
+ }
6631
+ }
6632
+ function lastHost(targetOrOptions, propertyKey) {
6633
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6634
+ return query(":lastHost", {})(targetOrOptions, propertyKey);
6635
+ }
6636
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6637
+ return query(":lastHost", targetOrOptions);
6638
+ } else {
6639
+ return query(":lastHost", {});
6640
+ }
6641
+ }
6642
+ function firstAppHost(targetOrOptions, propertyKey) {
6643
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6644
+ return query(":firstAppHost", {})(targetOrOptions, propertyKey);
6645
+ }
6646
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6647
+ return query(":firstAppHost", targetOrOptions);
6648
+ } else {
6649
+ return query(":firstAppHost", {});
6650
+ }
6651
+ }
6652
+ function lastAppHost(targetOrOptions, propertyKey) {
6653
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6654
+ return query(":lastAppHost", {})(targetOrOptions, propertyKey);
6655
+ }
6656
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6657
+ return query(":lastAppHost", targetOrOptions);
6658
+ } else {
6659
+ return query(":lastAppHost", {});
6660
+ }
6272
6661
  }
6273
6662
 
6274
6663
  // src/decorators/queryAll.ts
6275
- var QUERY_ALL_METADATA_KEY = Symbol("simple-web-component:query-all");
6664
+ var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
6276
6665
  function queryAll(selectorOrTarget, options = {}) {
6277
6666
  return (targetObj, propertyKey, descriptor) => {
6278
6667
  if (descriptor !== void 0) {
@@ -6367,101 +6756,197 @@ var getQueryAllMetadata = (target) => {
6367
6756
  const constructor = target instanceof Function ? target : target.constructor;
6368
6757
  return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6369
6758
  };
6370
- function queryAllHost(options) {
6371
- return queryAll(":host", options);
6759
+ function queryAllHost(targetOrOptions, propertyKey) {
6760
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6761
+ return queryAll(":host", {})(targetOrOptions, propertyKey);
6762
+ }
6763
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6764
+ return queryAll(":host", targetOrOptions);
6765
+ } else {
6766
+ return queryAll(":host", {});
6767
+ }
6372
6768
  }
6373
-
6374
- // src/decorators/classList.ts
6375
- var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
6376
- function createClassListDecorator(action) {
6377
- return (selector, options = {}) => {
6378
- return (target, propertyKey, descriptor) => {
6379
- const constructor = target.constructor;
6380
- let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
6381
- if (!metaList) {
6382
- metaList = /* @__PURE__ */ new Map();
6383
- ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
6384
- }
6385
- metaList.set(propertyKey, { propertyKey, selector, action, options });
6386
- const original = descriptor.value;
6387
- descriptor.value = async function(...args) {
6388
- ensureInit2(this);
6769
+ var allHost = queryAllHost;
6770
+ function allParentHost(targetOrOptions, propertyKey) {
6771
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6772
+ return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
6773
+ }
6774
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6775
+ return queryAll(":parentHost", targetOrOptions);
6776
+ } else {
6777
+ return queryAll(":parentHost", {});
6778
+ }
6779
+ }
6780
+ function allAppHost(targetOrOptions, propertyKey) {
6781
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6782
+ return queryAll(":appHost", {})(targetOrOptions, propertyKey);
6783
+ }
6784
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6785
+ return queryAll(":appHost", targetOrOptions);
6786
+ } else {
6787
+ return queryAll(":appHost", {});
6788
+ }
6789
+ }
6790
+ function allFirstHost(targetOrOptions, propertyKey) {
6791
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6792
+ return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
6793
+ }
6794
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6795
+ return queryAll(":firstHost", targetOrOptions);
6796
+ } else {
6797
+ return queryAll(":firstHost", {});
6798
+ }
6799
+ }
6800
+ function allLastHost(targetOrOptions, propertyKey) {
6801
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6802
+ return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
6803
+ }
6804
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6805
+ return queryAll(":lastHost", targetOrOptions);
6806
+ } else {
6807
+ return queryAll(":lastHost", {});
6808
+ }
6809
+ }
6810
+ function allFirstAppHost(targetOrOptions, propertyKey) {
6811
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6812
+ return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
6813
+ }
6814
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6815
+ return queryAll(":firstAppHost", targetOrOptions);
6816
+ } else {
6817
+ return queryAll(":firstAppHost", {});
6818
+ }
6819
+ }
6820
+ function allLastAppHost(targetOrOptions, propertyKey) {
6821
+ if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6822
+ return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
6823
+ }
6824
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6825
+ return queryAll(":lastAppHost", targetOrOptions);
6826
+ } else {
6827
+ return queryAll(":lastAppHost", {});
6828
+ }
6829
+ }
6830
+
6831
+ // src/decorators/applyClass.ts
6832
+ var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
6833
+ function createClassDecorator(action) {
6834
+ return (selector, classMapOrOptions, options = {}) => {
6835
+ return (target, propertyKey, descriptor) => {
6836
+ const constructor = target.constructor;
6837
+ let metaList = ReflectUtils.getOwnMetadata(CLASS_METADATA_KEY, constructor);
6838
+ if (!metaList) {
6839
+ metaList = /* @__PURE__ */ new Map();
6840
+ ReflectUtils.defineMetadata(CLASS_METADATA_KEY, metaList, constructor);
6841
+ }
6842
+ let classMap = void 0;
6843
+ let finalOptions = options;
6844
+ if (typeof classMapOrOptions === "string" || typeof classMapOrOptions === "object" && classMapOrOptions !== null && !("root" in classMapOrOptions)) {
6845
+ classMap = classMapOrOptions;
6846
+ } else if (typeof classMapOrOptions === "object" && classMapOrOptions !== null && "root" in classMapOrOptions) {
6847
+ finalOptions = classMapOrOptions;
6848
+ }
6849
+ metaList.set(propertyKey, { propertyKey, selector, action, options: finalOptions });
6850
+ const original = descriptor.value;
6851
+ descriptor.value = async function(...args) {
6852
+ ensureInit2(this);
6389
6853
  const res = await original.apply(this, args);
6390
6854
  if (res !== void 0) {
6391
- const r = options.root || "auto";
6392
- const hostSet = SwcUtils.getHostSet(this);
6855
+ const win = this.ownerDocument?.defaultView || window;
6856
+ const host2 = this;
6857
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6858
+ const r = finalOptions.root || "auto";
6393
6859
  const targetEls = [];
6394
- if (selector === ":host" || !selector) {
6395
- targetEls.push(this);
6396
- } else if (selector === ":parentHost") {
6397
- if (hostSet.$parentHost) targetEls.push(hostSet.$parentHost);
6398
- } else if (selector === ":appHost") {
6399
- if (hostSet.$appHost) targetEls.push(hostSet.$appHost);
6400
- } else {
6401
- if (r === "shadow") {
6402
- const found = this.shadowRoot?.querySelectorAll(selector);
6403
- if (found) targetEls.push(...found);
6404
- } else if (r === "light") {
6405
- const found = this.querySelectorAll(selector);
6406
- if (found) targetEls.push(...found);
6407
- } else if (r === "all") {
6408
- const sFound = this.shadowRoot?.querySelectorAll(selector);
6409
- const lFound = this.querySelectorAll(selector);
6410
- if (sFound) targetEls.push(...sFound);
6411
- if (lFound) targetEls.push(...lFound);
6412
- } else {
6413
- const found = (this.shadowRoot || this).querySelectorAll(selector);
6414
- if (found) targetEls.push(...found);
6860
+ const applyRoot = (t) => {
6861
+ if (!t || !(t instanceof win.HTMLElement)) return;
6862
+ targetEls.push(t);
6863
+ };
6864
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6865
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6866
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6867
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6868
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6869
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6870
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6871
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6872
+ else if (selector === ":host" || !selector) applyRoot(host2);
6873
+ else {
6874
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
6875
+ if (targetRoot) {
6876
+ const found = targetRoot.querySelectorAll(selector);
6877
+ if (found) targetEls.push(...Array.from(found));
6415
6878
  }
6416
6879
  }
6417
6880
  targetEls.forEach((targetEl) => {
6881
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
6418
6882
  if (action === "set") {
6419
6883
  let classes = "";
6420
- if (typeof res === "object" && res !== null && !Array.isArray(res)) {
6421
- classes = Object.entries(res).filter(([_, force]) => !!force).map(([cls]) => cls).join(" ");
6884
+ if (classMap && typeof classMap === "string") {
6885
+ classes = resolvedRes ? classMap : "";
6886
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6887
+ classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
6422
6888
  } else {
6423
- classes = Array.isArray(res) ? res.join(" ") : String(res);
6889
+ classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
6424
6890
  }
6425
6891
  targetEl.className = classes;
6426
- } else if (action === "update") {
6427
- if (typeof res === "object" && res !== null && !Array.isArray(res)) {
6428
- Object.entries(res).forEach(([cls, force]) => {
6429
- targetEl.classList.toggle(cls, !!force);
6892
+ } else if (action === "update" || action === "toggle") {
6893
+ if (classMap && typeof classMap === "string") {
6894
+ targetEl.classList.toggle(classMap, !!resolvedRes);
6895
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6896
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
6897
+ const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
6898
+ targetEl.classList.toggle(cls, isActive);
6430
6899
  });
6431
- } else if (res !== void 0 && res !== null) {
6432
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6433
- targetEl.classList.add(...classes);
6900
+ } else {
6901
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
6902
+ if (action === "update") targetEl.classList.add(...classes);
6903
+ else classes.forEach((c) => targetEl.classList.toggle(c));
6904
+ }
6905
+ } else if (action === "add" || action === "remove") {
6906
+ if (classMap && typeof classMap === "string" && !!resolvedRes) {
6907
+ if (action === "add") targetEl.classList.add(classMap);
6908
+ else targetEl.classList.remove(classMap);
6909
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
6910
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
6911
+ const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
6912
+ if (shouldExecute) {
6913
+ if (action === "add") targetEl.classList.add(cls);
6914
+ else targetEl.classList.remove(cls);
6915
+ }
6916
+ });
6917
+ } else {
6918
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
6919
+ if (action === "add") targetEl.classList.add(...classes);
6920
+ else targetEl.classList.remove(...classes);
6434
6921
  }
6435
- } else if (action === "add") {
6436
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6437
- targetEl.classList.add(...classes);
6438
- } else if (action === "remove") {
6439
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6440
- targetEl.classList.remove(...classes);
6441
- } else if (action === "toggle") {
6442
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6443
- classes.forEach((c) => targetEl.classList.toggle(c));
6444
6922
  }
6445
6923
  });
6446
6924
  }
6447
6925
  return res;
6448
6926
  };
6927
+ return descriptor;
6449
6928
  };
6450
6929
  };
6451
6930
  }
6452
- var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
6453
- var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
6454
- var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
6455
- var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
6456
- var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
6457
- var setClassListHost = (options = {}) => createClassListDecorator("set")(":host", options);
6458
- var updateClassListHost = (options = {}) => createClassListDecorator("update")(":host", options);
6459
- var addClassListHost = (options = {}) => createClassListDecorator("add")(":host", options);
6460
- var removeClassListHost = (options = {}) => createClassListDecorator("remove")(":host", options);
6461
- var toggleClassListHost = (options = {}) => createClassListDecorator("toggle")(":host", options);
6462
- var findAllClassListMetadata = (target) => {
6931
+ function applyClass(selector, action = "update", options = {}) {
6932
+ return createClassDecorator(action)(selector, options);
6933
+ }
6934
+ var setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
6935
+ var updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
6936
+ var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
6937
+ var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
6938
+ var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
6939
+ function applyClassHost(action = "update", options = {}) {
6940
+ return createClassDecorator(action)(":host", options);
6941
+ }
6942
+ var setClassHost = (classMapOrOptions, options = {}) => createClassDecorator("set")(":host", classMapOrOptions, options);
6943
+ var updateClassHost = (classMapOrOptions, options = {}) => createClassDecorator("update")(":host", classMapOrOptions, options);
6944
+ var addClassHost = (classMapOrOptions, options = {}) => createClassDecorator("add")(":host", classMapOrOptions, options);
6945
+ var removeClassHost = (classMapOrOptions, options = {}) => createClassDecorator("remove")(":host", classMapOrOptions, options);
6946
+ var toggleClassHost = (classMapOrOptions, options = {}) => createClassDecorator("toggle")(":host", classMapOrOptions, options);
6947
+ var findAllClassMetadata = (target) => {
6463
6948
  const result = /* @__PURE__ */ new Map();
6464
- const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
6949
+ const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
6465
6950
  maps.forEach((map) => {
6466
6951
  if (map instanceof Map) {
6467
6952
  map.forEach((v, k) => result.set(k, v));
@@ -6470,8 +6955,8 @@ var findAllClassListMetadata = (target) => {
6470
6955
  return result;
6471
6956
  };
6472
6957
 
6473
- // src/decorators/style.ts
6474
- var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
6958
+ // src/decorators/applyStyle.ts
6959
+ var STYLE_METADATA_KEY = Symbol.for("simple-web-component:style");
6475
6960
  function createStyleDecorator(action) {
6476
6961
  return (selector, options = {}) => {
6477
6962
  return (target, propertyKey, descriptor) => {
@@ -6487,60 +6972,79 @@ function createStyleDecorator(action) {
6487
6972
  ensureInit2(this);
6488
6973
  const res = await original.apply(this, args);
6489
6974
  if (res !== void 0) {
6975
+ const win = this.ownerDocument?.defaultView || window;
6976
+ const host2 = this;
6977
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6490
6978
  const r = options.root || "auto";
6491
- const hostSet = SwcUtils.getHostSet(this);
6492
6979
  const targetEls = [];
6493
- if (selector === ":host" || !selector) {
6494
- targetEls.push(this);
6495
- } else if (selector === ":parentHost") {
6496
- if (hostSet.$parentHost) targetEls.push(hostSet.$parentHost);
6497
- } else if (selector === ":appHost") {
6498
- if (hostSet.$appHost) targetEls.push(hostSet.$appHost);
6499
- } else {
6500
- if (r === "shadow") {
6501
- const found = this.shadowRoot?.querySelectorAll(selector);
6502
- if (found) targetEls.push(...found);
6503
- } else if (r === "light") {
6504
- const found = this.querySelectorAll(selector);
6505
- if (found) targetEls.push(...found);
6506
- } else if (r === "all") {
6507
- const sFound = this.shadowRoot?.querySelectorAll(selector);
6508
- const lFound = this.querySelectorAll(selector);
6509
- if (sFound) targetEls.push(...sFound);
6510
- if (lFound) targetEls.push(...lFound);
6511
- } else {
6512
- const found = (this.shadowRoot || this).querySelectorAll(selector);
6513
- if (found) targetEls.push(...found);
6980
+ const applyRoot = (t) => {
6981
+ if (!t || !(t instanceof win.HTMLElement)) return;
6982
+ targetEls.push(t);
6983
+ };
6984
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6985
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6986
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6987
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6988
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6989
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6990
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6991
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6992
+ else if (selector === ":host" || !selector) applyRoot(host2);
6993
+ else {
6994
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
6995
+ if (targetRoot) {
6996
+ const found = targetRoot.querySelectorAll(selector);
6997
+ if (found) targetEls.push(...Array.from(found));
6514
6998
  }
6515
6999
  }
6516
7000
  targetEls.forEach((targetEl) => {
6517
- if (action === "set") {
6518
- targetEl.style.cssText = "";
6519
- if (typeof res === "object" && res !== null) {
6520
- Object.assign(targetEl.style, res);
6521
- } else if (typeof res === "string") {
6522
- targetEl.style.cssText = res;
6523
- }
6524
- } else if (action === "update") {
6525
- if (typeof res === "object" && res !== null) {
6526
- Object.assign(targetEl.style, res);
7001
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
7002
+ if (action === "set" || action === "update") {
7003
+ if (action === "set") targetEl.style.cssText = "";
7004
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7005
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
7006
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
7007
+ if (finalVal === null || finalVal === void 0) {
7008
+ targetEl.style.removeProperty(prop);
7009
+ } else {
7010
+ targetEl.style[prop] = String(finalVal);
7011
+ }
7012
+ });
7013
+ } else if (typeof resolvedRes === "string") {
7014
+ targetEl.style.cssText = resolvedRes;
6527
7015
  }
6528
7016
  } else if (action === "remove") {
6529
- const props = Array.isArray(res) ? res : [res];
6530
- props.forEach((p) => targetEl.style.removeProperty(String(p)));
7017
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7018
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
7019
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
7020
+ if (shouldRemove) {
7021
+ targetEl.style.removeProperty(prop);
7022
+ }
7023
+ });
7024
+ } else {
7025
+ const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
7026
+ props.forEach((p) => targetEl.style.removeProperty(String(p)));
7027
+ }
6531
7028
  }
6532
7029
  });
6533
7030
  }
6534
7031
  return res;
6535
7032
  };
7033
+ return descriptor;
6536
7034
  };
6537
7035
  };
6538
7036
  }
7037
+ function applyStyle(selector, action = "update", options = {}) {
7038
+ return createStyleDecorator(action)(selector, options);
7039
+ }
6539
7040
  var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6540
- var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
6541
7041
  var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
6542
- var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
6543
7042
  var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
7043
+ function applyStyleHost(action = "update", options = {}) {
7044
+ return createStyleDecorator(action)(":host", options);
7045
+ }
7046
+ var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
7047
+ var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
6544
7048
  var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
6545
7049
  var findAllStyleMetadata = (target) => {
6546
7050
  const result = /* @__PURE__ */ new Map();
@@ -6553,8 +7057,248 @@ var findAllStyleMetadata = (target) => {
6553
7057
  return result;
6554
7058
  };
6555
7059
 
7060
+ // src/decorators/applyAttribute.ts
7061
+ var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
7062
+ function createAttributeDecorator(action) {
7063
+ return (selector, nameOrOptions, options = {}) => {
7064
+ return (target, propertyKey, descriptor) => {
7065
+ const constructor = target.constructor;
7066
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
7067
+ if (!metaList) {
7068
+ metaList = /* @__PURE__ */ new Map();
7069
+ ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
7070
+ }
7071
+ let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
7072
+ let finalOptions = options;
7073
+ if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
7074
+ finalOptions = nameOrOptions;
7075
+ }
7076
+ metaList.set(propertyKey, {
7077
+ propertyKey,
7078
+ selector,
7079
+ action,
7080
+ options: { ...finalOptions, name: attributeName }
7081
+ });
7082
+ const original = descriptor.value;
7083
+ descriptor.value = async function(...args) {
7084
+ ensureInit2(this);
7085
+ const res = await original.apply(this, args);
7086
+ if (res !== void 0) {
7087
+ const win = this.ownerDocument?.defaultView || window;
7088
+ const host2 = this;
7089
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
7090
+ const r = finalOptions.root || "auto";
7091
+ const targetEls = [];
7092
+ const applyRoot = (t) => {
7093
+ if (!t || !(t instanceof win.HTMLElement)) return;
7094
+ targetEls.push(t);
7095
+ };
7096
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
7097
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
7098
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
7099
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
7100
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
7101
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
7102
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
7103
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
7104
+ else if (selector === ":host" || !selector) applyRoot(host2);
7105
+ else {
7106
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
7107
+ if (targetRoot) {
7108
+ const found = targetRoot.querySelectorAll(selector);
7109
+ if (found) targetEls.push(...Array.from(found));
7110
+ }
7111
+ }
7112
+ targetEls.forEach((targetEl) => {
7113
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
7114
+ if (action === "set" || action === "update") {
7115
+ if (attributeName) {
7116
+ if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
7117
+ targetEl.removeAttribute(attributeName);
7118
+ } else {
7119
+ targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
7120
+ }
7121
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7122
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
7123
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
7124
+ if (finalVal === null || finalVal === void 0 || finalVal === false) {
7125
+ targetEl.removeAttribute(attr);
7126
+ } else {
7127
+ targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
7128
+ }
7129
+ });
7130
+ }
7131
+ } else if (action === "remove") {
7132
+ if (attributeName) {
7133
+ targetEl.removeAttribute(attributeName);
7134
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7135
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
7136
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
7137
+ if (shouldRemove) targetEl.removeAttribute(attr);
7138
+ });
7139
+ } else {
7140
+ const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
7141
+ attrs.forEach((a) => targetEl.removeAttribute(String(a)));
7142
+ }
7143
+ }
7144
+ });
7145
+ }
7146
+ return res;
7147
+ };
7148
+ return descriptor;
7149
+ };
7150
+ };
7151
+ }
7152
+ function applyAttribute(selector, action = "update", options = {}) {
7153
+ return createAttributeDecorator(action)(selector, options);
7154
+ }
7155
+ var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
7156
+ var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
7157
+ var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
7158
+ function applyAttributeHost(action = "update", options = {}) {
7159
+ return createAttributeDecorator(action)(":host", options);
7160
+ }
7161
+ var setAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("set")(":host", nameOrOptions, options);
7162
+ var updateAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("update")(":host", nameOrOptions, options);
7163
+ var removeAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("remove")(":host", nameOrOptions, options);
7164
+ var findAllAttributeApplyMetadata = (target) => {
7165
+ const result = /* @__PURE__ */ new Map();
7166
+ const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
7167
+ maps.forEach((map) => {
7168
+ if (map instanceof Map) {
7169
+ map.forEach((v, k) => result.set(k, v));
7170
+ }
7171
+ });
7172
+ return result;
7173
+ };
7174
+
6556
7175
  // src/utils/Utils.ts
6557
- var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
7176
+ var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
7177
+ var htmlFragment = (html, doc) => {
7178
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7179
+ if (!d) throw new Error("Document is not available");
7180
+ const template = d.createElement("template");
7181
+ template.innerHTML = html.trim();
7182
+ return template.content;
7183
+ };
7184
+ var textNode = (text, doc) => {
7185
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7186
+ if (!d) throw new Error("Document is not available");
7187
+ return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
7188
+ };
7189
+ var commentNode = (comment, doc) => {
7190
+ const d = doc || (typeof document !== "undefined" ? document : void 0);
7191
+ if (!d) throw new Error("Document is not available");
7192
+ return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
7193
+ };
7194
+ var createElement = (tagName, options) => {
7195
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7196
+ if (!d) throw new Error("Document is not available");
7197
+ const el = d.createElement(tagName);
7198
+ if (options?.html) el.innerHTML = options.html;
7199
+ if (options?.attrs) {
7200
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7201
+ }
7202
+ return el;
7203
+ };
7204
+ var htmlDivElement = (html, options) => {
7205
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7206
+ if (!d) throw new Error("Document is not available");
7207
+ const el = d.createElement("div");
7208
+ el.innerHTML = html.trim();
7209
+ if (options?.attrs) {
7210
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7211
+ }
7212
+ return el;
7213
+ };
7214
+ var htmlSpanElement = (html, options) => {
7215
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7216
+ if (!d) throw new Error("Document is not available");
7217
+ const el = d.createElement("span");
7218
+ el.innerHTML = html.trim();
7219
+ if (options?.attrs) {
7220
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7221
+ }
7222
+ return el;
7223
+ };
7224
+ var htmlButtonElement = (html, options) => {
7225
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7226
+ if (!d) throw new Error("Document is not available");
7227
+ const el = d.createElement("button");
7228
+ el.innerHTML = html.trim();
7229
+ if (options?.attrs) {
7230
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7231
+ }
7232
+ return el;
7233
+ };
7234
+ var htmlUlElement = (options) => {
7235
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7236
+ if (!d) throw new Error("Document is not available");
7237
+ const el = d.createElement("ul");
7238
+ if (options?.attrs) {
7239
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7240
+ }
7241
+ return el;
7242
+ };
7243
+ var htmlLiElement = (html, options) => {
7244
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7245
+ if (!d) throw new Error("Document is not available");
7246
+ const el = d.createElement("li");
7247
+ el.innerHTML = html.trim();
7248
+ if (options?.attrs) {
7249
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7250
+ }
7251
+ return el;
7252
+ };
7253
+ var htmlAElement = (html, options) => {
7254
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7255
+ if (!d) throw new Error("Document is not available");
7256
+ const el = d.createElement("a");
7257
+ el.innerHTML = html.trim();
7258
+ if (options?.href) el.href = options.href;
7259
+ if (options?.attrs) {
7260
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7261
+ }
7262
+ return el;
7263
+ };
7264
+ var htmlPElement = (html, options) => {
7265
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7266
+ if (!d) throw new Error("Document is not available");
7267
+ const el = d.createElement("p");
7268
+ el.innerHTML = html.trim();
7269
+ if (options?.attrs) {
7270
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7271
+ }
7272
+ return el;
7273
+ };
7274
+ var htmlHeadingElement = (level, html, options) => {
7275
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7276
+ if (!d) throw new Error("Document is not available");
7277
+ const el = d.createElement(`h${level}`);
7278
+ el.innerHTML = html.trim();
7279
+ if (options?.attrs) {
7280
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7281
+ }
7282
+ return el;
7283
+ };
7284
+ var htmlSectionElement = (options) => {
7285
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7286
+ if (!d) throw new Error("Document is not available");
7287
+ const el = d.createElement("section");
7288
+ if (options?.attrs) {
7289
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7290
+ }
7291
+ return el;
7292
+ };
7293
+ var htmlArticleElement = (options) => {
7294
+ const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
7295
+ if (!d) throw new Error("Document is not available");
7296
+ const el = d.createElement("article");
7297
+ if (options?.attrs) {
7298
+ Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
7299
+ }
7300
+ return el;
7301
+ };
6558
7302
  var SwcUtils;
6559
7303
  ((SwcUtils2) => {
6560
7304
  SwcUtils2.getHelperSet = (win) => {
@@ -6617,7 +7361,7 @@ var SwcUtils;
6617
7361
  };
6618
7362
  SwcUtils2.getAppHosts = (el) => {
6619
7363
  const hosts = (0, SwcUtils2.getHosts)(el);
6620
- return hosts.filter((host) => host.tagName.toLowerCase() === "swc-app" || host.getAttribute("is")?.startsWith("swc-app-"));
7364
+ return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
6621
7365
  };
6622
7366
  SwcUtils2.getAppHost = (el) => {
6623
7367
  const appHosts = (0, SwcUtils2.getAppHosts)(el);
@@ -6666,7 +7410,7 @@ var SwcUtils;
6666
7410
  })(SwcUtils || (SwcUtils = {}));
6667
7411
 
6668
7412
  // src/decorators/emitCustomEvent.ts
6669
- var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol("simple-web-component:emit-custom-event");
7413
+ var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
6670
7414
  function emitCustomEvent(selectorOrTarget, type, options = {}) {
6671
7415
  return (targetObj, propertyKey, descriptor) => {
6672
7416
  const constructor = targetObj.constructor;
@@ -6735,7 +7479,10 @@ var getEmitCustomEventMetadataList = (target) => {
6735
7479
  const constructor = target instanceof Function ? target : target.constructor;
6736
7480
  return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
6737
7481
  };
6738
- function emitCustomEventHost(type, options) {
7482
+ function emitCustomEventHost(type, options = {}) {
7483
+ if (!options.attributeName) {
7484
+ options.attributeName = `on-emit-${type}`;
7485
+ }
6739
7486
  return emitCustomEvent(":host", type, options);
6740
7487
  }
6741
7488
 
@@ -6827,7 +7574,46 @@ var SituationTypeContainers = class {
6827
7574
  return this.containers.find(predicate);
6828
7575
  }
6829
7576
  };
6830
- var InjectMetadataKey = Symbol("Inject");
7577
+ var isTargetSymbol = (config) => {
7578
+ return "symbol" in config && config.symbol !== void 0;
7579
+ };
7580
+ var isTargetType = (config) => {
7581
+ return "type" in config && config.type !== void 0;
7582
+ };
7583
+ var isTargetScheme = (config) => {
7584
+ return "scheme" in config && config.scheme !== void 0;
7585
+ };
7586
+ var isTargetFactory = (config) => {
7587
+ return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7588
+ };
7589
+ var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7590
+ var injectProcess = (config, target, propertyKey, parameterIndex) => {
7591
+ if (propertyKey && typeof target === "object") {
7592
+ const otarget = target;
7593
+ target = target.constructor;
7594
+ const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
7595
+ const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
7596
+ saves.push({ index: parameterIndex, config, propertyKey, type });
7597
+ ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
7598
+ } else if (!propertyKey || typeof target === "function") {
7599
+ const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
7600
+ const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
7601
+ existingInjectdParameters.push({ index: parameterIndex, config, type });
7602
+ ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
7603
+ }
7604
+ };
7605
+ function Inject(configOrTarget, propertyKey, parameterIndex) {
7606
+ if (propertyKey && parameterIndex !== void 0) {
7607
+ injectProcess({}, configOrTarget, propertyKey, parameterIndex);
7608
+ } else {
7609
+ return (target, propertyKey2, parameterIndex2) => {
7610
+ injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
7611
+ };
7612
+ }
7613
+ }
7614
+ var getInject = (target, propertyKey) => {
7615
+ return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7616
+ };
6831
7617
 
6832
7618
  // src/types.ts
6833
7619
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -6845,7 +7631,7 @@ var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
6845
7631
  })(InjectSituationType || {});
6846
7632
 
6847
7633
  // src/decorators/elementDefine.ts
6848
- var ELEMENT_CONFIG_KEY = Symbol("simple-web-component:element-config");
7634
+ var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
6849
7635
  var getElementConfig = (target) => {
6850
7636
  const constructor = target instanceof Function ? target : target.constructor;
6851
7637
  return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
@@ -6874,9 +7660,9 @@ var handleGlobalSwcEvent = async (event) => {
6874
7660
  if (!(node instanceof HTMLElement)) continue;
6875
7661
  const script = node.getAttribute?.(attrName);
6876
7662
  if (script && !getElementConfig(node)) {
6877
- const host = SwcUtils.findNearestSwcHost(node);
6878
- if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
6879
- await host.__swc_executeAttributeEvent(node, attrName, script, event);
7663
+ const host2 = SwcUtils.findNearestSwcHost(node);
7664
+ if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
7665
+ await host2.__swc_executeAttributeEvent(node, attrName, script, event);
6880
7666
  event.__swc_handled = true;
6881
7667
  break;
6882
7668
  }
@@ -6960,7 +7746,6 @@ var setupPrototype = (proto) => {
6960
7746
  const oldHandler = handlers.get(attrName);
6961
7747
  if (oldHandler) el.removeEventListener(eventName, oldHandler);
6962
7748
  const handler = async (event) => {
6963
- console.log("execute handler", event);
6964
7749
  const parent = SwcUtils.findNearestSwcHost(el);
6965
7750
  const hostSet = SwcUtils.getHostSet(parent || el);
6966
7751
  const conf = getElementConfig(this);
@@ -6981,7 +7766,6 @@ var setupPrototype = (proto) => {
6981
7766
  };
6982
7767
  proto.__swc_executeAttributeEvent = async function(el, attrName, script, event) {
6983
7768
  ensureInit2(this);
6984
- console.log("execute handler2", event);
6985
7769
  const parent = SwcUtils.findNearestSwcHost(el);
6986
7770
  const hostSet = SwcUtils.getHostSet(parent || el);
6987
7771
  const conf = getElementConfig(this);
@@ -7021,12 +7805,22 @@ var elementDefine = (name, config = {}) => (constructor) => {
7021
7805
  const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
7022
7806
  const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === ":host" || meta.selector === "");
7023
7807
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
7024
- const addHostEventListenerList = addEventListenerList.filter((meta) => meta.selector === ":host" || meta.selector === "");
7025
7808
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
7026
7809
  const attributeList = findAllAttributeMetadata(constructor);
7810
+ const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
7027
7811
  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"];
7028
7812
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7029
- const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...attrChangeMap.keys(), ...Array.from(findAllSetAttributeMetadata(constructor).values()).map((it) => it.name), ...attributeList.map((it) => it.options.name || String(it.propertyKey)), ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
7813
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7814
+ const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
7815
+ const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7816
+ ...metadata.observedAttributes ?? [],
7817
+ ...attrChangeMap.keys(),
7818
+ ...attributeApplyNames,
7819
+ ...attributeListNames,
7820
+ ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7821
+ ...swcLifecycleAttributes,
7822
+ ...swcOnEvents
7823
+ ])];
7030
7824
  const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
7031
7825
  const proto = constructor.prototype;
7032
7826
  setupPrototype(proto);
@@ -7045,7 +7839,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
7045
7839
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7046
7840
  }
7047
7841
  attributeList.forEach((meta) => {
7048
- const attrName = meta.options.name || String(meta.propertyKey);
7049
7842
  if (meta.options.connectedInitialize === true) {
7050
7843
  this.__swc_syncing_init = true;
7051
7844
  try {
@@ -7185,22 +7978,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
7185
7978
  }
7186
7979
  });
7187
7980
  });
7188
- addHostEventListenerList.forEach((meta) => {
7189
- const { type, options } = meta;
7190
- const opts = { capture: options.capture, once: options.once, passive: options.passive };
7191
- const handler = async (event) => {
7192
- if (options.stopPropagation) event.stopPropagation();
7193
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
7194
- if (options.preventDefault) event.preventDefault();
7195
- const currentHostSet = SwcUtils.getHostSet(this);
7196
- const args = { event, ...currentHostSet, $el: this, $root: this.getRootNode() };
7197
- await this[meta.propertyKey](event, currentHostSet, args);
7198
- };
7199
- this.addEventListener(type, handler, opts);
7200
- if (options.removeOnDisconnected === true) {
7201
- this._boundListeners.push({ target: this, type, handler, options: opts });
7202
- }
7203
- });
7204
7981
  if (originalConnected) originalConnected.apply(this);
7205
7982
  const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
7206
7983
  if (aMethods) {
@@ -7239,67 +8016,1226 @@ var elementDefine = (name, config = {}) => (constructor) => {
7239
8016
  if (bMethods) {
7240
8017
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7241
8018
  }
7242
- if (originalAdopted) originalAdopted.apply(this);
7243
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);
7244
- if (aMethods) {
7245
- for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8019
+ if (originalAdopted) originalAdopted.apply(this);
8020
+ const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);
8021
+ if (aMethods) {
8022
+ for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
8023
+ }
8024
+ this._executeSwcScript("swc-on-adopted", hostSet);
8025
+ this._executeSwcScript("swc-on-after-adopted", hostSet);
8026
+ };
8027
+ const originalAttributeChanged = proto.attributeChangedCallback;
8028
+ proto.attributeChangedCallback = function(name2, old, newVal) {
8029
+ if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
8030
+ const hSet = SwcUtils.getHostSet(this);
8031
+ if (name2.startsWith("swc-on-") && !swcLifecycleAttributes.includes(name2)) {
8032
+ if (newVal !== null) {
8033
+ const eventName = name2.substring(7);
8034
+ this._bindAttributeEvent(this, name2, newVal, eventName);
8035
+ }
8036
+ }
8037
+ const hostCustomEventMeta = emitHostCustomEventList.find((it) => it.options.attributeName === name2);
8038
+ if (hostCustomEventMeta && newVal !== null) {
8039
+ this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
8040
+ }
8041
+ const mKeys = attrChangeMap.get(name2);
8042
+ if (mKeys && Array.isArray(mKeys)) {
8043
+ for (const key of mKeys) this[key](newVal, old, name2, hSet);
8044
+ }
8045
+ };
8046
+ Object.defineProperty(constructor, "observedAttributes", {
8047
+ get: () => mergedObservedAttributes,
8048
+ configurable: true
8049
+ });
8050
+ ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);
8051
+ const registry = metadata.customElementRegistry || win?.customElements;
8052
+ if (registry && !registry.get(metadata.name)) {
8053
+ registry.define(metadata.name, constructor, metadata.extends ? { extends: metadata.extends } : void 0);
8054
+ }
8055
+ return constructor;
8056
+ };
8057
+
8058
+ // ../simple-boot/dist/esm/throwable/SimError.js
8059
+ var SimError = class {
8060
+ constructor(message, name, stack) {
8061
+ this.message = message;
8062
+ this.name = name;
8063
+ this.stack = stack;
8064
+ }
8065
+ };
8066
+
8067
+ // ../simple-boot/dist/esm/throwable/SimNoSuch.js
8068
+ var SimNoSuch = class extends SimError {
8069
+ constructor(message, name, stack) {
8070
+ super(message, name, stack);
8071
+ }
8072
+ };
8073
+
8074
+ // ../simple-boot/dist/esm/decorators/SimDecorator.js
8075
+ var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
8076
+ Lifecycle2["Singleton"] = "Singleton";
8077
+ Lifecycle2["Transient"] = "Transient";
8078
+ return Lifecycle2;
8079
+ })(Lifecycle || {});
8080
+ var sims = /* @__PURE__ */ new Map();
8081
+ var containers = /* @__PURE__ */ new Set();
8082
+ var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
8083
+ var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
8084
+ var simProcess = (config, inputTarget) => {
8085
+ const target = (() => {
8086
+ if (typeof inputTarget === "object") {
8087
+ return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
8088
+ }
8089
+ if (ValidUtils.isArrowFunction(inputTarget)) {
8090
+ return () => inputTarget();
8091
+ }
8092
+ return inputTarget;
8093
+ })();
8094
+ let targetType;
8095
+ if (isNotNullObjetInstance(target)) {
8096
+ targetType = target.constructor;
8097
+ } else {
8098
+ targetType = target;
8099
+ }
8100
+ config.scope = config?.scope ?? "Singleton";
8101
+ ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
8102
+ const adding = (targetKey, target2 = targetKey) => {
8103
+ const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
8104
+ items.add(target2);
8105
+ sims.set(targetKey, items);
8106
+ };
8107
+ if (Array.isArray(config?.type)) {
8108
+ config?.type.forEach((it) => {
8109
+ adding(it, target);
8110
+ });
8111
+ } else if (config.type) {
8112
+ adding(config?.type, target);
8113
+ } else {
8114
+ adding(target);
8115
+ }
8116
+ };
8117
+ function Sim(configOrTarget) {
8118
+ if (typeof configOrTarget === "function") {
8119
+ simProcess({}, configOrTarget);
8120
+ } else {
8121
+ return (target) => {
8122
+ simProcess(configOrTarget, target);
8123
+ };
8124
+ }
8125
+ }
8126
+ var getSim = (target) => {
8127
+ if (target != null && target !== void 0 && typeof target === "object") {
8128
+ target = Object.getPrototypeOf(target).constructor;
8129
+ }
8130
+ try {
8131
+ return ReflectUtils.getMetadata(SimMetadataKey, target);
8132
+ } catch (e) {
8133
+ }
8134
+ };
8135
+ var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
8136
+ var getPostConstructs = (target) => {
8137
+ return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
8138
+ };
8139
+
8140
+ // ../simple-boot/dist/esm/simstance/SimAtomic.js
8141
+ var SimAtomic = class {
8142
+ constructor(type, simstanceManager, config) {
8143
+ this.type = type;
8144
+ this.simstanceManager = simstanceManager;
8145
+ this.config = config;
8146
+ this.value = type.value;
8147
+ }
8148
+ getConfig(key = SimMetadataKey) {
8149
+ return ReflectUtils.getMetadata(key, this.type.originalType);
8150
+ }
8151
+ getConfigs() {
8152
+ return ReflectUtils.getMetadatas(this.type.originalType);
8153
+ }
8154
+ getValue(config) {
8155
+ if (config?.refresh) {
8156
+ this.value = void 0;
8157
+ }
8158
+ if (!this.value) {
8159
+ if (typeof this.type.targetKeyType === "symbol") {
8160
+ this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
8161
+ } else {
8162
+ this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
8163
+ }
8164
+ }
8165
+ return this.value;
8166
+ }
8167
+ };
8168
+
8169
+ // ../simple-boot/dist/esm/SimOption.js
8170
+ var SimOption = class {
8171
+ constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
8172
+ this.rootRouter = rootRouter;
8173
+ this.container = container;
8174
+ this.advice = advice;
8175
+ this.excludeProxys = excludeProxys;
8176
+ this.proxy = proxy;
8177
+ this.using = using;
8178
+ this.cache = cache;
8179
+ }
8180
+ addAdvicce(advice) {
8181
+ this.advice ?? (this.advice = []);
8182
+ this.advice.push(advice);
8183
+ }
8184
+ setAdvice(...advice) {
8185
+ this.advice = advice;
8186
+ return this;
8187
+ }
8188
+ };
8189
+
8190
+ // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
8191
+ var MetaDataAtomic = class {
8192
+ constructor(target, metaData) {
8193
+ this.target = target;
8194
+ this.metaData = metaData;
8195
+ }
8196
+ };
8197
+ var MetaDataPropertyAtomic = class extends MetaDataAtomic {
8198
+ constructor(target, metaData, property, parameter) {
8199
+ super(target, metaData);
8200
+ this.property = property;
8201
+ this.parameter = parameter;
8202
+ }
8203
+ call(...parameter) {
8204
+ return this.target[this.property](...parameter);
8205
+ }
8206
+ };
8207
+
8208
+ // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8209
+ var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
8210
+ var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
8211
+ var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
8212
+ var getAfter = (target, propertyKey) => {
8213
+ return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
8214
+ };
8215
+ var getAfters = (target) => {
8216
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8217
+ };
8218
+ var getProtoAfters = (target, propertyKey, type) => {
8219
+ return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8220
+ };
8221
+ var getBefore = (target, propertyKey) => {
8222
+ return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
8223
+ };
8224
+ var getBefores = (target) => {
8225
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8226
+ };
8227
+ var getProtoBefores = (target, propertyKey, type) => {
8228
+ return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8229
+ };
8230
+
8231
+ // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
8232
+ var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
8233
+ ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
8234
+ ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
8235
+ return ExceptionHandlerSituationType2;
8236
+ })(ExceptionHandlerSituationType || {});
8237
+ var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
8238
+ var getExceptionHandlers = (target) => {
8239
+ if (target !== null && void 0 !== target && typeof target === "object") {
8240
+ target = target.constructor;
8241
+ }
8242
+ return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
8243
+ };
8244
+ var targetExceptionHandlers = (target, error) => {
8245
+ const exceptionHandlers = getExceptionHandlers(target);
8246
+ const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
8247
+ const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
8248
+ const targetSorts = targets?.sort((a, b) => {
8249
+ const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
8250
+ const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
8251
+ return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
8252
+ });
8253
+ return (targetSorts ?? []).concat(...emptyTargets ?? []);
8254
+ };
8255
+ var targetExceptionHandler = (target, error, excludeMethods = []) => {
8256
+ let exceptionHandlers = targetExceptionHandlers(target, error);
8257
+ exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
8258
+ if (exceptionHandlers && exceptionHandlers.length > 0) {
8259
+ return exceptionHandlers[0];
8260
+ } else {
8261
+ return void 0;
8262
+ }
8263
+ };
8264
+
8265
+ // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
8266
+ var SimProxyHandler = class {
8267
+ constructor(simpleApplication, simstanceManager, simOption) {
8268
+ this.simpleApplication = simpleApplication;
8269
+ this.simstanceManager = simstanceManager;
8270
+ this.simOption = simOption;
8271
+ }
8272
+ // 잘받게 해놨네 ㅋㅋ simstanceManager
8273
+ get(target, name) {
8274
+ if (name === "_SimpleBoot_application") {
8275
+ return this.simpleApplication;
8276
+ } else if (name === "_SimpleBoot_simstanceManager") {
8277
+ return this.simstanceManager;
8278
+ } else if (name === "_SimpleBoot_simOption") {
8279
+ return this.simOption;
8280
+ } else if (name === "_SimpleBoot_origin") {
8281
+ return target;
8282
+ } else {
8283
+ return target[name];
8284
+ }
8285
+ }
8286
+ set(obj, prop, value, receiver) {
8287
+ value = this.simstanceManager?.proxy(value);
8288
+ obj[prop] = value;
8289
+ return true;
8290
+ }
8291
+ apply(target, thisArg, argumentsList) {
8292
+ let r;
8293
+ try {
8294
+ this.aopBefore(thisArg, target);
8295
+ try {
8296
+ r = Reflect.apply(target, thisArg, argumentsList);
8297
+ } catch (e) {
8298
+ throw e;
8299
+ } finally {
8300
+ this.aopAfter(thisArg, target);
8301
+ }
8302
+ } catch (e) {
8303
+ console.error(e);
8304
+ const inHandlers = this.getExceptionHandler(e, thisArg, target);
8305
+ if (inHandlers.length > 0 && inHandlers[0]) {
8306
+ const inHandler = inHandlers[0];
8307
+ this.executeExceptionHandler(e, inHandler, argumentsList);
8308
+ } else {
8309
+ throw e;
8310
+ }
8311
+ }
8312
+ return r;
8313
+ }
8314
+ executeExceptionHandler(e, inHandler, argumentsList) {
8315
+ const otherStorage = /* @__PURE__ */ new Map();
8316
+ otherStorage.set(e.constructor, e);
8317
+ const situationErrorTypeContainer = new SituationTypeContainer({
8318
+ situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
8319
+ data: e
8320
+ });
8321
+ const situationParameterTypeContainer = new SituationTypeContainer({
8322
+ situationType: ExceptionHandlerSituationType.PARAMETER,
8323
+ data: argumentsList
8324
+ });
8325
+ otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
8326
+ argumentsList?.forEach((it) => {
8327
+ otherStorage.set(it.constructor, it);
8328
+ });
8329
+ try {
8330
+ this.simstanceManager.executeBindParameterSim(
8331
+ {
8332
+ target: inHandler.thisArg,
8333
+ targetKey: inHandler.config.propertyKey
8334
+ },
8335
+ otherStorage
8336
+ );
8337
+ } catch (es) {
8338
+ e = es;
8339
+ }
8340
+ if (inHandler.config.config.throw) {
8341
+ const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
8342
+ if ((exceptionHandler?.length ?? 0) > 0) {
8343
+ this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
8344
+ }
8345
+ }
8346
+ }
8347
+ getExceptionHandler(e, thisArg, target) {
8348
+ const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
8349
+ return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
8350
+ }) ?? [];
8351
+ const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
8352
+ const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
8353
+ return inHandlers;
8354
+ }
8355
+ aopBefore(obj, protoType) {
8356
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
8357
+ if (propertyName && obj) {
8358
+ getProtoBefores(obj, propertyName).forEach((it) => {
8359
+ it.call(obj, protoType, propertyName);
8360
+ });
8361
+ for (let i = 0; i < this.simOption.advice.length; i++) {
8362
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8363
+ const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
8364
+ protoBefores.forEach((it) => {
8365
+ it.call(obj, protoType, propertyName);
8366
+ });
8367
+ }
8368
+ }
8369
+ }
8370
+ aopAfter(obj, protoType) {
8371
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
8372
+ if (propertyName) {
8373
+ getProtoAfters(obj, propertyName).forEach((it) => {
8374
+ it.call(obj, protoType, propertyName);
8375
+ });
8376
+ for (let i = 0; i < this.simOption.advice.length; i++) {
8377
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8378
+ const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
8379
+ protoBefores.forEach((it) => {
8380
+ it.call(obj, protoType, propertyName);
8381
+ });
8382
+ }
8383
+ }
8384
+ }
8385
+ has(target, key) {
8386
+ if (key === "_SimpleBoot_isProxy") {
8387
+ return true;
8388
+ }
8389
+ return key in target;
8390
+ }
8391
+ };
8392
+
8393
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
8394
+ var isOnSimCreate = (obj) => {
8395
+ return typeof obj?.onSimCreate === "function";
8396
+ };
8397
+
8398
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
8399
+ var isOnSimCreateProxyCompleted = (obj) => {
8400
+ return typeof obj?.onSimCreateProxyCompleted === "function";
8401
+ };
8402
+
8403
+ // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8404
+ var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
8405
+ var getSimNoProxy = (target, propertyKey) => {
8406
+ try {
8407
+ if (propertyKey === void 0) {
8408
+ return Reflect.getMetadata(SimNoProxyKey, target);
8409
+ }
8410
+ return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
8411
+ } catch (e) {
8412
+ return void 0;
8413
+ }
8414
+ };
8415
+ var isSimNoProxy = (target, propertyKey) => {
8416
+ if (target === null || target === void 0) {
8417
+ return false;
8418
+ }
8419
+ return getSimNoProxy(target, propertyKey) === true;
8420
+ };
8421
+
8422
+ // ../simple-boot/dist/esm/simstance/SimstanceManager.js
8423
+ var SimstanceManager = class _SimstanceManager {
8424
+ // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
8425
+ constructor(simpleApplication, option) {
8426
+ this.simpleApplication = simpleApplication;
8427
+ this.option = option;
8428
+ this._storage = /* @__PURE__ */ new Map();
8429
+ this.name = "simstanceManager-" + RandomUtils.uuid4();
8430
+ this.setStoreSet(SimpleApplication, this.simpleApplication);
8431
+ this.setStoreSet(_SimstanceManager, this);
8432
+ this.setStoreSet(option.constructor, option);
8433
+ this.setStoreSet(SimOption, option);
8434
+ this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
8435
+ }
8436
+ get storage() {
8437
+ return this._storage;
8438
+ }
8439
+ getSimAtomics() {
8440
+ const r = [];
8441
+ Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
8442
+ r.push(
8443
+ ...Array.from(Array.from(targetMap.keys())).map(
8444
+ (sit) => new SimAtomic(
8445
+ {
8446
+ targetKeyType,
8447
+ originalType: sit
8448
+ },
8449
+ this
8450
+ )
8451
+ )
8452
+ );
8453
+ });
8454
+ return r;
8455
+ }
8456
+ getSimConfig(schemeOrSymbol) {
8457
+ const newVar = this.getSimAtomics().filter((it) => {
8458
+ const config = it?.getConfig();
8459
+ const symbols = ConvertUtils.flatArray(config?.symbol);
8460
+ const schemes = ConvertUtils.flatArray(config?.scheme);
8461
+ if (typeof schemeOrSymbol === "symbol") {
8462
+ return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
8463
+ } else if (typeof schemeOrSymbol === "string") {
8464
+ return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
8465
+ } else {
8466
+ return false;
8467
+ }
8468
+ }) || [];
8469
+ return newVar;
8470
+ }
8471
+ findSims(data) {
8472
+ let r = [];
8473
+ if (data) {
8474
+ const simAtomics = this.getSimAtomics();
8475
+ r = simAtomics.filter((it) => {
8476
+ let b = false;
8477
+ const config = it.getConfig();
8478
+ const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
8479
+ const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
8480
+ if (typeof data === "symbol") {
8481
+ b = symbols.includes(data);
8482
+ } else {
8483
+ const { scheme, type } = data;
8484
+ b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
8485
+ }
8486
+ return b;
8487
+ });
8488
+ }
8489
+ return r;
8490
+ }
8491
+ findFirstSim(data) {
8492
+ if (typeof data === "symbol") {
8493
+ return this.findSims(data)[0];
8494
+ } else {
8495
+ return this.findSims(data)[0];
8496
+ }
8497
+ }
8498
+ findLastSim(data) {
8499
+ if (typeof data === "symbol") {
8500
+ return this.findSims(data).reverse()[0];
8501
+ } else {
8502
+ return this.findSims(data).reverse()[0];
8503
+ }
8504
+ }
8505
+ flatStoreSets() {
8506
+ return new Map(
8507
+ Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
8508
+ );
8509
+ }
8510
+ getStoreSets(targetKey) {
8511
+ const map = this.storage.get(targetKey);
8512
+ const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
8513
+ return datas.map((it) => ({ type: it[0], instance: it[1] }));
8514
+ }
8515
+ getStoreSet(targetKey, target) {
8516
+ const sets = this.getStoreSets(targetKey);
8517
+ let find = sets.find((it) => it.type === target);
8518
+ if (!find && (!target || target === targetKey)) {
8519
+ find = sets.find((it) => it.instance);
8520
+ }
8521
+ if (!find?.instance) {
8522
+ const type = target ?? targetKey;
8523
+ if (typeof type === "object") {
8524
+ const find2 = this.storage.get(type);
8525
+ if (find2) {
8526
+ return { type, instance: type };
8527
+ }
8528
+ }
8529
+ const flatStoreSets = this.flatStoreSets();
8530
+ const data = flatStoreSets.get(type);
8531
+ if (data) {
8532
+ this.setStoreSet(targetKey, data, type);
8533
+ }
8534
+ return { type, instance: data };
8535
+ } else {
8536
+ return find;
8537
+ }
8538
+ }
8539
+ getStoreInstance(targetKey, target) {
8540
+ return this.getStoreSet(targetKey, target)?.instance;
8541
+ }
8542
+ getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
8543
+ if (target) {
8544
+ const registed = this.getStoreSet(target, originTypeTarget);
8545
+ if (registed?.type && !registed?.instance) {
8546
+ return this.resolve({
8547
+ targetKey: target,
8548
+ target: originTypeTarget,
8549
+ newInstanceCarrier
8550
+ });
8551
+ }
8552
+ return registed?.instance;
8553
+ }
8554
+ }
8555
+ setStoreSet(targetKey, obj, target = targetKey) {
8556
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8557
+ itemMap.set(target, obj);
8558
+ this.storage.set(targetKey, itemMap);
8559
+ }
8560
+ registerStore(targetKey, regTyps) {
8561
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8562
+ regTyps.forEach((it) => {
8563
+ const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
8564
+ if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
8565
+ itemMap.set(type, value);
8566
+ }
8567
+ });
8568
+ this.storage.set(targetKey, itemMap);
8569
+ }
8570
+ // 진입점
8571
+ resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
8572
+ const registed = this.getStoreSet(targetKey, target);
8573
+ if (registed?.instance) {
8574
+ return registed.instance;
8575
+ }
8576
+ if (this.storage.has(targetKey) && void 0 === registed?.instance) {
8577
+ newInstanceCarrier.depth++;
8578
+ const newSim = this.newSim({
8579
+ target: registed?.type ?? targetKey,
8580
+ newInstanceCarrier,
8581
+ simCreateAfter: (data) => {
8582
+ if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
8583
+ this.setStoreSet(targetKey, data, target);
8584
+ }
8585
+ }
8586
+ });
8587
+ newInstanceCarrier.depth--;
8588
+ if (newInstanceCarrier.depth === 0) {
8589
+ newInstanceCarrier.newInstances.forEach((it) => {
8590
+ this.callBindPostConstruct(it);
8591
+ });
8592
+ }
8593
+ if (isOnSimCreate(newSim)) {
8594
+ newSim.onSimCreate();
8595
+ }
8596
+ return newSim;
8597
+ }
8598
+ const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
8599
+ console.error(simNoSuch);
8600
+ throw simNoSuch;
8601
+ }
8602
+ newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
8603
+ const parameters = this.getParameterSim({
8604
+ target,
8605
+ otherStorage,
8606
+ newInstanceCarrier
8607
+ });
8608
+ const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
8609
+ let p = this.proxy(r);
8610
+ const config = getSim(target);
8611
+ if (config?.proxy) {
8612
+ const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
8613
+ proxys.forEach((it) => {
8614
+ if (typeof it === "object") {
8615
+ p = new Proxy(p, it);
8616
+ } else {
8617
+ const simConfig = getSim(it);
8618
+ p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
8619
+ }
8620
+ });
8621
+ }
8622
+ newInstanceCarrier?.newInstances.push(p);
8623
+ simCreateAfter?.(p);
8624
+ if (isOnSimCreateProxyCompleted(p)) {
8625
+ p.onSimCreateProxyCompleted(p);
8626
+ }
8627
+ return p;
8628
+ }
8629
+ callBindPostConstruct(obj) {
8630
+ const postConstruct = getPostConstructs(obj);
8631
+ postConstruct.forEach((it) => {
8632
+ obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
8633
+ });
8634
+ }
8635
+ async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8636
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8637
+ if (typeof target === "object" && targetKey) {
8638
+ const targetMethod = target[targetKey];
8639
+ return targetMethod?.bind(target)?.(...binds);
8640
+ } else if (typeof target === "function" && !targetKey) {
8641
+ return new target(...binds);
8642
+ }
8643
+ }
8644
+ executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8645
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8646
+ if (typeof target === "object" && targetKey) {
8647
+ const targetMethod = target[targetKey];
8648
+ return targetMethod?.bind(target)?.(...binds);
8649
+ } else if (typeof target === "function" && !targetKey) {
8650
+ return new target(...binds);
8651
+ }
8652
+ }
8653
+ getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
8654
+ const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
8655
+ let injections = [];
8656
+ const injects = getInject(target, targetKey);
8657
+ const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
8658
+ const loopArray = new Array(loopCount).fill(void 0);
8659
+ injections = loopArray.map((_, idx) => {
8660
+ const token = paramTypes[idx];
8661
+ const saveInject = injects?.find((it) => it.index === idx);
8662
+ for (const f of firstCheckMaker ?? []) {
8663
+ const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
8664
+ if (void 0 !== firstCheckObj) {
8665
+ return firstCheckObj;
8666
+ }
8667
+ }
8668
+ if (saveInject) {
8669
+ const inject = saveInject.config;
8670
+ let obj = otherStorage?.get(token);
8671
+ if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
8672
+ const p = [];
8673
+ if (isTargetType(inject) && inject.type) {
8674
+ p.push(
8675
+ ...this.getStoreSets(inject.type).map(
8676
+ (it) => this.resolve({
8677
+ targetKey: inject.type,
8678
+ target: it.type,
8679
+ newInstanceCarrier
8680
+ })
8681
+ ).reverse()
8682
+ );
8683
+ }
8684
+ if (isTargetSymbol(inject)) {
8685
+ p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
8686
+ }
8687
+ if (isTargetScheme(inject)) {
8688
+ p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
8689
+ }
8690
+ return p;
8691
+ }
8692
+ if (inject.situationType && otherStorage) {
8693
+ const situations = otherStorage.get(SituationTypeContainers);
8694
+ const situation = otherStorage.get(SituationTypeContainer);
8695
+ if (inject.situationType === situation?.situationType) {
8696
+ obj = situation.data;
8697
+ } else if (situations && situations.length > 0) {
8698
+ const find = situations.find((a) => {
8699
+ if (a.index !== void 0) {
8700
+ return a.situationType === inject.situationType && a.index === idx;
8701
+ } else {
8702
+ return a.situationType === inject.situationType;
8703
+ }
8704
+ });
8705
+ if (find) {
8706
+ obj = find.data;
8707
+ }
8708
+ }
8709
+ }
8710
+ if (!obj) {
8711
+ const currentInstance = typeof target === "object" ? target : void 0;
8712
+ if (isTargetFactory(inject)) {
8713
+ obj = inject.factory({
8714
+ instance: currentInstance,
8715
+ methodName: String(targetKey),
8716
+ parameter: inputParameters,
8717
+ application: this.simpleApplication
8718
+ });
8719
+ } else {
8720
+ let findLastSim;
8721
+ if (isTargetSymbol(inject)) {
8722
+ findLastSim = this.findLastSim(inject.symbol);
8723
+ } else if (isTargetType(inject) || isTargetScheme(inject)) {
8724
+ findLastSim = this.findLastSim(inject);
8725
+ }
8726
+ try {
8727
+ obj = findLastSim ? this.resolve({
8728
+ targetKey: findLastSim?.type.targetKeyType ?? token,
8729
+ newInstanceCarrier
8730
+ }) : this.resolve({
8731
+ targetKey: token,
8732
+ newInstanceCarrier
8733
+ });
8734
+ if (inject.factory && obj) {
8735
+ if (typeof inject.factory === "function") {
8736
+ obj = inject.factory({
8737
+ instance: currentInstance,
8738
+ methodName: String(targetKey),
8739
+ parameter: inputParameters,
8740
+ application: this.simpleApplication,
8741
+ injectInstance: obj
8742
+ });
8743
+ }
8744
+ }
8745
+ } catch (e) {
8746
+ if (inject.optional) {
8747
+ return void 0;
8748
+ } else {
8749
+ throw e;
8750
+ }
8751
+ }
8752
+ }
8753
+ }
8754
+ if (inject.proxy && obj) {
8755
+ if (ValidUtils.isConstructor(inject.proxy)) {
8756
+ const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
8757
+ if (handler) {
8758
+ obj = new Proxy(obj, handler);
8759
+ }
8760
+ } else if (typeof inject.proxy === "function") {
8761
+ const handler = inject.proxy({
8762
+ application: this.simpleApplication,
8763
+ instance: obj
8764
+ });
8765
+ if (handler) {
8766
+ obj = new Proxy(obj, handler);
8767
+ }
8768
+ }
8769
+ }
8770
+ return obj;
8771
+ } else {
8772
+ return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
8773
+ }
8774
+ });
8775
+ return injections;
8776
+ }
8777
+ proxy(target) {
8778
+ try {
8779
+ const noProxy = isSimNoProxy(target);
8780
+ const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
8781
+ if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
8782
+ for (const key in target) {
8783
+ if (!isSimNoProxy(target, key)) {
8784
+ target[key] = this.proxy(target[key]);
8785
+ }
8786
+ }
8787
+ const protoTypeName = ObjectUtils.ownPropertyNames(target);
8788
+ protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
8789
+ target[it] = new Proxy(target[it], this.simProxyHandler);
8790
+ });
8791
+ if (this.simProxyHandler) {
8792
+ target = new Proxy(target, this.simProxyHandler);
8793
+ }
8794
+ }
8795
+ if (this.option.proxy) {
8796
+ target = this.option.proxy.onAfterProxy(target);
8797
+ }
8798
+ return target;
8799
+ } catch (e) {
8800
+ console.log("sim proxy error");
8801
+ throw e;
8802
+ }
8803
+ }
8804
+ run(otherInstanceSim = /* @__PURE__ */ new Map()) {
8805
+ for (const [k, v] of Array.from(otherInstanceSim.entries())) {
8806
+ const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
8807
+ this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
8808
+ if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
8809
+ this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
8810
+ }
8811
+ }
8812
+ const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
8813
+ if (!myContainers.includes(this.simpleApplication)) {
8814
+ myContainers.push(this.simpleApplication);
8815
+ }
8816
+ Array.from(sims.entries()).forEach(([type, implementations]) => {
8817
+ const filteredSet = /* @__PURE__ */ new Set();
8818
+ implementations.forEach((impl) => {
8819
+ const config = getSim(impl);
8820
+ const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
8821
+ let isInclude = false;
8822
+ if (targetContainers.length <= 0) {
8823
+ isInclude = true;
8824
+ } else {
8825
+ isInclude = myContainers.some((it) => targetContainers.includes(it));
8826
+ }
8827
+ if (isInclude) {
8828
+ filteredSet.add(impl);
8829
+ }
8830
+ });
8831
+ if (filteredSet.size > 0) {
8832
+ this.registerStore(type, filteredSet);
8833
+ }
8834
+ });
8835
+ this.callBindPostConstruct(this);
8836
+ this.getSimAtomics().forEach((it) => {
8837
+ if (it.getConfig()?.autoCreate) {
8838
+ it.getValue();
8839
+ }
8840
+ });
8841
+ }
8842
+ };
8843
+
8844
+ // ../simple-boot/dist/esm/intent/Intent.js
8845
+ var Intent = class {
8846
+ constructor(uri, data, event) {
8847
+ this.uri = uri;
8848
+ this.data = data;
8849
+ this.event = event;
8850
+ this.sessionData = /* @__PURE__ */ new Map();
8851
+ if (typeof uri === "string") {
8852
+ const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
8853
+ if (match) {
8854
+ const symbol = Symbol.for(match[1]);
8855
+ this.uri = {
8856
+ symbol,
8857
+ uri: match[2]
8858
+ };
8859
+ }
8860
+ }
8861
+ }
8862
+ get symbols() {
8863
+ if (typeof this.uri === "object") {
8864
+ return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
8865
+ }
8866
+ return void 0;
8867
+ }
8868
+ get scheme() {
8869
+ if (typeof this.uri === "string") {
8870
+ const parts = this.uri.split("://");
8871
+ if (parts.length > 1) {
8872
+ return parts[0];
8873
+ }
8874
+ return void 0;
8875
+ } else {
8876
+ return void 0;
8877
+ }
8878
+ }
8879
+ get paths() {
8880
+ return this.pathname.split("/") ?? [];
8881
+ }
8882
+ get fullPath() {
8883
+ const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
8884
+ const paths = uri.split("://");
8885
+ return paths[paths.length >= 2 ? 1 : 0] ?? "";
8886
+ }
8887
+ get pathname() {
8888
+ const paths = this.fullPath.split("?");
8889
+ return paths[0];
8890
+ }
8891
+ get query() {
8892
+ const paths = this.fullPath.split("?");
8893
+ return paths[1] ?? "";
8894
+ }
8895
+ getQueryParamDecodeURI(key) {
8896
+ const p = this.queryParamsDecodeURI;
8897
+ if (key) {
8898
+ return p[key];
8899
+ } else {
8900
+ return p;
8901
+ }
8902
+ }
8903
+ getQueryParamDecodeURIFirst(key) {
8904
+ const param = this.getQueryParamDecodeURI(key);
8905
+ if (Array.isArray(param)) {
8906
+ return param[0];
8907
+ } else {
8908
+ return param;
8909
+ }
8910
+ }
8911
+ getQueryParam(key) {
8912
+ const p = this.queryParams;
8913
+ if (key) {
8914
+ return p[key];
8915
+ } else {
8916
+ return p;
8917
+ }
8918
+ }
8919
+ getQueryParamFirst(key) {
8920
+ const param = this.getQueryParam(key);
8921
+ if (Array.isArray(param)) {
8922
+ return param[0];
8923
+ } else {
8924
+ return param;
8925
+ }
8926
+ }
8927
+ get queryParams() {
8928
+ const param = {};
8929
+ this.query.split("&")?.forEach((it) => {
8930
+ const a = it.split("=");
8931
+ if (param[a[0]]) {
8932
+ if (Array.isArray(param[a[0]])) {
8933
+ param[a[0]].push(a[1]);
8934
+ } else {
8935
+ param[a[0]] = [param[a[0]], a[1]];
8936
+ }
8937
+ } else {
8938
+ param[a[0]] = a[1];
8939
+ }
8940
+ });
8941
+ return param;
8942
+ }
8943
+ get queryParamsDecodeURI() {
8944
+ const params = this.queryParams;
8945
+ for (const key in params) {
8946
+ if (params.hasOwnProperty(key)) {
8947
+ const param = params[key];
8948
+ if (Array.isArray(param)) {
8949
+ params[key] = param.map((p) => decodeURIComponent(p));
8950
+ } else {
8951
+ params[key] = decodeURIComponent(param);
8952
+ }
8953
+ }
8954
+ }
8955
+ return params;
8956
+ }
8957
+ getPathnameData(urlExpression) {
8958
+ return Expression.Path.pathNameData(this.pathname, urlExpression);
8959
+ }
8960
+ get isSymbolScheme() {
8961
+ return this.symbols !== void 0;
8962
+ }
8963
+ };
8964
+
8965
+ // ../simple-boot/dist/esm/intent/IntentSubscribe.js
8966
+ var isIntentSubscribe = (obj) => {
8967
+ return !!obj && typeof obj.intentSubscribe === "function";
8968
+ };
8969
+
8970
+ // ../simple-boot/dist/esm/intent/IntentManager.js
8971
+ var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
8972
+ var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
8973
+ var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
8974
+ var IntentManager = class {
8975
+ constructor(simpleApplication, simstanceManager, routerManager, simOption) {
8976
+ this.simpleApplication = simpleApplication;
8977
+ this.simstanceManager = simstanceManager;
8978
+ this.routerManager = routerManager;
8979
+ this.simOption = simOption;
8980
+ this.subject = new Subject();
8981
+ }
8982
+ get observable() {
8983
+ return this.subject.asObservable();
8984
+ }
8985
+ async makeIntentData(it, data) {
8986
+ const target = [];
8987
+ const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
8988
+ if (isRouterPublishType(it)) {
8989
+ it = it.router;
8990
+ }
8991
+ const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
8992
+ if (routerMatch && typeof it === "string") {
8993
+ const routerBasePath = routerMatch[1];
8994
+ const actualPath = routerMatch[2];
8995
+ const routerModule = await this.routerManager.routing(routerBasePath, {
8996
+ router: rootRouter
8997
+ });
8998
+ const instance = routerModule.getModuleInstance();
8999
+ if (instance) {
9000
+ target.push(instance);
9001
+ }
9002
+ it = new Intent(actualPath, data);
9003
+ } else if (isSymbolPublishType(it)) {
9004
+ it = new Intent({ symbol: it.symbol, uri: it.path }, data);
9005
+ } else if (isSchemePublishType(it)) {
9006
+ it = new Intent(`${it.scheme}://${it.path}`, data);
9007
+ } else if (typeof it === "string") {
9008
+ it = new Intent(it, data);
9009
+ }
9010
+ const intent = it;
9011
+ if (!routerMatch) {
9012
+ if (intent.symbols) {
9013
+ target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
9014
+ } else if (intent.scheme) {
9015
+ target.push(...this.simstanceManager.getSimConfig(intent.scheme));
9016
+ } else {
9017
+ target.push(...this.simstanceManager.getSimAtomics());
9018
+ }
9019
+ }
9020
+ return { intent, target };
9021
+ }
9022
+ async publishMeta(it, data) {
9023
+ const { intent, target } = await this.makeIntentData(it, data);
9024
+ const r = [];
9025
+ const targetInstances = target.map((it2) => {
9026
+ if (it2 instanceof SimAtomic) {
9027
+ return it2.getValue();
9028
+ } else {
9029
+ return it2;
9030
+ }
9031
+ });
9032
+ this.subject.next(intent);
9033
+ for (let data2 of targetInstances) {
9034
+ let orNewSim = data2;
9035
+ if (orNewSim) {
9036
+ const filteredPaths = intent.paths.filter((i) => i);
9037
+ if (filteredPaths.length > 0) {
9038
+ let callthis = orNewSim;
9039
+ let lastProp = "";
9040
+ filteredPaths.forEach((i) => {
9041
+ callthis = orNewSim;
9042
+ orNewSim = orNewSim?.[i];
9043
+ lastProp = i;
9044
+ });
9045
+ if (orNewSim && typeof orNewSim === "function") {
9046
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9047
+ const result = await this.simstanceManager.executeBindParameterSimPromise({
9048
+ target: callthis,
9049
+ targetKey: lastProp,
9050
+ parameterCount: intentData.length,
9051
+ inputParameters: intentData,
9052
+ firstCheckMaker: [
9053
+ (obj, token, idx) => {
9054
+ if (idx < intentData.length) {
9055
+ return intentData[idx];
9056
+ }
9057
+ if (token === Intent && idx === 0) {
9058
+ return intent;
9059
+ }
9060
+ }
9061
+ ]
9062
+ });
9063
+ r.push(result);
9064
+ } else if (orNewSim) {
9065
+ callthis[lastProp] = intent.data;
9066
+ r.push(callthis[lastProp]);
9067
+ }
9068
+ } else {
9069
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9070
+ if (isIntentSubscribe(orNewSim)) {
9071
+ r.push(orNewSim.intentSubscribe(...intentData));
9072
+ }
9073
+ }
9074
+ }
9075
+ }
9076
+ return { return: r, target };
9077
+ }
9078
+ async publish(it, data) {
9079
+ const rdata = await this.publishMeta(it, data);
9080
+ return rdata.return;
9081
+ }
9082
+ };
9083
+
9084
+ // ../simple-boot/dist/esm/decorators/inject/Injection.js
9085
+ var InjectionMetadataKey = Symbol("Injection");
9086
+ var getInjection = (target, propertyKey) => {
9087
+ return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
9088
+ };
9089
+
9090
+ // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
9091
+ var MethodNoSuch = class extends SimError {
9092
+ constructor(message, name, propertyKeys, stack) {
9093
+ super(message, name, stack);
9094
+ this.propertyKeys = propertyKeys;
9095
+ }
9096
+ };
9097
+
9098
+ // ../simple-boot/dist/esm/decorators/route/Router.js
9099
+ var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
9100
+ var getRouter = (target) => {
9101
+ if (target != null && typeof target === "object") {
9102
+ target = target.constructor;
9103
+ }
9104
+ try {
9105
+ return ReflectUtils.getMetadata(RouterMetadataKey, target);
9106
+ } catch (e) {
9107
+ }
9108
+ };
9109
+ var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9110
+
9111
+ // ../simple-boot/dist/esm/route/RouterModule.js
9112
+ var RouterModule = class {
9113
+ constructor(simstanceManager, router, module, routerChains = []) {
9114
+ this.simstanceManager = simstanceManager;
9115
+ this.router = router;
9116
+ this.module = module;
9117
+ this.routerChains = routerChains;
9118
+ }
9119
+ get path() {
9120
+ return this._path;
9121
+ }
9122
+ set path(value) {
9123
+ this._path = value;
9124
+ }
9125
+ get data() {
9126
+ return this._data;
9127
+ }
9128
+ set data(value) {
9129
+ this._data = value;
9130
+ }
9131
+ get intent() {
9132
+ return this._intent;
9133
+ }
9134
+ set intent(value) {
9135
+ this._intent = value;
9136
+ }
9137
+ get propertyKeys() {
9138
+ return this._propertyKeys;
9139
+ }
9140
+ set propertyKeys(value) {
9141
+ this._propertyKeys = value;
9142
+ }
9143
+ get pathData() {
9144
+ return this._pathData;
9145
+ }
9146
+ getPathData() {
9147
+ return this._pathData;
9148
+ }
9149
+ set pathData(value) {
9150
+ this._pathData = value;
9151
+ }
9152
+ getRouterPath(join = "") {
9153
+ return this.getRouterPaths().map((it) => it ?? "").join(join);
9154
+ }
9155
+ getRouterPaths() {
9156
+ return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
9157
+ }
9158
+ getRouterPathData(pathName) {
9159
+ return Expression.Path.pathNameData(pathName, this.getRouterPath());
9160
+ }
9161
+ getModuleInstance(propertyKey, instanceBind = true) {
9162
+ const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
9163
+ if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
9164
+ let instanceElement = instance[propertyKey];
9165
+ if (instanceBind && typeof instanceBind === "boolean") {
9166
+ instanceElement = instanceElement.bind(instance);
9167
+ } else if (instanceBind && typeof instanceBind === "object") {
9168
+ instanceElement = instanceElement.bind(instanceBind);
9169
+ }
9170
+ return instanceElement;
9171
+ } else {
9172
+ return instance;
9173
+ }
9174
+ }
9175
+ executeModuleProperty(propertyKey, ...param) {
9176
+ const target = this.getModuleInstance();
9177
+ if (propertyKey) {
9178
+ const config = getInjection(target, propertyKey);
9179
+ if (config) {
9180
+ const other = /* @__PURE__ */ new Map();
9181
+ param.forEach((it) => other.set(it.constructor, it));
9182
+ return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
9183
+ } else {
9184
+ if (target[propertyKey]) {
9185
+ return target[propertyKey]?.(...param);
9186
+ } else {
9187
+ throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
9188
+ }
9189
+ }
9190
+ }
9191
+ }
9192
+ get firstRouteChain() {
9193
+ return this.routerChains[0];
9194
+ }
9195
+ get firstRouteChainValue() {
9196
+ return this.firstRouteChain?.getValue();
9197
+ }
9198
+ get lastRouteChain() {
9199
+ return this.routerChains[this.routerChains.length - 1];
9200
+ }
9201
+ get lastRouteChainValue() {
9202
+ return this.lastRouteChain?.getValue();
9203
+ }
9204
+ hasActivateInLastRoute(obj) {
9205
+ return this.lastRouteChainValue?.hasActivate(obj) === true;
9206
+ }
9207
+ getQueryParamDecodeURI(key) {
9208
+ if (this.intent) {
9209
+ return this.intent.getQueryParamDecodeURI(key);
9210
+ }
9211
+ }
9212
+ getQueryParamDecodeURIFirst(key) {
9213
+ if (this.intent) {
9214
+ return this.intent.getQueryParamDecodeURIFirst(key);
9215
+ }
9216
+ }
9217
+ getQueryParam(key) {
9218
+ if (this.intent) {
9219
+ return this.intent.getQueryParam(key);
7246
9220
  }
7247
- this._executeSwcScript("swc-on-adopted", hostSet);
7248
- this._executeSwcScript("swc-on-after-adopted", hostSet);
7249
- };
7250
- const originalAttributeChanged = proto.attributeChangedCallback;
7251
- proto.attributeChangedCallback = function(name2, old, newVal) {
7252
- if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
7253
- const hSet = SwcUtils.getHostSet(this);
7254
- if (name2.startsWith("swc-on-") && !swcLifecycleAttributes.includes(name2)) {
7255
- if (newVal !== null) {
7256
- const eventName = name2.substring(7);
7257
- this._bindAttributeEvent(this, name2, newVal, eventName);
7258
- }
9221
+ }
9222
+ getQueryParamFirst(key) {
9223
+ if (this.intent) {
9224
+ return this.intent.getQueryParamFirst(key);
7259
9225
  }
7260
- const hostCustomEventMeta = emitHostCustomEventList.find((it) => it.options.attributeName === name2);
7261
- if (hostCustomEventMeta && newVal !== null) {
7262
- this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
9226
+ }
9227
+ get queryParams() {
9228
+ if (this.intent) {
9229
+ return this.intent.queryParams;
7263
9230
  }
7264
- const mKeys = attrChangeMap.get(name2);
7265
- if (mKeys && Array.isArray(mKeys)) {
7266
- for (const key of mKeys) this[key](newVal, old, name2, hSet);
9231
+ }
9232
+ get queryParamsAfterDecodeURI() {
9233
+ if (this.intent) {
9234
+ return this.intent.queryParamsDecodeURI;
7267
9235
  }
7268
- };
7269
- Object.defineProperty(constructor, "observedAttributes", {
7270
- get: () => mergedObservedAttributes,
7271
- configurable: true
7272
- });
7273
- ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);
7274
- const registry = metadata.customElementRegistry || win?.customElements;
7275
- if (registry && !registry.get(metadata.name)) {
7276
- registry.define(metadata.name, constructor, metadata.extends ? { extends: metadata.extends } : void 0);
7277
9236
  }
7278
- return constructor;
7279
9237
  };
7280
9238
 
7281
- // ../simple-boot/dist/esm/decorators/SimDecorator.js
7282
- var SimMetadataKey = Symbol("Sim");
7283
- var PostConstructMetadataKey = Symbol("PostConstruct");
7284
-
7285
- // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
7286
- var AfterMetadataKey = Symbol("After");
7287
- var BeforeMetadataKey = Symbol("Before");
7288
- var AroundMetadataKey = Symbol("Around");
7289
-
7290
- // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
7291
- var ExceptionHandlerMetadataKey = Symbol("ExceptionHandler");
7292
-
7293
- // ../simple-boot/dist/esm/decorators/SimNoProxy.js
7294
- var SimNoProxyKey = Symbol("Sim:NoProxy");
7295
-
7296
- // ../simple-boot/dist/esm/decorators/inject/Injection.js
7297
- var InjectionMetadataKey = Symbol("Injection");
7298
-
7299
- // ../simple-boot/dist/esm/decorators/route/Router.js
7300
- var RouterMetadataKey = Symbol("Router");
7301
- var RouteMetadataKey = Symbol("RouteMetadataKey");
7302
-
7303
9239
  // ../simple-boot/dist/esm/route/RouterAction.js
7304
9240
  var RouterAction;
7305
9241
  ((RouterAction2) => {
@@ -7314,6 +9250,435 @@ var RouterAction;
7314
9250
  };
7315
9251
  })(RouterAction || (RouterAction = {}));
7316
9252
 
9253
+ // ../simple-boot/dist/esm/route/RouterManager.js
9254
+ var RouterManager = class {
9255
+ constructor(simpleApplication, simstanceManager, simOption) {
9256
+ this.simpleApplication = simpleApplication;
9257
+ this.simstanceManager = simstanceManager;
9258
+ this.simOption = simOption;
9259
+ this.subject = new Subject();
9260
+ }
9261
+ // @SimNoProxy
9262
+ get observable() {
9263
+ return this.subject.asObservable();
9264
+ }
9265
+ routingMap(option) {
9266
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9267
+ if (!targetRouter) {
9268
+ throw new Error("no router");
9269
+ }
9270
+ const map = {};
9271
+ if (targetRouter) {
9272
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9273
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9274
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9275
+ const routerData = routerAtomic.getConfig(RouterMetadataKey);
9276
+ if (routerData) {
9277
+ const currentPrefix = (option?.prefix ?? "") + routerData.path;
9278
+ if (routerData.route && routerData.route[""]) {
9279
+ map[currentPrefix] = routerData.route[""];
9280
+ }
9281
+ if (routerData.route) {
9282
+ Object.entries(routerData.route).forEach(([key, value]) => {
9283
+ map[currentPrefix + key] = value;
9284
+ });
9285
+ }
9286
+ routerData.routers?.forEach((it) => {
9287
+ Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
9288
+ });
9289
+ }
9290
+ }
9291
+ return map;
9292
+ }
9293
+ /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
9294
+ * @deprecated
9295
+ */
9296
+ async routings(intent, option) {
9297
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9298
+ if (!targetRouter) {
9299
+ throw new Error("no router");
9300
+ }
9301
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9302
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9303
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9304
+ const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
9305
+ const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
9306
+ if (exactModuleMatches.length > 0) {
9307
+ exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9308
+ return exactModuleMatches;
9309
+ }
9310
+ const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
9311
+ if (exactPathMatches.length > 0) {
9312
+ exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9313
+ return exactPathMatches;
9314
+ }
9315
+ return [];
9316
+ }
9317
+ async routing(intent, option) {
9318
+ if (typeof intent === "string") {
9319
+ intent = new Intent(intent);
9320
+ }
9321
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9322
+ const callCheckOnRouting = option?.noOnRouting !== true;
9323
+ if (!targetRouter) {
9324
+ debugger;
9325
+ throw new Error("no router");
9326
+ }
9327
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9328
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9329
+ const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9330
+ const rootRouter = routerAtomic.getValue();
9331
+ const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
9332
+ if (executeModuleResult) {
9333
+ const [executeModule, routerChains] = executeModuleResult;
9334
+ executeModule.routerChains = routerChains;
9335
+ this.activeRouterModule = executeModule;
9336
+ const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
9337
+ if (routerChains.length > 0) {
9338
+ for (let i = 0; i < routerChains.length; i++) {
9339
+ const current = routerChains[i];
9340
+ const next = routerChains[i + 1];
9341
+ const value = current.getValue();
9342
+ if (RouterAction.isCanActivate(value) && next) {
9343
+ await value.canActivate(routingDataSet, next.getValue());
9344
+ }
9345
+ if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
9346
+ await value.onRouting(routingDataSet);
9347
+ }
9348
+ }
9349
+ }
9350
+ this.activeRouterModule = executeModule;
9351
+ const moduleInstance = executeModule.getModuleInstance();
9352
+ if (!executeModule?.module) {
9353
+ const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
9354
+ const value = routerChain?.getValue();
9355
+ if (RouterAction.isCanActivate(value)) {
9356
+ await value.canActivate(routingDataSet, moduleInstance);
9357
+ }
9358
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9359
+ await value.onRouting(routingDataSet);
9360
+ }
9361
+ } else {
9362
+ const value = executeModule.router?.getValue();
9363
+ if (RouterAction.isCanActivate(value)) {
9364
+ await value.canActivate(routingDataSet, moduleInstance);
9365
+ }
9366
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9367
+ await value.onRouting(routingDataSet);
9368
+ }
9369
+ if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
9370
+ await moduleInstance.onRouting(routingDataSet);
9371
+ }
9372
+ }
9373
+ const find = this.activeRouterModule;
9374
+ this.subject.next({ intent, routerModule: find, routerManager: this });
9375
+ return find;
9376
+ } else {
9377
+ const empty = await this._handleNotFoundRouting(rootRouter, intent);
9378
+ this.subject.next({ intent, routerModule: empty, routerManager: this });
9379
+ return empty;
9380
+ }
9381
+ }
9382
+ /**
9383
+ * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
9384
+ * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
9385
+ * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
9386
+ * @param rootRouter 앱의 최상위 라우터 인스턴스
9387
+ * @param intent 확인에 실패한 원본 Intent 객체
9388
+ * @private
9389
+ */
9390
+ async _handleNotFoundRouting(rootRouter, intent) {
9391
+ const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
9392
+ const routingDataSet = { intent, routerModule, routerManager: this };
9393
+ const value = rootRouter;
9394
+ if (RouterAction.isCanActivate(value)) {
9395
+ await value.canActivate(routingDataSet, null);
9396
+ }
9397
+ if (RouterAction.isOnRouting(value)) {
9398
+ await value.onRouting(routingDataSet);
9399
+ }
9400
+ this.activeRouterModule = routerModule;
9401
+ return this.activeRouterModule;
9402
+ }
9403
+ getExecuteModule(router, intent, parentRouters, option) {
9404
+ const path = intent.pathname;
9405
+ const routerConfig = router.getConfig(RouterMetadataKey);
9406
+ if (routerConfig) {
9407
+ const filters = [];
9408
+ if (Array.isArray(routerConfig.filters)) {
9409
+ filters.push(...routerConfig.filters);
9410
+ } else if (routerConfig.filters) {
9411
+ filters.push(routerConfig.filters);
9412
+ }
9413
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9414
+ if (noAccept) {
9415
+ return;
9416
+ }
9417
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9418
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9419
+ if (isRoot) {
9420
+ const currentParentRouters = [...parentRouters, router];
9421
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
9422
+ let bestMatchModule = void 0;
9423
+ let bestMatchLength = -1;
9424
+ for (const child of routerConfig.routers) {
9425
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9426
+ if (!routerAtomic) {
9427
+ continue;
9428
+ }
9429
+ const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
9430
+ if (executeModule) {
9431
+ const [rm, chains] = executeModule;
9432
+ const currentMatchLength = rm.path?.length || 0;
9433
+ if (currentMatchLength > bestMatchLength) {
9434
+ bestMatchLength = currentMatchLength;
9435
+ bestMatchModule = executeModule;
9436
+ } else if (currentMatchLength === bestMatchLength) {
9437
+ if (option?.find?.router === "last") {
9438
+ bestMatchModule = executeModule;
9439
+ }
9440
+ }
9441
+ }
9442
+ }
9443
+ if (bestMatchModule) {
9444
+ return bestMatchModule;
9445
+ }
9446
+ }
9447
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9448
+ if (module) {
9449
+ return [module, currentParentRouters];
9450
+ }
9451
+ }
9452
+ }
9453
+ }
9454
+ // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
9455
+ isRootUrl(path, parentRoots, url) {
9456
+ const searchString = parentRoots.join("") + (path || "");
9457
+ if (searchString === "/") {
9458
+ return true;
9459
+ }
9460
+ const searchs = searchString.split("/");
9461
+ const urls = url.split("/");
9462
+ const trimmedUrls = urls.slice(0, searchs.length).join("/");
9463
+ return !!Expression.Path.pathNameData(trimmedUrls, searchString);
9464
+ }
9465
+ _collectAllMatchingModules(router, intent, parentRouters) {
9466
+ const matches = [];
9467
+ const path = intent.pathname;
9468
+ const routerConfig = router.getConfig(RouterMetadataKey);
9469
+ if (routerConfig) {
9470
+ const filters = [];
9471
+ if (Array.isArray(routerConfig.filters)) {
9472
+ filters.push(...routerConfig.filters);
9473
+ } else if (routerConfig.filters) {
9474
+ filters.push(routerConfig.filters);
9475
+ }
9476
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9477
+ if (noAccept) {
9478
+ return matches;
9479
+ }
9480
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9481
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9482
+ if (isRoot) {
9483
+ const currentParentRouters = [...parentRouters, router];
9484
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
9485
+ for (const child of routerConfig.routers) {
9486
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9487
+ if (!routerAtomic) {
9488
+ continue;
9489
+ }
9490
+ matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
9491
+ }
9492
+ }
9493
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9494
+ if (module) {
9495
+ module.routerChains = currentParentRouters;
9496
+ matches.push(module);
9497
+ }
9498
+ }
9499
+ }
9500
+ return matches;
9501
+ }
9502
+ findRouterOrModule(router, routerData, parentRoots, intent) {
9503
+ const module = this.findRouting(router, routerData, parentRoots, intent);
9504
+ if (module?.module) {
9505
+ module.intent = intent;
9506
+ return module;
9507
+ }
9508
+ const urlRoot = parentRoots.join("") + (routerData.path || "");
9509
+ if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
9510
+ const rm = new RouterModule(this.simstanceManager, router);
9511
+ rm.intent = intent;
9512
+ rm.path = urlRoot;
9513
+ rm.pathData = intent.getPathnameData(urlRoot);
9514
+ return rm;
9515
+ }
9516
+ return void 0;
9517
+ }
9518
+ findRouting(router, routerData, parentRoots, intent) {
9519
+ const urlRoot = parentRoots.join("") + routerData.path;
9520
+ if (routerData.route) {
9521
+ for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
9522
+ const path = urlRoot + it;
9523
+ const pathnameData = intent.getPathnameData(path);
9524
+ if (pathnameData) {
9525
+ try {
9526
+ const dataSet = this.findRouteProperty(routerData.route, it, intent);
9527
+ const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
9528
+ rm.data = dataSet.data;
9529
+ rm.path = path;
9530
+ rm.pathData = pathnameData;
9531
+ rm.propertyKeys = dataSet.propertyKeys;
9532
+ return rm;
9533
+ } catch (e) {
9534
+ }
9535
+ }
9536
+ }
9537
+ }
9538
+ }
9539
+ findRouteProperty(route, propertyName, intent) {
9540
+ let child;
9541
+ let data;
9542
+ let propertyKeys;
9543
+ const routeElement = route[propertyName];
9544
+ if (typeof routeElement === "function") {
9545
+ child = { targetKeyType: routeElement, originalType: routeElement };
9546
+ } else if (typeof routeElement === "symbol") {
9547
+ const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
9548
+ if (findSimType?.originalType) {
9549
+ child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
9550
+ }
9551
+ } else if (typeof routeElement === "string") {
9552
+ return this.findRouteProperty(route, routeElement, intent);
9553
+ } else if (Array.isArray(routeElement)) {
9554
+ const r = routeElement?.[0];
9555
+ if (typeof r === "object" && "filters" in r && "target" in r) {
9556
+ const filters = [];
9557
+ if (Array.isArray(r.filters)) {
9558
+ filters.push(...r.filters);
9559
+ } else if (r.filters) {
9560
+ filters.push(r.filters);
9561
+ }
9562
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9563
+ if (!noAccept) {
9564
+ child = { targetKeyType: r.target, originalType: r.target };
9565
+ }
9566
+ } else {
9567
+ child = { targetKeyType: r, originalType: r };
9568
+ }
9569
+ data = routeElement?.[1];
9570
+ } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
9571
+ const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9572
+ if (!noAccept) {
9573
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9574
+ propertyKeys = routeElement.propertyKeys;
9575
+ }
9576
+ } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
9577
+ const filters = [];
9578
+ if (Array.isArray(routeElement.filters)) {
9579
+ filters.push(...routeElement.filters);
9580
+ } else if (routeElement.filters) {
9581
+ filters.push(routeElement.filters);
9582
+ }
9583
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9584
+ if (!noAccept) {
9585
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9586
+ }
9587
+ }
9588
+ return {
9589
+ child,
9590
+ data,
9591
+ propertyKeys
9592
+ };
9593
+ }
9594
+ };
9595
+
9596
+ // ../simple-boot/dist/esm/SimpleApplication.js
9597
+ var SimpleApplication = class _SimpleApplication {
9598
+ // public rootRouter?: ConstructorType<any>;
9599
+ // constructor();
9600
+ // constructor(option: SimOption);
9601
+ // constructor(rootRouter?: ConstructorType<Object> | Function);
9602
+ // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
9603
+ // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
9604
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
9605
+ constructor(option = new SimOption()) {
9606
+ this.option = option;
9607
+ this.simstanceManager = new SimstanceManager(this, option);
9608
+ this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
9609
+ this.routerManager = new RouterManager(this, this.simstanceManager, option);
9610
+ this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
9611
+ this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
9612
+ this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
9613
+ containers.add(this);
9614
+ }
9615
+ getSimstanceManager() {
9616
+ return this.simstanceManager;
9617
+ }
9618
+ getIntentManager() {
9619
+ return this.intentManager;
9620
+ }
9621
+ getRouterManager() {
9622
+ return this.routerManager;
9623
+ }
9624
+ run(otherInstanceSim) {
9625
+ otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
9626
+ otherInstanceSim.set(_SimpleApplication, this);
9627
+ this.simstanceManager.run(otherInstanceSim);
9628
+ return this;
9629
+ }
9630
+ simAtomic(type) {
9631
+ if (typeof type === "symbol") {
9632
+ return this.simstanceManager.findFirstSim(type);
9633
+ } else if (typeof type === "function") {
9634
+ return this.simstanceManager.findFirstSim({ type });
9635
+ }
9636
+ }
9637
+ simAtomics(type) {
9638
+ if (typeof type === "symbol") {
9639
+ return this.simstanceManager.findSims(type) ?? [];
9640
+ } else if (typeof type === "function") {
9641
+ return this.simstanceManager.findSims({ type }) ?? [];
9642
+ } else {
9643
+ return [];
9644
+ }
9645
+ }
9646
+ getInstance(type) {
9647
+ const i = this.sim(type);
9648
+ if (i) {
9649
+ return i;
9650
+ } else {
9651
+ throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
9652
+ }
9653
+ }
9654
+ sim(type) {
9655
+ return this.simAtomic(type)?.getValue();
9656
+ }
9657
+ sims(type) {
9658
+ return this.simAtomics(type).map((it) => it.getValue());
9659
+ }
9660
+ addSim(configOrTarget, target) {
9661
+ const r = Sim(configOrTarget);
9662
+ if (typeof r === "function" && target) {
9663
+ r(target);
9664
+ }
9665
+ }
9666
+ publishIntent(i, data) {
9667
+ return this.intentManager.publish(i, data);
9668
+ }
9669
+ routing(i, option) {
9670
+ if (i instanceof Intent) {
9671
+ return this.routerManager.routing(i, option);
9672
+ } else if (typeof i === "string") {
9673
+ const intent = new Intent(i);
9674
+ return this.routerManager.routing(intent, option);
9675
+ } else {
9676
+ const intent = new Intent(i.path, i.data);
9677
+ return this.routerManager.routing(intent, option);
9678
+ }
9679
+ }
9680
+ };
9681
+
7317
9682
  // ../core-web/dist/esm/element/CanvasUtils.js
7318
9683
  var CanvasUtils;
7319
9684
  ((CanvasUtils2) => {
@@ -8075,80 +10440,399 @@ var ValidUtils2;
8075
10440
  };
8076
10441
  })(ValidUtils2 || (ValidUtils2 = {}));
8077
10442
 
8078
- // src/utils/TemplateUtils.ts
8079
- var TemplateUtils;
8080
- ((TemplateUtils2) => {
8081
- TemplateUtils2.htmlFragment = (strings, ...values) => {
8082
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8083
- const template = document.createElement("template");
8084
- template.innerHTML = raw.trim();
8085
- return template.content;
8086
- };
8087
- TemplateUtils2.textNode = (strings, ...values) => {
8088
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8089
- return document.createTextNode(raw);
8090
- };
8091
- TemplateUtils2.commentNode = (strings, ...values) => {
8092
- const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8093
- return document.createComment(raw);
8094
- };
8095
- TemplateUtils2.createElement = (info, attrs = {}) => {
8096
- const el = document.createElement(info.tagName);
8097
- if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
8098
- Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
8099
- return el;
8100
- };
8101
- const createTagFunction = (tagName) => {
8102
- return (strings, ...values) => {
8103
- const el = document.createElement(tagName);
8104
- el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
8105
- return el;
8106
- };
10443
+ // ../simple-boot/dist/esm/index.js
10444
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
10445
+
10446
+ // ../simple-boot/dist/esm/alert/AlertAction.js
10447
+ var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
10448
+ AlertAction2["ACTIVE"] = "ACTIVE";
10449
+ AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
10450
+ return AlertAction2;
10451
+ })(AlertAction || {});
10452
+
10453
+ // ../simple-boot/dist/esm/alert/Alert.js
10454
+ var Alert = class {
10455
+ constructor(alertService, config) {
10456
+ this.alertService = alertService;
10457
+ this.config = config;
10458
+ this.isActive = false;
10459
+ this.activateBefore = [];
10460
+ this.activateAfter = [];
10461
+ this.deActivateBefore = [];
10462
+ this.deActivateAfter = [];
10463
+ this.data = /* @__PURE__ */ new Map();
10464
+ if (config?.uuid) {
10465
+ this.uuid = config.uuid;
10466
+ } else {
10467
+ this.uuid = RandomUtils.uuid();
10468
+ }
10469
+ }
10470
+ addOpenBefore(fn) {
10471
+ this.activateBefore.push(fn);
10472
+ }
10473
+ addOpenAfter(fn) {
10474
+ this.activateAfter.push(fn);
10475
+ }
10476
+ addCloseBefore(fn) {
10477
+ this.deActivateBefore.push(fn);
10478
+ }
10479
+ addCloseAfter(fn) {
10480
+ this.deActivateAfter.push(fn);
10481
+ }
10482
+ setData(key, value) {
10483
+ this.data.set(key, value);
10484
+ }
10485
+ getData(key) {
10486
+ return this.data.get(key);
10487
+ }
10488
+ async activate() {
10489
+ try {
10490
+ await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
10491
+ this.result = this.make();
10492
+ this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
10493
+ this.isActive = true;
10494
+ if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
10495
+ setTimeout(() => {
10496
+ this.deActivate();
10497
+ }, this.config.closeTime);
10498
+ }
10499
+ this.config?.activate?.(this.result, this);
10500
+ });
10501
+ } catch (e) {
10502
+ } finally {
10503
+ await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
10504
+ });
10505
+ }
10506
+ }
10507
+ async deActivate() {
10508
+ try {
10509
+ await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
10510
+ this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
10511
+ this.isActive = false;
10512
+ this.config?.deActivate?.(this.result, this);
10513
+ });
10514
+ } catch (e) {
10515
+ } finally {
10516
+ await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
10517
+ });
10518
+ }
10519
+ }
10520
+ };
10521
+
10522
+ // ../simple-boot/dist/esm/alert/AlertFactory.js
10523
+ var __decorate = function(decorators, target, key, desc) {
10524
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10525
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10526
+ 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;
10527
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10528
+ };
10529
+ var AlertFactory;
10530
+ (function(AlertFactory2) {
10531
+ AlertFactory2.SYMBOL = Symbol.for("simple-boot:alert-factory-token");
10532
+ })(AlertFactory || (AlertFactory = {}));
10533
+ var DefaultAlertFactory = class DefaultAlertFactory2 {
10534
+ create(data) {
10535
+ return void 0;
10536
+ }
10537
+ };
10538
+ DefaultAlertFactory = __decorate([
10539
+ Sim({ symbol: AlertFactory.SYMBOL })
10540
+ ], DefaultAlertFactory);
10541
+
10542
+ // ../simple-boot/dist/esm/alert/AlertType.js
10543
+ var AlertType = /* @__PURE__ */ ((AlertType2) => {
10544
+ AlertType2["DANGER"] = "DANGER";
10545
+ AlertType2["NORMAL"] = "NORMAL";
10546
+ AlertType2["PROGRESS"] = "PROGRESS";
10547
+ AlertType2["SUCCESS"] = "SUCCESS";
10548
+ AlertType2["ERROR"] = "ERROR";
10549
+ AlertType2["INFO"] = "INFO";
10550
+ AlertType2["WARNING"] = "WARNING";
10551
+ AlertType2["CONSOLE"] = "CONSOLE";
10552
+ AlertType2["ETC"] = "ETC";
10553
+ return AlertType2;
10554
+ })(AlertType || {});
10555
+
10556
+ // ../simple-boot/dist/esm/alert/AlertService.js
10557
+ var __decorate2 = function(decorators, target, key, desc) {
10558
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10559
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10560
+ 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;
10561
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10562
+ };
10563
+ var __metadata = function(k, v) {
10564
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10565
+ };
10566
+ var __param = function(paramIndex, decorator) {
10567
+ return function(target, key) {
10568
+ decorator(target, key, paramIndex);
10569
+ };
10570
+ };
10571
+ var _a;
10572
+ var AlertService = class AlertService2 {
10573
+ constructor(alertFactory) {
10574
+ this.name = (/* @__PURE__ */ new Date()).toUTCString();
10575
+ this.subject = new ReplaySubject();
10576
+ this.alertFactory = alertFactory;
10577
+ }
10578
+ // @PostConstruct
10579
+ // postConstruct(
10580
+ // ) {
10581
+ // this.alertFactory = alertFactory;
10582
+ // }
10583
+ get observable() {
10584
+ return this.subject.asObservable();
10585
+ }
10586
+ publish(data) {
10587
+ this.subject.next(data);
10588
+ }
10589
+ create(factory, config) {
10590
+ return new class extends Alert {
10591
+ make() {
10592
+ return factory(this);
10593
+ }
10594
+ }(this, config);
10595
+ }
10596
+ createFromFactory(type, config) {
10597
+ return this.alertFactory?.create({ caller: this, type, config });
10598
+ }
10599
+ danger(config) {
10600
+ return this.createFromFactory(AlertType.DANGER, config);
10601
+ }
10602
+ progress(config) {
10603
+ config = config ?? {};
10604
+ return this.createFromFactory(AlertType.PROGRESS, config);
10605
+ }
10606
+ success(config) {
10607
+ return this.createFromFactory(AlertType.SUCCESS, config);
10608
+ }
10609
+ info(config) {
10610
+ return this.createFromFactory(AlertType.INFO, config);
10611
+ }
10612
+ error(config) {
10613
+ return this.createFromFactory(AlertType.ERROR, config);
10614
+ }
10615
+ warning(config) {
10616
+ return this.createFromFactory(AlertType.WARNING, config);
10617
+ }
10618
+ };
10619
+ AlertService = __decorate2([
10620
+ Sim,
10621
+ __param(0, Inject({ symbol: AlertFactory.SYMBOL })),
10622
+ __metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
10623
+ ], AlertService);
10624
+
10625
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
10626
+ var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
10627
+ var getCacheSet = (simpleApplication) => {
10628
+ return simpleApplicationCache.get(simpleApplication);
10629
+ };
10630
+ var findCacheByKey = (simpleApplication, key) => {
10631
+ const storage = simpleApplicationCache.get(simpleApplication);
10632
+ if (storage) {
10633
+ return Array.from(storage.config.entries()).find(([k, v]) => k === key);
10634
+ }
10635
+ };
10636
+ var findCacheByKeyStartWith = (simpleApplication, key) => {
10637
+ const storage = simpleApplicationCache.get(simpleApplication);
10638
+ if (storage) {
10639
+ return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
10640
+ } else {
10641
+ return [];
10642
+ }
10643
+ };
10644
+ var deleteCacheByKey = (simpleApplication, key) => {
10645
+ const storage = simpleApplicationCache.get(simpleApplication);
10646
+ if (storage) {
10647
+ storage.storage.delete(key);
10648
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
10649
+ const data = storage.config.get(k);
10650
+ if (data?.expireTimeout) {
10651
+ clearTimeout(data.expireTimeout);
10652
+ }
10653
+ storage.config.delete(k);
10654
+ storage.storage.delete(k);
10655
+ });
10656
+ }
10657
+ };
10658
+ var deleteCacheByKeyStartWith = (simpleApplication, key) => {
10659
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
10660
+ };
10661
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
10662
+
10663
+ // ../simple-boot/dist/esm/cache/CacheManager.js
10664
+ var __decorate3 = function(decorators, target, key, desc) {
10665
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10666
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10667
+ 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;
10668
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10669
+ };
10670
+ var __metadata2 = function(k, v) {
10671
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10672
+ };
10673
+ var _a2;
10674
+ var CacheManager = class CacheManager2 {
10675
+ constructor(simpleApplication) {
10676
+ this.simpleApplication = simpleApplication;
10677
+ }
10678
+ findCacheByKey(key) {
10679
+ return findCacheByKey(this.simpleApplication, key);
10680
+ }
10681
+ findCacheByKeyStartWith(key) {
10682
+ return findCacheByKeyStartWith(this.simpleApplication, key);
10683
+ }
10684
+ deleteCacheByKey(key) {
10685
+ return deleteCacheByKey(this.simpleApplication, key);
10686
+ }
10687
+ deleteCacheByKeyStartWith(key) {
10688
+ return deleteCacheByKeyStartWith(this.simpleApplication, key);
10689
+ }
10690
+ getCacheSet() {
10691
+ return getCacheSet(this.simpleApplication);
10692
+ }
10693
+ };
10694
+ CacheManager = __decorate3([
10695
+ Sim,
10696
+ __metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
10697
+ ], CacheManager);
10698
+
10699
+ // ../simple-boot/dist/esm/decorators/event/EventListener.js
10700
+ var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
10701
+
10702
+ // ../simple-boot/dist/esm/decorators/validate/Validation.js
10703
+ var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
10704
+ var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
10705
+
10706
+ // ../simple-boot/dist/esm/fetch/ApiService.js
10707
+ var __decorate4 = function(decorators, target, key, desc) {
10708
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10709
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10710
+ 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;
10711
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10712
+ };
10713
+ var __metadata3 = function(k, v) {
10714
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10715
+ };
10716
+ var _a3;
10717
+ var _b;
10718
+ var ApiServiceInterceptor;
10719
+ (function(ApiServiceInterceptor2) {
10720
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
10721
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10722
+ try {
10723
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10724
+ } catch (e) {
10725
+ return [];
10726
+ }
8107
10727
  };
8108
- TemplateUtils2.htmlDivElement = createTagFunction("div");
8109
- TemplateUtils2.htmlSpanElement = createTagFunction("span");
8110
- TemplateUtils2.htmlButtonElement = createTagFunction("button");
8111
- TemplateUtils2.htmlUlElement = createTagFunction("ul");
8112
- TemplateUtils2.htmlLiElement = createTagFunction("li");
8113
- TemplateUtils2.htmlInputElement = createTagFunction("input");
8114
- TemplateUtils2.htmlAElement = createTagFunction("a");
8115
- TemplateUtils2.htmlPElement = createTagFunction("p");
8116
- TemplateUtils2.htmlH1Element = createTagFunction("h1");
8117
- TemplateUtils2.htmlH2Element = createTagFunction("h2");
8118
- TemplateUtils2.htmlH3Element = createTagFunction("h3");
8119
- TemplateUtils2.htmlH4Element = createTagFunction("h4");
8120
- TemplateUtils2.htmlH5Element = createTagFunction("h5");
8121
- TemplateUtils2.htmlH6Element = createTagFunction("h6");
8122
- TemplateUtils2.htmlSectionElement = createTagFunction("section");
8123
- TemplateUtils2.htmlArticleElement = createTagFunction("article");
8124
- })(TemplateUtils || (TemplateUtils = {}));
8125
- var htmlFragment = TemplateUtils.htmlFragment;
8126
- var textNode = TemplateUtils.textNode;
8127
- var commentNode = TemplateUtils.commentNode;
8128
- var createElement = TemplateUtils.createElement;
8129
- var htmlDivElement = TemplateUtils.htmlDivElement;
8130
- var htmlSpanElement = TemplateUtils.htmlSpanElement;
8131
- var htmlButtonElement = TemplateUtils.htmlButtonElement;
8132
- var htmlUlElement = TemplateUtils.htmlUlElement;
8133
- var htmlLiElement = TemplateUtils.htmlLiElement;
8134
- var htmlInputElement = TemplateUtils.htmlInputElement;
8135
- var htmlAElement = TemplateUtils.htmlAElement;
8136
- var htmlPElement = TemplateUtils.htmlPElement;
8137
- var htmlH1Element = TemplateUtils.htmlH1Element;
8138
- var htmlH2Element = TemplateUtils.htmlH2Element;
8139
- var htmlH3Element = TemplateUtils.htmlH3Element;
8140
- var htmlH4Element = TemplateUtils.htmlH4Element;
8141
- var htmlH5Element = TemplateUtils.htmlH5Element;
8142
- var htmlH6Element = TemplateUtils.htmlH6Element;
8143
- var htmlSectionElement = TemplateUtils.htmlSectionElement;
8144
- var htmlArticleElement = TemplateUtils.htmlArticleElement;
10728
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10729
+ var ApiService = class ApiService2 extends HttpJsonFetcher {
10730
+ constructor(simstanceManager, alertService) {
10731
+ super();
10732
+ this.simstanceManager = simstanceManager;
10733
+ this.subject = new Subject();
10734
+ this.alertService = alertService;
10735
+ }
10736
+ // @PostConstruct
10737
+ // postConstruct(alertService: AlertService<any>) {
10738
+ // this.alertService = alertService;
10739
+ // }
10740
+ get observable() {
10741
+ return this.subject.asObservable();
10742
+ }
10743
+ createPipe(config) {
10744
+ return {};
10745
+ }
10746
+ async beforeProxyFetch(config) {
10747
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10748
+ for (const interceptor of interceptors) {
10749
+ if (interceptor.beforeProxyFetch) {
10750
+ config = await interceptor.beforeProxyFetch(config);
10751
+ }
10752
+ }
10753
+ this.subject.next({ type: "beforeFetchData", config });
10754
+ return config;
10755
+ }
10756
+ async afterProxyFetch(config) {
10757
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10758
+ let r = config.response;
10759
+ for (const interceptor of interceptors) {
10760
+ if (interceptor.afterProxyFetch) {
10761
+ r = await interceptor.afterProxyFetch(config);
10762
+ }
10763
+ }
10764
+ this.subject.next({ type: "afterFetchData", response: r });
10765
+ return r;
10766
+ }
10767
+ beforeFetch(fetch2) {
10768
+ this.subject.next({ type: "beforeFetch", fetch: fetch2 });
10769
+ }
10770
+ afterFetch(fetch2, response) {
10771
+ this.subject.next({ type: "afterFetch", fetch: fetch2, response });
10772
+ }
10773
+ before(config, pipe) {
10774
+ this.subject.next({ type: "progress", config, pipe });
10775
+ config.config?.config?.callBackProgress?.(config, pipe);
10776
+ if (config.config?.config?.alertProgress) {
10777
+ const alert = this.alertService?.progress({ title: config.config.config.title });
10778
+ if (alert) {
10779
+ pipe.progress = alert;
10780
+ alert.activate();
10781
+ }
10782
+ }
10783
+ }
10784
+ afterSuccess(config, pipe) {
10785
+ this.subject.next({ type: "success", config, pipe });
10786
+ config.config?.config?.callBackSuccess?.(config, pipe);
10787
+ if (config.config?.config?.alertSuccessMsg) {
10788
+ this.alertService?.success({ title: config.config.config.title })?.activate();
10789
+ }
10790
+ }
10791
+ afterSuccessTransform(config, pipe) {
10792
+ }
10793
+ finally(config, pipe) {
10794
+ this.subject.next({ type: "final", config, pipe });
10795
+ config.config?.config?.callBackFinal?.(config, pipe);
10796
+ pipe.progress?.deActivate();
10797
+ }
10798
+ error(config, pipe, e) {
10799
+ console.log("error", e);
10800
+ this.subject.next({ type: "error", config, pipe, e });
10801
+ config.config?.config?.callBackError?.(config, pipe, e);
10802
+ if (config.config?.config?.alertErrorMsg) {
10803
+ this.alertService?.danger({
10804
+ title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
10805
+ })?.activate();
10806
+ }
10807
+ if (config.config?.config?.enableErrorConsole) {
10808
+ console.error(`apiService Error ${config?.config?.config?.title}`, e);
10809
+ }
10810
+ }
10811
+ async execute(fetcherRequest) {
10812
+ const target = fetcherRequest.target;
10813
+ const config = fetcherRequest.config;
10814
+ let r = { target, config };
10815
+ const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
10816
+ for (const apiServiceInterceptor of interceptor) {
10817
+ if (apiServiceInterceptor.beforeProxyExecute) {
10818
+ r = await apiServiceInterceptor.beforeProxyExecute?.(r);
10819
+ }
10820
+ }
10821
+ return super.execute(r);
10822
+ }
10823
+ };
10824
+ ApiService = __decorate4([
10825
+ Sim,
10826
+ __metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
10827
+ ], ApiService);
8145
10828
  export {
8146
10829
  ADD_EVENT_LISTENER_METADATA_KEY,
8147
10830
  APPLY_NODE_METADATA_KEY,
10831
+ ATTRIBUTE_APPLY_METADATA_KEY,
8148
10832
  ATTRIBUTE_CHANGED_WILDCARD,
8149
- ATTRIBUTE_METADATA_KEY,
10833
+ ATTRIBUTE_FIELD_METADATA_KEY,
8150
10834
  BROWSER_GLOBALS,
8151
- CLASS_LIST_METADATA_KEY,
10835
+ CLASS_METADATA_KEY,
8152
10836
  DOM_EVENT_NAMES,
8153
10837
  ELEMENT_CONFIG_KEY,
8154
10838
  EMIT_CUSTOM_EVENT_METADATA_KEY,
@@ -8166,35 +10850,33 @@ export {
8166
10850
  ON_CONSTRUCTOR_METADATA_KEY,
8167
10851
  QUERY_ALL_METADATA_KEY,
8168
10852
  QUERY_METADATA_KEY,
8169
- SET_ATTRIBUTE_METADATA_KEY,
8170
10853
  STYLE_METADATA_KEY,
8171
10854
  SWC_NOT_FOUND,
8172
10855
  SwcUtils,
8173
- TemplateUtils,
8174
- addClassList,
8175
- addClassListHost,
10856
+ addClass,
10857
+ addClassHost,
8176
10858
  addEventListener,
8177
10859
  addEventListenerHost,
8178
- applyAfterBeginNode,
8179
- applyAfterBeginNodeHost,
8180
- applyAfterEndNode,
8181
- applyAfterEndNodeHost,
8182
- applyBeforeBeginNode,
8183
- applyBeforeBeginNodeHost,
8184
- applyBeforeEndNode,
8185
- applyBeforeEndNodeHost,
10860
+ allAppHost,
10861
+ allFirstAppHost,
10862
+ allFirstHost,
10863
+ allHost,
10864
+ allLastAppHost,
10865
+ allLastHost,
10866
+ allParentHost,
10867
+ appHost,
10868
+ applyAttribute,
10869
+ applyAttributeHost,
10870
+ applyClass,
10871
+ applyClassHost,
8186
10872
  applyInnerHtmlNode,
8187
10873
  applyInnerHtmlNodeHost,
8188
- applyInnerTextNode,
8189
- applyInnerTextNodeHost,
8190
10874
  applyNode,
8191
10875
  applyNodeHost,
8192
- applyRemoveNode,
8193
- applyRemoveNodeHost,
8194
10876
  applyReplaceChildrenNode,
8195
10877
  applyReplaceChildrenNodeHost,
8196
- applyReplaceNode,
8197
- applyReplaceNodeHost,
10878
+ applyStyle,
10879
+ applyStyleHost,
8198
10880
  attribute,
8199
10881
  attributeHost,
8200
10882
  changedAttributeHost,
@@ -8205,12 +10887,14 @@ export {
8205
10887
  emitCustomEventHost,
8206
10888
  ensureInit2 as ensureInit,
8207
10889
  findAllApplyNodeMetadata,
10890
+ findAllAttributeApplyMetadata,
8208
10891
  findAllAttributeChangedMetadata,
8209
10892
  findAllAttributeMetadata,
8210
- findAllClassListMetadata,
10893
+ findAllClassMetadata,
8211
10894
  findAllLifecycleMetadata,
8212
- findAllSetAttributeMetadata,
8213
10895
  findAllStyleMetadata,
10896
+ firstAppHost,
10897
+ firstHost,
8214
10898
  getAddEventListenerMetadata,
8215
10899
  getChangedAttributeMetadata,
8216
10900
  getElementConfig,
@@ -8218,24 +10902,20 @@ export {
8218
10902
  getOnConnectedInnerHtmlMetadata,
8219
10903
  getQueryAllMetadata,
8220
10904
  getQueryMetadata,
8221
- getSetAttributeMetadata,
10905
+ host,
8222
10906
  htmlAElement,
8223
10907
  htmlArticleElement,
8224
10908
  htmlButtonElement,
8225
10909
  htmlDivElement,
8226
10910
  htmlFragment,
8227
- htmlH1Element,
8228
- htmlH2Element,
8229
- htmlH3Element,
8230
- htmlH4Element,
8231
- htmlH5Element,
8232
- htmlH6Element,
8233
- htmlInputElement,
10911
+ htmlHeadingElement,
8234
10912
  htmlLiElement,
8235
10913
  htmlPElement,
8236
10914
  htmlSectionElement,
8237
10915
  htmlSpanElement,
8238
10916
  htmlUlElement,
10917
+ lastAppHost,
10918
+ lastHost,
8239
10919
  onAddEventListener,
8240
10920
  onAdopted,
8241
10921
  onAfterAdopted,
@@ -8248,26 +10928,31 @@ export {
8248
10928
  onConnectedInnerHtml,
8249
10929
  onConstructor,
8250
10930
  onDisconnected,
10931
+ parentHost,
8251
10932
  query,
8252
10933
  queryAll,
8253
10934
  queryAllHost,
8254
10935
  queryHost,
8255
- removeClassList,
8256
- removeClassListHost,
10936
+ removeAttribute,
10937
+ removeAttributeHost,
10938
+ removeClass,
10939
+ removeClassHost,
8257
10940
  removeStyle,
8258
10941
  removeStyleHost,
8259
10942
  resolveTargetEls,
8260
10943
  setAttribute,
8261
10944
  setAttributeHost,
8262
- setClassList,
8263
- setClassListHost,
10945
+ setClass,
10946
+ setClassHost,
8264
10947
  setStyle,
8265
10948
  setStyleHost,
8266
10949
  textNode,
8267
- toggleClassList,
8268
- toggleClassListHost,
8269
- updateClassList,
8270
- updateClassListHost,
10950
+ toggleClass,
10951
+ toggleClassHost,
10952
+ updateAttribute,
10953
+ updateAttributeHost,
10954
+ updateClass,
10955
+ updateClassHost,
8271
10956
  updateStyle,
8272
10957
  updateStyleHost
8273
10958
  };