@dooboostore/simple-web-component 1.0.36 → 1.0.37

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 (210) hide show
  1. package/README.md +41 -4
  2. package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +6 -6
  3. package/dist/cjs/SwcAppEngine.js.map +7 -0
  4. package/dist/cjs/decorators/applyNode.js +14 -13
  5. package/dist/cjs/decorators/applyNode.js.map +2 -2
  6. package/dist/cjs/decorators/applySlot.js +122 -0
  7. package/dist/cjs/decorators/applySlot.js.map +7 -0
  8. package/dist/cjs/decorators/elementDefine.js +38 -30
  9. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  10. package/dist/cjs/decorators/index.js +1 -0
  11. package/dist/cjs/decorators/index.js.map +2 -2
  12. package/dist/cjs/decorators/lifecycles.js +56 -8
  13. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  14. package/dist/cjs/elements/{SwcAppMixin.js → SwcApp.js} +107 -57
  15. package/dist/cjs/elements/SwcApp.js.map +7 -0
  16. package/dist/cjs/elements/index.js +21 -2
  17. package/dist/cjs/elements/index.js.map +3 -3
  18. package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
  19. package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
  20. package/dist/cjs/elements/tt/SwcAsync.js +1 -0
  21. package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
  22. package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
  23. package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
  24. package/dist/cjs/elements/tt/SwcChoose.js +1 -0
  25. package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
  26. package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
  27. package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
  28. package/dist/cjs/elements/tt/SwcIf.js +1 -0
  29. package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
  30. package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
  31. package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
  32. package/dist/cjs/elements/tt/SwcLoop.js +1 -0
  33. package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
  34. package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
  35. package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
  36. package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
  37. package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
  38. package/dist/cjs/elements/tt/register.js +1 -0
  39. package/dist/cjs/elements/tt/register.js.map +7 -0
  40. package/dist/cjs/index.js +12 -8
  41. package/dist/cjs/index.js.map +2 -2
  42. package/dist/cjs/types/window.d.js +16 -0
  43. package/dist/cjs/types/window.d.js.map +7 -0
  44. package/dist/cjs/types.js.map +1 -1
  45. package/dist/cjs/utils/Utils.js +9 -6
  46. package/dist/cjs/utils/Utils.js.map +2 -2
  47. package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +4 -4
  48. package/dist/esm/SwcAppEngine.js.map +7 -0
  49. package/dist/esm/decorators/applyNode.js +14 -13
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +103 -0
  52. package/dist/esm/decorators/applySlot.js.map +7 -0
  53. package/dist/esm/decorators/elementDefine.js +41 -33
  54. package/dist/esm/decorators/elementDefine.js.map +2 -2
  55. package/dist/esm/decorators/index.js +1 -0
  56. package/dist/esm/decorators/index.js.map +2 -2
  57. package/dist/esm/decorators/lifecycles.js +56 -8
  58. package/dist/esm/decorators/lifecycles.js.map +2 -2
  59. package/dist/esm/elements/{SwcAppMixin.js → SwcApp.js} +102 -53
  60. package/dist/esm/elements/SwcApp.js.map +7 -0
  61. package/dist/esm/elements/index.js +7 -1
  62. package/dist/esm/elements/index.js.map +2 -2
  63. package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
  64. package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
  65. package/dist/esm/elements/tt/SwcAsync.js +1 -0
  66. package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
  67. package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
  68. package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
  69. package/dist/esm/elements/tt/SwcChoose.js +1 -0
  70. package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
  71. package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
  72. package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
  73. package/dist/esm/elements/tt/SwcIf.js +1 -0
  74. package/dist/esm/elements/tt/SwcIf.js.map +7 -0
  75. package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
  76. package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
  77. package/dist/esm/elements/tt/SwcLoop.js +1 -0
  78. package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
  79. package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
  80. package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
  81. package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
  82. package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
  83. package/dist/esm/elements/tt/register.js +1 -0
  84. package/dist/esm/elements/tt/register.js.map +7 -0
  85. package/dist/esm/index.js +13 -9
  86. package/dist/esm/index.js.map +2 -2
  87. package/dist/esm/types/window.d.js +1 -0
  88. package/dist/esm/types/window.d.js.map +7 -0
  89. package/dist/esm/types.js.map +1 -1
  90. package/dist/esm/utils/Utils.js +9 -6
  91. package/dist/esm/utils/Utils.js.map +2 -2
  92. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3867 -97
  93. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  94. package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
  95. package/dist/types/SwcAppEngine.d.ts.map +1 -0
  96. package/dist/types/decorators/applyNode.d.ts +7 -7
  97. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  98. package/dist/types/decorators/applySlot.d.ts +27 -0
  99. package/dist/types/decorators/applySlot.d.ts.map +1 -0
  100. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  101. package/dist/types/decorators/index.d.ts +1 -0
  102. package/dist/types/decorators/index.d.ts.map +1 -1
  103. package/dist/types/decorators/lifecycles.d.ts +21 -6
  104. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  105. package/dist/types/elements/SwcApp.d.ts +7 -0
  106. package/dist/types/elements/SwcApp.d.ts.map +1 -0
  107. package/dist/types/elements/index.d.ts +2 -1
  108. package/dist/types/elements/index.d.ts.map +1 -1
  109. package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
  110. package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
  111. package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
  112. package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
  113. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
  114. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
  115. package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
  116. package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
  117. package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
  118. package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
  119. package/dist/types/elements/tt/SwcIf.d.ts +1 -0
  120. package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
  121. package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
  122. package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
  123. package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
  124. package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
  125. package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
  126. package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
  127. package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
  128. package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
  129. package/dist/types/elements/tt/register.d.ts +1 -0
  130. package/dist/types/elements/tt/register.d.ts.map +1 -0
  131. package/dist/types/index.d.ts +2 -2
  132. package/dist/types/index.d.ts.map +1 -1
  133. package/dist/types/types.d.ts +3 -3
  134. package/dist/types/types.d.ts.map +1 -1
  135. package/dist/types/utils/Utils.d.ts +6 -5
  136. package/dist/types/utils/Utils.d.ts.map +1 -1
  137. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3867 -97
  138. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  139. package/package.json +2 -2
  140. package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +12 -7
  141. package/src/decorators/applyNode.ts +15 -13
  142. package/src/decorators/applySlot.ts +228 -0
  143. package/src/decorators/elementDefine.ts +59 -37
  144. package/src/decorators/index.ts +1 -0
  145. package/src/decorators/lifecycles.ts +76 -11
  146. package/src/elements/{SwcAppMixin.ts → SwcApp.ts} +98 -31
  147. package/src/elements/index.ts +11 -1
  148. package/src/elements/tt/SwcAppMixin.ts +13 -0
  149. package/src/elements/tt/SwcAsync.ts +139 -0
  150. package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
  151. package/src/elements/tt/SwcChoose.ts +182 -0
  152. package/src/elements/tt/SwcChooseTemplate.ts +229 -0
  153. package/src/elements/tt/SwcIf.ts +145 -0
  154. package/src/elements/tt/SwcIfTemplate.ts +158 -0
  155. package/src/elements/tt/SwcLoop.ts +222 -0
  156. package/src/elements/tt/SwcLoopTemplate.ts +255 -0
  157. package/src/elements/tt/SwcSubTemplates.ts +6 -0
  158. package/src/elements/tt/register.ts +720 -0
  159. package/src/index.ts +13 -9
  160. package/src/types/window.d.ts +43 -0
  161. package/src/types.ts +4 -3
  162. package/src/utils/Utils.ts +11 -6
  163. package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
  164. package/dist/cjs/elements/SwcAppMixin.js.map +0 -7
  165. package/dist/cjs/elements/SwcAsync.js +0 -129
  166. package/dist/cjs/elements/SwcAsync.js.map +0 -7
  167. package/dist/cjs/elements/SwcChoose.js +0 -155
  168. package/dist/cjs/elements/SwcChoose.js.map +0 -7
  169. package/dist/cjs/elements/SwcIf.js +0 -117
  170. package/dist/cjs/elements/SwcIf.js.map +0 -7
  171. package/dist/cjs/elements/SwcLoop.js +0 -176
  172. package/dist/cjs/elements/SwcLoop.js.map +0 -7
  173. package/dist/cjs/elements/SwcSubTemplates.js +0 -13
  174. package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
  175. package/dist/cjs/elements/register.js +0 -1026
  176. package/dist/cjs/elements/register.js.map +0 -7
  177. package/dist/esm/elements/SwcAppEngine.js.map +0 -7
  178. package/dist/esm/elements/SwcAppMixin.js.map +0 -7
  179. package/dist/esm/elements/SwcAsync.js +0 -129
  180. package/dist/esm/elements/SwcAsync.js.map +0 -7
  181. package/dist/esm/elements/SwcChoose.js +0 -155
  182. package/dist/esm/elements/SwcChoose.js.map +0 -7
  183. package/dist/esm/elements/SwcIf.js +0 -117
  184. package/dist/esm/elements/SwcIf.js.map +0 -7
  185. package/dist/esm/elements/SwcLoop.js +0 -176
  186. package/dist/esm/elements/SwcLoop.js.map +0 -7
  187. package/dist/esm/elements/SwcSubTemplates.js +0 -13
  188. package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
  189. package/dist/esm/elements/register.js +0 -1007
  190. package/dist/esm/elements/register.js.map +0 -7
  191. package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
  192. package/dist/types/elements/SwcAppMixin.d.ts +0 -386
  193. package/dist/types/elements/SwcAppMixin.d.ts.map +0 -1
  194. package/dist/types/elements/SwcAsync.d.ts +0 -2
  195. package/dist/types/elements/SwcAsync.d.ts.map +0 -1
  196. package/dist/types/elements/SwcChoose.d.ts +0 -2
  197. package/dist/types/elements/SwcChoose.d.ts.map +0 -1
  198. package/dist/types/elements/SwcIf.d.ts +0 -2
  199. package/dist/types/elements/SwcLoop.d.ts +0 -2
  200. package/dist/types/elements/SwcLoop.d.ts.map +0 -1
  201. package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
  202. package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
  203. package/dist/types/elements/register.d.ts +0 -4
  204. package/dist/types/elements/register.d.ts.map +0 -1
  205. package/src/elements/SwcAsync.ts +0 -126
  206. package/src/elements/SwcChoose.ts +0 -190
  207. package/src/elements/SwcIf.ts +0 -124
  208. package/src/elements/SwcLoop.ts +0 -205
  209. package/src/elements/SwcSubTemplates.ts +0 -6
  210. package/src/elements/register.ts +0 -1022
@@ -5,6 +5,7 @@ var dooboostoreSimpleWebComponent = (() => {
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __commonJS = (cb, mod) => function __require() {
9
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
11
  };
@@ -29,6 +30,7 @@ var dooboostoreSimpleWebComponent = (() => {
29
30
  mod
30
31
  ));
31
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
34
 
33
35
  // ../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
34
36
  var require_Reflect = __commonJS({
@@ -1120,6 +1122,7 @@ var dooboostoreSimpleWebComponent = (() => {
1120
1122
  __export(bundle_entry_exports, {
1121
1123
  ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
1122
1124
  APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
1125
+ APPLY_SLOT_METADATA_KEY: () => APPLY_SLOT_METADATA_KEY,
1123
1126
  ATTRIBUTE_APPLY_METADATA_KEY: () => ATTRIBUTE_APPLY_METADATA_KEY,
1124
1127
  ATTRIBUTE_CHANGED_WILDCARD: () => ATTRIBUTE_CHANGED_WILDCARD,
1125
1128
  ATTRIBUTE_FIELD_METADATA_KEY: () => ATTRIBUTE_FIELD_METADATA_KEY,
@@ -1129,7 +1132,6 @@ var dooboostoreSimpleWebComponent = (() => {
1129
1132
  ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
1130
1133
  EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
1131
1134
  HTML_TAG_ENTRIES: () => HTML_TAG_ENTRIES,
1132
- INNER_HTML_METADATA_KEY: () => INNER_HTML_METADATA_KEY,
1133
1135
  InjectSituationType: () => InjectSituationType,
1134
1136
  ON_ADD_EVENT_LISTENER_METADATA_KEY: () => ON_ADD_EVENT_LISTENER_METADATA_KEY,
1135
1137
  ON_AFTER_ADOPTED_METADATA_KEY: () => ON_AFTER_ADOPTED_METADATA_KEY,
@@ -1139,6 +1141,8 @@ var dooboostoreSimpleWebComponent = (() => {
1139
1141
  ON_BEFORE_ADOPTED_METADATA_KEY: () => ON_BEFORE_ADOPTED_METADATA_KEY,
1140
1142
  ON_BEFORE_CONNECTED_METADATA_KEY: () => ON_BEFORE_CONNECTED_METADATA_KEY,
1141
1143
  ON_BEFORE_DISCONNECTED_METADATA_KEY: () => ON_BEFORE_DISCONNECTED_METADATA_KEY,
1144
+ ON_CONNECTED_COMPLETED_METADATA_KEY: () => ON_CONNECTED_COMPLETED_METADATA_KEY,
1145
+ ON_CONNECTED_INNER_HTML_METADATA_KEY: () => ON_CONNECTED_INNER_HTML_METADATA_KEY,
1142
1146
  ON_CONNECTED_SWC_APP_METADATA_KEY: () => ON_CONNECTED_SWC_APP_METADATA_KEY,
1143
1147
  ON_INITIALIZE_METADATA_KEY: () => ON_INITIALIZE_METADATA_KEY,
1144
1148
  PROPERTY_SET_METADATA_KEY: () => PROPERTY_SET_METADATA_KEY,
@@ -1163,15 +1167,26 @@ var dooboostoreSimpleWebComponent = (() => {
1163
1167
  applyAttributeThis: () => applyAttributeThis,
1164
1168
  applyClass: () => applyClass,
1165
1169
  applyClassThis: () => applyClassThis,
1166
- applyInnerHtmlNode: () => applyInnerHtmlNode,
1167
- applyInnerHtmlNodeThis: () => applyInnerHtmlNodeThis,
1168
- applyInnerTextNode: () => applyInnerTextNode,
1169
1170
  applyNode: () => applyNode,
1171
+ applyNodeInnerHtml: () => applyNodeInnerHtml,
1172
+ applyNodeInnerText: () => applyNodeInnerText,
1173
+ applyNodeReplaceChildren: () => applyNodeReplaceChildren,
1170
1174
  applyNodeThis: () => applyNodeThis,
1171
- applyReplaceChildrenNode: () => applyReplaceChildrenNode,
1172
- applyReplaceChildrenNodeThis: () => applyReplaceChildrenNodeThis,
1175
+ applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
1176
+ applySlot: () => applySlot,
1177
+ applySlotAppend: () => applySlotAppend,
1178
+ applySlotAppendHtml: () => applySlotAppendHtml,
1179
+ applySlotAppendText: () => applySlotAppendText,
1180
+ applySlotClear: () => applySlotClear,
1181
+ applySlotPrepend: () => applySlotPrepend,
1182
+ applySlotPrependHtml: () => applySlotPrependHtml,
1183
+ applySlotPrependText: () => applySlotPrependText,
1184
+ applySlotReplaceChildren: () => applySlotReplaceChildren,
1185
+ applySlotReplaceChildrenHtml: () => applySlotReplaceChildrenHtml,
1186
+ applySlotReplaceChildrenText: () => applySlotReplaceChildrenText,
1173
1187
  applyStyle: () => applyStyle,
1174
1188
  applyStyleThis: () => applyStyleThis,
1189
+ applyThisInnerHtmlNode: () => applyThisInnerHtmlNode,
1175
1190
  attribute: () => attribute,
1176
1191
  attributeThis: () => attributeThis,
1177
1192
  changedAttributeThis: () => changedAttributeThis,
@@ -1184,6 +1199,7 @@ var dooboostoreSimpleWebComponent = (() => {
1184
1199
  emitCustomEventThis: () => emitCustomEventThis,
1185
1200
  ensureInit: () => ensureInit,
1186
1201
  findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
1202
+ findAllApplySlotMetadata: () => findAllApplySlotMetadata,
1187
1203
  findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
1188
1204
  findAllAttributeChangedMetadata: () => findAllAttributeChangedMetadata,
1189
1205
  findAllAttributeMetadata: () => findAllAttributeMetadata,
@@ -1195,6 +1211,8 @@ var dooboostoreSimpleWebComponent = (() => {
1195
1211
  getChangedAttributeMetadata: () => getChangedAttributeMetadata,
1196
1212
  getElementConfig: () => getElementConfig,
1197
1213
  getEmitCustomEventMetadataList: () => getEmitCustomEventMetadataList,
1214
+ getOnConnectedAfterMetadata: () => getOnConnectedAfterMetadata,
1215
+ getOnConnectedBeforeMetadata: () => getOnConnectedBeforeMetadata,
1198
1216
  getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
1199
1217
  getPublishSwcAppMessageMetadata: () => getPublishSwcAppMessageMetadata,
1200
1218
  getQueryAllMetadata: () => getQueryAllMetadata,
@@ -1219,7 +1237,9 @@ var dooboostoreSimpleWebComponent = (() => {
1219
1237
  onConnected: () => onConnected,
1220
1238
  onConnectedAfter: () => onConnectedAfter,
1221
1239
  onConnectedBefore: () => onConnectedBefore,
1240
+ onConnectedCompleted: () => onConnectedCompleted,
1222
1241
  onConnectedInnerHtml: () => onConnectedInnerHtml,
1242
+ onConnectedSwcApp: () => onConnectedSwcApp,
1223
1243
  onDisconnected: () => onDisconnected,
1224
1244
  onDisconnectedAfter: () => onDisconnectedAfter,
1225
1245
  onDisconnectedBefore: () => onDisconnectedBefore,
@@ -1233,6 +1253,8 @@ var dooboostoreSimpleWebComponent = (() => {
1233
1253
  queryHost: () => queryHost,
1234
1254
  queryThis: () => queryThis,
1235
1255
  queryWindow: () => queryWindow,
1256
+ register: () => register,
1257
+ registerSwcApp: () => registerSwcApp,
1236
1258
  removeAttribute: () => removeAttribute,
1237
1259
  removeAttributeThis: () => removeAttributeThis,
1238
1260
  removeClass: () => removeClass,
@@ -1260,10 +1282,10 @@ var dooboostoreSimpleWebComponent = (() => {
1260
1282
  updateStyle: () => updateStyle,
1261
1283
  updateStyleThis: () => updateStyleThis
1262
1284
  });
1263
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1285
+ var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1264
1286
 
1265
1287
  // src/index.ts
1266
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
1288
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1267
1289
 
1268
1290
  // ../core/dist/esm/valid/ValidUtils.js
1269
1291
  var ValidUtils;
@@ -4939,6 +4961,137 @@ var dooboostoreSimpleWebComponent = (() => {
4939
4961
  }
4940
4962
  };
4941
4963
 
4964
+ // ../core/dist/esm/message/Subject.js
4965
+ var Subject = class extends Observable {
4966
+ constructor() {
4967
+ super((subscriber) => {
4968
+ return this._subscribeToSubject(subscriber);
4969
+ });
4970
+ this._observers = /* @__PURE__ */ new Set();
4971
+ this._isStopped = false;
4972
+ this._hasError = false;
4973
+ }
4974
+ _subscribeToSubject(subscriber) {
4975
+ const partialObserver = {
4976
+ next: subscriber.next.bind(subscriber),
4977
+ error: subscriber.error.bind(subscriber),
4978
+ complete: subscriber.complete.bind(subscriber)
4979
+ };
4980
+ if (this._isStopped) {
4981
+ if (this._hasError) {
4982
+ partialObserver.error?.(this._error);
4983
+ } else {
4984
+ partialObserver.complete?.();
4985
+ }
4986
+ return Subscription.EMPTY;
4987
+ }
4988
+ this._observers.add(partialObserver);
4989
+ return new Subscription(() => {
4990
+ this._observers.delete(partialObserver);
4991
+ });
4992
+ }
4993
+ next(data) {
4994
+ if (this._isStopped) {
4995
+ return;
4996
+ }
4997
+ this._observers.forEach((observer) => {
4998
+ observer.next?.(data);
4999
+ });
5000
+ }
5001
+ error(err) {
5002
+ if (this._isStopped) {
5003
+ return;
5004
+ }
5005
+ this._hasError = true;
5006
+ this._error = err;
5007
+ this._isStopped = true;
5008
+ this._observers.forEach((observer) => observer.error?.(err));
5009
+ this._observers.clear();
5010
+ }
5011
+ complete() {
5012
+ if (this._isStopped) {
5013
+ return;
5014
+ }
5015
+ this._isStopped = true;
5016
+ this._observers.forEach((observer) => observer.complete?.());
5017
+ this._observers.clear();
5018
+ }
5019
+ asObservable() {
5020
+ return new Observable((subscriber) => {
5021
+ return this._subscribeToSubject(subscriber);
5022
+ });
5023
+ }
5024
+ };
5025
+
5026
+ // ../core/dist/esm/message/BehaviorSubject.js
5027
+ var BehaviorSubject = class extends Subject {
5028
+ // BehaviorSubject always has a current value
5029
+ constructor(initialValue) {
5030
+ super();
5031
+ this._value = initialValue;
5032
+ }
5033
+ next(data) {
5034
+ this._value = data;
5035
+ super.next(data);
5036
+ }
5037
+ _subscribeToSubject(subscriber) {
5038
+ const subscription = super._subscribeToSubject(subscriber);
5039
+ if (!this._isStopped) {
5040
+ subscriber.next(this._value);
5041
+ } else if (this._hasError) {
5042
+ subscriber.error(this._error);
5043
+ } else {
5044
+ subscriber.complete();
5045
+ }
5046
+ return subscription;
5047
+ }
5048
+ getValue() {
5049
+ if (this._hasError) {
5050
+ throw this._error;
5051
+ }
5052
+ return this._value;
5053
+ }
5054
+ };
5055
+
5056
+ // ../core/dist/esm/message/ReplaySubject.js
5057
+ var ReplaySubject = class extends Subject {
5058
+ // Removed: private _error: E | undefined;
5059
+ // Removed: private _isStopped = false;
5060
+ constructor(bufferSize = Infinity) {
5061
+ super();
5062
+ this.bufferSize = bufferSize;
5063
+ this._buffer = [];
5064
+ }
5065
+ next(data) {
5066
+ if (this._isStopped) {
5067
+ return;
5068
+ }
5069
+ this._buffer.push(data);
5070
+ if (this._buffer.length > this.bufferSize) {
5071
+ this._buffer.shift();
5072
+ }
5073
+ super.next(data);
5074
+ }
5075
+ error(err) {
5076
+ super.error(err);
5077
+ }
5078
+ complete() {
5079
+ super.complete();
5080
+ }
5081
+ _subscribeToSubject(subscriber) {
5082
+ this._buffer.forEach((value) => subscriber.next(value));
5083
+ if (this._isStopped) {
5084
+ if (this._hasError) {
5085
+ subscriber.error(this._error);
5086
+ } else {
5087
+ subscriber.complete();
5088
+ }
5089
+ return Subscription.EMPTY;
5090
+ }
5091
+ return super._subscribeToSubject(subscriber);
5092
+ }
5093
+ };
5094
+
4942
5095
  // ../core/dist/esm/message/AutoCloseSubscription.js
4943
5096
  var AutoCloseSubscription = class extends Subscription {
4944
5097
  constructor(userUnsubscribe) {
@@ -4946,6 +5099,19 @@ var dooboostoreSimpleWebComponent = (() => {
4946
5099
  }
4947
5100
  };
4948
5101
 
5102
+ // ../core/dist/esm/message/index.js
5103
+ var debounceTimeIntervalLock = (unlockChecker, unlocked, intervalTime, config) => {
5104
+ const clearIntervalFn = config?.clearInterval || clearInterval;
5105
+ const setIntervalFn = config?.setInterval || setInterval;
5106
+ const nextIntervalId = setIntervalFn(() => {
5107
+ if (unlockChecker()) {
5108
+ clearIntervalFn(nextIntervalId);
5109
+ unlocked();
5110
+ }
5111
+ }, intervalTime);
5112
+ return nextIntervalId;
5113
+ };
5114
+
4949
5115
  // ../core/dist/esm/promise/AbortablePromise.js
4950
5116
  var AbortablePromise = class _AbortablePromise {
4951
5117
  constructor(executor, signal) {
@@ -5273,6 +5439,284 @@ var dooboostoreSimpleWebComponent = (() => {
5273
5439
  })(Result = Promises2.Result || (Promises2.Result = {}));
5274
5440
  })(Promises || (Promises = {}));
5275
5441
 
5442
+ // ../core/dist/esm/fetch/Fetcher.js
5443
+ var Fetcher = class {
5444
+ createPipe(config) {
5445
+ return {};
5446
+ }
5447
+ fetch(config) {
5448
+ return new Promise((resolve, reject) => {
5449
+ const pipe = this.createPipe(config);
5450
+ Promise.resolve().then(() => {
5451
+ this.before(config, pipe);
5452
+ config?.before?.();
5453
+ }).then(() => {
5454
+ return this.execute(config);
5455
+ }).then((data) => {
5456
+ const hasError = config.config?.hasErrorChecker?.(data);
5457
+ if (hasError) {
5458
+ throw hasError;
5459
+ }
5460
+ pipe.responseData = data;
5461
+ this.afterSuccess(config, pipe);
5462
+ config?.afterSuccess?.();
5463
+ const gdata = config?.transform ? config.transform(data) : data;
5464
+ this.afterSuccessTransform(config, pipe);
5465
+ resolve(gdata);
5466
+ }).catch(async (e) => {
5467
+ this.error(config, pipe, e);
5468
+ config?.error?.();
5469
+ if (config?.errorTransform) {
5470
+ e = await config.errorTransform(e);
5471
+ }
5472
+ e = await this.errorTransform(e);
5473
+ reject(e);
5474
+ }).finally(() => {
5475
+ this.finally(config, pipe);
5476
+ config?.finally?.();
5477
+ });
5478
+ });
5479
+ }
5480
+ };
5481
+
5482
+ // ../core/dist/esm/fetch/HttpFetcher.js
5483
+ var HttpResponseError = class extends Error {
5484
+ };
5485
+ var HttpFetcher = class extends Fetcher {
5486
+ get(config) {
5487
+ config.config ?? (config.config = {});
5488
+ config.config.fetch = config.config?.fetch ?? {};
5489
+ config.config.fetch.method = "GET";
5490
+ return this.fetch(config);
5491
+ }
5492
+ post(config) {
5493
+ config.config ?? (config.config = {});
5494
+ config.config.fetch = config.config?.fetch ?? {};
5495
+ config.config.fetch.method = "POST";
5496
+ return this.fetch(config);
5497
+ }
5498
+ patch(config) {
5499
+ config.config ?? (config.config = {});
5500
+ config.config.fetch = config.config?.fetch ?? {};
5501
+ config.config.fetch.method = "PATCH";
5502
+ return this.fetch(config);
5503
+ }
5504
+ put(config) {
5505
+ config.config ?? (config.config = {});
5506
+ config.config.fetch = config.config?.fetch ?? {};
5507
+ config.config.fetch.method = "PUT";
5508
+ return this.fetch(config);
5509
+ }
5510
+ head(config) {
5511
+ config.config ?? (config.config = {});
5512
+ config.config.fetch = config.config?.fetch ?? {};
5513
+ config.config.fetch.method = "HEAD";
5514
+ return this.fetch(config);
5515
+ }
5516
+ delete(config) {
5517
+ config.config ?? (config.config = {});
5518
+ config.config.fetch = config.config?.fetch ?? {};
5519
+ config.config.fetch.method = "DELETE";
5520
+ return this.fetch(config);
5521
+ }
5522
+ async beforeProxyFetch(config) {
5523
+ return config;
5524
+ }
5525
+ async afterProxyFetch(config) {
5526
+ return config.response;
5527
+ }
5528
+ afterSuccess(config, pipe) {
5529
+ }
5530
+ afterSuccessTransform(config, pipe) {
5531
+ }
5532
+ before(config, pipe) {
5533
+ }
5534
+ error(config, pipe, e) {
5535
+ }
5536
+ finally(config, pipe) {
5537
+ }
5538
+ beforeFetch(fetch2) {
5539
+ }
5540
+ afterFetch(fetch2, response) {
5541
+ }
5542
+ // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5543
+ async errorTransform(e) {
5544
+ const httpResponseError = new HttpResponseError();
5545
+ httpResponseError.error = e;
5546
+ if (e instanceof Response) {
5547
+ httpResponseError.response = e;
5548
+ try {
5549
+ httpResponseError.body = await e.clone().text();
5550
+ httpResponseError.message = e.statusText;
5551
+ } catch (e2) {
5552
+ httpResponseError.body = e2;
5553
+ httpResponseError.message = e2.message;
5554
+ }
5555
+ } else {
5556
+ httpResponseError.body = e;
5557
+ httpResponseError.message = e.message;
5558
+ }
5559
+ return httpResponseError;
5560
+ }
5561
+ async execute(fetcherRequest) {
5562
+ let target = fetcherRequest.target;
5563
+ let config = fetcherRequest.config;
5564
+ if (!(target instanceof URL) && typeof target !== "string") {
5565
+ const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5566
+ try {
5567
+ const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5568
+ searchParams.forEach((value, key) => {
5569
+ url.searchParams.append(key, value);
5570
+ });
5571
+ target = url;
5572
+ } catch (e) {
5573
+ if (typeof target.url === "string") {
5574
+ const searchParamString = searchParams.toString();
5575
+ target = target.url + (searchParamString ? "?" + searchParamString : "");
5576
+ } else {
5577
+ target = "";
5578
+ }
5579
+ }
5580
+ }
5581
+ const beforeProxyData = { requestInfo: target, init: config?.fetch };
5582
+ let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5583
+ beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5584
+ target = beforeData.requestInfo;
5585
+ if (beforeData.init) {
5586
+ config ?? (config = {});
5587
+ config.fetch = beforeData.init;
5588
+ }
5589
+ let abortedTimeout;
5590
+ if (config?.fetch && "timeout" in config.fetch) {
5591
+ const abortController = new AbortController();
5592
+ abortedTimeout = setTimeout(() => {
5593
+ if (config?.fetch?.signal) {
5594
+ const inputSignal = config.fetch.signal;
5595
+ const listener = () => {
5596
+ if (!abortController.signal.aborted) {
5597
+ abortController.abort();
5598
+ }
5599
+ inputSignal.removeEventListener("abort", listener);
5600
+ };
5601
+ inputSignal.addEventListener("abort", listener);
5602
+ }
5603
+ if (!abortController.signal.aborted) {
5604
+ abortController.abort();
5605
+ }
5606
+ }, config.fetch.timeout);
5607
+ config.fetch.signal = abortController.signal;
5608
+ }
5609
+ this.beforeFetch({ target, requestInit: config?.fetch });
5610
+ return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5611
+ this.afterFetch({ target, requestInit: config?.fetch }, it);
5612
+ const afterProxyData = {
5613
+ fetch: { target, requestInit: config.fetch },
5614
+ config: beforeData,
5615
+ response: it
5616
+ };
5617
+ it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5618
+ it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5619
+ config?.fetchResponseAfterCallBack?.(it, config);
5620
+ if (!config?.allowedResponseNotOk && !it.ok) {
5621
+ throw it;
5622
+ }
5623
+ const data = config?.hasResponseErrorChecker?.(it, config);
5624
+ if (data) {
5625
+ throw data;
5626
+ }
5627
+ return it;
5628
+ }).finally(() => {
5629
+ if (abortedTimeout) {
5630
+ clearTimeout(abortedTimeout);
5631
+ }
5632
+ });
5633
+ }
5634
+ };
5635
+
5636
+ // ../core/dist/esm/fetch/HttpJsonFetcher.js
5637
+ var HttpJsonFetcher = class extends HttpFetcher {
5638
+ updateJsonFetchConfigAndData(config) {
5639
+ var _a, _b;
5640
+ const headers = {
5641
+ "Content-Type": "application/json",
5642
+ Accept: "application/json, text/plain, */*"
5643
+ };
5644
+ config.config ?? (config.config = {});
5645
+ (_a = config.config).fetch ?? (_a.fetch = {});
5646
+ (_b = config.config.fetch).headers ?? (_b.headers = {});
5647
+ config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5648
+ if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5649
+ config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5650
+ }
5651
+ return config;
5652
+ }
5653
+ get(config) {
5654
+ return super.get(config);
5655
+ }
5656
+ delete(config) {
5657
+ return super.delete(config);
5658
+ }
5659
+ post(config) {
5660
+ return super.post(config);
5661
+ }
5662
+ patch(config) {
5663
+ return super.patch(config);
5664
+ }
5665
+ put(config) {
5666
+ return super.put(config);
5667
+ }
5668
+ head(config) {
5669
+ return super.head(config);
5670
+ }
5671
+ postJson(config) {
5672
+ return super.post(this.updateJsonFetchConfigAndData(config));
5673
+ }
5674
+ patchJson(config) {
5675
+ return super.patch(this.updateJsonFetchConfigAndData(config));
5676
+ }
5677
+ putJson(config) {
5678
+ return super.put(this.updateJsonFetchConfigAndData(config));
5679
+ }
5680
+ async errorTransform(e) {
5681
+ const httpResponseError = new HttpResponseError();
5682
+ httpResponseError.error = e;
5683
+ if (e instanceof Response) {
5684
+ httpResponseError.response = e;
5685
+ try {
5686
+ httpResponseError.body = await e.clone().json();
5687
+ httpResponseError.message = e.statusText;
5688
+ } catch (parseError) {
5689
+ httpResponseError.body = parseError;
5690
+ httpResponseError.message = parseError.message;
5691
+ }
5692
+ } else {
5693
+ httpResponseError.body = e;
5694
+ httpResponseError.message = e.message;
5695
+ }
5696
+ return httpResponseError;
5697
+ }
5698
+ // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5699
+ execute(fetcherRequest) {
5700
+ return super.execute(fetcherRequest).then((response) => {
5701
+ const config = fetcherRequest.config;
5702
+ const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5703
+ if (transform === "response") {
5704
+ return response;
5705
+ } else if (transform === "text") {
5706
+ return response?.text();
5707
+ } else if (typeof transform === "function") {
5708
+ return transform(response);
5709
+ } else {
5710
+ return response?.text().then((it) => {
5711
+ if ((it ?? "").length > 0) {
5712
+ return JSON.parse(it);
5713
+ }
5714
+ });
5715
+ }
5716
+ });
5717
+ }
5718
+ };
5719
+
5276
5720
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5277
5721
  var RenderDrawObj = class extends Obj {
5278
5722
  render(draw, config) {
@@ -6045,9 +6489,44 @@ var dooboostoreSimpleWebComponent = (() => {
6045
6489
  var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
6046
6490
  var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
6047
6491
  var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
6492
+ var ON_CONNECTED_INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
6048
6493
  var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
6049
- var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
6494
+ var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
6050
6495
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
6496
+ function onConnectedBefore(arg1, arg2, arg3) {
6497
+ const decorator = (options, target, propertyKey) => {
6498
+ const constructor = target.constructor;
6499
+ let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
6500
+ if (!list) {
6501
+ list = [];
6502
+ ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
6503
+ }
6504
+ list.push({ propertyKey, options });
6505
+ };
6506
+ if (arg2) {
6507
+ return decorator({}, arg1, arg2);
6508
+ }
6509
+ return (target, propertyKey) => {
6510
+ decorator(arg1 || {}, target, propertyKey);
6511
+ };
6512
+ }
6513
+ function onConnectedAfter(arg1, arg2, arg3) {
6514
+ const decorator = (options, target, propertyKey) => {
6515
+ const constructor = target.constructor;
6516
+ let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
6517
+ if (!list) {
6518
+ list = [];
6519
+ ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
6520
+ }
6521
+ list.push({ propertyKey, options });
6522
+ };
6523
+ if (arg2) {
6524
+ return decorator({}, arg1, arg2);
6525
+ }
6526
+ return (target, propertyKey) => {
6527
+ decorator(arg1 || {}, target, propertyKey);
6528
+ };
6529
+ }
6051
6530
  function createLifecycleDecorator(metadataKey) {
6052
6531
  return (target, propertyKey) => {
6053
6532
  const constructor = target.constructor;
@@ -6060,8 +6539,6 @@ var dooboostoreSimpleWebComponent = (() => {
6060
6539
  };
6061
6540
  }
6062
6541
  var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
6063
- var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6064
- var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6065
6542
  var onConnected = onConnectedAfter;
6066
6543
  var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
6067
6544
  var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
@@ -6070,13 +6547,15 @@ var dooboostoreSimpleWebComponent = (() => {
6070
6547
  var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
6071
6548
  var onAdopted = onAdoptedAfter;
6072
6549
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
6550
+ var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
6551
+ var onConnectedCompleted = createLifecycleDecorator(ON_CONNECTED_COMPLETED_METADATA_KEY);
6073
6552
  function onConnectedInnerHtml(arg1, arg2, arg3) {
6074
6553
  const decorator = (options, target, propertyKey) => {
6075
6554
  const constructor = target.constructor;
6076
- let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
6555
+ let list = ReflectUtils.getMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor);
6077
6556
  if (!list) {
6078
6557
  list = [];
6079
- ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
6558
+ ReflectUtils.defineMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, list, constructor);
6080
6559
  }
6081
6560
  list.push({ propertyKey, options });
6082
6561
  };
@@ -6089,11 +6568,19 @@ var dooboostoreSimpleWebComponent = (() => {
6089
6568
  }
6090
6569
  var findAllLifecycleMetadata = (target, metadataKey) => {
6091
6570
  const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
6092
- return results.length > 0 ? results : void 0;
6571
+ return results;
6093
6572
  };
6094
6573
  var getOnConnectedInnerHtmlMetadata = (target) => {
6095
6574
  const constructor = target instanceof Function ? target : target.constructor;
6096
- return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
6575
+ return ReflectUtils.getMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor) ?? [];
6576
+ };
6577
+ var getOnConnectedBeforeMetadata = (target) => {
6578
+ const constructor = target instanceof Function ? target : target.constructor;
6579
+ return ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
6580
+ };
6581
+ var getOnConnectedAfterMetadata = (target) => {
6582
+ const constructor = target instanceof Function ? target : target.constructor;
6583
+ return ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
6097
6584
  };
6098
6585
 
6099
6586
  // src/utils/Utils.ts
@@ -6115,14 +6602,17 @@ var dooboostoreSimpleWebComponent = (() => {
6115
6602
  if (!d) throw new Error("Document is not available");
6116
6603
  return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
6117
6604
  };
6118
- var createElement = (tagName, options) => {
6119
- const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
6120
- if (!d) throw new Error("Document is not available");
6121
- const el = d.createElement(tagName);
6122
- if (options?.html) el.innerHTML = options.html;
6605
+ var createElement = (documentOrWindow, tagName2, options) => {
6606
+ const doc = "document" in documentOrWindow ? documentOrWindow.document : documentOrWindow;
6607
+ if (!doc) throw new Error("Document is not available");
6608
+ const el = doc.createElement(tagName2);
6609
+ if (options?.innerHtml) el.innerHTML = options.innerHtml;
6123
6610
  if (options?.attrs) {
6124
6611
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
6125
6612
  }
6613
+ if (options?.property) {
6614
+ Object.entries(options.property).forEach(([k, v]) => el[k] = v);
6615
+ }
6126
6616
  return el;
6127
6617
  };
6128
6618
  var htmlDivElement = (html, options) => {
@@ -6376,7 +6866,7 @@ var dooboostoreSimpleWebComponent = (() => {
6376
6866
  $hosts,
6377
6867
  $firstHost,
6378
6868
  $lastHost: $host,
6379
- $templateHost: el.__swc_template_host,
6869
+ // $templateHost: (el as any).__swc_template_host,
6380
6870
  $appHost,
6381
6871
  $appHosts,
6382
6872
  $firstAppHost,
@@ -7055,7 +7545,22 @@ var dooboostoreSimpleWebComponent = (() => {
7055
7545
  return this.containers.find(predicate);
7056
7546
  }
7057
7547
  };
7548
+ var isTargetSymbol = (config) => {
7549
+ return "symbol" in config && config.symbol !== void 0;
7550
+ };
7551
+ var isTargetType = (config) => {
7552
+ return "type" in config && config.type !== void 0;
7553
+ };
7554
+ var isTargetScheme = (config) => {
7555
+ return "scheme" in config && config.scheme !== void 0;
7556
+ };
7557
+ var isTargetFactory = (config) => {
7558
+ return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7559
+ };
7058
7560
  var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7561
+ var getInject = (target, propertyKey) => {
7562
+ return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7563
+ };
7059
7564
 
7060
7565
  // src/types.ts
7061
7566
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7327,6 +7832,379 @@ var dooboostoreSimpleWebComponent = (() => {
7327
7832
  };
7328
7833
  })(NodeUtils || (NodeUtils = {}));
7329
7834
 
7835
+ // ../core-web/dist/esm/node/slot/Slot.js
7836
+ var Slot = class {
7837
+ constructor(start, end) {
7838
+ this.start = start;
7839
+ this.end = end;
7840
+ }
7841
+ // Parse mixed Node|string items into Node[] within the context of this slot's
7842
+ // document. This is a private helper that uses the slot's start comment to
7843
+ // resolve the ownerDocument. mode: 'html'|'text'|'auto'
7844
+ parseItems(items, mode = "html") {
7845
+ const out = [];
7846
+ const host = this.start;
7847
+ const doc = host && host.ownerDocument ? host.ownerDocument : typeof document !== "undefined" ? document : void 0;
7848
+ if (!doc) return out;
7849
+ for (const it of items) {
7850
+ if (typeof it === "string") {
7851
+ if (mode === "text") {
7852
+ out.push(doc.createTextNode(it));
7853
+ } else {
7854
+ const template = doc.createElement("template");
7855
+ template.innerHTML = it;
7856
+ const childNodes = Array.from(template.content.childNodes);
7857
+ out.push(...childNodes);
7858
+ }
7859
+ } else {
7860
+ out.push(it);
7861
+ }
7862
+ }
7863
+ return out;
7864
+ }
7865
+ // Return nodes between start and end (exclusive) using nextSibling traversal
7866
+ nodes() {
7867
+ const out = [];
7868
+ let cur = this.start.nextSibling;
7869
+ while (cur && cur !== this.end) {
7870
+ out.push(cur);
7871
+ cur = cur.nextSibling;
7872
+ }
7873
+ return out;
7874
+ }
7875
+ append(...items) {
7876
+ if (!items || items.length === 0) return;
7877
+ const nodesToInsert = this.parseItems(items);
7878
+ if (nodesToInsert.length === 0) return;
7879
+ const parent = this.end ? this.end.parentNode : this.start.parentNode;
7880
+ const ref = this.end || null;
7881
+ for (const n of nodesToInsert) {
7882
+ if (ref) parent.insertBefore(n, ref);
7883
+ else parent.appendChild(n);
7884
+ }
7885
+ }
7886
+ // Explicit HTML/text variants
7887
+ appendHtml(...items) {
7888
+ this.append(...items);
7889
+ }
7890
+ appendText(...items) {
7891
+ const nodesToInsert = this.parseItems(items, "text");
7892
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7893
+ this.append(...nodesToInsert);
7894
+ }
7895
+ prepend(...items) {
7896
+ if (!items || items.length === 0) return;
7897
+ const nodesToInsert = this.parseItems(items);
7898
+ if (nodesToInsert.length === 0) return;
7899
+ const parent = this.start.parentNode;
7900
+ const before = this.start.nextSibling;
7901
+ for (let i = nodesToInsert.length - 1; i >= 0; i--) {
7902
+ const n = nodesToInsert[i];
7903
+ parent.insertBefore(n, before);
7904
+ }
7905
+ }
7906
+ prependHtml(...items) {
7907
+ this.prepend(...items);
7908
+ }
7909
+ prependText(...items) {
7910
+ const nodesToInsert = this.parseItems(items, "text");
7911
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7912
+ this.prepend(...nodesToInsert);
7913
+ }
7914
+ clear() {
7915
+ let cur = this.start.nextSibling;
7916
+ while (cur && cur !== this.end) {
7917
+ const next = cur.nextSibling;
7918
+ if ("remove" in cur && typeof cur.remove === "function")
7919
+ cur.remove();
7920
+ cur = next;
7921
+ }
7922
+ }
7923
+ // Replace all children between start and end with provided items.
7924
+ // Items can be Node or string (HTML/text). Uses parseItems to create
7925
+ // insertion nodes and then appends them (after clearing existing children).
7926
+ replaceChildren(...items) {
7927
+ this.clear();
7928
+ if (!items || items.length === 0) return;
7929
+ const nodesToInsert = this.parseItems(items);
7930
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7931
+ this.append(...nodesToInsert);
7932
+ }
7933
+ /**
7934
+ * Explicit HTML variant of replaceChildren — alias for replaceChildren
7935
+ * to make intent clear.
7936
+ */
7937
+ replaceChildrenHtml(...items) {
7938
+ this.replaceChildren(...items);
7939
+ }
7940
+ /**
7941
+ * Explicit text variant of replaceChildren — parses strings as text nodes
7942
+ * and replaces the children with those text nodes.
7943
+ */
7944
+ replaceChildrenText(...items) {
7945
+ this.clear();
7946
+ if (!items || items.length === 0) return;
7947
+ const nodesToInsert = this.parseItems(items, "text");
7948
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7949
+ this.append(...nodesToInsert);
7950
+ }
7951
+ findAll(predicate) {
7952
+ if (!predicate) return this.nodes();
7953
+ return this.nodes().filter(predicate);
7954
+ }
7955
+ querySelector(selector) {
7956
+ if (!selector) return null;
7957
+ for (const n of this.nodes()) {
7958
+ if (n.nodeType === Node.ELEMENT_NODE) {
7959
+ const el = n;
7960
+ if (el.matches && el.matches(selector)) return el;
7961
+ const found = el.querySelector(selector);
7962
+ if (found) return found;
7963
+ }
7964
+ }
7965
+ return null;
7966
+ }
7967
+ querySelectorAll(selector) {
7968
+ if (!selector) return [];
7969
+ const out = [];
7970
+ for (const n of this.nodes()) {
7971
+ if (n.nodeType === Node.ELEMENT_NODE) {
7972
+ const el = n;
7973
+ if (el.matches && el.matches(selector)) out.push(el);
7974
+ const found = el.querySelectorAll(selector);
7975
+ if (found && found.length) out.push(...Array.from(found));
7976
+ }
7977
+ }
7978
+ return out;
7979
+ }
7980
+ /**
7981
+ * Append clones of provided items into this slot.
7982
+ * Strings will be parsed and resulting nodes cloned; Node items will be cloned.
7983
+ */
7984
+ appendCopy(...items) {
7985
+ const parsed = this.parseItems(items);
7986
+ if (!parsed || parsed.length === 0) return;
7987
+ const clones = parsed.map((n) => n.cloneNode(true));
7988
+ if (clones.length === 0) return;
7989
+ this.append(...clones);
7990
+ }
7991
+ /**
7992
+ * Prepend clones of provided items into this slot.
7993
+ */
7994
+ prependCopy(...items) {
7995
+ const parsed = this.parseItems(items);
7996
+ if (!parsed || parsed.length === 0) return;
7997
+ const clones = parsed.map((n) => n.cloneNode(true));
7998
+ if (clones.length === 0) return;
7999
+ this.prepend(...clones);
8000
+ }
8001
+ };
8002
+
8003
+ // ../core-web/dist/esm/node/slot/NodeSlot.js
8004
+ var NodeSlot = class _NodeSlot {
8005
+ constructor(host, id) {
8006
+ if (!host) throw new Error("host node is required");
8007
+ if (!id) throw new Error("id is required");
8008
+ this.host = host;
8009
+ this.id = id;
8010
+ const markerData = _NodeSlot.startEndMarkerData(id);
8011
+ this.startMarkerData = markerData.start;
8012
+ this.endMarkerData = markerData.end;
8013
+ }
8014
+ static startEndMarkerData(id) {
8015
+ return {
8016
+ start: `__slot_start__:${id}`,
8017
+ end: `__slot_end__:${id}`
8018
+ };
8019
+ }
8020
+ static slot(id) {
8021
+ const uid = RandomUtils.uuid();
8022
+ const markerData = _NodeSlot.startEndMarkerData(id);
8023
+ const start = `<!--${markerData.start}:${uid}-->`;
8024
+ const end = `<!--${markerData.end}:${uid}-->`;
8025
+ return `${start}${end}`;
8026
+ }
8027
+ /**
8028
+ * Return HTML comment string pair for embedding into templates.
8029
+ * Example: host.innerHTML = `<div>...${nodeSlot}...</div>`
8030
+ */
8031
+ get slot() {
8032
+ return _NodeSlot.slot(this.id);
8033
+ }
8034
+ // startCommentString and endCommentString getters removed — use slot() which
8035
+ // generates the full start/end comment pair including a unique uid per
8036
+ // insertion to ensure correct pairing when multiple slots with the same id
8037
+ // are inserted into the DOM.
8038
+ // toString removed intentionally to avoid accidental implicit string coercion.
8039
+ // Note: Symbol.toPrimitive removed to avoid custom primitive coercion logic.
8040
+ // valueOf and Symbol.toStringTag removed — prefer explicit use of slot getter/string conversion.
8041
+ findSlots() {
8042
+ const result = [];
8043
+ const doc = this.host.ownerDocument || (typeof document !== "undefined" ? document : void 0);
8044
+ const win = doc?.defaultView;
8045
+ if (!doc || !win) return result;
8046
+ const find = (target) => {
8047
+ const walker = doc.createTreeWalker(target, win.NodeFilter.SHOW_COMMENT, null, false);
8048
+ let node = walker.nextNode();
8049
+ const startPrefix = this.startMarkerData + ":";
8050
+ while (node) {
8051
+ const data = node.data;
8052
+ if (data && data.indexOf(startPrefix) === 0) {
8053
+ const uid = data.substring(startPrefix.length);
8054
+ const expectedEnd = `${this.endMarkerData}:${uid}`;
8055
+ let sibling = node.nextSibling;
8056
+ let foundEnd = null;
8057
+ while (sibling) {
8058
+ if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode === node.parentNode) {
8059
+ foundEnd = sibling;
8060
+ break;
8061
+ }
8062
+ sibling = sibling.nextSibling;
8063
+ }
8064
+ result.push(new Slot(node, foundEnd));
8065
+ }
8066
+ node = walker.nextNode();
8067
+ }
8068
+ };
8069
+ if (this.host.shadowRoot) {
8070
+ find(this.host.shadowRoot);
8071
+ }
8072
+ find(this.host);
8073
+ return result;
8074
+ }
8075
+ /**
8076
+ * Return an array of node arrays — for each found slot pair (via findSlots())
8077
+ * returns the nodes between its start and end (exclusive). Uses sibling
8078
+ * traversal (nextSibling) because findSlots pairs only same-parent markers.
8079
+ */
8080
+ nodes() {
8081
+ const slots = this.findSlots();
8082
+ return slots.map((s) => s.nodes());
8083
+ }
8084
+ append(...items) {
8085
+ if (!items || items.length === 0) return;
8086
+ const slots = this.findSlots();
8087
+ if (!slots || slots.length === 0) return;
8088
+ for (const s of slots) {
8089
+ s.append(...items);
8090
+ }
8091
+ }
8092
+ appendHtml(...items) {
8093
+ const slots = this.findSlots();
8094
+ for (const s of slots) s.appendHtml(...items);
8095
+ }
8096
+ appendText(...items) {
8097
+ const slots = this.findSlots();
8098
+ for (const s of slots) s.appendText(...items);
8099
+ }
8100
+ /**
8101
+ * Append copies of the provided items into each found slot.
8102
+ */
8103
+ appendCopy(...items) {
8104
+ if (!items || items.length === 0) return;
8105
+ const slots = this.findSlots();
8106
+ if (!slots || slots.length === 0) return;
8107
+ for (const s of slots) {
8108
+ s.appendCopy(...items);
8109
+ }
8110
+ }
8111
+ prepend(...items) {
8112
+ if (!items || items.length === 0) return;
8113
+ const slots = this.findSlots();
8114
+ if (!slots || slots.length === 0) return;
8115
+ for (const s of slots) {
8116
+ s.prepend(...items);
8117
+ }
8118
+ }
8119
+ prependHtml(...items) {
8120
+ const slots = this.findSlots();
8121
+ for (const s of slots) s.prependHtml(...items);
8122
+ }
8123
+ prependText(...items) {
8124
+ const slots = this.findSlots();
8125
+ for (const s of slots) s.prependText(...items);
8126
+ }
8127
+ /**
8128
+ * Prepend copies of the provided items into each found slot.
8129
+ */
8130
+ prependCopy(...items) {
8131
+ if (!items || items.length === 0) return;
8132
+ const slots = this.findSlots();
8133
+ if (!slots || slots.length === 0) return;
8134
+ for (const s of slots) {
8135
+ s.prependCopy(...items);
8136
+ }
8137
+ }
8138
+ clear() {
8139
+ const slots = this.findSlots();
8140
+ for (const s of slots) {
8141
+ s.clear();
8142
+ }
8143
+ }
8144
+ /**
8145
+ * Replace children inside each found slot with the provided items.
8146
+ * Items can be Node or string (HTML).
8147
+ */
8148
+ replaceChildren(...items) {
8149
+ const slots = this.findSlots();
8150
+ if (!slots || slots.length === 0) return;
8151
+ for (const s of slots) {
8152
+ s.replaceChildren(...items);
8153
+ }
8154
+ }
8155
+ replaceChildrenHtml(...items) {
8156
+ const slots = this.findSlots();
8157
+ if (!slots || slots.length === 0) return;
8158
+ for (const s of slots) {
8159
+ s.replaceChildrenHtml(...items);
8160
+ }
8161
+ }
8162
+ replaceChildrenText(...items) {
8163
+ const slots = this.findSlots();
8164
+ if (!slots || slots.length === 0) return;
8165
+ for (const s of slots) {
8166
+ s.replaceChildrenText(...items);
8167
+ }
8168
+ }
8169
+ findAll(predicate) {
8170
+ const groups = this.nodes();
8171
+ const flat = groups.reduce((acc, cur) => acc.concat(cur), []);
8172
+ if (!predicate) return flat;
8173
+ return flat.filter(predicate);
8174
+ }
8175
+ querySelector(selector) {
8176
+ if (!selector) return null;
8177
+ const groups = this.nodes();
8178
+ for (const nodes of groups) {
8179
+ for (const n of nodes) {
8180
+ if (n.nodeType === Node.ELEMENT_NODE) {
8181
+ const el = n;
8182
+ if (el.matches && el.matches(selector)) return el;
8183
+ const found = el.querySelector(selector);
8184
+ if (found) return found;
8185
+ }
8186
+ }
8187
+ }
8188
+ return null;
8189
+ }
8190
+ querySelectorAll(selector) {
8191
+ if (!selector) return [];
8192
+ const out = [];
8193
+ const groups = this.nodes();
8194
+ for (const nodes of groups) {
8195
+ for (const n of nodes) {
8196
+ if (n.nodeType === Node.ELEMENT_NODE) {
8197
+ const el = n;
8198
+ if (el.matches && el.matches(selector)) out.push(el);
8199
+ const found = el.querySelectorAll(selector);
8200
+ if (found && found.length) out.push(...Array.from(found));
8201
+ }
8202
+ }
8203
+ }
8204
+ return out;
8205
+ }
8206
+ };
8207
+
7330
8208
  // ../core-web/dist/esm/document/DocumentUtils.js
7331
8209
  var DocumentUtils;
7332
8210
  ((DocumentUtils2) => {
@@ -7721,8 +8599,360 @@ var dooboostoreSimpleWebComponent = (() => {
7721
8599
  };
7722
8600
  })(LocationUtils || (LocationUtils = {}));
7723
8601
 
7724
- // ../core-web/dist/esm/stylecss/StyleCssUtils.js
7725
- var StyleCssUtils;
8602
+ // ../core-web/dist/esm/routers/Router.js
8603
+ var ROUTER_NO_EVENT_MARKER = "__ROUTER_NO_EVENT__";
8604
+ var Router = class {
8605
+ constructor(config) {
8606
+ this._config = config;
8607
+ let routeData;
8608
+ if (config?.firstUrl) {
8609
+ const path = config.firstUrl.split("?");
8610
+ const urlSearchParams = new URLSearchParams(path[1] ?? "");
8611
+ routeData = {
8612
+ url: config.firstUrl,
8613
+ path: path[0],
8614
+ searchParams: urlSearchParams,
8615
+ router: this,
8616
+ search: urlSearchParams.size > 0 ? `?${urlSearchParams.toString()}` : "",
8617
+ triggerPoint: "first-end"
8618
+ };
8619
+ this.behaviorSubject = new BehaviorSubject(routeData);
8620
+ this.go(config.firstUrl);
8621
+ } else {
8622
+ routeData = { ...this.getRouteData(), triggerPoint: "first-end" };
8623
+ this.behaviorSubject = new BehaviorSubject(routeData);
8624
+ }
8625
+ this.config.window.addEventListener("popstate", (event) => {
8626
+ const routeData2 = { ...this.getRouteData(), triggerPoint: "end" };
8627
+ this.behaviorSubject.next(routeData2);
8628
+ });
8629
+ }
8630
+ get value() {
8631
+ return this.behaviorSubject.getValue();
8632
+ }
8633
+ get observable() {
8634
+ return this.behaviorSubject.asObservable();
8635
+ }
8636
+ get searchParamObject() {
8637
+ return ConvertUtils.toObject(this.getSearchParams());
8638
+ }
8639
+ getSearchParamObject() {
8640
+ return this.searchParamObject;
8641
+ }
8642
+ get config() {
8643
+ return this._config;
8644
+ }
8645
+ getSearchFirstParamsObject(defaultValue) {
8646
+ const a = ConvertUtils.toObject(this.getSearchParams(), { firstValue: true });
8647
+ return Object.assign({}, defaultValue, a);
8648
+ }
8649
+ getHashSearchFirstParamsObject() {
8650
+ return ConvertUtils.toObject(this.getHashSearchParams(), { firstValue: true });
8651
+ }
8652
+ // async attach(): Promise<void> {
8653
+ // // const proxy = getDomRenderProxy(this.config.rootObject)
8654
+ // // if (proxy) {
8655
+ // // const key = `___${EventManager.ROUTER_VARNAME}`;
8656
+ // // await proxy.render(key);
8657
+ // // }
8658
+ // }
8659
+ testRegexp(regexp) {
8660
+ if (regexp) {
8661
+ const b = RegExp(regexp).test(this.getPathName());
8662
+ return b;
8663
+ } else {
8664
+ return false;
8665
+ }
8666
+ }
8667
+ test(urlExpression) {
8668
+ if (urlExpression && this.getPathData(urlExpression)) {
8669
+ return true;
8670
+ } else {
8671
+ return false;
8672
+ }
8673
+ }
8674
+ getRouteData(config) {
8675
+ let path = this.getPathName();
8676
+ let url = this.getUrl();
8677
+ let searchParams = this.getSearchParams();
8678
+ let search = this.getSearch();
8679
+ if (config?.pathOrUrl) {
8680
+ const paths = config.pathOrUrl.split("?");
8681
+ search = paths[1] ? `?${paths[1]}` : "";
8682
+ searchParams = new URLSearchParams(search);
8683
+ const firstUrl = paths[0];
8684
+ if (ValidUtils.isUrl(firstUrl)) {
8685
+ path = new URL(firstUrl).pathname;
8686
+ } else {
8687
+ path = firstUrl;
8688
+ }
8689
+ url = config.pathOrUrl;
8690
+ }
8691
+ const newVar = {
8692
+ path,
8693
+ url,
8694
+ searchParams,
8695
+ // 이렇게 하면 진짜 문자열이 변형이 될수 있다 따라서 그냥 문자열 자른 원본을넣어줘야한다
8696
+ // search: searchParams.size > 0 ? `?${searchParams.toString()}` : '',
8697
+ search,
8698
+ router: this
8699
+ };
8700
+ const data = this.getData();
8701
+ if (data) {
8702
+ newVar.data = data;
8703
+ }
8704
+ if (config?.urlExpression) {
8705
+ const data2 = this.getPathData(config.urlExpression);
8706
+ if (data2) {
8707
+ newVar.pathData = data2;
8708
+ }
8709
+ }
8710
+ return Object.freeze(newVar);
8711
+ }
8712
+ pushState(data, title, path, config) {
8713
+ const stateData = config?.noEventAndPublish ? { ...data, [ROUTER_NO_EVENT_MARKER]: true } : data;
8714
+ if (!config?.noEventAndPublish) {
8715
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
8716
+ }
8717
+ this.config.window.history?.pushState(stateData, title ?? "", path);
8718
+ if (!config?.noEventAndPublish) {
8719
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
8720
+ }
8721
+ return { data: stateData };
8722
+ }
8723
+ replaceState(data, title, path, config) {
8724
+ const stateData = config?.noEventAndPublish ? { ...data, [ROUTER_NO_EVENT_MARKER]: true } : data;
8725
+ if (!config?.noEventAndPublish) {
8726
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
8727
+ }
8728
+ this.config.window.history?.replaceState(stateData, title ?? "", path);
8729
+ if (!config?.noEventAndPublish) {
8730
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
8731
+ }
8732
+ return { data: stateData };
8733
+ }
8734
+ getData() {
8735
+ return this.config.window.history?.state;
8736
+ }
8737
+ getPathData(urlExpression, currentUrl = this.getPathName()) {
8738
+ return Expression.Path.pathNameData(currentUrl, urlExpression);
8739
+ }
8740
+ back(config) {
8741
+ if (!config?.noEventAndPublish) {
8742
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8743
+ }
8744
+ this.config.window.history.back();
8745
+ }
8746
+ forward(config) {
8747
+ if (!config?.noEventAndPublish) {
8748
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8749
+ }
8750
+ this.config.window.history?.forward();
8751
+ }
8752
+ go(config, changeStateConfig) {
8753
+ if (typeof config === "number") {
8754
+ if (!changeStateConfig?.noEventAndPublish) {
8755
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8756
+ }
8757
+ this.config.window.history?.go(config);
8758
+ return;
8759
+ }
8760
+ if (typeof config === "string") {
8761
+ config = { path: config };
8762
+ }
8763
+ if (config?.replace) {
8764
+ this.replace(config.path, config.state);
8765
+ } else {
8766
+ this.push(config.path, config.state);
8767
+ }
8768
+ if (config.scrollToTop !== false) {
8769
+ try {
8770
+ this._config.window?.scrollTo?.(0, 0);
8771
+ } catch (e) {
8772
+ }
8773
+ }
8774
+ }
8775
+ toUrl(data) {
8776
+ let targetPath;
8777
+ if (typeof data === "string") {
8778
+ targetPath = data;
8779
+ } else {
8780
+ const tpath = data.path ?? this.getPathName();
8781
+ const s = data.searchParams ? ConvertUtils.toRawQueryString(data.searchParams, { valueEncodeURIComponent: true }) : "";
8782
+ targetPath = `${tpath}${s.length > 0 ? "?" : ""}${s}`;
8783
+ }
8784
+ return targetPath;
8785
+ }
8786
+ reload() {
8787
+ const currentUrl = this.getUrl();
8788
+ this.replace(currentUrl);
8789
+ }
8790
+ };
8791
+
8792
+ // ../core-web/dist/esm/routers/HashRouter.js
8793
+ var HashRouter = class extends Router {
8794
+ constructor(config) {
8795
+ super(config);
8796
+ }
8797
+ getSearchParams(data) {
8798
+ const hashSearch = LocationUtils.hashSearch(this.config.window);
8799
+ const searchParams = hashSearch ? new URLSearchParams(hashSearch) : new URL(this.config.window.document.location.href).searchParams;
8800
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8801
+ }
8802
+ push(path, state) {
8803
+ if (path === "/") {
8804
+ return super.pushState(state?.data, state?.title, "/", state?.config);
8805
+ } else {
8806
+ return super.pushState(state?.data, state?.title, `#${this.toUrl(path)}`, state?.config);
8807
+ }
8808
+ }
8809
+ replace(path, state) {
8810
+ if (path === "/") {
8811
+ return super.replaceState(state?.data, state?.title, "/", state?.config);
8812
+ } else {
8813
+ return super.replaceState(state?.data, state?.title, `#${this.toUrl(path)}`, state?.config);
8814
+ }
8815
+ }
8816
+ setDeleteHashSearchParam(name, state) {
8817
+ }
8818
+ pushDeleteHashSearchParam(name, state) {
8819
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8820
+ const size = Array.from(s.entries()).length;
8821
+ const href = `${this.config.window.location.pathname}${this.config.window.location.search}${size > 0 ? "#" + s.toString() : ""}`;
8822
+ super.pushState(state?.data, state?.title, href, state?.config);
8823
+ }
8824
+ pushDeleteSearchParam(name, state) {
8825
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8826
+ this.push({ searchParams: s }, state);
8827
+ }
8828
+ pushAddSearchParam(params, state) {
8829
+ const s = this.getSearchParams({ append: params });
8830
+ this.push({ searchParams: s }, state);
8831
+ }
8832
+ pushUpsertSearchParam(params, state) {
8833
+ const s = this.getSearchParams();
8834
+ UrlUtils.upsertSearchParam(s, params);
8835
+ this.push({ searchParams: s }, state);
8836
+ }
8837
+ replaceDeleteHashSearchParam(name, state) {
8838
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8839
+ const size = Array.from(s.entries()).length;
8840
+ const href = `${this.config.window.location.pathname}${this.config.window.location.search}${size > 0 ? "#" + s.toString() : ""}`;
8841
+ super.pushState(state?.data, state?.title, href, state?.config);
8842
+ }
8843
+ replaceDeleteSearchParam(name, state) {
8844
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8845
+ this.push({ searchParams: s }, state);
8846
+ }
8847
+ replaceAddSearchParam(params, state) {
8848
+ const s = this.getSearchParams({ append: params });
8849
+ this.push({ searchParams: s }, state);
8850
+ }
8851
+ replaceUpsertSearchParam(params, state) {
8852
+ const s = this.getSearchParams();
8853
+ UrlUtils.upsertSearchParam(s, params);
8854
+ this.replace({ searchParams: s }, state);
8855
+ }
8856
+ getUrl() {
8857
+ return LocationUtils.hash(this.config.window) || "/";
8858
+ }
8859
+ getHref() {
8860
+ return this.config.window.location.href;
8861
+ }
8862
+ getPathName() {
8863
+ return LocationUtils.hashPath(this.config.window) || "/";
8864
+ }
8865
+ getSearch() {
8866
+ return LocationUtils.hashSearch(this.config.window);
8867
+ }
8868
+ getHashSearchParams(data) {
8869
+ const hash = this.config.window.location.hash;
8870
+ const queryIndex = hash.indexOf("?");
8871
+ const searchParams = queryIndex !== -1 ? new URLSearchParams(hash.slice(queryIndex + 1)) : new URLSearchParams();
8872
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8873
+ }
8874
+ };
8875
+
8876
+ // ../core-web/dist/esm/routers/PathRouter.js
8877
+ var PathRouter = class extends Router {
8878
+ constructor(config) {
8879
+ super(config);
8880
+ }
8881
+ getSearchParams(data) {
8882
+ if (!this.config.window.document?.location?.href) {
8883
+ return new URLSearchParams();
8884
+ }
8885
+ const searchParams = new URL(this.config.window.document.location?.href).searchParams;
8886
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8887
+ }
8888
+ push(path, state) {
8889
+ return super.pushState(state?.data, state?.title, this.toUrl(path), state?.config);
8890
+ }
8891
+ replace(path, state) {
8892
+ return super.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);
8893
+ }
8894
+ pushDeleteSearchParam(name, state) {
8895
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8896
+ this.push({ searchParams: s }, state);
8897
+ }
8898
+ pushDeleteHashSearchParam(name, state) {
8899
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8900
+ const size = Array.from(s.entries()).length;
8901
+ const href = `${this.config.window.location?.pathname ?? "/"}${this.config.window.location?.search}${size > 0 ? "#" + s.toString() : ""}`;
8902
+ super.pushState(state?.data, state?.title, href, state?.config);
8903
+ }
8904
+ pushAddSearchParam(params, state) {
8905
+ const s = this.getSearchParams({ append: params });
8906
+ this.push({ searchParams: s }, state);
8907
+ }
8908
+ pushUpsertSearchParam(params, state) {
8909
+ const s = this.getSearchParams();
8910
+ UrlUtils.upsertSearchParam(s, params);
8911
+ this.push({ searchParams: s }, state);
8912
+ }
8913
+ replaceDeleteSearchParam(name, state) {
8914
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8915
+ this.replace({ searchParams: s }, state);
8916
+ }
8917
+ replaceDeleteHashSearchParam(name, state) {
8918
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8919
+ const size = Array.from(s.entries()).length;
8920
+ const href = `${this.config.window.location?.pathname ?? "/"}${this.config.window.location?.search}${size > 0 ? "#" + s.toString() : ""}`;
8921
+ super.replaceState(state?.data, state?.title, href, state?.config);
8922
+ }
8923
+ replaceAddSearchParam(params, state) {
8924
+ const s = this.getSearchParams({ append: params });
8925
+ this.replace({ searchParams: s }, state);
8926
+ }
8927
+ replaceUpsertSearchParam(params, state) {
8928
+ const s = this.getSearchParams();
8929
+ UrlUtils.upsertSearchParam(s, params);
8930
+ this.replace({ searchParams: s }, state);
8931
+ }
8932
+ getUrl() {
8933
+ if (!this.config.window.document?.location?.href) {
8934
+ return "/";
8935
+ }
8936
+ const url = new URL(this.config.window.document.location?.href);
8937
+ return url.pathname + url.search;
8938
+ }
8939
+ getHref() {
8940
+ return this.config.window.location?.href ?? "/";
8941
+ }
8942
+ getPathName() {
8943
+ return this.config.window.location?.pathname ?? "/";
8944
+ }
8945
+ getSearch() {
8946
+ return this.config.window.location?.search ?? "";
8947
+ }
8948
+ getHashSearchParams(data) {
8949
+ const searchParams = new URLSearchParams(this.config.window.location?.hash.slice(1) ?? "");
8950
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8951
+ }
8952
+ };
8953
+
8954
+ // ../core-web/dist/esm/stylecss/StyleCssUtils.js
8955
+ var StyleCssUtils;
7726
8956
  ((StyleCssUtils2) => {
7727
8957
  StyleCssUtils2.getPropertyValue = (valueName, config) => {
7728
8958
  return config.window.getComputedStyle(config.el).getPropertyValue(valueName);
@@ -7839,6 +9069,91 @@ var dooboostoreSimpleWebComponent = (() => {
7839
9069
  };
7840
9070
  })(ValidUtils2 || (ValidUtils2 = {}));
7841
9071
 
9072
+ // src/decorators/applySlot.ts
9073
+ var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
9074
+ function applySlot(id, options = { position: "replaceChildrenHtml" }) {
9075
+ return (targetObj, propertyKey, descriptor) => {
9076
+ const type = descriptor === void 0 ? "property" : "method";
9077
+ if (type === "property") {
9078
+ Object.defineProperty(targetObj, propertyKey, {
9079
+ get() {
9080
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
9081
+ return nodeSlot;
9082
+ },
9083
+ configurable: true,
9084
+ enumerable: true
9085
+ });
9086
+ }
9087
+ const constructor = targetObj.constructor;
9088
+ let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
9089
+ if (!metaList) {
9090
+ metaList = [];
9091
+ ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
9092
+ }
9093
+ metaList.push({ propertyKey, id, type, options });
9094
+ if (type === "method") {
9095
+ const original = descriptor.value;
9096
+ descriptor.value = function(...args) {
9097
+ ensureInit(this);
9098
+ const conf = getElementConfig(this);
9099
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
9100
+ const currentDoc = currentWin.document;
9101
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
9102
+ const res = original.apply(this, args);
9103
+ if (res) {
9104
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
9105
+ const pos = options.position || "replaceChildrenHtml";
9106
+ const doc = currentWin.document;
9107
+ if (pos === "replaceChildrenHtml") {
9108
+ nodeSlot.replaceChildrenHtml(res);
9109
+ } else if (pos === "replaceChildrenText") {
9110
+ nodeSlot.replaceChildrenText(res);
9111
+ } else if (pos === "appendHtml") {
9112
+ nodeSlot.appendHtml(res);
9113
+ } else if (pos === "appendText") {
9114
+ nodeSlot.appendText(res);
9115
+ } else if (pos === "prependHtml") {
9116
+ nodeSlot.prependHtml(res);
9117
+ } else if (pos === "prependText") {
9118
+ nodeSlot.prependText(res);
9119
+ } else if (pos === "clear") {
9120
+ nodeSlot.clear();
9121
+ }
9122
+ }
9123
+ return res;
9124
+ };
9125
+ }
9126
+ };
9127
+ }
9128
+ var findAllApplySlotMetadata = (target) => {
9129
+ const constructor = target instanceof Function ? target : target.constructor;
9130
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
9131
+ };
9132
+ function applySlotClear(id) {
9133
+ return applySlot(id, { position: "clear" });
9134
+ }
9135
+ function applySlotPrependHtml(id) {
9136
+ return applySlot(id, { position: "prependHtml" });
9137
+ }
9138
+ var applySlotPrepend = applySlotPrependHtml;
9139
+ function applySlotPrependText(id) {
9140
+ return applySlot(id, { position: "prependText" });
9141
+ }
9142
+ function applySlotAppendHtml(id) {
9143
+ return applySlot(id, { position: "appendHtml" });
9144
+ }
9145
+ function applySlotAppendText(id) {
9146
+ return applySlot(id, { position: "appendText" });
9147
+ }
9148
+ var applySlotAppend = applySlotAppendHtml;
9149
+ function applySlotReplaceChildrenHtml(id) {
9150
+ return applySlot(id, { position: "replaceChildrenHtml" });
9151
+ }
9152
+ var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
9153
+ function applySlotReplaceChildrenText(id) {
9154
+ return applySlot(id, { position: "replaceChildrenText" });
9155
+ }
9156
+
7842
9157
  // src/decorators/elementDefine.ts
7843
9158
  var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
7844
9159
  var getElementConfig = (target) => {
@@ -7847,7 +9162,7 @@ var dooboostoreSimpleWebComponent = (() => {
7847
9162
  };
7848
9163
  var ensureInit = (inst) => {
7849
9164
  if (!inst.__swc_initialized) {
7850
- inst._swcId = Math.random().toString(36).substring(2, 11);
9165
+ inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? Math.random().toString(36).substring(2, 11);
7851
9166
  inst._emitHandlers = /* @__PURE__ */ new Map();
7852
9167
  inst._boundListeners = [];
7853
9168
  inst.__swc_initialized = true;
@@ -7868,6 +9183,12 @@ var dooboostoreSimpleWebComponent = (() => {
7868
9183
  delete inst[meta.propertyKey];
7869
9184
  });
7870
9185
  }
9186
+ const slotAllList = findAllApplySlotMetadata(target);
9187
+ if (slotAllList) {
9188
+ slotAllList.filter((it) => it.type === "property").forEach((meta) => {
9189
+ delete inst[meta.propertyKey];
9190
+ });
9191
+ }
7871
9192
  const hostSet = SwcUtils.getHostSet(inst);
7872
9193
  const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
7873
9194
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
@@ -7910,7 +9231,7 @@ var dooboostoreSimpleWebComponent = (() => {
7910
9231
  if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = /* @__PURE__ */ new Map();
7911
9232
  return inst.__swc_attributeEventHandlers;
7912
9233
  };
7913
- var setupPrototype = (proto) => {
9234
+ var setupPrototype = (proto, win) => {
7914
9235
  if (proto.__swc_proto_setup) return;
7915
9236
  proto.__swc_proto_setup = true;
7916
9237
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
@@ -7941,7 +9262,7 @@ var dooboostoreSimpleWebComponent = (() => {
7941
9262
  proto._invokeLifecycleMethod = function(methodName, hostSet, extraArgs = []) {
7942
9263
  ensureInit(this);
7943
9264
  if (typeof this[methodName] !== "function") return;
7944
- const useHostSet = hostSet ?? SwcUtils.getHostSet(this);
9265
+ const useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);
7945
9266
  const app = useHostSet?.$appHost?.simpleApplication;
7946
9267
  if (app) {
7947
9268
  const otherStorage = /* @__PURE__ */ new Map();
@@ -8046,61 +9367,57 @@ var dooboostoreSimpleWebComponent = (() => {
8046
9367
  const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
8047
9368
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
8048
9369
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
8049
- const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
8050
9370
  const proto = constructor.prototype;
8051
- setupPrototype(proto);
9371
+ setupPrototype(proto, win);
8052
9372
  let helperHostSet = null;
8053
9373
  const originalConnected = proto.connectedCallback;
8054
9374
  proto.connectedCallback = async function() {
8055
9375
  ensureInit(this);
8056
9376
  helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
8057
9377
  const appHost = helperHostSet.$appHost;
9378
+ const useSsr = isSSR(this);
8058
9379
  try {
8059
9380
  if (appHost && typeof appHost._connected === "function") {
8060
9381
  await appHost._connected(this);
8061
9382
  } else if (appHost && typeof appHost) {
8062
- appHost._connected_safari ?? (appHost._connected_safari = []);
8063
- appHost._connected_safari.push(this);
9383
+ appHost._connected_safari_and_standby ?? (appHost._connected_safari_and_standby = []);
9384
+ appHost._connected_safari_and_standby.push(this);
8064
9385
  }
8065
9386
  const conf = getElementConfig(this);
8066
9387
  const currentWin = this._resolveWindow(conf);
8067
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
9388
+ const bMethods = getOnConnectedBeforeMetadata(this).filter((it) => useSsr ? !it.options.ssrFirst : true);
9389
+ if (bMethods) {
9390
+ for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
9391
+ }
9392
+ this._executeSwcScript("swc-on-before-connected", helperHostSet);
9393
+ const targetConnectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor).filter((it) => useSsr ? !it.options.ssrFirst : true);
9394
+ const shadowMode = conf?.useShadow || targetConnectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
8068
9395
  if (shadowMode && !this.shadowRoot) {
8069
9396
  const mode = shadowMode === true ? "open" : shadowMode;
8070
9397
  this.attachShadow({ mode });
8071
9398
  }
8072
- const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
8073
- if (bMethods) {
8074
- for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
8075
- }
8076
- this._executeSwcScript("swc-on-before-connected", helperHostSet);
8077
- if (connectedInnerHtmlList.length > 0) {
9399
+ if (targetConnectedInnerHtmlList.length > 0) {
8078
9400
  let sContent = "", lContent = "";
8079
- for (const meta of connectedInnerHtmlList) {
9401
+ for (const meta of targetConnectedInnerHtmlList) {
8080
9402
  let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
8081
9403
  const actionExpression = new ActionExpression(res, {
8082
9404
  expression: {
8083
9405
  replace: {
8084
- start: meta.options.replaceWrap?.start || "{%{",
8085
- end: meta.options.replaceWrap?.end || "}%}"
9406
+ start: meta.options.replaceWrap?.start || "[[",
9407
+ end: meta.options.replaceWrap?.end || "]]"
8086
9408
  },
8087
9409
  callReturn: {
8088
- start: meta.options.replaceWrap?.start || "{%{=",
8089
- end: meta.options.replaceWrap?.end || "}%}"
9410
+ start: meta.options.replaceWrap?.start || "[[=",
9411
+ end: meta.options.replaceWrap?.end || "]]"
8090
9412
  },
8091
9413
  call: {
8092
- start: meta.options.replaceWrap?.start || "{%{@",
8093
- end: meta.options.replaceWrap?.end || "}%}"
9414
+ start: meta.options.replaceWrap?.start || "[[@",
9415
+ end: meta.options.replaceWrap?.end || "]]"
8094
9416
  }
8095
9417
  }
8096
9418
  });
8097
9419
  actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
8098
- try {
8099
- const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
8100
- actionExpression.replace(it, sr);
8101
- } catch (e) {
8102
- console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
8103
- }
9420
+ actionExpression.replace(it, NodeSlot.slot(`${this._swcId}-${it.script}`));
8104
9421
  });
8105
9422
  res = actionExpression.getUnprocessedTemplate();
8106
9423
  if (res !== void 0) {
@@ -8248,9 +9565,11 @@ var dooboostoreSimpleWebComponent = (() => {
8248
9565
  });
8249
9566
  });
8250
9567
  if (originalConnected) await originalConnected.apply(this);
8251
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
9568
+ const aMethods = getOnConnectedAfterMetadata(this).filter((it) => {
9569
+ return useSsr ? !it.options.ssrFirst : true;
9570
+ });
8252
9571
  if (aMethods) {
8253
- for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
9572
+ for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
8254
9573
  }
8255
9574
  this._executeSwcScript("swc-on-connected", helperHostSet);
8256
9575
  this._executeSwcScript("swc-on-after-connected", helperHostSet);
@@ -8266,6 +9585,9 @@ var dooboostoreSimpleWebComponent = (() => {
8266
9585
  }
8267
9586
  }
8268
9587
  } finally {
9588
+ for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {
9589
+ await this._invokeLifecycleMethod(mPropertyKey, helperHostSet);
9590
+ }
8269
9591
  if (appHost && typeof appHost._connectedDone === "function") {
8270
9592
  await appHost._connectedDone(this);
8271
9593
  }
@@ -8273,7 +9595,6 @@ var dooboostoreSimpleWebComponent = (() => {
8273
9595
  };
8274
9596
  const originalDisconnected = proto.disconnectedCallback;
8275
9597
  proto.disconnectedCallback = function() {
8276
- console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
8277
9598
  const appHost = helperHostSet.$appHost;
8278
9599
  if (appHost && typeof appHost._disconnected === "function") {
8279
9600
  appHost._disconnected(this);
@@ -8535,8 +9856,9 @@ var dooboostoreSimpleWebComponent = (() => {
8535
9856
  return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
8536
9857
  });
8537
9858
  };
8538
- var applyToDom = (targetEl, res, pos, doc) => {
9859
+ var applyToDom = (targetEl, res, pos, win) => {
8539
9860
  if (!targetEl) return;
9861
+ const doc = win.document;
8540
9862
  if (pos === "innerHtml") {
8541
9863
  targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
8542
9864
  return;
@@ -8547,7 +9869,7 @@ var dooboostoreSimpleWebComponent = (() => {
8547
9869
  }
8548
9870
  return;
8549
9871
  }
8550
- const isShadowRoot = targetEl instanceof ShadowRoot;
9872
+ const isShadowRoot = targetEl instanceof win.ShadowRoot;
8551
9873
  const nodes = normalizeNodes(res, doc);
8552
9874
  if (pos === "replace") {
8553
9875
  if (!isShadowRoot) targetEl.replaceWith(...nodes);
@@ -8600,7 +9922,7 @@ var dooboostoreSimpleWebComponent = (() => {
8600
9922
  const runApply = (target, val) => {
8601
9923
  const pos = options.position || "beforeEnd";
8602
9924
  if (!options.filter || options.filter(target, val, { currentThis: this, helper: hostSet })) {
8603
- applyToDom(target, val, pos, currentDoc);
9925
+ applyToDom(target, val, pos, currentWin);
8604
9926
  }
8605
9927
  };
8606
9928
  if (res instanceof Promise) {
@@ -8634,23 +9956,23 @@ var dooboostoreSimpleWebComponent = (() => {
8634
9956
  const opt = targetOrOptions || {};
8635
9957
  return applyNode("$this", { position: "beforeEnd", ...opt });
8636
9958
  }
8637
- function applyReplaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
9959
+ function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
8638
9960
  if (propertyKey !== void 0) return applyNode("$this", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
8639
9961
  const opt = targetOrOptions || {};
8640
9962
  return applyNode("$this", { position: "replaceChildren", ...opt });
8641
9963
  }
8642
- function applyInnerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
9964
+ function applyThisInnerHtmlNode(targetOrOptions, propertyKey, descriptor) {
8643
9965
  if (propertyKey !== void 0) return applyNode("$this", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
8644
9966
  const opt = targetOrOptions || {};
8645
9967
  return applyNode("$this", { position: "innerHtml", ...opt });
8646
9968
  }
8647
- function applyReplaceChildrenNode(selector, options = {}) {
9969
+ function applyNodeReplaceChildren(selector, options = {}) {
8648
9970
  return applyNode(selector, { ...options, position: "replaceChildren" });
8649
9971
  }
8650
- function applyInnerHtmlNode(selector, options = {}) {
9972
+ function applyNodeInnerHtml(selector, options = {}) {
8651
9973
  return applyNode(selector, { ...options, position: "innerHtml" });
8652
9974
  }
8653
- function applyInnerTextNode(selector, options = {}) {
9975
+ function applyNodeInnerText(selector, options = {}) {
8654
9976
  return applyNode(selector, { ...options, position: "innerText" });
8655
9977
  }
8656
9978
 
@@ -9122,57 +10444,2505 @@ var dooboostoreSimpleWebComponent = (() => {
9122
10444
  return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
9123
10445
  };
9124
10446
 
10447
+ // ../simple-boot/dist/esm/index.js
10448
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
10449
+
10450
+ // ../simple-boot/dist/esm/throwable/SimError.js
10451
+ var SimError = class {
10452
+ constructor(message, name, stack) {
10453
+ this.message = message;
10454
+ this.name = name;
10455
+ this.stack = stack;
10456
+ }
10457
+ };
10458
+
10459
+ // ../simple-boot/dist/esm/throwable/SimNoSuch.js
10460
+ var SimNoSuch = class extends SimError {
10461
+ constructor(message, name, stack) {
10462
+ super(message, name, stack);
10463
+ }
10464
+ };
10465
+
9125
10466
  // ../simple-boot/dist/esm/decorators/SimDecorator.js
10467
+ var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
10468
+ Lifecycle2["Singleton"] = "Singleton";
10469
+ Lifecycle2["Transient"] = "Transient";
10470
+ return Lifecycle2;
10471
+ })(Lifecycle || {});
10472
+ var sims = /* @__PURE__ */ new Map();
10473
+ var containers = /* @__PURE__ */ new Set();
9126
10474
  var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
10475
+ var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
10476
+ var simProcess = (config, inputTarget) => {
10477
+ const target = (() => {
10478
+ if (typeof inputTarget === "object") {
10479
+ return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
10480
+ }
10481
+ if (ValidUtils.isArrowFunction(inputTarget)) {
10482
+ return () => inputTarget();
10483
+ }
10484
+ return inputTarget;
10485
+ })();
10486
+ let targetType;
10487
+ if (isNotNullObjetInstance(target)) {
10488
+ targetType = target.constructor;
10489
+ } else {
10490
+ targetType = target;
10491
+ }
10492
+ config.scope = config?.scope ?? "Singleton";
10493
+ ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
10494
+ const adding = (targetKey, target2 = targetKey) => {
10495
+ const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
10496
+ items.add(target2);
10497
+ sims.set(targetKey, items);
10498
+ };
10499
+ if (Array.isArray(config?.type)) {
10500
+ config?.type.forEach((it) => {
10501
+ adding(it, target);
10502
+ });
10503
+ } else if (config.type) {
10504
+ adding(config?.type, target);
10505
+ } else {
10506
+ adding(target);
10507
+ }
10508
+ };
10509
+ function Sim(configOrTarget) {
10510
+ if (typeof configOrTarget === "symbol") {
10511
+ return (target) => {
10512
+ simProcess({ symbol: configOrTarget }, target);
10513
+ };
10514
+ } else if (typeof configOrTarget === "function") {
10515
+ simProcess({}, configOrTarget);
10516
+ } else {
10517
+ return (target) => {
10518
+ simProcess(configOrTarget, target);
10519
+ };
10520
+ }
10521
+ }
10522
+ var getSim = (target) => {
10523
+ if (target != null && target !== void 0 && typeof target === "object") {
10524
+ target = Object.getPrototypeOf(target).constructor;
10525
+ }
10526
+ try {
10527
+ return ReflectUtils.getMetadata(SimMetadataKey, target);
10528
+ } catch (e) {
10529
+ }
10530
+ };
9127
10531
  var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
10532
+ var getPostConstructs = (target) => {
10533
+ return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
10534
+ };
10535
+
10536
+ // ../simple-boot/dist/esm/simstance/SimAtomic.js
10537
+ var SimAtomic = class {
10538
+ constructor(type, simstanceManager, config) {
10539
+ this.type = type;
10540
+ this.simstanceManager = simstanceManager;
10541
+ this.config = config;
10542
+ this.value = type.value;
10543
+ }
10544
+ getConfig(key = SimMetadataKey) {
10545
+ return ReflectUtils.getMetadata(key, this.type.originalType);
10546
+ }
10547
+ getConfigs() {
10548
+ return ReflectUtils.getMetadatas(this.type.originalType);
10549
+ }
10550
+ getValue(config) {
10551
+ if (config?.refresh) {
10552
+ this.value = void 0;
10553
+ }
10554
+ if (!this.value) {
10555
+ if (typeof this.type.targetKeyType === "symbol") {
10556
+ this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
10557
+ } else {
10558
+ this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
10559
+ }
10560
+ }
10561
+ return this.value;
10562
+ }
10563
+ };
10564
+
10565
+ // ../simple-boot/dist/esm/SimOption.js
10566
+ var SimOption = class {
10567
+ constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
10568
+ this.rootRouter = rootRouter;
10569
+ this.container = container;
10570
+ this.advice = advice;
10571
+ this.excludeProxys = excludeProxys;
10572
+ this.proxy = proxy;
10573
+ this.using = using;
10574
+ this.cache = cache;
10575
+ }
10576
+ addAdvicce(advice) {
10577
+ this.advice ?? (this.advice = []);
10578
+ this.advice.push(advice);
10579
+ }
10580
+ setAdvice(...advice) {
10581
+ this.advice = advice;
10582
+ return this;
10583
+ }
10584
+ };
10585
+
10586
+ // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
10587
+ var MetaDataAtomic = class {
10588
+ constructor(target, metaData) {
10589
+ this.target = target;
10590
+ this.metaData = metaData;
10591
+ }
10592
+ };
10593
+ var MetaDataPropertyAtomic = class extends MetaDataAtomic {
10594
+ constructor(target, metaData, property, parameter) {
10595
+ super(target, metaData);
10596
+ this.property = property;
10597
+ this.parameter = parameter;
10598
+ }
10599
+ call(...parameter) {
10600
+ return this.target[this.property](...parameter);
10601
+ }
10602
+ };
9128
10603
 
9129
10604
  // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
9130
10605
  var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
9131
10606
  var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
9132
10607
  var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
10608
+ var getAfter = (target, propertyKey) => {
10609
+ return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
10610
+ };
10611
+ var getAfters = (target) => {
10612
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
10613
+ };
10614
+ var getProtoAfters = (target, propertyKey, type) => {
10615
+ return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
10616
+ };
10617
+ var getBefore = (target, propertyKey) => {
10618
+ return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
10619
+ };
10620
+ var getBefores = (target) => {
10621
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
10622
+ };
10623
+ var getProtoBefores = (target, propertyKey, type) => {
10624
+ return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
10625
+ };
9133
10626
 
9134
10627
  // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
10628
+ var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
10629
+ ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
10630
+ ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
10631
+ return ExceptionHandlerSituationType2;
10632
+ })(ExceptionHandlerSituationType || {});
9135
10633
  var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
10634
+ var getExceptionHandlers = (target) => {
10635
+ if (target !== null && void 0 !== target && typeof target === "object") {
10636
+ target = target.constructor;
10637
+ }
10638
+ return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
10639
+ };
10640
+ var targetExceptionHandlers = (target, error) => {
10641
+ const exceptionHandlers = getExceptionHandlers(target);
10642
+ const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
10643
+ const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
10644
+ const targetSorts = targets?.sort((a, b) => {
10645
+ const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
10646
+ const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
10647
+ return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
10648
+ });
10649
+ return (targetSorts ?? []).concat(...emptyTargets ?? []);
10650
+ };
10651
+ var targetExceptionHandler = (target, error, excludeMethods = []) => {
10652
+ let exceptionHandlers = targetExceptionHandlers(target, error);
10653
+ exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
10654
+ if (exceptionHandlers && exceptionHandlers.length > 0) {
10655
+ return exceptionHandlers[0];
10656
+ } else {
10657
+ return void 0;
10658
+ }
10659
+ };
9136
10660
 
9137
- // ../simple-boot/dist/esm/decorators/SimNoProxy.js
9138
- var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
9139
-
9140
- // ../simple-boot/dist/esm/decorators/inject/Injection.js
9141
- var InjectionMetadataKey = Symbol("Injection");
9142
-
9143
- // ../simple-boot/dist/esm/decorators/route/Router.js
9144
- var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
9145
- var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9146
-
9147
- // ../simple-boot/dist/esm/route/RouterAction.js
9148
- var RouterAction;
9149
- ((RouterAction2) => {
9150
- RouterAction2.isCanActivate = (obj) => {
9151
- return typeof obj?.canActivate === "function";
9152
- };
9153
- RouterAction2.isOnRouting = (obj) => {
9154
- return typeof obj?.onRouting === "function";
9155
- };
9156
- RouterAction2.isHasActivate = (obj) => {
9157
- return typeof obj?.hasActivate === "function";
9158
- };
9159
- })(RouterAction || (RouterAction = {}));
9160
-
9161
- // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
9162
- var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
9163
-
9164
- // ../simple-boot/dist/esm/fetch/ApiService.js
9165
- var ApiServiceInterceptor;
9166
- ((ApiServiceInterceptor2) => {
9167
- ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
9168
- ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10661
+ // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
10662
+ var SimProxyHandler = class {
10663
+ constructor(simpleApplication, simstanceManager, simOption) {
10664
+ this.simpleApplication = simpleApplication;
10665
+ this.simstanceManager = simstanceManager;
10666
+ this.simOption = simOption;
10667
+ }
10668
+ // 잘받게 해놨네 ㅋㅋ simstanceManager
10669
+ get(target, name) {
10670
+ if (name === "_SimpleBoot_application") {
10671
+ return this.simpleApplication;
10672
+ } else if (name === "_SimpleBoot_simstanceManager") {
10673
+ return this.simstanceManager;
10674
+ } else if (name === "_SimpleBoot_simOption") {
10675
+ return this.simOption;
10676
+ } else if (name === "_SimpleBoot_origin") {
10677
+ return target;
10678
+ } else {
10679
+ return target[name];
10680
+ }
10681
+ }
10682
+ set(obj, prop, value, receiver) {
10683
+ value = this.simstanceManager?.proxy(value);
10684
+ obj[prop] = value;
10685
+ return true;
10686
+ }
10687
+ apply(target, thisArg, argumentsList) {
10688
+ let r;
9169
10689
  try {
9170
- return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10690
+ this.aopBefore(thisArg, target);
10691
+ try {
10692
+ r = Reflect.apply(target, thisArg, argumentsList);
10693
+ } catch (e) {
10694
+ throw e;
10695
+ } finally {
10696
+ this.aopAfter(thisArg, target);
10697
+ }
9171
10698
  } catch (e) {
9172
- return [];
10699
+ console.error(e);
10700
+ const inHandlers = this.getExceptionHandler(e, thisArg, target);
10701
+ if (inHandlers.length > 0 && inHandlers[0]) {
10702
+ const inHandler = inHandlers[0];
10703
+ this.executeExceptionHandler(e, inHandler, argumentsList);
10704
+ } else {
10705
+ throw e;
10706
+ }
9173
10707
  }
9174
- };
9175
- })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10708
+ return r;
10709
+ }
10710
+ executeExceptionHandler(e, inHandler, argumentsList) {
10711
+ const otherStorage = /* @__PURE__ */ new Map();
10712
+ otherStorage.set(e.constructor, e);
10713
+ const situationErrorTypeContainer = new SituationTypeContainer({
10714
+ situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
10715
+ data: e
10716
+ });
10717
+ const situationParameterTypeContainer = new SituationTypeContainer({
10718
+ situationType: ExceptionHandlerSituationType.PARAMETER,
10719
+ data: argumentsList
10720
+ });
10721
+ otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
10722
+ argumentsList?.forEach((it) => {
10723
+ otherStorage.set(it.constructor, it);
10724
+ });
10725
+ try {
10726
+ this.simstanceManager.executeBindParameterSim(
10727
+ {
10728
+ target: inHandler.thisArg,
10729
+ targetKey: inHandler.config.propertyKey
10730
+ },
10731
+ otherStorage
10732
+ );
10733
+ } catch (es) {
10734
+ e = es;
10735
+ }
10736
+ if (inHandler.config.config.throw) {
10737
+ const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
10738
+ if ((exceptionHandler?.length ?? 0) > 0) {
10739
+ this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
10740
+ }
10741
+ }
10742
+ }
10743
+ getExceptionHandler(e, thisArg, target) {
10744
+ const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
10745
+ return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
10746
+ }) ?? [];
10747
+ const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
10748
+ const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
10749
+ return inHandlers;
10750
+ }
10751
+ aopBefore(obj, protoType) {
10752
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
10753
+ if (propertyName && obj) {
10754
+ getProtoBefores(obj, propertyName).forEach((it) => {
10755
+ it.call(obj, protoType, propertyName);
10756
+ });
10757
+ for (let i = 0; i < this.simOption.advice.length; i++) {
10758
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
10759
+ const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
10760
+ protoBefores.forEach((it) => {
10761
+ it.call(obj, protoType, propertyName);
10762
+ });
10763
+ }
10764
+ }
10765
+ }
10766
+ aopAfter(obj, protoType) {
10767
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
10768
+ if (propertyName) {
10769
+ getProtoAfters(obj, propertyName).forEach((it) => {
10770
+ it.call(obj, protoType, propertyName);
10771
+ });
10772
+ for (let i = 0; i < this.simOption.advice.length; i++) {
10773
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
10774
+ const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
10775
+ protoBefores.forEach((it) => {
10776
+ it.call(obj, protoType, propertyName);
10777
+ });
10778
+ }
10779
+ }
10780
+ }
10781
+ has(target, key) {
10782
+ if (key === "_SimpleBoot_isProxy") {
10783
+ return true;
10784
+ }
10785
+ return key in target;
10786
+ }
10787
+ };
10788
+
10789
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
10790
+ var isOnSimCreate = (obj) => {
10791
+ return typeof obj?.onSimCreate === "function";
10792
+ };
10793
+
10794
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
10795
+ var isOnSimCreateProxyCompleted = (obj) => {
10796
+ return typeof obj?.onSimCreateProxyCompleted === "function";
10797
+ };
10798
+
10799
+ // ../simple-boot/dist/esm/decorators/SimNoProxy.js
10800
+ var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
10801
+ var getSimNoProxy = (target, propertyKey) => {
10802
+ try {
10803
+ if (propertyKey === void 0) {
10804
+ return Reflect.getMetadata(SimNoProxyKey, target);
10805
+ }
10806
+ return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
10807
+ } catch (e) {
10808
+ return void 0;
10809
+ }
10810
+ };
10811
+ var isSimNoProxy = (target, propertyKey) => {
10812
+ if (target === null || target === void 0) {
10813
+ return false;
10814
+ }
10815
+ return getSimNoProxy(target, propertyKey) === true;
10816
+ };
10817
+
10818
+ // ../simple-boot/dist/esm/simstance/SimstanceManager.js
10819
+ var SimstanceManager = class _SimstanceManager {
10820
+ // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
10821
+ constructor(simpleApplication, option) {
10822
+ this.simpleApplication = simpleApplication;
10823
+ this.option = option;
10824
+ this._storage = /* @__PURE__ */ new Map();
10825
+ this.name = "simstanceManager-" + RandomUtils.uuid4();
10826
+ this.setStoreSet(SimpleApplication, this.simpleApplication);
10827
+ this.setStoreSet(_SimstanceManager, this);
10828
+ this.setStoreSet(option.constructor, option);
10829
+ this.setStoreSet(SimOption, option);
10830
+ this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
10831
+ }
10832
+ get storage() {
10833
+ return this._storage;
10834
+ }
10835
+ getSimAtomics() {
10836
+ const r = [];
10837
+ Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
10838
+ r.push(
10839
+ ...Array.from(Array.from(targetMap.keys())).map(
10840
+ (sit) => new SimAtomic(
10841
+ {
10842
+ targetKeyType,
10843
+ originalType: sit
10844
+ },
10845
+ this
10846
+ )
10847
+ )
10848
+ );
10849
+ });
10850
+ return r;
10851
+ }
10852
+ getSimConfig(schemeOrSymbol) {
10853
+ const newVar = this.getSimAtomics().filter((it) => {
10854
+ const config = it?.getConfig();
10855
+ const symbols = ConvertUtils.flatArray(config?.symbol);
10856
+ const schemes = ConvertUtils.flatArray(config?.scheme);
10857
+ if (typeof schemeOrSymbol === "symbol") {
10858
+ return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
10859
+ } else if (typeof schemeOrSymbol === "string") {
10860
+ return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
10861
+ } else {
10862
+ return false;
10863
+ }
10864
+ }) || [];
10865
+ return newVar;
10866
+ }
10867
+ findSims(data) {
10868
+ let r = [];
10869
+ if (data) {
10870
+ const simAtomics = this.getSimAtomics();
10871
+ r = simAtomics.filter((it) => {
10872
+ let b = false;
10873
+ const config = it.getConfig();
10874
+ const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
10875
+ const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
10876
+ if (typeof data === "symbol") {
10877
+ b = symbols.includes(data);
10878
+ } else {
10879
+ const { scheme, type } = data;
10880
+ b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
10881
+ }
10882
+ return b;
10883
+ });
10884
+ }
10885
+ return r;
10886
+ }
10887
+ findFirstSim(data) {
10888
+ if (typeof data === "symbol") {
10889
+ return this.findSims(data)[0];
10890
+ } else {
10891
+ return this.findSims(data)[0];
10892
+ }
10893
+ }
10894
+ findLastSim(data) {
10895
+ if (typeof data === "symbol") {
10896
+ return this.findSims(data).reverse()[0];
10897
+ } else {
10898
+ return this.findSims(data).reverse()[0];
10899
+ }
10900
+ }
10901
+ flatStoreSets() {
10902
+ return new Map(
10903
+ Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
10904
+ );
10905
+ }
10906
+ getStoreSets(targetKey) {
10907
+ const map = this.storage.get(targetKey);
10908
+ const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
10909
+ return datas.map((it) => ({ type: it[0], instance: it[1] }));
10910
+ }
10911
+ getStoreSet(targetKey, target) {
10912
+ const sets = this.getStoreSets(targetKey);
10913
+ let find = sets.find((it) => it.type === target);
10914
+ if (!find && (!target || target === targetKey)) {
10915
+ find = sets.find((it) => it.instance);
10916
+ }
10917
+ if (!find?.instance) {
10918
+ const type = target ?? targetKey;
10919
+ if (typeof type === "object") {
10920
+ const find2 = this.storage.get(type);
10921
+ if (find2) {
10922
+ return { type, instance: type };
10923
+ }
10924
+ }
10925
+ const flatStoreSets = this.flatStoreSets();
10926
+ const data = flatStoreSets.get(type);
10927
+ if (data) {
10928
+ this.setStoreSet(targetKey, data, type);
10929
+ }
10930
+ return { type, instance: data };
10931
+ } else {
10932
+ return find;
10933
+ }
10934
+ }
10935
+ getStoreInstance(targetKey, target) {
10936
+ return this.getStoreSet(targetKey, target)?.instance;
10937
+ }
10938
+ getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
10939
+ if (target) {
10940
+ const registed = this.getStoreSet(target, originTypeTarget);
10941
+ if (registed?.type && !registed?.instance) {
10942
+ return this.resolve({
10943
+ targetKey: target,
10944
+ target: originTypeTarget,
10945
+ newInstanceCarrier
10946
+ });
10947
+ }
10948
+ return registed?.instance;
10949
+ }
10950
+ }
10951
+ setStoreSet(targetKey, obj, target = targetKey) {
10952
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
10953
+ itemMap.set(target, obj);
10954
+ this.storage.set(targetKey, itemMap);
10955
+ }
10956
+ registerStore(targetKey, regTyps) {
10957
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
10958
+ regTyps.forEach((it) => {
10959
+ const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
10960
+ if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
10961
+ itemMap.set(type, value);
10962
+ }
10963
+ });
10964
+ this.storage.set(targetKey, itemMap);
10965
+ }
10966
+ // 진입점
10967
+ resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
10968
+ const registed = this.getStoreSet(targetKey, target);
10969
+ if (registed?.instance) {
10970
+ return registed.instance;
10971
+ }
10972
+ if (this.storage.has(targetKey) && void 0 === registed?.instance) {
10973
+ newInstanceCarrier.depth++;
10974
+ const newSim = this.newSim({
10975
+ target: registed?.type ?? targetKey,
10976
+ newInstanceCarrier,
10977
+ simCreateAfter: (data) => {
10978
+ if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
10979
+ this.setStoreSet(targetKey, data, target);
10980
+ }
10981
+ }
10982
+ });
10983
+ newInstanceCarrier.depth--;
10984
+ if (newInstanceCarrier.depth === 0) {
10985
+ newInstanceCarrier.newInstances.forEach((it) => {
10986
+ this.callBindPostConstruct(it);
10987
+ });
10988
+ }
10989
+ if (isOnSimCreate(newSim)) {
10990
+ newSim.onSimCreate();
10991
+ }
10992
+ return newSim;
10993
+ }
10994
+ const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
10995
+ console.error(simNoSuch);
10996
+ throw simNoSuch;
10997
+ }
10998
+ newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
10999
+ const parameters = this.getParameterSim({
11000
+ target,
11001
+ otherStorage,
11002
+ newInstanceCarrier
11003
+ });
11004
+ const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
11005
+ let p = this.proxy(r);
11006
+ const config = getSim(target);
11007
+ if (config?.proxy) {
11008
+ const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
11009
+ proxys.forEach((it) => {
11010
+ if (typeof it === "object") {
11011
+ p = new Proxy(p, it);
11012
+ } else {
11013
+ const simConfig = getSim(it);
11014
+ p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
11015
+ }
11016
+ });
11017
+ }
11018
+ newInstanceCarrier?.newInstances.push(p);
11019
+ simCreateAfter?.(p);
11020
+ if (isOnSimCreateProxyCompleted(p)) {
11021
+ p.onSimCreateProxyCompleted(p);
11022
+ }
11023
+ return p;
11024
+ }
11025
+ callBindPostConstruct(obj) {
11026
+ const postConstruct = getPostConstructs(obj);
11027
+ postConstruct.forEach((it) => {
11028
+ obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
11029
+ });
11030
+ }
11031
+ async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
11032
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
11033
+ const resolvedBinds = await Promise.all(binds);
11034
+ if (typeof target === "object" && targetKey) {
11035
+ const targetMethod = target[targetKey];
11036
+ return targetMethod?.bind(target)?.(...resolvedBinds);
11037
+ } else if (typeof target === "function" && !targetKey) {
11038
+ return new target(...resolvedBinds);
11039
+ }
11040
+ }
11041
+ executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
11042
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
11043
+ if (typeof target === "object" && targetKey) {
11044
+ const targetMethod = target[targetKey];
11045
+ return targetMethod?.bind(target)?.(...binds);
11046
+ } else if (typeof target === "function" && !targetKey) {
11047
+ return new target(...binds);
11048
+ }
11049
+ }
11050
+ getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
11051
+ const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
11052
+ let injections = [];
11053
+ const injects = getInject(target, targetKey);
11054
+ const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
11055
+ injections = [];
11056
+ for (let idx = 0; idx < loopCount; idx++) {
11057
+ const token = paramTypes[idx];
11058
+ const saveInject = injects?.find((it) => it.index === idx);
11059
+ let isFirstChecked = false;
11060
+ for (const f of firstCheckMaker ?? []) {
11061
+ const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
11062
+ if (void 0 !== firstCheckObj) {
11063
+ injections.push(firstCheckObj);
11064
+ isFirstChecked = true;
11065
+ break;
11066
+ }
11067
+ }
11068
+ if (isFirstChecked) continue;
11069
+ if (saveInject) {
11070
+ const inject = saveInject.config;
11071
+ let obj = otherStorage?.get(token);
11072
+ if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
11073
+ const p = [];
11074
+ if (isTargetType(inject) && inject.type) {
11075
+ p.push(
11076
+ ...this.getStoreSets(inject.type).map(
11077
+ (it) => this.resolve({
11078
+ targetKey: inject.type,
11079
+ target: it.type,
11080
+ newInstanceCarrier
11081
+ })
11082
+ ).reverse()
11083
+ );
11084
+ }
11085
+ if (isTargetSymbol(inject)) {
11086
+ p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
11087
+ }
11088
+ if (isTargetScheme(inject)) {
11089
+ p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
11090
+ }
11091
+ injections.push(p);
11092
+ continue;
11093
+ }
11094
+ if (inject.situationType && otherStorage) {
11095
+ const situations = otherStorage.get(SituationTypeContainers);
11096
+ const situation = otherStorage.get(SituationTypeContainer);
11097
+ if (inject.situationType === situation?.situationType) {
11098
+ obj = situation.data;
11099
+ } else if (situations && situations.length > 0) {
11100
+ const find = situations.find((a) => {
11101
+ if (a.index !== void 0) {
11102
+ return a.situationType === inject.situationType && a.index === idx;
11103
+ } else {
11104
+ return a.situationType === inject.situationType;
11105
+ }
11106
+ });
11107
+ if (find) {
11108
+ obj = find.data;
11109
+ }
11110
+ }
11111
+ }
11112
+ if (!obj) {
11113
+ const currentInstance = typeof target === "object" ? target : void 0;
11114
+ if (isTargetFactory(inject)) {
11115
+ const combinedParameters = injections.length > 0 ? injections : inputParameters;
11116
+ obj = inject.factory({
11117
+ instance: currentInstance,
11118
+ methodName: String(targetKey),
11119
+ parameter: combinedParameters,
11120
+ application: this.simpleApplication
11121
+ });
11122
+ } else {
11123
+ let findLastSim;
11124
+ if (isTargetSymbol(inject)) {
11125
+ findLastSim = this.findLastSim(inject.symbol);
11126
+ } else if (isTargetType(inject) || isTargetScheme(inject)) {
11127
+ findLastSim = this.findLastSim(inject);
11128
+ }
11129
+ try {
11130
+ obj = findLastSim ? this.resolve({
11131
+ targetKey: findLastSim?.type.targetKeyType ?? token,
11132
+ newInstanceCarrier
11133
+ }) : this.resolve({
11134
+ targetKey: token,
11135
+ newInstanceCarrier
11136
+ });
11137
+ if (inject.factory && obj) {
11138
+ if (typeof inject.factory === "function") {
11139
+ const combinedParameters = injections.length > 0 ? injections : inputParameters;
11140
+ obj = inject.factory({
11141
+ instance: currentInstance,
11142
+ methodName: String(targetKey),
11143
+ parameter: combinedParameters,
11144
+ application: this.simpleApplication,
11145
+ injectInstance: obj
11146
+ });
11147
+ }
11148
+ }
11149
+ } catch (e) {
11150
+ if (inject.optional) {
11151
+ injections.push(void 0);
11152
+ continue;
11153
+ } else {
11154
+ throw e;
11155
+ }
11156
+ }
11157
+ }
11158
+ }
11159
+ if (inject.proxy && obj) {
11160
+ if (ValidUtils.isConstructor(inject.proxy)) {
11161
+ const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
11162
+ if (handler) {
11163
+ obj = new Proxy(obj, handler);
11164
+ }
11165
+ } else if (typeof inject.proxy === "function") {
11166
+ const handler = inject.proxy({
11167
+ application: this.simpleApplication,
11168
+ instance: obj
11169
+ });
11170
+ if (handler) {
11171
+ obj = new Proxy(obj, handler);
11172
+ }
11173
+ }
11174
+ }
11175
+ injections.push(obj);
11176
+ } else {
11177
+ const obj = otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
11178
+ injections.push(obj);
11179
+ }
11180
+ }
11181
+ return injections;
11182
+ }
11183
+ proxy(target) {
11184
+ try {
11185
+ const noProxy = isSimNoProxy(target);
11186
+ const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
11187
+ if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
11188
+ for (const key in target) {
11189
+ if (!isSimNoProxy(target, key)) {
11190
+ target[key] = this.proxy(target[key]);
11191
+ }
11192
+ }
11193
+ const protoTypeName = ObjectUtils.ownPropertyNames(target);
11194
+ protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
11195
+ target[it] = new Proxy(target[it], this.simProxyHandler);
11196
+ });
11197
+ if (this.simProxyHandler) {
11198
+ target = new Proxy(target, this.simProxyHandler);
11199
+ }
11200
+ }
11201
+ if (this.option.proxy) {
11202
+ target = this.option.proxy.onAfterProxy(target);
11203
+ }
11204
+ return target;
11205
+ } catch (e) {
11206
+ console.log("sim proxy error");
11207
+ throw e;
11208
+ }
11209
+ }
11210
+ run(otherInstanceSim = /* @__PURE__ */ new Map()) {
11211
+ for (const [k, v] of Array.from(otherInstanceSim.entries())) {
11212
+ const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
11213
+ this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
11214
+ if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
11215
+ this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
11216
+ }
11217
+ }
11218
+ const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
11219
+ if (!myContainers.includes(this.simpleApplication)) {
11220
+ myContainers.push(this.simpleApplication);
11221
+ }
11222
+ Array.from(sims.entries()).forEach(([type, implementations]) => {
11223
+ const filteredSet = /* @__PURE__ */ new Set();
11224
+ implementations.forEach((impl) => {
11225
+ const config = getSim(impl);
11226
+ const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
11227
+ let isInclude = false;
11228
+ if (targetContainers.length <= 0) {
11229
+ if (myContainers.length === 1 && myContainers[0] === this.simpleApplication) {
11230
+ isInclude = true;
11231
+ }
11232
+ } else {
11233
+ isInclude = myContainers.some((it) => targetContainers.includes(it));
11234
+ }
11235
+ if (isInclude) {
11236
+ filteredSet.add(impl);
11237
+ }
11238
+ });
11239
+ if (filteredSet.size > 0) {
11240
+ this.registerStore(type, filteredSet);
11241
+ }
11242
+ });
11243
+ this.callBindPostConstruct(this);
11244
+ this.getSimAtomics().forEach((it) => {
11245
+ if (it.getConfig()?.autoCreate) {
11246
+ it.getValue();
11247
+ }
11248
+ });
11249
+ }
11250
+ };
11251
+
11252
+ // ../simple-boot/dist/esm/intent/Intent.js
11253
+ var Intent = class {
11254
+ constructor(uri, data) {
11255
+ this.uri = uri;
11256
+ this.data = data;
11257
+ this.sessionData = /* @__PURE__ */ new Map();
11258
+ if (typeof uri === "string") {
11259
+ const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
11260
+ if (match) {
11261
+ const symbol = Symbol.for(match[1]);
11262
+ this.uri = {
11263
+ symbol,
11264
+ uri: `/${match[2]}`
11265
+ };
11266
+ }
11267
+ }
11268
+ }
11269
+ get symbols() {
11270
+ if (typeof this.uri === "object" && "symbol" in this.uri) {
11271
+ return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
11272
+ }
11273
+ return void 0;
11274
+ }
11275
+ get types() {
11276
+ if (typeof this.uri === "object" && "type" in this.uri) {
11277
+ return this.uri.type;
11278
+ }
11279
+ return void 0;
11280
+ }
11281
+ get scheme() {
11282
+ if (typeof this.uri === "string") {
11283
+ const parts = this.uri.split("://");
11284
+ if (parts.length > 1) {
11285
+ return parts[0];
11286
+ }
11287
+ return void 0;
11288
+ } else {
11289
+ return void 0;
11290
+ }
11291
+ }
11292
+ get paths() {
11293
+ if (typeof this.uri === "object" && "type" in this.uri && "target" in this.uri) {
11294
+ return [String(this.uri.target)];
11295
+ }
11296
+ return this.pathname.split("/") ?? [];
11297
+ }
11298
+ get fullPath() {
11299
+ if (typeof this.uri === "object" && "type" in this.uri && "target" in this.uri) {
11300
+ return `/${String(this.uri.target)}`;
11301
+ }
11302
+ const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
11303
+ const paths = uri.split("://");
11304
+ return paths[paths.length >= 2 ? 1 : 0] ?? "";
11305
+ }
11306
+ get pathname() {
11307
+ const paths = this.fullPath.split("?");
11308
+ return paths[0];
11309
+ }
11310
+ get query() {
11311
+ const paths = this.fullPath.split("?");
11312
+ return paths[1] ?? "";
11313
+ }
11314
+ getQueryParamDecodeURI(key) {
11315
+ const p = this.queryParamsDecodeURI;
11316
+ if (key) {
11317
+ return p[key];
11318
+ } else {
11319
+ return p;
11320
+ }
11321
+ }
11322
+ getQueryParamDecodeURIFirst(key) {
11323
+ const param = this.getQueryParamDecodeURI(key);
11324
+ if (Array.isArray(param)) {
11325
+ return param[0];
11326
+ } else {
11327
+ return param;
11328
+ }
11329
+ }
11330
+ getQueryParam(key) {
11331
+ const p = this.queryParams;
11332
+ if (key) {
11333
+ return p[key];
11334
+ } else {
11335
+ return p;
11336
+ }
11337
+ }
11338
+ getQueryParamFirst(key) {
11339
+ const param = this.getQueryParam(key);
11340
+ if (Array.isArray(param)) {
11341
+ return param[0];
11342
+ } else {
11343
+ return param;
11344
+ }
11345
+ }
11346
+ get queryParams() {
11347
+ const param = {};
11348
+ this.query.split("&")?.forEach((it) => {
11349
+ const a = it.split("=");
11350
+ if (param[a[0]]) {
11351
+ if (Array.isArray(param[a[0]])) {
11352
+ param[a[0]].push(a[1]);
11353
+ } else {
11354
+ param[a[0]] = [param[a[0]], a[1]];
11355
+ }
11356
+ } else {
11357
+ param[a[0]] = a[1];
11358
+ }
11359
+ });
11360
+ return param;
11361
+ }
11362
+ get queryParamsDecodeURI() {
11363
+ const params = this.queryParams;
11364
+ for (const key in params) {
11365
+ if (params.hasOwnProperty(key)) {
11366
+ const param = params[key];
11367
+ if (Array.isArray(param)) {
11368
+ params[key] = param.map((p) => decodeURIComponent(p));
11369
+ } else {
11370
+ params[key] = decodeURIComponent(param);
11371
+ }
11372
+ }
11373
+ }
11374
+ return params;
11375
+ }
11376
+ getPathnameData(urlExpression) {
11377
+ return Expression.Path.pathNameData(this.pathname, urlExpression);
11378
+ }
11379
+ get isSymbolScheme() {
11380
+ return this.symbols !== void 0;
11381
+ }
11382
+ };
11383
+
11384
+ // ../simple-boot/dist/esm/intent/IntentSubscribe.js
11385
+ var isIntentSubscribe = (obj) => {
11386
+ return !!obj && typeof obj.intentSubscribe === "function";
11387
+ };
11388
+
11389
+ // ../simple-boot/dist/esm/intent/IntentManager.js
11390
+ var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
11391
+ var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
11392
+ var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
11393
+ var isTypePublishType = (it) => typeof it === "object" && it !== null && "type" in it && "target" in it;
11394
+ var IntentManager = class {
11395
+ constructor(simpleApplication, simstanceManager, routerManager, simOption) {
11396
+ this.simpleApplication = simpleApplication;
11397
+ this.simstanceManager = simstanceManager;
11398
+ this.routerManager = routerManager;
11399
+ this.simOption = simOption;
11400
+ this.subject = new Subject();
11401
+ }
11402
+ get observable() {
11403
+ return this.subject.asObservable();
11404
+ }
11405
+ async makeIntentData(it, data) {
11406
+ const target = [];
11407
+ const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
11408
+ if (isRouterPublishType(it)) {
11409
+ it = it.router;
11410
+ }
11411
+ const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
11412
+ if (routerMatch && typeof it === "string") {
11413
+ const routerBasePath = routerMatch[1];
11414
+ const actualPath = routerMatch[2];
11415
+ const routerModule = await this.routerManager.routing(routerBasePath, {
11416
+ router: rootRouter
11417
+ });
11418
+ const instance = routerModule.getModuleInstance();
11419
+ if (instance) {
11420
+ target.push(instance);
11421
+ }
11422
+ it = new Intent(actualPath, data);
11423
+ } else if (isSymbolPublishType(it)) {
11424
+ it = new Intent({ symbol: it.symbol, uri: it.path }, data);
11425
+ } else if (isTypePublishType(it)) {
11426
+ it = new Intent({ type: it.type, target: it.target }, data);
11427
+ } else if (isSchemePublishType(it)) {
11428
+ it = new Intent(`${it.scheme}://${it.path}`, data);
11429
+ } else if (typeof it === "string") {
11430
+ it = new Intent(it, data);
11431
+ }
11432
+ const intent = it;
11433
+ if (!routerMatch) {
11434
+ if (intent.types) {
11435
+ target.push(...this.simstanceManager.findSims({ type: intent.types }));
11436
+ } else if (intent.symbols) {
11437
+ target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
11438
+ } else if (intent.scheme) {
11439
+ target.push(...this.simstanceManager.getSimConfig(intent.scheme));
11440
+ } else {
11441
+ target.push(...this.simstanceManager.getSimAtomics());
11442
+ }
11443
+ }
11444
+ return { intent, target };
11445
+ }
11446
+ async publishMeta(it, data) {
11447
+ const { intent, target } = await this.makeIntentData(it, data);
11448
+ const r = [];
11449
+ const targetInstances = target.map((it2) => {
11450
+ if (it2 instanceof SimAtomic) {
11451
+ return it2.getValue();
11452
+ } else {
11453
+ return it2;
11454
+ }
11455
+ });
11456
+ this.subject.next(intent);
11457
+ for (let data2 of targetInstances) {
11458
+ let orNewSim = data2;
11459
+ if (orNewSim) {
11460
+ const filteredPaths = intent.paths.filter((i) => i);
11461
+ if (filteredPaths.length > 0) {
11462
+ let callthis = orNewSim;
11463
+ let lastProp = "";
11464
+ filteredPaths.forEach((i) => {
11465
+ callthis = orNewSim;
11466
+ orNewSim = orNewSim?.[i];
11467
+ lastProp = i;
11468
+ });
11469
+ if (orNewSim && typeof orNewSim === "function") {
11470
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
11471
+ const result = await this.simstanceManager.executeBindParameterSimPromise({
11472
+ target: callthis,
11473
+ targetKey: String(lastProp),
11474
+ parameterCount: intentData.length,
11475
+ inputParameters: intentData,
11476
+ firstCheckMaker: [
11477
+ (obj, token, idx) => {
11478
+ if (idx < intentData.length) {
11479
+ return intentData[idx];
11480
+ }
11481
+ if (token === Intent && idx === 0) {
11482
+ return intent;
11483
+ }
11484
+ }
11485
+ ]
11486
+ });
11487
+ r.push(result);
11488
+ } else if (orNewSim) {
11489
+ callthis[lastProp] = intent.data;
11490
+ r.push(callthis[lastProp]);
11491
+ }
11492
+ } else {
11493
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
11494
+ if (isIntentSubscribe(orNewSim)) {
11495
+ r.push(orNewSim.intentSubscribe(...intentData));
11496
+ }
11497
+ }
11498
+ }
11499
+ }
11500
+ return { return: r, target };
11501
+ }
11502
+ async publish(it, data) {
11503
+ const rdata = await this.publishMeta(it, data);
11504
+ return rdata.return;
11505
+ }
11506
+ };
11507
+
11508
+ // ../simple-boot/dist/esm/decorators/inject/Injection.js
11509
+ var InjectionMetadataKey = Symbol("Injection");
11510
+ var getInjection = (target, propertyKey) => {
11511
+ return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
11512
+ };
11513
+
11514
+ // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
11515
+ var MethodNoSuch = class extends SimError {
11516
+ constructor(message, name, propertyKeys, stack) {
11517
+ super(message, name, stack);
11518
+ this.propertyKeys = propertyKeys;
11519
+ }
11520
+ };
11521
+
11522
+ // ../simple-boot/dist/esm/decorators/route/Router.js
11523
+ var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
11524
+ var getRouter = (target) => {
11525
+ if (target != null && typeof target === "object") {
11526
+ target = target.constructor;
11527
+ }
11528
+ try {
11529
+ return ReflectUtils.getMetadata(RouterMetadataKey, target);
11530
+ } catch (e) {
11531
+ }
11532
+ };
11533
+ var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
11534
+
11535
+ // ../simple-boot/dist/esm/route/RouterModule.js
11536
+ var RouterModule = class {
11537
+ constructor(simstanceManager, router, module, routerChains = []) {
11538
+ this.simstanceManager = simstanceManager;
11539
+ this.router = router;
11540
+ this.module = module;
11541
+ this.routerChains = routerChains;
11542
+ }
11543
+ get path() {
11544
+ return this._path;
11545
+ }
11546
+ set path(value) {
11547
+ this._path = value;
11548
+ }
11549
+ get data() {
11550
+ return this._data;
11551
+ }
11552
+ set data(value) {
11553
+ this._data = value;
11554
+ }
11555
+ get intent() {
11556
+ return this._intent;
11557
+ }
11558
+ set intent(value) {
11559
+ this._intent = value;
11560
+ }
11561
+ get propertyKeys() {
11562
+ return this._propertyKeys;
11563
+ }
11564
+ set propertyKeys(value) {
11565
+ this._propertyKeys = value;
11566
+ }
11567
+ get pathData() {
11568
+ return this._pathData;
11569
+ }
11570
+ getPathData() {
11571
+ return this._pathData;
11572
+ }
11573
+ set pathData(value) {
11574
+ this._pathData = value;
11575
+ }
11576
+ getRouterPath(join = "") {
11577
+ return this.getRouterPaths().map((it) => it ?? "").join(join);
11578
+ }
11579
+ getRouterPaths() {
11580
+ return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
11581
+ }
11582
+ getRouterPathData(pathName) {
11583
+ return Expression.Path.pathNameData(pathName, this.getRouterPath());
11584
+ }
11585
+ getModuleInstance(propertyKey, instanceBind = true) {
11586
+ const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
11587
+ if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
11588
+ let instanceElement = instance[propertyKey];
11589
+ if (instanceBind && typeof instanceBind === "boolean") {
11590
+ instanceElement = instanceElement.bind(instance);
11591
+ } else if (instanceBind && typeof instanceBind === "object") {
11592
+ instanceElement = instanceElement.bind(instanceBind);
11593
+ }
11594
+ return instanceElement;
11595
+ } else {
11596
+ return instance;
11597
+ }
11598
+ }
11599
+ executeModuleProperty(propertyKey, ...param) {
11600
+ const target = this.getModuleInstance();
11601
+ if (propertyKey) {
11602
+ const config = getInjection(target, propertyKey);
11603
+ if (config) {
11604
+ const other = /* @__PURE__ */ new Map();
11605
+ param.forEach((it) => other.set(it.constructor, it));
11606
+ return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
11607
+ } else {
11608
+ if (target[propertyKey]) {
11609
+ return target[propertyKey]?.(...param);
11610
+ } else {
11611
+ throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
11612
+ }
11613
+ }
11614
+ }
11615
+ }
11616
+ get firstRouteChain() {
11617
+ return this.routerChains[0];
11618
+ }
11619
+ get firstRouteChainValue() {
11620
+ return this.firstRouteChain?.getValue();
11621
+ }
11622
+ get lastRouteChain() {
11623
+ return this.routerChains[this.routerChains.length - 1];
11624
+ }
11625
+ get lastRouteChainValue() {
11626
+ return this.lastRouteChain?.getValue();
11627
+ }
11628
+ hasActivateInLastRoute(obj) {
11629
+ return this.lastRouteChainValue?.hasActivate(obj) === true;
11630
+ }
11631
+ getQueryParamDecodeURI(key) {
11632
+ if (this.intent) {
11633
+ return this.intent.getQueryParamDecodeURI(key);
11634
+ }
11635
+ }
11636
+ getQueryParamDecodeURIFirst(key) {
11637
+ if (this.intent) {
11638
+ return this.intent.getQueryParamDecodeURIFirst(key);
11639
+ }
11640
+ }
11641
+ getQueryParam(key) {
11642
+ if (this.intent) {
11643
+ return this.intent.getQueryParam(key);
11644
+ }
11645
+ }
11646
+ getQueryParamFirst(key) {
11647
+ if (this.intent) {
11648
+ return this.intent.getQueryParamFirst(key);
11649
+ }
11650
+ }
11651
+ get queryParams() {
11652
+ if (this.intent) {
11653
+ return this.intent.queryParams;
11654
+ }
11655
+ }
11656
+ get queryParamsAfterDecodeURI() {
11657
+ if (this.intent) {
11658
+ return this.intent.queryParamsDecodeURI;
11659
+ }
11660
+ }
11661
+ };
11662
+
11663
+ // ../simple-boot/dist/esm/route/RouterAction.js
11664
+ var RouterAction;
11665
+ ((RouterAction2) => {
11666
+ RouterAction2.isCanActivate = (obj) => {
11667
+ return typeof obj?.canActivate === "function";
11668
+ };
11669
+ RouterAction2.isOnRouting = (obj) => {
11670
+ return typeof obj?.onRouting === "function";
11671
+ };
11672
+ RouterAction2.isHasActivate = (obj) => {
11673
+ return typeof obj?.hasActivate === "function";
11674
+ };
11675
+ })(RouterAction || (RouterAction = {}));
11676
+
11677
+ // ../simple-boot/dist/esm/route/RouterManager.js
11678
+ var RouterManager = class {
11679
+ constructor(simpleApplication, simstanceManager, simOption) {
11680
+ this.simpleApplication = simpleApplication;
11681
+ this.simstanceManager = simstanceManager;
11682
+ this.simOption = simOption;
11683
+ this.subject = new Subject();
11684
+ }
11685
+ // @SimNoProxy
11686
+ get observable() {
11687
+ return this.subject.asObservable();
11688
+ }
11689
+ routingMap(option) {
11690
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11691
+ if (!targetRouter) {
11692
+ throw new Error("no router");
11693
+ }
11694
+ const map = {};
11695
+ if (targetRouter) {
11696
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11697
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11698
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11699
+ const routerData = routerAtomic.getConfig(RouterMetadataKey);
11700
+ if (routerData) {
11701
+ const currentPrefix = (option?.prefix ?? "") + routerData.path;
11702
+ if (routerData.route && routerData.route[""]) {
11703
+ map[currentPrefix] = routerData.route[""];
11704
+ }
11705
+ if (routerData.route) {
11706
+ Object.entries(routerData.route).forEach(([key, value]) => {
11707
+ map[currentPrefix + key] = value;
11708
+ });
11709
+ }
11710
+ routerData.routers?.forEach((it) => {
11711
+ Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
11712
+ });
11713
+ }
11714
+ }
11715
+ return map;
11716
+ }
11717
+ /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
11718
+ * @deprecated
11719
+ */
11720
+ async routings(intent, option) {
11721
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11722
+ if (!targetRouter) {
11723
+ throw new Error("no router");
11724
+ }
11725
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11726
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11727
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11728
+ const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
11729
+ const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
11730
+ if (exactModuleMatches.length > 0) {
11731
+ exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
11732
+ return exactModuleMatches;
11733
+ }
11734
+ const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
11735
+ if (exactPathMatches.length > 0) {
11736
+ exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
11737
+ return exactPathMatches;
11738
+ }
11739
+ return [];
11740
+ }
11741
+ async routing(intent, option) {
11742
+ if (typeof intent === "string") {
11743
+ intent = new Intent(intent);
11744
+ }
11745
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11746
+ const callCheckOnRouting = option?.noOnRouting !== true;
11747
+ if (!targetRouter) {
11748
+ debugger;
11749
+ throw new Error("no router");
11750
+ }
11751
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11752
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11753
+ const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11754
+ const rootRouter = routerAtomic.getValue();
11755
+ const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
11756
+ if (executeModuleResult) {
11757
+ const [executeModule, routerChains] = executeModuleResult;
11758
+ executeModule.routerChains = routerChains;
11759
+ this.activeRouterModule = executeModule;
11760
+ const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
11761
+ if (routerChains.length > 0) {
11762
+ for (let i = 0; i < routerChains.length; i++) {
11763
+ const current = routerChains[i];
11764
+ const next = routerChains[i + 1];
11765
+ const value = current.getValue();
11766
+ if (RouterAction.isCanActivate(value) && next) {
11767
+ await value.canActivate(routingDataSet, next.getValue());
11768
+ }
11769
+ if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
11770
+ await value.onRouting(routingDataSet);
11771
+ }
11772
+ }
11773
+ }
11774
+ this.activeRouterModule = executeModule;
11775
+ const moduleInstance = executeModule.getModuleInstance();
11776
+ if (!executeModule?.module) {
11777
+ const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
11778
+ const value = routerChain?.getValue();
11779
+ if (RouterAction.isCanActivate(value)) {
11780
+ await value.canActivate(routingDataSet, moduleInstance);
11781
+ }
11782
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
11783
+ await value.onRouting(routingDataSet);
11784
+ }
11785
+ } else {
11786
+ const value = executeModule.router?.getValue();
11787
+ if (RouterAction.isCanActivate(value)) {
11788
+ await value.canActivate(routingDataSet, moduleInstance);
11789
+ }
11790
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
11791
+ await value.onRouting(routingDataSet);
11792
+ }
11793
+ if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
11794
+ await moduleInstance.onRouting(routingDataSet);
11795
+ }
11796
+ }
11797
+ const find = this.activeRouterModule;
11798
+ this.subject.next({ intent, routerModule: find, routerManager: this });
11799
+ return find;
11800
+ } else {
11801
+ const empty = await this._handleNotFoundRouting(rootRouter, intent);
11802
+ this.subject.next({ intent, routerModule: empty, routerManager: this });
11803
+ return empty;
11804
+ }
11805
+ }
11806
+ /**
11807
+ * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
11808
+ * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
11809
+ * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
11810
+ * @param rootRouter 앱의 최상위 라우터 인스턴스
11811
+ * @param intent 확인에 실패한 원본 Intent 객체
11812
+ * @private
11813
+ */
11814
+ async _handleNotFoundRouting(rootRouter, intent) {
11815
+ const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
11816
+ const routingDataSet = { intent, routerModule, routerManager: this };
11817
+ const value = rootRouter;
11818
+ if (RouterAction.isCanActivate(value)) {
11819
+ await value.canActivate(routingDataSet, null);
11820
+ }
11821
+ if (RouterAction.isOnRouting(value)) {
11822
+ await value.onRouting(routingDataSet);
11823
+ }
11824
+ this.activeRouterModule = routerModule;
11825
+ return this.activeRouterModule;
11826
+ }
11827
+ getExecuteModule(router, intent, parentRouters, option) {
11828
+ const path = intent.pathname;
11829
+ const routerConfig = router.getConfig(RouterMetadataKey);
11830
+ if (routerConfig) {
11831
+ const filters = [];
11832
+ if (Array.isArray(routerConfig.filters)) {
11833
+ filters.push(...routerConfig.filters);
11834
+ } else if (routerConfig.filters) {
11835
+ filters.push(routerConfig.filters);
11836
+ }
11837
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11838
+ if (noAccept) {
11839
+ return;
11840
+ }
11841
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
11842
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
11843
+ if (isRoot) {
11844
+ const currentParentRouters = [...parentRouters, router];
11845
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
11846
+ let bestMatchModule = void 0;
11847
+ let bestMatchLength = -1;
11848
+ for (const child of routerConfig.routers) {
11849
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
11850
+ if (!routerAtomic) {
11851
+ continue;
11852
+ }
11853
+ const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
11854
+ if (executeModule) {
11855
+ const [rm, chains] = executeModule;
11856
+ const currentMatchLength = rm.path?.length || 0;
11857
+ if (currentMatchLength > bestMatchLength) {
11858
+ bestMatchLength = currentMatchLength;
11859
+ bestMatchModule = executeModule;
11860
+ } else if (currentMatchLength === bestMatchLength) {
11861
+ if (option?.find?.router === "last") {
11862
+ bestMatchModule = executeModule;
11863
+ }
11864
+ }
11865
+ }
11866
+ }
11867
+ if (bestMatchModule) {
11868
+ return bestMatchModule;
11869
+ }
11870
+ }
11871
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
11872
+ if (module) {
11873
+ return [module, currentParentRouters];
11874
+ }
11875
+ }
11876
+ }
11877
+ }
11878
+ // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
11879
+ isRootUrl(path, parentRoots, url) {
11880
+ const searchString = parentRoots.join("") + (path || "");
11881
+ if (searchString === "/") {
11882
+ return true;
11883
+ }
11884
+ const searchs = searchString.split("/");
11885
+ const urls = url.split("/");
11886
+ const trimmedUrls = urls.slice(0, searchs.length).join("/");
11887
+ return !!Expression.Path.pathNameData(trimmedUrls, searchString);
11888
+ }
11889
+ _collectAllMatchingModules(router, intent, parentRouters) {
11890
+ const matches = [];
11891
+ const path = intent.pathname;
11892
+ const routerConfig = router.getConfig(RouterMetadataKey);
11893
+ if (routerConfig) {
11894
+ const filters = [];
11895
+ if (Array.isArray(routerConfig.filters)) {
11896
+ filters.push(...routerConfig.filters);
11897
+ } else if (routerConfig.filters) {
11898
+ filters.push(routerConfig.filters);
11899
+ }
11900
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11901
+ if (noAccept) {
11902
+ return matches;
11903
+ }
11904
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
11905
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
11906
+ if (isRoot) {
11907
+ const currentParentRouters = [...parentRouters, router];
11908
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
11909
+ for (const child of routerConfig.routers) {
11910
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
11911
+ if (!routerAtomic) {
11912
+ continue;
11913
+ }
11914
+ matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
11915
+ }
11916
+ }
11917
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
11918
+ if (module) {
11919
+ module.routerChains = currentParentRouters;
11920
+ matches.push(module);
11921
+ }
11922
+ }
11923
+ }
11924
+ return matches;
11925
+ }
11926
+ findRouterOrModule(router, routerData, parentRoots, intent) {
11927
+ const module = this.findRouting(router, routerData, parentRoots, intent);
11928
+ if (module?.module) {
11929
+ module.intent = intent;
11930
+ return module;
11931
+ }
11932
+ const urlRoot = parentRoots.join("") + (routerData.path || "");
11933
+ if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
11934
+ const rm = new RouterModule(this.simstanceManager, router);
11935
+ rm.intent = intent;
11936
+ rm.path = urlRoot;
11937
+ rm.pathData = intent.getPathnameData(urlRoot);
11938
+ return rm;
11939
+ }
11940
+ return void 0;
11941
+ }
11942
+ findRouting(router, routerData, parentRoots, intent) {
11943
+ const urlRoot = parentRoots.join("") + routerData.path;
11944
+ if (routerData.route) {
11945
+ for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
11946
+ const path = urlRoot + it;
11947
+ const pathnameData = intent.getPathnameData(path);
11948
+ if (pathnameData) {
11949
+ try {
11950
+ const dataSet = this.findRouteProperty(routerData.route, it, intent);
11951
+ const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
11952
+ rm.data = dataSet.data;
11953
+ rm.path = path;
11954
+ rm.pathData = pathnameData;
11955
+ rm.propertyKeys = dataSet.propertyKeys;
11956
+ return rm;
11957
+ } catch (e) {
11958
+ }
11959
+ }
11960
+ }
11961
+ }
11962
+ }
11963
+ findRouteProperty(route, propertyName, intent) {
11964
+ let child;
11965
+ let data;
11966
+ let propertyKeys;
11967
+ const routeElement = route[propertyName];
11968
+ if (typeof routeElement === "function") {
11969
+ child = { targetKeyType: routeElement, originalType: routeElement };
11970
+ } else if (typeof routeElement === "symbol") {
11971
+ const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
11972
+ if (findSimType?.originalType) {
11973
+ child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
11974
+ }
11975
+ } else if (typeof routeElement === "string") {
11976
+ return this.findRouteProperty(route, routeElement, intent);
11977
+ } else if (Array.isArray(routeElement)) {
11978
+ const r = routeElement?.[0];
11979
+ if (typeof r === "object" && "filters" in r && "target" in r) {
11980
+ const filters = [];
11981
+ if (Array.isArray(r.filters)) {
11982
+ filters.push(...r.filters);
11983
+ } else if (r.filters) {
11984
+ filters.push(r.filters);
11985
+ }
11986
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11987
+ if (!noAccept) {
11988
+ child = { targetKeyType: r.target, originalType: r.target };
11989
+ }
11990
+ } else {
11991
+ child = { targetKeyType: r, originalType: r };
11992
+ }
11993
+ data = routeElement?.[1];
11994
+ } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
11995
+ const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11996
+ if (!noAccept) {
11997
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
11998
+ propertyKeys = routeElement.propertyKeys;
11999
+ }
12000
+ } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
12001
+ const filters = [];
12002
+ if (Array.isArray(routeElement.filters)) {
12003
+ filters.push(...routeElement.filters);
12004
+ } else if (routeElement.filters) {
12005
+ filters.push(routeElement.filters);
12006
+ }
12007
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
12008
+ if (!noAccept) {
12009
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
12010
+ }
12011
+ }
12012
+ return {
12013
+ child,
12014
+ data,
12015
+ propertyKeys
12016
+ };
12017
+ }
12018
+ };
12019
+
12020
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
12021
+ var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
12022
+ var getCacheSet = (simpleApplication) => {
12023
+ return simpleApplicationCache.get(simpleApplication);
12024
+ };
12025
+ var findCacheByKey = (simpleApplication, key) => {
12026
+ const storage = simpleApplicationCache.get(simpleApplication);
12027
+ if (storage) {
12028
+ return Array.from(storage.config.entries()).find(([k, v]) => k === key);
12029
+ }
12030
+ };
12031
+ var findCacheByKeyStartWith = (simpleApplication, key) => {
12032
+ const storage = simpleApplicationCache.get(simpleApplication);
12033
+ if (storage) {
12034
+ return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
12035
+ } else {
12036
+ return [];
12037
+ }
12038
+ };
12039
+ var deleteCacheByKey = (simpleApplication, key) => {
12040
+ const storage = simpleApplicationCache.get(simpleApplication);
12041
+ if (storage) {
12042
+ storage.storage.delete(key);
12043
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
12044
+ const data = storage.config.get(k);
12045
+ if (data?.expireTimeout) {
12046
+ clearTimeout(data.expireTimeout);
12047
+ }
12048
+ storage.config.delete(k);
12049
+ storage.storage.delete(k);
12050
+ });
12051
+ }
12052
+ };
12053
+ var deleteCacheByKeyStartWith = (simpleApplication, key) => {
12054
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
12055
+ };
12056
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
12057
+
12058
+ // ../simple-boot/dist/esm/cache/CacheManager.js
12059
+ var CacheManager = class {
12060
+ constructor(simpleApplication) {
12061
+ this.simpleApplication = simpleApplication;
12062
+ }
12063
+ findCacheByKey(key) {
12064
+ return findCacheByKey(this.simpleApplication, key);
12065
+ }
12066
+ findCacheByKeyStartWith(key) {
12067
+ return findCacheByKeyStartWith(this.simpleApplication, key);
12068
+ }
12069
+ deleteCacheByKey(key) {
12070
+ return deleteCacheByKey(this.simpleApplication, key);
12071
+ }
12072
+ deleteCacheByKeyStartWith(key) {
12073
+ return deleteCacheByKeyStartWith(this.simpleApplication, key);
12074
+ }
12075
+ getCacheSet() {
12076
+ return getCacheSet(this.simpleApplication);
12077
+ }
12078
+ };
12079
+
12080
+ // ../simple-boot/dist/esm/fetch/ApiService.js
12081
+ var ApiServiceInterceptor;
12082
+ ((ApiServiceInterceptor2) => {
12083
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
12084
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
12085
+ try {
12086
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
12087
+ } catch (e) {
12088
+ return [];
12089
+ }
12090
+ };
12091
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
12092
+ var ApiService = class extends HttpJsonFetcher {
12093
+ constructor(simstanceManager, alertService) {
12094
+ super();
12095
+ this.simstanceManager = simstanceManager;
12096
+ this.subject = new Subject();
12097
+ this.alertService = alertService;
12098
+ }
12099
+ // @PostConstruct
12100
+ // postConstruct(alertService: AlertService<any>) {
12101
+ // this.alertService = alertService;
12102
+ // }
12103
+ get observable() {
12104
+ return this.subject.asObservable();
12105
+ }
12106
+ createPipe(config) {
12107
+ return {};
12108
+ }
12109
+ async beforeProxyFetch(config) {
12110
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
12111
+ for (const interceptor of interceptors) {
12112
+ if (interceptor.beforeProxyFetch) {
12113
+ config = await interceptor.beforeProxyFetch(config);
12114
+ }
12115
+ }
12116
+ this.subject.next({ type: "beforeFetchData", config });
12117
+ return config;
12118
+ }
12119
+ async afterProxyFetch(config) {
12120
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
12121
+ let r = config.response;
12122
+ for (const interceptor of interceptors) {
12123
+ if (interceptor.afterProxyFetch) {
12124
+ r = await interceptor.afterProxyFetch(config);
12125
+ }
12126
+ }
12127
+ this.subject.next({ type: "afterFetchData", response: r });
12128
+ return r;
12129
+ }
12130
+ beforeFetch(fetch2) {
12131
+ this.subject.next({ type: "beforeFetch", fetch: fetch2 });
12132
+ }
12133
+ afterFetch(fetch2, response) {
12134
+ this.subject.next({ type: "afterFetch", fetch: fetch2, response });
12135
+ }
12136
+ before(config, pipe) {
12137
+ this.subject.next({ type: "progress", config, pipe });
12138
+ config.config?.config?.callBackProgress?.(config, pipe);
12139
+ if (config.config?.config?.alertProgress) {
12140
+ const alert = this.alertService?.progress({ title: config.config.config.title });
12141
+ if (alert) {
12142
+ pipe.progress = alert;
12143
+ alert.activate();
12144
+ }
12145
+ }
12146
+ }
12147
+ afterSuccess(config, pipe) {
12148
+ this.subject.next({ type: "success", config, pipe });
12149
+ config.config?.config?.callBackSuccess?.(config, pipe);
12150
+ if (config.config?.config?.alertSuccessMsg) {
12151
+ this.alertService?.success({ title: config.config.config.title })?.activate();
12152
+ }
12153
+ }
12154
+ afterSuccessTransform(config, pipe) {
12155
+ }
12156
+ finally(config, pipe) {
12157
+ this.subject.next({ type: "final", config, pipe });
12158
+ config.config?.config?.callBackFinal?.(config, pipe);
12159
+ pipe.progress?.deActivate();
12160
+ }
12161
+ error(config, pipe, e) {
12162
+ console.log("error", e);
12163
+ this.subject.next({ type: "error", config, pipe, e });
12164
+ config.config?.config?.callBackError?.(config, pipe, e);
12165
+ if (config.config?.config?.alertErrorMsg) {
12166
+ this.alertService?.danger({
12167
+ title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
12168
+ })?.activate();
12169
+ }
12170
+ if (config.config?.config?.enableErrorConsole) {
12171
+ console.error(`apiService Error ${config?.config?.config?.title}`, e);
12172
+ }
12173
+ }
12174
+ async execute(fetcherRequest) {
12175
+ const target = fetcherRequest.target;
12176
+ const config = fetcherRequest.config;
12177
+ let r = { target, config };
12178
+ const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
12179
+ for (const apiServiceInterceptor of interceptor) {
12180
+ if (apiServiceInterceptor.beforeProxyExecute) {
12181
+ r = await apiServiceInterceptor.beforeProxyExecute?.(r);
12182
+ }
12183
+ }
12184
+ return super.execute(r);
12185
+ }
12186
+ };
12187
+
12188
+ // ../simple-boot/dist/esm/alert/AlertAction.js
12189
+ var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
12190
+ AlertAction2["ACTIVE"] = "ACTIVE";
12191
+ AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
12192
+ return AlertAction2;
12193
+ })(AlertAction || {});
12194
+
12195
+ // ../simple-boot/dist/esm/alert/Alert.js
12196
+ var Alert = class {
12197
+ constructor(alertService, config) {
12198
+ this.alertService = alertService;
12199
+ this.config = config;
12200
+ this.isActive = false;
12201
+ this.activateBefore = [];
12202
+ this.activateAfter = [];
12203
+ this.deActivateBefore = [];
12204
+ this.deActivateAfter = [];
12205
+ this.data = /* @__PURE__ */ new Map();
12206
+ if (config?.uuid) {
12207
+ this.uuid = config.uuid;
12208
+ } else {
12209
+ this.uuid = RandomUtils.uuid();
12210
+ }
12211
+ }
12212
+ addOpenBefore(fn) {
12213
+ this.activateBefore.push(fn);
12214
+ }
12215
+ addOpenAfter(fn) {
12216
+ this.activateAfter.push(fn);
12217
+ }
12218
+ addCloseBefore(fn) {
12219
+ this.deActivateBefore.push(fn);
12220
+ }
12221
+ addCloseAfter(fn) {
12222
+ this.deActivateAfter.push(fn);
12223
+ }
12224
+ setData(key, value) {
12225
+ this.data.set(key, value);
12226
+ }
12227
+ getData(key) {
12228
+ return this.data.get(key);
12229
+ }
12230
+ async activate() {
12231
+ try {
12232
+ await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
12233
+ this.result = this.make();
12234
+ this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
12235
+ this.isActive = true;
12236
+ if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
12237
+ setTimeout(() => {
12238
+ this.deActivate();
12239
+ }, this.config.closeTime);
12240
+ }
12241
+ this.config?.activate?.(this.result, this);
12242
+ });
12243
+ } catch (e) {
12244
+ } finally {
12245
+ await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
12246
+ });
12247
+ }
12248
+ }
12249
+ async deActivate() {
12250
+ try {
12251
+ await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
12252
+ this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
12253
+ this.isActive = false;
12254
+ this.config?.deActivate?.(this.result, this);
12255
+ });
12256
+ } catch (e) {
12257
+ } finally {
12258
+ await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
12259
+ });
12260
+ }
12261
+ }
12262
+ };
12263
+
12264
+ // ../simple-boot/dist/esm/alert/AlertFactory.js
12265
+ var AlertFactory = class {
12266
+ };
12267
+ var DefaultAlertFactory = class extends AlertFactory {
12268
+ create(data) {
12269
+ return void 0;
12270
+ }
12271
+ };
12272
+
12273
+ // ../simple-boot/dist/esm/alert/AlertType.js
12274
+ var AlertType = /* @__PURE__ */ ((AlertType2) => {
12275
+ AlertType2["DANGER"] = "DANGER";
12276
+ AlertType2["NORMAL"] = "NORMAL";
12277
+ AlertType2["PROGRESS"] = "PROGRESS";
12278
+ AlertType2["SUCCESS"] = "SUCCESS";
12279
+ AlertType2["ERROR"] = "ERROR";
12280
+ AlertType2["INFO"] = "INFO";
12281
+ AlertType2["WARNING"] = "WARNING";
12282
+ AlertType2["CONSOLE"] = "CONSOLE";
12283
+ AlertType2["ETC"] = "ETC";
12284
+ return AlertType2;
12285
+ })(AlertType || {});
12286
+
12287
+ // ../simple-boot/dist/esm/alert/AlertService.js
12288
+ var AlertService = class {
12289
+ constructor(alertFactory) {
12290
+ this.name = (/* @__PURE__ */ new Date()).toUTCString();
12291
+ this.subject = new ReplaySubject();
12292
+ this.alertFactory = alertFactory;
12293
+ }
12294
+ // @PostConstruct
12295
+ // postConstruct(
12296
+ // ) {
12297
+ // this.alertFactory = alertFactory;
12298
+ // }
12299
+ // @PostConstruct
12300
+ // postConstruct(apiService: ApiService) {
12301
+ // this.apiService = alertFactory;
12302
+ // }
12303
+ get observable() {
12304
+ return this.subject.asObservable();
12305
+ }
12306
+ publish(data) {
12307
+ this.subject.next(data);
12308
+ }
12309
+ create(factory, config) {
12310
+ return new class extends Alert {
12311
+ make() {
12312
+ return factory(this);
12313
+ }
12314
+ }(this, config);
12315
+ }
12316
+ createFromFactory(type, config) {
12317
+ return this.alertFactory?.create({ caller: this, type, config });
12318
+ }
12319
+ danger(config) {
12320
+ return this.createFromFactory(AlertType.DANGER, config);
12321
+ }
12322
+ progress(config) {
12323
+ config = config ?? {};
12324
+ return this.createFromFactory(AlertType.PROGRESS, config);
12325
+ }
12326
+ success(config) {
12327
+ return this.createFromFactory(AlertType.SUCCESS, config);
12328
+ }
12329
+ info(config) {
12330
+ return this.createFromFactory(AlertType.INFO, config);
12331
+ }
12332
+ error(config) {
12333
+ return this.createFromFactory(AlertType.ERROR, config);
12334
+ }
12335
+ warning(config) {
12336
+ return this.createFromFactory(AlertType.WARNING, config);
12337
+ }
12338
+ };
12339
+
12340
+ // ../simple-boot/dist/esm/SimpleApplication.js
12341
+ var SimpleApplication = class _SimpleApplication {
12342
+ // public rootRouter?: ConstructorType<any>;
12343
+ // constructor();
12344
+ // constructor(option: SimOption);
12345
+ // constructor(rootRouter?: ConstructorType<Object> | Function);
12346
+ // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
12347
+ // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
12348
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
12349
+ // private alertService: AlertService<any>;
12350
+ constructor(option = new SimOption()) {
12351
+ this.option = option;
12352
+ this.simstanceManager = new SimstanceManager(this, option);
12353
+ this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
12354
+ this.routerManager = new RouterManager(this, this.simstanceManager, option);
12355
+ this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
12356
+ this.cacheManager = new CacheManager(this);
12357
+ if (!this.simstanceManager.getStoreSet(AlertFactory)) {
12358
+ this.simstanceManager.setStoreSet(AlertFactory, new DefaultAlertFactory());
12359
+ }
12360
+ Sim({ container: this.option.container })(AlertService);
12361
+ Sim({ container: this.option.container })(ApiService);
12362
+ this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
12363
+ this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
12364
+ this.simstanceManager.setStoreSet(CacheManager, this.cacheManager);
12365
+ containers.add(this);
12366
+ }
12367
+ getSimstanceManager() {
12368
+ return this.simstanceManager;
12369
+ }
12370
+ getIntentManager() {
12371
+ return this.intentManager;
12372
+ }
12373
+ getRouterManager() {
12374
+ return this.routerManager;
12375
+ }
12376
+ run(otherInstanceSim) {
12377
+ otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
12378
+ otherInstanceSim.set(_SimpleApplication, this);
12379
+ this.simstanceManager.run(otherInstanceSim);
12380
+ return this;
12381
+ }
12382
+ simAtomic(type) {
12383
+ if (typeof type === "symbol") {
12384
+ return this.simstanceManager.findFirstSim(type);
12385
+ } else if (typeof type === "function") {
12386
+ return this.simstanceManager.findFirstSim({ type });
12387
+ }
12388
+ }
12389
+ simAtomics(type) {
12390
+ if (typeof type === "symbol") {
12391
+ return this.simstanceManager.findSims(type) ?? [];
12392
+ } else if (typeof type === "function") {
12393
+ return this.simstanceManager.findSims({ type }) ?? [];
12394
+ } else {
12395
+ return [];
12396
+ }
12397
+ }
12398
+ getInstance(type) {
12399
+ const i = this.sim(type);
12400
+ if (i) {
12401
+ return i;
12402
+ } else {
12403
+ throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
12404
+ }
12405
+ }
12406
+ sim(type) {
12407
+ return this.simAtomic(type)?.getValue();
12408
+ }
12409
+ sims(type) {
12410
+ return this.simAtomics(type).map((it) => it.getValue());
12411
+ }
12412
+ addSim(configOrTarget, target) {
12413
+ const r = Sim(configOrTarget);
12414
+ if (typeof r === "function" && target) {
12415
+ r(target);
12416
+ }
12417
+ }
12418
+ publishIntent(i, data) {
12419
+ return this.intentManager.publish(i, data);
12420
+ }
12421
+ routing(i, option) {
12422
+ if (i instanceof Intent) {
12423
+ return this.routerManager.routing(i, option);
12424
+ } else if (typeof i === "string") {
12425
+ const intent = new Intent(i);
12426
+ return this.routerManager.routing(intent, option);
12427
+ } else {
12428
+ const intent = new Intent(i.path, i.data);
12429
+ return this.routerManager.routing(intent, option);
12430
+ }
12431
+ }
12432
+ };
12433
+
12434
+ // ../simple-boot/dist/esm/decorators/event/EventListener.js
12435
+ var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
12436
+
12437
+ // ../simple-boot/dist/esm/decorators/validate/Validation.js
12438
+ var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
12439
+ var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
12440
+
12441
+ // src/router/ElementRouter.ts
12442
+ var ElementRouter = class extends Router {
12443
+ constructor(config) {
12444
+ super(config);
12445
+ __publicField(this, "_history", []);
12446
+ __publicField(this, "_currentIndex", -1);
12447
+ }
12448
+ // Override pushState to manage internal history
12449
+ pushState(data, title, path, config) {
12450
+ const behaviorSubject = this.behaviorSubject;
12451
+ if (!config?.noEventAndPublish && behaviorSubject) {
12452
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
12453
+ }
12454
+ if (!this._history) this._history = [];
12455
+ this._history = this._history.slice(0, this._currentIndex + 1);
12456
+ this._history.push({ url: path, data, title });
12457
+ this._currentIndex++;
12458
+ if (!config?.noEventAndPublish && behaviorSubject) {
12459
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
12460
+ }
12461
+ return { data };
12462
+ }
12463
+ // Override replaceState to manage internal history
12464
+ replaceState(data, title, path, config) {
12465
+ const behaviorSubject = this.behaviorSubject;
12466
+ if (!config?.noEventAndPublish && behaviorSubject) {
12467
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
12468
+ }
12469
+ if (!this._history) this._history = [];
12470
+ if (this._currentIndex === -1) {
12471
+ this._history.push({ url: path, data, title });
12472
+ this._currentIndex = 0;
12473
+ } else {
12474
+ this._history[this._currentIndex] = { url: path, data, title };
12475
+ }
12476
+ if (!config?.noEventAndPublish && behaviorSubject) {
12477
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
12478
+ }
12479
+ return { data };
12480
+ }
12481
+ push(path, state) {
12482
+ this.pushState(state?.data, state?.title, this.toUrl(path), state?.config);
12483
+ }
12484
+ replace(path, state) {
12485
+ this.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);
12486
+ }
12487
+ back(config) {
12488
+ if (this._currentIndex > 0) {
12489
+ this.go(-1, config);
12490
+ }
12491
+ }
12492
+ forward(config) {
12493
+ if (this._currentIndex < this._history.length - 1) {
12494
+ this.go(1, config);
12495
+ }
12496
+ }
12497
+ go(config, changeStateConfig) {
12498
+ if (typeof config === "number") {
12499
+ const targetIndex = this._currentIndex + config;
12500
+ if (this._history && targetIndex >= 0 && targetIndex < this._history.length) {
12501
+ const behaviorSubject = this.behaviorSubject;
12502
+ if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {
12503
+ behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
12504
+ }
12505
+ this._currentIndex = targetIndex;
12506
+ const entry = this._history[this._currentIndex];
12507
+ if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {
12508
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: entry.url }), triggerPoint: "end" });
12509
+ }
12510
+ }
12511
+ return;
12512
+ }
12513
+ return super.go(config, changeStateConfig);
12514
+ }
12515
+ getData() {
12516
+ return this._history?.[this._currentIndex]?.data;
12517
+ }
12518
+ getUrl() {
12519
+ return this._history?.[this._currentIndex]?.url ?? this.config?.firstUrl ?? "/";
12520
+ }
12521
+ getHref() {
12522
+ return this.getUrl();
12523
+ }
12524
+ getPathName() {
12525
+ return this.getUrl().split("?")[0];
12526
+ }
12527
+ getSearch() {
12528
+ const parts = this.getUrl().split("?");
12529
+ return parts[1] ? `?${parts[1]}` : "";
12530
+ }
12531
+ getSearchParams(data) {
12532
+ const search = this.getSearch();
12533
+ const searchParams = new URLSearchParams(search);
12534
+ return UrlUtils.manipulateSearchParams(searchParams, data);
12535
+ }
12536
+ getHashSearchParams(data) {
12537
+ const url = this.getUrl();
12538
+ const hashIdx = url.indexOf("#");
12539
+ const hash = hashIdx !== -1 ? url.slice(hashIdx + 1) : "";
12540
+ const searchParams = new URLSearchParams(hash);
12541
+ return UrlUtils.manipulateSearchParams(searchParams, data);
12542
+ }
12543
+ pushAddSearchParam(params, state) {
12544
+ const s = this.getSearchParams({ append: params });
12545
+ this.push({ searchParams: s }, state);
12546
+ }
12547
+ pushDeleteHashSearchParam(name, state) {
12548
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
12549
+ const url = this.getUrl().split("#")[0];
12550
+ const size = Array.from(s.entries()).length;
12551
+ this.push(url + (size > 0 ? "#" + s.toString() : ""), state);
12552
+ }
12553
+ pushDeleteSearchParam(name, state) {
12554
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
12555
+ this.push({ searchParams: s }, state);
12556
+ }
12557
+ pushUpsertSearchParam(params, state) {
12558
+ const s = this.getSearchParams();
12559
+ UrlUtils.upsertSearchParam(s, params);
12560
+ this.push({ searchParams: s }, state);
12561
+ }
12562
+ replaceAddSearchParam(params, state) {
12563
+ const s = this.getSearchParams({ append: params });
12564
+ this.replace({ searchParams: s }, state);
12565
+ }
12566
+ replaceDeleteHashSearchParam(name, state) {
12567
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
12568
+ const url = this.getUrl().split("#")[0];
12569
+ const size = Array.from(s.entries()).length;
12570
+ this.replace(url + (size > 0 ? "#" + s.toString() : ""), state);
12571
+ }
12572
+ replaceDeleteSearchParam(name, state) {
12573
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
12574
+ this.replace({ searchParams: s }, state);
12575
+ }
12576
+ replaceUpsertSearchParam(params, state) {
12577
+ const s = this.getSearchParamObject();
12578
+ UrlUtils.upsertSearchParam(s, params);
12579
+ this.replace({ searchParams: s }, state);
12580
+ }
12581
+ };
12582
+
12583
+ // src/SwcAppEngine.ts
12584
+ var SwcAppEngine = class {
12585
+ constructor(host) {
12586
+ this.host = host;
12587
+ __publicField(this, "simpleApplication");
12588
+ __publicField(this, "router");
12589
+ __publicField(this, "routerSubscription");
12590
+ __publicField(this, "_config");
12591
+ }
12592
+ get config() {
12593
+ return this._config;
12594
+ }
12595
+ async connect(config) {
12596
+ try {
12597
+ this._config = config;
12598
+ if (this._config.routeType === "path") {
12599
+ this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });
12600
+ } else if (this._config.routeType === "hash") {
12601
+ this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });
12602
+ } else if (this._config.routeType === "element") {
12603
+ this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });
12604
+ }
12605
+ this.simpleApplication = new SimpleApplication(
12606
+ new SimOption({
12607
+ excludeProxys: [this._config.window.Node],
12608
+ container: this._config.container
12609
+ })
12610
+ );
12611
+ const otherInstanceSim = /* @__PURE__ */ new Map();
12612
+ this.config?.otherInstanceSim?.forEach((v, k) => {
12613
+ otherInstanceSim.set(k, v);
12614
+ });
12615
+ if (this.router) otherInstanceSim.set(Router, this.router);
12616
+ this.simpleApplication.run(otherInstanceSim);
12617
+ if (this._config.onEngineStarted) {
12618
+ await this._config.onEngineStarted(this.simpleApplication, this.host);
12619
+ }
12620
+ } catch (e) {
12621
+ console.error("[SWC-APP-ENGINE] Init failed:", e, this._config);
12622
+ }
12623
+ }
12624
+ disconnect() {
12625
+ this.routerSubscription?.unsubscribe();
12626
+ }
12627
+ };
12628
+
12629
+ // src/elements/SwcApp.ts
12630
+ var __decorate = function(decorators, target, key, desc) {
12631
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12632
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12633
+ 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;
12634
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12635
+ };
12636
+ var isSSR = (i) => {
12637
+ return i.hasAttribute("swc-use-ssr");
12638
+ };
12639
+ var setSSRAttribute = (i) => {
12640
+ i.setAttribute("swc-use-ssr", i._swcId ?? "");
12641
+ };
12642
+ var removeSSRAttribute = (i) => {
12643
+ i.removeAttribute("swc-use-ssr");
12644
+ };
12645
+ var tagName = "swc-app";
12646
+ var SwcApp_default = async (w) => {
12647
+ const existing = w.customElements.get(tagName);
12648
+ if (existing)
12649
+ return existing;
12650
+ let SwcApp = class SwcApp extends w.HTMLElement {
12651
+ constructor() {
12652
+ super(...arguments);
12653
+ this.__swc_engine = new SwcAppEngine(this);
12654
+ this._swc_connected_instance = /* @__PURE__ */ new Set();
12655
+ this._routeChangeInvocations = 0;
12656
+ this._connectedInvocations = 0;
12657
+ this._connected_safari_and_standby = [];
12658
+ }
12659
+ get simpleApplication() {
12660
+ return this.__swc_engine.simpleApplication;
12661
+ }
12662
+ get config() {
12663
+ return this.__swc_engine?.config;
12664
+ }
12665
+ get router() {
12666
+ return this.__swc_engine?.router;
12667
+ }
12668
+ async _invokeRouteChangeSubscribers(instance, re) {
12669
+ if (instance.isConnected === false)
12670
+ return;
12671
+ this._routeChangeInvocations++;
12672
+ if (this._childrenRouteChangedInterval) {
12673
+ this.config.window.clearInterval(this._childrenRouteChangedInterval);
12674
+ }
12675
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
12676
+ this._childrenRouteChangedInterval = debounceTimeIntervalLock(
12677
+ () => this._routeChangeInvocations === 0,
12678
+ () => {
12679
+ this._childrenRouteChangedInterval = null;
12680
+ this.config.onChildrenRouteChanged?.(re, this);
12681
+ },
12682
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
12683
+ intervalConfig
12684
+ // {setInterval: window.setInterval, clearInterval: window.clearInterval}
12685
+ );
12686
+ try {
12687
+ const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
12688
+ if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
12689
+ const ps = routeChangeSubscribers.map(async (metadata) => {
12690
+ const methodName = metadata.propertyKey;
12691
+ let pathPattern = metadata.options?.path;
12692
+ const filter = metadata.options?.filter;
12693
+ if (typeof pathPattern === "function") {
12694
+ pathPattern = pathPattern(instance);
12695
+ }
12696
+ let pathMatched = false;
12697
+ let pathData = null;
12698
+ if (!pathPattern) {
12699
+ pathMatched = true;
12700
+ pathData = {};
12701
+ } else if (Array.isArray(pathPattern)) {
12702
+ for (const pattern of pathPattern) {
12703
+ const data = SwcUtils.parsePathPattern(pattern, re.path || "/");
12704
+ if (data !== null) {
12705
+ pathMatched = true;
12706
+ pathData = data;
12707
+ break;
12708
+ }
12709
+ }
12710
+ } else {
12711
+ pathData = SwcUtils.parsePathPattern(pathPattern, re.path || "/");
12712
+ pathMatched = pathData !== null;
12713
+ }
12714
+ const filterPassed = !filter || filter(this.router, instance);
12715
+ if (pathMatched && filterPassed && instance[methodName]) {
12716
+ await instance[methodName]({ ...re, pathData });
12717
+ }
12718
+ });
12719
+ await Promise.allSettled(ps);
12720
+ }
12721
+ } finally {
12722
+ if (this.config?.ssr) {
12723
+ setSSRAttribute(instance);
12724
+ } else {
12725
+ removeSSRAttribute(instance);
12726
+ }
12727
+ this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
12728
+ }
12729
+ }
12730
+ async _connected(instance, option) {
12731
+ if (instance) {
12732
+ if (!this.simpleApplication && !this.config) {
12733
+ this._connected_safari_and_standby.push(instance);
12734
+ return;
12735
+ }
12736
+ this.config.onConnectedChildBefore?.(instance);
12737
+ if (!option?.noIncrements) {
12738
+ this._connectedInvocations++;
12739
+ }
12740
+ this._swc_connected_instance.add(instance);
12741
+ const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
12742
+ for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
12743
+ await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
12744
+ }
12745
+ if (this._childrenConnectedDoneInterval) {
12746
+ this.config.window.clearInterval(this._childrenConnectedDoneInterval);
12747
+ }
12748
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
12749
+ this._childrenConnectedDoneInterval = debounceTimeIntervalLock(() => this._connectedInvocations === 0, () => {
12750
+ this._childrenConnectedDoneInterval = null;
12751
+ this.config.onChildrenConnectedDone?.(this);
12752
+ }, this.config?.childrenConnectedDoneCheckIntervalTime ?? 30, intervalConfig);
12753
+ if (this.simpleApplication) {
12754
+ try {
12755
+ if (this.router && this._lastRouterEvent) {
12756
+ await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent);
12757
+ }
12758
+ } catch (e) {
12759
+ throw e;
12760
+ }
12761
+ }
12762
+ if (this.config?.ssr) {
12763
+ setSSRAttribute(instance);
12764
+ } else {
12765
+ removeSSRAttribute(instance);
12766
+ }
12767
+ }
12768
+ this.config.onConnectedChildAfter?.(instance);
12769
+ return this;
12770
+ }
12771
+ async _connectedDone(instance) {
12772
+ try {
12773
+ } finally {
12774
+ this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
12775
+ }
12776
+ }
12777
+ _disconnected(instance) {
12778
+ if (instance) {
12779
+ this._swc_connected_instance.delete(instance);
12780
+ this.config?.onDisconnectedChildAfter?.(instance);
12781
+ }
12782
+ }
12783
+ async _handleRouteChange(route) {
12784
+ this._lastRouterEvent = route;
12785
+ const swcConnectedInstance = Array.from(this._swc_connected_instance);
12786
+ const ps = swcConnectedInstance.map((instance) => this._invokeRouteChangeSubscribers(instance, route));
12787
+ await Promise.allSettled(ps);
12788
+ }
12789
+ async connect(config) {
12790
+ console.log("[SWC] connect");
12791
+ const swcConfig = {
12792
+ routeType: "element",
12793
+ window: config?.window,
12794
+ ...config
12795
+ };
12796
+ const mode = config?.connectMode || "direct";
12797
+ if (mode === "direct" || mode === "hydrate") {
12798
+ this.setAttribute("swc-connect-mode", mode);
12799
+ await this.__swc_engine.connect(swcConfig);
12800
+ } else if (mode === "swap" || mode === "clear-swap") {
12801
+ if (!this.parentNode) {
12802
+ await this.__swc_engine.connect(swcConfig);
12803
+ this.setAttribute("swc-connect-mode", "direct");
12804
+ } else {
12805
+ const clonedApp = this.cloneNode(mode === "swap");
12806
+ clonedApp.style.display = "none";
12807
+ this.parentNode.insertBefore(clonedApp, this.nextSibling);
12808
+ try {
12809
+ await clonedApp.connect({ ...config || {}, connectMode: "direct" });
12810
+ if (this.parentNode) {
12811
+ this.parentNode.removeChild(this);
12812
+ }
12813
+ clonedApp.style.display = "";
12814
+ clonedApp.setAttribute("swc-connect-mode", mode);
12815
+ return;
12816
+ } catch (e) {
12817
+ if (clonedApp.parentNode) {
12818
+ clonedApp.parentNode.removeChild(clonedApp);
12819
+ }
12820
+ await this.__swc_engine.connect(swcConfig);
12821
+ this.setAttribute("swc-connect-mode", "direct");
12822
+ }
12823
+ }
12824
+ }
12825
+ this._connected_safari_and_standby.forEach((instance) => {
12826
+ this._connected(instance, { noIncrements: true });
12827
+ });
12828
+ if (!this._routerSubscription && this.router) {
12829
+ const config2 = this.__swc_engine.config;
12830
+ this._routerSubscription = this.router.observable.subscribe(async (route) => {
12831
+ console.log("[SWC] Router event received:", route.triggerPoint);
12832
+ if (route.triggerPoint === "end") {
12833
+ await this._handleRouteChange(route);
12834
+ }
12835
+ });
12836
+ if (config2?.path) {
12837
+ console.log("[DEBUG] Navigating to initial path:", config2.path);
12838
+ }
12839
+ }
12840
+ }
12841
+ // async _invokeOnConnectedSwcAppStarted(instance: any) {
12842
+ // this._swcAppStartedInvocations++;
12843
+ // try {
12844
+ // // 이미 시작된 인스턴스라면 스킵 (비동기 병렬 중복 호출 방지)
12845
+ // if (this._swc_started_instances.has(instance)) return;
12846
+ // this._swc_started_instances.add(instance);
12847
+ //
12848
+ // const startedMethods = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);
12849
+ // if (startedMethods) {
12850
+ // const ps = startedMethods.map(m => instance._invokeLifecycleMethod(m));
12851
+ // await Promise.allSettled(ps);
12852
+ // }
12853
+ // } finally {
12854
+ // this._swcAppStartedInvocations--;
12855
+ // }
12856
+ // }
12857
+ connectedCallback() {
12858
+ if (super.connectedCallback)
12859
+ super.connectedCallback();
12860
+ const configStr = this.getAttribute("swc-get-application-config");
12861
+ const win = this.ownerDocument?.defaultView || window;
12862
+ if (configStr && win) {
12863
+ try {
12864
+ const userConfig = FunctionUtils.executeReturn({
12865
+ script: configStr,
12866
+ context: this,
12867
+ args: SwcUtils.getHelperAndHostSet(win, this)
12868
+ });
12869
+ this.connect(userConfig);
12870
+ } catch (e) {
12871
+ console.error("[SWC-APP-ENGINE] Script execution failed:", e);
12872
+ }
12873
+ }
12874
+ this._connected(this);
12875
+ this.__swc_engine?.config?.onConnected?.(this);
12876
+ this._connectedDone(this);
12877
+ }
12878
+ disconnectedCallback() {
12879
+ if (super.disconnectedCallback)
12880
+ super.disconnectedCallback();
12881
+ this._routerSubscription?.unsubscribe();
12882
+ this._routerSubscription = void 0;
12883
+ this._lastRouterEvent = void 0;
12884
+ this.__swc_engine.disconnect();
12885
+ this.__swc_engine?.config?.onDisconnected?.(this);
12886
+ this._disconnected(this);
12887
+ }
12888
+ async routing(path) {
12889
+ await this.router?.go(path);
12890
+ }
12891
+ back() {
12892
+ this.router?.back();
12893
+ }
12894
+ forward() {
12895
+ this.router?.forward();
12896
+ }
12897
+ reload() {
12898
+ this.router?.reload();
12899
+ }
12900
+ // async completedSwcApp() {
12901
+ // const ss = Array.from(this._swc_connected_instance).flatMap((it) => {
12902
+ // const ms = findAllLifecycleMetadata(it, ON_CONNECTED_COMPLETED_SWC_APP_METADATA_KEY) ?? [];
12903
+ // return ms.map((sit) => it[sit](this));
12904
+ // });
12905
+ // await Promise.allSettled(ss);
12906
+ // }
12907
+ publishMessage(message) {
12908
+ this._swc_connected_instance.forEach((instance) => {
12909
+ this._invokeMessageSubscribers(instance, message);
12910
+ });
12911
+ }
12912
+ _invokeMessageSubscribers(instance, message) {
12913
+ const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);
12914
+ if (messageSubscribers && Array.isArray(messageSubscribers)) {
12915
+ messageSubscribers.forEach((metadata) => {
12916
+ const methodName = metadata.propertyKey;
12917
+ const messageType = metadata.messageType;
12918
+ const filter = metadata.filter;
12919
+ let typeMatched = false;
12920
+ if (!messageType) {
12921
+ typeMatched = true;
12922
+ } else if (message.type === messageType) {
12923
+ typeMatched = true;
12924
+ }
12925
+ let filterMatched = true;
12926
+ if (filter && typeMatched) {
12927
+ filterMatched = filter(message, instance);
12928
+ }
12929
+ if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
12930
+ instance[methodName](message);
12931
+ }
12932
+ });
12933
+ }
12934
+ }
12935
+ };
12936
+ SwcApp = __decorate([
12937
+ elementDefine(tagName, { window: w })
12938
+ ], SwcApp);
12939
+ ;
12940
+ return w.customElements.whenDefined(tagName);
12941
+ };
12942
+
12943
+ // src/elements/index.ts
12944
+ var registerSwcApp = SwcApp_default;
12945
+ var register = [SwcApp_default];
9176
12946
  return __toCommonJS(bundle_entry_exports);
9177
12947
  })();
9178
12948
  /*! Bundled license information: