jsf.js_next_gen 4.1.0-beta.2 → 4.1.0-beta.21

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 (413) hide show
  1. package/AI_CONTRIBUTIONS.md +71 -0
  2. package/README.md +254 -78
  3. package/api-extractor.faces.json +38 -0
  4. package/dist/docs/assets/hierarchy.js +1 -1
  5. package/dist/docs/assets/navigation.js +1 -1
  6. package/dist/docs/assets/search.js +1 -1
  7. package/dist/docs/functions/faces.ajax.addOnError.html +2 -2
  8. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -2
  9. package/dist/docs/functions/faces.ajax.request.html +2 -2
  10. package/dist/docs/functions/faces.ajax.response.html +2 -2
  11. package/dist/docs/functions/faces.getClientWindow.html +2 -2
  12. package/dist/docs/functions/faces.getProjectStage.html +2 -2
  13. package/dist/docs/functions/faces.getViewState.html +1 -1
  14. package/dist/docs/functions/faces.push.close.html +1 -1
  15. package/dist/docs/functions/faces.push.init.html +6 -6
  16. package/dist/docs/functions/faces.push.open.html +1 -1
  17. package/dist/docs/functions/faces.util.chain.html +2 -2
  18. package/dist/docs/functions/myfaces.ab.html +3 -3
  19. package/dist/docs/functions/myfaces.onDomReady.html +1 -1
  20. package/dist/docs/functions/myfaces.reserveNamespace.html +1 -1
  21. package/dist/docs/hierarchy.html +1 -1
  22. package/dist/docs/index.html +292 -71
  23. package/dist/docs/interfaces/faces.AjaxData.html +6 -0
  24. package/dist/docs/interfaces/faces.AjaxError.html +18 -0
  25. package/dist/docs/interfaces/faces.AjaxEvent.html +8 -0
  26. package/dist/docs/interfaces/faces.ajax.RequestContext.html +6 -0
  27. package/dist/docs/interfaces/faces.ajax.RequestOptions.html +10 -0
  28. package/dist/docs/modules/faces.ajax.html +1 -1
  29. package/dist/docs/modules/faces.html +1 -1
  30. package/dist/docs/modules/faces.push.html +1 -1
  31. package/dist/docs/modules/faces.util.html +1 -1
  32. package/dist/docs/modules/myfaces.html +1 -1
  33. package/dist/docs/modules.html +1 -1
  34. package/dist/docs/types/faces.AjaxErrorStatus.html +2 -0
  35. package/dist/docs/types/faces.AjaxEventStatus.html +2 -0
  36. package/dist/docs/types/faces.ProjectStage.html +2 -0
  37. package/dist/docs/types/faces.ajax.OnErrorCallback.html +2 -0
  38. package/dist/docs/types/faces.ajax.OnEventCallback.html +2 -0
  39. package/dist/docs/types/faces.push.OnCloseHandler.html +2 -0
  40. package/dist/docs/types/faces.push.OnErrorHandler.html +2 -0
  41. package/dist/docs/types/faces.push.OnMessageHandler.html +2 -0
  42. package/dist/docs/types/faces.push.OnOpenHandler.html +2 -0
  43. package/dist/docs/variables/faces.contextpath.html +1 -1
  44. package/dist/docs/variables/faces.implversion.html +1 -1
  45. package/dist/docs/variables/faces.separatorchar.html +1 -1
  46. package/dist/docs/variables/faces.specversion.html +1 -1
  47. package/dist/docs/variables/myfaces.oam.html +1 -1
  48. package/dist/window/faces-development.js +1801 -499
  49. package/dist/window/faces-development.js.map +1 -1
  50. package/{target/api/_api.js → dist/window/faces.d.ts} +124 -151
  51. package/dist/window/faces.js +1 -1
  52. package/dist/window/faces.js.LICENSE.txt +0 -17
  53. package/dist/window/faces.js.map +1 -1
  54. package/dist/window/jsf-development.js +1806 -513
  55. package/dist/window/jsf-development.js.map +1 -1
  56. package/{target/src/main/typescript/api/_api.js → dist/window/jsf.d.ts} +125 -153
  57. package/dist/window/jsf.js +1 -1
  58. package/dist/window/jsf.js.LICENSE.txt +0 -17
  59. package/dist/window/jsf.js.map +1 -1
  60. package/package.json +22 -18
  61. package/scripts/build-dts.mjs +239 -0
  62. package/src/main/typescript/@types/definitions/index.d.ts +22 -122
  63. package/{target/test/frameworkBase/_ext/monadish/fixtures/test2.js → src/main/typescript/@types/definitions/modules.d.ts} +18 -2
  64. package/src/main/typescript/api/_api.ts +132 -29
  65. package/{target/test/frameworkBase/_ext/monadish/fixtures/test.js → src/main/typescript/api/_api_ae_stub.d.ts} +6 -2
  66. package/src/main/typescript/api/faces.ts +2 -2
  67. package/src/main/typescript/api/jsf.ts +15 -23
  68. package/src/main/typescript/impl/AjaxImpl.ts +15 -15
  69. package/src/main/typescript/impl/PushImpl.ts +139 -69
  70. package/src/main/typescript/impl/core/Const.ts +2 -2
  71. package/src/main/typescript/impl/i18n/Messages.ts +1 -1
  72. package/src/main/typescript/impl/util/Assertions.ts +1 -2
  73. package/src/main/typescript/impl/util/AsyncRunnable.ts +3 -4
  74. package/src/main/typescript/impl/util/ExtDomQuery.ts +19 -19
  75. package/src/main/typescript/impl/util/FileUtils.ts +30 -14
  76. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +34 -34
  77. package/src/main/typescript/impl/util/Lang.ts +19 -22
  78. package/src/main/typescript/impl/util/XhrQueueController.ts +25 -3
  79. package/src/main/typescript/impl/xhrCore/ErrorData.ts +17 -12
  80. package/src/main/typescript/impl/xhrCore/EventData.ts +8 -7
  81. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +3 -3
  82. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +7 -6
  83. package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
  84. package/src/main/typescript/impl/xhrCore/ResponseDataResolver.ts +0 -38
  85. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +17 -15
  86. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -63
  87. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -134
  88. package/src/main/typescript/mona_dish_shim.ts +6 -2
  89. package/src/main/typescript/myfaces/OamSubmit.ts +10 -6
  90. package/src/main/typescript/test/api/JsfPushShimTest.spec.ts +126 -0
  91. package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
  92. package/src/main/typescript/test/api/PushTypeCompatibility.ts +65 -0
  93. package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
  94. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -0
  95. package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
  96. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
  97. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
  98. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +55 -9
  99. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
  100. package/src/main/typescript/test/impl/AssertionsTest.spec.ts +168 -0
  101. package/src/main/typescript/test/impl/FileUtilsTest.spec.ts +126 -0
  102. package/src/main/typescript/test/impl/ImplTest.spec.ts +75 -1
  103. package/src/main/typescript/test/impl/ResponseDataResolverTest.spec.ts +62 -0
  104. package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +91 -1
  105. package/src/main/typescript/test/impl/util/ExtLangTest.spec.ts +110 -0
  106. package/src/main/typescript/test/impl/util/HiddenInputBuilderTest.spec.ts +74 -0
  107. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +61 -1
  108. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +191 -2
  109. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
  110. package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +14 -0
  111. package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +21 -5
  112. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +363 -4
  113. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +218 -4
  114. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +1 -1
  115. package/src/main/typescript/test/xhrCore/WebsocketTest.spec.ts +764 -0
  116. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +265 -62
  117. package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
  118. package/{target/src/main/typescript/test/xhrCore/FakeWebsocket.js → src/main/typescript/tsconfig.ae.json} +16 -23
  119. package/src/main/typescript/{tsconfig.json → tsconfig.dts.json} +11 -27
  120. package/src/main/typescript/tsconfig.test.json +17 -0
  121. package/tsconfig.api-extractor.json +17 -0
  122. package/.claude/settings.local.json +0 -16
  123. package/.github/workflows/codeql-analysis.yml +0 -83
  124. package/.github/workflows/nodejs.yml +0 -26
  125. package/.mocharc.json +0 -10
  126. package/.nyc_output/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  127. package/.nyc_output/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  128. package/.nyc_output/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  129. package/.nyc_output/processinfo/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  130. package/.nyc_output/processinfo/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  131. package/.nyc_output/processinfo/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  132. package/.nyc_output/processinfo/index.json +0 -1
  133. package/.nycrc +0 -6
  134. package/build.cmd +0 -1
  135. package/build.sh +0 -3
  136. package/mvnw +0 -286
  137. package/mvnw.cmd +0 -161
  138. package/plans for 4.0.1.txt +0 -8
  139. package/remap.ts +0 -51
  140. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +0 -221
  141. package/target/api/_api.js.map +0 -1
  142. package/target/api/faces.js +0 -45
  143. package/target/api/faces.js.map +0 -1
  144. package/target/api/jsf.js +0 -56
  145. package/target/api/jsf.js.map +0 -1
  146. package/target/impl/AjaxImpl.js +0 -748
  147. package/target/impl/AjaxImpl.js.map +0 -1
  148. package/target/impl/PushImpl.js +0 -265
  149. package/target/impl/PushImpl.js.map +0 -1
  150. package/target/impl/core/Const.js +0 -177
  151. package/target/impl/core/Const.js.map +0 -1
  152. package/target/impl/core/ImplTypes.js +0 -38
  153. package/target/impl/core/ImplTypes.js.map +0 -1
  154. package/target/impl/i18n/Messages.js +0 -113
  155. package/target/impl/i18n/Messages.js.map +0 -1
  156. package/target/impl/util/Assertions.js +0 -101
  157. package/target/impl/util/Assertions.js.map +0 -1
  158. package/target/impl/util/AsyncRunnable.js +0 -78
  159. package/target/impl/util/AsyncRunnable.js.map +0 -1
  160. package/target/impl/util/ExtDomQuery.js +0 -306
  161. package/target/impl/util/ExtDomQuery.js.map +0 -1
  162. package/target/impl/util/FileUtils.js +0 -98
  163. package/target/impl/util/FileUtils.js.map +0 -1
  164. package/target/impl/util/HiddenInputBuilder.js +0 -83
  165. package/target/impl/util/HiddenInputBuilder.js.map +0 -1
  166. package/target/impl/util/IListener.js +0 -3
  167. package/target/impl/util/IListener.js.map +0 -1
  168. package/target/impl/util/Lang.js +0 -263
  169. package/target/impl/util/Lang.js.map +0 -1
  170. package/target/impl/util/XhrQueueController.js +0 -92
  171. package/target/impl/util/XhrQueueController.js.map +0 -1
  172. package/target/impl/xhrCore/ErrorData.js +0 -87
  173. package/target/impl/xhrCore/ErrorData.js.map +0 -1
  174. package/target/impl/xhrCore/EventData.js +0 -52
  175. package/target/impl/xhrCore/EventData.js.map +0 -1
  176. package/target/impl/xhrCore/IResponseProcessor.js +0 -3
  177. package/target/impl/xhrCore/IResponseProcessor.js.map +0 -1
  178. package/target/impl/xhrCore/RequestDataResolver.js +0 -186
  179. package/target/impl/xhrCore/RequestDataResolver.js.map +0 -1
  180. package/target/impl/xhrCore/ResonseDataResolver.js +0 -104
  181. package/target/impl/xhrCore/ResonseDataResolver.js.map +0 -1
  182. package/target/impl/xhrCore/Response.js +0 -186
  183. package/target/impl/xhrCore/Response.js.map +0 -1
  184. package/target/impl/xhrCore/ResponseDataResolver.js +0 -104
  185. package/target/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  186. package/target/impl/xhrCore/ResponseProcessor.js +0 -468
  187. package/target/impl/xhrCore/ResponseProcessor.js.map +0 -1
  188. package/target/impl/xhrCore/XhrFormData.js +0 -163
  189. package/target/impl/xhrCore/XhrFormData.js.map +0 -1
  190. package/target/impl/xhrCore/XhrRequest.js +0 -433
  191. package/target/impl/xhrCore/XhrRequest.js.map +0 -1
  192. package/target/mona_dish_shim.js +0 -70
  193. package/target/mona_dish_shim.js.map +0 -1
  194. package/target/myfaces/OamSubmit.js +0 -128
  195. package/target/myfaces/OamSubmit.js.map +0 -1
  196. package/target/src/main/typescript/api/_api.js.map +0 -1
  197. package/target/src/main/typescript/api/faces.js +0 -45
  198. package/target/src/main/typescript/api/faces.js.map +0 -1
  199. package/target/src/main/typescript/api/jsf.js +0 -56
  200. package/target/src/main/typescript/api/jsf.js.map +0 -1
  201. package/target/src/main/typescript/impl/AjaxImpl.js +0 -748
  202. package/target/src/main/typescript/impl/AjaxImpl.js.map +0 -1
  203. package/target/src/main/typescript/impl/PushImpl.js +0 -265
  204. package/target/src/main/typescript/impl/PushImpl.js.map +0 -1
  205. package/target/src/main/typescript/impl/core/Const.js +0 -177
  206. package/target/src/main/typescript/impl/core/Const.js.map +0 -1
  207. package/target/src/main/typescript/impl/core/ImplTypes.js +0 -38
  208. package/target/src/main/typescript/impl/core/ImplTypes.js.map +0 -1
  209. package/target/src/main/typescript/impl/i18n/Messages.js +0 -113
  210. package/target/src/main/typescript/impl/i18n/Messages.js.map +0 -1
  211. package/target/src/main/typescript/impl/util/Assertions.js +0 -101
  212. package/target/src/main/typescript/impl/util/Assertions.js.map +0 -1
  213. package/target/src/main/typescript/impl/util/AsyncRunnable.js +0 -78
  214. package/target/src/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
  215. package/target/src/main/typescript/impl/util/ExtDomQuery.js +0 -306
  216. package/target/src/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
  217. package/target/src/main/typescript/impl/util/FileUtils.js +0 -98
  218. package/target/src/main/typescript/impl/util/FileUtils.js.map +0 -1
  219. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js +0 -83
  220. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js.map +0 -1
  221. package/target/src/main/typescript/impl/util/IListener.js +0 -3
  222. package/target/src/main/typescript/impl/util/IListener.js.map +0 -1
  223. package/target/src/main/typescript/impl/util/Lang.js +0 -263
  224. package/target/src/main/typescript/impl/util/Lang.js.map +0 -1
  225. package/target/src/main/typescript/impl/util/XhrQueueController.js +0 -92
  226. package/target/src/main/typescript/impl/util/XhrQueueController.js.map +0 -1
  227. package/target/src/main/typescript/impl/xhrCore/ErrorData.js +0 -87
  228. package/target/src/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
  229. package/target/src/main/typescript/impl/xhrCore/EventData.js +0 -52
  230. package/target/src/main/typescript/impl/xhrCore/EventData.js.map +0 -1
  231. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
  232. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
  233. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -186
  234. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
  235. package/target/src/main/typescript/impl/xhrCore/Response.js +0 -186
  236. package/target/src/main/typescript/impl/xhrCore/Response.js.map +0 -1
  237. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js +0 -104
  238. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  239. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -468
  240. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
  241. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js +0 -163
  242. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
  243. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js +0 -433
  244. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
  245. package/target/src/main/typescript/mona_dish_shim.js +0 -70
  246. package/target/src/main/typescript/mona_dish_shim.js.map +0 -1
  247. package/target/src/main/typescript/myfaces/OamSubmit.js +0 -128
  248. package/target/src/main/typescript/myfaces/OamSubmit.js.map +0 -1
  249. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js +0 -117
  250. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js.map +0 -1
  251. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js +0 -123
  252. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js.map +0 -1
  253. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  254. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  255. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  256. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  257. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  258. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  259. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  260. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  261. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  262. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  263. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -2
  264. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  265. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  266. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  267. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  268. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  269. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  270. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  271. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  272. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  273. package/target/src/main/typescript/test/impl/ImplTest.spec.js +0 -225
  274. package/target/src/main/typescript/test/impl/ImplTest.spec.js.map +0 -1
  275. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js +0 -143
  276. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js.map +0 -1
  277. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js +0 -106
  278. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  279. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  280. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  281. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js +0 -118
  282. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js.map +0 -1
  283. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js +0 -57
  284. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js.map +0 -1
  285. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js +0 -60
  286. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  287. package/target/src/main/typescript/test/queue/AsynchronousProbe.js +0 -93
  288. package/target/src/main/typescript/test/queue/AsynchronousProbe.js.map +0 -1
  289. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js +0 -133
  290. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  291. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js +0 -101
  292. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js.map +0 -1
  293. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js +0 -175
  294. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  295. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js +0 -184
  296. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js.map +0 -1
  297. package/target/src/main/typescript/test/xhrCore/FakeWebsocket.js.map +0 -1
  298. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js +0 -181
  299. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  300. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  301. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  302. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js +0 -199
  303. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  304. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js +0 -567
  305. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  306. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js +0 -845
  307. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js.map +0 -1
  308. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js +0 -382
  309. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  310. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js +0 -667
  311. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js.map +0 -1
  312. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js +0 -367
  313. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  314. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js +0 -123
  315. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  316. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  317. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  318. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js +0 -207
  319. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js.map +0 -1
  320. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  321. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  322. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  323. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  324. package/target/test/api/MyFacesABTest.spec.js +0 -117
  325. package/target/test/api/MyFacesABTest.spec.js.map +0 -1
  326. package/target/test/frameworkBase/LangTest.spec.js +0 -123
  327. package/target/test/frameworkBase/LangTest.spec.js.map +0 -1
  328. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  329. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  330. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  331. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  332. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  333. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  334. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  335. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  336. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  337. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  338. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -1
  339. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  340. package/target/test/frameworkBase/_ext/monadish/fixtures/test.js.map +0 -1
  341. package/target/test/frameworkBase/_ext/monadish/fixtures/test2.js.map +0 -1
  342. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  343. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  344. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  345. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  346. package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  347. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  348. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  349. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  350. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +0 -16
  351. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js.map +0 -1
  352. package/target/test/impl/ImplTest.spec.js +0 -225
  353. package/target/test/impl/ImplTest.spec.js.map +0 -1
  354. package/target/test/impl/ImplTest_23.spec.js +0 -143
  355. package/target/test/impl/ImplTest_23.spec.js.map +0 -1
  356. package/target/test/impl/SeparatorCharsTest.spec.js +0 -106
  357. package/target/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  358. package/target/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  359. package/target/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  360. package/target/test/myfaces/OamSubmit.spec.js +0 -118
  361. package/target/test/myfaces/OamSubmit.spec.js.map +0 -1
  362. package/target/test/myfaces/OnLoad.spec.js +0 -57
  363. package/target/test/myfaces/OnLoad.spec.js.map +0 -1
  364. package/target/test/myfaces/ReserveNamespace.spec.js +0 -60
  365. package/target/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  366. package/target/test/queue/AsynchronousProbe.js +0 -93
  367. package/target/test/queue/AsynchronousProbe.js.map +0 -1
  368. package/target/test/queue/AsynchronousQueueTest.spec.js +0 -133
  369. package/target/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  370. package/target/test/xhrCore/ClientWindow.spec.js +0 -101
  371. package/target/test/xhrCore/ClientWindow.spec.js.map +0 -1
  372. package/target/test/xhrCore/ErrorChainTest.spec.js +0 -175
  373. package/target/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  374. package/target/test/xhrCore/EventTests.spec.js +0 -184
  375. package/target/test/xhrCore/EventTests.spec.js.map +0 -1
  376. package/target/test/xhrCore/FakeWebsocket.js +0 -38
  377. package/target/test/xhrCore/FakeWebsocket.js.map +0 -1
  378. package/target/test/xhrCore/FileUploadTest.spec.js +0 -181
  379. package/target/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  380. package/target/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  381. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  382. package/target/test/xhrCore/OamSubmitTest.spec.js +0 -199
  383. package/target/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  384. package/target/test/xhrCore/RequestParamsTest.spec.js +0 -567
  385. package/target/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  386. package/target/test/xhrCore/RequestTest.spec.js +0 -845
  387. package/target/test/xhrCore/RequestTest.spec.js.map +0 -1
  388. package/target/test/xhrCore/RequestTest_23.spec.js +0 -382
  389. package/target/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  390. package/target/test/xhrCore/ResponseTest.spec.js +0 -667
  391. package/target/test/xhrCore/ResponseTest.spec.js.map +0 -1
  392. package/target/test/xhrCore/ResponseTest23.spec.js +0 -367
  393. package/target/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  394. package/target/test/xhrCore/ShadowDomTest.spec.js +0 -123
  395. package/target/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  396. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  397. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  398. package/target/test/xhrCore/WebsocketTest.js +0 -207
  399. package/target/test/xhrCore/WebsocketTest.js.map +0 -1
  400. package/target/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  401. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  402. package/target/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  403. package/target/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  404. package/target/test/xhrCore/fixtures/addedViewHead1.js +0 -17
  405. package/target/test/xhrCore/fixtures/addedViewHead1.js.map +0 -1
  406. package/target/test/xhrCore/fixtures/addedViewHead2.js +0 -17
  407. package/target/test/xhrCore/fixtures/addedViewHead2.js.map +0 -1
  408. package/target/test/xhrCore/fixtures/addedViewHead3.js +0 -17
  409. package/target/test/xhrCore/fixtures/addedViewHead3.js.map +0 -1
  410. package/target/test/xhrCore/fixtures/nonce_script.js +0 -17
  411. package/target/test/xhrCore/fixtures/nonce_script.js.map +0 -1
  412. package/tsconfig.json +0 -9
  413. package/webpack.config.ts +0 -54
@@ -1 +1 @@
1
- {"version":3,"file":"faces.js","mappings":";sFA4CA,WAkBA,WA6BA,oBAA4BA,EAAoBC,KAAiCC,GAC7E,OAAMF,GAAcE,EAAWC,OAAS,EAC7B,IAAIC,EAAaH,GAErBI,EAAOJ,KAAWC,EAC7B,EASA,oBAA4BF,EAAoBC,KAAiCC,GAC7E,OAAMF,GAAcE,EAAWC,OAAS,EAC7B,IAAIC,EAAaH,GAErBK,EAAOL,KAAWC,EAC7B,EAEA,mBAA2BD,KAAiCC,GACxD,IAAIK,EAAM,KACVL,EAAaM,EAAkBN,GAC/B,IAAIO,EAAUR,EACd,IAAI,IAAIS,EAAM,EAAGA,EAAMR,EAAWC,OAAQO,IAAO,CAC7C,IAAIC,EAAkCT,EAAWQ,GAGjD,GAFAC,GAAgD,GAA/BC,EAAWD,GAAwBC,EAAWD,GAAkBA,EACjFF,EAAUA,aAAO,EAAPA,EAAUE,QACjB,IAAsBF,EACrB,OAAO,KAEXF,EAAME,CACV,CACA,OAAOA,CACX,EAmDA,cA+DA,oBAAyBI,GACrB,OAAOC,KAAKC,MAAMD,KAAKE,UAAUH,GACrC,EAOA,iCAAsCI,GACnC,OAAOC,GAAa,GAAM,KAAUD,EACvC,EAkEA,iBAyBA,qBAAgBE,EAAUC,EAAWC,GACjC,GAAGD,GAAQC,EACP,OAAO,EAEX,UAAUD,UAAeC,EACrB,OAAO,EAEX,GAAGC,MAAMC,QAAQH,IAASE,MAAMC,QAAQF,GAAO,CAC3C,GAAGD,EAAKjB,QAAUkB,EAAKlB,OACnB,OAIJ,OAAOiB,EAAKI,OAAM,CAACC,EAAMf,IAAQ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OAAQ2F,eAAO,eAAEoC,IAAI,CACrB,MAAMpC,EAAU,UAGf3F,OAAwB,QAAmB,QAAf,EAAM,OAANA,aAAM,IAANA,YAAM,EAANA,OAAQ2F,eAAO,QAAI,CAAC,EACjD9iB,OAAOC,KAAK6iB,GAAS1gB,SAAQjC,IAAM,QAAC,OAAAgd,OAAO2F,QAAQ3iB,GAA4B,QAArB,EAAc,QAAd,EAAAgd,OAAO2F,eAAO,eAAG3iB,UAAI,QAAI2iB,EAAQ3iB,EAAI,GACnG,CACW,EAAA0iB,MAAQ1F,OAAO0F,MACf,EAAAC,QAAU3F,OAAO2F,O","sources":["webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/AssocArray.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/Config.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/DomQuery.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/Es2019Array.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/Global.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/Lang.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/Monad.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/XmlQuery.ts","webpack://jsf.js_next_gen/./node_modules/mona-dish/src/main/typescript/index_core.ts","webpack://jsf.js_next_gen/./src/main/typescript/api/_api.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/AjaxImpl.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/PushImpl.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/core/Const.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/core/ImplTypes.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/i18n/Messages.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/Assertions.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/AsyncRunnable.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/ExtDomQuery.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/FileUtils.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/HiddenInputBuilder.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/Lang.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/util/XhrQueueController.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/ErrorData.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/EventData.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/RequestDataResolver.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/Response.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/ResponseDataResolver.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/ResponseProcessor.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/XhrFormData.ts","webpack://jsf.js_next_gen/./src/main/typescript/impl/xhrCore/XhrRequest.ts","webpack://jsf.js_next_gen/./src/main/typescript/myfaces/OamSubmit.ts","webpack://jsf.js_next_gen/webpack/bootstrap","webpack://jsf.js_next_gen/webpack/runtime/global","webpack://jsf.js_next_gen/./src/main/typescript/api/faces.ts"],"sourcesContent":["/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * various helpers to deal with associative\n * arrays. If someone feels uncomfortable using\n * The config system, this is similar!\n */\nimport {IValueHolder} from \"./Monad\";\nimport {Es2019Array} from \"./Es2019Array\";\n\n/**\n * A nop as assign functionality (aka ignore assign)\n */\nclass IgnoreAssign implements IValueHolder<any> {\n constructor(private parent: any) {}\n\n set value(value: any | Array<any>) {\n }\n get value(): any | Array<any> {\n return this.parent;\n }\n};\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function assign<T>(target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if (accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n const lastPathItem = buildPath(target, ...accessPath);\n let assigner: IValueHolder<T> = new (class {\n set value(value: T | Array<T>) {\n lastPathItem.target[lastPathItem.key] = value;\n }\n\n get value(): T | Array<T> {\n return lastPathItem.target[lastPathItem.key];\n }\n })();\n return assigner;\n}\n\n\nexport function append<T>(target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if (accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n const lastPathItem = buildPath(target, ...accessPath);\n let appender: IValueHolder<T> = new (class {\n set value(value: T | Array<T>) {\n if(!Array.isArray(value)) {\n value = [value];\n }\n if(!lastPathItem.target[lastPathItem.key]) {\n lastPathItem.target[lastPathItem.key] = value\n } else {\n if(!Array.isArray(lastPathItem.target[lastPathItem.key])) {\n lastPathItem.target[lastPathItem.key] = [lastPathItem.target[lastPathItem.key]];\n }\n lastPathItem.target[lastPathItem.key].push(...value);\n }\n }\n })();\n return appender;\n}\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function assignIf<T>(condition: boolean, target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if ((!condition) || accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n return assign(target, ...accessPath);\n}\n\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function appendIf<T>(condition: boolean, target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if ((!condition) || accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n return append(target, ...accessPath);\n}\n\nexport function resolve<T>(target: {[key: string]: any}, ...accessPath: string[]): T | null {\n let ret = null;\n accessPath = flattenAccessPath(accessPath);\n let currPtr = target;\n for(let cnt = 0; cnt < accessPath.length; cnt++) {\n let accessKeyIndex: number | string = accessPath[cnt];\n accessKeyIndex = arrayIndex(accessKeyIndex) != -1 ? arrayIndex(accessKeyIndex) : accessKeyIndex;\n currPtr = currPtr?.[accessKeyIndex];\n if('undefined' == typeof currPtr) {\n return null;\n }\n ret = currPtr;\n }\n return currPtr as T;\n}\n\n\nfunction keyVal(key: string): string {\n let start = key.indexOf(\"[\");\n\n if (start >= 0) {\n return key.substring(0, start);\n } else {\n return key;\n }\n}\n\nfunction arrayIndex(key: string): number {\n let start = key.indexOf(\"[\");\n let end = key.indexOf(\"]\");\n if (start >= 0 && end > 0 && start < end) {\n return parseInt(key.substring(start + 1, end));\n } else {\n return -1;\n }\n}\n\nfunction isArrayPos(currKey: string, arrPos: number): boolean {\n return currKey === \"\" && arrPos >= 0;\n}\n\nfunction isNoArray(arrPos: number): boolean {\n return arrPos == -1;\n}\n\nfunction alloc(arr: Array<any>, length: number, defaultVal = {}) {\n let toAdd = [];\n toAdd.length = length;\n toAdd[length - 1] = defaultVal;\n arr.push(...toAdd);\n}\n\n\nfunction flattenAccessPath(accessPath: string[]) {\n return new Es2019Array(...accessPath).flatMap((path: string) => path.split(\"[\"))\n .map((path: string) => path.indexOf(\"]\") != -1 ? \"[\" + path : path)\n .filter((path: string) => path != \"\");\n}\n\n/**\n * builds up a path, only done if no data is present!\n * @param target\n * @param accessPath\n * @returns the last assignable entry\n */\nexport function buildPath(target: {[key: string]: any}, ...accessPath: string[]): {target: any, key: string | number} {\n accessPath = flattenAccessPath(accessPath);\n //we now have a pattern of having the array accessors always in separate items\n let parentPtr: any = target;\n let parKeyArrPos: string | number | null = null;\n let currKey: string | null = null;\n let arrPos = -1;\n\n for (let cnt = 0; cnt < accessPath.length; cnt++) {\n currKey = keyVal(accessPath[cnt]);\n arrPos = arrayIndex(accessPath[cnt]);\n //it now is either key or arrPos\n if (arrPos != -1) {\n //case root(array)[5] -> root must be array and allocate 5 elements\n //case root.item[5] root.item must be array and of 5 elements\n if(!Array.isArray(parentPtr)) {\n throw Error(\"Associative array referenced as index array in path reference\");\n }\n\n //we need to look ahead for proper allocation\n //not end reached\n let nextArrPos = -1;\n if(cnt < accessPath.length - 1) {\n nextArrPos = arrayIndex(accessPath[cnt + 1])\n }\n let dataPresent = 'undefined' != typeof parentPtr?.[arrPos];\n //no data present check here is needed, because alloc only reserves if not present\n alloc(parentPtr, arrPos + 1, nextArrPos != -1 ?[]: {});\n parKeyArrPos = arrPos;\n //we now go to the reserved element\n if(cnt == accessPath.length - 1) {\n parentPtr[arrPos] = (dataPresent) ? parentPtr[arrPos] : null;\n } else {\n parentPtr = parentPtr[arrPos];\n }\n } else {\n if(Array.isArray(parentPtr)) {\n throw Error(\"Index array referenced as associative array in path reference\");\n }\n //again look ahead whether the next value is an array or assoc array\n let nextArrPos = -1;\n if(cnt < accessPath.length - 1) {\n nextArrPos = arrayIndex(accessPath[cnt + 1])\n }\n parKeyArrPos = currKey;\n let dataPresent = 'undefined' != typeof parentPtr?.[currKey];\n if(cnt == accessPath.length - 1) {\n if(!dataPresent) {\n parentPtr[currKey] = null;\n }\n } else {\n if(!dataPresent) {\n parentPtr[currKey] = nextArrPos == -1 ? {} : [];\n }\n parentPtr = parentPtr[currKey];\n }\n }\n }\n\n return {target: parentPtr, key: parKeyArrPos as string | number};\n\n}\n\nexport function deepCopy(fromAssoc: {[key: string]: any}): {[key: string]: any} {\n return JSON.parse(JSON.stringify(fromAssoc));\n}\n\n/**\n * simple left to right merge\n *\n * @param assocArrays\n */\nexport function simpleShallowMerge(...assocArrays: {[key: string]: any}[]) {\n return shallowMerge(true, false, ...assocArrays);\n}\n\nfunction _appendWithOverwrite(withAppend: boolean, target: { [p: string]: any }, key: string, arr: {[key: string]: any}, toAssign: any) {\n if (!withAppend) {\n target[key] = arr[key];\n } else {\n //overwrite means in this case, no double entries!\n //we do not a deep compare for now a single value compare suffices\n if ('undefined' == typeof target?.[key]) {\n target[key] = toAssign\n } else if (!Array.isArray(target[key])) {\n\n let oldVal = target[key];\n let newVals: any[] = [];\n //TODO maybe deep deep compare here, but on the other hand it is\n //shallow\n toAssign.forEach((item: any) => {\n if (oldVal != item) {\n newVals.push(item);\n }\n });\n target[key] = new Es2019Array(...[]);\n target[key].push(oldVal);\n target[key].push(...newVals);\n } else {\n let oldVal = target[key];\n let newVals: any[] = [];\n //TODO deep compare here\n toAssign.forEach((item: any) => {\n if (oldVal.indexOf(item) == -1) {\n newVals.push(item);\n }\n });\n\n target[key].push(...newVals);\n }\n }\n}\n\nfunction _appendWithoutOverwrite(withAppend: boolean, target: { [p: string]: any }, key: string, arr: {[key: string]: any}, toAssign: any) {\n if (!withAppend) {\n return;\n } else {\n //overwrite means in this case, no double entries!\n //we do not a deep compare for now a single value compare suffices\n if ('undefined' == typeof target?.[key]) {\n target[key] = toAssign\n } else if (!Array.isArray(target[key])) {\n let oldVal = target[key];\n target[key] = new Es2019Array(...[]);\n target[key].push(oldVal);\n target[key].push(...toAssign);\n } else {\n target[key].push(...toAssign);\n }\n }\n}\n\n/**\n * Shallow merge as in config, but on raw associative arrays\n *\n * @param overwrite overwrite existing keys, if they exist with their subtrees\n * @param withAppend if a key exist append the values or drop them\n * Combination overwrite withappend filters doubles out of merged arrays\n * @param assocArrays array of assoc arres reduced right to left\n */\nexport function shallowMerge(overwrite = true, withAppend = false, ...assocArrays: {[key: string]: any}[]) {\n let target: {[key: string]: any} = {};\n new Es2019Array(...assocArrays).map((arr: {[key: string]: any}) => {\n return {arr, keys: Object.keys(arr)};\n }).forEach(({arr, keys}: {arr: {[key: string]: any}, keys: string[]}) => {\n keys.forEach((key: string) => {\n let toAssign = arr[key];\n if(!Array.isArray(toAssign) && withAppend) {\n toAssign = new Es2019Array(...[toAssign]);\n }\n if(overwrite || !target?.[key]) {\n _appendWithOverwrite(withAppend, target, key, arr, toAssign);\n } else if(!overwrite && target?.[key]) {\n _appendWithoutOverwrite(withAppend, target, key, arr, toAssign);\n }\n\n\n\n })\n });\n return target;\n}\n\n//TODO test this, slightly altered from https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934\n//he overlooked some optimizations and a shortcut at typeof!\nexport function deepEqual(obj1: any, obj2: any): boolean | void {\n if(obj1 == obj2) {\n return false;\n }\n if(typeof obj1 != typeof obj2) {\n return false;\n }\n if(Array.isArray(obj1) && Array.isArray(obj2)) {\n if(obj1.length != obj2.length) {\n return;\n }\n //arrays must be equal, order as well, there is no way around it\n //this is the major limitation we have\n return obj1.every((item, cnt) => deepEqual(item, obj2[cnt]));\n }\n //string number and other primitives are filtered out here\n if(\"object\" == typeof obj1 && \"object\" == typeof obj2) {\n let keys1 = Object.keys(obj1);\n let keys2 = Object.keys(obj2);\n if(keys1.length != keys2.length) {\n return false;\n }\n return keys1.every(key => keys2.indexOf(key) != -1) &&\n keys1.every(key => deepEqual(obj1[key], obj2[key]));\n }\n return false;\n //done here no match found\n}\n\n","import {Es2019Array} from \"./Es2019Array\";\nimport {IValueHolder, Optional, ValueEmbedder} from \"./Monad\";\nimport {Lang} from \"./Lang\";\nconst objAssign = Lang.objAssign;\nimport {append, appendIf, assign, assignIf, resolve, shallowMerge} from \"./AssocArray\";\n\n/**\n * specialized value embedder\n * for our Configuration\n */\nclass ConfigEntry<T> extends ValueEmbedder<T> {\n\n /*default value for absent*/\n static absent = ConfigEntry.fromNullable(null);\n\n /**\n * arrayed value positions\n */\n arrPos: number;\n\n constructor(rootElem: any, key: any, arrPos?: number) {\n super(rootElem, key);\n\n this.arrPos = arrPos ?? -1;\n }\n\n get value() {\n if (this.key == \"\" && this.arrPos >= 0) {\n return this._value[this.arrPos];\n } else if (this.key && this.arrPos >= 0) {\n return this._value[this.key][this.arrPos];\n }\n return this._value[this.key];\n }\n\n set value(val: T) {\n if (this.key == \"\" && this.arrPos >= 0) {\n this._value[this.arrPos] = val;\n return;\n } else if (this.key && this.arrPos >= 0) {\n this._value[this.key][this.arrPos] = val;\n return;\n }\n this._value[this.key] = val;\n }\n}\n\nexport const CONFIG_VALUE = \"__END_POINT__\";\nexport const CONFIG_ANY = \"__ANY_POINT__\";\nexport type ConfigDef = { [key: string]: any };\n\n/**\n * Config, basically an optional wrapper for a json structure\n * (not Side - effect free, since we can alter the internal config state\n * without generating a new config), not sure if we should make it side - effect free\n * since this would swallow a lot of performance and ram\n */\nexport class Config extends Optional<any> {\n constructor(root: any, private configDef ?: ConfigDef) {\n super(root);\n }\n\n /**\n * shallow copy getter, copies only the first level, references the deeper nodes\n * in a shared manner\n */\n get shallowCopy(): Config {\n return this.shallowCopy$();\n }\n\n protected shallowCopy$(): Config {\n let ret = new Config({});\n ret.shallowMerge(this.value);\n return ret;\n }\n\n /**\n * deep copy, copies all config nodes\n */\n get deepCopy(): Config {\n return this.deepCopy$();\n }\n\n protected deepCopy$(): Config {\n return new Config(objAssign({}, this.value));\n }\n\n /**\n * creates a config from an initial value or null\n * @param value\n */\n static fromNullable<T>(value?: T | null): Config {\n return new Config(value);\n }\n\n /**\n * simple merge for the root configs\n */\n shallowMerge(other: Config, overwrite = true, withAppend = false) {\n //shallow merge must be mutable so we have to remap\n let newThis = shallowMerge(overwrite, withAppend, this.value, other.value);\n if (Array.isArray(this._value)) {\n this._value.length = 0;\n this._value.push(...(newThis as any));\n } else {\n Object.getOwnPropertyNames(this._value).forEach(key => delete this._value[key]);\n Object.getOwnPropertyNames(newThis).forEach(key => this._value[key] = newThis[key]);\n }\n }\n\n /**\n * assigns a single value as array, or appends it\n * to an existing value mapping a single value to array\n *\n *\n * usage myConfig.append(\"foobaz\").value = \"newValue\"\n * myConfig.append(\"foobaz\").value = \"newValue2\"\n *\n * resulting in myConfig.foobaz == [\"newValue, newValue2\"]\n *\n * @param {string[]} accessPath\n */\n append(...accessPath: string[]): IValueHolder<any> {\n return append(this._value, ...accessPath);\n }\n\n /**\n * appends to an existing entry (or extends into an array and appends)\n * if the condition is met\n * @param {boolean} condition\n * @param {string[]} accessPath\n */\n appendIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {\n return appendIf(condition, this._value, ...accessPath);\n }\n\n /**\n * assigns a new value on the given access path\n * @param accessPath\n */\n assign(...accessPath): IValueHolder<any> {\n return assign(this.value, ...accessPath);\n }\n\n\n /**\n * assign a value if the condition is set to true, otherwise skip it\n *\n * @param condition the condition, the access accessPath into the config\n * @param accessPath\n */\n assignIf(condition: boolean, ...accessPath: Array<any>): IValueHolder<any> {\n return assignIf(condition, this._value, ...accessPath);\n }\n\n /**\n * get if the access path is present (get is reserved as getter with a default, on the current path)\n * TODO will be renamed to something more meaningful and deprecated, the name is ambiguous\n * @param accessPath the access path\n */\n getIf(...accessPath: Array<string>): Config {\n this.assertAccessPath(...accessPath);\n return this.getClass().fromNullable(resolve(this.value, ...accessPath));\n }\n\n\n /**\n * gets the current node and if none is present returns a config with a default value\n * @param defaultVal\n */\n get(defaultVal: any): Config {\n return this.getClass().fromNullable(super.get(defaultVal).value);\n }\n\n //empties the current config entry\n delete(key: string): Config {\n if (key in this.value) {\n delete this.value[key];\n }\n return this;\n }\n\n /**\n * converts the entire config into a json object\n */\n toJson(): any {\n return JSON.stringify(this.value);\n }\n\n\n protected getClass(): any {\n return Config;\n }\n\n private setVal(val: any) {\n this._value = val;\n }\n\n\n /**\n * asserts the access path for a semi typed access\n * @param accessPath\n * @private\n */\n private assertAccessPath(...accessPath: Array<string>) {\n accessPath = this.preprocessKeys(...accessPath);\n if (!this.configDef) {\n //untyped\n return;\n }\n\n const ERR_ACCESS_PATH = \"Access Path to config invalid\";\n let currAccessPos: any = Optional.fromNullable(Object.keys(this.configDef).map(key => {\n let ret = {};\n ret[key] = this.configDef[key];\n return ret;\n }));\n\n for (let cnt = 0; cnt < accessPath.length; cnt++) {\n let currKey = this.keyVal(accessPath[cnt]);\n let arrPos: any = this.arrayIndex(accessPath[cnt]);\n\n //key index\n if (this.isArray(arrPos)) {\n if (currKey != \"\") {\n currAccessPos = Array.isArray(currAccessPos.value) ?\n Optional.fromNullable(new Es2019Array(...currAccessPos.value)\n .find(item => {\n return !!(item?.[currKey] ?? false)\n })?.[currKey]?.[arrPos]) :\n Optional.fromNullable(currAccessPos.value?.[currKey]?.[arrPos] ?? null);\n\n } else {\n currAccessPos = (Array.isArray(currAccessPos.value)) ?\n Optional.fromNullable(currAccessPos.value?.[arrPos]) : Optional.absent;\n }\n //we noe store either the current array or the filtered look ahead to go further\n } else {\n //we now have an array and go further with a singular key\n currAccessPos = (Array.isArray(currAccessPos.value)) ? Optional.fromNullable(new Es2019Array(...currAccessPos.value)\n .find(item => {\n return !!(item?.[currKey] ?? false);\n })?.[currKey]) :\n Optional.fromNullable(currAccessPos.value?.[currKey] ?? null);\n }\n if (!currAccessPos.isPresent()) {\n throw Error(ERR_ACCESS_PATH)\n }\n if (currAccessPos.value == CONFIG_ANY) {\n return;\n }\n }\n }\n\n private isNoArray(arrPos: number) {\n return arrPos == -1;\n }\n\n private isArray(arrPos: number) {\n return !this.isNoArray(arrPos);\n }\n\n}","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http:// www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {IValueHolder, Optional, ValueEmbedder} from \"./Monad\";\nimport {XMLQuery} from \"./XmlQuery\";\n\nimport {ICollector, IStreamDataSource, ITERATION_STATUS} from \"./SourcesCollectors\";\nimport {Lang} from \"./Lang\";\nimport {_global$} from \"./Global\";\nimport {Es2019Array} from \"./Es2019Array\";\nconst trim = Lang.trim;\n\nconst isString = Lang.isString;\nconst eqi = Lang.equalsIgnoreCase;\nconst objToArray = Lang.objToArray;\nimport {append, assign, simpleShallowMerge} from \"./AssocArray\";\nimport {IDomQuery} from \"./IDomQuery\";\n\ndeclare var ownerDocument: any;\n\n/**\n * in order to poss custom parameters we need to extend the mutation observer init\n */\nexport interface WAIT_OPTS extends MutationObserverInit {\n timeout?: number;\n /**\n * interval on non legacy browsers\n */\n interval?: number;\n}\n\n\nclass NonceValueEmbedder extends ValueEmbedder<string> {\n\n constructor(private rootElems: HTMLElement[]) {\n super(rootElems?.[0], \"nonce\");\n }\n\n isAbsent(): boolean {\n const value = this.value;\n return 'undefined' == typeof value || '' == value;\n }\n\n get value(): string {\n return (this?.rootElems?.[0] as HTMLElement)?.nonce ?? (this?.rootElems?.[0] as HTMLElement)?.getAttribute(\"nonce\")\n }\n\n\n set value(newVal: string) {\n if (!this?.rootElems?.length) {\n return;\n }\n\n this.rootElems.forEach((rootElem: HTMLElement) => {\n if(\"undefined\" != typeof rootElem?.nonce) {\n rootElem.nonce = newVal\n } else {\n rootElem.setAttribute(\"nonce\", newVal);\n }\n });\n\n }\n}\n\n/**\n *\n * // - submit checkboxes and radio inputs only if checked\n if ((tagName != \"select\" && elemType != \"button\"\n && elemType != \"reset\" && elemType != \"submit\" && elemType != \"image\")\n && ((elemType != \"checkbox\" && elemType != \"radio\"\n */\n\nenum ALLOWED_SUBMITTABLE_ELEMENTS {\n SELECT = \"select\",\n BUTTON = \"button\",\n SUBMIT = \"submit\",\n RESET = \"reset\",\n IMAGE = \"image\",\n RADIO = \"radio\",\n CHECKBOX = \"checkbox\"\n\n}\n\n/**\n * helper to fix a common problem that a system has to wait, until a certain condition is reached.\n * Depending on the browser this uses either the Mutation Observer or a semi compatible interval as fallback.\n * @param root the root DomQuery element to start from\n * @param condition the condition lambda to be fulfilled\n * @param options options for the search\n */\nfunction waitUntilDom(root: DomQuery, condition: (element: DomQuery) => boolean, options: WAIT_OPTS = {\n attributes: true,\n childList: true,\n subtree: true,\n timeout: 500,\n interval: 100\n}): Promise<DomQuery> {\n return new Promise<DomQuery>((success, error) => {\n let observer: MutationObserver = null;\n const MUT_ERROR = new Error(\"Mutation observer timeout\");\n\n // we do the same but for now ignore the options on the dom query\n // we cannot use absent here, because the condition might search for an absent element\n function findElement(root: DomQuery, condition: (element: DomQuery) => boolean): DomQuery | null {\n let found = null;\n if (!!condition(root)) {\n return root;\n }\n if (options.childList) {\n found = (condition(root)) ? root : root.childNodes.filter(item => condition(item)).first().value.value;\n } else if (options.subtree) {\n found = (condition(root)) ? root : root.querySelectorAll(\" * \").filter(item => condition(item)).first().value.value;\n } else {\n found = (condition(root)) ? root : null;\n }\n return found;\n }\n\n let foundElement = root;\n if (!!(foundElement = findElement(foundElement, condition))) {\n success(new DomQuery(foundElement));\n return;\n }\n\n if ('undefined' != typeof MutationObserver) {\n const mutTimeout = setTimeout(() => {\n observer.disconnect();\n return error(MUT_ERROR);\n }, options.timeout);\n\n const callback: MutationCallback = (mutationList: MutationRecord[]) => {\n const found = new DomQuery(mutationList.map((mut) => mut.target)).filter(item => condition(item)).first();\n if (found.isPresent()) {\n clearTimeout(mutTimeout);\n observer.disconnect();\n success(new DomQuery(found || root));\n }\n }\n observer = new MutationObserver(callback);\n\n // browsers might ignore it, but we cannot break the api in the case\n // hence no timeout is passed\n let observableOpts = {...options};\n delete observableOpts.timeout;\n root.eachElem(item => {\n observer.observe(item, observableOpts)\n })\n } else { // fallback for legacy browsers without mutation observer\n\n let interval = setInterval(() => {\n let found = findElement(root, condition);\n if (!!found) {\n if (timeout) {\n clearTimeout(timeout);\n clearInterval(interval);\n interval = null;\n }\n success(new DomQuery(found || root));\n }\n }, options.interval);\n let timeout = setTimeout(() => {\n if (interval) {\n clearInterval(interval);\n error(MUT_ERROR);\n }\n }, options.timeout)\n\n }\n });\n}\n\nexport class ElementAttribute extends ValueEmbedder<string> {\n\n constructor(private element: DomQuery, private name: string, private defaultVal: string = null) {\n super(element, name);\n }\n\n get value(): string {\n let val: Element[] = this.element.get(0).orElse(...[]).values;\n if (!val.length) {\n return this.defaultVal;\n }\n return val[0].getAttribute(this.name);\n }\n\n set value(value: string) {\n let val: Element[] = this.element.get(0).orElse(...[]).values;\n for (let cnt = 0; cnt < val.length; cnt++) {\n val[cnt].setAttribute(this.name, value);\n }\n val[0].setAttribute(this.name, value);\n }\n\n protected getClass(): any {\n return ElementAttribute;\n }\n\n static fromNullable<ElementAttribute, T>(value?: any, valueKey: string = \"value\"): ElementAttribute {\n return <any>new ElementAttribute(value, valueKey);\n }\n\n}\n\nexport class Style extends ValueEmbedder<string> {\n\n constructor(private element: DomQuery, private name: string, private defaultVal: string = null) {\n super(element, name);\n }\n\n get value(): string {\n let val: Element[] = this.element.values;\n if (!val.length) {\n return this.defaultVal;\n }\n return (val[0] as HTMLElement).style[this.name];\n }\n\n set value(value: string) {\n let val: HTMLElement[] = this.element.values as HTMLElement[];\n for (let cnt = 0; cnt < val.length; cnt++) {\n val[cnt].style[this.name] = value;\n }\n }\n\n protected getClass(): any {\n return ElementAttribute;\n }\n\n static fromNullable<ElementAttribute, T>(value?: any, valueKey: string = \"value\"): ElementAttribute {\n return <any>new ElementAttribute(value, valueKey);\n }\n\n}\n\n/**\n * small helper for the specialized jsf case\n * @constructor\n */\nconst DEFAULT_WHITELIST = () => {\n return true;\n};\n\n\n\n/**\n * Monadic DomNode representation, ala jquery\n * This is a thin wrapper over querySelectorAll\n * to get slim monadic support\n * to reduce implementation code on the users side.\n * This is vital for frameworks which want to rely on\n * plain dom but still do not want to lose\n * the reduced code footprint of querying dom trees and traversing\n * by using functional patterns.\n *\n * Also, a few convenience methods are added to reduce\n * the code footprint of standard dom processing\n * operations like eval\n *\n * in most older systems\n * Note parts of this code still stem from the Dom.js I have written 10 years\n * ago, those parts look a bit ancient and will be replaced over time.\n *\n */\nexport class DomQuery implements IDomQuery, IStreamDataSource<DomQuery>, Iterable<DomQuery> {\n\n static absent = new DomQuery();\n\n /**\n * reference to the environmental global object\n */\n static global = _global$;\n\n private rootNode: Array<Element> = [];\n\n pos = -1;\n\n constructor(...rootNode: Array<Element | ShadowRoot | DomQuery | Document | Array<any> | string>) {\n\n if (Optional.fromNullable(rootNode).isAbsent() || !rootNode.length) {\n return;\n } else {\n // we need to flatten out the arrays\n\n for (let cnt = 0; cnt < rootNode.length; cnt++) {\n if (!rootNode[cnt]) {\n // we skip possible null entries which can happen in\n // certain corner conditions due to the constructor re-wrapping single elements into arrays.\n } else if (isString(rootNode[cnt])) {\n let foundElement = DomQuery.querySelectorAll(<string>rootNode[cnt]);\n if (!foundElement.isAbsent()) {\n rootNode.push(...foundElement.values)\n }\n } else if (rootNode[cnt] instanceof DomQuery) {\n this.rootNode.push(...(rootNode[cnt] as any).values);\n } else {\n this.rootNode.push(rootNode[cnt] as any);\n }\n }\n }\n }\n\n\n /**\n * returns the first element\n */\n get value(): Optional<Element> {\n return this.getAsElem(0);\n }\n\n get values(): Element[] {\n return this.allElems();\n }\n\n get global(): any {\n return _global$;\n }\n\n get stream(): any {\n throw Error(\"Not implemented, include Stream.ts for this to work\")\n }\n\n get lazyStream(): any {\n throw Error(\"Not implemented, include Stream.ts for this to work\")\n }\n\n /**\n * returns the id of the first element\n */\n get id(): ValueEmbedder<string> {\n return new ElementAttribute(this.get(0), \"id\");\n }\n\n /**\n * length of the entire query set\n */\n get length(): number {\n return this.rootNode.length\n }\n\n /**\n * convenience method for tagName\n */\n get tagName(): Optional<string> {\n return <Optional<string>>this.getAsElem(0).getIf(\"tagName\");\n }\n\n /**\n * convenience method for nodeName\n */\n get nodeName(): Optional<string> {\n return <Optional<string>>this.getAsElem(0).getIf(\"nodeName\");\n }\n\n isTag(tagName: string): boolean {\n return !this.isAbsent()\n && (this.nodeName.orElse(\"__none___\")\n .value.toLowerCase() == tagName.toLowerCase()\n || this.tagName.orElse(\"__none___\")\n .value.toLowerCase() == tagName.toLowerCase()\n )\n }\n\n /**\n * convenience property for type\n *\n * returns null in case of no type existing otherwise\n * the type of the first element\n */\n get type(): Optional<string> {\n return this.getAsElem(0).getIf(\"type\");\n }\n\n /**\n * convenience property for name\n *\n * returns null in case of no type existing otherwise\n * the name of the first element\n */\n get name(): ValueEmbedder<string> {\n return new ValueEmbedder(this.getAsElem(0).value, \"name\");\n }\n\n /**\n * convenience property for value\n *\n * returns null in case of no type existing otherwise\n * the value of the first element\n */\n get inputValue(): ValueEmbedder<string | boolean> {\n if (this.getAsElem(0).getIf(\"value\").isPresent()) {\n return new ValueEmbedder<string>(this.getAsElem(0).value);\n } else {\n return <any>ValueEmbedder.absent;\n }\n }\n\n get val(): string | boolean {\n return this.inputValue.value;\n }\n\n set val(value: string | boolean) {\n this.inputValue.value = value;\n }\n\n get nodeId(): string {\n return this.id.value;\n }\n\n set nodeId(value: string) {\n this.id.value = value;\n }\n\n get checked(): boolean {\n return new Es2019Array(...this.values).every(el => !!(el).checked as any);\n }\n\n set checked(newChecked: boolean) {\n this.eachElem(el => (el as any).checked = newChecked);\n }\n\n get elements(): DomQuery {\n // a simple querySelectorAll should suffice\n return this.querySelectorAll(\"input, checkbox, select, textarea, fieldset\");\n }\n\n get deepElements(): DomQuery {\n let elemStr = \"input, select, textarea, checkbox, fieldset\";\n return this.querySelectorAllDeep(elemStr);\n }\n\n /**\n * a deep search which treats the single isolated shadow dom areas\n * separately and runs the query on each shadow dom\n * @param queryStr\n */\n querySelectorAllDeep(queryStr: string): DomQuery {\n let found: Array<DomQuery> = [];\n let queryRes = this.querySelectorAll(queryStr);\n if (queryRes.length) {\n found.push(queryRes);\n }\n let shadowRoots = this.querySelectorAll(\"*\").shadowRoot;\n if (shadowRoots.length) {\n let shadowRes = shadowRoots.querySelectorAllDeep(queryStr);\n if (shadowRes.length) {\n found.push(shadowRes);\n }\n }\n return new DomQuery(...found);\n }\n\n\n /**\n * disabled flag\n */\n get disabled(): boolean {\n return this.attr(\"disabled\").isPresent();\n }\n\n set disabled(disabled: boolean) {\n // this.attr(\"disabled\").value = disabled + \"\";\n if (!disabled) {\n this.removeAttribute(\"disabled\");\n } else {\n this.attr(\"disabled\").value = \"disabled\";\n }\n\n }\n\n removeAttribute(name: string) {\n this.eachElem(item => item.removeAttribute(name));\n }\n\n get childNodes(): DomQuery {\n let childNodeArr: Array<Element> = [];\n this.eachElem((item: Element) => {\n childNodeArr = childNodeArr.concat(objToArray(item.childNodes));\n });\n return new DomQuery(...childNodeArr);\n }\n\n\n get asArray(): DomQuery[] {\n // filter not supported by IE11\n let items = new Es2019Array(...this.rootNode).filter(item => {\n return item != null\n }).map(item => {\n return DomQuery.byId(item)\n });\n return items as DomQuery[];\n }\n\n get offsetWidth(): number {\n return new Es2019Array(...this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetWidth)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetHeight(): number {\n return new Es2019Array(...this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetHeight)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetLeft(): number {\n return new Es2019Array(...this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetLeft)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetTop(): number {\n return new Es2019Array(this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as any).offsetTop)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get asNodeArray(): Array<Element> {\n return new Es2019Array(...this.rootNode.filter(item => item != null));\n }\n\n get nonce(): ValueEmbedder<string> {\n return new NonceValueEmbedder(this.rootNode as HTMLElement[]);\n }\n\n static querySelectorAllDeep(selector: string) {\n return new DomQuery(document).querySelectorAllDeep(selector);\n }\n\n /**\n * easy query selector all producer\n *\n * @param selector the selector\n * @returns a results dom query object\n */\n static querySelectorAll(selector: string): DomQuery {\n if (selector.indexOf(\"/shadow/\") != -1) {\n return new DomQuery(document)._querySelectorAllDeep(selector);\n } else {\n return new DomQuery(document)._querySelectorAll(selector);\n }\n }\n\n /**\n * byId producer\n *\n * @param selector id\n * @param deep true if you want to go into shadow areas\n * @return a DomQuery containing the found elements\n */\n static byId(selector: string | DomQuery | Element, deep = false): DomQuery {\n if (isString(selector)) {\n return (!deep) ? new DomQuery(document).byId(<string>selector) : new DomQuery(document).byIdDeep(<string>selector);\n } else {\n return new DomQuery(selector as any);\n }\n }\n\n /**\n * byTagName producer\n *\n * @param selector name\n * @return a DomQuery containing the found elements\n */\n static byTagName(selector: string | DomQuery | Element): DomQuery {\n if (isString(selector)) {\n return new DomQuery(document).byTagName(<string>selector);\n } else {\n return new DomQuery(selector as any);\n }\n }\n\n static globalEval(code: string, nonce?: string): DomQuery {\n return new DomQuery(document).globalEval(code, nonce);\n }\n\n static globalEvalSticky(code: string, nonce?: string): DomQuery {\n return new DomQuery(document).globalEvalSticky(code, nonce);\n }\n\n /**\n * builds the ie nodes properly in a placeholder\n * and bypasses a non script insert bug that way\n * @param markup the markup code to be executed from\n */\n static fromMarkup(markup: string): DomQuery {\n\n // https:// developer.mozilla.org/de/docs/Web/API/DOMParser license creative commons\n const doc = document.implementation.createHTMLDocument(\"\");\n markup = trim(markup);\n let lowerMarkup = markup.toLowerCase();\n if (lowerMarkup.search(/<!doctype[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<html[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<head[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<body[^\\w\\-]+/gi) != -1) {\n doc.documentElement.innerHTML = markup;\n return new DomQuery(doc.documentElement);\n } else {\n let startsWithTag = function (str: string, tagName: string) {\n let tag1 = [\"<\", tagName, \">\"].join(\"\");\n let tag2 = [\"<\", tagName, \" \"].join(\"\");\n return (str.indexOf(tag1) == 0) || (str.indexOf(tag2) == 0);\n };\n\n let dummyPlaceHolder = new DomQuery(document.createElement(\"div\"));\n\n // table needs special treatment due to the browsers auto creation\n if (startsWithTag(lowerMarkup, \"thead\") || startsWithTag(lowerMarkup, \"tbody\")) {\n dummyPlaceHolder.html(`<table>${markup}</table>`);\n return dummyPlaceHolder.querySelectorAll(\"table\").get(0).childNodes.detach();\n } else if (startsWithTag(lowerMarkup, \"tfoot\")) {\n dummyPlaceHolder.html(`<table><thead></thead><tbody><tbody${markup}</table>`);\n return dummyPlaceHolder.querySelectorAll(\"table\").get(2).childNodes.detach();\n } else if (startsWithTag(lowerMarkup, \"tr\")) {\n dummyPlaceHolder.html(`<table><tbody>${markup}</tbody></table>`);\n return dummyPlaceHolder.querySelectorAll(\"tbody\").get(0).childNodes.detach();\n } else if (startsWithTag(lowerMarkup, \"td\")) {\n dummyPlaceHolder.html(`<table><tbody><tr>${markup}</tr></tbody></table>`);\n return dummyPlaceHolder.querySelectorAll(\"tr\").get(0).childNodes.detach();\n }\n\n dummyPlaceHolder.html(markup);\n return dummyPlaceHolder.childNodes.detach();\n }\n\n }\n\n /**\n * returns the nth element as DomQuery\n * from the internal elements\n * note if you try to reach a non-existing element position\n * you will get back an absent entry\n *\n * @param index the nth index\n */\n get(index: number): DomQuery {\n return (index < this.rootNode.length) ? new DomQuery(this.rootNode[index]) : DomQuery.absent;\n }\n\n\n /**\n * returns the nth element as optional of an Element object\n * @param index the number from the index\n * @param defaults the default value if the index is overrun default Optional\\.absent\n */\n getAsElem(index: number, defaults: Optional<any> = Optional.absent): Optional<Element> {\n return (index < this.rootNode.length) ? Optional.fromNullable(this.rootNode[index]) : defaults;\n }\n\n /**\n * returns the files from a given element\n * @param index\n */\n filesFromElem(index: number): Array<any> {\n return (index < this.rootNode.length) ? (this.rootNode[index] as any)?.files ? (this.rootNode[index] as any).files : [] : [];\n }\n\n /**\n * returns the value array< of all elements\n */\n allElems(): Array<Element> {\n return this.rootNode;\n }\n\n /**\n * absent no values reached?\n */\n isAbsent(): boolean {\n return this.length == 0;\n }\n\n /**\n * should make the code clearer\n * note if you pass a function\n * this refers to the active DomQuery object\n */\n isPresent(presentRunnable ?: (elem ?: DomQuery) => void): boolean {\n let absent = this.isAbsent();\n if (!absent && presentRunnable) {\n presentRunnable.call(this, this)\n }\n return !absent;\n }\n\n /**\n * should make the code clearer\n * note if you pass a function\n * this refers to the active DomQuery object\n *\n *\n * @param presentRunnable\n */\n ifPresentLazy(presentRunnable: (elem ?: DomQuery) => void = function () {\n }): DomQuery {\n this.isPresent.call(this, presentRunnable);\n return this;\n }\n\n /**\n * remove all affected nodes from this query object from the dom tree\n */\n delete() {\n this.eachElem((node: Element) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }\n\n querySelectorAll(selector): DomQuery {\n // We could merge both methods, but for now this is more readable\n if (selector.indexOf(\"/shadow/\") != -1) {\n return this._querySelectorAllDeep(selector);\n } else {\n return this._querySelectorAll(selector);\n }\n }\n\n closest(selector): DomQuery {\n // We could merge both methods, but for now this is more readable\n if (selector.indexOf(\"/shadow/\") != -1) {\n return this._closestDeep(selector);\n } else {\n return this._closest(selector);\n }\n }\n\n\n /**\n * core byId method\n * @param id the id to search for\n * @param includeRoot also match the root element?\n */\n byId(id: string, includeRoot?: boolean): DomQuery {\n let res: Array<DomQuery> = [];\n if (includeRoot) {\n res = res.concat(...\n new Es2019Array(...(this?.rootNode || []))\n .filter(((item) => id == item.id) as any)\n .map(item => new DomQuery(item))\n );\n }\n\n // for some strange kind of reason the # selector fails\n // on hidden elements we use the attributes match selector\n // that works\n res = res.concat(this.querySelectorAll(`[id=\"${id}\"]`));\n return new DomQuery(...res);\n }\n\n\n byIdDeep(id: string, includeRoot?: boolean): DomQuery {\n let res: Array<DomQuery> = [];\n if (includeRoot) {\n res = res.concat(\n new Es2019Array(...(this?.rootNode || []))\n .filter(item => id == item.id)\n .map(item => new DomQuery(item))\n );\n }\n\n let subItems = this.querySelectorAllDeep(`[id=\"${id}\"]`);\n if (subItems.length) {\n res.push(subItems);\n }\n\n return new DomQuery(...res);\n }\n\n /**\n * same as byId just for the tag name\n * @param tagName the tag-name to search for\n * @param includeRoot shall the root element be part of this search\n * @param deep do we also want to go into shadow dom areas\n */\n byTagName(tagName: string, includeRoot ?: boolean, deep ?: boolean): DomQuery {\n let res: Array<Element | DomQuery> = [];\n if (includeRoot) {\n res = new Es2019Array(...(this?.rootNode ?? []))\n .filter(element => element?.tagName == tagName)\n .reduce((reduction: any, item: Element) => reduction.concat([item]), res);\n }\n\n (deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));\n return new DomQuery(...res);\n }\n\n /**\n * attr accessor, usage myQuery.attr(\"class\").value = \"bla\"\n * or let value myQuery.attr(\"class\").value\n * @param attr the attribute to set\n * @param defaultValue the default value in case nothing is presented (defaults to null)\n */\n attr(attr: string, defaultValue: string = null): ElementAttribute {\n return new ElementAttribute(this, attr, defaultValue);\n }\n\n style(cssProperty: string, defaultValue: string = null): Style {\n return new Style(this, cssProperty, defaultValue);\n }\n\n\n /**\n * Checks for an existing class in the class attributes\n *\n * @param clazz the class to search for\n */\n hasClass(clazz: string) {\n let hasIt = false;\n this.eachElem(node => {\n hasIt = node.classList.contains(clazz);\n if (hasIt) {\n return false;\n }\n });\n return hasIt;\n }\n\n /**\n * appends a class string if not already in the element(s)\n *\n * @param clazz the style class to append\n */\n addClass(clazz: string): DomQuery {\n this.eachElem(item => item.classList.add(clazz))\n return this;\n }\n\n /**\n * remove the style class if in the class definitions\n *\n * @param clazz\n */\n removeClass(clazz: string): DomQuery {\n this.eachElem(item => item.classList.remove(clazz));\n return this;\n }\n\n /**\n * checks whether we have a multipart element in our children\n * or are one\n */\n isMultipartCandidate(deep = false): boolean {\n const FILE_INPUT = \"input[type='file']\";\n return this.matchesSelector(FILE_INPUT) ||\n ((!deep) ? this.querySelectorAll(FILE_INPUT) :\n this.querySelectorAllDeep(FILE_INPUT)).first().isPresent();\n }\n\n /**\n * innerHtml\n * equivalent to jQueries html\n * as setter the html is set and the\n * DomQuery is given back\n * as getter the html string is returned\n *\n * @param newInnerHTML the inner html to be inserted\n */\n html(newInnerHTML?: string): DomQuery | Optional<string> {\n if (Optional.fromNullable(newInnerHTML).isAbsent()) {\n return this.isPresent() ? Optional.fromNullable(this.innerHTML) : Optional.absent;\n }\n this.innerHTML = newInnerHTML;\n\n return this;\n }\n\n /**\n * Standard dispatch event method, delegated from node\n */\n dispatchEvent(evt: Event): DomQuery {\n this.eachElem(elem => elem.dispatchEvent(evt));\n return this;\n }\n\n /**\n * abbreviation property to use innerHTML directly like on the dom tree\n * @param newInnerHTML the new inner html which should be attached to \"this\" domQuery\n */\n set innerHTML(newInnerHTML: string) {\n this.eachElem(elem => elem.innerHTML = newInnerHTML);\n }\n\n /**\n * getter abbreviation to use innerHTML directly\n */\n get innerHTML(): string {\n let retArr = [];\n this.eachElem(elem => retArr.push(elem.innerHTML));\n return retArr.join(\"\");\n }\n\n /**\n * since the dom allows both innerHTML and innerHtml we also have to implement both\n * @param newInnerHtml see above\n */\n set innerHtml(newInnerHtml: string) {\n this.innerHTML = newInnerHtml;\n }\n\n /**\n * same here, getter for allowing innerHtml directly\n */\n get innerHtml(): string {\n return this.innerHTML;\n }\n\n /**\n * filters the current dom query elements\n * upon a given selector\n *\n * @param selector\n */\n filterSelector(selector: string): DomQuery {\n let matched = [];\n\n this.eachElem(item => {\n if (this._matchesSelector(item, selector)) {\n matched.push(item)\n }\n });\n return new DomQuery(...matched);\n }\n\n /**\n * checks whether any item in this domQuery level matches the selector\n * if there is one element only attached, as root the match is only\n * performed on this element.\n * @param selector\n */\n matchesSelector(selector: string): boolean {\n return this.asArray\n .some(item => this._matchesSelector(item.getAsElem(0).value, selector));\n }\n\n /**\n * easy node traversal, you can pass\n * a set of node selectors which are joined as direct children\n *\n * Note!!! The root nodes are not in the getIf, those are always the child nodes\n *\n * @param nodeSelector\n */\n getIf(...nodeSelector: Array<string>): DomQuery {\n\n let selectorStage: DomQuery = this.childNodes;\n for (let cnt = 0; cnt < nodeSelector.length; cnt++) {\n selectorStage = selectorStage.filterSelector(nodeSelector[cnt]);\n if (selectorStage.isAbsent()) {\n return selectorStage;\n }\n }\n return selectorStage;\n }\n\n eachElem(func: (item: Element, cnt?: number) => any): DomQuery {\n\n for (let cnt = 0, len = this.rootNode.length; cnt < len; cnt++) {\n if (func(this.rootNode[cnt], cnt) === false) {\n break;\n }\n }\n return this;\n }\n\n firstElem(func: (item: Element, cnt?: number) => any = item => item): DomQuery {\n if (this.rootNode.length > 1) {\n func(this.rootNode[0], 0);\n }\n return this;\n }\n\n lastElem(func: (item: Element, cnt?: number) => any = item => item): DomQuery {\n if (this.rootNode.length > 1) {\n func(this.rootNode[this.rootNode.length - 1], 0);\n }\n return this;\n }\n\n each(func: (item: DomQuery, cnt?: number) => any): DomQuery {\n new Es2019Array(...this.rootNode)\n .forEach((item, cnt) => {\n // we could use a filter, but for the best performance we don´t\n if (item == null) {\n return;\n }\n return func(DomQuery.byId(item), cnt);\n });\n\n return this;\n }\n\n /**\n * replace convenience function, replaces one or more elements with\n * a set of elements passed as DomQuery\n * @param toReplace the replaced nodes as reference (original node has been replaced)\n */\n replace(toReplace: DomQuery): DomQuery {\n this.each(item => {\n let asElem = item.getAsElem(0).value;\n let parent = asElem.parentElement;\n let nextElement = asElem.nextElementSibling;\n let previousElement = asElem.previousElementSibling;\n if(nextElement != null) {\n new DomQuery(nextElement).insertBefore(toReplace);\n } else if(previousElement) {\n new DomQuery(previousElement).insertAfter(toReplace)\n } else {\n new DomQuery(parent).append(toReplace);\n }\n item.delete();\n });\n return toReplace;\n }\n\n /**\n * returns a new dom query containing only the first element max\n *\n * @param func a an optional callback function to perform an operation on the first element\n */\n first(func: (item: DomQuery, cnt?: number) => any = (item) => item): DomQuery {\n if (this.rootNode.length >= 1) {\n func(this.get(0), 0);\n return this.get(0);\n }\n return this;\n }\n\n /**\n * returns a new dom query containing only the first element max\n *\n * @param func a an optional callback function to perform an operation on the first element\n */\n last(func: (item: DomQuery, cnt?: number) => any = (item) => item): DomQuery {\n if (this.rootNode.length >= 1) {\n let lastNode = this.get(this.rootNode.length - 1);\n func(lastNode, 0);\n return lastNode;\n }\n return this;\n }\n\n /**\n * filter function which filters a subset\n *\n * @param func\n */\n filter(func: (item: DomQuery) => boolean): DomQuery {\n let reArr: Array<DomQuery> = [];\n this.each((item: DomQuery) => {\n func(item) ? reArr.push(item) : null;\n });\n return new DomQuery(...<any>reArr);\n }\n\n /**\n * global eval head appendix method\n * no other methods are supported anymore\n * @param code the code to be evaluated\n * @param nonce optional nonce key for higher security\n */\n globalEval(code: string, nonce ?: string): DomQuery {\n const head = document.getElementsByTagName(\"head\")?.[0]\n ?? document.documentElement.getElementsByTagName(\"head\")?.[0];\n const script = document.createElement(\"script\");\n if (nonce) {\n if ('undefined' != typeof script?.nonce) {\n script.nonce = nonce;\n } else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n script.type = \"text/javascript\";\n script.innerHTML = code;\n let newScriptElement = head.appendChild(script);\n head.removeChild(newScriptElement);\n return this;\n }\n\n /**\n * global eval head appendix method\n * no other methods are supported anymore\n * @param code the code to be evaluated\n * @param nonce optional nonce key for higher security\n */\n globalEvalSticky(code: string, nonce ?: string): DomQuery {\n let head = document.getElementsByTagName(\"head\")[0] || document.documentElement;\n let script = document.createElement(\"script\");\n this.applyNonce(nonce, script);\n script.type = \"text/javascript\";\n script.innerHTML = code;\n head.appendChild(script);\n return this;\n }\n\n /**\n * detaches a set of nodes from their parent elements\n * in a browser independent manner\n * @return {Array} an array of nodes with the detached dom nodes\n */\n detach(): DomQuery {\n this.eachElem((item: Element) => {\n item.parentNode.removeChild(item);\n });\n return this;\n }\n\n /**\n * appends the current set of elements\n * to the element or first element passed via elem\n * @param elem\n */\n appendTo(elem: DomQuery | string): DomQuery {\n if (Lang.isString(elem)) {\n this.appendTo(DomQuery.querySelectorAll(elem as string));\n return this;\n }\n this.eachElem((item) => {\n let value1: Element = <Element>(elem as DomQuery).getAsElem(0).orElseLazy(() => {\n return {\n appendChild: () => {\n }\n }\n }).value;\n value1.appendChild(item);\n });\n return this;\n }\n\n /**\n * loads and evaluates a script from a source uri\n *\n * @param src the source to be loaded and evaluated\n * @param delay in milliseconds execution default (0 == no delay)\n * @param nonce optional nonce value to allow increased security via nonce crypto token\n */\n loadScriptEval(src: string, delay: number = 0, nonce?: string) {\n this._loadScriptEval(false, src, delay, nonce);\n\n return this;\n }\n\n\n /**\n * loads and evaluates a script from a source uri\n *\n * @param src the source to be loaded and evaluated\n * @param delay in milliseconds execution default (0 == no delay)\n * @param nonce optional nonce parameter for increased security via nonce crypto token\n */\n loadScriptEvalSticky(src: string, delay: number = 0, nonce?: string) {\n this._loadScriptEval(true, src, delay, nonce);\n\n return this;\n }\n\n insertAfter(...toInsertParams: Array<DomQuery>): DomQuery {\n\n this.each(existingItem => {\n let existingElement = existingItem.getAsElem(0).value;\n let rootNode = existingElement.parentNode;\n for (let cnt = 0; cnt < toInsertParams.length; cnt++) {\n let nextSibling: Element = <any>existingElement.nextSibling;\n toInsertParams[cnt].eachElem(insertElem => {\n if (nextSibling) {\n rootNode.insertBefore(insertElem, nextSibling);\n existingElement = nextSibling;\n } else {\n rootNode.appendChild(insertElem);\n }\n });\n\n }\n });\n\n let res = [];\n res.push(this);\n res = res.concat(toInsertParams);\n return new DomQuery(...res);\n }\n\n insertBefore(...toInsertParams: Array<DomQuery>): DomQuery {\n this.each(existingItem => {\n let existingElement = existingItem.getAsElem(0).value;\n let rootNode = existingElement.parentNode;\n for (let cnt = 0; cnt < toInsertParams.length; cnt++) {\n toInsertParams[cnt].eachElem(insertElem => {\n rootNode.insertBefore(insertElem, existingElement);\n });\n }\n });\n let res = [];\n res.push(this);\n res = res.concat(toInsertParams);\n return new DomQuery(...res);\n }\n\n orElse(...elseValue: any): DomQuery {\n if (this.isPresent()) {\n return this;\n } else {\n return new DomQuery(...elseValue);\n }\n }\n\n orElseLazy(func: () => any): DomQuery {\n if (this.isPresent()) {\n return this;\n } else {\n return new DomQuery(func());\n }\n }\n\n /**\n * find all parents in the hierarchy for which the selector matches\n * @param selector\n */\n allParents(selector: string): DomQuery {\n let parent = this.parent();\n let ret = [];\n while(parent.isPresent()) {\n if(parent.matchesSelector(selector)) {\n ret.push(parent);\n }\n parent = parent.parent();\n }\n return new DomQuery(...ret);\n }\n\n /**\n * finds the first parent in the hierarchy for which the selector matches\n * @param selector\n */\n firstParent(selector: string): DomQuery {\n let parent = this.parent();\n while(parent.isPresent()) {\n if(parent.matchesSelector(selector)) {\n return parent;\n }\n parent = parent.parent();\n }\n return DomQuery.absent;\n }\n\n /**\n * fetches all parents as long as the filter criterium matches\n * @param selector\n */\n parentsWhileMatch(selector: string): DomQuery {\n const retArr: Array<DomQuery> = [];\n let parent = this.parent().filter(item => item.matchesSelector(selector));\n while(parent.isPresent()) {\n retArr.push(parent);\n parent = parent.parent().filter(item => item.matchesSelector(selector));\n }\n\n return new DomQuery(...retArr);\n }\n\n parent(): DomQuery {\n let ret = [];\n this.eachElem((item: Element) => {\n let parent = item.parentNode || (item as any).host || item.shadowRoot;\n if (parent && ret.indexOf(parent) == -1) {\n ret.push(parent);\n }\n });\n\n return new DomQuery(...ret);\n }\n\n copyAttrs(sourceItem: DomQuery | XMLQuery): DomQuery {\n sourceItem.eachElem((sourceNode: Element) => {\n let attrs: Array<Attr> = objToArray(sourceNode.attributes);\n for (let item of attrs) {\n let value: string = item.value;\n let name: string = item.name;\n\n switch (name) {\n case \"id\":\n this.id.value = value;\n break;\n case \"disabled\":\n this.resolveAttributeHolder(\"disabled\").disabled = value;\n break;\n case \"checked\":\n this.resolveAttributeHolder(\"checked\").checked = value;\n break;\n case \"nonce\":\n // nonce will be handled below!\n break;\n default:\n this.attr(name).value = value;\n }\n }\n });\n\n //special nonce handling\n sourceItem.nonce.isPresent(() => {\n this.nonce.value = sourceItem.nonce.value;\n });\n\n return this;\n }\n\n /**\n * outerHTML convenience method\n * browsers only support innerHTML but\n * for instance for your jsf.js we have a full\n * replace pattern which needs outerHTML processing\n *\n * @param markup the markup which should replace the root element\n * @param runEmbeddedScripts if true the embedded scripts are executed\n * @param runEmbeddedCss if true the embedded css are executed\n * @param deep should this also work for shadow dom (run scripts etc...)\n */\n outerHTML(markup: string, runEmbeddedScripts ?: boolean, runEmbeddedCss ?: boolean, deep = false): DomQuery {\n if (this.isAbsent()) {\n return;\n }\n\n let focusElementId = document?.activeElement?.id;\n let caretPosition = (focusElementId) ? DomQuery.getCaretPosition(document.activeElement) : null;\n let nodes = DomQuery.fromMarkup(markup);\n let res = [];\n let toReplace = this.getAsElem(0).value;\n let firstInsert = nodes.get(0);\n let parentNode = toReplace.parentNode;\n let replaced = firstInsert.getAsElem(0).value;\n parentNode.replaceChild(replaced, toReplace);\n res.push(new DomQuery(replaced));\n // no replacement possible\n if (this.isAbsent()) {\n return this;\n }\n\n let insertAdditionalItems = [];\n\n if (nodes.length > 1) {\n insertAdditionalItems = insertAdditionalItems.concat(...nodes.values.slice(1));\n res.push(DomQuery.byId(replaced).insertAfter(new DomQuery(...insertAdditionalItems)));\n }\n\n if (runEmbeddedScripts) {\n this.runScripts();\n }\n if (runEmbeddedCss) {\n this.runCss();\n }\n\n let focusElement = DomQuery.byId(focusElementId);\n if (focusElementId && focusElement.isPresent() &&\n caretPosition != null && \"undefined\" != typeof caretPosition) {\n focusElement.eachElem(item => DomQuery.setCaretPosition(item, caretPosition));\n }\n\n return nodes;\n }\n\n /**\n * Run through the given nodes in the DomQuery execute the inline scripts\n * @param sticky if set to true the evaluated elements will stick to the head, default false\n * @param whitelisted: optional whitelist function which can filter out script tags which are not processed\n * defaults to the standard jsf.js exclusion (we use this code for myfaces)\n */\n runScripts(sticky = false, whitelisted: (val: string) => boolean = DEFAULT_WHITELIST): DomQuery {\n const evalCollectedScripts = (scriptsToProcess: { evalText: string, nonce: string }[]) => {\n if (scriptsToProcess.length) {\n // script source means we have to eval the existing\n // scripts before we run the 'include' command\n // this.globalEval(finalScripts.join(\"\\n\"));\n let joinedScripts = [];\n new Es2019Array(...scriptsToProcess).forEach(item => {\n if (!item.nonce) {\n joinedScripts.push(item.evalText)\n } else {\n if (joinedScripts.length) {\n this.globalEval(joinedScripts.join(\"\\n\"));\n joinedScripts.length = 0;\n }\n\n (!sticky) ?\n this.globalEval(item.evalText, item.nonce) :\n this.globalEvalSticky(item.evalText, item.nonce);\n }\n });\n if (joinedScripts.length) {\n (!sticky) ? this.globalEval(joinedScripts.join(\"\\n\")) :\n this.globalEvalSticky(joinedScripts.join(\"\\n\"));\n joinedScripts.length = 0;\n }\n\n scriptsToProcess = [];\n }\n return scriptsToProcess;\n }\n\n let finalScripts = [],\n allowedItemTypes = [\"\", \"script\", \"text/javascript\", \"text/ecmascript\", \"ecmascript\"],\n execScript = (item) => {\n let tagName = item.tagName;\n let itemType = (item?.type ?? '').toLowerCase();\n if (tagName &&\n eqi(tagName, \"script\") &&\n allowedItemTypes.indexOf(itemType) != -1) {\n let src = item.getAttribute('src');\n if ('undefined' != typeof src\n && null != src\n && src.length > 0\n ) {\n let nonce = item?.nonce ?? item.getAttribute('nonce').value;\n // we have to move this into an inner if because chrome otherwise chokes\n // due to changing the and order instead of relying on left to right\n // if jsf.js is already registered we do not replace it anymore\n if (whitelisted(src)) {\n // we run the collected scripts, before we run the 'include' command\n finalScripts = evalCollectedScripts(finalScripts);\n if (!sticky) {\n (!!nonce) ? this.loadScriptEval(src, 0, nonce) :\n // if no nonce is set we do not pass any once\n this.loadScriptEval(src, 0);\n } else {\n (!!nonce) ? this.loadScriptEvalSticky(src, 0, nonce) :\n // if no nonce is set we do not pass any once\n this.loadScriptEvalSticky(src, 0);\n }\n }\n\n } else {\n // embedded script auto eval\n // probably not needed anymore\n let evalText = trim(item.text || item.innerText || item.innerHTML);\n let go = true;\n\n while (go) {\n go = false;\n if (evalText.substring(0, 4) == \"<!--\") {\n evalText = evalText.substring(4);\n go = true;\n }\n if (evalText.substring(0, 4) == \"//<!--\") {\n evalText = evalText.substring(6);\n go = true;\n }\n if (evalText.substring(0, 11) == \"//<![CDATA[\") {\n evalText = evalText.substring(11);\n go = true;\n }\n }\n let nonce = item?.nonce ?? item.getAttribute('nonce').value ?? '';\n // we have to run the script under a global context\n // we store the script for fewer calls to eval\n finalScripts.push({\n nonce,\n evalText\n });\n }\n }\n };\n try {\n let scriptElements = new DomQuery(this.filterSelector(\"script\"), this.querySelectorAll(\"script\"));\n // script execution order by relative pos in their dom tree\n scriptElements.asArray\n .flatMap(item => [...item.values])\n .sort((node1, node2) => node2.compareDocumentPosition(node1) - 3) // preceding 2, following == 4)\n .forEach(item => execScript(item));\n\n evalCollectedScripts(finalScripts);\n } catch (e) {\n if (console && console.error) {\n // not sure if we\n // should use our standard\n // error mechanisms here\n // because in the head appendix\n // method only a console\n // error would be raised as well\n console.error(e.message || e.description);\n }\n } finally {\n // the usual ie6 fix code\n // the IE6 garbage collector is broken\n // nulling closures helps somewhat to reduce\n // mem leaks, which are impossible to avoid\n // at this browser\n execScript = null;\n }\n return this;\n }\n\n runCss(): DomQuery {\n\n const execCss = (toReplace: HTMLElement) => {\n const _toReplace = DomQuery.byId(toReplace);\n const tagName = _toReplace.tagName.orElse(\"\").value;\n let newElement = DomQuery.fromMarkup(`<${tagName.toLowerCase()} />`);\n newElement = newElement.copyAttrs(_toReplace);\n newElement.innerHTML = toReplace.innerHTML;\n // css suffices a simple replace to get it eval-ed, no need\n // for a full head replace\n _toReplace.replace(newElement);\n };\n\n const cssElems: DomQuery = new DomQuery(this.filterSelector(\"link, style\"), this.querySelectorAll(\"link, style\"));\n\n cssElems.asArray\n .flatMap(item => [...item.values])\n // sort to make sure the execution order is correct\n // this is needed because we mix 2 queries together\n // -3 is needed due to the compareDocumentPosition return value\n .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)\n .forEach(item => execCss(item as HTMLElement));\n\n return this;\n }\n\n /**\n * fires a click event on the underlying dom elements\n */\n click(): DomQuery {\n this.fireEvent(\"click\");\n return this;\n }\n\n addEventListener(type: string, listener: (evt: Event) => void, options?: boolean | EventListenerOptions): DomQuery {\n this.eachElem((node: Element) => node.addEventListener(type, listener, options));\n return this;\n }\n\n removeEventListener(type: string, listener: (evt: Event) => void, options?: boolean | EventListenerOptions): DomQuery {\n this.eachElem((node: Element) => node.removeEventListener(type, listener, options));\n return this;\n }\n\n /**\n * fires an event\n */\n fireEvent(eventName: string, options: {[key: string]: any} = {}) {\n // merge with last one having the highest priority\n\n let finalOptions: any = {\n bubbles: true, cancelable: true\n }\n finalOptions = simpleShallowMerge(finalOptions, options);\n\n this.eachElem((node: Element) => {\n let doc;\n if (node.ownerDocument) {\n doc = node.ownerDocument;\n } else if (node.nodeType == 9) {\n // the node may be the document itself, nodeType 9 = DOCUMENT_NODE\n doc = node;\n } else {\n throw new Error(\"Invalid node passed to fireEvent: \" + node.id);\n }\n\n if (node.dispatchEvent) {\n // Gecko-style approach (now the standard) takes more work\n let EventClass = Event;\n\n // Different events have different event classes.\n // If this switch statement can't map an eventName to an EventClass,\n // the event firing is going to fail.\n // extend this list on demand\n switch (eventName) {\n case \"click\": // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.\n case \"mousedown\":\n case \"mouseup\":\n case \"mousemove\":\n EventClass = this.global().MouseEvent;\n break;\n case \"keyup\":\n case \"keydown\":\n case \"keypress\":\n EventClass = this.global().KeyboardEvent;\n break;\n case \"focus\":\n case \"change\":\n case \"blur\":\n case \"select\":\n break;\n default:\n throw \"fireEvent: Couldn't find an event class for event '\" + eventName + \"'.\";\n }\n\n let event = new EventClass(eventName, finalOptions);\n // this is added as an extra to allow internally the detection of synthetic events\n // not used atm, but it does not hurt to have the extra info\n (event as any).synthetic = true; // allow detection of synthetic events\n // The second parameter says go ahead with the default action\n node.dispatchEvent(event);\n } else if ((node as any).fireEvent) {\n // IE-old school style, you can drop this if you don't need to support IE8 and lower\n let event = doc.createEventObject();\n event.synthetic = true; // allow detection of synthetic events\n Object.keys(finalOptions).forEach(key => event[key] = finalOptions[key]);\n (node as any).fireEvent(\"on\" + eventName, event);\n }\n })\n }\n\n textContent(joinString: string = \"\"): string {\n return this.asArray\n .map((value: DomQuery) => {\n let item = value.getAsElem(0).orElseLazy(() => {\n return <any>{\n textContent: \"\"\n };\n }).value;\n return (item as any).textContent || \"\";\n })\n .reduce((text1, text2) => [text1,joinString,text2].join(\"\"), \"\");\n }\n\n innerText(joinString: string = \"\"): string {\n return this.asArray\n .map((value: DomQuery) => {\n let item = value.getAsElem(0).orElseLazy(() => {\n return <any>{\n innerText: \"\"\n };\n }).value;\n return (item as any).innerText || \"\";\n })\n .reduce((text1, text2) => {\n return [text1, text2].join(joinString)\n }, \"\");\n }\n\n /**\n * encodes all input elements properly into respective\n * config entries, this can be used\n * for legacy systems, for newer use-cases, use the\n * HTML5 Form class which all newer browsers provide\n *\n * @param toMerge optional config which can be merged in\n * @return a copy pf\n */\n encodeFormElement(toMerge = {}): {[key: string]: any} {\n\n // browser behavior no element name no encoding (normal submit fails in that case)\n // https:// issues.apache.org/jira/browse/MYFACES-2847\n if (this.name.isAbsent()) {\n return;\n }\n\n // let´s keep it side-effects free\n let target = simpleShallowMerge(toMerge);\n\n this.each((element: DomQuery) => {\n if (element.name.isAbsent()) {// no name, no encoding\n return;\n }\n let name = element.name.value;\n let tagName = element.tagName.orElse(\"__none__\").value.toLowerCase();\n let elemType = element.type.orElse(\"__none__\").value.toLowerCase();\n\n elemType = elemType.toLowerCase();\n\n // routine for all elements\n // rules:\n // - process only input, textarea and select elements\n // - elements must have attribute \"name\"\n // - elements must not be disabled\n if (((tagName == \"input\" || tagName == \"textarea\" || tagName == \"select\") &&\n (name != null && name != \"\")) && !element.disabled) {\n\n // routine for select elements\n // rules:\n // - if select-one and value-Attribute exist => \"name=value\"\n // (also if value empty => \"name=\")\n // - if select-one and value-Attribute don't exist =>\n // \"name=DisplayValue\"\n // - if select multi and multiple selected => \"name=value1&name=value2\"\n // - if select and selectedIndex=-1 don't submit\n if (tagName == \"select\") {\n // selectedIndex must be >= 0 to be submitted\n let selectElem: HTMLSelectElement = <HTMLSelectElement>element.getAsElem(0).value;\n if (selectElem.selectedIndex >= 0) {\n let uLen = selectElem.options.length;\n for (let u = 0; u < uLen; u++) {\n // find all selected options\n // let subBuf = [];\n if (selectElem.options[u].selected) {\n let elementOption = selectElem.options[u];\n append(target, name).value = (elementOption.getAttribute(\"value\") != null) ?\n elementOption.value : elementOption.text;\n }\n }\n }\n }\n\n // routine for remaining elements\n // rules:\n // - don't submit no selects (processed above), buttons, reset buttons, submit buttons,\n // - submit checkboxes and radio inputs only if checked\n if (\n (\n tagName != ALLOWED_SUBMITTABLE_ELEMENTS.SELECT &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.BUTTON &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RESET &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.SUBMIT &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.IMAGE\n ) && (\n (\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.CHECKBOX && elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RADIO) ||\n element.checked\n )\n ) {\n let uploadedFiles = (element.value as any)?.value?.files;\n let filesArr: any = uploadedFiles ?? [];\n if (filesArr?.length) { //files can be empty but set\n // xhr level2, single multiple must be passes as they are\n assign(target, name).value = Array.from(filesArr);\n } else {\n if(!!uploadedFiles) { //we skip empty file elements i\n return;\n }\n //checkboxes etc.. need to be appended\n append(target, name).value = element.inputValue.value;\n }\n }\n\n }\n });\n\n return target;\n }\n\n get cDATAAsString(): string {\n let TYPE_CDATA_BLOCK = 4;\n\n let res = this.asArray\n .flatMap( item => {\n return item.childNodes.asArray;\n })\n .filter(item => {\n return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;\n })\n .reduce((reduced: Array<any>, item: DomQuery) => {\n reduced.push((item?.value?.value as any)?.data ?? \"\");\n return reduced;\n }, []);\n /*let res: any = this.lazyStream.flatMap(item => {\n return item.childNodes.stream\n }).filter(item => {\n return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;\n }).reduce((reduced: Array<any>, item: DomQuery) => {\n reduced.push((item?.value?.value)?.data ?? \"\" as any);\n return reduced;\n }, []).value;*/\n\n // response may contain several blocks\n return res.join(\"\");\n }\n\n subNodes(from: number, to?: number): DomQuery {\n if (Optional.fromNullable(to).isAbsent()) {\n to = this.length;\n }\n return new DomQuery(...this.rootNode.slice(from, Math.min(to, this.length)));\n }\n\n\n // because we can stream from an array stream directly into the dom query\n _limits = -1;\n\n limits(end: number): DomQuery {\n this._limits = end;\n return <any>this;\n }\n\n //-- internally exposed methods needed for the interconnectivity\n hasNext() {\n let isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;\n let isEndOfArray = this.pos >= this.values.length - 1;\n return !(isLimitsReached ||\n isEndOfArray);\n }\n\n next(): DomQuery {\n if (!this.hasNext()) {\n return null;\n }\n this.pos++;\n return new DomQuery(this.values[this.pos]);\n }\n\n\n lookAhead(cnt = 1): ITERATION_STATUS | DomQuery {\n if ((this.values.length - 1) < (this.pos + cnt)) {\n return ITERATION_STATUS.EO_STRM;\n }\n return new DomQuery(this.values[this.pos + cnt]);\n }\n\n\n current(): DomQuery | ITERATION_STATUS {\n if (this.pos == -1) {\n return ITERATION_STATUS.BEF_STRM;\n }\n return new DomQuery(this.values[this.pos]);\n }\n\n\n reset() {\n this.pos = -1;\n }\n\n attachShadow(params: { [key: string]: string } = {mode: \"open\"}): DomQuery {\n let shadowRoots: DomQuery[] = [];\n this.eachElem((item: Element) => {\n let shadowElement: DomQuery;\n if ((item)?.attachShadow as any) {\n shadowElement = DomQuery.byId((item as any).attachShadow(params));\n shadowRoots.push(shadowElement);\n } else {\n throw new Error(\"Shadow dom creation not supported by the browser, please use a shim, to gain this functionality\");\n }\n });\n return new DomQuery(...shadowRoots);\n }\n\n /**\n * helper to fix a common dom problem\n * we have to wait until a certain condition is met, in most of the cases we just want to know whether an element is present in the sub dom-tree before being able to proceed\n * @param condition\n * @param options\n */\n async waitUntilDom(condition: (element: DomQuery) => boolean, options: WAIT_OPTS = {\n attributes: true,\n childList: true,\n subtree: true,\n timeout: 500,\n interval: 100\n }): Promise<DomQuery> {\n return waitUntilDom(this, condition, options);\n }\n\n /**\n * returns the embedded shadow elements\n */\n get shadowElements(): DomQuery {\n let shadowElements = this.querySelectorAll(\"*\")\n .filter(item => item.hasShadow);\n\n\n let mapped: Array<ShadowRoot> = (shadowElements.allElems() || []).map(element => element.shadowRoot);\n return new DomQuery(...mapped);\n }\n\n get shadowRoot(): DomQuery {\n let shadowRoots = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (this.rootNode[cnt].shadowRoot) {\n shadowRoots.push(this.rootNode[cnt].shadowRoot);\n }\n }\n return new DomQuery(...shadowRoots);\n }\n\n get hasShadow(): boolean {\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (this.rootNode[cnt].shadowRoot) {\n return true;\n }\n }\n return false;\n }\n\n // from\n // http:// blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/\n static getCaretPosition(ctrl: any) {\n let caretPos = 0;\n\n try {\n if ((document as any)?.selection) {\n ctrl.focus();\n let selection = (document as any).selection.createRange();\n // the selection now is start zero\n selection.moveStart('character', -ctrl.value.length);\n // the caret-position is the selection start\n caretPos = selection.text.length;\n }\n } catch (e) {\n // now this is ugly, but not supported input types throw errors for selectionStart\n // just in case someone dumps this code onto unsupported browsers\n }\n return caretPos;\n }\n\n /**\n * sets the caret position\n *\n * @param ctrl the control to set the caret position to\n * @param pos the position to set\n *\n * note if the control does not have any selectable and focusable behavior\n * calling this method does nothing (silent fail)\n *\n */\n static setCaretPosition(ctrl: any, pos: number) {\n ctrl?.focus ? ctrl?.focus() : null;\n // the selection range is our caret position\n\n ctrl?.setSelectiongRange ? ctrl?.setSelectiongRange(pos, pos) : null;\n }\n\n /**\n * Implementation of an iterator\n * to allow loops over dom query collections\n */\n [Symbol.iterator](): Iterator<DomQuery> {\n return {\n next: () => {\n let done = !this.hasNext();\n let val = this.next();\n return {\n done: done,\n value: <DomQuery>val\n }\n }\n }\n }\n\n /**\n * Concatenates the elements of two Dom Queries into a single one\n * @param toAttach the elements to attach\n * @param filterDoubles filter out possible double elements (aka same markup)\n */\n concat(toAttach: DomQuery, filterDoubles = true): DomQuery {\n let domQueries = this.asArray;\n const ret = new DomQuery(...domQueries.concat(toAttach.asArray));\n // we now filter the doubles out\n if (!filterDoubles) {\n return ret;\n }\n let idx = {}; // ie11 does not support sets, we have to fake it\n return new DomQuery(...ret.asArray.filter(node => {\n const notFound = !(idx?.[node.value.value.outerHTML as any]);\n idx[node.value.value.outerHTML as any] = true;\n return notFound;\n }));\n }\n\n append(elem: DomQuery): DomQuery {\n this.each(item => elem.appendTo(item));\n return this;\n }\n\n prependTo(elem: DomQuery): DomQuery {\n elem.eachElem(item => {\n item.prepend(...this.allElems());\n });\n return this;\n }\n\n prepend(elem: DomQuery): DomQuery {\n this.eachElem(item => {\n item.prepend(...elem.allElems());\n })\n return this;\n }\n\n /**\n * query selector all on the existing dom queryX object\n *\n * @param selector the standard selector\n * @return a DomQuery with the results\n */\n private _querySelectorAll(selector): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n let nodes = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (!this.rootNode[cnt]?.querySelectorAll) {\n continue;\n }\n let res = this.rootNode[cnt].querySelectorAll(selector);\n nodes = nodes.concat(...objToArray(res));\n }\n\n return new DomQuery(...nodes);\n }\n\n /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/\n private _querySelectorAllDeep(selector): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n\n let foundNodes: DomQuery = new DomQuery(...this.rootNode);\n let selectors = selector.split(/\\/shadow\\//);\n\n for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {\n if (selectors[cnt2] == \"\") {\n continue;\n }\n let levelSelector = selectors[cnt2];\n foundNodes = foundNodes.querySelectorAll(levelSelector);\n if (cnt2 < selectors.length - 1) {\n foundNodes = foundNodes.shadowRoot;\n }\n }\n\n return foundNodes;\n }\n\n\n /**\n * query selector all on the existing dom queryX object\n *\n * @param selector the standard selector\n * @return a DomQuery with the results\n */\n private _closest(selector): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n let nodes = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (!this.rootNode[cnt]?.closest) {\n continue;\n }\n let res = [this.rootNode[cnt].closest(selector)];\n nodes = nodes.concat(...res);\n }\n\n return new DomQuery(...nodes);\n }\n\n /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/\n private _closestDeep(selector): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n\n let foundNodes: DomQuery = new DomQuery(...this.rootNode);\n let selectors = selector.split(/\\/shadow\\//);\n\n for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {\n if (selectors[cnt2] == \"\") {\n continue;\n }\n let levelSelector = selectors[cnt2];\n foundNodes = foundNodes.closest(levelSelector);\n if (cnt2 < selectors.length - 1) {\n foundNodes = foundNodes.shadowRoot;\n }\n }\n\n return foundNodes;\n }\n\n /**\n * matches selector call in a browser independent manner\n *\n * @param toMatch\n * @param selector\n * @private\n */\n private _matchesSelector(toMatch: Element, selector: string): boolean {\n if(toMatch.matches) {\n return toMatch.matches(selector);\n }\n var foundElements = (document || ownerDocument).querySelectorAll(selector);\n return Array.prototype.indexOf.call(foundElements, toMatch) !== -1;\n }\n\n /**\n * sticky non-sticky unified code of the load script eval\n * implementation if programmatic &gt;script src=\"... loading\n *\n * @param sticky if set to true a head element is left in the dom tree after the script has loaded\n *\n * @param src the sec to load\n * @param delay delay the script loading x ms (default immediately === 0)\n * @param nonce optional nonce token to be passed into the script tag\n * @private\n */\n private _loadScriptEval(sticky: boolean, src: string, delay: number = 0, nonce ?: string) {\n let srcNode = this.createSourceNode(src, nonce);\n let nonceCheck = this.createSourceNode(null, nonce);\n let marker = `nonce_${Date.now()}_${Math.random()}`;\n nonceCheck.innerHTML = `document.head[\"${marker}\"] = true` // noop\n\n let head = document.head;\n // upfront nonce check, needed mostly for testing\n // but cannot hurt to block src calls which have invalid nonce on localhost\n // the reason for doing this up until now we have a similar construct automatically\n // by loading the scripts via xhr and then embedding them.\n // this is not needed anymore but the nonce is more relaxed with script src\n // we now enforce it the old way\n\n head.appendChild(nonceCheck);\n head.removeChild(nonceCheck);\n if(!head[marker]) {\n return;\n }\n try {\n if (!delay) {\n head.appendChild(srcNode);\n if(!sticky) {\n head.removeChild(srcNode);\n }\n } else {\n setTimeout(() => {\n head.appendChild(srcNode);\n if(!sticky) {\n head.removeChild(srcNode);\n }\n }, delay);\n }\n } finally {\n delete head[marker];\n }\n\n return this;\n }\n\n /**\n * resolves an attribute holder compared\n * @param attrName the attribute name\n */\n private resolveAttributeHolder(attrName: string = \"value\"): HTMLFormElement | any {\n let ret = [];\n ret[attrName] = null;\n return (attrName in this.getAsElem(0).value) ?\n this.getAsElem(0).value :\n ret;\n }\n\n private createSourceNode(src: string | null, nonce?: string) {\n let srcNode: HTMLScriptElement = document.createElement(\"script\");\n srcNode.type = \"text/javascript\";\n if (!!nonce) {\n if ('undefined' != typeof srcNode?.nonce) {\n srcNode.nonce = nonce;\n } else {\n srcNode.setAttribute(\"nonce\", nonce);\n }\n }\n if(!!src) {\n srcNode.src = src;\n }\n\n return srcNode;\n }\n\n private applyNonce(nonce: string, script: HTMLScriptElement) {\n if (nonce) {\n if ('undefined' != typeof script?.nonce) {\n script.nonce = nonce;\n } else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n }\n\n}\n\n\n/**\n * Various collectors\n * which can be used in conjunction with Streams\n */\n\n/**\n * A collector which bundles a full dom query stream into a single dom query element\n *\n * This connects basically our stream back into DomQuery\n */\nexport class DomQueryCollector implements ICollector<DomQuery, DomQuery> {\n\n data: DomQuery[] = [];\n\n collect(element: DomQuery) {\n this.data.push(element);\n }\n\n get finalValue(): DomQuery {\n return new DomQuery(...this.data);\n }\n}\n\n/**\n * abbreviation for DomQuery\n */\nexport const DQ = DomQuery;\nexport type DQ = DomQuery;\n// noinspection JSUnusedGlobalSymbols\n/**\n * replacement for the jquery $\n */\nexport const DQ$ = DomQuery.querySelectorAll;\n","/**\n * Extended array\n */\n\n/**\n * Extended array which adds various es 2019 shim functions to the normal array\n * We must remap all array producing functions in order to keep\n * the delegation active, once we are in!\n */\nclass Es2019Array_<T> extends Array<T>{\n\n _another: T[];\n\n constructor(...another: T[]) {\n super(...another);\n if((another as any)._another) {\n this._another = (another as any)._another;\n } else {\n this._another = another;\n }\n\n //for testing it definitely runs into this branch because we are on es5 level\n //if (!(Array.prototype).flatMap as any) {\n this.flatMap = (flatMapFun) => this._flatMap(flatMapFun) as any;\n //}\n //if (!(Array.prototype).flat as any) {\n this.flat = (flatLevel: number = 1) => this._flat(flatLevel);\n //}\n }\n\n map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[] {\n const ret = Array.prototype.map.call(this._another, callbackfn, thisArg);\n return new (_Es2019Array as any) (... ret);\n }\n\n concat(...items: any[]): T[] {\n const ret = Array.prototype.concat.call(this._another, ...items);\n return new (_Es2019Array as any)(... ret);\n }\n\n reverse(): T[] {\n const ret = Array.prototype.reverse.call(this._another);\n return new (_Es2019Array as any)(... ret);\n }\n\n slice(start?: number, end?: number): T[] {\n const ret = Array.prototype.slice.call(this._another, start, end);\n return new (_Es2019Array as any)(...ret);\n }\n\n splice(start: number, deleteCount?: number): T[] {\n const ret = Array.prototype.splice.call(this._another, start, deleteCount ?? 0);\n return new (_Es2019Array as any)(...ret);\n }\n\n filter<S extends T>(predicate: (value: T, index: number, array: T[]) => any, thisArg?: any): S[] {\n const ret = Array.prototype.filter.call(this._another, predicate, thisArg);\n return new (_Es2019Array as any)(...ret);\n }\n\n\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T {\n const ret = Array.prototype.reduce.call(this._another, callbackfn as any, initialValue);\n return ret as T;\n }\n\n /*reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T {\n const ret = Array.prototype.reduceRight.call(callbackfn, initialValue);\n return ret;\n }*/\n\n private _flat(flatDepth = 1) {\n return this._flatResolve(this._another, flatDepth);\n }\n\n private _flatResolve(arr: any[], flatDepth = 1): any[] {\n //recursion break\n if (flatDepth == 0) {\n return arr;\n }\n let res: any[] = [];\n\n let reFlat = (item: any) => {\n item = Array.isArray(item) ? item : [item];\n let mapped = this._flatResolve(item, flatDepth - 1);\n res = res.concat(mapped);\n };\n arr.forEach(reFlat)\n\n return new Es2019Array(...res);\n }\n\n private _flatMap(mapperFunction: Function): any {\n let res = this.map(item => mapperFunction(item));\n return this._flatResolve(res);\n }\n}\n\n//let _Es2019Array = function<T>(...data: T[]) {};\n\n//let oldProto = Es2019Array.prototype;\n\nexport function _Es2019Array<T>(...data: T[]): Es2019Array_<T> {\n let ret = new Es2019Array_<T>(...data);\n let proxied = new Proxy<Es2019Array_<T>>(ret, {\n get(target: Es2019Array_<unknown>, p: string | symbol, receiver: any): any {\n if(\"symbol\" == typeof p) {\n return (target._another as any)[p];\n }\n if(!isNaN(parseInt(p as string))) {\n return (target._another as any)[p];\n } else {\n return (target as any)[p];\n }\n },\n\n set(target, property, value): boolean {\n (target as any)[property] = value;\n (target._another as any)[property] = value;\n return true;\n }\n\n });\n return proxied;\n};\n\n/**\n * this is the switch between normal array and our shim\n * the shim is only provided in case the native browser\n * does not yet have flatMap support on arrays\n */\n// Runtime check for browser compatibility — TypeScript knows flatMap exists in lib but older browsers may not have it.\nexport var Es2019Array: any = ((Array.prototype as any).flatMap) ? function<T>(...data: T[]): T[] {\n // sometimes the typescript compiler produces\n // an array without flatmap between boundaries (the result produces True for Array.isArray\n // but has no flatMap function, could be a node issue also or Typescript!\n // we remap that (could be related to: https://github.com/microsoft/TypeScript/issues/31033\n // the check and remap fixes the issue which should not exist in the first place\n return (data as any)?.flatMap ? data : _Es2019Array(...data);\n} : _Es2019Array;","/*!\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n/**\n * various environments handle the global variable different\n * we have to deal with this.\n */\nexport function _global$(): any | null {\n let _global$: any = ('undefined' != typeof globalThis && globalThis.window) ? globalThis.window:\n ('undefined' != typeof window) ? window :\n ('undefined' != typeof globalThis) ? globalThis :\n ('undefined' != typeof global && global?.window) ? global.window :\n ('undefined' != typeof global) ? global : null;\n //under test systems we often have a lazy init of the window object under global.window, but we\n //want the window object\n return _global$?.window ?? _global$;\n}\n\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Optional} from \"./Monad\";\nimport {Es2019Array} from \"./Es2019Array\";\n\n/**\n * Lang helpers crossported from the apache myfaces project\n */\nexport namespace Lang {\n\n\n //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those\n /**\n * helper function to safely resolve anything\n * this is not an elvis operator, it resolves\n * a value without exception in a tree and if\n * it is not resolvable then an optional of\n * a default value is restored or Optional.empty\n * if none is given\n *\n * usage\n * <code>\n * let var: Optiona<string> = saveResolve(() => a.b.c.d.e, \"foobaz\")\n * </code>\n *\n * @param resolverProducer a lambda which can produce the value\n * @param defaultValue an optional default value if the producer fails to produce anything\n * @returns an Optional of the produced value\n */\n export function saveResolve<T>(resolverProducer: () => T, defaultValue: T = null): Optional<T> {\n try {\n let result = resolverProducer();\n return Optional.fromNullable(result ?? defaultValue);\n } catch (e) {\n return Optional.absent;\n }\n }\n\n /**\n * lazy resolve... aka the function is called on resolve and a default value also\n * is a producing function (called only if the original producer does not produce any result)\n * @param resolverProducer the producer for the resolve\n * @param defaultValue the default value producer function\n */\n export function saveResolveLazy<T>(resolverProducer: () => T, defaultValue: () => T = null): Optional<T> {\n try {\n let result = resolverProducer();\n return Optional.fromNullable(result ?? defaultValue());\n } catch (e) {\n return Optional.absent;\n }\n }\n\n /**\n * String to array function performs a string to array transformation\n * @param {String} it the string which has to be changed into an array\n * @param {RegExp} splitter our splitter reglar expression\n * @return a trimmed array of the splitted string\n */\n export function strToArray(it: string, splitter: string | RegExp = /\\./gi): Array<string> {\n\n let ret = [];\n it.split(splitter).forEach((element => {\n ret.push(trim(element));\n }));\n return ret;\n }\n\n /**\n * hyperfast trim\n * http://blog.stevenlevithan.com/archives/faster-trim-javascript\n * crossported from dojo\n */\n export function trim(str: string): string {\n str = str.replace(/^\\s\\s*/, '');\n let ws = /\\s/, i = str.length;\n\n while (ws.test(str.charAt(--i))) {\n //do nothing\n }\n return str.slice(0, i + 1);\n }\n\n /**\n * generic object arrays like dom definitions to array conversion method which\n * transforms any object to something array like\n * @param obj\n * @param offset\n * @param pack\n * @returns an array converted from the object\n */\n export function objToArray<T>(obj: any, offset: number = 0, pack: Array<T> = []): Array<T> {\n if ((obj ?? \"__undefined__\") == \"__undefined__\") {\n return pack ?? null;\n }\n //since offset is numeric we cannot use the shortcut due to 0 being false\n //special condition array delivered no offset no pack\n if ((obj) instanceof Array && !offset && !pack as any) return obj;\n\n return new Es2019Array(...pack.concat(Array.prototype.slice.call(obj, offset)));\n }\n\n /**\n * equalsIgnoreCase, case-insensitive comparison of two strings\n *\n * @param source\n * @param destination\n */\n export function equalsIgnoreCase(source?: string, destination?: string): boolean {\n let finalSource = source ?? \"___no_value__\";\n let finalDest = destination ?? \"___no_value__\";\n\n //in any other case we do a strong string comparison\n return finalSource.toLowerCase() === finalDest.toLowerCase();\n }\n\n\n /**\n * runtime type assertion\n *\n * @param probe the probe to be tested for a type\n * @param theType the type to be tested for\n */\n export function assertType(probe: any, theType: any): boolean {\n return isString(theType) ? typeof probe == theType : probe instanceof theType;\n }\n\n /**\n * Back ported from Dojo\n * a failsafe string determination method\n * (since in javascript String != \"\" typeof alone fails!)\n * @param it {|Object|} the object to be checked for being a string\n * @return true in case of being a string false otherwise\n */\n export function isString(it?: any): boolean {\n //\tsummary:\n //\t\tReturn true if it is a String\n return !!arguments.length && it != null && (typeof it == \"string\" || it instanceof String); // Boolean\n }\n\n /**\n * Back-ported, a failsafe determination code for checking whether an object is a function\n * @param it the object to check for being a function\n */\n export function isFunc(it: any): boolean {\n return it instanceof Function || typeof it === \"function\";\n }\n\n // code from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n // license https://creativecommons.org/licenses/by-sa/2.5/\n export function objAssign(target: any, ...theArgs: any) { // .length of function is 2\n if (target == null) { // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n let to = Object(target);\n if((Object).assign as any) {\n theArgs.forEach(item => (Object).assign(to, item) as any);\n return to;\n }\n\n theArgs.filter(item => item != null).forEach(item => {\n let nextSource = item;\n Object.keys(nextSource)\n .filter(nextKey => Object.prototype.hasOwnProperty.call(nextSource, nextKey))\n .forEach(nextKey => to[nextKey] = nextSource[nextKey]);\n });\n return to;\n }\n\n\n}\n\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A module which keeps basic monad like definitions in place\n * Useful if you need the functions in another library to keep its dependencies down\n */\n\n/*IMonad definitions*/\n\nimport {Lang} from \"./Lang\";\nimport {Es2019Array} from \"./Es2019Array\";\n\n\n/**\n * IFunctor interface,\n * defines an interface which allows to map a functor\n * via a first order function to another functor\n */\nexport interface IFunctor<T> {\n map<R>(fn: (data: T) => R): IFunctor<R>;\n}\n\n/**\n * IMonad definition, basically a functor with a flatMap implementation, flatMap reduces all nested monads after a\n * function call f into a monad with the nesting level of 1\n *\n * flatmap flats nested Monads into a IMonad of the deepest nested implementation\n */\nexport interface IMonad<T, M extends IMonad<any, any>> extends IFunctor<T> {\n flatMap<T, M>(f: (T) => M): IMonad<any, any>;\n}\n\n/**\n * a stateful functor which holds a value upn which a\n * function can be applied\n *\n * as value holder of type T\n */\nexport interface IIdentity<T> extends IFunctor<T> {\n readonly value: T;\n}\n\n\n/**\n * custom value holder definition, since we are not pure functional\n * but iterative we have structures which allow the assignment of a value\n * also not all structures are side - effect free\n */\nexport interface IValueHolder<T> {\n value: T | Array<T>;\n}\n\n/**\n * Implementation of a monad\n * (Side - effect free), no write allowed directly on the monads\n * value state\n */\nexport class Monad<T> implements IMonad<T, Monad<any>>, IValueHolder<T> {\n constructor(value: T) {\n this._value = value;\n }\n\n protected _value: T;\n\n get value(): T {\n return this._value;\n }\n\n map<R>(fn?: (data: T) => R): Monad<R> {\n if (!fn) {\n fn = (inVal: any) => <R>inVal;\n }\n let result: R = fn(this.value);\n return new Monad(result);\n }\n\n flatMap<R>(fn?: (data: T) => R): Monad<any> {\n let mapped: Monad<any> = this.map(fn);\n while (mapped?.value instanceof Monad) {\n mapped = mapped.value\n }\n return mapped;\n }\n\n}\n\n/**\n * optional implementation, an optional is basically an implementation of a Monad with additional syntactic\n * sugar on top\n * (Side - effect free, since value assignment is not allowed)\n * */\nexport class Optional<T> extends Monad<T> {\n\n /*default value for absent*/\n static absent = Optional.fromNullable(null);\n\n constructor(value: T) {\n super(value);\n }\n\n get value(): T {\n if (this._value instanceof Monad) {\n return this._value.flatMap().value\n }\n return this._value;\n }\n\n static fromNullable<V extends Optional<T>, T>(value?: T): Optional<T> {\n return <V> new Optional(value);\n }\n\n /*syntactic sugar for absent and present checks*/\n isAbsent(): boolean {\n return \"undefined\" == typeof this.value || null == this.value;\n }\n\n /**\n * any value present\n */\n isPresent(presentRunnable ?: (val ?: Monad<T>) => void): boolean {\n let absent = this.isAbsent();\n if (!absent && presentRunnable) {\n presentRunnable.call(this, this)\n }\n return !absent;\n }\n\n ifPresentLazy(presentRunnable: (val ?: Monad<T>) => void = () => {\n }): Monad<T> {\n this.isPresent.call(this, presentRunnable);\n return this;\n }\n\n orElse(elseValue: any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n //shortcut\n if (elseValue == null) {\n return Optional.absent;\n }\n return this.flatMap(() => elseValue);\n }\n }\n\n /**\n * lazy, passes a function which then is lazily evaluated\n * instead of a direct value\n * @param func\n */\n orElseLazy(func: () => any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n return this.flatMap(func);\n }\n }\n\n /*\n * we need to implement it to fulfill the contract, although it is used only internally\n * all values are flattened when accessed anyway, so there is no need to call this method\n */\n flatMap<R>(fn?: (data: T) => R): Optional<any> {\n let val = super.flatMap(fn);\n if (!(val instanceof Optional)) {\n return Optional.fromNullable(val.value);\n }\n\n return <Optional<any>>val.flatMap();\n }\n\n /*\n * elvis operation, take care, if you use this you lose typesafety and refactoring\n * capabilities, unfortunately typescript does not allow to have its own elvis operator\n * this is some syntactic sugar however which is quite useful*/\n getIf<R>(...key: string[]): Optional<R> {\n\n key = this.preprocessKeys(...key);\n\n let currentPos: Optional<any> = this;\n for (let cnt = 0; cnt < key.length; cnt++) {\n let currKey = this.keyVal(key[cnt]);\n let arrPos = this.arrayIndex(key[cnt]);\n\n if (currKey === \"\" && arrPos >= 0) {\n currentPos = this.getClass().fromNullable(!(currentPos.value instanceof Array) ? null : (currentPos.value.length < arrPos ? null : currentPos.value[arrPos]));\n if (currentPos.isAbsent()) {\n return currentPos;\n }\n continue;\n } else if (currKey && arrPos >= 0) {\n if (currentPos.getIfPresent(currKey).isAbsent()) {\n return currentPos;\n }\n currentPos = (currentPos.getIfPresent(currKey).value instanceof Array) ? this.getClass().fromNullable(currentPos.getIfPresent(currKey).value[arrPos]) : this.getClass().absent;\n if (currentPos.isAbsent()) {\n return currentPos;\n }\n continue;\n\n } else {\n currentPos = currentPos.getIfPresent(currKey);\n }\n if (currentPos.isAbsent()) {\n return currentPos;\n } else if (arrPos > -1) {\n currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);\n }\n }\n return currentPos;\n }\n\n /**\n * simple match, if the first order function call returns\n * true then there is a match, if the value is not present\n * it never matches\n *\n * @param fn the first order function performing the match\n */\n match(fn: (item: T) => boolean): boolean {\n if (this.isAbsent()) {\n return false\n }\n return fn(this.value);\n }\n\n /**\n * convenience function to flatmap the internal value\n * and replace it with a default in case of being absent\n *\n * @param defaultVal\n * @returns {Optional<any>}\n */\n get<R>(defaultVal: any = Optional.absent): Optional<R> {\n if (this.isAbsent()) {\n return this.getClass().fromNullable(defaultVal).flatMap();\n }\n\n return this.getClass().fromNullable(this.value).flatMap();\n }\n\n toJson(): string {\n return JSON.stringify(this.value);\n }\n\n /**\n * helper to override several implementations in a more fluent way\n * by having a getClass operation we can avoid direct calls into the constructor or\n * static methods and do not have to implement several methods which rely on the type\n * of \"this\"\n * @returns the type of Optional\n */\n protected getClass(): any {\n return Optional;\n }\n\n /*helper method for getIf with array access aka <name>[<indexPos>]*/\n protected arrayIndex(key: string): number {\n let start = key.indexOf(\"[\");\n let end = key.indexOf(\"]\");\n if (start >= 0 && end > 0 && start < end) {\n return parseInt(key.substring(start + 1, end));\n } else {\n return -1;\n }\n }\n\n /*helper method for getIf with array access aka <name>[<indexPos>]*/\n protected keyVal(key: string): string {\n let start = key.indexOf(\"[\");\n\n if (start >= 0) {\n return key.substring(0, start);\n } else {\n return key;\n }\n }\n\n /**\n * additional syntactic sugar which is not part of the usual optional implementation\n * but makes life easier, if you want to sacrifice typesafety and refactoring\n * capabilities in typescript\n */\n getIfPresent<R>(key: string): Optional<R> {\n if (this.isAbsent()) {\n return this.getClass().absent;\n }\n return this.getClass().fromNullable(this.value[key]).flatMap();\n }\n\n /**\n * elvis like typesafe functional save resolver\n * a typesafe option for getIfPresent\n *\n * usage myOptional.resolve(value => value.subAttr.subAttr2).orElseLazy(....)\n * if this is resolvable without any errors an Optional with the value is returned\n * if not, then an Optional absent is returned, also if you return Optional absent\n * it is flatmapped into absent\n *\n * @param resolver the resolver function, can throw any arbitrary errors, int the error case\n * the resolution goes towards absent\n */\n resolve<V>(resolver: (item: T) => V): Optional<V> {\n if (this.isAbsent()) {\n return Optional.absent;\n }\n try {\n return Optional.fromNullable(resolver(this.value))\n } catch (e) {\n return Optional.absent;\n }\n }\n\n\n protected preprocessKeys(...keys): string[] {\n return new Es2019Array(...keys)\n .flatMap(item => {\n return new Es2019Array(...item.split(/]\\s*\\[/gi))\n .map(item => {\n item = item.replace(/^\\s+|\\s+$/g, \"\");\n if(item.indexOf(\"[\") == -1 && item.indexOf(\"]\") != -1) {\n item = \"[\" + item;\n }\n if(item.indexOf(\"]\") == -1 && item.indexOf(\"[\") != -1) {\n item = item + \"]\";\n }\n return item;\n })\n });\n }\n}\n\n\n// --------------------- From here onwards we break out the side effect free limits ------------\n\n/**\n * ValueEmbedder is the writeable version\n * of optional, it basically is a wrapper\n * around a construct which has a state\n * and can be written to.\n *\n * For the readonly version see Optional\n */\nexport class ValueEmbedder<T> extends Optional<T> implements IValueHolder<T> {\n\n /*default value for absent*/\n static absent = ValueEmbedder.fromNullable(null);\n\n protected key: string;\n\n constructor(rootElem: any, valueKey: string = \"value\") {\n super(rootElem);\n\n this.key = valueKey;\n }\n\n get value(): T {\n return this._value ? <T>this._value[this.key] : null;\n }\n\n set value(newVal: T) {\n if (!this._value) {\n return;\n }\n this._value[this.key] = newVal\n }\n\n orElse(elseValue: any): Optional<any> {\n let alternative = {};\n alternative[this.key] = elseValue;\n return this.isPresent() ? this : new ValueEmbedder(alternative, this.key);\n }\n\n orElseLazy(func: () => any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n let alternative = {};\n alternative[this.key] = func();\n return new ValueEmbedder(alternative, this.key);\n }\n }\n\n /**\n * helper to override several implementations in a more fluent way\n * by having a getClass operation we can avoid direct calls into the constructor or\n * static methods and do not have to implement several methods which rely on the type\n * of \"this\"\n * @returns ValueEmbedder\n */\n protected getClass(): any {\n return ValueEmbedder;\n }\n\n static fromNullable<V extends Optional<T>,T>(value?: any, valueKey: string = \"value\"): V {\n return <any> new ValueEmbedder<T>(value, valueKey);\n }\n\n}\n\n\n\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DomQuery} from \"./DomQuery\";\nimport {Es2019Array} from \"./Es2019Array\";\nimport {Config} from \"./Config\";\n\n/**\n * special status of the datasource location pointer\n * if an access, outside - of the possible data boundaries is happening\n * (example for instance current without a first next call, or next\n * which goes over the last possible dataset), an iteration status return\n * value is returned marking this boundary instead of a classical element\n *\n * Note this is only internally used but must be implemented to fulfill\n * internal contracts, the end user will never see those values if he uses\n * streams!\n */\nexport enum ITERATION_STATUS {\n EO_STRM = '__EO_STRM__',\n BEF_STRM = '___BEF_STRM__',\n}\n\nexport function calculateSkips(next_strm: IStreamDataSource<any>) {\n let pos = 1;\n while (next_strm.lookAhead(pos) != ITERATION_STATUS.EO_STRM) {\n pos++;\n }\n return --pos;\n}\n\n/**\n * Every data source which feeds data into the lazy stream\n * or stream generally must implement this interface\n *\n * It is basically an iteratable to the core\n */\nexport interface IStreamDataSource<T> {\n\n /**\n * @returns true if additional data is present false if not\n */\n hasNext(): boolean;\n\n /**\n * returns the next element in the stream\n */\n next(): T | ITERATION_STATUS;\n\n /**\n * looks ahead cnt without changing the internal data \"pointers\" of the data source\n * (this is mostly needed by possibly infinite constructs like lazy streams,\n * because they do not know by definition their\n * boundaries)\n *\n * @param cnt the elements to look ahead\n * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before\n * finding the \"cnt\" element\n */\n lookAhead(cnt ?: number): T | ITERATION_STATUS;\n\n /**\n * returns the current element, returns the same element as the previous next call\n * if there is no next before current called then we will call next as initial element\n */\n current(): T | ITERATION_STATUS;\n\n /**\n * resets the position to the beginning\n */\n reset(): void;\n}\n\n/**\n * A collector, needs to be implemented\n */\nexport interface ICollector<T, S> {\n /**\n * this method basically takes a single stream element\n * and does something with it (collecting it one way or the other\n * in most cases)\n *\n * @param element\n */\n collect(element: T);\n\n /**\n * the final result after all the collecting is done\n */\n finalValue: S;\n}\n\n\n/**\n * A data source which combines multiple streams sequentially into one\n * (this is used internally by flatmap, but also can be used externally)\n */\nexport class MultiStreamDatasource<T> implements IStreamDataSource<T> {\n\n private activeStrm;\n private selectedPos = 0;\n private strms;\n\n constructor(private first, ...strms: Array<IStreamDataSource<T>>) {\n this.strms = [first].concat(...strms);\n this.activeStrm = this.strms[this.selectedPos];\n }\n\n current(): any {\n return this.activeStrm.current();\n }\n\n hasNext(): boolean {\n if(this.activeStrm.hasNext()) {\n return true;\n }\n if(this.selectedPos >= this.strms.length) {\n return false;\n }\n return this.findNextStrm() != -1;\n }\n\n private findNextStrm(): number {\n let hasNext = false;\n let cnt = this.selectedPos;\n while(!hasNext && cnt < this.strms.length) {\n hasNext = this.strms[cnt].hasNext();\n if(!hasNext) {\n cnt++;\n }\n }\n return hasNext ? cnt : -1;\n }\n\n lookAhead(cnt: number = 1): T | ITERATION_STATUS {\n //lets clone\n const strms = this.strms.slice(this.selectedPos);\n\n if(!strms.length) {\n return ITERATION_STATUS.EO_STRM;\n }\n\n const all_strms = [...strms];\n while(all_strms.length) {\n let next_strm = all_strms.shift();\n let lookAhead = next_strm.lookAhead(cnt);\n\n if (lookAhead != ITERATION_STATUS.EO_STRM) {\n return lookAhead;\n }\n cnt = cnt - calculateSkips(next_strm);\n }\n return ITERATION_STATUS.EO_STRM;\n }\n\n\n next(): any {\n if(this.activeStrm.hasNext()) {\n return this.activeStrm.next();\n }\n this.selectedPos = this.findNextStrm();\n if(this.selectedPos == -1) {\n return ITERATION_STATUS.EO_STRM;\n }\n this.activeStrm = this.strms[this.selectedPos];\n return this.activeStrm.next();\n }\n\n reset(): void {\n this.activeStrm = this.strms[0];\n this.selectedPos = 0;\n for(let cnt = 0; cnt < this.strms.length; cnt++) {\n this.strms[cnt].reset();\n }\n }\n\n}\n\n/**\n * defines a sequence of numbers for our stream input\n */\nexport class SequenceDataSource implements IStreamDataSource<number> {\n\n start: number;\n total: number;\n value: number;\n\n constructor(start: number, total: number) {\n this.total = total;\n this.start = start;\n this.value = start - 1;\n }\n\n\n hasNext(): boolean {\n return this.value < (this.total - 1);\n }\n\n next(): number | ITERATION_STATUS {\n this.value++;\n return this.value <= (this.total - 1) ? this.value : ITERATION_STATUS.EO_STRM;\n }\n\n lookAhead(cnt = 1): number | ITERATION_STATUS {\n if ((this.value + cnt) > this.total - 1) {\n return ITERATION_STATUS.EO_STRM;\n } else {\n return this.value + cnt;\n }\n }\n\n reset(): void {\n this.value = this.start - 1;\n }\n\n current(): number | ITERATION_STATUS {\n //first condition current without initial call for next\n return (this.start - 1) ? ITERATION_STATUS.BEF_STRM : this.value;\n }\n}\n\n\n/**\n * implementation of a datasource on top of a standard array\n */\nexport class ArrayStreamDataSource<T> implements IStreamDataSource<T> {\n value: Array<T>;\n dataPos = -1;\n\n constructor(...value: Array<T>) {\n this.value = value;\n }\n\n lookAhead(cnt = 1): T | ITERATION_STATUS {\n if ((this.dataPos + cnt) > this.value.length - 1) {\n return ITERATION_STATUS.EO_STRM;\n }\n return this.value[this.dataPos + cnt];\n }\n\n hasNext(): boolean {\n return this.value.length - 1 > this.dataPos;\n }\n\n next(): T | ITERATION_STATUS {\n this.dataPos++;\n return this?.value[this.dataPos] ?? ITERATION_STATUS.EO_STRM;\n }\n\n reset() {\n this.dataPos = -1;\n }\n\n current(): T {\n return this.value[Math.max(0, this.dataPos)];\n }\n}\n\n/**\n * an intermediate data source which prefilters\n * incoming stream data\n * and lets only the data out which\n * passes the filter function check\n */\nexport class FilteredStreamDatasource<T> implements IStreamDataSource<T> {\n\n filterFunc: (T) => boolean;\n inputDataSource: IStreamDataSource<T>;\n\n _current: T | ITERATION_STATUS = ITERATION_STATUS.BEF_STRM;\n // we have to add a filter idx because the external filter values might change over time, so\n // we cannot reset the state properly unless we do it from a snapshot\n _filterIdx = {};\n _unfilteredPos = 0;\n\n constructor(filterFunc: (T) => boolean, parent: IStreamDataSource<T>) {\n this.filterFunc = filterFunc;\n this.inputDataSource = parent;\n }\n\n /**\n * in order to filter we have to make a look ahead until the\n * first next allowed element\n * hence we prefetch the element and then\n * serve it via next\n */\n hasNext(): boolean {\n let steps = 1;\n let found = false;\n let next;\n\n while (!found && (next = this.inputDataSource.lookAhead(steps)) != ITERATION_STATUS.EO_STRM) {\n if (this.filterFunc(next)) {\n this._filterIdx[this._unfilteredPos + steps] = true;\n found = true;\n } else {\n steps++;\n }\n }\n return found;\n }\n\n /**\n * serve the next element\n */\n next(): T | ITERATION_STATUS {\n let found: T | ITERATION_STATUS = ITERATION_STATUS.EO_STRM;\n while (this.inputDataSource.hasNext()) {\n this._unfilteredPos++;\n let next: T = <T>this.inputDataSource.next();\n //again here we cannot call the filter function twice, because its state might change, so if indexed, we have a decent snapshot, either has next or next can trigger\n //the snapshot\n if (next != ITERATION_STATUS.EO_STRM &&\n ((this._filterIdx?.[this._unfilteredPos] ?? false) || this.filterFunc(next))) {\n this._filterIdx[this._unfilteredPos] = true;\n found = next;\n break;\n }\n }\n this._current = found as T;\n return found;\n }\n\n /**\n * looks ahead cnt without changing the internal data \"pointers\" of the data source\n * (this is mostly needed by LazyStreams, because they do not know by definition their\n * boundaries)\n *\n * @param cnt the elements to look ahead\n * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before\n * finding the \"cnt\" element\n */\n lookAhead(cnt = 1): ITERATION_STATUS | T {\n let lookupVal: T | ITERATION_STATUS;\n\n for (let loop = 1; cnt > 0 && (lookupVal = this.inputDataSource.lookAhead(loop)) != ITERATION_STATUS.EO_STRM; loop++) {\n let inCache = this._filterIdx?.[this._unfilteredPos + loop];\n if (inCache || this.filterFunc(lookupVal)) {\n cnt--;\n this._filterIdx[this._unfilteredPos + loop] = true;\n }\n }\n return lookupVal;\n }\n\n current(): T | ITERATION_STATUS {\n return this._current;\n }\n\n reset(): void {\n this._current = ITERATION_STATUS.BEF_STRM;\n this._filterIdx = {};\n this._unfilteredPos = 0;\n this.inputDataSource.reset();\n }\n}\n\n/**\n * an intermediate datasource which maps the items from\n * one into another\n */\nexport class MappedStreamDataSource<T, S> implements IStreamDataSource<S> {\n\n mapFunc: (T) => S;\n inputDataSource: IStreamDataSource<T>;\n\n constructor(mapFunc: (T) => S, parent: IStreamDataSource<T>) {\n this.mapFunc = mapFunc;\n this.inputDataSource = parent;\n }\n\n hasNext(): boolean {\n return this.inputDataSource.hasNext();\n }\n\n next(): S {\n return this.mapFunc(this.inputDataSource.next());\n }\n\n reset(): void {\n this.inputDataSource.reset();\n }\n\n current(): S {\n return this.mapFunc(this.inputDataSource.current());\n }\n\n lookAhead(cnt = 1): ITERATION_STATUS | S {\n const lookAheadVal = this.inputDataSource.lookAhead(cnt);\n return (lookAheadVal == ITERATION_STATUS.EO_STRM) ? lookAheadVal as ITERATION_STATUS : this.mapFunc(lookAheadVal) as S;\n }\n}\n\n\n/**\n * For the time being we only need one collector\n * a collector which collects a stream back into arrays\n */\nexport class ShimArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = new Es2019Array(...[]);\n\n collect(element: S) {\n this.data.push(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n\n/**\n * collects the values as inverse array\n */\nexport class InverseArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = [];\n\n collect(element: S) {\n this.data.unshift(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n\n\n/**\n * collects an tuple array stream into an assoc array with elements being collected into arrays\n *\n */\nexport class ArrayAssocArrayCollector<S> implements ICollector<[string, S] | string, { [key: string]: S }> {\n finalValue: { [key: string]: any } = {};\n\n collect(element: [string, S] | string) {\n let key = element?.[0] ?? <string>element;\n this.finalValue[key] = this.finalValue?.[key] ?? [];\n this.finalValue[key].push(element?.[1] ?? true);\n }\n}\n\n/**\n * dummy collector which just triggers a run\n * on lazy streams without collecting anything\n */\nexport class Run<S> implements ICollector<S, any> {\n collect(element: S) {\n\n }\n\n get finalValue(): any {\n return null;\n }\n}\n\n/**\n * collects an assoc stream back to an assoc array\n */\nexport class AssocArrayCollector<S> implements ICollector<[string, S] | string, { [key: string]: S }> {\n\n finalValue: { [key: string]: any } = {};\n\n collect(element: [string, S] | string) {\n this.finalValue[element[0] ?? <string>element] = element[1] ?? true;\n }\n}\n\n\n/**\n * A Config collector similar to the FormDFata Collector\n */\nexport class ConfigCollector implements ICollector<{ key: string, value: any }, Config> {\n finalValue: Config = new Config({});\n\n collect(element: { key: string; value: any }) {\n this.finalValue.append(element.key).value = element.value;\n }\n}\n\n\n/**\n * Form data collector for key value pair streams\n */\nexport class FormDataCollector implements ICollector<{ key: string, value: any }, FormData> {\n finalValue: FormData = new FormData();\n\n collect(element: { key: string; value: any }) {\n this.finalValue.append(element.key, element.value);\n }\n}\n\n/**\n * Form data collector for DomQuery streams\n */\nexport class QueryFormDataCollector implements ICollector<DomQuery, FormData> {\n finalValue: FormData = new FormData();\n\n collect(element: DomQuery) {\n let toMerge = element.encodeFormElement();\n if (toMerge.isPresent()) {\n this.finalValue.append(element.name.value, toMerge.get(element.name).value);\n }\n }\n}\n\n/**\n * Encoded String collector from dom query streams\n */\nexport class QueryFormStringCollector implements ICollector<DomQuery, string> {\n\n formData: [[string, string]] = <any>[];\n\n collect(element: DomQuery) {\n let toMerge = element.encodeFormElement();\n if (toMerge.isPresent()) {\n this.formData.push([element.name.value, toMerge.get(element.name).value]);\n }\n }\n\n get finalValue(): string {\n return new Es2019Array(...this.formData)\n .map(keyVal => keyVal.join(\"=\"))\n .reduce((item1, item2) => [item1, item2].join(\"&\"));\n }\n}\n\n/**\n * For the time being we only need one collector\n * a collector which collects a stream back into arrays\n */\nexport class ArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = [];\n\n collect(element: S) {\n this.data.push(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Lang} from \"./Lang\";\nimport {DomQuery} from \"./DomQuery\";\nconst isString = Lang.isString;\nimport {_global$} from \"./Global\";\n\ndeclare let ActiveXObject: any;\n\n/**\n * xml query as specialized case for DomQuery\n */\nexport class XMLQuery extends DomQuery {\n\n constructor(rootNode: Document | string | DomQuery, docType: string = \"text/xml\") {\n\n let createIe11DomQueryShim = (): DOMParser => {\n //at the time if wroting ie11 is the only relevant browser\n //left withut any DomQuery support\n let parser = new ActiveXObject(\"Microsoft.XMLDOM\");\n parser.async = false;\n //we shim th dom parser from ie in\n return <any>{\n parseFromString: (text: string, contentType: string): Document => {\n return parser.loadXML(text);\n }\n }\n };\n\n let parseXML = (xml: string): Document => {\n if (xml == null) {\n return null;\n }\n let domParser: DOMParser = Lang.saveResolveLazy<DOMParser>(\n () => new (_global$()).DOMParser(),\n (): DOMParser => createIe11DomQueryShim()\n ).value;\n return domParser.parseFromString(xml, <any> docType);\n };\n\n if (isString(rootNode)) {\n super(parseXML(<string>rootNode))\n } else {\n super(rootNode);\n }\n }\n\n isXMLParserError(): boolean {\n return this.querySelectorAll(\"parsererror\").isPresent();\n }\n\n toString(): string {\n let ret = [];\n this.eachElem((node: any) => {\n let serialized = (_global$())?.XMLSerializer?.constructor()?.serializeToString(node) ?? node?.xml;\n if (!!serialized) {\n ret.push(serialized);\n }\n });\n return ret.join(\"\");\n }\n\n parserErrorText(joinstr: string): string {\n return this.querySelectorAll(\"parsererror\").textContent(joinstr);\n }\n\n static parseXML(txt: string): XMLQuery {\n return new XMLQuery(txt);\n }\n\n static parseHTML(txt: string): XMLQuery {\n return new XMLQuery(txt, \"text/html\");\n }\n\n static fromString(txt: string, parseType: string = \"text/xml\"): XMLQuery {\n return new XMLQuery(txt, parseType);\n }\n}\n\nexport const XQ = XMLQuery;\nexport type XQ = XMLQuery;","/*!\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nexport {DomQuery, ElementAttribute, DomQueryCollector, DQ, DQ$} from \"./DomQuery\";\nexport {IDomQuery} from \"./IDomQuery\";\nexport {Lang} from \"./Lang\";\nexport {Monad, IValueHolder, IFunctor, IMonad, IIdentity, Optional, ValueEmbedder} from \"./Monad\";\nexport {XMLQuery, XQ} from \"./XmlQuery\";\nexport {assign, assignIf, append, simpleShallowMerge, shallowMerge} from \"./AssocArray\"\nexport {Config} from \"./Config\";\nexport {ConfigDef} from \"./Config\";\nexport {CONFIG_ANY} from \"./Config\";\nexport {CONFIG_VALUE} from \"./Config\";\nexport * as Assoc from \"./AssocArray\";\nexport {Es2019Array, _Es2019Array} from \"./Es2019Array\";\n\n\n\n\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Implementation} from \"../impl/AjaxImpl\";\nimport {PushImpl} from \"../impl/PushImpl\";\nimport {oam as _oam} from \"../myfaces/OamSubmit\";\nimport {$nsp, CTX_OPTIONS_EXECUTE, CTX_OPTIONS_PARAMS, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from \"../impl/core/Const\";\nimport {ErrorData} from \"../impl/xhrCore/ErrorData\";\nimport {EventData} from \"../impl/xhrCore/EventData\";\n\n//we use modules to get a proper jsdoc and static/map structure in the calls\n//as per spec requirement\nexport namespace faces {\n\n\n /**\n * Version of the implementation for the faces.ts.\n * <p />\n * as specified within the jsf specifications faces.html:\n * <ul>\n * <li>left two digits major release number</li>\n * <li>middle two digits minor spec release number</li>\n * <li>right two digits bug release number</li>\n * </ul>\n */\n export var specversion = 400000;\n /**\n * Implementation version as specified within the jsf specification.\n * <p />\n * A number increased with every implementation version\n * and reset by moving to a new spec release number\n *\n */\n export var implversion = 0;\n\n /**\n * SeparatorChar as defined by facesContext.getNamingContainerSeparatorChar()\n */\n export var separatorchar: string = getSeparatorChar();\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Context Path as defined externalContext.requestContextPath\n */\n export var contextpath: string = '#{facesContext.externalContext.requestContextPath}';\n // we do not have a fallback here, for now\n\n /**\n * This method is responsible for the return of a given project stage as defined\n * by the jsf specification.\n * <p/>\n * Valid return values are:\n * <ul>\n * <li>&quot;Production&quot;</li>\n * <li>&quot;Development&quot;</li>\n * <li>&quot;SystemTest&quot;</li>\n * <li>&quot;UnitTest&quot;</li>\n * </li>\n *\n * @return {String} the current project state emitted by the server side method:\n * <i>jakarta.faces.application.Application.getProjectStage()</i>\n */\n export function getProjectStage(): string {\n return Implementation.getProjectStage();\n }\n\n /**\n * collect and encode data for a given form element (must be of type form)\n * find the jakarta.faces.ViewState element and encode its value as well!\n * return a concatenated string of the encoded values!\n *\n * @throws an exception in case of the given element not being of type form!\n * https://issues.apache.org/jira/browse/MYFACES-2110\n */\n export function getViewState(formElement: Element | string): string {\n return Implementation.getViewState(formElement);\n }\n\n /**\n * returns the window identifier for the given node / window\n * @return the window identifier or null if none is found\n * @param rootNode\n */\n export function getClientWindow(rootNode?: Element | string): string {\n return Implementation.getClientWindow(rootNode);\n }\n\n // private helper functions\n function getSeparatorChar(): string {\n const sep = '#{facesContext.namingContainerSeparatorChar}';\n //We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior\n //the idea is that the separator char is provided from the underlying container, but if not then we\n //will perform a fallback (aka 2.3 has the url fallback behavior)\n return (sep.match(/\\#\\{facesContext.namingContainerSeparatorChar\\}/gi)) ? Implementation.getSeparatorChar() : sep;\n }\n\n\n\n\n export namespace ajax {\n \"use strict\";\n\n /**\n * this function has to send the ajax requests\n *\n * following request conditions must be met:\n * <ul>\n * <li> the request must be sent asynchronously! </li>\n * <li> the request must be a POST!!! request </li>\n * <li> the request url must be the form action attribute </li>\n * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>\n * </ul>\n *\n * @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted\n * @param {EVENT} event: any javascript event supported by that object\n * @param {Map} options : map of options being pushed into the ajax cycle\n */\n export function request(element: Element, event?: Event, options?: Options): void {\n Implementation.request(element, event, options)\n }\n\n /**\n * response handler\n * @param request the request object having triggered this response\n * @param context the request context\n *\n */\n export function response(request: XMLHttpRequest, context?: Context): void {\n Implementation.response(request, context);\n }\n\n /**\n * Adds an error handler to our global error queue.\n * the error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>\n * with errorData being of following format:\n * <ul>\n * <li> errorData.type : &quot;error&quot;</li>\n * <li> errorData.status : the error status message</li>\n * <li> errorData.serverErrorName : the server error name in case of a server error</li>\n * <li> errorData.serverErrorMessage : the server error message in case of a server error</li>\n * <li> errorData.source : the issuing source element which triggered the request </li>\n * <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>\n * <li> eventData.responseText: the request response text </li>\n * <li> eventData.responseXML: the request response xml </li>\n * </ul>\n *\n * @param errorFunc error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>\n */\n export function addOnError(errorFunc: (data: ErrorData) => void): void {\n Implementation.addOnError(errorFunc as any);\n }\n\n /**\n * Adds a global event listener to the ajax event queue. The event listener must be a function\n * of following format: <i>function eventListener(&lt;eventData&gt;)</i>\n *\n * @param eventFunc event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>\n */\n export function addOnEvent(eventFunc: (data: EventData) => void): void {\n Implementation.addOnEvent(eventFunc as any);\n }\n }\n\n export namespace util {\n\n /**\n * varargs function which executes a chain of code (functions or any other code)\n *\n * if any of the code returns false, the execution\n * is terminated prematurely skipping the rest of the code!\n *\n * @param {HTMLElement | String} source, the callee object\n * @param {Event} event, the event object of the callee event triggering this function\n * @param funcs ... arbitrary array of functions or strings\n * @returns true if the chain has succeeded false otherwise\n */\n export function chain(source: HTMLElement | string, event: Event | null, ...funcs: Array<Function | string>): boolean {\n return Implementation.chain(source, event, ...(funcs as EvalFuncs));\n }\n }\n\n export namespace push {\n /**\n * @param socketClientId the sockets client identifier\n * @param url the uri to reach the socket\n * @param channel the channel name/id\n * @param onopen The function to be invoked when the web socket is opened.\n * @param onmessage The function to be invoked when a message is received.\n * @param onerror The function to be invoked when an error occurs.\n * @param onclose The function to be invoked when the web socket is closed.\n * @param behaviors functions which are invoked whenever a message is received\n * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.\n */\n export function init(socketClientId: string,\n url: string,\n channel: string,\n onopen: Function,\n onmessage: Function,\n onerror: Function,\n onclose: Function,\n behaviors: any,\n autoConnect: boolean): void {\n PushImpl.init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect);\n }\n\n /**\n * Open the web socket on the given channel.\n * @param socketClientId The name of the web socket channel.\n * @throws Error is thrown, if the channel is unknown.\n */\n export function open(socketClientId: string): void {\n PushImpl.open(socketClientId);\n }\n\n /**\n * Close the web socket on the given channel.\n * @param socketClientId The id of the web socket client.\n * @throws Error is thrown, if the channel is unknown.\n */\n export function close(socketClientId: string): void {\n PushImpl.close(socketClientId);\n }\n\n }\n}\n\nexport namespace myfaces {\n /**\n * AB function similar to mojarra and Primefaces\n * not part of the spec but a convenience accessor method\n * Code provided by Thomas Andraschko\n *\n * @param source the event source\n * @param event the event\n * @param eventName event name for java.jakarta.faces.behavior.event\n * @param execute execute list as passed down in faces.ajax.request\n * @param render the render list as string\n * @param options the options which need to be merged in\n * @param userParameters a set of user parameters which go into the final options under params, they can override whatever is passed via options\n */\n export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Options = {}, userParameters: Options = {}): void {\n if(!options) {\n options = {};\n }\n if(!userParameters) {\n userParameters = {};\n }\n if (eventName) {\n options[CTX_OPTIONS_PARAMS] = options?.[CTX_OPTIONS_PARAMS] ?? {};\n options[CTX_OPTIONS_PARAMS][$nsp(P_BEHAVIOR_EVENT)] = eventName;\n }\n if (execute) {\n options[CTX_OPTIONS_EXECUTE] = execute;\n }\n if (render) {\n options[CTX_PARAM_RENDER] = render;\n }\n\n //we push the users parameters in\n if (!options[\"params\"]) {\n options[\"params\"] = {};\n }\n\n for (let key in userParameters) {\n options[\"params\"][key] = userParameters[key];\n }\n\n (window?.faces ?? window.jsf).ajax.request(source, event, options);\n }\n\n\n const onReadyChain: Array<() => void> = [];\n let readyStateListener = null;\n // noinspection JSUnusedGlobalSymbols\n /**\n * Helper function in the myfaces namespace to handle document ready properly for the load case\n * the ajax case, does not need proper treatment, since it is deferred anyway.\n * Used by command script as helper function!\n *\n * @param executionFunc the function to be executed upon ready\n */\n export function onDomReady(executionFunc: () => void) {\n if(document.readyState !== \"complete\") {\n onReadyChain.push(executionFunc);\n if(!readyStateListener) {\n readyStateListener = () => {\n window.removeEventListener(\"DOMContentLoaded\", readyStateListener);\n readyStateListener = null;\n try {\n onReadyChain.forEach(func => func());\n } finally {\n //done we clear now the ready chain\n onReadyChain.length = 0;\n }\n };\n window.addEventListener(\"DOMContentLoaded\", readyStateListener);\n }\n } else {\n if(readyStateListener) {\n readyStateListener();\n }\n executionFunc();\n }\n\n }\n\n /**\n * reserve a namespace for the given string\n * @param namespace the namespace to reserve with '.' as separator\n */\n export function reserveNamespace(namespace: string): void {\n let current: any = window;\n const namespaces = namespace.split(\".\");\n for(const part of namespaces) {\n current[part] = current[part] || {};\n current = current[part];\n }\n }\n\n /**\n * legacy oam functions\n */\n export const oam = _oam;\n}\n\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {IListener} from \"./util/IListener\";\nimport {Response} from \"./xhrCore/Response\";\nimport {XhrRequest} from \"./xhrCore/XhrRequest\";\nimport {Config, DQ, DQ$, Lang, Optional} from \"mona-dish\";\nimport {Assertions} from \"./util/Assertions\";\nimport {ExtConfig, ExtDomQuery} from \"./util/ExtDomQuery\";\nimport {ErrorData} from \"./xhrCore/ErrorData\";\nimport {EventData} from \"./xhrCore/EventData\";\nimport {ExtLang} from \"./util/Lang\";\n\nimport {\n CTX_OPTIONS_EXECUTE,\n CTX_PARAM_REQ_PASS_THR,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_SRC_FRM_ID,\n IDENT_ALL,\n IDENT_FORM,\n IDENT_NONE,\n IDENT_THIS,\n MYFACES,\n ON_ERROR,\n ON_EVENT,\n P_AJAX,\n P_CLIENT_WINDOW,\n P_EVT,\n P_EXECUTE,\n P_AJAX_SOURCE,\n P_RENDER,\n P_RESET_VALUES,\n P_WINDOW_ID,\n CTX_PARAM_RENDER,\n SOURCE,\n HTML_TAG_FORM,\n CTX_OPTIONS_PARAMS,\n VIEW_ID,\n $faces,\n EMPTY_STR,\n NAMED_VIEWROOT,\n NAMING_CONTAINER_ID,\n CTX_PARAM_PPS,\n MYFACES_OPTION_PPS,\n $nsp,\n CTX_PARAM_UPLOAD_ON_PROGRESS,\n CTX_PARAM_UPLOAD_PREINIT,\n CTX_PARAM_UPLOAD_LOADSTART,\n CTX_PARAM_UPLOAD_LOADEND,\n CTX_PARAM_UPLOAD_LOAD, CTX_PARAM_UPLOAD_ERROR, CTX_PARAM_UPLOAD_ABORT, CTX_PARAM_UPLOAD_TIMEOUT\n} from \"./core/Const\";\nimport {\n resolveDefaults,\n resolveDelay,\n resolveForm,\n resolveTimeout, resolveViewId, resolveViewRootId, resoveNamingContainerMapper\n} from \"./xhrCore/RequestDataResolver\";\nimport {encodeFormData} from \"./util/FileUtils\";\nimport {XhrQueueController} from \"./util/XhrQueueController\";\n\n/*\n * allowed project stages\n */\nenum ProjectStages {\n Production = \"Production\",\n Development = \"Development\",\n SystemTest = \"SystemTest\",\n UnitTest = \"UnitTest\"\n}\n\n/*\n * Block-filter for the pass-through filtering; the attributes given here\n * will not be transmitted from the options into the pass-through\n */\nenum BlockFilter {\n onerror = \"onerror\",\n onevent = \"onevent\",\n render = \"render\",\n execute = \"execute\",\n myfaces = \"myfaces\",\n delay = \"delay\",\n timeout = \"timeout\",\n resetValues = \"resetValues\",\n windowId = \"windowId\",\n params = \"params\"\n}\n\n\n\n/**\n * Core Implementation\n * to distinct between api and impl\n *\n * The original idea was to make the implementation pluggable\n * but this is pointless, you always can overwrite the thin api layer\n * however a dedicated api makes sense for readability reasons\n */\nexport namespace Implementation {\n /*\n Small internal explanation, this code is optimized for readability\n and cuts off a ton of old legacy code.\n Aka older browsers are not supported anymore.\n We use a self written helper library to keep the number of external\n code dependencies down.\n The library is called mona-dish and started as a small sideproject of mine\n it provides following\n\n a) Monad like structures for querying because this keeps the code denser and adds abstractions\n that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides\n\n c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be\n transformed into different data representations\n\n examples:\n internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;\n passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID\n\n basically an abbreviation for\n\n internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;\n\n\n internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;\n passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored\n\n abbreviates:\n if(condition) {\n internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;\n }\n\n\n d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish\n\n Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use\n\n */\n\n const trim = Lang.trim;\n const getMessage = ExtLang.getMessage;\n const getGlobalConfig = ExtLang.getGlobalConfig;\n import assert = Assertions.assert;\n const ofAssoc = ExtLang.ofAssoc;\n const collectAssoc = ExtLang.collectAssoc;\n\n let projectStage: string = null;\n let separator: string = null;\n let eventQueue = [];\n let errorQueue = [];\n export let requestQueue: XhrQueueController<XhrRequest> = null;\n /*error reporting threshold*/\n let threshold = \"ERROR\";\n\n /**\n * fetches the separator char from the given script tags\n *\n * @return {string} the separator char for the given script tags\n */\n export function getSeparatorChar(): string {\n return resolveGlobalConfig()?.separator ??\n (separator ??= ExtDomQuery.searchJsfJsFor(/separator=([^&;]*)/).orElse(\":\").value);\n }\n\n /**\n * this is for testing purposes only, since AjaxImpl is a module\n * we need to reset for every unit test its internal states\n */\n export function reset() {\n projectStage = null;\n separator = null;\n eventQueue = [];\n errorQueue = [];\n requestQueue = null;\n }\n\n /**\n * @return the project stage also emitted by the server:\n * it cannot be cached and must be delivered over the server\n * The value for it comes from the requestInternal parameter of the faces.js script called \"stage\".\n */\n export function getProjectStage(): string | null {\n return resolveGlobalConfig()?.projectStage ??\n (projectStage ??= resolveProjectStateFromURL());\n }\n\n /**\n * resolves the project stage as url parameter\n * @return the project stage or null\n */\n export function resolveProjectStateFromURL(): string | null {\n\n /* run through all script tags and try to find the one that includes faces.js */\n const foundStage = ExtDomQuery.searchJsfJsFor(/stage=([^&;]*)/).value as string;\n return (foundStage in ProjectStages) ? foundStage : ProjectStages.Production; // MYFACES-4572: default is production\n }\n\n /**\n * implementation of the faces.util.chain functionality\n *\n * @param source\n * @param event\n * @param funcs\n */\n export function chain(source: any, event: Event, ...funcs: EvalFuncs): boolean {\n // we can use our lazy stream each functionality to run our chain here.\n // by passing a boolean as return value into the onElem call\n // we can stop early at the first false, just like the spec requests\n\n let ret = true;\n funcs.every(func => {\n let returnVal = resolveAndExecute(source, event, func);\n if(returnVal === false) {\n ret = false;\n }\n //we short circuit in case of false and break the every loop\n return ret;\n });\n return ret;\n\n }\n\n /**\n * this function has to send the ajax requests\n *\n * following request conditions must be met:\n * <ul>\n * <li> the request must be sent asynchronously! </li>\n * <li> the request must be a POST!!! request </li>\n * <li> the request url must be the form action attribute </li>\n * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>\n * </ul>\n *\n * @param el any dom element no matter being it html or jsf, from which the event is emitted\n * @param event any javascript event supported by that object\n * @param opts map of options being pushed into the ajax cycle\n *\n * a) transformArguments out of the function\n * b) passThrough handling with a map copy with a filter map block map\n */\n export function request(el: ElemDef, event?: Event, opts ?: Options) {\n\n const {\n options,\n elem,\n elementId,\n windowId,\n isResetValues\n } = resolveDefaults(event, opts, el);\n const requestCtx = new ExtConfig({});\n const internalCtx = new ExtConfig({});\n\n Assertions.assertRequestIntegrity(options, elem);\n\n /**\n * fetch the parent form\n *\n * note we also add an override possibility here\n * so that people can use dummy forms and work\n * with detached objects\n */\n const form: DQ = resolveForm(elem, event);\n const viewId: string = resolveViewId(form);\n const formId = form.id.value;\n const delay: number = resolveDelay(options);\n const timeout: number = resolveTimeout(options);\n\n requestCtx.assignIf(!!windowId, P_WINDOW_ID).value = windowId;\n\n // old non - spec behavior will be removed after it is clear whether the removal breaks any code\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);\n\n // spec conform behavior, all passthrough params must be under \"passthrough\n const params = remapArrayToAssocArr(options.getIf(CTX_OPTIONS_PARAMS).orElse({}).value);\n //we turn off the remapping for the param merge, because we do not want to have\n //any namespacing to be remapped\n\n let ctxPassthrough = requestCtx.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;\n ctxPassthrough.$nspEnabled = false;\n ctxPassthrough.shallowMerge(new Config(params), true);\n //now we turn it on again\n ctxPassthrough.$nspEnabled = true;\n requestCtx.assignIf(!!event, CTX_PARAM_REQ_PASS_THR, P_EVT).value = event?.type;\n\n /**\n * ajax pass through context with the source\n * onresolved Event and onerror Event\n */\n requestCtx.assign(SOURCE).value = elementId;\n\n requestCtx.assign(VIEW_ID).value = viewId;\n\n /**\n * on resolvedEvent and onError...\n * those values will be traversed later on\n * also into the response context\n */\n requestCtx.assign(ON_EVENT).value = options.value?.onevent;\n requestCtx.assign(ON_ERROR).value = options.value?.onerror;\n\n /**\n * Fetch the myfaces config params\n */\n requestCtx.assign(MYFACES).value = options.value?.myfaces;\n\n /**\n * binding contract the jakarta.faces.source must be set\n */\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_AJAX_SOURCE).value = elementId;\n\n /**\n * jakarta.faces.partial.ajax must be set to true\n */\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_AJAX).value = true;\n\n /**\n * if resetValues is set to true\n * then we have to set jakarta.faces.resetValues as well\n * as pass through parameter\n * the value has to be explicitly true, according to\n * the specs jsdoc\n */\n requestCtx.assignIf(isResetValues, CTX_PARAM_REQ_PASS_THR, P_RESET_VALUES).value = true;\n\n // additional meta information to speed things up, note internal non jsf\n // pass through options are stored under _mfInternal in the context\n internalCtx.assign(CTX_PARAM_SRC_FRM_ID).value = formId;\n\n /**\n * special myfaces only internal parameter for onProgress until we have an official api\n * that way we can track the progress of a xhr request (useful for file uploads)\n */\n internalCtx.assign(CTX_PARAM_UPLOAD_PREINIT).value = options.value?.myfaces?.upload?.preinit;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOADSTART).value = options.value?.myfaces?.upload?.loadstart;\n internalCtx.assign(CTX_PARAM_UPLOAD_ON_PROGRESS).value = options.value?.myfaces?.upload?.progress;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOADEND).value = options.value?.myfaces?.upload?.loadend;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOAD).value = options.value?.myfaces?.upload?.load;\n internalCtx.assign(CTX_PARAM_UPLOAD_ERROR).value = options.value?.myfaces?.upload?.error;\n internalCtx.assign(CTX_PARAM_UPLOAD_ABORT).value = options.value?.myfaces?.upload?.abort;\n internalCtx.assign(CTX_PARAM_UPLOAD_TIMEOUT).value = options.value?.myfaces?.upload?.timeout;\n\n // mojarra compatibility, mojarra is sending the form id as well\n // this is not documented behavior but can be determined by running\n // mojarra under blackbox conditions.\n // I assume it does the same as our formId_submit=1 so leaving it out\n // won't hurt but for the sake of compatibility we are going to add it\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, formId).value = formId;\n internalCtx.assign(CTX_PARAM_SRC_CTL_ID).value = elementId;\n // reintroduction of PPS as per myfaces 2.3 (myfaces.pps = true, only the executes are submitted)\n internalCtx.assign(CTX_PARAM_PPS).value = extractMyFacesParams(options.value)?.[MYFACES_OPTION_PPS] ?? false;\n\n\n assignClientWindowId(form, requestCtx);\n assignExecute(options, requestCtx, form, elementId);\n assignRender(options, requestCtx, form, elementId);\n assignNamingContainerData(internalCtx, form);\n\n //now we enqueue the request as asynchronous runnable into our request\n //queue and let the queue take over the rest\n queueHandler.addRequestToQueue(elem, form, requestCtx, internalCtx, delay, timeout);\n }\n\n /**\n * Spec. 13.3.3\n * Examining the response markup and updating the DOM tree\n * @param {XMLHttpRequest} request - the ajax request\n * @param {Object} context - the ajax context\n */\n export function response(request: XMLHttpRequest, context: Context) {\n Response.processResponse(request, context);\n }\n\n /**\n * adds an error handler to the error queue\n *\n * @param errorListener the error listener handler\n */\n export function addOnError(errorListener: IListener<ErrorData>) {\n errorQueue.push(errorListener);\n }\n\n /**\n * adds an event handler to the event queue\n *\n * @param eventListener the event listener handler\n */\n export function addOnEvent(eventListener: IListener<EventData>) {\n eventQueue.push(eventListener);\n }\n\n // noinspection JSUnusedLocalSymbols\n /**\n * sends an event to the event handlers\n *\n * @param data the event data object hosting the event data according to the spec @see EventData for what is reachable\n * @param localHandler an optional event handler, which is processed before the event handler chain\n */\n export function sendEvent(data: EventData, localHandler = function (data: EventData) {\n }) {\n /*now we serve the queue as well*/\n localHandler(data);\n eventQueue.forEach(fn => fn(data));\n }\n\n /**\n * error handler behavior called internally\n * and only into the impl it takes care of the\n * internal message transformation to a myfaces internal error\n * and then uses the standard send error mechanisms\n * also a double error logging prevention is done as well\n *\n * @param request the request currently being processed\n * @param context the context affected by this error\n * @param exception the exception being thrown\n * @param clearRequestQueue if set to true, clears the request queue of all pending requests\n */\n export function stdErrorHandler(request: XMLHttpRequest,\n context: Config,\n exception: Error,\n clearRequestQueue = false) {\n //newer browsers do not allow to hold additional values on native objects like exceptions\n //we hence capsule it into the request, which is gced automatically\n //on ie as well, since the stdErrorHandler usually is called between requests\n //this is a valid approach\n try {\n if (threshold == \"ERROR\") {\n let errorData = ErrorData.fromClient(exception);\n sendError(errorData);\n }\n } finally {\n if (clearRequestQueue) {\n requestQueue.clear();\n }\n }\n }\n\n // noinspection JSUnusedLocalSymbols\n /**\n * implementation triggering the error chain\n *\n *\n *\n * handles the errors, in case of an onError exists within the context the onError is called as local error handler\n * the registered error handlers in the queue received an error message to be dealt with\n * and if the projectStage is at development an alert box is displayed\n *\n * note: we have additional functionality here, via the global config myfaces.config.defaultErrorOutput a function can be provided\n * which changes the default output behavior from alert to something else\n *\n * @param errorData the error data to be displayed\n * @param localHandler an optional local error handler which has to be processed before the error handler queue\n */\n export function sendError(errorData: ErrorData, localHandler = function (data: ErrorData) {\n }) {\n\n localHandler(errorData);\n errorQueue.forEach((errorCallback: Function) => {\n errorCallback(errorData);\n });\n let displayError: (string) => void = getGlobalConfig(\"defaultErrorOutput\", (console ? console.error : alert));\n displayError(errorData);\n }\n\n /**\n * @node optional element or id defining a rootnode where an element with the id \"jakarta.faces.windowId\" is hosted\n * @return the client window id of the current window, if one is given if none is found, null is returned\n */\n export function getClientWindow(node ?: Element | string): string | null {\n const ALTERED = \"___mf_id_altered__\";\n const INIT = \"___init____\";\n\n /*\n * the search root for the dom element search\n */\n\n\n let searchRoot = ((node) ? DQ.byId(node): DQ$(\"form\"));\n let inputs = searchRoot\n .filterSelector(`input[name='${$nsp(P_CLIENT_WINDOW)}']`)\n .orElseLazy(() => searchRoot.querySelectorAll(`input[name='${$nsp(P_CLIENT_WINDOW)}']`))\n\n /*\n * lazy helper to fetch the window id from the included faces.js\n */\n let fetchWindowIdFromJSFJS = (): Optional<string> => ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null);\n\n /*\n * fetch window id from the url\n */\n let fetchWindowIdFromURL = function (): Optional<string> {\n const href = window.location.href, windowId = \"jfwid\";\n const regex = new RegExp(\"[\\\\?&]\" + windowId + \"=([^&#\\\\;]*)\");\n const results = regex.exec(href);\n //initial trial over the url and a regexp\n if (results != null) return Optional.fromNullable(results[1]);\n return Optional.fromNullable(null);\n };\n\n /*\n * functional double check based on stream reduction\n * the values should be identical or on INIT value which is a premise to\n * skip the first check\n *\n * @param value1\n * @param value2\n */\n let differenceCheck = (value1: string, value2: string): string => {\n if(value1 == INIT) {\n return value2;\n } else if (value1 == ALTERED || value1 != value2) {\n return ALTERED;\n }\n return value2;\n };\n\n /*\n * helper for cleaner code, maps the value from an item\n *\n * @param item\n */\n let getValue = (item: DQ): string => item.val as string;\n /*\n * fetch the window id from the forms\n * window ids must be present in all forms\n * or non-existent. If they exist all of them must be the same\n */\n\n let formWindowId: string = inputs.asArray.map(getValue).reduce(differenceCheck, INIT);\n\n\n //if the resulting window id is set on altered then we have an unresolvable problem\n assert(ALTERED != formWindowId, \"Multiple different windowIds found in document\");\n\n /*\n * return the window id or null\n */\n return formWindowId != INIT ? formWindowId : (fetchWindowIdFromURL() || fetchWindowIdFromJSFJS()).value;\n }\n\n /**\n * collect and encode data for a given form element (must be of type form)\n * find the jakarta.faces.ViewState element and encode its value as well!\n * @return a concatenated string of the encoded values!\n *\n * @throws Error in case of the given element not being of type form!\n * https://issues.apache.org/jira/browse/MYFACES-2110\n */\n export function getViewState(form: Element | string): string {\n /**\n * type-check assert!, we opt for strong typing here\n * because it makes it easier to detect bugs\n */\n\n let element: DQ = DQ.byId(form, true);\n if (!element.isTag(HTML_TAG_FORM)) {\n throw new Error(getMessage(\"ERR_VIEWSTATE\"));\n }\n\n // determine the naming container scenario\n const dummyContext = new Config({});\n assignNamingContainerData(dummyContext, DQ.byId(form))\n // fetch all non file input form elements\n let formElements = element.deepElements.encodeFormElement()\n\n // encode them! (file inputs are handled differently and are not part of the viewstate)\n return encodeFormData(new ExtConfig(formElements), resoveNamingContainerMapper(dummyContext));\n }\n\n /**\n * this at the first sight looks like a weird construct, but we need to do it this way\n * for testing, we cannot proxy addRequestToQueue from the testing frameworks directly,\n * but we need to keep it under unit tests.\n */\n export let queueHandler = {\n /**\n * public to make it accessible for tests\n *\n * adds a new request to our queue for further processing\n */\n addRequestToQueue: function (elem: DQ, form: DQ, reqCtx: ExtConfig, respPassThr: Config, delay = 0, timeout = 0) {\n requestQueue = requestQueue ?? new XhrQueueController<XhrRequest>();\n requestQueue.enqueue(new XhrRequest(reqCtx, respPassThr, timeout), delay);\n }\n };\n\n //----------------------------------------------- Methods ---------------------------------------------------------------------\n\n /**\n * the idea is to replace some placeholder parameters with their respective values\n * placeholder params like @all, @none, @form, @this need to be replaced by\n * the values defined by the specification\n *\n * This function does it for the render parameters\n *\n * @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)\n * @param targetContext the receiving target context\n * @param issuingForm the issuing form\n * @param sourceElementId the executing element triggering the faces.ajax.request (id of it)\n */\n function assignRender(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {\n if (requestOptions.getIf(CTX_PARAM_RENDER).isPresent()) {\n remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_RENDER, <string>requestOptions.getIf(CTX_PARAM_RENDER).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);\n }\n }\n\n /**\n * the idea is to replace some placeholder parameters with their respective values\n * placeholder params like @all, @none, @form, @this need to be replaced by\n * the values defined by the specification\n *\n * This function does it for the execute parameters\n *\n * @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)\n * @param targetContext the receiving target context\n * @param issuingForm the issuing form\n * @param sourceElementId the executing element triggering the faces.ajax.request (id of it)\n */\n function assignExecute(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {\n\n if (requestOptions.getIf(CTX_OPTIONS_EXECUTE).isPresent()) {\n /*the options must be a blank delimited list of strings*/\n /*compliance with Mojarra which automatically adds @this to an execute\n * the spec rev 2.0a however states, if none is issued nothing at all should be sent down\n */\n requestOptions.assign(CTX_OPTIONS_EXECUTE).value = [requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, IDENT_THIS].join(\" \");\n remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_EXECUTE, <string>requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);\n } else {\n targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value = sourceElementId;\n }\n }\n\n /**\n * apply the browser tab where the request was originating from\n *\n * @param form the form hosting the client window id\n * @param targetContext the target context receiving the value\n */\n function assignClientWindowId(form: DQ, targetContext: Config) {\n\n let clientWindow = $faces().getClientWindow(form.getAsElem(0).value);\n if (clientWindow) {\n targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_CLIENT_WINDOW).value = clientWindow;\n }\n }\n\n /**\n * determines the current naming container\n * and assigns it internally\n *\n * @param internalContext\n * @param formElement\n * @private\n */\n function assignNamingContainerData(internalContext: Config, formElement: DQ) {\n const viewRootId = resolveViewRootId(formElement);\n\n if(!!viewRootId) {\n internalContext.assign(NAMED_VIEWROOT).value = true;\n internalContext.assign(NAMING_CONTAINER_ID).value = viewRootId;\n }\n }\n\n /**\n * transforms the user values to the expected values\n * handling '@none', '@all', '@form', and '@this' appropriately.\n * (Note: Although we could employ a simple string replacement method,\n * it could result in duplicate entries under certain conditions.)\n *\n * Specific standardized constants such as\n * '@all', '@none', '@form', and '@this'\n * require special treatment.\n *\n * @param targetConfig the target configuration receiving the final values\n * @param targetKey the target key\n * @param userValues the passed user values (aka input string which needs to be transformed)\n * @param issuingForm the form where the issuing element originates\n * @param issuingElementId the issuing element\n * @param rootNamingContainerId the naming container id (\"\" default if none is given)\n */\n function remapDefaultConstants(targetConfig: Config, targetKey: string, userValues: string, issuingForm: DQ, issuingElementId: string, rootNamingContainerId: string = \"\"): Config {\n //a cleaner implementation of the transform list method\n const SEP = $faces().separatorchar;\n let iterValues: string[] = (userValues) ? trim(userValues).split(/\\s+/gi) : [];\n let ret = [];\n let processed: {[key: string]: boolean} = {};\n\n /**\n * remaps the client ids for the portlet case so that the server\n * can deal with them either prefixed ir not\n * also resolves the absolute id case (it was assumed the server does this, but\n * apparently the RI does not, so we have to follow the RI behavior here)\n * @param componentIdToTransform the componentId which needs post-processing\n */\n const remapNamingContainer = componentIdToTransform => {\n // pattern :<anything> must be prepended by viewRoot if there is one,\n // otherwise we are in a not namespaced then only the id has to match\n const rootNamingContainerPrefix = (rootNamingContainerId.length) ? rootNamingContainerId+SEP : EMPTY_STR;\n let formClientId = issuingForm.id.value;\n // nearest parent naming container relative to the form\n const nearestNamingContainer = formClientId.substring(0, formClientId.lastIndexOf(SEP));\n const nearestNamingContainerPrefix = (nearestNamingContainer.length) ? nearestNamingContainer + SEP : EMPTY_STR;\n // Absolute search expressions, always start with SEP or the name of the root naming container\n const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;\n const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length\n && componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);\n let finalIdentifier: string;\n if (isAbsolutSearchExpr) {\n //we cut off the leading sep if there is one\n componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;\n componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;\n //now we prepend either the prefix or \"\" from the cut-off string to get the final result\n finalIdentifier = [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);\n } else { //relative search according to the javadoc\n //we cut off the root naming container id from the form\n if (formClientId.indexOf(rootNamingContainerPrefix) == 0) {\n formClientId = formClientId.substring(rootNamingContainerPrefix.length);\n }\n\n //If prependId = true, the outer form id must be present in the id if same form\n let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;\n finalIdentifier = hasPrependId ?\n [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR) :\n [nearestNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);\n }\n // We need to double-check because we have scenarios where we have a naming container\n // and no prepend (aka tobago testcase \"must handle ':' in IDs properly\", scenario 3,\n // in this case we return the component id, and be happy\n // we can roll a dom check here\n return DQ.byId(finalIdentifier).isPresent() ? finalIdentifier : componentIdToTransform;\n };\n\n // in this case we do not use lazy stream because it won´t bring any code reduction\n // or speedup\n for (let cnt = 0; cnt < iterValues.length; cnt++) {\n //avoid doubles\n if (iterValues[cnt] in processed) {\n continue;\n }\n switch (iterValues[cnt]) {\n //@none no values should be sent\n case IDENT_NONE:\n return targetConfig.delete(targetKey);\n //@all is a pass through case according to the spec\n case IDENT_ALL:\n targetConfig.assign(targetKey).value = IDENT_ALL;\n return targetConfig;\n //@form pushes the issuing form id into our list\n case IDENT_FORM:\n ret.push(remapNamingContainer(issuingForm.id.value));\n processed[issuingForm.id.value] = true;\n break;\n //@this is replaced with the current issuing element id\n case IDENT_THIS:\n if (!(issuingElementId in processed)) {\n ret.push(remapNamingContainer(issuingElementId));\n processed[issuingElementId] = true;\n }\n break;\n default:\n ret.push(remapNamingContainer(iterValues[cnt]));\n processed[iterValues[cnt]] = true;\n }\n }\n\n targetConfig.assign(targetKey).value = ret.join(\" \");\n return targetConfig;\n }\n\n /**\n * Filters the provided options using a blacklist to ensure\n * only pass-through parameters are processed for the Ajax request.\n *\n * Note that this issue is leftover from a previous implementation.\n * The specification-conforming behavior is to use parameters for pass-through values.\n * This will be addressed soon, after confirming that removal won't break any legacy code.\n *\n * @param {Context} mappedOpts - The options to be filtered.\n */\n function extractLegacyParams(mappedOpts: Options): {[key: string]: any} {\n //we now can use the full code reduction given by our stream api\n //to filter\n return ofAssoc(mappedOpts)\n .filter((item => !(item[0] in BlockFilter)))\n .reduce(collectAssoc, {});\n }\n\n /**\n * Extracts the MyFaces configuration parameters\n * that augment JSF with additional functionality.\n *\n * @param mappedOpts\n * @private\n */\n function extractMyFacesParams(mappedOpts: Options): {[key: string]: any} {\n //we now can use the full code reduction given by our stream api\n //to filter\n return ofAssoc(mappedOpts)\n .filter((item => (item[0] == \"myfaces\")))\n .reduce(collectAssoc, {})?.[MYFACES];\n }\n\n\n function remapArrayToAssocArr(arrayedParams: [[string, any]] | {[key: string]: any}): {[key: string]: any} {\n if(Array.isArray(arrayedParams)) {\n return arrayedParams.reduce(collectAssoc, {} as any);\n }\n return arrayedParams;\n }\n\n function resolveGlobalConfig(): any {\n return window?.[MYFACES]?.config ?? {};\n }\n\n /**\n * Private helper to execute a function or code fragment\n * @param source the source of the caller passed into the function as this\n * @param event an event which needs to be passed down into the function\n * @param func either a function or code fragment\n * @return a boolean value, if the passed function returns false, then the\n * caller is basically notified that the execution can now stop (JSF requirement for chain)\n * @private\n */\n function resolveAndExecute(source: any, event: Event, func: Function | string): boolean {\n if (\"string\" != typeof func) {\n //function is passed down as chain parameter, can be executed as is\n return (<Function>func).call(source, event) !== false;\n } else {\n //either a function or a string can be passed in case of a string we have to wrap it into another function\n //it is not a plain executable code but a definition\n let sourceCode = trim(<string>func);\n if (sourceCode.indexOf(\"function \") == 0) {\n sourceCode = `return ${sourceCode} (event)`;\n }\n return new Function(\"event\", sourceCode).call(source, event) !== false;\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Typescript port of the faces\\.push part in the myfaces implementation\n */\nimport {MAX_RECONNECT_ATTEMPTS, REASON_EXPIRED, RECONNECT_INTERVAL} from \"./core/Const\";\nimport {DQ} from \"mona-dish\";\n\n/**\n * Implementation class for the push functionality\n */\nexport namespace PushImpl {\n\n // @deprecated because we can assume at least for the newer versions\n // that the protocol is properly set!\n const URL_PROTOCOL = DQ.global().location.protocol.replace(\"http\", \"ws\") + \"//\";\n\n\n // we expose the member variables for testing purposes\n // they are not directly touched outside of tests\n\n /* socket map by token */\n export let sockets = {};\n /* component attributes by clientId */\n export let components = {};\n /* client ids by token (share websocket connection) */\n export let clientIdsByTokens = {};\n\n\n // needed for testing\n export function reset() {\n sockets = {};\n components = {}\n clientIdsByTokens = {}\n }\n\n /*\n * Api implementations, exposed functions\n */\n\n /**\n * @param socketClientId the sockets client identifier\n * @param url the uri to reach the socket\n * @param channel the channel name/id\n * @param onopen The function to be invoked when the web socket is opened.\n * @param onmessage The function to be invoked when a message is received.\n * @param onerror The function to be invoked when an error occurs.\n * @param onclose The function to be invoked when the web socket is closed.\n * @param behaviors functions which are invoked whenever a message is received\n * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.\n */\n export function init(socketClientId: string,\n url: string,\n channel: string,\n onopen: Function,\n onmessage: Function,\n onerror: Function,\n onclose: Function,\n behaviors: any,\n autoConnect: boolean) {\n onclose = resolveFunction(onclose);\n\n if (!DQ.global().WebSocket) { // IE6-9.\n onclose(-1, channel);\n return;\n }\n\n let channelToken = url.substr(url.indexOf('?') + 1);\n\n if (!components[socketClientId]) {\n components[socketClientId] = {\n 'channelToken': channelToken,\n 'onopen': resolveFunction(onopen),\n 'onmessage' : resolveFunction(onmessage),\n 'onerror' : resolveFunction(onerror),\n 'onclose': onclose,\n 'behaviors': behaviors,\n 'autoconnect': autoConnect};\n if (!clientIdsByTokens[channelToken]) {\n clientIdsByTokens[channelToken] = [];\n }\n clientIdsByTokens[channelToken].push(socketClientId);\n if (!sockets[channelToken]){\n sockets[channelToken] = new Socket(channelToken,\n getBaseURL(url), channel);\n }\n }\n\n if (autoConnect) {\n (DQ.global()?.faces ?? DQ.global()?.jsf).push.open(socketClientId);\n }\n }\n\n export function open(socketClientId: string) {\n getSocket(components[socketClientId]?.channelToken).open();\n }\n\n export function close(socketClientId: string) {\n getSocket(components[socketClientId].channelToken).close();\n }\n\n // Private helper classes\n // Private classes functions ----------------------------------------------------------------------------------\n /**\n * Creates a reconnecting web socket. When the web socket successfully connects on first attempt, then it will\n * automatically reconnect on timeout with cumulative intervals of 500ms with a maximum of 25 attempts (~3 minutes).\n * The <code>onclose</code> function will be called with the error code of the last attempt.\n * @constructor\n * @param {string} channelToken the channel token associated with this websocket connection\n * @param {string} url The URL of the web socket\n * @param {string} channel The name of the web socket channel.\n */\n\n class Socket {\n\n socket: WebSocket;\n reconnectAttempts = 0;\n\n constructor(private channelToken: string, private url: string, private channel: string) {\n }\n\n open() {\n if (this.socket && this.socket.readyState == 1) {\n return;\n }\n this.socket = new WebSocket(this.url);\n\n this.bindCallbacks();\n }\n\n // noinspection JSUnusedLocalSymbols\n onopen(event: any) {\n if (!this.reconnectAttempts) {\n let clientIds = clientIdsByTokens[this.channelToken];\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n components[socketClientId]?.['onopen']?.(this.channel);\n }\n }\n this.reconnectAttempts = 0;\n }\n\n onerror(event: any) {\n let message = JSON.parse(event?.data ?? null);\n //TODO replace this with a more readable Stream code\n for (let i = clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {\n let socketClientId = clientIdsByTokens[this.channelToken][i];\n if (document.getElementById(socketClientId)) {\n try {\n components[socketClientId]?.['onerror']?.(message, this.channel, event);\n } catch (e) {\n //Ignore\n }\n } else {\n clientIdsByTokens[this.channelToken].splice(i, 1);\n }\n }\n if (clientIdsByTokens[this.channelToken].length == 0) {\n // tag disappeared\n this.close();\n }\n }\n\n onmmessage(event: any) {\n let message = JSON.parse(event.data);\n for (let i = clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {\n let socketClientId = clientIdsByTokens[this.channelToken][i];\n if (document.getElementById(socketClientId)) {\n try {\n components[socketClientId]?.['onmessage']?.(message, this.channel, event);\n } catch (e) {\n //Ignore\n }\n let behaviors = components?.[socketClientId]?.['behaviors'];\n let functions = behaviors?.[message];\n if (functions && functions.length) {\n for (let j = 0; j < functions.length; j++) {\n try {\n functions[j](null);\n } catch (e) {\n //Ignore\n }\n }\n }\n } else {\n clientIdsByTokens[this.channelToken].splice(i, 1);\n }\n }\n if (clientIdsByTokens[this.channelToken].length == 0) {\n // tag disappeared\n this.close();\n }\n }\n\n onclose(event: any) {\n if (!this.socket\n || (event.code == 1000 && event.reason == REASON_EXPIRED)\n || (event.code == 1008)\n || (!this.reconnectAttempts)\n || (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS)) {\n let clientIds = clientIdsByTokens[this.channelToken];\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n components?.[socketClientId]?.['onclose']?.(event?.code, this?.channel, event);\n }\n } else {\n setTimeout(this.open, RECONNECT_INTERVAL * this.reconnectAttempts++);\n }\n };\n\n close() {\n if (this.socket) {\n let s = this.socket;\n this.socket = null;\n s.close();\n }\n }\n\n /**\n * bind the callbacks to the socket callbacks\n */\n private bindCallbacks() {\n this.socket.onopen = (event: Event) => this.onopen(event);\n this.socket.onmessage = (event: Event) => this.onmmessage(event);\n this.socket.onclose = (event: Event) => this.onclose(event);\n this.socket.onerror = (event: Event) => this.onerror(event);\n }\n }\n\n // Private static functions ---------------------------------------------------------------------------------------\n // @deprecated because we can assume at least for the newer versions\n // that the protocol is properly set!\n // https://issues.apache.org/jira/browse/MYFACES-4718\n // This needs further investigation\n function getBaseURL(url: string) {\n if (url.indexOf(\"://\") < 0) {\n let base = DQ.global().location.hostname + \":\" + DQ.global().location.port;\n return URL_PROTOCOL + base + url;\n } else {\n return url;\n }\n }\n\n /**\n * Get socket associated with given channelToken.\n * @param channelToken The name of the web socket channelToken.\n * @return Socket associated with given channelToken.\n * @throws Error, when the channelToken is unknown, you may need to initialize\n * it first via <code>init()</code> function.\n */\n function getSocket(channelToken: string): Socket {\n let socket = sockets[channelToken];\n if (socket) {\n return socket;\n } else {\n throw new Error(\"Unknown channelToken: \" + channelToken);\n }\n }\n\n function resolveFunction(fn: Function | string = () => {\n }): Function {\n return <Function>((typeof fn !== \"function\") && (fn = DQ.global()[fn]), fn);\n }\n\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * [export const] constants\n */\n\nexport const XML_ATTR_NAMED_VIEWROOT = \"namedViewRoot\";\nexport const NAMED_VIEWROOT = \"namedViewRoot\";\n\nexport const P_AJAX_SOURCE = \"jakarta.faces.source\";\nexport const NAMING_CONTAINER_ID = \"myfaces.NamingContainerId\";\n\nexport const VIEW_ID = \"myfaces.viewId\";\nexport const P_VIEWSTATE = \"jakarta.faces.ViewState\";\nexport const P_CLIENT_WINDOW = \"jakarta.faces.ClientWindow\";\nexport const P_VIEWROOT = \"jakarta.faces.ViewRoot\";\nexport const P_VIEWHEAD = \"jakarta.faces.ViewHead\";\nexport const P_VIEWBODY = \"jakarta.faces.ViewBody\";\n\nexport const P_RESOURCE = \"jakarta.faces.Resource\";\n\n/*some useful definitions*/\n\nexport const EMPTY_FUNC = Object.freeze(() => {\n});\nexport const EMPTY_STR = \"\";\nexport const EMPTY_MAP = Object.freeze({});\n\nexport const HTML_VIEWSTATE = [\"<input type='hidden'\", \"name='\", P_VIEWSTATE, \"' value='' />\"].join(EMPTY_STR);\nexport const HTML_CLIENT_WINDOW = [\"<input type='hidden'\", \"' name='\", P_CLIENT_WINDOW, \"' value='' />\"].join(EMPTY_STR);\n\n\n/*internal identifiers for options*/\nexport const IDENT_ALL = \"@all\";\nexport const IDENT_NONE = \"@none\";\nexport const IDENT_THIS = \"@this\";\nexport const IDENT_FORM = \"@form\";\n\n\nexport const P_AJAX = \"jakarta.faces.partial.ajax\";\nexport const P_EXECUTE = \"jakarta.faces.partial.execute\";\nexport const P_RENDER = \"jakarta.faces.partial.render\";\n/*render override for viewbody or viewroot, in both cases an all is performed*/\nexport const P_RENDER_OVERRIDE = \"_myfaces.rendeOverride\";\nexport const P_EVT = \"jakarta.faces.partial.event\";\n\nexport const P_RESET_VALUES = \"jakarta.faces.partial.resetValues\";\nexport const P_WINDOW_ID = \"jakarta.faces.windowId\";\n\nexport const P_BEHAVIOR_EVENT = \"jakarta.faces.behavior.event\";\n\nexport const CTX_PARAM_RENDER = \"render\";\nexport const WINDOW_ID = \"windowId\";\n\n/* message types */\nexport const ERROR = \"error\";\nexport const EVENT = \"event\";\n\nexport const ON_ERROR = \"onerror\";\nexport const ON_EVENT = \"onevent\";\n\n/* event emitting stages */\nexport const BEGIN = \"begin\";\nexport const COMPLETE = \"complete\";\nexport const SUCCESS = \"success\";\n\nexport const SOURCE = \"source\";\nexport const STATUS = \"status\";\n\n\nexport const ERROR_NAME = \"error-name\";\nexport const ERROR_MESSAGE = \"error-message\";\n\n\nexport const RESPONSE_TEXT = \"responseText\";\nexport const RESPONSE_XML = \"responseXML\";\n\n/*ajax errors spec 14.4.2*/\nexport const HTTP_ERROR = \"httpError\";\nexport const EMPTY_RESPONSE = \"emptyResponse\";\nexport const MALFORMEDXML = \"malformedXML\";\nexport const SERVER_ERROR = \"serverError\";\nexport const CLIENT_ERROR = \"clientError\";\nexport const TIMEOUT_EVENT = \"timeout\";\n\nexport const CTX_OPTIONS_PARAMS = \"params\";\nexport const CTX_OPTIONS_DELAY = \"delay\";\nexport const DELAY_NONE = 'none';\nexport const CTX_OPTIONS_TIMEOUT = \"timeout\";\nexport const CTX_OPTIONS_RESET = \"resetValues\";\nexport const CTX_OPTIONS_EXECUTE = \"execute\";\n\nexport const CTX_PARAM_MF_INTERNAL = \"myfaces.internal\";\nexport const CTX_PARAM_SRC_FRM_ID = \"myfaces.source.formId\";\nexport const CTX_PARAM_UPLOAD_ON_PROGRESS = \"myfaces.upload.progress\";\nexport const CTX_PARAM_UPLOAD_PREINIT = \"myfaces.upload.preinit\";\nexport const CTX_PARAM_UPLOAD_LOADSTART = \"myfaces.upload.loadstart\";\nexport const CTX_PARAM_UPLOAD_LOADEND = \"myfaces.upload.loadend\";\nexport const CTX_PARAM_UPLOAD_LOAD = \"myfaces.upload.load\";\nexport const CTX_PARAM_UPLOAD_ERROR = \"myfaces.upload.error\";\nexport const CTX_PARAM_UPLOAD_ABORT = \"myfaces.upload.abort\";\nexport const CTX_PARAM_UPLOAD_TIMEOUT = \"myfaces.upload.timeout\";\nexport const CTX_PARAM_SRC_CTL_ID = \"myfaces.source.controlId\";\nexport const CTX_PARAM_REQ_PASS_THR = \"myfaces.request.passThrough\";\nexport const CTX_PARAM_PPS = \"myfaces.request.pps\";\n\nexport const CONTENT_TYPE = \"Content-Type\";\nexport const HEAD_FACES_REQ = \"Faces-Request\";\nexport const REQ_ACCEPT = \"Accept\";\nexport const VAL_AJAX = \"partial/ajax\";\nexport const ENCODED_URL = \"jakarta.faces.encodedURL\";\nexport const REQ_TYPE_GET = \"GET\";\nexport const REQ_TYPE_POST = \"POST\";\nexport const STATE_EVT_BEGIN = \"begin\"; //TODO remove this\nexport const STATE_EVT_TIMEOUT = \"TIMEOUT_EVENT\";\nexport const STATE_EVT_COMPLETE = \"complete\"; //TODO remove this\nexport const URL_ENCODED = \"application/x-www-form-urlencoded\";\nexport const MULTIPART = \"multipart/form-data\";\nexport const NO_TIMEOUT = 0;\nexport const STD_ACCEPT = \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\";\n\nexport const HTML_TAG_HEAD = \"HEAD\";\nexport const HTML_TAG_FORM = \"FORM\";\nexport const HTML_TAG_BODY = \"BODY\";\nexport const HTML_TAG_LINK = \"LINK\";\nexport const HTML_TAG_SCRIPT = \"SCRIPT\";\nexport const HTML_TAG_STYLE = \"STYLE\";\n\n\nexport const SEL_VIEWSTATE_ELEM = \"[name='\" + P_VIEWSTATE + \"']\";\nexport const SEL_CLIENT_WINDOW_ELEM = \"[name='\" + P_CLIENT_WINDOW + \"']\";\nexport const SEL_RESPONSE_XML = \"responseXML\";\n\nexport const PHASE_PROCESS_RESPONSE = \"processResponse\";\n\n\nexport const ERR_NO_PARTIAL_RESPONSE = \"Partial response not set\";\n\nexport const MYFACES_OPTION_PPS = \"pps\";\n\nexport const ATTR_URL = \"url\";\nexport const ATTR_NAME = \"name\";\nexport const ATTR_VALUE = \"value\";\nexport const ATTR_ID = \"id\";\n\n/*partial response types*/\nexport const XML_TAG_PARTIAL_RESP = \"partial-response\";\n\n/*partial commands*/\nexport const XML_TAG_CHANGES = \"changes\";\nexport const XML_TAG_UPDATE = \"update\";\nexport const XML_TAG_DELETE = \"delete\";\nexport const XML_TAG_INSERT = \"insert\";\nexport const XML_TAG_EVAL = \"eval\";\nexport const XML_TAG_ERROR = \"error\";\nexport const XML_TAG_ATTRIBUTES = \"attributes\";\nexport const XML_TAG_EXTENSION = \"extension\";\nexport const XML_TAG_REDIRECT = \"redirect\";\nexport const XML_TAG_BEFORE = \"before\";\nexport const XML_TAG_AFTER = \"after\";\nexport const XML_TAG_ATTR = \"attribute\";\n\n\n/*other constants*/\n\nexport const UPDATE_FORMS = \"myfaces.updateForms\";\nexport const UPDATE_ELEMS = \"myfaces.updateElems\";\n\n//we want the head elements to be processed before we process the body\n//but after the inner html is done\nexport const DEFERRED_HEAD_INSERTS = \"myfaces.headElems\";\n\nexport const MYFACES = \"myfaces\";\n\nexport const MF_NONE = \"__mf_none__\";\n\nexport const REASON_EXPIRED = \"Expired\";\n\nexport const APPLIED_VST = \"myfaces.appliedViewState\";\nexport const APPLIED_CLIENT_WINDOW = \"myfaces.appliedClientWindow\";\n\nexport const RECONNECT_INTERVAL = 500;\nexport const MAX_RECONNECT_ATTEMPTS = 25;\n\nexport const UNKNOWN = \"UNKNOWN\";\n\n/**\n * helper to remap the namespaces variables for 2.3\n * from 2.3 to 4.0 every javax namespace has been changed\n * to faces\n * To take the compatibility layer out this method just has to be\n * changed to a simple value passthrough\n */\n\nexport function $faces(): FacesAPI {\n return (window?.faces ?? window?.jsf) as FacesAPI;\n}\n\nexport function $nsp(inputNamespace?: any): any {\n if((!inputNamespace) || !inputNamespace?.replace) {\n return inputNamespace;\n }\n return (!!window?.faces) ? inputNamespace.replace(/javax\\.faces/gi,\"jakarta.faces\"): inputNamespace.replace(/jakarta\\.faces/gi, \"javax.faces\");\n}\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {EMPTY_STR, P_VIEWSTATE} from \"./Const\";\n\nexport interface IdValueHolder {\n\n readonly id: string;\n readonly value: string;\n\n}\n\n/**\n * a helper class to isolate the\n * view state and client window and other\n * future states which follow a similar pattern\n */\nexport class StateHolder implements IdValueHolder {\n\n nameSpace: string;\n\n constructor(public id: string, public value: string) {\n let viewStatePos = id.indexOf(P_VIEWSTATE);\n this.nameSpace = viewStatePos > 0 ? id.substr(0, viewStatePos - 1) : EMPTY_STR;\n }\n\n get hasNameSpace(): boolean {\n return !!(this?.nameSpace ?? EMPTY_STR).length;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class Messages {\n MSG_TEST = \"Testmessage\";\n\n /*Messages*/\n /** @constant */\n MSG_DEV_MODE = \"Note, this message is only sent, because project stage is development and no \" +\n \"other error listeners are registered.\";\n /** @constant */\n MSG_AFFECTED_CLASS = \"Affected Class=\";\n /** @constant */\n MSG_AFFECTED_METHOD = \"Affected Method=\";\n /** @constant */\n MSG_ERROR_NAME = \"Error Name=\";\n /** @constant */\n MSG_ERROR_MESSAGE = \"Error Message=\";\n /** @constant */\n MSG_SERVER_ERROR_NAME = \"Server Error Name=\";\n\n /** @constant */\n MSG_ERROR_DESC = \"Error Description=\";\n /** @constant */\n MSG_ERROR_NO = \"Error Number=\";\n /** @constant */\n MSG_ERROR_LINENO = \"Error Line Number=\";\n\n /*Errors and messages*/\n /** @constant */\n ERR_FORM = \"Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing\";\n /** @constant */\n ERR_VIEWSTATE = \"faces.viewState= param value not of type form!\";\n /** @constant */\n ERR_TRANSPORT = \"Transport type {0} does not exist\";\n /** @constant */\n ERR_EVT_PASS = \"an event must be passed down (either a an event object null or undefined) \";\n /** @constant */\n ERR_CONSTRUCT = \"Parts of the response couldn't be retrieved when constructing the event data= {0} \";\n /** @constant */\n ERR_MALFORMEDXML = \"The server response could not be parsed, the server has returned with a response which is not xml !\";\n /** @constant */\n ERR_SOURCE_FUNC = \"source cannot be a function (probably source and event were not defined or set to null\";\n /** @constant */\n ERR_EV_OR_UNKNOWN = \"An event object or unknown must be passed as second parameter\";\n /** @constant */\n ERR_SOURCE_NOSTR = \"source cannot be a string\";\n /** @constant */\n ERR_SOURCE_DEF_NULL = \"source must be defined or null\";\n\n //_Lang.js\n /** @constant */\n ERR_MUST_STRING = \"{0}: {1} namespace must be of type String\";\n /** @constant */\n ERR_REF_OR_ID = \"{0}: {1} a reference node or identifier must be provided\";\n /** @constant */\n ERR_PARAM_GENERIC = \"{0}: parameter {1} must be of type {2}\";\n /** @constant */\n ERR_PARAM_STR = \"{0}: {1} param must be of type string\";\n /** @constant */\n ERR_PARAM_STR_RE = \"{0}: {1} param must be of type string or a regular expression\";\n /** @constant */\n ERR_PARAM_MIXMAPS = \"{0}: both a source as well as a destination map must be provided\";\n /** @constant */\n ERR_MUST_BE_PROVIDED = \"{0}: an {1} and a {2} must be provided\";\n /** @constant */\n ERR_MUST_BE_PROVIDED1 = \"{0}: {1} must be set\";\n\n /** @constant */\n ERR_REPLACE_EL = \"replaceElements called while evalNodes is not an array\";\n\n /** @constant */\n ERR_EMPTY_RESPONSE = \"{0}: The response cannot be null or empty!\";\n /** @constant */\n ERR_ITEM_ID_NOTFOUND = \"{0}: item with identifier {1} could not be found\";\n /** @constant */\n ERR_PPR_IDREQ = \"{0}: Error in PPR Insert, id must be present\";\n /** @constant */\n ERR_PPR_INSERTBEFID = \"{0}: Error in PPR Insert, before id or after id must be present\";\n /** @constant */\n ERR_PPR_INSERTBEFID_1 = \"{0}: Error in PPR Insert, before node of id {1} does not exist in document\";\n /** @constant */\n ERR_PPR_INSERTBEFID_2 = \"{0}: Error in PPR Insert, after node of id {1} does not exist in document\";\n\n /** @constant */\n ERR_PPR_DELID = \"{0}: Error in delete, id not in xml markup\";\n /** @constant */\n ERR_PPR_UNKNOWNCID = \"{0}: Unknown Html-Component-ID= {1}\";\n\n /** @constant */\n ERR_NO_VIEWROOTATTR = \"{0}: Changing of ViewRoot attributes is not supported\";\n /** @constant */\n ERR_NO_HEADATTR = \"{0}: Changing of Head attributes is not supported\";\n /** @constant */\n ERR_RED_URL = \"{0}: Redirect without url\";\n\n /** @constant */\n ERR_REQ_FAILED_UNKNOWN = \"Request failed with unknown status\";\n\n /** @constant */\n ERR_REQU_FAILED = \"Request failed with status {0} and reason {1}\";\n\n /** @constant */\n UNKNOWN = \"UNKNOWN\";\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, Lang, XMLQuery} from \"mona-dish\";\n\nimport {DQ} from \"mona-dish\";\nimport {\n ATTR_URL,\n EMPTY_RESPONSE,\n EMPTY_STR, ERR_NO_PARTIAL_RESPONSE, MALFORMEDXML,\n ON_ERROR,\n ON_EVENT,\n PHASE_PROCESS_RESPONSE,\n XML_TAG_PARTIAL_RESP\n} from \"../core/Const\";\nimport {ExtLang} from \"./Lang\";\n\n\n/**\n * a set of internal code assertions\n * which raise an error\n *\n */\nexport namespace Assertions {\n\n\n\n export function assertRequestIntegrity(options: Config, elem: DQ): void | never {\n /*assert if the onerror is set and once if it is set it must be of type function*/\n assertFunction(options.getIf(ON_ERROR).value);\n /*assert if the onevent is set and once if it is set it must be of type function*/\n assertFunction(options.getIf(ON_EVENT).value);\n //improve the error messages if an empty elem is passed\n //Assertions.assertElementExists(elem);\n assert(elem.isPresent(), ExtLang.getMessage(\"ERR_MUST_BE_PROVIDED1\", \"{0}: source must be provided or exist\", \"source element id\"), \"faces.ajax.request\", \"ArgNotSet\", )\n }\n\n export function assertUrlExists(node: XMLQuery): void | never {\n if (node.attr(ATTR_URL).isAbsent()) {\n throw Assertions.raiseError(new Error(), ExtLang.getMessage(\"ERR_RED_URL\", null, \"processRedirect\"), \"processRedirect\");\n }\n }\n\n /**\n * checks the xml for various issues which can occur\n * and prevent a proper processing\n */\n export function assertValidXMLResponse(responseXML: XMLQuery) : void | never {\n assert(!responseXML.isAbsent(), EMPTY_RESPONSE, PHASE_PROCESS_RESPONSE);\n assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(EMPTY_STR), PHASE_PROCESS_RESPONSE);\n assert(responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP).isPresent(), ERR_NO_PARTIAL_RESPONSE, PHASE_PROCESS_RESPONSE);\n }\n\n /**\n * internal helper which raises an error in the\n * format we need for further processing\n *\n * @param error\n * @param message the message\n * @param caller\n * @param title the title of the error (optional)\n * @param name the name of the error (optional)\n */\n export function raiseError(error: any, message: string, caller ?: string, title ?: string, name ?: string): Error {\n\n let finalTitle = title ?? MALFORMEDXML;\n let finalName = name ?? MALFORMEDXML;\n let finalMessage = message ?? EMPTY_STR;\n\n //TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults\n return ExtLang.makeException(error, finalTitle, finalName, \"Response\", caller || (((arguments as any).caller) ? (arguments as any).caller.toString() : \"_raiseError\"), finalMessage);\n }\n\n /*\n * using the new typescript 3.7 compiler assertion functionality to improve compiler hinting\n * we are not fully there yet, but soon\n */\n\n export function assert(value: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Assertion Error\"): asserts value {\n if(!value) {\n throw Assertions.raiseError(new Error(), msg ,caller, title);\n }\n }\n\n\n export function assertType(value: any, theType: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Type Assertion Error\"): asserts value {\n if((!!value) && !Lang.assertType(value,theType)) {\n throw Assertions.raiseError(new Error(), msg ,caller, title);\n }\n }\n\n export function assertFunction(value: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Assertion Error\"): asserts value is Function {\n assertType(value, \"function\", msg, caller, title);\n }\n\n export function assertDelay(value: any) {\n if(!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,\n // including NaN and non numeric strings, no type equality is deliberate here,\n throw new Error(\"Invalid delay value: \" + value);\n }\n }\n}\n\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Asynchronous queue member for our asynchronous queue\n * Ever object in the asynchronous queue needs to implement this interface\n *\n * the usage should be similar as Promise. from the outside.\n * but with a dedicated start point. The problem why we cannot use\n * promises here, is mostly related to the needed cancel functionality\n * and that the queue expects a runnable as entry.\n *\n * from the implementation side it is mostly registering callbacks\n * and calling them at the appropriate time.\n */\nexport interface IAsyncRunnable<T> {\n /**\n * starts the runnable\n */\n start();\n\n /**\n * cancel the current ongoing op if possible\n */\n cancel();\n\n /**\n * callback for then functionality\n * triggered when the async run is complete\n *\n * the async runnable must register the passed function\n * and then triggers all the registered then functions\n * when it is complete\n *\n * @param func the then functor\n */\n then(func: (data: any) => any): IAsyncRunnable<T>;\n\n /**\n * callback for catch functionality\n * triggered when the async run is complete\n *\n * the async runnable must register the passed function\n * and then triggers all the registered catch handlers\n * when an error has occurred\n *\n * @param func\n */\n catch(func: (data: any) => any): IAsyncRunnable<T>;\n\n\n /**\n * finally called when all then and catches are performed\n * same this is a register function\n * and once the finally time for the promise has\n * come the finally functions must be performed\n */\n finally(func: () => void): IAsyncRunnable<T>;\n}\n\n\n/**\n * pretty much the same as cancellable Promise, but given\n * we do not have that on browser level yet this is sort\n * of a non - intrusive Shim!\n */\nexport abstract class AsyncRunnable<T> implements IAsyncRunnable<T>{\n /**\n * helper support so that we do not have to drag in Promise shims\n */\n private catchFunctions: Array<Function> = [];\n private thenFunctions: Array<Function> = [];\n\n /**\n * cancel the run of the runnable (which then depending on the implementation\n * either triggers indirectly resolve or reject)\n */\n abstract cancel(): void;\n\n /**\n * extended functionality start to trigger the runnable\n */\n abstract start(): void;\n\n /**\n * resolve handler function which calls the then chain\n * and after that finally\n * @param data\n */\n resolve(data: any) {\n this.thenFunctions.reduce((inputVal: any, thenFunc: any) => {\n return thenFunc(inputVal);\n }, data)\n }\n\n /**\n * reject handler function which triggers the catch chain\n * @param data\n */\n reject(data: any) {\n this.catchFunctions.reduce((inputVal: any, catchFunc: any) => {\n return catchFunc(inputVal);\n }, data);\n }\n\n /**\n * register a catch functor\n * @param func the functor for the catch monad\n */\n catch(func: (data: any) => any): IAsyncRunnable<T> {\n this.catchFunctions.push(func);\n return this;\n }\n\n /**\n * registers a finally functor\n * @param func the functor for the finally handling chanin\n */\n finally(func: () => void): IAsyncRunnable<T> {\n // no ie11 support we probably are going to revert to shims for that one\n this.catchFunctions.push(func);\n this.thenFunctions.push(func);\n return this;\n }\n\n /**\n * @param func then functor similar to promise\n */\n then(func: (data: any) => any): IAsyncRunnable<T> {\n this.thenFunctions.push(func);\n return this;\n }\n}\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, IValueHolder, Optional, DomQuery, DQ, Es2019Array, ValueEmbedder} from \"mona-dish\";\nimport {$faces, $nsp, P_WINDOW_ID} from \"../core/Const\";\n\n\n/**\n * detects whether a source is a faces.js request\n *\n * @param source the source string for the faces.js request\n * @return true if a faces.js loading pattern is detected\n * @constructor\n */\nconst IS_FACES_SOURCE = (source?: string): boolean => {\n //spec version smaller 4 we have to deal with the jsf namespace\n\n return source && !!(source?.search(/\\/jakarta\\.faces\\.resource.*\\/faces\\.js.*/) != -1 ||\n source?.search(/\\/faces-development\\.js.*/) != -1 ||\n source?.search(/\\/faces-uncompressed\\.js.*/) != -1 ||\n source?.search(/\\/faces[^.]*\\.js.*ln=jakarta.faces.*/gi) != -1 ||\n //fallback without check for jsf, that way we allow both bookmarks\n source?.search(/\\/javax\\.faces\\.resource.*\\/jsf\\.js.*/) != -1 ||\n source?.search(/\\/jsf-development\\.js.*/) != -1 ||\n source?.search(/\\/jsf-uncompressed\\.js.*/) != -1 ||\n source?.search(/\\/jsf[^.]*\\.js.*ln=javax.faces.*/gi) != -1);\n}\n\n/**\n * namespace myfaces\\.testscripts can be used as extension point for internal\n * tests, those will be handled similarly to faces.js, in regard\n * to reload blocking on ajax requests\n *\n * Note: atm not used, used to be used in the old implementation\n * but still is reserved for now\n *\n * @param source the source to check\n * @constructor\n */\nconst IS_INTERNAL_SOURCE = (source: string): boolean => {\n return source.search(/\\/faces[^.]*\\.js.*ln=myfaces.testscripts.*/gi) != -1 || source.search(/\\/jsf[^.]*\\.js.*ln=myfaces.testscripts.*/gi) != -1;\n}\n\n\nconst ATTR_SRC = 'src';\n\n/**\n * Extension which adds implementation specific\n * meta-data to our dom query\n *\n * Usage\n * el = new ExtDQ(oldReference)\n * nonce = el.nonce\n * windowId = el.getWindowId\n */\nexport class ExtDomQuery extends DQ {\n\n static get windowId(): Optional<string> {\n return new ExtDomQuery(document.body).windowId;\n }\n\n static get nonce(): Optional<string> {\n return new ExtDomQuery(document.body).nonce;\n }\n\n get windowId(): Optional<string> {\n\n const fetchWindowIdFromURL = function (): string | null {\n let href = window.location.href;\n let windowId = \"windowId\";\n let regex = new RegExp(\"[\\\\?&]\" + windowId + \"=([^&#\\\\;]*)\");\n let results = regex.exec(href);\n //initial trial over the url and a regexp\n if (results != null) return results[1];\n return null;\n };\n\n //byId ($)\n if (this.value.isPresent()) {\n let result = this.querySelectorAll(\"form input[name='\" + P_WINDOW_ID + \"']\");\n if (result.length > 1) {\n throw Error(\"Multiple different windowIds found in document\");\n }\n\n return Optional.fromNullable((result.isPresent()) ? (<HTMLInputElement>result.getAsElem(0).value).value : fetchWindowIdFromURL());\n } else {\n return Optional.fromNullable(fetchWindowIdFromURL());\n }\n }\n\n /*\n * determines the faces.js nonce and adds them to the namespace\n * this is done once and only lazily\n */\n get nonce(): ValueEmbedder<string> {\n //already processed\n let myfacesConfig = new ExtConfig(window.myfaces);\n let globalNonce: IValueHolder<string> = myfacesConfig.getIf(\"config\", \"cspMeta\", \"nonce\");\n if (!!globalNonce.value) {\n return ValueEmbedder.fromNullable(globalNonce);\n }\n\n let curScript = new DQ(document.currentScript);\n //since our baseline atm is ie11 we cannot use document.currentScript globally\n let nonce = curScript.nonce;\n if (nonce.isPresent()) {\n // fast-path for modern browsers\n return ValueEmbedder.fromNullable(nonce);\n }\n // fallback if the currentScript method fails, we just search the jsf tags for nonce, this is\n // the last possibility\n let nonceScript: Optional<DomQuery> = Optional.fromNullable(DQ\n .querySelectorAll(\"script[src], link[src]\").asArray\n .filter((item) => item.nonce.isPresent() && item.attr(ATTR_SRC) != null)\n .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))?.[0]);\n if(!nonceScript?.value) {\n return ValueEmbedder.absent as ValueEmbedder<string>;\n }\n\n return new DomQuery(nonceScript.value).nonce;\n }\n\n static searchJsfJsFor(item: RegExp): Optional<String> {\n return new ExtDomQuery(document).searchJsfJsFor(item);\n }\n\n /**\n * searches the embedded faces.js for items like separator char etc.\n * expects a match as variable under position 1 in the result match\n * @param regExp\n */\n searchJsfJsFor(regExp: RegExp): Optional<string> {\n //perfect application for lazy stream\n return Optional.fromNullable(DQ.querySelectorAll(\"script[src], link[src]\").asArray\n .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))\n .map(item => item.attr(ATTR_SRC).value.match(regExp))\n .filter(item => item != null && item.length > 1)\n .map((result: string[]) => {\n return decodeURIComponent(result[1]);\n })?.[0]);\n }\n\n globalEval(code: string, nonce ?: string): DQ {\n return new ExtDomQuery(super.globalEval(code, nonce ?? this.nonce.value));\n }\n\n // called from base class runScripts, do not delete\n // noinspection JSUnusedGlobalSymbols\n globalEvalSticky(code: string, nonce ?: string): DQ {\n return new ExtDomQuery(super.globalEvalSticky(code, nonce ?? this.nonce.value));\n }\n\n /**\n * decorated run scripts which takes our jsf extensions into consideration\n * (standard DomQuery will let you pass anything)\n * @param sticky if set to true the internally generated element for the script is left in the dom\n * @param whiteListed\n */\n runScripts(sticky = false, whiteListed?: (src: string) => boolean): DomQuery {\n const whitelistFunc = (src: string): boolean => {\n return (whiteListed?.(src) ?? true) && !IS_FACES_SOURCE(src) && !IS_INTERNAL_SOURCE(src);\n };\n return super.runScripts(sticky, whitelistFunc);\n }\n\n /**\n * adds the elements in this ExtDomQuery to the head\n *\n * @param suppressDoubleIncludes checks for existing elements in the head before running the insert\n */\n runHeadInserts(suppressDoubleIncludes = true): void {\n let head = ExtDomQuery.byId(document.head);\n //automated nonce handling\n let processedScripts = [];\n\n // the idea is only to run head inserts on resources\n // which do not exist already, that way\n // we can avoid double includes on subsequent resource\n // requests.\n function resourceIsNew(element: DomQuery) {\n if(!suppressDoubleIncludes) {\n return true;\n }\n const tagName = element.tagName.value;\n if(!tagName) {\n // text node they do not have tag names, so we can process them as they are without\n // any further ado\n return true;\n }\n let reference = element.attr(\"href\")\n .orElseLazy(() => element.attr(\"src\").value)\n .orElseLazy(() => element.attr(\"rel\").value);\n\n if (!reference.isPresent()) {\n return true;\n }\n return !head.querySelectorAll(`${tagName}[href='${reference.value}']`).length &&\n !head.querySelectorAll(`${tagName}[src='${reference.value}']`).length &&\n !head.querySelectorAll(`${tagName}[rel='${reference.value}']`).length;\n }\n\n this\n .filter(resourceIsNew)\n .each(element => {\n if(element.tagName.value != \"SCRIPT\") {\n //we need to run runScripts properly to deal with the rest\n new ExtDomQuery(...processedScripts).runScripts(true);\n processedScripts = [];\n head.append(element);\n } else {\n processedScripts.push(element);\n }\n });\n new ExtDomQuery(...processedScripts).runScripts(true);\n }\n\n\n /**\n * byId producer\n *\n * @param selector id\n * @param deep whether the search should go into embedded shadow dom elements\n * @return a DomQuery containing the found elements\n */\n static byId(selector: DomQuery | Element | string, deep = false): ExtDomQuery {\n const ret = DomQuery.byId(selector, deep);\n if($faces().getProjectStage().toLowerCase() == \"development\" &&\n window?.console && ret.isAbsent() && selector) {\n let identifier = (<DomQuery>selector)?.id?.value ?? (<Element>selector)?.id ?? selector.toString();\n console.error(\"Element \" + identifier + \"not found\");\n }\n return new ExtDomQuery(ret);\n }\n\n\n filter(func: (item: DomQuery) => boolean): ExtDomQuery {\n return new ExtDomQuery(super.filter(func));\n }\n}\n\nexport const ExtDQ = ExtDomQuery;\n\n/**\n * in order to reduce the number of interception points for the fallbacks we add\n * the namespace remapping straight to our config accessors\n */\nexport class ExtConfig extends Config {\n\n $nspEnabled = true;\n\n constructor(root: any) {\n super(root);\n }\n\n assignIf(condition: boolean, ...accessPath): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.assignIf(condition, ...accessPathMapped);\n }\n\n assign(...accessPath): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.assign(...accessPathMapped);\n }\n\n append(...accessPath): IValueHolder<any> {\n return super.append(...accessPath);\n }\n\n appendIf(condition: boolean, ...accessPath): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.appendIf(condition, ...accessPathMapped);\n }\n\n getIf(...accessPath): Config {\n const accessPathMapped = this.remap(accessPath);\n return super.getIf(...accessPathMapped);\n }\n\n get(defaultVal: any): Config {\n return super.get($nsp(defaultVal));\n }\n\n delete(key: string): Config {\n return super.delete($nsp(key));\n }\n\n /**\n * creates a config from an initial value or null\n * @param value\n */\n static fromNullable<T>(value?: T | null): Config {\n return new ExtConfig(value);\n }\n\n protected getClass(): any {\n return ExtConfig;\n }\n\n /**\n * shallow copy getter, copies only the first level, references the deeper nodes\n * in a shared manner\n */\n protected shallowCopy$(): Config {\n const ret = super.shallowCopy$();\n return new ExtConfig(ret);\n }\n\n /**\n * deep copy, copies all config nodes\n */\n get deepCopy(): Config {\n return new ExtConfig(super.deepCopy$());\n }\n\n /**\n * helper to remap the namespaces of an array of access paths\n * @param accessPath the access paths to be remapped\n * @private returns an array of access paths with version remapped namespaces\n */\n private remap(accessPath: string[]): string[] {\n if(!this.$nspEnabled) {\n return accessPath;\n }\n return new Es2019Array(...accessPath).map(key => $nsp(key));\n }\n}","import {Config, DomQuery, DQ, Es2019Array} from \"mona-dish\";\nimport {ExtDomQuery} from \"./ExtDomQuery\";\nimport {$faces, EMPTY_STR} from \"../core/Const\";\n\n/*\n * various routines for encoding and decoding url parameters\n * into configs and vice versa\n */\n\n\n/**\n * encodes a given form data into a url encoded string\n * @param formData the form data config object\n * @param paramsMapper the params mapper\n * @param defaultStr a default string if nothing comes out of it\n */\nexport function encodeFormData(formData: Config,\n paramsMapper = (inStr, inVal) => [inStr, inVal],\n defaultStr = EMPTY_STR): string {\n if (formData.isAbsent()) {\n return defaultStr;\n }\n const assocValues = formData.value;\n\n const expandValueArrAndRename = key => assocValues[key].map(val => paramsMapper(key, val));\n const isPropertyKey = key => assocValues.hasOwnProperty(key);\n const isNotFile = ([, value]) => !(value instanceof ExtDomQuery.global().File);\n const mapIntoUrlParam = keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;\n\n return new Es2019Array(...Object.keys(assocValues))\n .filter(isPropertyKey)\n .flatMap(expandValueArrAndRename)\n .filter(isNotFile)\n .map(mapIntoUrlParam)\n .join(\"&\");\n}\n\n/**\n * splits and decodes encoded values into strings containing of key=value\n * @param encoded encoded string\n */\nexport function decodeEncodedValues(encoded: string): string[][] {\n const filterBlanks = item => !!(item || '').replace(/\\s+/g, '');\n const splitKeyValuePair = _line => {\n let line = decodeURIComponent(_line);\n let index = line.indexOf(\"=\");\n if (index == -1) {\n return [line];\n }\n return [line.substring(0, index), line.substring(index + 1)];\n };\n\n let requestParamEntries = encoded.split(/&/gi);\n return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);\n}\n\n\n/**\n * gets all the input files and their corresponding file objects\n * @param dataSource\n */\nexport function resolveFiles(dataSource: DQ): [string, File][] {\n\n const expandFilesArr = ([key, files]) => {\n return [...files].map(file => [key, file]);\n }\n const remapFileInput = fileInput => {\n return [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];\n }\n\n const files = dataSource\n .querySelectorAllDeep(\"input[type='file']\")\n .asArray;\n\n const ret = files\n .map(remapFileInput)\n .flatMap(expandFilesArr);\n\n return ret as any;\n}\n\n\nexport function fixEmptyParameters(keyVal: any[]): [string, any] {\n return (keyVal.length < 3 ? [keyVal?.[0] ?? [], keyVal?.[1] ?? []] : keyVal) as [string, any];\n}\n\n/**\n * returns the decoded viewState from parentItem\n * @param parentItem\n */\nfunction resolveViewState(parentItem: DomQuery): string[][] | [string, File][] {\n const viewStateStr = $faces().getViewState(parentItem.getAsElem(0).value);\n\n // we now need to decode it and then merge it into the target buf\n // which hosts already our overrides (aka do not override what is already there(\n // after that we need to deal with form elements on a separate level\n return decodeEncodedValues(viewStateStr);\n}\n\n/**\n * gets all the inputs under the form parentItem\n * as array\n * @param parentItem\n */\nexport function getFormInputsAsArr(parentItem: DomQuery): string[][] | [string, File][] {\n const standardInputs: any = resolveViewState(parentItem);\n const fileInputs = resolveFiles(parentItem);\n return standardInputs.concat(fileInputs)\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {DomQuery, DQ, DQ$} from \"mona-dish\";\nimport {$faces, $nsp, HTML_CLIENT_WINDOW, HTML_VIEWSTATE, P_CLIENT_WINDOW, P_VIEWSTATE} from \"../core/Const\";\n\n/**\n * Builder for hidden inputs.\n * ATM only ViewState and Client window\n * are supported (per spec)\n *\n * Improves readability in the response processor!\n */\nexport class HiddenInputBuilder {\n private namingContainerId?: string;\n private parent?: DomQuery;\n private namedViewRoot: boolean = false;\n private readonly name: string;\n private readonly template: string;\n\n constructor(private selector: string) {\n const isViewState = selector.indexOf($nsp(P_VIEWSTATE)) != -1;\n this.name = isViewState ? P_VIEWSTATE : P_CLIENT_WINDOW\n this.template = isViewState ? HTML_VIEWSTATE : HTML_CLIENT_WINDOW\n }\n\n withNamingContainerId(namingContainer: string): HiddenInputBuilder {\n this.namingContainerId = namingContainer;\n return this;\n }\n\n withParent(parent: DomQuery): HiddenInputBuilder {\n this.parent = parent;\n return this;\n }\n\n withNamedViewRoot(namedViewRoot: boolean): HiddenInputBuilder {\n this.namedViewRoot = namedViewRoot;\n return this;\n }\n\n\n build(): DomQuery {\n const SEP = $faces().separatorchar;\n\n let existingStates = DQ$(`[name*='${$nsp(this.name)}']`);\n let cnt = existingStates.asArray.map(state => {\n let ident: string = state.id.orElse(\"0\").value;\n ident = ident.substring(ident.lastIndexOf(SEP)+1);\n return parseInt(ident);\n })\n .filter(item => {\n return !isNaN(item);\n })\n .reduce((item1, item2) => {\n return Math.max(item1, item2);\n }, 0); //we start with 1 (see cnt++)\n //the maximum new ident is the current max + 1\n cnt++;\n\n\n const newElement = DQ.fromMarkup($nsp(this.template));\n newElement.id.value = ((this.namingContainerId?.length) ?\n [this.namingContainerId, $nsp(this.name), cnt]:\n [$nsp(this.name), cnt]).join(SEP);\n\n //name must be prefixed with the naming container id as well according to the jsdocs\n if(this.namedViewRoot) {\n newElement.name.value = (this.namingContainerId?.length) ?\n [this.namingContainerId, $nsp(this.name)].join(SEP): $nsp(this.name);\n } else {\n newElement.name.value = $nsp(this.name);\n }\n\n\n this?.parent?.append(newElement);\n return newElement;\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {Lang as LangBase, Config, Optional, DomQuery, DQ} from \"mona-dish\";\nimport {Messages} from \"../i18n/Messages\";\nimport {EMPTY_STR, HTML_TAG_FORM} from \"../core/Const\";\nimport {getEventTarget} from \"../xhrCore/RequestDataResolver\";\nimport {Es2019Array} from \"mona-dish\";\n\n\nexport namespace ExtLang {\n\n let installedLocale: Messages;\n let nameSpace = \"impl/util/Lang/\";\n\n export function getLanguage(): string {\n //TODO global config override\n\n let language: string = (navigator as any).languages?.[0] ?? navigator?.language;\n language = language.split(\"-\")[0];\n return language;\n }\n\n //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those\n /**\n * helper function to safely resolve anything\n * this is not an elvis operator, it resolves\n * a value without exception in a tree and if\n * it is not resolvable then an optional of\n * a default value is restored or Optional\\.empty\n * if none is given\n *\n * usage\n * <code>\n * let var: Optional<string> = saveResolve(() => a.b.c.d.e, \"foobaz\")\n * </code>\n *\n * @param resolverProducer a lambda which can produce the value\n * @param defaultValue an optional default value if the producer fails to produce anything\n * @returns an Optional of the produced value\n */\n export function failSaveResolve<T>(resolverProducer: () => T, defaultValue: T = null): Optional<T> {\n return LangBase.saveResolve(resolverProducer, defaultValue);\n }\n\n /**\n * under some conditions it makes sense to swallow errors and return a default value in the error case\n * classical example the optional resolution of values in a chain (thankfully now covered by Typescript itself)\n * another example which we have in our system is that some operations fail only under test due to test framework\n * limitations while they cannot fail in the real world.\n *\n * @param resolverProducer a producer function which produces a value in the non error case\n * @param defaultValue the default value in case of a fail of the function\n */\n export function failSaveExecute<T>(resolverProducer: () => any, defaultValue: T = null): void {\n LangBase.saveResolve(resolverProducer, defaultValue);\n }\n\n /**\n * returns a given localized message upon a given key\n * basic java log like templating functionality is included\n *\n * @param key the key for the message\n * @param defaultMessage optional default message if none was found\n *\n * Additionally, you can pass additional arguments, which are used\n * in the same way java log templates use the params\n *\n * @param templateParams the param list to be filled in\n */\n export function getMessage(key: string, defaultMessage?: string, ...templateParams: Array<string>): string {\n installedLocale = installedLocale ?? new Messages();\n\n let msg = installedLocale[key] ?? defaultMessage ?? key;\n templateParams.forEach((param, cnt) => {\n msg = msg.replace(new RegExp([\"\\\\{\", cnt, \"\\\\}\"].join(EMPTY_STR), \"g\"), param);\n })\n\n\n return msg;\n }\n\n /**\n * transforms a key value pair into a string\n * @param key the key\n * @param val the value\n * @param delimiter the delimiter\n */\n export function keyValToStr(key: string, val: string, delimiter: string = \"\\n\") {\n return [key, val].join(delimiter);\n }\n\n /**\n * creates an exception with additional internal parameters\n * for extra information\n *\n * @param error\n * @param title the exception title\n * @param name the exception name\n * @param callerCls the caller class\n * @param callFunc the caller function\n * @param message the message for the exception\n */\n export function makeException(error: Error, title: string, name: string, callerCls: string, callFunc: string, message: string): Error {\n\n return new Error(message + (callerCls ?? nameSpace) + callFunc );\n\n }\n\n /**\n * fetches a global config entry\n * @param configName the name of the configuration entry\n * @param defaultValue\n *\n * @return either the config entry or if none is given the default value\n */\n export function getGlobalConfig(configName: string, defaultValue: any): any {\n /**\n * note we could use exists but this is a heavy operation, since the config name usually\n * given this function here is called very often\n * is a single entry without . in between we can do the lighter shortcut\n */\n return window?.myfaces?.config?.[configName] ?? defaultValue;\n }\n\n /**\n * fetches the form in a fuzzy manner depending\n * on an element or event target.\n *\n * The idea is that according to the jsf spec\n * the enclosing form of the issuing element needs to be fetched.\n *\n * This is fine, but since then html5 came into the picture with the form attribute the element\n * can be anywhere referencing its parent form.\n *\n * Also, theoretically you can have the case of an issuing element enclosing a set of forms\n * (not really often used, but theoretically it could be input button allows to embed html for instance)\n *\n * So the idea is not to limit the issuing form determination to the spec case\n * but also cover the theoretical and html5 corner case.\n *\n * @param elem\n * @param event\n */\n export function getForm(elem: Element, event ?: Event): DQ | never {\n\n let queryElem = new DQ(elem);\n let eventTarget = (event) ? new DQ(getEventTarget(event)) : DomQuery.absent;\n\n if (queryElem.isTag(HTML_TAG_FORM)) {\n return queryElem;\n }\n\n //html 5 for handling\n if (queryElem.attr(HTML_TAG_FORM).isPresent()) {\n let formId = queryElem.attr(HTML_TAG_FORM).value;\n let foundForm = DQ.byId(formId, true);\n if (foundForm.isPresent()) {\n return foundForm;\n }\n }\n\n //no direct form is found we look for parent/child relationships as fallback\n //(90% case)\n let form = queryElem.firstParent(HTML_TAG_FORM)\n .orElseLazy(() => queryElem.byTagName(HTML_TAG_FORM, true))\n .orElseLazy(() => eventTarget.firstParent(HTML_TAG_FORM))\n .orElseLazy(() => eventTarget.byTagName(HTML_TAG_FORM))\n .first();\n\n //either a form is found within parent child - nearest form (aka first)\n //or we look for a single form\n form = form.orElseLazy(() => DQ.byTagName(HTML_TAG_FORM));\n\n //the end result must be a found form otherwise - Exception\n assertOnlyOneFormExists(form);\n\n return form;\n }\n\n /**\n * gets the local or global options with local ones having higher priority\n * if no local or global one was found then the default value is given back\n *\n * @param configName the name of the configuration entry\n * @param localOptions the local options root for the configuration myfaces as default marker is added\n * implicitly\n *\n * @param defaultValue\n *\n * @return either the config entry or if none is given the default value\n */\n export function getLocalOrGlobalConfig(localOptions: Config, configName: string, defaultValue: any): any {\n return localOptions.value?.myfaces?.config?.[configName] ??\n window?.myfaces?.config?.[configName] ??\n defaultValue;\n }\n\n /**\n * expands an associative array into an array of key value tuples\n * @param value\n */\n export function ofAssoc(value: {[key: string]: any}) {\n return new Es2019Array(...Object.keys(value))\n .map(key => [key, value[key]]);\n }\n\n export function collectAssoc(target: any, item: any) {\n target[item[0]] = item[1];\n return target;\n }\n\n /**\n * The active timeout for the \"debounce\".\n * Since we only use it in the XhrController\n * we can use a local module variable here\n */\n let activeTimeouts = {};\n\n\n\n\n /**\n * a simple debounce function\n * which waits until a timeout is reached and\n * if something comes in in between debounces\n *\n * @param runnable a runnable which should go under debounce control\n * @param timeout a timeout for the debounce window\n */\n export function debounce(key, runnable, timeout) {\n function clearActiveTimeout() {\n clearTimeout(activeTimeouts[key]);\n delete activeTimeouts[key];\n }\n\n if (!!(activeTimeouts?.[key])) {\n clearActiveTimeout();\n }\n if (timeout > 0) {\n activeTimeouts[key] = setTimeout(() => {\n try {\n runnable();\n } finally {\n clearActiveTimeout();\n }\n }, timeout);\n } else {\n runnable();\n }\n }\n\n /**\n * assert that the form exists and only one form exists and throw an exception in the case it does not\n *\n * @param forms the form to check for\n */\n function assertOnlyOneFormExists(forms: DomQuery): void | never {\n if (forms.isAbsent() || forms.length > 1) {\n throw makeException(new Error(), null, null, \"Impl\", \"getForm\", getMessage(\"ERR_FORM\"));\n }\n }\n}","import {IAsyncRunnable} from \"./AsyncRunnable\";\nimport {ExtLang} from \"./Lang\";\nconst debounce = ExtLang.debounce;\n\n/**\n * A simple XHR queue controller\n * following the async op -> next pattern\n * Faces enforces for the XHR handling\n */\nexport class XhrQueueController<T extends IAsyncRunnable<any>> {\n queue = [];\n taskRunning = false;\n\n constructor() {\n }\n\n /**\n * executes or enqueues an element\n * @param runnable the runnable (request) to be enqueued\n * @param timeOut timeout if > 0 which defers the execution\n * until the debounce window for the timeout is closed.\n */\n enqueue(runnable: T, timeOut: number = 0) {\n debounce(\"xhrQueue\", () => {\n const requestHandler = this.enrichRunnable(runnable);\n if (!this.taskRunning) {\n this.signalTaskRunning();\n requestHandler.start();\n } else {\n this.queue.push(requestHandler);\n }\n }, timeOut);\n }\n\n /**\n * trigger the next element in the queue\n * to be started!\n */\n next() {\n this.updateTaskRunning();\n const next = this.queue.shift();\n next?.start();\n }\n\n /**\n * clears and resets the queue\n */\n clear() {\n this.queue.length = 0;\n this.updateTaskRunning();\n }\n\n /**\n * true if queue is empty\n */\n get isEmpty(): boolean {\n return !this.queue.length;\n }\n\n /**\n * Enriches the incoming async asyncRunnable\n * with the error and next handling\n * (aka: asyncRunnable is done -> next\n * error -> clear queue\n * @param asyncRunnable the async runnable which needs enrichment\n * @private\n */\n private enrichRunnable(asyncRunnable: T) {\n /**\n * we can use the Promise pattern asyncrunnable uses\n * to trigger queue control callbacks of next element\n * and clear the queue (theoretically this\n * would work with any promise)\n */\n return asyncRunnable\n .then(() => this.next())\n .catch(() => this.clear());\n }\n\n\n /**\n * alerts the queue that a task is running\n *\n * @private\n */\n private signalTaskRunning() {\n this.taskRunning = true;\n }\n\n /**\n * updates the task running status according to the current queue\n * @private\n */\n private updateTaskRunning() {\n this.taskRunning = !this.isEmpty;\n }\n\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n EMPTY_STR, ERROR,\n ERROR_MESSAGE,\n ERROR_NAME, HTTP_ERROR,\n RESPONSE_TEXT,\n RESPONSE_XML, SERVER_ERROR,\n SOURCE,\n STATUS,\n UNKNOWN\n} from \"../core/Const\";\nimport {Config, DQ, Optional, XMLQuery} from \"mona-dish\";\n\nimport {EventData} from \"./EventData\";\nimport {ExtLang} from \"../util/Lang\";\nconst getMessage = ExtLang.getMessage;\n\n\nexport enum ErrorType {\n SERVER_ERROR = \"serverError\",\n HTTP_ERROR = \"httpError\",\n CLIENT_ERROR = \"clientError\",\n TIMEOUT = \"timeout\"\n}\n\n/**\n * the spec has a problem of having the error\n * object somewhat underspecified, there is no clear\n * description of the required contents.\n * I want to streamline it with mojarra here\n * hence we are going to move\n * everything into the same attributes,\n * I will add deprecated myfaces backwards compatibility attributes as well\n */\nexport class ErrorData extends EventData implements IErrorData {\n\n type: string = \"error\";\n source: string | Element;\n\n errorName: string;\n errorMessage: string;\n\n responseText: string;\n responseXML: any;\n\n status: string;\n typeDetails: ErrorType;\n\n serverErrorName: string;\n serverErrorMessage: string;\n description: string;\n\n constructor(source: string | Element, errorName: string, errorMessage: string, responseText: string = null, responseXML: Document = null, responseCode: number = -1, statusOverride: string = null, type = ErrorType.CLIENT_ERROR) {\n super();\n\n ///MYFACES-4676 error payload expects an element if possible\n //this code remaps the string in an element and if not existing just passes as is what comes in\n this.source = DQ.byId(source).value.orElse(source).value;\n this.type = ERROR;\n this.errorName = errorName;\n\n //tck requires that the type is prefixed to the message itself (jsdoc also) in case of a server error\n this.errorMessage = (type == ErrorType.SERVER_ERROR) ? type + \": \" + errorMessage : errorMessage;\n this.responseCode = responseCode;\n this.responseText = responseText;\n this.responseXML = responseXML;\n\n this.status = statusOverride;\n\n this.description = `Status: ${this.status}\\nResponse Code: ${this.responseCode}\\nError Message: ${this.errorMessage}`;\n\n this.typeDetails = type;\n\n if (type == ErrorType.SERVER_ERROR) {\n this.serverErrorName = this.errorName;\n this.serverErrorMessage = this.errorMessage;\n }\n }\n\n static fromClient(e: Error): ErrorData {\n return new ErrorData((e as any)?.source ?? \"client\", e?.name ?? EMPTY_STR, e?.message ?? EMPTY_STR, e?.stack ?? EMPTY_STR);\n }\n\n static fromHttpConnection(source: any, name: string, message: string, responseText: string, responseXML: Document, responseCode: number, status: string = EMPTY_STR): ErrorData {\n return new ErrorData(source, name, message, responseText, responseXML, responseCode, status, ErrorType.HTTP_ERROR);\n }\n\n static fromGeneric(context: Config, errorCode: number, errorType: ErrorType = ErrorType.SERVER_ERROR): ErrorData {\n\n let getMsg = this.getMsg;\n\n let source = getMsg(context, SOURCE);\n let errorName = getMsg(context, ERROR_NAME);\n let errorMessage = getMsg(context, ERROR_MESSAGE);\n let status = getMsg(context, STATUS);\n let responseText = getMsg(context, RESPONSE_TEXT);\n let responseXML: Document = context.getIf(RESPONSE_XML).value;\n\n\n return new ErrorData(source, errorName, errorMessage, responseText, responseXML, errorCode, status, errorType);\n }\n\n private static getMsg(context, param) {\n return getMessage(context.getIf(param).orElse(EMPTY_STR).value);\n }\n\n static fromServerError(context: Config): ErrorData {\n return this.fromGeneric(context, -1);\n }\n\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, DQ} from \"mona-dish\";\nimport {BEGIN, CTX_PARAM_REQ_PASS_THR, EVENT, P_AJAX_SOURCE, SOURCE} from \"../core/Const\";\n\nexport class EventData implements IEventData{\n type: string;\n status: string;\n source: any;\n responseCode: number;\n responseText: string;\n responseXML: Document;\n\n static createFromRequest(request: XMLHttpRequest, internalContext: Config, context: Config, /*event name*/ name: string): EventData {\n\n let eventData = new EventData();\n let internalSource = \"_internal._source\";\n eventData.type = EVENT;\n eventData.status = name;\n\n eventData.source = internalContext.getIf(\"_source\",\"_element\").value;\n // this fixes the issue that the source element is not present anymore at done\n // at page transitions\n if( !eventData.source) {\n let sourceId: string = context.getIf(SOURCE)\n .orElseLazy(() => context.getIf(P_AJAX_SOURCE).value)\n .orElseLazy(() => context.getIf(CTX_PARAM_REQ_PASS_THR, P_AJAX_SOURCE).value)\n .value;\n if (sourceId) {\n eventData.source = DQ.byId(sourceId, true).first().value.value;\n }\n if (eventData.source) {\n //we store the event source for later references\n internalContext.assign(\"_source\",\"_element\").value = eventData.source;\n }\n }\n\n if (name !== BEGIN) {\n eventData.responseCode = request?.status;\n eventData.responseText = request?.responseText;\n eventData.responseXML = request?.responseXML;\n }\n return eventData;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DomQuery, DQ} from \"mona-dish\";\nimport {\n $faces,\n $nsp,\n CTX_OPTIONS_DELAY,\n CTX_OPTIONS_TIMEOUT,\n DELAY_NONE,\n EMPTY_FUNC,\n EMPTY_STR,\n ENCODED_URL, NAMED_VIEWROOT, NAMING_CONTAINER_ID,\n P_VIEWSTATE,\n REQ_TYPE_GET,\n REQ_TYPE_POST\n} from \"../core/Const\";\nimport {XhrFormData} from \"./XhrFormData\";\nimport {ExtLang} from \"../util/Lang\";\nimport {ExtConfig, ExtDomQuery} from \"../util/ExtDomQuery\";\nimport {Assertions} from \"../util/Assertions\";\n\n\n/**\n * Resolver functions for various aspects of the request data\n *\n * stateless because it might be called from various\n * parts of the response classes\n */\n\n/**\n * resolves the event handlers lazily\n * so that if some decoration happens in between we can deal with it\n *\n * @param requestContext\n * @param responseContext\n * @param funcName\n */\nexport function resolveHandlerFunc(requestContext: Config, responseContext: Config, funcName: string) {\n responseContext = responseContext || new Config({});\n return responseContext.getIf(funcName)\n .orElseLazy(() =>requestContext.getIf(funcName).value)\n .orElse(EMPTY_FUNC).value;\n}\n\nexport function resolveTargetUrl(srcFormElement: HTMLFormElement) {\n return (typeof srcFormElement.elements[ENCODED_URL] == 'undefined') ?\n srcFormElement.action :\n srcFormElement.elements[ENCODED_URL].value;\n}\n\nexport function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, ajaxType = REQ_TYPE_POST) {\n let targetUrl = resolveTargetUrl(<HTMLFormElement>sourceForm.getAsElem(0).value);\n\n return targetUrl + (ajaxType == REQ_TYPE_GET ? \"?\" + formData.toString() : EMPTY_STR);\n}\n\n/**\n * form resolution the same way our old implementation did\n * it is either the id or the parent form of the element or an embedded form\n * of the element\n *\n * @param elem\n * @param event\n */\nexport function resolveForm(elem: DQ, event: Event): DQ {\n return ExtLang.getForm(elem.getAsElem(0).value, event);\n}\n\nexport function resolveViewId(form: DQ): string {\n const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).id.orElse(\"\").value;\n const divider = $faces().separatorchar;\n const viewId = viewState.split(divider, 2)[0];\n const viewStateViewId = viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : \"\";\n // myfaces specific, we in non portlet environments prepend the viewId\n // even without being in a naming container, the other components ignore that\n return form.id.value.indexOf(viewStateViewId) === 0 ? viewStateViewId : \"\";\n}\n\nexport function resolveViewRootId(form: DQ): string {\n const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).attr(\"name\").orElse(\"\").value;\n const divider = $faces().separatorchar;\n const viewId = viewState.split(divider, 2)[0];\n //different to the identifier the form id is never prepended to the viewstate\n return viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : \"\";\n}\n\n/**\n * as per jsdoc before the request it must be ensured that every post argument\n * is prefixed with the naming container id (there is an exception in mojarra with\n * the element=element param, which we have to follow here as well.\n * (inputs are prefixed by name anyway normally this only affects our standard parameters)\n * @private\n */\nexport function resoveNamingContainerMapper(internalContext: Config): (key: string, value: any) => [string, any] {\n const isNamedViewRoot = internalContext.getIf(NAMED_VIEWROOT).isPresent();\n if(!isNamedViewRoot) {\n return (key, value) => [key, value];\n }\n const partialId = internalContext.getIf(NAMING_CONTAINER_ID).value;\n const SEP = $faces().separatorchar;\n const prefix = partialId + SEP;\n return (key: string, value: any) => (key.indexOf(prefix) == 0) ? [key, value] : [prefix + key, value];\n}\n\nexport function resolveTimeout(options: Config): number {\n let getCfg = ExtLang.getLocalOrGlobalConfig;\n return options.getIf(CTX_OPTIONS_TIMEOUT).value ?? getCfg(options.value, CTX_OPTIONS_TIMEOUT, 0);\n}\n\n/**\n * resolve the delay from the options and/or the request context and or the configuration\n *\n * @param options ... the options object, in most cases it will host the delay value\n */\nexport function resolveDelay(options: Config): number {\n // null, 'none', or undefined will automatically be mapped to 0 aka no delay\n // the config delay will be dropped not needed anymore, it does not really\n // make sense anymore now that it is part of a local spec\n let ret = options.getIf(CTX_OPTIONS_DELAY).orElse(0).value;\n // if delay === none, no delay must be used, aka delay 0\n ret = (DELAY_NONE === ret) ? 0 : ret;\n // negative, or invalid values will automatically get a js exception\n Assertions.assertDelay(ret);\n return ret;\n}\n\n/**\n * resolves the window-id from various sources\n *\n * @param options\n */\nexport function resolveWindowId(options: Config): string | null {\n return options?.value?.windowId ?? ExtDomQuery.windowId.value;\n}\n\n/**\n * cross port from the dojo lib\n * browser save event resolution\n * @param evt the event object\n * (with a fallback for ie events if none is present)\n * @deprecated soon will be removed\n */\nexport function getEventTarget(evt: Event): Element {\n // ie6 and 7 fallback\n let finalEvent = evt;\n /*\n * evt source is defined in the jsf events\n * seems like some component authors use our code,\n * so we add it here see also\n * https://issues.apache.org/jira/browse/MYFACES-2458\n * not entirely a bug but makes sense to add this\n * behavior. I don´t use it that way but nevertheless it\n * does not break anything so why not\n */\n let t = finalEvent?.srcElement ?? finalEvent?.target ?? (finalEvent as any)?.source;\n while ((t) && (t.nodeType != 1)) {\n t = t.parentNode;\n }\n return t;\n}\n\n/**\n * resolves a bunch of default values\n * which can be further processed from the given\n * call parameters of faces.ajax.request\n *\n * @param event\n * @param opts\n * @param el\n */\nexport function resolveDefaults(event: Event, opts: Options | [[string, any]] , el: Element | string = null): any {\n //deep copy the options, so that further transformations to not backfire into the callers\n const elem = DQ.byId(el || <Element>event.target, true);\n const options = new ExtConfig(opts).deepCopy as ExtConfig;\n return {\n options: options,\n elem: elem,\n elementId: elem.id.value,\n windowId: resolveWindowId(options),\n isResetValues: true === options.value?.resetValues\n };\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DQ, XMLQuery} from \"mona-dish\";\nimport {ResponseProcessor} from \"./ResponseProcessor\";\n\nimport {IResponseProcessor} from \"./IResponseProcessor\";\nimport {\n $nsp,\n XML_TAG_ATTRIBUTES,\n XML_TAG_CHANGES,\n XML_TAG_DELETE,\n XML_TAG_ERROR,\n XML_TAG_EVAL,\n XML_TAG_EXTENSION,\n XML_TAG_INSERT,\n XML_TAG_REDIRECT,\n XML_TAG_UPDATE, P_RESOURCE,\n P_VIEWBODY,\n P_VIEWHEAD,\n P_VIEWROOT,\n NAMING_CONTAINER_ID,\n XML_TAG_PARTIAL_RESP,\n RESPONSE_XML,\n XML_TAG_AFTER,\n XML_TAG_BEFORE, NAMED_VIEWROOT, XML_ATTR_NAMED_VIEWROOT, P_VIEWSTATE, $faces\n} from \"../core/Const\";\nimport {resolveContexts, resolveResponseXML} from \"./ResponseDataResolver\";\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n\n\nexport namespace Response {\n\n\n /**\n * Standardized faces.ts response\n * this one is called straight from faces.ts.response\n *\n * The processing follows the spec by going for the responseXML\n * and processing its tags\n *\n * @param {XMLHttpRequest} request (xhrRequest) - xhr request object\n * @param context {Context} context (Map) - AJAX context\n *\n */\n export function processResponse(request: XMLHttpRequest, context: Context) {\n\n let req = ExtConfig.fromNullable(request);\n let {externalContext, internalContext} = resolveContexts(context);\n let responseXML: XMLQuery = resolveResponseXML(req);\n let responseProcessor = new ResponseProcessor(req, externalContext, internalContext);\n\n internalContext.assign(RESPONSE_XML).value = responseXML;\n\n // we now process the partial tags, or in none given raise an error\n responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)\n .each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));\n\n // We now process the viewStates, client windows and the elements to be evaluated are delayed.\n // The reason for this is that often it is better\n // to wait until the document has caught up before\n // doing any evaluations even on embedded scripts.\n // Usually this does not matter, the client window comes in almost last always anyway\n // we maybe drop this deferred assignment in the future, but myfaces did it until now.\n responseProcessor.updateNamedViewRootState();\n responseProcessor.fixViewStates();\n responseProcessor.fixClientWindow();\n responseProcessor.globalEval();\n\n responseProcessor.done();\n }\n\n /**\n * highest node partial-response from there the main operations are triggered\n */\n function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext) {\n\n\n /*\n https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd\n The \"partial-response\" element is the root of the partial response information hierarchy,\n and contains nested elements for all possible elements that can exist in the response.\n This element must have an \"id\" attribute whose value is the return from calling getContainerClientId()\n on the UIViewRoot to which this response pertains.\n */\n // we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page\n // under or in body as identifier\n\n let partialId:string = node?.id?.value;\n internalContext.assignIf(!!partialId, NAMING_CONTAINER_ID).value = partialId; // second case mojarra\n\n // there must be at least one container viewstate element resembling the viewroot that we know\n // this is named\n responseProcessor.updateNamedViewRootState();\n\n const SEL_SUB_TAGS = [XML_TAG_ERROR, XML_TAG_REDIRECT, XML_TAG_CHANGES].join(\",\");\n\n // now we can process the main operations\n node.querySelectorAll(SEL_SUB_TAGS).each((node: XMLQuery) => {\n switch (node.tagName.value) {\n case XML_TAG_ERROR:\n responseProcessor.error(node);\n break;\n case XML_TAG_REDIRECT:\n responseProcessor.redirect(node);\n break;\n case XML_TAG_CHANGES:\n processChangesTag(node, responseProcessor);\n break;\n }\n });\n }\n\n let processInsert = function (responseProcessor: IResponseProcessor, node: XMLQuery) {\n // path1 insert after as child tags\n if(node.querySelectorAll([XML_TAG_BEFORE, XML_TAG_AFTER].join(\",\")).length) {\n responseProcessor.insertWithSubTags(node);\n } else { // insert before after with id\n responseProcessor.insert(node);\n }\n\n };\n\n /**\n * next level changes tag\n *\n * @param node\n * @param responseProcessor\n */\n function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {\n const ALLOWED_TAGS = [XML_TAG_UPDATE, XML_TAG_EVAL, XML_TAG_INSERT, XML_TAG_DELETE, XML_TAG_ATTRIBUTES, XML_TAG_EXTENSION].join(\", \");\n node.querySelectorAll(ALLOWED_TAGS).each(\n (node: XMLQuery) => {\n switch (node.tagName.value) {\n case XML_TAG_UPDATE:\n processUpdateTag(node, responseProcessor);\n break;\n\n case XML_TAG_EVAL:\n responseProcessor.eval(node);\n break;\n\n case XML_TAG_INSERT:\n processInsert(responseProcessor, node);\n break;\n\n case XML_TAG_DELETE:\n responseProcessor.delete(node);\n break;\n\n case XML_TAG_ATTRIBUTES:\n responseProcessor.attributes(node);\n break;\n\n case XML_TAG_EXTENSION:\n break;\n }\n }\n );\n return true;\n }\n\n /**\n * checks and stores a state update for delayed processing\n *\n * @param responseProcessor the response processor to perform the store operation\n * @param node the xml node to check for the state\n *\n * @private\n */\n function storeState(responseProcessor: IResponseProcessor, node: XMLQuery) {\n return responseProcessor.processViewState(node) || responseProcessor.processClientWindow(node);\n }\n\n /**\n * branch tag update. drill further down into the updates\n * special case viewState in that case it is a leaf\n * and the viewState must be processed\n *\n * @param node\n * @param responseProcessor\n */\n function processUpdateTag(node: XMLQuery, responseProcessor: IResponseProcessor) {\n // early state storing, if no state we perform a normal update cycle\n if (!storeState(responseProcessor, node)) {\n handleElementUpdate(node, responseProcessor);\n }\n }\n\n /**\n * element update\n *\n * @param node\n * @param responseProcessor\n */\n function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {\n let cdataBlock = node.cDATAAsString;\n switch (node.id.value) {\n case $nsp(P_VIEWROOT) :\n responseProcessor.replaceViewRoot(DQ.fromMarkup(cdataBlock.substring(cdataBlock.indexOf(\"<html\"))));\n break;\n\n case $nsp(P_VIEWHEAD):\n responseProcessor.replaceHead(DQ.fromMarkup(cdataBlock));\n break;\n\n case $nsp(P_VIEWBODY):\n responseProcessor.replaceBody(DQ.fromMarkup(cdataBlock));\n break;\n\n case $nsp(P_RESOURCE):\n responseProcessor.addToHead(DQ.fromMarkup(cdataBlock))\n break;\n\n default:// htmlItem replacement\n responseProcessor.update(node, cdataBlock);\n break;\n }\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, Optional, XMLQuery} from \"mona-dish\";\n\nimport {Assertions} from \"../util/Assertions\";\nimport {DQ} from \"mona-dish\";\nimport {\n $nsp,\n CTX_PARAM_MF_INTERNAL,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_SRC_FRM_ID,\n SEL_RESPONSE_XML,\n SOURCE,\n HTML_TAG_FORM,\n UPDATE_ELEMS,\n UPDATE_FORMS,\n DEFERRED_HEAD_INSERTS\n} from \"../core/Const\";\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n/**\n * Resolver functions for various aspects of the response data\n *\n * stateless because it might be called from various\n * parts of the response classes\n */\n\n/**\n * fetches the response XML\n * as XML Query object\n *\n * @param request the request hosting the responseXML\n *\n * Throws an error in case of non-existent or wrong xml data\n *\n */\nexport function resolveResponseXML(request: Config): XMLQuery {\n let ret = new XMLQuery($nsp(request.getIf(SEL_RESPONSE_XML).value));\n Assertions.assertValidXMLResponse(ret);\n\n return ret;\n}\n\n/**\n * Splits the incoming pass-through context apart\n * in an internal and an external normalized context\n * the internal one is just for our internal processing\n *\n * @param context the root context as associative array\n */\nexport function resolveContexts(context: { [p: string]: any }): any {\n /**\n * we split the context apart into the external one and\n * some internal values\n */\n let externalContext = ExtConfig.fromNullable(context);\n let internalContext = externalContext.getIf(CTX_PARAM_MF_INTERNAL);\n if (!internalContext.isPresent()) {\n internalContext = ExtConfig.fromNullable({});\n }\n\n /**\n * prepare storage for some deferred operations\n */\n internalContext.assign(DEFERRED_HEAD_INSERTS).value = [];\n internalContext.assign(UPDATE_FORMS).value = [];\n internalContext.assign(UPDATE_ELEMS).value = [];\n return {externalContext, internalContext};\n}\n\n/**\n * fetches the source element out of our contexts\n *\n * @param context the external context which should host the source id\n * @param internalContext internal pass-through fall back\n *\n */\nexport function resolveSourceElement(context: Config, internalContext: Config): DQ {\n let elemId = resolveSourceElementId(context, internalContext);\n return DQ.byId(elemId.value, true);\n}\n\n/**\n * fetches the source form if it still exists\n * also embedded forms and parent forms are taken into consideration\n * as fallbacks\n *\n * @param internalContext\n * @param elem\n */\nexport function resolveSourceForm(internalContext: Config, elem: DQ): DQ {\n let sourceFormId = internalContext.getIf(CTX_PARAM_SRC_FRM_ID);\n let sourceForm = new DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);\n\n sourceForm = sourceForm.orElseLazy(() => elem.firstParent(HTML_TAG_FORM))\n .orElseLazy(() => elem.querySelectorAll(HTML_TAG_FORM))\n .orElseLazy(() => DQ.querySelectorAll(HTML_TAG_FORM));\n\n return sourceForm;\n}\n\nfunction resolveSourceElementId(context: Config, internalContext: Config): Optional<string> {\n //?internal context?? used to be external one\n return internalContext.getIf(CTX_PARAM_SRC_CTL_ID)\n .orElseLazy(() => context.getIf(SOURCE, \"id\").value);\n}\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DomQuery, DQ, DQ$, Lang, XMLQuery} from \"mona-dish\";\nimport {Implementation} from \"../AjaxImpl\";\nimport {Assertions} from \"../util/Assertions\";\nimport {IResponseProcessor} from \"./IResponseProcessor\";\nimport {ErrorData} from \"./ErrorData\";\nimport {StateHolder} from \"../core/ImplTypes\";\nimport {EventData} from \"./EventData\";\n\nimport {\n $faces,\n $nsp,\n APPLIED_CLIENT_WINDOW,\n APPLIED_VST,\n ATTR_ID,\n ATTR_NAME,\n ATTR_URL,\n ATTR_VALUE,\n DEFERRED_HEAD_INSERTS,\n EMPTY_FUNC,\n EMPTY_STR,\n ERROR_MESSAGE,\n ERROR_NAME,\n HTML_TAG_BODY,\n HTML_TAG_FORM,\n HTML_TAG_HEAD,\n HTML_TAG_LINK,\n HTML_TAG_SCRIPT,\n HTML_TAG_STYLE, IDENT_ALL, IDENT_NONE, NAMED_VIEWROOT,\n ON_ERROR,\n ON_EVENT,\n P_CLIENT_WINDOW,\n P_EXECUTE,\n P_AJAX_SOURCE,\n P_RENDER,\n P_RENDER_OVERRIDE,\n P_VIEWSTATE,\n NAMING_CONTAINER_ID,\n RESPONSE_XML,\n SEL_CLIENT_WINDOW_ELEM,\n SEL_VIEWSTATE_ELEM,\n SOURCE,\n SUCCESS,\n UPDATE_ELEMS,\n UPDATE_FORMS,\n XML_TAG_AFTER,\n XML_TAG_ATTR,\n XML_TAG_BEFORE\n} from \"../core/Const\";\nimport {ExtConfig, ExtDomQuery} from \"../util/ExtDomQuery\";\nimport {HiddenInputBuilder} from \"../util/HiddenInputBuilder\";\nconst trim = Lang.trim;\nimport {ExtLang} from \"../util/Lang\";\nconst ofAssoc = ExtLang.ofAssoc;\n\n\n/**\n * Response processor\n *\n * Each XML tag is either a node or a leaf\n * or both\n *\n * the processor provides a set of operations\n * which are executed on a single leaf node per operation\n * and present the core functionality of our response\n *\n * Note the response processor is stateful hence we bundle it in a class\n * to reduce code we keep references tot contexts in place\n */\nexport class ResponseProcessor implements IResponseProcessor {\n\n constructor(private request: Config, private externalContext: Config, private internalContext: Config) {\n }\n\n /**\n * head replacement\n * @param shadowDocument incoming shadow head data (aka cdata as xml reference or dom element)\n * the data incoming must represent the html representation of the head itself one way or the other\n */\n replaceHead(shadowDocument: XMLQuery | DQ) {\n const shadowHead = shadowDocument.querySelectorAll(HTML_TAG_HEAD);\n if (!shadowHead.isPresent()) {\n return;\n }\n const head = ExtDomQuery.querySelectorAll(HTML_TAG_HEAD);\n // full replace we delete everything\n head.childNodes.delete();\n this.addToHead(shadowHead);\n //we copy the attributes as well (just in case myfaces introduces the id in head)\n head.copyAttrs(shadowHead);\n }\n\n addToHead(shadowHead: XMLQuery | DQ) {\n const mappedHeadData = new ExtDomQuery(shadowHead);\n const scriptTags = [HTML_TAG_SCRIPT];\n const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse(\"\").value) == -1);\n nonExecutables.runHeadInserts(true);\n\n //incoming either the outer head tag or its children\n const nodesToAdd = (shadowHead.tagName.value === \"HEAD\") ? shadowHead.childNodes : shadowHead;\n // this is stored for \"post\" processing\n // after the rest of the \"physical build up\", head before body\n const scriptElements = new DomQuery(...nodesToAdd.asArray\n .filter(item => scriptTags.indexOf(item.tagName.orElse(\"\").value) != -1));\n\n this.addToHeadDeferred(scriptElements);\n }\n\n addToHeadDeferred(newElements: XMLQuery | DQ) {\n this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(newElements);\n }\n\n /**\n * replaces the body in the expected manner\n * which means the entire body content is refreshed\n * however also the body attributes must be transferred\n * keeping event handlers etc... in place\n *\n * @param shadowDocument .. an incoming shadow document hosting the new nodes\n */\n replaceBody(shadowDocument: XMLQuery | DQ) {\n\n const shadowBody = shadowDocument.querySelectorAll(HTML_TAG_BODY);\n if (!shadowBody.isPresent()) {\n return;\n }\n\n const shadowInnerHTML: string = <string>shadowBody.innerHTML;\n const resultingBody = <DQ>ExtDomQuery.querySelectorAll(HTML_TAG_BODY);\n const updateForms = resultingBody.querySelectorAll(HTML_TAG_FORM);\n\n // main difference, we cannot replace the body itself, but only its content\n // we need a separate step for post-processing the incoming\n // attributes, like classes, styles etc...\n (resultingBody.html(shadowInnerHTML) as DQ).copyAttrs(shadowBody);\n this.externalContext.assign($nsp(P_RENDER_OVERRIDE)).value = \"@all\";\n this.storeForPostProcessing(updateForms, resultingBody);\n }\n\n /**\n * Leaf Tag eval... process whatever is in the eval cdata block\n *\n * @param node the node to eval\n */\n eval(node: XMLQuery) {\n ExtDomQuery.globalEval(node.cDATAAsString);\n }\n\n /**\n * processes an incoming error from the response\n * which is hosted under the &lt;error&gt; tag\n * @param node the node hosting the error in our response xml\n * @param node the node in the xml hosting the error message\n */\n error(node: XMLQuery) {\n /**\n * <error>\n * <error-name>String</error-name>\n * <error-message><![CDATA[message]]></error-message>\n * <error>\n */\n\n const mergedErrorData = new ExtConfig({});\n mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_AJAX_SOURCE).get(0).value;\n mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);\n mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;\n\n const hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();\n\n //we now store the response xml also in the error data for further details\n mergedErrorData.assignIf(hasResponseXML, RESPONSE_XML).value = this.internalContext.getIf(RESPONSE_XML).value.get(0).value;\n\n // error post-processing and enrichment (standard messages from keys)\n const errorData = ErrorData.fromServerError(mergedErrorData);\n\n // we now trigger an internally stored onError function which might be an attached to the context\n // either we do not have an internal on error, or an on error has been based via params from the outside.\n // In both cases they are attached to our contexts\n\n this.triggerOnError(errorData);\n Implementation.sendError(errorData);\n }\n\n /**\n * process the redirect operation\n *\n * @param node\n */\n redirect(node: XMLQuery) {\n Assertions.assertUrlExists(node);\n\n const redirectUrl = trim(node.attr(ATTR_URL).value);\n if (redirectUrl != EMPTY_STR) {\n window.location.href = redirectUrl;\n }\n }\n\n /**\n * processes the update operation and updates the node with the cdata block\n * @param node the xml response node hosting the update info\n * @param cdataBlock the cdata block with the new html code\n */\n update(node: XMLQuery, cdataBlock: string) {\n const result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);\n const sourceForm = result?.firstParent(HTML_TAG_FORM).orElseLazy(() => result.byTagName(HTML_TAG_FORM, true));\n if (sourceForm) {\n this.storeForPostProcessing(sourceForm, result);\n }\n }\n\n /**\n * Delete handler, simply deletes the node referenced by the xml data\n * @param node\n */\n delete(node: XMLQuery) {\n DQ.byId(node.id.value, true).delete();\n }\n\n /**\n * attributes leaf tag... process the attributes\n *\n * @param node\n */\n attributes(node: XMLQuery) {\n const elem = DQ.byId(node.id.value, true);\n\n node.byTagName(XML_TAG_ATTR).each((item: XMLQuery) => {\n elem.attr(item.attr(ATTR_NAME).value).value = item.attr(ATTR_VALUE).value;\n });\n }\n\n /**\n * @param shadowDocument a shadow document which is needed for further processing\n */\n replaceViewRoot(shadowDocument: XMLQuery) {\n this.replaceHead(shadowDocument);\n this.replaceBody(shadowDocument);\n }\n\n /**\n * Insert handling, either before or after\n *\n * @param node\n */\n insert(node: XMLQuery) {\n //let insertId = node.id; //not used atm\n\n const before = node.attr(XML_TAG_BEFORE);\n const after = node.attr(XML_TAG_AFTER);\n const insertNodes = DQ.fromMarkup(node.cDATAAsString as any);\n\n if (before.isPresent()) {\n DQ.byId(before.value, true).insertBefore(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n if (after.isPresent()) {\n const domQuery = DQ.byId(after.value, true);\n domQuery.insertAfter(insertNodes);\n\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n }\n\n /**\n * Handler for the case &lt;insert <&lt; before id=\"...\n *\n * @param node the node hosting the insert data\n */\n insertWithSubTags(node: XMLQuery) {\n const before = node.querySelectorAll(XML_TAG_BEFORE);\n const after = node.querySelectorAll(XML_TAG_AFTER);\n\n before.each(item => {\n const insertId = item.attr(ATTR_ID);\n const insertNodes = DQ.fromMarkup(item.cDATAAsString as any);\n if (insertId.isPresent()) {\n DQ.byId(insertId.value, true).insertBefore(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n });\n\n after.each(item => {\n const insertId = item.attr(ATTR_ID);\n const insertNodes = DQ.fromMarkup(item.cDATAAsString as any);\n if (insertId.isPresent()) {\n DQ.byId(insertId.value, true).insertAfter(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n });\n }\n\n /**\n * Process the viewState update, update the affected\n * forms with their respective new viewState values\n *\n */\n processViewState(node: XMLQuery): boolean {\n if (ResponseProcessor.isViewStateNode(node)) {\n const state = node.cDATAAsString;\n this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);\n return true;\n }\n return false;\n }\n\n processClientWindow(node: XMLQuery): boolean {\n if (ResponseProcessor.isClientWindowNode(node)) {\n const state = node.cDATAAsString;\n this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);\n return true;\n }\n }\n\n /**\n * generic global eval which runs the embedded css and scripts\n */\n globalEval() {\n // phase one, if we have head inserts, we build up those before going into the script eval phase\n let insertHeadElems = new ExtDomQuery(...this.internalContext.getIf(DEFERRED_HEAD_INSERTS).value);\n insertHeadElems.runHeadInserts(true);\n\n // phase 2 we run a script eval on all updated elements in the body\n let updateElems = new ExtDomQuery(...this.internalContext.getIf(UPDATE_ELEMS).value);\n updateElems.runCss();\n // phase 3, we do the same for the css\n updateElems.runScripts();\n }\n\n /**\n * Postprocessing view state fixing\n * this appends basically the incoming view states to the forms.\n * It is called from outside after all forms have been processed basically\n * as last lifecycle step, before going into the next request.\n */\n fixViewStates() {\n ofAssoc(this.internalContext.getIf(APPLIED_VST).orElse({}).value)\n .forEach(([, value]) => {\n const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value\n const affectedForms = this.getContainerForms(namingContainerId)\n .filter(affectedForm => this.isInExecuteOrRender(affectedForm));\n\n this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse(\"\").value);\n })\n }\n\n\n\n /**\n * same as with view states before applies the incoming client windows as last step after the rest of the processing\n * is done.\n */\n fixClientWindow() {\n ofAssoc(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)\n .forEach(([, value]) => {\n const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value;\n const affectedForms = this.getContainerForms(namingContainerId)\n .filter(affectedForm => this.isInExecuteOrRender(affectedForm));\n\n this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse(\"\").value);\n });\n }\n\n updateNamedViewRootState() {\n let partialId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n let namedViewRoot = this.internalContext.getIf(NAMED_VIEWROOT);\n if(partialId.isPresent() &&\n (namedViewRoot.isAbsent() ||\n !namedViewRoot.value)) {\n const SEP = $faces().separatorchar;\n this.internalContext.assign(NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || DQ$(`input[name*='${$nsp(P_VIEWSTATE)}']`)\n .filter(node => node.attr(\"name\").value.indexOf(partialId.value + SEP) == 0).length > 0;\n }\n }\n\n /**\n * all processing done we can close the request and send the appropriate events\n */\n done() {\n const eventData = EventData.createFromRequest(this.request.value, this.internalContext, this.externalContext, SUCCESS);\n\n //because some frameworks might decorate them over the context in the response\n const eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;\n Implementation.sendEvent(eventData, eventHandler);\n }\n\n /**\n * proper viewState -> form assignment\n *\n * @param forms the forms to append the viewState to\n * @param viewState the final viewState\n * @param namingContainerId\n */\n private appendViewStateToForms(forms: DQ, namedViewRoot: boolean, viewState: string, namingContainerId = \"\") {\n this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);\n }\n\n\n /**\n * proper clientWindow -> form assignment\n *\n * @param forms the forms to append the viewState to\n * @param clientWindow the final viewState\n * @param namingContainerId\n */\n private appendClientWindowToForms(forms: DQ, namedViewRoot: boolean, clientWindow: string, namingContainerId = \"\") {\n this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);\n }\n\n /**\n * generic append state which appends a certain state as hidden element to an existing set of forms\n *\n * @param forms the forms to append or change to\n * @param selector the selector for the state\n * @param namedViewRoot if set to true, the name is also prefixed\n * @param state the state itself which needs to be assigned\n *\n * @param namingContainerId\n * @private\n */\n private assignState(forms: DQ, selector: string, namedViewRoot: boolean, state: string, namingContainerId: string) {\n /**\n * creates the viewState or client window id element\n * @param form\n */\n const createAndAppendHiddenInput = (form: DomQuery) => {\n return new HiddenInputBuilder(selector)\n .withNamingContainerId(namingContainerId)\n .withParent(form)\n .withNamedViewRoot(namedViewRoot)\n .build();\n };\n\n forms.each(form => {\n const hiddenInput = form.querySelectorAll(selector)\n .orElseLazy(() => createAndAppendHiddenInput(form));\n hiddenInput.val = state;\n });\n }\n\n /**\n * Stores certain aspects of the dom for later post-processing\n *\n * @param updateForms the update forms which should receive standardized internal jsf data\n * @param toBeEvaluated the resulting elements which should be evaluated\n */\n private storeForPostProcessing(updateForms: DQ, toBeEvaluated: DQ) {\n this.storeForUpdate(updateForms);\n this.storeForEval(toBeEvaluated);\n }\n\n /**\n * helper to store a given form for the update post-processing (viewState)\n *\n * @param updateForms the dom query object pointing to the forms which need to be updated\n */\n private storeForUpdate(updateForms: DQ) {\n this.internalContext.assign(UPDATE_FORMS).value.push(updateForms);\n }\n\n /**\n * same for eval (js and css)\n *\n * @param toBeEvaluated\n */\n private storeForEval(toBeEvaluated: DQ) {\n this.internalContext.assign(UPDATE_ELEMS).value.push(toBeEvaluated);\n }\n\n /**\n * check whether a given XMLQuery node is an explicit viewState node\n *\n * @param node the node to check\n * @returns if it is a viewState node\n */\n private static isViewStateNode(node: XMLQuery): boolean {\n const SEP = $faces().separatorchar;\n return \"undefined\" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||\n node?.id?.value?.indexOf([SEP, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||\n node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), SEP].join(EMPTY_STR)) != -1);\n }\n\n /**\n * incoming client window node also needs special processing\n *\n * @param node the node to check\n * @returns true of it ii\n */\n private static isClientWindowNode(node: XMLQuery): boolean {\n const SEP = $faces().separatorchar;\n return \"undefined\" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||\n node?.id?.value?.indexOf([SEP, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||\n node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), SEP].join(EMPTY_STR)) != -1);\n }\n\n private triggerOnError(errorData: ErrorData) {\n this.externalContext.getIf(ON_ERROR).orElseLazy(() => this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);\n }\n\n /**\n * filters the forms according to being member of the \"execute\" or \"render\" cycle\n * @param affectedForm\n * @private\n */\n private isInExecuteOrRender(affectedForm) {\n const executes = this.externalContext.getIf($nsp(P_EXECUTE)).orElse(\"@none\").value.split(/\\s+/gi);\n const renders = this.externalContext.getIf(P_RENDER_OVERRIDE)\n .orElseLazy(() => this.externalContext.getIf($nsp(P_RENDER)).value)\n .orElse(IDENT_NONE).value.split(/\\s+/gi);\n const executeAndRenders = executes.concat(...renders);\n return [...executeAndRenders].filter(nameOrId => {\n if ([IDENT_ALL, IDENT_NONE].indexOf(nameOrId) != -1) {\n return true;\n }\n\n const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);\n //either the form directly is in execute or render or one of its children or one of its parents\n return affectedForm.matchesSelector(NAME_OR_ID) ||\n affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||\n affectedForm.firstParent(NAME_OR_ID).isPresent();\n }).length > 0;\n }\n\n /**\n * gets all forms under a single naming container id\n * @param namingContainerId\n * @private\n */\n private getContainerForms(namingContainerId: Config) {\n if (namingContainerId.isPresent()) {\n //naming container mode, all forms under naming container id must be processed\n return DQ$(this.getNameOrIdSelector(namingContainerId.value))\n // missing condition if the naming container is not present we have to\n // use the body as fallback\n .orElseLazy(() => DQ.byTagName(HTML_TAG_BODY))\n .byTagName(HTML_TAG_FORM, true);\n } else {\n return DQ.byTagName(HTML_TAG_FORM);\n }\n }\n\n private getNameOrIdSelector(nameOrId) {\n return `[id='${nameOrId}'], [name='${nameOrId}']`;\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, DQ} from \"mona-dish\";\nimport {$nsp, EMPTY_STR, IDENT_NONE, P_VIEWSTATE} from \"../core/Const\";\n\nimport {\n encodeFormData,\n fixEmptyParameters, getFormInputsAsArr\n} from \"../util/FileUtils\";\nimport {ExtLang} from \"../util/Lang\";\nconst ofAssoc = ExtLang.ofAssoc;\nimport {Es2019Array} from \"mona-dish\";\n\n\ntype ParamsMapper<V, K> = (key: V, item: K) => [V, K];\nconst defaultParamsMapper: ParamsMapper<string, any> = (key, item) => [key, item];\n\n/**\n * A unified form data class\n * which builds upon our configuration.\n *\n * We cannot use standard html5 forms everywhere\n * due to api constraints on the HTML Form object in IE11\n * and due to the url encoding constraint given by the faces.js spec\n *\n *\n * internal storage format\n * every value is stored as an array\n * even scalar ones!\n */\nexport class XhrFormData extends Config {\n /**\n * Checks if the given datasource is a multipart request source\n * multipart is only needed if one of the executes is a file input\n * since file inputs are stateless, they fall out of the view state\n * and need special handling. With file submits we have to send a formData object\n * instead of an encoded string files cannot be sent that way\n */\n isMultipartRequest: boolean = false;\n\n /**\n * data collector from a given form\n *\n * @param dataSource either a form as DomQuery object or an encoded url string\n * @param paramsMapper a remapper for the params keys and values\n * @param executes the executes id list for the elements to being processed\n * @param partialIds partial ids to collect, to reduce the data sent down\n */\n constructor(private dataSource: DQ, private paramsMapper: ParamsMapper<string, any> = defaultParamsMapper, executes?: string[], private partialIds?: string[]) {\n super({});\n //encode and append the issuing item if not a partial ids array of ids is passed\n /*\n * Spec. 13.3.1\n * Collect and encode input elements.\n * Additionally the hidden element jakarta.faces.ViewState\n * Enhancement partial page submit\n */\n this.resolveRequestType(this.dataSource, executes);\n this.encodeSubmittableFields(this.dataSource, this.partialIds);\n this.applyViewState(this.dataSource);\n }\n\n /**\n * @returns a Form data representation, this is needed for file submits\n */\n toFormData(): FormData {\n /*\n * expands key: [item1, item2]\n * to: [{key: key, value: item1}, {key: key, value: item2}]\n */\n let expandValueArrays = ([key, item]) => {\n if (Array.isArray(item)) {\n return new Es2019Array(...item).map(value => {\n return {key, value}\n })\n }\n return [{key, value: item}]\n }\n\n /*\n * remaps the incoming {key, value} tuples\n * to naming container prefixed keys and values\n */\n let remapForNamingContainer = ({key, value}) => {\n key = this.remapKeyForNamingContainer(key);\n return {key, value}\n };\n\n /*\n * collects everything into a FormData object\n */\n return ofAssoc(this.value)\n .flatMap(expandValueArrays)\n .map(remapForNamingContainer)\n .reduce((formData: FormData, {key, value}: any) => {\n formData.append(key, value);\n return formData;\n }, new FormData()) as FormData;\n }\n\n /**\n * returns an encoded string representation of our xhr form data\n *\n * @param defaultStr optional default value if nothing is there to encode\n */\n toString(defaultStr = EMPTY_STR): string {\n return encodeFormData(this, this.paramsMapper, defaultStr);\n }\n\n /**\n * generic post init code, for now, this performs some post assign data post-processing\n * @param rootElement the root element which knows the request type (usually a form)\n * @param executes the executable dom nodes which need to be processed into the form data, which we can send\n * in our ajax request\n */\n private resolveRequestType(rootElement: DQ, executes?: Array<string>) {\n if (!executes || executes.indexOf(IDENT_NONE) != -1) {\n return;\n }\n this.isMultipartRequest = rootElement.isMultipartCandidate(true);\n }\n\n /**\n * special case view state handling\n *\n * @param form the form holding the view state value\n */\n private applyViewState(form: DQ) {\n if (this.getIf($nsp(P_VIEWSTATE)).isPresent()) {\n return;\n }\n let viewStateElement = form.querySelectorAllDeep(`[name*='${$nsp(P_VIEWSTATE)}'`);\n let viewState = viewStateElement.inputValue;\n this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;\n }\n\n /**\n * determines fields to submit\n * @param {Node} parentItem - form element item is nested in\n * @param {Array} partialIds - ids fo PPS\n */\n private encodeSubmittableFields(parentItem: DQ, partialIds: string[] = []) {\n\n const mergeIntoThis = ([key, value]) => this.append(key).value = value;\n const namingContainerRemap = ([key, value]) => this.paramsMapper(key as string, value);\n\n const remappedPartialIds = partialIds.map(partialId => this.remapKeyForNamingContainer(partialId));\n const partialIdsFilter = ([key, value]) => (!remappedPartialIds.length || key.indexOf(\"@\") == 0) ? true :\n remappedPartialIds.indexOf(key) != -1;\n\n let inputs = getFormInputsAsArr(parentItem);\n inputs\n .map(fixEmptyParameters)\n .map(namingContainerRemap)\n .filter(partialIdsFilter)\n .forEach(mergeIntoThis);\n }\n\n private remapKeyForNamingContainer(key: string): string {\n return this.paramsMapper(key, \"\")[0];\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {AsyncRunnable, IAsyncRunnable} from \"../util/AsyncRunnable\";\nimport {Config, DQ, XMLQuery} from \"mona-dish\";\nimport {Implementation} from \"../AjaxImpl\";\n\nimport {XhrFormData} from \"./XhrFormData\";\nimport {ErrorData} from \"./ErrorData\";\nimport {EventData} from \"./EventData\";\nimport {ExtLang} from \"../util/Lang\";\nimport {\n $faces,\n BEGIN,\n COMPLETE,\n CONTENT_TYPE,\n CTX_PARAM_MF_INTERNAL,\n CTX_PARAM_REQ_PASS_THR,\n ERROR,\n HEAD_FACES_REQ,\n MALFORMEDXML,\n NO_TIMEOUT,\n ON_ERROR,\n ON_EVENT,\n P_EXECUTE,\n REQ_ACCEPT,\n REQ_TYPE_GET,\n REQ_TYPE_POST,\n SOURCE,\n STATE_EVT_TIMEOUT,\n STD_ACCEPT,\n URL_ENCODED,\n VAL_AJAX,\n IDENT_NONE,\n CTX_PARAM_SRC_FRM_ID,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_PPS,\n EMPTY_RESPONSE,\n HTTP_ERROR,\n EMPTY_STR,\n $nsp,\n P_BEHAVIOR_EVENT,\n CTX_PARAM_UPLOAD_ON_PROGRESS,\n CTX_PARAM_UPLOAD_LOAD,\n CTX_PARAM_UPLOAD_LOADSTART,\n CTX_PARAM_UPLOAD_LOADEND,\n CTX_PARAM_UPLOAD_ABORT,\n CTX_PARAM_UPLOAD_TIMEOUT,\n CTX_PARAM_UPLOAD_ERROR,\n CTX_PARAM_UPLOAD_PREINIT\n} from \"../core/Const\";\nimport {\n resolveFinalUrl,\n resolveHandlerFunc,\n resoveNamingContainerMapper\n} from \"./RequestDataResolver\";\nconst failSaveExecute = ExtLang.failSaveExecute;\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n/**\n * Faces XHR Request Wrapper\n * as AsyncRunnable for our Asynchronous queue\n * This means from the outside the\n * xhr request is similar to a Promise in a way\n * that you can add then and catch and finally callbacks.\n *\n *\n * The idea is that we basically just enqueue\n * a single ajax request into our queue\n * and let the queue do the processing.\n *\n *\n */\n\nexport class XhrRequest extends AsyncRunnable<XMLHttpRequest> {\n\n private responseContext: Config;\n\n private stopProgress = false;\n\n\n private xhrObject = new XMLHttpRequest();\n\n static readonly TYPE_CHECKBOX = \"checkbox\";\n static readonly TYPE_RADIO = \"radio\";\n\n\n /**\n * Required Parameters\n *\n * @param requestContext the request context with all pass through values\n * @param internalContext internal context with internal info which is passed through, not used by the user\n * Optional Parameters\n * @param timeout optional xhr timeout\n * @param ajaxType optional request type, default \"POST\"\n * @param contentType optional content type, default \"application/x-www-form-urlencoded\"\n */\n constructor(\n private requestContext: ExtConfig,\n private internalContext: Config,\n private timeout = NO_TIMEOUT,\n private ajaxType = REQ_TYPE_POST,\n private contentType = URL_ENCODED\n ) {\n super();\n // we omit promises here because we have to deal with cancel functionality,\n // and promises to not provide that (yet) instead we have our async queue\n // which uses an api internally, which is very close to promises\n this.registerXhrCallbacks((data: any) => this.resolve(data), (data: any) => this.reject(data));\n }\n\n start(): IAsyncRunnable<XMLHttpRequest> {\n\n let ignoreErr = failSaveExecute;\n let xhrObject = this.xhrObject;\n let sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value)\n\n\n let executesArr = () => {\n return this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\\s+/gi);\n };\n\n try {\n // encoded we need to decode\n // We generated a base representation of the current form\n // in case someone has overloaded the viewState with additional decorators we merge\n // that in, there is no way around it, the spec allows it and getViewState\n // must be called, so whatever getViewState delivers has higher priority then\n // whatever the formData object delivers\n // the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial\n // ids for reduced load and server processing, this will be removed soon, we can handle the same via execute\n const executes = executesArr();\n const partialIdsArray = this.internalContext.getIf(CTX_PARAM_PPS).value === true ? executes : [];\n const formData: XhrFormData = new XhrFormData(\n sourceForm,\n resoveNamingContainerMapper(this.internalContext),\n executes, partialIdsArray\n );\n\n this.contentType = formData.isMultipartRequest ? \"undefined\" : this.contentType;\n\n // next step the pass through parameters are merged in for post params\n this.requestContext.$nspEnabled = false;\n const requestContext = this.requestContext;\n const requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;\n\n // we are turning off here the jsf, faces remapping because we are now dealing with\n // pass-through parameters\n requestPassThroughParams.$nspEnabled = false;\n // this is an extension where we allow pass through parameters to be sent down additionally\n // this can be used and is used in the impl to enrich the post request parameters with additional\n // information\n try {\n formData.shallowMerge(requestPassThroughParams, true, true);\n } finally {\n // unfortunately as long as we support\n // both namespaces we have to keep manual control\n // on the key renaming before doing ops like deep copy\n this.requestContext.$nspEnabled = true;\n requestPassThroughParams.$nspEnabled = true;\n }\n\n this.appendIssuingItem(formData);\n\n this.responseContext = requestPassThroughParams.deepCopy;\n\n // we have to shift the internal passthroughs around to build up our response context\n const responseContext = this.responseContext;\n\n responseContext.assign(CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;\n\n // per spec the onEvent and onError handlers must be passed through to the response\n responseContext.assign(ON_EVENT).value = requestContext.getIf(ON_EVENT).value;\n responseContext.assign(ON_ERROR).value = requestContext.getIf(ON_ERROR).value;\n\n xhrObject.open(this.ajaxType, resolveFinalUrl(sourceForm, formData, this.ajaxType), true);\n\n // adding timeout\n this.timeout ? xhrObject.timeout = this.timeout : null;\n\n // a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects\n // normal browsers should resolve this\n // tests can quietly fail on this one\n if (this.contentType != \"undefined\") {\n ignoreErr(() => xhrObject.setRequestHeader(CONTENT_TYPE, `${this.contentType}; charset=utf-8`));\n }\n\n ignoreErr(() => xhrObject.setRequestHeader(HEAD_FACES_REQ, VAL_AJAX));\n\n // probably not needed anymore, will test this\n // some webkit based mobile browsers do not follow the w3c spec of\n // setting, they accept headers automatically\n ignoreErr(() => xhrObject.setRequestHeader(REQ_ACCEPT, STD_ACCEPT));\n\n this.sendEvent(BEGIN);\n this.sendRequest(formData);\n } catch (e) {\n // this happens usually in a client side condition, hence we have to deal in with it in a client\n // side manner\n this.handleErrorAndClearQueue(e);\n throw e;\n }\n return this;\n }\n\n\n\n cancel() {\n try {\n // this causes onError to be called where the error\n // handling takes over\n this.xhrObject.abort();\n } catch (e) {\n this.handleError(e);\n }\n }\n\n\n /**\n * attaches the internal event and processing\n * callback within the promise to our xhr object\n *\n * @param resolve\n * @param reject\n */\n private registerXhrCallbacks(resolve: Consumer<any>, reject: Consumer<any>) {\n const xhrObject = this.xhrObject;\n\n xhrObject.onabort = () => {\n this.onAbort(resolve, reject);\n };\n xhrObject.ontimeout = () => {\n this.onTimeout(resolve, reject);\n };\n xhrObject.onload = () => {\n this.onResponseReceived(resolve)\n };\n xhrObject.onloadend = () => {\n this.onResponseProcessed(this.xhrObject, resolve);\n };\n\n if(xhrObject?.upload) {\n //this is an extension so that we can send the upload object of the current\n //request before any operation\n this.internalContext.getIf(CTX_PARAM_UPLOAD_PREINIT).value?.(xhrObject.upload);\n //now we hook in the upload events\n xhrObject.upload.addEventListener(\"progress\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ON_PROGRESS).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"load\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOAD).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"loadstart\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADSTART).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"loadend\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADEND).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"abort\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ABORT).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"timeout\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_TIMEOUT).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"error\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ERROR).value?.(xhrObject.upload, event);\n });\n\n }\n\n xhrObject.onerror = (errorData: any) => {\n // Safari in rare cases triggers an error when cancelling a request internally, or when\n // in this case we simply ignore the request and clear up the queue, because\n // it is not safe anymore to proceed with the current queue\n\n // This bypasses a Safari issue where it keeps requests hanging after page unload\n // and then triggers a cancel error on then instead of just stopping\n // and clearing the code\n // in a page unload case it is safe to clear the queue\n // in the exact safari case any request after this one in the queue is invalid\n // because the queue references xhr requests to a page which already is gone!\n if (this.isCancelledResponse(this.xhrObject)) {\n /*\n * this triggers the catch chain and after that finally\n */\n this.stopProgress = true;\n reject();\n return;\n }\n // error already processed somewhere else\n if (this.stopProgress) {\n return;\n }\n this.handleError(errorData);\n };\n }\n\n private isCancelledResponse(currentTarget: XMLHttpRequest): boolean {\n return currentTarget?.status === 0 && // cancelled internally by browser\n currentTarget?.readyState === 4 &&\n currentTarget?.responseText === '' &&\n currentTarget?.responseXML === null;\n }\n\n /*\n * xhr processing callbacks\n *\n * Those methods are the callbacks called by\n * the xhr object depending on its own state\n */\n /**\n * client side abort... also here for now we clean the queue\n *\n * @param resolve\n * @param reject\n * @private\n */\n private onAbort(resolve: Consumer<any>, reject: Consumer<any>) {\n // reject means clear queue, in this case we abort entirely the processing\n // does not happen yet, we have to probably rethink this strategy in the future\n // when we introduce cancel functionality\n this.handleHttpError(reject);\n }\n\n /**\n * request timeout, this must be handled like a generic server error per spec\n * unfortunately, so we have to jump to the next item (we cancelled before)\n * @param resolve\n * @param reject\n * @private\n */\n private onTimeout(resolve: Consumer<any>, reject: Consumer<any>) {\n // timeout also means we we probably should clear the queue,\n // the state is unsafe for the next requests\n this.sendEvent(STATE_EVT_TIMEOUT);\n this.handleHttpError(resolve);\n }\n\n /**\n * the response is received and normally is a normal response\n * but also can be some kind of error (http code >= 300)\n * In any case the response will be resolved either as error or response\n * and the next item in the queue will be processed\n * @param resolve\n * @private\n */\n private onResponseReceived(resolve: Consumer<any>) {\n\n this.sendEvent(COMPLETE);\n\n //request error resolution as per spec:\n if(!this.processRequestErrors(resolve)) {\n $faces().ajax.response(this.xhrObject, this.responseContext.value ?? {});\n }\n }\n\n private processRequestErrors(resolve: Consumer<any>): boolean {\n const responseXML = new XMLQuery(this.xhrObject?.responseXML);\n const responseText = this.xhrObject?.responseText ?? \"\";\n const responseCode = this.xhrObject?.status ?? -1;\n if(responseXML.isXMLParserError()) {\n // Firefox: malformed XML produces a Document with <parsererror>\n const errorName = \"Invalid Response\";\n const errorMessage = \"The response xml is invalid\";\n this.handleGenericResponseError(errorName, errorMessage, MALFORMEDXML, resolve);\n return true;\n } else if(responseXML.isAbsent() && responseText.trim().length > 0) {\n // Chrome: responseXML is null for unparseable XML, but responseText has content\n const errorName = \"Invalid Response\";\n const errorMessage = \"The response xml is invalid\";\n this.handleGenericResponseError(errorName, errorMessage, MALFORMEDXML, resolve);\n return true;\n } else if(responseXML.isAbsent()) {\n // Truly empty response\n const errorName = \"Empty Response\";\n const errorMessage = \"The response has provided no data\";\n this.handleGenericResponseError(errorName, errorMessage, EMPTY_RESPONSE, resolve);\n return true;\n } else if (responseCode >= 300 || responseCode < 200) {\n this.handleHttpError(resolve);\n return true;\n }\n return false;\n }\n\n\n private handleGenericResponseError(errorName: string, errorMessage: string, responseStatus: string, resolve: (s?: any) => void) {\n const errorData: ErrorData = new ErrorData(\n this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value,\n errorName, errorMessage,\n this.xhrObject?.responseText ?? \"\",\n this.xhrObject?.responseXML ?? null,\n this.xhrObject.status,\n responseStatus\n );\n this.finalizeError(errorData, resolve);\n }\n\n private handleHttpError(resolveOrReject: Function, errorMessage: string = \"Generic HTTP Serror\") {\n this.stopProgress = true;\n\n const errorData = new ErrorData(\n this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value,\n HTTP_ERROR, errorMessage,\n this.xhrObject?.responseText ?? \"\",\n this.xhrObject?.responseXML ?? null,\n this.xhrObject?.status ?? -1,\n HTTP_ERROR\n )\n this.finalizeError(errorData, resolveOrReject);\n }\n\n private finalizeError(errorData: ErrorData, resolveOrReject: Function) {\n try {\n this.handleError(errorData, true);\n } finally {\n // we issue a resolveOrReject in this case to allow the system to recover\n // reject would clean up the queue\n // resolve would trigger the next element in the queue to be processed\n resolveOrReject(errorData);\n this.stopProgress = true;\n }\n }\n\n /**\n * last minute cleanup, the request now either is fully done\n * or not by having had a cancel or error event be\n * @param data\n * @param resolve\n * @private\n */\n private onResponseProcessed(data: any, resolve: Consumer<any>) {\n // if stop progress true, the cleanup already has been performed\n if (this.stopProgress) {\n return;\n }\n /*\n * normal case, cleanup == next item if possible\n */\n resolve(data);\n }\n\n private sendRequest(formData: XhrFormData) {\n const isPost = this.ajaxType != REQ_TYPE_GET;\n if (formData.isMultipartRequest) {\n // in case of a multipart request we send in a formData object as body\n this.xhrObject.send((isPost) ? formData.toFormData() : null);\n } else {\n // in case of a normal request we send it normally\n this.xhrObject.send((isPost) ? formData.toString() : null);\n }\n }\n\n /*\n * other helpers\n */\n private sendEvent(evtType: string) {\n const eventData = EventData.createFromRequest(this.xhrObject, this.internalContext, this.requestContext, evtType);\n try {\n // User code error, we might cover\n // this in onError, but also we cannot swallow it.\n // We need to resolve the local handlers lazily,\n // because some frameworks might decorate them over the context in the response\n let eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_EVENT);\n Implementation.sendEvent(eventData, eventHandler);\n } catch (e) {\n e.source = e?.source ?? this.requestContext.getIf(SOURCE).value;\n // this is a client error, no save state anymore for queue processing!\n this.handleErrorAndClearQueue(e);\n // we forward the error upward like all client side errors\n throw e;\n }\n }\n\n private handleErrorAndClearQueue(e, responseFormatError: boolean = false) {\n this.handleError(e, responseFormatError);\n this.reject(e);\n }\n\n private handleError(exception, responseFormatError: boolean = false) {\n const errorData = (responseFormatError) ? ErrorData.fromHttpConnection(exception.source, exception.type, exception.message ?? EMPTY_STR, exception.responseText, exception.responseXML, exception.responseCode, exception.status) : ErrorData.fromClient(exception);\n const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);\n\n Implementation.sendError(errorData, eventHandler);\n }\n\n private appendIssuingItem(formData: XhrFormData) {\n const issuingItemId = this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value;\n\n //to avoid sideffects with buttons we only can append the issuing item if no behavior event is set\n //MYFACES-4679!\n const eventType = formData.getIf($nsp(P_BEHAVIOR_EVENT)).value?.[0] ?? null;\n const isBehaviorEvent = (!!eventType) && eventType != 'click';\n\n //not encoded\n if(issuingItemId && formData.getIf(issuingItemId).isAbsent() && !isBehaviorEvent) {\n const issuingItem = DQ.byId(issuingItemId);\n const itemValue = issuingItem.inputValue;\n const arr = new ExtConfig({});\n const type: string = issuingItem.type.orElse(\"\").value.toLowerCase();\n\n //Checkbox and radio only value pass if checked is set, otherwise they should not show\n //up at all, and if checked is set, they either can have a value or simply being boolean\n if((type == XhrRequest.TYPE_CHECKBOX || type == XhrRequest.TYPE_RADIO) && !issuingItem.checked) {\n return;\n } else if((type == XhrRequest.TYPE_CHECKBOX || type == XhrRequest.TYPE_RADIO)) {\n arr.assign(issuingItemId).value = itemValue.orElse(true).value;\n } else if (itemValue.isPresent()) {\n arr.assign(issuingItemId).value = itemValue.value;\n }\n\n formData.shallowMerge(arr, true, true);\n }\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DQ} from \"mona-dish\";\nimport {ExtLang} from \"../impl/util/Lang\";\n\n/**\n * legacy code to enable various aspects\n * of myfaces, used to be rendered inline\n * for jsf 2.0 we can externalize it into its own custom resource\n *\n * note this is a straight 1:1 port from the existing codebase\n * (not too much work has been spent here, the important thing is, that\n * the namespace and functions need to be kept intact for legacy code)\n *\n * we might move the code over in the future, but for now a straight 1:1 port suffices\n */\nexport namespace oam {\n const ofAssoc = ExtLang.ofAssoc;\n /**\n * sets a hidden input field\n * @param formName the formName\n * @param name the hidden field\n * @param value the value to be rendered\n */\n export const setHiddenInput = function (formName: string, name: string, value: string): void {\n DQ.byId(document.forms[formName])\n .each(form => {\n const input = form.querySelectorAll(`input[type='hidden'][name='${name}']`);\n if (input.isPresent()) {\n input.inputValue.value = value;\n } else {\n const newInput = DQ.fromMarkup(`<input type='hidden' id='${name}' name='${name}'>`);\n newInput.inputValue.value = value;\n newInput.appendTo(form);\n }\n });\n };\n\n /**\n * clears a hidden input field\n *\n * @param formName formName for the input\n * @param name the name of the input field\n */\n export const clearHiddenInput = function (formName: string, name: string): void {\n let element = document.forms?.[formName]?.elements?.[name];\n if(!element) {\n return;\n }\n DQ.byId(element).delete();\n };\n\n // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols\n /**\n * does special form submit remapping\n * re-maps the issuing command link into something,\n * the \"decode\" of the command link on the server can understand\n *\n * @param formName\n * @param linkId\n * @param target\n * @param params\n */\n export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params: AssocArr<any> | Tuples<string, any> | null = {} ): boolean {\n\n\n //handle a possible incoming null, not sure if this is used that way anywhere, but we allow it\n params = (!params) ? {} : params;\n\n let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\\$:').replace(/:/g, '_');\n window?.[clearFn]?.(formName);\n\n //autoscroll code\n if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {\n myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());\n }\n let paramsStream: Array<[string, any]> = Array.isArray(params) ? [...params] : ofAssoc(params);\n paramsStream.forEach(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));\n\n //we call the namespaced function, to allow decoration, via a direct call we would\n myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');\n\n\n DQ.byId(document.forms?.[formName] ?? document.getElementById(formName)).each(form => {\n const ATTR_TARGET = \"target\";\n const formElement = form.getAsElem(0).value as HTMLFormElement;\n const oldTarget = (form.getAsElem(0).value as HTMLFormElement).getAttribute(\"target\");\n\n if(target != \"null\" && target) {\n (form.getAsElem(0).value as HTMLFormElement).setAttribute(\"target\", target);\n }\n\n const result = formElement?.onsubmit?.(null);\n\n try {\n if ((!!result) || 'undefined' == typeof result) {\n formElement.submit();\n }\n } catch (e) {\n window?.console.error(e);\n } finally {\n if(oldTarget == null || oldTarget == \"null\") {\n (form.getAsElem(0).value as HTMLFormElement).removeAttribute(\"target\");\n } else {\n (form.getAsElem(0).value as HTMLFormElement).setAttribute(\"target\", oldTarget);\n }\n\n // noinspection JSUnusedLocalSymbols\n paramsStream.forEach(([key, data]) => {\n myfaces.oam.clearHiddenInput(formName, key);\n });\n myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);\n }\n\n });\n return false;\n };\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * faces.js init layer which provides as per spec the proper\n * window namespace if it does not exist already\n *\n * The idea is that we use a small shim on top of\n * the implementation to provide the window namespace.\n * The implementation itself is in a protected namespace\n * which will be bound by the build system\n *\n * The documentation nevertheless targets the _api file, which\n * hosts the full api\n */\nif(!window.faces) {\n //we lazily load the code to prevent ram bloat\n const faces = require(\"./_api\").faces;\n window['faces'] = window?.faces ?? faces;\n}\nif(!window?.myfaces?.ab) {\n const myfaces = require(\"./_api\").myfaces;\n\n //namespace might be extended is not exclusively reserved so we merge\n (window as any)[\"myfaces\"] = window?.myfaces ?? {};\n Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);\n}\nexport var faces = window.faces;\nexport var myfaces = window.myfaces;\n"],"names":["condition","target","accessPath","length","IgnoreAssign","assign","append","ret","flattenAccessPath","currPtr","cnt","accessKeyIndex","arrayIndex","fromAssoc","JSON","parse","stringify","assocArrays","shallowMerge","deepEqual","obj1","obj2","Array","isArray","every","item","keys1","Object","keys","keys2","key","indexOf","constructor","parent","value","this","lastPathItem","buildPath","push","keyVal","start","substring","end","parseInt","alloc","arr","defaultVal","toAdd","Es2019Array","flatMap","path","split","map","filter","parentPtr","parKeyArrPos","currKey","arrPos","Error","nextArrPos","dataPresent","overwrite","withAppend","forEach","toAssign","oldVal","newVals","_appendWithOverwrite","_appendWithoutOverwrite","objAssign","Lang","ConfigEntry","ValueEmbedder","rootElem","super","_value","val","absent","fromNullable","CONFIG_VALUE","CONFIG_ANY","Config","Optional","root","configDef","shallowCopy","shallowCopy$","deepCopy","deepCopy$","other","newThis","getOwnPropertyNames","appendIf","assignIf","getIf","assertAccessPath","getClass","resolve","get","toJson","setVal","preprocessKeys","currAccessPos","find","isPresent","isNoArray","trim","isString","eqi","equalsIgnoreCase","objToArray","NonceValueEmbedder","rootElems","isAbsent","nonce","getAttribute","newVal","setAttribute","ALLOWED_SUBMITTABLE_ELEMENTS","ElementAttribute","element","name","orElse","values","valueKey","Style","style","DEFAULT_WHITELIST","DomQuery","rootNode","pos","_limits","foundElement","querySelectorAll","getAsElem","allElems","global","_global$","stream","lazyStream","id","tagName","nodeName","isTag","toLowerCase","type","inputValue","nodeId","checked","el","newChecked","eachElem","elements","deepElements","querySelectorAllDeep","queryStr","found","queryRes","shadowRoots","shadowRoot","shadowRes","disabled","attr","removeAttribute","childNodes","childNodeArr","concat","asArray","byId","offsetWidth","elem","reduce","accumulate","incoming","offsetHeight","offsetLeft","offsetTop","asNodeArray","selector","document","_querySelectorAllDeep","_querySelectorAll","deep","byIdDeep","byTagName","globalEval","code","globalEvalSticky","fromMarkup","markup","doc","implementation","createHTMLDocument","lowerMarkup","search","documentElement","innerHTML","startsWithTag","str","tag1","join","tag2","dummyPlaceHolder","createElement","html","detach","index","defaults","filesFromElem","files","presentRunnable","call","ifPresentLazy","node","parentNode","removeChild","closest","_closestDeep","_closest","includeRoot","res","subItems","reduction","defaultValue","cssProperty","hasClass","clazz","hasIt","classList","contains","addClass","add","removeClass","remove","isMultipartCandidate","FILE_INPUT","matchesSelector","first","newInnerHTML","dispatchEvent","evt","retArr","innerHtml","newInnerHtml","filterSelector","matched","_matchesSelector","some","nodeSelector","selectorStage","func","len","firstElem","lastElem","each","replace","toReplace","asElem","parentElement","nextElement","nextElementSibling","previousElement","previousElementSibling","insertBefore","insertAfter","delete","last","lastNode","reArr","head","getElementsByTagName","script","newScriptElement","appendChild","applyNonce","appendTo","orElseLazy","loadScriptEval","src","delay","_loadScriptEval","loadScriptEvalSticky","toInsertParams","existingItem","existingElement","nextSibling","insertElem","elseValue","allParents","firstParent","parentsWhileMatch","host","copyAttrs","sourceItem","sourceNode","attrs","attributes","resolveAttributeHolder","outerHTML","runEmbeddedScripts","runEmbeddedCss","focusElementId","activeElement","caretPosition","getCaretPosition","nodes","firstInsert","replaced","replaceChild","insertAdditionalItems","slice","runScripts","runCss","focusElement","setCaretPosition","sticky","whitelisted","evalCollectedScripts","scriptsToProcess","joinedScripts","evalText","finalScripts","allowedItemTypes","execScript","itemType","text","innerText","go","sort","node1","node2","compareDocumentPosition","e","console","error","message","description","_toReplace","newElement","execCss","click","fireEvent","addEventListener","listener","options","removeEventListener","eventName","finalOptions","bubbles","cancelable","simpleShallowMerge","ownerDocument","nodeType","EventClass","Event","MouseEvent","KeyboardEvent","event","synthetic","createEventObject","textContent","joinString","text1","text2","encodeFormElement","toMerge","elemType","selectElem","selectedIndex","uLen","u","selected","elementOption","SELECT","BUTTON","RESET","SUBMIT","IMAGE","CHECKBOX","RADIO","uploadedFiles","filesArr","from","cDATAAsString","reduced","data","subNodes","to","Math","min","limits","hasNext","isLimitsReached","isEndOfArray","next","lookAhead","ITERATION_STATUS","EO_STRM","current","BEF_STRM","reset","attachShadow","params","mode","shadowElement","waitUntilDom","childList","subtree","timeout","interval","Promise","success","observer","MUT_ERROR","findElement","MutationObserver","mutTimeout","setTimeout","disconnect","callback","mutationList","mut","clearTimeout","observableOpts","observe","setInterval","clearInterval","shadowElements","mapped","hasShadow","ctrl","caretPos","selection","focus","createRange","moveStart","setSelectiongRange","Symbol","iterator","done","toAttach","filterDoubles","domQueries","idx","notFound","prependTo","prepend","foundNodes","selectors","cnt2","levelSelector","toMatch","matches","foundElements","prototype","srcNode","createSourceNode","nonceCheck","marker","Date","now","random","attrName","collect","finalValue","DQ","DQ$","Es2019Array_","another","_another","flatMapFun","_flatMap","flat","flatLevel","_flat","callbackfn","thisArg","_Es2019Array","items","reverse","splice","deleteCount","predicate","initialValue","flatDepth","_flatResolve","mapperFunction","Proxy","p","receiver","isNaN","set","property","globalThis","window","g","ws","i","test","charAt","it","arguments","String","saveResolve","resolverProducer","result","saveResolveLazy","strToArray","splitter","obj","offset","pack","source","destination","finalDest","assertType","probe","theType","isFunc","Function","theArgs","TypeError","nextSource","nextKey","hasOwnProperty","Monad","fn","inVal","currentPos","getIfPresent","match","resolver","alternative","calculateSkips","next_strm","strms","selectedPos","activeStrm","findNextStrm","all_strms","shift","total","dataPos","max","filterFunc","_current","_filterIdx","_unfilteredPos","inputDataSource","steps","lookupVal","loop","mapFunc","lookAheadVal","unshift","FormData","formData","item1","item2","XMLQuery","docType","xml","DOMParser","parser","ActiveXObject","async","parseFromString","contentType","loadXML","createIe11DomQueryShim","isXMLParserError","toString","serialized","XMLSerializer","serializeToString","parserErrorText","joinstr","parseXML","txt","parseHTML","fromString","parseType","XQ","DomQueryCollector","faces","myfaces","ajax","util","specversion","implversion","separatorchar","sep","Implementation","getSeparatorChar","contextpath","getProjectStage","getViewState","formElement","getClientWindow","request","response","context","addOnError","errorFunc","addOnEvent","eventFunc","chain","funcs","init","socketClientId","url","channel","onopen","onmessage","onerror","onclose","behaviors","autoConnect","PushImpl","open","close","ab","execute","render","userParameters","CTX_OPTIONS_PARAMS","$nsp","P_BEHAVIOR_EVENT","CTX_OPTIONS_EXECUTE","CTX_PARAM_RENDER","jsf","onReadyChain","readyStateListener","onDomReady","executionFunc","readyState","reserveNamespace","namespace","namespaces","part","oam","ProjectStages","BlockFilter","getMessage","ExtLang","getGlobalConfig","assert","Assertions","ofAssoc","collectAssoc","projectStage","separator","eventQueue","errorQueue","resolveProjectStateFromURL","foundStage","ExtDomQuery","searchJsfJsFor","Production","sendError","errorData","localHandler","errorCallback","alert","displayError","assignNamingContainerData","internalContext","viewRootId","resolveViewRootId","NAMED_VIEWROOT","NAMING_CONTAINER_ID","remapDefaultConstants","targetConfig","targetKey","userValues","issuingForm","issuingElementId","rootNamingContainerId","SEP","$faces","iterValues","processed","remapNamingContainer","componentIdToTransform","rootNamingContainerPrefix","EMPTY_STR","formClientId","nearestNamingContainer","lastIndexOf","nearestNamingContainerPrefix","hasLeadingSep","finalIdentifier","IDENT_NONE","IDENT_ALL","IDENT_FORM","IDENT_THIS","resolveGlobalConfig","MYFACES","config","requestQueue","returnVal","sourceCode","resolveAndExecute","opts","elementId","windowId","isResetValues","resolveDefaults","requestCtx","ExtConfig","internalCtx","assertRequestIntegrity","form","resolveForm","viewId","resolveViewId","formId","resolveDelay","resolveTimeout","mappedOpts","P_WINDOW_ID","CTX_PARAM_REQ_PASS_THR","arrayedParams","ctxPassthrough","requestOptions","targetContext","sourceElementId","$nspEnabled","P_EVT","SOURCE","VIEW_ID","ON_EVENT","onevent","ON_ERROR","P_AJAX_SOURCE","P_AJAX","P_RESET_VALUES","CTX_PARAM_SRC_FRM_ID","CTX_PARAM_UPLOAD_PREINIT","upload","preinit","CTX_PARAM_UPLOAD_LOADSTART","loadstart","CTX_PARAM_UPLOAD_ON_PROGRESS","progress","CTX_PARAM_UPLOAD_LOADEND","loadend","CTX_PARAM_UPLOAD_LOAD","load","CTX_PARAM_UPLOAD_ERROR","CTX_PARAM_UPLOAD_ABORT","abort","CTX_PARAM_UPLOAD_TIMEOUT","CTX_PARAM_SRC_CTL_ID","CTX_PARAM_PPS","extractMyFacesParams","MYFACES_OPTION_PPS","clientWindow","P_CLIENT_WINDOW","assignClientWindowId","P_EXECUTE","P_RENDER","assignRender","queueHandler","addRequestToQueue","Response","processResponse","errorListener","eventListener","sendEvent","stdErrorHandler","exception","clearRequestQueue","ErrorData","fromClient","clear","ALTERED","INIT","searchRoot","formWindowId","value1","value2","href","location","results","RegExp","exec","fetchWindowIdFromURL","HTML_TAG_FORM","dummyContext","formElements","encodeFormData","resoveNamingContainerMapper","reqCtx","respPassThr","XhrQueueController","enqueue","XhrRequest","URL_PROTOCOL","protocol","sockets","components","clientIdsByTokens","resolveFunction","WebSocket","channelToken","substr","Socket","base","hostname","port","getBaseURL","getSocket","reconnectAttempts","socket","bindCallbacks","clientIds","getElementById","onmmessage","functions","j","reason","REASON_EXPIRED","MAX_RECONNECT_ATTEMPTS","RECONNECT_INTERVAL","s","inputNamespace","XML_ATTR_NAMED_VIEWROOT","P_VIEWSTATE","P_VIEWROOT","P_VIEWHEAD","P_VIEWBODY","P_RESOURCE","EMPTY_FUNC","freeze","EMPTY_MAP","HTML_VIEWSTATE","HTML_CLIENT_WINDOW","P_RENDER_OVERRIDE","WINDOW_ID","ERROR","EVENT","BEGIN","COMPLETE","SUCCESS","STATUS","ERROR_NAME","ERROR_MESSAGE","RESPONSE_TEXT","RESPONSE_XML","HTTP_ERROR","EMPTY_RESPONSE","MALFORMEDXML","SERVER_ERROR","CLIENT_ERROR","TIMEOUT_EVENT","CTX_OPTIONS_DELAY","DELAY_NONE","CTX_OPTIONS_TIMEOUT","CTX_OPTIONS_RESET","CTX_PARAM_MF_INTERNAL","CONTENT_TYPE","HEAD_FACES_REQ","REQ_ACCEPT","VAL_AJAX","ENCODED_URL","REQ_TYPE_GET","REQ_TYPE_POST","STATE_EVT_BEGIN","STATE_EVT_TIMEOUT","STATE_EVT_COMPLETE","URL_ENCODED","MULTIPART","NO_TIMEOUT","STD_ACCEPT","HTML_TAG_HEAD","HTML_TAG_BODY","HTML_TAG_LINK","HTML_TAG_SCRIPT","HTML_TAG_STYLE","SEL_VIEWSTATE_ELEM","SEL_CLIENT_WINDOW_ELEM","SEL_RESPONSE_XML","PHASE_PROCESS_RESPONSE","ERR_NO_PARTIAL_RESPONSE","ATTR_URL","ATTR_NAME","ATTR_VALUE","ATTR_ID","XML_TAG_PARTIAL_RESP","XML_TAG_CHANGES","XML_TAG_UPDATE","XML_TAG_DELETE","XML_TAG_INSERT","XML_TAG_EVAL","XML_TAG_ERROR","XML_TAG_ATTRIBUTES","XML_TAG_EXTENSION","XML_TAG_REDIRECT","XML_TAG_BEFORE","XML_TAG_AFTER","XML_TAG_ATTR","UPDATE_FORMS","UPDATE_ELEMS","DEFERRED_HEAD_INSERTS","MF_NONE","APPLIED_VST","APPLIED_CLIENT_WINDOW","UNKNOWN","viewStatePos","nameSpace","hasNameSpace","MSG_TEST","MSG_DEV_MODE","MSG_AFFECTED_CLASS","MSG_AFFECTED_METHOD","MSG_ERROR_NAME","MSG_ERROR_MESSAGE","MSG_SERVER_ERROR_NAME","MSG_ERROR_DESC","MSG_ERROR_NO","MSG_ERROR_LINENO","ERR_FORM","ERR_VIEWSTATE","ERR_TRANSPORT","ERR_EVT_PASS","ERR_CONSTRUCT","ERR_MALFORMEDXML","ERR_SOURCE_FUNC","ERR_EV_OR_UNKNOWN","ERR_SOURCE_NOSTR","ERR_SOURCE_DEF_NULL","ERR_MUST_STRING","ERR_REF_OR_ID","ERR_PARAM_GENERIC","ERR_PARAM_STR","ERR_PARAM_STR_RE","ERR_PARAM_MIXMAPS","ERR_MUST_BE_PROVIDED","ERR_MUST_BE_PROVIDED1","ERR_REPLACE_EL","ERR_EMPTY_RESPONSE","ERR_ITEM_ID_NOTFOUND","ERR_PPR_IDREQ","ERR_PPR_INSERTBEFID","ERR_PPR_INSERTBEFID_1","ERR_PPR_INSERTBEFID_2","ERR_PPR_DELID","ERR_PPR_UNKNOWNCID","ERR_NO_VIEWROOTATTR","ERR_NO_HEADATTR","ERR_RED_URL","ERR_REQ_FAILED_UNKNOWN","ERR_REQU_FAILED","msg","caller","title","raiseError","assertFunction","assertUrlExists","assertValidXMLResponse","responseXML","finalTitle","finalName","finalMessage","makeException","assertDelay","catchFunctions","thenFunctions","inputVal","thenFunc","reject","catchFunc","then","IS_FACES_SOURCE","ATTR_SRC","body","globalNonce","currentScript","nonceScript","regExp","decodeURIComponent","whiteListed","runHeadInserts","suppressDoubleIncludes","processedScripts","reference","identifier","ExtDQ","accessPathMapped","remap","paramsMapper","inStr","defaultStr","assocValues","File","encodeURIComponent","parentItem","standardInputs","decodeEncodedValues","resolveViewState","fileInputs","resolveFiles","encoded","_line","line","dataSource","fileInput","file","namedViewRoot","isViewState","template","withNamingContainerId","namingContainer","namingContainerId","withParent","withNamedViewRoot","build","state","ident","installedLocale","defaultMessage","templateParams","Messages","param","callerCls","callFunc","getLanguage","language","navigator","languages","failSaveResolve","failSaveExecute","keyValToStr","delimiter","configName","getForm","queryElem","eventTarget","getEventTarget","foundForm","forms","assertOnlyOneFormExists","getLocalOrGlobalConfig","localOptions","activeTimeouts","debounce","runnable","clearActiveTimeout","queue","taskRunning","timeOut","requestHandler","enrichRunnable","signalTaskRunning","updateTaskRunning","isEmpty","asyncRunnable","catch","ErrorType","EventData","errorName","errorMessage","responseText","responseCode","statusOverride","status","typeDetails","serverErrorName","serverErrorMessage","stack","fromHttpConnection","fromGeneric","errorCode","errorType","getMsg","fromServerError","createFromRequest","eventData","sourceId","requestContext","responseContext","funcName","sourceForm","ajaxType","resolveTargetUrl","viewState","divider","viewStateViewId","prefix","getCfg","finalEvent","t","srcElement","resolveWindowId","resetValues","srcFormElement","action","req","externalContext","resolveContexts","resolveResponseXML","responseProcessor","ResponseProcessor","partialId","updateNamedViewRootState","SEL_SUB_TAGS","redirect","ALLOWED_TAGS","processViewState","processClientWindow","storeState","cdataBlock","replaceViewRoot","replaceHead","replaceBody","addToHead","update","handleElementUpdate","processUpdateTag","eval","processInsert","processChangesTag","processPartialTag","fixViewStates","fixClientWindow","insertWithSubTags","insert","elemId","resolveSourceElementId","sourceFormId","shadowDocument","shadowHead","mappedHeadData","scriptTags","nodesToAdd","scriptElements","addToHeadDeferred","newElements","shadowBody","shadowInnerHTML","resultingBody","updateForms","storeForPostProcessing","mergedErrorData","hasResponseXML","triggerOnError","redirectUrl","before","after","insertNodes","insertId","isViewStateNode","StateHolder","isClientWindowNode","updateElems","affectedForms","getContainerForms","affectedForm","isInExecuteOrRender","appendViewStateToForms","appendClientWindowToForms","eventHandler","assignState","HiddenInputBuilder","createAndAppendHiddenInput","toBeEvaluated","storeForUpdate","storeForEval","executes","renders","nameOrId","NAME_OR_ID","getNameOrIdSelector","defaultParamsMapper","XhrFormData","partialIds","isMultipartRequest","resolveRequestType","encodeSubmittableFields","applyViewState","toFormData","remapKeyForNamingContainer","rootElement","viewStateElement","remappedPartialIds","getFormInputsAsArr","fixEmptyParameters","AsyncRunnable","stopProgress","xhrObject","XMLHttpRequest","registerXhrCallbacks","ignoreErr","executesArr","partialIdsArray","requestPassThroughParams","appendIssuingItem","resolveFinalUrl","setRequestHeader","sendRequest","handleErrorAndClearQueue","cancel","handleError","onabort","onAbort","ontimeout","onTimeout","onload","onResponseReceived","onloadend","onResponseProcessed","isCancelledResponse","currentTarget","handleHttpError","processRequestErrors","handleGenericResponseError","responseStatus","finalizeError","resolveOrReject","isPost","send","evtType","resolveHandlerFunc","responseFormatError","issuingItemId","eventType","isBehaviorEvent","issuingItem","itemValue","TYPE_CHECKBOX","TYPE_RADIO","setHiddenInput","formName","input","newInput","clearHiddenInput","submitForm","linkId","clearFn","core","autoScroll","getScrolling","paramsStream","oldTarget","onsubmit","submit","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"faces.js","mappings":";gEAWO,MAAMA,EAAiB,IAUvB,SAASC,EAAeC,EAAaC,GACxC,IAAK,IAAIC,EAAQ,EAAGC,EAAMF,EAAOG,OAAQF,EAAQC,EAAKD,GAASJ,EAC3DO,MAAMC,UAAUC,KAAKC,MAAMR,EAAQK,MAAMC,UAAUG,MAAMC,KAAKT,EAAQC,EAAOA,EAAQJ,IAEzF,OAAOE,CACX,CAOA,MAAMW,UAAyBN,MAI3B,WAAAO,CAAYC,EAAe,IACvBC,SAEAD,EAAUR,MAAMU,QAAQF,GAAWA,EAAU,CAACA,IAC1BG,SAChBC,KAAKD,SAAYH,EAAgBG,SAEjCC,KAAKD,SAAWH,EAEpBd,EAAYkB,KAAMJ,GAIdI,KAAKC,QAAWC,GAAeF,KAAKG,SAASD,GAG7CF,KAAKI,KAAO,CAACC,EAAoB,IAAML,KAAKM,MAAMD,EAE1D,CAEA,GAAAE,CAAOC,EAAwDC,GAE3D,OAAQC,EADItB,MAAMC,UAAUkB,IAAId,KAAKO,KAAKD,SAAUS,EAAYC,GAEpE,CAEA,MAAAE,IAAUC,GAEN,OAAQF,EADItB,MAAMC,UAAUsB,OAAOpB,MAAMS,KAAKD,SAAUa,GAE5D,CAEA,OAAAC,GAEI,OAAQH,EADItB,MAAMC,UAAUwB,QAAQpB,KAAKO,KAAKD,UAElD,CAEA,KAAAP,CAAMP,EAAgB6B,GAElB,OAAQJ,EADItB,MAAMC,UAAUG,MAAMC,KAAKO,KAAKD,SAAUd,EAAO6B,GAEjE,CAEA,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C,EAAAR,IACA,oBAAAxvB,QAAAA,OAAAiwB,aACAjpC,OAAA8e,eAAA0pB,EAAAxvB,OAAAiwB,YAAA,CAAuDpuC,MAAA,WAEvDmF,OAAA8e,eAAA0pB,EAAA,cAAgD3tC,OAAA,GAAa,iBCyB7D,8CAAI4L,OAAOsd,MAAO,CAEd,MAAMmlB,EAAaxiC,EAAA,OACnBD,OAAc,MAAiB,QAAbrD,EAAM,OAANqD,aAAM,IAANA,YAAM,EAANA,OAAQsd,aAAK,IAAA3gB,EAAAA,EAAI8lC,CACvC,CACA,KAAmB,QAAf/lC,EAAM,OAANsD,aAAM,IAANA,YAAM,EAANA,OAAQohB,eAAO,IAAA1kB,OAAA,EAAAA,EAAEskC,IAAI,CACrB,MAAM5f,EAAUnhB,EAAA,OAGfD,OAAwB,QAAmB,QAAfjD,EAAM,OAANiD,aAAM,IAANA,YAAM,EAANA,OAAQohB,eAAO,IAAArkB,EAAAA,EAAI,GAChDxD,OAAO1C,KAAKuqB,GAAS/tB,SAAQoC,IAAM,IAAAkH,EAAAD,EAAC,OAAAsD,OAAOohB,QAAQ3rB,GAA4B,QAArBiH,EAAc,QAAdC,EAAAqD,OAAOohB,eAAO,IAAAzkB,OAAA,EAAAA,EAAGlH,UAAI,IAAAiH,EAAAA,EAAI0kB,EAAQ3rB,EAAI,GACnG,CACO,IAAI6nB,EAAQtd,OAAOsd,MACfolB,EAAU1iC,OAAOohB","sources":["webpack:///./node_modules/mona-dish/src/main/typescript/Es2019Array.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Lang.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Monad.ts","webpack:///./node_modules/mona-dish/src/main/typescript/AssocArray.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Config.ts","webpack:///./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Global.ts","webpack:///./node_modules/mona-dish/src/main/typescript/DomQuery.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Promise.ts","webpack:///./node_modules/mona-dish/src/main/typescript/XmlQuery.ts","webpack:///./node_modules/mona-dish/src/main/typescript/Stream.ts","webpack:///./node_modules/mona-dish/src/main/typescript/TagBuilder.ts","webpack:///./src/main/typescript/impl/core/Const.ts","webpack:///./src/main/typescript/impl/i18n/Messages.ts","webpack:///./src/main/typescript/impl/util/ExtDomQuery.ts","webpack:///./src/main/typescript/impl/xhrCore/RequestDataResolver.ts","webpack:///./src/main/typescript/impl/util/Lang.ts","webpack:///./src/main/typescript/impl/util/Assertions.ts","webpack:///./src/main/typescript/impl/xhrCore/EventData.ts","webpack:///./src/main/typescript/impl/xhrCore/ErrorData.ts","webpack:///./src/main/typescript/impl/core/ImplTypes.ts","webpack:///./src/main/typescript/impl/util/HiddenInputBuilder.ts","webpack:///./src/main/typescript/impl/xhrCore/ResponseProcessor.ts","webpack:///./src/main/typescript/impl/xhrCore/Response.ts","webpack:///./src/main/typescript/impl/xhrCore/ResponseDataResolver.ts","webpack:///./src/main/typescript/impl/util/AsyncRunnable.ts","webpack:///./src/main/typescript/impl/util/FileUtils.ts","webpack:///./src/main/typescript/impl/xhrCore/XhrFormData.ts","webpack:///./src/main/typescript/impl/xhrCore/XhrRequest.ts","webpack:///./src/main/typescript/impl/util/XhrQueueController.ts","webpack:///./src/main/typescript/impl/AjaxImpl.ts","webpack:///./src/main/typescript/impl/PushImpl.ts","webpack:///./src/main/typescript/myfaces/OamSubmit.ts","webpack:///./src/main/typescript/api/_api.ts","webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/main/typescript/api/faces.ts"],"sourcesContent":["/**\n * Extended array\n */\n\n/**\n * Max number of elements passed per function call.\n * Spreading or applying a large array into a single call\n * (\"fn(...data)\") overflows the argument stack on most browsers\n * (Chrome throws \"RangeError: Maximum call stack size exceeded\"\n * at roughly 65k arguments), so bulk operations must be chunked.\n */\nexport const MAX_ARG_LENGTH = 30000;\n\n/**\n * Appends the contents of source to target in argument-stack-safe chunks,\n * the chunk-safe replacement for target.push(...source)\n *\n * @param target the array to append to\n * @param source the elements to append\n * @returns target for chaining\n */\nexport function pushChunked<T>(target: T[], source: ArrayLike<T>): T[] {\n for (let start = 0, len = source.length; start < len; start += MAX_ARG_LENGTH) {\n Array.prototype.push.apply(target, Array.prototype.slice.call(source, start, start + MAX_ARG_LENGTH));\n }\n return target;\n}\n\n/**\n * Extended array which adds various es 2019 shim functions to the normal array\n * We must remap all array producing functions in order to keep\n * the delegation active, once we are in!\n */\nclass Es2019Array_<T> extends Array<T>{\n\n _another: T[];\n\n constructor(another: T[] = []) {\n super();\n // species constructors and legacy code paths may pass a scalar\n another = Array.isArray(another) ? another : [another] as T[];\n if((another as any)._another) {\n this._another = (another as any)._another;\n } else {\n this._another = another;\n }\n pushChunked(this, another);\n\n //for testing it definitely runs into this branch because we are on es5 level\n //if (!(Array.prototype).flatMap as any) {\n this.flatMap = (flatMapFun) => this._flatMap(flatMapFun) as any;\n //}\n //if (!(Array.prototype).flat as any) {\n this.flat = (flatLevel: number = 1) => this._flat(flatLevel);\n //}\n }\n\n map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[] {\n const ret = Array.prototype.map.call(this._another, callbackfn, thisArg);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n concat(...items: any[]): T[] {\n const ret = Array.prototype.concat.apply(this._another, items);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n reverse(): T[] {\n const ret = Array.prototype.reverse.call(this._another);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n slice(start?: number, end?: number): T[] {\n const ret = Array.prototype.slice.call(this._another, start, end);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n splice(start: number, deleteCount?: number): T[] {\n const ret = Array.prototype.splice.call(this._another, start, deleteCount ?? 0);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n filter<S extends T>(predicate: (value: T, index: number, array: T[]) => any, thisArg?: any): S[] {\n const ret = Array.prototype.filter.call(this._another, predicate, thisArg);\n return (_Es2019ArrayFromArr as any)(ret);\n }\n\n\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T {\n const ret = Array.prototype.reduce.call(this._another, callbackfn as any, initialValue);\n return ret as T;\n }\n\n /*reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T {\n const ret = Array.prototype.reduceRight.call(callbackfn, initialValue);\n return ret;\n }*/\n\n private _flat(flatDepth = 1) {\n return this._flatResolve(this._another, flatDepth);\n }\n\n private _flatResolve(arr: any[], flatDepth = 1): any[] {\n //recursion break\n if (flatDepth == 0) {\n return arr;\n }\n let res: any[] = [];\n\n let reFlat = (item: any) => {\n item = Array.isArray(item) ? item : [item];\n let mapped = this._flatResolve(item, flatDepth - 1);\n res = res.concat(mapped);\n };\n arr.forEach(reFlat)\n\n return Es2019ArrayFrom(res);\n }\n\n private _flatMap(mapperFunction: Function): any {\n let res = this.map(item => mapperFunction(item));\n return this._flatResolve(res);\n }\n}\n\n//let _Es2019Array = function<T>(...data: T[]) {};\n\n//let oldProto = Es2019Array.prototype;\n\nexport function _Es2019Array<T>(...data: T[]): Es2019Array_<T> {\n return _Es2019ArrayFromArr(data);\n}\n\n/**\n * chunk-safe variant of _Es2019Array which takes the backing array\n * directly instead of spreading it into the call\n */\nexport function _Es2019ArrayFromArr<T>(data: T[]): Es2019Array_<T> {\n let ret = new Es2019Array_<T>(data);\n let proxied = new Proxy<Es2019Array_<T>>(ret, {\n get(target: Es2019Array_<unknown>, p: string | symbol, receiver: any): any {\n if(\"symbol\" == typeof p) {\n return (target._another as any)[p];\n }\n if(!isNaN(parseInt(p as string))) {\n return (target._another as any)[p];\n } else {\n return (target as any)[p];\n }\n },\n\n set(target, property, value): boolean {\n (target as any)[property] = value;\n (target._another as any)[property] = value;\n return true;\n }\n\n });\n return proxied;\n};\n\n/**\n * this is the switch between normal array and our shim\n * the shim is only provided in case the native browser\n * does not yet have flatMap support on arrays\n */\n// Runtime check for browser compatibility — TypeScript knows flatMap exists in lib but older browsers may not have it.\ninterface Es2019ArrayConstructor {\n new<T = any>(...data: any[]): T[];\n <T = any>(...data: any[]): T[];\n}\n\nexport var Es2019Array: Es2019ArrayConstructor = (((Array.prototype as any).flatMap) ? function<T>(...data: T[]): T[] {\n // sometimes the typescript compiler produces\n // an array without flatmap between boundaries (the result produces True for Array.isArray\n // but has no flatMap function, could be a node issue also or Typescript!\n // we remap that (could be related to: https://github.com/microsoft/TypeScript/issues/31033\n // the check and remap fixes the issue which should not exist in the first place\n return (data as any)?.flatMap ? data : _Es2019ArrayFromArr(data);\n} : _Es2019Array) as Es2019ArrayConstructor;\n\n/**\n * chunk-safe variant of new Es2019Array(...source) -\n * spreading a large array into the constructor call overflows the\n * argument stack (\"Maximum call stack size exceeded\"), this builder\n * copies the data over in safe chunks instead\n *\n * @param source an array or array-like holding the initial data\n */\nexport function Es2019ArrayFrom<T>(source: ArrayLike<T>): T[] {\n const data: T[] = pushChunked([], source);\n return ((Array.prototype as any).flatMap) ? data : _Es2019ArrayFromArr(data);\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Optional} from \"./Monad\";\nimport {Es2019ArrayFrom} from \"./Es2019Array\";\n\n/**\n * Lang helpers crossported from the apache myfaces project\n */\nexport namespace Lang {\n\n\n //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those\n /**\n * helper function to safely resolve anything\n * this is not an elvis operator, it resolves\n * a value without exception in a tree and if\n * it is not resolvable then an optional of\n * a default value is restored or Optional.empty\n * if none is given\n *\n * usage\n * <code>\n * let var: Optiona<string> = saveResolve(() => a.b.c.d.e, \"foobaz\")\n * </code>\n *\n * @param resolverProducer a lambda which can produce the value\n * @param defaultValue an optional default value if the producer fails to produce anything\n * @returns an Optional of the produced value\n */\n export function saveResolve<T>(resolverProducer: () => T, defaultValue: T | null = null): Optional<T> {\n try {\n let result = resolverProducer();\n return Optional.fromNullable(result ?? defaultValue);\n } catch (e) {\n return Optional.absent;\n }\n }\n\n /**\n * lazy resolve... aka the function is called on resolve and a default value also\n * is a producing function (called only if the original producer does not produce any result)\n * @param resolverProducer the producer for the resolve\n * @param defaultValue the default value producer function\n */\n export function saveResolveLazy<T>(resolverProducer: () => T, defaultValue: (() => T) | null = null): Optional<T> {\n try {\n let result = resolverProducer();\n return Optional.fromNullable(result ?? defaultValue!());\n } catch (e) {\n return Optional.absent;\n }\n }\n\n /**\n * String to array function performs a string to array transformation\n * @param {String} it the string which has to be changed into an array\n * @param {RegExp} splitter our splitter reglar expression\n * @return a trimmed array of the splitted string\n */\n export function strToArray(it: string, splitter: string | RegExp = /\\./gi): Array<string> {\n\n let ret: string[] = [];\n it.split(splitter).forEach((element => {\n ret.push(trim(element));\n }));\n return ret;\n }\n\n /**\n * hyperfast trim\n * http://blog.stevenlevithan.com/archives/faster-trim-javascript\n * crossported from dojo\n */\n export function trim(str: string): string {\n str = str.replace(/^\\s\\s*/, '');\n let ws = /\\s/, i = str.length;\n\n while (ws.test(str.charAt(--i))) {\n //do nothing\n }\n return str.slice(0, i + 1);\n }\n\n /**\n * generic object arrays like dom definitions to array conversion method which\n * transforms any object to something array like\n * @param obj\n * @param offset\n * @param pack\n * @returns an array converted from the object\n */\n export function objToArray<T>(obj: any, offset: number = 0, pack: Array<T> = []): Array<T> {\n if ((obj ?? \"__undefined__\") == \"__undefined__\") {\n return pack ?? null;\n }\n //since offset is numeric we cannot use the shortcut due to 0 being false\n //special condition array delivered no offset no pack\n if ((obj) instanceof Array && !offset && !pack as any) return obj;\n\n return Es2019ArrayFrom(pack.concat(Array.prototype.slice.call(obj, offset)));\n }\n\n /**\n * equalsIgnoreCase, case-insensitive comparison of two strings\n *\n * @param source\n * @param destination\n */\n export function equalsIgnoreCase(source?: string | null, destination?: string | null): boolean {\n let finalSource = source ?? \"___no_value__\";\n let finalDest = destination ?? \"___no_value__\";\n\n //in any other case we do a strong string comparison\n return finalSource.toLowerCase() === finalDest.toLowerCase();\n }\n\n\n /**\n * runtime type assertion\n *\n * @param probe the probe to be tested for a type\n * @param theType the type to be tested for\n */\n export function assertType(probe: any, theType: any): boolean {\n return isString(theType) ? typeof probe == theType : probe instanceof theType;\n }\n\n /**\n * Back ported from Dojo\n * a failsafe string determination method\n * (since in javascript String != \"\" typeof alone fails!)\n * @param it {|Object|} the object to be checked for being a string\n * @return true in case of being a string false otherwise\n */\n export function isString(it?: any): boolean {\n //\tsummary:\n //\t\tReturn true if it is a String\n return !!arguments.length && it != null && (typeof it == \"string\" || it instanceof String); // Boolean\n }\n\n /**\n * Back-ported, a failsafe determination code for checking whether an object is a function\n * @param it the object to check for being a function\n */\n export function isFunc(it: any): boolean {\n return it instanceof Function || typeof it === \"function\";\n }\n\n export function objAssign(target: any, ...theArgs: any[]) { // .length of function is 2\n if (target == null) { // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n let to = Object(target);\n if((Object).assign as any) {\n theArgs.forEach(item => (Object).assign(to, item) as any);\n return to;\n }\n\n theArgs.filter(item => item != null).forEach(item => {\n let nextSource = item;\n const stringKeys = Object.keys(nextSource);\n const symbolKeys = Object.getOwnPropertySymbols(nextSource)\n .filter(sym => Object.prototype.propertyIsEnumerable.call(nextSource, sym));\n [...stringKeys, ...symbolKeys]\n .forEach(key => to[key] = nextSource[key]);\n });\n return to;\n }\n\n\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A module which keeps basic monad like definitions in place\n * Useful if you need the functions in another library to keep its dependencies down\n */\n\n/*IMonad definitions*/\n\nimport {Lang} from \"./Lang\";\nimport {Es2019Array} from \"./Es2019Array\";\n\n\n/**\n * IFunctor interface,\n * defines an interface which allows to map a functor\n * via a first order function to another functor\n */\nexport interface IFunctor<T> {\n map<R>(fn: (data: T) => R): IFunctor<R>;\n}\n\n/**\n * IMonad definition, basically a functor with a flatMap implementation, flatMap reduces all nested monads after a\n * function call f into a monad with the nesting level of 1\n *\n * flatmap flats nested Monads into a IMonad of the deepest nested implementation\n */\nexport interface IMonad<T, M extends IMonad<any, any>> extends IFunctor<T> {\n flatMap<R>(f?: (data: T) => R): IMonad<any, any>;\n}\n\n/**\n * a stateful functor which holds a value upn which a\n * function can be applied\n *\n * as value holder of type T\n */\nexport interface IIdentity<T> extends IFunctor<T> {\n readonly value: T;\n}\n\n\n/**\n * custom value holder definition, since we are not pure functional\n * but iterative we have structures which allow the assignment of a value\n * also not all structures are side - effect free\n */\nexport interface IValueHolder<T> {\n value: T | Array<T>;\n}\n\n/**\n * Implementation of a monad\n * (Side - effect free), no write allowed directly on the monads\n * value state\n */\nexport class Monad<T> implements IMonad<T, Monad<any>>, IValueHolder<T> {\n constructor(value: T) {\n this._value = value;\n }\n\n protected _value: T;\n\n get value(): T {\n return this._value;\n }\n\n map<R>(fn?: (data: T) => R): Monad<R> {\n if (!fn) {\n fn = (inVal: any) => <R>inVal;\n }\n let result: R = fn(this.value);\n return new Monad(result);\n }\n\n flatMap<R>(fn?: (data: T) => R): Monad<any> {\n let mapped: Monad<any> = this.map(fn);\n while (mapped?.value instanceof Monad) {\n mapped = mapped.value\n }\n return mapped;\n }\n\n}\n\n/**\n * optional implementation, an optional is basically an implementation of a Monad with additional syntactic\n * sugar on top\n * (Side - effect free, since value assignment is not allowed)\n * */\nexport class Optional<T> extends Monad<T | null | undefined> {\n\n /*default value for absent*/\n static absent: Optional<any> = Optional.fromNullable(null);\n\n constructor(value: T | null | undefined) {\n super(value);\n }\n\n get value(): T {\n if (this._value instanceof Monad) {\n return this._value.flatMap().value\n }\n return this._value as T;\n }\n\n static fromNullable<V extends Optional<T>, T>(value?: T | null): Optional<T> {\n return <V> new Optional<T>(value);\n }\n\n /*syntactic sugar for absent and present checks*/\n isAbsent(): boolean {\n return \"undefined\" == typeof this.value || null == this.value;\n }\n\n /**\n * any value present\n */\n isPresent(presentRunnable ?: (val ?: Optional<T>) => void): boolean {\n let absent = this.isAbsent();\n if (!absent && presentRunnable) {\n presentRunnable.call(this, this)\n }\n return !absent;\n }\n\n ifPresentLazy(presentRunnable: (val ?: Optional<T>) => void = () => {\n }): Optional<T> {\n this.isPresent.call(this, presentRunnable);\n return this;\n }\n\n orElse(elseValue: any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n //shortcut\n if (elseValue == null) {\n return Optional.absent;\n }\n return this.flatMap(() => elseValue);\n }\n }\n\n /**\n * lazy, passes a function which then is lazily evaluated\n * instead of a direct value\n * @param func\n */\n orElseLazy(func: () => any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n return this.flatMap(func);\n }\n }\n\n /*\n * we need to implement it to fulfill the contract, although it is used only internally\n * all values are flattened when accessed anyway, so there is no need to call this method\n */\n flatMap<R>(fn?: (data: T) => R): Optional<any> {\n let val = super.flatMap(fn as any);\n if (!(val instanceof Optional)) {\n return Optional.fromNullable(val.value);\n }\n\n return <Optional<any>>val.flatMap();\n }\n\n /*\n * elvis operation, take care, if you use this you lose typesafety and refactoring\n * capabilities, unfortunately typescript does not allow to have its own elvis operator\n * this is some syntactic sugar however which is quite useful*/\n getIf<R>(...key: string[]): Optional<R> {\n\n key = this.preprocessKeys(...key);\n\n let currentPos: Optional<any> = this;\n for (let cnt = 0; cnt < key.length; cnt++) {\n let currKey = this.keyVal(key[cnt]);\n let arrPos = this.arrayIndex(key[cnt]);\n\n if (currKey === \"\" && arrPos >= 0) {\n currentPos = this.getClass().fromNullable(!(currentPos.value instanceof Array) ? null : (currentPos.value.length < arrPos ? null : currentPos.value[arrPos]));\n if (currentPos.isAbsent()) {\n return currentPos;\n }\n continue;\n } else if (currKey && arrPos >= 0) {\n if (currentPos.getIfPresent(currKey).isAbsent()) {\n return currentPos;\n }\n currentPos = (currentPos.getIfPresent(currKey).value instanceof Array) ? this.getClass().fromNullable((currentPos.getIfPresent(currKey).value as any)[arrPos]) : this.getClass().absent;\n if (currentPos.isAbsent()) {\n return currentPos;\n }\n continue;\n\n } else {\n currentPos = currentPos.getIfPresent(currKey);\n }\n if (currentPos.isAbsent()) {\n return currentPos;\n } else if (arrPos > -1) {\n currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);\n }\n }\n return currentPos;\n }\n\n /**\n * simple match, if the first order function call returns\n * true then there is a match, if the value is not present\n * it never matches\n *\n * @param fn the first order function performing the match\n */\n match(fn: (item: T) => boolean): boolean {\n if (this.isAbsent()) {\n return false\n }\n return fn(this.value);\n }\n\n /**\n * convenience function to flatmap the internal value\n * and replace it with a default in case of being absent\n *\n * @param defaultVal\n * @returns {Optional<any>}\n */\n get<R>(defaultVal: any = Optional.absent): Optional<R> {\n if (this.isAbsent()) {\n return this.getClass().fromNullable(defaultVal).flatMap();\n }\n\n return this.getClass().fromNullable(this.value).flatMap();\n }\n\n toJson(): string {\n return JSON.stringify(this.value);\n }\n\n /**\n * helper to override several implementations in a more fluent way\n * by having a getClass operation we can avoid direct calls into the constructor or\n * static methods and do not have to implement several methods which rely on the type\n * of \"this\"\n * @returns the type of Optional\n */\n protected getClass(): any {\n return Optional;\n }\n\n /*helper method for getIf with array access aka <name>[<indexPos>]*/\n protected arrayIndex(key: string): number {\n let start = key.indexOf(\"[\");\n let end = key.indexOf(\"]\");\n if (start >= 0 && end > 0 && start < end) {\n return parseInt(key.substring(start + 1, end));\n } else {\n return -1;\n }\n }\n\n /*helper method for getIf with array access aka <name>[<indexPos>]*/\n protected keyVal(key: string): string {\n let start = key.indexOf(\"[\");\n\n if (start >= 0) {\n return key.substring(0, start);\n } else {\n return key;\n }\n }\n\n /**\n * additional syntactic sugar which is not part of the usual optional implementation\n * but makes life easier, if you want to sacrifice typesafety and refactoring\n * capabilities in typescript\n */\n getIfPresent<R>(key: string): Optional<R> {\n if (this.isAbsent()) {\n return this.getClass().absent;\n }\n return this.getClass().fromNullable((this.value as any)[key]).flatMap();\n }\n\n /**\n * elvis like typesafe functional save resolver\n * a typesafe option for getIfPresent\n *\n * usage myOptional.resolve(value => value.subAttr.subAttr2).orElseLazy(....)\n * if this is resolvable without any errors an Optional with the value is returned\n * if not, then an Optional absent is returned, also if you return Optional absent\n * it is flatmapped into absent\n *\n * @param resolver the resolver function, can throw any arbitrary errors, int the error case\n * the resolution goes towards absent\n */\n resolve<V>(resolver: (item: T) => V): Optional<V> {\n if (this.isAbsent()) {\n return Optional.absent;\n }\n try {\n return Optional.fromNullable(resolver(this.value))\n } catch (e) {\n return Optional.absent;\n }\n }\n\n\n protected preprocessKeys(...keys: string[]): string[] {\n return new Es2019Array(...keys)\n .flatMap(item => {\n return new Es2019Array(...item.split(/]\\s*\\[/gi))\n .map(item => {\n item = item.replace(/^\\s+|\\s+$/g, \"\");\n if(item.indexOf(\"[\") == -1 && item.indexOf(\"]\") != -1) {\n item = \"[\" + item;\n }\n if(item.indexOf(\"]\") == -1 && item.indexOf(\"[\") != -1) {\n item = item + \"]\";\n }\n return item;\n })\n });\n }\n}\n\n\n// --------------------- From here onwards we break out the side effect free limits ------------\n\n/**\n * ValueEmbedder is the writeable version\n * of optional, it basically is a wrapper\n * around a construct which has a state\n * and can be written to.\n *\n * For the readonly version see Optional\n */\nexport class ValueEmbedder<T> extends Optional<T> implements IValueHolder<T> {\n\n /*default value for absent*/\n static absent = ValueEmbedder.fromNullable(null);\n\n protected key: string;\n\n constructor(rootElem: any, valueKey: string = \"value\") {\n super(rootElem);\n\n this.key = valueKey;\n }\n\n get value(): T {\n return this._value ? <T>(this._value as any)[this.key] : null as T;\n }\n\n set value(newVal: T) {\n if (!this._value) {\n return;\n }\n (this._value as any)[this.key] = newVal\n }\n\n orElse(elseValue: any): Optional<any> {\n let alternative: { [key: string]: any } = {};\n alternative[this.key] = elseValue;\n return this.isPresent() ? this : new ValueEmbedder(alternative, this.key);\n }\n\n orElseLazy(func: () => any): Optional<any> {\n if (this.isPresent()) {\n return this;\n } else {\n let alternative: { [key: string]: any } = {};\n alternative[this.key] = func();\n return new ValueEmbedder(alternative, this.key);\n }\n }\n\n /**\n * helper to override several implementations in a more fluent way\n * by having a getClass operation we can avoid direct calls into the constructor or\n * static methods and do not have to implement several methods which rely on the type\n * of \"this\"\n * @returns ValueEmbedder\n */\n protected getClass(): any {\n return ValueEmbedder;\n }\n\n static fromNullable<V extends Optional<T>,T>(value?: any, valueKey: string = \"value\"): V {\n return <any> new ValueEmbedder<T>(value, valueKey);\n }\n\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * various helpers to deal with associative\n * arrays. If someone feels uncomfortable using\n * The config system, this is similar!\n */\nimport {IValueHolder} from \"./Monad\";\nimport {Es2019Array, pushChunked} from \"./Es2019Array\";\n\n/**\n * A nop as assign functionality (aka ignore assign)\n */\nclass IgnoreAssign implements IValueHolder<any> {\n constructor(private parent: any) {}\n\n set value(value: any | Array<any>) {\n }\n get value(): any | Array<any> {\n return this.parent;\n }\n};\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function assign<T>(target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if (accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n const lastPathItem = buildPath(target, ...accessPath);\n let assigner: IValueHolder<T> = new (class {\n set value(value: T | Array<T>) {\n lastPathItem.target[lastPathItem.key] = value;\n }\n\n get value(): T | Array<T> {\n return lastPathItem.target[lastPathItem.key];\n }\n })();\n return assigner;\n}\n\n\nexport function append<T>(target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if (accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n const lastPathItem = buildPath(target, ...accessPath);\n let appender: IValueHolder<T> = new (class {\n set value(value: T | Array<T>) {\n if(!Array.isArray(value)) {\n value = [value];\n }\n if(!lastPathItem.target[lastPathItem.key]) {\n lastPathItem.target[lastPathItem.key] = value\n } else {\n if(!Array.isArray(lastPathItem.target[lastPathItem.key])) {\n lastPathItem.target[lastPathItem.key] = [lastPathItem.target[lastPathItem.key]];\n }\n pushChunked(lastPathItem.target[lastPathItem.key], value);\n }\n }\n })();\n return appender;\n}\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function assignIf<T>(condition: boolean, target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if ((!condition) || accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n return assign(target, ...accessPath);\n}\n\n\n/**\n * uses the known pattern from config\n * assign(target, key1, key2, key3).value = value;\n * @param target\n * @param keys\n */\nexport function appendIf<T>(condition: boolean, target: {[key: string]: any}, ...accessPath: string[]): IValueHolder<T> {\n if ((!condition) || accessPath.length < 1) {\n return new IgnoreAssign(target);\n }\n return append(target, ...accessPath);\n}\n\nexport function resolve<T>(target: {[key: string]: any}, ...accessPath: string[]): T | null {\n let ret = null;\n accessPath = flattenAccessPath(accessPath);\n let currPtr = target;\n for(let cnt = 0; cnt < accessPath.length; cnt++) {\n let accessKeyIndex: number | string = accessPath[cnt];\n accessKeyIndex = arrayIndex(accessKeyIndex) != -1 ? arrayIndex(accessKeyIndex) : accessKeyIndex;\n currPtr = currPtr?.[accessKeyIndex];\n if('undefined' == typeof currPtr) {\n return null;\n }\n ret = currPtr;\n }\n return currPtr as T;\n}\n\n\nfunction keyVal(key: string): string {\n let start = key.indexOf(\"[\");\n\n if (start >= 0) {\n return key.substring(0, start);\n } else {\n return key;\n }\n}\n\nfunction arrayIndex(key: string): number {\n let start = key.indexOf(\"[\");\n let end = key.indexOf(\"]\");\n if (start >= 0 && end > 0 && start < end) {\n return parseInt(key.substring(start + 1, end));\n } else {\n return -1;\n }\n}\n\nfunction isArrayPos(currKey: string, arrPos: number): boolean {\n return currKey === \"\" && arrPos >= 0;\n}\n\nfunction isNoArray(arrPos: number): boolean {\n return arrPos == -1;\n}\n\nfunction alloc(arr: Array<any>, length: number, defaultVal = {}) {\n let toAdd = [];\n toAdd.length = length;\n toAdd[length - 1] = defaultVal;\n pushChunked(arr, toAdd);\n}\n\n\nfunction flattenAccessPath(accessPath: string[]) {\n return new Es2019Array(...accessPath).flatMap((path: string) => path.split(\"[\"))\n .map((path: string) => path.indexOf(\"]\") != -1 ? \"[\" + path : path)\n .filter((path: string) => path != \"\");\n}\n\n/**\n * builds up a path, only done if no data is present!\n * @param target\n * @param accessPath\n * @returns the last assignable entry\n */\nexport function buildPath(target: {[key: string]: any}, ...accessPath: string[]): {target: any, key: string | number} {\n accessPath = flattenAccessPath(accessPath);\n //we now have a pattern of having the array accessors always in separate items\n let parentPtr: any = target;\n let parKeyArrPos: string | number | null = null;\n let currKey: string | null = null;\n let arrPos = -1;\n\n for (let cnt = 0; cnt < accessPath.length; cnt++) {\n currKey = keyVal(accessPath[cnt]);\n arrPos = arrayIndex(accessPath[cnt]);\n //it now is either key or arrPos\n if (arrPos != -1) {\n //case root(array)[5] -> root must be array and allocate 5 elements\n //case root.item[5] root.item must be array and of 5 elements\n if(!Array.isArray(parentPtr)) {\n throw Error(\"Associative array referenced as index array in path reference\");\n }\n\n //we need to look ahead for proper allocation\n //not end reached\n let nextArrPos = -1;\n if(cnt < accessPath.length - 1) {\n nextArrPos = arrayIndex(accessPath[cnt + 1])\n }\n let dataPresent = 'undefined' != typeof parentPtr?.[arrPos];\n //no data present check here is needed, because alloc only reserves if not present\n alloc(parentPtr, arrPos + 1, nextArrPos != -1 ?[]: {});\n parKeyArrPos = arrPos;\n //we now go to the reserved element\n if(cnt == accessPath.length - 1) {\n parentPtr[arrPos] = (dataPresent) ? parentPtr[arrPos] : null;\n } else {\n parentPtr = parentPtr[arrPos];\n }\n } else {\n if(Array.isArray(parentPtr)) {\n throw Error(\"Index array referenced as associative array in path reference\");\n }\n //again look ahead whether the next value is an array or assoc array\n let nextArrPos = -1;\n if(cnt < accessPath.length - 1) {\n nextArrPos = arrayIndex(accessPath[cnt + 1])\n }\n parKeyArrPos = currKey;\n let dataPresent = 'undefined' != typeof parentPtr?.[currKey];\n if(cnt == accessPath.length - 1) {\n if(!dataPresent) {\n parentPtr[currKey] = null;\n }\n } else {\n if(!dataPresent) {\n parentPtr[currKey] = nextArrPos == -1 ? {} : [];\n }\n parentPtr = parentPtr[currKey];\n }\n }\n }\n\n return {target: parentPtr, key: parKeyArrPos as string | number};\n\n}\n\nexport function deepCopy(fromAssoc: {[key: string]: any}): {[key: string]: any} {\n return JSON.parse(JSON.stringify(fromAssoc));\n}\n\n/**\n * simple left to right merge\n *\n * @param assocArrays\n */\nexport function simpleShallowMerge(...assocArrays: {[key: string]: any}[]) {\n return shallowMerge(true, false, ...assocArrays);\n}\n\nfunction _appendWithOverwrite(withAppend: boolean, target: { [p: string]: any }, key: string, arr: {[key: string]: any}, toAssign: any) {\n if (!withAppend) {\n target[key] = arr[key];\n } else {\n //overwrite means in this case, no double entries!\n //we do not a deep compare for now a single value compare suffices\n if ('undefined' == typeof target?.[key]) {\n target[key] = toAssign\n } else if (!Array.isArray(target[key])) {\n\n let oldVal = target[key];\n let newVals: any[] = [];\n //TODO maybe deep deep compare here, but on the other hand it is\n //shallow\n toAssign.forEach((item: any) => {\n if (oldVal != item) {\n newVals.push(item);\n }\n });\n target[key] = new Es2019Array(...[]);\n target[key].push(oldVal);\n pushChunked(target[key], newVals);\n } else {\n let oldVal = target[key];\n let newVals: any[] = [];\n //TODO deep compare here\n toAssign.forEach((item: any) => {\n if (oldVal.indexOf(item) == -1) {\n newVals.push(item);\n }\n });\n\n pushChunked(target[key], newVals);\n }\n }\n}\n\nfunction _appendWithoutOverwrite(withAppend: boolean, target: { [p: string]: any }, key: string, arr: {[key: string]: any}, toAssign: any) {\n if (!withAppend) {\n return;\n } else {\n //overwrite means in this case, no double entries!\n //we do not a deep compare for now a single value compare suffices\n if ('undefined' == typeof target?.[key]) {\n target[key] = toAssign\n } else if (!Array.isArray(target[key])) {\n let oldVal = target[key];\n target[key] = new Es2019Array(...[]);\n target[key].push(oldVal);\n pushChunked(target[key], toAssign);\n } else {\n pushChunked(target[key], toAssign);\n }\n }\n}\n\n/**\n * Shallow merge as in config, but on raw associative arrays\n *\n * @param overwrite overwrite existing keys, if they exist with their subtrees\n * @param withAppend if a key exist append the values or drop them\n * Combination overwrite withappend filters doubles out of merged arrays\n * @param assocArrays array of assoc arres reduced right to left\n */\nexport function shallowMerge(overwrite = true, withAppend = false, ...assocArrays: {[key: string]: any}[]) {\n let target: {[key: string]: any} = {};\n new Es2019Array(...assocArrays).map((arr: {[key: string]: any}) => {\n return {arr, keys: Object.keys(arr)};\n }).forEach(({arr, keys}: {arr: {[key: string]: any}, keys: string[]}) => {\n keys.forEach((key: string) => {\n let toAssign = arr[key];\n if(!Array.isArray(toAssign) && withAppend) {\n toAssign = new Es2019Array(...[toAssign]);\n }\n if(overwrite || !target?.[key]) {\n _appendWithOverwrite(withAppend, target, key, arr, toAssign);\n } else if(!overwrite && target?.[key]) {\n _appendWithoutOverwrite(withAppend, target, key, arr, toAssign);\n }\n\n\n\n })\n });\n return target;\n}\n\n//TODO test this, slightly altered from https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934\n//he overlooked some optimizations and a shortcut at typeof!\nexport function deepEqual(obj1: any, obj2: any): boolean | void {\n if(obj1 == obj2) {\n return false;\n }\n if(typeof obj1 != typeof obj2) {\n return false;\n }\n if(Array.isArray(obj1) && Array.isArray(obj2)) {\n if(obj1.length != obj2.length) {\n return;\n }\n //arrays must be equal, order as well, there is no way around it\n //this is the major limitation we have\n return obj1.every((item, cnt) => deepEqual(item, obj2[cnt]));\n }\n //string number and other primitives are filtered out here\n if(\"object\" == typeof obj1 && \"object\" == typeof obj2) {\n let keys1 = Object.keys(obj1);\n let keys2 = Object.keys(obj2);\n if(keys1.length != keys2.length) {\n return false;\n }\n return keys1.every(key => keys2.indexOf(key) != -1) &&\n keys1.every(key => deepEqual(obj1[key], obj2[key]));\n }\n return false;\n //done here no match found\n}\n\n","import {Es2019ArrayFrom, pushChunked} from \"./Es2019Array\";\nimport {IValueHolder, Optional, ValueEmbedder} from \"./Monad\";\nimport {Lang} from \"./Lang\";\nconst objAssign = Lang.objAssign;\nimport {append, appendIf, assign, assignIf, resolve, shallowMerge} from \"./AssocArray\";\n\n/**\n * specialized value embedder\n * for our Configuration\n */\nclass ConfigEntry<T> extends ValueEmbedder<T> {\n\n /*default value for absent*/\n static absent = ConfigEntry.fromNullable(null);\n\n /**\n * arrayed value positions\n */\n arrPos: number;\n\n constructor(rootElem: { [key: string]: any } | any[], key: any, arrPos?: number) {\n super(rootElem, key);\n\n this.arrPos = arrPos ?? -1;\n }\n\n get value() {\n if (this.key == \"\" && this.arrPos >= 0) {\n return (this._value as any)[this.arrPos];\n } else if (this.key && this.arrPos >= 0) {\n return (this._value as any)[this.key][this.arrPos];\n }\n return (this._value as any)[this.key];\n }\n\n set value(val: T) {\n if (this.key == \"\" && this.arrPos >= 0) {\n (this._value as any)[this.arrPos] = val;\n return;\n } else if (this.key && this.arrPos >= 0) {\n (this._value as any)[this.key][this.arrPos] = val;\n return;\n }\n (this._value as any)[this.key] = val;\n }\n}\n\nexport const CONFIG_VALUE = \"__END_POINT__\";\nexport const CONFIG_ANY = \"__ANY_POINT__\";\nexport type ConfigDef = { [key: string]: any };\n\n/**\n * Config, basically an optional wrapper for a json structure\n * (not Side - effect free, since we can alter the internal config state\n * without generating a new config), not sure if we should make it side - effect free\n * since this would swallow a lot of performance and ram\n */\nexport class Config extends Optional<any> {\n constructor(root: any, private configDef ?: ConfigDef) {\n super(root);\n }\n\n /**\n * shallow copy getter, copies only the first level, references the deeper nodes\n * in a shared manner\n */\n get shallowCopy(): Config {\n return this.shallowCopy$();\n }\n\n protected shallowCopy$(): Config {\n let ret = new Config({});\n ret.shallowMerge(this.value);\n return ret;\n }\n\n /**\n * deep copy, copies all config nodes\n */\n get deepCopy(): Config {\n return this.deepCopy$();\n }\n\n protected deepCopy$(): Config {\n return new Config(objAssign({}, this.value));\n }\n\n /**\n * creates a config from an initial value or null\n * @param value\n */\n static fromNullable<T>(value?: T | null): Config {\n return new Config(value);\n }\n\n /**\n * simple merge for the root configs\n */\n shallowMerge(other: Config, overwrite = true, withAppend = false) {\n //shallow merge must be mutable so we have to remap\n let newThis = shallowMerge(overwrite, withAppend, this.value, other.value);\n if (Array.isArray(this._value)) {\n this._value.length = 0;\n pushChunked(this._value as any, newThis as any);\n } else {\n Object.getOwnPropertyNames(this._value).forEach(key => delete this._value[key]);\n Object.getOwnPropertyNames(newThis).forEach(key => this._value[key] = newThis[key]);\n }\n }\n\n /**\n * assigns a single value as array, or appends it\n * to an existing value mapping a single value to array\n *\n *\n * usage myConfig.append(\"foobaz\").value = \"newValue\"\n * myConfig.append(\"foobaz\").value = \"newValue2\"\n *\n * resulting in myConfig.foobaz == [\"newValue, newValue2\"]\n *\n * @param {string[]} accessPath\n */\n append(...accessPath: string[]): IValueHolder<any> {\n return append(this._value, ...accessPath);\n }\n\n /**\n * appends to an existing entry (or extends into an array and appends)\n * if the condition is met\n * @param {boolean} condition\n * @param {string[]} accessPath\n */\n appendIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {\n return appendIf(condition, this._value, ...accessPath);\n }\n\n /**\n * assigns a new value on the given access path\n * @param accessPath\n */\n assign(...accessPath: Array<any>): IValueHolder<any> {\n return assign(this.value, ...accessPath);\n }\n\n\n /**\n * assign a value if the condition is set to true, otherwise skip it\n *\n * @param condition the condition, the access accessPath into the config\n * @param accessPath\n */\n assignIf(condition: boolean, ...accessPath: Array<any>): IValueHolder<any> {\n return assignIf(condition, this._value, ...accessPath);\n }\n\n /**\n * get if the access path is present (get is reserved as getter with a default, on the current path)\n * TODO will be renamed to something more meaningful and deprecated, the name is ambiguous\n * @param accessPath the access path\n */\n getIf(...accessPath: Array<string>): Config {\n this.assertAccessPath(...accessPath);\n return this.getClass().fromNullable(resolve(this.value, ...accessPath));\n }\n\n\n /**\n * gets the current node and if none is present returns a config with a default value\n * @param defaultVal\n */\n get(defaultVal: any): Config {\n return this.getClass().fromNullable(super.get(defaultVal).value);\n }\n\n //empties the current config entry\n delete(key: string): Config {\n if (key in this.value) {\n delete this.value[key];\n }\n return this;\n }\n\n /**\n * converts the entire config into a json object\n */\n toJson(): any {\n return JSON.stringify(this.value);\n }\n\n\n protected getClass(): any {\n return Config;\n }\n\n private setVal(val: any) {\n this._value = val;\n }\n\n\n /**\n * asserts the access path for a semi typed access\n * @param accessPath\n * @private\n */\n private assertAccessPath(...accessPath: Array<string>) {\n accessPath = this.preprocessKeys(...accessPath);\n if (!this.configDef) {\n //untyped\n return;\n }\n\n const ERR_ACCESS_PATH = \"Access Path to config invalid\";\n let currAccessPos: any = Optional.fromNullable(Object.keys(this.configDef).map(key => {\n let ret: { [key: string]: any } = {};\n ret[key] = this.configDef![key];\n return ret;\n }));\n\n for (let cnt = 0; cnt < accessPath.length; cnt++) {\n let currKey = this.keyVal(accessPath[cnt]);\n let arrPos: any = this.arrayIndex(accessPath[cnt]);\n\n //key index\n if (this.isArray(arrPos)) {\n if (currKey != \"\") {\n currAccessPos = Array.isArray(currAccessPos.value) ?\n Optional.fromNullable(Es2019ArrayFrom<any>(currAccessPos.value)\n .find(item => {\n return !!(item?.[currKey] ?? false)\n })?.[currKey]?.[arrPos]) :\n Optional.fromNullable(currAccessPos.value?.[currKey]?.[arrPos] ?? null);\n\n } else {\n currAccessPos = (Array.isArray(currAccessPos.value)) ?\n Optional.fromNullable(currAccessPos.value?.[arrPos]) : Optional.absent;\n }\n //we noe store either the current array or the filtered look ahead to go further\n } else {\n //we now have an array and go further with a singular key\n currAccessPos = (Array.isArray(currAccessPos.value)) ? Optional.fromNullable(Es2019ArrayFrom<any>(currAccessPos.value)\n .find(item => {\n return !!(item?.[currKey] ?? false);\n })?.[currKey]) :\n Optional.fromNullable(currAccessPos.value?.[currKey] ?? null);\n }\n if (!currAccessPos.isPresent()) {\n throw Error(ERR_ACCESS_PATH)\n }\n if (currAccessPos.value == CONFIG_ANY) {\n return;\n }\n }\n }\n\n private isNoArray(arrPos: number) {\n return arrPos == -1;\n }\n\n private isArray(arrPos: number) {\n return !this.isNoArray(arrPos);\n }\n\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DomQuery} from \"./DomQuery\";\nimport {Es2019Array, Es2019ArrayFrom, pushChunked} from \"./Es2019Array\";\nimport {Config} from \"./Config\";\n\n/**\n * special status of the datasource location pointer\n * if an access, outside - of the possible data boundaries is happening\n * (example for instance current without a first next call, or next\n * which goes over the last possible dataset), an iteration status return\n * value is returned marking this boundary instead of a classical element\n *\n * Note this is only internally used but must be implemented to fulfill\n * internal contracts, the end user will never see those values if he uses\n * streams!\n */\nexport enum ITERATION_STATUS {\n EO_STRM = '__EO_STRM__',\n BEF_STRM = '___BEF_STRM__',\n}\n\nexport function calculateSkips(next_strm: IStreamDataSource<any>) {\n let pos = 1;\n while (next_strm.lookAhead(pos) != ITERATION_STATUS.EO_STRM) {\n pos++;\n }\n return --pos;\n}\n\n/**\n * Every data source which feeds data into the lazy stream\n * or stream generally must implement this interface\n *\n * It is basically an iteratable to the core\n */\nexport interface IStreamDataSource<T> {\n\n /**\n * @returns true if additional data is present false if not\n */\n hasNext(): boolean;\n\n /**\n * returns the next element in the stream\n */\n next(): T | ITERATION_STATUS;\n\n /**\n * looks ahead cnt without changing the internal data \"pointers\" of the data source\n * (this is mostly needed by possibly infinite constructs like lazy streams,\n * because they do not know by definition their\n * boundaries)\n *\n * @param cnt the elements to look ahead\n * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before\n * finding the \"cnt\" element\n */\n lookAhead(cnt ?: number): T | ITERATION_STATUS;\n\n /**\n * returns the current element, returns the same element as the previous next call\n * if there is no next before current called then we will call next as initial element\n */\n current(): T | ITERATION_STATUS;\n\n /**\n * resets the position to the beginning\n */\n reset(): void;\n}\n\n/**\n * A collector, needs to be implemented\n */\nexport interface ICollector<T, S> {\n /**\n * this method basically takes a single stream element\n * and does something with it (collecting it one way or the other\n * in most cases)\n *\n * @param element\n */\n collect(element: T): void;\n\n /**\n * the final result after all the collecting is done\n */\n finalValue: S;\n}\n\n\n/**\n * A data source which combines multiple streams sequentially into one\n * (this is used internally by flatmap, but also can be used externally)\n */\nexport class MultiStreamDatasource<T> implements IStreamDataSource<T> {\n\n private activeStrm: IStreamDataSource<T>;\n private selectedPos = 0;\n private strms: Array<IStreamDataSource<T>>;\n\n constructor(private first: IStreamDataSource<T>, ...strms: Array<IStreamDataSource<T>>) {\n // callers may pass single data sources or entire arrays of them,\n // we flatten one level here (chunk-safe, no spread into a call)\n this.strms = [first];\n strms.forEach(strm => {\n if (Array.isArray(strm)) {\n pushChunked(this.strms, strm);\n } else {\n this.strms.push(strm);\n }\n });\n this.activeStrm = this.strms[this.selectedPos];\n }\n\n current(): any {\n return this.activeStrm.current();\n }\n\n hasNext(): boolean {\n if(this.activeStrm.hasNext()) {\n return true;\n }\n if(this.selectedPos >= this.strms.length) {\n return false;\n }\n return this.findNextStrm() != -1;\n }\n\n private findNextStrm(): number {\n let hasNext = false;\n let cnt = this.selectedPos;\n while(!hasNext && cnt < this.strms.length) {\n hasNext = this.strms[cnt].hasNext();\n if(!hasNext) {\n cnt++;\n }\n }\n return hasNext ? cnt : -1;\n }\n\n lookAhead(cnt: number = 1): T | ITERATION_STATUS {\n //lets clone\n const strms = this.strms.slice(this.selectedPos);\n\n if(!strms.length) {\n return ITERATION_STATUS.EO_STRM;\n }\n\n const all_strms = [...strms];\n while(all_strms.length) {\n let next_strm = all_strms.shift();\n let lookAhead = next_strm!.lookAhead(cnt);\n\n if (lookAhead != ITERATION_STATUS.EO_STRM) {\n return lookAhead;\n }\n cnt = cnt - calculateSkips(next_strm!);\n }\n return ITERATION_STATUS.EO_STRM;\n }\n\n\n next(): any {\n if(this.activeStrm.hasNext()) {\n return this.activeStrm.next();\n }\n this.selectedPos = this.findNextStrm();\n if(this.selectedPos == -1) {\n return ITERATION_STATUS.EO_STRM;\n }\n this.activeStrm = this.strms[this.selectedPos];\n return this.activeStrm.next();\n }\n\n reset(): void {\n this.activeStrm = this.strms[0];\n this.selectedPos = 0;\n for(let cnt = 0; cnt < this.strms.length; cnt++) {\n this.strms[cnt].reset();\n }\n }\n\n}\n\n/**\n * defines a sequence of numbers for our stream input\n */\nexport class SequenceDataSource implements IStreamDataSource<number> {\n\n start: number;\n total: number;\n value: number;\n\n constructor(start: number, total: number) {\n this.total = total;\n this.start = start;\n this.value = start - 1;\n }\n\n\n hasNext(): boolean {\n return this.value < (this.total - 1);\n }\n\n next(): number | ITERATION_STATUS {\n this.value++;\n return this.value <= (this.total - 1) ? this.value : ITERATION_STATUS.EO_STRM;\n }\n\n lookAhead(cnt = 1): number | ITERATION_STATUS {\n if ((this.value + cnt) > this.total - 1) {\n return ITERATION_STATUS.EO_STRM;\n } else {\n return this.value + cnt;\n }\n }\n\n reset(): void {\n this.value = this.start - 1;\n }\n\n current(): number | ITERATION_STATUS {\n //first condition current without initial call for next\n return (this.start - 1) ? ITERATION_STATUS.BEF_STRM : this.value;\n }\n}\n\n\n/**\n * implementation of a datasource on top of a standard array\n */\nexport class ArrayStreamDataSource<T> implements IStreamDataSource<T> {\n value: Array<T>;\n dataPos = -1;\n\n constructor(...value: Array<T>) {\n this.value = value;\n }\n\n /**\n * chunk-safe factory, takes the backing array directly instead\n * of spreading it into the constructor call (spreading large arrays\n * overflows the argument stack)\n *\n * @param data the array to stream over\n */\n static ofArray<T>(data: Array<T>): ArrayStreamDataSource<T> {\n const ret = new ArrayStreamDataSource<T>();\n ret.value = data ?? [];\n return ret;\n }\n\n lookAhead(cnt = 1): T | ITERATION_STATUS {\n if ((this.dataPos + cnt) > this.value.length - 1) {\n return ITERATION_STATUS.EO_STRM;\n }\n return this.value[this.dataPos + cnt];\n }\n\n hasNext(): boolean {\n return this.value.length - 1 > this.dataPos;\n }\n\n next(): T | ITERATION_STATUS {\n this.dataPos++;\n return this?.value[this.dataPos] ?? ITERATION_STATUS.EO_STRM;\n }\n\n reset() {\n this.dataPos = -1;\n }\n\n current(): T {\n return this.value[Math.max(0, this.dataPos)];\n }\n}\n\n/**\n * an intermediate data source which prefilters\n * incoming stream data\n * and lets only the data out which\n * passes the filter function check\n */\nexport class FilteredStreamDatasource<T> implements IStreamDataSource<T> {\n\n filterFunc: (data: T) => boolean;\n inputDataSource: IStreamDataSource<T>;\n\n _current: T | ITERATION_STATUS = ITERATION_STATUS.BEF_STRM;\n // we have to add a filter idx because the external filter values might change over time, so\n // we cannot reset the state properly unless we do it from a snapshot\n _filterIdx: { [key: number]: boolean } = {};\n _unfilteredPos = 0;\n\n constructor(filterFunc: (data: T) => boolean, parent: IStreamDataSource<T>) {\n this.filterFunc = filterFunc;\n this.inputDataSource = parent;\n }\n\n /**\n * in order to filter we have to make a look ahead until the\n * first next allowed element\n * hence we prefetch the element and then\n * serve it via next\n */\n hasNext(): boolean {\n let steps = 1;\n let found = false;\n let next;\n\n while (!found && (next = this.inputDataSource.lookAhead(steps)) != ITERATION_STATUS.EO_STRM) {\n if (this.filterFunc(next as T)) {\n this._filterIdx[this._unfilteredPos + steps] = true;\n found = true;\n } else {\n steps++;\n }\n }\n return found;\n }\n\n /**\n * serve the next element\n */\n next(): T | ITERATION_STATUS {\n let found: T | ITERATION_STATUS = ITERATION_STATUS.EO_STRM;\n while (this.inputDataSource.hasNext()) {\n this._unfilteredPos++;\n let next: T = <T>this.inputDataSource.next();\n //again here we cannot call the filter function twice, because its state might change, so if indexed, we have a decent snapshot, either has next or next can trigger\n //the snapshot\n if (next != ITERATION_STATUS.EO_STRM &&\n ((this._filterIdx?.[this._unfilteredPos] ?? false) || this.filterFunc(next))) {\n this._filterIdx[this._unfilteredPos] = true;\n found = next;\n break;\n }\n }\n this._current = found as T;\n return found;\n }\n\n /**\n * looks ahead cnt without changing the internal data \"pointers\" of the data source\n * (this is mostly needed by LazyStreams, because they do not know by definition their\n * boundaries)\n *\n * @param cnt the elements to look ahead\n * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before\n * finding the \"cnt\" element\n */\n lookAhead(cnt = 1): ITERATION_STATUS | T {\n let lookupVal: T | ITERATION_STATUS = ITERATION_STATUS.EO_STRM;\n\n for (let loop = 1; cnt > 0 && (lookupVal = this.inputDataSource.lookAhead(loop)) != ITERATION_STATUS.EO_STRM; loop++) {\n let inCache = this._filterIdx?.[this._unfilteredPos + loop];\n if (inCache || this.filterFunc(lookupVal as T)) {\n cnt--;\n this._filterIdx[this._unfilteredPos + loop] = true;\n }\n }\n return lookupVal;\n }\n\n current(): T | ITERATION_STATUS {\n return this._current;\n }\n\n reset(): void {\n this._current = ITERATION_STATUS.BEF_STRM;\n this._filterIdx = {};\n this._unfilteredPos = 0;\n this.inputDataSource.reset();\n }\n}\n\n/**\n * an intermediate datasource which maps the items from\n * one into another\n */\nexport class MappedStreamDataSource<T, S> implements IStreamDataSource<S> {\n\n mapFunc: (data: T | ITERATION_STATUS) => S;\n inputDataSource: IStreamDataSource<T>;\n\n constructor(mapFunc: (data: T | ITERATION_STATUS) => S, parent: IStreamDataSource<T>) {\n this.mapFunc = mapFunc;\n this.inputDataSource = parent;\n }\n\n hasNext(): boolean {\n return this.inputDataSource.hasNext();\n }\n\n next(): S {\n return this.mapFunc(this.inputDataSource.next());\n }\n\n reset(): void {\n this.inputDataSource.reset();\n }\n\n current(): S {\n return this.mapFunc(this.inputDataSource.current());\n }\n\n lookAhead(cnt = 1): ITERATION_STATUS | S {\n const lookAheadVal = this.inputDataSource.lookAhead(cnt);\n return (lookAheadVal == ITERATION_STATUS.EO_STRM) ? lookAheadVal as ITERATION_STATUS : this.mapFunc(lookAheadVal) as S;\n }\n}\n\n\n/**\n * For the time being we only need one collector\n * a collector which collects a stream back into arrays\n */\nexport class ShimArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = new Es2019Array(...[]);\n\n collect(element: S) {\n this.data.push(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n\n/**\n * collects the values as inverse array\n */\nexport class InverseArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = [];\n\n collect(element: S) {\n this.data.unshift(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n\n\n/**\n * collects an tuple array stream into an assoc array with elements being collected into arrays\n *\n */\nexport class ArrayAssocArrayCollector<S> implements ICollector<[string, S] | string, { [key: string]: S }> {\n finalValue: { [key: string]: any } = {};\n\n collect(element: [string, S] | string) {\n let key = element?.[0] ?? <string>element;\n this.finalValue[key] = this.finalValue?.[key] ?? [];\n this.finalValue[key].push(element?.[1] ?? true);\n }\n}\n\n/**\n * dummy collector which just triggers a run\n * on lazy streams without collecting anything\n */\nexport class Run<S> implements ICollector<S, any> {\n collect(element: S) {\n\n }\n\n get finalValue(): any {\n return null;\n }\n}\n\n/**\n * collects an assoc stream back to an assoc array\n */\nexport class AssocArrayCollector<S> implements ICollector<[string, S] | string, { [key: string]: S }> {\n\n finalValue: { [key: string]: any } = {};\n\n collect(element: [string, S] | string) {\n this.finalValue[element[0] ?? <string>element] = element[1] ?? true;\n }\n}\n\n\n/**\n * A Config collector similar to the FormDFata Collector\n */\nexport class ConfigCollector implements ICollector<{ key: string, value: any }, Config> {\n finalValue: Config = new Config({});\n\n collect(element: { key: string; value: any }) {\n this.finalValue.append(element.key).value = element.value;\n }\n}\n\n\n/**\n * Form data collector for key value pair streams\n */\nexport class FormDataCollector implements ICollector<{ key: string, value: any }, FormData> {\n finalValue: FormData = new FormData();\n\n collect(element: { key: string; value: any }) {\n this.finalValue.append(element.key, element.value);\n }\n}\n\n/**\n * Form data collector for DomQuery streams\n */\nexport class QueryFormDataCollector implements ICollector<DomQuery, FormData> {\n finalValue: FormData = new FormData();\n\n collect(element: DomQuery) {\n let toMerge = element.encodeFormElement();\n if (toMerge.isPresent()) {\n this.finalValue.append(element.name.value, toMerge.get(element.name).value);\n }\n }\n}\n\n/**\n * Encoded String collector from dom query streams\n */\nexport class QueryFormStringCollector implements ICollector<DomQuery, string> {\n\n formData: [[string, string]] = <any>[];\n\n collect(element: DomQuery) {\n let toMerge = element.encodeFormElement();\n if (toMerge.isPresent()) {\n this.formData.push([element.name.value, toMerge.get(element.name).value]);\n }\n }\n\n get finalValue(): string {\n return Es2019ArrayFrom(this.formData)\n .map((keyVal: [string, string]) => keyVal.join(\"=\"))\n .reduce((item1: string, item2: string) => [item1, item2].join(\"&\"));\n }\n}\n\n/**\n * For the time being we only need one collector\n * a collector which collects a stream back into arrays\n */\nexport class ArrayCollector<S> implements ICollector<S, Array<S>> {\n private data: Array<S> = [];\n\n collect(element: S) {\n this.data.push(element);\n }\n\n get finalValue(): Array<S> {\n return this.data;\n }\n}\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n/**\n * various environments handle the global variable different\n * we have to deal with this.\n */\nexport function _global$(): any | null {\n let _global$: any = ('undefined' != typeof globalThis && globalThis.window) ? globalThis.window:\n ('undefined' != typeof window) ? window :\n ('undefined' != typeof globalThis) ? globalThis :\n ('undefined' != typeof global && global?.window) ? global.window :\n ('undefined' != typeof global) ? global : null;\n //under test systems we often have a lazy init of the window object under global.window, but we\n //want the window object\n return _global$?.window ?? _global$;\n}\n\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http:// www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {IValueHolder, Optional, ValueEmbedder} from \"./Monad\";\nimport {XMLQuery} from \"./XmlQuery\";\n\nimport {ICollector, IStreamDataSource, ITERATION_STATUS} from \"./SourcesCollectors\";\nimport {Lang} from \"./Lang\";\nimport {_global$} from \"./Global\";\nimport {Es2019Array, Es2019ArrayFrom, MAX_ARG_LENGTH, pushChunked} from \"./Es2019Array\";\nconst trim = Lang.trim;\n\nconst isString = Lang.isString;\nconst eqi = Lang.equalsIgnoreCase;\nconst objToArray = Lang.objToArray;\nimport {append, assign, simpleShallowMerge} from \"./AssocArray\";\nimport {IDomQuery} from \"./IDomQuery\";\n\ndeclare var ownerDocument: any;\n\n/**\n * chunk-safe version of target.prepend(...elements)\n * (spreading a large element list overflows the argument stack)\n *\n * the chunks are prepended in reverse order, so the resulting\n * element order is the same as a single prepend call would produce,\n * for less than MAX_ARG_LENGTH elements this boils down to exactly\n * one native prepend call\n */\nfunction prependChunked(target: Element, elements: Element[]) {\n for (let end = elements.length; end > 0; end -= MAX_ARG_LENGTH) {\n const start = Math.max(0, end - MAX_ARG_LENGTH);\n target.prepend(...elements.slice(start, end));\n }\n}\n\n/**\n * in order to poss custom parameters we need to extend the mutation observer init\n */\nexport interface WAIT_OPTS extends MutationObserverInit {\n timeout?: number;\n /**\n * interval on non legacy browsers\n */\n interval?: number;\n}\n\n\nclass NonceValueEmbedder extends ValueEmbedder<string> {\n\n constructor(private rootElems: HTMLElement[]) {\n super(rootElems?.[0], \"nonce\");\n }\n\n isAbsent(): boolean {\n const value = this.value;\n return 'undefined' == typeof value || '' == value;\n }\n\n get value(): string {\n return (this?.rootElems?.[0] as HTMLElement)?.nonce ?? (this?.rootElems?.[0] as HTMLElement)?.getAttribute(\"nonce\")\n }\n\n\n set value(newVal: string) {\n if (!this?.rootElems?.length) {\n return;\n }\n\n this.rootElems.forEach((rootElem: HTMLElement) => {\n if(\"undefined\" != typeof rootElem?.nonce) {\n rootElem.nonce = newVal\n } else {\n rootElem.setAttribute(\"nonce\", newVal);\n }\n });\n\n }\n}\n\n/**\n *\n * // - submit checkboxes and radio inputs only if checked\n if ((tagName != \"select\" && elemType != \"button\"\n && elemType != \"reset\" && elemType != \"submit\" && elemType != \"image\")\n && ((elemType != \"checkbox\" && elemType != \"radio\"\n */\n\nenum ALLOWED_SUBMITTABLE_ELEMENTS {\n SELECT = \"select\",\n BUTTON = \"button\",\n SUBMIT = \"submit\",\n RESET = \"reset\",\n IMAGE = \"image\",\n RADIO = \"radio\",\n CHECKBOX = \"checkbox\"\n\n}\n\n/**\n * helper to fix a common problem that a system has to wait, until a certain condition is reached.\n * Depending on the browser this uses either the Mutation Observer or a semi compatible interval as fallback.\n * @param root the root DomQuery element to start from\n * @param condition the condition lambda to be fulfilled\n * @param options options for the search\n */\nfunction waitUntilDom(root: DomQuery, condition: (element: DomQuery) => boolean, options: WAIT_OPTS = {\n attributes: true,\n childList: true,\n subtree: true,\n timeout: 500,\n interval: 100\n}): Promise<DomQuery> {\n return new Promise<DomQuery>((success, error) => {\n let observer: MutationObserver | null = null;\n const MUT_ERROR = new Error(\"Mutation observer timeout\");\n\n // we do the same but for now ignore the options on the dom query\n // we cannot use absent here, because the condition might search for an absent element\n function findElement(root: DomQuery, condition: (element: DomQuery) => boolean): DomQuery | null {\n let found: any = null;\n if (!!condition(root)) {\n return root;\n }\n if (options.childList) {\n found = (condition(root)) ? root : root.childNodes.filter(item => condition(item)).first().value.value;\n } else if (options.subtree) {\n found = (condition(root)) ? root : root.querySelectorAll(\" * \").filter(item => condition(item)).first().value.value;\n } else {\n found = (condition(root)) ? root : null;\n }\n return found;\n }\n\n let foundElement: DomQuery | null = root;\n if (!!(foundElement = findElement(foundElement, condition))) {\n success(new DomQuery(foundElement));\n return;\n }\n\n if ('undefined' != typeof MutationObserver) {\n const mutTimeout = setTimeout(() => {\n observer!.disconnect();\n return error(MUT_ERROR);\n }, options.timeout);\n\n const callback: MutationCallback = (mutationList: MutationRecord[]) => {\n const found = new DomQuery(mutationList.map((mut) => mut.target)).filter(item => condition(item)).first();\n if (found.isPresent()) {\n clearTimeout(mutTimeout);\n observer!.disconnect();\n success(new DomQuery(found || root));\n }\n }\n observer = new MutationObserver(callback);\n\n // browsers might ignore it, but we cannot break the api in the case\n // hence no timeout is passed\n let observableOpts = {...options};\n delete observableOpts.timeout;\n root.eachElem(item => {\n observer!.observe(item, observableOpts)\n })\n } else { // fallback for legacy browsers without mutation observer\n let interval: any;\n let timeout: any;\n interval = setInterval(() => {\n let found = findElement(root, condition);\n if (!!found) {\n if (timeout) {\n clearTimeout(timeout);\n clearInterval(interval);\n interval = null;\n }\n success(new DomQuery(found || root));\n }\n }, options.interval);\n timeout = setTimeout(() => {\n if (interval) {\n clearInterval(interval);\n error(MUT_ERROR);\n }\n }, options.timeout);\n }\n });\n}\n\nexport class ElementAttribute extends ValueEmbedder<string | null> {\n\n constructor(private element: DomQuery, private name: string, private defaultVal: string | null = null) {\n super(element, name);\n }\n\n get value(): string | null {\n let val: Element[] = this.element.get(0).orElse(...[]).values;\n if (!val.length) {\n return this.defaultVal;\n }\n return val[0].getAttribute(this.name);\n }\n\n set value(value: string) {\n let val: Element[] = this.element.get(0).orElse(...[]).values;\n for (let cnt = 0; cnt < val.length; cnt++) {\n val[cnt].setAttribute(this.name, value);\n }\n }\n\n protected getClass(): any {\n return ElementAttribute;\n }\n\n static fromNullable<ElementAttribute, T>(value?: any, valueKey: string = \"value\"): ElementAttribute {\n return <any>new ElementAttribute(value, valueKey);\n }\n\n}\n\nexport class Style extends ValueEmbedder<string | null> {\n\n constructor(private element: DomQuery, private name: string, private defaultVal: string | null = null) {\n super(element, name);\n }\n\n get value(): string | null {\n let val: Element[] = this.element.values;\n if (!val.length) {\n return this.defaultVal;\n }\n return (val[0] as HTMLElement).style[this.name as any];\n }\n\n set value(value: string) {\n let val: HTMLElement[] = this.element.values as HTMLElement[];\n for (let cnt = 0; cnt < val.length; cnt++) {\n val[cnt].style[this.name as any] = value;\n }\n }\n\n protected getClass(): any {\n return Style;\n }\n\n static fromNullable<ElementAttribute, T>(value?: any, valueKey: string = \"value\"): ElementAttribute {\n return <any>new Style(value, valueKey);\n }\n\n}\n\n/**\n * small helper for the specialized jsf case\n * @constructor\n */\nconst DEFAULT_WHITELIST = () => {\n return true;\n};\n\n\n\n/**\n * Monadic DomNode representation, ala jquery\n * This is a thin wrapper over querySelectorAll\n * to get slim monadic support\n * to reduce implementation code on the users side.\n * This is vital for frameworks which want to rely on\n * plain dom but still do not want to lose\n * the reduced code footprint of querying dom trees and traversing\n * by using functional patterns.\n *\n * Also, a few convenience methods are added to reduce\n * the code footprint of standard dom processing\n * operations like eval\n *\n * in most older systems\n * Note parts of this code still stem from the Dom.js I have written 10 years\n * ago, those parts look a bit ancient and will be replaced over time.\n *\n */\nexport class DomQuery implements IDomQuery, IStreamDataSource<DomQuery>, Iterable<DomQuery> {\n\n static absent = new DomQuery();\n\n /**\n * reference to the environmental global object\n */\n static global = _global$;\n\n private rootNode: Array<Element> = [];\n\n pos = -1;\n\n constructor(...rootNode: Array<Element | ShadowRoot | DomQuery | Document | Array<any> | string | null | undefined>) {\n\n if (Optional.fromNullable(rootNode).isAbsent() || !rootNode.length) {\n return;\n } else {\n // we need to flatten out the arrays\n\n for (let cnt = 0; cnt < rootNode.length; cnt++) {\n if (!rootNode[cnt]) {\n // we skip possible null entries which can happen in\n // certain corner conditions due to the constructor re-wrapping single elements into arrays.\n } else if (isString(rootNode[cnt])) {\n let foundElement = DomQuery.querySelectorAll(<string>rootNode[cnt]);\n if (!foundElement.isAbsent()) {\n pushChunked(rootNode, foundElement.values)\n }\n } else if (rootNode[cnt] instanceof DomQuery) {\n pushChunked(this.rootNode, (rootNode[cnt] as any).values);\n } else if (Array.isArray(rootNode[cnt])) {\n // flatten array arguments into the work list, so large element\n // arrays can be passed without spreading them into the call\n pushChunked(rootNode, rootNode[cnt] as Array<any>);\n } else {\n this.rootNode.push(rootNode[cnt] as any);\n }\n }\n }\n }\n\n\n /**\n * returns the first element\n */\n get value(): Optional<Element> {\n return this.getAsElem(0);\n }\n\n get values(): Element[] {\n return this.allElems();\n }\n\n get global(): any {\n return _global$;\n }\n\n get stream(): any {\n throw Error(\"Not implemented, include Stream.ts for this to work\")\n }\n\n get lazyStream(): any {\n throw Error(\"Not implemented, include Stream.ts for this to work\")\n }\n\n /**\n * returns the id of the first element\n */\n get id(): ValueEmbedder<string> {\n return new ElementAttribute(this.get(0), \"id\") as ValueEmbedder<string>;\n }\n\n /**\n * length of the entire query set\n */\n get length(): number {\n return this.rootNode.length\n }\n\n /**\n * convenience method for tagName\n */\n get tagName(): Optional<string> {\n return <Optional<string>>this.getAsElem(0).getIf(\"tagName\");\n }\n\n /**\n * convenience method for nodeName\n */\n get nodeName(): Optional<string> {\n return <Optional<string>>this.getAsElem(0).getIf(\"nodeName\");\n }\n\n isTag(tagName: string): boolean {\n return !this.isAbsent()\n && (this.nodeName.orElse(\"__none___\")\n .value.toLowerCase() == tagName.toLowerCase()\n || this.tagName.orElse(\"__none___\")\n .value.toLowerCase() == tagName.toLowerCase()\n )\n }\n\n /**\n * convenience property for type\n *\n * returns null in case of no type existing otherwise\n * the type of the first element\n */\n get type(): Optional<string> {\n return this.getAsElem(0).getIf(\"type\");\n }\n\n /**\n * convenience property for name\n *\n * returns null in case of no type existing otherwise\n * the name of the first element\n */\n get name(): ValueEmbedder<string> {\n return new ValueEmbedder(this.getAsElem(0).value, \"name\");\n }\n\n /**\n * convenience property for value\n *\n * returns null in case of no type existing otherwise\n * the value of the first element\n */\n get inputValue(): ValueEmbedder<string | boolean> {\n if (this.getAsElem(0).getIf(\"value\").isPresent()) {\n return new ValueEmbedder<string>(this.getAsElem(0).value);\n } else {\n return <any>ValueEmbedder.absent;\n }\n }\n\n get val(): string | boolean {\n return this.inputValue.value;\n }\n\n set val(value: string | boolean) {\n this.inputValue.value = value;\n }\n\n get nodeId(): string {\n return this.id.value;\n }\n\n set nodeId(value: string) {\n this.id.value = value;\n }\n\n get checked(): boolean {\n return Es2019ArrayFrom(this.values).every(el => !!(el as any).checked);\n }\n\n set checked(newChecked: boolean) {\n this.eachElem(el => (el as any).checked = newChecked);\n }\n\n get elements(): DomQuery {\n // a simple querySelectorAll should suffice\n return this.querySelectorAll(\"input, select, textarea, fieldset\");\n }\n\n get deepElements(): DomQuery {\n let elemStr = \"input, select, textarea, fieldset\";\n return this.querySelectorAllDeep(elemStr);\n }\n\n /**\n * a deep search which treats the single isolated shadow dom areas\n * separately and runs the query on each shadow dom\n * @param queryStr\n */\n querySelectorAllDeep(queryStr: string): DomQuery {\n let found: Array<DomQuery> = [];\n let queryRes = this.querySelectorAll(queryStr);\n if (queryRes.length) {\n found.push(queryRes);\n }\n let shadowRoots = this._collectShadowRoots();\n if (shadowRoots.length) {\n let shadowRes = new DomQuery(shadowRoots).querySelectorAllDeep(queryStr);\n if (shadowRes.length) {\n found.push(shadowRes);\n }\n }\n return new DomQuery(found);\n }\n\n /**\n * Collects the shadow roots hosted by the light-DOM descendants of each root\n * node in a single pass.\n *\n * This replaces the prior `querySelectorAll(\"*\").shadowRoot`, which\n * materialized a DomQuery wrapping every element on the page and then walked\n * that throwaway collection a second time through the shadowRoot getter. We\n * still have to inspect every element - there is no CSS selector for \"has a\n * shadow root\", so the cost stays O(number of elements) - but we drop the\n * intermediate all-elements DomQuery and the redundant second traversal.\n *\n * @private\n */\n private _collectShadowRoots(): ShadowRoot[] {\n let shadowRoots: ShadowRoot[] = [];\n for (let cnt = 0; cnt < (this?.rootNode?.length ?? 0); cnt++) {\n let root: any = this.rootNode[cnt];\n if (!root?.querySelectorAll) {\n continue;\n }\n let all = root.querySelectorAll(\"*\");\n for (let i = 0, len = all.length; i < len; i++) {\n let shadowRoot = (all[i] as Element).shadowRoot;\n if (shadowRoot) {\n shadowRoots.push(shadowRoot);\n }\n }\n }\n return shadowRoots;\n }\n\n\n /**\n * disabled flag\n */\n get disabled(): boolean {\n return this.attr(\"disabled\").isPresent();\n }\n\n set disabled(disabled: boolean) {\n // this.attr(\"disabled\").value = disabled + \"\";\n if (!disabled) {\n this.removeAttribute(\"disabled\");\n } else {\n this.attr(\"disabled\").value = \"disabled\";\n }\n\n }\n\n removeAttribute(name: string) {\n this.eachElem(item => item.removeAttribute(name));\n }\n\n get childNodes(): DomQuery {\n let childNodeArr: Array<Element> = [];\n this.eachElem((item: Element) => {\n // push the live childNodes list straight into the single target in\n // chunks instead of concat(objToArray(...)) per root, which both\n // copied each child list and reallocated the growing accumulator\n // (O(roots * total children))\n pushChunked(childNodeArr, item.childNodes as ArrayLike<any>);\n });\n return new DomQuery(childNodeArr);\n }\n\n\n get asArray(): DomQuery[] {\n // filter not supported by IE11\n let items = Es2019ArrayFrom(this.rootNode).filter(item => {\n return item != null\n }).map(item => {\n return DomQuery.byId(item)\n });\n return items as DomQuery[];\n }\n\n get offsetWidth(): number {\n return Es2019ArrayFrom(this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetWidth)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetHeight(): number {\n return Es2019ArrayFrom(this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetHeight)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetLeft(): number {\n return Es2019ArrayFrom(this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as HTMLElement).offsetLeft)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get offsetTop(): number {\n return Es2019ArrayFrom(this.rootNode)\n .filter(item => item != null)\n .map(elem => (elem as any).offsetTop)\n .reduce((accumulate, incoming) => accumulate + incoming, 0);\n }\n\n get asNodeArray(): Array<Element> {\n return Es2019ArrayFrom(this.rootNode.filter(item => item != null));\n }\n\n get nonce(): ValueEmbedder<string> {\n return new NonceValueEmbedder(this.rootNode as HTMLElement[]);\n }\n\n static querySelectorAllDeep(selector: string) {\n return new DomQuery(document).querySelectorAllDeep(selector);\n }\n\n /**\n * easy query selector all producer\n *\n * @param selector the selector\n * @returns a results dom query object\n */\n static querySelectorAll(selector: string): DomQuery {\n if (selector.indexOf(\"/shadow/\") != -1) {\n return new DomQuery(document)._querySelectorAllDeep(selector);\n } else {\n return new DomQuery(document)._querySelectorAll(selector);\n }\n }\n\n /**\n * byId producer\n *\n * @param selector id\n * @param deep true if you want to go into shadow areas\n * @return a DomQuery containing the found elements\n */\n static byId(selector: string | DomQuery | Element, deep = false): DomQuery {\n if (isString(selector)) {\n return (!deep) ? new DomQuery(document).byId(<string>selector) : new DomQuery(document).byIdDeep(<string>selector);\n } else {\n return new DomQuery(selector as any);\n }\n }\n\n /**\n * byTagName producer\n *\n * @param selector name\n * @return a DomQuery containing the found elements\n */\n static byTagName(selector: string | DomQuery | Element): DomQuery {\n if (isString(selector)) {\n return new DomQuery(document).byTagName(<string>selector);\n } else {\n return new DomQuery(selector as any);\n }\n }\n\n static globalEval(code: string, nonce?: string): DomQuery {\n return new DomQuery(document).globalEval(code, nonce);\n }\n\n static globalEvalSticky(code: string, nonce?: string): DomQuery {\n return new DomQuery(document).globalEvalSticky(code, nonce);\n }\n\n /**\n * builds the ie nodes properly in a placeholder\n * and bypasses a non script insert bug that way\n * @param markup the markup code to be executed from\n */\n static fromMarkup(markup: string): DomQuery {\n\n const doc = document.implementation.createHTMLDocument(\"\");\n markup = trim(markup);\n let lowerMarkup = markup.toLowerCase();\n if (lowerMarkup.search(/<!doctype[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<html[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<head[^\\w\\-]+/gi) != -1 ||\n lowerMarkup.search(/<body[^\\w\\-]+/gi) != -1) {\n doc.documentElement.innerHTML = markup;\n return new DomQuery(doc.documentElement);\n } else {\n let startsWithTag = function (str: string, tagName: string) {\n let tag1 = [\"<\", tagName, \">\"].join(\"\");\n let tag2 = [\"<\", tagName, \" \"].join(\"\");\n return (str.indexOf(tag1) == 0) || (str.indexOf(tag2) == 0);\n };\n\n let dummyPlaceHolder = new DomQuery(document.createElement(\"div\"));\n\n // table needs special treatment due to the browsers auto creation\n if (startsWithTag(lowerMarkup, \"thead\")\n || startsWithTag(lowerMarkup, \"tbody\")\n || startsWithTag(lowerMarkup, \"tfoot\")) {\n dummyPlaceHolder.html(`<table>${markup}</table>`);\n return dummyPlaceHolder.querySelectorAll(\"table\").get(0).childNodes.detach();\n } else if (startsWithTag(lowerMarkup, \"tr\")) {\n dummyPlaceHolder.html(`<table><tbody>${markup}</tbody></table>`);\n return dummyPlaceHolder.querySelectorAll(\"tbody\").get(0).childNodes.detach();\n } else if (startsWithTag(lowerMarkup, \"td\") || startsWithTag(lowerMarkup, \"th\")) {\n dummyPlaceHolder.html(`<table><tbody><tr>${markup}</tr></tbody></table>`);\n return dummyPlaceHolder.querySelectorAll(\"tr\").get(0).childNodes.detach();\n }\n\n dummyPlaceHolder.html(markup);\n return dummyPlaceHolder.childNodes.detach();\n }\n\n }\n\n /**\n * returns the nth element as DomQuery\n * from the internal elements\n * note if you try to reach a non-existing element position\n * you will get back an absent entry\n *\n * @param index the nth index\n */\n get(index: number): DomQuery {\n return (index < this.rootNode.length) ? new DomQuery(this.rootNode[index]) : DomQuery.absent;\n }\n\n\n /**\n * returns the nth element as optional of an Element object\n * @param index the number from the index\n * @param defaults the default value if the index is overrun default Optional\\.absent\n */\n getAsElem(index: number, defaults: Optional<any> = Optional.absent): Optional<Element> {\n return (index < this.rootNode.length) ? Optional.fromNullable(this.rootNode[index]) : defaults;\n }\n\n /**\n * returns the files from a given element\n * @param index\n */\n filesFromElem(index: number): Array<any> {\n return (index < this.rootNode.length) ? (this.rootNode[index] as any)?.files ? (this.rootNode[index] as any).files : [] : [];\n }\n\n /**\n * returns the value array< of all elements\n */\n allElems(): Array<Element> {\n return this.rootNode;\n }\n\n /**\n * absent no values reached?\n */\n isAbsent(): boolean {\n return this.length == 0;\n }\n\n /**\n * should make the code clearer\n * note if you pass a function\n * this refers to the active DomQuery object\n */\n isPresent(presentRunnable ?: (elem ?: DomQuery) => void): boolean {\n let absent = this.isAbsent();\n if (!absent && presentRunnable) {\n presentRunnable.call(this, this)\n }\n return !absent;\n }\n\n /**\n * should make the code clearer\n * note if you pass a function\n * this refers to the active DomQuery object\n *\n *\n * @param presentRunnable\n */\n ifPresentLazy(presentRunnable: (elem ?: DomQuery) => void = function () {\n }): DomQuery {\n this.isPresent.call(this, presentRunnable);\n return this;\n }\n\n /**\n * remove all affected nodes from this query object from the dom tree\n */\n delete() {\n this.eachElem((node: Element) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }\n\n querySelectorAll(selector: string): DomQuery {\n // We could merge both methods, but for now this is more readable\n if (selector.indexOf(\"/shadow/\") != -1) {\n return this._querySelectorAllDeep(selector);\n } else {\n return this._querySelectorAll(selector);\n }\n }\n\n closest(selector: string): DomQuery {\n // We could merge both methods, but for now this is more readable\n if (selector.indexOf(\"/shadow/\") != -1) {\n return this._closestDeep(selector);\n } else {\n return this._closest(selector);\n }\n }\n\n\n /**\n * core byId method\n * @param id the id to search for\n * @param includeRoot also match the root element?\n */\n byId(id: string, includeRoot?: boolean): DomQuery {\n let res: Array<DomQuery> = [];\n if (includeRoot) {\n res = res.concat(\n Es2019ArrayFrom(this?.rootNode || [])\n .filter((item: Element) => id == item.id)\n .map(item => new DomQuery(item))\n );\n }\n\n // for some strange kind of reason the # selector fails\n // on hidden elements we use the attributes match selector\n // that works\n res = res.concat(this.querySelectorAll(`[id=\"${id}\"]`));\n return new DomQuery(res);\n }\n\n\n byIdDeep(id: string, includeRoot?: boolean): DomQuery {\n let res: Array<DomQuery> = [];\n if (includeRoot) {\n res = res.concat(\n Es2019ArrayFrom(this?.rootNode || [])\n .filter(item => id == item.id)\n .map(item => new DomQuery(item))\n );\n }\n\n // a \"deep\" id search must collect matches across every scope: ids are\n // unique only within a single node-tree, so the same id may legitimately\n // exist in the light DOM and inside one or more shadow roots at once.\n // We therefore cannot short-circuit on a light-DOM hit and must run the\n // full deep search.\n let subItems = this.querySelectorAllDeep(`[id=\"${id}\"]`);\n if (subItems.length) {\n res.push(subItems);\n }\n\n return new DomQuery(res);\n }\n\n /**\n * same as byId just for the tag name\n * @param tagName the tag-name to search for\n * @param includeRoot shall the root element be part of this search\n * @param deep do we also want to go into shadow dom areas\n */\n byTagName(tagName: string, includeRoot ?: boolean, deep ?: boolean): DomQuery {\n let res: Array<Element | DomQuery> = [];\n if (includeRoot) {\n // append the matching roots in a single pass; the prior\n // reduce(reduction.concat([item])) reallocated the accumulator on\n // every match (O(matches^2))\n let matchingRoots = Es2019ArrayFrom(this?.rootNode ?? [])\n .filter(element => element?.tagName == tagName);\n pushChunked(res, matchingRoots);\n }\n\n (deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));\n return new DomQuery(res);\n }\n\n /**\n * attr accessor, usage myQuery.attr(\"class\").value = \"bla\"\n * or let value myQuery.attr(\"class\").value\n * @param attr the attribute to set\n * @param defaultValue the default value in case nothing is presented (defaults to null)\n */\n attr(attr: string, defaultValue: string | null = null): ElementAttribute {\n return new ElementAttribute(this, attr, defaultValue);\n }\n\n style(cssProperty: string, defaultValue: string | null = null): Style {\n return new Style(this, cssProperty, defaultValue);\n }\n\n\n /**\n * Checks for an existing class in the class attributes\n *\n * @param clazz the class to search for\n */\n hasClass(clazz: string) {\n let hasIt = false;\n this.eachElem(node => {\n hasIt = node.classList.contains(clazz);\n if (hasIt) {\n return false;\n }\n });\n return hasIt;\n }\n\n /**\n * appends a class string if not already in the element(s)\n *\n * @param clazz the style class to append\n */\n addClass(clazz: string): DomQuery {\n this.eachElem(item => item.classList.add(clazz))\n return this;\n }\n\n /**\n * remove the style class if in the class definitions\n *\n * @param clazz\n */\n removeClass(clazz: string): DomQuery {\n this.eachElem(item => item.classList.remove(clazz));\n return this;\n }\n\n /**\n * checks whether we have a multipart element in our children\n * or are one\n */\n isMultipartCandidate(deep = false): boolean {\n const FILE_INPUT = \"input[type='file']\";\n return this.matchesSelector(FILE_INPUT) ||\n ((!deep) ? this.querySelectorAll(FILE_INPUT) :\n this.querySelectorAllDeep(FILE_INPUT)).first().isPresent();\n }\n\n /**\n * innerHtml\n * equivalent to jQueries html\n * as setter the html is set and the\n * DomQuery is given back\n * as getter the html string is returned\n *\n * @param newInnerHTML the inner html to be inserted\n */\n html(newInnerHTML?: string): DomQuery | Optional<string> {\n if (Optional.fromNullable(newInnerHTML).isAbsent()) {\n return this.isPresent() ? Optional.fromNullable(this.innerHTML) : Optional.absent;\n }\n this.innerHTML = newInnerHTML!;\n\n return this;\n }\n\n /**\n * Standard dispatch event method, delegated from node\n */\n dispatchEvent(evt: Event): DomQuery {\n this.eachElem(elem => elem.dispatchEvent(evt));\n return this;\n }\n\n /**\n * abbreviation property to use innerHTML directly like on the dom tree\n * @param newInnerHTML the new inner html which should be attached to \"this\" domQuery\n */\n set innerHTML(newInnerHTML: string) {\n this.eachElem(elem => elem.innerHTML = newInnerHTML);\n }\n\n /**\n * getter abbreviation to use innerHTML directly\n */\n get innerHTML(): string {\n let retArr: string[] = [];\n this.eachElem(elem => retArr.push(elem.innerHTML));\n return retArr.join(\"\");\n }\n\n /**\n * since the dom allows both innerHTML and innerHtml we also have to implement both\n * @param newInnerHtml see above\n */\n set innerHtml(newInnerHtml: string) {\n this.innerHTML = newInnerHtml;\n }\n\n /**\n * same here, getter for allowing innerHtml directly\n */\n get innerHtml(): string {\n return this.innerHTML;\n }\n\n /**\n * filters the current dom query elements\n * upon a given selector\n *\n * @param selector\n */\n filterSelector(selector: string): DomQuery {\n let matched: Element[] = [];\n\n this.eachElem(item => {\n if (this._matchesSelector(item, selector)) {\n matched.push(item)\n }\n });\n return new DomQuery(matched);\n }\n\n /**\n * checks whether any item in this domQuery level matches the selector\n * if there is one element only attached, as root the match is only\n * performed on this element.\n * @param selector\n */\n matchesSelector(selector: string): boolean {\n return this.asArray\n .some(item => this._matchesSelector(item.getAsElem(0).value, selector));\n }\n\n /**\n * easy node traversal, you can pass\n * a set of node selectors which are joined as direct children\n *\n * Note!!! The root nodes are not in the getIf, those are always the child nodes\n *\n * @param nodeSelector\n */\n getIf(...nodeSelector: Array<string>): DomQuery {\n\n let selectorStage: DomQuery = this.childNodes;\n for (let cnt = 0; cnt < nodeSelector.length; cnt++) {\n selectorStage = selectorStage.filterSelector(nodeSelector[cnt]);\n if (selectorStage.isAbsent()) {\n return selectorStage;\n }\n }\n return selectorStage;\n }\n\n eachElem(func: (item: Element, cnt?: number) => any): DomQuery {\n\n for (let cnt = 0, len = this.rootNode.length; cnt < len; cnt++) {\n if (func(this.rootNode[cnt], cnt) === false) {\n break;\n }\n }\n return this;\n }\n\n firstElem(func: (item: Element, cnt?: number) => any = item => item): DomQuery {\n if (this.rootNode.length > 0) {\n func(this.rootNode[0], 0);\n }\n return this;\n }\n\n lastElem(func: (item: Element, cnt?: number) => any = item => item): DomQuery {\n if (this.rootNode.length > 0) {\n func(this.rootNode[this.rootNode.length - 1], this.rootNode.length - 1);\n }\n return this;\n }\n\n each(func: (item: DomQuery, cnt?: number) => any): DomQuery {\n Es2019ArrayFrom(this.rootNode)\n .forEach((item, cnt) => {\n // we could use a filter, but for the best performance we don´t\n if (item == null) {\n return;\n }\n return func(DomQuery.byId(item), cnt);\n });\n\n return this;\n }\n\n /**\n * replace convenience function, replaces one or more elements with\n * a set of elements passed as DomQuery\n * @param toReplace the replaced nodes as reference (original node has been replaced)\n */\n replace(toReplace: DomQuery): DomQuery {\n this.each(item => {\n let asElem = item.getAsElem(0).value;\n let parent = asElem.parentElement;\n let nextElement = asElem.nextElementSibling;\n let previousElement = asElem.previousElementSibling;\n if(nextElement != null) {\n new DomQuery(nextElement).insertBefore(toReplace);\n } else if(previousElement) {\n new DomQuery(previousElement).insertAfter(toReplace)\n } else {\n new DomQuery(parent).append(toReplace);\n }\n item.delete();\n });\n return toReplace;\n }\n\n /**\n * returns a new dom query containing only the first element max\n *\n * @param func a an optional callback function to perform an operation on the first element\n */\n first(func: (item: DomQuery, cnt?: number) => any = (item) => item): DomQuery {\n if (this.rootNode.length >= 1) {\n func(this.get(0), 0);\n return this.get(0);\n }\n return this;\n }\n\n /**\n * returns a new dom query containing only the first element max\n *\n * @param func a an optional callback function to perform an operation on the first element\n */\n last(func: (item: DomQuery, cnt?: number) => any = (item) => item): DomQuery {\n if (this.rootNode.length >= 1) {\n let lastNode = this.get(this.rootNode.length - 1);\n func(lastNode, 0);\n return lastNode;\n }\n return this;\n }\n\n /**\n * filter function which filters a subset\n *\n * @param func\n */\n filter(func: (item: DomQuery) => boolean): DomQuery {\n let reArr: Array<DomQuery> = [];\n this.each((item: DomQuery) => {\n func(item) ? reArr.push(item) : null;\n });\n return new DomQuery(<any>reArr);\n }\n\n /**\n * global eval head appendix method\n * no other methods are supported anymore\n * @param code the code to be evaluated\n * @param nonce optional nonce key for higher security\n */\n globalEval(code: string, nonce ?: string): DomQuery {\n const head = document.getElementsByTagName(\"head\")?.[0]\n ?? document.documentElement.getElementsByTagName(\"head\")?.[0];\n const script = document.createElement(\"script\");\n if (nonce) {\n if ('undefined' != typeof script?.nonce) {\n script.nonce = nonce;\n } else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n script.type = \"text/javascript\";\n script.innerHTML = code;\n let newScriptElement = head.appendChild(script);\n head.removeChild(newScriptElement);\n return this;\n }\n\n /**\n * global eval head appendix method\n * no other methods are supported anymore\n * @param code the code to be evaluated\n * @param nonce optional nonce key for higher security\n */\n globalEvalSticky(code: string, nonce ?: string): DomQuery {\n let head = document.getElementsByTagName(\"head\")[0] || document.documentElement;\n let script = document.createElement(\"script\");\n this.applyNonce(nonce as any, script);\n script.type = \"text/javascript\";\n script.innerHTML = code;\n head.appendChild(script);\n return this;\n }\n\n /**\n * detaches a set of nodes from their parent elements\n * in a browser independent manner\n * @return {Array} an array of nodes with the detached dom nodes\n */\n detach(): DomQuery {\n this.eachElem((item: Element) => {\n item.parentNode!.removeChild(item);\n });\n return this;\n }\n\n /**\n * appends the current set of elements\n * to the element or first element passed via elem\n * @param elem\n */\n appendTo(elem: DomQuery | string): DomQuery {\n if (Lang.isString(elem)) {\n this.appendTo(DomQuery.querySelectorAll(elem as string));\n return this;\n }\n this.eachElem((item) => {\n let value1: Element = <Element>(elem as DomQuery).getAsElem(0).orElseLazy(() => {\n return {\n appendChild: () => {\n }\n }\n }).value;\n value1.appendChild(item);\n });\n return this;\n }\n\n /**\n * loads and evaluates a script from a source uri\n *\n * @param src the source to be loaded and evaluated\n * @param delay in milliseconds execution default (0 == no delay)\n * @param nonce optional nonce value to allow increased security via nonce crypto token\n */\n loadScriptEval(src: string, delay: number = 0, nonce?: string) {\n this._loadScriptEval(false, src, delay, nonce);\n\n return this;\n }\n\n\n /**\n * loads and evaluates a script from a source uri\n *\n * @param src the source to be loaded and evaluated\n * @param delay in milliseconds execution default (0 == no delay)\n * @param nonce optional nonce parameter for increased security via nonce crypto token\n */\n loadScriptEvalSticky(src: string, delay: number = 0, nonce?: string) {\n this._loadScriptEval(true, src, delay, nonce);\n\n return this;\n }\n\n insertAfter(...toInsertParams: Array<DomQuery>): DomQuery {\n\n this.each(existingItem => {\n let existingElement = existingItem.getAsElem(0).value;\n let rootNode = existingElement.parentNode;\n for (let cnt = 0; cnt < toInsertParams.length; cnt++) {\n let nextSibling: Element = <any>existingElement.nextSibling;\n toInsertParams[cnt].eachElem(insertElem => {\n if (nextSibling) {\n rootNode!.insertBefore(insertElem, nextSibling);\n existingElement = nextSibling;\n } else {\n rootNode!.appendChild(insertElem);\n }\n });\n\n }\n });\n\n let res: DomQuery[] = [];\n res.push(this);\n res = res.concat(toInsertParams);\n return new DomQuery(res);\n }\n\n insertBefore(...toInsertParams: Array<DomQuery>): DomQuery {\n this.each(existingItem => {\n let existingElement = existingItem.getAsElem(0).value;\n let rootNode = existingElement.parentNode;\n for (let cnt = 0; cnt < toInsertParams.length; cnt++) {\n toInsertParams[cnt].eachElem(insertElem => {\n rootNode!.insertBefore(insertElem, existingElement);\n });\n }\n });\n let res: DomQuery[] = [];\n res.push(this);\n res = res.concat(toInsertParams);\n return new DomQuery(res);\n }\n\n orElse(...elseValue: any): DomQuery {\n if (this.isPresent()) {\n return this;\n } else {\n return new DomQuery(...elseValue);\n }\n }\n\n orElseLazy(func: () => any): DomQuery {\n if (this.isPresent()) {\n return this;\n } else {\n return new DomQuery(func());\n }\n }\n\n /**\n * find all parents in the hierarchy for which the selector matches\n * @param selector\n */\n allParents(selector: string): DomQuery {\n let parent = this.parent();\n let ret: Array<DomQuery> = [];\n while(parent.isPresent()) {\n if(parent.matchesSelector(selector)) {\n ret.push(parent);\n }\n parent = parent.parent();\n }\n return new DomQuery(ret);\n }\n\n /**\n * finds the first parent in the hierarchy for which the selector matches\n * @param selector\n */\n firstParent(selector: string): DomQuery {\n let parent = this.parent();\n while(parent.isPresent()) {\n if(parent.matchesSelector(selector)) {\n return parent;\n }\n parent = parent.parent();\n }\n return DomQuery.absent;\n }\n\n /**\n * fetches all parents as long as the filter criterium matches\n * @param selector\n */\n parentsWhileMatch(selector: string): DomQuery {\n const retArr: Array<DomQuery> = [];\n let parent = this.parent().filter(item => item.matchesSelector(selector));\n while(parent.isPresent()) {\n retArr.push(parent);\n parent = parent.parent().filter(item => item.matchesSelector(selector));\n }\n\n return new DomQuery(retArr);\n }\n\n parent(): DomQuery {\n let ret: Array<Node | ShadowRoot> = [];\n this.eachElem((item: Element) => {\n let parent = item.parentNode || (item as any).host || item.shadowRoot;\n if (parent && ret.indexOf(parent) == -1) {\n ret.push(parent);\n }\n });\n\n return new DomQuery(ret as any);\n }\n\n copyAttrs(sourceItem: DomQuery | XMLQuery): DomQuery {\n sourceItem.eachElem((sourceNode: Element) => {\n let attrs: Array<Attr> = objToArray(sourceNode.attributes);\n for (let item of attrs) {\n let value: string = item.value;\n let name: string = item.name;\n\n switch (name) {\n case \"id\":\n this.id.value = value;\n break;\n case \"disabled\":\n this.resolveAttributeHolder(\"disabled\").disabled = value;\n break;\n case \"checked\":\n this.resolveAttributeHolder(\"checked\").checked = value;\n break;\n case \"nonce\":\n // nonce will be handled below!\n break;\n default:\n this.attr(name).value = value;\n }\n }\n });\n\n //special nonce handling\n sourceItem.nonce.isPresent(() => {\n this.nonce.value = sourceItem.nonce.value;\n });\n\n return this;\n }\n\n /**\n * outerHTML convenience method\n * browsers only support innerHTML but\n * for instance for your jsf.js we have a full\n * replace pattern which needs outerHTML processing\n *\n * @param markup the markup which should replace the root element\n * @param runEmbeddedScripts if true the embedded scripts are executed\n * @param runEmbeddedCss if true the embedded css are executed\n * @param deep should this also work for shadow dom (run scripts etc...)\n */\n outerHTML(markup: string, runEmbeddedScripts ?: boolean, runEmbeddedCss ?: boolean, deep = false): DomQuery {\n if (this.isAbsent()) {\n return undefined as any;\n }\n\n let toReplace = this.getAsElem(0).value;\n let activeElement = document?.activeElement;\n let focusElementId = activeElement?.id;\n // only save/restore the caret if the focused element is actually part of the\n // subtree that gets replaced. Otherwise updating an unrelated component would\n // reset the caret of a different, still focused input field.\n let restoreFocus = !!focusElementId && !!(toReplace as any)?.contains?.(activeElement);\n let caretPosition = restoreFocus ? DomQuery.getCaretPosition(activeElement) : null;\n let nodes = DomQuery.fromMarkup(markup);\n let res: DomQuery[] = [];\n let firstInsert = nodes.get(0);\n let parentNode = toReplace.parentNode;\n let replaced = firstInsert.getAsElem(0).value;\n parentNode!.replaceChild(replaced, toReplace);\n res.push(new DomQuery(replaced));\n // no replacement possible\n if (this.isAbsent()) {\n return this;\n }\n\n let insertAdditionalItems: Element[] = [];\n\n if (nodes.length > 1) {\n insertAdditionalItems = insertAdditionalItems.concat(nodes.values.slice(1));\n res.push(DomQuery.byId(replaced).insertAfter(new DomQuery(insertAdditionalItems)));\n }\n\n if (runEmbeddedScripts) {\n this.runScripts();\n }\n if (runEmbeddedCss) {\n this.runCss();\n }\n\n if (restoreFocus) {\n let focusElement = DomQuery.byId(focusElementId as any);\n if (focusElement.isPresent() &&\n caretPosition != null && \"undefined\" != typeof caretPosition) {\n focusElement.eachElem(item => DomQuery.setCaretPosition(item, caretPosition));\n }\n }\n\n return nodes;\n }\n\n /**\n * Run through the given nodes in the DomQuery execute the inline scripts\n * @param sticky if set to true the evaluated elements will stick to the head, default false\n * @param whitelisted: optional whitelist function which can filter out script tags which are not processed\n * defaults to the standard jsf.js exclusion (we use this code for myfaces)\n */\n runScripts(sticky = false, whitelisted: (val: string) => boolean = DEFAULT_WHITELIST): DomQuery {\n const evalCollectedScripts = (scriptsToProcess: { evalText: string, nonce: string }[]) => {\n if (scriptsToProcess.length) {\n // script source means we have to eval the existing\n // scripts before we run the 'include' command\n // this.globalEval(finalScripts.join(\"\\n\"));\n let joinedScripts: string[] = [];\n Es2019ArrayFrom(scriptsToProcess).forEach(item => {\n if (!item.nonce) {\n joinedScripts.push(item.evalText)\n } else {\n if (joinedScripts.length) {\n this.globalEval(joinedScripts.join(\"\\n\"));\n joinedScripts.length = 0;\n }\n\n (!sticky) ?\n this.globalEval(item.evalText, item.nonce) :\n this.globalEvalSticky(item.evalText, item.nonce);\n }\n });\n if (joinedScripts.length) {\n (!sticky) ? this.globalEval(joinedScripts.join(\"\\n\")) :\n this.globalEvalSticky(joinedScripts.join(\"\\n\"));\n joinedScripts.length = 0;\n }\n\n scriptsToProcess = [];\n }\n return scriptsToProcess;\n }\n\n let finalScripts: { evalText: string, nonce: string }[] = [],\n allowedItemTypes = [\"\", \"script\", \"text/javascript\", \"text/ecmascript\", \"ecmascript\"],\n execScript = (item: HTMLScriptElement) => {\n let tagName = item.tagName;\n let itemType = (item?.type ?? '').toLowerCase();\n if (tagName &&\n eqi(tagName, \"script\") &&\n allowedItemTypes.indexOf(itemType) != -1) {\n let src = item.getAttribute('src');\n if ('undefined' != typeof src\n && null != src\n && src.length > 0\n ) {\n let nonce = item?.nonce ?? (item.getAttribute('nonce') as any).value;\n // we have to move this into an inner if because chrome otherwise chokes\n // due to changing the and order instead of relying on left to right\n // if jsf.js is already registered we do not replace it anymore\n if (whitelisted(src)) {\n // we run the collected scripts, before we run the 'include' command\n finalScripts = evalCollectedScripts(finalScripts);\n if (!sticky) {\n (!!nonce) ? this.loadScriptEval(src, 0, nonce) :\n // if no nonce is set we do not pass any once\n this.loadScriptEval(src, 0);\n } else {\n (!!nonce) ? this.loadScriptEvalSticky(src, 0, nonce) :\n // if no nonce is set we do not pass any once\n this.loadScriptEvalSticky(src, 0);\n }\n }\n\n } else {\n // embedded script auto eval\n // probably not needed anymore\n let evalText = trim(item.text || item.innerText || item.innerHTML);\n let go = true;\n\n while (go) {\n go = false;\n if (evalText.substring(0, 4) == \"<!--\") {\n evalText = evalText.substring(4);\n go = true;\n }\n if (evalText.substring(0, 4) == \"//<!--\") {\n evalText = evalText.substring(6);\n go = true;\n }\n if (evalText.substring(0, 11) == \"//<![CDATA[\") {\n evalText = evalText.substring(11);\n go = true;\n }\n }\n let nonce = item?.nonce ?? (item.getAttribute('nonce') as any).value ?? '';\n // we have to run the script under a global context\n // we store the script for fewer calls to eval\n finalScripts.push({\n nonce,\n evalText\n });\n }\n }\n };\n try {\n let scriptElements = new DomQuery(this.filterSelector(\"script\"), this.querySelectorAll(\"script\"));\n // script execution order by relative pos in their dom tree\n scriptElements.asArray\n .flatMap(item => [...item.values])\n .sort((node1, node2) => node2.compareDocumentPosition(node1) - 3) // preceding 2, following == 4)\n .forEach(item => execScript(item as HTMLScriptElement));\n\n evalCollectedScripts(finalScripts);\n } catch (e: unknown) {\n if (console && console.error) {\n // not sure if we\n // should use our standard\n // error mechanisms here\n // because in the head appendix\n // method only a console\n // error would be raised as well\n const error = e as { message?: string, description?: string };\n console.error(error.message || error.description);\n }\n } finally {\n // the usual ie6 fix code\n // the IE6 garbage collector is broken\n // nulling closures helps somewhat to reduce\n // mem leaks, which are impossible to avoid\n // at this browser\n execScript = null as any;\n }\n return this;\n }\n\n runCss(): DomQuery {\n\n const execCss = (toReplace: HTMLElement) => {\n const _toReplace = DomQuery.byId(toReplace);\n const tagName = _toReplace.tagName.orElse(\"\").value;\n let newElement = DomQuery.fromMarkup(`<${tagName.toLowerCase()} />`);\n newElement = newElement.copyAttrs(_toReplace);\n newElement.innerHTML = toReplace.innerHTML;\n // css suffices a simple replace to get it eval-ed, no need\n // for a full head replace\n _toReplace.replace(newElement);\n };\n\n const cssElems: DomQuery = new DomQuery(this.filterSelector(\"link, style\"), this.querySelectorAll(\"link, style\"));\n\n cssElems.asArray\n .flatMap(item => [...item.values])\n // sort to make sure the execution order is correct\n // this is needed because we mix 2 queries together\n // -3 is needed due to the compareDocumentPosition return value\n .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)\n .forEach(item => execCss(item as HTMLElement));\n\n return this;\n }\n\n /**\n * fires a click event on the underlying dom elements\n */\n click(): DomQuery {\n this.fireEvent(\"click\");\n return this;\n }\n\n addEventListener(type: string, listener: (evt: Event) => void, options?: boolean | EventListenerOptions): DomQuery {\n this.eachElem((node: Element) => node.addEventListener(type, listener, options));\n return this;\n }\n\n removeEventListener(type: string, listener: (evt: Event) => void, options?: boolean | EventListenerOptions): DomQuery {\n this.eachElem((node: Element) => node.removeEventListener(type, listener, options));\n return this;\n }\n\n /**\n * fires an event\n */\n fireEvent(eventName: string, options: {[key: string]: any} = {}) {\n // merge with last one having the highest priority\n\n let finalOptions: any = {\n bubbles: true, cancelable: true\n }\n finalOptions = simpleShallowMerge(finalOptions, options);\n\n this.eachElem((node: Element) => {\n let doc;\n if (node.ownerDocument) {\n doc = node.ownerDocument;\n } else if (node.nodeType == 9) {\n // the node may be the document itself, nodeType 9 = DOCUMENT_NODE\n doc = node;\n } else {\n throw new Error(\"Invalid node passed to fireEvent: \" + node.id);\n }\n\n if (node.dispatchEvent) {\n // Gecko-style approach (now the standard) takes more work\n let EventClass = Event;\n\n // Different events have different event classes.\n // If this switch statement can't map an eventName to an EventClass,\n // the event firing is going to fail.\n // extend this list on demand\n switch (eventName) {\n case \"click\": // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.\n case \"mousedown\":\n case \"mouseup\":\n case \"mousemove\":\n EventClass = this.global().MouseEvent;\n break;\n case \"keyup\":\n case \"keydown\":\n case \"keypress\":\n EventClass = this.global().KeyboardEvent;\n break;\n case \"focus\":\n case \"change\":\n case \"blur\":\n case \"select\":\n break;\n default:\n throw \"fireEvent: Couldn't find an event class for event '\" + eventName + \"'.\";\n }\n\n let event = new EventClass(eventName, finalOptions);\n // this is added as an extra to allow internally the detection of synthetic events\n // not used atm, but it does not hurt to have the extra info\n (event as any).synthetic = true; // allow detection of synthetic events\n // The second parameter says go ahead with the default action\n node.dispatchEvent(event);\n } else if ((node as any).fireEvent) {\n // IE-old school style, you can drop this if you don't need to support IE8 and lower\n let event = (doc as any).createEventObject();\n event.synthetic = true; // allow detection of synthetic events\n Object.keys(finalOptions).forEach(key => event[key] = finalOptions[key]);\n (node as any).fireEvent(\"on\" + eventName, event);\n }\n })\n }\n\n textContent(joinString: string = \"\"): string {\n return this.asArray\n .map((value: DomQuery) => {\n let item = value.getAsElem(0).orElseLazy(() => {\n return <any>{\n textContent: \"\"\n };\n }).value;\n return (item as any).textContent || \"\";\n })\n .reduce((text1, text2) => [text1,joinString,text2].join(\"\"), \"\");\n }\n\n innerText(joinString: string = \"\"): string {\n return this.asArray\n .map((value: DomQuery) => {\n let item = value.getAsElem(0).orElseLazy(() => {\n return <any>{\n innerText: \"\"\n };\n }).value;\n return (item as any).innerText || \"\";\n })\n .reduce((text1, text2) => {\n return [text1, text2].join(joinString)\n }, \"\");\n }\n\n /**\n * encodes all input elements properly into respective\n * config entries, this can be used\n * for legacy systems, for newer use-cases, use the\n * HTML5 Form class which all newer browsers provide\n *\n * @param toMerge optional config which can be merged in\n * @return a copy pf\n */\n encodeFormElement(toMerge = {}): {[key: string]: any} {\n\n // browser behavior no element name no encoding (normal submit fails in that case)\n // https:// issues.apache.org/jira/browse/MYFACES-2847\n if (this.name.isAbsent()) {\n return undefined as any;\n }\n\n // let´s keep it side-effects free\n let target = simpleShallowMerge(toMerge);\n\n this.each((element: DomQuery) => {\n if (element.name.isAbsent()) {// no name, no encoding\n return;\n }\n let name = element.name.value;\n let tagName = element.tagName.orElse(\"__none__\").value.toLowerCase();\n let elemType = element.type.orElse(\"__none__\").value.toLowerCase();\n\n elemType = elemType.toLowerCase();\n\n // routine for all elements\n // rules:\n // - process only input, textarea and select elements\n // - elements must have attribute \"name\"\n // - elements must not be disabled\n if (((tagName == \"input\" || tagName == \"textarea\" || tagName == \"select\") &&\n (name != null && name != \"\")) && !element.disabled) {\n\n // routine for select elements\n // rules:\n // - if select-one and value-Attribute exist => \"name=value\"\n // (also if value empty => \"name=\")\n // - if select-one and value-Attribute don't exist =>\n // \"name=DisplayValue\"\n // - if select multi and multiple selected => \"name=value1&name=value2\"\n // - if select and selectedIndex=-1 don't submit\n if (tagName == \"select\") {\n // selectedIndex must be >= 0 to be submitted\n let selectElem: HTMLSelectElement = <HTMLSelectElement>element.getAsElem(0).value;\n if (selectElem.selectedIndex >= 0) {\n let uLen = selectElem.options.length;\n for (let u = 0; u < uLen; u++) {\n // find all selected options\n // let subBuf = [];\n if (selectElem.options[u].selected) {\n let elementOption = selectElem.options[u];\n append(target, name).value = (elementOption.getAttribute(\"value\") != null) ?\n elementOption.value : elementOption.text;\n }\n }\n }\n }\n\n // routine for remaining elements\n // rules:\n // - don't submit no selects (processed above), buttons, reset buttons, submit buttons,\n // - submit checkboxes and radio inputs only if checked\n if (\n (\n tagName != ALLOWED_SUBMITTABLE_ELEMENTS.SELECT &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.BUTTON &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RESET &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.SUBMIT &&\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.IMAGE\n ) && (\n (\n elemType != ALLOWED_SUBMITTABLE_ELEMENTS.CHECKBOX && elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RADIO) ||\n element.checked\n )\n ) {\n let uploadedFiles = (element.value as any)?.value?.files;\n let filesArr: any = uploadedFiles ?? [];\n if (filesArr?.length) { //files can be empty but set\n // xhr level2, single multiple must be passes as they are\n assign(target, name).value = Array.from(filesArr);\n } else {\n if(!!uploadedFiles) { //we skip empty file elements i\n return;\n }\n //checkboxes etc.. need to be appended\n append(target, name).value = element.inputValue.value;\n }\n }\n\n }\n });\n\n return target;\n }\n\n get cDATAAsString(): string {\n let TYPE_CDATA_BLOCK = 4;\n\n let res = this.asArray\n .flatMap( item => {\n return item.childNodes.asArray;\n })\n .filter(item => {\n return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;\n })\n .reduce((reduced: Array<any>, item: DomQuery) => {\n reduced.push((item?.value?.value as any)?.data ?? \"\");\n return reduced;\n }, []);\n /*let res: any = this.lazyStream.flatMap(item => {\n return item.childNodes.stream\n }).filter(item => {\n return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;\n }).reduce((reduced: Array<any>, item: DomQuery) => {\n reduced.push((item?.value?.value)?.data ?? \"\" as any);\n return reduced;\n }, []).value;*/\n\n // response may contain several blocks\n return res.join(\"\");\n }\n\n subNodes(from: number, to?: number): DomQuery {\n if (Optional.fromNullable(to).isAbsent()) {\n to = this.length;\n }\n return new DomQuery(this.rootNode.slice(from, Math.min(to!, this.length)));\n }\n\n\n // because we can stream from an array stream directly into the dom query\n _limits = -1;\n\n limits(end: number): DomQuery {\n this._limits = end;\n return <any>this;\n }\n\n //-- internally exposed methods needed for the interconnectivity\n hasNext() {\n let isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;\n let isEndOfArray = this.pos >= this.values.length - 1;\n return !(isLimitsReached ||\n isEndOfArray);\n }\n\n next(): DomQuery {\n if (!this.hasNext()) {\n return null as any;\n }\n this.pos++;\n return new DomQuery(this.values[this.pos]);\n }\n\n\n lookAhead(cnt = 1): ITERATION_STATUS | DomQuery {\n if ((this.values.length - 1) < (this.pos + cnt)) {\n return ITERATION_STATUS.EO_STRM;\n }\n return new DomQuery(this.values[this.pos + cnt]);\n }\n\n\n current(): DomQuery | ITERATION_STATUS {\n if (this.pos == -1) {\n return ITERATION_STATUS.BEF_STRM;\n }\n return new DomQuery(this.values[this.pos]);\n }\n\n\n reset() {\n this.pos = -1;\n }\n\n attachShadow(params: { [key: string]: string } = {mode: \"open\"}): DomQuery {\n let shadowRoots: DomQuery[] = [];\n this.eachElem((item: Element) => {\n let shadowElement: DomQuery;\n if ((item)?.attachShadow as any) {\n shadowElement = DomQuery.byId((item as any).attachShadow(params));\n shadowRoots.push(shadowElement);\n } else {\n throw new Error(\"Shadow dom creation not supported by the browser, please use a shim, to gain this functionality\");\n }\n });\n return new DomQuery(shadowRoots);\n }\n\n /**\n * helper to fix a common dom problem\n * we have to wait until a certain condition is met, in most of the cases we just want to know whether an element is present in the sub dom-tree before being able to proceed\n * @param condition\n * @param options\n */\n async waitUntilDom(condition: (element: DomQuery) => boolean, options: WAIT_OPTS = {\n attributes: true,\n childList: true,\n subtree: true,\n timeout: 500,\n interval: 100\n }): Promise<DomQuery> {\n return waitUntilDom(this, condition, options);\n }\n\n /**\n * returns the embedded shadow elements\n */\n get shadowElements(): DomQuery {\n let shadowElements = this.querySelectorAll(\"*\")\n .filter(item => item.hasShadow);\n\n\n let mapped: Array<ShadowRoot> = (shadowElements.allElems() || [])\n .map(element => element.shadowRoot)\n .filter((root): root is ShadowRoot => !!root);\n return new DomQuery(mapped);\n }\n\n get shadowRoot(): DomQuery {\n let shadowRoots = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (this.rootNode[cnt].shadowRoot) {\n shadowRoots.push(this.rootNode[cnt].shadowRoot);\n }\n }\n return new DomQuery(shadowRoots);\n }\n\n get hasShadow(): boolean {\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (this.rootNode[cnt].shadowRoot) {\n return true;\n }\n }\n return false;\n }\n\n static getCaretPosition(ctrl: any): number {\n try {\n // selectionStart is supported on text inputs/textareas in every relevant\n // browser (IE9+ and all modern engines)\n if (typeof ctrl?.selectionStart === \"number\") {\n return ctrl.selectionStart;\n }\n } catch (e) {\n // some input types throw on selectionStart access; treat as \"no caret\"\n }\n return 0;\n }\n\n /**\n * sets the caret position\n *\n * @param ctrl the control to set the caret position to\n * @param pos the position to set\n *\n * note if the control does not have any selectable and focusable behavior\n * calling this method does nothing (silent fail)\n *\n */\n static setCaretPosition(ctrl: any, pos: number) {\n ctrl?.focus ? ctrl?.focus() : null;\n // the selection range is our caret position\n //\n // setSelectionRange exists on every HTMLInputElement, but the DOM spec\n // mandates that calling it on input types which do not support text\n // selection (checkbox, radio, button, file, ...) throws an\n // InvalidStateError. Hence a plain existence check is not enough; we\n // additionally swallow the error so the focus above still takes effect\n // (silent fail as documented).\n try {\n ctrl?.setSelectionRange ? ctrl?.setSelectionRange(pos, pos) : null;\n } catch (e) {\n // input type does not support a caret/selection -> nothing to set\n }\n }\n\n /**\n * Implementation of an iterator\n * to allow loops over dom query collections\n */\n [Symbol.iterator](): Iterator<DomQuery> {\n return {\n next: () => {\n let done = !this.hasNext();\n let val = this.next();\n return {\n done: done,\n value: <DomQuery>val\n }\n }\n }\n }\n\n /**\n * Concatenates the elements of two Dom Queries into a single one\n * @param toAttach the elements to attach\n * @param filterDoubles filter out possible double elements (aka same markup)\n */\n concat(toAttach: DomQuery, filterDoubles = true): DomQuery {\n let domQueries = this.asArray;\n const ret = new DomQuery(domQueries.concat(toAttach.asArray));\n // we now filter the doubles out\n if (!filterDoubles) {\n return ret;\n }\n let idx: { [key: string]: boolean } = {}; // ie11 does not support sets, we have to fake it\n return new DomQuery(ret.asArray.filter(node => {\n const notFound = !(idx?.[node.value.value.outerHTML as any]);\n idx[node.value.value.outerHTML as any] = true;\n return notFound;\n }));\n }\n\n append(elem: DomQuery): DomQuery {\n this.each(item => elem.appendTo(item));\n return this;\n }\n\n prependTo(elem: DomQuery): DomQuery {\n elem.eachElem(item => {\n prependChunked(item, this.allElems());\n });\n return this;\n }\n\n prepend(elem: DomQuery): DomQuery {\n this.eachElem(item => {\n prependChunked(item, elem.allElems());\n })\n return this;\n }\n\n /**\n * query selector all on the existing dom queryX object\n *\n * @param selector the standard selector\n * @return a DomQuery with the results\n */\n private _querySelectorAll(selector: string): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n let nodes: Element[] = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (!this.rootNode[cnt]?.querySelectorAll) {\n continue;\n }\n let res = this.rootNode[cnt].querySelectorAll(selector);\n // push the NodeList straight into the single target array in\n // argument-stack-safe chunks; this avoids the objToArray copy plus\n // the concat reallocation, which doubled a large result set (e.g. the\n // querySelectorAll(\"*\") shadow scan) on every root iteration\n pushChunked(nodes, res as ArrayLike<Element>);\n }\n\n return new DomQuery(nodes);\n }\n\n /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/\n private _querySelectorAllDeep(selector: string): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n\n let foundNodes: DomQuery = new DomQuery(this.rootNode);\n let selectors = selector.split(/\\/shadow\\//);\n\n for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {\n if (selectors[cnt2] == \"\") {\n continue;\n }\n let levelSelector = selectors[cnt2];\n foundNodes = foundNodes.querySelectorAll(levelSelector);\n if (cnt2 < selectors.length - 1) {\n foundNodes = foundNodes.shadowRoot;\n }\n }\n\n return foundNodes;\n }\n\n\n /**\n * query selector all on the existing dom queryX object\n *\n * @param selector the standard selector\n * @return a DomQuery with the results\n */\n private _closest(selector: string): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n let nodes: Element[] = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n if (!this.rootNode[cnt]?.closest) {\n continue;\n }\n let res = [this.rootNode[cnt].closest(selector)];\n nodes = nodes.concat(res as any);\n }\n\n return new DomQuery(nodes);\n }\n\n /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/\n private _closestDeep(selector: string): DomQuery {\n if (!this?.rootNode?.length) {\n return this;\n }\n\n let foundNodes: DomQuery = new DomQuery(this.rootNode);\n let selectors = selector.split(/\\/shadow\\//);\n\n for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {\n if (selectors[cnt2] == \"\") {\n continue;\n }\n let levelSelector = selectors[cnt2];\n foundNodes = foundNodes.closest(levelSelector);\n if (cnt2 < selectors.length - 1) {\n foundNodes = foundNodes.shadowRoot;\n }\n }\n\n return foundNodes;\n }\n\n /**\n * matches selector call in a browser independent manner\n *\n * @param toMatch\n * @param selector\n * @private\n */\n private _matchesSelector(toMatch: Element, selector: string): boolean {\n if(toMatch.matches) {\n return toMatch.matches(selector);\n }\n var foundElements = (document || ownerDocument).querySelectorAll(selector);\n return Array.prototype.indexOf.call(foundElements, toMatch) !== -1;\n }\n\n /**\n * sticky non-sticky unified code of the load script eval\n * implementation if programmatic &gt;script src=\"... loading\n *\n * @param sticky if set to true a head element is left in the dom tree after the script has loaded\n *\n * @param src the sec to load\n * @param delay delay the script loading x ms (default immediately === 0)\n * @param nonce optional nonce token to be passed into the script tag\n * @private\n */\n private _loadScriptEval(sticky: boolean, src: string, delay: number = 0, nonce ?: string) {\n let srcNode = this.createSourceNode(src, nonce);\n let nonceCheck = this.createSourceNode(null, nonce);\n let marker = `nonce_${Date.now()}_${Math.random()}`;\n nonceCheck.innerHTML = `document.head[\"${marker}\"] = true` // noop\n\n let head = document.head;\n // upfront nonce check, needed mostly for testing\n // but cannot hurt to block src calls which have invalid nonce on localhost\n // the reason for doing this up until now we have a similar construct automatically\n // by loading the scripts via xhr and then embedding them.\n // this is not needed anymore but the nonce is more relaxed with script src\n // we now enforce it the old way\n\n head.appendChild(nonceCheck);\n head.removeChild(nonceCheck);\n if(!(head as any)[marker]) {\n return;\n }\n try {\n if (!delay) {\n head.appendChild(srcNode);\n if(!sticky) {\n head.removeChild(srcNode);\n }\n } else {\n setTimeout(() => {\n head.appendChild(srcNode);\n if(!sticky) {\n head.removeChild(srcNode);\n }\n }, delay);\n }\n } finally {\n delete (head as any)[marker];\n }\n\n return this;\n }\n\n /**\n * resolves an attribute holder compared\n * @param attrName the attribute name\n */\n private resolveAttributeHolder(attrName: string = \"value\"): HTMLFormElement | any {\n let ret: { [key: string]: any } = [];\n ret[attrName] = null;\n return (attrName in this.getAsElem(0).value) ?\n this.getAsElem(0).value :\n ret;\n }\n\n private createSourceNode(src: string | null, nonce?: string) {\n let srcNode: HTMLScriptElement = document.createElement(\"script\");\n srcNode.type = \"text/javascript\";\n if (!!nonce) {\n if ('undefined' != typeof srcNode?.nonce) {\n srcNode.nonce = nonce;\n } else {\n srcNode.setAttribute(\"nonce\", nonce);\n }\n }\n if(!!src) {\n srcNode.src = src;\n }\n\n return srcNode;\n }\n\n private applyNonce(nonce: string, script: HTMLScriptElement) {\n if (nonce) {\n if ('undefined' != typeof script?.nonce) {\n script.nonce = nonce;\n } else {\n script.setAttribute(\"nonce\", nonce);\n }\n }\n }\n\n}\n\n\n/**\n * Various collectors\n * which can be used in conjunction with Streams\n */\n\n/**\n * A collector which bundles a full dom query stream into a single dom query element\n *\n * This connects basically our stream back into DomQuery\n */\nexport class DomQueryCollector implements ICollector<DomQuery, DomQuery> {\n\n data: DomQuery[] = [];\n\n collect(element: DomQuery) {\n this.data.push(element);\n }\n\n get finalValue(): DomQuery {\n return new DomQuery(this.data);\n }\n}\n\n/**\n * abbreviation for DomQuery\n */\nexport const DQ = DomQuery;\nexport type DQ = DomQuery;\n// noinspection JSUnusedGlobalSymbols\n/**\n * replacement for the jquery $\n */\nexport const DQ$ = DomQuery.querySelectorAll;\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nimport {Optional} from \"./Monad\";\n\nexport enum PromiseStatus {\n PENDING, FULFILLED, REJECTED\n}\n\nexport interface IPromise {\n then(executorFunc: (val: any) => any): IPromise;\n\n catch(executorFunc: (val: any) => any): IPromise\n\n finally(executorFunc: () => void): IPromise;\n\n}\n\n/*\n * Promise wrappers for timeout and interval\n */\nexport function timeout(timeout: number): CancellablePromise {\n let handler: any = null;\n return new CancellablePromise((apply: Function, reject: Function) => {\n handler = setTimeout(() => apply(), timeout);\n }, () => {\n if (handler) {\n clearTimeout(handler);\n handler = null;\n }\n });\n}\n\nexport function interval(timeout: number): CancellablePromise {\n let handler: any = null;\n return new CancellablePromise((apply: Function, reject: Function) => {\n handler = setInterval(() => {\n apply();\n }, timeout);\n }, () => {\n if (handler) {\n clearInterval(handler);\n handler = null;\n }\n });\n}\n\n/**\n * a small (probably not 100% correct, although I tried to be correct as possible) Promise implementation\n * for systems which do not have a promise implemented\n * Note, although an internal state is kept, this is sideffect free since\n * is value is a function to operate on, hence no real state is kept internally, except for the then\n * and catch calling order\n */\nexport class Promise implements IPromise {\n\n status = PromiseStatus.PENDING;\n protected allFuncs: Array<any> = [];\n private value: (resolve: (val?: any) => void, reject: (val?: any) => void) => void;\n\n constructor(executor: (resolve: (val?: any) => void, reject: (val?: any) => void) => void) {\n //super(executor);\n this.value = executor;\n this.value((data: any) => this.resolve(data), (data: any) => this.reject(data));\n }\n\n static all(...promises: Array<IPromise>): IPromise {\n\n let promiseCnt = 0;\n let myapply: Function;\n\n let myPromise = new Promise((apply: Function, reject: Function) => {\n myapply = apply;\n });\n let executor = () => {\n promiseCnt++;\n\n if (promises.length == promiseCnt) {\n myapply();\n }\n };\n (executor as any).__last__ = true;\n\n for (let cnt = 0; cnt < promises.length; cnt++) {\n promises[cnt].finally(executor);\n }\n return myPromise;\n }\n\n static race(...promises: Array<IPromise>): IPromise {\n\n let promiseCnt = 0;\n let myapply: Function | null;\n let myreject: Function | null;\n\n let myPromise = new Promise((apply: Function, reject: Function) => {\n myapply = apply;\n myreject = reject;\n });\n\n let thenexecutor = (): IPromise => {\n if (!!myapply) {\n myapply();\n }\n myapply = null;\n myreject = null;\n return null as any;\n };\n (thenexecutor as any).__last__ = true;\n\n let catchexeutor = (): IPromise => {\n if (!!myreject) {\n myreject();\n }\n myreject = null;\n myapply = null;\n return null as any;\n };\n (catchexeutor as any).__last__ = true;\n\n for (let cnt = 0; cnt < promises.length; cnt++) {\n promises[cnt].then(thenexecutor);\n promises[cnt].catch(catchexeutor);\n }\n return myPromise;\n }\n\n static reject(reason: any): Promise {\n let retVal = new Promise((resolve: any, reject: any) => {\n //not really doable without a hack\n if (reason instanceof Promise) {\n reason.then((val: any) => {\n reject(val);\n });\n } else {\n setTimeout(() => {\n reject(reason);\n }, 1);\n }\n });\n\n return retVal;\n }\n\n static resolve(reason: any): Promise {\n let retVal = new Promise((resolve: any, reject: any) => {\n //not really doable without a hack\n if (reason instanceof Promise) {\n reason.then((val) => resolve(val));\n } else {\n setTimeout(() => {\n resolve(reason);\n }, 1);\n }\n });\n\n return retVal;\n }\n\n then(executorFunc: (val?: any) => any, catchfunc?: (val?: any) => any): Promise {\n this.allFuncs.push({\"then\": executorFunc});\n if (catchfunc) {\n this.allFuncs.push({\"catch\": catchfunc});\n }\n this.spliceLastFuncs();\n return this;\n }\n\n catch(executorFunc: (val?: any) => void): Promise {\n this.allFuncs.push({\"catch\": executorFunc});\n this.spliceLastFuncs();\n return this;\n }\n\n finally(executorFunc: () => void): Promise {\n if ((this as any).__reason__) {\n (this as any).__reason__.finally(executorFunc);\n return undefined as any;\n }\n\n this.allFuncs.push({\"finally\": executorFunc});\n this.spliceLastFuncs();\n return this;\n }\n\n protected resolve(val?: any) {\n\n while (this.allFuncs.length) {\n if (!this.allFuncs[0].then) {\n break;\n }\n let fn = this.allFuncs.shift();\n\n let funcResult = Optional.fromNullable(fn.then(val));\n\n if (funcResult.isPresent()) {\n funcResult = funcResult.flatMap();\n val = funcResult.value;\n if (val instanceof Promise) {\n //let func = (newVal: any) => {this.resolve(newVal)};\n //func.__last__ = true;\n //val.then(func);\n this.transferIntoNewPromise(val);\n\n return;\n }\n } else {\n break;\n }\n }\n\n this.appyFinally();\n this.status = PromiseStatus.FULFILLED;\n }\n\n protected reject(val?: any) {\n\n while (this.allFuncs.length) {\n if (this.allFuncs[0].finally) {\n break;\n }\n let fn = this.allFuncs.shift();\n if (fn.catch) {\n let funcResult = Optional.fromNullable(fn.catch(val));\n if (funcResult.isPresent()) {\n funcResult = funcResult.flatMap();\n val = funcResult.value;\n if (val instanceof Promise) {\n //val.then((newVal: any) => {this.resolve(newVal)});\n this.transferIntoNewPromise(val);\n return;\n }\n this.status = PromiseStatus.REJECTED;\n break;\n } else {\n break;\n }\n }\n }\n\n this.status = PromiseStatus.REJECTED;\n this.appyFinally();\n }\n\n protected appyFinally() {\n while (this.allFuncs.length) {\n let fn = this.allFuncs.shift();\n if (fn.finally) {\n fn.finally();\n }\n }\n }\n\n private spliceLastFuncs() {\n let lastFuncs = [];\n let rest = [];\n for (let cnt = 0; cnt < this.allFuncs.length; cnt++) {\n for (let key in this.allFuncs[cnt]) {\n if (this.allFuncs[cnt][key].__last__) {\n lastFuncs.push(this.allFuncs[cnt]);\n } else {\n rest.push(this.allFuncs[cnt]);\n }\n }\n }\n this.allFuncs = rest.concat(lastFuncs);\n }\n\n private transferIntoNewPromise(val: any) {\n for (let cnt = 0; cnt < this.allFuncs.length; cnt++) {\n for (let key in this.allFuncs[cnt]) {\n val[key](this.allFuncs[cnt][key]);\n }\n }\n }\n}\n\n/**\n * a cancellable promise\n * a Promise with a cancel function, which can be cancellend any time\n * this is useful for promises which use cancellable asynchronous operations\n * note, even in a cancel state, the finally of the promise is executed, however\n * subsequent thens are not anymore.\n * The current then however is fished or a catch is called depending on how the outer\n * operation reacts to a cancel order.\n */\nexport class CancellablePromise extends Promise {\n\n /**\n * @param executor asynchronous callback operation which triggers the callback\n * @param cancellator cancel operation, separate from the trigger operation\n */\n constructor(executor: (resolve: (val?: any) => void, reject: (val?: any) => void) => void, cancellator: () => void) {\n super(executor);\n this.cancellator = cancellator;\n }\n\n cancel() {\n this.status = PromiseStatus.REJECTED;\n this.appyFinally();\n //lets terminate it once and for all, the finally has been applied\n this.allFuncs = [];\n }\n\n then(executorFunc: (val?: any) => any, catchfunc?: (val?: any) => any): CancellablePromise {\n return <CancellablePromise>super.then(executorFunc, catchfunc);\n }\n\n catch(executorFunc: (val?: any) => void): CancellablePromise {\n return <CancellablePromise>super.catch(executorFunc);\n }\n\n finally(executorFunc: () => void): CancellablePromise {\n return <CancellablePromise>super.finally(executorFunc);\n }\n\n private cancellator = () => {\n };\n}\n\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Lang} from \"./Lang\";\nimport {DomQuery} from \"./DomQuery\";\nconst isString = Lang.isString;\nimport {_global$} from \"./Global\";\n\ndeclare let ActiveXObject: any;\n\n/**\n * xml query as specialized case for DomQuery\n */\nexport class XMLQuery extends DomQuery {\n\n constructor(rootNode: Document | string | DomQuery, docType: string = \"text/xml\") {\n\n let createIe11DomQueryShim = (): DOMParser => {\n //at the time if wroting ie11 is the only relevant browser\n //left withut any DomQuery support\n let parser = new ActiveXObject(\"Microsoft.XMLDOM\");\n parser.async = false;\n //we shim th dom parser from ie in\n return <any>{\n parseFromString: (text: string, contentType: string): Document => {\n return parser.loadXML(text);\n }\n }\n };\n\n let parseXML = (xml: string): Document | null => {\n if (xml == null) {\n return null;\n }\n let domParser: DOMParser = Lang.saveResolveLazy<DOMParser>(\n () => new (_global$()).DOMParser(),\n (): DOMParser => createIe11DomQueryShim()\n ).value;\n return domParser.parseFromString(xml, <any> docType);\n };\n\n if (isString(rootNode)) {\n super(parseXML(<string>rootNode))\n } else {\n super(rootNode);\n }\n }\n\n isXMLParserError(): boolean {\n return this.querySelectorAll(\"parsererror\").isPresent();\n }\n\n toString(): string {\n let ret: string[] = [];\n this.eachElem((node: any) => {\n let serialized = (_global$())?.XMLSerializer?.constructor()?.serializeToString(node) ?? node?.xml;\n if (!!serialized) {\n ret.push(serialized);\n }\n });\n return ret.join(\"\");\n }\n\n parserErrorText(joinstr: string): string {\n return this.querySelectorAll(\"parsererror\").textContent(joinstr);\n }\n\n static parseXML(txt: string): XMLQuery {\n return new XMLQuery(txt);\n }\n\n static parseHTML(txt: string): XMLQuery {\n return new XMLQuery(txt, \"text/html\");\n }\n\n static fromString(txt: string, parseType: string = \"text/xml\"): XMLQuery {\n return new XMLQuery(txt, parseType);\n }\n}\n\nexport const XQ = XMLQuery;\nexport type XQ = XMLQuery;\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * A small stream implementation\n */\nimport {IMonad, IValueHolder, Optional} from \"./Monad\";\nimport {\n ArrayCollector,\n ArrayStreamDataSource, calculateSkips,\n FilteredStreamDatasource,\n ICollector,\n IStreamDataSource,\n ITERATION_STATUS,\n MappedStreamDataSource, MultiStreamDatasource\n} from \"./SourcesCollectors\";\nimport {DomQuery} from \"./DomQuery\";\nimport {Config} from \"./Config\";\n//import {from, Observable} from \"rxjs\";\n\n\n/*\n * some typedefs to make the code more reabable\n */\nexport type StreamMapper<T> = (data: T) => IStreamDataSource<any>;\nexport type ArrayMapper<T> = (data: T) => Array<any>;\nexport type IteratableConsumer<T> = (data: T, pos ?: number) => void | boolean;\nexport type Reducable<T, V> = (val1: T | V, val2: T) => V;\nexport type Matchable<T> = (data: T) => boolean;\nexport type Mappable<T, R> = (data: T) => R;\nexport type Comparator<T> = (el1: T, el2: T) => number;\n\n\n/**\n * Same for flatmap to deal with element -> stream mappings\n */\nexport class FlatMapStreamDataSource<T, S> implements IStreamDataSource<S> {\n\n mapFunc: StreamMapper<T>;\n\n inputDataSource: IStreamDataSource<T>;\n\n /**\n * the currently active stream\n * coming from an incoming element\n * once the end of this one is reached\n * it is swapped out by another one\n * from the next element\n */\n activeDataSource: IStreamDataSource<S> | null = null;\n walkedDataSources: Array<IStreamDataSource<S>> = [];\n _currPos = 0;\n\n constructor(func: StreamMapper<T>, parent: IStreamDataSource<T>) {\n this.mapFunc = func;\n this.inputDataSource = parent;\n }\n\n hasNext(): boolean {\n return this.resolveActiveHasNext() || this.resolveNextHasNext();\n }\n\n private resolveActiveHasNext() {\n let next = false;\n if (this.activeDataSource) {\n next = this.activeDataSource.hasNext();\n }\n return next;\n }\n\n lookAhead(cnt = 1): ITERATION_STATUS | S {\n\n let lookAhead = this?.activeDataSource?.lookAhead(cnt);\n if (this?.activeDataSource && lookAhead != ITERATION_STATUS.EO_STRM) {\n //this should cover 95% of all cases\n return lookAhead as S | ITERATION_STATUS;\n }\n\n if (this.activeDataSource) {\n cnt -= calculateSkips(this.activeDataSource)\n }\n\n //the idea is basically to look into the streams sub-sequentially for a match\n //after each stream we have to take into consideration that the skipCnt is\n //reduced by the number of datasets we already have looked into in the previous stream/datasource\n //unfortunately for now we have to loop into them, so we introduce a small o2 here\n for (let dsLoop = 1; true; dsLoop++) {\n let datasourceData = this.inputDataSource.lookAhead(dsLoop);\n //we have looped out\n //no embedded data anymore? we are done, data\n //can either be a scalar an array or another datasource\n if (datasourceData === ITERATION_STATUS.EO_STRM) {\n return ITERATION_STATUS.EO_STRM;\n }\n let mappedData = this.mapFunc(datasourceData as T);\n\n //it either comes in as datasource or as array\n //both cases must be unified into a datasource\n let currentDataSource = this.toDatasource(mappedData);\n //we now run again a lookahead\n let ret = currentDataSource.lookAhead(cnt);\n //if the value is found then we are set\n if (ret != ITERATION_STATUS.EO_STRM) {\n return ret;\n }\n //reduce the next lookahead by the number of elements\n //we are now skipping in the current data source\n cnt -= calculateSkips(currentDataSource);\n }\n }\n\n private toDatasource(mapped: Array<S> | IStreamDataSource<S>) {\n let ds = Array.isArray(mapped) ? ArrayStreamDataSource.ofArray(mapped) : mapped;\n this.walkedDataSources.push(ds)\n return ds;\n }\n\n private resolveNextHasNext() {\n let next = false;\n while (!next && this.inputDataSource.hasNext()) {\n let mapped = this.mapFunc(this.inputDataSource.next() as T);\n this.activeDataSource = this.toDatasource(mapped);\n next = this.activeDataSource.hasNext();\n }\n return next;\n }\n\n next(): S | ITERATION_STATUS {\n if (this.hasNext()) {\n this._currPos++;\n return this.activeDataSource!.next();\n }\n return undefined as any;\n }\n\n reset(): void {\n this.inputDataSource.reset();\n this.walkedDataSources.forEach(ds => ds.reset());\n this.walkedDataSources = [];\n this._currPos = 0;\n this.activeDataSource = null;\n }\n\n current(): S | ITERATION_STATUS {\n if (!this.activeDataSource) {\n this.hasNext();\n }\n return this.activeDataSource!.current();\n }\n}\n\n/**\n * Generic interface defining a stream\n */\nexport interface IStream<T> {\n /**\n * Perform the operation fn on a single element in the stream at a time\n * then pass the stream over for further processing\n * This is basically an intermediate point in the stream\n * with further processing happening later, do not use\n * this method to gather data or iterate over all date for processing\n * (for the second case each has to be used)\n *\n * @param fn the processing function, if it returns false, further processing is stopped\n */\n onElem(fn: IteratableConsumer<T>): IStream<T>;\n\n /**\n * Iterate over all elements in the stream and do some processing via fn\n *\n * @param fn takes a single element and if it returns false\n * then further processing is stopped\n */\n each(fn: IteratableConsumer<T>): void;\n\n\n /**\n * maps a single element into another via fn\n * @param fn function which takes one element in and returns another\n */\n map<R>(fn?: Mappable<T, R>): IStream<R>;\n\n /**\n * Takes an element in and returns a set of something\n * the set then is flatted into a single stream to be further processed\n *\n * @param fn\n */\n flatMap<R>(fn?: StreamMapper<T> | ArrayMapper<T>): IStream<R>;\n\n /**\n * filtering, takes an element in and is processed by fn.\n * If it returns false then further processing on this element is skipped\n * if it returns true it is passed down the chain.\n *\n * @param fn\n */\n filter(fn?: Matchable<T>): IStream<T>;\n\n /**\n * functional reduce... takes two elements in the stream and reduces to\n * one from left to right\n *\n * @param fn the reduction function for instance (val1,val2) => val1l+val2\n * @param startVal an optional starting value, if provided the the processing starts with this element\n * and further goes down into the stream, if not, then the first two elements are taken as reduction starting point\n */\n reduce<V>(fn: Reducable<T, V>, startVal: T | V): Optional<T | V>;\n\n /**\n * returns the first element in the stream is given as Optional\n */\n first(): Optional<T>;\n\n /**\n * Returns the last stream element (note in endless streams without filtering and limiting you will never reach that\n * point hence producing an endless loop)\n */\n last(): Optional<T>;\n\n /**\n * returns true if there is at least one element where a call fn(element) produces true\n *\n * @param fn\n */\n anyMatch(fn: Matchable<T>): boolean;\n\n /**\n * returns true if all elmements produce true on a call to fn(element)\n *\n * @param fn\n */\n allMatch(fn: Matchable<T>): boolean;\n\n /**\n * returns true if no elmements produce true on a call to fn(element)\n *\n * @param fn\n */\n noneMatch(fn: Matchable<T>): boolean;\n\n /**\n * Collect the elements with a collector given\n * There are a number of collectors provided\n *\n * @param collector\n */\n collect(collector: ICollector<T, any>): any;\n\n /**\n * sort on the stream, this is a special case\n * of an endpoint, so your data which is fed in needs\n * to be limited otherwise it will fail\n * it still returns a stream for further processing\n *\n * @param comparator\n */\n sort(comparator: Comparator<T>): IStream<T>;\n\n /**\n * Limits the stream to a certain number of elements\n *\n * @param end the limit of the stream\n */\n limits(end: number): IStream<T>;\n\n\n concat(...toAppend: Array<IStream<T>>): IStream<T>\n\n /**\n * returns the stream collected into an array (90% use-case abbreviation\n */\n value: Array<T>;\n\n /**\n * returns the currently element selected in the stream\n */\n current(): T | ITERATION_STATUS\n\n /**\n * returns an observable of the given stream\n */\n [Symbol.iterator](): Iterator<T>;\n\n //observable: Observable<T>;\n}\n\n/**\n * A simple typescript based reimplementation of streams\n *\n * This is the early eval version\n * for a lazy eval version check, LazyStream, which is api compatible\n * to this implementation, however with the benefit of being able\n * to provide infinite data sources and generic data providers, the downside\n * is, it might be a tad slower in some situations\n */\nexport class Stream<T> implements IMonad<T, Stream<any>>, IValueHolder<Array<T>>, IStream<T>, IStreamDataSource<T> {\n\n value: Array<T>;\n _limits = -1;\n\n private pos = -1;\n\n constructor(...value: T[]) {\n this.value = value;\n }\n\n static of<T>(...data: Array<T>): Stream<T> {\n return Stream.ofArr(data);\n }\n\n /**\n * chunk-safe factory, takes the backing array directly instead of\n * spreading it into the call (Stream.of(...largeArray) overflows the\n * argument stack on large arrays)\n *\n * @param data the array to stream over\n */\n static ofArr<T>(data: Array<T>): Stream<T> {\n const ret = new Stream<T>();\n ret.value = data ?? [];\n return ret;\n }\n\n static ofAssoc<T>(data: { [key: string]: T }): Stream<[string, T]> {\n return this.ofArr(Object.keys(data)).map(key => [key, data[key]]);\n }\n\n static ofDataSource<T>(dataSource: IStreamDataSource<T>) {\n let value: T[] = [];\n while (dataSource.hasNext()) {\n value.push(dataSource.next() as T);\n }\n\n return Stream.ofArr(value);\n }\n\n static ofDomQuery(value: DomQuery): Stream<DomQuery> {\n return Stream.ofArr(value.asArray);\n }\n\n static ofConfig(value: Config): Stream<[string, any]> {\n return Stream.ofArr(Object.keys(value.value)).map(key => [key, value.value[key]])\n }\n\n current(): T | ITERATION_STATUS {\n if(this.pos == -1) {\n return ITERATION_STATUS.BEF_STRM;\n }\n if(this.pos >= this.value.length) {\n return ITERATION_STATUS.EO_STRM;\n }\n return this.value[this.pos];\n }\n\n limits(end: number): Stream<T> {\n this._limits = end;\n return this;\n }\n\n /**\n * concat for streams, so that you can concat two streams together\n * @param toAppend\n */\n concat(...toAppend: Array<IStream<T>>): Stream<T> {\n let toConcat = [this].concat(toAppend as any);\n return Stream.ofArr(toConcat).flatMap(item => item);\n }\n\n\n onElem(fn: (data: T, pos ?: number) => void | boolean): Stream<T> {\n for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {\n if (fn(this.value[cnt], cnt) === false) {\n break;\n }\n }\n return this;\n }\n\n\n each(fn: (data: T, pos ?: number) => void | boolean) {\n this.onElem(fn);\n this.reset();\n }\n\n map<R>(fn?: (data: T) => R): Stream<R> {\n if (!fn) {\n fn = (inval: any) => <R>inval;\n }\n let res: R[] = [];\n this.each((item) => {\n res.push(fn(item))\n });\n\n return Stream.ofArr(res);\n }\n\n /*\n * we need to implement it to fulfill the contract, although it is used only internally\n * all values are flattened when accessed anyway, so there is no need to call this method\n */\n\n flatMap<R>(fn?: (data: T) => R | Array<any>): Stream<any> {\n let ret: any[] = [];\n this.each(item => {\n let strmR: any = fn!(item);\n ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat(strmR.value);\n });\n return <Stream<any>>Stream.ofArr(ret);\n }\n\n filter(fn?: (data: T) => boolean): Stream<T> {\n let res: Array<T> = [];\n this.each((data) => {\n if (fn!(data)) {\n res.push(data);\n }\n });\n return Stream.ofArr(res);\n }\n\n reduce<V>(fn: Reducable<T, V | T>, startVal: V | null = null): Optional<V | T> {\n let offset = startVal != null ? 0 : 1;\n let val1: V | T | null = startVal != null ? startVal : this.value.length ? this.value[0] : null;\n\n for (let cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {\n val1 = fn(val1 as T | V, this.value[cnt]);\n }\n this.reset();\n return Optional.fromNullable<Optional<any>, V | T>(val1);\n }\n\n first(): Optional<T> {\n this.reset();\n return this.value && this.value.length ? Optional.fromNullable(this.value[0]) : Optional.absent;\n }\n\n last(): Optional<T> {\n //could be done via reduce, but is faster this way\n let length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;\n this.reset();\n return Optional.fromNullable(length ? this.value[length - 1] : null);\n }\n\n anyMatch(fn: Matchable<T>): boolean {\n for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {\n if (fn(this.value[cnt])) {\n return true;\n }\n }\n this.reset();\n return false;\n }\n\n allMatch(fn: Matchable<T>): boolean {\n if (!this.value.length) {\n return false;\n }\n let matches = 0;\n for (let cnt = 0; cnt < this.value.length; cnt++) {\n if (fn(this.value[cnt])) {\n matches++;\n }\n }\n this.reset();\n return matches == this.value.length;\n }\n\n noneMatch(fn: Matchable<T>): boolean {\n let matches = 0;\n for (let cnt = 0; cnt < this.value.length; cnt++) {\n if (!fn(this.value[cnt])) {\n matches++;\n }\n }\n this.reset();\n return matches == this.value.length;\n }\n\n sort(comparator: Comparator<T>): IStream<T> {\n let newArr = this.value.slice().sort(comparator);\n return Stream.ofArr(newArr);\n }\n\n\n collect(collector: ICollector<T, any>): any {\n this.each(data => collector.collect(data));\n this.reset();\n return collector.finalValue;\n }\n\n //-- internally exposed methods needed for the interconnectivity\n hasNext(): boolean {\n let isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;\n let isEndOfArray = this.pos >= this.value.length - 1;\n return !(isLimitsReached || isEndOfArray);\n }\n\n next(): T | ITERATION_STATUS {\n if (!this.hasNext()) {\n return null as any;\n }\n this.pos++;\n return this.value[this.pos];\n }\n\n lookAhead(cnt = 1): T | ITERATION_STATUS {\n if((this.pos + cnt) >= this.value.length) {\n return ITERATION_STATUS.EO_STRM;\n }\n return this.value[this.pos + cnt];\n }\n\n\n [Symbol.iterator]() : Iterator<T> {\n return {\n next: () => {\n let done = !this.hasNext();\n let val = this.next();\n return {\n done: done,\n value: <T>val\n }\n }\n }\n }\n\n /*get observable(): Observable<T> {\n return from(this);\n }*/\n\n reset() {\n this.pos = -1;\n }\n}\n\n/**\n * Lazy implementation of a Stream\n * The idea is to connect the intermediate\n * streams as datasources like a linked list\n * with reverse referencing and for special\n * operations like filtering flatmapping\n * have intermediate datasources in the list\n * with specialized functions.\n *\n * Sort of a modified pipe valve pattern\n * the streams are the pipes the intermediate\n * data sources are the valves\n *\n * We then can use passed in functions to control\n * the flow in the valves\n *\n * That way we can have a lazy evaluating stream\n *\n * So if an endpoint requests data\n * a callback trace goes back the stream list\n * which triggers an operation upwards\n * which sends data down the drain which then is processed\n * and filtered until one element hits the endpoint.\n *\n * That is repeated, until all elements are processed\n * or an internal limit is hit.\n *\n */\nexport class LazyStream<T> implements IStreamDataSource<T>, IStream<T>, IMonad<T, LazyStream<any>> {\n\n protected dataSource: IStreamDataSource<T>;\n _limits = -1;\n\n /*\n * needed to have the limits check working\n * we need to keep track of the current position\n * in the stream\n */\n pos = -1;\n\n static of<T>(...values: Array<T>): LazyStream<T> {\n return LazyStream.ofArr(values);\n }\n\n /**\n * chunk-safe factory, takes the backing array directly instead of\n * spreading it into the call (LazyStream.of(...largeArray) overflows\n * the argument stack on large arrays)\n *\n * @param data the array to stream over\n */\n static ofArr<T>(data: Array<T>): LazyStream<T> {\n return new LazyStream<T>(ArrayStreamDataSource.ofArray(data));\n }\n\n static ofAssoc<T>(data: { [key: string]: T }): LazyStream<[string, T]> {\n return this.ofArr(Object.keys(data)).map(key => [key, data[key]]);\n }\n\n static ofStreamDataSource<T>(value: IStreamDataSource<T>): LazyStream<T> {\n return new LazyStream(value);\n }\n\n static ofDomQuery(value: DomQuery): LazyStream<DomQuery> {\n return LazyStream.ofArr(value.asArray);\n }\n\n static ofConfig(value: Config): LazyStream<[string, any]> {\n return LazyStream.ofArr(Object.keys(value.value)).map(key => [key, value.value[key]])\n }\n\n constructor(parent: IStreamDataSource<T>) {\n this.dataSource = parent;\n\n }\n\n hasNext(): boolean {\n if (this.isOverLimits()) {\n return false;\n }\n\n return this.dataSource.hasNext();\n }\n\n next(): T | ITERATION_STATUS {\n let next = this.dataSource.next();\n // @ts-ignore\n this.pos++;\n return next;\n }\n\n lookAhead(cnt= 1): ITERATION_STATUS | T {\n return this.dataSource.lookAhead(cnt);\n }\n\n\n\n current(): T | ITERATION_STATUS {\n return this.dataSource.current();\n }\n\n reset(): void {\n this.dataSource.reset();\n this.pos = -1;\n this._limits = -1;\n }\n\n /**\n * concat for streams, so that you can concat two streams together\n * @param toAppend\n */\n concat(...toAppend: Array<IStream<T>>): LazyStream<T> {\n //this.dataSource = new MultiStreamDatasource<T>(this, ... toAppend);\n //return this;\n return LazyStream.ofStreamDataSource(new MultiStreamDatasource(this, toAppend as any) as any)\n //return LazyStream.of(<IStream<T>>this, ...toAppend).flatMap(item => item);\n }\n\n nextFilter(fn: Matchable<T>): T | ITERATION_STATUS {\n if (this.hasNext()) {\n let newVal: T = this.next() as T;\n if (!fn(newVal)) {\n return this.nextFilter(fn);\n }\n return <T>newVal;\n }\n return null as any;\n }\n\n limits(max: number): LazyStream<T> {\n this._limits = max;\n return this;\n }\n\n //main stream methods\n collect(collector: ICollector<T, any>): any {\n while (this.hasNext()) {\n let t = this.next();\n collector.collect(<T>t);\n }\n this.reset();\n return collector.finalValue;\n }\n\n onElem(fn: IteratableConsumer<T>): LazyStream<T> {\n return new LazyStream(new MappedStreamDataSource((el) => {\n if (fn(el as T, this.pos) === false) {\n this.stop();\n }\n return el;\n }, this));\n }\n\n filter(fn?: Matchable<T>): LazyStream<T> {\n return <LazyStream<T>>new LazyStream<T>(new FilteredStreamDatasource<any>(fn!, this));\n }\n\n map<R>(fn?: Mappable<T, R>): LazyStream<any> {\n return new LazyStream(new MappedStreamDataSource(fn as any, this));\n }\n\n flatMap<R>(fn?: ((data: T) => R | Array<any>)): LazyStream<any> {\n return new LazyStream<any>(new FlatMapStreamDataSource(fn as any, this));\n }\n\n //endpoint\n each(fn: IteratableConsumer<T>) {\n while (this.hasNext()) {\n if (fn(this.next() as T) === false) {\n this.stop();\n }\n }\n this.reset();\n }\n\n reduce<V>(fn: Reducable<T, V>, startVal: T | V | null = null): Optional<T | V> {\n if (!this.hasNext()) {\n return Optional.absent;\n }\n let value1: T | V | ITERATION_STATUS;\n let value2: T | ITERATION_STATUS = ITERATION_STATUS.EO_STRM;\n if (startVal != null) {\n value1 = startVal;\n value2 = this.next();\n } else {\n value1 = this.next();\n if (!this.hasNext()) {\n return Optional.fromNullable(value1 as T | V);\n }\n value2 = this.next();\n }\n value1 = fn(value1 as T | V, value2 as T);\n while (this.hasNext()) {\n value2 = this.next();\n value1 = fn(value1 as T | V, value2 as T);\n }\n this.reset();\n return Optional.fromNullable(value1);\n }\n\n last(): Optional<T> {\n if (!this.hasNext()) {\n return Optional.absent;\n }\n return this.reduce((el1, el2) => el2);\n }\n\n first(): Optional<T> {\n this.reset();\n if (!this.hasNext()) {\n return Optional.absent;\n }\n return Optional.fromNullable(this.next() as T);\n }\n\n anyMatch(fn: Matchable<T>): boolean {\n while (this.hasNext()) {\n if (fn(this.next() as T)) {\n return true;\n }\n }\n return false;\n }\n\n allMatch(fn: Matchable<T>): boolean {\n while (this.hasNext()) {\n if (!fn(this.next() as T)) {\n return false;\n }\n }\n return true;\n }\n\n noneMatch(fn: Matchable<T>): boolean {\n while (this.hasNext()) {\n if (fn(this.next() as T)) {\n return false;\n }\n }\n return true;\n }\n\n sort(comparator: Comparator<T>): IStream<T> {\n let arr = this.collect(new ArrayCollector());\n arr = arr.sort(comparator);\n return LazyStream.ofArr(arr);\n }\n\n get value(): Array<T> {\n return this.collect(new ArrayCollector<T>());\n }\n\n [Symbol.iterator]() : Iterator<T> {\n return {\n next: () => {\n let done = !this.hasNext();\n let val = this.next();\n return {\n done: done,\n value: <T>val\n }\n }\n }\n }\n\n /*get observable(): Observable<T> {\n return from(this);\n }*/\n\n private stop() {\n this.pos = this._limits + 1000000000;\n this._limits = 0;\n }\n\n private isOverLimits() {\n return this._limits != -1 && this.pos >= this._limits - 1;\n }\n\n}\n\n\n/**\n * 1.0 backwards compatibility functions\n *\n * this restores the stream and lazy stream\n * property on DomQuery on prototype level\n *\n */\n\nObject.defineProperty(DomQuery.prototype, \"stream\", {\n get: function stream(){\n return Stream.ofDomQuery(this);\n }\n})\n\n\nObject.defineProperty(DomQuery.prototype, \"lazyStream\", {\n get: function lazyStream(){\n return LazyStream.ofDomQuery(this);\n }\n})\n","/*!\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//poliyfill from @webcomponents/webcomponentsjs\nimport {DomQuery} from \"./DomQuery\";\nimport {_global$} from \"./Global\";\n\n\nif (\"undefined\" != typeof _global$) {\n (function () {\n if (void 0 === _global$().Reflect || void 0 === _global$().customElements || (_global$().customElements).polyfillWrapFlushCallback as any) return;\n const a = HTMLElement;\n _global$().HTMLElement = {\n HTMLElement: function HTMLElement() {\n return Reflect.construct(a, [], this.constructor)\n }\n }.HTMLElement, HTMLElement.prototype = a.prototype, HTMLElement.prototype.constructor = HTMLElement, Object.setPrototypeOf(HTMLElement, a);\n })();\n}\n\n/**\n * beginning custom tag support\n *\n * This api is still experimental\n * and might be interwoven with DomQuery\n * so it is bound to change\n *\n * it follows a builder pattern to allow easier creations\n * with less code of custom tags\n */\nexport class TagBuilder {\n tagName: string;\n connectedCallback?: Function;\n clazz?: CustomElementConstructor;\n extendsType: CustomElementConstructor = HTMLElement;\n theOptions!: ElementDefinitionOptions | null;\n markup!: string;\n disconnectedCallback?: Function;\n adoptedCallback ?: Function;\n attributeChangedCallback ?: Function;\n observedAttrs: string[] = [];\n\n // noinspection JSUnusedGlobalSymbols\n static withTagName(tagName: string): TagBuilder {\n return new TagBuilder(tagName);\n }\n\n // noinspection JSUnusedGlobalSymbols\n constructor(tagName: string) {\n this.tagName = tagName;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withObservedAttributes(...oAttrs: string[]) {\n this.observedAttrs = oAttrs;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withConnectedCallback(callback: Function) {\n this.connectedCallback = callback;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withDisconnectedCallback(callback: Function) {\n this.disconnectedCallback = callback;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withAdoptedCallback(callback: Function) {\n this.adoptedCallback = callback;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withAttributeChangedCallback(callback: Function) {\n this.attributeChangedCallback = callback;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withExtendsType(extendsType: CustomElementConstructor) {\n this.extendsType = extendsType;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withOptions(theOptions: ElementDefinitionOptions) {\n this.theOptions = theOptions;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withClass(clazz: CustomElementConstructor) {\n if (this.markup) {\n throw Error(\"Markup already defined, markup must be set in the class\");\n }\n this.clazz = clazz;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n withMarkup(markup: string) {\n if (this.clazz) {\n throw Error(\"Class already defined, markup must be set in the class\");\n }\n this.markup = markup;\n return this;\n }\n\n // noinspection JSUnusedGlobalSymbols\n register() {\n if (!this.clazz && !this.markup) {\n throw Error(\"Class or markup must be defined\")\n }\n if (this.clazz) {\n\n let applyCallback = (name: string) => {\n let outerCallback = (this as any)[name];\n let protoCallback = (this.clazz!.prototype as any)[name];\n let finalCallback = outerCallback || protoCallback;\n if (finalCallback) {\n (this.clazz!.prototype as any)[name] = function () {\n if(outerCallback) {\n finalCallback.apply(DomQuery.byId(this));\n } else {\n protoCallback.apply(this as any);\n }\n }\n }\n }\n\n applyCallback(\"connectedCallback\");\n applyCallback(\"disconnectedCallback\");\n applyCallback(\"adoptedCallback\");\n applyCallback(\"attributeChangedCallback\");\n\n //TODO how do we handle the oAttrs?\n if (this.observedAttrs.length) {\n Object.defineProperty(this.clazz.prototype, \"observedAttributes\", {\n get(): any {\n return this.observedAttrs;\n }\n });\n }\n\n _global$().customElements.define(this.tagName, this.clazz, this.theOptions || null);\n } else {\n let _t_ = this;\n let applyCallback = (name: string, scope: any) => {\n if ((_t_ as any)[name]) {\n (_t_ as any)[name].apply(DomQuery.byId(scope) as any);\n }\n };\n\n _global$().customElements.define(this.tagName, class extends this.extendsType {\n constructor() {\n super();\n this.innerHTML = _t_.markup;\n }\n\n // noinspection JSUnusedGlobalSymbols\n static get observedAttributes() {\n return _t_.observedAttrs;\n }\n\n // noinspection JSUnusedGlobalSymbols\n connectedCallback() {\n applyCallback(\"connectedCallback\", this);\n }\n\n // noinspection JSUnusedGlobalSymbols\n disconnectedCallback() {\n applyCallback(\"disconnectedCallback\", this);\n }\n\n // noinspection JSUnusedGlobalSymbols\n adoptedCallback() {\n applyCallback(\"adoptedCallback\", this);\n }\n\n // noinspection JSUnusedGlobalSymbols\n attributeChangedCallback() {\n applyCallback(\"attributeChangedCallback\", this);\n }\n\n }, this.theOptions || null);\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * [export const] constants\n */\n\nexport const XML_ATTR_NAMED_VIEWROOT = \"namedViewRoot\";\nexport const NAMED_VIEWROOT = \"namedViewRoot\";\n\nexport const P_AJAX_SOURCE = \"jakarta.faces.source\";\nexport const NAMING_CONTAINER_ID = \"myfaces.NamingContainerId\";\n\nexport const VIEW_ID = \"myfaces.viewId\";\nexport const P_VIEWSTATE = \"jakarta.faces.ViewState\";\nexport const P_CLIENT_WINDOW = \"jakarta.faces.ClientWindow\";\nexport const P_VIEWROOT = \"jakarta.faces.ViewRoot\";\nexport const P_VIEWHEAD = \"jakarta.faces.ViewHead\";\nexport const P_VIEWBODY = \"jakarta.faces.ViewBody\";\n\nexport const P_RESOURCE = \"jakarta.faces.Resource\";\n\n/*some useful definitions*/\n\nexport const EMPTY_FUNC = Object.freeze(() => {\n});\nexport const EMPTY_STR = \"\";\nexport const EMPTY_MAP = Object.freeze({});\n\nexport const HTML_VIEWSTATE = [\"<input type='hidden'\", \"name='\", P_VIEWSTATE, \"' value='' />\"].join(EMPTY_STR);\nexport const HTML_CLIENT_WINDOW = [\"<input type='hidden'\", \"' name='\", P_CLIENT_WINDOW, \"' value='' />\"].join(EMPTY_STR);\n\n\n/*internal identifiers for options*/\nexport const IDENT_ALL = \"@all\";\nexport const IDENT_NONE = \"@none\";\nexport const IDENT_THIS = \"@this\";\nexport const IDENT_FORM = \"@form\";\n\n\nexport const P_AJAX = \"jakarta.faces.partial.ajax\";\nexport const P_EXECUTE = \"jakarta.faces.partial.execute\";\nexport const P_RENDER = \"jakarta.faces.partial.render\";\n/*render override for viewbody or viewroot, in both cases an all is performed*/\nexport const P_RENDER_OVERRIDE = \"_myfaces.rendeOverride\";\nexport const P_EVT = \"jakarta.faces.partial.event\";\n\nexport const P_RESET_VALUES = \"jakarta.faces.partial.resetValues\";\nexport const P_WINDOW_ID = \"jakarta.faces.windowId\";\n\nexport const P_BEHAVIOR_EVENT = \"jakarta.faces.behavior.event\";\n\nexport const CTX_PARAM_RENDER = \"render\";\nexport const WINDOW_ID = \"windowId\";\n\n/* message types */\nexport const ERROR = \"error\";\nexport const EVENT = \"event\";\n\nexport const ON_ERROR = \"onerror\";\nexport const ON_EVENT = \"onevent\";\n\n/* event emitting stages */\nexport const BEGIN = \"begin\";\nexport const COMPLETE = \"complete\";\nexport const SUCCESS = \"success\";\n\nexport const SOURCE = \"source\";\nexport const STATUS = \"status\";\n\n\nexport const ERROR_NAME = \"error-name\";\nexport const ERROR_MESSAGE = \"error-message\";\n\n\nexport const RESPONSE_TEXT = \"responseText\";\nexport const RESPONSE_XML = \"responseXML\";\n\n/*ajax errors spec 14.4.2*/\nexport const HTTP_ERROR = \"httpError\";\nexport const EMPTY_RESPONSE = \"emptyResponse\";\nexport const MALFORMEDXML = \"malformedXML\";\nexport const SERVER_ERROR = \"serverError\";\nexport const CLIENT_ERROR = \"clientError\";\nexport const TIMEOUT_EVENT = \"timeout\";\n\nexport const CTX_OPTIONS_PARAMS = \"params\";\nexport const CTX_OPTIONS_DELAY = \"delay\";\nexport const DELAY_NONE = 'none';\nexport const CTX_OPTIONS_TIMEOUT = \"timeout\";\nexport const CTX_OPTIONS_RESET = \"resetValues\";\nexport const CTX_OPTIONS_EXECUTE = \"execute\";\n\nexport const CTX_PARAM_MF_INTERNAL = \"myfaces.internal\";\nexport const CTX_PARAM_SRC_FRM_ID = \"myfaces.source.formId\";\nexport const CTX_PARAM_UPLOAD_ON_PROGRESS = \"myfaces.upload.progress\";\nexport const CTX_PARAM_UPLOAD_PREINIT = \"myfaces.upload.preinit\";\nexport const CTX_PARAM_UPLOAD_LOADSTART = \"myfaces.upload.loadstart\";\nexport const CTX_PARAM_UPLOAD_LOADEND = \"myfaces.upload.loadend\";\nexport const CTX_PARAM_UPLOAD_LOAD = \"myfaces.upload.load\";\nexport const CTX_PARAM_UPLOAD_ERROR = \"myfaces.upload.error\";\nexport const CTX_PARAM_UPLOAD_ABORT = \"myfaces.upload.abort\";\nexport const CTX_PARAM_UPLOAD_TIMEOUT = \"myfaces.upload.timeout\";\nexport const CTX_PARAM_SRC_CTL_ID = \"myfaces.source.controlId\";\nexport const CTX_PARAM_REQ_PASS_THR = \"myfaces.request.passThrough\";\nexport const CTX_PARAM_PPS = \"myfaces.request.pps\";\n\nexport const CONTENT_TYPE = \"Content-Type\";\nexport const HEAD_FACES_REQ = \"Faces-Request\";\nexport const REQ_ACCEPT = \"Accept\";\nexport const VAL_AJAX = \"partial/ajax\";\nexport const ENCODED_URL = \"jakarta.faces.encodedURL\";\nexport const REQ_TYPE_GET = \"GET\";\nexport const REQ_TYPE_POST = \"POST\";\nexport const STATE_EVT_BEGIN = \"begin\"; //TODO remove this\nexport const STATE_EVT_TIMEOUT = \"TIMEOUT_EVENT\";\nexport const STATE_EVT_COMPLETE = \"complete\"; //TODO remove this\nexport const URL_ENCODED = \"application/x-www-form-urlencoded\";\nexport const MULTIPART = \"multipart/form-data\";\nexport const NO_TIMEOUT = 0;\nexport const STD_ACCEPT = \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\";\n\nexport const HTML_TAG_HEAD = \"HEAD\";\nexport const HTML_TAG_FORM = \"FORM\";\nexport const HTML_TAG_BODY = \"BODY\";\nexport const HTML_TAG_LINK = \"LINK\";\nexport const HTML_TAG_SCRIPT = \"SCRIPT\";\nexport const HTML_TAG_STYLE = \"STYLE\";\n\n\nexport const SEL_VIEWSTATE_ELEM = \"[name='\" + P_VIEWSTATE + \"']\";\nexport const SEL_CLIENT_WINDOW_ELEM = \"[name='\" + P_CLIENT_WINDOW + \"']\";\nexport const SEL_RESPONSE_XML = \"responseXML\";\n\nexport const PHASE_PROCESS_RESPONSE = \"processResponse\";\n\n\nexport const ERR_NO_PARTIAL_RESPONSE = \"Partial response not set\";\n\nexport const MYFACES_OPTION_PPS = \"pps\";\n\nexport const ATTR_URL = \"url\";\nexport const ATTR_NAME = \"name\";\nexport const ATTR_VALUE = \"value\";\nexport const ATTR_ID = \"id\";\n\n/*partial response types*/\nexport const XML_TAG_PARTIAL_RESP = \"partial-response\";\n\n/*partial commands*/\nexport const XML_TAG_CHANGES = \"changes\";\nexport const XML_TAG_UPDATE = \"update\";\nexport const XML_TAG_DELETE = \"delete\";\nexport const XML_TAG_INSERT = \"insert\";\nexport const XML_TAG_EVAL = \"eval\";\nexport const XML_TAG_ERROR = \"error\";\nexport const XML_TAG_ATTRIBUTES = \"attributes\";\nexport const XML_TAG_EXTENSION = \"extension\";\nexport const XML_TAG_REDIRECT = \"redirect\";\nexport const XML_TAG_BEFORE = \"before\";\nexport const XML_TAG_AFTER = \"after\";\nexport const XML_TAG_ATTR = \"attribute\";\n\n\n/*other constants*/\n\nexport const UPDATE_FORMS = \"myfaces.updateForms\";\nexport const UPDATE_ELEMS = \"myfaces.updateElems\";\n\n//we want the head elements to be processed before we process the body\n//but after the inner html is done\nexport const DEFERRED_HEAD_INSERTS = \"myfaces.headElems\";\n\nexport const MYFACES = \"myfaces\";\n\nexport const MF_NONE = \"__mf_none__\";\n\nexport const REASON_EXPIRED = \"Expired\";\n\nexport const APPLIED_VST = \"myfaces.appliedViewState\";\nexport const APPLIED_CLIENT_WINDOW = \"myfaces.appliedClientWindow\";\n\nexport const RECONNECT_INTERVAL = 500;\nexport const MAX_RECONNECT_ATTEMPTS = 25;\n\nexport const UNKNOWN = \"UNKNOWN\";\n\n/**\n * helper to remap the namespaces variables for 2.3\n * from 2.3 to 4.0 every javax namespace has been changed\n * to faces\n * To take the compatibility layer out this method just has to be\n * changed to a simple value passthrough\n */\n\nexport function $faces(): typeof faces {\n return window?.faces ?? window?.jsf;\n}\n\nexport function $nsp(inputNamespace?: any): any {\n if((!inputNamespace) || !inputNamespace?.replace) {\n return inputNamespace;\n }\n return (!!window?.faces) ? inputNamespace.replace(/javax\\.faces/gi,\"jakarta.faces\"): inputNamespace.replace(/jakarta\\.faces/gi, \"javax.faces\");\n}\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class Messages {\n MSG_TEST = \"Testmessage\";\n\n /*Messages*/\n /** @constant */\n MSG_DEV_MODE = \"Note, this message is only sent, because project stage is development and no \" +\n \"other error listeners are registered.\";\n /** @constant */\n MSG_AFFECTED_CLASS = \"Affected Class=\";\n /** @constant */\n MSG_AFFECTED_METHOD = \"Affected Method=\";\n /** @constant */\n MSG_ERROR_NAME = \"Error Name=\";\n /** @constant */\n MSG_ERROR_MESSAGE = \"Error Message=\";\n /** @constant */\n MSG_SERVER_ERROR_NAME = \"Server Error Name=\";\n\n /** @constant */\n MSG_ERROR_DESC = \"Error Description=\";\n /** @constant */\n MSG_ERROR_NO = \"Error Number=\";\n /** @constant */\n MSG_ERROR_LINENO = \"Error Line Number=\";\n\n /*Errors and messages*/\n /** @constant */\n ERR_FORM = \"Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing\";\n /** @constant */\n ERR_VIEWSTATE = \"faces.viewState= param value not of type form!\";\n /** @constant */\n ERR_TRANSPORT = \"Transport type {0} does not exist\";\n /** @constant */\n ERR_EVT_PASS = \"an event must be passed down (either an event object null or undefined) \";\n /** @constant */\n ERR_CONSTRUCT = \"Parts of the response couldn't be retrieved when constructing the event data= {0} \";\n /** @constant */\n ERR_MALFORMEDXML = \"The server response could not be parsed, the server has returned with a response which is not xml !\";\n /** @constant */\n ERR_SOURCE_FUNC = \"source cannot be a function (probably source and event were not defined or set to null\";\n /** @constant */\n ERR_EV_OR_UNKNOWN = \"An event object or unknown must be passed as second parameter\";\n /** @constant */\n ERR_SOURCE_NOSTR = \"source cannot be a string\";\n /** @constant */\n ERR_SOURCE_DEF_NULL = \"source must be defined or null\";\n\n //_Lang.js\n /** @constant */\n ERR_MUST_STRING = \"{0}: {1} namespace must be of type String\";\n /** @constant */\n ERR_REF_OR_ID = \"{0}: {1} a reference node or identifier must be provided\";\n /** @constant */\n ERR_PARAM_GENERIC = \"{0}: parameter {1} must be of type {2}\";\n /** @constant */\n ERR_PARAM_STR = \"{0}: {1} param must be of type string\";\n /** @constant */\n ERR_PARAM_STR_RE = \"{0}: {1} param must be of type string or a regular expression\";\n /** @constant */\n ERR_PARAM_MIXMAPS = \"{0}: both a source as well as a destination map must be provided\";\n /** @constant */\n ERR_MUST_BE_PROVIDED = \"{0}: an {1} and a {2} must be provided\";\n /** @constant */\n ERR_MUST_BE_PROVIDED1 = \"{0}: {1} must be set\";\n\n /** @constant */\n ERR_REPLACE_EL = \"replaceElements called while evalNodes is not an array\";\n\n /** @constant */\n ERR_EMPTY_RESPONSE = \"{0}: The response cannot be null or empty!\";\n /** @constant */\n ERR_ITEM_ID_NOTFOUND = \"{0}: item with identifier {1} could not be found\";\n /** @constant */\n ERR_PPR_IDREQ = \"{0}: Error in PPR Insert, id must be present\";\n /** @constant */\n ERR_PPR_INSERTBEFID = \"{0}: Error in PPR Insert, before id or after id must be present\";\n /** @constant */\n ERR_PPR_INSERTBEFID_1 = \"{0}: Error in PPR Insert, before node of id {1} does not exist in document\";\n /** @constant */\n ERR_PPR_INSERTBEFID_2 = \"{0}: Error in PPR Insert, after node of id {1} does not exist in document\";\n\n /** @constant */\n ERR_PPR_DELID = \"{0}: Error in delete, id not in xml markup\";\n /** @constant */\n ERR_PPR_UNKNOWNCID = \"{0}: Unknown Html-Component-ID= {1}\";\n\n /** @constant */\n ERR_NO_VIEWROOTATTR = \"{0}: Changing of ViewRoot attributes is not supported\";\n /** @constant */\n ERR_NO_HEADATTR = \"{0}: Changing of Head attributes is not supported\";\n /** @constant */\n ERR_RED_URL = \"{0}: Redirect without url\";\n\n /** @constant */\n ERR_REQ_FAILED_UNKNOWN = \"Request failed with unknown status\";\n\n /** @constant */\n ERR_REQU_FAILED = \"Request failed with status {0} and reason {1}\";\n\n /** @constant */\n UNKNOWN = \"UNKNOWN\";\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, IValueHolder, Optional, DomQuery, DQ, Es2019Array, ValueEmbedder} from \"mona-dish\";\nimport {$faces, $nsp, P_WINDOW_ID} from \"../core/Const\";\n\n\n/**\n * detects whether a source is a faces.js request\n *\n * @param source the source string for the faces.js request\n * @return true if a faces.js loading pattern is detected\n * @constructor\n */\nconst IS_FACES_SOURCE = (source?: string): boolean => {\n //spec version smaller 4 we have to deal with the jsf namespace\n\n return !!source && !!(source.search(/\\/jakarta\\.faces\\.resource.*\\/faces\\.js.*/) != -1 ||\n source?.search(/\\/faces-development\\.js.*/) != -1 ||\n source?.search(/\\/faces-uncompressed\\.js.*/) != -1 ||\n source?.search(/\\/faces[^.]*\\.js.*ln=jakarta.faces.*/gi) != -1 ||\n //fallback without check for jsf, that way we allow both bookmarks\n source?.search(/\\/javax\\.faces\\.resource.*\\/jsf\\.js.*/) != -1 ||\n source?.search(/\\/jsf-development\\.js.*/) != -1 ||\n source?.search(/\\/jsf-uncompressed\\.js.*/) != -1 ||\n source?.search(/\\/jsf[^.]*\\.js.*ln=javax.faces.*/gi) != -1);\n}\n\n/**\n * namespace myfaces\\.testscripts can be used as extension point for internal\n * tests, those will be handled similarly to faces.js, in regard\n * to reload blocking on ajax requests\n *\n * Note: atm not used, used to be used in the old implementation\n * but still is reserved for now\n *\n * @param source the source to check\n * @constructor\n */\nconst IS_INTERNAL_SOURCE = (source: string): boolean => {\n return source.search(/\\/faces[^.]*\\.js.*ln=myfaces.testscripts.*/gi) != -1 || source.search(/\\/jsf[^.]*\\.js.*ln=myfaces.testscripts.*/gi) != -1;\n}\n\n\nconst ATTR_SRC = 'src';\n\nfunction isRegExpMatchArray(value: RegExpMatchArray | null): value is RegExpMatchArray {\n return value != null && value.length > 1;\n}\n\n/**\n * Extension which adds implementation specific\n * meta-data to our dom query\n *\n * Usage\n * el = new ExtDQ(oldReference)\n * nonce = el.nonce\n * windowId = el.getWindowId\n */\nexport class ExtDomQuery extends DQ {\n\n static get windowId(): Optional<string> {\n return new ExtDomQuery(document.body).windowId;\n }\n\n static get nonce(): Optional<string> {\n return new ExtDomQuery(document.body).nonce;\n }\n\n get windowId(): Optional<string> {\n\n const fetchWindowIdFromURL = function (): string | null {\n let href = window.location.href;\n let windowId = \"windowId\";\n let regex = new RegExp(\"[\\\\?&]\" + windowId + \"=([^&#\\\\;]*)\");\n let results = regex.exec(href);\n //initial trial over the url and a regexp\n if (results != null) return results[1];\n return null;\n };\n\n //byId ($)\n if (this.value.isPresent()) {\n let result = this.querySelectorAll(\"form input[name='\" + P_WINDOW_ID + \"']\");\n if (result.length > 1) {\n throw Error(\"Multiple different windowIds found in document\");\n }\n\n return Optional.fromNullable((result.isPresent()) ? (<HTMLInputElement>result.getAsElem(0).value).value : fetchWindowIdFromURL());\n } else {\n return Optional.fromNullable(fetchWindowIdFromURL());\n }\n }\n\n /*\n * determines the faces.js nonce and adds them to the namespace\n * this is done once and only lazily\n */\n get nonce(): ValueEmbedder<string> {\n //already processed\n let myfacesConfig = new ExtConfig(window.myfaces);\n let globalNonce: IValueHolder<string> = myfacesConfig.getIf(\"config\", \"cspMeta\", \"nonce\");\n if (!!globalNonce.value) {\n return ValueEmbedder.fromNullable(globalNonce);\n }\n\n let curScript = new DQ(document.currentScript);\n //since our baseline atm is ie11 we cannot use document.currentScript globally\n let nonce = curScript.nonce;\n if (nonce.isPresent()) {\n // fast-path for modern browsers\n return ValueEmbedder.fromNullable(nonce);\n }\n // fallback if the currentScript method fails, we just search the jsf tags for nonce, this is\n // the last possibility\n let nonceScript: Optional<DomQuery> = Optional.fromNullable(DQ\n .querySelectorAll(\"script[src], link[src]\").asArray\n .filter((item) => item.nonce.isPresent() && item.attr(ATTR_SRC).value != null)\n .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value ?? undefined))?.[0]);\n if(!nonceScript?.value) {\n return ValueEmbedder.absent as ValueEmbedder<string>;\n }\n\n return new DomQuery(nonceScript.value).nonce;\n }\n\n static searchJsfJsFor(item: RegExp): Optional<String> {\n return new ExtDomQuery(document).searchJsfJsFor(item);\n }\n\n /**\n * searches the embedded faces.js for items like separator char etc.\n * expects a match as variable under position 1 in the result match\n * @param regExp\n */\n searchJsfJsFor(regExp: RegExp): Optional<string> {\n //perfect application for lazy stream\n return Optional.fromNullable(DQ.querySelectorAll(\"script[src], link[src]\").asArray\n .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value ?? undefined))\n .map(item => (item.attr(ATTR_SRC).value ?? \"\").match(regExp))\n .filter(isRegExpMatchArray)\n .map((result) => {\n return decodeURIComponent(result[1]);\n })?.[0]);\n }\n\n // called from base class runScripts, do not delete\n // noinspection JSUnusedGlobalSymbols\n globalEvalSticky(code: string, nonce ?: string): DQ {\n return new ExtDomQuery(super.globalEvalSticky(code, nonce ?? this.nonce.value));\n }\n\n /**\n * decorated run scripts which takes our jsf extensions into consideration\n * (standard DomQuery will let you pass anything)\n * @param sticky if set to true the internally generated element for the script is left in the dom\n * @param whiteListed\n */\n runScripts(sticky = false, whiteListed?: (src: string) => boolean): DomQuery {\n const whitelistFunc = (src: string): boolean => {\n return (whiteListed?.(src) ?? true) && !IS_FACES_SOURCE(src) && !IS_INTERNAL_SOURCE(src);\n };\n return super.runScripts(sticky, whitelistFunc);\n }\n\n /**\n * adds the elements in this ExtDomQuery to the head\n *\n * @param suppressDoubleIncludes checks for existing elements in the head before running the insert\n */\n runHeadInserts(suppressDoubleIncludes = true): void {\n let head = ExtDomQuery.byId(document.head);\n //automated nonce handling\n let processedScripts: DomQuery[] = [];\n\n // the idea is only to run head inserts on resources\n // which do not exist already, that way\n // we can avoid double includes on subsequent resource\n // requests.\n function resourceIsNew(element: DomQuery) {\n if(!suppressDoubleIncludes) {\n return true;\n }\n const tagName = element.tagName.value;\n if(!tagName) {\n // text node they do not have tag names, so we can process them as they are without\n // any further ado\n return true;\n }\n let reference = element.attr(\"href\")\n .orElseLazy(() => element.attr(\"src\").value)\n .orElseLazy(() => element.attr(\"rel\").value);\n\n if (!reference.isPresent()) {\n return true;\n }\n return !head.querySelectorAll(`${tagName}[href='${reference.value}']`).length &&\n !head.querySelectorAll(`${tagName}[src='${reference.value}']`).length &&\n !head.querySelectorAll(`${tagName}[rel='${reference.value}']`).length;\n }\n\n this\n .filter(resourceIsNew)\n .each(element => {\n if(element.tagName.value != \"SCRIPT\") {\n //we need to run runScripts properly to deal with the rest\n new ExtDomQuery(...processedScripts).runScripts(true);\n processedScripts = [];\n head.append(element);\n } else {\n processedScripts.push(element);\n }\n });\n new ExtDomQuery(...processedScripts).runScripts(true);\n }\n\n\n /**\n * byId producer\n *\n * @param selector id\n * @param deep whether the search should go into embedded shadow dom elements\n * @return a DomQuery containing the found elements\n */\n static byId(selector: DomQuery | Element | string, deep = false): ExtDomQuery {\n const ret = DomQuery.byId(selector, deep);\n if($faces().getProjectStage().toLowerCase() == \"development\" &&\n window?.console && ret.isAbsent() && selector) {\n let identifier = (<DomQuery>selector)?.id?.value ?? (<Element>selector)?.id ?? selector.toString();\n console.error(\"Element \" + identifier + \"not found\");\n }\n return new ExtDomQuery(ret);\n }\n\n\n filter(func: (item: DomQuery) => boolean): ExtDomQuery {\n return new ExtDomQuery(super.filter(func));\n }\n}\n\nexport const ExtDQ = ExtDomQuery;\n\n/**\n * in order to reduce the number of interception points for the fallbacks we add\n * the namespace remapping straight to our config accessors\n */\nexport class ExtConfig extends Config {\n\n $nspEnabled = true;\n\n constructor(root: any) {\n super(root);\n }\n\n assignIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.assignIf(condition, ...accessPathMapped);\n }\n\n assign(...accessPath: string[]): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.assign(...accessPathMapped);\n }\n\n append(...accessPath: string[]): IValueHolder<any> {\n return super.append(...accessPath);\n }\n\n appendIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {\n const accessPathMapped = this.remap(accessPath);\n return super.appendIf(condition, ...accessPathMapped);\n }\n\n getIf(...accessPath: string[]): Config {\n const accessPathMapped = this.remap(accessPath);\n return super.getIf(...accessPathMapped);\n }\n\n get(defaultVal: any): Config {\n return super.get($nsp(defaultVal));\n }\n\n delete(key: string): Config {\n return super.delete($nsp(key));\n }\n\n /**\n * creates a config from an initial value or null\n * @param value\n */\n static fromNullable<T>(value?: T | null): Config {\n return new ExtConfig(value);\n }\n\n protected getClass(): any {\n return ExtConfig;\n }\n\n /**\n * shallow copy getter, copies only the first level, references the deeper nodes\n * in a shared manner\n */\n protected shallowCopy$(): Config {\n const ret = super.shallowCopy$();\n return new ExtConfig(ret);\n }\n\n /**\n * deep copy, copies all config nodes\n */\n get deepCopy(): Config {\n return new ExtConfig(super.deepCopy$());\n }\n\n /**\n * helper to remap the namespaces of an array of access paths\n * @param accessPath the access paths to be remapped\n * @private returns an array of access paths with version remapped namespaces\n */\n private remap(accessPath: string[]): string[] {\n if(!this.$nspEnabled) {\n return accessPath;\n }\n return new Es2019Array(...accessPath).map((key: string) => $nsp(key));\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DomQuery, DQ} from \"mona-dish\";\nimport {\n $faces,\n $nsp,\n CTX_OPTIONS_DELAY,\n CTX_OPTIONS_TIMEOUT,\n DELAY_NONE,\n EMPTY_FUNC,\n EMPTY_STR,\n ENCODED_URL, NAMED_VIEWROOT, NAMING_CONTAINER_ID,\n P_VIEWSTATE,\n REQ_TYPE_GET,\n REQ_TYPE_POST\n} from \"../core/Const\";\nimport {XhrFormData} from \"./XhrFormData\";\nimport {ExtLang} from \"../util/Lang\";\nimport {ExtConfig, ExtDomQuery} from \"../util/ExtDomQuery\";\nimport {Assertions} from \"../util/Assertions\";\n\n\n/**\n * Resolver functions for various aspects of the request data\n *\n * stateless because it might be called from various\n * parts of the response classes\n */\n\n/**\n * resolves the event handlers lazily\n * so that if some decoration happens in between we can deal with it\n *\n * @param requestContext\n * @param responseContext\n * @param funcName\n */\nexport function resolveHandlerFunc(requestContext: Config, responseContext: Config, funcName: string) {\n responseContext = responseContext || new Config({});\n return responseContext.getIf(funcName)\n .orElseLazy(() =>requestContext.getIf(funcName).value)\n .orElse(EMPTY_FUNC).value;\n}\n\nexport function resolveTargetUrl(srcFormElement: HTMLFormElement) {\n const formElements = srcFormElement.elements as HTMLFormControlsCollection & {[key: string]: HTMLInputElement};\n return (typeof formElements[ENCODED_URL] == 'undefined') ?\n srcFormElement.action :\n formElements[ENCODED_URL].value;\n}\n\nexport function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, ajaxType = REQ_TYPE_POST) {\n let targetUrl = resolveTargetUrl(<HTMLFormElement>sourceForm.getAsElem(0).value);\n\n return targetUrl + (ajaxType == REQ_TYPE_GET ? \"?\" + formData.toString() : EMPTY_STR);\n}\n\n/**\n * form resolution the same way our old implementation did\n * it is either the id or the parent form of the element or an embedded form\n * of the element\n *\n * @param elem\n * @param event\n */\nexport function resolveForm(elem: DQ, event?: Event): DQ {\n return ExtLang.getForm(elem.getAsElem(0).value, event);\n}\n\nexport function resolveViewId(form: DQ): string {\n const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).id.orElse(\"\").value;\n const divider = $faces().separatorchar;\n const viewId = viewState.split(divider, 2)[0];\n const viewStateViewId = viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : \"\";\n // myfaces specific, we in non portlet environments prepend the viewId\n // even without being in a naming container, the other components ignore that\n return form.id.value.indexOf(viewStateViewId) === 0 ? viewStateViewId : \"\";\n}\n\nexport function resolveViewRootId(form: DQ): string {\n const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).attr(\"name\").orElse(\"\").value;\n const divider = $faces().separatorchar;\n const viewId = viewState.split(divider, 2)[0];\n //different to the identifier the form id is never prepended to the viewstate\n return viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : \"\";\n}\n\n/**\n * as per jsdoc before the request it must be ensured that every post argument\n * is prefixed with the naming container id (there is an exception in mojarra with\n * the element=element param, which we have to follow here as well.\n * (inputs are prefixed by name anyway normally this only affects our standard parameters)\n * @private\n */\nexport function resoveNamingContainerMapper(internalContext: Config): (key: string, value: any) => [string, any] {\n const isNamedViewRoot = internalContext.getIf(NAMED_VIEWROOT).isPresent();\n if(!isNamedViewRoot) {\n return (key, value) => [key, value];\n }\n const partialId = internalContext.getIf(NAMING_CONTAINER_ID).value;\n const SEP = $faces().separatorchar;\n const prefix = partialId + SEP;\n return (key: string, value: any) => (key.indexOf(prefix) == 0) ? [key, value] : [prefix + key, value];\n}\n\nexport function resolveTimeout(options: Config): number {\n let getCfg = ExtLang.getLocalOrGlobalConfig;\n return options.getIf(CTX_OPTIONS_TIMEOUT).value ?? getCfg(options.value, CTX_OPTIONS_TIMEOUT, 0);\n}\n\n/**\n * resolve the delay from the options and/or the request context and or the configuration\n *\n * @param options ... the options object, in most cases it will host the delay value\n */\nexport function resolveDelay(options: Config): number {\n // null, 'none', or undefined will automatically be mapped to 0 aka no delay\n // the config delay will be dropped not needed anymore, it does not really\n // make sense anymore now that it is part of a local spec\n let ret = options.getIf(CTX_OPTIONS_DELAY).orElse(0).value;\n // if delay === none, no delay must be used, aka delay 0\n ret = (DELAY_NONE === ret) ? 0 : ret;\n // negative, or invalid values will automatically get a js exception\n Assertions.assertDelay(ret);\n return ret;\n}\n\n/**\n * resolves the window-id from various sources\n *\n * @param options\n */\nexport function resolveWindowId(options: Config): string | null {\n return options?.value?.windowId ?? ExtDomQuery.windowId.value;\n}\n\n/**\n * cross port from the dojo lib\n * browser save event resolution\n * @param evt the event object\n * (with a fallback for ie events if none is present)\n * @deprecated soon will be removed\n */\nexport function getEventTarget(evt: Event): Element {\n // ie6 and 7 fallback\n let finalEvent = evt;\n /*\n * evt source is defined in the jsf events\n * seems like some component authors use our code,\n * so we add it here see also\n * https://issues.apache.org/jira/browse/MYFACES-2458\n * not entirely a bug but makes sense to add this\n * behavior. I don´t use it that way but nevertheless it\n * does not break anything so why not\n */\n let t = finalEvent?.srcElement ?? finalEvent?.target ?? (finalEvent as any)?.source;\n while ((t) && (t.nodeType != 1)) {\n t = t.parentNode;\n }\n return t;\n}\n\n/**\n * resolves a bunch of default values\n * which can be further processed from the given\n * call parameters of faces.ajax.request\n *\n * @param event\n * @param opts\n * @param el\n */\nexport function resolveDefaults(event?: Event, opts?: Options | [[string, any]] , el: Element | string | null = null): any {\n //deep copy the options, so that further transformations to not backfire into the callers\n const elem = DQ.byId(el || (event as Event).target as Element, true);\n const options = new ExtConfig(opts).deepCopy as ExtConfig;\n return {\n options: options,\n elem: elem,\n elementId: elem.id.value,\n windowId: resolveWindowId(options),\n isResetValues: true === options.value?.resetValues\n };\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {Lang as LangBase, Config, Optional, DomQuery, DQ} from \"mona-dish\";\nimport {Messages} from \"../i18n/Messages\";\nimport {EMPTY_STR, HTML_TAG_FORM} from \"../core/Const\";\nimport {getEventTarget} from \"../xhrCore/RequestDataResolver\";\nimport {Es2019Array} from \"mona-dish\";\n\n\nexport namespace ExtLang {\n\n let installedLocale: Messages;\n const nameSpace = \"impl/util/Lang/\";\n\n export function getLanguage(): string {\n //TODO global config override\n\n const language: string = (navigator as any).languages?.[0] ?? navigator?.language ?? \"en\";\n return language.split(\"-\")[0];\n }\n\n //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those\n /**\n * helper function to safely resolve anything\n * this is not an elvis operator, it resolves\n * a value without exception in a tree and if\n * it is not resolvable then an optional of\n * a default value is restored or Optional\\.empty\n * if none is given\n *\n * usage\n * <code>\n * let var: Optional<string> = saveResolve(() => a.b.c.d.e, \"foobaz\")\n * </code>\n *\n * @param resolverProducer a lambda which can produce the value\n * @param defaultValue an optional default value if the producer fails to produce anything\n * @returns an Optional of the produced value\n */\n export function failSaveResolve<T>(resolverProducer: () => T, defaultValue: T | null = null): Optional<T | null> {\n return LangBase.saveResolve(resolverProducer, defaultValue);\n }\n\n /**\n * under some conditions it makes sense to swallow errors and return a default value in the error case\n * classical example the optional resolution of values in a chain (thankfully now covered by Typescript itself)\n * another example which we have in our system is that some operations fail only under test due to test framework\n * limitations while they cannot fail in the real world.\n *\n * @param resolverProducer a producer function which produces a value in the non error case\n * @param defaultValue the default value in case of a fail of the function\n */\n export function failSaveExecute<T>(resolverProducer: () => any, defaultValue: T | null = null): void {\n LangBase.saveResolve(resolverProducer, defaultValue);\n }\n\n /**\n * returns a given localized message upon a given key\n * basic java log like templating functionality is included\n *\n * @param key the key for the message\n * @param defaultMessage optional default message if none was found\n *\n * Additionally, you can pass additional arguments, which are used\n * in the same way java log templates use the params\n *\n * @param templateParams the param list to be filled in\n */\n export function getMessage(key: string, defaultMessage?: string, ...templateParams: Array<string>): string {\n installedLocale = installedLocale ?? new Messages();\n\n let msg = (installedLocale as any)[key] ?? defaultMessage ?? key;\n templateParams.forEach((param, cnt) => {\n msg = msg.replace(new RegExp([\"\\\\{\", cnt, \"\\\\}\"].join(EMPTY_STR), \"g\"), param);\n });\n return msg;\n }\n\n /**\n * transforms a key value pair into a string\n * @param key the key\n * @param val the value\n * @param delimiter the delimiter\n */\n export function keyValToStr(key: string, val: string, delimiter: string = \"\\n\"): string {\n return [key, val].join(delimiter);\n }\n\n /**\n * creates an exception with additional internal parameters\n * for extra information\n *\n * @param error\n * @param title the exception title\n * @param name the exception name\n * @param callerCls the caller class\n * @param callFunc the caller function\n * @param message the message for the exception\n */\n export function makeException(error: Error, title: string, name: string, callerCls: string, callFunc: string, message: string): Error {\n\n return new Error(message + (callerCls ?? nameSpace) + callFunc );\n\n }\n\n /**\n * fetches a global config entry\n * @param configName the name of the configuration entry\n * @param defaultValue\n *\n * @return either the config entry or if none is given the default value\n */\n export function getGlobalConfig(configName: string, defaultValue: any): any {\n /**\n * note we could use exists but this is a heavy operation, since the config name usually\n * given this function here is called very often\n * is a single entry without . in between we can do the lighter shortcut\n */\n return window?.myfaces?.config?.[configName] ?? defaultValue;\n }\n\n /**\n * fetches the form in a fuzzy manner depending\n * on an element or event target.\n *\n * The idea is that according to the jsf spec\n * the enclosing form of the issuing element needs to be fetched.\n *\n * This is fine, but since then html5 came into the picture with the form attribute the element\n * can be anywhere referencing its parent form.\n *\n * Also, theoretically you can have the case of an issuing element enclosing a set of forms\n * (not really often used, but theoretically it could be input button allows to embed html for instance)\n *\n * So the idea is not to limit the issuing form determination to the spec case\n * but also cover the theoretical and html5 corner case.\n *\n * @param elem\n * @param event\n */\n export function getForm(elem: Element, event ?: Event): DQ | never {\n\n const queryElem = new DQ(elem);\n const eventTarget = (event) ? new DQ(getEventTarget(event)) : DomQuery.absent;\n\n if (queryElem.isTag(HTML_TAG_FORM)) {\n return queryElem;\n }\n\n //html 5 for handling\n if (queryElem.attr(HTML_TAG_FORM).isPresent()) {\n const formId = queryElem.attr(HTML_TAG_FORM).value;\n const foundForm = DQ.byId(formId as any, true);\n if (foundForm.isPresent()) {\n return foundForm;\n }\n }\n\n //no direct form is found we look for parent/child relationships as fallback\n //(90% case)\n let form = queryElem.firstParent(HTML_TAG_FORM)\n .orElseLazy(() => queryElem.byTagName(HTML_TAG_FORM, true))\n .orElseLazy(() => eventTarget.firstParent(HTML_TAG_FORM))\n .orElseLazy(() => eventTarget.byTagName(HTML_TAG_FORM))\n .first();\n\n //either a form is found within parent child - nearest form (aka first)\n //or we look for a single form\n form = form.orElseLazy(() => DQ.byTagName(HTML_TAG_FORM));\n\n //the end result must be a found form otherwise - Exception\n assertOnlyOneFormExists(form);\n\n return form;\n }\n\n /**\n * gets the local or global options with local ones having higher priority\n * if no local or global one was found then the default value is given back\n *\n * @param configName the name of the configuration entry\n * @param localOptions the local options root for the configuration myfaces as default marker is added\n * implicitly\n *\n * @param defaultValue\n *\n * @return either the config entry or if none is given the default value\n */\n export function getLocalOrGlobalConfig(localOptions: Config, configName: string, defaultValue: any): any {\n return localOptions.value?.myfaces?.config?.[configName] ??\n window?.myfaces?.config?.[configName] ??\n defaultValue;\n }\n\n /**\n * expands an associative array into an array of key value tuples\n * @param value\n */\n export function ofAssoc(value: {[key: string]: any}): Array<[string, any]> {\n return new Es2019Array(...Object.keys(value))\n .map((key: string) => [key, value[key]]);\n }\n\n export function collectAssoc(target: any, item: any): any {\n target[item[0]] = item[1];\n return target;\n }\n\n /**\n * The active timeout for the \"debounce\".\n * Since we only use it in the XhrController\n * we can use a local module variable here\n */\n let activeTimeouts: {[key: string]: ReturnType<typeof setTimeout>} = {};\n\n\n\n\n /**\n * a simple debounce function\n * which waits until a timeout is reached and\n * if something comes in in between debounces\n *\n * @param runnable a runnable which should go under debounce control\n * @param timeout a timeout for the debounce window\n */\n export function debounce(key: string, runnable: Function, timeout: number): void {\n function clearActiveTimeout() {\n clearTimeout(activeTimeouts[key]);\n delete activeTimeouts[key];\n }\n\n if (!!(activeTimeouts?.[key])) {\n clearActiveTimeout();\n }\n if (timeout > 0) {\n activeTimeouts[key] = setTimeout(() => {\n try {\n runnable();\n } finally {\n clearActiveTimeout();\n }\n }, timeout);\n } else {\n runnable();\n }\n }\n\n /**\n * assert that the form exists and only one form exists and throw an exception in the case it does not\n *\n * @param forms the form to check for\n */\n function assertOnlyOneFormExists(forms: DomQuery): void | never {\n if (forms.isAbsent() || forms.length > 1) {\n throw makeException(new Error(), null as any, null as any, \"Impl\", \"getForm\", getMessage(\"ERR_FORM\"));\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, Lang, XMLQuery} from \"mona-dish\";\n\nimport {DQ} from \"mona-dish\";\nimport {\n ATTR_URL,\n EMPTY_RESPONSE,\n EMPTY_STR, ERR_NO_PARTIAL_RESPONSE, MALFORMEDXML,\n ON_ERROR,\n ON_EVENT,\n PHASE_PROCESS_RESPONSE,\n XML_TAG_PARTIAL_RESP\n} from \"../core/Const\";\nimport {ExtLang} from \"./Lang\";\n\n\n/**\n * a set of internal code assertions\n * which raise an error\n *\n */\nexport namespace Assertions {\n\n\n\n export function assertRequestIntegrity(options: Config, elem: DQ): void | never {\n /*assert if the onerror is set and once if it is set it must be of type function*/\n assertFunction(options.getIf(ON_ERROR).value);\n /*assert if the onevent is set and once if it is set it must be of type function*/\n assertFunction(options.getIf(ON_EVENT).value);\n //improve the error messages if an empty elem is passed\n //Assertions.assertElementExists(elem);\n assert(elem.isPresent(), ExtLang.getMessage(\"ERR_MUST_BE_PROVIDED1\", \"{0}: source must be provided or exist\", \"source element id\"), \"faces.ajax.request\", \"ArgNotSet\", )\n }\n\n export function assertUrlExists(node: XMLQuery): void | never {\n if (node.attr(ATTR_URL).isAbsent()) {\n throw Assertions.raiseError(new Error(), ExtLang.getMessage(\"ERR_RED_URL\", undefined, \"processRedirect\"), \"processRedirect\");\n }\n }\n\n /**\n * checks the xml for various issues which can occur\n * and prevent a proper processing\n */\n export function assertValidXMLResponse(responseXML: XMLQuery) : void | never {\n assert(!responseXML.isAbsent(), EMPTY_RESPONSE, PHASE_PROCESS_RESPONSE);\n assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(EMPTY_STR), PHASE_PROCESS_RESPONSE);\n assert(responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP).isPresent(), ERR_NO_PARTIAL_RESPONSE, PHASE_PROCESS_RESPONSE);\n }\n\n /**\n * internal helper which raises an error in the\n * format we need for further processing\n *\n * @param error\n * @param message the message\n * @param caller\n * @param title the title of the error (optional)\n * @param name the name of the error (optional)\n */\n export function raiseError(error: any, message: string, caller ?: string, title ?: string, name ?: string): Error {\n\n let finalTitle = title ?? MALFORMEDXML;\n let finalName = name ?? MALFORMEDXML;\n let finalMessage = message ?? EMPTY_STR;\n\n //TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults\n return ExtLang.makeException(error, finalTitle, finalName, \"Response\", caller || (((arguments as any).caller) ? (arguments as any).caller.toString() : \"_raiseError\"), finalMessage);\n }\n\n /*\n * using the new typescript 3.7 compiler assertion functionality to improve compiler hinting\n * we are not fully there yet, but soon\n */\n\n export function assert(value: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Assertion Error\"): asserts value {\n if(!value) {\n throw Assertions.raiseError(new Error(), msg ,caller, title);\n }\n }\n\n\n export function assertType(value: any, theType: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Type Assertion Error\"): asserts value {\n if((!!value) && !Lang.assertType(value,theType)) {\n throw Assertions.raiseError(new Error(), msg ,caller, title);\n }\n }\n\n export function assertFunction(value: any, msg = EMPTY_STR, caller=EMPTY_STR, title=\"Assertion Error\"): asserts value is Function {\n assertType(value, \"function\", msg, caller, title);\n }\n\n export function assertDelay(value: any) {\n if(!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,\n // including NaN and non numeric strings, no type equality is deliberate here,\n throw new Error(\"Invalid delay value: \" + value);\n }\n }\n}\n\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, DQ} from \"mona-dish\";\nimport {BEGIN, CTX_PARAM_REQ_PASS_THR, EVENT, P_AJAX_SOURCE, SOURCE} from \"../core/Const\";\n\nexport class EventData {\n type!: string;\n status!: string | null;\n source: any;\n responseCode!: number;\n responseText!: string;\n responseXML!: Document | null;\n\n /** @internal */\n static createFromRequest(request: XMLHttpRequest, internalContext: any, context: any, /*event name*/ name: string): EventData {\n\n let eventData = new EventData();\n let internalSource = \"_internal._source\";\n eventData.type = EVENT;\n eventData.status = name;\n\n eventData.source = internalContext.getIf(\"_source\",\"_element\").value;\n // this fixes the issue that the source element is not present anymore at done\n // at page transitions\n if( !eventData.source) {\n let sourceId: string = context.getIf(SOURCE)\n .orElseLazy(() => context.getIf(P_AJAX_SOURCE).value)\n .orElseLazy(() => context.getIf(CTX_PARAM_REQ_PASS_THR, P_AJAX_SOURCE).value)\n .value;\n if (sourceId) {\n eventData.source = DQ.byId(sourceId, true).first().value.value;\n }\n if (eventData.source) {\n //we store the event source for later references\n internalContext.assign(\"_source\",\"_element\").value = eventData.source;\n }\n }\n\n if (name !== BEGIN) {\n eventData.responseCode = request?.status;\n eventData.responseText = request?.responseText;\n eventData.responseXML = request?.responseXML;\n }\n return eventData;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n EMPTY_STR, ERROR,\n ERROR_MESSAGE,\n ERROR_NAME, HTTP_ERROR,\n RESPONSE_TEXT,\n RESPONSE_XML, SERVER_ERROR,\n SOURCE,\n STATUS,\n UNKNOWN\n} from \"../core/Const\";\nimport {Config, DQ, Optional, XMLQuery} from \"mona-dish\";\n\nimport {EventData} from \"./EventData\";\nimport {ExtLang} from \"../util/Lang\";\nconst getMessage = ExtLang.getMessage;\n\n\nexport enum ErrorType {\n SERVER_ERROR = \"serverError\",\n HTTP_ERROR = \"httpError\",\n CLIENT_ERROR = \"clientError\",\n TIMEOUT = \"timeout\"\n}\n\n/**\n * the spec has a problem of having the error\n * object somewhat underspecified, there is no clear\n * description of the required contents.\n * I want to streamline it with mojarra here\n * hence we are going to move\n * everything into the same attributes,\n * I will add deprecated myfaces backwards compatibility attributes as well\n */\nexport class ErrorData extends EventData {\n\n type: string = \"error\";\n source: string | Element;\n\n errorName: string;\n errorMessage: string;\n\n responseText: string;\n responseXML: any;\n\n status: string | null;\n typeDetails: ErrorType;\n\n serverErrorName!: string;\n serverErrorMessage!: string;\n description: string;\n\n /** @internal */\n constructor(source: string | Element, errorName: string, errorMessage: string, responseText: string | null = null, responseXML: Document | null = null, responseCode: number = -1, statusOverride: string | null = null, type = ErrorType.CLIENT_ERROR) {\n super();\n\n ///MYFACES-4676 error payload expects an element if possible\n //this code remaps the string in an element and if not existing just passes as is what comes in\n this.source = DQ.byId(source).value.orElse(source).value;\n this.type = ERROR;\n this.errorName = errorName;\n\n //tck requires that the type is prefixed to the message itself (jsdoc also) in case of a server error\n this.errorMessage = (type == ErrorType.SERVER_ERROR) ? type + \": \" + errorMessage : errorMessage;\n this.responseCode = responseCode;\n this.responseText = responseText as any;\n this.responseXML = responseXML;\n\n this.status = statusOverride;\n\n this.description = `Status: ${this.status}\\nResponse Code: ${this.responseCode}\\nError Message: ${this.errorMessage}`;\n\n this.typeDetails = type;\n\n if (type == ErrorType.SERVER_ERROR) {\n this.serverErrorName = this.errorName;\n this.serverErrorMessage = this.errorMessage;\n }\n }\n\n /** @internal */\n static fromClient(e: Error): ErrorData {\n return new ErrorData((e as any)?.source ?? \"client\", e?.name ?? EMPTY_STR, e?.message ?? EMPTY_STR, e?.stack ?? EMPTY_STR);\n }\n\n /** @internal */\n static fromHttpConnection(source: any, name: string, message: string, responseText: string, responseXML: Document | null, responseCode: number, status: string = EMPTY_STR): ErrorData {\n return new ErrorData(source, name, message, responseText, responseXML, responseCode, status, ErrorType.HTTP_ERROR);\n }\n\n /** @internal */\n static fromGeneric(context: any, errorCode: number, errorType: ErrorType = ErrorType.SERVER_ERROR): ErrorData {\n\n let getMsg = this.getMsg;\n\n let source = getMsg(context, SOURCE);\n let errorName = getMsg(context, ERROR_NAME);\n let errorMessage = getMsg(context, ERROR_MESSAGE);\n let status = getMsg(context, STATUS);\n let responseText = getMsg(context, RESPONSE_TEXT);\n let responseXML: Document | null = context.getIf(RESPONSE_XML).value;\n\n\n return new ErrorData(source, errorName, errorMessage, responseText, responseXML, errorCode, status, errorType);\n }\n\n private static getMsg(context: any, param: string) {\n return getMessage(context.getIf(param).orElse(EMPTY_STR).value);\n }\n\n /** @internal */\n static fromServerError(context: any): ErrorData {\n return this.fromGeneric(context, -1);\n }\n\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {EMPTY_STR, P_VIEWSTATE} from \"./Const\";\n\nexport interface IdValueHolder {\n\n readonly id: string;\n readonly value: string;\n\n}\n\n/**\n * a helper class to isolate the\n * view state and client window and other\n * future states which follow a similar pattern\n */\nexport class StateHolder implements IdValueHolder {\n\n nameSpace: string;\n\n constructor(public id: string, public value: string) {\n let viewStatePos = id.indexOf(P_VIEWSTATE);\n this.nameSpace = viewStatePos > 0 ? id.substr(0, viewStatePos - 1) : EMPTY_STR;\n }\n\n get hasNameSpace(): boolean {\n return !!(this?.nameSpace ?? EMPTY_STR).length;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {DomQuery, DQ, DQ$} from \"mona-dish\";\nimport {$faces, $nsp, HTML_CLIENT_WINDOW, HTML_VIEWSTATE, P_CLIENT_WINDOW, P_VIEWSTATE} from \"../core/Const\";\n\n/**\n * Builder for hidden inputs.\n * ATM only ViewState and Client window\n * are supported (per spec)\n *\n * Improves readability in the response processor!\n */\nexport class HiddenInputBuilder {\n private namingContainerId?: string;\n private parent?: DomQuery;\n private namedViewRoot = false;\n private readonly name: string;\n private readonly template: string;\n\n constructor(selector: string) {\n const isViewState = selector.includes($nsp(P_VIEWSTATE));\n this.name = isViewState ? P_VIEWSTATE : P_CLIENT_WINDOW;\n this.template = isViewState ? HTML_VIEWSTATE : HTML_CLIENT_WINDOW;\n }\n\n withNamingContainerId(namingContainer: string): HiddenInputBuilder {\n this.namingContainerId = namingContainer;\n return this;\n }\n\n withParent(parent: DomQuery): HiddenInputBuilder {\n this.parent = parent;\n return this;\n }\n\n withNamedViewRoot(namedViewRoot: boolean): HiddenInputBuilder {\n this.namedViewRoot = namedViewRoot;\n return this;\n }\n\n\n build(): DomQuery {\n const newElement = DQ.fromMarkup($nsp(this.template));\n newElement.id.value = this.buildId();\n newElement.name.value = this.buildName();\n this.parent?.append(newElement);\n return newElement;\n }\n\n private buildId(): string {\n const separator = $faces().separatorchar;\n const parts = this.namingContainerId?.length ?\n [this.namingContainerId, $nsp(this.name), this.nextIndex()] :\n [$nsp(this.name), this.nextIndex()];\n\n return parts.join(separator);\n }\n\n private buildName(): string {\n if (!this.namedViewRoot) {\n return $nsp(this.name);\n }\n\n return this.namingContainerId?.length ?\n [this.namingContainerId, $nsp(this.name)].join($faces().separatorchar) :\n $nsp(this.name);\n }\n\n private nextIndex(): number {\n const separator = $faces().separatorchar;\n return DQ$(`[name*='${$nsp(this.name)}']`).asArray\n .map(state => state.id.orElse(\"0\").value)\n .map(id => id.substring(id.lastIndexOf(separator) + 1))\n .map(idSuffix => parseInt(idSuffix))\n .filter(idSuffix => !isNaN(idSuffix))\n .reduce((max, idSuffix) => Math.max(max, idSuffix), 0) + 1;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DomQuery, DQ, DQ$, Lang, XMLQuery} from \"mona-dish\";\nimport {Implementation} from \"../AjaxImpl\";\nimport {Assertions} from \"../util/Assertions\";\nimport {IResponseProcessor} from \"./IResponseProcessor\";\nimport {ErrorData} from \"./ErrorData\";\nimport {StateHolder} from \"../core/ImplTypes\";\nimport {EventData} from \"./EventData\";\n\nimport {\n $faces,\n $nsp,\n APPLIED_CLIENT_WINDOW,\n APPLIED_VST,\n ATTR_ID,\n ATTR_NAME,\n ATTR_URL,\n ATTR_VALUE,\n DEFERRED_HEAD_INSERTS,\n EMPTY_FUNC,\n EMPTY_STR,\n ERROR_MESSAGE,\n ERROR_NAME,\n HTML_TAG_BODY,\n HTML_TAG_FORM,\n HTML_TAG_HEAD,\n HTML_TAG_SCRIPT,\n IDENT_ALL, IDENT_NONE, NAMED_VIEWROOT,\n ON_ERROR,\n ON_EVENT,\n P_CLIENT_WINDOW,\n P_EXECUTE,\n P_AJAX_SOURCE,\n P_RENDER,\n P_RENDER_OVERRIDE,\n P_VIEWSTATE,\n NAMING_CONTAINER_ID,\n RESPONSE_XML,\n SEL_CLIENT_WINDOW_ELEM,\n SEL_VIEWSTATE_ELEM,\n SOURCE,\n SUCCESS,\n UPDATE_ELEMS,\n UPDATE_FORMS,\n XML_TAG_AFTER,\n XML_TAG_ATTR,\n XML_TAG_BEFORE\n} from \"../core/Const\";\nimport {ExtConfig, ExtDomQuery} from \"../util/ExtDomQuery\";\nimport {HiddenInputBuilder} from \"../util/HiddenInputBuilder\";\nconst trim = Lang.trim;\nimport {ExtLang} from \"../util/Lang\";\nconst ofAssoc = ExtLang.ofAssoc;\n\n\n/**\n * Response processor\n *\n * Each XML tag is either a node or a leaf\n * or both\n *\n * the processor provides a set of operations\n * which are executed on a single leaf node per operation\n * and present the core functionality of our response\n *\n * Note the response processor is stateful hence we bundle it in a class\n * to reduce code we keep references tot contexts in place\n */\nexport class ResponseProcessor implements IResponseProcessor {\n\n constructor(private request: Config, private externalContext: Config, private internalContext: Config) {\n }\n\n /**\n * head replacement\n * @param shadowDocument incoming shadow head data (aka cdata as xml reference or dom element)\n * the data incoming must represent the html representation of the head itself one way or the other\n */\n replaceHead(shadowDocument: XMLQuery | DQ) {\n const shadowHead = shadowDocument.querySelectorAll(HTML_TAG_HEAD);\n if (!shadowHead.isPresent()) {\n return;\n }\n const head = ExtDomQuery.querySelectorAll(HTML_TAG_HEAD);\n // full replace we delete everything\n head.childNodes.delete();\n this.addToHead(shadowHead);\n //we copy the attributes as well (just in case myfaces introduces the id in head)\n head.copyAttrs(shadowHead);\n }\n\n addToHead(shadowHead: XMLQuery | DQ) {\n const mappedHeadData = new ExtDomQuery(shadowHead);\n const scriptTags = [HTML_TAG_SCRIPT];\n const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse(\"\").value) == -1);\n nonExecutables.runHeadInserts(true);\n\n //incoming either the outer head tag or its children\n const nodesToAdd = (shadowHead.tagName.value === \"HEAD\") ? shadowHead.childNodes : shadowHead;\n // this is stored for \"post\" processing\n // after the rest of the \"physical build up\", head before body\n const scriptElements = new DomQuery(...nodesToAdd.asArray\n .filter(item => scriptTags.indexOf(item.tagName.orElse(\"\").value) != -1));\n\n this.addToHeadDeferred(scriptElements);\n }\n\n addToHeadDeferred(newElements: XMLQuery | DQ) {\n this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(newElements);\n }\n\n /**\n * replaces the body in the expected manner\n * which means the entire body content is refreshed\n * however also the body attributes must be transferred\n * keeping event handlers etc... in place\n *\n * @param shadowDocument .. an incoming shadow document hosting the new nodes\n */\n replaceBody(shadowDocument: XMLQuery | DQ) {\n\n const shadowBody = shadowDocument.querySelectorAll(HTML_TAG_BODY);\n if (!shadowBody.isPresent()) {\n return;\n }\n\n const shadowInnerHTML: string = <string>shadowBody.innerHTML;\n const resultingBody = <DQ>ExtDomQuery.querySelectorAll(HTML_TAG_BODY);\n const updateForms = resultingBody.querySelectorAll(HTML_TAG_FORM);\n\n // main difference, we cannot replace the body itself, but only its content\n // we need a separate step for post-processing the incoming\n // attributes, like classes, styles etc...\n (resultingBody.html(shadowInnerHTML) as DQ).copyAttrs(shadowBody);\n this.externalContext.assign($nsp(P_RENDER_OVERRIDE)).value = \"@all\";\n this.storeForPostProcessing(updateForms, resultingBody);\n }\n\n /**\n * Leaf Tag eval... process whatever is in the eval cdata block\n *\n * @param node the node to eval\n */\n eval(node: XMLQuery) {\n ExtDomQuery.globalEval(node.cDATAAsString);\n }\n\n /**\n * processes an incoming error from the response\n * which is hosted under the &lt;error&gt; tag\n * @param node the node hosting the error in our response xml\n * @param node the node in the xml hosting the error message\n */\n error(node: XMLQuery) {\n /**\n * <error>\n * <error-name>String</error-name>\n * <error-message><![CDATA[message]]></error-message>\n * <error>\n */\n\n const mergedErrorData = new ExtConfig({});\n mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_AJAX_SOURCE).get(0).value;\n mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);\n mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;\n\n const hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();\n\n //we now store the response xml also in the error data for further details\n mergedErrorData.assignIf(hasResponseXML, RESPONSE_XML).value = this.internalContext.getIf(RESPONSE_XML).value.get(0).value;\n\n // error post-processing and enrichment (standard messages from keys)\n const errorData = ErrorData.fromServerError(mergedErrorData);\n\n // we now trigger an internally stored onError function which might be an attached to the context\n // either we do not have an internal on error, or an on error has been based via params from the outside.\n // In both cases they are attached to our contexts\n\n this.triggerOnError(errorData);\n Implementation.sendError(errorData);\n }\n\n /**\n * process the redirect operation\n *\n * @param node\n */\n redirect(node: XMLQuery) {\n Assertions.assertUrlExists(node);\n\n const redirectUrl = trim(node.attr(ATTR_URL).value as any);\n if (redirectUrl != EMPTY_STR) {\n window.location.href = redirectUrl;\n }\n }\n\n /**\n * processes the update operation and updates the node with the cdata block\n * @param node the xml response node hosting the update info\n * @param cdataBlock the cdata block with the new html code\n */\n update(node: XMLQuery, cdataBlock: string) {\n const result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);\n const sourceForm = result?.firstParent(HTML_TAG_FORM).orElseLazy(() => result.byTagName(HTML_TAG_FORM, true));\n if (sourceForm) {\n this.storeForPostProcessing(sourceForm, result);\n }\n }\n\n /**\n * Delete handler, simply deletes the node referenced by the xml data\n * @param node\n */\n delete(node: XMLQuery) {\n DQ.byId(node.id.value, true).delete();\n }\n\n /**\n * attributes leaf tag... process the attributes\n *\n * @param node\n */\n attributes(node: XMLQuery) {\n const elem = DQ.byId(node.id.value, true);\n\n node.byTagName(XML_TAG_ATTR).each((item: XMLQuery) => {\n elem.attr(item.attr(ATTR_NAME).value as any).value = item.attr(ATTR_VALUE).value as any;\n });\n }\n\n /**\n * @param shadowDocument a shadow document which is needed for further processing\n */\n replaceViewRoot(shadowDocument: XMLQuery) {\n this.replaceHead(shadowDocument);\n this.replaceBody(shadowDocument);\n }\n\n /**\n * Insert handling, either before or after\n *\n * @param node\n */\n insert(node: XMLQuery) {\n //let insertId = node.id; //not used atm\n\n const before = node.attr(XML_TAG_BEFORE);\n const after = node.attr(XML_TAG_AFTER);\n const insertNodes = DQ.fromMarkup(node.cDATAAsString as any);\n\n if (before.isPresent()) {\n DQ.byId(before.value as any, true).insertBefore(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n if (after.isPresent()) {\n const domQuery = DQ.byId(after.value as any, true);\n domQuery.insertAfter(insertNodes);\n\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n }\n\n /**\n * Handler for the case &lt;insert <&lt; before id=\"...\n *\n * @param node the node hosting the insert data\n */\n insertWithSubTags(node: XMLQuery) {\n const before = node.querySelectorAll(XML_TAG_BEFORE);\n const after = node.querySelectorAll(XML_TAG_AFTER);\n\n before.each(item => {\n const insertId = item.attr(ATTR_ID);\n const insertNodes = DQ.fromMarkup(item.cDATAAsString as any);\n if (insertId.isPresent()) {\n DQ.byId(insertId.value as any, true).insertBefore(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n });\n\n after.each(item => {\n const insertId = item.attr(ATTR_ID);\n const insertNodes = DQ.fromMarkup(item.cDATAAsString as any);\n if (insertId.isPresent()) {\n DQ.byId(insertId.value as any, true).insertAfter(insertNodes);\n this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);\n }\n });\n }\n\n /**\n * Process the viewState update, update the affected\n * forms with their respective new viewState values\n *\n */\n processViewState(node: XMLQuery): boolean {\n if (ResponseProcessor.isViewStateNode(node)) {\n const state = node.cDATAAsString;\n this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);\n return true;\n }\n return false;\n }\n\n processClientWindow(node: XMLQuery): boolean {\n if (ResponseProcessor.isClientWindowNode(node)) {\n const state = node.cDATAAsString;\n this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);\n return true;\n }\n return false;\n }\n\n /**\n * generic global eval which runs the embedded css and scripts\n */\n globalEval() {\n // phase one, if we have head inserts, we build up those before going into the script eval phase\n let insertHeadElems = new ExtDomQuery(...this.internalContext.getIf(DEFERRED_HEAD_INSERTS).value);\n insertHeadElems.runHeadInserts(true);\n\n // phase 2 we run a script eval on all updated elements in the body\n let updateElems = new ExtDomQuery(...this.internalContext.getIf(UPDATE_ELEMS).value);\n updateElems.runCss();\n // phase 3, we do the same for the css\n updateElems.runScripts();\n }\n\n /**\n * Postprocessing view state fixing\n * this appends basically the incoming view states to the forms.\n * It is called from outside after all forms have been processed basically\n * as last lifecycle step, before going into the next request.\n */\n fixViewStates() {\n ofAssoc(this.internalContext.getIf(APPLIED_VST).orElse({}).value)\n .forEach(([, value]: [string, Config]) => {\n const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value\n const affectedForms = this.getContainerForms(namingContainerId)\n .filter(affectedForm => this.isInExecuteOrRender(affectedForm));\n\n this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse(\"\").value);\n })\n }\n\n\n\n /**\n * same as with view states before applies the incoming client windows as last step after the rest of the processing\n * is done.\n */\n fixClientWindow() {\n ofAssoc(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)\n .forEach(([, value]: [string, Config]) => {\n const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value;\n const affectedForms = this.getContainerForms(namingContainerId)\n .filter(affectedForm => this.isInExecuteOrRender(affectedForm));\n\n this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse(\"\").value);\n });\n }\n\n updateNamedViewRootState() {\n let partialId = this.internalContext.getIf(NAMING_CONTAINER_ID);\n let namedViewRoot = this.internalContext.getIf(NAMED_VIEWROOT);\n if(partialId.isPresent() &&\n (namedViewRoot.isAbsent() ||\n !namedViewRoot.value)) {\n const SEP = $faces().separatorchar;\n this.internalContext.assign(NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || DQ$(`input[name*='${$nsp(P_VIEWSTATE)}']`)\n .filter(node => (node.attr(\"name\").value as any).indexOf(partialId.value + SEP) == 0).length > 0;\n }\n }\n\n /**\n * all processing done we can close the request and send the appropriate events\n */\n done() {\n const eventData = EventData.createFromRequest(this.request.value, this.internalContext, this.externalContext, SUCCESS);\n\n //because some frameworks might decorate them over the context in the response\n const eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;\n Implementation.sendEvent(eventData, eventHandler);\n }\n\n /**\n * proper viewState -> form assignment\n *\n * @param forms the forms to append the viewState to\n * @param namedViewRoot if set to true, the name is also prefixed\n * @param viewState the final viewState\n * @param namingContainerId\n */\n private appendViewStateToForms(forms: DQ, namedViewRoot: boolean, viewState: string, namingContainerId = \"\") {\n this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);\n }\n\n\n /**\n * proper clientWindow -> form assignment\n *\n * @param forms the forms to append the viewState to\n * @param namedViewRoot if set to true, the name is also prefixed\n * @param clientWindow the final viewState\n * @param namingContainerId\n */\n private appendClientWindowToForms(forms: DQ, namedViewRoot: boolean, clientWindow: string, namingContainerId = \"\") {\n this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);\n }\n\n /**\n * generic append state which appends a certain state as hidden element to an existing set of forms\n *\n * @param forms the forms to append or change to\n * @param selector the selector for the state\n * @param namedViewRoot if set to true, the name is also prefixed\n * @param state the state itself which needs to be assigned\n *\n * @param namingContainerId\n * @private\n */\n private assignState(forms: DQ, selector: string, namedViewRoot: boolean, state: string, namingContainerId: string) {\n /**\n * creates the viewState or client window id element\n * @param form\n */\n const createAndAppendHiddenInput = (form: DomQuery) => {\n return new HiddenInputBuilder(selector)\n .withNamingContainerId(namingContainerId)\n .withParent(form)\n .withNamedViewRoot(namedViewRoot)\n .build();\n };\n\n forms.each(form => {\n const hiddenInput = form.querySelectorAll(selector)\n .orElseLazy(() => createAndAppendHiddenInput(form));\n hiddenInput.val = state;\n });\n }\n\n /**\n * Stores certain aspects of the dom for later post-processing\n *\n * @param updateForms the update forms which should receive standardized internal jsf data\n * @param toBeEvaluated the resulting elements which should be evaluated\n */\n private storeForPostProcessing(updateForms: DQ, toBeEvaluated: DQ) {\n this.storeForUpdate(updateForms);\n this.storeForEval(toBeEvaluated);\n }\n\n /**\n * helper to store a given form for the update post-processing (viewState)\n *\n * @param updateForms the dom query object pointing to the forms which need to be updated\n */\n private storeForUpdate(updateForms: DQ) {\n this.internalContext.assign(UPDATE_FORMS).value.push(updateForms);\n }\n\n /**\n * same for eval (js and css)\n *\n * @param toBeEvaluated\n */\n private storeForEval(toBeEvaluated: DQ) {\n this.internalContext.assign(UPDATE_ELEMS).value.push(toBeEvaluated);\n }\n\n /**\n * check whether a given XMLQuery node is an explicit viewState node\n *\n * @param node the node to check\n * @returns if it is a viewState node\n */\n private static isViewStateNode(node: XMLQuery): boolean {\n const SEP = $faces().separatorchar;\n return \"undefined\" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||\n node?.id?.value?.indexOf([SEP, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||\n node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), SEP].join(EMPTY_STR)) != -1);\n }\n\n /**\n * incoming client window node also needs special processing\n *\n * @param node the node to check\n * @returns true of it ii\n */\n private static isClientWindowNode(node: XMLQuery): boolean {\n const SEP = $faces().separatorchar;\n return \"undefined\" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||\n node?.id?.value?.indexOf([SEP, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||\n node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), SEP].join(EMPTY_STR)) != -1);\n }\n\n private triggerOnError(errorData: ErrorData) {\n this.externalContext.getIf(ON_ERROR).orElseLazy(() => this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);\n }\n\n /**\n * filters the forms according to being member of the \"execute\" or \"render\" cycle\n * @param affectedForm\n * @private\n */\n private isInExecuteOrRender(affectedForm: DQ) {\n const executes = this.externalContext.getIf($nsp(P_EXECUTE)).orElse(\"@none\").value.split(/\\s+/gi);\n const renders = this.externalContext.getIf(P_RENDER_OVERRIDE)\n .orElseLazy(() => this.externalContext.getIf($nsp(P_RENDER)).value)\n .orElse(IDENT_NONE).value.split(/\\s+/gi);\n const executeAndRenders = executes.concat(...renders);\n return [...executeAndRenders].filter((nameOrId: string) => {\n if ([IDENT_ALL, IDENT_NONE].indexOf(nameOrId) != -1) {\n return true;\n }\n\n const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);\n //either the form directly is in execute or render or one of its children or one of its parents\n return affectedForm.matchesSelector(NAME_OR_ID) ||\n affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||\n affectedForm.firstParent(NAME_OR_ID).isPresent();\n }).length > 0;\n }\n\n /**\n * gets all forms under a single naming container id\n * @param namingContainerId\n * @private\n */\n private getContainerForms(namingContainerId: Config) {\n if (namingContainerId.isPresent()) {\n //naming container mode, all forms under naming container id must be processed\n return DQ$(this.getNameOrIdSelector(namingContainerId.value))\n // missing condition if the naming container is not present we have to\n // use the body as fallback\n .orElseLazy(() => DQ.byTagName(HTML_TAG_BODY))\n .byTagName(HTML_TAG_FORM, true);\n } else {\n return DQ.byTagName(HTML_TAG_FORM);\n }\n }\n\n private getNameOrIdSelector(nameOrId: string) {\n return `[id='${nameOrId}'], [name='${nameOrId}']`;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DQ, XMLQuery} from \"mona-dish\";\nimport {ResponseProcessor} from \"./ResponseProcessor\";\n\nimport {IResponseProcessor} from \"./IResponseProcessor\";\nimport {\n $nsp,\n XML_TAG_ATTRIBUTES,\n XML_TAG_CHANGES,\n XML_TAG_DELETE,\n XML_TAG_ERROR,\n XML_TAG_EVAL,\n XML_TAG_EXTENSION,\n XML_TAG_INSERT,\n XML_TAG_REDIRECT,\n XML_TAG_UPDATE, P_RESOURCE,\n P_VIEWBODY,\n P_VIEWHEAD,\n P_VIEWROOT,\n NAMING_CONTAINER_ID,\n XML_TAG_PARTIAL_RESP,\n RESPONSE_XML,\n XML_TAG_AFTER,\n XML_TAG_BEFORE, NAMED_VIEWROOT, XML_ATTR_NAMED_VIEWROOT, P_VIEWSTATE, $faces\n} from \"../core/Const\";\nimport {resolveContexts, resolveResponseXML} from \"./ResponseDataResolver\";\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n\n\nexport namespace Response {\n\n\n /**\n * Standardized faces.ts response\n * this one is called straight from faces.ts.response\n *\n * The processing follows the spec by going for the responseXML\n * and processing its tags\n *\n * @param {XMLHttpRequest} request (xhrRequest) - xhr request object\n * @param context {Context} context (Map) - AJAX context\n *\n */\n export function processResponse(request: XMLHttpRequest, context: Context) {\n\n let req = ExtConfig.fromNullable(request);\n let {externalContext, internalContext} = resolveContexts(context);\n let responseXML: XMLQuery = resolveResponseXML(req);\n let responseProcessor = new ResponseProcessor(req, externalContext, internalContext);\n\n internalContext.assign(RESPONSE_XML).value = responseXML;\n\n // we now process the partial tags, or in none given raise an error\n responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)\n .each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));\n\n // We now process the viewStates, client windows and the elements to be evaluated are delayed.\n // The reason for this is that often it is better\n // to wait until the document has caught up before\n // doing any evaluations even on embedded scripts.\n // Usually this does not matter, the client window comes in almost last always anyway\n // we maybe drop this deferred assignment in the future, but myfaces did it until now.\n responseProcessor.updateNamedViewRootState();\n responseProcessor.fixViewStates();\n responseProcessor.fixClientWindow();\n responseProcessor.globalEval();\n\n responseProcessor.done();\n }\n\n /**\n * highest node partial-response from there the main operations are triggered\n */\n function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext: Config) {\n\n\n /*\n https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd\n The \"partial-response\" element is the root of the partial response information hierarchy,\n and contains nested elements for all possible elements that can exist in the response.\n This element must have an \"id\" attribute whose value is the return from calling getContainerClientId()\n on the UIViewRoot to which this response pertains.\n */\n // we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page\n // under or in body as identifier\n\n let partialId:string = node?.id?.value;\n internalContext.assignIf(!!partialId, NAMING_CONTAINER_ID).value = partialId; // second case mojarra\n\n // there must be at least one container viewstate element resembling the viewroot that we know\n // this is named\n responseProcessor.updateNamedViewRootState();\n\n const SEL_SUB_TAGS = [XML_TAG_ERROR, XML_TAG_REDIRECT, XML_TAG_CHANGES].join(\",\");\n\n // now we can process the main operations\n node.querySelectorAll(SEL_SUB_TAGS).each((node: XMLQuery) => {\n switch (node.tagName.value) {\n case XML_TAG_ERROR:\n responseProcessor.error(node);\n break;\n case XML_TAG_REDIRECT:\n responseProcessor.redirect(node);\n break;\n case XML_TAG_CHANGES:\n processChangesTag(node, responseProcessor);\n break;\n }\n });\n }\n\n let processInsert = function (responseProcessor: IResponseProcessor, node: XMLQuery) {\n // path1 insert after as child tags\n if(node.querySelectorAll([XML_TAG_BEFORE, XML_TAG_AFTER].join(\",\")).length) {\n responseProcessor.insertWithSubTags(node);\n } else { // insert before after with id\n responseProcessor.insert(node);\n }\n\n };\n\n /**\n * next level changes tag\n *\n * @param node\n * @param responseProcessor\n */\n function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {\n const ALLOWED_TAGS = [XML_TAG_UPDATE, XML_TAG_EVAL, XML_TAG_INSERT, XML_TAG_DELETE, XML_TAG_ATTRIBUTES, XML_TAG_EXTENSION].join(\", \");\n node.querySelectorAll(ALLOWED_TAGS).each(\n (node: XMLQuery) => {\n switch (node.tagName.value) {\n case XML_TAG_UPDATE:\n processUpdateTag(node, responseProcessor);\n break;\n\n case XML_TAG_EVAL:\n responseProcessor.eval(node);\n break;\n\n case XML_TAG_INSERT:\n processInsert(responseProcessor, node);\n break;\n\n case XML_TAG_DELETE:\n responseProcessor.delete(node);\n break;\n\n case XML_TAG_ATTRIBUTES:\n responseProcessor.attributes(node);\n break;\n\n case XML_TAG_EXTENSION:\n break;\n }\n }\n );\n return true;\n }\n\n /**\n * checks and stores a state update for delayed processing\n *\n * @param responseProcessor the response processor to perform the store operation\n * @param node the xml node to check for the state\n *\n * @private\n */\n function storeState(responseProcessor: IResponseProcessor, node: XMLQuery) {\n return responseProcessor.processViewState(node) || responseProcessor.processClientWindow(node);\n }\n\n /**\n * branch tag update. drill further down into the updates\n * special case viewState in that case it is a leaf\n * and the viewState must be processed\n *\n * @param node\n * @param responseProcessor\n */\n function processUpdateTag(node: XMLQuery, responseProcessor: IResponseProcessor) {\n // early state storing, if no state we perform a normal update cycle\n if (!storeState(responseProcessor, node)) {\n handleElementUpdate(node, responseProcessor);\n }\n }\n\n /**\n * element update\n *\n * @param node\n * @param responseProcessor\n */\n function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {\n let cdataBlock = node.cDATAAsString;\n switch (node.id.value) {\n case $nsp(P_VIEWROOT) :\n responseProcessor.replaceViewRoot(DQ.fromMarkup(cdataBlock.substring(cdataBlock.indexOf(\"<html\"))));\n break;\n\n case $nsp(P_VIEWHEAD):\n responseProcessor.replaceHead(DQ.fromMarkup(cdataBlock));\n break;\n\n case $nsp(P_VIEWBODY):\n responseProcessor.replaceBody(DQ.fromMarkup(cdataBlock));\n break;\n\n case $nsp(P_RESOURCE):\n responseProcessor.addToHead(DQ.fromMarkup(cdataBlock))\n break;\n\n default:// htmlItem replacement\n responseProcessor.update(node, cdataBlock);\n break;\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, Optional, XMLQuery} from \"mona-dish\";\n\nimport {Assertions} from \"../util/Assertions\";\nimport {DQ} from \"mona-dish\";\nimport {\n $nsp,\n CTX_PARAM_MF_INTERNAL,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_SRC_FRM_ID,\n SEL_RESPONSE_XML,\n SOURCE,\n HTML_TAG_FORM,\n UPDATE_ELEMS,\n UPDATE_FORMS,\n DEFERRED_HEAD_INSERTS\n} from \"../core/Const\";\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n/**\n * Resolver functions for various aspects of the response data\n *\n * stateless because it might be called from various\n * parts of the response classes\n */\n\n/**\n * fetches the response XML\n * as XML Query object\n *\n * @param request the request hosting the responseXML\n *\n * Throws an error in case of non-existent or wrong xml data\n *\n */\nexport function resolveResponseXML(request: Config): XMLQuery {\n let ret = new XMLQuery($nsp(request.getIf(SEL_RESPONSE_XML).value));\n Assertions.assertValidXMLResponse(ret);\n\n return ret;\n}\n\n/**\n * Splits the incoming pass-through context apart\n * in an internal and an external normalized context\n * the internal one is just for our internal processing\n *\n * @param context the root context as associative array\n */\nexport function resolveContexts(context: { [p: string]: any }): any {\n /**\n * we split the context apart into the external one and\n * some internal values\n */\n let externalContext = ExtConfig.fromNullable(context);\n let internalContext = externalContext.getIf(CTX_PARAM_MF_INTERNAL);\n if (!internalContext.isPresent()) {\n internalContext = ExtConfig.fromNullable({});\n }\n\n /**\n * prepare storage for some deferred operations\n */\n internalContext.assign(DEFERRED_HEAD_INSERTS).value = [];\n internalContext.assign(UPDATE_FORMS).value = [];\n internalContext.assign(UPDATE_ELEMS).value = [];\n return {externalContext, internalContext};\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Asynchronous queue member for our asynchronous queue\n * Ever object in the asynchronous queue needs to implement this interface\n *\n * the usage should be similar as Promise. from the outside.\n * but with a dedicated start point. The problem why we cannot use\n * promises here, is mostly related to the needed cancel functionality\n * and that the queue expects a runnable as entry.\n *\n * from the implementation side it is mostly registering callbacks\n * and calling them at the appropriate time.\n */\nexport interface IAsyncRunnable<T> {\n /**\n * starts the runnable\n */\n start(): void;\n\n /**\n * cancel the current ongoing op if possible\n */\n cancel(): void;\n\n /**\n * callback for then functionality\n * triggered when the async run is complete\n *\n * the async runnable must register the passed function\n * and then triggers all the registered then functions\n * when it is complete\n *\n * @param func the then functor\n */\n then(func: (data: any) => any): IAsyncRunnable<T>;\n\n /**\n * callback for catch functionality\n * triggered when the async run is complete\n *\n * the async runnable must register the passed function\n * and then triggers all the registered catch handlers\n * when an error has occurred\n *\n * @param func\n */\n catch(func: (data: any) => any): IAsyncRunnable<T>;\n\n\n /**\n * finally called when all then and catches are performed\n * same this is a register function\n * and once the finally time for the promise has\n * come the finally functions must be performed\n */\n finally(func: () => void): IAsyncRunnable<T>;\n}\n\n\n/**\n * pretty much the same as cancellable Promise, but given\n * we do not have that on browser level yet this is sort\n * of a non - intrusive Shim!\n */\nexport abstract class AsyncRunnable<T> implements IAsyncRunnable<T>{\n /**\n * helper support so that we do not have to drag in Promise shims\n */\n private catchFunctions: Array<Function> = [];\n private thenFunctions: Array<Function> = [];\n\n /**\n * cancel the run of the runnable (which then depending on the implementation\n * either triggers indirectly resolve or reject)\n */\n abstract cancel(): void;\n\n /**\n * extended functionality start to trigger the runnable\n */\n abstract start(): void;\n\n /**\n * resolve handler function which calls the then chain\n * and after that finally\n * @param data\n */\n resolve(data: any) {\n this.thenFunctions.reduce((inputVal: any, thenFunc: any) => {\n return thenFunc(inputVal);\n }, data)\n }\n\n /**\n * reject handler function which triggers the catch chain\n * @param data\n */\n reject(data: any) {\n this.catchFunctions.reduce((inputVal: any, catchFunc: any) => {\n return catchFunc(inputVal);\n }, data);\n }\n\n /**\n * register a catch functor\n * @param func the functor for the catch monad\n */\n catch(func: (data: any) => any): IAsyncRunnable<T> {\n this.catchFunctions.push(func);\n return this;\n }\n\n /**\n * registers a finally functor\n * @param func the functor for the finally handling chain\n */\n finally(func: () => void): IAsyncRunnable<T> {\n // no ie11 support we probably are going to revert to shims for that one\n this.catchFunctions.push(func);\n this.thenFunctions.push(func);\n return this;\n }\n\n /**\n * @param func then functor similar to promise\n */\n then(func: (data: any) => any): IAsyncRunnable<T> {\n this.thenFunctions.push(func);\n return this;\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Config, DomQuery, DQ, Es2019Array} from \"mona-dish\";\nimport {ExtDomQuery} from \"./ExtDomQuery\";\nimport {$faces, EMPTY_STR} from \"../core/Const\";\n\n/*\n * various routines for encoding and decoding url parameters\n * into configs and vice versa\n */\n\n\n/**\n * encodes a given form data into a url encoded string\n * @param formData the form data config object\n * @param paramsMapper the params mapper\n * @param defaultStr a default string if nothing comes out of it\n */\nexport function encodeFormData(formData: Config,\n paramsMapper = (inStr: string, inVal: any) => [inStr, inVal],\n defaultStr = EMPTY_STR): string {\n if (formData.isAbsent()) {\n return defaultStr;\n }\n const assocValues = formData.value;\n\n const expandValueArrAndRename = (key: string) => assocValues[key].map((val: any) => paramsMapper(key, val));\n const isPropertyKey = (key: string) => assocValues.hasOwnProperty(key);\n const isNotFile = ([, value]: [string, any]) => !(value instanceof ExtDomQuery.global().File);\n const mapIntoUrlParam = (keyVal: [string, any]) => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;\n\n return new Es2019Array(...Object.keys(assocValues))\n .filter(isPropertyKey)\n .flatMap(expandValueArrAndRename)\n .filter(isNotFile)\n .map(mapIntoUrlParam)\n .join(\"&\");\n}\n\n/**\n * splits and decodes encoded values into strings containing of key=value\n * @param encoded encoded string\n */\nexport function decodeEncodedValues(encoded: string): string[][] {\n const filterBlanks = (item: string) => !!(item || '').replace(/\\s+/g, '');\n const splitKeyValuePair = (_line: string) => {\n let line = decodeURIComponent(_line);\n let index = line.indexOf(\"=\");\n if (index === -1) {\n return [line];\n }\n return [line.substring(0, index), line.substring(index + 1)];\n };\n\n let requestParamEntries = encoded.split(\"&\");\n return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);\n}\n\n\n/**\n * gets all the input files and their corresponding file objects\n * @param dataSource\n */\nexport function resolveFiles(dataSource: DQ): [string, File][] {\n\n const expandFilesArr = ([key, files]: any[]) => {\n return [...files].map((file: File) => [key, file]);\n }\n const remapFileInput = (fileInput: DQ) => {\n return [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];\n }\n\n const files = dataSource\n .querySelectorAllDeep(\"input[type='file']\")\n .asArray;\n\n const ret = files\n .map(remapFileInput)\n .flatMap(expandFilesArr);\n\n return ret as any;\n}\n\n\nexport function fixEmptyParameters(keyVal: any[]): [string, any] {\n return (keyVal.length < 3 ? [keyVal?.[0] ?? [], keyVal?.[1] ?? []] : keyVal) as [string, any];\n}\n\n/**\n * returns the decoded viewState from parentItem\n * @param parentItem\n */\nfunction resolveViewState(parentItem: DomQuery): string[][] | [string, File][] {\n const viewStateStr = $faces().getViewState(parentItem.getAsElem(0).value);\n\n // we now need to decode it and then merge it into the target buf\n // which hosts already our overrides (aka do not override what is already there(\n // after that we need to deal with form elements on a separate level\n return decodeEncodedValues(viewStateStr);\n}\n\n/**\n * gets all the inputs under the form parentItem\n * as array\n * @param parentItem\n */\nexport function getFormInputsAsArr(parentItem: DomQuery): string[][] | [string, File][] {\n const standardInputs: any = resolveViewState(parentItem);\n const fileInputs = resolveFiles(parentItem);\n return standardInputs.concat(fileInputs);\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Config, DQ} from \"mona-dish\";\nimport {$nsp, EMPTY_STR, IDENT_NONE, P_VIEWSTATE} from \"../core/Const\";\n\nimport {\n encodeFormData,\n fixEmptyParameters, getFormInputsAsArr\n} from \"../util/FileUtils\";\nimport {ExtLang} from \"../util/Lang\";\nconst ofAssoc = ExtLang.ofAssoc;\nimport {Es2019Array} from \"mona-dish\";\n\n\ntype ParamsMapper = (key: string, value: any) => [string, any];\nconst defaultParamsMapper: ParamsMapper = (key, item) => [key, item];\n\n/**\n * A unified form data class\n * which builds upon our configuration.\n *\n * We cannot use standard html5 forms everywhere\n * due to api constraints on the HTML Form object in IE11\n * and due to the url encoding constraint given by the faces.js spec\n *\n *\n * internal storage format\n * every value is stored as an array\n * even scalar ones!\n */\nexport class XhrFormData extends Config {\n /**\n * Checks if the given datasource is a multipart request source\n * multipart is only needed if one of the executes is a file input\n * since file inputs are stateless, they fall out of the view state\n * and need special handling. With file submits we have to send a formData object\n * instead of an encoded string files cannot be sent that way\n */\n isMultipartRequest: boolean = false;\n\n /**\n * data collector from a given form\n *\n * @param dataSource either a form as DomQuery object or an encoded url string\n * @param paramsMapper a remapper for the params keys and values\n * @param executes the executes id list for the elements to being processed\n * @param partialIds partial ids to collect, to reduce the data sent down\n */\n constructor(dataSource: DQ, private paramsMapper: ParamsMapper = defaultParamsMapper, executes?: string[], partialIds?: string[]) {\n super({});\n /*\n * Spec. 13.3.1 — order matters: detect multipart first, encode fields second,\n * apply view state last (so it is not double-counted if already present in fields).\n */\n this.initFormData(dataSource, executes, partialIds);\n }\n\n /**\n * @returns a Form data representation, this is needed for file submits\n */\n toFormData(): FormData {\n return this.buildFormData();\n }\n\n /**\n * returns an encoded string representation of our xhr form data\n *\n * @param defaultStr optional default value if nothing is there to encode\n */\n toString(defaultStr = EMPTY_STR): string {\n return encodeFormData(this, this.paramsMapper, defaultStr);\n }\n\n /**\n * Drives the three-phase form data initialisation in the required order.\n */\n private initFormData(dataSource: DQ, executes?: string[], partialIds?: string[]): void {\n this.detectMultipartRequest(dataSource, executes);\n this.encodeSubmittableFields(dataSource, partialIds);\n this.applyViewState(dataSource);\n }\n\n /**\n * Sets isMultipartRequest when any of the executed elements is a file input.\n */\n private detectMultipartRequest(rootElement: DQ, executes?: Array<string>): void {\n if (!executes || executes.includes(IDENT_NONE)) {\n return;\n }\n this.isMultipartRequest = rootElement.isMultipartCandidate(true);\n }\n\n /**\n * special case view state handling\n *\n * @param form the form holding the view state value\n */\n private applyViewState(form: DQ): void {\n if (this.getIf($nsp(P_VIEWSTATE)).isPresent()) {\n return;\n }\n const viewStateElement = form.querySelectorAllDeep(`[name*='${$nsp(P_VIEWSTATE)}'`);\n const viewState = viewStateElement.inputValue;\n this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;\n }\n\n /**\n * determines fields to submit\n * @param {Node} parentItem - form element item is nested in\n * @param {Array} partialIds - ids fo PPS\n */\n private encodeSubmittableFields(parentItem: DQ, partialIds: string[] = []): void {\n const mergeIntoThis = ([key, value]: [string, any]) => this.append(key).value = value;\n const namingContainerRemap = ([key, value]: [string, any]) => this.paramsMapper(key as string, value);\n\n const remappedPartialIds = partialIds.map(id => this.remapKeyForNamingContainer(id));\n\n getFormInputsAsArr(parentItem)\n .map(fixEmptyParameters)\n .map(namingContainerRemap)\n .filter(([key]) => this.isFieldIncluded(key, remappedPartialIds))\n .forEach(mergeIntoThis);\n }\n\n /**\n * Returns true when the field should be included in the submission.\n * Special \"@\"-prefixed keys (internal markers) are always included.\n * When no partial ids are specified, everything passes through.\n */\n private isFieldIncluded(key: string, remappedPartialIds: string[]): boolean {\n if (!remappedPartialIds.length || key.startsWith(\"@\")) {\n return true;\n }\n return remappedPartialIds.includes(key);\n }\n\n /**\n * Builds the FormData object from the internal key→value[] map.\n * Arrays are expanded so each value becomes a separate FormData entry.\n */\n private buildFormData(): FormData {\n const expandValueArrays = ([key, item]: [string, any]) => {\n if (Array.isArray(item)) {\n return new Es2019Array(...item).map((value: any) => ({key, value}));\n }\n return [{key, value: item}];\n };\n\n const remapForNamingContainer = ({key, value}: {key: string, value: any}) => ({\n key: this.remapKeyForNamingContainer(key),\n value\n });\n\n return ofAssoc(this.value)\n .flatMap(expandValueArrays)\n .map(remapForNamingContainer)\n .reduce((formData: FormData, {key, value}: any) => {\n formData.append(key, value);\n return formData;\n }, new FormData()) as FormData;\n }\n\n /**\n * Applies paramsMapper to remap only the key, ignoring the value transformation.\n * EMPTY_STR is passed as a placeholder since only the remapped key is used.\n */\n private remapKeyForNamingContainer(key: string): string {\n const [remappedKey] = this.paramsMapper(key, EMPTY_STR); // value is a required arg but irrelevant here; only the remapped key is used\n return remappedKey;\n }\n}","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {AsyncRunnable, IAsyncRunnable} from \"../util/AsyncRunnable\";\nimport {Config, DQ, XMLQuery} from \"mona-dish\";\nimport {Implementation} from \"../AjaxImpl\";\n\nimport {XhrFormData} from \"./XhrFormData\";\nimport {ErrorData} from \"./ErrorData\";\nimport {EventData} from \"./EventData\";\nimport {ExtLang} from \"../util/Lang\";\nimport {\n $faces,\n BEGIN,\n COMPLETE,\n CONTENT_TYPE,\n CTX_PARAM_MF_INTERNAL,\n CTX_PARAM_REQ_PASS_THR,\n HEAD_FACES_REQ,\n MALFORMEDXML,\n NO_TIMEOUT,\n ON_ERROR,\n ON_EVENT,\n P_EXECUTE,\n REQ_ACCEPT,\n REQ_TYPE_GET,\n REQ_TYPE_POST,\n SOURCE,\n STATE_EVT_TIMEOUT,\n STD_ACCEPT,\n URL_ENCODED,\n VAL_AJAX,\n IDENT_NONE,\n CTX_PARAM_SRC_FRM_ID,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_PPS,\n EMPTY_RESPONSE,\n HTTP_ERROR,\n EMPTY_STR,\n $nsp,\n P_BEHAVIOR_EVENT,\n CTX_PARAM_UPLOAD_ON_PROGRESS,\n CTX_PARAM_UPLOAD_LOAD,\n CTX_PARAM_UPLOAD_LOADSTART,\n CTX_PARAM_UPLOAD_LOADEND,\n CTX_PARAM_UPLOAD_ABORT,\n CTX_PARAM_UPLOAD_TIMEOUT,\n CTX_PARAM_UPLOAD_ERROR,\n CTX_PARAM_UPLOAD_PREINIT\n} from \"../core/Const\";\nimport {\n resolveFinalUrl,\n resolveHandlerFunc,\n resoveNamingContainerMapper\n} from \"./RequestDataResolver\";\nconst failSaveExecute = ExtLang.failSaveExecute;\nimport {ExtConfig} from \"../util/ExtDomQuery\";\n\n/**\n * Faces XHR Request Wrapper\n * as AsyncRunnable for our Asynchronous queue\n * This means from the outside the\n * xhr request is similar to a Promise in a way\n * that you can add then and catch and finally callbacks.\n *\n *\n * The idea is that we basically just enqueue\n * a single ajax request into our queue\n * and let the queue do the processing.\n *\n *\n */\n\nexport class XhrRequest extends AsyncRunnable<XMLHttpRequest> {\n\n private readonly ERR_INVALID_RESPONSE = \"Invalid Response\";\n private readonly ERR_EMPTY_RESPONSE = \"Empty Response\";\n static readonly TYPE_CHECKBOX = \"checkbox\";\n static readonly TYPE_RADIO = \"radio\";\n\n private responseContext!: Config;\n private stopProgress = false;\n private xhrObject = new XMLHttpRequest();\n\n /**\n * Required Parameters\n *\n * @param requestContext the request context with all pass through values\n * @param internalContext internal context with internal info which is passed through, not used by the user\n * Optional Parameters\n * @param timeout optional xhr timeout\n * @param ajaxType optional request type, default \"POST\"\n * @param contentType optional content type, default \"application/x-www-form-urlencoded\"\n */\n constructor(\n private requestContext: ExtConfig,\n private internalContext: Config,\n private timeout = NO_TIMEOUT,\n private ajaxType = REQ_TYPE_POST,\n private contentType = URL_ENCODED\n ) {\n super();\n // we omit promises here because we have to deal with cancel functionality,\n // and promises to not provide that (yet) instead we have our async queue\n // which uses an api internally, which is very close to promises\n this.registerXhrCallbacks((data: any) => this.resolve(data), (data: any) => this.reject(data));\n }\n\n start(): IAsyncRunnable<XMLHttpRequest> {\n\n const ignoreErr = failSaveExecute;\n const xhrObject = this.xhrObject;\n const sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value);\n\n try {\n // encoded we need to decode\n // We generated a base representation of the current form\n // in case someone has overloaded the viewState with additional decorators we merge\n // that in, there is no way around it, the spec allows it and getViewState\n // must be called, so whatever getViewState delivers has higher priority then\n // whatever the formData object delivers\n // the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial\n // ids for reduced load and server processing, this will be removed soon, we can handle the same via execute\n const executes = this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\\s+/gi);\n const partialIdsArray = this.internalContext.getIf(CTX_PARAM_PPS).value === true ? executes : [];\n const formData: XhrFormData = new XhrFormData(\n sourceForm,\n resoveNamingContainerMapper(this.internalContext),\n executes, partialIdsArray\n );\n\n // next step the pass through parameters are merged in for post params\n this.requestContext.$nspEnabled = false;\n const requestContext = this.requestContext;\n const requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;\n\n // we are turning off here the jsf, faces remapping because we are now dealing with\n // pass-through parameters\n requestPassThroughParams.$nspEnabled = false;\n // this is an extension where we allow pass through parameters to be sent down additionally\n // this can be used and is used in the impl to enrich the post request parameters with additional\n // information\n try {\n formData.shallowMerge(requestPassThroughParams, true, true);\n } finally {\n // unfortunately as long as we support\n // both namespaces we have to keep manual control\n // on the key renaming before doing ops like deep copy\n this.requestContext.$nspEnabled = true;\n requestPassThroughParams.$nspEnabled = true;\n }\n\n this.appendIssuingItem(formData);\n\n this.responseContext = requestPassThroughParams.deepCopy;\n\n // we have to shift the internal passthroughs around to build up our response context\n const responseContext = this.responseContext;\n\n responseContext.assign(CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;\n\n // per spec the onEvent and onError handlers must be passed through to the response\n responseContext.assign(ON_EVENT).value = requestContext.getIf(ON_EVENT).value;\n responseContext.assign(ON_ERROR).value = requestContext.getIf(ON_ERROR).value;\n\n xhrObject.open(this.ajaxType, resolveFinalUrl(sourceForm, formData, this.ajaxType), true);\n\n if (this.timeout) xhrObject.timeout = this.timeout;\n\n // a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects\n // normal browsers should resolve this\n // tests can quietly fail on this one\n if (!formData.isMultipartRequest) {\n ignoreErr(() => xhrObject.setRequestHeader(CONTENT_TYPE, `${this.contentType}; charset=utf-8`));\n }\n\n ignoreErr(() => xhrObject.setRequestHeader(HEAD_FACES_REQ, VAL_AJAX));\n // some webkit based mobile browsers do not follow the w3c spec for Accept headers\n ignoreErr(() => xhrObject.setRequestHeader(REQ_ACCEPT, STD_ACCEPT));\n\n this.sendEvent(BEGIN);\n this.sendRequest(formData);\n } catch (e) {\n // this happens usually in a client side condition, hence we have to deal in with it in a client\n // side manner\n this.handleErrorAndClearQueue(e);\n throw e;\n }\n return this;\n }\n\n cancel() {\n try {\n // this causes onError to be called where the error\n // handling takes over\n this.xhrObject.abort();\n } catch (e) {\n this.handleError(e);\n }\n }\n\n\n /**\n * attaches the internal event and processing\n * callback within the promise to our xhr object\n *\n * @param resolve\n * @param reject\n */\n private registerXhrCallbacks(resolve: Consumer<any>, reject: Consumer<any>) {\n const xhrObject = this.xhrObject;\n\n xhrObject.onabort = () => {\n this.onAbort(resolve, reject);\n };\n xhrObject.ontimeout = () => {\n this.onTimeout(resolve, reject);\n };\n xhrObject.onload = () => {\n this.onResponseReceived(resolve)\n };\n xhrObject.onloadend = () => {\n this.onResponseProcessed(this.xhrObject, resolve);\n };\n\n this.registerUploadCallbacks(xhrObject);\n\n xhrObject.onerror = (errorData: any) => {\n // Older Safari/WebKit and Chrome/Chromium versions can cancel XHRs during\n // navigation or download handoff by triggering onerror with status=0/readyState=4.\n // Treat that as queue cleanup rather than reporting a user-facing Ajax error.\n if (this.isCancelledResponse(this.xhrObject)) {\n /*\n * this triggers the catch chain and after that finally\n */\n this.stopProgress = true;\n reject();\n return;\n }\n // error already processed somewhere else\n if (this.stopProgress) {\n return;\n }\n this.handleError(errorData);\n };\n }\n\n private registerUploadCallbacks(xhrObject: XMLHttpRequest): void {\n if (!xhrObject?.upload) {\n return;\n }\n // fire the pre-init hook so callers can inspect the upload object before any transfer starts\n this.internalContext.getIf(CTX_PARAM_UPLOAD_PREINIT).value?.(xhrObject.upload);\n xhrObject.upload.addEventListener(\"progress\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ON_PROGRESS).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"load\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOAD).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"loadstart\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADSTART).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"loadend\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADEND).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"abort\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ABORT).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"timeout\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_TIMEOUT).value?.(xhrObject.upload, event);\n });\n xhrObject.upload.addEventListener(\"error\", (event: ProgressEvent) => {\n this.internalContext.getIf(CTX_PARAM_UPLOAD_ERROR).value?.(xhrObject.upload, event);\n });\n }\n\n private isCancelledResponse(currentTarget: XMLHttpRequest): boolean {\n return currentTarget?.status === 0 && // cancelled internally by browser\n currentTarget?.readyState === 4 &&\n currentTarget?.responseText === '' &&\n currentTarget?.responseXML === null;\n }\n\n /*\n * xhr processing callbacks\n *\n * Those methods are the callbacks called by\n * the xhr object depending on its own state\n */\n private onAbort(_resolve: Consumer<any>, reject: Consumer<any>) {\n this.handleHttpError(reject);\n }\n\n private onTimeout(resolve: Consumer<any>, _reject: Consumer<any>) {\n this.sendEvent(STATE_EVT_TIMEOUT);\n this.handleHttpError(resolve);\n }\n\n /**\n * the response is received and normally is a normal response\n * but also can be some kind of error (http code >= 300)\n * In any case the response will be resolved either as error or response\n * and the next item in the queue will be processed\n * @param resolve\n * @private\n */\n private onResponseReceived(resolve: Consumer<any>) {\n\n this.sendEvent(COMPLETE);\n\n //request error resolution as per spec:\n if(!this.processRequestErrors(resolve)) {\n $faces().ajax.response(this.xhrObject, this.responseContext.value ?? {});\n }\n }\n\n private processRequestErrors(resolve: Consumer<any>): boolean {\n const responseXML = new XMLQuery(this.xhrObject?.responseXML as any);\n const responseText = this.xhrObject?.responseText ?? \"\";\n const responseCode = this.xhrObject?.status ?? -1;\n\n // HTTP status takes priority: a non-2xx response is always an HTTP error,\n // regardless of what the body contains (e.g. an HTML error page from a 404\n // must not be misreported as malformedXML).\n if (responseCode >= 300 || responseCode < 200) {\n this.handleHttpError(resolve);\n return true;\n }\n if(responseXML.isXMLParserError()) {\n // Firefox: malformed XML produces a Document with <parsererror>\n this.handleGenericResponseError(this.ERR_INVALID_RESPONSE, \"The response xml is invalid\", MALFORMEDXML, resolve);\n return true;\n } else if(responseXML.isAbsent() && responseText.trim().length > 0) {\n // Chrome: responseXML is null for unparseable XML, but responseText has content\n this.handleGenericResponseError(this.ERR_INVALID_RESPONSE, \"The response xml is invalid\", MALFORMEDXML, resolve);\n return true;\n } else if(responseXML.isAbsent()) {\n // Truly empty response\n this.handleGenericResponseError(this.ERR_EMPTY_RESPONSE, \"The response has provided no data\", EMPTY_RESPONSE, resolve);\n return true;\n }\n return false;\n }\n\n\n private handleGenericResponseError(errorName: string, errorMessage: string, responseStatus: string, resolve: (s?: any) => void) {\n const errorData = new ErrorData(\n this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value,\n errorName, errorMessage,\n this.xhrObject?.responseText ?? \"\",\n this.xhrObject?.responseXML ?? null,\n this.xhrObject.status,\n responseStatus\n );\n this.finalizeError(errorData, resolve);\n }\n\n private handleHttpError(resolveOrReject: Consumer<any>, errorMessage: string = \"Generic HTTP Error\") {\n this.stopProgress = true;\n\n const errorData = new ErrorData(\n this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value,\n HTTP_ERROR, errorMessage,\n this.xhrObject?.responseText ?? \"\",\n this.xhrObject?.responseXML ?? null,\n this.xhrObject?.status ?? -1,\n HTTP_ERROR\n )\n this.finalizeError(errorData, resolveOrReject);\n }\n\n private finalizeError(errorData: ErrorData, resolveOrReject: Consumer<any>) {\n try {\n this.handleError(errorData, true);\n } finally {\n // we issue a resolveOrReject in this case to allow the system to recover\n // reject would clean up the queue\n // resolve would trigger the next element in the queue to be processed\n resolveOrReject(errorData);\n this.stopProgress = true;\n }\n }\n\n private onResponseProcessed(data: any, resolve: Consumer<any>) {\n if (!this.stopProgress) {\n resolve(data);\n }\n }\n\n private sendRequest(formData: XhrFormData) {\n if (this.ajaxType === REQ_TYPE_GET) {\n this.xhrObject.send(null);\n return;\n }\n this.xhrObject.send(formData.isMultipartRequest ? formData.toFormData() : formData.toString());\n }\n\n /*\n * other helpers\n */\n private sendEvent(evtType: string) {\n const eventData = EventData.createFromRequest(this.xhrObject, this.internalContext, this.requestContext, evtType);\n try {\n // User code error, we might cover\n // this in onError, but also we cannot swallow it.\n // We need to resolve the local handlers lazily,\n // because some frameworks might decorate them over the context in the response\n const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_EVENT);\n Implementation.sendEvent(eventData, eventHandler);\n } catch (e) {\n e.source = e?.source ?? this.requestContext.getIf(SOURCE).value;\n // this is a client error, no save state anymore for queue processing!\n this.handleErrorAndClearQueue(e);\n // we forward the error upward like all client side errors\n throw e;\n }\n }\n\n private handleErrorAndClearQueue(e: any, responseFormatError: boolean = false) {\n this.handleError(e, responseFormatError);\n this.reject(e);\n }\n\n private handleError(exception: any, responseFormatError: boolean = false) {\n const errorData = responseFormatError\n ? ErrorData.fromHttpConnection(exception.source, exception.type, exception.message ?? EMPTY_STR, exception.responseText, exception.responseXML, exception.responseCode, exception.status)\n : ErrorData.fromClient(exception);\n const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);\n Implementation.sendError(errorData, eventHandler);\n }\n\n private appendIssuingItem(formData: XhrFormData) {\n const issuingItemId = this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value;\n\n //to avoid side effects with buttons we only can append the issuing item if no behavior event is set\n //MYFACES-4679!\n const eventType = formData.getIf($nsp(P_BEHAVIOR_EVENT)).value?.[0] ?? null;\n const isBehaviorEvent = !!eventType && eventType !== 'click';\n\n //not encoded\n if(issuingItemId && formData.getIf(issuingItemId).isAbsent() && !isBehaviorEvent) {\n const issuingItem = DQ.byId(issuingItemId);\n const itemValue = issuingItem.inputValue;\n const arr = new ExtConfig({});\n const type: string = issuingItem.type.orElse(\"\").value.toLowerCase();\n\n //Checkbox and radio only value pass if checked is set, otherwise they should not show\n //up at all, and if checked is set, they either can have a value or simply being boolean\n const isCheckable = type === XhrRequest.TYPE_CHECKBOX || type === XhrRequest.TYPE_RADIO;\n if (isCheckable && !issuingItem.checked) {\n return;\n } else if (isCheckable) {\n arr.assign(issuingItemId).value = itemValue.orElse(true).value;\n } else if (itemValue.isPresent()) {\n arr.assign(issuingItemId).value = itemValue.value;\n }\n\n formData.shallowMerge(arr, true, true);\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {IAsyncRunnable} from \"./AsyncRunnable\";\nimport {ExtLang} from \"./Lang\";\nconst debounce = ExtLang.debounce;\n\n/**\n * A simple XHR queue controller\n * following the async op -> next pattern\n * Faces enforces for the XHR handling\n */\nexport class XhrQueueController<T extends IAsyncRunnable<any>> {\n queue: IAsyncRunnable<any>[] = [];\n taskRunning = false;\n\n // Each instance needs its own debounce key: a shared key would cause enqueues\n // on separate instances to cancel each other's debounce window.\n private static instanceCount = 0;\n private readonly debounceKey: string;\n\n constructor() {\n this.debounceKey = `xhrQueue_${XhrQueueController.instanceCount++}`;\n }\n\n /**\n * executes or enqueues an element\n * @param runnable the runnable (request) to be enqueued\n * @param timeOut timeout if > 0 which defers the execution\n * until the debounce window for the timeout is closed.\n */\n enqueue(runnable: T, timeOut: number = 0) {\n debounce(this.debounceKey, () => {\n const requestHandler = this.enrichRunnable(runnable);\n if (!this.taskRunning) {\n this.signalTaskRunning();\n requestHandler.start();\n } else {\n this.queue.push(requestHandler);\n }\n }, timeOut);\n }\n\n /**\n * trigger the next element in the queue\n * to be started!\n */\n next() {\n this.updateTaskRunning();\n const next = this.queue.shift();\n next?.start();\n }\n\n /**\n * clears and resets the queue\n */\n clear() {\n this.queue.length = 0;\n this.updateTaskRunning();\n }\n\n /**\n * true if queue is empty\n */\n get isEmpty(): boolean {\n return !this.queue.length;\n }\n\n /**\n * Enriches the incoming async asyncRunnable\n * with the error and next handling\n * (aka: asyncRunnable is done -> next\n * error -> clear queue\n * @param asyncRunnable the async runnable which needs enrichment\n * @private\n */\n private enrichRunnable(asyncRunnable: T) {\n /**\n * we can use the Promise pattern asyncrunnable uses\n * to trigger queue control callbacks of next element\n * and clear the queue (theoretically this\n * would work with any promise)\n */\n return asyncRunnable\n .then(() => this.next())\n .catch(() => this.clear());\n }\n\n\n /**\n * alerts the queue that a task is running\n *\n * @private\n */\n private signalTaskRunning() {\n this.taskRunning = true;\n }\n\n /**\n * updates the task running status according to the current queue\n * @private\n */\n private updateTaskRunning() {\n this.taskRunning = !this.isEmpty;\n }\n\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {IListener} from \"./util/IListener\";\nimport {Response} from \"./xhrCore/Response\";\nimport {XhrRequest} from \"./xhrCore/XhrRequest\";\nimport {Config, DQ, DQ$, Lang, Optional} from \"mona-dish\";\nimport {Assertions} from \"./util/Assertions\";\nimport {ExtConfig, ExtDomQuery} from \"./util/ExtDomQuery\";\nimport {ErrorData} from \"./xhrCore/ErrorData\";\nimport {EventData} from \"./xhrCore/EventData\";\nimport {ExtLang} from \"./util/Lang\";\n\nimport {\n CTX_OPTIONS_EXECUTE,\n CTX_PARAM_REQ_PASS_THR,\n CTX_PARAM_SRC_CTL_ID,\n CTX_PARAM_SRC_FRM_ID,\n IDENT_ALL,\n IDENT_FORM,\n IDENT_NONE,\n IDENT_THIS,\n MYFACES,\n ON_ERROR,\n ON_EVENT,\n P_AJAX,\n P_CLIENT_WINDOW,\n P_EVT,\n P_EXECUTE,\n P_AJAX_SOURCE,\n P_RENDER,\n P_RESET_VALUES,\n P_WINDOW_ID,\n CTX_PARAM_RENDER,\n SOURCE,\n HTML_TAG_FORM,\n CTX_OPTIONS_PARAMS,\n VIEW_ID,\n $faces,\n EMPTY_STR,\n NAMED_VIEWROOT,\n NAMING_CONTAINER_ID,\n CTX_PARAM_PPS,\n MYFACES_OPTION_PPS,\n $nsp,\n CTX_PARAM_UPLOAD_ON_PROGRESS,\n CTX_PARAM_UPLOAD_PREINIT,\n CTX_PARAM_UPLOAD_LOADSTART,\n CTX_PARAM_UPLOAD_LOADEND,\n CTX_PARAM_UPLOAD_LOAD, CTX_PARAM_UPLOAD_ERROR, CTX_PARAM_UPLOAD_ABORT, CTX_PARAM_UPLOAD_TIMEOUT\n} from \"./core/Const\";\nimport {\n resolveDefaults,\n resolveDelay,\n resolveForm,\n resolveTimeout, resolveViewId, resolveViewRootId, resoveNamingContainerMapper\n} from \"./xhrCore/RequestDataResolver\";\nimport {encodeFormData} from \"./util/FileUtils\";\nimport {XhrQueueController} from \"./util/XhrQueueController\";\n\n/*\n * allowed project stages\n */\nenum ProjectStages {\n Production = \"Production\",\n Development = \"Development\",\n SystemTest = \"SystemTest\",\n UnitTest = \"UnitTest\"\n}\n\n/*\n * Block-filter for the pass-through filtering; the attributes given here\n * will not be transmitted from the options into the pass-through\n */\nenum BlockFilter {\n onerror = \"onerror\",\n onevent = \"onevent\",\n render = \"render\",\n execute = \"execute\",\n myfaces = \"myfaces\",\n delay = \"delay\",\n timeout = \"timeout\",\n resetValues = \"resetValues\",\n windowId = \"windowId\",\n params = \"params\"\n}\n\n\n\n/**\n * Core Implementation\n * to distinct between api and impl\n *\n * The original idea was to make the implementation pluggable\n * but this is pointless, you always can overwrite the thin api layer\n * however a dedicated api makes sense for readability reasons\n */\nexport namespace Implementation {\n /*\n Small internal explanation, this code is optimized for readability\n and cuts off a ton of old legacy code.\n Aka older browsers are not supported anymore.\n We use a self written helper library to keep the number of external\n code dependencies down.\n The library is called mona-dish and started as a small sideproject of mine\n it provides following\n\n a) Monad like structures for querying because this keeps the code denser and adds abstractions\n that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides\n\n c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be\n transformed into different data representations\n\n examples:\n internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;\n passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID\n\n basically an abbreviation for\n\n internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;\n\n\n internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;\n passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored\n\n abbreviates:\n if(condition) {\n internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};\n internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;\n }\n\n\n d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish\n\n Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use\n\n */\n\n const trim = Lang.trim;\n const getMessage = ExtLang.getMessage;\n const getGlobalConfig = ExtLang.getGlobalConfig;\n import assert = Assertions.assert;\n const ofAssoc = ExtLang.ofAssoc;\n const collectAssoc = ExtLang.collectAssoc;\n\n let projectStage: string | null = null;\n let separator: string | null = null;\n let eventQueue: Function[] = [];\n let errorQueue: Function[] = [];\n export let requestQueue: XhrQueueController<XhrRequest> | null = null;\n /*error reporting threshold*/\n let threshold = \"ERROR\";\n\n /**\n * fetches the separator char from the given script tags\n *\n * @return {string} the separator char for the given script tags\n */\n export function getSeparatorChar(): string {\n return resolveGlobalConfig()?.separator ??\n (separator ??= ExtDomQuery.searchJsfJsFor(/separator=([^&;]*)/).orElse(\":\").value);\n }\n\n /**\n * this is for testing purposes only, since AjaxImpl is a module\n * we need to reset for every unit test its internal states\n */\n export function reset() {\n projectStage = null;\n separator = null;\n eventQueue = [];\n errorQueue = [];\n requestQueue = null;\n }\n\n /**\n * @return the project stage also emitted by the server:\n * it cannot be cached and must be delivered over the server\n * The value for it comes from the requestInternal parameter of the faces.js script called \"stage\".\n */\n export function getProjectStage(): string | null {\n return resolveGlobalConfig()?.projectStage ??\n (projectStage ??= resolveProjectStateFromURL());\n }\n\n /**\n * resolves the project stage as url parameter\n * @return the project stage or null\n */\n export function resolveProjectStateFromURL(): string | null {\n\n /* run through all script tags and try to find the one that includes faces.js */\n const foundStage = ExtDomQuery.searchJsfJsFor(/stage=([^&;]*)/).value as string;\n return (foundStage in ProjectStages) ? foundStage : ProjectStages.Production; // MYFACES-4572: default is production\n }\n\n /**\n * implementation of the faces.util.chain functionality\n *\n * @param source\n * @param event\n * @param funcs\n */\n export function chain(source: any, event: Event | null, ...funcs: EvalFuncs): boolean {\n // we can use our lazy stream each functionality to run our chain here.\n // by passing a boolean as return value into the onElem call\n // we can stop early at the first false, just like the spec requests\n\n let ret = true;\n funcs.every(func => {\n let returnVal = resolveAndExecute(source, event, func);\n if(returnVal === false) {\n ret = false;\n }\n //we short circuit in case of false and break the every loop\n return ret;\n });\n return ret;\n\n }\n\n /**\n * this function has to send the ajax requests\n *\n * following request conditions must be met:\n * <ul>\n * <li> the request must be sent asynchronously! </li>\n * <li> the request must be a POST!!! request </li>\n * <li> the request url must be the form action attribute </li>\n * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>\n * </ul>\n *\n * @param el any dom element no matter being it html or jsf, from which the event is emitted\n * @param event any javascript event supported by that object\n * @param opts map of options being pushed into the ajax cycle\n *\n * a) transformArguments out of the function\n * b) passThrough handling with a map copy with a filter map block map\n */\n export function request(el: ElemDef, event?: Event, opts ?: Options) {\n\n const {\n options,\n elem,\n elementId,\n windowId,\n isResetValues\n } = resolveDefaults(event, opts, el);\n const requestCtx = new ExtConfig({});\n const internalCtx = new ExtConfig({});\n\n Assertions.assertRequestIntegrity(options, elem);\n\n /**\n * fetch the parent form\n *\n * note we also add an override possibility here\n * so that people can use dummy forms and work\n * with detached objects\n */\n const form: DQ = resolveForm(elem, event);\n const viewId: string = resolveViewId(form);\n const formId = form.id.value;\n const delay: number = resolveDelay(options);\n const timeout: number = resolveTimeout(options);\n\n requestCtx.assignIf(!!windowId, P_WINDOW_ID).value = windowId;\n\n // old non - spec behavior will be removed after it is clear whether the removal breaks any code\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);\n\n // spec conform behavior, all passthrough params must be under \"passthrough\n const params = remapArrayToAssocArr(options.getIf(CTX_OPTIONS_PARAMS).orElse({}).value);\n //we turn off the remapping for the param merge, because we do not want to have\n //any namespacing to be remapped\n\n let ctxPassthrough = requestCtx.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;\n ctxPassthrough.$nspEnabled = false;\n ctxPassthrough.shallowMerge(new Config(params), true);\n //now we turn it on again\n ctxPassthrough.$nspEnabled = true;\n requestCtx.assignIf(!!event, CTX_PARAM_REQ_PASS_THR, P_EVT).value = event?.type;\n\n /**\n * ajax pass through context with the source\n * onresolved Event and onerror Event\n */\n requestCtx.assign(SOURCE).value = elementId;\n\n requestCtx.assign(VIEW_ID).value = viewId;\n\n /**\n * on resolvedEvent and onError...\n * those values will be traversed later on\n * also into the response context\n */\n requestCtx.assign(ON_EVENT).value = options.value?.onevent;\n requestCtx.assign(ON_ERROR).value = options.value?.onerror;\n\n /**\n * Fetch the myfaces config params\n */\n requestCtx.assign(MYFACES).value = options.value?.myfaces;\n\n /**\n * binding contract the jakarta.faces.source must be set\n */\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_AJAX_SOURCE).value = elementId;\n\n /**\n * jakarta.faces.partial.ajax must be set to true\n */\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_AJAX).value = true;\n\n /**\n * if resetValues is set to true\n * then we have to set jakarta.faces.resetValues as well\n * as pass through parameter\n * the value has to be explicitly true, according to\n * the specs jsdoc\n */\n requestCtx.assignIf(isResetValues, CTX_PARAM_REQ_PASS_THR, P_RESET_VALUES).value = true;\n\n // additional meta information to speed things up, note internal non jsf\n // pass through options are stored under _mfInternal in the context\n internalCtx.assign(CTX_PARAM_SRC_FRM_ID).value = formId;\n\n /**\n * special myfaces only internal parameter for onProgress until we have an official api\n * that way we can track the progress of a xhr request (useful for file uploads)\n */\n internalCtx.assign(CTX_PARAM_UPLOAD_PREINIT).value = options.value?.myfaces?.upload?.preinit;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOADSTART).value = options.value?.myfaces?.upload?.loadstart;\n internalCtx.assign(CTX_PARAM_UPLOAD_ON_PROGRESS).value = options.value?.myfaces?.upload?.progress;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOADEND).value = options.value?.myfaces?.upload?.loadend;\n internalCtx.assign(CTX_PARAM_UPLOAD_LOAD).value = options.value?.myfaces?.upload?.load;\n internalCtx.assign(CTX_PARAM_UPLOAD_ERROR).value = options.value?.myfaces?.upload?.error;\n internalCtx.assign(CTX_PARAM_UPLOAD_ABORT).value = options.value?.myfaces?.upload?.abort;\n internalCtx.assign(CTX_PARAM_UPLOAD_TIMEOUT).value = options.value?.myfaces?.upload?.timeout;\n\n // mojarra compatibility, mojarra is sending the form id as well\n // this is not documented behavior but can be determined by running\n // mojarra under blackbox conditions.\n // I assume it does the same as our formId_submit=1 so leaving it out\n // won't hurt but for the sake of compatibility we are going to add it\n requestCtx.assign(CTX_PARAM_REQ_PASS_THR, formId).value = formId;\n internalCtx.assign(CTX_PARAM_SRC_CTL_ID).value = elementId;\n // reintroduction of PPS as per myfaces 2.3 (myfaces.pps = true, only the executes are submitted)\n internalCtx.assign(CTX_PARAM_PPS).value = extractMyFacesParams(options.value)?.[MYFACES_OPTION_PPS] ?? false;\n\n\n assignClientWindowId(form, requestCtx);\n assignExecute(options, requestCtx, form, elementId);\n assignRender(options, requestCtx, form, elementId);\n assignNamingContainerData(internalCtx, form);\n\n //now we enqueue the request as asynchronous runnable into our request\n //queue and let the queue take over the rest\n queueHandler.addRequestToQueue(elem, form, requestCtx, internalCtx, delay, timeout);\n }\n\n /**\n * Spec. 13.3.3\n * Examining the response markup and updating the DOM tree\n * @param {XMLHttpRequest} request - the ajax request\n * @param {Object} context - the ajax context\n */\n export function response(request: XMLHttpRequest, context: Context) {\n Response.processResponse(request, context);\n }\n\n /**\n * adds an error handler to the error queue\n *\n * @param errorListener the error listener handler\n */\n export function addOnError(errorListener: IListener<ErrorData>) {\n errorQueue.push(errorListener);\n }\n\n /**\n * adds an event handler to the event queue\n *\n * @param eventListener the event listener handler\n */\n export function addOnEvent(eventListener: IListener<EventData>) {\n eventQueue.push(eventListener);\n }\n\n // noinspection JSUnusedLocalSymbols\n /**\n * sends an event to the event handlers\n *\n * @param data the event data object hosting the event data according to the spec @see EventData for what is reachable\n * @param localHandler an optional event handler, which is processed before the event handler chain\n */\n export function sendEvent(data: EventData, localHandler = function (data: EventData) {\n }) {\n /*now we serve the queue as well*/\n localHandler(data);\n eventQueue.forEach(fn => fn(data));\n }\n\n /**\n * error handler behavior called internally\n * and only into the impl it takes care of the\n * internal message transformation to a myfaces internal error\n * and then uses the standard send error mechanisms\n * also a double error logging prevention is done as well\n *\n * @param request the request currently being processed\n * @param context the context affected by this error\n * @param exception the exception being thrown\n * @param clearRequestQueue if set to true, clears the request queue of all pending requests\n */\n export function stdErrorHandler(request: XMLHttpRequest,\n context: Config,\n exception: Error,\n clearRequestQueue = false) {\n //newer browsers do not allow to hold additional values on native objects like exceptions\n //we hence capsule it into the request, which is gced automatically\n //on ie as well, since the stdErrorHandler usually is called between requests\n //this is a valid approach\n try {\n if (threshold == \"ERROR\") {\n let errorData = ErrorData.fromClient(exception);\n sendError(errorData);\n }\n } finally {\n if (clearRequestQueue) {\n requestQueue?.clear();\n }\n }\n }\n\n // noinspection JSUnusedLocalSymbols\n /**\n * implementation triggering the error chain\n *\n *\n *\n * handles the errors, in case of an onError exists within the context the onError is called as local error handler\n * the registered error handlers in the queue received an error message to be dealt with\n * and if the projectStage is at development an alert box is displayed\n *\n * note: we have additional functionality here, via the global config myfaces.config.defaultErrorOutput a function can be provided\n * which changes the default output behavior from alert to something else\n *\n * @param errorData the error data to be displayed\n * @param localHandler an optional local error handler which has to be processed before the error handler queue\n */\n export function sendError(errorData: ErrorData, localHandler = function (data: ErrorData) {\n }) {\n\n localHandler(errorData);\n errorQueue.forEach((errorCallback: Function) => {\n errorCallback(errorData);\n });\n let displayError: (message: any) => void = getGlobalConfig(\"defaultErrorOutput\", (console ? console.error : alert));\n displayError(errorData);\n }\n\n /**\n * @node optional element or id defining a rootnode where an element with the id \"jakarta.faces.windowId\" is hosted\n * @return the client window id of the current window, if one is given if none is found, null is returned\n */\n export function getClientWindow(node ?: Element | string): string | null {\n const ALTERED = \"___mf_id_altered__\";\n const INIT = \"___init____\";\n\n /*\n * the search root for the dom element search\n */\n\n\n let searchRoot = ((node) ? DQ.byId(node): DQ$(\"form\"));\n let inputs = searchRoot\n .filterSelector(`input[name='${$nsp(P_CLIENT_WINDOW)}']`)\n .orElseLazy(() => searchRoot.querySelectorAll(`input[name='${$nsp(P_CLIENT_WINDOW)}']`))\n\n /*\n * lazy helper to fetch the window id from the included faces.js\n */\n let fetchWindowIdFromJSFJS = (): Optional<string | null> => ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null);\n\n /*\n * fetch window id from the url\n */\n let fetchWindowIdFromURL = function (): Optional<string | null> {\n const href = window.location.href, windowId = \"jfwid\";\n const regex = new RegExp(\"[\\\\?&]\" + windowId + \"=([^&#\\\\;]*)\");\n const results = regex.exec(href);\n //initial trial over the url and a regexp\n if (results != null) return Optional.fromNullable(results[1]);\n return Optional.fromNullable(null);\n };\n\n /*\n * functional double check based on stream reduction\n * the values should be identical or on INIT value which is a premise to\n * skip the first check\n *\n * @param value1\n * @param value2\n */\n let differenceCheck = (value1: string, value2: string): string => {\n if(value1 == INIT) {\n return value2;\n } else if (value1 == ALTERED || value1 != value2) {\n return ALTERED;\n }\n return value2;\n };\n\n /*\n * helper for cleaner code, maps the value from an item\n *\n * @param item\n */\n let getValue = (item: DQ): string => item.val as string;\n /*\n * fetch the window id from the forms\n * window ids must be present in all forms\n * or non-existent. If they exist all of them must be the same\n */\n\n let formWindowId: string = inputs.asArray.map(getValue).reduce(differenceCheck, INIT);\n\n\n //if the resulting window id is set on altered then we have an unresolvable problem\n assert(ALTERED != formWindowId, \"Multiple different windowIds found in document\");\n\n /*\n * return the window id or null\n */\n return formWindowId != INIT ? formWindowId : (fetchWindowIdFromURL() || fetchWindowIdFromJSFJS()).value;\n }\n\n /**\n * collect and encode data for a given form element (must be of type form)\n * find the jakarta.faces.ViewState element and encode its value as well!\n * @return a concatenated string of the encoded values!\n *\n * @throws Error in case of the given element not being of type form!\n * https://issues.apache.org/jira/browse/MYFACES-2110\n */\n export function getViewState(form: Element | string): string {\n /**\n * type-check assert!, we opt for strong typing here\n * because it makes it easier to detect bugs\n */\n\n let element: DQ = DQ.byId(form, true);\n if (!element.isTag(HTML_TAG_FORM)) {\n throw new Error(getMessage(\"ERR_VIEWSTATE\"));\n }\n\n // determine the naming container scenario\n const dummyContext = new Config({});\n assignNamingContainerData(dummyContext, DQ.byId(form))\n // fetch all non file input form elements\n let formElements = element.deepElements.encodeFormElement()\n\n // encode them! (file inputs are handled differently and are not part of the viewstate)\n return encodeFormData(new ExtConfig(formElements), resoveNamingContainerMapper(dummyContext));\n }\n\n /**\n * this at the first sight looks like a weird construct, but we need to do it this way\n * for testing, we cannot proxy addRequestToQueue from the testing frameworks directly,\n * but we need to keep it under unit tests.\n */\n export let queueHandler = {\n /**\n * public to make it accessible for tests\n *\n * adds a new request to our queue for further processing\n */\n addRequestToQueue: function (elem: DQ, form: DQ, reqCtx: ExtConfig, respPassThr: Config, delay = 0, timeout = 0) {\n requestQueue = requestQueue ?? new XhrQueueController<XhrRequest>();\n requestQueue.enqueue(new XhrRequest(reqCtx, respPassThr, timeout), delay);\n }\n };\n\n //----------------------------------------------- Methods ---------------------------------------------------------------------\n\n /**\n * the idea is to replace some placeholder parameters with their respective values\n * placeholder params like @all, @none, @form, @this need to be replaced by\n * the values defined by the specification\n *\n * This function does it for the render parameters\n *\n * @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)\n * @param targetContext the receiving target context\n * @param issuingForm the issuing form\n * @param sourceElementId the executing element triggering the faces.ajax.request (id of it)\n */\n function assignRender(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {\n if (requestOptions.getIf(CTX_PARAM_RENDER).isPresent()) {\n remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_RENDER, <string>requestOptions.getIf(CTX_PARAM_RENDER).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);\n }\n }\n\n /**\n * the idea is to replace some placeholder parameters with their respective values\n * placeholder params like @all, @none, @form, @this need to be replaced by\n * the values defined by the specification\n *\n * This function does it for the execute parameters\n *\n * @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)\n * @param targetContext the receiving target context\n * @param issuingForm the issuing form\n * @param sourceElementId the executing element triggering the faces.ajax.request (id of it)\n */\n function assignExecute(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {\n\n if (requestOptions.getIf(CTX_OPTIONS_EXECUTE).isPresent()) {\n /*the options must be a blank delimited list of strings*/\n /*compliance with Mojarra which automatically adds @this to an execute\n * the spec rev 2.0a however states, if none is issued nothing at all should be sent down\n */\n requestOptions.assign(CTX_OPTIONS_EXECUTE).value = [requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, IDENT_THIS].join(\" \");\n remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_EXECUTE, <string>requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);\n } else {\n targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value = sourceElementId;\n }\n }\n\n /**\n * apply the browser tab where the request was originating from\n *\n * @param form the form hosting the client window id\n * @param targetContext the target context receiving the value\n */\n function assignClientWindowId(form: DQ, targetContext: Config) {\n\n let clientWindow = $faces().getClientWindow(form.getAsElem(0).value);\n if (clientWindow) {\n targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_CLIENT_WINDOW).value = clientWindow;\n }\n }\n\n /**\n * determines the current naming container\n * and assigns it internally\n *\n * @param internalContext\n * @param formElement\n * @private\n */\n function assignNamingContainerData(internalContext: Config, formElement: DQ) {\n const viewRootId = resolveViewRootId(formElement);\n\n if(!!viewRootId) {\n internalContext.assign(NAMED_VIEWROOT).value = true;\n internalContext.assign(NAMING_CONTAINER_ID).value = viewRootId;\n }\n }\n\n /**\n * transforms the user values to the expected values\n * handling '@none', '@all', '@form', and '@this' appropriately.\n * (Note: Although we could employ a simple string replacement method,\n * it could result in duplicate entries under certain conditions.)\n *\n * Specific standardized constants such as\n * '@all', '@none', '@form', and '@this'\n * require special treatment.\n *\n * @param targetConfig the target configuration receiving the final values\n * @param targetKey the target key\n * @param userValues the passed user values (aka input string which needs to be transformed)\n * @param issuingForm the form where the issuing element originates\n * @param issuingElementId the issuing element\n * @param rootNamingContainerId the naming container id (\"\" default if none is given)\n */\n function remapDefaultConstants(targetConfig: Config, targetKey: string, userValues: string, issuingForm: DQ, issuingElementId: string, rootNamingContainerId: string = \"\"): Config {\n //a cleaner implementation of the transform list method\n const SEP = $faces().separatorchar;\n let iterValues: string[] = (userValues) ? trim(userValues).split(/\\s+/gi) : [];\n let ret: string[] = [];\n let processed: {[key: string]: boolean} = {};\n\n /**\n * remaps the client ids for the portlet case so that the server\n * can deal with them either prefixed ir not\n * also resolves the absolute id case (it was assumed the server does this, but\n * apparently the RI does not, so we have to follow the RI behavior here)\n * @param componentIdToTransform the componentId which needs post-processing\n */\n const remapNamingContainer = (componentIdToTransform: string) => {\n // pattern :<anything> must be prepended by viewRoot if there is one,\n // otherwise we are in a not namespaced then only the id has to match\n const rootNamingContainerPrefix = (rootNamingContainerId.length) ? rootNamingContainerId+SEP : EMPTY_STR;\n let formClientId = issuingForm.id.value;\n // nearest parent naming container relative to the form\n const nearestNamingContainer = formClientId.substring(0, formClientId.lastIndexOf(SEP));\n const nearestNamingContainerPrefix = (nearestNamingContainer.length) ? nearestNamingContainer + SEP : EMPTY_STR;\n // Absolute search expressions, always start with SEP or the name of the root naming container\n const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;\n const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length\n && componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);\n let finalIdentifier: string;\n if (isAbsolutSearchExpr) {\n //we cut off the leading sep if there is one\n componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;\n componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;\n //now we prepend either the prefix or \"\" from the cut-off string to get the final result\n finalIdentifier = [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);\n } else { //relative search according to the javadoc\n //we cut off the root naming container id from the form\n if (formClientId.indexOf(rootNamingContainerPrefix) == 0) {\n formClientId = formClientId.substring(rootNamingContainerPrefix.length);\n }\n\n //If prependId = true, the outer form id must be present in the id if same form\n let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;\n finalIdentifier = hasPrependId ?\n [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR) :\n [nearestNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);\n }\n // We need to double-check because we have scenarios where we have a naming container\n // and no prepend (aka tobago testcase \"must handle ':' in IDs properly\", scenario 3,\n // in this case we return the component id, and be happy\n // we can roll a dom check here\n return DQ.byId(finalIdentifier).isPresent() ? finalIdentifier : componentIdToTransform;\n };\n\n // in this case we do not use lazy stream because it won´t bring any code reduction\n // or speedup\n for (let cnt = 0; cnt < iterValues.length; cnt++) {\n //avoid doubles\n if (iterValues[cnt] in processed) {\n continue;\n }\n switch (iterValues[cnt]) {\n //@none no values should be sent\n case IDENT_NONE:\n return targetConfig.delete(targetKey);\n //@all is a pass through case according to the spec\n case IDENT_ALL:\n targetConfig.assign(targetKey).value = IDENT_ALL;\n return targetConfig;\n //@form pushes the issuing form id into our list\n case IDENT_FORM:\n ret.push(remapNamingContainer(issuingForm.id.value));\n processed[issuingForm.id.value] = true;\n break;\n //@this is replaced with the current issuing element id\n case IDENT_THIS:\n if (!(issuingElementId in processed)) {\n ret.push(remapNamingContainer(issuingElementId));\n processed[issuingElementId] = true;\n }\n break;\n default:\n ret.push(remapNamingContainer(iterValues[cnt]));\n processed[iterValues[cnt]] = true;\n }\n }\n\n targetConfig.assign(targetKey).value = ret.join(\" \");\n return targetConfig;\n }\n\n /**\n * Filters the provided options using a blacklist to ensure\n * only pass-through parameters are processed for the Ajax request.\n *\n * Note that this issue is leftover from a previous implementation.\n * The specification-conforming behavior is to use parameters for pass-through values.\n * This will be addressed soon, after confirming that removal won't break any legacy code.\n *\n * @param {Context} mappedOpts - The options to be filtered.\n */\n function extractLegacyParams(mappedOpts: Options): {[key: string]: any} {\n //we now can use the full code reduction given by our stream api\n //to filter\n return ofAssoc(mappedOpts)\n .filter(((item: [string, any]) => !(item[0] in BlockFilter)))\n .reduce(collectAssoc, {});\n }\n\n /**\n * Extracts the MyFaces configuration parameters\n * that augment JSF with additional functionality.\n *\n * @param mappedOpts\n * @private\n */\n function extractMyFacesParams(mappedOpts: Options): {[key: string]: any} {\n //we now can use the full code reduction given by our stream api\n //to filter\n return ofAssoc(mappedOpts)\n .filter(((item: [string, any]) => (item[0] == \"myfaces\")))\n .reduce(collectAssoc, {})?.[MYFACES];\n }\n\n\n function remapArrayToAssocArr(arrayedParams: [[string, any]] | {[key: string]: any}): {[key: string]: any} {\n if(Array.isArray(arrayedParams)) {\n return arrayedParams.reduce(collectAssoc, {} as any);\n }\n return arrayedParams;\n }\n\n function resolveGlobalConfig(): any {\n return window?.[MYFACES]?.config ?? {};\n }\n\n /**\n * Private helper to execute a function or code fragment\n * @param source the source of the caller passed into the function as this\n * @param event an event which needs to be passed down into the function\n * @param func either a function or code fragment\n * @return a boolean value, if the passed function returns false, then the\n * caller is basically notified that the execution can now stop (JSF requirement for chain)\n * @private\n */\n function resolveAndExecute(source: any, event: Event | null, func: Function | string): boolean {\n if (\"string\" != typeof func) {\n //function is passed down as chain parameter, can be executed as is\n return (<Function>func).call(source, event) !== false;\n } else {\n //either a function or a string can be passed in case of a string we have to wrap it into another function\n //it is not a plain executable code but a definition\n let sourceCode = trim(<string>func);\n if (sourceCode.indexOf(\"function \") == 0) {\n sourceCode = `return ${sourceCode} (event)`;\n }\n return new Function(\"event\", sourceCode).call(source, event) !== false;\n }\n }\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Typescript port of the faces\\.push part in the myfaces implementation\n */\nimport {MAX_RECONNECT_ATTEMPTS, RECONNECT_INTERVAL} from \"./core/Const\";\nimport {DQ} from \"mona-dish\";\n\n/**\n * Implementation class for the push functionality\n */\nexport namespace PushImpl {\n\n // @deprecated because we can assume at least for the newer versions\n // that the protocol is properly set!\n const URL_PROTOCOL = DQ.global().location.protocol.replace(\"http\", \"ws\") + \"//\";\n\n\n // we expose the member variables for testing purposes\n // they are not directly touched outside of tests\n\n /* socket map by token */\n export type OpenCallback = (channel: string) => void;\n export type MessageCallback = (message: any, channel: string, event: MessageEvent) => void;\n export type ErrorCallback = (code: number, channel: string, event: CloseEvent) => void;\n export type CloseCallback = (code: number, channel: string, event?: CloseEvent) => void;\n\n type ComponentData = {\n channelToken: string;\n onopen: OpenCallback;\n onmessage: MessageCallback;\n onerror: ErrorCallback;\n onclose: CloseCallback;\n behaviors: any;\n autoconnect: boolean;\n };\n\n /** @internal */\n export let sockets: {[key: string]: Socket} = {};\n /* component attributes by clientId */\n /** @internal */\n export let components: {[key: string]: ComponentData} = {};\n /* client ids by token (share websocket connection) */\n /** @internal */\n export let clientIdsByTokens: {[key: string]: string[]} = {};\n\n // needed for testing\n /** @internal */\n export function reset() {\n Object.values(sockets).forEach(s => { try { s.close(); } catch(e) { /* ignore */ } });\n sockets = {};\n components = {};\n clientIdsByTokens = {};\n }\n\n /*\n * Api implementations, exposed functions\n */\n\n /**\n * @param socketClientId the sockets client identifier\n * @param url the uri to reach the socket\n * @param channel the channel name/id\n * @param onopen The function to be invoked when the web socket is opened.\n * @param onmessage The function to be invoked when a message is received.\n * @param onerror The function to be invoked when an error occurs.\n * @param onclose The function to be invoked when the web socket is closed.\n * @param behaviors functions which are invoked whenever a message is received\n * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.\n */\n export function init(socketClientId: string,\n url: string,\n channel: string,\n onopen: OpenCallback | string,\n onmessage: MessageCallback | string,\n onerror: ErrorCallback | string,\n onclose: CloseCallback | string,\n behaviors: any,\n autoConnect: boolean) {\n onclose = resolveFunction(onclose) as CloseCallback;\n\n if (!DQ.global().WebSocket) { // IE6-9.\n onclose(-1, channel);\n return;\n }\n\n let channelToken = url.substr(url.indexOf('?') + 1);\n\n if (!components[socketClientId]) {\n components[socketClientId] = {\n 'channelToken': channelToken,\n 'onopen': resolveFunction(onopen) as OpenCallback,\n 'onmessage' : resolveFunction(onmessage) as MessageCallback,\n 'onerror' : resolveFunction(onerror) as ErrorCallback,\n 'onclose': onclose,\n 'behaviors': behaviors,\n 'autoconnect': autoConnect};\n if (!clientIdsByTokens[channelToken]) {\n clientIdsByTokens[channelToken] = [];\n }\n clientIdsByTokens[channelToken].push(socketClientId);\n if (!sockets[channelToken]){\n sockets[channelToken] = new Socket(channelToken,\n getBaseURL(url), channel);\n }\n }\n\n if (autoConnect) {\n (DQ.global()?.faces ?? DQ.global()?.jsf).push.open(socketClientId);\n }\n }\n\n export function open(socketClientId: string) {\n getSocket(components[socketClientId]?.channelToken).open();\n }\n\n export function close(socketClientId: string) {\n getSocket(components[socketClientId].channelToken).close();\n }\n\n // Private helper classes\n // Private classes functions ----------------------------------------------------------------------------------\n /**\n * Creates a reconnecting web socket. When the web socket successfully connects on first attempt, then it will\n * automatically reconnect on timeout with cumulative intervals of 500ms with a maximum of 25 attempts (~3 minutes).\n * The <code>onclose</code> function will be called with the error code of the last attempt.\n * @constructor\n * @param {string} channelToken the channel token associated with this websocket connection\n * @param {string} url The URL of the web socket\n * @param {string} channel The name of the web socket channel.\n */\n\n class Socket {\n\n private socket: WebSocket | null = null;\n private reconnectAttempts = 0;\n private hasEverConnected = false;\n private hasNotifiedInitialOpenAttempt = false;\n\n constructor(private channelToken: string, private url: string, private channel: string) {\n }\n\n open() {\n if (this.socket && this.socket.readyState === 1) {\n return;\n }\n this.socket = new WebSocket(this.url);\n this.bindCallbacks();\n this.notifyInitialOpenAttempt();\n }\n\n // noinspection JSUnusedLocalSymbols\n onopen(event: any) {\n this.hasEverConnected = true;\n this.reconnectAttempts = 0;\n }\n\n onerror(event: any) {\n // Native WebSocket error events do not expose the close reason code.\n // Faces onerror is fired from onclose only when a reconnect is attempted.\n }\n\n onmessage(event: any) {\n let message = JSON.parse(event.data);\n let clientIds = clientIdsByTokens[this.channelToken];\n if (!clientIds) return; // socket was torn down (reset()) while message was pending\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n if (document.getElementById(socketClientId)) {\n try {\n components[socketClientId]?.['onmessage']?.(message, this.channel, event);\n } catch (e) {\n //Ignore\n }\n let behaviors = components?.[socketClientId]?.['behaviors'];\n let functions = behaviors?.[message];\n if (functions && functions.length) {\n for (let j = 0; j < functions.length; j++) {\n try {\n functions[j](null);\n } catch (e) {\n //Ignore\n }\n }\n }\n } else {\n clientIds.splice(i, 1);\n }\n }\n if (clientIds.length === 0) {\n // tag disappeared\n this.close();\n }\n }\n\n onclose(event: any) {\n if (this.isTerminalClose(event)) {\n this.notifyClose(event);\n this.resetConnectionState();\n return;\n }\n\n if (!this.notifyErrorAndPruneMissingComponents(event)) return;\n if (this.closeIfChannelHasNoComponents()) return;\n\n this.scheduleReconnect();\n };\n\n close() {\n if (this.socket) {\n let s = this.socket;\n this.socket = null;\n s.close();\n }\n }\n\n private notifyInitialOpenAttempt() {\n if (this.reconnectAttempts || this.hasNotifiedInitialOpenAttempt) return;\n\n this.hasNotifiedInitialOpenAttempt = true;\n let clientIds = clientIdsByTokens[this.channelToken];\n if (!clientIds) return; // socket was torn down (reset()) while timer was pending\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n components[socketClientId]?.['onopen']?.(this.channel);\n }\n }\n\n private isTerminalClose(event: any): boolean {\n return !this.socket\n // Spec: no reconnect when the very first connection attempt fails.\n // onerror must also not be invoked in this case, only onclose.\n || !this.hasEverConnected\n // Spec: code 1000 (normal closure) is always terminal, regardless of reason.\n || event.code === 1000\n // 1008 = Policy Violation. Reconnecting would hit the same rejection again.\n || event.code === 1008\n || this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS;\n }\n\n private notifyClose(event: any) {\n let clientIds = clientIdsByTokens[this.channelToken];\n if (!clientIds) return; // already torn down (reset() called while socket was open)\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n components?.[socketClientId]?.['onclose']?.(event?.code, this?.channel, event);\n }\n }\n\n private resetConnectionState() {\n this.reconnectAttempts = 0;\n this.hasEverConnected = false;\n this.hasNotifiedInitialOpenAttempt = false;\n }\n\n private notifyErrorAndPruneMissingComponents(event: any): boolean {\n let clientIds = clientIdsByTokens[this.channelToken];\n if (!clientIds) return false; // already torn down (reset() called while socket was open)\n for (let i = clientIds.length - 1; i >= 0; i--) {\n let socketClientId = clientIds[i];\n if (document.getElementById(socketClientId)) {\n try {\n components?.[socketClientId]?.['onerror']?.(event?.code, this?.channel, event);\n } catch (e) {\n //Ignore\n }\n } else {\n clientIds.splice(i, 1);\n }\n }\n return true;\n }\n\n private closeIfChannelHasNoComponents(): boolean {\n if (clientIdsByTokens[this.channelToken]?.length !== 0) return false;\n\n // tag disappeared\n this.close();\n return true;\n }\n\n private scheduleReconnect() {\n const reconnectAttempt = ++this.reconnectAttempts;\n this.socket = null;\n setTimeout(() => this.open(), RECONNECT_INTERVAL * reconnectAttempt);\n }\n\n /**\n * bind the callbacks to the socket callbacks\n */\n private bindCallbacks() {\n this.socket!.onopen = (event: Event) => this.onopen(event);\n this.socket!.onmessage = (event: Event) => this.onmessage(event);\n this.socket!.onclose = (event: Event) => this.onclose(event);\n this.socket!.onerror = (event: Event) => this.onerror(event);\n }\n }\n\n // Private static functions ---------------------------------------------------------------------------------------\n // @deprecated because we can assume at least for the newer versions\n // that the protocol is properly set!\n // https://issues.apache.org/jira/browse/MYFACES-4718\n // This needs further investigation\n function getBaseURL(url: string) {\n if (url.indexOf(\"://\") < 0) {\n let base = DQ.global().location.hostname + \":\" + DQ.global().location.port;\n return URL_PROTOCOL + base + url;\n } else {\n return url;\n }\n }\n\n /**\n * Get socket associated with given channelToken.\n * @param channelToken The name of the web socket channelToken.\n * @return Socket associated with given channelToken.\n * @throws Error, when the channelToken is unknown, you may need to initialize\n * it first via <code>init()</code> function.\n */\n function getSocket(channelToken: string): Socket {\n let socket = sockets[channelToken];\n if (socket) {\n return socket;\n } else {\n throw new Error(\"Unknown channelToken: \" + channelToken);\n }\n }\n\n function resolveFunction<T extends Function>(fn?: T | string | null): T {\n if (typeof fn === \"function\") return fn as T;\n if (typeof fn === \"string\" && typeof DQ.global()[fn] === \"function\") return DQ.global()[fn] as T;\n return (() => {}) as unknown as T;\n }\n\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {DQ} from \"mona-dish\";\nimport {ExtLang} from \"../impl/util/Lang\";\n\n/**\n * legacy code to enable various aspects\n * of myfaces, used to be rendered inline\n * for jsf 2.0 we can externalize it into its own custom resource\n *\n * note this is a straight 1:1 port from the existing codebase\n * (not too much work has been spent here, the important thing is, that\n * the namespace and functions need to be kept intact for legacy code)\n *\n * we might move the code over in the future, but for now a straight 1:1 port suffices\n */\nexport namespace oam {\n const ofAssoc = ExtLang.ofAssoc;\n /**\n * sets a hidden input field\n * @param formName the formName\n * @param name the hidden field\n * @param value the value to be rendered\n */\n export const setHiddenInput = function (formName: string, name: string, value: string): void {\n const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};\n DQ.byId(forms[formName])\n .each(form => {\n const input = form.querySelectorAll(`input[type='hidden'][name='${name}']`);\n if (input.isPresent()) {\n input.inputValue.value = value;\n } else {\n const newInput = DQ.fromMarkup(`<input type='hidden' id='${name}' name='${name}'>`);\n newInput.inputValue.value = value;\n newInput.appendTo(form);\n }\n });\n };\n\n /**\n * clears a hidden input field\n *\n * @param formName formName for the input\n * @param name the name of the input field\n */\n export const clearHiddenInput = function (formName: string, name: string): void {\n const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};\n const elements = forms?.[formName]?.elements as HTMLFormControlsCollection & {[key: string]: Element};\n let element = elements?.[name];\n if(!element) {\n return;\n }\n DQ.byId(element).delete();\n };\n\n // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols\n /**\n * does special form submit remapping\n * re-maps the issuing command link into something,\n * the \"decode\" of the command link on the server can understand\n *\n * @param formName\n * @param linkId\n * @param target\n * @param params\n */\n export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params: Record<string, any> | [string, any][] | null = {} ): boolean {\n\n\n //handle a possible incoming null, not sure if this is used that way anywhere, but we allow it\n params = (!params) ? {} : params;\n\n let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\\$:').replace(/:/g, '_');\n window?.[clearFn]?.(formName);\n\n //autoscroll code\n if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {\n myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());\n }\n let paramsStream: Array<[string, any]> = Array.isArray(params) ? [...params] : ofAssoc(params);\n paramsStream.forEach(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));\n\n //we call the namespaced function, to allow decoration, via a direct call we would\n myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');\n\n\n const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};\n DQ.byId(forms?.[formName] ?? document.getElementById(formName)).each(form => {\n const ATTR_TARGET = \"target\";\n const formElement = form.getAsElem(0).value as HTMLFormElement;\n const oldTarget = (form.getAsElem(0).value as HTMLFormElement).getAttribute(\"target\");\n\n if(target != \"null\" && target) {\n (form.getAsElem(0).value as HTMLFormElement).setAttribute(\"target\", target);\n }\n\n const result = formElement?.onsubmit?.(null as any);\n\n try {\n if ((!!result) || 'undefined' == typeof result) {\n formElement.submit();\n }\n } catch (e) {\n window?.console.error(e);\n } finally {\n if(oldTarget == null || oldTarget == \"null\") {\n (form.getAsElem(0).value as HTMLFormElement).removeAttribute(\"target\");\n } else {\n (form.getAsElem(0).value as HTMLFormElement).setAttribute(\"target\", oldTarget);\n }\n\n // noinspection JSUnusedLocalSymbols\n paramsStream.forEach(([key, data]) => {\n myfaces.oam.clearHiddenInput(formName, key);\n });\n myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);\n }\n\n });\n return false;\n };\n}\n","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {Implementation} from \"../impl/AjaxImpl\";\nimport {PushImpl} from \"../impl/PushImpl\";\nimport {oam as _oam} from \"../myfaces/OamSubmit\";\nimport {$nsp, CTX_OPTIONS_EXECUTE, CTX_OPTIONS_PARAMS, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from \"../impl/core/Const\";\n\n//we use modules to get a proper jsdoc and static/map structure in the calls\n//as per spec requirement\nexport namespace faces {\n\n /**\n * Project stage values, mirroring jakarta.faces.application.ProjectStage.\n */\n export type ProjectStage = \"Development\" | \"UnitTest\" | \"SystemTest\" | \"Production\";\n\n /**\n * Status values sent to ajax event callbacks.\n */\n export type AjaxEventStatus = \"begin\" | \"complete\" | \"success\";\n\n /**\n * Status values sent to ajax error callbacks.\n */\n export type AjaxErrorStatus = \"httpError\" | \"emptyResponse\" | \"malformedXML\" | \"serverError\";\n\n /**\n * Common shape for the data passed to ajax callbacks.\n */\n export interface AjaxData {\n source?: Element;\n responseCode?: number;\n responseText?: string;\n responseXML?: XMLDocument;\n }\n\n /**\n * Data passed to ajax event callbacks.\n */\n export interface AjaxEvent extends AjaxData {\n type: \"event\";\n status: AjaxEventStatus;\n }\n\n /**\n * Data passed to ajax error callbacks.\n */\n export interface AjaxError extends AjaxData {\n type: \"error\";\n status: AjaxErrorStatus | \"clientError\" | \"timeout\";\n errorName?: string;\n errorMessage?: string;\n /** @deprecated MyFaces compatibility alias. */\n serverErrorName?: string;\n /** @deprecated MyFaces compatibility alias. */\n serverErrorMessage?: string;\n /** MyFaces compatibility detail. */\n description?: string;\n /** MyFaces compatibility detail. */\n typeDetails?: unknown;\n }\n\n\n /**\n * Version of the implementation for the faces.ts.\n * <p />\n * as specified within the jsf specifications faces.html:\n * <ul>\n * <li>left two digits major release number</li>\n * <li>middle two digits minor spec release number</li>\n * <li>right two digits bug release number</li>\n * </ul>\n */\n export const specversion: number = 400000;\n /**\n * Implementation version as specified within the jsf specification.\n * <p />\n * A number increased with every implementation version\n * and reset by moving to a new spec release number\n *\n */\n export const implversion: number = 0;\n\n /**\n * SeparatorChar as defined by facesContext.getNamingContainerSeparatorChar()\n */\n export const separatorchar: string = getSeparatorChar();\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Context Path as defined externalContext.requestContextPath\n */\n export const contextpath: string = '#{facesContext.externalContext.requestContextPath}';\n // we do not have a fallback here, for now\n\n /**\n * This method is responsible for the return of a given project stage as defined\n * by the jsf specification.\n * <p/>\n * Valid return values are:\n * <ul>\n * <li>&quot;Production&quot;</li>\n * <li>&quot;Development&quot;</li>\n * <li>&quot;SystemTest&quot;</li>\n * <li>&quot;UnitTest&quot;</li>\n * </li>\n *\n * @return {String} the current project state emitted by the server side method:\n * <i>jakarta.faces.application.Application.getProjectStage()</i>\n */\n export function getProjectStage(): ProjectStage {\n return Implementation.getProjectStage() as ProjectStage;\n }\n\n /**\n * collect and encode data for a given form element (must be of type form)\n * find the jakarta.faces.ViewState element and encode its value as well!\n * return a concatenated string of the encoded values!\n *\n * @throws an exception in case of the given element not being of type form!\n * https://issues.apache.org/jira/browse/MYFACES-2110\n */\n export function getViewState(formElement: Element | string): string {\n return Implementation.getViewState(formElement);\n }\n\n /**\n * returns the window identifier for the given node / window\n * @return the window identifier or null if none is found\n * @param rootNode\n */\n export function getClientWindow(rootNode?: Element | string): string | null {\n return Implementation.getClientWindow(rootNode);\n }\n\n // private helper functions\n function getSeparatorChar(): string {\n const sep = '#{facesContext.namingContainerSeparatorChar}';\n //We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior\n //the idea is that the separator char is provided from the underlying container, but if not then we\n //will perform a fallback (aka 2.3 has the url fallback behavior)\n return (sep.match(/\\#\\{facesContext.namingContainerSeparatorChar\\}/gi)) ? Implementation.getSeparatorChar() : sep;\n }\n\n\n\n\n export namespace ajax {\n \"use strict\";\n\n /**\n * Callback signature for ajax lifecycle events.\n */\n export type OnEventCallback = (data: AjaxEvent) => void;\n\n /**\n * Callback signature for ajax errors.\n */\n export type OnErrorCallback = (data: AjaxError) => void;\n\n /**\n * Options object for faces.ajax.request.\n */\n export interface RequestOptions {\n execute?: string;\n render?: string;\n onevent?: OnEventCallback;\n onerror?: OnErrorCallback;\n params?: Record<string, string | number | boolean>;\n delay?: number | \"none\";\n resetValues?: boolean;\n /** MyFaces extension/pass-through compatibility. */\n [key: string]: any;\n }\n\n /**\n * Per-request context object passed to faces.ajax.response.\n */\n export interface RequestContext {\n sourceid?: string;\n onerror?: OnErrorCallback;\n onevent?: OnEventCallback;\n /** MyFaces extension/pass-through compatibility. */\n [key: string]: any;\n }\n\n /**\n * this function has to send the ajax requests\n *\n * following request conditions must be met:\n * <ul>\n * <li> the request must be sent asynchronously! </li>\n * <li> the request must be a POST!!! request </li>\n * <li> the request url must be the form action attribute </li>\n * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>\n * </ul>\n *\n * @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted\n * @param {EVENT} event: any javascript event supported by that object\n * @param {Map} options : map of options being pushed into the ajax cycle\n */\n export function request(element: Element | string, event?: Event | null, options?: RequestOptions): void {\n Implementation.request(element, event as any, options as any)\n }\n\n /**\n * response handler\n * @param request the request object having triggered this response\n * @param context the request context\n *\n */\n export function response(request: XMLHttpRequest, context?: RequestContext): void {\n Implementation.response(request, context as any);\n }\n\n /**\n * Adds an error handler to our global error queue.\n * the error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>\n * with errorData being of following format:\n * <ul>\n * <li> errorData.type : &quot;error&quot;</li>\n * <li> errorData.status : the error status message</li>\n * <li> errorData.serverErrorName : the server error name in case of a server error</li>\n * <li> errorData.serverErrorMessage : the server error message in case of a server error</li>\n * <li> errorData.source : the issuing source element which triggered the request </li>\n * <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>\n * <li> eventData.responseText: the request response text </li>\n * <li> eventData.responseXML: the request response xml </li>\n * </ul>\n *\n * @param errorFunc error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>\n */\n export function addOnError(errorFunc: OnErrorCallback): void {\n Implementation.addOnError(errorFunc as any);\n }\n\n /**\n * Adds a global event listener to the ajax event queue. The event listener must be a function\n * of following format: <i>function eventListener(&lt;eventData&gt;)</i>\n *\n * @param eventFunc event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>\n */\n export function addOnEvent(eventFunc: OnEventCallback): void {\n Implementation.addOnEvent(eventFunc as any);\n }\n }\n\n export namespace util {\n\n /**\n * varargs function which executes a chain of code (functions or any other code)\n *\n * if any of the code returns false, the execution\n * is terminated prematurely skipping the rest of the code!\n *\n * @param {HTMLElement | String} source, the callee object\n * @param {Event} event, the event object of the callee event triggering this function\n * @param funcs ... arbitrary array of functions or strings\n * @returns true if the chain has succeeded false otherwise\n */\n export function chain(source: HTMLElement | string, event?: Event | null, ...funcs: Array<Function | string>): boolean {\n return Implementation.chain(source, event ?? null, ...(funcs as EvalFuncs));\n }\n }\n\n export namespace push {\n /**\n * Invoked when the websocket is opened.\n */\n export type OnOpenHandler = (channel: string) => void;\n\n /**\n * Invoked when a message is received from the server.\n */\n export type OnMessageHandler = (message: unknown, channel: string, event: MessageEvent) => void;\n\n /**\n * Invoked when a connection error occurs and the websocket will attempt to reconnect.\n */\n export type OnErrorHandler = (code: number, channel: string, event: CloseEvent) => void;\n\n /**\n * Invoked when the websocket is closed and will not attempt to reconnect.\n */\n export type OnCloseHandler = (code: number, channel: string, event: CloseEvent) => void;\n\n /**\n * @param socketClientId the sockets client identifier\n * @param url the uri to reach the socket\n * @param channel the channel name/id\n * @param onopen The function to be invoked when the web socket is opened.\n * @param onmessage The function to be invoked when a message is received.\n * @param onerror The function to be invoked when an error occurs.\n * @param onclose The function to be invoked when the web socket is closed.\n * @param behaviors functions which are invoked whenever a message is received\n * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.\n */\n export function init(socketClientId: string,\n url: string,\n channel: string,\n onopen: OnOpenHandler | string | null,\n onmessage: OnMessageHandler | string | null,\n onerror: OnErrorHandler | string | null,\n onclose: OnCloseHandler | string | null,\n behaviors: Record<string, Array<() => void>>,\n autoConnect: boolean): void {\n PushImpl.init(socketClientId, url, channel, onopen as any, onmessage as any, onerror as any, onclose as any, behaviors, autoConnect);\n }\n\n /**\n * Open the web socket on the given channel.\n * @param socketClientId The name of the web socket channel.\n * @throws Error is thrown, if the channel is unknown.\n */\n export function open(socketClientId: string): void {\n PushImpl.open(socketClientId);\n }\n\n /**\n * Close the web socket on the given channel.\n * @param socketClientId The id of the web socket client.\n * @throws Error is thrown, if the channel is unknown.\n */\n export function close(socketClientId: string): void {\n PushImpl.close(socketClientId);\n }\n\n }\n}\n\nexport namespace myfaces {\n /**\n * AB function similar to mojarra and Primefaces\n * not part of the spec but a convenience accessor method\n * Code provided by Thomas Andraschko\n *\n * @param source the event source\n * @param event the event\n * @param eventName event name for java.jakarta.faces.behavior.event\n * @param execute execute list as passed down in faces.ajax.request\n * @param render the render list as string\n * @param options the options which need to be merged in\n * @param userParameters a set of user parameters which go into the final options under params, they can override whatever is passed via options\n */\n export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: faces.ajax.RequestOptions = {}, userParameters: faces.ajax.RequestOptions = {}): void {\n if(!options) {\n options = {};\n }\n if(!userParameters) {\n userParameters = {};\n }\n if (eventName) {\n options[CTX_OPTIONS_PARAMS] = options?.[CTX_OPTIONS_PARAMS] ?? {};\n options[CTX_OPTIONS_PARAMS][$nsp(P_BEHAVIOR_EVENT)] = eventName;\n }\n if (execute) {\n options[CTX_OPTIONS_EXECUTE] = execute;\n }\n if (render) {\n options[CTX_PARAM_RENDER] = render;\n }\n\n //we push the users parameters in\n if (!options[\"params\"]) {\n options[\"params\"] = {};\n }\n\n for (let key in userParameters) {\n options[\"params\"][key] = userParameters[key];\n }\n\n (window?.faces ?? window.jsf).ajax.request(source, event, options as any);\n }\n\n\n const onReadyChain: Array<() => void> = [];\n let readyStateListener: (() => void) | null = null;\n // noinspection JSUnusedGlobalSymbols\n /**\n * Helper function in the myfaces namespace to handle document ready properly for the load case\n * the ajax case, does not need proper treatment, since it is deferred anyway.\n * Used by command script as helper function!\n *\n * @param executionFunc the function to be executed upon ready\n */\n export function onDomReady(executionFunc: () => void) {\n if(document.readyState !== \"complete\") {\n onReadyChain.push(executionFunc);\n if(!readyStateListener) {\n readyStateListener = () => {\n window.removeEventListener(\"DOMContentLoaded\", readyStateListener!);\n readyStateListener = null;\n try {\n onReadyChain.forEach(func => func());\n } finally {\n //done we clear now the ready chain\n onReadyChain.length = 0;\n }\n };\n window.addEventListener(\"DOMContentLoaded\", readyStateListener);\n }\n } else {\n if(readyStateListener) {\n readyStateListener();\n }\n executionFunc();\n }\n\n }\n\n /**\n * reserve a namespace for the given string\n * @param namespace the namespace to reserve with '.' as separator\n */\n export function reserveNamespace(namespace: string): void {\n let current: any = window;\n const namespaces = namespace.split(\".\");\n for(const part of namespaces) {\n current[part] = current[part] || {};\n current = current[part];\n }\n }\n\n /**\n * legacy oam functions\n */\n export const oam = _oam;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*! Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * faces.js init layer which provides as per spec the proper\n * window namespace if it does not exist already\n *\n * The idea is that we use a small shim on top of\n * the implementation to provide the window namespace.\n * The implementation itself is in a protected namespace\n * which will be bound by the build system\n *\n * The documentation nevertheless targets the _api file, which\n * hosts the full api\n */\nif(!window.faces) {\n //we lazily load the code to prevent ram bloat\n const myfacesApi = require(\"./_api\").faces;\n window['faces'] = window?.faces ?? myfacesApi;\n}\nif(!window?.myfaces?.ab) {\n const myfaces = require(\"./_api\").myfaces;\n\n //namespace might be extended is not exclusively reserved so we merge\n (window as any)[\"myfaces\"] = window?.myfaces ?? {};\n Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);\n}\nexport var faces = window.faces;\nexport var myfaces = window.myfaces;\n"],"names":["MAX_ARG_LENGTH","pushChunked","target","source","start","len","length","Array","prototype","push","apply","slice","call","Es2019Array_","constructor","another","super","isArray","_another","this","flatMap","flatMapFun","_flatMap","flat","flatLevel","_flat","map","callbackfn","thisArg","_Es2019ArrayFromArr","concat","items","reverse","end","splice","deleteCount","filter","predicate","reduce","initialValue","flatDepth","_flatResolve","arr","res","forEach","item","mapped","Es2019ArrayFrom","mapperFunction","data","ret","Proxy","get","p","receiver","isNaN","parseInt","set","property","value","Lang","Es2019Array","Monad","_value","fn","inVal","result","Optional","fromNullable","isAbsent","isPresent","presentRunnable","absent","ifPresentLazy","orElse","elseValue","orElseLazy","func","val","getIf","key","preprocessKeys","currentPos","cnt","currKey","keyVal","arrPos","arrayIndex","getClass","getIfPresent","match","defaultVal","toJson","JSON","stringify","indexOf","substring","resolve","resolver","e","keys","split","replace","ValueEmbedder","rootElem","valueKey","newVal","alternative","trim","str","ws","i","test","charAt","isString","it","arguments","String","saveResolve","resolverProducer","defaultValue","saveResolveLazy","strToArray","splitter","element","objToArray","obj","offset","pack","equalsIgnoreCase","destination","finalDest","toLowerCase","assertType","probe","theType","isFunc","Function","objAssign","theArgs","TypeError","to","Object","assign","nextSource","getOwnPropertySymbols","sym","propertyIsEnumerable","IgnoreAssign","parent","AssocArray_assign","accessPath","lastPathItem","buildPath","append","alloc","toAdd","flattenAccessPath","path","parentPtr","parKeyArrPos","Error","nextArrPos","dataPresent","simpleShallowMerge","assocArrays","shallowMerge","overwrite","withAppend","toAssign","oldVal","newVals","_appendWithOverwrite","_appendWithoutOverwrite","ConfigEntry","Config","root","configDef","shallowCopy","shallowCopy$","deepCopy","deepCopy$","other","newThis","getOwnPropertyNames","appendIf","condition","assignIf","assertAccessPath","currPtr","accessKeyIndex","setVal","currAccessPos","_b","_a","find","_e","_d","_c","_f","_g","_j","_h","isNoArray","ITERATION_STATUS","calculateSkips","next_strm","pos","lookAhead","EO_STRM","MultiStreamDatasource","first","strms","selectedPos","strm","activeStrm","current","hasNext","findNextStrm","all_strms","shift","next","reset","ArrayStreamDataSource","dataPos","ofArray","Math","max","FilteredStreamDatasource","filterFunc","_current","BEF_STRM","_filterIdx","_unfilteredPos","inputDataSource","steps","found","lookupVal","loop","MappedStreamDataSource","mapFunc","lookAheadVal","ArrayCollector","collect","finalValue","_global$","globalThis","window","__webpack_require__","g","eqi","prependChunked","elements","prepend","NonceValueEmbedder","rootElems","nonce","getAttribute","setAttribute","ALLOWED_SUBMITTABLE_ELEMENTS","ElementAttribute","name","values","Style","style","DEFAULT_WHITELIST","DomQuery","rootNode","_limits","foundElement","querySelectorAll","getAsElem","allElems","global","stream","lazyStream","id","tagName","nodeName","isTag","type","inputValue","nodeId","checked","every","el","newChecked","eachElem","deepElements","querySelectorAllDeep","queryStr","queryRes","shadowRoots","_collectShadowRoots","shadowRes","all","shadowRoot","disabled","attr","removeAttribute","childNodes","childNodeArr","asArray","byId","offsetWidth","elem","accumulate","incoming","offsetHeight","offsetLeft","offsetTop","asNodeArray","selector","document","_querySelectorAllDeep","_querySelectorAll","deep","byIdDeep","byTagName","globalEval","code","globalEvalSticky","fromMarkup","markup","doc","implementation","createHTMLDocument","lowerMarkup","search","documentElement","innerHTML","startsWithTag","tag1","join","tag2","dummyPlaceHolder","createElement","html","detach","index","defaults","filesFromElem","files","node","parentNode","removeChild","closest","_closestDeep","_closest","includeRoot","subItems","cssProperty","hasClass","clazz","hasIt","classList","contains","addClass","add","removeClass","remove","isMultipartCandidate","FILE_INPUT","matchesSelector","newInnerHTML","dispatchEvent","evt","retArr","innerHtml","newInnerHtml","filterSelector","matched","_matchesSelector","some","nodeSelector","selectorStage","firstElem","lastElem","each","toReplace","asElem","parentElement","nextElement","nextElementSibling","previousElement","previousElementSibling","insertBefore","insertAfter","delete","last","lastNode","reArr","head","getElementsByTagName","script","newScriptElement","appendChild","applyNonce","appendTo","loadScriptEval","src","delay","_loadScriptEval","loadScriptEvalSticky","toInsertParams","existingItem","existingElement","nextSibling","insertElem","allParents","firstParent","parentsWhileMatch","host","copyAttrs","sourceItem","sourceNode","attrs","attributes","resolveAttributeHolder","outerHTML","runEmbeddedScripts","runEmbeddedCss","activeElement","focusElementId","restoreFocus","caretPosition","getCaretPosition","nodes","firstInsert","replaced","replaceChild","insertAdditionalItems","runScripts","runCss","focusElement","setCaretPosition","sticky","whitelisted","evalCollectedScripts","scriptsToProcess","joinedScripts","evalText","finalScripts","allowedItemTypes","execScript","itemType","text","innerText","go","sort","node1","node2","compareDocumentPosition","console","error","message","description","_toReplace","newElement","execCss","click","fireEvent","addEventListener","listener","options","removeEventListener","eventName","finalOptions","bubbles","cancelable","ownerDocument","nodeType","EventClass","Event","MouseEvent","KeyboardEvent","event","synthetic","createEventObject","textContent","joinString","text1","text2","encodeFormElement","toMerge","elemType","selectElem","selectedIndex","uLen","u","selected","elementOption","SELECT","BUTTON","RESET","SUBMIT","IMAGE","CHECKBOX","RADIO","uploadedFiles","filesArr","from","cDATAAsString","reduced","subNodes","min","limits","isLimitsReached","isEndOfArray","attachShadow","params","mode","shadowElement","waitUntilDom","condition_1","childList","subtree","timeout","interval","Promise","success","observer","MUT_ERROR","findElement","MutationObserver","mutTimeout","setTimeout","disconnect","callback","mutationList","mut","clearTimeout","observableOpts","observe","setInterval","clearInterval","shadowElements","hasShadow","ctrl","selectionStart","focus","setSelectionRange","Symbol","iterator","done","toAttach","filterDoubles","domQueries","idx","notFound","prependTo","foundNodes","selectors","cnt2","levelSelector","toMatch","matches","foundElements","srcNode","createSourceNode","nonceCheck","marker","Date","now","random","attrName","DQ","DQ$","PromiseStatus","XmlQuery_isString","XMLQuery","docType","xml","DOMParser","parser","ActiveXObject","async","parseFromString","contentType","loadXML","createIe11DomQueryShim","isXMLParserError","toString","serialized","XMLSerializer","serializeToString","parserErrorText","joinstr","parseXML","txt","parseHTML","fromString","parseType","FlatMapStreamDataSource","activeDataSource","walkedDataSources","_currPos","resolveActiveHasNext","resolveNextHasNext","dsLoop","datasourceData","mappedData","currentDataSource","toDatasource","ds","Stream","of","ofArr","ofAssoc","ofDataSource","dataSource","ofDomQuery","ofConfig","toAppend","toConcat","onElem","inval","strmR","startVal","val1","anyMatch","allMatch","noneMatch","comparator","newArr","collector","LazyStream","ofStreamDataSource","isOverLimits","nextFilter","t","stop","value1","value2","el1","el2","defineProperty","Reflect","customElements","polyfillWrapFlushCallback","a","HTMLElement","construct","setPrototypeOf","NAMED_VIEWROOT","P_AJAX_SOURCE","NAMING_CONTAINER_ID","VIEW_ID","P_VIEWSTATE","P_CLIENT_WINDOW","EMPTY_FUNC","freeze","EMPTY_STR","HTML_VIEWSTATE","HTML_CLIENT_WINDOW","IDENT_ALL","IDENT_NONE","IDENT_THIS","P_EXECUTE","P_RENDER","P_RENDER_OVERRIDE","P_WINDOW_ID","P_BEHAVIOR_EVENT","CTX_PARAM_RENDER","ON_ERROR","ON_EVENT","BEGIN","SOURCE","ERROR_NAME","ERROR_MESSAGE","RESPONSE_XML","HTTP_ERROR","EMPTY_RESPONSE","MALFORMEDXML","CTX_OPTIONS_PARAMS","CTX_OPTIONS_TIMEOUT","CTX_OPTIONS_EXECUTE","CTX_PARAM_MF_INTERNAL","CTX_PARAM_SRC_FRM_ID","CTX_PARAM_UPLOAD_ON_PROGRESS","CTX_PARAM_UPLOAD_PREINIT","CTX_PARAM_UPLOAD_LOADSTART","CTX_PARAM_UPLOAD_LOADEND","CTX_PARAM_UPLOAD_LOAD","CTX_PARAM_UPLOAD_ERROR","CTX_PARAM_UPLOAD_ABORT","CTX_PARAM_UPLOAD_TIMEOUT","CTX_PARAM_SRC_CTL_ID","CTX_PARAM_REQ_PASS_THR","CTX_PARAM_PPS","ENCODED_URL","REQ_TYPE_POST","HTML_TAG_HEAD","HTML_TAG_FORM","HTML_TAG_BODY","SEL_VIEWSTATE_ELEM","SEL_CLIENT_WINDOW_ELEM","PHASE_PROCESS_RESPONSE","XML_TAG_PARTIAL_RESP","XML_TAG_CHANGES","XML_TAG_UPDATE","XML_TAG_DELETE","XML_TAG_INSERT","XML_TAG_EVAL","XML_TAG_ERROR","XML_TAG_ATTRIBUTES","XML_TAG_EXTENSION","XML_TAG_REDIRECT","XML_TAG_BEFORE","XML_TAG_AFTER","UPDATE_FORMS","UPDATE_ELEMS","DEFERRED_HEAD_INSERTS","MYFACES","APPLIED_VST","APPLIED_CLIENT_WINDOW","$faces","faces","jsf","$nsp","inputNamespace","Messages","MSG_TEST","MSG_DEV_MODE","MSG_AFFECTED_CLASS","MSG_AFFECTED_METHOD","MSG_ERROR_NAME","MSG_ERROR_MESSAGE","MSG_SERVER_ERROR_NAME","MSG_ERROR_DESC","MSG_ERROR_NO","MSG_ERROR_LINENO","ERR_FORM","ERR_VIEWSTATE","ERR_TRANSPORT","ERR_EVT_PASS","ERR_CONSTRUCT","ERR_MALFORMEDXML","ERR_SOURCE_FUNC","ERR_EV_OR_UNKNOWN","ERR_SOURCE_NOSTR","ERR_SOURCE_DEF_NULL","ERR_MUST_STRING","ERR_REF_OR_ID","ERR_PARAM_GENERIC","ERR_PARAM_STR","ERR_PARAM_STR_RE","ERR_PARAM_MIXMAPS","ERR_MUST_BE_PROVIDED","ERR_MUST_BE_PROVIDED1","ERR_REPLACE_EL","ERR_EMPTY_RESPONSE","ERR_ITEM_ID_NOTFOUND","ERR_PPR_IDREQ","ERR_PPR_INSERTBEFID","ERR_PPR_INSERTBEFID_1","ERR_PPR_INSERTBEFID_2","ERR_PPR_DELID","ERR_PPR_UNKNOWNCID","ERR_NO_VIEWROOTATTR","ERR_NO_HEADATTR","ERR_RED_URL","ERR_REQ_FAILED_UNKNOWN","ERR_REQU_FAILED","UNKNOWN","IS_FACES_SOURCE","ATTR_SRC","isRegExpMatchArray","ExtDomQuery","windowId","body","fetchWindowIdFromURL","href","location","results","RegExp","exec","globalNonce","ExtConfig","myfaces","currentScript","nonceScript","undefined","searchJsfJsFor","regExp","decodeURIComponent","whiteListed","runHeadInserts","suppressDoubleIncludes","processedScripts","reference","getProjectStage","identifier","$nspEnabled","accessPathMapped","remap","resolveHandlerFunc","requestContext","responseContext","funcName","resoveNamingContainerMapper","internalContext","prefix","separatorchar","resolveWindowId","ExtLang","Assertions","installedLocale","getMessage","defaultMessage","templateParams","msg","param","makeException","title","callerCls","callFunc","getLanguage","navigator","languages","language","failSaveResolve","failSaveExecute","keyValToStr","delimiter","getGlobalConfig","configName","config","getForm","queryElem","eventTarget","finalEvent","srcElement","getEventTarget","formId","foundForm","form","forms","assertOnlyOneFormExists","getLocalOrGlobalConfig","localOptions","collectAssoc","activeTimeouts","debounce","runnable","clearActiveTimeout","assert","caller","raiseError","assertFunction","assertRequestIntegrity","assertUrlExists","assertValidXMLResponse","responseXML","finalTitle","finalName","finalMessage","assertDelay","EventData","createFromRequest","request","context","eventData","status","sourceId","responseCode","responseText","ErrorType","ErrorData","errorName","errorMessage","statusOverride","CLIENT_ERROR","SERVER_ERROR","typeDetails","serverErrorName","serverErrorMessage","fromClient","stack","fromHttpConnection","fromGeneric","errorCode","errorType","getMsg","fromServerError","StateHolder","viewStatePos","nameSpace","substr","hasNameSpace","HiddenInputBuilder","namedViewRoot","isViewState","includes","template","withNamingContainerId","namingContainer","namingContainerId","withParent","withNamedViewRoot","build","buildId","buildName","separator","nextIndex","state","lastIndexOf","idSuffix","ResponseProcessor_trim","ResponseProcessor","externalContext","replaceHead","shadowDocument","shadowHead","addToHead","mappedHeadData","scriptTags","nodesToAdd","scriptElements","addToHeadDeferred","newElements","replaceBody","shadowBody","shadowInnerHTML","resultingBody","updateForms","storeForPostProcessing","eval","mergedErrorData","hasResponseXML","errorData","triggerOnError","Implementation","sendError","redirect","redirectUrl","update","cdataBlock","sourceForm","replaceViewRoot","insert","before","after","insertNodes","insertWithSubTags","insertId","processViewState","isViewStateNode","processClientWindow","isClientWindowNode","updateElems","fixViewStates","affectedForms","getContainerForms","affectedForm","isInExecuteOrRender","appendViewStateToForms","fixClientWindow","appendClientWindowToForms","updateNamedViewRootState","partialId","SEP","getElementById","eventHandler","sendEvent","viewState","assignState","clientWindow","createAndAppendHiddenInput","toBeEvaluated","storeForUpdate","storeForEval","executes","renders","nameOrId","NAME_OR_ID","getNameOrIdSelector","Response","processResponse","req","resolveContexts","resolveResponseXML","responseProcessor","SEL_SUB_TAGS","ALLOWED_TAGS","storeState","handleElementUpdate","processUpdateTag","processInsert","processChangesTag","processPartialTag","AsyncRunnable","catchFunctions","thenFunctions","inputVal","thenFunc","reject","catchFunc","then","encodeFormData","formData","paramsMapper","inStr","defaultStr","assocValues","hasOwnProperty","File","encodeURIComponent","fixEmptyParameters","XhrFormData_ofAssoc","defaultParamsMapper","XhrFormData","partialIds","isMultipartRequest","initFormData","toFormData","buildFormData","detectMultipartRequest","encodeSubmittableFields","applyViewState","rootElement","viewStateElement","remapKeyForNamingContainer","parentItem","remappedPartialIds","standardInputs","getViewState","_line","line","resolveViewState","fileInputs","fileInput","file","getFormInputsAsArr","isFieldIncluded","startsWith","FormData","remappedKey","XhrRequest","ajaxType","ERR_INVALID_RESPONSE","stopProgress","xhrObject","XMLHttpRequest","registerXhrCallbacks","ignoreErr","partialIdsArray","requestPassThroughParams","appendIssuingItem","open","srcFormElement","formElements","action","resolveTargetUrl","resolveFinalUrl","setRequestHeader","sendRequest","handleErrorAndClearQueue","cancel","abort","handleError","onabort","onAbort","ontimeout","onTimeout","onload","onResponseReceived","onloadend","onResponseProcessed","registerUploadCallbacks","onerror","isCancelledResponse","upload","currentTarget","readyState","_resolve","handleHttpError","_reject","processRequestErrors","ajax","response","handleGenericResponseError","responseStatus","finalizeError","resolveOrReject","send","evtType","responseFormatError","exception","issuingItemId","eventType","isBehaviorEvent","issuingItem","itemValue","isCheckable","TYPE_CHECKBOX","TYPE_RADIO","XhrQueueController","queue","taskRunning","debounceKey","instanceCount","enqueue","timeOut","requestHandler","enrichRunnable","signalTaskRunning","updateTaskRunning","clear","isEmpty","asyncRunnable","catch","ProjectStages","BlockFilter","PushImpl","oam","_api_myfaces","projectStage","eventQueue","errorQueue","resolveProjectStateFromURL","foundStage","Production","localHandler","errorCallback","alert","displayError","assignNamingContainerData","formElement","viewRootId","divider","viewId","resolveViewRootId","remapDefaultConstants","targetConfig","targetKey","userValues","issuingForm","issuingElementId","rootNamingContainerId","iterValues","processed","remapNamingContainer","componentIdToTransform","rootNamingContainerPrefix","formClientId","nearestNamingContainer","nearestNamingContainerPrefix","hasLeadingSep","finalIdentifier","resolveGlobalConfig","requestQueue","getSeparatorChar","chain","funcs","returnVal","sourceCode","resolveAndExecute","opts","elementId","isResetValues","resetValues","resolveDefaults","requestCtx","internalCtx","resolveForm","viewStateViewId","resolveViewId","resolveDelay","getCfg","resolveTimeout","mappedOpts","arrayedParams","ctxPassthrough","requestOptions","targetContext","sourceElementId","onevent","preinit","loadstart","_m","_l","_k","progress","_q","_p","_o","loadend","_t","_s","_r","load","_w","_v","_u","_z","_y","_x","_2","_1","_0","_4","_3","extractMyFacesParams","getClientWindow","assignClientWindowId","assignRender","queueHandler","addRequestToQueue","addOnError","errorListener","addOnEvent","eventListener","stdErrorHandler","clearRequestQueue","ALTERED","INIT","searchRoot","formWindowId","dummyContext","reqCtx","respPassThr","URL_PROTOCOL","protocol","sockets","components","clientIdsByTokens","s","close","init","socketClientId","url","channel","onopen","onmessage","onclose","behaviors","autoConnect","resolveFunction","WebSocket","channelToken","autoconnect","Socket","base","hostname","port","getBaseURL","getSocket","socket","reconnectAttempts","hasEverConnected","hasNotifiedInitialOpenAttempt","bindCallbacks","notifyInitialOpenAttempt","parse","clientIds","functions","j","isTerminalClose","notifyClose","resetConnectionState","notifyErrorAndPruneMissingComponents","closeIfChannelHasNoComponents","scheduleReconnect","reconnectAttempt","setHiddenInput","formName","input","newInput","clearHiddenInput","submitForm","linkId","clearFn","core","autoScroll","getScrolling","paramsStream","oldTarget","onsubmit","submit","util","specversion","implversion","sep","contextpath","errorFunc","eventFunc","ab","execute","render","userParameters","onReadyChain","readyStateListener","onDomReady","executionFunc","reserveNamespace","namespace","namespaces","part","__webpack_module_cache__","moduleId","cachedModule","exports","module","__webpack_modules__","d","definition","o","enumerable","prop","r","toStringTag","myfacesApi","faces_myfaces"],"sourceRoot":""}