@dooboostore/simple-web-component 1.0.24 → 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 (130) hide show
  1. package/README.md +64 -3406
  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 +87 -194
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/{style.js → applyStyle.js} +50 -60
  11. package/dist/cjs/decorators/applyStyle.js.map +7 -0
  12. package/dist/cjs/decorators/attribute.js +10 -16
  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 +1 -1
  25. package/dist/cjs/decorators/query.js.map +2 -2
  26. package/dist/cjs/decorators/queryAll.js +1 -1
  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/utils/Utils.js +1 -1
  33. package/dist/cjs/utils/Utils.js.map +2 -2
  34. package/dist/esm/decorators/addEventListener.js +1 -1
  35. package/dist/esm/decorators/addEventListener.js.map +2 -2
  36. package/dist/esm/decorators/applyAttribute.js +129 -0
  37. package/dist/esm/decorators/applyAttribute.js.map +7 -0
  38. package/dist/esm/decorators/applyClass.js +145 -0
  39. package/dist/esm/decorators/applyClass.js.map +7 -0
  40. package/dist/esm/decorators/applyNode.js +87 -194
  41. package/dist/esm/decorators/applyNode.js.map +2 -2
  42. package/dist/esm/decorators/{style.js → applyStyle.js} +47 -57
  43. package/dist/esm/decorators/applyStyle.js.map +7 -0
  44. package/dist/esm/decorators/attribute.js +10 -16
  45. package/dist/esm/decorators/attribute.js.map +2 -2
  46. package/dist/esm/decorators/changedAttributeHost.js +1 -1
  47. package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
  48. package/dist/esm/decorators/elementDefine.js +14 -23
  49. package/dist/esm/decorators/elementDefine.js.map +2 -2
  50. package/dist/esm/decorators/emitCustomEvent.js +5 -2
  51. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  52. package/dist/esm/decorators/index.js +3 -3
  53. package/dist/esm/decorators/index.js.map +1 -1
  54. package/dist/esm/decorators/lifecycles.js +9 -9
  55. package/dist/esm/decorators/lifecycles.js.map +2 -2
  56. package/dist/esm/decorators/query.js +1 -1
  57. package/dist/esm/decorators/query.js.map +2 -2
  58. package/dist/esm/decorators/queryAll.js +1 -1
  59. package/dist/esm/decorators/queryAll.js.map +2 -2
  60. package/dist/esm/elements/SwcAppEngine.js +19 -4
  61. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  62. package/dist/esm/elements/SwcAppMixin.js +2 -0
  63. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  64. package/dist/esm/utils/Utils.js +1 -1
  65. package/dist/esm/utils/Utils.js.map +2 -2
  66. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2884 -586
  67. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  68. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  69. package/dist/types/decorators/applyAttribute.d.ts +22 -0
  70. package/dist/types/decorators/applyAttribute.d.ts.map +1 -0
  71. package/dist/types/decorators/applyClass.d.ts +65 -0
  72. package/dist/types/decorators/applyClass.d.ts.map +1 -0
  73. package/dist/types/decorators/applyNode.d.ts +15 -123
  74. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  75. package/dist/types/decorators/applyStyle.d.ts +21 -0
  76. package/dist/types/decorators/applyStyle.d.ts.map +1 -0
  77. package/dist/types/decorators/attribute.d.ts +10 -19
  78. package/dist/types/decorators/attribute.d.ts.map +1 -1
  79. package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -1
  80. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  81. package/dist/types/decorators/emitCustomEvent.d.ts +1 -1
  82. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  83. package/dist/types/decorators/index.d.ts +3 -3
  84. package/dist/types/decorators/index.d.ts.map +1 -1
  85. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  86. package/dist/types/decorators/query.d.ts.map +1 -1
  87. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  88. package/dist/types/elements/SwcAppEngine.d.ts +7 -0
  89. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  90. package/dist/types/elements/SwcAppMixin.d.ts +1 -1
  91. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  92. package/dist/types/utils/Utils.d.ts.map +1 -1
  93. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2884 -586
  94. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  95. package/package.json +3 -3
  96. package/src/decorators/addEventListener.ts +1 -1
  97. package/src/decorators/applyAttribute.ts +147 -0
  98. package/src/decorators/applyClass.ts +158 -0
  99. package/src/decorators/applyNode.ts +112 -330
  100. package/src/decorators/applyStyle.ts +128 -0
  101. package/src/decorators/attribute.ts +21 -55
  102. package/src/decorators/changedAttributeHost.ts +1 -1
  103. package/src/decorators/elementDefine.ts +18 -39
  104. package/src/decorators/emitCustomEvent.ts +6 -3
  105. package/src/decorators/index.ts +3 -3
  106. package/src/decorators/lifecycles.ts +9 -11
  107. package/src/decorators/query.ts +1 -1
  108. package/src/decorators/queryAll.ts +1 -1
  109. package/src/elements/SwcAppEngine.ts +32 -4
  110. package/src/elements/SwcAppMixin.ts +2 -0
  111. package/src/utils/Utils.ts +2 -1
  112. package/dist/cjs/decorators/classList.js +0 -177
  113. package/dist/cjs/decorators/classList.js.map +0 -7
  114. package/dist/cjs/decorators/setAttribute.js +0 -111
  115. package/dist/cjs/decorators/setAttribute.js.map +0 -7
  116. package/dist/cjs/decorators/style.js.map +0 -7
  117. package/dist/esm/decorators/classList.js +0 -158
  118. package/dist/esm/decorators/classList.js.map +0 -7
  119. package/dist/esm/decorators/setAttribute.js +0 -92
  120. package/dist/esm/decorators/setAttribute.js.map +0 -7
  121. package/dist/esm/decorators/style.js.map +0 -7
  122. package/dist/types/decorators/classList.d.ts +0 -71
  123. package/dist/types/decorators/classList.d.ts.map +0 -1
  124. package/dist/types/decorators/setAttribute.d.ts +0 -23
  125. package/dist/types/decorators/setAttribute.d.ts.map +0 -1
  126. package/dist/types/decorators/style.d.ts +0 -58
  127. package/dist/types/decorators/style.d.ts.map +0 -1
  128. package/src/decorators/classList.ts +0 -234
  129. package/src/decorators/setAttribute.ts +0 -114
  130. package/src/decorators/style.ts +0 -185
@@ -303,8 +303,8 @@ var dooboostoreSimpleWebComponent = (() => {
303
303
  keys.push(key);
304
304
  }
305
305
  }
306
- for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
307
- var key = parentKeys_1[_a];
306
+ for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
307
+ var key = parentKeys_1[_a4];
308
308
  var hasKey = set.has(key);
309
309
  if (!hasKey) {
310
310
  set.add(key);
@@ -1120,10 +1120,11 @@ var dooboostoreSimpleWebComponent = (() => {
1120
1120
  __export(bundle_entry_exports, {
1121
1121
  ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
1122
1122
  APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
1123
+ ATTRIBUTE_APPLY_METADATA_KEY: () => ATTRIBUTE_APPLY_METADATA_KEY,
1123
1124
  ATTRIBUTE_CHANGED_WILDCARD: () => ATTRIBUTE_CHANGED_WILDCARD,
1124
- ATTRIBUTE_METADATA_KEY: () => ATTRIBUTE_METADATA_KEY,
1125
+ ATTRIBUTE_FIELD_METADATA_KEY: () => ATTRIBUTE_FIELD_METADATA_KEY,
1125
1126
  BROWSER_GLOBALS: () => BROWSER_GLOBALS,
1126
- CLASS_LIST_METADATA_KEY: () => CLASS_LIST_METADATA_KEY,
1127
+ CLASS_METADATA_KEY: () => CLASS_METADATA_KEY,
1127
1128
  DOM_EVENT_NAMES: () => DOM_EVENT_NAMES,
1128
1129
  ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
1129
1130
  EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
@@ -1141,12 +1142,11 @@ var dooboostoreSimpleWebComponent = (() => {
1141
1142
  ON_CONSTRUCTOR_METADATA_KEY: () => ON_CONSTRUCTOR_METADATA_KEY,
1142
1143
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
1143
1144
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
1144
- SET_ATTRIBUTE_METADATA_KEY: () => SET_ATTRIBUTE_METADATA_KEY,
1145
1145
  STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
1146
1146
  SWC_NOT_FOUND: () => SWC_NOT_FOUND,
1147
1147
  SwcUtils: () => SwcUtils,
1148
- addClassList: () => addClassList,
1149
- addClassListHost: () => addClassListHost,
1148
+ addClass: () => addClass,
1149
+ addClassHost: () => addClassHost,
1150
1150
  addEventListener: () => addEventListener,
1151
1151
  addEventListenerHost: () => addEventListenerHost,
1152
1152
  allAppHost: () => allAppHost,
@@ -1157,26 +1157,18 @@ var dooboostoreSimpleWebComponent = (() => {
1157
1157
  allLastHost: () => allLastHost,
1158
1158
  allParentHost: () => allParentHost,
1159
1159
  appHost: () => appHost,
1160
- applyAfterBeginNode: () => applyAfterBeginNode,
1161
- applyAfterBeginNodeHost: () => applyAfterBeginNodeHost,
1162
- applyAfterEndNode: () => applyAfterEndNode,
1163
- applyAfterEndNodeHost: () => applyAfterEndNodeHost,
1164
- applyBeforeBeginNode: () => applyBeforeBeginNode,
1165
- applyBeforeBeginNodeHost: () => applyBeforeBeginNodeHost,
1166
- applyBeforeEndNode: () => applyBeforeEndNode,
1167
- applyBeforeEndNodeHost: () => applyBeforeEndNodeHost,
1160
+ applyAttribute: () => applyAttribute,
1161
+ applyAttributeHost: () => applyAttributeHost,
1162
+ applyClass: () => applyClass,
1163
+ applyClassHost: () => applyClassHost,
1168
1164
  applyInnerHtmlNode: () => applyInnerHtmlNode,
1169
1165
  applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
1170
- applyInnerTextNode: () => applyInnerTextNode,
1171
- applyInnerTextNodeHost: () => applyInnerTextNodeHost,
1172
1166
  applyNode: () => applyNode,
1173
1167
  applyNodeHost: () => applyNodeHost,
1174
- applyRemoveNode: () => applyRemoveNode,
1175
- applyRemoveNodeHost: () => applyRemoveNodeHost,
1176
1168
  applyReplaceChildrenNode: () => applyReplaceChildrenNode,
1177
1169
  applyReplaceChildrenNodeHost: () => applyReplaceChildrenNodeHost,
1178
- applyReplaceNode: () => applyReplaceNode,
1179
- applyReplaceNodeHost: () => applyReplaceNodeHost,
1170
+ applyStyle: () => applyStyle,
1171
+ applyStyleHost: () => applyStyleHost,
1180
1172
  attribute: () => attribute,
1181
1173
  attributeHost: () => attributeHost,
1182
1174
  changedAttributeHost: () => changedAttributeHost,
@@ -1187,11 +1179,11 @@ var dooboostoreSimpleWebComponent = (() => {
1187
1179
  emitCustomEventHost: () => emitCustomEventHost,
1188
1180
  ensureInit: () => ensureInit2,
1189
1181
  findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
1182
+ findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
1190
1183
  findAllAttributeChangedMetadata: () => findAllAttributeChangedMetadata,
1191
1184
  findAllAttributeMetadata: () => findAllAttributeMetadata,
1192
- findAllClassListMetadata: () => findAllClassListMetadata,
1185
+ findAllClassMetadata: () => findAllClassMetadata,
1193
1186
  findAllLifecycleMetadata: () => findAllLifecycleMetadata,
1194
- findAllSetAttributeMetadata: () => findAllSetAttributeMetadata,
1195
1187
  findAllStyleMetadata: () => findAllStyleMetadata,
1196
1188
  firstAppHost: () => firstAppHost,
1197
1189
  firstHost: () => firstHost,
@@ -1202,7 +1194,6 @@ var dooboostoreSimpleWebComponent = (() => {
1202
1194
  getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
1203
1195
  getQueryAllMetadata: () => getQueryAllMetadata,
1204
1196
  getQueryMetadata: () => getQueryMetadata,
1205
- getSetAttributeMetadata: () => getSetAttributeMetadata,
1206
1197
  host: () => host,
1207
1198
  htmlAElement: () => htmlAElement,
1208
1199
  htmlArticleElement: () => htmlArticleElement,
@@ -1234,29 +1225,33 @@ var dooboostoreSimpleWebComponent = (() => {
1234
1225
  queryAll: () => queryAll,
1235
1226
  queryAllHost: () => queryAllHost,
1236
1227
  queryHost: () => queryHost,
1237
- removeClassList: () => removeClassList,
1238
- removeClassListHost: () => removeClassListHost,
1228
+ removeAttribute: () => removeAttribute,
1229
+ removeAttributeHost: () => removeAttributeHost,
1230
+ removeClass: () => removeClass,
1231
+ removeClassHost: () => removeClassHost,
1239
1232
  removeStyle: () => removeStyle,
1240
1233
  removeStyleHost: () => removeStyleHost,
1241
1234
  resolveTargetEls: () => resolveTargetEls,
1242
1235
  setAttribute: () => setAttribute,
1243
1236
  setAttributeHost: () => setAttributeHost,
1244
- setClassList: () => setClassList,
1245
- setClassListHost: () => setClassListHost,
1237
+ setClass: () => setClass,
1238
+ setClassHost: () => setClassHost,
1246
1239
  setStyle: () => setStyle,
1247
1240
  setStyleHost: () => setStyleHost,
1248
1241
  textNode: () => textNode,
1249
- toggleClassList: () => toggleClassList,
1250
- toggleClassListHost: () => toggleClassListHost,
1251
- updateClassList: () => updateClassList,
1252
- updateClassListHost: () => updateClassListHost,
1242
+ toggleClass: () => toggleClass,
1243
+ toggleClassHost: () => toggleClassHost,
1244
+ updateAttribute: () => updateAttribute,
1245
+ updateAttributeHost: () => updateAttributeHost,
1246
+ updateClass: () => updateClass,
1247
+ updateClassHost: () => updateClassHost,
1253
1248
  updateStyle: () => updateStyle,
1254
1249
  updateStyleHost: () => updateStyleHost
1255
1250
  });
1256
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1251
+ var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1257
1252
 
1258
1253
  // src/index.ts
1259
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
1254
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1260
1255
 
1261
1256
  // ../core/dist/esm/valid/ValidUtils.js
1262
1257
  var ValidUtils;
@@ -4932,6 +4927,107 @@ var dooboostoreSimpleWebComponent = (() => {
4932
4927
  }
4933
4928
  };
4934
4929
 
4930
+ // ../core/dist/esm/message/Subject.js
4931
+ var Subject = class extends Observable {
4932
+ constructor() {
4933
+ super((subscriber) => {
4934
+ return this._subscribeToSubject(subscriber);
4935
+ });
4936
+ this._observers = /* @__PURE__ */ new Set();
4937
+ this._isStopped = false;
4938
+ this._hasError = false;
4939
+ }
4940
+ _subscribeToSubject(subscriber) {
4941
+ const partialObserver = {
4942
+ next: subscriber.next.bind(subscriber),
4943
+ error: subscriber.error.bind(subscriber),
4944
+ complete: subscriber.complete.bind(subscriber)
4945
+ };
4946
+ if (this._isStopped) {
4947
+ if (this._hasError) {
4948
+ partialObserver.error?.(this._error);
4949
+ } else {
4950
+ partialObserver.complete?.();
4951
+ }
4952
+ return Subscription.EMPTY;
4953
+ }
4954
+ this._observers.add(partialObserver);
4955
+ return new Subscription(() => {
4956
+ this._observers.delete(partialObserver);
4957
+ });
4958
+ }
4959
+ next(data) {
4960
+ if (this._isStopped) {
4961
+ return;
4962
+ }
4963
+ this._observers.forEach((observer) => {
4964
+ observer.next?.(data);
4965
+ });
4966
+ }
4967
+ error(err) {
4968
+ if (this._isStopped) {
4969
+ return;
4970
+ }
4971
+ this._hasError = true;
4972
+ this._error = err;
4973
+ this._isStopped = true;
4974
+ this._observers.forEach((observer) => observer.error?.(err));
4975
+ this._observers.clear();
4976
+ }
4977
+ complete() {
4978
+ if (this._isStopped) {
4979
+ return;
4980
+ }
4981
+ this._isStopped = true;
4982
+ this._observers.forEach((observer) => observer.complete?.());
4983
+ this._observers.clear();
4984
+ }
4985
+ asObservable() {
4986
+ return new Observable((subscriber) => {
4987
+ return this._subscribeToSubject(subscriber);
4988
+ });
4989
+ }
4990
+ };
4991
+
4992
+ // ../core/dist/esm/message/ReplaySubject.js
4993
+ var ReplaySubject = class extends Subject {
4994
+ // Removed: private _error: E | undefined;
4995
+ // Removed: private _isStopped = false;
4996
+ constructor(bufferSize = Infinity) {
4997
+ super();
4998
+ this.bufferSize = bufferSize;
4999
+ this._buffer = [];
5000
+ }
5001
+ next(data) {
5002
+ if (this._isStopped) {
5003
+ return;
5004
+ }
5005
+ this._buffer.push(data);
5006
+ if (this._buffer.length > this.bufferSize) {
5007
+ this._buffer.shift();
5008
+ }
5009
+ super.next(data);
5010
+ }
5011
+ error(err) {
5012
+ super.error(err);
5013
+ }
5014
+ complete() {
5015
+ super.complete();
5016
+ }
5017
+ _subscribeToSubject(subscriber) {
5018
+ this._buffer.forEach((value) => subscriber.next(value));
5019
+ if (this._isStopped) {
5020
+ if (this._hasError) {
5021
+ subscriber.error(this._error);
5022
+ } else {
5023
+ subscriber.complete();
5024
+ }
5025
+ return Subscription.EMPTY;
5026
+ }
5027
+ return super._subscribeToSubject(subscriber);
5028
+ }
5029
+ };
5030
+
4935
5031
  // ../core/dist/esm/message/AutoCloseSubscription.js
4936
5032
  var AutoCloseSubscription = class extends Subscription {
4937
5033
  constructor(userUnsubscribe) {
@@ -5266,6 +5362,284 @@ var dooboostoreSimpleWebComponent = (() => {
5266
5362
  })(Result = Promises2.Result || (Promises2.Result = {}));
5267
5363
  })(Promises || (Promises = {}));
5268
5364
 
5365
+ // ../core/dist/esm/fetch/Fetcher.js
5366
+ var Fetcher = class {
5367
+ createPipe(config) {
5368
+ return {};
5369
+ }
5370
+ fetch(config) {
5371
+ return new Promise((resolve, reject) => {
5372
+ const pipe = this.createPipe(config);
5373
+ Promise.resolve().then(() => {
5374
+ this.before(config, pipe);
5375
+ config?.before?.();
5376
+ }).then(() => {
5377
+ return this.execute(config);
5378
+ }).then((data) => {
5379
+ const hasError = config.config?.hasErrorChecker?.(data);
5380
+ if (hasError) {
5381
+ throw hasError;
5382
+ }
5383
+ pipe.responseData = data;
5384
+ this.afterSuccess(config, pipe);
5385
+ config?.afterSuccess?.();
5386
+ const gdata = config?.transform ? config.transform(data) : data;
5387
+ this.afterSuccessTransform(config, pipe);
5388
+ resolve(gdata);
5389
+ }).catch(async (e) => {
5390
+ this.error(config, pipe, e);
5391
+ config?.error?.();
5392
+ if (config?.errorTransform) {
5393
+ e = await config.errorTransform(e);
5394
+ }
5395
+ e = await this.errorTransform(e);
5396
+ reject(e);
5397
+ }).finally(() => {
5398
+ this.finally(config, pipe);
5399
+ config?.finally?.();
5400
+ });
5401
+ });
5402
+ }
5403
+ };
5404
+
5405
+ // ../core/dist/esm/fetch/HttpFetcher.js
5406
+ var HttpResponseError = class extends Error {
5407
+ };
5408
+ var HttpFetcher = class extends Fetcher {
5409
+ get(config) {
5410
+ config.config ?? (config.config = {});
5411
+ config.config.fetch = config.config?.fetch ?? {};
5412
+ config.config.fetch.method = "GET";
5413
+ return this.fetch(config);
5414
+ }
5415
+ post(config) {
5416
+ config.config ?? (config.config = {});
5417
+ config.config.fetch = config.config?.fetch ?? {};
5418
+ config.config.fetch.method = "POST";
5419
+ return this.fetch(config);
5420
+ }
5421
+ patch(config) {
5422
+ config.config ?? (config.config = {});
5423
+ config.config.fetch = config.config?.fetch ?? {};
5424
+ config.config.fetch.method = "PATCH";
5425
+ return this.fetch(config);
5426
+ }
5427
+ put(config) {
5428
+ config.config ?? (config.config = {});
5429
+ config.config.fetch = config.config?.fetch ?? {};
5430
+ config.config.fetch.method = "PUT";
5431
+ return this.fetch(config);
5432
+ }
5433
+ head(config) {
5434
+ config.config ?? (config.config = {});
5435
+ config.config.fetch = config.config?.fetch ?? {};
5436
+ config.config.fetch.method = "HEAD";
5437
+ return this.fetch(config);
5438
+ }
5439
+ delete(config) {
5440
+ config.config ?? (config.config = {});
5441
+ config.config.fetch = config.config?.fetch ?? {};
5442
+ config.config.fetch.method = "DELETE";
5443
+ return this.fetch(config);
5444
+ }
5445
+ async beforeProxyFetch(config) {
5446
+ return config;
5447
+ }
5448
+ async afterProxyFetch(config) {
5449
+ return config.response;
5450
+ }
5451
+ afterSuccess(config, pipe) {
5452
+ }
5453
+ afterSuccessTransform(config, pipe) {
5454
+ }
5455
+ before(config, pipe) {
5456
+ }
5457
+ error(config, pipe, e) {
5458
+ }
5459
+ finally(config, pipe) {
5460
+ }
5461
+ beforeFetch(fetch2) {
5462
+ }
5463
+ afterFetch(fetch2, response) {
5464
+ }
5465
+ // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5466
+ async errorTransform(e) {
5467
+ const httpResponseError = new HttpResponseError();
5468
+ httpResponseError.error = e;
5469
+ if (e instanceof Response) {
5470
+ httpResponseError.response = e;
5471
+ try {
5472
+ httpResponseError.body = await e.clone().text();
5473
+ httpResponseError.message = e.statusText;
5474
+ } catch (e2) {
5475
+ httpResponseError.body = e2;
5476
+ httpResponseError.message = e2.message;
5477
+ }
5478
+ } else {
5479
+ httpResponseError.body = e;
5480
+ httpResponseError.message = e.message;
5481
+ }
5482
+ return httpResponseError;
5483
+ }
5484
+ async execute(fetcherRequest) {
5485
+ let target = fetcherRequest.target;
5486
+ let config = fetcherRequest.config;
5487
+ if (!(target instanceof URL) && typeof target !== "string") {
5488
+ const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5489
+ try {
5490
+ const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5491
+ searchParams.forEach((value, key) => {
5492
+ url.searchParams.append(key, value);
5493
+ });
5494
+ target = url;
5495
+ } catch (e) {
5496
+ if (typeof target.url === "string") {
5497
+ const searchParamString = searchParams.toString();
5498
+ target = target.url + (searchParamString ? "?" + searchParamString : "");
5499
+ } else {
5500
+ target = "";
5501
+ }
5502
+ }
5503
+ }
5504
+ const beforeProxyData = { requestInfo: target, init: config?.fetch };
5505
+ let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5506
+ beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5507
+ target = beforeData.requestInfo;
5508
+ if (beforeData.init) {
5509
+ config ?? (config = {});
5510
+ config.fetch = beforeData.init;
5511
+ }
5512
+ let abortedTimeout;
5513
+ if (config?.fetch && "timeout" in config.fetch) {
5514
+ const abortController = new AbortController();
5515
+ abortedTimeout = setTimeout(() => {
5516
+ if (config?.fetch?.signal) {
5517
+ const inputSignal = config.fetch.signal;
5518
+ const listener = () => {
5519
+ if (!abortController.signal.aborted) {
5520
+ abortController.abort();
5521
+ }
5522
+ inputSignal.removeEventListener("abort", listener);
5523
+ };
5524
+ inputSignal.addEventListener("abort", listener);
5525
+ }
5526
+ if (!abortController.signal.aborted) {
5527
+ abortController.abort();
5528
+ }
5529
+ }, config.fetch.timeout);
5530
+ config.fetch.signal = abortController.signal;
5531
+ }
5532
+ this.beforeFetch({ target, requestInit: config?.fetch });
5533
+ return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5534
+ this.afterFetch({ target, requestInit: config?.fetch }, it);
5535
+ const afterProxyData = {
5536
+ fetch: { target, requestInit: config.fetch },
5537
+ config: beforeData,
5538
+ response: it
5539
+ };
5540
+ it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5541
+ it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5542
+ config?.fetchResponseAfterCallBack?.(it, config);
5543
+ if (!config?.allowedResponseNotOk && !it.ok) {
5544
+ throw it;
5545
+ }
5546
+ const data = config?.hasResponseErrorChecker?.(it, config);
5547
+ if (data) {
5548
+ throw data;
5549
+ }
5550
+ return it;
5551
+ }).finally(() => {
5552
+ if (abortedTimeout) {
5553
+ clearTimeout(abortedTimeout);
5554
+ }
5555
+ });
5556
+ }
5557
+ };
5558
+
5559
+ // ../core/dist/esm/fetch/HttpJsonFetcher.js
5560
+ var HttpJsonFetcher = class extends HttpFetcher {
5561
+ updateJsonFetchConfigAndData(config) {
5562
+ var _a4, _b2;
5563
+ const headers = {
5564
+ "Content-Type": "application/json",
5565
+ Accept: "application/json, text/plain, */*"
5566
+ };
5567
+ config.config ?? (config.config = {});
5568
+ (_a4 = config.config).fetch ?? (_a4.fetch = {});
5569
+ (_b2 = config.config.fetch).headers ?? (_b2.headers = {});
5570
+ config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5571
+ if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5572
+ config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5573
+ }
5574
+ return config;
5575
+ }
5576
+ get(config) {
5577
+ return super.get(config);
5578
+ }
5579
+ delete(config) {
5580
+ return super.delete(config);
5581
+ }
5582
+ post(config) {
5583
+ return super.post(config);
5584
+ }
5585
+ patch(config) {
5586
+ return super.patch(config);
5587
+ }
5588
+ put(config) {
5589
+ return super.put(config);
5590
+ }
5591
+ head(config) {
5592
+ return super.head(config);
5593
+ }
5594
+ postJson(config) {
5595
+ return super.post(this.updateJsonFetchConfigAndData(config));
5596
+ }
5597
+ patchJson(config) {
5598
+ return super.patch(this.updateJsonFetchConfigAndData(config));
5599
+ }
5600
+ putJson(config) {
5601
+ return super.put(this.updateJsonFetchConfigAndData(config));
5602
+ }
5603
+ async errorTransform(e) {
5604
+ const httpResponseError = new HttpResponseError();
5605
+ httpResponseError.error = e;
5606
+ if (e instanceof Response) {
5607
+ httpResponseError.response = e;
5608
+ try {
5609
+ httpResponseError.body = await e.clone().json();
5610
+ httpResponseError.message = e.statusText;
5611
+ } catch (parseError) {
5612
+ httpResponseError.body = parseError;
5613
+ httpResponseError.message = parseError.message;
5614
+ }
5615
+ } else {
5616
+ httpResponseError.body = e;
5617
+ httpResponseError.message = e.message;
5618
+ }
5619
+ return httpResponseError;
5620
+ }
5621
+ // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5622
+ execute(fetcherRequest) {
5623
+ return super.execute(fetcherRequest).then((response) => {
5624
+ const config = fetcherRequest.config;
5625
+ const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5626
+ if (transform === "response") {
5627
+ return response;
5628
+ } else if (transform === "text") {
5629
+ return response?.text();
5630
+ } else if (typeof transform === "function") {
5631
+ return transform(response);
5632
+ } else {
5633
+ return response?.text().then((it) => {
5634
+ if ((it ?? "").length > 0) {
5635
+ return JSON.parse(it);
5636
+ }
5637
+ });
5638
+ }
5639
+ });
5640
+ }
5641
+ };
5642
+
5269
5643
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5270
5644
  var RenderDrawObj = class extends Obj {
5271
5645
  render(draw, config) {
@@ -5542,7 +5916,7 @@ var dooboostoreSimpleWebComponent = (() => {
5542
5916
  // ../core/dist/esm/schedule/Schedule.js
5543
5917
  var Schedule;
5544
5918
  ((Schedule2) => {
5545
- Schedule2.SYMBOL = Symbol("Schedule");
5919
+ Schedule2.SYMBOL = Symbol.for("core:schedule-token");
5546
5920
  })(Schedule || (Schedule = {}));
5547
5921
 
5548
5922
  // ../core/dist/esm/url/UrlUtils.js
@@ -5696,6 +6070,17 @@ var dooboostoreSimpleWebComponent = (() => {
5696
6070
  Reflect.defineMetadata(metadataKey, value, target);
5697
6071
  }
5698
6072
  };
6073
+ ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
6074
+ const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
6075
+ for (const key of keys) {
6076
+ const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
6077
+ if (propertyKey) {
6078
+ Reflect.defineMetadata(key, data, to, propertyKey);
6079
+ } else {
6080
+ Reflect.defineMetadata(key, data, to);
6081
+ }
6082
+ }
6083
+ };
5699
6084
  })(ReflectUtils || (ReflectUtils = {}));
5700
6085
 
5701
6086
  // ../core/dist/esm/function/FunctionUtils.js
@@ -5859,7 +6244,7 @@ var dooboostoreSimpleWebComponent = (() => {
5859
6244
  })(Expression || (Expression = {}));
5860
6245
 
5861
6246
  // src/decorators/addEventListener.ts
5862
- var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
6247
+ var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
5863
6248
  function addEventListener(selectorOrTarget, type, options = {}) {
5864
6249
  return (targetObj, propertyKey, descriptor) => {
5865
6250
  const constructor = targetObj.constructor;
@@ -5880,15 +6265,15 @@ var dooboostoreSimpleWebComponent = (() => {
5880
6265
  }
5881
6266
 
5882
6267
  // src/decorators/lifecycles.ts
5883
- var ON_CONSTRUCTOR_METADATA_KEY = Symbol("simple-web-component:on-constructor");
5884
- var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-connected");
5885
- var ON_AFTER_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-connected");
5886
- var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-disconnected");
5887
- var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-disconnected");
5888
- var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
5889
- var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
5890
- var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
5891
- var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
6268
+ var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6269
+ var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
6270
+ var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
6271
+ var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
6272
+ var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
6273
+ var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
6274
+ var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
6275
+ var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
6276
+ var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
5892
6277
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
5893
6278
  function createLifecycleDecorator(metadataKey) {
5894
6279
  return (target, propertyKey) => {
@@ -5939,7 +6324,7 @@ var dooboostoreSimpleWebComponent = (() => {
5939
6324
  };
5940
6325
 
5941
6326
  // src/decorators/attribute.ts
5942
- var ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:attribute");
6327
+ var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
5943
6328
  var convertValue = (val, type) => {
5944
6329
  if (val === null || val === void 0) return val;
5945
6330
  if (type === Number) return Number(val);
@@ -5997,15 +6382,14 @@ var dooboostoreSimpleWebComponent = (() => {
5997
6382
  const constructor = target.constructor;
5998
6383
  const privateKey = Symbol(String(propertyKey));
5999
6384
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
6000
- let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
6385
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
6001
6386
  if (!metaList) {
6002
6387
  metaList = [];
6003
- ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
6388
+ ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
6004
6389
  }
6005
6390
  metaList.push({ propertyKey, selector, options, privateKey });
6006
6391
  const applySetAttribute = (inst, targets, attrName, nv) => {
6007
6392
  targets.forEach((it) => {
6008
- console.log("----->", it);
6009
6393
  if (it && typeof it.setAttribute === "function") {
6010
6394
  if (nv === null) {
6011
6395
  it.removeAttribute(attrName);
@@ -6023,7 +6407,6 @@ var dooboostoreSimpleWebComponent = (() => {
6023
6407
  const conf = getElementConfig(this);
6024
6408
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6025
6409
  const targetType = options.type || designType;
6026
- console.log("type-->", propertyKey, targetType);
6027
6410
  if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
6028
6411
  return convertValue(this[privateKey], targetType);
6029
6412
  }
@@ -6039,7 +6422,6 @@ var dooboostoreSimpleWebComponent = (() => {
6039
6422
  return convertValue(this[privateKey], targetType);
6040
6423
  },
6041
6424
  set(nv) {
6042
- const targetType = options.type || designType;
6043
6425
  const attrName = options.name || String(propertyKey);
6044
6426
  const conf = getElementConfig(this);
6045
6427
  const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
@@ -6064,13 +6446,9 @@ var dooboostoreSimpleWebComponent = (() => {
6064
6446
  });
6065
6447
  };
6066
6448
  }
6067
- var findAllAttributeMetadata = (target) => {
6068
- return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
6069
- };
6070
6449
  function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
6071
6450
  if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
6072
- const fieldName = String(propertyKeyOrOptions);
6073
- return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
6451
+ return attribute(":host", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
6074
6452
  }
6075
6453
  if (typeof targetOrAttrOrOptions === "string") {
6076
6454
  const attrName = targetOrAttrOrOptions;
@@ -6079,19 +6457,20 @@ var dooboostoreSimpleWebComponent = (() => {
6079
6457
  } else if (typeof targetOrAttrOrOptions === "object") {
6080
6458
  const options = targetOrAttrOrOptions;
6081
6459
  return (target, propertyKey) => {
6082
- const fieldName = String(propertyKey);
6083
- return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
6460
+ return attribute(":host", { ...options, name: String(propertyKey) })(target, propertyKey);
6084
6461
  };
6085
6462
  } else {
6086
6463
  return (target, propertyKey) => {
6087
- const fieldName = String(propertyKey);
6088
- return attribute(":host", { name: fieldName })(target, propertyKey);
6464
+ return attribute(":host", { name: String(propertyKey) })(target, propertyKey);
6089
6465
  };
6090
6466
  }
6091
6467
  }
6468
+ var findAllAttributeMetadata = (target) => {
6469
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
6470
+ };
6092
6471
 
6093
6472
  // src/decorators/changedAttributeHost.ts
6094
- var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol("simple-web-component:on-attribute-changed");
6473
+ var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
6095
6474
  function changedAttributeHost(attributeName) {
6096
6475
  return (target, propertyKey) => {
6097
6476
  const constructor = target.constructor;
@@ -6117,102 +6496,43 @@ var dooboostoreSimpleWebComponent = (() => {
6117
6496
  return ReflectUtils.findAllMapMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, target);
6118
6497
  };
6119
6498
 
6120
- // src/decorators/setAttribute.ts
6121
- var SET_ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:set-attribute");
6122
- function setAttribute(selector, name, options = {}) {
6123
- return (target, propertyKey, descriptor) => {
6124
- const constructor = target.constructor;
6125
- let metaList = ReflectUtils.getOwnMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
6126
- if (!metaList) {
6127
- metaList = /* @__PURE__ */ new Map();
6128
- ReflectUtils.defineMetadata(SET_ATTRIBUTE_METADATA_KEY, metaList, constructor);
6129
- }
6130
- metaList.set(propertyKey, { propertyKey, selector, name, options });
6131
- const original = descriptor.value;
6132
- descriptor.value = async function(...args) {
6133
- ensureInit2(this);
6134
- const res = await original.apply(this, args);
6135
- if (res !== void 0) {
6136
- const hostSet = SwcUtils.getHostSet(this);
6137
- const conf = getElementConfig(this);
6138
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6139
- const targetEls = [];
6140
- const r = options.root || "auto";
6141
- const applyRoot = (t) => {
6142
- if (!t) return;
6143
- if (r === "auto") {
6144
- targetEls.push(t);
6145
- } else {
6146
- if (r === "light" || r === "all") targetEls.push(t);
6147
- if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
6148
- }
6149
- };
6150
- if (selector === ":window") targetEls.push(currentWin);
6151
- else if (selector === ":document") targetEls.push(currentWin.document);
6152
- else if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6153
- else if (selector === ":appHost") applyRoot(hostSet.$appHost);
6154
- else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
6155
- else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
6156
- else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
6157
- else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6158
- else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6159
- else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6160
- else if (selector === ":host" || !selector) applyRoot(this);
6161
- else {
6162
- const roots = [];
6163
- if (r === "shadow") {
6164
- if (this.shadowRoot) roots.push(this.shadowRoot);
6165
- } else if (r === "light") {
6166
- roots.push(this);
6167
- } else if (r === "all") {
6168
- roots.push(this);
6169
- if (this.shadowRoot) roots.push(this.shadowRoot);
6170
- } else {
6171
- roots.push(this.shadowRoot || this);
6172
- }
6173
- roots.forEach((root) => targetEls.push(...root.querySelectorAll(selector)));
6174
- }
6175
- targetEls.forEach((targetEl) => {
6176
- if (!targetEl || typeof targetEl.setAttribute !== "function") return;
6177
- if (res === null) targetEl.removeAttribute(name);
6178
- else targetEl.setAttribute(name, String(res));
6179
- });
6180
- }
6181
- return res;
6182
- };
6183
- };
6184
- }
6185
- var getSetAttributeMetadata = (target) => {
6186
- const constructor = target instanceof Function ? target : target.constructor;
6187
- return ReflectUtils.getMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
6188
- };
6189
- var findAllSetAttributeMetadata = (target) => {
6190
- const result = /* @__PURE__ */ new Map();
6191
- const maps = ReflectUtils.findAllMetadata(SET_ATTRIBUTE_METADATA_KEY, target);
6192
- maps.forEach((map) => {
6193
- if (map instanceof Map) {
6194
- map.forEach((v, k) => result.set(k, v));
6195
- }
6196
- });
6197
- return result;
6198
- };
6199
- function setAttributeHost(name, options) {
6200
- return setAttribute(":host", name, options);
6201
- }
6202
-
6203
6499
  // src/decorators/applyNode.ts
6204
- var APPLY_NODE_METADATA_KEY = Symbol("simple-web-component:apply-node");
6500
+ var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
6205
6501
  var normalizeNodes = (res, doc) => {
6206
6502
  const items = Array.isArray(res) ? res : [res];
6207
6503
  return items.map((it) => {
6208
- if (it instanceof Node)
6209
- return it;
6504
+ if (it instanceof Node) return it;
6210
6505
  return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
6211
6506
  });
6212
6507
  };
6508
+ var applyToDom = (targetEl, res, pos, doc) => {
6509
+ if (!targetEl) return;
6510
+ if (pos === "innerHtml") {
6511
+ targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6512
+ return;
6513
+ }
6514
+ if (pos === "innerText") {
6515
+ if (targetEl.innerText !== void 0) {
6516
+ targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6517
+ }
6518
+ return;
6519
+ }
6520
+ const isShadowRoot = targetEl instanceof ShadowRoot;
6521
+ const nodes = normalizeNodes(res, doc);
6522
+ if (pos === "replace") {
6523
+ if (!isShadowRoot) targetEl.replaceWith(...nodes);
6524
+ } else if (pos === "replaceChildren") {
6525
+ targetEl.replaceChildren(...nodes);
6526
+ } else {
6527
+ if (pos === "beforeEnd") targetEl.append(...nodes);
6528
+ else if (pos === "afterBegin") targetEl.prepend(...nodes);
6529
+ else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
6530
+ else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
6531
+ }
6532
+ };
6213
6533
  function applyNode(selector, options = { position: "beforeEnd" }) {
6214
- return (target, propertyKey, descriptor) => {
6215
- const constructor = target.constructor;
6534
+ return (targetObj, propertyKey, descriptor) => {
6535
+ const constructor = targetObj.constructor;
6216
6536
  let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
6217
6537
  if (!metaList) {
6218
6538
  metaList = /* @__PURE__ */ new Map();
@@ -6220,94 +6540,58 @@ var dooboostoreSimpleWebComponent = (() => {
6220
6540
  }
6221
6541
  metaList.set(propertyKey, { propertyKey, selector, options });
6222
6542
  const original = descriptor.value;
6223
- descriptor.value = async function(...args) {
6543
+ descriptor.value = function(...args) {
6224
6544
  ensureInit2(this);
6225
- const res = await original.apply(this, args);
6226
- if (res !== void 0) {
6227
- const conf = getElementConfig(this);
6228
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6229
- const currentDoc = currentWin.document;
6230
- const pos = options.position || "beforeEnd";
6545
+ const conf = getElementConfig(this);
6546
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6547
+ const currentDoc = currentWin.document;
6548
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
6549
+ const getTarget = () => {
6231
6550
  const r = options.root || "auto";
6232
6551
  const applyRoot = (t) => {
6233
- if (!t || !(t instanceof HTMLElement))
6234
- return t;
6235
- if (r === "auto")
6236
- return t.shadowRoot || t;
6237
- if (r === "shadow")
6238
- return t.shadowRoot;
6239
- if (r === "light")
6240
- return t;
6241
- if (r === "all")
6242
- return t.shadowRoot || t;
6552
+ if (!t) return t;
6553
+ if (r === "auto") return t.shadowRoot || t;
6554
+ if (r === "shadow") return t.shadowRoot;
6555
+ if (r === "light") return t;
6556
+ if (r === "all") return t.shadowRoot || t;
6243
6557
  return t;
6244
6558
  };
6245
- const hostSet = SwcUtils.getHostSet(this);
6246
- if (pos === "remove") {
6247
- if (res) {
6248
- if (selector === ":host" || !selector) {
6249
- if (r === "shadow" && this.shadowRoot) {
6250
- this.shadowRoot.replaceChildren();
6251
- } else {
6252
- this.remove();
6253
- }
6254
- } else {
6255
- const targetRoot = applyRoot(this);
6256
- if (targetRoot) {
6257
- const targets = targetRoot.querySelectorAll(selector);
6258
- targets.forEach((el) => el.remove());
6259
- }
6260
- }
6261
- }
6262
- } else {
6263
- let targetEl = null;
6264
- if (selector === ":host") {
6265
- targetEl = applyRoot(this);
6266
- } else if (selector === ":parentHost") {
6267
- targetEl = applyRoot(hostSet.$parentHost);
6268
- } else if (selector === ":appHost") {
6269
- targetEl = applyRoot(hostSet.$appHost);
6270
- } else if (selector === ":firstHost") {
6271
- targetEl = applyRoot(hostSet.$firstHost);
6272
- } else if (selector === ":lastHost") {
6273
- targetEl = applyRoot(hostSet.$lastHost);
6274
- } else if (selector === ":firstAppHost") {
6275
- targetEl = applyRoot(hostSet.$firstHost);
6276
- } else if (selector === ":lastAppHost") {
6277
- targetEl = applyRoot(hostSet.$lastAppHost);
6278
- } else {
6279
- const targetRoot = applyRoot(this);
6280
- targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
6281
- }
6282
- if (targetEl) {
6283
- const isShadowRoot = targetEl instanceof ShadowRoot;
6284
- const nodes = normalizeNodes(res, currentDoc);
6285
- if (pos === "replace") {
6286
- if (!isShadowRoot) {
6287
- targetEl.replaceWith(...nodes);
6288
- }
6289
- } else if (pos === "replaceChildren") {
6290
- targetEl.replaceChildren(...nodes);
6291
- } else if (pos === "innerHtml") {
6292
- targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
6293
- } else if (pos === "innerText") {
6294
- if (targetEl.innerText !== void 0) {
6295
- targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
6296
- }
6297
- } else {
6298
- if (pos === "beforeEnd")
6299
- targetEl.append(...nodes);
6300
- else if (pos === "afterBegin")
6301
- targetEl.prepend(...nodes);
6302
- else if (pos === "beforeBegin" && !isShadowRoot)
6303
- targetEl.before(...nodes);
6304
- else if (pos === "afterEnd" && !isShadowRoot)
6305
- targetEl.after(...nodes);
6306
- }
6307
- }
6559
+ if (selector === ":host") return applyRoot(this);
6560
+ if (selector === ":parentHost") return applyRoot(hostSet.$parentHost);
6561
+ if (selector === ":appHost") return applyRoot(hostSet.$appHost);
6562
+ if (selector === ":firstHost") return applyRoot(hostSet.$firstHost);
6563
+ if (selector === ":lastHost") return applyRoot(hostSet.$lastHost);
6564
+ const targetRoot = applyRoot(this);
6565
+ return targetRoot ? targetRoot.querySelector(selector) : null;
6566
+ };
6567
+ const targetEl = getTarget();
6568
+ const res = original.apply(this, args);
6569
+ const runApply = (target, val) => {
6570
+ const pos = options.position || "beforeEnd";
6571
+ const defaultFilter = (t, v) => {
6572
+ if (v instanceof Node) return !t.contains(v);
6573
+ if (pos === "innerHtml" && typeof v === "string") return t.innerHTML !== v;
6574
+ if (pos === "replaceChildren" && v instanceof Node) return !t.contains(v);
6575
+ return true;
6576
+ };
6577
+ const activeFilter = options.filter || defaultFilter;
6578
+ if (activeFilter(target, val, hostSet)) {
6579
+ applyToDom(target, val, pos, currentDoc);
6308
6580
  }
6581
+ };
6582
+ if (res instanceof Promise) {
6583
+ if (targetEl && options.loading) {
6584
+ const loadingRes = options.loading.call(this, hostSet);
6585
+ applyToDom(targetEl, loadingRes, options.position || "beforeEnd", currentDoc);
6586
+ }
6587
+ return res.then((finalRes) => {
6588
+ if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
6589
+ return finalRes;
6590
+ });
6591
+ } else {
6592
+ if (res !== void 0 && targetEl) runApply(targetEl, res);
6593
+ return res;
6309
6594
  }
6310
- return res;
6311
6595
  };
6312
6596
  };
6313
6597
  }
@@ -6322,110 +6606,29 @@ var dooboostoreSimpleWebComponent = (() => {
6322
6606
  return result;
6323
6607
  };
6324
6608
  function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
6325
- console.log("vvvvv");
6326
- if (propertyKey !== void 0 && typeof propertyKey === "string" || typeof propertyKey === "symbol") {
6327
- return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
6328
- }
6329
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
6330
- const options = targetOrOptions;
6331
- return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
6332
- } else {
6333
- return applyNode(":host", { position: "beforeEnd" });
6334
- }
6335
- }
6336
- function applyBeforeBeginNode(selector, options) {
6337
- return applyNode(selector, { ...options, position: "beforeBegin" });
6338
- }
6339
- function applyAfterBeginNode(selector, options) {
6340
- return applyNode(selector, { ...options, position: "afterBegin" });
6609
+ if (propertyKey !== void 0) return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
6610
+ const opt = targetOrOptions || {};
6611
+ return applyNode(":host", { position: "beforeEnd", ...opt });
6341
6612
  }
6342
- function applyBeforeEndNode(selector, options) {
6343
- return applyNode(selector, { ...options, position: "beforeEnd" });
6613
+ function applyReplaceChildrenNodeHost(targetOrOptions, propertyKey, descriptor) {
6614
+ if (propertyKey !== void 0) return applyNode(":host", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
6615
+ const opt = targetOrOptions || {};
6616
+ return applyNode(":host", { position: "replaceChildren", ...opt });
6344
6617
  }
6345
- function applyAfterEndNode(selector, options) {
6346
- return applyNode(selector, { ...options, position: "afterEnd" });
6618
+ function applyInnerHtmlNodeHost(targetOrOptions, propertyKey, descriptor) {
6619
+ if (propertyKey !== void 0) return applyNode(":host", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
6620
+ const opt = targetOrOptions || {};
6621
+ return applyNode(":host", { position: "innerHtml", ...opt });
6347
6622
  }
6348
- function applyReplaceNode(selector, options) {
6349
- return applyNode(selector, { ...options, position: "replace" });
6350
- }
6351
- function applyReplaceChildrenNode(selector, options) {
6623
+ function applyReplaceChildrenNode(selector, options = {}) {
6352
6624
  return applyNode(selector, { ...options, position: "replaceChildren" });
6353
6625
  }
6354
- function applyInnerHtmlNode(selector, options) {
6626
+ function applyInnerHtmlNode(selector, options = {}) {
6355
6627
  return applyNode(selector, { ...options, position: "innerHtml" });
6356
6628
  }
6357
- function applyInnerTextNode(selector, options) {
6358
- return applyNode(selector, { ...options, position: "innerText" });
6359
- }
6360
- function applyRemoveNode(selector, options) {
6361
- return applyNode(selector, { ...options, position: "remove" });
6362
- }
6363
- function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
6364
- if (propertyKey !== void 0) {
6365
- const decorator = applyNode(":host", { position: "beforeBegin" });
6366
- return decorator(targetOrOptions, propertyKey, descriptor);
6367
- }
6368
- return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
6369
- }
6370
- function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
6371
- if (propertyKey !== void 0) {
6372
- const decorator = applyNode(":host", { position: "afterBegin" });
6373
- return decorator(optionsOrTarget, propertyKey, descriptor);
6374
- }
6375
- return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
6376
- }
6377
- function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6378
- if (propertyKey !== void 0) {
6379
- const decorator = applyNode(":host", { position: "beforeEnd" });
6380
- return decorator(optionsOrTarget, propertyKey, descriptor);
6381
- }
6382
- return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
6383
- }
6384
- function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
6385
- if (propertyKey !== void 0) {
6386
- const decorator = applyNode(":host", { position: "afterEnd" });
6387
- return decorator(optionsOrTarget, propertyKey, descriptor);
6388
- }
6389
- return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
6390
- }
6391
- function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
6392
- if (propertyKey !== void 0) {
6393
- const decorator = applyNode(":host", { position: "replace" });
6394
- return decorator(optionsOrTarget, propertyKey, descriptor);
6395
- }
6396
- return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
6397
- }
6398
- function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
6399
- if (propertyKey !== void 0) {
6400
- const decorator = applyNode(":host", { position: "replaceChildren" });
6401
- return decorator(optionsOrTarget, propertyKey, descriptor);
6402
- }
6403
- return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
6404
- }
6405
- function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
6406
- if (propertyKey !== void 0) {
6407
- const decorator = applyNode(":host", { position: "innerHtml" });
6408
- return decorator(optionsOrTarget, propertyKey, descriptor);
6409
- }
6410
- return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
6411
- }
6412
- function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
6413
- if (propertyKey !== void 0) {
6414
- const decorator = applyNode(":host", { position: "innerText" });
6415
- return decorator(optionsOrTarget, propertyKey, descriptor);
6416
- }
6417
- return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
6418
- }
6419
- function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
6420
- if (propertyKey !== void 0) {
6421
- const decorator = applyNode(":host", { position: "remove" });
6422
- return decorator(optionsOrTarget, propertyKey, descriptor);
6423
- }
6424
- return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
6425
- }
6426
6629
 
6427
6630
  // src/decorators/query.ts
6428
- var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
6631
+ var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
6429
6632
  function query(selectorOrTarget, options = {}) {
6430
6633
  return (targetObj, propertyKey, descriptor) => {
6431
6634
  if (descriptor !== void 0) {
@@ -6596,7 +6799,7 @@ var dooboostoreSimpleWebComponent = (() => {
6596
6799
  }
6597
6800
 
6598
6801
  // src/decorators/queryAll.ts
6599
- var QUERY_ALL_METADATA_KEY = Symbol("simple-web-component:query-all");
6802
+ var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
6600
6803
  function queryAll(selectorOrTarget, options = {}) {
6601
6804
  return (targetObj, propertyKey, descriptor) => {
6602
6805
  if (descriptor !== void 0) {
@@ -6763,35 +6966,38 @@ var dooboostoreSimpleWebComponent = (() => {
6763
6966
  }
6764
6967
  }
6765
6968
 
6766
- // src/decorators/classList.ts
6767
- var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
6768
- function createClassListDecorator(action) {
6769
- return (selector, options = {}) => {
6969
+ // src/decorators/applyClass.ts
6970
+ var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
6971
+ function createClassDecorator(action) {
6972
+ return (selector, classMapOrOptions, options = {}) => {
6770
6973
  return (target, propertyKey, descriptor) => {
6771
6974
  const constructor = target.constructor;
6772
- let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
6975
+ let metaList = ReflectUtils.getOwnMetadata(CLASS_METADATA_KEY, constructor);
6773
6976
  if (!metaList) {
6774
6977
  metaList = /* @__PURE__ */ new Map();
6775
- ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
6978
+ ReflectUtils.defineMetadata(CLASS_METADATA_KEY, metaList, constructor);
6776
6979
  }
6777
- metaList.set(propertyKey, { propertyKey, selector, action, options });
6980
+ let classMap = void 0;
6981
+ let finalOptions = options;
6982
+ if (typeof classMapOrOptions === "string" || typeof classMapOrOptions === "object" && classMapOrOptions !== null && !("root" in classMapOrOptions)) {
6983
+ classMap = classMapOrOptions;
6984
+ } else if (typeof classMapOrOptions === "object" && classMapOrOptions !== null && "root" in classMapOrOptions) {
6985
+ finalOptions = classMapOrOptions;
6986
+ }
6987
+ metaList.set(propertyKey, { propertyKey, selector, action, options: finalOptions });
6778
6988
  const original = descriptor.value;
6779
6989
  descriptor.value = async function(...args) {
6780
6990
  ensureInit2(this);
6781
6991
  const res = await original.apply(this, args);
6782
6992
  if (res !== void 0) {
6783
- const r = options.root || "auto";
6784
- const hostSet = SwcUtils.getHostSet(this);
6993
+ const win = this.ownerDocument?.defaultView || window;
6994
+ const host2 = this;
6995
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6996
+ const r = finalOptions.root || "auto";
6785
6997
  const targetEls = [];
6786
6998
  const applyRoot = (t) => {
6787
- if (!t || !(t instanceof HTMLElement)) return;
6788
- if (r === "auto") {
6789
- targetEls.push(t);
6790
- } else {
6791
- if (r === "light" || r === "all") targetEls.push(t);
6792
- if ((r === "shadow" || r === "all") && t.shadowRoot) {
6793
- }
6794
- }
6999
+ if (!t || !(t instanceof win.HTMLElement)) return;
7000
+ targetEls.push(t);
6795
7001
  };
6796
7002
  if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6797
7003
  else if (selector === ":appHost") applyRoot(hostSet.$appHost);
@@ -6801,102 +7007,84 @@ var dooboostoreSimpleWebComponent = (() => {
6801
7007
  else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6802
7008
  else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6803
7009
  else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6804
- else if (selector === ":host" || !selector) applyRoot(this);
7010
+ else if (selector === ":host" || !selector) applyRoot(host2);
6805
7011
  else {
6806
- if (r === "shadow") {
6807
- const found = this.shadowRoot?.querySelectorAll(selector);
6808
- if (found) targetEls.push(...Array.from(found));
6809
- } else if (r === "light") {
6810
- const found = this.querySelectorAll(selector);
6811
- if (found) targetEls.push(...Array.from(found));
6812
- } else if (r === "all") {
6813
- const sFound = this.shadowRoot?.querySelectorAll(selector);
6814
- const lFound = this.querySelectorAll(selector);
6815
- if (sFound) targetEls.push(...Array.from(sFound));
6816
- if (lFound) targetEls.push(...Array.from(lFound));
6817
- } else {
6818
- const found = (this.shadowRoot || this).querySelectorAll(selector);
7012
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
7013
+ if (targetRoot) {
7014
+ const found = targetRoot.querySelectorAll(selector);
6819
7015
  if (found) targetEls.push(...Array.from(found));
6820
7016
  }
6821
7017
  }
6822
7018
  targetEls.forEach((targetEl) => {
7019
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
6823
7020
  if (action === "set") {
6824
7021
  let classes = "";
6825
- if (typeof res === "object" && res !== null && !Array.isArray(res)) {
6826
- classes = Object.entries(res).filter(([_, force]) => !!force).map(([cls]) => cls).join(" ");
7022
+ if (classMap && typeof classMap === "string") {
7023
+ classes = resolvedRes ? classMap : "";
7024
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7025
+ classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
6827
7026
  } else {
6828
- classes = Array.isArray(res) ? res.join(" ") : String(res);
7027
+ classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
6829
7028
  }
6830
7029
  targetEl.className = classes;
6831
- } else if (action === "update") {
6832
- if (typeof res === "object" && res !== null && !Array.isArray(res)) {
6833
- Object.entries(res).forEach(([cls, force]) => {
6834
- targetEl.classList.toggle(cls, !!force);
7030
+ } else if (action === "update" || action === "toggle") {
7031
+ if (classMap && typeof classMap === "string") {
7032
+ targetEl.classList.toggle(classMap, !!resolvedRes);
7033
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7034
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
7035
+ const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
7036
+ targetEl.classList.toggle(cls, isActive);
6835
7037
  });
6836
- } else if (res !== void 0 && res !== null) {
6837
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6838
- targetEl.classList.add(...classes);
7038
+ } else {
7039
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
7040
+ if (action === "update") targetEl.classList.add(...classes);
7041
+ else classes.forEach((c) => targetEl.classList.toggle(c));
6839
7042
  }
6840
- } else if (action === "add") {
6841
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6842
- targetEl.classList.add(...classes);
6843
- } else if (action === "remove") {
6844
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6845
- targetEl.classList.remove(...classes);
6846
- } else if (action === "toggle") {
6847
- const classes = Array.isArray(res) ? res.map(String) : [String(res)];
6848
- classes.forEach((c) => targetEl.classList.toggle(c));
6849
- }
6850
- });
7043
+ } else if (action === "add" || action === "remove") {
7044
+ if (classMap && typeof classMap === "string" && !!resolvedRes) {
7045
+ if (action === "add") targetEl.classList.add(classMap);
7046
+ else targetEl.classList.remove(classMap);
7047
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7048
+ Object.entries(resolvedRes).forEach(([cls, force]) => {
7049
+ const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
7050
+ if (shouldExecute) {
7051
+ if (action === "add") targetEl.classList.add(cls);
7052
+ else targetEl.classList.remove(cls);
7053
+ }
7054
+ });
7055
+ } else {
7056
+ const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
7057
+ if (action === "add") targetEl.classList.add(...classes);
7058
+ else targetEl.classList.remove(...classes);
7059
+ }
7060
+ }
7061
+ });
6851
7062
  }
6852
7063
  return res;
6853
7064
  };
7065
+ return descriptor;
6854
7066
  };
6855
7067
  };
6856
7068
  }
6857
- var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
6858
- var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
6859
- var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
6860
- var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
6861
- var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
6862
- function setClassListHost(targetOrOptions, propertyKey, descriptor) {
6863
- if (propertyKey !== void 0) {
6864
- const decorator = createClassListDecorator("set")(":host", {});
6865
- return decorator(targetOrOptions, propertyKey, descriptor);
6866
- }
6867
- return createClassListDecorator("set")(":host", targetOrOptions || {});
6868
- }
6869
- function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
6870
- if (propertyKey !== void 0) {
6871
- const decorator = createClassListDecorator("update")(":host", {});
6872
- return decorator(targetOrOptions, propertyKey, descriptor);
6873
- }
6874
- return createClassListDecorator("update")(":host", targetOrOptions || {});
6875
- }
6876
- function addClassListHost(targetOrOptions, propertyKey, descriptor) {
6877
- if (propertyKey !== void 0) {
6878
- const decorator = createClassListDecorator("add")(":host", {});
6879
- return decorator(targetOrOptions, propertyKey, descriptor);
6880
- }
6881
- return createClassListDecorator("add")(":host", targetOrOptions || {});
6882
- }
6883
- function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
6884
- if (propertyKey !== void 0) {
6885
- const decorator = createClassListDecorator("remove")(":host", {});
6886
- return decorator(targetOrOptions, propertyKey, descriptor);
6887
- }
6888
- return createClassListDecorator("remove")(":host", targetOrOptions || {});
7069
+ function applyClass(selector, action = "update", options = {}) {
7070
+ return createClassDecorator(action)(selector, options);
6889
7071
  }
6890
- function toggleClassListHost(targetOrOptions, propertyKey, descriptor) {
6891
- if (propertyKey !== void 0) {
6892
- const decorator = createClassListDecorator("toggle")(":host", {});
6893
- return decorator(targetOrOptions, propertyKey, descriptor);
6894
- }
6895
- return createClassListDecorator("toggle")(":host", targetOrOptions || {});
7072
+ var setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
7073
+ var updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
7074
+ var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
7075
+ var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
7076
+ var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
7077
+ function applyClassHost(action = "update", options = {}) {
7078
+ return createClassDecorator(action)(":host", options);
6896
7079
  }
6897
- var findAllClassListMetadata = (target) => {
7080
+ var setClassHost = (classMapOrOptions, options = {}) => createClassDecorator("set")(":host", classMapOrOptions, options);
7081
+ var updateClassHost = (classMapOrOptions, options = {}) => createClassDecorator("update")(":host", classMapOrOptions, options);
7082
+ var addClassHost = (classMapOrOptions, options = {}) => createClassDecorator("add")(":host", classMapOrOptions, options);
7083
+ var removeClassHost = (classMapOrOptions, options = {}) => createClassDecorator("remove")(":host", classMapOrOptions, options);
7084
+ var toggleClassHost = (classMapOrOptions, options = {}) => createClassDecorator("toggle")(":host", classMapOrOptions, options);
7085
+ var findAllClassMetadata = (target) => {
6898
7086
  const result = /* @__PURE__ */ new Map();
6899
- const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
7087
+ const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
6900
7088
  maps.forEach((map) => {
6901
7089
  if (map instanceof Map) {
6902
7090
  map.forEach((v, k) => result.set(k, v));
@@ -6905,8 +7093,8 @@ var dooboostoreSimpleWebComponent = (() => {
6905
7093
  return result;
6906
7094
  };
6907
7095
 
6908
- // src/decorators/style.ts
6909
- var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
7096
+ // src/decorators/applyStyle.ts
7097
+ var STYLE_METADATA_KEY = Symbol.for("simple-web-component:style");
6910
7098
  function createStyleDecorator(action) {
6911
7099
  return (selector, options = {}) => {
6912
7100
  return (target, propertyKey, descriptor) => {
@@ -6922,18 +7110,14 @@ var dooboostoreSimpleWebComponent = (() => {
6922
7110
  ensureInit2(this);
6923
7111
  const res = await original.apply(this, args);
6924
7112
  if (res !== void 0) {
7113
+ const win = this.ownerDocument?.defaultView || window;
7114
+ const host2 = this;
7115
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
6925
7116
  const r = options.root || "auto";
6926
- const hostSet = SwcUtils.getHostSet(this);
6927
7117
  const targetEls = [];
6928
7118
  const applyRoot = (t) => {
6929
- if (!t || !(t instanceof HTMLElement)) return;
6930
- if (r === "auto") {
6931
- targetEls.push(t);
6932
- } else {
6933
- if (r === "light" || r === "all") targetEls.push(t);
6934
- if ((r === "shadow" || r === "all") && t.shadowRoot) {
6935
- }
6936
- }
7119
+ if (!t || !(t instanceof win.HTMLElement)) return;
7120
+ targetEls.push(t);
6937
7121
  };
6938
7122
  if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
6939
7123
  else if (selector === ":appHost") applyRoot(hostSet.$appHost);
@@ -6943,71 +7127,63 @@ var dooboostoreSimpleWebComponent = (() => {
6943
7127
  else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
6944
7128
  else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
6945
7129
  else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
6946
- else if (selector === ":host" || !selector) applyRoot(this);
7130
+ else if (selector === ":host" || !selector) applyRoot(host2);
6947
7131
  else {
6948
- if (r === "shadow") {
6949
- const found = this.shadowRoot?.querySelectorAll(selector);
6950
- if (found) targetEls.push(...Array.from(found));
6951
- } else if (r === "light") {
6952
- const found = this.querySelectorAll(selector);
6953
- if (found) targetEls.push(...Array.from(found));
6954
- } else if (r === "all") {
6955
- const sFound = this.shadowRoot?.querySelectorAll(selector);
6956
- const lFound = this.querySelectorAll(selector);
6957
- if (sFound) targetEls.push(...Array.from(sFound));
6958
- if (lFound) targetEls.push(...Array.from(lFound));
6959
- } else {
6960
- const found = (this.shadowRoot || this).querySelectorAll(selector);
7132
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
7133
+ if (targetRoot) {
7134
+ const found = targetRoot.querySelectorAll(selector);
6961
7135
  if (found) targetEls.push(...Array.from(found));
6962
7136
  }
6963
7137
  }
6964
7138
  targetEls.forEach((targetEl) => {
6965
- if (action === "set") {
6966
- targetEl.style.cssText = "";
6967
- if (typeof res === "object" && res !== null) {
6968
- Object.assign(targetEl.style, res);
6969
- } else if (typeof res === "string") {
6970
- targetEl.style.cssText = res;
6971
- }
6972
- } else if (action === "update") {
6973
- if (typeof res === "object" && res !== null) {
6974
- Object.assign(targetEl.style, res);
7139
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
7140
+ if (action === "set" || action === "update") {
7141
+ if (action === "set") targetEl.style.cssText = "";
7142
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7143
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
7144
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
7145
+ if (finalVal === null || finalVal === void 0) {
7146
+ targetEl.style.removeProperty(prop);
7147
+ } else {
7148
+ targetEl.style[prop] = String(finalVal);
7149
+ }
7150
+ });
7151
+ } else if (typeof resolvedRes === "string") {
7152
+ targetEl.style.cssText = resolvedRes;
6975
7153
  }
6976
7154
  } else if (action === "remove") {
6977
- const props = Array.isArray(res) ? res : [res];
6978
- props.forEach((p) => targetEl.style.removeProperty(String(p)));
7155
+ if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7156
+ Object.entries(resolvedRes).forEach(([prop, val]) => {
7157
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
7158
+ if (shouldRemove) {
7159
+ targetEl.style.removeProperty(prop);
7160
+ }
7161
+ });
7162
+ } else {
7163
+ const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
7164
+ props.forEach((p) => targetEl.style.removeProperty(String(p)));
7165
+ }
6979
7166
  }
6980
7167
  });
6981
7168
  }
6982
7169
  return res;
6983
7170
  };
7171
+ return descriptor;
6984
7172
  };
6985
7173
  };
6986
7174
  }
6987
- var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6988
- function setStyleHost(targetOrOptions, propertyKey, descriptor) {
6989
- if (propertyKey !== void 0) {
6990
- const decorator = createStyleDecorator("set")(":host", {});
6991
- return decorator(targetOrOptions, propertyKey, descriptor);
6992
- }
6993
- return createStyleDecorator("set")(":host", targetOrOptions || {});
7175
+ function applyStyle(selector, action = "update", options = {}) {
7176
+ return createStyleDecorator(action)(selector, options);
6994
7177
  }
7178
+ var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
6995
7179
  var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
6996
- function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
6997
- if (propertyKey !== void 0) {
6998
- const decorator = createStyleDecorator("update")(":host", {});
6999
- return decorator(targetOrOptions, propertyKey, descriptor);
7000
- }
7001
- return createStyleDecorator("update")(":host", targetOrOptions || {});
7002
- }
7003
7180
  var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
7004
- function removeStyleHost(targetOrOptions, propertyKey, descriptor) {
7005
- if (propertyKey !== void 0) {
7006
- const decorator = createStyleDecorator("remove")(":host", {});
7007
- return decorator(targetOrOptions, propertyKey, descriptor);
7008
- }
7009
- return createStyleDecorator("remove")(":host", targetOrOptions || {});
7181
+ function applyStyleHost(action = "update", options = {}) {
7182
+ return createStyleDecorator(action)(":host", options);
7010
7183
  }
7184
+ var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
7185
+ var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
7186
+ var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
7011
7187
  var findAllStyleMetadata = (target) => {
7012
7188
  const result = /* @__PURE__ */ new Map();
7013
7189
  const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
@@ -7019,8 +7195,123 @@ var dooboostoreSimpleWebComponent = (() => {
7019
7195
  return result;
7020
7196
  };
7021
7197
 
7198
+ // src/decorators/applyAttribute.ts
7199
+ var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
7200
+ function createAttributeDecorator(action) {
7201
+ return (selector, nameOrOptions, options = {}) => {
7202
+ return (target, propertyKey, descriptor) => {
7203
+ const constructor = target.constructor;
7204
+ let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
7205
+ if (!metaList) {
7206
+ metaList = /* @__PURE__ */ new Map();
7207
+ ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
7208
+ }
7209
+ let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
7210
+ let finalOptions = options;
7211
+ if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
7212
+ finalOptions = nameOrOptions;
7213
+ }
7214
+ metaList.set(propertyKey, {
7215
+ propertyKey,
7216
+ selector,
7217
+ action,
7218
+ options: { ...finalOptions, name: attributeName }
7219
+ });
7220
+ const original = descriptor.value;
7221
+ descriptor.value = async function(...args) {
7222
+ ensureInit2(this);
7223
+ const res = await original.apply(this, args);
7224
+ if (res !== void 0) {
7225
+ const win = this.ownerDocument?.defaultView || window;
7226
+ const host2 = this;
7227
+ const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
7228
+ const r = finalOptions.root || "auto";
7229
+ const targetEls = [];
7230
+ const applyRoot = (t) => {
7231
+ if (!t || !(t instanceof win.HTMLElement)) return;
7232
+ targetEls.push(t);
7233
+ };
7234
+ if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
7235
+ else if (selector === ":appHost") applyRoot(hostSet.$appHost);
7236
+ else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
7237
+ else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
7238
+ else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
7239
+ else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
7240
+ else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
7241
+ else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
7242
+ else if (selector === ":host" || !selector) applyRoot(host2);
7243
+ else {
7244
+ const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
7245
+ if (targetRoot) {
7246
+ const found = targetRoot.querySelectorAll(selector);
7247
+ if (found) targetEls.push(...Array.from(found));
7248
+ }
7249
+ }
7250
+ targetEls.forEach((targetEl) => {
7251
+ const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
7252
+ if (action === "set" || action === "update") {
7253
+ if (attributeName) {
7254
+ if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
7255
+ targetEl.removeAttribute(attributeName);
7256
+ } else {
7257
+ targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
7258
+ }
7259
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7260
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
7261
+ const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
7262
+ if (finalVal === null || finalVal === void 0 || finalVal === false) {
7263
+ targetEl.removeAttribute(attr);
7264
+ } else {
7265
+ targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
7266
+ }
7267
+ });
7268
+ }
7269
+ } else if (action === "remove") {
7270
+ if (attributeName) {
7271
+ targetEl.removeAttribute(attributeName);
7272
+ } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
7273
+ Object.entries(resolvedRes).forEach(([attr, val]) => {
7274
+ const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
7275
+ if (shouldRemove) targetEl.removeAttribute(attr);
7276
+ });
7277
+ } else {
7278
+ const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
7279
+ attrs.forEach((a) => targetEl.removeAttribute(String(a)));
7280
+ }
7281
+ }
7282
+ });
7283
+ }
7284
+ return res;
7285
+ };
7286
+ return descriptor;
7287
+ };
7288
+ };
7289
+ }
7290
+ function applyAttribute(selector, action = "update", options = {}) {
7291
+ return createAttributeDecorator(action)(selector, options);
7292
+ }
7293
+ var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
7294
+ var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
7295
+ var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
7296
+ function applyAttributeHost(action = "update", options = {}) {
7297
+ return createAttributeDecorator(action)(":host", options);
7298
+ }
7299
+ var setAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("set")(":host", nameOrOptions, options);
7300
+ var updateAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("update")(":host", nameOrOptions, options);
7301
+ var removeAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("remove")(":host", nameOrOptions, options);
7302
+ var findAllAttributeApplyMetadata = (target) => {
7303
+ const result = /* @__PURE__ */ new Map();
7304
+ const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
7305
+ maps.forEach((map) => {
7306
+ if (map instanceof Map) {
7307
+ map.forEach((v, k) => result.set(k, v));
7308
+ }
7309
+ });
7310
+ return result;
7311
+ };
7312
+
7022
7313
  // src/utils/Utils.ts
7023
- var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
7314
+ var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
7024
7315
  var htmlFragment = (html, doc) => {
7025
7316
  const d = doc || (typeof document !== "undefined" ? document : void 0);
7026
7317
  if (!d) throw new Error("Document is not available");
@@ -7257,7 +7548,7 @@ var dooboostoreSimpleWebComponent = (() => {
7257
7548
  })(SwcUtils || (SwcUtils = {}));
7258
7549
 
7259
7550
  // src/decorators/emitCustomEvent.ts
7260
- var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol("simple-web-component:emit-custom-event");
7551
+ var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
7261
7552
  function emitCustomEvent(selectorOrTarget, type, options = {}) {
7262
7553
  return (targetObj, propertyKey, descriptor) => {
7263
7554
  const constructor = targetObj.constructor;
@@ -7326,7 +7617,10 @@ var dooboostoreSimpleWebComponent = (() => {
7326
7617
  const constructor = target instanceof Function ? target : target.constructor;
7327
7618
  return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
7328
7619
  };
7329
- function emitCustomEventHost(type, options) {
7620
+ function emitCustomEventHost(type, options = {}) {
7621
+ if (!options.attributeName) {
7622
+ options.attributeName = `on-emit-${type}`;
7623
+ }
7330
7624
  return emitCustomEvent(":host", type, options);
7331
7625
  }
7332
7626
 
@@ -7418,7 +7712,46 @@ var dooboostoreSimpleWebComponent = (() => {
7418
7712
  return this.containers.find(predicate);
7419
7713
  }
7420
7714
  };
7421
- var InjectMetadataKey = Symbol("Inject");
7715
+ var isTargetSymbol = (config) => {
7716
+ return "symbol" in config && config.symbol !== void 0;
7717
+ };
7718
+ var isTargetType = (config) => {
7719
+ return "type" in config && config.type !== void 0;
7720
+ };
7721
+ var isTargetScheme = (config) => {
7722
+ return "scheme" in config && config.scheme !== void 0;
7723
+ };
7724
+ var isTargetFactory = (config) => {
7725
+ return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7726
+ };
7727
+ var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7728
+ var injectProcess = (config, target, propertyKey, parameterIndex) => {
7729
+ if (propertyKey && typeof target === "object") {
7730
+ const otarget = target;
7731
+ target = target.constructor;
7732
+ const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
7733
+ const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
7734
+ saves.push({ index: parameterIndex, config, propertyKey, type });
7735
+ ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
7736
+ } else if (!propertyKey || typeof target === "function") {
7737
+ const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
7738
+ const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
7739
+ existingInjectdParameters.push({ index: parameterIndex, config, type });
7740
+ ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
7741
+ }
7742
+ };
7743
+ function Inject(configOrTarget, propertyKey, parameterIndex) {
7744
+ if (propertyKey && parameterIndex !== void 0) {
7745
+ injectProcess({}, configOrTarget, propertyKey, parameterIndex);
7746
+ } else {
7747
+ return (target, propertyKey2, parameterIndex2) => {
7748
+ injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
7749
+ };
7750
+ }
7751
+ }
7752
+ var getInject = (target, propertyKey) => {
7753
+ return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7754
+ };
7422
7755
 
7423
7756
  // src/types.ts
7424
7757
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7436,7 +7769,7 @@ var dooboostoreSimpleWebComponent = (() => {
7436
7769
  })(InjectSituationType || {});
7437
7770
 
7438
7771
  // src/decorators/elementDefine.ts
7439
- var ELEMENT_CONFIG_KEY = Symbol("simple-web-component:element-config");
7772
+ var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
7440
7773
  var getElementConfig = (target) => {
7441
7774
  const constructor = target instanceof Function ? target : target.constructor;
7442
7775
  return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
@@ -7551,7 +7884,6 @@ var dooboostoreSimpleWebComponent = (() => {
7551
7884
  const oldHandler = handlers.get(attrName);
7552
7885
  if (oldHandler) el.removeEventListener(eventName, oldHandler);
7553
7886
  const handler = async (event) => {
7554
- console.log("execute handler", event);
7555
7887
  const parent = SwcUtils.findNearestSwcHost(el);
7556
7888
  const hostSet = SwcUtils.getHostSet(parent || el);
7557
7889
  const conf = getElementConfig(this);
@@ -7572,7 +7904,6 @@ var dooboostoreSimpleWebComponent = (() => {
7572
7904
  };
7573
7905
  proto.__swc_executeAttributeEvent = async function(el, attrName, script, event) {
7574
7906
  ensureInit2(this);
7575
- console.log("execute handler2", event);
7576
7907
  const parent = SwcUtils.findNearestSwcHost(el);
7577
7908
  const hostSet = SwcUtils.getHostSet(parent || el);
7578
7909
  const conf = getElementConfig(this);
@@ -7612,12 +7943,22 @@ var dooboostoreSimpleWebComponent = (() => {
7612
7943
  const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
7613
7944
  const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === ":host" || meta.selector === "");
7614
7945
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
7615
- const addHostEventListenerList = addEventListenerList.filter((meta) => meta.selector === ":host" || meta.selector === "");
7616
7946
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
7617
7947
  const attributeList = findAllAttributeMetadata(constructor);
7948
+ const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
7618
7949
  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"];
7619
7950
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7620
- 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])];
7951
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7952
+ const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
7953
+ const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7954
+ ...metadata.observedAttributes ?? [],
7955
+ ...attrChangeMap.keys(),
7956
+ ...attributeApplyNames,
7957
+ ...attributeListNames,
7958
+ ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7959
+ ...swcLifecycleAttributes,
7960
+ ...swcOnEvents
7961
+ ])];
7621
7962
  const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
7622
7963
  const proto = constructor.prototype;
7623
7964
  setupPrototype(proto);
@@ -7636,7 +7977,6 @@ var dooboostoreSimpleWebComponent = (() => {
7636
7977
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7637
7978
  }
7638
7979
  attributeList.forEach((meta) => {
7639
- const attrName = meta.options.name || String(meta.propertyKey);
7640
7980
  if (meta.options.connectedInitialize === true) {
7641
7981
  this.__swc_syncing_init = true;
7642
7982
  try {
@@ -7776,22 +8116,6 @@ var dooboostoreSimpleWebComponent = (() => {
7776
8116
  }
7777
8117
  });
7778
8118
  });
7779
- addHostEventListenerList.forEach((meta) => {
7780
- const { type, options } = meta;
7781
- const opts = { capture: options.capture, once: options.once, passive: options.passive };
7782
- const handler = async (event) => {
7783
- if (options.stopPropagation) event.stopPropagation();
7784
- if (options.stopImmediatePropagation) event.stopImmediatePropagation();
7785
- if (options.preventDefault) event.preventDefault();
7786
- const currentHostSet = SwcUtils.getHostSet(this);
7787
- const args = { event, ...currentHostSet, $el: this, $root: this.getRootNode() };
7788
- await this[meta.propertyKey](event, currentHostSet, args);
7789
- };
7790
- this.addEventListener(type, handler, opts);
7791
- if (options.removeOnDisconnected === true) {
7792
- this._boundListeners.push({ target: this, type, handler, options: opts });
7793
- }
7794
- });
7795
8119
  if (originalConnected) originalConnected.apply(this);
7796
8120
  const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
7797
8121
  if (aMethods) {
@@ -7869,104 +8193,1692 @@ var dooboostoreSimpleWebComponent = (() => {
7869
8193
  return constructor;
7870
8194
  };
7871
8195
 
7872
- // ../simple-boot/dist/esm/decorators/SimDecorator.js
7873
- var SimMetadataKey = Symbol("Sim");
7874
- var PostConstructMetadataKey = Symbol("PostConstruct");
8196
+ // ../simple-boot/dist/esm/throwable/SimError.js
8197
+ var SimError = class {
8198
+ constructor(message, name, stack) {
8199
+ this.message = message;
8200
+ this.name = name;
8201
+ this.stack = stack;
8202
+ }
8203
+ };
7875
8204
 
7876
- // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
7877
- var AfterMetadataKey = Symbol("After");
7878
- var BeforeMetadataKey = Symbol("Before");
7879
- var AroundMetadataKey = Symbol("Around");
8205
+ // ../simple-boot/dist/esm/throwable/SimNoSuch.js
8206
+ var SimNoSuch = class extends SimError {
8207
+ constructor(message, name, stack) {
8208
+ super(message, name, stack);
8209
+ }
8210
+ };
7880
8211
 
7881
- // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
7882
- var ExceptionHandlerMetadataKey = Symbol("ExceptionHandler");
8212
+ // ../simple-boot/dist/esm/decorators/SimDecorator.js
8213
+ var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
8214
+ Lifecycle2["Singleton"] = "Singleton";
8215
+ Lifecycle2["Transient"] = "Transient";
8216
+ return Lifecycle2;
8217
+ })(Lifecycle || {});
8218
+ var sims = /* @__PURE__ */ new Map();
8219
+ var containers = /* @__PURE__ */ new Set();
8220
+ var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
8221
+ var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
8222
+ var simProcess = (config, inputTarget) => {
8223
+ const target = (() => {
8224
+ if (typeof inputTarget === "object") {
8225
+ return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
8226
+ }
8227
+ if (ValidUtils.isArrowFunction(inputTarget)) {
8228
+ return () => inputTarget();
8229
+ }
8230
+ return inputTarget;
8231
+ })();
8232
+ let targetType;
8233
+ if (isNotNullObjetInstance(target)) {
8234
+ targetType = target.constructor;
8235
+ } else {
8236
+ targetType = target;
8237
+ }
8238
+ config.scope = config?.scope ?? "Singleton";
8239
+ ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
8240
+ const adding = (targetKey, target2 = targetKey) => {
8241
+ const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
8242
+ items.add(target2);
8243
+ sims.set(targetKey, items);
8244
+ };
8245
+ if (Array.isArray(config?.type)) {
8246
+ config?.type.forEach((it) => {
8247
+ adding(it, target);
8248
+ });
8249
+ } else if (config.type) {
8250
+ adding(config?.type, target);
8251
+ } else {
8252
+ adding(target);
8253
+ }
8254
+ };
8255
+ function Sim(configOrTarget) {
8256
+ if (typeof configOrTarget === "function") {
8257
+ simProcess({}, configOrTarget);
8258
+ } else {
8259
+ return (target) => {
8260
+ simProcess(configOrTarget, target);
8261
+ };
8262
+ }
8263
+ }
8264
+ var getSim = (target) => {
8265
+ if (target != null && target !== void 0 && typeof target === "object") {
8266
+ target = Object.getPrototypeOf(target).constructor;
8267
+ }
8268
+ try {
8269
+ return ReflectUtils.getMetadata(SimMetadataKey, target);
8270
+ } catch (e) {
8271
+ }
8272
+ };
8273
+ var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
8274
+ var getPostConstructs = (target) => {
8275
+ return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
8276
+ };
7883
8277
 
7884
- // ../simple-boot/dist/esm/decorators/SimNoProxy.js
7885
- var SimNoProxyKey = Symbol("Sim:NoProxy");
8278
+ // ../simple-boot/dist/esm/simstance/SimAtomic.js
8279
+ var SimAtomic = class {
8280
+ constructor(type, simstanceManager, config) {
8281
+ this.type = type;
8282
+ this.simstanceManager = simstanceManager;
8283
+ this.config = config;
8284
+ this.value = type.value;
8285
+ }
8286
+ getConfig(key = SimMetadataKey) {
8287
+ return ReflectUtils.getMetadata(key, this.type.originalType);
8288
+ }
8289
+ getConfigs() {
8290
+ return ReflectUtils.getMetadatas(this.type.originalType);
8291
+ }
8292
+ getValue(config) {
8293
+ if (config?.refresh) {
8294
+ this.value = void 0;
8295
+ }
8296
+ if (!this.value) {
8297
+ if (typeof this.type.targetKeyType === "symbol") {
8298
+ this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
8299
+ } else {
8300
+ this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
8301
+ }
8302
+ }
8303
+ return this.value;
8304
+ }
8305
+ };
7886
8306
 
7887
- // ../simple-boot/dist/esm/decorators/inject/Injection.js
7888
- var InjectionMetadataKey = Symbol("Injection");
8307
+ // ../simple-boot/dist/esm/SimOption.js
8308
+ var SimOption = class {
8309
+ constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
8310
+ this.rootRouter = rootRouter;
8311
+ this.container = container;
8312
+ this.advice = advice;
8313
+ this.excludeProxys = excludeProxys;
8314
+ this.proxy = proxy;
8315
+ this.using = using;
8316
+ this.cache = cache;
8317
+ }
8318
+ addAdvicce(advice) {
8319
+ this.advice ?? (this.advice = []);
8320
+ this.advice.push(advice);
8321
+ }
8322
+ setAdvice(...advice) {
8323
+ this.advice = advice;
8324
+ return this;
8325
+ }
8326
+ };
7889
8327
 
7890
- // ../simple-boot/dist/esm/decorators/route/Router.js
7891
- var RouterMetadataKey = Symbol("Router");
7892
- var RouteMetadataKey = Symbol("RouteMetadataKey");
8328
+ // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
8329
+ var MetaDataAtomic = class {
8330
+ constructor(target, metaData) {
8331
+ this.target = target;
8332
+ this.metaData = metaData;
8333
+ }
8334
+ };
8335
+ var MetaDataPropertyAtomic = class extends MetaDataAtomic {
8336
+ constructor(target, metaData, property, parameter) {
8337
+ super(target, metaData);
8338
+ this.property = property;
8339
+ this.parameter = parameter;
8340
+ }
8341
+ call(...parameter) {
8342
+ return this.target[this.property](...parameter);
8343
+ }
8344
+ };
7893
8345
 
7894
- // ../simple-boot/dist/esm/route/RouterAction.js
7895
- var RouterAction;
7896
- ((RouterAction2) => {
7897
- RouterAction2.isCanActivate = (obj) => {
7898
- return typeof obj?.canActivate === "function";
7899
- };
7900
- RouterAction2.isOnRouting = (obj) => {
7901
- return typeof obj?.onRouting === "function";
7902
- };
7903
- RouterAction2.isHasActivate = (obj) => {
7904
- return typeof obj?.hasActivate === "function";
7905
- };
7906
- })(RouterAction || (RouterAction = {}));
8346
+ // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8347
+ var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
8348
+ var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
8349
+ var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
8350
+ var getAfter = (target, propertyKey) => {
8351
+ return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
8352
+ };
8353
+ var getAfters = (target) => {
8354
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8355
+ };
8356
+ var getProtoAfters = (target, propertyKey, type) => {
8357
+ return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8358
+ };
8359
+ var getBefore = (target, propertyKey) => {
8360
+ return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
8361
+ };
8362
+ var getBefores = (target) => {
8363
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8364
+ };
8365
+ var getProtoBefores = (target, propertyKey, type) => {
8366
+ return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8367
+ };
7907
8368
 
7908
- // ../core-web/dist/esm/element/CanvasUtils.js
7909
- var CanvasUtils;
7910
- ((CanvasUtils2) => {
7911
- let Context2D;
7912
- ((Context2D2) => {
7913
- Context2D2.resetTransform = (context) => {
7914
- context.setTransform(1, 0, 0, 1, 0, 0);
7915
- };
7916
- })(Context2D = CanvasUtils2.Context2D || (CanvasUtils2.Context2D = {}));
7917
- CanvasUtils2.fontSize = (ctx, config) => {
7918
- const { text, maxWidth, maxHeight, fontOption } = config;
7919
- if (!text || maxWidth <= 0 || maxHeight <= 0) {
7920
- return 0;
7921
- }
7922
- const lines = text.split("\n").filter((line) => line.trim().length > 0);
7923
- if (lines.length === 0) {
7924
- return 0;
7925
- }
7926
- const lineHeightMultiplier = 1.2;
7927
- const maxFontSizeByHeight = Math.floor(maxHeight / (lines.length * lineHeightMultiplier));
7928
- if (maxFontSizeByHeight <= 0) {
7929
- return 0;
8369
+ // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
8370
+ var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
8371
+ ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
8372
+ ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
8373
+ return ExceptionHandlerSituationType2;
8374
+ })(ExceptionHandlerSituationType || {});
8375
+ var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
8376
+ var getExceptionHandlers = (target) => {
8377
+ if (target !== null && void 0 !== target && typeof target === "object") {
8378
+ target = target.constructor;
8379
+ }
8380
+ return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
8381
+ };
8382
+ var targetExceptionHandlers = (target, error) => {
8383
+ const exceptionHandlers = getExceptionHandlers(target);
8384
+ const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
8385
+ const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
8386
+ const targetSorts = targets?.sort((a, b) => {
8387
+ const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
8388
+ const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
8389
+ return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
8390
+ });
8391
+ return (targetSorts ?? []).concat(...emptyTargets ?? []);
8392
+ };
8393
+ var targetExceptionHandler = (target, error, excludeMethods = []) => {
8394
+ let exceptionHandlers = targetExceptionHandlers(target, error);
8395
+ exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
8396
+ if (exceptionHandlers && exceptionHandlers.length > 0) {
8397
+ return exceptionHandlers[0];
8398
+ } else {
8399
+ return void 0;
8400
+ }
8401
+ };
8402
+
8403
+ // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
8404
+ var SimProxyHandler = class {
8405
+ constructor(simpleApplication, simstanceManager, simOption) {
8406
+ this.simpleApplication = simpleApplication;
8407
+ this.simstanceManager = simstanceManager;
8408
+ this.simOption = simOption;
8409
+ }
8410
+ // 잘받게 해놨네 ㅋㅋ simstanceManager
8411
+ get(target, name) {
8412
+ if (name === "_SimpleBoot_application") {
8413
+ return this.simpleApplication;
8414
+ } else if (name === "_SimpleBoot_simstanceManager") {
8415
+ return this.simstanceManager;
8416
+ } else if (name === "_SimpleBoot_simOption") {
8417
+ return this.simOption;
8418
+ } else if (name === "_SimpleBoot_origin") {
8419
+ return target;
8420
+ } else {
8421
+ return target[name];
7930
8422
  }
7931
- let minSizeForWidth = 1;
7932
- let maxSizeForWidth = maxFontSizeByHeight;
7933
- let bestSizeForWidth = 0;
7934
- const maxIterations = 100;
7935
- let iteration = 0;
7936
- while (minSizeForWidth <= maxSizeForWidth && iteration < maxIterations) {
7937
- const midSize = Math.floor((minSizeForWidth + maxSizeForWidth) / 2);
7938
- if (midSize === 0) break;
7939
- ctx.font = `${fontOption?.fontWeight || "normal"} ${midSize}px ${fontOption?.fontFamily || "sans-serif"}`;
7940
- const maxLineWidth = Math.max(...lines.map((line) => ctx.measureText(line).width));
7941
- if (maxLineWidth <= maxWidth) {
7942
- bestSizeForWidth = midSize;
7943
- minSizeForWidth = midSize + 1;
8423
+ }
8424
+ set(obj, prop, value, receiver) {
8425
+ value = this.simstanceManager?.proxy(value);
8426
+ obj[prop] = value;
8427
+ return true;
8428
+ }
8429
+ apply(target, thisArg, argumentsList) {
8430
+ let r;
8431
+ try {
8432
+ this.aopBefore(thisArg, target);
8433
+ try {
8434
+ r = Reflect.apply(target, thisArg, argumentsList);
8435
+ } catch (e) {
8436
+ throw e;
8437
+ } finally {
8438
+ this.aopAfter(thisArg, target);
8439
+ }
8440
+ } catch (e) {
8441
+ console.error(e);
8442
+ const inHandlers = this.getExceptionHandler(e, thisArg, target);
8443
+ if (inHandlers.length > 0 && inHandlers[0]) {
8444
+ const inHandler = inHandlers[0];
8445
+ this.executeExceptionHandler(e, inHandler, argumentsList);
7944
8446
  } else {
7945
- maxSizeForWidth = midSize - 1;
8447
+ throw e;
7946
8448
  }
7947
- iteration++;
7948
8449
  }
7949
- return Math.min(bestSizeForWidth, maxFontSizeByHeight);
7950
- };
7951
- CanvasUtils2.textMetrics = (context, text) => {
7952
- return context.measureText(text);
7953
- };
7954
- })(CanvasUtils || (CanvasUtils = {}));
7955
-
7956
- // ../core-web/dist/esm/element/ElementUtils.js
7957
- var ElementUtils;
7958
- ((ElementUtils2) => {
7959
- function removeAllChildren(el, els) {
7960
- if (!els) {
7961
- el.replaceChildren();
7962
- } else if (Array.isArray(els)) {
7963
- el.replaceChildren(...els);
7964
- } else {
7965
- el.replaceChildren(els);
8450
+ return r;
8451
+ }
8452
+ executeExceptionHandler(e, inHandler, argumentsList) {
8453
+ const otherStorage = /* @__PURE__ */ new Map();
8454
+ otherStorage.set(e.constructor, e);
8455
+ const situationErrorTypeContainer = new SituationTypeContainer({
8456
+ situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
8457
+ data: e
8458
+ });
8459
+ const situationParameterTypeContainer = new SituationTypeContainer({
8460
+ situationType: ExceptionHandlerSituationType.PARAMETER,
8461
+ data: argumentsList
8462
+ });
8463
+ otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
8464
+ argumentsList?.forEach((it) => {
8465
+ otherStorage.set(it.constructor, it);
8466
+ });
8467
+ try {
8468
+ this.simstanceManager.executeBindParameterSim(
8469
+ {
8470
+ target: inHandler.thisArg,
8471
+ targetKey: inHandler.config.propertyKey
8472
+ },
8473
+ otherStorage
8474
+ );
8475
+ } catch (es) {
8476
+ e = es;
8477
+ }
8478
+ if (inHandler.config.config.throw) {
8479
+ const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
8480
+ if ((exceptionHandler?.length ?? 0) > 0) {
8481
+ this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
8482
+ }
7966
8483
  }
7967
8484
  }
7968
- ElementUtils2.removeAllChildren = removeAllChildren;
7969
- function loadImage(src, callback) {
8485
+ getExceptionHandler(e, thisArg, target) {
8486
+ const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
8487
+ return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
8488
+ }) ?? [];
8489
+ const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
8490
+ const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
8491
+ return inHandlers;
8492
+ }
8493
+ aopBefore(obj, protoType) {
8494
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
8495
+ if (propertyName && obj) {
8496
+ getProtoBefores(obj, propertyName).forEach((it) => {
8497
+ it.call(obj, protoType, propertyName);
8498
+ });
8499
+ for (let i = 0; i < this.simOption.advice.length; i++) {
8500
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8501
+ const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
8502
+ protoBefores.forEach((it) => {
8503
+ it.call(obj, protoType, propertyName);
8504
+ });
8505
+ }
8506
+ }
8507
+ }
8508
+ aopAfter(obj, protoType) {
8509
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
8510
+ if (propertyName) {
8511
+ getProtoAfters(obj, propertyName).forEach((it) => {
8512
+ it.call(obj, protoType, propertyName);
8513
+ });
8514
+ for (let i = 0; i < this.simOption.advice.length; i++) {
8515
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8516
+ const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
8517
+ protoBefores.forEach((it) => {
8518
+ it.call(obj, protoType, propertyName);
8519
+ });
8520
+ }
8521
+ }
8522
+ }
8523
+ has(target, key) {
8524
+ if (key === "_SimpleBoot_isProxy") {
8525
+ return true;
8526
+ }
8527
+ return key in target;
8528
+ }
8529
+ };
8530
+
8531
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
8532
+ var isOnSimCreate = (obj) => {
8533
+ return typeof obj?.onSimCreate === "function";
8534
+ };
8535
+
8536
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
8537
+ var isOnSimCreateProxyCompleted = (obj) => {
8538
+ return typeof obj?.onSimCreateProxyCompleted === "function";
8539
+ };
8540
+
8541
+ // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8542
+ var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
8543
+ var getSimNoProxy = (target, propertyKey) => {
8544
+ try {
8545
+ if (propertyKey === void 0) {
8546
+ return Reflect.getMetadata(SimNoProxyKey, target);
8547
+ }
8548
+ return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
8549
+ } catch (e) {
8550
+ return void 0;
8551
+ }
8552
+ };
8553
+ var isSimNoProxy = (target, propertyKey) => {
8554
+ if (target === null || target === void 0) {
8555
+ return false;
8556
+ }
8557
+ return getSimNoProxy(target, propertyKey) === true;
8558
+ };
8559
+
8560
+ // ../simple-boot/dist/esm/simstance/SimstanceManager.js
8561
+ var SimstanceManager = class _SimstanceManager {
8562
+ // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
8563
+ constructor(simpleApplication, option) {
8564
+ this.simpleApplication = simpleApplication;
8565
+ this.option = option;
8566
+ this._storage = /* @__PURE__ */ new Map();
8567
+ this.name = "simstanceManager-" + RandomUtils.uuid4();
8568
+ this.setStoreSet(SimpleApplication, this.simpleApplication);
8569
+ this.setStoreSet(_SimstanceManager, this);
8570
+ this.setStoreSet(option.constructor, option);
8571
+ this.setStoreSet(SimOption, option);
8572
+ this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
8573
+ }
8574
+ get storage() {
8575
+ return this._storage;
8576
+ }
8577
+ getSimAtomics() {
8578
+ const r = [];
8579
+ Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
8580
+ r.push(
8581
+ ...Array.from(Array.from(targetMap.keys())).map(
8582
+ (sit) => new SimAtomic(
8583
+ {
8584
+ targetKeyType,
8585
+ originalType: sit
8586
+ },
8587
+ this
8588
+ )
8589
+ )
8590
+ );
8591
+ });
8592
+ return r;
8593
+ }
8594
+ getSimConfig(schemeOrSymbol) {
8595
+ const newVar = this.getSimAtomics().filter((it) => {
8596
+ const config = it?.getConfig();
8597
+ const symbols = ConvertUtils.flatArray(config?.symbol);
8598
+ const schemes = ConvertUtils.flatArray(config?.scheme);
8599
+ if (typeof schemeOrSymbol === "symbol") {
8600
+ return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
8601
+ } else if (typeof schemeOrSymbol === "string") {
8602
+ return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
8603
+ } else {
8604
+ return false;
8605
+ }
8606
+ }) || [];
8607
+ return newVar;
8608
+ }
8609
+ findSims(data) {
8610
+ let r = [];
8611
+ if (data) {
8612
+ const simAtomics = this.getSimAtomics();
8613
+ r = simAtomics.filter((it) => {
8614
+ let b = false;
8615
+ const config = it.getConfig();
8616
+ const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
8617
+ const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
8618
+ if (typeof data === "symbol") {
8619
+ b = symbols.includes(data);
8620
+ } else {
8621
+ const { scheme, type } = data;
8622
+ b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
8623
+ }
8624
+ return b;
8625
+ });
8626
+ }
8627
+ return r;
8628
+ }
8629
+ findFirstSim(data) {
8630
+ if (typeof data === "symbol") {
8631
+ return this.findSims(data)[0];
8632
+ } else {
8633
+ return this.findSims(data)[0];
8634
+ }
8635
+ }
8636
+ findLastSim(data) {
8637
+ if (typeof data === "symbol") {
8638
+ return this.findSims(data).reverse()[0];
8639
+ } else {
8640
+ return this.findSims(data).reverse()[0];
8641
+ }
8642
+ }
8643
+ flatStoreSets() {
8644
+ return new Map(
8645
+ Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
8646
+ );
8647
+ }
8648
+ getStoreSets(targetKey) {
8649
+ const map = this.storage.get(targetKey);
8650
+ const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
8651
+ return datas.map((it) => ({ type: it[0], instance: it[1] }));
8652
+ }
8653
+ getStoreSet(targetKey, target) {
8654
+ const sets = this.getStoreSets(targetKey);
8655
+ let find = sets.find((it) => it.type === target);
8656
+ if (!find && (!target || target === targetKey)) {
8657
+ find = sets.find((it) => it.instance);
8658
+ }
8659
+ if (!find?.instance) {
8660
+ const type = target ?? targetKey;
8661
+ if (typeof type === "object") {
8662
+ const find2 = this.storage.get(type);
8663
+ if (find2) {
8664
+ return { type, instance: type };
8665
+ }
8666
+ }
8667
+ const flatStoreSets = this.flatStoreSets();
8668
+ const data = flatStoreSets.get(type);
8669
+ if (data) {
8670
+ this.setStoreSet(targetKey, data, type);
8671
+ }
8672
+ return { type, instance: data };
8673
+ } else {
8674
+ return find;
8675
+ }
8676
+ }
8677
+ getStoreInstance(targetKey, target) {
8678
+ return this.getStoreSet(targetKey, target)?.instance;
8679
+ }
8680
+ getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
8681
+ if (target) {
8682
+ const registed = this.getStoreSet(target, originTypeTarget);
8683
+ if (registed?.type && !registed?.instance) {
8684
+ return this.resolve({
8685
+ targetKey: target,
8686
+ target: originTypeTarget,
8687
+ newInstanceCarrier
8688
+ });
8689
+ }
8690
+ return registed?.instance;
8691
+ }
8692
+ }
8693
+ setStoreSet(targetKey, obj, target = targetKey) {
8694
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8695
+ itemMap.set(target, obj);
8696
+ this.storage.set(targetKey, itemMap);
8697
+ }
8698
+ registerStore(targetKey, regTyps) {
8699
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8700
+ regTyps.forEach((it) => {
8701
+ const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
8702
+ if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
8703
+ itemMap.set(type, value);
8704
+ }
8705
+ });
8706
+ this.storage.set(targetKey, itemMap);
8707
+ }
8708
+ // 진입점
8709
+ resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
8710
+ const registed = this.getStoreSet(targetKey, target);
8711
+ if (registed?.instance) {
8712
+ return registed.instance;
8713
+ }
8714
+ if (this.storage.has(targetKey) && void 0 === registed?.instance) {
8715
+ newInstanceCarrier.depth++;
8716
+ const newSim = this.newSim({
8717
+ target: registed?.type ?? targetKey,
8718
+ newInstanceCarrier,
8719
+ simCreateAfter: (data) => {
8720
+ if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
8721
+ this.setStoreSet(targetKey, data, target);
8722
+ }
8723
+ }
8724
+ });
8725
+ newInstanceCarrier.depth--;
8726
+ if (newInstanceCarrier.depth === 0) {
8727
+ newInstanceCarrier.newInstances.forEach((it) => {
8728
+ this.callBindPostConstruct(it);
8729
+ });
8730
+ }
8731
+ if (isOnSimCreate(newSim)) {
8732
+ newSim.onSimCreate();
8733
+ }
8734
+ return newSim;
8735
+ }
8736
+ const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
8737
+ console.error(simNoSuch);
8738
+ throw simNoSuch;
8739
+ }
8740
+ newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
8741
+ const parameters = this.getParameterSim({
8742
+ target,
8743
+ otherStorage,
8744
+ newInstanceCarrier
8745
+ });
8746
+ const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
8747
+ let p = this.proxy(r);
8748
+ const config = getSim(target);
8749
+ if (config?.proxy) {
8750
+ const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
8751
+ proxys.forEach((it) => {
8752
+ if (typeof it === "object") {
8753
+ p = new Proxy(p, it);
8754
+ } else {
8755
+ const simConfig = getSim(it);
8756
+ p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
8757
+ }
8758
+ });
8759
+ }
8760
+ newInstanceCarrier?.newInstances.push(p);
8761
+ simCreateAfter?.(p);
8762
+ if (isOnSimCreateProxyCompleted(p)) {
8763
+ p.onSimCreateProxyCompleted(p);
8764
+ }
8765
+ return p;
8766
+ }
8767
+ callBindPostConstruct(obj) {
8768
+ const postConstruct = getPostConstructs(obj);
8769
+ postConstruct.forEach((it) => {
8770
+ obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
8771
+ });
8772
+ }
8773
+ async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8774
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8775
+ if (typeof target === "object" && targetKey) {
8776
+ const targetMethod = target[targetKey];
8777
+ return targetMethod?.bind(target)?.(...binds);
8778
+ } else if (typeof target === "function" && !targetKey) {
8779
+ return new target(...binds);
8780
+ }
8781
+ }
8782
+ executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8783
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8784
+ if (typeof target === "object" && targetKey) {
8785
+ const targetMethod = target[targetKey];
8786
+ return targetMethod?.bind(target)?.(...binds);
8787
+ } else if (typeof target === "function" && !targetKey) {
8788
+ return new target(...binds);
8789
+ }
8790
+ }
8791
+ getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
8792
+ const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
8793
+ let injections = [];
8794
+ const injects = getInject(target, targetKey);
8795
+ const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
8796
+ const loopArray = new Array(loopCount).fill(void 0);
8797
+ injections = loopArray.map((_, idx) => {
8798
+ const token = paramTypes[idx];
8799
+ const saveInject = injects?.find((it) => it.index === idx);
8800
+ for (const f of firstCheckMaker ?? []) {
8801
+ const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
8802
+ if (void 0 !== firstCheckObj) {
8803
+ return firstCheckObj;
8804
+ }
8805
+ }
8806
+ if (saveInject) {
8807
+ const inject = saveInject.config;
8808
+ let obj = otherStorage?.get(token);
8809
+ if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
8810
+ const p = [];
8811
+ if (isTargetType(inject) && inject.type) {
8812
+ p.push(
8813
+ ...this.getStoreSets(inject.type).map(
8814
+ (it) => this.resolve({
8815
+ targetKey: inject.type,
8816
+ target: it.type,
8817
+ newInstanceCarrier
8818
+ })
8819
+ ).reverse()
8820
+ );
8821
+ }
8822
+ if (isTargetSymbol(inject)) {
8823
+ p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
8824
+ }
8825
+ if (isTargetScheme(inject)) {
8826
+ p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
8827
+ }
8828
+ return p;
8829
+ }
8830
+ if (inject.situationType && otherStorage) {
8831
+ const situations = otherStorage.get(SituationTypeContainers);
8832
+ const situation = otherStorage.get(SituationTypeContainer);
8833
+ if (inject.situationType === situation?.situationType) {
8834
+ obj = situation.data;
8835
+ } else if (situations && situations.length > 0) {
8836
+ const find = situations.find((a) => {
8837
+ if (a.index !== void 0) {
8838
+ return a.situationType === inject.situationType && a.index === idx;
8839
+ } else {
8840
+ return a.situationType === inject.situationType;
8841
+ }
8842
+ });
8843
+ if (find) {
8844
+ obj = find.data;
8845
+ }
8846
+ }
8847
+ }
8848
+ if (!obj) {
8849
+ const currentInstance = typeof target === "object" ? target : void 0;
8850
+ if (isTargetFactory(inject)) {
8851
+ obj = inject.factory({
8852
+ instance: currentInstance,
8853
+ methodName: String(targetKey),
8854
+ parameter: inputParameters,
8855
+ application: this.simpleApplication
8856
+ });
8857
+ } else {
8858
+ let findLastSim;
8859
+ if (isTargetSymbol(inject)) {
8860
+ findLastSim = this.findLastSim(inject.symbol);
8861
+ } else if (isTargetType(inject) || isTargetScheme(inject)) {
8862
+ findLastSim = this.findLastSim(inject);
8863
+ }
8864
+ try {
8865
+ obj = findLastSim ? this.resolve({
8866
+ targetKey: findLastSim?.type.targetKeyType ?? token,
8867
+ newInstanceCarrier
8868
+ }) : this.resolve({
8869
+ targetKey: token,
8870
+ newInstanceCarrier
8871
+ });
8872
+ if (inject.factory && obj) {
8873
+ if (typeof inject.factory === "function") {
8874
+ obj = inject.factory({
8875
+ instance: currentInstance,
8876
+ methodName: String(targetKey),
8877
+ parameter: inputParameters,
8878
+ application: this.simpleApplication,
8879
+ injectInstance: obj
8880
+ });
8881
+ }
8882
+ }
8883
+ } catch (e) {
8884
+ if (inject.optional) {
8885
+ return void 0;
8886
+ } else {
8887
+ throw e;
8888
+ }
8889
+ }
8890
+ }
8891
+ }
8892
+ if (inject.proxy && obj) {
8893
+ if (ValidUtils.isConstructor(inject.proxy)) {
8894
+ const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
8895
+ if (handler) {
8896
+ obj = new Proxy(obj, handler);
8897
+ }
8898
+ } else if (typeof inject.proxy === "function") {
8899
+ const handler = inject.proxy({
8900
+ application: this.simpleApplication,
8901
+ instance: obj
8902
+ });
8903
+ if (handler) {
8904
+ obj = new Proxy(obj, handler);
8905
+ }
8906
+ }
8907
+ }
8908
+ return obj;
8909
+ } else {
8910
+ return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
8911
+ }
8912
+ });
8913
+ return injections;
8914
+ }
8915
+ proxy(target) {
8916
+ try {
8917
+ const noProxy = isSimNoProxy(target);
8918
+ const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
8919
+ if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
8920
+ for (const key in target) {
8921
+ if (!isSimNoProxy(target, key)) {
8922
+ target[key] = this.proxy(target[key]);
8923
+ }
8924
+ }
8925
+ const protoTypeName = ObjectUtils.ownPropertyNames(target);
8926
+ protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
8927
+ target[it] = new Proxy(target[it], this.simProxyHandler);
8928
+ });
8929
+ if (this.simProxyHandler) {
8930
+ target = new Proxy(target, this.simProxyHandler);
8931
+ }
8932
+ }
8933
+ if (this.option.proxy) {
8934
+ target = this.option.proxy.onAfterProxy(target);
8935
+ }
8936
+ return target;
8937
+ } catch (e) {
8938
+ console.log("sim proxy error");
8939
+ throw e;
8940
+ }
8941
+ }
8942
+ run(otherInstanceSim = /* @__PURE__ */ new Map()) {
8943
+ for (const [k, v] of Array.from(otherInstanceSim.entries())) {
8944
+ const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
8945
+ this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
8946
+ if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
8947
+ this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
8948
+ }
8949
+ }
8950
+ const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
8951
+ if (!myContainers.includes(this.simpleApplication)) {
8952
+ myContainers.push(this.simpleApplication);
8953
+ }
8954
+ Array.from(sims.entries()).forEach(([type, implementations]) => {
8955
+ const filteredSet = /* @__PURE__ */ new Set();
8956
+ implementations.forEach((impl) => {
8957
+ const config = getSim(impl);
8958
+ const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
8959
+ let isInclude = false;
8960
+ if (targetContainers.length <= 0) {
8961
+ isInclude = true;
8962
+ } else {
8963
+ isInclude = myContainers.some((it) => targetContainers.includes(it));
8964
+ }
8965
+ if (isInclude) {
8966
+ filteredSet.add(impl);
8967
+ }
8968
+ });
8969
+ if (filteredSet.size > 0) {
8970
+ this.registerStore(type, filteredSet);
8971
+ }
8972
+ });
8973
+ this.callBindPostConstruct(this);
8974
+ this.getSimAtomics().forEach((it) => {
8975
+ if (it.getConfig()?.autoCreate) {
8976
+ it.getValue();
8977
+ }
8978
+ });
8979
+ }
8980
+ };
8981
+
8982
+ // ../simple-boot/dist/esm/intent/Intent.js
8983
+ var Intent = class {
8984
+ constructor(uri, data, event) {
8985
+ this.uri = uri;
8986
+ this.data = data;
8987
+ this.event = event;
8988
+ this.sessionData = /* @__PURE__ */ new Map();
8989
+ if (typeof uri === "string") {
8990
+ const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
8991
+ if (match) {
8992
+ const symbol = Symbol.for(match[1]);
8993
+ this.uri = {
8994
+ symbol,
8995
+ uri: match[2]
8996
+ };
8997
+ }
8998
+ }
8999
+ }
9000
+ get symbols() {
9001
+ if (typeof this.uri === "object") {
9002
+ return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
9003
+ }
9004
+ return void 0;
9005
+ }
9006
+ get scheme() {
9007
+ if (typeof this.uri === "string") {
9008
+ const parts = this.uri.split("://");
9009
+ if (parts.length > 1) {
9010
+ return parts[0];
9011
+ }
9012
+ return void 0;
9013
+ } else {
9014
+ return void 0;
9015
+ }
9016
+ }
9017
+ get paths() {
9018
+ return this.pathname.split("/") ?? [];
9019
+ }
9020
+ get fullPath() {
9021
+ const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
9022
+ const paths = uri.split("://");
9023
+ return paths[paths.length >= 2 ? 1 : 0] ?? "";
9024
+ }
9025
+ get pathname() {
9026
+ const paths = this.fullPath.split("?");
9027
+ return paths[0];
9028
+ }
9029
+ get query() {
9030
+ const paths = this.fullPath.split("?");
9031
+ return paths[1] ?? "";
9032
+ }
9033
+ getQueryParamDecodeURI(key) {
9034
+ const p = this.queryParamsDecodeURI;
9035
+ if (key) {
9036
+ return p[key];
9037
+ } else {
9038
+ return p;
9039
+ }
9040
+ }
9041
+ getQueryParamDecodeURIFirst(key) {
9042
+ const param = this.getQueryParamDecodeURI(key);
9043
+ if (Array.isArray(param)) {
9044
+ return param[0];
9045
+ } else {
9046
+ return param;
9047
+ }
9048
+ }
9049
+ getQueryParam(key) {
9050
+ const p = this.queryParams;
9051
+ if (key) {
9052
+ return p[key];
9053
+ } else {
9054
+ return p;
9055
+ }
9056
+ }
9057
+ getQueryParamFirst(key) {
9058
+ const param = this.getQueryParam(key);
9059
+ if (Array.isArray(param)) {
9060
+ return param[0];
9061
+ } else {
9062
+ return param;
9063
+ }
9064
+ }
9065
+ get queryParams() {
9066
+ const param = {};
9067
+ this.query.split("&")?.forEach((it) => {
9068
+ const a = it.split("=");
9069
+ if (param[a[0]]) {
9070
+ if (Array.isArray(param[a[0]])) {
9071
+ param[a[0]].push(a[1]);
9072
+ } else {
9073
+ param[a[0]] = [param[a[0]], a[1]];
9074
+ }
9075
+ } else {
9076
+ param[a[0]] = a[1];
9077
+ }
9078
+ });
9079
+ return param;
9080
+ }
9081
+ get queryParamsDecodeURI() {
9082
+ const params = this.queryParams;
9083
+ for (const key in params) {
9084
+ if (params.hasOwnProperty(key)) {
9085
+ const param = params[key];
9086
+ if (Array.isArray(param)) {
9087
+ params[key] = param.map((p) => decodeURIComponent(p));
9088
+ } else {
9089
+ params[key] = decodeURIComponent(param);
9090
+ }
9091
+ }
9092
+ }
9093
+ return params;
9094
+ }
9095
+ getPathnameData(urlExpression) {
9096
+ return Expression.Path.pathNameData(this.pathname, urlExpression);
9097
+ }
9098
+ get isSymbolScheme() {
9099
+ return this.symbols !== void 0;
9100
+ }
9101
+ };
9102
+
9103
+ // ../simple-boot/dist/esm/intent/IntentSubscribe.js
9104
+ var isIntentSubscribe = (obj) => {
9105
+ return !!obj && typeof obj.intentSubscribe === "function";
9106
+ };
9107
+
9108
+ // ../simple-boot/dist/esm/intent/IntentManager.js
9109
+ var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
9110
+ var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
9111
+ var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
9112
+ var IntentManager = class {
9113
+ constructor(simpleApplication, simstanceManager, routerManager, simOption) {
9114
+ this.simpleApplication = simpleApplication;
9115
+ this.simstanceManager = simstanceManager;
9116
+ this.routerManager = routerManager;
9117
+ this.simOption = simOption;
9118
+ this.subject = new Subject();
9119
+ }
9120
+ get observable() {
9121
+ return this.subject.asObservable();
9122
+ }
9123
+ async makeIntentData(it, data) {
9124
+ const target = [];
9125
+ const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
9126
+ if (isRouterPublishType(it)) {
9127
+ it = it.router;
9128
+ }
9129
+ const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
9130
+ if (routerMatch && typeof it === "string") {
9131
+ const routerBasePath = routerMatch[1];
9132
+ const actualPath = routerMatch[2];
9133
+ const routerModule = await this.routerManager.routing(routerBasePath, {
9134
+ router: rootRouter
9135
+ });
9136
+ const instance = routerModule.getModuleInstance();
9137
+ if (instance) {
9138
+ target.push(instance);
9139
+ }
9140
+ it = new Intent(actualPath, data);
9141
+ } else if (isSymbolPublishType(it)) {
9142
+ it = new Intent({ symbol: it.symbol, uri: it.path }, data);
9143
+ } else if (isSchemePublishType(it)) {
9144
+ it = new Intent(`${it.scheme}://${it.path}`, data);
9145
+ } else if (typeof it === "string") {
9146
+ it = new Intent(it, data);
9147
+ }
9148
+ const intent = it;
9149
+ if (!routerMatch) {
9150
+ if (intent.symbols) {
9151
+ target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
9152
+ } else if (intent.scheme) {
9153
+ target.push(...this.simstanceManager.getSimConfig(intent.scheme));
9154
+ } else {
9155
+ target.push(...this.simstanceManager.getSimAtomics());
9156
+ }
9157
+ }
9158
+ return { intent, target };
9159
+ }
9160
+ async publishMeta(it, data) {
9161
+ const { intent, target } = await this.makeIntentData(it, data);
9162
+ const r = [];
9163
+ const targetInstances = target.map((it2) => {
9164
+ if (it2 instanceof SimAtomic) {
9165
+ return it2.getValue();
9166
+ } else {
9167
+ return it2;
9168
+ }
9169
+ });
9170
+ this.subject.next(intent);
9171
+ for (let data2 of targetInstances) {
9172
+ let orNewSim = data2;
9173
+ if (orNewSim) {
9174
+ const filteredPaths = intent.paths.filter((i) => i);
9175
+ if (filteredPaths.length > 0) {
9176
+ let callthis = orNewSim;
9177
+ let lastProp = "";
9178
+ filteredPaths.forEach((i) => {
9179
+ callthis = orNewSim;
9180
+ orNewSim = orNewSim?.[i];
9181
+ lastProp = i;
9182
+ });
9183
+ if (orNewSim && typeof orNewSim === "function") {
9184
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9185
+ const result = await this.simstanceManager.executeBindParameterSimPromise({
9186
+ target: callthis,
9187
+ targetKey: lastProp,
9188
+ parameterCount: intentData.length,
9189
+ inputParameters: intentData,
9190
+ firstCheckMaker: [
9191
+ (obj, token, idx) => {
9192
+ if (idx < intentData.length) {
9193
+ return intentData[idx];
9194
+ }
9195
+ if (token === Intent && idx === 0) {
9196
+ return intent;
9197
+ }
9198
+ }
9199
+ ]
9200
+ });
9201
+ r.push(result);
9202
+ } else if (orNewSim) {
9203
+ callthis[lastProp] = intent.data;
9204
+ r.push(callthis[lastProp]);
9205
+ }
9206
+ } else {
9207
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9208
+ if (isIntentSubscribe(orNewSim)) {
9209
+ r.push(orNewSim.intentSubscribe(...intentData));
9210
+ }
9211
+ }
9212
+ }
9213
+ }
9214
+ return { return: r, target };
9215
+ }
9216
+ async publish(it, data) {
9217
+ const rdata = await this.publishMeta(it, data);
9218
+ return rdata.return;
9219
+ }
9220
+ };
9221
+
9222
+ // ../simple-boot/dist/esm/decorators/inject/Injection.js
9223
+ var InjectionMetadataKey = Symbol("Injection");
9224
+ var getInjection = (target, propertyKey) => {
9225
+ return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
9226
+ };
9227
+
9228
+ // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
9229
+ var MethodNoSuch = class extends SimError {
9230
+ constructor(message, name, propertyKeys, stack) {
9231
+ super(message, name, stack);
9232
+ this.propertyKeys = propertyKeys;
9233
+ }
9234
+ };
9235
+
9236
+ // ../simple-boot/dist/esm/decorators/route/Router.js
9237
+ var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
9238
+ var getRouter = (target) => {
9239
+ if (target != null && typeof target === "object") {
9240
+ target = target.constructor;
9241
+ }
9242
+ try {
9243
+ return ReflectUtils.getMetadata(RouterMetadataKey, target);
9244
+ } catch (e) {
9245
+ }
9246
+ };
9247
+ var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9248
+
9249
+ // ../simple-boot/dist/esm/route/RouterModule.js
9250
+ var RouterModule = class {
9251
+ constructor(simstanceManager, router, module, routerChains = []) {
9252
+ this.simstanceManager = simstanceManager;
9253
+ this.router = router;
9254
+ this.module = module;
9255
+ this.routerChains = routerChains;
9256
+ }
9257
+ get path() {
9258
+ return this._path;
9259
+ }
9260
+ set path(value) {
9261
+ this._path = value;
9262
+ }
9263
+ get data() {
9264
+ return this._data;
9265
+ }
9266
+ set data(value) {
9267
+ this._data = value;
9268
+ }
9269
+ get intent() {
9270
+ return this._intent;
9271
+ }
9272
+ set intent(value) {
9273
+ this._intent = value;
9274
+ }
9275
+ get propertyKeys() {
9276
+ return this._propertyKeys;
9277
+ }
9278
+ set propertyKeys(value) {
9279
+ this._propertyKeys = value;
9280
+ }
9281
+ get pathData() {
9282
+ return this._pathData;
9283
+ }
9284
+ getPathData() {
9285
+ return this._pathData;
9286
+ }
9287
+ set pathData(value) {
9288
+ this._pathData = value;
9289
+ }
9290
+ getRouterPath(join = "") {
9291
+ return this.getRouterPaths().map((it) => it ?? "").join(join);
9292
+ }
9293
+ getRouterPaths() {
9294
+ return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
9295
+ }
9296
+ getRouterPathData(pathName) {
9297
+ return Expression.Path.pathNameData(pathName, this.getRouterPath());
9298
+ }
9299
+ getModuleInstance(propertyKey, instanceBind = true) {
9300
+ const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
9301
+ if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
9302
+ let instanceElement = instance[propertyKey];
9303
+ if (instanceBind && typeof instanceBind === "boolean") {
9304
+ instanceElement = instanceElement.bind(instance);
9305
+ } else if (instanceBind && typeof instanceBind === "object") {
9306
+ instanceElement = instanceElement.bind(instanceBind);
9307
+ }
9308
+ return instanceElement;
9309
+ } else {
9310
+ return instance;
9311
+ }
9312
+ }
9313
+ executeModuleProperty(propertyKey, ...param) {
9314
+ const target = this.getModuleInstance();
9315
+ if (propertyKey) {
9316
+ const config = getInjection(target, propertyKey);
9317
+ if (config) {
9318
+ const other = /* @__PURE__ */ new Map();
9319
+ param.forEach((it) => other.set(it.constructor, it));
9320
+ return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
9321
+ } else {
9322
+ if (target[propertyKey]) {
9323
+ return target[propertyKey]?.(...param);
9324
+ } else {
9325
+ throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
9326
+ }
9327
+ }
9328
+ }
9329
+ }
9330
+ get firstRouteChain() {
9331
+ return this.routerChains[0];
9332
+ }
9333
+ get firstRouteChainValue() {
9334
+ return this.firstRouteChain?.getValue();
9335
+ }
9336
+ get lastRouteChain() {
9337
+ return this.routerChains[this.routerChains.length - 1];
9338
+ }
9339
+ get lastRouteChainValue() {
9340
+ return this.lastRouteChain?.getValue();
9341
+ }
9342
+ hasActivateInLastRoute(obj) {
9343
+ return this.lastRouteChainValue?.hasActivate(obj) === true;
9344
+ }
9345
+ getQueryParamDecodeURI(key) {
9346
+ if (this.intent) {
9347
+ return this.intent.getQueryParamDecodeURI(key);
9348
+ }
9349
+ }
9350
+ getQueryParamDecodeURIFirst(key) {
9351
+ if (this.intent) {
9352
+ return this.intent.getQueryParamDecodeURIFirst(key);
9353
+ }
9354
+ }
9355
+ getQueryParam(key) {
9356
+ if (this.intent) {
9357
+ return this.intent.getQueryParam(key);
9358
+ }
9359
+ }
9360
+ getQueryParamFirst(key) {
9361
+ if (this.intent) {
9362
+ return this.intent.getQueryParamFirst(key);
9363
+ }
9364
+ }
9365
+ get queryParams() {
9366
+ if (this.intent) {
9367
+ return this.intent.queryParams;
9368
+ }
9369
+ }
9370
+ get queryParamsAfterDecodeURI() {
9371
+ if (this.intent) {
9372
+ return this.intent.queryParamsDecodeURI;
9373
+ }
9374
+ }
9375
+ };
9376
+
9377
+ // ../simple-boot/dist/esm/route/RouterAction.js
9378
+ var RouterAction;
9379
+ ((RouterAction2) => {
9380
+ RouterAction2.isCanActivate = (obj) => {
9381
+ return typeof obj?.canActivate === "function";
9382
+ };
9383
+ RouterAction2.isOnRouting = (obj) => {
9384
+ return typeof obj?.onRouting === "function";
9385
+ };
9386
+ RouterAction2.isHasActivate = (obj) => {
9387
+ return typeof obj?.hasActivate === "function";
9388
+ };
9389
+ })(RouterAction || (RouterAction = {}));
9390
+
9391
+ // ../simple-boot/dist/esm/route/RouterManager.js
9392
+ var RouterManager = class {
9393
+ constructor(simpleApplication, simstanceManager, simOption) {
9394
+ this.simpleApplication = simpleApplication;
9395
+ this.simstanceManager = simstanceManager;
9396
+ this.simOption = simOption;
9397
+ this.subject = new Subject();
9398
+ }
9399
+ // @SimNoProxy
9400
+ get observable() {
9401
+ return this.subject.asObservable();
9402
+ }
9403
+ routingMap(option) {
9404
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9405
+ if (!targetRouter) {
9406
+ throw new Error("no router");
9407
+ }
9408
+ const map = {};
9409
+ if (targetRouter) {
9410
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9411
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9412
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9413
+ const routerData = routerAtomic.getConfig(RouterMetadataKey);
9414
+ if (routerData) {
9415
+ const currentPrefix = (option?.prefix ?? "") + routerData.path;
9416
+ if (routerData.route && routerData.route[""]) {
9417
+ map[currentPrefix] = routerData.route[""];
9418
+ }
9419
+ if (routerData.route) {
9420
+ Object.entries(routerData.route).forEach(([key, value]) => {
9421
+ map[currentPrefix + key] = value;
9422
+ });
9423
+ }
9424
+ routerData.routers?.forEach((it) => {
9425
+ Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
9426
+ });
9427
+ }
9428
+ }
9429
+ return map;
9430
+ }
9431
+ /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
9432
+ * @deprecated
9433
+ */
9434
+ async routings(intent, option) {
9435
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9436
+ if (!targetRouter) {
9437
+ throw new Error("no router");
9438
+ }
9439
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9440
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9441
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9442
+ const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
9443
+ const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
9444
+ if (exactModuleMatches.length > 0) {
9445
+ exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9446
+ return exactModuleMatches;
9447
+ }
9448
+ const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
9449
+ if (exactPathMatches.length > 0) {
9450
+ exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9451
+ return exactPathMatches;
9452
+ }
9453
+ return [];
9454
+ }
9455
+ async routing(intent, option) {
9456
+ if (typeof intent === "string") {
9457
+ intent = new Intent(intent);
9458
+ }
9459
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
9460
+ const callCheckOnRouting = option?.noOnRouting !== true;
9461
+ if (!targetRouter) {
9462
+ debugger;
9463
+ throw new Error("no router");
9464
+ }
9465
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9466
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9467
+ const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9468
+ const rootRouter = routerAtomic.getValue();
9469
+ const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
9470
+ if (executeModuleResult) {
9471
+ const [executeModule, routerChains] = executeModuleResult;
9472
+ executeModule.routerChains = routerChains;
9473
+ this.activeRouterModule = executeModule;
9474
+ const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
9475
+ if (routerChains.length > 0) {
9476
+ for (let i = 0; i < routerChains.length; i++) {
9477
+ const current = routerChains[i];
9478
+ const next = routerChains[i + 1];
9479
+ const value = current.getValue();
9480
+ if (RouterAction.isCanActivate(value) && next) {
9481
+ await value.canActivate(routingDataSet, next.getValue());
9482
+ }
9483
+ if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
9484
+ await value.onRouting(routingDataSet);
9485
+ }
9486
+ }
9487
+ }
9488
+ this.activeRouterModule = executeModule;
9489
+ const moduleInstance = executeModule.getModuleInstance();
9490
+ if (!executeModule?.module) {
9491
+ const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
9492
+ const value = routerChain?.getValue();
9493
+ if (RouterAction.isCanActivate(value)) {
9494
+ await value.canActivate(routingDataSet, moduleInstance);
9495
+ }
9496
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9497
+ await value.onRouting(routingDataSet);
9498
+ }
9499
+ } else {
9500
+ const value = executeModule.router?.getValue();
9501
+ if (RouterAction.isCanActivate(value)) {
9502
+ await value.canActivate(routingDataSet, moduleInstance);
9503
+ }
9504
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9505
+ await value.onRouting(routingDataSet);
9506
+ }
9507
+ if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
9508
+ await moduleInstance.onRouting(routingDataSet);
9509
+ }
9510
+ }
9511
+ const find = this.activeRouterModule;
9512
+ this.subject.next({ intent, routerModule: find, routerManager: this });
9513
+ return find;
9514
+ } else {
9515
+ const empty = await this._handleNotFoundRouting(rootRouter, intent);
9516
+ this.subject.next({ intent, routerModule: empty, routerManager: this });
9517
+ return empty;
9518
+ }
9519
+ }
9520
+ /**
9521
+ * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
9522
+ * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
9523
+ * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
9524
+ * @param rootRouter 앱의 최상위 라우터 인스턴스
9525
+ * @param intent 확인에 실패한 원본 Intent 객체
9526
+ * @private
9527
+ */
9528
+ async _handleNotFoundRouting(rootRouter, intent) {
9529
+ const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
9530
+ const routingDataSet = { intent, routerModule, routerManager: this };
9531
+ const value = rootRouter;
9532
+ if (RouterAction.isCanActivate(value)) {
9533
+ await value.canActivate(routingDataSet, null);
9534
+ }
9535
+ if (RouterAction.isOnRouting(value)) {
9536
+ await value.onRouting(routingDataSet);
9537
+ }
9538
+ this.activeRouterModule = routerModule;
9539
+ return this.activeRouterModule;
9540
+ }
9541
+ getExecuteModule(router, intent, parentRouters, option) {
9542
+ const path = intent.pathname;
9543
+ const routerConfig = router.getConfig(RouterMetadataKey);
9544
+ if (routerConfig) {
9545
+ const filters = [];
9546
+ if (Array.isArray(routerConfig.filters)) {
9547
+ filters.push(...routerConfig.filters);
9548
+ } else if (routerConfig.filters) {
9549
+ filters.push(routerConfig.filters);
9550
+ }
9551
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9552
+ if (noAccept) {
9553
+ return;
9554
+ }
9555
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9556
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9557
+ if (isRoot) {
9558
+ const currentParentRouters = [...parentRouters, router];
9559
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
9560
+ let bestMatchModule = void 0;
9561
+ let bestMatchLength = -1;
9562
+ for (const child of routerConfig.routers) {
9563
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9564
+ if (!routerAtomic) {
9565
+ continue;
9566
+ }
9567
+ const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
9568
+ if (executeModule) {
9569
+ const [rm, chains] = executeModule;
9570
+ const currentMatchLength = rm.path?.length || 0;
9571
+ if (currentMatchLength > bestMatchLength) {
9572
+ bestMatchLength = currentMatchLength;
9573
+ bestMatchModule = executeModule;
9574
+ } else if (currentMatchLength === bestMatchLength) {
9575
+ if (option?.find?.router === "last") {
9576
+ bestMatchModule = executeModule;
9577
+ }
9578
+ }
9579
+ }
9580
+ }
9581
+ if (bestMatchModule) {
9582
+ return bestMatchModule;
9583
+ }
9584
+ }
9585
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9586
+ if (module) {
9587
+ return [module, currentParentRouters];
9588
+ }
9589
+ }
9590
+ }
9591
+ }
9592
+ // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
9593
+ isRootUrl(path, parentRoots, url) {
9594
+ const searchString = parentRoots.join("") + (path || "");
9595
+ if (searchString === "/") {
9596
+ return true;
9597
+ }
9598
+ const searchs = searchString.split("/");
9599
+ const urls = url.split("/");
9600
+ const trimmedUrls = urls.slice(0, searchs.length).join("/");
9601
+ return !!Expression.Path.pathNameData(trimmedUrls, searchString);
9602
+ }
9603
+ _collectAllMatchingModules(router, intent, parentRouters) {
9604
+ const matches = [];
9605
+ const path = intent.pathname;
9606
+ const routerConfig = router.getConfig(RouterMetadataKey);
9607
+ if (routerConfig) {
9608
+ const filters = [];
9609
+ if (Array.isArray(routerConfig.filters)) {
9610
+ filters.push(...routerConfig.filters);
9611
+ } else if (routerConfig.filters) {
9612
+ filters.push(routerConfig.filters);
9613
+ }
9614
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9615
+ if (noAccept) {
9616
+ return matches;
9617
+ }
9618
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9619
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9620
+ if (isRoot) {
9621
+ const currentParentRouters = [...parentRouters, router];
9622
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
9623
+ for (const child of routerConfig.routers) {
9624
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9625
+ if (!routerAtomic) {
9626
+ continue;
9627
+ }
9628
+ matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
9629
+ }
9630
+ }
9631
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9632
+ if (module) {
9633
+ module.routerChains = currentParentRouters;
9634
+ matches.push(module);
9635
+ }
9636
+ }
9637
+ }
9638
+ return matches;
9639
+ }
9640
+ findRouterOrModule(router, routerData, parentRoots, intent) {
9641
+ const module = this.findRouting(router, routerData, parentRoots, intent);
9642
+ if (module?.module) {
9643
+ module.intent = intent;
9644
+ return module;
9645
+ }
9646
+ const urlRoot = parentRoots.join("") + (routerData.path || "");
9647
+ if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
9648
+ const rm = new RouterModule(this.simstanceManager, router);
9649
+ rm.intent = intent;
9650
+ rm.path = urlRoot;
9651
+ rm.pathData = intent.getPathnameData(urlRoot);
9652
+ return rm;
9653
+ }
9654
+ return void 0;
9655
+ }
9656
+ findRouting(router, routerData, parentRoots, intent) {
9657
+ const urlRoot = parentRoots.join("") + routerData.path;
9658
+ if (routerData.route) {
9659
+ for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
9660
+ const path = urlRoot + it;
9661
+ const pathnameData = intent.getPathnameData(path);
9662
+ if (pathnameData) {
9663
+ try {
9664
+ const dataSet = this.findRouteProperty(routerData.route, it, intent);
9665
+ const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
9666
+ rm.data = dataSet.data;
9667
+ rm.path = path;
9668
+ rm.pathData = pathnameData;
9669
+ rm.propertyKeys = dataSet.propertyKeys;
9670
+ return rm;
9671
+ } catch (e) {
9672
+ }
9673
+ }
9674
+ }
9675
+ }
9676
+ }
9677
+ findRouteProperty(route, propertyName, intent) {
9678
+ let child;
9679
+ let data;
9680
+ let propertyKeys;
9681
+ const routeElement = route[propertyName];
9682
+ if (typeof routeElement === "function") {
9683
+ child = { targetKeyType: routeElement, originalType: routeElement };
9684
+ } else if (typeof routeElement === "symbol") {
9685
+ const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
9686
+ if (findSimType?.originalType) {
9687
+ child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
9688
+ }
9689
+ } else if (typeof routeElement === "string") {
9690
+ return this.findRouteProperty(route, routeElement, intent);
9691
+ } else if (Array.isArray(routeElement)) {
9692
+ const r = routeElement?.[0];
9693
+ if (typeof r === "object" && "filters" in r && "target" in r) {
9694
+ const filters = [];
9695
+ if (Array.isArray(r.filters)) {
9696
+ filters.push(...r.filters);
9697
+ } else if (r.filters) {
9698
+ filters.push(r.filters);
9699
+ }
9700
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9701
+ if (!noAccept) {
9702
+ child = { targetKeyType: r.target, originalType: r.target };
9703
+ }
9704
+ } else {
9705
+ child = { targetKeyType: r, originalType: r };
9706
+ }
9707
+ data = routeElement?.[1];
9708
+ } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
9709
+ const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9710
+ if (!noAccept) {
9711
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9712
+ propertyKeys = routeElement.propertyKeys;
9713
+ }
9714
+ } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
9715
+ const filters = [];
9716
+ if (Array.isArray(routeElement.filters)) {
9717
+ filters.push(...routeElement.filters);
9718
+ } else if (routeElement.filters) {
9719
+ filters.push(routeElement.filters);
9720
+ }
9721
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9722
+ if (!noAccept) {
9723
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9724
+ }
9725
+ }
9726
+ return {
9727
+ child,
9728
+ data,
9729
+ propertyKeys
9730
+ };
9731
+ }
9732
+ };
9733
+
9734
+ // ../simple-boot/dist/esm/SimpleApplication.js
9735
+ var SimpleApplication = class _SimpleApplication {
9736
+ // public rootRouter?: ConstructorType<any>;
9737
+ // constructor();
9738
+ // constructor(option: SimOption);
9739
+ // constructor(rootRouter?: ConstructorType<Object> | Function);
9740
+ // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
9741
+ // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
9742
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
9743
+ constructor(option = new SimOption()) {
9744
+ this.option = option;
9745
+ this.simstanceManager = new SimstanceManager(this, option);
9746
+ this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
9747
+ this.routerManager = new RouterManager(this, this.simstanceManager, option);
9748
+ this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
9749
+ this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
9750
+ this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
9751
+ containers.add(this);
9752
+ }
9753
+ getSimstanceManager() {
9754
+ return this.simstanceManager;
9755
+ }
9756
+ getIntentManager() {
9757
+ return this.intentManager;
9758
+ }
9759
+ getRouterManager() {
9760
+ return this.routerManager;
9761
+ }
9762
+ run(otherInstanceSim) {
9763
+ otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
9764
+ otherInstanceSim.set(_SimpleApplication, this);
9765
+ this.simstanceManager.run(otherInstanceSim);
9766
+ return this;
9767
+ }
9768
+ simAtomic(type) {
9769
+ if (typeof type === "symbol") {
9770
+ return this.simstanceManager.findFirstSim(type);
9771
+ } else if (typeof type === "function") {
9772
+ return this.simstanceManager.findFirstSim({ type });
9773
+ }
9774
+ }
9775
+ simAtomics(type) {
9776
+ if (typeof type === "symbol") {
9777
+ return this.simstanceManager.findSims(type) ?? [];
9778
+ } else if (typeof type === "function") {
9779
+ return this.simstanceManager.findSims({ type }) ?? [];
9780
+ } else {
9781
+ return [];
9782
+ }
9783
+ }
9784
+ getInstance(type) {
9785
+ const i = this.sim(type);
9786
+ if (i) {
9787
+ return i;
9788
+ } else {
9789
+ throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
9790
+ }
9791
+ }
9792
+ sim(type) {
9793
+ return this.simAtomic(type)?.getValue();
9794
+ }
9795
+ sims(type) {
9796
+ return this.simAtomics(type).map((it) => it.getValue());
9797
+ }
9798
+ addSim(configOrTarget, target) {
9799
+ const r = Sim(configOrTarget);
9800
+ if (typeof r === "function" && target) {
9801
+ r(target);
9802
+ }
9803
+ }
9804
+ publishIntent(i, data) {
9805
+ return this.intentManager.publish(i, data);
9806
+ }
9807
+ routing(i, option) {
9808
+ if (i instanceof Intent) {
9809
+ return this.routerManager.routing(i, option);
9810
+ } else if (typeof i === "string") {
9811
+ const intent = new Intent(i);
9812
+ return this.routerManager.routing(intent, option);
9813
+ } else {
9814
+ const intent = new Intent(i.path, i.data);
9815
+ return this.routerManager.routing(intent, option);
9816
+ }
9817
+ }
9818
+ };
9819
+
9820
+ // ../core-web/dist/esm/element/CanvasUtils.js
9821
+ var CanvasUtils;
9822
+ ((CanvasUtils2) => {
9823
+ let Context2D;
9824
+ ((Context2D2) => {
9825
+ Context2D2.resetTransform = (context) => {
9826
+ context.setTransform(1, 0, 0, 1, 0, 0);
9827
+ };
9828
+ })(Context2D = CanvasUtils2.Context2D || (CanvasUtils2.Context2D = {}));
9829
+ CanvasUtils2.fontSize = (ctx, config) => {
9830
+ const { text, maxWidth, maxHeight, fontOption } = config;
9831
+ if (!text || maxWidth <= 0 || maxHeight <= 0) {
9832
+ return 0;
9833
+ }
9834
+ const lines = text.split("\n").filter((line) => line.trim().length > 0);
9835
+ if (lines.length === 0) {
9836
+ return 0;
9837
+ }
9838
+ const lineHeightMultiplier = 1.2;
9839
+ const maxFontSizeByHeight = Math.floor(maxHeight / (lines.length * lineHeightMultiplier));
9840
+ if (maxFontSizeByHeight <= 0) {
9841
+ return 0;
9842
+ }
9843
+ let minSizeForWidth = 1;
9844
+ let maxSizeForWidth = maxFontSizeByHeight;
9845
+ let bestSizeForWidth = 0;
9846
+ const maxIterations = 100;
9847
+ let iteration = 0;
9848
+ while (minSizeForWidth <= maxSizeForWidth && iteration < maxIterations) {
9849
+ const midSize = Math.floor((minSizeForWidth + maxSizeForWidth) / 2);
9850
+ if (midSize === 0) break;
9851
+ ctx.font = `${fontOption?.fontWeight || "normal"} ${midSize}px ${fontOption?.fontFamily || "sans-serif"}`;
9852
+ const maxLineWidth = Math.max(...lines.map((line) => ctx.measureText(line).width));
9853
+ if (maxLineWidth <= maxWidth) {
9854
+ bestSizeForWidth = midSize;
9855
+ minSizeForWidth = midSize + 1;
9856
+ } else {
9857
+ maxSizeForWidth = midSize - 1;
9858
+ }
9859
+ iteration++;
9860
+ }
9861
+ return Math.min(bestSizeForWidth, maxFontSizeByHeight);
9862
+ };
9863
+ CanvasUtils2.textMetrics = (context, text) => {
9864
+ return context.measureText(text);
9865
+ };
9866
+ })(CanvasUtils || (CanvasUtils = {}));
9867
+
9868
+ // ../core-web/dist/esm/element/ElementUtils.js
9869
+ var ElementUtils;
9870
+ ((ElementUtils2) => {
9871
+ function removeAllChildren(el, els) {
9872
+ if (!els) {
9873
+ el.replaceChildren();
9874
+ } else if (Array.isArray(els)) {
9875
+ el.replaceChildren(...els);
9876
+ } else {
9877
+ el.replaceChildren(els);
9878
+ }
9879
+ }
9880
+ ElementUtils2.removeAllChildren = removeAllChildren;
9881
+ function loadImage(src, callback) {
7970
9882
  let targetCallback;
7971
9883
  let promise = void 0;
7972
9884
  if (callback) {
@@ -8665,6 +10577,392 @@ var dooboostoreSimpleWebComponent = (() => {
8665
10577
  return /Mobi/i.test(targetWindow.navigator.userAgent);
8666
10578
  };
8667
10579
  })(ValidUtils2 || (ValidUtils2 = {}));
10580
+
10581
+ // ../simple-boot/dist/esm/index.js
10582
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
10583
+
10584
+ // ../simple-boot/dist/esm/alert/AlertAction.js
10585
+ var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
10586
+ AlertAction2["ACTIVE"] = "ACTIVE";
10587
+ AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
10588
+ return AlertAction2;
10589
+ })(AlertAction || {});
10590
+
10591
+ // ../simple-boot/dist/esm/alert/Alert.js
10592
+ var Alert = class {
10593
+ constructor(alertService, config) {
10594
+ this.alertService = alertService;
10595
+ this.config = config;
10596
+ this.isActive = false;
10597
+ this.activateBefore = [];
10598
+ this.activateAfter = [];
10599
+ this.deActivateBefore = [];
10600
+ this.deActivateAfter = [];
10601
+ this.data = /* @__PURE__ */ new Map();
10602
+ if (config?.uuid) {
10603
+ this.uuid = config.uuid;
10604
+ } else {
10605
+ this.uuid = RandomUtils.uuid();
10606
+ }
10607
+ }
10608
+ addOpenBefore(fn) {
10609
+ this.activateBefore.push(fn);
10610
+ }
10611
+ addOpenAfter(fn) {
10612
+ this.activateAfter.push(fn);
10613
+ }
10614
+ addCloseBefore(fn) {
10615
+ this.deActivateBefore.push(fn);
10616
+ }
10617
+ addCloseAfter(fn) {
10618
+ this.deActivateAfter.push(fn);
10619
+ }
10620
+ setData(key, value) {
10621
+ this.data.set(key, value);
10622
+ }
10623
+ getData(key) {
10624
+ return this.data.get(key);
10625
+ }
10626
+ async activate() {
10627
+ try {
10628
+ await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
10629
+ this.result = this.make();
10630
+ this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
10631
+ this.isActive = true;
10632
+ if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
10633
+ setTimeout(() => {
10634
+ this.deActivate();
10635
+ }, this.config.closeTime);
10636
+ }
10637
+ this.config?.activate?.(this.result, this);
10638
+ });
10639
+ } catch (e) {
10640
+ } finally {
10641
+ await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
10642
+ });
10643
+ }
10644
+ }
10645
+ async deActivate() {
10646
+ try {
10647
+ await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
10648
+ this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
10649
+ this.isActive = false;
10650
+ this.config?.deActivate?.(this.result, this);
10651
+ });
10652
+ } catch (e) {
10653
+ } finally {
10654
+ await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
10655
+ });
10656
+ }
10657
+ }
10658
+ };
10659
+
10660
+ // ../simple-boot/dist/esm/alert/AlertFactory.js
10661
+ var __decorate = function(decorators, target, key, desc) {
10662
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10663
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10664
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10665
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10666
+ };
10667
+ var AlertFactory;
10668
+ (function(AlertFactory2) {
10669
+ AlertFactory2.SYMBOL = Symbol.for("simple-boot:alert-factory-token");
10670
+ })(AlertFactory || (AlertFactory = {}));
10671
+ var DefaultAlertFactory = class DefaultAlertFactory2 {
10672
+ create(data) {
10673
+ return void 0;
10674
+ }
10675
+ };
10676
+ DefaultAlertFactory = __decorate([
10677
+ Sim({ symbol: AlertFactory.SYMBOL })
10678
+ ], DefaultAlertFactory);
10679
+
10680
+ // ../simple-boot/dist/esm/alert/AlertType.js
10681
+ var AlertType = /* @__PURE__ */ ((AlertType2) => {
10682
+ AlertType2["DANGER"] = "DANGER";
10683
+ AlertType2["NORMAL"] = "NORMAL";
10684
+ AlertType2["PROGRESS"] = "PROGRESS";
10685
+ AlertType2["SUCCESS"] = "SUCCESS";
10686
+ AlertType2["ERROR"] = "ERROR";
10687
+ AlertType2["INFO"] = "INFO";
10688
+ AlertType2["WARNING"] = "WARNING";
10689
+ AlertType2["CONSOLE"] = "CONSOLE";
10690
+ AlertType2["ETC"] = "ETC";
10691
+ return AlertType2;
10692
+ })(AlertType || {});
10693
+
10694
+ // ../simple-boot/dist/esm/alert/AlertService.js
10695
+ var __decorate2 = function(decorators, target, key, desc) {
10696
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10697
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10698
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10699
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10700
+ };
10701
+ var __metadata = function(k, v) {
10702
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10703
+ };
10704
+ var __param = function(paramIndex, decorator) {
10705
+ return function(target, key) {
10706
+ decorator(target, key, paramIndex);
10707
+ };
10708
+ };
10709
+ var _a;
10710
+ var AlertService = class AlertService2 {
10711
+ constructor(alertFactory) {
10712
+ this.name = (/* @__PURE__ */ new Date()).toUTCString();
10713
+ this.subject = new ReplaySubject();
10714
+ this.alertFactory = alertFactory;
10715
+ }
10716
+ // @PostConstruct
10717
+ // postConstruct(
10718
+ // ) {
10719
+ // this.alertFactory = alertFactory;
10720
+ // }
10721
+ get observable() {
10722
+ return this.subject.asObservable();
10723
+ }
10724
+ publish(data) {
10725
+ this.subject.next(data);
10726
+ }
10727
+ create(factory, config) {
10728
+ return new class extends Alert {
10729
+ make() {
10730
+ return factory(this);
10731
+ }
10732
+ }(this, config);
10733
+ }
10734
+ createFromFactory(type, config) {
10735
+ return this.alertFactory?.create({ caller: this, type, config });
10736
+ }
10737
+ danger(config) {
10738
+ return this.createFromFactory(AlertType.DANGER, config);
10739
+ }
10740
+ progress(config) {
10741
+ config = config ?? {};
10742
+ return this.createFromFactory(AlertType.PROGRESS, config);
10743
+ }
10744
+ success(config) {
10745
+ return this.createFromFactory(AlertType.SUCCESS, config);
10746
+ }
10747
+ info(config) {
10748
+ return this.createFromFactory(AlertType.INFO, config);
10749
+ }
10750
+ error(config) {
10751
+ return this.createFromFactory(AlertType.ERROR, config);
10752
+ }
10753
+ warning(config) {
10754
+ return this.createFromFactory(AlertType.WARNING, config);
10755
+ }
10756
+ };
10757
+ AlertService = __decorate2([
10758
+ Sim,
10759
+ __param(0, Inject({ symbol: AlertFactory.SYMBOL })),
10760
+ __metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
10761
+ ], AlertService);
10762
+
10763
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
10764
+ var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
10765
+ var getCacheSet = (simpleApplication) => {
10766
+ return simpleApplicationCache.get(simpleApplication);
10767
+ };
10768
+ var findCacheByKey = (simpleApplication, key) => {
10769
+ const storage = simpleApplicationCache.get(simpleApplication);
10770
+ if (storage) {
10771
+ return Array.from(storage.config.entries()).find(([k, v]) => k === key);
10772
+ }
10773
+ };
10774
+ var findCacheByKeyStartWith = (simpleApplication, key) => {
10775
+ const storage = simpleApplicationCache.get(simpleApplication);
10776
+ if (storage) {
10777
+ return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
10778
+ } else {
10779
+ return [];
10780
+ }
10781
+ };
10782
+ var deleteCacheByKey = (simpleApplication, key) => {
10783
+ const storage = simpleApplicationCache.get(simpleApplication);
10784
+ if (storage) {
10785
+ storage.storage.delete(key);
10786
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
10787
+ const data = storage.config.get(k);
10788
+ if (data?.expireTimeout) {
10789
+ clearTimeout(data.expireTimeout);
10790
+ }
10791
+ storage.config.delete(k);
10792
+ storage.storage.delete(k);
10793
+ });
10794
+ }
10795
+ };
10796
+ var deleteCacheByKeyStartWith = (simpleApplication, key) => {
10797
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
10798
+ };
10799
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
10800
+
10801
+ // ../simple-boot/dist/esm/cache/CacheManager.js
10802
+ var __decorate3 = function(decorators, target, key, desc) {
10803
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10804
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10805
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10806
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10807
+ };
10808
+ var __metadata2 = function(k, v) {
10809
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10810
+ };
10811
+ var _a2;
10812
+ var CacheManager = class CacheManager2 {
10813
+ constructor(simpleApplication) {
10814
+ this.simpleApplication = simpleApplication;
10815
+ }
10816
+ findCacheByKey(key) {
10817
+ return findCacheByKey(this.simpleApplication, key);
10818
+ }
10819
+ findCacheByKeyStartWith(key) {
10820
+ return findCacheByKeyStartWith(this.simpleApplication, key);
10821
+ }
10822
+ deleteCacheByKey(key) {
10823
+ return deleteCacheByKey(this.simpleApplication, key);
10824
+ }
10825
+ deleteCacheByKeyStartWith(key) {
10826
+ return deleteCacheByKeyStartWith(this.simpleApplication, key);
10827
+ }
10828
+ getCacheSet() {
10829
+ return getCacheSet(this.simpleApplication);
10830
+ }
10831
+ };
10832
+ CacheManager = __decorate3([
10833
+ Sim,
10834
+ __metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
10835
+ ], CacheManager);
10836
+
10837
+ // ../simple-boot/dist/esm/decorators/event/EventListener.js
10838
+ var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
10839
+
10840
+ // ../simple-boot/dist/esm/decorators/validate/Validation.js
10841
+ var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
10842
+ var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
10843
+
10844
+ // ../simple-boot/dist/esm/fetch/ApiService.js
10845
+ var __decorate4 = function(decorators, target, key, desc) {
10846
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10847
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10848
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10849
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10850
+ };
10851
+ var __metadata3 = function(k, v) {
10852
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10853
+ };
10854
+ var _a3;
10855
+ var _b;
10856
+ var ApiServiceInterceptor;
10857
+ (function(ApiServiceInterceptor2) {
10858
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
10859
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10860
+ try {
10861
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10862
+ } catch (e) {
10863
+ return [];
10864
+ }
10865
+ };
10866
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10867
+ var ApiService = class ApiService2 extends HttpJsonFetcher {
10868
+ constructor(simstanceManager, alertService) {
10869
+ super();
10870
+ this.simstanceManager = simstanceManager;
10871
+ this.subject = new Subject();
10872
+ this.alertService = alertService;
10873
+ }
10874
+ // @PostConstruct
10875
+ // postConstruct(alertService: AlertService<any>) {
10876
+ // this.alertService = alertService;
10877
+ // }
10878
+ get observable() {
10879
+ return this.subject.asObservable();
10880
+ }
10881
+ createPipe(config) {
10882
+ return {};
10883
+ }
10884
+ async beforeProxyFetch(config) {
10885
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10886
+ for (const interceptor of interceptors) {
10887
+ if (interceptor.beforeProxyFetch) {
10888
+ config = await interceptor.beforeProxyFetch(config);
10889
+ }
10890
+ }
10891
+ this.subject.next({ type: "beforeFetchData", config });
10892
+ return config;
10893
+ }
10894
+ async afterProxyFetch(config) {
10895
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10896
+ let r = config.response;
10897
+ for (const interceptor of interceptors) {
10898
+ if (interceptor.afterProxyFetch) {
10899
+ r = await interceptor.afterProxyFetch(config);
10900
+ }
10901
+ }
10902
+ this.subject.next({ type: "afterFetchData", response: r });
10903
+ return r;
10904
+ }
10905
+ beforeFetch(fetch2) {
10906
+ this.subject.next({ type: "beforeFetch", fetch: fetch2 });
10907
+ }
10908
+ afterFetch(fetch2, response) {
10909
+ this.subject.next({ type: "afterFetch", fetch: fetch2, response });
10910
+ }
10911
+ before(config, pipe) {
10912
+ this.subject.next({ type: "progress", config, pipe });
10913
+ config.config?.config?.callBackProgress?.(config, pipe);
10914
+ if (config.config?.config?.alertProgress) {
10915
+ const alert = this.alertService?.progress({ title: config.config.config.title });
10916
+ if (alert) {
10917
+ pipe.progress = alert;
10918
+ alert.activate();
10919
+ }
10920
+ }
10921
+ }
10922
+ afterSuccess(config, pipe) {
10923
+ this.subject.next({ type: "success", config, pipe });
10924
+ config.config?.config?.callBackSuccess?.(config, pipe);
10925
+ if (config.config?.config?.alertSuccessMsg) {
10926
+ this.alertService?.success({ title: config.config.config.title })?.activate();
10927
+ }
10928
+ }
10929
+ afterSuccessTransform(config, pipe) {
10930
+ }
10931
+ finally(config, pipe) {
10932
+ this.subject.next({ type: "final", config, pipe });
10933
+ config.config?.config?.callBackFinal?.(config, pipe);
10934
+ pipe.progress?.deActivate();
10935
+ }
10936
+ error(config, pipe, e) {
10937
+ console.log("error", e);
10938
+ this.subject.next({ type: "error", config, pipe, e });
10939
+ config.config?.config?.callBackError?.(config, pipe, e);
10940
+ if (config.config?.config?.alertErrorMsg) {
10941
+ this.alertService?.danger({
10942
+ title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
10943
+ })?.activate();
10944
+ }
10945
+ if (config.config?.config?.enableErrorConsole) {
10946
+ console.error(`apiService Error ${config?.config?.config?.title}`, e);
10947
+ }
10948
+ }
10949
+ async execute(fetcherRequest) {
10950
+ const target = fetcherRequest.target;
10951
+ const config = fetcherRequest.config;
10952
+ let r = { target, config };
10953
+ const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
10954
+ for (const apiServiceInterceptor of interceptor) {
10955
+ if (apiServiceInterceptor.beforeProxyExecute) {
10956
+ r = await apiServiceInterceptor.beforeProxyExecute?.(r);
10957
+ }
10958
+ }
10959
+ return super.execute(r);
10960
+ }
10961
+ };
10962
+ ApiService = __decorate4([
10963
+ Sim,
10964
+ __metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
10965
+ ], ApiService);
8668
10966
  return __toCommonJS(bundle_entry_exports);
8669
10967
  })();
8670
10968
  /*! Bundled license information: