@sankhyalabs/sankhyablocks 8.3.2 → 8.4.0-dev.2

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 (253) hide show
  1. package/dist/cjs/{ConfigStorage-4dd5e72c.js → ConfigStorage-0e4275f5.js} +163 -51
  2. package/dist/cjs/{DataFetcher-65199c00.js → DataFetcher-bd3d53a8.js} +78 -234
  3. package/dist/cjs/ISave-d68ce3cd.js +8 -0
  4. package/dist/cjs/PrintUtils-bcaeb82f.js +215 -0
  5. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  6. package/dist/cjs/{SnkFormConfigManager-44717597.js → SnkFormConfigManager-5b485cd4.js} +19 -21
  7. package/dist/cjs/{auth-fetcher-7ed6d3e3.js → auth-fetcher-1583fe43.js} +2 -2
  8. package/dist/cjs/{dataunit-fetcher-102030d8.js → dataunit-fetcher-910be4ce.js} +1 -1
  9. package/dist/cjs/{form-config-fetcher-49993843.js → form-config-fetcher-f6cb55e6.js} +66 -3
  10. package/dist/cjs/index-f9e81701.js +4 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-23adae20.js → pesquisa-fetcher-3356b3df.js} +1 -1
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button.cjs.entry.js +19 -11
  15. package/dist/cjs/snk-application.cjs.entry.js +60 -44
  16. package/dist/cjs/snk-attach.cjs.entry.js +9 -14
  17. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  18. package/dist/cjs/snk-crud.cjs.entry.js +28 -11
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
  20. package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-7cc1846d.js} +5 -5
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +17 -13
  23. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  24. package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
  25. package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -16
  26. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
  27. package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
  28. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  29. package/dist/cjs/snk-form.cjs.entry.js +13 -8
  30. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
  31. package/dist/cjs/snk-grid.cjs.entry.js +23 -22
  32. package/dist/cjs/{snk-guides-viewer-83cd2f15.js → snk-guides-viewer-5e22097d.js} +19 -8
  33. package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -9
  34. package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
  35. package/dist/cjs/snk-print-selector.cjs.entry.js +2 -4
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +43 -85
  37. package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +20 -0
  38. package/dist/cjs/snk-taskbar.cjs.entry.js +71 -5
  39. package/dist/cjs/{taskbar-elements-b98dd6e9.js → taskbar-elements-39949c7a.js} +4 -4
  40. package/dist/collection/collection-manifest.json +1 -0
  41. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  42. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  43. package/dist/collection/components/snk-application/snk-application.js +120 -65
  44. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  45. package/dist/collection/components/snk-crud/snk-crud.js +44 -8
  46. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +60 -2
  47. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  48. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +65 -28
  49. package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -6
  50. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  51. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +8 -13
  52. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  55. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  56. package/dist/collection/components/snk-form/snk-form.js +46 -2
  57. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  58. package/dist/collection/components/snk-grid/snk-grid.js +108 -16
  59. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  60. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  61. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -1
  62. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -4
  63. package/dist/collection/components/snk-taskbar/snk-taskbar-custom-elements.js +43 -0
  64. package/dist/collection/components/snk-taskbar/snk-taskbar.css +4 -0
  65. package/dist/collection/components/snk-taskbar/snk-taskbar.js +126 -5
  66. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  67. package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -71
  68. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -32
  69. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  70. package/dist/collection/lib/index.js +10 -0
  71. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  72. package/dist/collection/lib/utils/PrintUtils.js +18 -9
  73. package/dist/collection/lib/utils/urlutils.js +29 -0
  74. package/dist/components/ConfigStorage.js +161 -48
  75. package/dist/components/DataFetcher.js +79 -234
  76. package/dist/components/PrintUtils.js +213 -0
  77. package/dist/components/ResourceIDUtils.js +10 -0
  78. package/dist/components/SnkFormConfigManager.js +17 -19
  79. package/dist/components/auth-fetcher.js +1 -1
  80. package/dist/components/form-config-fetcher.js +64 -2
  81. package/dist/components/index.d.ts +1 -0
  82. package/dist/components/index.js +1 -0
  83. package/dist/components/snk-actions-button2.js +23 -9
  84. package/dist/components/snk-application2.js +145 -129
  85. package/dist/components/snk-attach2.js +1 -8
  86. package/dist/components/snk-configurator2.js +3 -1
  87. package/dist/components/snk-crud.js +27 -8
  88. package/dist/components/snk-data-unit2.js +6 -5
  89. package/dist/components/snk-detail-view2.js +26 -10
  90. package/dist/components/snk-entity-list.js +0 -4
  91. package/dist/components/snk-filter-bar2.js +12 -12
  92. package/dist/components/snk-filter-detail2.js +8 -13
  93. package/dist/components/snk-filter-modal-item2.js +5 -16
  94. package/dist/components/snk-form-config2.js +5 -15
  95. package/dist/components/snk-form-view2.js +6 -1
  96. package/dist/components/snk-form.js +9 -2
  97. package/dist/components/snk-grid-config2.js +4 -2
  98. package/dist/components/snk-grid2.js +24 -17
  99. package/dist/components/snk-personalized-filter2.js +11 -11
  100. package/dist/components/snk-print-selector.js +1 -1
  101. package/dist/components/snk-simple-crud2.js +30 -73
  102. package/dist/components/snk-taskbar-custom-elements.d.ts +11 -0
  103. package/dist/components/snk-taskbar-custom-elements.js +35 -0
  104. package/dist/components/snk-taskbar2.js +81 -9
  105. package/dist/esm/{ConfigStorage-d0e26692.js → ConfigStorage-f359573c.js} +162 -49
  106. package/dist/esm/{DataFetcher-4f5ad71c.js → DataFetcher-8daff9ad.js} +79 -234
  107. package/dist/esm/ISave-4412b20c.js +8 -0
  108. package/dist/esm/PrintUtils-3e4ff0f5.js +213 -0
  109. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  110. package/dist/esm/{SnkFormConfigManager-457554ca.js → SnkFormConfigManager-35876bad.js} +19 -21
  111. package/dist/esm/{auth-fetcher-852e26c9.js → auth-fetcher-299fed55.js} +1 -1
  112. package/dist/esm/{dataunit-fetcher-97dd5148.js → dataunit-fetcher-bd8f9572.js} +1 -1
  113. package/dist/esm/{form-config-fetcher-ff72a867.js → form-config-fetcher-8ef7be16.js} +65 -3
  114. package/dist/esm/index-a7d3d3f1.js +4 -0
  115. package/dist/esm/loader.js +1 -1
  116. package/dist/esm/{pesquisa-fetcher-d82df64b.js → pesquisa-fetcher-27819123.js} +1 -1
  117. package/dist/esm/sankhyablocks.js +1 -1
  118. package/dist/esm/snk-actions-button.entry.js +19 -11
  119. package/dist/esm/snk-application.entry.js +60 -44
  120. package/dist/esm/snk-attach.entry.js +5 -10
  121. package/dist/esm/snk-configurator.entry.js +2 -1
  122. package/dist/esm/snk-crud.entry.js +30 -13
  123. package/dist/esm/snk-data-exporter.entry.js +3 -2
  124. package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-1715d2f1.js} +5 -5
  125. package/dist/esm/snk-data-unit.entry.js +1 -1
  126. package/dist/esm/snk-detail-view.entry.js +17 -13
  127. package/dist/esm/snk-entity-list.entry.js +0 -4
  128. package/dist/esm/snk-filter-bar.entry.js +15 -17
  129. package/dist/esm/snk-filter-detail.entry.js +8 -17
  130. package/dist/esm/snk-filter-modal-item.entry.js +7 -20
  131. package/dist/esm/snk-form-config.entry.js +8 -18
  132. package/dist/esm/snk-form-view.entry.js +6 -1
  133. package/dist/esm/snk-form.entry.js +13 -8
  134. package/dist/esm/snk-grid-config.entry.js +6 -6
  135. package/dist/esm/snk-grid.entry.js +23 -22
  136. package/dist/esm/{snk-guides-viewer-202c3c4d.js → snk-guides-viewer-b0e32a7d.js} +19 -8
  137. package/dist/esm/snk-guides-viewer.entry.js +10 -9
  138. package/dist/esm/snk-personalized-filter.entry.js +14 -16
  139. package/dist/esm/snk-print-selector.entry.js +1 -3
  140. package/dist/esm/snk-simple-crud.entry.js +34 -76
  141. package/dist/esm/snk-taskbar-custom-elements.entry.js +16 -0
  142. package/dist/esm/snk-taskbar.entry.js +71 -5
  143. package/dist/esm/{taskbar-elements-2c761819.js → taskbar-elements-0a6b8b95.js} +4 -4
  144. package/dist/sankhyablocks/p-0df2ead8.entry.js +11 -0
  145. package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
  146. package/dist/sankhyablocks/p-34604220.entry.js +1 -0
  147. package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
  148. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  149. package/dist/sankhyablocks/p-6a38bda5.entry.js +1 -0
  150. package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
  151. package/dist/sankhyablocks/p-7bcd2f89.js +56 -0
  152. package/dist/sankhyablocks/p-7bd5aea7.js +1 -0
  153. package/dist/sankhyablocks/p-8014cc25.entry.js +1 -0
  154. package/dist/sankhyablocks/p-8d884fab.js +1 -0
  155. package/dist/sankhyablocks/p-928efcaa.entry.js +1 -0
  156. package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
  157. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  158. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  159. package/dist/sankhyablocks/p-a7ee0e6f.entry.js +1 -0
  160. package/dist/sankhyablocks/p-ac0556a3.js +1 -0
  161. package/dist/sankhyablocks/p-af2d9aea.entry.js +1 -0
  162. package/dist/sankhyablocks/{p-435259af.js → p-b13cb8b5.js} +2 -2
  163. package/dist/sankhyablocks/p-b244640b.js +1 -0
  164. package/dist/sankhyablocks/p-bba91710.entry.js +1 -0
  165. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  166. package/dist/sankhyablocks/p-c870b530.js +26 -0
  167. package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
  168. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  169. package/dist/sankhyablocks/p-d708b4ab.entry.js +1 -0
  170. package/dist/sankhyablocks/p-d84bc5c1.js +1 -0
  171. package/dist/sankhyablocks/{p-7d9302e2.js → p-de76b8a8.js} +1 -1
  172. package/dist/sankhyablocks/p-e19014a9.entry.js +1 -0
  173. package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
  174. package/dist/sankhyablocks/p-e9b53a9a.entry.js +1 -0
  175. package/dist/sankhyablocks/p-ebf8c5df.entry.js +1 -0
  176. package/dist/sankhyablocks/p-ed5f1204.entry.js +1 -0
  177. package/dist/sankhyablocks/p-f94b999e.entry.js +1 -0
  178. package/dist/sankhyablocks/p-fb1ecd0b.entry.js +1 -0
  179. package/dist/sankhyablocks/p-fd15aaac.entry.js +1 -0
  180. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  181. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  182. package/dist/types/components/snk-application/snk-application.d.ts +9 -22
  183. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  184. package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
  185. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
  186. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  187. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
  188. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
  189. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  190. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  191. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  192. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  193. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  194. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  195. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  196. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  197. package/dist/types/components/snk-grid/snk-grid.d.ts +17 -1
  198. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  199. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  200. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  201. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +2 -2
  202. package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +7 -0
  203. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -0
  204. package/dist/types/components.d.ts +203 -22
  205. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  206. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -8
  207. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  208. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  209. package/dist/types/lib/index.d.ts +11 -0
  210. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  211. package/dist/types/lib/utils/PrintUtils.d.ts +1 -0
  212. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  213. package/package.json +2 -2
  214. package/react/components.d.ts +1 -0
  215. package/react/components.js +1 -0
  216. package/react/components.js.map +1 -1
  217. package/dist/cjs/filter-bar-config-fetcher-2ab64f92.js +0 -155
  218. package/dist/cjs/resource-fetcher-8d12fee7.js +0 -68
  219. package/dist/components/filter-bar-config-fetcher.js +0 -153
  220. package/dist/components/resource-fetcher.js +0 -66
  221. package/dist/esm/filter-bar-config-fetcher-1093db95.js +0 -153
  222. package/dist/esm/resource-fetcher-be4d1ba4.js +0 -66
  223. package/dist/sankhyablocks/p-030a2da4.entry.js +0 -1
  224. package/dist/sankhyablocks/p-1208becf.entry.js +0 -1
  225. package/dist/sankhyablocks/p-17724bee.entry.js +0 -1
  226. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  227. package/dist/sankhyablocks/p-37b17041.js +0 -1
  228. package/dist/sankhyablocks/p-3916c825.entry.js +0 -1
  229. package/dist/sankhyablocks/p-3ffad8ca.entry.js +0 -1
  230. package/dist/sankhyablocks/p-44fe945a.entry.js +0 -1
  231. package/dist/sankhyablocks/p-4fc5a0db.entry.js +0 -1
  232. package/dist/sankhyablocks/p-564efc43.js +0 -1
  233. package/dist/sankhyablocks/p-5add4151.entry.js +0 -1
  234. package/dist/sankhyablocks/p-5de83141.entry.js +0 -1
  235. package/dist/sankhyablocks/p-6be9191f.entry.js +0 -1
  236. package/dist/sankhyablocks/p-6ee5d42c.js +0 -1
  237. package/dist/sankhyablocks/p-72d7f00c.js +0 -56
  238. package/dist/sankhyablocks/p-7352acf8.entry.js +0 -1
  239. package/dist/sankhyablocks/p-8115f7a2.js +0 -1
  240. package/dist/sankhyablocks/p-8903ffc6.js +0 -1
  241. package/dist/sankhyablocks/p-8dbb4c6c.entry.js +0 -11
  242. package/dist/sankhyablocks/p-935bfc1c.entry.js +0 -1
  243. package/dist/sankhyablocks/p-9395cf73.entry.js +0 -1
  244. package/dist/sankhyablocks/p-9d36d914.js +0 -17
  245. package/dist/sankhyablocks/p-aa6f27bd.entry.js +0 -1
  246. package/dist/sankhyablocks/p-aeaa5253.js +0 -10
  247. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  248. package/dist/sankhyablocks/p-c1273e40.js +0 -1
  249. package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
  250. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  251. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  252. package/dist/sankhyablocks/p-f5c33da3.entry.js +0 -1
  253. package/dist/sankhyablocks/p-f847d53a.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{DataType as t,StringUtils as e,ApplicationContext as n,ErrorException as i,WarningException as r,ObjectUtils as s}from"@sankhyalabs/core";import{c as o,a as u}from"./p-112455b1.js";import{DataUnitTransient as a}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";var c=o((function(t,e){var n="undefined"!=typeof self?self:u,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,r="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=c(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},f.prototype.delete=function(t){delete this.map[c(t)]},f.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},f.prototype.set=function(t,e){this.map[c(t)]=l(e)},f.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,i,r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,n){return new Promise((function(i,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL"),i(new O("response"in u?u.response:u.responseText,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&r&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=f,t.Request=w,t.Response=O),e.Headers=f,e.Request=w,e.Response=O,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=i;(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e})),l=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=function(t){return"object"==typeof t&&null!==t}})),h=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=function(t,e){if(!Boolean(t))throw new Error(null!=e?e:"Unexpected invariant triggered.")}})),f=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=function(t,e){let i=0,r=1;for(const s of t.body.matchAll(n)){if("number"==typeof s.index||(0,h.invariant)(!1),s.index>=e)break;i=s.index+s[0].length,r+=1}return{line:r,column:e+1-i}};const n=/\r\n|[\n\r]/g})),d=o((function(t,e){function n(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,s=e.line-1,o=e.line+(t.locationOffset.line-1),u=e.column+(1===e.line?n:0),a=`${t.name}:${o}:${u}\n`,c=r.split(/\r\n|[\n\r]/g),l=c[s];if(l.length>120){const t=Math.floor(u/80),e=u%80,n=[];for(let t=0;t<l.length;t+=80)n.push(l.slice(t,t+80));return a+i([[`${o} |`,n[0]],...n.slice(1,t+1).map((t=>["|",t])),["|","^".padStart(e)],["|",n[t+1]]])}return a+i([[o-1+" |",c[s-1]],[`${o} |`,l],["|","^".padStart(u)],[`${o+1} |`,c[s+1]]])}function i(t){const e=t.filter((([t,e])=>void 0!==e)),n=Math.max(...e.map((([t])=>t.length)));return e.map((([t,e])=>t.padStart(n)+(e?" "+e:""))).join("\n")}Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=function(t){return n(t.source,(0,f.getLocation)(t.source,t.start))},e.printSourceLocation=n})),v=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=function(t){return t.toJSON()},e.printError=function(t){return t.toString()};class n extends Error{constructor(t,...e){var r,s,o;const{nodes:u,source:a,positions:c,path:h,originalError:d,extensions:v}=function(t){const e=t[0];return null==e||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}(e);super(t),this.name="GraphQLError",this.path=null!=h?h:void 0,this.originalError=null!=d?d:void 0,this.nodes=i(Array.isArray(u)?u:u?[u]:void 0);const p=i(null===(r=this.nodes)||void 0===r?void 0:r.map((t=>t.loc)).filter((t=>null!=t)));this.source=null!=a?a:null==p||null===(s=p[0])||void 0===s?void 0:s.source,this.positions=null!=c?c:null==p?void 0:p.map((t=>t.start)),this.locations=c&&a?c.map((t=>(0,f.getLocation)(a,t))):null==p?void 0:p.map((t=>(0,f.getLocation)(t.source,t.start)));const m=(0,l.isObjectLike)(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(o=null!=v?v:m)&&void 0!==o?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const e of this.nodes)e.loc&&(t+="\n\n"+(0,d.printLocation)(e.loc));else if(this.source&&this.locations)for(const e of this.locations)t+="\n\n"+(0,d.printSourceLocation)(this.source,e);return t}toJSON(){const t={message:this.message};return null!=this.locations&&(t.locations=this.locations),null!=this.path&&(t.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function i(t){return void 0===t||0===t.length?void 0:t}e.GraphQLError=n})),p=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=function(t,e,n){return new v.GraphQLError(`Syntax Error: ${n}`,{source:t,positions:[e]})}})),m=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=function(t){const e=null==t?void 0:t.kind;return"string"==typeof e&&s.has(e)};class n{constructor(t,e,n){this.start=t.start,this.end=e.end,this.startToken=t,this.endToken=e,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}e.Location=n;class i{constructor(t,e,n,i,r,s){this.kind=t,this.start=e,this.end=n,this.line=i,this.column=r,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}e.Token=i;const r={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};e.QueryDocumentKeys=r;const s=new Set(Object.keys(r));var o;e.OperationTypeNode=o,function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"}(o||(e.OperationTypeNode=o={}))})),y=o((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0,e.DirectiveLocation=n,function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(n||(e.DirectiveLocation=n={}))})),b=o((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0,e.Kind=n,function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(n||(e.Kind=n={}))})),w=o((function(t,e){function n(t){return t>=48&&t<=57}function i(t){return t>=97&&t<=122||t>=65&&t<=90}Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=i,e.isNameContinue=function(t){return i(t)||n(t)||95===t},e.isNameStart=function(t){return i(t)||95===t},e.isWhiteSpace=function(t){return 9===t||32===t}})),g=o((function(t,e){function n(t){let e=0;for(;e<t.length&&(0,w.isWhiteSpace)(t.charCodeAt(e));)++e;return e}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=function(t){var e;let i=Number.MAX_SAFE_INTEGER,r=null,s=-1;for(let e=0;e<t.length;++e){var o;const u=t[e],a=n(u);a!==u.length&&(r=null!==(o=r)&&void 0!==o?o:e,s=e,0!==e&&a<i&&(i=a))}return t.map(((t,e)=>0===e?t:t.slice(i))).slice(null!==(e=r)&&void 0!==e?e:0,s+1)},e.isPrintableAsBlockString=function(t){if(""===t)return!0;let e=!0,n=!1,i=!0,r=!1;for(let s=0;s<t.length;++s)switch(t.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(e&&!r)return!1;r=!0,e=!0,n=!1;break;case 9:case 32:n||(n=e);break;default:i&&(i=n),e=!1}return!e&&(!i||!r)},e.printBlockString=function(t,e){const n=t.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,s=i.length>1&&i.slice(1).every((t=>0===t.length||(0,w.isWhiteSpace)(t.charCodeAt(0)))),o=n.endsWith('\\"""'),u=t.endsWith('"')&&!o,a=t.endsWith("\\"),c=u||a,l=!(null!=e&&e.minimize)&&(!r||t.length>70||c||s||o);let h="";const f=r&&(0,w.isWhiteSpace)(t.charCodeAt(0));return(l&&!f||s)&&(h+="\n"),h+=n,(l||c)&&(h+="\n"),'"""'+h+'"""'}})),O=o((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0,e.TokenKind=n,function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"}(n||(e.TokenKind=n={}))})),E=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.isPunctuatorTokenKind=function(t){return t===O.TokenKind.BANG||t===O.TokenKind.DOLLAR||t===O.TokenKind.AMP||t===O.TokenKind.PAREN_L||t===O.TokenKind.PAREN_R||t===O.TokenKind.SPREAD||t===O.TokenKind.COLON||t===O.TokenKind.EQUALS||t===O.TokenKind.AT||t===O.TokenKind.BRACKET_L||t===O.TokenKind.BRACKET_R||t===O.TokenKind.BRACE_L||t===O.TokenKind.PIPE||t===O.TokenKind.BRACE_R};class n{constructor(t){const e=new m.Token(O.TokenKind.SOF,0,0,0,0);this.source=t,this.lastToken=e,this.token=e,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==O.TokenKind.EOF)do{if(t.next)t=t.next;else{const e=c(this,t.end);t.next=e,e.prev=t,t=e}}while(t.kind===O.TokenKind.COMMENT);return t}}function i(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function r(t,e){return s(t.charCodeAt(e))&&o(t.charCodeAt(e+1))}function s(t){return t>=55296&&t<=56319}function o(t){return t>=56320&&t<=57343}function u(t,e){const n=t.source.body.codePointAt(e);if(void 0===n)return O.TokenKind.EOF;if(n>=32&&n<=126){const t=String.fromCodePoint(n);return'"'===t?"'\"'":`"${t}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function a(t,e,n,i,r){return new m.Token(e,n,i,t.line,1+n-t.lineStart,r)}function c(t,e){const n=t.source.body,s=n.length;let o=e;for(;o<s;){const e=n.charCodeAt(o);switch(e){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++t.line,t.lineStart=o;continue;case 13:10===n.charCodeAt(o+1)?o+=2:++o,++t.line,t.lineStart=o;continue;case 35:return l(t,o);case 33:return a(t,O.TokenKind.BANG,o,o+1);case 36:return a(t,O.TokenKind.DOLLAR,o,o+1);case 38:return a(t,O.TokenKind.AMP,o,o+1);case 40:return a(t,O.TokenKind.PAREN_L,o,o+1);case 41:return a(t,O.TokenKind.PAREN_R,o,o+1);case 46:if(46===n.charCodeAt(o+1)&&46===n.charCodeAt(o+2))return a(t,O.TokenKind.SPREAD,o,o+3);break;case 58:return a(t,O.TokenKind.COLON,o,o+1);case 61:return a(t,O.TokenKind.EQUALS,o,o+1);case 64:return a(t,O.TokenKind.AT,o,o+1);case 91:return a(t,O.TokenKind.BRACKET_L,o,o+1);case 93:return a(t,O.TokenKind.BRACKET_R,o,o+1);case 123:return a(t,O.TokenKind.BRACE_L,o,o+1);case 124:return a(t,O.TokenKind.PIPE,o,o+1);case 125:return a(t,O.TokenKind.BRACE_R,o,o+1);case 34:return 34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)?T(t,o):d(t,o)}if((0,w.isDigit)(e)||45===e)return h(t,o,e);if((0,w.isNameStart)(e))return D(t,o);throw(0,p.syntaxError)(t.source,o,39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":i(e)||r(n,o)?`Unexpected character: ${u(t,o)}.`:`Invalid character: ${u(t,o)}.`)}return a(t,O.TokenKind.EOF,s,s)}function l(t,e){const n=t.source.body,s=n.length;let o=e+1;for(;o<s;){const t=n.charCodeAt(o);if(10===t||13===t)break;if(i(t))++o;else{if(!r(n,o))break;o+=2}}return a(t,O.TokenKind.COMMENT,e,o,n.slice(e+1,o))}function h(t,e,n){const i=t.source.body;let r=e,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),(0,w.isDigit)(s))throw(0,p.syntaxError)(t.source,r,`Invalid number, unexpected digit after 0: ${u(t,r)}.`)}else r=f(t,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=f(t,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=f(t,r,s),s=i.charCodeAt(r)),46===s||(0,w.isNameStart)(s))throw(0,p.syntaxError)(t.source,r,`Invalid number, expected digit but got: ${u(t,r)}.`);return a(t,o?O.TokenKind.FLOAT:O.TokenKind.INT,e,r,i.slice(e,r))}function f(t,e,n){if(!(0,w.isDigit)(n))throw(0,p.syntaxError)(t.source,e,`Invalid number, expected digit but got: ${u(t,e)}.`);const i=t.source.body;let r=e+1;for(;(0,w.isDigit)(i.charCodeAt(r));)++r;return r}function d(t,e){const n=t.source.body,s=n.length;let o=e+1,c=o,l="";for(;o<s;){const s=n.charCodeAt(o);if(34===s)return l+=n.slice(c,o),a(t,O.TokenKind.STRING,e,o+1,l);if(92!==s){if(10===s||13===s)break;if(i(s))++o;else{if(!r(n,o))throw(0,p.syntaxError)(t.source,o,`Invalid character within String: ${u(t,o)}.`);o+=2}}else{l+=n.slice(c,o);const e=117===n.charCodeAt(o+1)?123===n.charCodeAt(o+2)?v(t,o):y(t,o):S(t,o);l+=e.value,o+=e.size,c=o}}throw(0,p.syntaxError)(t.source,o,"Unterminated string.")}function v(t,e){const n=t.source.body;let r=0,s=3;for(;s<12;){const t=n.charCodeAt(e+s++);if(125===t){if(s<5||!i(r))break;return{value:String.fromCodePoint(r),size:s}}if(r=r<<4|E(t),r<0)break}throw(0,p.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+s)}".`)}function y(t,e){const n=t.source.body,r=b(n,e+2);if(i(r))return{value:String.fromCodePoint(r),size:6};if(s(r)&&92===n.charCodeAt(e+6)&&117===n.charCodeAt(e+7)){const t=b(n,e+8);if(o(t))return{value:String.fromCodePoint(r,t),size:12}}throw(0,p.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function b(t,e){return E(t.charCodeAt(e))<<12|E(t.charCodeAt(e+1))<<8|E(t.charCodeAt(e+2))<<4|E(t.charCodeAt(e+3))}function E(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function S(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,p.syntaxError)(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function T(t,e){const n=t.source.body,s=n.length;let o=t.lineStart,c=e+3,l=c,h="";const f=[];for(;c<s;){const s=n.charCodeAt(c);if(34===s&&34===n.charCodeAt(c+1)&&34===n.charCodeAt(c+2)){h+=n.slice(l,c),f.push(h);const i=a(t,O.TokenKind.BLOCK_STRING,e,c+3,(0,g.dedentBlockStringLines)(f).join("\n"));return t.line+=f.length-1,t.lineStart=o,i}if(92!==s||34!==n.charCodeAt(c+1)||34!==n.charCodeAt(c+2)||34!==n.charCodeAt(c+3))if(10!==s&&13!==s)if(i(s))++c;else{if(!r(n,c))throw(0,p.syntaxError)(t.source,c,`Invalid character within String: ${u(t,c)}.`);c+=2}else h+=n.slice(l,c),f.push(h),13===s&&10===n.charCodeAt(c+1)?c+=2:++c,h="",l=c,o=c;else h+=n.slice(l,c),l=c+1,c+=4}throw(0,p.syntaxError)(t.source,c,"Unterminated string.")}function D(t,e){const n=t.source.body,i=n.length;let r=e+1;for(;r<i;){const t=n.charCodeAt(r);if(!(0,w.isNameContinue)(t))break;++r}return a(t,O.TokenKind.NAME,e,r,n.slice(e,r))}e.Lexer=n})),S=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=function(t,e){if(!Boolean(t))throw new Error(e)}})),T=o((function(t,e){function n(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return function(t,e){if(null===t)return"null";if(e.includes(t))return"[Circular]";const i=[...e,t];if(function(t){return"function"==typeof t.toJSON}(t)){const e=t.toJSON();if(e!==t)return"string"==typeof e?e:n(e,i)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>2)return"[Array]";const i=Math.min(10,t.length),r=t.length-i,s=[];for(let r=0;r<i;++r)s.push(n(t[r],e));return 1===r?s.push("... 1 more item"):r>1&&s.push(`... ${r} more items`),"["+s.join(", ")+"]"}(t,i);return function(t,e){const i=Object.entries(t);if(0===i.length)return"{}";if(e.length>2)return"["+function(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){const e=t.constructor.name;if("string"==typeof e&&""!==e)return e}return e}(t)+"]";const r=i.map((([t,i])=>t+": "+n(i,e)));return"{ "+r.join(", ")+" }"}(t,i)}(t,e);default:return String(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=function(t){return n(t,[])}})),D=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0,e.instanceOf=function(t,e){return t instanceof e}})),j=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=function(t){return(0,D.instanceOf)(t,n)};class n{constructor(t,e="GraphQL request",n={line:1,column:1}){"string"==typeof t||(0,S.devAssert)(!1,`Body must be a string. Received: ${(0,T.inspect)(t)}.`),this.body=t,this.name=e,this.locationOffset=n,this.locationOffset.line>0||(0,S.devAssert)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,S.devAssert)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}e.Source=n})),I=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=function(t,e){return new n(t,e).parseDocument()},e.parseConstValue=function(t,e){const i=new n(t,e);i.expectToken(O.TokenKind.SOF);const r=i.parseConstValueLiteral();return i.expectToken(O.TokenKind.EOF),r},e.parseType=function(t,e){const i=new n(t,e);i.expectToken(O.TokenKind.SOF);const r=i.parseTypeReference();return i.expectToken(O.TokenKind.EOF),r},e.parseValue=function(t,e){const i=new n(t,e);i.expectToken(O.TokenKind.SOF);const r=i.parseValueLiteral(!1);return i.expectToken(O.TokenKind.EOF),r};class n{constructor(t,e={}){const n=(0,j.isSource)(t)?t:new j.Source(t);this._lexer=new E.Lexer(n),this._options=e,this._tokenCounter=0}parseName(){const t=this.expectToken(O.TokenKind.NAME);return this.node(t,{kind:b.Kind.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:b.Kind.DOCUMENT,definitions:this.many(O.TokenKind.SOF,this.parseDefinition,O.TokenKind.EOF)})}parseDefinition(){if(this.peek(O.TokenKind.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),e=t?this._lexer.lookahead():this._lexer.token;if(e.kind===O.TokenKind.NAME){switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw(0,p.syntaxError)(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(e.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(e)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(O.TokenKind.BRACE_L))return this.node(t,{kind:b.Kind.OPERATION_DEFINITION,operation:m.OperationTypeNode.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const e=this.parseOperationType();let n;return this.peek(O.TokenKind.NAME)&&(n=this.parseName()),this.node(t,{kind:b.Kind.OPERATION_DEFINITION,operation:e,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(O.TokenKind.NAME);switch(t.value){case"query":return m.OperationTypeNode.QUERY;case"mutation":return m.OperationTypeNode.MUTATION;case"subscription":return m.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(O.TokenKind.PAREN_L,this.parseVariableDefinition,O.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:b.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(O.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(O.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(O.TokenKind.DOLLAR),this.node(t,{kind:b.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:b.Kind.SELECTION_SET,selections:this.many(O.TokenKind.BRACE_L,this.parseSelection,O.TokenKind.BRACE_R)})}parseSelection(){return this.peek(O.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,e=this.parseName();let n,i;return this.expectOptionalToken(O.TokenKind.COLON)?(n=e,i=this.parseName()):i=e,this.node(t,{kind:b.Kind.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(O.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){return this.optionalMany(O.TokenKind.PAREN_L,t?this.parseConstArgument:this.parseArgument,O.TokenKind.PAREN_R)}parseArgument(t=!1){const e=this._lexer.token,n=this.parseName();return this.expectToken(O.TokenKind.COLON),this.node(e,{kind:b.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(O.TokenKind.SPREAD);const e=this.expectOptionalKeyword("on");return!e&&this.peek(O.TokenKind.NAME)?this.node(t,{kind:b.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:b.Kind.INLINE_FRAGMENT,typeCondition:e?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this.node(t,!0===this._options.allowLegacyFragmentVariables?{kind:b.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}:{kind:b.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(t){const e=this._lexer.token;switch(e.kind){case O.TokenKind.BRACKET_L:return this.parseList(t);case O.TokenKind.BRACE_L:return this.parseObject(t);case O.TokenKind.INT:return this.advanceLexer(),this.node(e,{kind:b.Kind.INT,value:e.value});case O.TokenKind.FLOAT:return this.advanceLexer(),this.node(e,{kind:b.Kind.FLOAT,value:e.value});case O.TokenKind.STRING:case O.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case O.TokenKind.NAME:switch(this.advanceLexer(),e.value){case"true":return this.node(e,{kind:b.Kind.BOOLEAN,value:!0});case"false":return this.node(e,{kind:b.Kind.BOOLEAN,value:!1});case"null":return this.node(e,{kind:b.Kind.NULL});default:return this.node(e,{kind:b.Kind.ENUM,value:e.value})}case O.TokenKind.DOLLAR:if(t){if(this.expectToken(O.TokenKind.DOLLAR),this._lexer.token.kind===O.TokenKind.NAME)throw(0,p.syntaxError)(this._lexer.source,e.start,`Unexpected variable "$${this._lexer.token.value}" in constant value.`);throw this.unexpected(e)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:b.Kind.STRING,value:t.value,block:t.kind===O.TokenKind.BLOCK_STRING})}parseList(t){return this.node(this._lexer.token,{kind:b.Kind.LIST,values:this.any(O.TokenKind.BRACKET_L,(()=>this.parseValueLiteral(t)),O.TokenKind.BRACKET_R)})}parseObject(t){return this.node(this._lexer.token,{kind:b.Kind.OBJECT,fields:this.any(O.TokenKind.BRACE_L,(()=>this.parseObjectField(t)),O.TokenKind.BRACE_R)})}parseObjectField(t){const e=this._lexer.token,n=this.parseName();return this.expectToken(O.TokenKind.COLON),this.node(e,{kind:b.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(t)})}parseDirectives(t){const e=[];for(;this.peek(O.TokenKind.AT);)e.push(this.parseDirective(t));return e}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const e=this._lexer.token;return this.expectToken(O.TokenKind.AT),this.node(e,{kind:b.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let e;if(this.expectOptionalToken(O.TokenKind.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(O.TokenKind.BRACKET_R),e=this.node(t,{kind:b.Kind.LIST_TYPE,type:n})}else e=this.parseNamedType();return this.expectOptionalToken(O.TokenKind.BANG)?this.node(t,{kind:b.Kind.NON_NULL_TYPE,type:e}):e}parseNamedType(){return this.node(this._lexer.token,{kind:b.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(O.TokenKind.STRING)||this.peek(O.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(O.TokenKind.BRACE_L,this.parseOperationTypeDefinition,O.TokenKind.BRACE_R);return this.node(t,{kind:b.Kind.SCHEMA_DEFINITION,description:e,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,e=this.parseOperationType();this.expectToken(O.TokenKind.COLON);const n=this.parseNamedType();return this.node(t,{kind:b.Kind.OPERATION_TYPE_DEFINITION,operation:e,type:n})}parseScalarTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:b.Kind.SCALAR_TYPE_DEFINITION,description:e,name:n,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:b.Kind.OBJECT_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(O.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(O.TokenKind.BRACE_L,this.parseFieldDefinition,O.TokenKind.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(O.TokenKind.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(t,{kind:b.Kind.FIELD_DEFINITION,description:e,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(O.TokenKind.PAREN_L,this.parseInputValueDef,O.TokenKind.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName();this.expectToken(O.TokenKind.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(O.TokenKind.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(t,{kind:b.Kind.INPUT_VALUE_DEFINITION,description:e,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:b.Kind.INTERFACE_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:b.Kind.UNION_TYPE_DEFINITION,description:e,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(O.TokenKind.EQUALS)?this.delimitedMany(O.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:b.Kind.ENUM_TYPE_DEFINITION,description:e,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(O.TokenKind.BRACE_L,this.parseEnumValueDefinition,O.TokenKind.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:b.Kind.ENUM_VALUE_DEFINITION,description:e,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw(0,p.syntaxError)(this._lexer.source,this._lexer.token.start,`${i(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:b.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:e,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(O.TokenKind.BRACE_L,this.parseInputValueDef,O.TokenKind.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===O.TokenKind.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const e=this.parseConstDirectives(),n=this.optionalMany(O.TokenKind.BRACE_L,this.parseOperationTypeDefinition,O.TokenKind.BRACE_R);if(0===e.length&&0===n.length)throw this.unexpected();return this.node(t,{kind:b.Kind.SCHEMA_EXTENSION,directives:e,operationTypes:n})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const e=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(t,{kind:b.Kind.SCALAR_TYPE_EXTENSION,name:e,directives:n})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:b.Kind.OBJECT_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:b.Kind.INTERFACE_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:b.Kind.UNION_TYPE_EXTENSION,name:e,directives:n,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:b.Kind.ENUM_TYPE_EXTENSION,name:e,directives:n,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:b.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:e,directives:n,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("directive"),this.expectToken(O.TokenKind.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(t,{kind:b.Kind.DIRECTIVE_DEFINITION,description:e,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(O.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,e=this.parseName();if(Object.prototype.hasOwnProperty.call(y.DirectiveLocation,e.value))return e;throw this.unexpected(t)}node(t,e){return!0!==this._options.noLocation&&(e.loc=new m.Location(t,this._lexer.lastToken,this._lexer.source)),e}peek(t){return this._lexer.token.kind===t}expectToken(t){const e=this._lexer.token;if(e.kind===t)return this.advanceLexer(),e;throw(0,p.syntaxError)(this._lexer.source,e.start,`Expected ${r(t)}, found ${i(e)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t&&(this.advanceLexer(),!0)}expectKeyword(t){const e=this._lexer.token;if(e.kind!==O.TokenKind.NAME||e.value!==t)throw(0,p.syntaxError)(this._lexer.source,e.start,`Expected "${t}", found ${i(e)}.`);this.advanceLexer()}expectOptionalKeyword(t){const e=this._lexer.token;return e.kind===O.TokenKind.NAME&&e.value===t&&(this.advanceLexer(),!0)}unexpected(t){const e=null!=t?t:this._lexer.token;return(0,p.syntaxError)(this._lexer.source,e.start,`Unexpected ${i(e)}.`)}any(t,e,n){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(n);)i.push(e.call(this));return i}optionalMany(t,e,n){if(this.expectOptionalToken(t)){const t=[];do{t.push(e.call(this))}while(!this.expectOptionalToken(n));return t}return[]}many(t,e,n){this.expectToken(t);const i=[];do{i.push(e.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(t,e){this.expectOptionalToken(t);const n=[];do{n.push(e.call(this))}while(this.expectOptionalToken(t));return n}advanceLexer(){const{maxTokens:t}=this._options,e=this._lexer.advance();if(void 0!==t&&e.kind!==O.TokenKind.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw(0,p.syntaxError)(this._lexer.source,e.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function i(t){const e=t.value;return r(t.kind)+(null!=e?` "${e}"`:"")}function r(t){return(0,E.isPunctuatorTokenKind)(t)?`"${t}"`:t}e.Parser=n})),x=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.printString=function(t){return`"${t.replace(n,i)}"`};const n=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function i(t){return r[t.charCodeAt(0)]}const r=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"]})),N=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAK=void 0,e.getEnterLeaveForKind=i,e.getVisitFn=function(t,e,n){const{enter:r,leave:s}=i(t,e);return n?s:r},e.visit=function(t,e,r=m.QueryDocumentKeys){const s=new Map;for(const t of Object.values(b.Kind))s.set(t,i(e,t));let o,u,a,c=Array.isArray(t),l=[t],h=-1,f=[],d=t;const v=[],p=[];do{h++;const t=h===l.length,i=t&&0!==f.length;if(t){if(u=0===p.length?void 0:v[v.length-1],d=a,a=p.pop(),i)if(c){d=d.slice();let t=0;for(const[e,n]of f){const i=e-t;null===n?(d.splice(i,1),t++):d[i]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[t,e]of f)d[t]=e}h=o.index,l=o.keys,f=o.edits,c=o.inArray,o=o.prev}else if(a){if(u=c?h:l[h],d=a[u],null==d)continue;v.push(u)}let b;if(!Array.isArray(d)){var y,w;(0,m.isNode)(d)||(0,S.devAssert)(!1,`Invalid AST Node: ${(0,T.inspect)(d)}.`);const i=t?null===(y=s.get(d.kind))||void 0===y?void 0:y.leave:null===(w=s.get(d.kind))||void 0===w?void 0:w.enter;if(b=null==i?void 0:i.call(e,d,u,a,v,p),b===n)break;if(!1===b){if(!t){v.pop();continue}}else if(void 0!==b&&(f.push([u,b]),!t)){if(!(0,m.isNode)(b)){v.pop();continue}d=b}}var g;void 0===b&&i&&f.push([u,d]),t?v.pop():(o={inArray:c,index:h,keys:l,edits:f,prev:o},c=Array.isArray(d),l=c?d:null!==(g=r[d.kind])&&void 0!==g?g:[],h=-1,f=[],a&&p.push(a),a=d)}while(void 0!==o);return 0!==f.length?f[f.length-1][1]:t},e.visitInParallel=function(t){const e=new Array(t.length).fill(null),r=Object.create(null);for(const s of Object.values(b.Kind)){let o=!1;const u=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0);for(let e=0;e<t.length;++e){const{enter:n,leave:r}=i(t[e],s);o||(o=null!=n||null!=r),u[e]=n,a[e]=r}o&&(r[s]={enter(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const a=null===(s=u[o])||void 0===s?void 0:s.apply(t[o],i);if(!1===a)e[o]=r;else if(a===n)e[o]=n;else if(void 0!==a)return a}},leave(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const r=null===(s=a[o])||void 0===s?void 0:s.apply(t[o],i);if(r===n)e[o]=n;else if(void 0!==r&&!1!==r)return r}else e[o]===r&&(e[o]=null)}})}return r};const n=Object.freeze({});function i(t,e){const n=t[e];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}e.BREAK=n})),k=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.print=function(t){return(0,N.visit)(t,n)};const n={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>i(t.definitions,"\n\n")},OperationDefinition:{leave(t){const e=s("(",i(t.variableDefinitions,", "),")"),n=i([t.operation,i([t.name,e]),i(t.directives," ")]," ");return("query"===n?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+s(" = ",n)+s(" ",i(r," "))},SelectionSet:{leave:({selections:t})=>r(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:u}){const a=s("",t,": ")+e;let c=a+s("(",i(n,", "),")");return c.length>80&&(c=a+s("(\n",o(i(n,"\n")),"\n)")),i([c,i(r," "),u]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+s(" ",i(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>i(["...",s("on ",t),i(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:o})=>`fragment ${t}${s("(",i(n,", "),")")} on ${e} ${s("",i(r," ")," ")}`+o},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?(0,g.printBlockString)(t):(0,x.printString)(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+i(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+i(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+s("(",i(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>s("",t,"\n")+i(["schema",i(e," "),r(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i(["scalar",e,i(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["type",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:a})=>s("",t,"\n")+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+": "+r+s(" ",i(a," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:o})=>s("",t,"\n")+i([e+": "+n,s("= ",r),i(o," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["interface",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>s("",t,"\n")+i(["union",e,i(n," "),s("= ",i(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:o})=>s("",t,"\n")+i(["enum",e,i(n," "),r(o)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i([e,i(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:o})=>s("",t,"\n")+i(["input",e,i(n," "),r(o)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:a})=>s("",t,"\n")+"directive @"+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+(r?" repeatable":"")+" on "+i(a," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>i(["extend schema",i(t," "),r(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>i(["extend scalar",t,i(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend type",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend interface",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>i(["extend union",t,i(e," "),s("= ",i(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>i(["extend enum",t,i(e," "),r(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>i(["extend input",t,i(e," "),r(n)]," ")}};function i(t,e=""){var n;return null!==(n=null==t?void 0:t.filter((t=>t)).join(e))&&void 0!==n?n:""}function r(t){return s("{\n",o(i(t,"\n")),"\n}")}function s(t,e,n=""){return null!=e&&""!==e?t+e+n:""}function o(t){return s(" ",t.replace(/\n/g,"\n "))}function u(t){var e;return null!==(e=null==t?void 0:t.some((t=>t.includes("\n"))))&&void 0!==e&&e}})),A=function(t){var e=t.name,n=t.type;this.uri=t.uri,this.name=e,this.type=n},_=function(t){return"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Blob&&t instanceof Blob||t instanceof A},P=function t(e,n,i){var r;void 0===n&&(n=""),void 0===i&&(i=_);var s=new Map;function o(t,e){var n=s.get(e);n?n.push.apply(n,t):s.set(e,t)}if(i(e))r=null,o([n],e);else{var u=n?n+".":"";if("undefined"!=typeof FileList&&e instanceof FileList)r=Array.prototype.map.call(e,(function(t,e){return o([""+u+e],t),null}));else if(Array.isArray(e))r=e.map((function(e,n){var r=t(e,""+u+n,i);return r.files.forEach(o),r.clone}));else if(e&&e.constructor===Object)for(var a in r={},e){var c=t(e[a],""+u+a,i);c.files.forEach(o),r[a]=c.clone}else r=e}return{clone:r,files:s}},$=_,F="object"==typeof self?self.FormData:window.FormData,U=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultJsonSerializer=void 0,e.defaultJsonSerializer={parse:JSON.parse,stringify:JSON.stringify}})),q=o((function(t,e){var n=u&&u.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(F),r=function(t){return $(t)||null!==t&&"object"==typeof t&&"function"==typeof t.pipe};e.default=function(t,e,n,s){void 0===s&&(s=U.defaultJsonSerializer);var o=P({query:t,variables:e,operationName:n},"",r),u=o.clone,a=o.files;if(0===a.size){if(!Array.isArray(t))return s.stringify(u);if(void 0!==e&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");var c=t.reduce((function(t,n,i){return t.push({query:n,variables:e?e[i]:void 0}),t}),[]);return s.stringify(c)}var l=new("undefined"==typeof FormData?i.default:FormData);l.append("operations",s.stringify(u));var h={},f=0;return a.forEach((function(t){h[++f]=t})),l.append("map",s.stringify(h)),f=0,a.forEach((function(t,e){l.append(""+ ++f,e)})),l}})),C=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchRequestsExtendedArgs=e.parseRawRequestExtendedArgs=e.parseRequestExtendedArgs=e.parseBatchRequestArgs=e.parseRawRequestArgs=e.parseRequestArgs=void 0,e.parseRequestArgs=function(t,e,n){return t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0}},e.parseRawRequestArgs=function(t,e,n){return t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0}},e.parseBatchRequestArgs=function(t,e){return t.documents?t:{documents:t,requestHeaders:e,signal:void 0}},e.parseRequestExtendedArgs=function(t,e,n,i){return t.document?t:{url:t,document:e,variables:n,requestHeaders:i,signal:void 0}},e.parseRawRequestExtendedArgs=function(t,e,n,i){return t.query?t:{url:t,query:e,variables:n,requestHeaders:i,signal:void 0}},e.parseBatchRequestsExtendedArgs=function(t,e,n){return t.documents?t:{url:t,documents:e,requestHeaders:n,signal:void 0}}})),V=o((function(t,e){var n,i=u&&u.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.ClientError=void 0;var r=function(t){function e(n,i){var r=this,s=e.extractMessage(n)+": "+JSON.stringify({response:n,request:i});return r=t.call(this,s)||this,Object.setPrototypeOf(r,e.prototype),r.response=n,r.request=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e.extractMessage=function(t){try{return t.errors[0].message}catch(e){return"GraphQL Error (Code: "+t.status+")"}},e}(Error);e.ClientError=r})),L=o((function(t,e){var n=u&&u.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=u&&u.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},r=u&&u.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=void 0;var s="ping",o="pong",a="complete",c=function(){function t(t,e,n){this._type=t,this._payload=e,this._id=n}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return this._payload},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){var t={type:this.type};return null!=this.id&&null!=this.id&&(t.id=this.id),null!=this.payload&&null!=this.payload&&(t.payload=this.payload),JSON.stringify(t)},enumerable:!1,configurable:!0}),t.parse=function(e,n){var i=JSON.parse(e),r=i.id;return new t(i.type,n(i.payload),r)},t}(),l=function(){function t(t,e){var u=this,l=e.onInit,d=e.onAcknowledged,v=e.onPing,p=e.onPong;this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=t,t.onopen=function(){return i(u,void 0,void 0,(function(){var e,n,i,s;return r(this,(function(r){switch(r.label){case 0:return this.socketState.acknowledged=!1,this.socketState.subscriptions={},n=(e=t).send,i=h,l?[4,l()]:[3,2];case 1:return s=r.sent(),[3,3];case 2:s=null,r.label=3;case 3:return n.apply(e,[i.apply(void 0,[s]).text]),[2]}}))}))},t.onclose=function(){u.socketState.acknowledged=!1,u.socketState.subscriptions={}},t.onerror=function(t){console.error(t)},t.onmessage=function(e){try{var i=(void 0===y&&(y=function(t){return t}),c.parse(e.data,y));switch(i.type){case"connection_ack":return void(u.socketState.acknowledged?console.warn("Duplicate CONNECTION_ACK message ignored"):(u.socketState.acknowledged=!0,d&&d(i.payload)));case s:return void(v?v(i.payload).then((function(e){return t.send(f(e).text)})):t.send(f(null).text));case o:return void(p&&p(i.payload))}if(!u.socketState.acknowledged)return;if(null==i.id||!u.socketState.subscriptions[i.id])return;var r=u.socketState.subscriptions[i.id],l=r.query,h=r.variables,m=r.subscriber;switch(i.type){case"next":return!i.payload.errors&&i.payload.data&&m.next&&m.next(i.payload.data),void(i.payload.errors&&m.error&&m.error(new V.ClientError(n(n({},i.payload),{status:200}),{query:l,variables:h})));case"error":return void(m.error&&m.error(new V.ClientError({errors:i.payload,status:200},{query:l,variables:h})));case a:return m.complete&&m.complete(),void delete u.socketState.subscriptions[i.id]}}catch(e){console.error(e),t.close(1006)}var y;t.close(4400,"Unknown graphql-ws message.")}}return t.prototype.makeSubscribe=function(t,e,n,i){var r,s,o=this,u=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[u]={query:t,variables:n,subscriber:i},this.socket.send((r=u,s={query:t,operationName:e,variables:n},new c("subscribe",s,r)).text),function(){o.socket.send(function(t){return new c(a,void 0,t)}(u).text),delete o.socketState.subscriptions[u]}},t.prototype.rawRequest=function(t,e){var n=this;return new Promise((function(i,r){var s;n.rawSubscribe(t,{next:function(t,e){return s={data:t,extensions:e}},error:r,complete:function(){return i(s)}},e)}))},t.prototype.request=function(t,e){var n=this;return new Promise((function(i,r){var s;n.subscribe(t,{next:function(t){return s=t},error:r,complete:function(){return i(s)}},e)}))},t.prototype.subscribe=function(t,e,n){var i=M.resolveRequestDocument(t);return this.makeSubscribe(i.query,i.operationName,n,e)},t.prototype.rawSubscribe=function(t,e,n){return this.makeSubscribe(t,void 0,n,e)},t.prototype.ping=function(t){this.socket.send(function(t){return new c(s,t,void 0)}(t).text)},t.prototype.close=function(){this.socket.close(1e3)},t.PROTOCOL="graphql-transport-ws",t}();function h(t){return new c("connection_init",t)}function f(t){return new c(o,t,void 0)}e.GraphQLWebSocketClient=l})),M=o((function(t,e){var n=u&&u.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=u&&u.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=u&&u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=u&&u.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},o=u&&u.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},a=u&&u.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},l=u&&u.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n},h=u&&u.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=e.gql=e.resolveRequestDocument=e.batchRequests=e.request=e.rawRequest=e.GraphQLClient=e.ClientError=void 0;var f=s(c),d=f,v=h(q);Object.defineProperty(e,"ClientError",{enumerable:!0,get:function(){return V.ClientError}});var p=function(t){var e={};return t&&("undefined"!=typeof Headers&&t instanceof Headers||t instanceof d.Headers?e=function(t){var e={};return t.forEach((function(t,n){e[n]=t})),e}(t):Array.isArray(t)?t.forEach((function(t){e[t[0]]=t[1]})):e=t),e},m=function(t){return t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim()},y=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,l=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=v.default(i,r,s,l.jsonSerializer),[4,c(e,n({method:"POST",headers:n(n({},"string"==typeof t?{"Content-Type":"application/json"}:{}),u),body:t},l))];case 1:return[2,o.sent()]}}))}))},b=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,l=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=function(t){var e=t.query,n=t.variables,i=t.operationName,r=t.jsonSerializer;if(!Array.isArray(e)){var s=["query="+encodeURIComponent(m(e))];return n&&s.push("variables="+encodeURIComponent(r.stringify(n))),i&&s.push("operationName="+encodeURIComponent(i)),s.join("&")}if(void 0!==n&&!Array.isArray(n))throw new Error("Cannot create query with given variable type, array expected");var o=e.reduce((function(t,e,i){return t.push({query:m(e),variables:n?r.stringify(n[i]):void 0}),t}),[]);return"query="+encodeURIComponent(r.stringify(o))}({query:i,variables:r,operationName:s,jsonSerializer:l.jsonSerializer}),[4,c(e+"?"+t,n({method:"GET",headers:u},l))];case 1:return[2,o.sent()]}}))}))},w=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,u,c,h,d,v,m,y;return a(this,(function(){return r=C.parseRawRequestArgs(t,e,i),o=(s=this.options).headers,c=void 0===(u=s.fetch)?f.default:u,d=void 0===(h=s.method)?"POST":h,v=l(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=T(r.query).operationName,[2,g({url:m,query:r.query,variables:r.variables,headers:n(n({},p(D(o))),p(r.requestHeaders)),operationName:y,fetch:c,method:d,fetchOptions:v})]}))}))},t.prototype.request=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,u,c,h,d,v,m,y,b;return a(this,(function(a){switch(a.label){case 0:return r=C.parseRequestArgs(t,e,i),o=(s=this.options).headers,c=void 0===(u=s.fetch)?f.default:u,d=void 0===(h=s.method)?"POST":h,v=l(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=T(r.document),b=y.operationName,[4,g({url:m,query:y.query,variables:r.variables,headers:n(n({},p(D(o))),p(r.requestHeaders)),operationName:b,fetch:c,method:d,fetchOptions:v})];case 1:return[2,a.sent().data]}}))}))},t.prototype.batchRequests=function(t,e){return o(this,void 0,void 0,(function(){var i,r,s,o,u,c,h,d,v,m,y;return a(this,(function(a){switch(a.label){case 0:return i=C.parseBatchRequestArgs(t,e),s=(r=this.options).headers,u=void 0===(o=r.fetch)?f.default:o,h=void 0===(c=r.method)?"POST":c,d=l(r,["headers","fetch","method"]),v=this.url,void 0!==i.signal&&(d.signal=i.signal),m=i.documents.map((function(t){return T(t.document).query})),y=i.documents.map((function(t){return t.variables})),[4,g({url:v,query:m,variables:y,headers:n(n({},p(D(s))),p(i.requestHeaders)),operationName:void 0,fetch:u,method:h,fetchOptions:d})];case 1:return[2,a.sent().data]}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var n,i=this.options.headers;return i?i[t]=e:this.options.headers=((n={})[t]=e,n),this},t.prototype.setEndpoint=function(t){return this.url=t,this},t}();function g(t){var e=t.url,i=t.query,r=t.variables,s=t.headers,u=t.operationName,c=t.fetch,h=t.method,f=void 0===h?"POST":h,d=t.fetchOptions;return o(this,void 0,void 0,(function(){var t,o,h,v,p,m,w,g,O,S;return a(this,(function(a){switch(a.label){case 0:return t="POST"===f.toUpperCase()?y:b,o=Array.isArray(i),[4,t({url:e,query:i,variables:r,operationName:u,headers:s,fetch:c,fetchOptions:d})];case 1:return[4,E(h=a.sent(),d.jsonSerializer)];case 2:if(v=a.sent(),p=o&&Array.isArray(v)?!v.some((function(t){return!t.data})):!!v.data,m=!v.errors||"all"===d.errorPolicy||"ignore"===d.errorPolicy,h.ok&&m&&p)return w=h.headers,g=h.status,O=l(v,["errors"]),S="ignore"===d.errorPolicy?O:v,[2,n(n({},o?{data:S}:S),{headers:w,status:g})];throw new V.ClientError(n(n({},"string"==typeof v?{error:v}:v),{status:h.status,headers:h.headers}),{query:i,variables:r})}}))}))}function O(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=C.parseRequestExtendedArgs(t,e,i,r),[2,new w(s.url).request(n({},s))]}))}))}function E(t,e){return void 0===e&&(e=U.defaultJsonSerializer),o(this,void 0,void 0,(function(){var n,i,r;return a(this,(function(s){switch(s.label){case 0:return t.headers.forEach((function(t,e){"content-type"===e.toLowerCase()&&(n=t)})),n&&n.toLowerCase().startsWith("application/json")?(r=(i=e).parse,[4,t.text()]):[3,2];case 1:return[2,r.apply(i,[s.sent()])];case 2:return[2,t.text()]}}))}))}function S(t){var e,n=void 0,i=t.definitions.filter((function(t){return"OperationDefinition"===t.kind}));return 1===i.length&&(n=null===(e=i[0].name)||void 0===e?void 0:e.value),n}function T(t){if("string"==typeof t){var e=void 0;try{e=S(I.parse(t))}catch(t){}return{query:t,operationName:e}}var n=S(t);return{query:k.print(t),operationName:n}}function D(t){return"function"==typeof t?t():t}e.GraphQLClient=w,e.rawRequest=function(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=C.parseRawRequestExtendedArgs(t,e,i,r),[2,new w(s.url).rawRequest(n({},s))]}))}))},e.request=O,e.batchRequests=function(t,e,i){return o(this,void 0,void 0,(function(){var r;return a(this,(function(){return r=C.parseBatchRequestsExtendedArgs(t,e,i),[2,new w(r.url).batchRequests(n({},r))]}))}))},e.default=O,e.resolveRequestDocument=T,e.gql=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.reduce((function(t,n,i){return""+t+n+(i in e?e[i]:"")}),"")},Object.defineProperty(e,"GraphQLWebSocketClient",{enumerable:!0,get:function(){return L.GraphQLWebSocketClient}})}));class R{static getQueryParams(t){const e=new Map,n=/[?&]?([^=]+)=([^&]*)/g;let i;for(t=(t=window.unescape(t)).split("+").join(" ");i=n.exec(t);)e.set(window.decodeURIComponent(i[1]),i[2]);return e.set("urlBase",this.getUrlBase()),window.moduleID&&window.URIServiceBroker&&(e.set("moduleID",window.moduleID),e.set("URIServiceBroker",window.URIServiceBroker)),e}static getUrlBase(){return window.mock_url?window.mock_url:`${location.protocol}//${location.hostname}${location.port?":"+location.port:""}`}}class B{constructor(t,e,n,i){this.serviceName=t,this.requestBody=e,this.successCallback=n,this.errorCallback=i}reCall(t){return t&&(this.requestBody=t),Q.get().callServiceBroker(this.serviceName,this.requestBody).then(this.successCallback,this.errorCallback)}}class G{constructor(t,e,n){this.req=t,this.resolve=e,this.reject=n}putVariable(t,e){this.req.values[t]=e}reCall(){return Q.get().callGraphQL(this.req).then(this.resolve,this.reject)}putTXPro(e,n){this.req&&this.req.values&&(this.req.values.changes||[]).length&&this.req.values.changes[0].fields.push({dataType:t.TEXT,fieldName:`${a.DATA_UNIT_TRANSIENT_PREFIX_NAME}${e}`,value:n})}}class J{constructor(){this.appletImpressao=new z}static getInstance(){return J.instance||(J.instance=new J),J.instance}async processPendingPrinting(t){await this.findPendingPrints(t)}async findPendingPrints(t){const e={transactionIds:[{transactionId:{$:t}}]},n=await Q.get().callServiceBroker(J.SERVICE_FIND_PENDING_PRINTS,JSON.stringify(e)),i=this.parsePrintData(n),r=await this.processDirectPrint(i);r.length&&this.openSnkPrintSelector(Object.assign(Object.assign({},i),{pendingPrinters:r}))}getLocalPrinters(){const t=this.appletImpressao.findLocalPrinters(),e=[];for(const n of t)e.push({nome:n,printerUri:J.LOCAL_SERVER_URI+n,isLocal:!0});return e}parsePrintData(t){const e=t.pendindPrintJobData;if(!e)return;let{printServers:{printServer:n},pendingPrinters:{pendingPrinter:i}}=e;n=n?Array.isArray(n)?n:[n]:[],i=i?Array.isArray(i)?i:[i]:[];const r=n.map((t=>{const e=Array.isArray(t.printerLocation)?t.printerLocation:[t.printerLocation];return{printServerUri:t.printServerUri,printerList:e.map(this.normalize)}})),s=i.map(this.normalize);return{transactionId:e.transactionId.$,printServers:r,pendingPrinters:s,printServerActive:"true"===e.printServers.printServerActive}}normalize(t){const e={};return Object.keys(t).forEach((n=>{e[n]=J.ENCODED_PROPERTIES.includes(n)?window.atob(t[n].$):t[n].$})),e}processLocalPrinting(t){const e=t.map((t=>t.transactionId));this.appletImpressao.doLocalPrinting(e.join())}async openSnkPrintSelector(t){let n=document.querySelector("snk-print-selector");n||(n=document.createElement("snk-print-selector"),n.setAttribute("id",e.generateUUID()),window.document.body.appendChild(n));const{selectedPrinter:i,saveSubstitute:r}=await n.openPrintSelector(t);if(!i)return;const s={transactionId:t.transactionId,pendingPrinters:t.pendingPrinters,printerUri:i.printerUri,saveSubstitutePrinters:r};await this.saveSubstitutePrinter(s)}async saveSubstitutePrinter(t){const{transactionId:e,pendingPrinters:n,printerUri:i,saveSubstitutePrinters:r=!1}=t,s={substitutePrintersRequest:{substitutePrinters:{pendingPrinter:n.map((t=>({printerUri:{$:t.printerUri||i},originalPrinterName:{$:t.originalPrinterName},printJobCount:{$:t.printJobCount},docType:{$:t.docType},docTypeDescription:{$:t.docTypeDescription}})))},saveSubstitutePrinters:{$:r.toString()},transactionId:{$:e}}};await Q.get().callServiceBroker(J.SERVICE_SAVE_SUBSTITUTE_PRINTER,JSON.stringify(s))}async processDirectPrint(t){if(!this.appletImpressao.checkWebConnection())return[];const e=this.getLocalPrinters();if(!e.length)return[];const n=[],i=t.pendingPrinters.filter((t=>{const i=this.getDefaultPrinterName(t.originalPrinterName);return!(e.find((t=>t.nome===i))||this.isPrinterNameAFile(i))||(n.push(Object.assign(Object.assign({},t),{printerUri:J.LOCAL_SERVER_URI+i})),!1)}));if(!n.length)return i;const r={transactionId:t.transactionId,pendingPrinters:n};return await this.saveSubstitutePrinter(r),i}getDefaultPrinterName(t){const e=this.appletImpressao.getDefaultPrinter(),n=/padr[aã]o/gi.test(t);return e&&n?e:t}isPrinterNameAFile(t){return new RegExp("^(w:)?[/\\ws]+?.w{3}$","mis").test(t)}}J.SERVICE_FIND_PENDING_PRINTS="mge@PrintServiceSP.findPendingPrinters",J.SERVICE_SAVE_SUBSTITUTE_PRINTER="mge@PrintServiceSP.saveSubstitutePrinter",J.LOCAL_SERVER_URI="LOCAL:0/",J.ENCODED_PROPERTIES=["printerName","printerUri"];class z{constructor(){this.appletImpressao=document.getElementById("centralNotaAppletImpressao")}checkWebConnection(){return!!this.appletImpressao&&(!!this.appletImpressao.testRunningWC&&!!this.appletImpressao.testRunningWC())}findLocalPrinters(){if(!this.appletImpressao)return[];const t=this.appletImpressao.getLocalPrinters();return t?t.split(","):[]}doLocalPrinting(t){this.appletImpressao&&this.appletImpressao.doLocalPrinting(t)}getDefaultPrinter(){return this.appletImpressao?this.appletImpressao.getPrintDefault():""}}var H=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(n){e[n]=t[n]&&function(e){return new Promise((function(i,r){!function(t,e,n,i){Promise.resolve(i).then((function(e){t({value:e,done:n})}),e)}(i,r,(e=t[n](e)).done,e.value)}))}}};class Q{constructor(){this.GRAPHQL_PATH=`/${window.MGE_MODULE_NAME||"mgefin-bff"}/graphql`,this.watingRequestsById=new Map}static get(){if(!Q.instance){Q.instance=new Q;const t=document.querySelector(this.appTagName);null===t?Q.instance.resume():(t.addEventListener("applicationLoading",(()=>Q.instance.pause())),t.addEventListener("applicationLoaded",(()=>Q.instance.resume())))}return this.instance.application=n.getContextValue("__SNK__APPLICATION__"),this.instance}static addRequestListener(t){Q.requestListener.indexOf(t)<0&&Q.requestListener.push(t)}static removeRequestListener(t){const e=Q.requestListener.indexOf(t);e>-1&&Q.requestListener.splice(e,1)}processGraphQlErrorInfo(t){var e,n;const s="Falha detectada",o=t[0];if(o.length>0){const t=o[0],u=(null==t?void 0:t.message)?null==t?void 0:t.message:"Não há mensagem de erro",a=(null===(e=null==t?void 0:t.extensions)||void 0===e?void 0:e.level)?t.extensions.level:"ERROR",c=(null===(n=null==t?void 0:t.extensions)||void 0===n?void 0:n.code)?t.extensions.code:"";return"WARNING"===a?new r(s,u,c):new i(s,u,c)}return new i(s,"Não há informações sobre o erro")}processServiceBrokerErrorInfo(t){const e="Falha detectada";let n,s,{statusMessage:o,tsError:u}=t||{};return o||(o="Não há informações sobre o erro"),u&&(n=u.tsErrorCode,s=u.tsErrorLevel),"WARNING"===s?new r(e,o,n):new i(e,o,n)}async callGraphQL(t){var e;const n=this.getReqKey(t);if(t.queryID=n,t.values.queryID=n,Q.clientEventsByID){t.values.registeredEventListeners=[];for(let[e]of Q.clientEventsByID)t.values.registeredEventListeners.push(e)}return this.ready?new Promise((async(e,i)=>{let r=this.getQueryTemplate(t);const s=await this.fecthGrapql([{document:r,variables:t.values}]);s.errors.length>0?this.proccesGraphQLClientEvents(null==s?void 0:s.extensions,t,e,i)||i(this.processGraphQlErrorInfo(s.errors)):(e(s.data[0][n]),this.proccesGraphQLClientEvents(null==s?void 0:s.extensions,t,e,i))})):(this.watingRequestsById.has(n)||this.watingRequestsById.set(n,new K(t)),null===(e=this.getWatingRequest(n))||void 0===e?void 0:e.promise)}resolveURL(){return R.getUrlBase()}proccesGraphQLClientEvents(t,e,n,i){if(null==t)return!1;for(const s in t){const{clientEvents:o}=t[s];if(!o)return!1;for(const t in o){if(!Q.hasClientEvent(t))throw console.warn(`Client event ${t} not registered`),new r("ClientEvent não registrado",`Ocorreu o client event ${t} porém não há client event registrado na aplicação.`);Q.clientEventsByID.get(t).forEach((r=>{r({id:t,content:JSON.parse(o[t])},new G(e,n,i))}))}return Object.keys(o).length>0}return!1}async processServiceBrokerClientEvents(t){var e,n,i,r,s,o,u,a;const{clientEvents:c,serviceName:l,payloadJson:h,accept:f,reject:d}=t;if(!(null==c?void 0:c.length))return;const v=new B(l,h,f,d);try{for(var p,m=!0,y=H(c);!(e=(p=await y.next()).done);){r=p.value,m=!1;try{const t=r;if(Q.hasClientEvent(t.id)){const e=Q.clientEventsByID.get(t.id),n={id:t.id,content:t};try{for(var b,w=!0,g=(o=void 0,H(e));!(s=(b=await g.next()).done);){a=b.value,w=!1;try{const t=a;await t(n,v)}finally{w=!0}}}catch(t){o={error:t}}finally{try{w||s||!(u=g.return)||await u.call(g)}finally{if(o)throw o.error}}}}finally{m=!0}}}catch(t){n={error:t}}finally{try{m||e||!(i=y.return)||await i.call(y)}finally{if(n)throw n.error}}}processPrinting(t){"true"===(null==t?void 0:t.pendingPrinting)&&J.getInstance().processPendingPrinting(null==t?void 0:t.transactionId),"localPrintings"in t&&J.getInstance().processLocalPrinting(null==t?void 0:t.localPrintings)}getContext(t){var e;const n=R.getQueryParams(location.search);return{baseUrl:`${this.resolveURL()}/${t}/service.sbr`,appName:"SankhyaBlocks",mgeSession:`${window.mgeSession||n.get("mgeSession")}`,globalID:"85C0093DFA240EAB699B4E47A10215BD",resourceID:window.resourceID||(null===(e=window.workspace)||void 0===e?void 0:e.resourceID)}}async callServiceBroker(t,e,n){return new Promise((async(r,o)=>{const u=t.split("@"),[a,c]=2===u.length?u:["mge",t],l=this.getContext(a);let h=`${l.baseUrl}?serviceName=${c}&counter=21&application=${l.appName}&outputType=json&preventTransform=false&mgeSession=${l.mgeSession}&resourceID=${l.resourceID}&globalID=${l.globalID}&allowConcurrentCalls=true`;h=await this.addUrlParams(n,h),document.cookie=`JSESSIONID=${l.mgeSession};`;const f=new XMLHttpRequest;var d={};"string"==typeof e&&(e=s.stringToObject(e)),e.hasOwnProperty("requestBody")?d=e:d.requestBody=e;for(let[t]of Q.clientEventsByID)d.requestBody.hasOwnProperty("clientEventList")||(d.requestBody.clientEventList={clientEvent:[]}),d.requestBody.clientEventList.clientEvent.push({$:t});Q.requestListener.forEach((t=>t.onRequestStart({url:h,requestBody:e}))),f.open("POST",h,!0),f.withCredentials=!0,f.send(s.objectToString(d)),f.onreadystatechange=async()=>{var n;if(4==f.readyState&&200==f.status)try{const e=JSON.parse(f.responseText);await this.processServiceBrokerClientEvents({clientEvents:null==e?void 0:e.clientEvents,serviceName:t,payloadJson:d,accept:r,reject:o}),this.isServiceBrokerError(e)?o(this.processServiceBrokerErrorInfo(e)):e.status==Q.SERVICE_BROKER_STATUS.SERVICE_CANCELED&&e.statusMessage?console.debug(`[DataFetcher] ${e.statusMessage}`):(r(e.responseBody),e.status==Q.SERVICE_BROKER_STATUS.INFO&&(null===(n=this.application)||void 0===n||n.info(e.statusMessage))),this.processPrinting(e)}catch(t){console.warn(`Erro ao executar serviço: ${t}`),o(new i("Erro ao executar serviço",t))}else 4==f.readyState&&200!=f.status&&o(new i(`Erro ao executar serviço: ${t}`,f.responseText));Q.requestListener.forEach((t=>t.onRequestEnd({url:h,requestBody:e})))}}))}async addUrlParams(t,n){var i;const r=(null==t?void 0:t.urlParams)||{},s=await(null===(i=this.application)||void 0===i?void 0:i.getAttributeFromHTMLWrapper("VSS"));if(e.isEmpty(s)||(r.vss=s),0===Object.keys(r).length)return n;-1===n.indexOf("?")&&(n+="?");for(const t in r)n+=`&${t}=${r[t]}`;return n}isServiceBrokerError(t){return!t.hasOwnProperty("status")||t.status==Q.SERVICE_BROKER_STATUS.ERROR||t.status==Q.SERVICE_BROKER_STATUS.TIMEOUT}getReqKey(t){return window.btoa(e.hashCode(`${t.query}${JSON.stringify(t.values||"")}`)).replace(/=/g,"")}getQueryTemplate(t){return(t.query||"").replaceAll("$queryAlias$",t.queryID)}getWatingRequest(t){return this.watingRequestsById.get(t)}pause(){this.ready=!1}async resume(){if(this.ready=!0,this.watingRequestsById.size>0){const t=[];let e;this.watingRequestsById.forEach((async e=>{let n=this.getQueryTemplate(e.request);t.push({document:n,variables:Object.assign({},e.request.values)})}));let n=[],r=[];e=await this.fecthGrapql(t),n=e.data,r=e.errors,r.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(e.request.variables[e.index].queryID))||void 0===n?void 0:n.reject)||Promise.reject)(new i("Falha detectada",e.message))}))})),n.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(t))||void 0===n?void 0:n.resolve)||Promise.resolve)(e)}))})),this.watingRequestsById.clear()}}async fecthGrapql(t){let e,n=[],r=[],s=`${this.resolveURL()+this.GRAPHQL_PATH}`;const o=[];window.mgeSession&&(s+=`?mgeSession=${window.mgeSession}`),Q.requestListener.forEach((e=>e.onRequestStart({url:s,requestBody:t})));try{e=await M.batchRequests(s,t,{"Content-Type":`application/json; charset=${window.SERVER_ENCODING||"UTF-8"}`}),e.forEach(((e,i)=>{var s;(null===(s=null==e?void 0:e.errors)||void 0===s?void 0:s.length)>0?r.push(e.errors.map((e=>this.normalizeErrorResponse(e,t,i)))):n.push(e.data),e.extensions&&o.push(e.extensions)}))}catch(o){if(this.isHttpError(o))throw Q.requestListener.forEach((e=>e.onRequestEnd({url:s,requestBody:t}))),new i("Falha de comunicação",o.message);{e=o.response;const t=o.request;Object.entries(e).forEach((([e,i])=>{i.errors?r.push(i.errors.map((n=>(n.request=t,n.index=Number(e),n)))):i.data&&n.push(i.data)}))}}return Q.requestListener.forEach((e=>e.onRequestEnd({url:s,requestBody:t}))),{data:n,errors:r,extensions:o}}isHttpError(t){var e;return!t.response&&!t.request||(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)>=300}normalizeErrorResponse(t,e,n){const i=Object.assign({},e[n]),{variables:r}=i;return i.variables=[],i.variables[n]=r,t.request=i,t.index=Number(n),t}static addClientEvent(t,e){let n=Q.clientEventsByID.get(t);if(null!=n){if(n.some((t=>t.toString()===e.toString())))return;n.push(e)}else Q.clientEventsByID.set(t,[e])}static hasClientEvent(t){return Q.clientEventsByID.has(t)}static removeClientEvent(t){return Q.clientEventsByID.delete(t)}}Q.appTagName="snk-application",Q.requestListener=[],Q.SERVICE_BROKER_STATUS={ERROR:0,INFO:2,OK:1,TIMEOUT:3,SERVICE_CANCELED:4},Q.clientEventsByID=new Map;class K{constructor(t){this._resolve=()=>{},this._reject=()=>{},this._request=void 0,this._request=t,this._promisse=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get resolve(){return this._resolve}get reject(){return this._reject}get promise(){return this._promisse}get request(){return this._request}}export{Q as D,J as P,R as U,M as d}
@@ -1,56 +0,0 @@
1
- import{ApplicationContext as e}from"@sankhyalabs/core";import{F as t}from"./p-9d36d914.js";import{R as s}from"./p-aeaa5253.js";import{F as i}from"./p-37b17041.js";import{d as r,D as n}from"./p-6ee5d42c.js";class a extends s{constructor(){super(...arguments),this.GRID_CONFIG_VERSION="V3:"}getConfig(e,t){const s=this.getPath(t,e);return new Promise(((e,t)=>{this.loadResource(s).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((e=>{t(e)}))}))}saveConfig(e,t,s){const i=this.getPath(s,t);return new Promise(((t,s)=>{this.saveResource(e,i).then((e=>{t(JSON.parse(e.resource))})).catch((e=>{s(e)}))}))}getPath(e,t){return t?`cfg://grid/${this.GRID_CONFIG_VERSION}${e}/${t}`:`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`}}class l{constructor(){this.templateByQuery=new Map,this.buildTemplates()}resolveURI(e,t){let s="filter-assistent-config://"+e;return t&&(s+="."+t),s}buildTemplates(){this.templateByQuery.set("fetchFilterFields",r.gql`
2
- query($name: String!) {
3
- $queryAlias$: fetchFilterFields(name: $name){
4
- currentLink {
5
- description
6
- uri
7
- }
8
- links {
9
- description
10
- uri
11
- fieldCount
12
- }
13
- fields {
14
- name
15
- description
16
- uri
17
- onlyDate
18
- dataType
19
- userInterface
20
- entityName
21
- properties {
22
- name
23
- value
24
- }
25
- }
26
- }
27
- }
28
- `),this.templateByQuery.set("fetchFilterAssistent",r.gql`
29
- query($name: String!) {
30
- $queryAlias$: fetchFilterAssistent(name: $name) {
31
- id
32
- name
33
- active
34
- expression
35
- warningMessage
36
- assistent
37
- }
38
- }`),this.templateByQuery.set("savePersonalizedFilter",r.gql`
39
- mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
40
- $queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
41
- id
42
- name
43
- }
44
- }`),this.templateByQuery.set("deletePersonalizedFilter",r.gql`
45
- mutation($name: String!, $filterId: String!) {
46
- $queryAlias$: deletePersonalizedFilter(name: $name, filterId: $filterId) {
47
- id
48
- name
49
- }
50
- }`),this.templateByQuery.set("validateExpression",r.gql`
51
- query($dataUnitName: String!, $expression: String!) {
52
- $queryAlias$: validateExpression(dataUnitName: $dataUnitName, expression: $expression) {
53
- valid
54
- message
55
- }
56
- }`)}async loadPersonalizedFilter(e,t,s){return new Promise(((i,r)=>{n.get().callGraphQL({values:{name:this.resolveURI(e,s)+"/"+t},query:this.templateByQuery.get("fetchFilterAssistent")}).then((e=>{e.assistent=JSON.parse(e.assistent),i(e)})).catch((e=>{r(e)}))}))}async savePersonalizedFilter(e,t,s){let i=JSON.parse(JSON.stringify(e));return i.assistent=JSON.stringify(i.assistent),new Promise(((e,r)=>{n.get().callGraphQL({values:{name:this.resolveURI(t,s),filterAssistent:i},query:this.templateByQuery.get("savePersonalizedFilter")}).then((t=>{e(t)})).catch((e=>{r(e)}))}))}async removePersonalizedFilter(e,t,s){return new Promise(((i,r)=>{n.get().callGraphQL({values:{name:this.resolveURI(t,s),filterId:e.id},query:this.templateByQuery.get("deletePersonalizedFilter")}).then((e=>{i(e)})).catch((e=>{r(e)}))}))}async validatePersonalizedFilter(e,t){return new Promise(((s,i)=>{n.get().callGraphQL({values:{dataUnitName:e,expression:t},query:this.templateByQuery.get("validateExpression")}).then((e=>{s(e)})).catch((e=>{i(e)}))}))}loadFields(e){return new Promise(((t,s)=>{n.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchFilterFields")}).then((e=>{var s;let i=e.fields;for(const e of i){if(Array.isArray(e.properties)&&e.properties.length>0){const t=e.properties.reduce(((e,t)=>(e[t.name]=t.value,e)),{});e.properties=t}(null===(s=null==e?void 0:e.properties)||void 0===s?void 0:s.options)&&(e.properties.options=JSON.parse(e.properties.options))}t(Object.assign(Object.assign({},e),{fields:i}))})).catch((e=>{s(e)}))}))}}const o="form",c="grid",d="filterBar";class u{static async get(){if(!u.instance){const t=e.getContextValue("__SNK__APPLICATION__");if(null!=t){const e=t.configName,s=await t.getResourceID();u.instance=new u,u.resourceID=s,u.instance.loadFormConfig(e),u.instance.loadGridConfig(e)}}return this.instance}async loadFilterBarConfig(e,t){const s=u.buildCacheID(e,d);return u.configById.has(s)||u.configById.set(s,u.filterBarConfigFetcher.getConfig(u.resourceID,e,t)),u.configById.get(s)}async loadFormConfig(e){const t=u.buildCacheID(e,o);return u.configById.has(t)||u.configById.set(t,u.formConfigFetcher.loadFormConfig(e,u.resourceID)),u.configById.get(t)}async loadGridConfig(e){const t=u.buildCacheID(e,c);return u.configById.has(t)||u.configById.set(t,u.gridConfigFetcher.getConfig(e,u.resourceID)),u.configById.get(t)}static async saveFilterBarConfig(e,t){const s=this.buildCacheID(t,d);return this.configById.delete(s),this.filterBarConfigFetcher.saveConfig(e,this.resourceID,t)}static async saveFormConfig(e,t){const s=this.buildCacheID(t,o);return this.configById.delete(s),this.formConfigFetcher.saveConfig(e,t,this.resourceID)}static async saveCardState(e,t){return this.formConfigFetcher.saveCardState(e,t,this.resourceID)}static async saveGridConfig(e,t){if(null==e)return;const s=this.buildCacheID(t,c);return this.configById.delete(s),this.gridConfigFetcher.saveConfig(e,t,this.resourceID)}static async loadPersonalizedFilter(e,t){return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID,e,t)}static async savePersonalizedFilter(e,t){const s=this.buildCacheID(t,d);return this.configById.delete(s),this.personalizedFilterFetcher.savePersonalizedFilter(e,this.resourceID,t)}static async removePersonalizedFilter(e,t){return this.personalizedFilterFetcher.removePersonalizedFilter(e,this.resourceID,t)}static async validatePersonalizedFilter(e,t){return this.personalizedFilterFetcher.validatePersonalizedFilter(e,t)}static buildCacheID(e,t){return null==e?`req_${t}_${this.resourceID}`:`req_${t}_${e}_${this.resourceID}`}}u.configById=new Map,u.filterBarConfigFetcher=new i,u.formConfigFetcher=new t,u.gridConfigFetcher=new a,u.personalizedFilterFetcher=new l;export{u as C,a as G,l as P}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as a,ApplicationContext as h}from"@sankhyalabs/core";import{T as n}from"./p-a2493d11.js";import"./p-6ee5d42c.js";import"./p-435259af.js";import{P as o}from"./p-5534e08c.js";import{c as r}from"./p-4a78e118.js";import{A as d}from"./p-c1273e40.js";import"./p-6dc031de.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-aeaa5253.js";const c=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this._viewHistory=[],this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=r.GRID,this._canEdit=void 0,this.configName=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=o.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===r.GRID,this.setViewMode(r.FORM)}async executeAction(t){return t===n.GRID_MODE?this.setViewMode(r.GRID):t===n.FORM_MODE||t===n.UPDATE?this.gridToForm(t!==n.UPDATE):t===n.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(r.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||r.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t}openConfig(t){this._snkConfigurator.close(),t===r.GRID?this._snkGrid.showConfig():t===r.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){a.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(r.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}componentWillLoad(){const t=h.getContextValue("__SNK__APPLICATION__");t.hasAccess(d.UPDATE).then((t=>this._canEdit=t));let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",(async({detail:t})=>{this._dataState=t,void 0!==t.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}));break}i=i.parentElement}this.configName||(this.configName=t.configName)}initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder)}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}render(){return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===r.GRID,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit},s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(r.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit},s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL")},s("div",{slot:"SnkConfigContainerSlot"},s("slot",{name:"SnkConfigContainerSlot"}))))}get _element(){return e(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};c.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{c as snk_crud}
@@ -1 +0,0 @@
1
- import{C as t}from"./p-72d7f00c.js";import{ObjectUtils as e}from"@sankhyalabs/core";import{F as s}from"./p-9d36d914.js";class i{constructor(t,e){this._configName=t,this._onConfigChange=e}async loadConfig(){return new Promise((e=>{t.get().then((t=>{t.loadFormConfig(this._configName).then((t=>{this.setConfig(t),e(t)})).catch((t=>{console.warn(t)}))}))}))}saveConfig(s){const i=e.copy(s);return new Promise((e=>{t.saveFormConfig(s,this._configName).then((t=>{this.setConfig(Object.assign(Object.assign({},i),t)),e(Object.assign(Object.assign({},i),t))}))}))}saveCardState(e,s,i){return new Promise((r=>{var n;const h=(null===(n=this._config)||void 0===n?void 0:n.cardsState)||new Map,c=h.get(e);h.set(e,"fixed"===i?this.updateFixSequence(Object.assign(Object.assign({},c),{fixed:s.fixed}),h):Object.assign(Object.assign({},c),{[i]:s[i]})),t.saveCardState(h,this._configName).then((t=>{this._config=Object.assign(Object.assign({},this._config),{cardsState:h}),r(t)}))}))}updateFixSequence(t,e){let s=-1;return Array.from(e.values()).forEach((e=>{e.fixed||delete t.fixSequence,null!=e.fixSequence&&(s=Math.max(s,e.fixSequence))})),t.fixed?t.fixSequence=s+1:delete t.fixSequence,t}getFieldsList(t){var e;const s=null===(e=this._config)||void 0===e?void 0:e.fields;return null!=s&&s.length>0?[...s]:null!=t?t.metadata.fields.filter((t=>!1!==t.visible)).map((({name:t})=>({name:t}))):[]}getInsertionConfig(t){const e=this.getFieldsList(t).filter((e=>{if(t){const s=t.getField(e.name);if(s&&s.readOnly)return!1}return!e.readOnly}));return Object.assign(Object.assign({},this._config),{fields:e})}setConfig(t){this.isLoaded=!0;const{cardsState:e,summary:s,defaultVars:i}=this._config||{};this._config=Object.assign({},t),e&&(this._config.cardsState=e),s&&(this._config.summary=s),i&&(this._config.defaultVars=i),this._onConfigChange&&this._onConfigChange(Object.assign({},this._config))}getConfig(t,e){return t?this.getInsertionConfig(e):Object.assign({},this._config)}getFormConfigFetcher(){return null==this._formConfigFetcher&&(this._formConfigFetcher=new s),this._formConfigFetcher}async fetchUserAvailableConfigs(t){return null!=this._configName?Promise.resolve(void 0):this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName,t)}async fetchLegacyConfig(t){return this.getFormConfigFetcher().fetchLegacyConfig(this._configName,t)}async fetchDefaultConfig(t){return this.getFormConfigFetcher().fetchDefaultConfig(this._configName,t)}}export{i as S}
@@ -1 +0,0 @@
1
- import{r as i,c as e,h as s,F as t}from"./p-d2d301a6.js";import{ElementIDUtils as a}from"@sankhyalabs/core";import{S as r}from"./p-8115f7a2.js";import{buildFormMetadata as n,FormMetadata as d}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as o}from"./p-c2beb95c.js";import{T as h}from"./p-a2493d11.js";import{c as l}from"./p-4a78e118.js";import"./p-6ee5d42c.js";import"./p-435259af.js";import{P as u}from"./p-5534e08c.js";import{SelectionMode as v}from"@sankhyalabs/core/dist/dataunit/DataUnit";const c="__FORM:",g=class{constructor(s){i(this,s),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.canEdit=!0,this.presentationMode=void 0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const s=null==i?void 0:i.selectedRecord,t=null==e?void 0:e.selectedRecord;(null==s?void 0:s.__record__id__)!==(null==t?void 0:t.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}exitViewer(){this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===h.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){g.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataState.insertionMode,this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=n(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),s=this.dataUnit.getSelectedRecord(),t=!s||this.dataUnit.isNewRecord(s.__record__id__),a=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&t&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),a.push(e)})),this._guides=a,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=d.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}))}loadTaskbarProcessor(){var i,e;const s=(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular",t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const a=["PREVIOUS","NEXT","DIVIDER","ATTACH","CLONE","REMOVE","MORE_OPTIONS","ACTIONS_BUTTON","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==u.SECONDARY?a.unshift("INSERT"):a.push("INSERT");const r=this.getInvisibleButtons();this._taskbarProcessor=new o({"snkGuideViewer.regular":a,"snkGuideViewer.finish_edition":["CANCEL","SAVE"]}),this._taskbarProcessor.process(s,this.taskbarManager,this.dataState,t,r)}getInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===v.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}static updateContentCard(i,e,s,t){return t.saveCardState(i,e,s)}static buildFixedForms(i,e,a,r,n,d){const o=null==i?void 0:i.cardsState;if(null!=o)return s(t,null,Array.from(o.entries()).filter((([i,e])=>(null==e?void 0:e.fixed)&&i!=a)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([t,a])=>{var o;const h=e.getSheet(t);if(null!=h)return s("snk-form-view",{levelPath:d,label:h.label,name:t,fields:h.fields,formMetadata:e,dataUnit:r,recordsValidator:n,contracted:"CONTRACTED"===(null==a?void 0:a.presentation),fixed:null==a?void 0:a.fixed,summaryFields:null===(o=null==i?void 0:i.summary)||void 0===o?void 0:o.get(t),key:t})})))}wrapDetail(i,e){if(0===i.length)return e;const t=i.pop(),a=d.getDetailName(t);return a?this.wrapDetail(i,s("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,a)}`,entityName:a},e)):void 0}getDataUnitName(i,e){if(i.length>0){const s=i.map((i=>d.getDetailName(i)));return`${this.entityPath}/${s.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,t,a,r;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let o;const h=n.split("::"),l=h.pop(),v=d.getDetailName(l);let g=n;if(v||h.length>0){let e,t;if(n.includes(c)){[g,e]=n.split(c);const s=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;t=s>1?this._breadcrumbItems[s-2]:this.selectedGuide}else t=this.selectedGuide;o=this.wrapDetail(h,s("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,v),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:v,selectedForm:e,branchGuide:t,guideItemPath:this._breadcrumbItems,key:`detail${g}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail)}))}else{const i=this.selectedGuide.id,d=this._masterFormMetadata.getSheet(i);if(d){const h=null===(t=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===t?void 0:t.get(i);o=s("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(r=null===(a=this.masterFormConfig)||void 0===a?void 0:a.summary)||void 0===r?void 0:r.get(i),name:i,label:d.label,fields:d.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,key:n},this.presentationMode==u.SECONDARY&&this.buildTaskBar())}}return o}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}getConfigViewMode(){return l.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===l.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}componentWillLoad(){this._configManager=new r(this.configName,(i=>this.masterFormConfig=i)),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}buildTaskBar(){var i;return s("div",{class:"ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 "+(this.presentationMode!=u.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},s("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.actionsList,messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit}))}render(){var i,e;if(null!=this._formEditorConfigManager)return s("snk-form-config",{dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null});if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const t=this._guides&&this._guides.length>1;return s("section",{class:"snk-guides-viewer"},s("div",{class:"ez-row snk-guides-viewer__header"},s("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},s("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),s("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},s("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getMessage("snkCrud.title")),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&s("div",{class:"ez-margin-top--extra-small"},s("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=u.SECONDARY&&this.buildTaskBar()),s("div",{class:"snk-guides-viewer__container"},t?s("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzSelectionChange:i=>this.updateSelectedGuideHandler(i.detail)}):s("div",null),s("div",{class:"snk-guides-viewer__detail-container"},g.buildFixedForms(this.masterFormConfig,this._masterFormMetadata,null===(e=this.selectedGuide)||void 0===e?void 0:e.id,this.dataUnit,this.recordsValidator),this.getContent())),s("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail)}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};g.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{g as S}
@@ -1,11 +0,0 @@
1
- import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{WaitingChangeException as r,WarningException as n,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,ApplicationContext as d,ErrorTracking as m,DataType as w}from"@sankhyalabs/core";import{d as f,D as y,U as g}from"./p-6ee5d42c.js";import{ApplicationUtils as P}from"@sankhyalabs/ezui/dist/collection/utils";import{P as v}from"./p-435259af.js";import{G as I,C as A}from"./p-72d7f00c.js";import{D as S}from"./p-7d9302e2.js";import{A as _,a as E}from"./p-c1273e40.js";import{S as C}from"./p-ae6aff81.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9d36d914.js";import"./p-aeaa5253.js";import"./p-37b17041.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";class T{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof r||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof r||t instanceof n?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(s,e)}}))}}function D(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(D=function(){return t})()}const b=N;function N(t,s){const e=D();return(N=function(t){return e[t-=392]})(t,s)}!function(){const t=N,s=D();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const j=b(396);class k{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
2
- $queryAlias$: fetchTotals(name: $name, filters: $filters ){
3
- name
4
- value
5
- }
6
- }`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,r=this.cancel.findIndex((t=>t[i]));return r>=0&&(this.cancel[r][i](),this.cancel.splice(r,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,r)=>{y.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return r("Não foi possível recuperar os totalizadores")})).catch(r)}))}}var O;class L{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}}L.resourceID=null===(O=window.workspace)||void 0===O?void 0:O.resourceID;class U{static webConnectionCaller(t,s,e){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,s,e)}}class ${constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",f.gql`query($name: String!) {
7
- $queryAlias$: fetchResource(name: $name){
8
- name
9
- resource
10
- }
11
- }`)}async getParam(t){const s=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:s},query:this.templateByQuery.get("fetchParam")})}async asString(t){const s=await this.getParam(t);return this.getValue(s)}async asInteger(t){const s=await this.getParam(t);return parseInt(this.getValue(s))}async asFloat(t){const s=await this.getParam(t);return parseFloat(this.getValue(s))}async asBoolean(t){const s=await this.getParam(t);return"S"===this.getValue(s)}async asDate(t){const s=await this.getParam(t);return c.strToDate(this.getValue(s))}async getBatchParams(t){const s=await this.getParam(t.join(",")),e={};return s.forEach((t=>e[t.name]=t.resource)),e}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource))return"";try{const s=o.stringToObject(t.resource),[e]=Object.keys(s);return s[e]}catch(t){console.warn("Erro ao converter string JSON.")}}}const M=R;function R(t,s){const e=F();return(R=function(t){return e[t-=378]})(t,s)}function F(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(F=function(){return t})()}!function(){const t=R,s=F();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class q{[M(397)](t){const s=M;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new x("S"===t[s(402)]||!0===t[s(402)]);return Array[s(394)](t[s(391)])&&t[s(391)][s(385)]((t=>e.putAccess(t[s(382)],String(t.status)==s(398)))),e}}class x{constructor(t){const s=M;this.isSup=t,this[s(384)]={}}[M(378)](t,s){this[M(384)][t]=s}[M(393)](t){const s=M;if(this[s(402)])return!0;let e=!0;return this[s(384)][s(380)](t)&&(e=this.actions[t]),e}isUserSup(){return this.isSup}}const z=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new $),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||L.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new G(t,s)),e||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,s)=>{this.auth.then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}initOnboarding(t){return u.getInstance().init(t,window.envContext),Promise.resolve()}async hasAccess(t){return new Promise(((s,e)=>{this.auth.then((i=>{this.getAuthList(i).then((e=>{s(e.isSup||e.actions[t])})).catch((t=>e(t)))}))}))}async getAllAccess(){return new Promise(((t,s)=>{this.auth.then((e=>{this.getAuthList(e).then((s=>{const e={};e.isSup=s.isSup,Object.entries(_).forEach((t=>{e[t[0]]=s.actions[t[1]]||!1})),t(e)})).catch((t=>s(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,s="full",e=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){L.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{U.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i){return new Promise(((r,n)=>{const a=this.getDuPromissesStack(s),o=a.length>0;if(a.push(new G(r,n)),!o){const r=this.dataUnitFetcher.getDataUnit(t,this.resourceID,e,i);r.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,r);a.length>0;)a.pop().resolve(r)})).catch((t=>{for(;a.length>0;)a.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i){return new Promise(((r,n)=>{const a=this._duCache.get(s);a?r(a):this.createDataunit(t,s,e,i).then((t=>{r(t)})).catch((t=>n(t)))}))}async addClientEvent(t,s){return new Promise((e=>{y.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{y.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(y.hasClientEvent(t))}))}async callServiceBroker(t,s,e){return y.get().callServiceBroker(t,s,e)}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return P.alert(t,s,e,i)}async error(t,s,e,i){return P.error(t,s,e,i)}async success(t,s,e,i){return P.success(t,s,e,i)}async message(t,s,e,i){return P.message(t,s,e,i)}async confirm(t,s,e,i,r){return P.confirm(t,s,e,i,r)}async info(t,s){return P.info(t,s)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async getAuthList(t){return await(new q).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=g.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new S),this._dataUnitFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new I),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new k),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new v),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new E),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===l.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||w.TEXT,r=e.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(s,r,{entity:n,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,s,e){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(i,s,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return L.getAppLabel(this._resourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}getApplicationPath(){return new Promise((t=>{"dev"!==window.applicationenv&&t(`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/build`),t("")}))}executeSelectDistinct(t,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(y.get())}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new T(this),this.messagesBuilder=new C,d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${g.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),d.setContextValue("__EZUI__GRID_LICENSE__",j),m.init(),A.get()}connectedCallback(){d.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),p.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var s;if(1==(null===(s=null==t?void 0:t.requestBody)||void 0===s?void 0:s.length)){const{name:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class G{constructor(t,s){this.resolve=t,this.reject=s}}z.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{z as snk_application}
@@ -1 +0,0 @@
1
- export{S as snk_guides_viewer}from"./p-8903ffc6.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"./p-8115f7a2.js";import"./p-72d7f00c.js";import"./p-9d36d914.js";import"./p-6ee5d42c.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-aeaa5253.js";import"./p-37b17041.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-c2beb95c.js";import"./p-a2493d11.js";import"./p-5534e08c.js";import"./p-6dc031de.js";import"./p-4a78e118.js";import"./p-435259af.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";
@@ -1 +0,0 @@
1
- import{r as i,c as e,h as s,F as t,H as n}from"./p-d2d301a6.js";import{StringUtils as l,ObjectUtils as r,ApplicationContext as a,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-5c1aacc7.js";import{P as d,C as c}from"./p-72d7f00c.js";import{ApplicationUtils as p}from"@sankhyalabs/ezui/dist/collection/utils";import{a as f}from"./p-933c0c0b.js";import{s as m}from"./p-6dc031de.js";import"./p-584d7212.js";import"./p-9d36d914.js";import"./p-6ee5d42c.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-aeaa5253.js";import"./p-37b17041.js";const z=class{constructor(s){i(this,s),this.ezCancel=e(this,"ezCancel",7),this.ezSave=e(this,"ezSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let e=null==i?void 0:i.uri;if(l.isEmpty(e)&&(e=this.entityUri),!this._filterMetadataStorage.has(e)){const i=await this._personalizedFilterFetcher.loadFields(e);this._filterMetadataStorage.set(e,i)}return this._filterMetadataStorage.get(e)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:"Valor",type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:f.AND}};this._originalFilterAssistent=r.copy(i),this._filterAssistent=r.copy(i)}loadFilter(i,e){null!=i&&e!=i&&c.get().then((()=>{c.loadPersonalizedFilter(i,this.configName).then((i=>{const e=this.addLabelToItems(i);this._filterAssistent=e,this._originalFilterAssistent=r.copy(e),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent}))}))}componentWillLoad(){var i;null==m.get(`filterFieldsDataSource.${this.entityUri}`)&&m.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=a.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}saveFilter(){c.savePersonalizedFilter(this._filterAssistent,this.configName).then((i=>{this._elButtonSave.enabled=!1,p.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const e=Object.assign(Object.assign({},i),this._filterAssistent);e.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=r.copy(e),this._filterAssistent=r.copy(e)}))}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:e}=this._filterAssistent,s=i?h.buildGroupExpression(i):e;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?p.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:e=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),e.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();p.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var e;i&&(this._filterAssistent=r.copy(null!==(e=this._originalFilterAssistent)&&void 0!==e?e:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}addLabelToItems(i){return i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((e=>{if(null==e.fieldLabel){const s=(i.parameters||[]).find((i=>i.fieldName===e.fieldName));s&&(e.fieldLabel=s.label)}})),i}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const e=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(e)}buildExpression(i,e,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${e}`:`${i}.${e}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(t,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:i=>this._viewStackRef=i},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail)})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,e;if(this._filterAssistentMode)p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(e=this._originalFilterAssistent)||void 0===e?void 0:e.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,e=h.buildGroupExpression(this._filterAssistent.assistent);i!==e?p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:e}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}render(){var i,e,t,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return s(n,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.getMessage(this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd"),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(e=this._filterAssistent)||void 0===e?void 0:e.name,onEzChange:i=>this.handleTitleChange(i.detail)}),this.renderButtonAddField(),s("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};z.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";export{z as snk_personalized_filter}
@@ -1,17 +0,0 @@
1
- import{d as e,D as t}from"./p-6ee5d42c.js";import{ObjectUtils as n}from"@sankhyalabs/core";import{R as i}from"./p-aeaa5253.js";class s extends i{constructor(){super(),this.queryConfig=new Map,this.buildTemplatesConfig()}buildTemplatesConfig(){this.queryConfig.set("fetchUserAvailableConfigs",e.gql`query($name: String!) {
2
- $queryAlias$: fetchUserAvailableConfigs(name: $name){
3
- name
4
- origin
5
- key
6
- }
7
- }`),this.queryConfig.set("fetchLegacyConfig",e.gql`query($name: String!) {
8
- $queryAlias$: fetchLegacyConfig(name: $name){
9
- name
10
- resource
11
- }
12
- }`),this.queryConfig.set("fetchDefaultConfig",e.gql`query($name: String!) {
13
- $queryAlias$: fetchDefaultConfig(name: $name){
14
- name
15
- resource
16
- }
17
- }`)}loadFormConfig(e,t){return new Promise(((n,i)=>{Promise.all([this.loadResource(this.getPath(t,e)),this.loadResource(this.getPath(`FormCardState:${t}`,e,"form-card")),this.loadResource(this.getPath(t,e,"summary")),this.loadResource(this.getPath(t,e,"defaultValues"))]).then((([e,t,i,s])=>{let a;if(null!=e){a=Object.assign(Object.assign({},JSON.parse(e)),{emptyConfig:!1});const{tabs:t,fields:n}=a;if(t){const e=new Map(t.map((e=>[e.label,e])));null==n||n.forEach((t=>{var n;return t.tab=(null===(n=e.get(this.getTabName(t.tab)))||void 0===n?void 0:n.label)||e.get(this.getTabName(t.tab))}))}a.fields=null==n?void 0:n.map((e=>{if("readonly"in e){const t=!0===e.readonly;delete e.readonly,e.readOnly=t}return e}))}null!=t&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.cardsState=new Map(JSON.parse(t))),null!=i&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.summary=new Map(Object.entries(JSON.parse(i)))),null!=s&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.defaultVars=new Map(Object.entries(JSON.parse(s)))),n(a)})).catch((e=>{i(e)}))}))}getTabName(e){return"object"==typeof e?e.label:e}saveCardState(e,t,n){const i=this.getPath(`FormCardState:${n}`,t,"form-card");return new Promise(((t,n)=>{this.saveResource(Array.from(e.entries()),i).then((e=>{t(new Map(JSON.parse(e.resource)))})).catch((e=>{n(e)}))}))}saveConfig(e,t,n){delete e.cardsState,delete e.defaultVars,delete e.summary;const i=this.getPath(n,t);return new Promise(((t,n)=>{this.saveResource(e,i).then((e=>{t(JSON.parse(e.resource))})).catch((e=>{n(e)}))}))}fetchUserAvailableConfigs(e,n){const i=this.getPath(n,e);return new Promise(((e,n)=>{t.get().callGraphQL({values:{name:i},query:this.queryConfig.get("fetchUserAvailableConfigs")}).then((t=>{e(t)})).catch((e=>{n(e)}))}))}fetchLegacyConfig(e,i){const s=this.getPath(i,e);return new Promise(((e,i)=>{t.get().callGraphQL({values:{name:s},query:this.queryConfig.get("fetchLegacyConfig")}).then((t=>{e(n.stringToObject((null==t?void 0:t.resource)||""))})).catch((e=>{i(e)}))}))}fetchDefaultConfig(e,i){const s=this.getPath(i,e);return new Promise(((e,i)=>{t.get().callGraphQL({values:{name:s},query:this.queryConfig.get("fetchDefaultConfig")}).then((t=>{e(n.stringToObject((null==t?void 0:t.resource)||""))})).catch((e=>{i(e)}))}))}getPath(e,t,n="form"){return t?`cfg://${n}/${e}/${t}`:`cfg://${n}/${e}`}}var a;!function(e){e.USER="USER",e.DEFAULT="DEFAULT",e.SHARED="SHARED"}(a||(a={}));export{s as F,a as U}
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ObjectUtils as o,ApplicationContext as r,DataType as n,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as l,DialogType as d}from"@sankhyalabs/ezui/dist/collection/utils";import{D as h,a as c,b as p}from"./p-5534e08c.js";import{R as u}from"./p-4a78e118.js";import{D as m}from"./p-6ee5d42c.js";import{S as v}from"./p-564efc43.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ae6aff81.js";class x{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===h.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===h.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS];if(t===h.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===h.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===h.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===h.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===h.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportByEmail(t,e){t===h.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:h.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:h.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:h.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:h.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:h.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:h.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function f(t){var{methodName:e}=t,i=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(t,["methodName"]);const s=`mgefin-bff@DataExporterSPBean.${e}`,r={serviceName:s,requestBody:i};return new Promise(((t,e)=>{m.get().callServiceBroker(s,o.objectToString(r)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>e(t)))}))}const k=5e3,E=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._items=[],this._showDropdown=!1,this._releasedToExport=[h.EXPORT_TO_PDF,h.EXPORT_TO_XLS,h.EXPORT_BY_EMAIL,h.EXPORT_PDF_TO_EMAIL,h.EXPORT_XLS_TO_EMAIL,h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS],this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=c[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:c.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),l.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=v.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){if(null==this.provider||null==t||null==e)return;const i=this.provider.getFilters(),s=await this.provider.getColumnsMetadata(),o=this.provider.getOrders(),r=this.provider.getResourceURI(),n=this.provider.getSelectedIDs(),a=t.exportOption,d=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS];delete t.exportOption;let c=Object.assign({filters:i,columns:s,sort:o,resourceURI:r,selectedIDs:n.slice(0,k)},t);if(d.includes(a)||"page"==t.type){const t=this.provider.getOffset(),e=this.provider.getLimit();c=Object.assign(Object.assign({},c),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(c=Object.assign(Object.assign({},c),{offset:0,limit:k,selectedIDs:[]}));f(c).then((t=>e(t))).catch((t=>l.error(this.getMessage("snkDataExporter.message.exportError"),t?t.statusMessage:this.getMessage("snkDataExporter.message.exportError"))))}getOptionKey(t){return Object.keys(h).find((e=>h[e]===t))}dispatchExporter(t){var e;const i=this.getOptionKey(t),s=null!==(e=p[i])&&void 0!==e?e:p.EXPORT_TO_PDF,o=p[i]===p.EXPORT_TO_XLS;this.resolveExporter({methodName:h[`EXPORT_TO_${s}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:k},(t=>{!function({fileSessionKey:t,isDownload:e}){const i=r.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),l.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:s,isDownload:o}))}))}async processExporter(t){var e,i,s,o;const r=null==t?void 0:t.detail,n=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS],a=null===(e=null==r?void 0:r.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==r?void 0:r.id)===h.EXPORT_CURRENT_PAGE)return;const c=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),p=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),u=null===(o=this.provider)||void 0===o?void 0:o.getLimit();let m=!1;if(n.includes(null==r?void 0:r.id)&&u<=k||a?m=!1:(null==c?void 0:c.length)?m=c.length>k:p>k&&(m=!0),m){const t=k.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await l.confirm(e.title,e.description,null,d.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(a)return this.openPersonalizedReports(r.id),void(this._showDropdown=!1);this._releasedToExport.includes(null==r?void 0:r.id)&&(r.id===h.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(r.id),this._showDropdown=!1)}loadItems(){const t=[];this._releasedToExport.forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e;const i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID();if(null==i)return void(this._items=t);const s=await function(t){const e="mgefin-bff@DataExporterSPBean.getPersonalizedReports",i={serviceName:e,requestBody:t};return new Promise(((t,s)=>m.get().callServiceBroker(e,o.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:i});null==s||s.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e;const i=[],s=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(e=this.provider)||void 0===e||e.getSelectedIDs().forEach((({name:t,type:e,value:s},o)=>{const r=[];r.fields=[],0===o&&(i[`PK_${t}`]={type:this.parseDataType(e),value:s},i.pks=[]),r.fields.push({nome:t,tipo:e,valor:s}),i.pks.push(r)})),this._application.openApp(`${u}${s}`,i)}parseDataType(t){switch(t){case n.NUMBER:return"I";case n.DATE:return"D";default:return"S"}}loadDropdown(){var t,e;this._selectedNumber=(null===(e=null===(t=this.provider)||void 0===t?void 0:t.getSelectedIDs())||void 0===e?void 0:e.length)||0,this._itemBuilder=new x(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=r.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" snk-data-exporter--overlap":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};E.style=".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{E as snk_data_exporter}
@@ -1,10 +0,0 @@
1
- import{d as e,D as r}from"./p-6ee5d42c.js";class s{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",e.gql`query($name: String!) {
2
- $queryAlias$: fetchResource(name: $name){
3
- resource
4
- }
5
- }`),this.templateByQuery.set("saveResource",e.gql`mutation($resource: InputResource!) {
6
- $queryAlias$: saveResource(resource: $resource){
7
- name
8
- resource
9
- }
10
- }`)}loadResource(e){if(s._loadingResource.has(e))return s._loadingResource.get(e);const u=new Promise(((u,o)=>{r.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchResource")}).then((r=>{u(null==r?void 0:r.resource),s._loadingResource.delete(e)})).catch((r=>{o(r),s._loadingResource.delete(e)}))}));return s._loadingResource.set(e,u),u}saveResource(e,s){return new Promise(((u,o)=>{r.get().callGraphQL({values:{resource:{name:s,resource:JSON.stringify(e)}},query:this.templateByQuery.get("saveResource")}).then((e=>{u(e)})).catch((e=>{o(e)}))}))}}s._loadingResource=new Map;export{s as R}
@@ -1 +0,0 @@
1
- import{r as o,c as r,h as t}from"./p-d2d301a6.js";import{ApplicationContext as i}from"@sankhyalabs/core";import{c as a}from"./p-4a78e118.js";import{A as n}from"./p-dc36cfbf.js";const s=class{constructor(t){o(this,t),this.configSelected=r(this,"configSelected",7),this.openConfig=r(this,"openConfig",7),this.save=r(this,"save",7),this.cancel=r(this,"cancel",7),this._opened=!1,this._permissions=void 0,this.showActionButtons=!1,this.configName=void 0,this.viewMode=a.GRID,this.messagesBuilder=void 0}async open(){this._opened=!0,this.configSelected.emit(this.getViewModeValue()),this.modal.heightMode="full"}async close(){this.closeConfig()}closeConfig(){this._opened=!1}onViewModeChanged(o){this.viewMode=null==o?void 0:o.detail,this.configSelected.emit(this.viewMode)}onClickOpenConfig(){this.openConfig.emit(this.viewMode)}isAllowed(o){return!n[o]||!!this._permissions&&(this._permissions.isSup||this._permissions[o])}enableModeConfig(){return!(!this.isAllowed(n.CONFIG_GRID)||!this.isAllowed(n.CONFIG))}getViewModeValue(){return null!=this._permissions&&(this.isAllowed(n.CONFIG_GRID)?this.isAllowed(n.CONFIG)||(this.viewMode=a.GRID):this.viewMode=a.FORM),this.viewMode}getMessage(o){var r;return null===(r=this.messagesBuilder)||void 0===r?void 0:r.getMessage(o,{})}componentWillLoad(){this._application=i.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((o=>this._permissions=o)):this._permissions={}}render(){return t("ez-modal",{ref:o=>this.modal=o,opened:this._opened,"close-esc":!1,"close-outside-click":!1,"modal-size":"small",scrim:"light"},t("div",{class:"snk-configurator"},t("div",{class:"snk-configurator__header"},t("label",{class:"snk-configurator__title"},this.getMessage("snkConfigurator.titleConfigurations")),t("div",{class:"snk-configurator__button-close"},t("ez-button",{mode:"icon",iconName:"close",size:"medium",onClick:()=>this.closeConfig()}))),t("div",{class:"snk-configurator__main"},t("ez-collapsible-box",{boxBordered:!0,label:"Modo de visualização ",headerSize:"medium",class:"snk-configurator__collapsable-box"},t("ez-radio-button",{value:this.getViewModeValue().toString(),onEzChange:o=>this.onViewModeChanged(o),enabled:this.enableModeConfig()},t("ez-radio-button-option",{label:this.getMessage("snkConfigurator.labelGrid"),value:a.GRID}),t("ez-radio-button-option",{label:this.getMessage("snkConfigurator.labelForm"),value:a.FORM})),t("div",{class:"snk-configurator__collsable-box-action"},t("ez-button",{label:this.getMessage(this.viewMode===a.GRID?"snkConfigurator.labelConfigGrid":"snkConfigurator.labelConfigForm"),class:"snk-configurator__button-config ez-button--secondary",onClick:()=>this.onClickOpenConfig(),id:"openConfigurator"}))),t("div",{class:"snk-configurator__outline"},t("slot",{name:"SnkConfigContainerSlot"}))),this.showActionButtons&&t("div",{class:"snk-configurator__action-buttons"},t("ez-button",{label:"Cancelar",onClick:()=>this.cancel.emit()}),t("ez-button",{label:"Salvar",onClick:()=>this.save.emit(),class:"ez-button--primary"}))))}};s.style='.sc-snk-configurator-h{--snk-configurator__button-close--padding-left:var(--space--medium, 12px);--snk-configurator__title--color:var(--title--primary, #2B3A54);--snk-configurator__title--font-family:var(--font-pattern, "Roboto");--snk-configurator__title--font-size:var(--title--large, 20px);--snk-configurator__title--font-weight:var(--text-weight--extra-large, 700);--snk-configurator__subtitle--color:var(--title--primary, #2B3A54);--snk-configurator__subtitle--font-family:var(--font-pattern, "Roboto");--snk-configurator__subtitle--font-size:var(--text--medium, 14px);--snk-configurator__subtitle--font-weight:var(--text-weight--large, 600);--snk-configurator__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-configurator__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-configurator__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-configurator__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-configurator__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-configurator__scrollbar--width:var(--space--medium, 12px)}.snk-configurator.sc-snk-configurator{display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.snk-configurator__collsable-box-action.sc-snk-configurator{width:100%}.snk-configurator__action-buttons.sc-snk-configurator{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--space--medium)}.snk-configurator__outline.sc-snk-configurator{display:flex;flex-direction:column;gap:var(--space--small);margin-top:var(--space--small);margin-bottom:var(--space--large)}@media screen and (min-width: 480px){.snk-configurator.sc-snk-configurator{width:359px;max-width:359px}}.snk-configurator__button-config.sc-snk-configurator{--ez-button--min-width:100%}.snk-configurator__header.sc-snk-configurator{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-configurator__title.sc-snk-configurator{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-configurator__title--color);font-size:var(--snk-configurator__title--font-size);font-family:var(--snk-configurator__title--font-family);font-weight:var(--snk-configurator__title--font-weight)}.snk-configurator__subtitle.sc-snk-configurator{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-configurator__subtitle--color);font-size:var(--snk-configurator__subtitle--font-size);font-family:var(--snk-configurator__subtitle--font-family);font-weight:var(--snk-configurator__subtitle--font-weight)}.snk-configurator__button-close.sc-snk-configurator{padding-left:var(--snk-configurator__button-close--padding-left)}.snk-configurator__main.sc-snk-configurator{overflow-y:auto;scrollbar-width:thin;margin:var(--space--medium) 0;scrollbar-color:var(--snk-configurator__scrollbar--color-clicked) var(--snk-configurator__scrollbar--color-background)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar{background-color:var(--snk-configurator__scrollbar--color-background);width:var(--snk-configurator__scrollbar--width);max-width:var(--snk-configurator__scrollbar--width);min-width:var(--snk-configurator__scrollbar--width)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-track{background-color:var(--snk-configurator__scrollbar--color-background);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb{background-color:var(--snk-configurator__scrollbar--color-default);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:hover,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-configurator__scrollbar--color-hover)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:active,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-configurator__scrollbar--color-clicked)}';export{s as snk_configurator}
@@ -1 +0,0 @@
1
- import{ObjectUtils as a}from"@sankhyalabs/core";import{R as t}from"./p-aeaa5253.js";class e extends t{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((a=>{s(a)}))}))}}var s;!function(a){a.INSERT="I",a.UPDATE="A",a.REMOVE="E",a.SHOW="C",a.CONFIG="F",a.CONFIG_NUMBER="N",a.CLONE="D",a.CONFIG_GRID="G"}(s||(s={}));export{s as A,e as a}
@@ -1 +0,0 @@
1
- export{S as snk_data_unit}from"./p-564efc43.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-ae6aff81.js";
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as r,ApplicationContext as h,ElementIDUtils as n}from"@sankhyalabs/core";import{A as o}from"./p-dc36cfbf.js";import{T as l,V as d,A as k,b,a as c}from"./p-a2493d11.js";import{P as m}from"./p-5534e08c.js";import"./p-6dc031de.js";const u=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this._titleKeyByElement={[l.UPDATE]:"snkTaskbar.titleUpdate",[l.PREVIOUS]:"snkTaskbar.titlePrevious",[l.NEXT]:"snkTaskbar.titleNext",[l.REFRESH]:"snkTaskbar.titleRefresh",[l.CLONE]:"snkTaskbar.titleClone",[l.REMOVE]:"snkTaskbar.titleRemove",[l.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[l.INSERT]:"snkTaskbar.titleInsert",[l.CANCEL]:"snkTaskbar.titleCancel",[l.SAVE]:"snkTaskbar.titleSave",[l.GRID_MODE]:"snkTaskbar.titleGridMode",[l.FORM_MODE]:"snkTaskbar.titleFormMode",[l.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[l.ATTACH]:"snkTaskbar.titleAttach"},this._permissions=void 0,this.configName=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=m.PRIMARY,this.messagesBuilder=void 0}observeButtons(){this._definitions=void 0}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(d[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===k.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[o.CONFIG_GRID]||this._permissions[o.CONFIG]):!k[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case l.PREVIOUS:this.dataUnit.previousRecord();break;case l.NEXT:this.dataUnit.nextRecord();break;case l.REFRESH:this.dataUnit.loadData();break;case l.CLONE:this.dataUnit.copySelected();break;case l.REMOVE:this.dataUnit.removeSelectedRecords();break;case l.INSERT:this.dataUnit.addRecord();break;case l.CANCEL:this.dataUnit.cancelEdition();break;case l.SAVE:this.dataUnit.saveData()}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(m).includes(this.presentationMode)||(this.presentationMode=m.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";return t>1&&(i+="ez-padding-left--medium"),l[s.toString()]?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList,this.configName,this.presentationMode):c(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}getIdElemBtnNative(t){return r.toCamelCase(t)}getIdElemBtnCustom(t){return r.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons)),this.validatePresentationMode()}componentDidLoad(){n.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}render(){if(void 0===this._definitions)return;let t=0;return i(e,null,this.removeEmpty(this._definitions.map((s=>(s===l.DIVIDER?t=0:t++,l[s]?this.getElement(t,l[s]):this.customButtons.has(s)?this.getElement(t,this.customButtons.get(s)):i("slot",{name:s}))))))}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"]}}};u.style=".sc-snk-taskbar-h{display:flex}";export{u as snk_taskbar}
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as s,H as l}from"./p-d2d301a6.js";import{ObjectUtils as o,ApplicationContext as e}from"@sankhyalabs/core";const n=class{constructor(s){i(this,s),this.valueChanged=t(this,"valueChanged",7),this.saveConfig=t(this,"saveConfig",7),this._searchValue=void 0,this._ezListSource=[],this.config=void 0,this.rightListSlotBuilder=void 0,this.maxHeightList=""}async reloadList(){this.loadListSource(),this.saveConfig.emit(this.config)}observeConfig(){var i,t;null===(t=null===(i=this._searchElement)||void 0===i?void 0:i.clearValue)||void 0===t||t.call(i)}ezListChangeListener(i){var t,s;const l=o.copy(this.config);null===(t=this.getListConfigValue(l))||void 0===t||t.forEach((t=>{var s,l;t&&t.id===(null===(s=i.detail)||void 0===s?void 0:s.id)&&(t.check=null===(l=i.detail)||void 0===l?void 0:l.check)})),this.config=o.copy(l),this.saveConfig.emit(this.config),this.valueChanged.emit(null===(s=this.config)||void 0===s?void 0:s.value)}loadListSource(){var i;this._ezListSource=[],null===(i=this.getListConfigValue(this.config))||void 0===i||i.forEach((i=>{i&&this._ezListSource.push({label:`${i.id} - ${i.label}`,check:i.check,id:i.id})}))}componentDidLoad(){var i,t,s,l,o;let n=this.getListConfigValue(this.config),a=[];Array.isArray(n)?a=n:a.push(null===(t=null===(i=this.config)||void 0===i?void 0:i.value)||void 0===t?void 0:t.members),this.config.value=a,this._entityName=null===(o=null===(l=null===(s=this.config)||void 0===s?void 0:s.props)||void 0===l?void 0:l.searchContext)||void 0===o?void 0:o.entity,this._application=e.getContextValue("__SNK__APPLICATION__"),this.loadListSource()}optionLoader(i){var t,s,l,o;const{mode:e,argument:n}=i;if(void 0===this._application)return;const a=null===(l=null===(s=null===(t=this.config)||void 0===t?void 0:t.props)||void 0===s?void 0:s.searchContext)||void 0===l?void 0:l.searchOptions,v={entityDescription:null===(o=this.config)||void 0===o?void 0:o.label,entity:this._entityName,searchOptions:a};return this._application.executePreparedSearch(e,n,v)}onEzSearchChange(i){var t,s,l,o;null!=i.detail&&void 0===(null===(t=this.getListConfigValue(this.config))||void 0===t?void 0:t.find((t=>{var s;return(null==t?void 0:t.id)==(null===(s=i.detail)||void 0===s?void 0:s.value)})))&&(this.config=Object.assign(Object.assign({},this.config),{value:[...null!==(l=null===(s=this.config)||void 0===s?void 0:s.value)&&void 0!==l?l:[],{id:i.detail.value,check:!0,label:i.detail.label}]}),this.loadListSource(),this.saveConfig.emit(this.config),this.valueChanged.emit(null===(o=this.config)||void 0===o?void 0:o.value))}getMessage(i,t){var s;return null===(s=this._application)||void 0===s?void 0:s.messagesBuilder.getMessage(i,t)}getListConfigValue(i){var t,s,l,o;return null!==(o=null!==(s=null===(t=i.value)||void 0===t?void 0:t.elements)&&void 0!==s?s:null===(l=null==i?void 0:i.value)||void 0===l?void 0:l.members)&&void 0!==o?o:null==i?void 0:i.value}render(){var i,t;return s(l,null,s("ez-search",{ref:i=>this._searchElement=i,optionLoader:i=>this.optionLoader(i),value:this._searchValue,label:null===(i=this.config)||void 0===i?void 0:i.label,onEzChange:i=>this.onEzSearchChange(i),suppressEmptyOption:!0}),(null===(t=this._ezListSource)||void 0===t?void 0:t.length)>0&&s("label",{class:"label"},this.getMessage("snkEntityList.selected")),s("div",{style:this.maxHeightList?{"max-height":this.maxHeightList}:{},class:{"snk-entity-list--overflow":!!this.maxHeightList}},s("ez-list",{ref:i=>this._ezList=i,id:"snkEntityList",listMode:"check",dataSource:this._ezListSource,hoverFeedback:!0,itemSlotBuilder:this.rightListSlotBuilder,onEzCheckChange:i=>this.ezListChangeListener(i)})))}static get watchers(){return{config:["observeConfig"]}}};n.style=".sc-snk-entity-list-h{--snk-entity-list--label--font-size:var(--text--medium, 14px);--snk-entity-list--label--font-family:var(--font-pattern, Arial);--snk-entity-list--label--color:var(--title--primary, #000);--snk-entity-list--label--disabled--color:var(--text--disable, #AFB6C0)}.label.sc-snk-entity-list{flex-shrink:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--snk-entity-list--label--color);font-size:var(--snk-entity-list--label--font-size);font-family:var(--snk-entity-list--label--font-family);cursor:default;padding-left:var(--space--small);padding-bottom:var(--space--extra-small)}.snk-entity-list--overflow.sc-snk-entity-list{overflow:auto}.snk-entity-list--overflow.sc-snk-entity-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";export{n as snk_entity_list}