gina 0.1.1-alpha.16 → 0.1.1-alpha.161

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 (324) hide show
  1. package/AUTHORS +2 -1
  2. package/LICENSE +1 -1
  3. package/README-4Contributors.md +30 -0
  4. package/README.md +202 -32
  5. package/bin/cli +165 -68
  6. package/bin/cli-debug +49 -18
  7. package/bin/cmd +40 -18
  8. package/bin/gina +48 -37
  9. package/{framework/v0.1.1-alpha.16/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
  10. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/AUTHORS +0 -0
  11. package/framework/{v0.1.1-alpha.16/lib/inherits → v0.1.1-alpha.161}/LICENSE +1 -1
  12. package/framework/v0.1.1-alpha.161/VERSION +1 -0
  13. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/html/nolayout.html +0 -0
  14. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/html/static.html +0 -0
  15. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/android-chrome-192x192.png +0 -0
  16. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/android-chrome-512x512.png +0 -0
  17. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/apple-touch-icon.png +0 -0
  18. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/favicon-16x16.png +0 -0
  19. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/favicon-32x32.png +0 -0
  20. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/asset/img/favicon.ico +0 -0
  21. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.js +887 -874
  22. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.js.map +3 -3
  23. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.min.css +0 -0
  24. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.min.css.map +0 -0
  25. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/gina.min.js +739 -0
  26. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/gina.min.js.map +8 -0
  27. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.onload.min.js +0 -0
  28. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/dist/gina.onload.min.js.map +0 -0
  29. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/css/toolbar-min.css +1 -0
  30. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/css/toolbar.css +3 -0
  31. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/css/toolbar.css.map +1 -0
  32. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/js/jquery-3.1.0.min.js +4 -0
  33. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/main.js +1542 -0
  34. package/framework/v0.1.1-alpha.161/core/asset/plugin/dist/toolbar/toolbar.html +251 -0
  35. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/readme.md +6 -6
  36. package/framework/{v0.1.1-alpha.16/core/asset/js → v0.1.1-alpha.161/core/asset}/plugin/uuid.json +0 -0
  37. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/config.js +29 -14
  38. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/index.js +331 -222
  39. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/connector.js +6 -4
  40. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/connector.v2.js +47 -47
  41. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/connector.v3.js +0 -0
  42. package/framework/v0.1.1-alpha.161/core/connectors/couchbase/lib/connector.v4.js +384 -0
  43. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/n1ql.js +3 -2
  44. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/session-store.js +6 -5
  45. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  46. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
  47. package/framework/v0.1.1-alpha.161/core/connectors/couchbase/lib/session-store.v4.js +362 -0
  48. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/controller/controller.framework.js +0 -0
  49. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/controller/controller.js +691 -677
  50. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/controller/index.js +0 -0
  51. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/.travis.yml +0 -0
  52. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/LICENSE +0 -0
  53. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/README.md +0 -0
  54. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
  55. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/deps/encoding/encoding.js +0 -0
  56. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/lib/main.js +0 -0
  57. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/lib/types/multipart.js +0 -0
  58. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/lib/types/urlencoded.js +0 -0
  59. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/lib/utils.js +0 -0
  60. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/busboy/package.json +0 -0
  61. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  62. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/dev/index.js +1 -1
  63. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/dev/lib/class.js +0 -0
  64. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/dev/lib/factory.js +1 -1
  65. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/dev/lib/tools.js +0 -0
  66. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/gna.js +3 -4
  67. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/README.md +0 -0
  68. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/currency.json +0 -0
  69. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/dist/language/en.json +0 -0
  70. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/dist/language/fr.json +0 -0
  71. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/dist/region/en.json +0 -0
  72. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/dist/region/fr.json +0 -0
  73. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/index.js +2 -2
  74. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/src/make.js +0 -0
  75. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/src/resources/currency.csv +0 -0
  76. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/src/resources/region.csv +0 -0
  77. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/locales/src/resources/region.mapping.json +0 -0
  78. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/mime.types +0 -0
  79. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/model/entity.js +81 -61
  80. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/model/index.js +8 -7
  81. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/model/template/entityFactory.js +1 -1
  82. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/model/template/index.js +1 -1
  83. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/README.md +0 -0
  84. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/index.js +1 -1
  85. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/file/README.md +0 -0
  86. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/file/build.json +0 -0
  87. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/file/package.json +1 -1
  88. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/intl/README.md +0 -0
  89. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/intl/build.json +0 -0
  90. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/intl/package.json +1 -1
  91. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/intl/src/main.js +0 -0
  92. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/storage/README.md +0 -0
  93. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/storage/build.json +0 -0
  94. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/storage/package.json +1 -1
  95. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/storage/src/main.js +0 -0
  96. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/validator/README.md +0 -0
  97. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/validator/build.json +0 -0
  98. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/validator/package.json +1 -1
  99. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/validator/src/form-validator.js +0 -0
  100. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/plugins/lib/validator/src/main.js +0 -0
  101. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/router.js +92 -79
  102. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/server.express.js +0 -0
  103. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/server.isaac.js +117 -108
  104. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/server.js +44 -1
  105. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/status.codes +0 -0
  106. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/config/app.json +0 -0
  107. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/config/routing.json +0 -0
  108. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/config/settings.json +0 -0
  109. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
  110. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/config/templates.json +4 -4
  111. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
  112. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  113. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/controllers/setup.js +0 -0
  114. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle/index.js +0 -0
  115. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  116. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  117. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  118. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  119. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  120. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_public/readme.md +0 -0
  121. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  122. package/framework/v0.1.1-alpha.161/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
  123. package/framework/v0.1.1-alpha.161/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
  124. package/framework/v0.1.1-alpha.161/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
  125. package/framework/{v0.1.1-alpha.16/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.161/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
  126. package/framework/v0.1.1-alpha.161/core/template/command/gina.bat.tpl +8 -0
  127. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/command/gina.tpl +1 -1
  128. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/env.json +0 -0
  129. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/manifest.json +0 -0
  130. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/package.json +1 -1
  131. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/settings.json +0 -0
  132. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/statics.json +3 -3
  133. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/conf/templates.json +2 -2
  134. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/client/json/401.json +0 -0
  135. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/client/json/403.json +0 -0
  136. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/client/json/404.json +0 -0
  137. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/server/html/50x.html +0 -0
  138. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/server/json/500.json +0 -0
  139. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/error/server/json/503.json +0 -0
  140. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/core/template/extensions/logger/config.json +0 -0
  141. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/console.js +1 -1
  142. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/context.js +145 -5
  143. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/dateFormat.js +4 -2
  144. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/index.js +10 -5
  145. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/json/README.md +0 -0
  146. package/framework/{v0.1.1-alpha.16/helpers/plugins → v0.1.1-alpha.161/helpers/json}/package.json +1 -1
  147. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/json/src/main.js +22 -22
  148. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/path.js +143 -89
  149. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/plugins/README.md +0 -0
  150. package/framework/{v0.1.1-alpha.16/helpers/json → v0.1.1-alpha.161/helpers/plugins}/package.json +1 -1
  151. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/plugins/src/api-error.js +23 -23
  152. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/plugins/src/main.js +2 -2
  153. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/prototypes.js +35 -36
  154. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/task.js +21 -14
  155. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/helpers/text.js +1 -1
  156. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/archiver/README.md +0 -0
  157. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/archiver/build.json +0 -0
  158. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/archiver/package.json +1 -1
  159. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/archiver/src/dep/jszip.min.js +0 -0
  160. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/archiver/src/main.js +167 -167
  161. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/aliases.json +4 -1
  162. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/add.js +43 -17
  163. package/framework/v0.1.1-alpha.161/lib/cmd/bundle/arguments.json +6 -0
  164. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/copy.js +0 -0
  165. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/cp.js +0 -0
  166. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/help.js +0 -0
  167. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/help.txt +2 -2
  168. package/framework/v0.1.1-alpha.161/lib/cmd/bundle/list.js +176 -0
  169. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/remove.js +22 -22
  170. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/rename.js +0 -0
  171. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/restart.js +0 -0
  172. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/rm.js +0 -0
  173. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/start.js +257 -46
  174. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/status.js +0 -0
  175. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/bundle/stop.js +93 -74
  176. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/add.js +0 -0
  177. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/get.js +0 -0
  178. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/help.js +0 -0
  179. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/help.txt +0 -0
  180. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/link-dev.js +0 -0
  181. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/list.js +0 -0
  182. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/remove.js +0 -0
  183. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/rm.js +0 -0
  184. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/set.js +0 -0
  185. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/env/unset.js +0 -0
  186. package/framework/{v0.1.1-alpha.16/lib/cmd/scope → v0.1.1-alpha.161/lib/cmd/env}/use.js +21 -1
  187. package/framework/v0.1.1-alpha.161/lib/cmd/framework/build.js +85 -0
  188. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/dot.js +0 -0
  189. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/get.js +0 -0
  190. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/help.js +0 -0
  191. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/help.txt +0 -0
  192. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/init.js +212 -21
  193. package/framework/v0.1.1-alpha.161/lib/cmd/framework/link-node-modules.js +86 -0
  194. package/framework/v0.1.1-alpha.161/lib/cmd/framework/link.js +94 -0
  195. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/msg.json +0 -0
  196. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/open.js +15 -0
  197. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/restart.js +58 -26
  198. package/framework/v0.1.1-alpha.161/lib/cmd/framework/set.js +264 -0
  199. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/start.js +35 -12
  200. package/framework/v0.1.1-alpha.161/lib/cmd/framework/status.js +138 -0
  201. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/stop.js +44 -28
  202. package/framework/v0.1.1-alpha.161/lib/cmd/framework/tail.js +271 -0
  203. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/update.js +0 -0
  204. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/framework/version.js +12 -3
  205. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/gina-dev.1.md +0 -0
  206. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/gina-framework.1.md +0 -0
  207. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/gina.1.md +0 -0
  208. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/helper.js +74 -5
  209. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/index.js +22 -22
  210. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/msg.json +0 -0
  211. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/port/help.js +0 -0
  212. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/port/help.txt +0 -0
  213. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/port/inc/scan.js +32 -17
  214. package/framework/v0.1.1-alpha.161/lib/cmd/port/list.js +446 -0
  215. package/framework/v0.1.1-alpha.161/lib/cmd/port/reset.js +426 -0
  216. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/port/set.js +0 -0
  217. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/add.js +146 -122
  218. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/arguments.json +0 -0
  219. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/build.js +0 -0
  220. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/help.js +0 -0
  221. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/help.txt +0 -0
  222. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/import.js +0 -0
  223. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/list.js +16 -2
  224. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/move.js +0 -0
  225. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/remove.js +17 -17
  226. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/rename.js +0 -0
  227. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/restart.js +0 -0
  228. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/rm.js +0 -0
  229. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/start.js +0 -0
  230. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/status.js +0 -0
  231. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/project/stop.js +0 -0
  232. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/protocol/help.js +0 -0
  233. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/protocol/help.txt +0 -0
  234. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/protocol/list.js +0 -0
  235. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/protocol/set.js +239 -201
  236. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/help.js +0 -0
  237. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/help.txt +0 -0
  238. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/link-local.js +0 -0
  239. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/list.js +0 -0
  240. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/remove.js +0 -0
  241. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/rm.js +0 -0
  242. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/set.js +0 -0
  243. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/scope/unset.js +0 -0
  244. package/framework/{v0.1.1-alpha.16/lib/cmd/env → v0.1.1-alpha.161/lib/cmd/scope}/use.js +0 -0
  245. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cmd/view/add.js +34 -9
  246. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/collection/README.md +0 -0
  247. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/collection/build.json +0 -0
  248. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/collection/package.json +1 -1
  249. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/collection/src/main.js +0 -0
  250. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/config.js +2 -1
  251. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cron/README.md +0 -0
  252. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cron/package.json +1 -1
  253. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/cron/src/main.js +0 -0
  254. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/generator/index.js +1 -1
  255. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/index.js +1 -1
  256. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161/lib/inherits}/LICENSE +1 -1
  257. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/README.md +0 -0
  258. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  259. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/example/protected_inheritance.js +0 -0
  260. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/example/simple_inheritance.js +0 -0
  261. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  262. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/package.json +1 -1
  263. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/inherits/src/main.js +1 -1
  264. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/README.md +0 -0
  265. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/package.json +1 -1
  266. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/default/index.js +13 -2
  267. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/file/index.js +105 -14
  268. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  269. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  270. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/mq/index.js +2 -1
  271. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/mq/listener.js +16 -14
  272. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/containers/mq/speaker.js +32 -3
  273. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/helper.js +20 -1
  274. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/logger/src/main.js +5 -2
  275. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/math/index.js +7 -7
  276. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/README.md +0 -0
  277. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/example/merge.js +0 -0
  278. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/example/merge_2_literal objects.js +0 -0
  279. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/example/merge_and_preserve_first.js +0 -0
  280. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/package.json +1 -1
  281. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/merge/src/main.js +0 -0
  282. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/model.js +9 -9
  283. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/proc.js +75 -47
  284. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/routing/README.md +0 -0
  285. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/routing/build.json +0 -0
  286. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/routing/package.json +1 -1
  287. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/routing/src/main.js +258 -258
  288. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/session-store.js +6 -6
  289. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/shell.js +3 -3
  290. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/swig-filters/README.md +0 -0
  291. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/swig-filters/package.json +1 -1
  292. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/swig-filters/src/main.js +55 -52
  293. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/url/README.md +0 -0
  294. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/url/index.js +0 -0
  295. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/url/mocks.json +0 -0
  296. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/url/routing.json +0 -0
  297. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/url/test.js +0 -0
  298. package/framework/{v0.1.1-alpha.16 → v0.1.1-alpha.161}/lib/validator.js +0 -0
  299. package/framework/v0.1.1-alpha.161/package.json +14 -0
  300. package/package.json +33 -24
  301. package/resources/home/main.json +44 -1
  302. package/resources/home/settings.json +7 -0
  303. package/resources/home/user/extensions/logger/default/config.json +1 -1
  304. package/resources/package.json.template +29 -18
  305. package/script/post_install.js +410 -120
  306. package/script/post_publish.js +185 -0
  307. package/script/pre_install.js +424 -76
  308. package/script/prepare_version.js +152 -22
  309. package/utils/helper.js +230 -185
  310. package/utils/prototypes.js +9 -9
  311. package/utils/prototypes.json_clone.js +31 -31
  312. package/doc/framework/cli/doc.json +0 -9
  313. package/doc/framework/index.md +0 -60
  314. package/framework/v0.1.1-alpha.16/VERSION +0 -1
  315. package/framework/v0.1.1-alpha.16/core/asset/js/plugin/dist/gina.min.js +0 -736
  316. package/framework/v0.1.1-alpha.16/core/asset/js/plugin/dist/gina.min.js.map +0 -56
  317. package/framework/v0.1.1-alpha.16/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
  318. package/framework/v0.1.1-alpha.16/lib/cmd/bundle/arguments.json +0 -4
  319. package/framework/v0.1.1-alpha.16/lib/cmd/bundle/list.js +0 -129
  320. package/framework/v0.1.1-alpha.16/lib/cmd/framework/set.js +0 -161
  321. package/framework/v0.1.1-alpha.16/lib/cmd/framework/status.js +0 -72
  322. package/framework/v0.1.1-alpha.16/lib/cmd/framework/tail.js +0 -183
  323. package/framework/v0.1.1-alpha.16/lib/cmd/port/list.js +0 -176
  324. package/framework/v0.1.1-alpha.16/package.json +0 -14
@@ -2679,7 +2679,10 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
2679
2679
  define( 'utils/merge',[],function() { return Merge() })
2680
2680
  };
2681
2681
  function registerEvents(plugin, events) {
2682
- gina.registeredEvents[plugin] = events
2682
+ if ( typeof(gina) == 'undefined' && typeof(window.gina) != 'undefined' ) {
2683
+ gina = window.gina;
2684
+ }
2685
+ gina.registeredEvents[plugin] = events;
2683
2686
  }
2684
2687
  function mergeEventProps(evt, proxiedEvent) {
2685
2688
  for (let p in proxiedEvent) {
@@ -2692,16 +2695,16 @@ function mergeEventProps(evt, proxiedEvent) {
2692
2695
  }
2693
2696
  /**
2694
2697
  * addListener
2695
- *
2696
- * @param {object} target
2697
- * @param {object} element
2698
- * @param {string|array} name
2699
- * @param {callback} callback
2698
+ *
2699
+ * @param {object} target
2700
+ * @param {object} element
2701
+ * @param {string|array} name
2702
+ * @param {callback} callback
2700
2703
  */
2701
2704
  function addListener(target, element, name, callback) {
2702
-
2705
+
2703
2706
  var registerListener = function(target, element, name, callback) {
2704
-
2707
+
2705
2708
  if ( typeof(target.event) != 'undefined' && target.event.isTouchSupported && /^(click|mouseout|mouseover)/.test(name) && target.event[name].indexOf(element) == -1) {
2706
2709
  target.event[name][target.event[name].length] = element
2707
2710
  }
@@ -2718,10 +2721,10 @@ function addListener(target, element, name, callback) {
2718
2721
 
2719
2722
  gina.events[name] = ( typeof(element.id) != 'undefined' && typeof(element.id) != 'object' ) ? element.id : element.getAttribute('id');
2720
2723
  }
2721
-
2724
+
2722
2725
  var i = 0, len = null;
2723
- if ( Array.isArray(name) ) {
2724
- len = name.length;
2726
+ if ( Array.isArray(name) ) {
2727
+ len = name.length;
2725
2728
  for (; i < len; i++) {
2726
2729
  registerListener(target, element, name[i], callback)
2727
2730
  }
@@ -2736,14 +2739,14 @@ function addListener(target, element, name, callback) {
2736
2739
  } else {
2737
2740
  name = ( /\.$/.test(name) ) ? name + element.id : name;
2738
2741
  registerListener(target, element, name, callback);
2739
- }
2742
+ }
2740
2743
  }
2741
-
2744
+
2742
2745
  }
2743
2746
  /**
2744
2747
  * triggerEvent
2745
2748
  * @param {object} target - targeted domain
2746
- * @param {object} element - HTMLFormElement
2749
+ * @param {object} element - HTMLFormElement
2747
2750
  * @param {string} name - event ID
2748
2751
  * @param {object|array|string} args - details
2749
2752
  * @param {object} [proxiedEvent]
@@ -2783,11 +2786,11 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2783
2786
 
2784
2787
 
2785
2788
  }
2786
-
2789
+
2787
2790
  if (window.CustomEvent || document.createEvent) {
2788
-
2789
-
2790
- if (window.CustomEvent) { // new method from ie9
2791
+
2792
+
2793
+ if (window.CustomEvent) { // new method from ie9
2791
2794
  evt = new CustomEvent(name, {
2792
2795
  'detail' : args,
2793
2796
  'bubbles' : true,
@@ -2808,7 +2811,7 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2808
2811
 
2809
2812
  }
2810
2813
  if (proxiedEvent) {
2811
- // merging props
2814
+ // merging props
2812
2815
  evt = mergeEventProps(evt, proxiedEvent);
2813
2816
  }
2814
2817
 
@@ -2821,17 +2824,17 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2821
2824
  }
2822
2825
 
2823
2826
  } else if (document.createEventObject) { // non standard
2824
-
2827
+
2825
2828
  evt = document.createEventObject();
2826
2829
  evt.srcElement.id = element.id;
2827
2830
  evt.detail = args;
2828
2831
  evt.target = element;
2829
-
2830
- if (proxiedEvent) {
2831
- // merging props
2832
+
2833
+ if (proxiedEvent) {
2834
+ // merging props
2832
2835
  evt = mergeEventProps(evt, proxiedEvent);
2833
2836
  }
2834
-
2837
+
2835
2838
  element.fireEvent('on' + name, evt);
2836
2839
  }
2837
2840
 
@@ -2880,7 +2883,7 @@ function setupXhr(options) {
2880
2883
  options.method = 'GET';
2881
2884
  }
2882
2885
  options.method = options.method.toUpperCase();
2883
-
2886
+
2884
2887
  if ( options.withCredentials ) {
2885
2888
  if ('withCredentials' in xhr) {
2886
2889
  // XHR for Chrome/Firefox/Opera/Safari.
@@ -2901,7 +2904,7 @@ function setupXhr(options) {
2901
2904
 
2902
2905
  return;
2903
2906
  }
2904
-
2907
+
2905
2908
  if ( typeof(options.responseType) != 'undefined' ) {
2906
2909
  xhr.responseType = options.responseType;
2907
2910
  } else {
@@ -2933,22 +2936,22 @@ function setupXhr(options) {
2933
2936
 
2934
2937
  /**
2935
2938
  * handleXhr
2936
- *
2939
+ *
2937
2940
  * @param {object} xhr - instance
2938
- * @param {object} $el - dom objet element
2939
- * @param {object} options
2940
- */
2941
+ * @param {object} $el - dom objet element
2942
+ * @param {object} options
2943
+ */
2941
2944
  function handleXhr(xhr, $el, options, require) {
2942
-
2945
+
2943
2946
  if (!xhr)
2944
2947
  throw new Error('No `xhr` object initiated');
2945
-
2948
+
2946
2949
  //var merge = require('utils/merge');
2947
-
2950
+
2948
2951
  var blob = null
2949
2952
  , isAttachment = null // handle download
2950
2953
  , contentType = null
2951
- , result = null
2954
+ , result = null
2952
2955
  , id = null
2953
2956
  , $link = options.$link || null
2954
2957
  , $form = options.$form || null
@@ -2956,14 +2959,14 @@ function handleXhr(xhr, $el, options, require) {
2956
2959
  ;
2957
2960
  delete options.$link;
2958
2961
  delete options.$form;
2959
-
2962
+
2960
2963
  if ($form || $link) {
2961
2964
  if ($link) {
2962
2965
  // not the link element but the link elements collection : like for popins main container
2963
2966
  $link.target = document.getElementById($link.id);
2964
2967
  $target = gina.link.target;
2965
2968
  id = gina.link.id;
2966
-
2969
+
2967
2970
  // copy $el attributes to $target
2968
2971
  // for (var prop in $link) {
2969
2972
  // if ( !$target[prop] )
@@ -2972,28 +2975,28 @@ function handleXhr(xhr, $el, options, require) {
2972
2975
  } else { // forms
2973
2976
  $target = $form.target;
2974
2977
  id = $target.getAttribute('id');
2975
- }
2978
+ }
2976
2979
  } else {
2977
2980
  $target = $el;
2978
2981
  id = $target.getAttribute('id');
2979
2982
  }
2980
-
2983
+
2981
2984
  // forward callback to HTML data event attribute through `hform` status
2982
- var hLinkIsRequired = ( $link && $el.getAttribute('data-gina-link-event-on-success') || $link && $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
2985
+ var hLinkIsRequired = ( $link && $el.getAttribute('data-gina-link-event-on-success') || $link && $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
2983
2986
  // if (hLinkIsRequired && $link)
2984
2987
  // listenToXhrEvents($link, 'link');
2985
-
2988
+
2986
2989
  // forward callback to HTML data event attribute through `hform` status
2987
2990
  var hFormIsRequired = ( $form && $target.getAttribute('data-gina-form-event-on-submit-success') || $form && $target.getAttribute('data-gina-form-event-on-submit-error') ) ? true : false;
2988
2991
  // success -> data-gina-form-event-on-submit-success
2989
2992
  // error -> data-gina-form-event-on-submit-error
2990
2993
  if (hFormIsRequired && $form)
2991
2994
  listenToXhrEvents($form, 'form');
2992
-
2993
-
2995
+
2996
+
2994
2997
  // to upload, use `multipart/form-data` for `enctype`
2995
2998
  var enctype = $el.getAttribute('enctype') || options.headers['Content-Type'];
2996
-
2999
+
2997
3000
  // setting up headers - all but Content-Type ; it will be set right before .send() is called
2998
3001
  for (var hearder in options.headers) {
2999
3002
  //if ( hearder == 'Content-Type' && typeof (enctype) != 'undefined' && enctype != null && enctype != '') {
@@ -3003,45 +3006,45 @@ function handleXhr(xhr, $el, options, require) {
3003
3006
  continue;
3004
3007
 
3005
3008
  xhr.setRequestHeader(hearder, options.headers[hearder]);
3006
- }
3009
+ }
3007
3010
  xhr.withCredentials = ( typeof(options.withCredentials) != 'undefined' ) ? options.withCredentials : false;
3008
-
3009
-
3011
+
3012
+
3010
3013
  // catching errors
3011
3014
  xhr.onerror = function(event, err) {
3012
-
3015
+
3013
3016
  var error = 'Transaction error: might be due to the server CORS settings.\nPlease, check the console for more details.';
3014
3017
  var result = {
3015
3018
  'status': xhr.status || 500, //500,
3016
3019
  'error' : error
3017
- };
3018
-
3020
+ };
3021
+
3019
3022
  var resultIsObject = true;
3020
3023
  if ($form)
3021
3024
  $form.eventData.error = result;
3022
-
3025
+
3023
3026
  if ($link)
3024
3027
  $link.eventData.error = result;
3025
-
3028
+
3026
3029
  //updateToolbar(result, resultIsObject);
3027
3030
  window.ginaToolbar.update('data-xhr', result, resultIsObject);
3028
-
3031
+
3029
3032
  triggerEvent(gina, $target, 'error.' + id, result);
3030
-
3033
+
3031
3034
  if (hFormIsRequired)
3032
3035
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3033
-
3036
+
3034
3037
  if (hLinkIsRequired)
3035
3038
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3036
3039
  }
3037
-
3040
+
3038
3041
  // catching ready state cb
3039
3042
  xhr.onreadystatechange = function (event) {
3040
3043
  // In case the user is also redirecting
3041
3044
  var redirectDelay = (/Google Inc/i.test(navigator.vendor)) ? 50 : 0;
3042
-
3045
+
3043
3046
  if (xhr.readyState == 2) { // responseType interception
3044
- isAttachment = ( /^attachment\;/.test( xhr.getResponseHeader('Content-Disposition') ) ) ? true : false;
3047
+ isAttachment = ( /^attachment\;/.test( xhr.getResponseHeader('Content-Disposition') ) ) ? true : false;
3045
3048
  // force blob response type
3046
3049
  if ( !xhr.responseType && isAttachment ) {
3047
3050
  xhr.responseType = 'blob';
@@ -3050,21 +3053,21 @@ function handleXhr(xhr, $el, options, require) {
3050
3053
 
3051
3054
  if (xhr.readyState == 4) {
3052
3055
  blob = null;
3053
- contentType = xhr.getResponseHeader('Content-Type');
3054
-
3056
+ contentType = xhr.getResponseHeader('Content-Type');
3057
+
3055
3058
  // 200, 201, 201' etc ...
3056
3059
  if( /^2/.test(xhr.status) ) {
3057
3060
 
3058
- try {
3059
-
3061
+ try {
3062
+
3060
3063
  // handling blob xhr download
3061
3064
  if ( /blob/.test(xhr.responseType) || isAttachment ) {
3062
3065
  if ( typeof(contentType) == 'undefined' || contentType == null) {
3063
3066
  contentType = 'application/octet-stream';
3064
3067
  }
3065
-
3068
+
3066
3069
  blob = new Blob([this.response], { type: contentType });
3067
-
3070
+
3068
3071
  //Create a link element, hide it, direct it towards the blob, and then 'click' it programatically
3069
3072
  var a = document.createElement('a');
3070
3073
  a.style = 'display: none';
@@ -3078,82 +3081,82 @@ function handleXhr(xhr, $el, options, require) {
3078
3081
  a.click();
3079
3082
  //release the reference to the file by revoking the Object URL
3080
3083
  window.URL.revokeObjectURL(url);
3081
-
3084
+
3082
3085
  result = {
3083
3086
  status : xhr.status,
3084
3087
  statusText : xhr.statusText,
3085
3088
  responseType : blob.type,
3086
3089
  type : blob.type,
3087
- size : blob.size
3090
+ size : blob.size
3088
3091
  }
3089
-
3090
- }
3091
3092
 
3092
-
3093
+ }
3094
+
3095
+
3093
3096
  if ( !result && /\/json/.test( contentType ) ) {
3094
3097
  result = JSON.parse(xhr.responseText);
3095
-
3098
+
3096
3099
  if ( typeof(result.status) == 'undefined' )
3097
3100
  result.status = xhr.status || 200;
3098
3101
  }
3099
-
3102
+
3100
3103
  if ( !result && /\/html/.test( contentType ) ) {
3101
-
3104
+
3102
3105
  result = {
3103
3106
  contentType : contentType,
3104
3107
  content : xhr.responseText
3105
3108
  };
3106
-
3109
+
3107
3110
  if ( typeof(result.status) == 'undefined' )
3108
3111
  result.status = xhr.status;
3109
-
3112
+
3110
3113
  // if hasPopinHandler & popinIsBinded
3111
3114
  if ( typeof(gina.popin) != 'undefined' && gina.hasPopinHandler ) {
3112
-
3115
+
3113
3116
  // select popin by id
3114
3117
  var $popin = gina.popin.getActivePopin();
3115
-
3118
+
3116
3119
  if ($popin) {
3117
-
3120
+
3118
3121
  XHRData = {};
3119
3122
  // update toolbar
3120
-
3123
+
3121
3124
  try {
3122
3125
  XHRData = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-data');
3123
3126
  XHRData = JSON.parse(decodeURIComponent(XHRData.value));
3124
-
3125
- XHRView = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-view');
3127
+
3128
+ XHRView = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-view');
3126
3129
  XHRView = JSON.parse(decodeURIComponent(XHRView.value));
3127
-
3128
- // update data tab
3130
+
3131
+ // update data tab
3129
3132
  if ( gina && typeof(window.ginaToolbar) && typeof(XHRData) != 'undefined' ) {
3130
3133
  window.ginaToolbar.update('data-xhr', XHRData);
3131
3134
  }
3132
-
3133
- // update view tab
3135
+
3136
+ // update view tab
3134
3137
  if ( gina && typeof(window.ginaToolbar) && typeof(XHRView) != 'undefined' ) {
3135
3138
  window.ginaToolbar.update('view-xhr', XHRView);
3136
- }
3139
+ }
3137
3140
 
3138
3141
  } catch (err) {
3139
3142
  throw err
3140
- }
3141
-
3143
+ }
3144
+
3142
3145
  $popin.loadContent(result.content);
3143
-
3146
+
3144
3147
  result = XHRData;
3145
3148
  triggerEvent(gina, $target, 'success.' + id, result);
3146
-
3149
+
3147
3150
  return;
3148
- }
3149
-
3151
+ }
3152
+
3150
3153
  }
3151
3154
  }
3152
-
3155
+
3153
3156
  if (!result) { // normal case
3154
- result = xhr.responseText;
3157
+ result = xhr.responseText;
3155
3158
  }
3156
-
3159
+
3157
3160
  if ($form)
3158
3161
  $form.eventData.success = result;
3159
3162
 
@@ -3172,13 +3175,13 @@ function handleXhr(xhr, $el, options, require) {
3172
3175
  }
3173
3176
 
3174
3177
  triggerEvent(gina, $target, 'success.' + id, result);
3175
-
3178
+
3176
3179
  if (hFormIsRequired)
3177
3180
  triggerEvent(gina, $target, 'success.' + id + '.hform', result);
3178
-
3181
+
3179
3182
  if (hLinkIsRequired)
3180
3183
  triggerEvent(gina, $target, 'success.' + id + '.hlink', result);
3181
-
3184
+
3182
3185
  } catch (err) {
3183
3186
 
3184
3187
  result = {
@@ -3187,12 +3190,12 @@ function handleXhr(xhr, $el, options, require) {
3187
3190
  stack : err.stack
3188
3191
 
3189
3192
  };
3190
-
3193
+
3191
3194
  if ($form)
3192
3195
  $form.eventData.error = result;
3193
-
3194
3196
 
3195
- XHRData = result;
3197
+
3198
+ XHRData = result;
3196
3199
  // update toolbar
3197
3200
  if ( gina && typeof(window.ginaToolbar) == 'object' && XHRData ) {
3198
3201
  try {
@@ -3209,39 +3212,39 @@ function handleXhr(xhr, $el, options, require) {
3209
3212
  triggerEvent(gina, $target, 'error.' + id, result);
3210
3213
  if (hFormIsRequired)
3211
3214
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3212
-
3215
+
3213
3216
  if (hLinkIsRequired)
3214
3217
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3215
3218
  }
3216
-
3219
+
3217
3220
  // handle redirect
3218
- if ( typeof(result) != 'undefined' && typeof(result.location) != 'undefined' ) {
3219
- window.location.hash = ''; //removing hashtag
3220
-
3221
+ if ( typeof(result) != 'undefined' && typeof(result.location) != 'undefined' ) {
3222
+ window.location.hash = ''; //removing hashtag
3223
+
3221
3224
  // if ( window.location.host == gina.config.hostname && /^(http|https)\:\/\//.test(result.location) ) { // same origin
3222
3225
  // result.location = result.location.replace( new RegExp(gina.config.hostname), '' );
3223
3226
  // } else { // external - need to remove `X-Requested-With` from `options.headers`
3224
3227
  result.location = (!/^http/.test(result.location) && !/^\//.test(result.location) ) ? location.protocol +'//' + result.location : result.location;
3225
- //}
3226
-
3228
+ //}
3229
+
3227
3230
  return setTimeout(() => {
3228
3231
  window.location.href = result.location;
3229
- }, redirectDelay);
3232
+ }, redirectDelay);
3230
3233
  }
3231
3234
 
3232
3235
  } else if ( xhr.status != 0) {
3233
-
3236
+
3234
3237
  result = { 'status': xhr.status, 'message': '' };
3235
3238
  // handling blob xhr error
3236
3239
  if ( /blob/.test(xhr.responseType) ) {
3237
-
3240
+
3238
3241
  blob = new Blob([this.response], { type: 'text/plain' });
3239
-
3242
+
3240
3243
  var reader = new FileReader(), blobError = '';
3241
-
3244
+
3242
3245
  // This fires after the blob has been read/loaded.
3243
3246
  reader.addEventListener('loadend', (e) => {
3244
-
3247
+
3245
3248
  if ( /string/i.test(typeof(e.srcElement.result)) ) {
3246
3249
  blobError += e.srcElement.result;
3247
3250
  } else if ( typeof(e.srcElement.result) == 'object' ) {
@@ -3249,21 +3252,21 @@ function handleXhr(xhr, $el, options, require) {
3249
3252
  } else {
3250
3253
  result.message += e.srcElement.result
3251
3254
  }
3252
-
3255
+
3253
3256
  // once ready
3254
3257
  if ( /^2/.test(reader.readyState) ) {
3255
-
3258
+
3256
3259
  if ( /^(\{|\[)/.test( blobError ) ) {
3257
3260
  try {
3258
3261
  result = merge( result, JSON.parse(blobError) )
3259
3262
  } catch(err) {
3260
3263
  result = merge(result, err)
3261
- }
3264
+ }
3262
3265
  }
3263
-
3266
+
3264
3267
  if (!result.message)
3265
3268
  delete result.message;
3266
-
3269
+
3267
3270
  if ($form)
3268
3271
  $form.eventData.error = result;
3269
3272
 
@@ -3293,23 +3296,23 @@ function handleXhr(xhr, $el, options, require) {
3293
3296
  }
3294
3297
 
3295
3298
  triggerEvent(gina, $target, 'error.' + id, result);
3296
-
3299
+
3297
3300
  if (hFormIsRequired)
3298
3301
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3299
-
3302
+
3300
3303
  if (hLinkIsRequired)
3301
3304
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3302
3305
  }
3303
3306
  return;
3304
-
3305
-
3307
+
3308
+
3306
3309
  });
3307
3310
 
3308
3311
  // Start reading the blob as text.
3309
3312
  reader.readAsText(blob);
3310
-
3313
+
3311
3314
  } else { // normal case
3312
-
3315
+
3313
3316
  if ( /^(\{|\[).test( xhr.responseText ) /) {
3314
3317
 
3315
3318
  try {
@@ -3353,24 +3356,24 @@ function handleXhr(xhr, $el, options, require) {
3353
3356
  }
3354
3357
 
3355
3358
  triggerEvent(gina, $target, 'error.' + id, result);
3356
-
3359
+
3357
3360
  if (hFormIsRequired)
3358
3361
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3359
-
3362
+
3360
3363
  if (hLinkIsRequired)
3361
- triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3364
+ triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3362
3365
  }
3363
-
3366
+
3364
3367
  return;
3365
3368
 
3366
-
3369
+
3367
3370
  }
3368
3371
  }
3369
3372
  };
3370
-
3373
+
3371
3374
  // catching request progress
3372
3375
  xhr.onprogress = function(event) {
3373
-
3376
+
3374
3377
  var percentComplete = '0';
3375
3378
  if (event.lengthComputable) {
3376
3379
  percentComplete = event.loaded / event.total;
@@ -3402,17 +3405,17 @@ function handleXhr(xhr, $el, options, require) {
3402
3405
  $form.eventData.ontimeout = result;
3403
3406
 
3404
3407
  triggerEvent(gina, $target, 'error.' + id, result);
3405
-
3408
+
3406
3409
  if (hFormIsRequired)
3407
3410
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3408
-
3411
+
3409
3412
  if (hLinkIsRequired)
3410
3413
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3411
-
3414
+
3412
3415
  return;
3413
3416
  };
3414
-
3415
-
3417
+
3418
+
3416
3419
  //return xhr;
3417
3420
  }
3418
3421
 
@@ -3438,7 +3441,7 @@ function removeListener(target, element, name, callback) {
3438
3441
  } else {
3439
3442
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3440
3443
  element.removeEventListener(name, callback, false);
3441
- }
3444
+ }
3442
3445
  } else if (element.attachEvent) {
3443
3446
  //element.detachEvent('on' + name, callback);
3444
3447
  if ( Array.isArray(element) ) {
@@ -3455,7 +3458,7 @@ function removeListener(target, element, name, callback) {
3455
3458
  } else {
3456
3459
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3457
3460
  element.detachEvent('on' + name, callback);
3458
- }
3461
+ }
3459
3462
  }
3460
3463
  } else {
3461
3464
  //target.customEvent.removeListener(name, callback)
@@ -3473,7 +3476,7 @@ function removeListener(target, element, name, callback) {
3473
3476
  } else {
3474
3477
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3475
3478
  target.customEvent.removeListener(name, callback)
3476
- }
3479
+ }
3477
3480
  }
3478
3481
 
3479
3482
  if ( typeof(gina.events[name]) != 'undefined' ) {
@@ -3514,12 +3517,12 @@ function on(event, cb) {
3514
3517
  if ( this.eventData && !$target.eventData)
3515
3518
  $target.eventData = this.eventData
3516
3519
 
3517
- if ( /\.(hform|hlink)$/.test(event) ) {
3520
+ if ( /\.(hform|hlink)$/.test(event) ) {
3518
3521
  event = ( /\.hform$/.test(event) ) ? event.replace(/\.hform$/, '.' + id + '.hform') : event.replace(/\.hlink$/, '.' + id + '.hlink');
3519
3522
  } else { // normal case
3520
3523
  event += '.' + id;
3521
3524
  }
3522
-
3525
+
3523
3526
 
3524
3527
  if (!gina.events[event]) {
3525
3528
 
@@ -3542,7 +3545,7 @@ function on(event, cb) {
3542
3545
 
3543
3546
  if (cb)
3544
3547
  cb(e, data);
3545
-
3548
+
3546
3549
  //triggerEvent(gina, e.currentTarget, e.type);
3547
3550
  });
3548
3551
 
@@ -3553,10 +3556,10 @@ function on(event, cb) {
3553
3556
 
3554
3557
  return this
3555
3558
  }
3556
-
3557
- // Nothing can be added after on()
3558
-
3559
-
3559
+
3560
+ // Nothing can be added after on()
3561
+
3562
+
3560
3563
  var listenToXhrEvents = function($el, type) {
3561
3564
 
3562
3565
 
@@ -3585,16 +3588,16 @@ function on(event, cb) {
3585
3588
  define("utils/events", function(){});
3586
3589
 
3587
3590
  function PrototypesHelper(instance) {
3588
-
3591
+
3589
3592
  var isGFFCtx = ( ( typeof(module) !== 'undefined' ) && module.exports ) ? false : true;
3590
-
3593
+
3591
3594
  var local = instance || null;
3592
3595
  var envVars = null;
3593
3596
  // since for some cases we cannot use gina envVars directly
3594
- if (
3597
+ if (
3595
3598
  typeof(GINA_DIR) == 'undefined'
3596
3599
  && !isGFFCtx
3597
- && typeof(process) != 'undefined'
3600
+ && typeof(process) != 'undefined'
3598
3601
  && process.argv.length > 3
3599
3602
  ) {
3600
3603
  if ( /^\{/.test(process.argv[2]) ) {
@@ -3606,27 +3609,27 @@ function PrototypesHelper(instance) {
3606
3609
  var envVarFile = process.argv[2].split(/\-\-argv\-filename\=/)[1];
3607
3610
  envVars = JSON.parse(fs.readFileSync(envVarFile).toString()).envVars;
3608
3611
  }
3609
-
3612
+
3610
3613
  }
3611
3614
  // else if (isGFFCtx) {
3612
3615
  // envVars = window;
3613
3616
  // }
3614
-
3615
-
3617
+
3618
+
3616
3619
  // dateFormat proto
3617
3620
  if ( local && typeof(local) != 'undefined' && typeof(local.dateFormat) != 'undefined' ) {
3618
3621
  for (let method in local.dateFormat) {
3619
-
3622
+
3620
3623
  if ( typeof(Date[method]) != 'undefined' )
3621
3624
  continue;
3622
-
3625
+
3623
3626
  Object.defineProperty( Date.prototype, method, {
3624
3627
  writable: false,
3625
3628
  enumerable: false,
3626
3629
  //If loaded several times, it can lead to an exception. That's why I put this.
3627
3630
  configurable: true,
3628
- value: function() {
3629
-
3631
+ value: function() {
3632
+
3630
3633
  var newArgs = { 0: this }, i = 1;
3631
3634
  for (var a in arguments) {
3632
3635
  newArgs[i] = arguments[a];
@@ -3635,18 +3638,20 @@ function PrototypesHelper(instance) {
3635
3638
  newArgs.length = i;
3636
3639
  // don't touch this, we need the name
3637
3640
  const name = method;
3638
-
3641
+
3639
3642
  return local.dateFormat[name].apply(this, newArgs );
3640
3643
  }
3641
3644
  });
3642
-
3645
+
3643
3646
  }
3644
3647
  }
3645
3648
 
3649
+
3650
+
3646
3651
  if ( typeof(Array.clone) == 'undefined' ) {
3647
3652
  /**
3648
3653
  * clone array
3649
- *
3654
+ *
3650
3655
  * @returns {array} Return cloned array
3651
3656
  * @supress {misplacedTypeAnnotation}
3652
3657
  **/
@@ -3658,27 +3663,27 @@ function PrototypesHelper(instance) {
3658
3663
  value: function(){ return this.slice(0); }
3659
3664
  });
3660
3665
  }
3661
-
3666
+
3662
3667
  if ( typeof(JSON.clone) == 'undefined' && !isGFFCtx ) {
3663
3668
  if ( typeof(envVars) != 'undefined' ) {
3664
3669
  JSON.clone = require( envVars.GINA_DIR +'/utils/prototypes.json_clone');
3665
3670
  } else {
3666
3671
  JSON.clone = require( GINA_DIR +'/utils/prototypes.json_clone');
3667
- }
3672
+ }
3668
3673
  }
3669
-
3674
+
3670
3675
  if ( typeof(JSON.escape) == 'undefined' ) {
3671
3676
  /**
3672
3677
  * JSON.escape
3673
3678
  * Escape special characters
3674
- *
3675
- * Changes made here must be reflected in:
3679
+ *
3680
+ * Changes made here must be reflected in:
3676
3681
  * - gina/utils/prototypes.js
3677
3682
  * - gina/framework/version/helpers/prototypes.js
3678
- * - gina/framework/version/core/asset/js/plugin/src/gina/utils/polyfill.js
3679
- *
3683
+ * - gina/framework/version/core/asset/plugin/src/gina/utils/polyfill.js
3684
+ *
3680
3685
  * @param {object} jsonStr
3681
- *
3686
+ *
3682
3687
  * @returns {object} escaped JSON string
3683
3688
  **/
3684
3689
  var escape = function(jsonStr){
@@ -3688,14 +3693,14 @@ function PrototypesHelper(instance) {
3688
3693
  .replace(/\r/g, "\\r")
3689
3694
  .replace(/\t/g, "\\t")
3690
3695
  ;
3691
- } catch (err) {
3696
+ } catch (err) {
3692
3697
  throw err;
3693
3698
  }
3694
3699
  };
3695
-
3700
+
3696
3701
  JSON.escape = escape;
3697
3702
  }
3698
-
3703
+
3699
3704
 
3700
3705
  if ( typeof(Array.toString) == 'undefined' ) {
3701
3706
  Array.prototype.toString = function(){
@@ -3712,7 +3717,7 @@ function PrototypesHelper(instance) {
3712
3717
  value: function(o){ return this.indexOf(o)!=-1 }
3713
3718
  });
3714
3719
  }
3715
-
3720
+
3716
3721
  if ( typeof(Array.from) == 'undefined' ) { // if not under ES6
3717
3722
 
3718
3723
  Object.defineProperty( Array.prototype, 'from', {
@@ -3738,7 +3743,7 @@ function PrototypesHelper(instance) {
3738
3743
  }
3739
3744
  });
3740
3745
  }
3741
-
3746
+
3742
3747
  if ( typeof(Object.count) == 'undefined' ) {
3743
3748
  Object.defineProperty( Object.prototype, 'count', {
3744
3749
  writable: true,
@@ -3750,7 +3755,7 @@ function PrototypesHelper(instance) {
3750
3755
  try {
3751
3756
  var self = this;
3752
3757
  if (this instanceof String) self = JSON.parse(this);
3753
-
3758
+
3754
3759
  for (var prop in this)
3755
3760
  if (this.hasOwnProperty(prop)) ++i;
3756
3761
 
@@ -3761,10 +3766,10 @@ function PrototypesHelper(instance) {
3761
3766
 
3762
3767
  }
3763
3768
  });
3764
- }
3769
+ }
3770
+
3771
+
3765
3772
 
3766
-
3767
-
3768
3773
  if ( typeof(global) != 'undefined' && typeof(global.__stack) == 'undefined' ) {
3769
3774
  /**
3770
3775
  * __stack Get current stack
@@ -3788,8 +3793,8 @@ function PrototypesHelper(instance) {
3788
3793
  }
3789
3794
  });
3790
3795
  }
3791
-
3792
-
3796
+
3797
+
3793
3798
  }
3794
3799
 
3795
3800
  if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
@@ -3799,10 +3804,10 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
3799
3804
  // Publish as AMD module
3800
3805
  define( 'helpers/prototypes',[],function() { return PrototypesHelper })
3801
3806
  }
3802
- ;
3807
+ ;
3803
3808
  /*
3804
3809
  * This file is part of the gina package.
3805
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
3810
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
3806
3811
  *
3807
3812
  * For the full copyright and license information, please view the LICENSE
3808
3813
  * file that was distributed with this source code.
@@ -3810,9 +3815,9 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
3810
3815
  /**
3811
3816
  * Credits & thanks to Steven Levithan :)
3812
3817
  * http://blog.stevenlevithan.com/archives/date-time-format
3813
- *
3814
- *
3815
- *
3818
+ *
3819
+ *
3820
+ *
3816
3821
  * Original Copyrights
3817
3822
  * Date Format 1.2.3
3818
3823
  * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
@@ -3830,15 +3835,15 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
3830
3835
  * @param {string} mask
3831
3836
  */
3832
3837
  function DateFormatHelper() {
3833
-
3838
+
3834
3839
  var isGFFCtx = ( ( typeof(module) !== 'undefined' ) && module.exports ) ? false : true;
3835
3840
  var merge = (isGFFCtx) ? require('utils/merge') : require('./../lib/merge');
3836
-
3837
-
3841
+
3842
+
3838
3843
  // if ( typeof(define) === 'function' && define.amd ) {
3839
3844
  // var Date = this.Date;
3840
3845
  // }
3841
-
3846
+
3842
3847
  var self = {};
3843
3848
  // language-country
3844
3849
  self.culture = 'en-US'; // by default
@@ -3854,7 +3859,7 @@ function DateFormatHelper() {
3854
3859
  fullDate: "dddd, mmmm d, yyyy",
3855
3860
  // common
3856
3861
  cookieDate: "GMT:ddd, dd mmm yyyy HH:MM:ss",
3857
- logger: "[yyyy mmm dd HH:MM:ss]",
3862
+ logger: "yyyy mmm dd HH:MM:ss",
3858
3863
  shortTime: "h:MM TT",
3859
3864
  shortTime2: "h:MM",
3860
3865
  mediumTime: "h:MM:ss TT",
@@ -3867,9 +3872,10 @@ function DateFormatHelper() {
3867
3872
  shortIsoTime: "HH:MM",
3868
3873
  longIsoTime: "HH:MM:ss TT",
3869
3874
  isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
3875
+ longIsoDateTime: "yyyy-mm-dd'T'HH:MM:ss.L",
3870
3876
  isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
3871
3877
  };
3872
-
3878
+
3873
3879
  self.i18n = {
3874
3880
  'en': {
3875
3881
  dayNames: [
@@ -3908,10 +3914,10 @@ function DateFormatHelper() {
3908
3914
  }
3909
3915
  }
3910
3916
  };
3911
-
3917
+
3912
3918
  /**
3913
- *
3914
- * @param {string} culture (5 chars) | lang (2 chars)
3919
+ *
3920
+ * @param {string} culture (5 chars) | lang (2 chars)
3915
3921
  */
3916
3922
  var setCulture = function(date, culture) {
3917
3923
  if (/\-/.test(culture) ) {
@@ -3919,24 +3925,24 @@ function DateFormatHelper() {
3919
3925
  self.lang = culture.split(/\-/)[0];
3920
3926
  } else {
3921
3927
  self.lang = culture
3922
- }
3923
-
3928
+ }
3929
+
3924
3930
  return this
3925
3931
  }
3926
3932
 
3927
3933
  var format = function(date, mask, utc) {
3928
-
3934
+
3929
3935
  // if ( typeof(merge) == 'undefined' || !merge ) {
3930
3936
  // merge = (isGFFCtx) ? require('utils/merge') : require('./../lib/merge');
3931
-
3937
+
3932
3938
  // }
3933
-
3939
+
3934
3940
  var dF = self
3935
3941
  , i18n = dF.i18n[dF.lang] || dF.i18n['en']
3936
3942
  //, masksList = merge(i18n.masks, dF.masks)
3937
3943
  , masksList = null
3938
3944
  ;
3939
-
3945
+
3940
3946
  try {
3941
3947
  masksList = merge(i18n.masks, dF.masks);
3942
3948
  } catch( mergeErr) {
@@ -3945,7 +3951,7 @@ function DateFormatHelper() {
3945
3951
  merge = (isGFFCtx) ? require('utils/merge') : require('./../lib/merge');
3946
3952
  masksList = merge(i18n.masks, dF.masks);
3947
3953
  }
3948
-
3954
+
3949
3955
  if ( typeof(dF.i18n[dF.culture]) != 'undefined' ) {
3950
3956
  i18n = dF.i18n[dF.culture];
3951
3957
  if ( typeof(dF.i18n[dF.culture].mask) != 'undefined' ) {
@@ -4011,7 +4017,8 @@ function DateFormatHelper() {
4011
4017
  s: s,
4012
4018
  ss: pad(s),
4013
4019
  l: pad(L, 3),
4014
- L: pad(L > 99 ? Math.round(L / 10) : L),
4020
+ // L: pad(L > 99 ? Math.round(L / 10) : L),
4021
+ L: pad(L),
4015
4022
  t: H < 12 ? "a" : "p",
4016
4023
  tt: H < 12 ? "am" : "pm",
4017
4024
  T: H < 12 ? "A" : "P",
@@ -4126,25 +4133,25 @@ function DateFormatHelper() {
4126
4133
  }
4127
4134
  return days;
4128
4135
  }
4129
-
4130
-
4136
+
4137
+
4131
4138
  /**
4132
4139
  * getQuarter
4133
4140
  * Get quarter number
4134
4141
  * To test : https://planetcalc.com/1252/
4135
4142
  * Based on fiscal year- See.: https://en.wikipedia.org/wiki/Fiscal_year
4136
- *
4143
+ *
4137
4144
  * TODO - Complete fiscalCodes
4138
- *
4145
+ *
4139
4146
  * @param {object} [date] if not defined, will take today's value
4140
4147
  * @param {string} [code] - us|eu
4141
- *
4148
+ *
4142
4149
  * @returns {number} quarterNumber - 1 to 4
4143
4150
  */
4144
4151
  var fiscalCodes = ['us', 'eu', 'corporate'];
4145
4152
  var getQuarter = function(date, code) {
4146
4153
  if (
4147
- arguments.length == 1
4154
+ arguments.length == 1
4148
4155
  && typeof(arguments[0]) == 'string'
4149
4156
  ) {
4150
4157
  if ( fiscalCodes.indexOf(arguments[0].toLowerCase()) < 0 ) {
@@ -4159,14 +4166,14 @@ function DateFormatHelper() {
4159
4166
  if ( typeof(code) == 'undefined') {
4160
4167
  code = 'corporate';
4161
4168
  }
4162
-
4169
+
4163
4170
  code = code.toLowerCase();
4164
4171
  var q = [1,2,3,4]; // EU & corporates by default
4165
4172
  switch (code) {
4166
4173
  case 'us':
4167
4174
  q = [4,1,2,3];
4168
4175
  break;
4169
-
4176
+
4170
4177
  case 'corportate':
4171
4178
  case 'eu':
4172
4179
  q = [1,2,3,4]
@@ -4176,23 +4183,23 @@ function DateFormatHelper() {
4176
4183
  q = [1,2,3,4];
4177
4184
  break;
4178
4185
  }
4179
-
4186
+
4180
4187
  return q[Math.floor(date.getMonth() / 3)];
4181
4188
  }
4182
-
4189
+
4183
4190
  /**
4184
4191
  * getHalfYear
4185
- *
4192
+ *
4186
4193
  * Based on fiscal year- See.: https://en.wikipedia.org/wiki/Fiscal_year
4187
- *
4188
- * @param {object} date
4194
+ *
4195
+ * @param {object} date
4189
4196
  * @param {string} code
4190
- *
4197
+ *
4191
4198
  * @returns halfYear number - 1 to 2
4192
4199
  */
4193
4200
  var getHalfYear = function(date, code) {
4194
4201
  if (
4195
- arguments.length == 1
4202
+ arguments.length == 1
4196
4203
  && typeof(arguments[0]) == 'string'
4197
4204
  ) {
4198
4205
  if ( fiscalCodes.indexOf(arguments[0].toLowerCase()) < 0 ) {
@@ -4207,40 +4214,40 @@ function DateFormatHelper() {
4207
4214
  if ( typeof(code) == 'undefined') {
4208
4215
  code = 'corporate';
4209
4216
  }
4210
-
4217
+
4211
4218
  code = code.toLowerCase();
4212
-
4219
+
4213
4220
  return (date.getQuarter(code) <=2 ) ? 1 : 2;
4214
4221
  }
4215
-
4222
+
4216
4223
  /**
4217
4224
  * getWeekISO8601
4218
4225
  * Get week number
4219
4226
  * ISO 8601
4220
4227
  * To test : https://planetcalc.com/1252/
4221
- *
4228
+ *
4222
4229
  * @param {object} [date] if not defined, will take today's value
4223
- *
4230
+ *
4224
4231
  * @returns {number} weekNumber
4225
4232
  */
4226
4233
  var getWeekISO8601 = function(date) {
4227
4234
  // Copy date so don't modify original
4228
- d = new Date(date.getFullYear(), date.getMonth(), date.getDate());
4235
+ d = new Date(date.getFullYear(), date.getMonth(), date.getDate());
4229
4236
  // Make Sunday's day number 7
4230
4237
  var dayNum = d.getDay() || 7;
4231
4238
  d.setDate(d.getDate() + 4 - dayNum);
4232
4239
  var yearStart = new Date(Date.parse(d.getFullYear(),0,1));
4233
-
4240
+
4234
4241
  return Math.ceil((((d - yearStart) / 86400000) + 1)/7)
4235
4242
  }
4236
-
4243
+
4237
4244
  /**
4238
4245
  * getWeek
4239
4246
  * Get week number
4240
4247
  * To test : https://planetcalc.com/1252/
4241
- *
4248
+ *
4242
4249
  * @param {object} [date] if not defined, will take today's value
4243
- *
4250
+ *
4244
4251
  * @returns {number} weekNumber - 1 to 53
4245
4252
  */
4246
4253
  var getWeek = function(date, standardMethod) {
@@ -4250,14 +4257,14 @@ function DateFormatHelper() {
4250
4257
  if ( typeof(standardMethod) == 'undefined') {
4251
4258
  standardMethod = 'ISO 8601';
4252
4259
  }
4253
-
4260
+
4254
4261
  standardMethod = standardMethod.replace(/\s+/g, '').toLowerCase();
4255
4262
  switch (standardMethod) {
4256
4263
  case 'corporate':
4257
4264
  case 'eu':
4258
4265
  case 'iso8601':
4259
4266
  return getWeekISO8601(date)
4260
-
4267
+
4261
4268
  default:
4262
4269
  return getWeekISO8601(date)
4263
4270
  }
@@ -4316,7 +4323,7 @@ function DateFormatHelper() {
4316
4323
  addDays : addDays,
4317
4324
  addYears : addYears
4318
4325
  };
4319
-
4326
+
4320
4327
  return _proto
4321
4328
 
4322
4329
  };
@@ -7556,7 +7563,7 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
7556
7563
  };
7557
7564
  /*
7558
7565
  * This file is part of the gina package.
7559
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
7566
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
7560
7567
  *
7561
7568
  * For the full copyright and license information, please view the LICENSE
7562
7569
  * file that was distributed with this source code.
@@ -7577,10 +7584,10 @@ function Routing() {
7577
7584
  allowedMethods: ['get', 'post', 'put', 'delete'],
7578
7585
  reservedParams: ['controle', 'file','title', 'namespace', 'path'],
7579
7586
  notFound: {}
7580
- };
7581
-
7587
+ };
7588
+
7582
7589
  self.allowedMethodsString = self.allowedMethods.join(',');
7583
-
7590
+
7584
7591
  // loading utils & plugins
7585
7592
  var plugins = null, inherits = null, merge = null, Validator = null, fs = null, promisify = null;
7586
7593
  if (!isGFFCtx) {
@@ -7590,8 +7597,8 @@ function Routing() {
7590
7597
  merge = require('../../merge');
7591
7598
  plugins = require(__dirname+'/../../../core/plugins') || getContext('gina').plugins;
7592
7599
  Validator = plugins.Validator;
7593
-
7594
- }
7600
+
7601
+ }
7595
7602
  // BO - In case of partial rendering whithout handler defined for the partial
7596
7603
  else {
7597
7604
  if ( !merge || typeof(merge) != 'function' ) {
@@ -7600,16 +7607,16 @@ function Routing() {
7600
7607
  if ( !Validator || typeof(Validator) != 'function' ) {
7601
7608
  var Validator = require('utils/form-validator');
7602
7609
  }
7603
- }
7610
+ }
7604
7611
  // EO - In case of partial rendering whithout handler defined for the partial
7605
-
7612
+
7606
7613
  /**
7607
7614
  * Get url props
7608
7615
  * Used to retrieve additional properties for routes with redirect flag for example
7609
- *
7616
+ *
7610
7617
  * @param {string} [bundle]
7611
- * @param {string} [env]
7612
- *
7618
+ * @param {string} [env]
7619
+ *
7613
7620
  * @returns {object} urlProps - { .host, .hostname, .webroot }
7614
7621
  */
7615
7622
  self.getUrlProps = function(bundle, env) {
@@ -7625,7 +7632,7 @@ function Routing() {
7625
7632
  urlProps.hostname = _route.hostname;
7626
7633
  urlProps.host = _route.host;
7627
7634
  urlProps.webroot = _route.webroot;
7628
- }
7635
+ }
7629
7636
  } else {
7630
7637
  config = getContext('gina').config;
7631
7638
  if ( typeof(getContext('argvFilename')) != 'undefined' ) {
@@ -7637,47 +7644,47 @@ function Routing() {
7637
7644
  if ( typeof(env) == 'undefined' ) {
7638
7645
  env = config.env;
7639
7646
  }
7640
-
7647
+
7641
7648
  urlProps.hostname = config.envConf[bundle][env].hostname;
7642
7649
  urlProps.host = config.envConf[bundle][env].host;
7643
7650
  urlProps.webroot = config.envConf[bundle][env].server.webroot;
7644
7651
  }
7645
-
7652
+
7646
7653
  return urlProps;
7647
7654
  }
7648
-
7655
+
7649
7656
  /**
7650
7657
  * Load bundle routing configuration
7651
- *
7658
+ *
7652
7659
  * @param {object} options
7653
7660
  * {
7654
7661
  * isStadalone: false,
7655
7662
  * bundle: 'default', // bundle's name
7656
7663
  * wroot: '/', // by default
7657
- *
7664
+ *
7658
7665
  * }
7659
- *
7666
+ *
7660
7667
  */
7661
7668
  // self.loadBundleRoutingConfiguration = function(options, filename) {
7662
-
7669
+
7663
7670
  // }
7664
-
7671
+
7665
7672
  /**
7666
7673
  * Get routing
7667
- *
7674
+ *
7668
7675
  * @param {string} [bundle]
7669
7676
  */
7670
7677
  // self.getRouting = function(bundle) {
7671
-
7678
+
7672
7679
  // }
7673
-
7680
+
7674
7681
  /**
7675
7682
  * Get reversed routing
7676
- *
7683
+ *
7677
7684
  * @param {string} [bundle]
7678
7685
  */
7679
7686
  // self.getReverseRouting = function(bundle) {
7680
-
7687
+
7681
7688
  // }
7682
7689
 
7683
7690
  /**
@@ -7692,7 +7699,7 @@ function Routing() {
7692
7699
  * @returns {object|false} foundRoute
7693
7700
  * */
7694
7701
  self.compareUrls = async function(params, url, request, response, next) {
7695
-
7702
+
7696
7703
  if ( typeof(request) == 'undefined' ) {
7697
7704
  request = { routing: {} };
7698
7705
  }
@@ -7746,12 +7753,12 @@ function Routing() {
7746
7753
  *
7747
7754
  * */
7748
7755
  var parseRouting = async function(params, url, request, response, next) {
7749
-
7756
+
7750
7757
  // Sample debug break for specific rule
7751
7758
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7752
7759
  // console.debug('passed '+ params.rule);
7753
7760
  // }
7754
-
7761
+
7755
7762
  var uRe = params.url.split(/\//)
7756
7763
  , uRo = url.split(/\//)
7757
7764
  , uReCount = 0
@@ -7762,30 +7769,30 @@ function Routing() {
7762
7769
  , i = 0
7763
7770
  , method = request.method.toLowerCase()
7764
7771
  ;
7765
-
7772
+
7766
7773
  // TODO - remove comments
7767
7774
  // when requirement is not listed but still validated
7768
- // if (
7769
- // typeof(params.requirements) != 'undefined'
7775
+ // if (
7776
+ // typeof(params.requirements) != 'undefined'
7770
7777
  // && method == params.method.toLowerCase()
7771
7778
  // //&& /validator\:\:/.test(JSON.stringify(params.requirements))
7772
7779
  // ) {
7773
-
7780
+
7774
7781
  // var requiremements = Object.getOwnPropertyNames(params.requirements);
7775
7782
  // var r = 0;
7776
7783
  // // In order to filter variables
7777
7784
  // var uRoVars = uRo.join(',').match(/\:[-_a-z0-9]+/g);
7778
7785
  // // var uRoVarCount = (uRoVars) ? uRoVars.length : 0;
7779
7786
  // while ( r < requiremements.length ) {
7780
-
7787
+
7781
7788
  // // if not listed, but still needing validation
7782
- // if (
7783
- // typeof(params.param[ requiremements[r] ]) == 'undefined'
7789
+ // if (
7790
+ // typeof(params.param[ requiremements[r] ]) == 'undefined'
7784
7791
  // && /^validator\:\:/i.test(params.requirements[ requiremements[r] ])
7785
7792
  // && typeof(request[method][ requiremements[r] ])
7786
7793
  // ) {
7787
7794
  // if (uRo.length != uRe.length) {
7788
- // // r++;
7795
+ // // r++;
7789
7796
  // // continue;
7790
7797
  // break;
7791
7798
  // }
@@ -7795,22 +7802,22 @@ function Routing() {
7795
7802
  // * "requirements" : {
7796
7803
  // * "email": "validator::{ isEmail: true, isString: [7] }"
7797
7804
  // * }
7798
- // *
7805
+ // *
7799
7806
  // * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
7800
- // */
7807
+ // */
7801
7808
  // let regex = params.requirements[ requiremements[r] ];
7802
7809
  // let _data = {}, _ruleObj = {}, _rule = {};
7803
-
7810
+
7804
7811
  // try {
7805
7812
  // _ruleObj = JSON.parse(
7806
7813
  // regex.split(/::/).splice(1)[0]
7807
7814
  // .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
7808
7815
  // .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
7809
- // );
7816
+ // );
7810
7817
  // } catch (err) {
7811
7818
  // throw err;
7812
7819
  // }
7813
-
7820
+
7814
7821
  // let key = requiremements[r];
7815
7822
  // // validator.query case
7816
7823
  // if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
@@ -7824,7 +7831,7 @@ function Routing() {
7824
7831
  // for (let p = 0, pLen = uRo.length; p < pLen; p++) {
7825
7832
  // // :variable only
7826
7833
  // if (!/^\:/.test(uRo[p])) continue;
7827
-
7834
+
7828
7835
  // let pName = uRo[p].replace(/^\:/, '');
7829
7836
  // if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
7830
7837
  // _data[ pName ] = uRe[p];
@@ -7834,24 +7841,24 @@ function Routing() {
7834
7841
  // request.params[pName] = uRe[p];
7835
7842
  // }
7836
7843
  // }
7837
- // }
7844
+ // }
7838
7845
  // }
7839
7846
  // // normal case
7840
7847
  // _data = merge(_data, request[method]);
7841
-
7848
+
7842
7849
  // if ( typeof(_data[key]) == 'undefined' ) {
7843
7850
  // // init default value for unlisted variable/param
7844
7851
  // _data[key] = null;
7845
7852
  // }
7846
-
7847
- // _rule[key] = _ruleObj;
7853
+
7854
+ // _rule[key] = _ruleObj;
7848
7855
  // _validator = new Validator('routing', _data, null, _rule );
7849
-
7856
+
7850
7857
  // if (_ruleObj.count() == 0 ) {
7851
7858
  // console.error('Route validation failed '+ params.rule);
7852
7859
  // return false;
7853
7860
  // }
7854
-
7861
+
7855
7862
  // for (let rule in _ruleObj) {
7856
7863
  // let _result = null;
7857
7864
  // if (Array.isArray(_ruleObj[rule])) { // has args
@@ -7869,12 +7876,12 @@ function Routing() {
7869
7876
  // r++
7870
7877
  // }
7871
7878
  // }
7872
-
7879
+
7873
7880
  // attaching routing description for this request
7874
7881
  var paramMethod = params.method.toLowerCase();
7875
-
7882
+
7876
7883
  var hasAlreadyBeenScored = false;
7877
- if (
7884
+ if (
7878
7885
  typeof(params.requirements) != 'undefined'
7879
7886
  && /get|delete/i.test(method)
7880
7887
  && typeof(request[method]) != 'undefined'
@@ -7883,20 +7890,20 @@ function Routing() {
7883
7890
  typeof(params.requirements) != 'undefined'
7884
7891
  && /get/i.test(method)
7885
7892
  && /delete/i.test(paramMethod)
7886
- ) {
7893
+ ) {
7887
7894
  if ( /get/i.test(method) && /delete/i.test(paramMethod) ) {
7888
7895
  method = paramMethod;
7889
7896
  }
7890
7897
  // `delete` methods don't have a body
7891
7898
  // So, request.delete is {} by default
7892
- if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
7899
+ if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
7893
7900
  // just in case
7894
7901
  if ( typeof(request[method]) == 'undefined' ) {
7895
7902
  request[method] = {};
7896
7903
  }
7897
7904
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
7898
- if (uRe[p] === uRo[p]) {
7899
- ++score;
7905
+ if (uRe[p] === uRo[p]) {
7906
+ ++score;
7900
7907
  continue;
7901
7908
  }
7902
7909
  let _key = uRo[p].substr(1);
@@ -7911,44 +7918,44 @@ function Routing() {
7911
7918
  continue;
7912
7919
  }
7913
7920
  if (
7914
- /^:/.test(uRo[p])
7921
+ /^:/.test(uRo[p])
7915
7922
  && typeof(condition) != 'undefined'
7916
7923
  && new RegExp(condition).test(uRe[p])
7917
7924
  ) {
7918
- ++score;
7919
- request[method][uRo[p].substr(1)] = uRe[p];
7925
+ ++score;
7926
+ request[method][uRo[p].substr(1)] = uRe[p];
7920
7927
  }
7921
7928
  }
7922
- hasAlreadyBeenScored = true;
7923
- }
7924
-
7929
+ hasAlreadyBeenScored = true;
7930
+ }
7931
+
7925
7932
  // Sample debug break for specific rule
7926
7933
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7927
7934
  // console.debug('passed '+ params.rule);
7928
7935
  // }
7929
7936
  for (let p in request[method]) {
7930
7937
  if ( typeof(params.requirements[p]) != 'undefined' && uRo.indexOf(':' + p) < 0 ) {
7931
- uRo[uRoCount] = ':' + p;
7938
+ uRo[uRoCount] = ':' + p;
7932
7939
  ++uRoCount;
7933
-
7940
+
7934
7941
  uRe[uReCount] = request[method][p];
7935
7942
  ++uReCount;
7936
7943
  if (!hasAlreadyBeenScored && uRe.length === uRo.length)
7937
- ++maxLen;
7944
+ ++maxLen;
7938
7945
  }
7939
7946
  }
7940
7947
  }
7941
-
7942
-
7948
+
7949
+
7943
7950
  // Sample debug break for specific rule
7944
7951
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7945
7952
  // console.debug('passed '+ params.rule);
7946
7953
  // }
7947
-
7954
+
7948
7955
  if (!hasAlreadyBeenScored && uRe.length === uRo.length) {
7949
-
7956
+
7950
7957
  for (; i < maxLen; ++i) {
7951
-
7958
+
7952
7959
  if (uRe[i] === uRo[i]) {
7953
7960
  ++score;
7954
7961
  }
@@ -7957,15 +7964,15 @@ function Routing() {
7957
7964
  }
7958
7965
  }
7959
7966
  }
7960
-
7967
+
7961
7968
  // This test is done to catch `validator::` rules under requirements
7962
- if (
7963
- typeof(params.requirements) != 'undefined'
7969
+ if (
7970
+ typeof(params.requirements) != 'undefined'
7964
7971
  && method == params.method.toLowerCase()
7965
7972
  && !hasAlreadyBeenScored
7966
7973
  && score >= maxLen
7967
7974
  ) {
7968
-
7975
+
7969
7976
  var requiremements = Object.getOwnPropertyNames(params.requirements);
7970
7977
  var r = 0;
7971
7978
  // In order to filter variables
@@ -7975,12 +7982,12 @@ function Routing() {
7975
7982
  // requirement name as `key`
7976
7983
  let key = requiremements[r];
7977
7984
  // if not listed, but still needing validation
7978
- if (
7979
- typeof(params.param[ key ]) == 'undefined'
7985
+ if (
7986
+ typeof(params.param[ key ]) == 'undefined'
7980
7987
  && /^validator\:\:/i.test(params.requirements[ key ])
7981
7988
  ) {
7982
7989
  if (uRo.length != uRe.length) {
7983
- // r++;
7990
+ // r++;
7984
7991
  // continue;
7985
7992
  break;
7986
7993
  }
@@ -7990,22 +7997,22 @@ function Routing() {
7990
7997
  * "requirements" : {
7991
7998
  * "email": "validator::{ isEmail: true, isString: [7] }"
7992
7999
  * }
7993
- *
8000
+ *
7994
8001
  * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
7995
- */
8002
+ */
7996
8003
  let regex = params.requirements[ key ];
7997
8004
  let _data = {}, _ruleObj = {}, _rule = {};
7998
-
8005
+
7999
8006
  try {
8000
8007
  _ruleObj = JSON.parse(
8001
8008
  regex.split(/::/).splice(1)[0]
8002
8009
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
8003
8010
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
8004
- );
8011
+ );
8005
8012
  } catch (err) {
8006
8013
  throw err;
8007
8014
  }
8008
-
8015
+
8009
8016
  // validator.query case
8010
8017
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
8011
8018
  _data = _ruleObj.query.data;
@@ -8018,7 +8025,7 @@ function Routing() {
8018
8025
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
8019
8026
  // :variable only
8020
8027
  if (!/^\:/.test(uRo[p])) continue;
8021
-
8028
+
8022
8029
  let pName = uRo[p].replace(/^\:/, '');
8023
8030
  if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
8024
8031
  _data[ pName ] = uRe[p];
@@ -8028,9 +8035,9 @@ function Routing() {
8028
8035
  request.params[pName] = uRe[p];
8029
8036
  }
8030
8037
  }
8031
- }
8038
+ }
8032
8039
  }
8033
-
8040
+
8034
8041
  // If validator.query has data, _data should inherit from request data
8035
8042
  _data = merge(_data, JSON.clone(request[method]) || {} );
8036
8043
  // This test is to initialize query.data[key] to null by default
@@ -8038,20 +8045,20 @@ function Routing() {
8038
8045
  // init default value for unlisted variable/param
8039
8046
  _data[key] = null;
8040
8047
  }
8041
-
8042
- _rule[key] = _ruleObj;
8048
+
8049
+ _rule[key] = _ruleObj;
8043
8050
  if (!isGFFCtx) {
8044
8051
  _validator = new Validator('routing', _data, null, _rule );
8045
8052
  } else {
8046
8053
  _validator = new Validator(_data);
8047
8054
  }
8048
-
8055
+
8049
8056
  if (_ruleObj.count() == 0 ) {
8050
8057
  console.error('Route validation failed '+ params.rule);
8051
8058
  --score;
8052
8059
  r++;
8053
8060
  continue;
8054
- }
8061
+ }
8055
8062
  // for each validation rule
8056
8063
  for (let rule in _ruleObj) {
8057
8064
  // updating query.data
@@ -8063,8 +8070,8 @@ function Routing() {
8063
8070
  _result = await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
8064
8071
  } else {
8065
8072
  _result = await _validator[key][rule](_ruleObj[rule], request, response, next);
8066
- }
8067
-
8073
+ }
8074
+
8068
8075
  //let condition = _ruleObj[rule].validIf.replace(new RegExp('\\$isValid'), _result.isValid);
8069
8076
  // if ( eval(condition)) {
8070
8077
  if ( !_result.isValid ) {
@@ -8080,7 +8087,7 @@ function Routing() {
8080
8087
  }
8081
8088
 
8082
8089
  foundRoute.past = (score === maxLen) ? true : false;
8083
-
8090
+
8084
8091
  if (foundRoute.past) {
8085
8092
  // attaching routing description for this request
8086
8093
  //request.routing = params; // can be retried in controller with: req.routing
@@ -8088,7 +8095,7 @@ function Routing() {
8088
8095
  request.routing = checkRouteParams(params, request[method]);
8089
8096
  foundRoute.request = request;
8090
8097
  }
8091
-
8098
+
8092
8099
 
8093
8100
  return foundRoute;
8094
8101
  };
@@ -8119,7 +8126,7 @@ function Routing() {
8119
8126
  , flags = null
8120
8127
  , key = null
8121
8128
  , tested = false
8122
-
8129
+
8123
8130
  , _validator = null
8124
8131
  , _data = null
8125
8132
  , _ruleObj = null
@@ -8129,57 +8136,57 @@ function Routing() {
8129
8136
  // request method
8130
8137
  , requestMethod = request.method.toLowerCase()
8131
8138
  ;
8132
-
8139
+
8133
8140
  if (!_param.length) return false;
8134
8141
 
8135
8142
  // if custom path, path rewrite
8136
8143
  if (params.param.path && regex.test(params.param.path)) {
8137
8144
  params.param.path = params.param.path.replace(regex, urlVal);
8138
8145
  }
8139
-
8146
+
8140
8147
  // if custom namespace, namespace rewrite
8141
- if (params.param.namespace && regex.test(params.param.namespace)) {
8142
- params.param.namespace = params.param.namespace.replace(regex, urlVal);
8148
+ if (params.param.namespace && regex.test(params.param.namespace)) {
8149
+ params.param.namespace = params.param.namespace.replace(regex, urlVal);
8143
8150
  }
8144
-
8151
+
8145
8152
  // if custom file, file rewrite
8146
- // if (params.param.file && regex.test(params.param.file)) {
8147
- // params.param.file = params.param.file.replace(regex, urlVal);
8153
+ // if (params.param.file && regex.test(params.param.file)) {
8154
+ // params.param.file = params.param.file.replace(regex, urlVal);
8148
8155
  // }
8149
8156
  // file is handle like url replacement (path is like pathname)
8150
8157
  if (typeof (params.param.file) != 'undefined' && /:/.test(params.param.file)) {
8151
- var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
8152
- replacement.variable = urlVal;
8158
+ var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
8159
+ replacement.variable = urlVal;
8153
8160
  params.param.file = params.param.file.replace( _regex, replacement );
8154
8161
  }
8155
8162
 
8156
8163
  // if custom title, title rewrite
8157
- if (params.param.title && regex.test(params.param.title)) {
8164
+ if (params.param.title && regex.test(params.param.title)) {
8158
8165
  params.param.title = params.param.title.replace(regex, urlVal);
8159
8166
  }
8160
8167
 
8161
8168
  if (_param.length == 1) { // fast one
8162
-
8169
+
8163
8170
  re = new RegExp( _param[0]);
8164
8171
  matched = (_param.indexOf(urlVar) > -1) ? _param.indexOf(urlVar) : false;
8165
-
8172
+
8166
8173
  if (matched === false ) {
8167
8174
  // In order to support rules defined like :
8168
8175
  // { params.url } => `/section/:name/page:number`
8169
8176
  // { request.url } => `/section/plante/page4`
8170
8177
  //
8171
8178
  // with keys = [ ":name", ":number" ]
8172
-
8179
+
8173
8180
  if ( urlVar.match(re) ) {
8174
8181
  matched = 0;
8175
8182
  }
8176
8183
  }
8177
-
8184
+
8178
8185
 
8179
8186
  if (matched === false) return matched;
8180
8187
  // filter on method
8181
8188
  if (params.method.toLowerCase() !== requestMethod) return false;
8182
-
8189
+
8183
8190
  if ( typeof(request[requestMethod]) == 'undefined' ) {
8184
8191
  request[requestMethod] = {}
8185
8192
  }
@@ -8191,7 +8198,7 @@ function Routing() {
8191
8198
  regex = params.requirements[key];
8192
8199
  if (/^\//.test(regex)) {
8193
8200
  re = regex.match(/\/(.*)\//).pop();
8194
- flags = regex.replace('/' + re + '/', '');
8201
+ flags = regex.replace('/' + re + '/', '');
8195
8202
 
8196
8203
  tested = new RegExp(re, flags).test(urlVal)
8197
8204
  } else if ( /^validator\:\:/.test(regex) && urlVal) {
@@ -8200,11 +8207,11 @@ function Routing() {
8200
8207
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
8201
8208
  * "email": "validator::{ isEmail: true, isString: [7] }"
8202
8209
  * }
8203
- *
8210
+ *
8204
8211
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
8205
- */
8206
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
8207
- urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
8212
+ */
8213
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
8214
+ urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
8208
8215
  _data[key] = urlVal.replace( new RegExp(str, 'g'), '');
8209
8216
  try {
8210
8217
  //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
@@ -8212,11 +8219,11 @@ function Routing() {
8212
8219
  regex.split(/::/).splice(1)[0]
8213
8220
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
8214
8221
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
8215
- );
8222
+ );
8216
8223
  } catch (err) {
8217
8224
  throw err;
8218
8225
  }
8219
- //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8226
+ //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8220
8227
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
8221
8228
  // since we only have one param
8222
8229
  // :var1 == :var1
@@ -8226,7 +8233,7 @@ function Routing() {
8226
8233
  request.params[key] = _data[key];
8227
8234
  }
8228
8235
  }
8229
- _rule[key] = _ruleObj;
8236
+ _rule[key] = _ruleObj;
8230
8237
  _validator = new Validator('routing', _data, null, _rule );
8231
8238
  if (_ruleObj.count() == 0 ) {
8232
8239
  console.error('Route validation failed '+ params.rule);
@@ -8237,7 +8244,7 @@ function Routing() {
8237
8244
  await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
8238
8245
  } else {
8239
8246
  await _validator[key][rule](_ruleObj[rule], request, response, next);
8240
- }
8247
+ }
8241
8248
  }
8242
8249
  tested = _validator.isValid();
8243
8250
  } else {
@@ -8250,7 +8257,7 @@ function Routing() {
8250
8257
  typeof(params.requirements[key]) != 'undefined' &&
8251
8258
  typeof(request.params) != 'undefined' &&
8252
8259
  tested
8253
- ) {
8260
+ ) {
8254
8261
  request.params[key] = urlVal;
8255
8262
  if ( typeof(request[requestMethod][key]) == 'undefined' ) {
8256
8263
  request[requestMethod][key] = urlVal;
@@ -8300,22 +8307,22 @@ function Routing() {
8300
8307
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
8301
8308
  * "email": "validator::{ isEmail: true, isString: [7] }"
8302
8309
  * }
8303
- *
8310
+ *
8304
8311
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true}} ).isEmail().valid;
8305
- */
8306
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
8307
- urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
8312
+ */
8313
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
8314
+ urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
8308
8315
  _data[key[0]] = urlVal.replace( new RegExp(str, 'g'), '');
8309
- _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8310
- _rule[key[0]] = _ruleObj;
8316
+ _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8317
+ _rule[key[0]] = _ruleObj;
8311
8318
  _validator = new Validator('routing', _data, null, _rule );
8312
-
8319
+
8313
8320
  for (let rule in _ruleObj) {
8314
8321
  if (Array.isArray(_ruleObj[rule])) { // has args
8315
8322
  _validator[key[0]][rule].apply(_validator[key[0]], _ruleObj[rule])
8316
8323
  } else {
8317
8324
  _validator[key[0]][rule](_ruleObj[rule])
8318
- }
8325
+ }
8319
8326
  }
8320
8327
  tested = _validator.isValid();
8321
8328
  } else {
@@ -8373,9 +8380,9 @@ function Routing() {
8373
8380
 
8374
8381
  return false
8375
8382
  }
8376
-
8383
+
8377
8384
  var replacement = function(matched){
8378
- return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
8385
+ return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
8379
8386
  };
8380
8387
  var checkRouteParams = function(route, params) {
8381
8388
  var variable = null
@@ -8389,14 +8396,14 @@ function Routing() {
8389
8396
  ;
8390
8397
  for (p in route.param) {
8391
8398
  if ( typeof(params) != 'undefined' && typeof(params[p]) == 'undefined' ) continue;
8392
-
8399
+
8393
8400
  if ( /^:/.test(route.param[p]) ) {
8394
8401
  variable = route.param[p].substr(1);
8395
-
8402
+
8396
8403
  if ( typeof(params) != 'undefined' && typeof(params[variable]) != 'undefined' ) {
8397
-
8398
- regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
8399
-
8404
+
8405
+ regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
8406
+
8400
8407
 
8401
8408
  if ( typeof(route.param.path) != 'undefined' && /:/.test(route.param.path) ) {
8402
8409
  route.param.path = route.param.path.replace( regex, params[variable]);
@@ -8409,28 +8416,28 @@ function Routing() {
8409
8416
  }
8410
8417
  // file is handle like url replacement (path is like pathname)
8411
8418
  if (typeof (route.param.file) != 'undefined' && /:/.test(route.param.file)) {
8412
- replacement.variable = params[variable];
8419
+ replacement.variable = params[variable];
8413
8420
  route.param.file = route.param.file.replace( regex, replacement );
8414
8421
  }
8415
-
8416
- if ( /\,/.test(route.url) ) {
8422
+
8423
+ if ( /\,/.test(route.url) ) {
8417
8424
  urls = route.url.split(/\,/g);
8418
8425
  i = 0; len = urls.length;
8419
8426
  for (; i < len; ++i) {
8420
- replacement.variable = params[variable];
8427
+ replacement.variable = params[variable];
8421
8428
  urls[i] = urls[i].replace( regex, replacement );
8422
8429
  }
8423
8430
  route.url = urls.join(',');
8424
- } else {
8425
- replacement.variable = params[variable];
8431
+ } else {
8432
+ replacement.variable = params[variable];
8426
8433
  route.url = route.url.replace( regex, replacement );
8427
8434
  }
8428
8435
  }
8429
8436
  }
8430
8437
  }
8431
-
8438
+
8432
8439
  // Selecting url in case of multiple urls & optional requirmements
8433
- if ( urls ) {
8440
+ if ( urls ) {
8434
8441
  i = 0; len = urls.length;
8435
8442
  var rawUrlVars = null
8436
8443
  , rawUrlScore = null
@@ -8457,8 +8464,8 @@ function Routing() {
8457
8464
  route.urlIndex = i;
8458
8465
  }
8459
8466
  }
8460
- }
8461
-
8467
+ }
8468
+
8462
8469
  return route;
8463
8470
  }
8464
8471
 
@@ -8472,7 +8479,7 @@ function Routing() {
8472
8479
  * @returns {object} route
8473
8480
  * */
8474
8481
  self.getRoute = function(rule, params, urlIndex) {
8475
-
8482
+
8476
8483
  var config = null;
8477
8484
  if (isGFFCtx) {
8478
8485
  config = window.gina.config;
@@ -8482,13 +8489,13 @@ function Routing() {
8482
8489
  config.getRouting = getContext('gina').Config.instance.getRouting;
8483
8490
  }
8484
8491
  }
8485
-
8492
+
8486
8493
  var env = config.env || GINA_ENV // by default, takes the current bundle
8487
8494
  , envTmp = null
8488
8495
  //, scheme = null
8489
8496
  , bundle = config.bundle // by default, takes the current bundle
8490
8497
  ;
8491
-
8498
+
8492
8499
  if ( !/\@/.test(rule) && typeof(bundle) != 'undefined' && bundle != null) {
8493
8500
  rule = rule.toLowerCase()
8494
8501
  rule += '@' + bundle
@@ -8513,8 +8520,8 @@ function Routing() {
8513
8520
 
8514
8521
  rule = arr[0].toLowerCase() +'@'+ bundle;
8515
8522
  }
8516
-
8517
-
8523
+
8524
+
8518
8525
  var routing = config.getRouting(bundle, env);
8519
8526
 
8520
8527
  if ( typeof(routing[rule]) == 'undefined' ) {
@@ -8537,14 +8544,14 @@ function Routing() {
8537
8544
  delete route.urlIndex;
8538
8545
  }
8539
8546
  urlIndex = ( typeof(urlIndex) != 'undefined' ) ? urlIndex : 0;
8540
- route.url = route.url.split(/,/g)[urlIndex];
8547
+ route.url = route.url.split(/,/g)[urlIndex];
8541
8548
  }
8542
8549
  // fix url in case of empty param value allowed by the routing rule
8543
8550
  // to prevent having a folder.
8544
8551
  // eg.: {..., id: '/^\\s*$/'} => {..., id: ''} => /path/to/ becoming /path/to
8545
8552
  if ( /\/$/.test(route.url) && route.url != '/' )
8546
8553
  route.url = route.url.substr(0, route.url.length-1);
8547
-
8554
+
8548
8555
  // Completeting url with extra params e.g.: ?param1=val1&param2=val2
8549
8556
  if ( /GET/i.test(route.method) && typeof(params) != 'undefined' ) {
8550
8557
  var queryParams = '?', maskedUrl = routing[rule].url;
@@ -8555,46 +8562,46 @@ function Routing() {
8555
8562
  if (typeof(params[r]) != 'undefined' )
8556
8563
  queryParams += r +'='+ encodeURIComponent(params[r])+ '&';
8557
8564
  }
8558
-
8565
+
8559
8566
  if (queryParams.length > 1) {
8560
8567
  queryParams = queryParams.substring(0, queryParams.length-1);
8561
8568
  route.url += queryParams;
8562
8569
  }
8563
8570
  }
8564
-
8571
+
8565
8572
  // recommanded for x-bundle coms
8566
8573
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
8567
8574
  route.toUrl = function (ignoreWebRoot) {
8568
-
8575
+
8569
8576
  var urlProps = null;
8570
8577
  if ( /^redirect$/i.test(this.param.control) ) {
8571
8578
  urlProps = self.getUrlProps(this.bundle, (env||GINA_ENV));
8572
8579
  }
8573
-
8580
+
8574
8581
  var wroot = this.webroot || urlProps.webroot
8575
8582
  , hostname = this.hostname || urlProps.hostname
8576
8583
  , path = this.url
8577
8584
  ;
8578
-
8585
+
8579
8586
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
8580
8587
 
8581
8588
  return hostname + this.url
8582
8589
  };
8583
-
8590
+
8584
8591
  /**
8585
8592
  * request current url
8586
- *
8587
- *
8588
- *
8593
+ *
8594
+ *
8595
+ *
8589
8596
  * @param {boolean} [ignoreWebRoot]
8590
8597
  * @param {object} [options] - see: https://nodejs.org/api/https.html#https_new_agent_options
8591
8598
  * @param {object} [_this] - current context: only used when `promisify`is used
8592
- *
8599
+ *
8593
8600
  * @callback {callback} [cb] - see: https://nodejs.org/api/https.html#https_new_agent_options
8594
8601
  * @param {object} res
8595
8602
  */
8596
8603
  route.request = function(ignoreWebRoot, options) {
8597
-
8604
+
8598
8605
  var cb = null, _this = null;
8599
8606
  if ( typeof(arguments[arguments.length-1]) == 'function' ) {
8600
8607
  cb = arguments[arguments.length-1];
@@ -8602,14 +8609,14 @@ function Routing() {
8602
8609
  if ( typeof(arguments[2]) == 'object' ) {
8603
8610
  _this = arguments[2];
8604
8611
  }
8605
-
8612
+
8606
8613
  var wroot = this.webroot || _this.webroot
8607
8614
  , hostname = this.hostname || _this.hostname
8608
8615
  , url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : this.url || _this.url
8609
8616
  ;
8610
-
8617
+
8611
8618
  var scheme = ( /^https/.test(hostname) ) ? 'https' : 'http';
8612
-
8619
+
8613
8620
  if (isGFFCtx) {
8614
8621
  var target = ( typeof(options) != 'undefined' && typeof(options.target) != 'undefined' ) ? options.target : "_self";
8615
8622
  window.open(url, target)
@@ -8619,11 +8626,11 @@ function Routing() {
8619
8626
  // create an agent just for this request
8620
8627
  options.agent = false;
8621
8628
  }
8622
- var agent = require(''+scheme);
8623
- var onAgentResponse = function(res) {
8624
-
8629
+ var agent = require(''+scheme);
8630
+ var onAgentResponse = function(res) {
8631
+
8625
8632
  var data = '', err = false;
8626
-
8633
+
8627
8634
  res.on('data', function (chunk) {
8628
8635
  data += chunk;
8629
8636
  });
@@ -8647,26 +8654,26 @@ function Routing() {
8647
8654
  err = parseError
8648
8655
  }
8649
8656
  }
8650
- if (err) {
8657
+ if (err) {
8651
8658
  cb(err);
8652
8659
  return;
8653
8660
  }
8654
-
8661
+
8655
8662
  cb(false, data);
8656
8663
  return;
8657
8664
  });
8658
8665
  }
8659
- if (cb) {
8666
+ if (cb) {
8660
8667
  agent.get(url, options, onAgentResponse);
8661
8668
  } else {
8662
8669
  // just throw the request without waiting/handling response
8663
8670
  agent.get(url, options);
8664
- }
8671
+ }
8665
8672
  }
8666
- return;
8667
-
8673
+ return;
8674
+
8668
8675
  } // EO route.request()
8669
-
8676
+
8670
8677
  if ( /\:/.test(route.url) ) {
8671
8678
  var paramList = route.url
8672
8679
  .match(/(\:(.*)\/|\:(.*)$)/g)
@@ -8690,21 +8697,21 @@ function Routing() {
8690
8697
  // adding hash if found
8691
8698
  if (hash)
8692
8699
  url += hash;
8693
-
8700
+
8694
8701
  route.url = url;
8695
8702
  // recommanded for x-bundle coms
8696
8703
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
8697
- route.toUrl = function (ignoreWebRoot) {
8704
+ route.toUrl = function (ignoreWebRoot) {
8698
8705
  var wroot = this.webroot
8699
8706
  , hostname = this.hostname
8700
8707
  , path = this.url
8701
8708
  ;
8702
-
8709
+
8703
8710
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
8704
8711
 
8705
8712
  return hostname + this.url
8706
8713
  };
8707
-
8714
+
8708
8715
  return route
8709
8716
  }
8710
8717
 
@@ -8717,18 +8724,18 @@ function Routing() {
8717
8724
  * @param {string} url e.g.: /webroot/some/url/path or http
8718
8725
  * @param {string} [bundle] targeted bundle
8719
8726
  * @param {string} [method] request method (GET|PUT|PUT|DELETE) - GET is set by default
8720
- * @param {object} [request]
8727
+ * @param {object} [request]
8721
8728
  * @param {boolean} [isOverridinMethod] // will replace request.method by the provided method - Used for redirections
8722
- *
8729
+ *
8723
8730
  * @returns {object|boolean} route - when route is found; `false` when not found
8724
8731
  * */
8725
-
8732
+
8726
8733
  self.getRouteByUrl = function (url, bundle, method, request, isOverridinMethod) {
8727
-
8734
+
8728
8735
  if (
8729
- arguments.length == 2
8730
- && typeof(arguments[1]) != 'undefined'
8731
- && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
8736
+ arguments.length == 2
8737
+ && typeof(arguments[1]) != 'undefined'
8738
+ && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
8732
8739
  ) {
8733
8740
  method = arguments[1];
8734
8741
  bundle = undefined;
@@ -8741,24 +8748,24 @@ function Routing() {
8741
8748
  , hostname = null
8742
8749
  , host = null
8743
8750
  ;
8744
-
8751
+
8745
8752
  if ( /\#/.test(url) && url.length > 1 ) {
8746
8753
  var urlPart = url.split(/\#/);
8747
8754
  url = urlPart[0];
8748
8755
  hash = '#' + urlPart[1];
8749
-
8756
+
8750
8757
  urlPart = null;
8751
8758
  }
8752
-
8759
+
8753
8760
  // fast method
8754
8761
  if (
8755
- arguments.length == 1
8756
- && typeof(arguments[0]) != 'undefined'
8762
+ arguments.length == 1
8763
+ && typeof(arguments[0]) != 'undefined'
8757
8764
  ) {
8758
8765
  if ( !/^(https|http)/i.test(url) && !/^\//.test(url)) {
8759
8766
  url = '/'+ url;
8760
8767
  }
8761
-
8768
+
8762
8769
  webroot = '/' + url.split(/\//g)[1];
8763
8770
  if (isGFFCtx) {
8764
8771
  reverseRouting = gina.config.reverseRouting;
@@ -8772,24 +8779,24 @@ function Routing() {
8772
8779
  host = infos.host;
8773
8780
  hostname = infos.hostname;
8774
8781
  infos = null;
8775
- }
8782
+ }
8776
8783
  }
8777
-
8784
+
8778
8785
  isOverridinMethod = ( typeof(arguments[arguments.length-1]) != 'boolean') ? false : arguments[arguments.length-1];
8779
8786
 
8780
- var matched = false
8787
+ var matched = false
8781
8788
  , config = null
8782
8789
  , env = null
8783
8790
  , prefix = null
8784
8791
  , pathname = null
8785
8792
  , params = null
8786
8793
  , isRoute = null
8787
- , foundRoute = null
8788
- , routeObj = null
8794
+ , foundRoute = null
8795
+ , routeObj = null
8789
8796
  ;
8790
-
8791
-
8792
-
8797
+
8798
+
8799
+
8793
8800
  var isMethodProvidedByDefault = ( typeof(method) != 'undefined' ) ? true : false;
8794
8801
 
8795
8802
  if (isGFFCtx) {
@@ -8813,18 +8820,18 @@ function Routing() {
8813
8820
  } else {
8814
8821
 
8815
8822
  var gnaCtx = getContext('gina');
8816
-
8823
+
8817
8824
  config = gnaCtx.config;
8818
8825
  bundle = (typeof (bundle) != 'undefined') ? bundle : config.bundle;
8819
8826
  env = config.env;
8820
8827
  routing = config.getRouting(bundle);
8821
-
8822
-
8828
+
8829
+
8823
8830
 
8824
8831
  hostname = config.envConf[bundle][env].hostname;
8825
8832
  webroot = config.envConf[bundle][env].server.webroot;
8826
8833
  prefix = hostname + webroot;
8827
-
8834
+
8828
8835
  if ( !request ) {
8829
8836
  request = {
8830
8837
  routing: {},
@@ -8844,11 +8851,11 @@ function Routing() {
8844
8851
  if ( typeof(request.routing.path) == 'undefined' )
8845
8852
  request.routing.path = unescape(pathname);
8846
8853
  method = ( typeof(method) != 'undefined' ) ? method.toLowerCase() : 'get';
8847
-
8854
+
8848
8855
  if (isMethodProvidedByDefault) {
8849
8856
  // to handle 303 redirect like PUT -> GET
8850
8857
  request.originalMethod = request.method;
8851
-
8858
+
8852
8859
  request.method = method;
8853
8860
  request.routing.path = unescape(pathname)
8854
8861
  }
@@ -8858,8 +8865,8 @@ function Routing() {
8858
8865
 
8859
8866
  // getting params
8860
8867
  params = {};
8861
-
8862
-
8868
+
8869
+
8863
8870
 
8864
8871
  var paramsList = null;
8865
8872
  var re = new RegExp(method, 'i');
@@ -8874,13 +8881,13 @@ function Routing() {
8874
8881
  if (routing[name].bundle != bundle) continue;
8875
8882
 
8876
8883
  // method filter
8877
- localMethod = routing[name].method;
8884
+ localMethod = routing[name].method;
8878
8885
  if ( /\,/.test( localMethod ) && re.test(localMethod) ) {
8879
8886
  localMethod = request.method
8880
- }
8887
+ }
8881
8888
  if (typeof (routing[name].method) != 'undefined' && !re.test(localMethod)) continue;
8882
-
8883
- //Preparing params to relay to the core/router.
8889
+
8890
+ //Preparing params to relay to the core/router.
8884
8891
  params = {
8885
8892
  method : localMethod,
8886
8893
  requirements : routing[name].requirements,
@@ -8896,8 +8903,8 @@ function Routing() {
8896
8903
 
8897
8904
  // normal case
8898
8905
  //Parsing for the right url.
8899
- try {
8900
-
8906
+ try {
8907
+
8901
8908
  isRoute = self.compareUrls(params, routing[name].url, request);
8902
8909
 
8903
8910
  if (isRoute.past) {
@@ -8917,96 +8924,96 @@ function Routing() {
8917
8924
  } //EO for break out
8918
8925
 
8919
8926
  if (!matched) {
8920
- if (isGFFCtx) {
8921
- var urlHasChanged = false;
8922
- if (
8923
- url == '#'
8924
- && /GET/i.test(method)
8925
- && isMethodProvidedByDefault
8927
+ if (isGFFCtx) {
8928
+ var urlHasChanged = false;
8929
+ if (
8930
+ url == '#'
8931
+ && /GET/i.test(method)
8932
+ && isMethodProvidedByDefault
8926
8933
  || /^404\:/.test(url)
8927
8934
  ) {
8928
8935
  url = location.pathname;
8929
8936
  urlHasChanged = true;
8930
8937
  }
8931
-
8938
+
8932
8939
  if ( typeof(self.notFound) == 'undefined' ) {
8933
8940
  self.notFound = {}
8934
8941
  }
8935
-
8942
+
8936
8943
  var notFound = null, msg = '[ RoutingHelper::getRouteByUrl(rule[, bundle, method]) ] : route [ %r ] is called but not found inside your view: `' + url + '` !';
8937
8944
  if ( gina.hasPopinHandler && gina.popinIsBinded ) {
8938
8945
  notFound = gina.popin.getActivePopin().target.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
8939
8946
  } else {
8940
8947
  notFound = document.body.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
8941
8948
  }
8942
-
8949
+
8943
8950
  notFound = (notFound && notFound.length > 0) ? notFound[0] : null;
8944
-
8951
+
8945
8952
  if ( notFound && isMethodProvidedByDefault && urlHasChanged ) {
8946
-
8947
- var m = notFound.match(/\[\w+\]/)[0];
8948
-
8953
+
8954
+ var m = notFound.match(/\[\w+\]/)[0];
8955
+
8949
8956
  notFound = notFound.replace('404:'+m, m.replace(/\[|\]/g, '')+'::' );
8950
-
8957
+
8951
8958
  msg = msg.replace(/\%r/, notFound.replace(/404\:\s+/, ''));
8952
-
8959
+
8953
8960
  if (typeof(self.notFound[notFound]) == 'undefined') {
8954
- self.notFound[notFound] = {
8961
+ self.notFound[notFound] = {
8955
8962
  count: 1,
8956
- message: msg
8963
+ message: msg
8957
8964
  };
8958
8965
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
8959
8966
  ++self.notFound[notFound].count;
8960
8967
  }
8961
-
8962
- return false
8963
- }
8964
-
8965
- notFound = null;
8966
-
8967
- var altRule = gina.config.reverseRouting[url] || null;
8968
+
8969
+ return false
8970
+ }
8971
+
8972
+ notFound = null;
8973
+
8974
+ var altRule = gina.config.reverseRouting[url] || null;
8968
8975
  if (
8969
- !notFound
8976
+ !notFound
8970
8977
  && altRule
8971
8978
  && typeof(altRule) != 'undefined'
8972
8979
  && altRule.split(/\@(.+)$/)[1] == bundle
8973
8980
  ) {
8974
-
8981
+
8975
8982
  notFound = altRule;
8976
8983
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
8977
-
8984
+
8978
8985
  msg = msg.replace(/\%r/, method.toUpperCase() +'::'+ altRule);
8979
-
8980
- self.notFound[notFound] = {
8986
+
8987
+ self.notFound[notFound] = {
8981
8988
  count: 1,
8982
- message: msg
8989
+ message: msg
8983
8990
  };
8984
- //console.warn(msg);
8991
+ //console.warn(msg);
8985
8992
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
8986
8993
  ++self.notFound[notFound].count;
8987
8994
  }
8988
-
8995
+
8989
8996
  return false
8990
8997
  }
8991
-
8998
+
8992
8999
  // forms
8993
9000
  var altRoute = self.compareUrls(params, url, request) || null;
8994
9001
  if(altRoute.past && isMethodProvidedByDefault) {
8995
9002
  notFound = method.toUpperCase() +'::'+ altRoute.request.routing.rule;
8996
9003
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
8997
9004
  msg = msg.replace(/\%r/, notFound);
8998
- //console.warn(msg);
9005
+ //console.warn(msg);
8999
9006
  } else {
9000
9007
  ++self.notFound[notFound].count;
9001
9008
  }
9002
-
9009
+
9003
9010
  return false
9004
- }
9011
+ }
9005
9012
  return false
9006
9013
  }
9007
9014
 
9008
-
9009
- console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
9015
+
9016
+ console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
9010
9017
  return false;
9011
9018
  } else {
9012
9019
  // fix url in case of empty param value allowed by the routing rule
@@ -9017,21 +9024,21 @@ function Routing() {
9017
9024
  // adding hash if found
9018
9025
  if (hash)
9019
9026
  url += hash;
9020
-
9027
+
9021
9028
  route.url = url;
9022
9029
  // recommanded for x-bundle coms
9023
9030
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
9024
- route.toUrl = function (ignoreWebRoot) {
9031
+ route.toUrl = function (ignoreWebRoot) {
9025
9032
  var wroot = this.webroot
9026
9033
  , hostname = this.hostname
9027
9034
  , path = this.url
9028
9035
  ;
9029
-
9036
+
9030
9037
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
9031
-
9038
+
9032
9039
  return hostname + this.url
9033
9040
  };
9034
-
9041
+
9035
9042
  return route
9036
9043
  }
9037
9044
  }
@@ -9043,7 +9050,7 @@ if ((typeof (module) !== 'undefined') && module.exports) {
9043
9050
  // Publish as node.js module
9044
9051
  module.exports = Routing()
9045
9052
  } else if (typeof (define) === 'function' && define.amd) {
9046
- // Publish as AMD module
9053
+ // Publish as AMD module
9047
9054
  define('utils/routing', ['require', 'utils/form-validator', 'utils/merge'], function() { return Routing() })
9048
9055
  };
9049
9056
  /**
@@ -15067,7 +15074,6 @@ define("utils/dom", function(){});
15067
15074
  // getting fields & values
15068
15075
  var $fields = {}
15069
15076
  , fields = { '_length': 0 }
15070
- , id = $target.getAttribute('id')
15071
15077
  , rules = ( typeof(gina.validator.$forms[id]) != 'undefined' ) ? gina.validator.$forms[id].rules : null
15072
15078
  , name = null
15073
15079
  , value = 0
@@ -16194,7 +16200,7 @@ define("utils/dom", function(){});
16194
16200
  }
16195
16201
 
16196
16202
 
16197
- for (var c = 0, cLen = conditions.length; c<cLen; ++c) {
16203
+ for (let c = 0, cLen = conditions.length; c<cLen; ++c) {
16198
16204
  // by default
16199
16205
  //caseValue = fields[field];
16200
16206
  caseValue = allFields[field];
@@ -18003,11 +18009,11 @@ define('gina/toolbar', ['require', 'jquery', 'vendor/uuid'/**, 'utils/merge'*/,
18003
18009
  return Toolbar
18004
18010
  });
18005
18011
  define('gina', [ 'require', 'vendor/uuid', 'utils/merge', 'utils/events', 'helpers/prototypes', 'helpers/dateFormat', 'gina/toolbar' ], function (require) {
18006
-
18007
-
18012
+
18013
+
18008
18014
  var eventsHandler = require('utils/events'); // events handler
18009
18015
  var merge = require('utils/merge');
18010
- var dateFormat = require('helpers/dateFormat')();
18016
+ var dateFormat = require('helpers/dateFormat')();
18011
18017
  var prototypes = require('helpers/prototypes')({ dateFormat: dateFormat });
18012
18018
  var uuid = require('vendor/uuid');
18013
18019
 
@@ -18093,27 +18099,27 @@ define('gina', [ 'require', 'vendor/uuid', 'utils/merge', 'utils/events', 'helpe
18093
18099
 
18094
18100
  'setOptions' : setOptions
18095
18101
  };
18096
-
18102
+
18097
18103
  // iframe case
18098
18104
  if ( typeof(parent.window['gina']) != 'undefined' ) {
18099
18105
  // inheriting from parent frame instance
18100
- window['gina'] = merge((window['gina'] || {}), parent.window['gina']);
18106
+ window['gina'] = merge((window['gina'] || {}), parent.window['gina']);
18101
18107
  }
18102
- $instance = merge( (window['gina'] || {}), $instance);
18108
+ $instance = merge( (window['gina'] || {}), $instance);
18103
18109
 
18104
18110
  registerEvents(this.plugin, events);
18105
-
18111
+
18106
18112
  triggerEvent(gina, proto.target, 'ginaloaded', $instance)
18107
18113
  }
18108
18114
 
18109
18115
  return construct
18110
18116
  });
18111
18117
  /*!
18112
- * Engine.IO v6.1.1
18113
- * (c) 2014-2021 Guillermo Rauch
18118
+ * Engine.IO v6.2.2
18119
+ * (c) 2014-2022 Guillermo Rauch
18114
18120
  * Released under the MIT License.
18115
18121
  */
18116
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define('vendor/engine.io',e):(t="undefined"!=typeof globalThis?globalThis:t||self).eio=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?u(t):e}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=i(t);if(e){var o=i(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function p(t,e,r){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=i(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}},p(t,e,r||t)}var l={exports:{}};try{l.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){l.exports=!1}var f=l.exports,d="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function y(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||f))return new XMLHttpRequest}catch(t){}if(!e)try{return new(d[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function v(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return r.reduce((function(e,r){return t.hasOwnProperty(r)&&(e[r]=t[r]),e}),{})}var m=setTimeout,g=clearTimeout;function b(t,e){e.useNativeTimers?(t.setTimeoutFn=m.bind(d),t.clearTimeoutFn=g.bind(d)):(t.setTimeoutFn=setTimeout.bind(d),t.clearTimeoutFn=clearTimeout.bind(d))}var k=w;function w(t){if(t)return function(t){for(var e in w.prototype)t[e]=w.prototype[e];return t}(t)}w.prototype.on=w.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},w.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},w.prototype.off=w.prototype.removeListener=w.prototype.removeAllListeners=w.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},w.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},w.prototype.emitReserved=w.prototype.emit,w.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},w.prototype.hasListeners=function(t){return!!this.listeners(t).length};var T=Object.create(null);T.open="0",T.close="1",T.ping="2",T.pong="3",T.message="4",T.upgrade="5",T.noop="6";var S=Object.create(null);Object.keys(T).forEach((function(t){S[T[t]]=t}));for(var x={type:"error",data:"parser error"},O="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),E="function"==typeof ArrayBuffer,R=function(t,e,r){var n,o=t.type,s=t.data;return O&&s instanceof Blob?e?r(s):C(s,r):E&&(s instanceof ArrayBuffer||(n=s,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer))?e?r(s):C(new Blob([s]),r):r(T[o]+(s||""))},C=function(t,e){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];e("b"+t)},r.readAsDataURL(t)},q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),L=0;L<q.length;L++)B[q.charCodeAt(L)]=L;var P,A="function"==typeof ArrayBuffer,_=function(t,e){if("string"!=typeof t)return{type:"message",data:U(t,e)};var r=t.charAt(0);return"b"===r?{type:"message",data:j(t.substring(1),e)}:S[r]?t.length>1?{type:S[r],data:t.substring(1)}:{type:S[r]}:x},j=function(t,e){if(A){var r=function(t){var e,r,n,o,s,i=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(i--,"="===t[t.length-2]&&i--);var c=new ArrayBuffer(i),h=new Uint8Array(c);for(e=0;e<a;e+=4)r=B[t.charCodeAt(e)],n=B[t.charCodeAt(e+1)],o=B[t.charCodeAt(e+2)],s=B[t.charCodeAt(e+3)],h[u++]=r<<2|n>>4,h[u++]=(15&n)<<4|o>>2,h[u++]=(3&o)<<6|63&s;return c}(t);return U(r,e)}return{base64:!0,data:t}},U=function(t,e){return"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t},H=String.fromCharCode(30),D=function(t){s(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this)).writable=!1,b(u(n),t),n.opts=t,n.query=t.query,n.readyState="",n.socket=t.socket,n}return n(o,[{key:"onError",value:function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,p(i(o.prototype),"emit",this).call(this,"error",r),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){"open"===this.readyState&&this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,p(i(o.prototype),"emit",this).call(this,"open")}},{key:"onData",value:function(t){var e=_(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){p(i(o.prototype),"emit",this).call(this,"packet",t)}},{key:"onClose",value:function(){this.readyState="closed",p(i(o.prototype),"emit",this).call(this,"close")}}]),o}(k),F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),I={},M=0,W=0;function N(t){var e="";do{e=F[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function X(){var t=N(+new Date);return t!==P?(M=0,P=t):t+"."+N(M++)}for(;W<64;W++)I[F[W]]=W;X.encode=N,X.decode=function(t){var e=0;for(W=0;W<t.length;W++)e=64*e+I[t.charAt(W)];return e};var $=X,z={encode:function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},decode:function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var s=r[n].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},V=function(t){s(o,t);var r=h(o);function o(){var t;return e(this,o),(t=r.apply(this,arguments)).polling=!1,t}return n(o,[{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var r=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",(function(){--n||r()}))),this.writable||(n++,this.once("drain",(function(){--n||r()})))}else r()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emit("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var r=t.split(H),n=[],o=0;o<r.length;o++){var s=_(r[o],e);if(n.push(s),"error"===s.type)break}return n})(t,this.socket.binaryType).forEach((function(t){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this,e=function(){t.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,function(t,e){var r=t.length,n=new Array(r),o=0;t.forEach((function(t,s){R(t,!1,(function(t){n[s]=t,++o===r&&e(n.join(H))}))}))}(t,(function(t){e.doWrite(t,(function(){e.writable=!0,e.emit("drain")}))}))}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",r="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=$()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);var n=z.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"name",get:function(){return"polling"}}]),o}(D);function G(){}var J=null!=new y({xdomain:!1}).responseType,K=function(t){s(i,t);var r=h(i);function i(t){var n;if(e(this,i),n=r.call(this,t),"undefined"!=typeof location){var o="https:"===location.protocol,s=location.port;s||(s=o?"443":"80"),n.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,n.xs=t.secure!==o}var a=t&&t.forceBase64;return n.supportsBinary=J&&!a,n}return n(i,[{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new Q(this.uri(),t)}},{key:"doWrite",value:function(t,e){var r=this,n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",(function(t){r.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e}}]),i}(V),Q=function(t){s(o,t);var r=h(o);function o(t,n){var s;return e(this,o),b(u(s=r.call(this)),n),s.opts=n,s.method=n.method||"GET",s.uri=t,s.async=!1!==n.async,s.data=void 0!==n.data?n.data:null,s.create(),s}return n(o,[{key:"create",value:function(){var t=this,e=v(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var r=this.xhr=new y(e);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var n in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?t.onLoad():t.setTimeoutFn((function(){t.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(e){return void this.setTimeoutFn((function(){t.onError(e)}),0)}"undefined"!=typeof document&&(this.index=o.requestsCount++,o.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=G,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete o.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"abort",value:function(){this.cleanup()}}]),o}(k);if(Q.requestsCount=0,Q.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Y);else if("function"==typeof addEventListener){addEventListener("onpagehide"in d?"pagehide":"unload",Y,!1)}function Y(){for(var t in Q.requests)Q.requests.hasOwnProperty(t)&&Q.requests[t].abort()}var Z="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},tt=d.WebSocket||d.MozWebSocket,et="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),rt=function(t){s(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this,t)).supportsBinary=!t.forceBase64,n}return n(o,[{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,r=et?{}:v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=et?new tt(t,e,r):e?new tt(t,e):new tt(t)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var r=function(r){var n=t[r],o=r===t.length-1;R(n,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}o&&Z((function(){e.writable=!0,e.emit("drain")}),e.setTimeoutFn)}))},n=0;n<t.length;n++)r(n)}},{key:"doClose",value:function(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",r="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=$()),this.supportsBinary||(t.b64=1);var n=z.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"check",value:function(){return!(!tt||"__initialize"in tt&&this.name===o.prototype.name)}},{key:"name",get:function(){return"websocket"}}]),o}(D),nt={websocket:rt,polling:K},ot=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,st=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],it=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o,s,i=ot.exec(t||""),a={},u=14;u--;)a[st[u]]=i[u]||"";return-1!=r&&-1!=n&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,a.path),a.queryKey=(o=a.query,s={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(s[e]=r)})),s),a};var at=function(r){s(a,r);var i=h(a);function a(r){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),n=i.call(this),r&&"object"===t(r)&&(s=r,r=null),r?(r=it(r),s.hostname=r.host,s.secure="https"===r.protocol||"wss"===r.protocol,s.port=r.port,r.query&&(s.query=r.query)):s.host&&(s.hostname=it(s.host).host),b(u(n),s),n.secure=null!=s.secure?s.secure:"undefined"!=typeof location&&"https:"===location.protocol,s.hostname&&!s.port&&(s.port=n.secure?"443":"80"),n.hostname=s.hostname||("undefined"!=typeof location?location.hostname:"localhost"),n.port=s.port||("undefined"!=typeof location&&location.port?location.port:n.secure?"443":"80"),n.transports=s.transports||["polling","websocket"],n.readyState="",n.writeBuffer=[],n.prevBufferLen=0,n.opts=o({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},s),n.opts.path=n.opts.path.replace(/\/$/,"")+"/","string"==typeof n.opts.query&&(n.opts.query=z.decode(n.opts.query)),n.id=null,n.upgrades=null,n.pingInterval=null,n.pingTimeout=null,n.pingTimeoutTimer=null,"function"==typeof addEventListener&&(n.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){n.transport&&(n.transport.removeAllListeners(),n.transport.close())}),!1),"localhost"!==n.hostname&&(n.offlineEventListener=function(){n.onClose("transport close")},addEventListener("offline",n.offlineEventListener,!1))),n.open(),n}return n(a,[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var r=o({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new nt[t](r)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var e=this,r=this.createTransport(t),n=!1;a.priorWebsocketSuccess=!1;var o=function(){n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",r),!r)return;a.priorWebsocketSuccess="websocket"===r.name,e.transport.pause((function(){n||"closed"!==e.readyState&&(p(),e.setTransport(r),r.send([{type:"upgrade"}]),e.emitReserved("upgrade",r),r=null,e.upgrading=!1,e.flush())}))}else{var o=new Error("probe error");o.transport=r.name,e.emitReserved("upgradeError",o)}})))};function s(){n||(n=!0,p(),r.close(),r=null)}var i=function(t){var n=new Error("probe error: "+t);n.transport=r.name,s(),e.emitReserved("upgradeError",n)};function u(){i("transport closed")}function c(){i("socket closed")}function h(t){r&&t.name!==r.name&&s()}var p=function(){r.removeListener("open",o),r.removeListener("error",i),r.removeListener("close",u),e.off("close",c),e.off("upgrading",h)};r.once("open",o),r.once("error",i),r.once("close",u),this.once("close",c),this.once("upgrading",h),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}},{key:"onHandshake",value:function(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((function(){t.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}},{key:"flush",value:function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emitReserved("flush"))}},{key:"write",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"send",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"sendPacket",value:function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},r=function r(){t.off("upgrade",r),t.off("upgradeError",r),e()},n=function(){t.once("upgrade",r),t.once("upgradeError",r)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?n():e()})):this.upgrading?n():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}]),a}(k);at.protocol=4;return function(t,e){return new at(t,e)}}));
18122
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define('vendor/engine.io',e):(t="undefined"!=typeof globalThis?globalThis:t||self).eio=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function c(t,e,r){return c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&a(o,r.prototype),o},c.apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return p=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,t)},p(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?h(t):e}function f(t){var e=u();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l(this,r)}}function d(t,e,r){return d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}},d(t,e,r||t)}var y=Object.create(null);y.open="0",y.close="1",y.ping="2",y.pong="3",y.message="4",y.upgrade="5",y.noop="6";var v=Object.create(null);Object.keys(y).forEach((function(t){v[y[t]]=t}));for(var m={type:"error",data:"parser error"},g="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),b="function"==typeof ArrayBuffer,k=function(t,e,r){var n,o=t.type,i=t.data;return g&&i instanceof Blob?e?r(i):w(i,r):b&&(i instanceof ArrayBuffer||(n=i,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer))?e?r(i):w(new Blob([i]),r):r(y[o]+(i||""))},w=function(t,e){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];e("b"+t)},r.readAsDataURL(t)},T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S="undefined"==typeof Uint8Array?[]:new Uint8Array(256),R=0;R<T.length;R++)S[T.charCodeAt(R)]=R;var x="function"==typeof ArrayBuffer,O=function(t,e){if("string"!=typeof t)return{type:"message",data:P(t,e)};var r=t.charAt(0);return"b"===r?{type:"message",data:E(t.substring(1),e)}:v[r]?t.length>1?{type:v[r],data:t.substring(1)}:{type:v[r]}:m},E=function(t,e){if(x){var r=function(t){var e,r,n,o,i,s=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var c=new ArrayBuffer(s),p=new Uint8Array(c);for(e=0;e<a;e+=4)r=S[t.charCodeAt(e)],n=S[t.charCodeAt(e+1)],o=S[t.charCodeAt(e+2)],i=S[t.charCodeAt(e+3)],p[u++]=r<<2|n>>4,p[u++]=(15&n)<<4|o>>2,p[u++]=(3&o)<<6|63&i;return c}(t);return P(r,e)}return{base64:!0,data:t}},P=function(t,e){return"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t},B=String.fromCharCode(30);function C(t){if(t)return function(t){for(var e in C.prototype)t[e]=C.prototype[e];return t}(t)}C.prototype.on=C.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},C.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},C.prototype.off=C.prototype.removeListener=C.prototype.removeAllListeners=C.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},C.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},C.prototype.emitReserved=C.prototype.emit,C.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},C.prototype.hasListeners=function(t){return!!this.listeners(t).length};var L="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function q(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return r.reduce((function(e,r){return t.hasOwnProperty(r)&&(e[r]=t[r]),e}),{})}var A=setTimeout,j=clearTimeout;function _(t,e){e.useNativeTimers?(t.setTimeoutFn=A.bind(L),t.clearTimeoutFn=j.bind(L)):(t.setTimeoutFn=setTimeout.bind(L),t.clearTimeoutFn=clearTimeout.bind(L))}var U,H=function(t){i(n,t);var r=f(n);function n(t,o,i){var s;return e(this,n),(s=r.call(this,t)).description=o,s.context=i,s.type="TransportError",s}return n}(p(Error)),F=function(t){i(o,t);var r=f(o);function o(t){var n;return e(this,o),(n=r.call(this)).writable=!1,_(h(n),t),n.opts=t,n.query=t.query,n.readyState="",n.socket=t.socket,n}return n(o,[{key:"onError",value:function(t,e,r){return d(s(o.prototype),"emitReserved",this).call(this,"error",new H(t,e,r)),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){"open"===this.readyState&&this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,d(s(o.prototype),"emitReserved",this).call(this,"open")}},{key:"onData",value:function(t){var e=O(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){d(s(o.prototype),"emitReserved",this).call(this,"packet",t)}},{key:"onClose",value:function(t){this.readyState="closed",d(s(o.prototype),"emitReserved",this).call(this,"close",t)}}]),o}(C),D="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),M={},I=0,W=0;function N(t){var e="";do{e=D[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function X(){var t=N(+new Date);return t!==U?(I=0,U=t):t+"."+N(I++)}for(;W<64;W++)M[D[W]]=W;function $(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function z(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}var V=!1;try{V="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}var G=V;function J(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||G))return new XMLHttpRequest}catch(t){}if(!e)try{return new(L[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function K(){}var Q=null!=new J({xdomain:!1}).responseType,Y=function(t){i(s,t);var r=f(s);function s(t){var n;if(e(this,s),(n=r.call(this,t)).polling=!1,"undefined"!=typeof location){var o="https:"===location.protocol,i=location.port;i||(i=o?"443":"80"),n.xd="undefined"!=typeof location&&t.hostname!==location.hostname||i!==t.port,n.xs=t.secure!==o}var a=t&&t.forceBase64;return n.supportsBinary=Q&&!a,n}return n(s,[{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var r=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",(function(){--n||r()}))),this.writable||(n++,this.once("drain",(function(){--n||r()})))}else r()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var r=t.split(B),n=[],o=0;o<r.length;o++){var i=O(r[o],e);if(n.push(i),"error"===i.type)break}return n})(t,this.socket.binaryType).forEach((function(t){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose({description:"transport closed by the server"}),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this,e=function(){t.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,function(t,e){var r=t.length,n=new Array(r),o=0;t.forEach((function(t,i){k(t,!1,(function(t){n[i]=t,++o===r&&e(n.join(B))}))}))}(t,(function(t){e.doWrite(t,(function(){e.writable=!0,e.emitReserved("drain")}))}))}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",r="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=X()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);var n=$(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new Z(this.uri(),t)}},{key:"doWrite",value:function(t,e){var r=this,n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",(function(t,e){r.onError("xhr post error",t,e)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e,r){t.onError("xhr poll error",e,r)})),this.pollXhr=e}},{key:"name",get:function(){return"polling"}}]),s}(F),Z=function(t){i(o,t);var r=f(o);function o(t,n){var i;return e(this,o),_(h(i=r.call(this)),n),i.opts=n,i.method=n.method||"GET",i.uri=t,i.async=!1!==n.async,i.data=void 0!==n.data?n.data:null,i.create(),i}return n(o,[{key:"create",value:function(){var t=this,e=q(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var r=this.xhr=new J(e);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var n in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?t.onLoad():t.setTimeoutFn((function(){t.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(e){return void this.setTimeoutFn((function(){t.onError(e)}),0)}"undefined"!=typeof document&&(this.index=o.requestsCount++,o.requests[this.index]=this)}},{key:"onError",value:function(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=K,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete o.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}},{key:"abort",value:function(){this.cleanup()}}]),o}(C);if(Z.requestsCount=0,Z.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",tt);else if("function"==typeof addEventListener){addEventListener("onpagehide"in L?"pagehide":"unload",tt,!1)}function tt(){for(var t in Z.requests)Z.requests.hasOwnProperty(t)&&Z.requests[t].abort()}var et="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},rt=L.WebSocket||L.MozWebSocket,nt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),ot=function(t){i(o,t);var r=f(o);function o(t){var n;return e(this,o),(n=r.call(this,t)).supportsBinary=!t.forceBase64,n}return n(o,[{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,r=nt?{}:q(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=nt?new rt(t,e,r):e?new rt(t,e):new rt(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=function(e){return t.onClose({description:"websocket connection closed",context:e})},this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var r=function(r){var n=t[r],o=r===t.length-1;k(n,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}o&&et((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))},n=0;n<t.length;n++)r(n)}},{key:"doClose",value:function(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",r="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=X()),this.supportsBinary||(t.b64=1);var n=$(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"check",value:function(){return!!rt}},{key:"name",get:function(){return"websocket"}}]),o}(F),it={websocket:ot,polling:Y},st=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,at=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ut(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o,i,s=st.exec(t||""),a={},u=14;u--;)a[at[u]]=s[u]||"";return-1!=r&&-1!=n&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,a.path),a.queryKey=(o=a.query,i={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(i[e]=r)})),i),a}var ct=function(r){i(a,r);var s=f(a);function a(r){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),n=s.call(this),r&&"object"===t(r)&&(i=r,r=null),r?(r=ut(r),i.hostname=r.host,i.secure="https"===r.protocol||"wss"===r.protocol,i.port=r.port,r.query&&(i.query=r.query)):i.host&&(i.hostname=ut(i.host).host),_(h(n),i),n.secure=null!=i.secure?i.secure:"undefined"!=typeof location&&"https:"===location.protocol,i.hostname&&!i.port&&(i.port=n.secure?"443":"80"),n.hostname=i.hostname||("undefined"!=typeof location?location.hostname:"localhost"),n.port=i.port||("undefined"!=typeof location&&location.port?location.port:n.secure?"443":"80"),n.transports=i.transports||["polling","websocket"],n.readyState="",n.writeBuffer=[],n.prevBufferLen=0,n.opts=o({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},i),n.opts.path=n.opts.path.replace(/\/$/,"")+"/","string"==typeof n.opts.query&&(n.opts.query=z(n.opts.query)),n.id=null,n.upgrades=null,n.pingInterval=null,n.pingTimeout=null,n.pingTimeoutTimer=null,"function"==typeof addEventListener&&(n.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){n.transport&&(n.transport.removeAllListeners(),n.transport.close())}),!1),"localhost"!==n.hostname&&(n.offlineEventListener=function(){n.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",n.offlineEventListener,!1))),n.open(),n}return n(a,[{key:"createTransport",value:function(t){var e=o({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var r=o({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new it[t](r)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(t){return e.onClose("transport close",t)}))}},{key:"probe",value:function(t){var e=this,r=this.createTransport(t),n=!1;a.priorWebsocketSuccess=!1;var o=function(){n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",r),!r)return;a.priorWebsocketSuccess="websocket"===r.name,e.transport.pause((function(){n||"closed"!==e.readyState&&(h(),e.setTransport(r),r.send([{type:"upgrade"}]),e.emitReserved("upgrade",r),r=null,e.upgrading=!1,e.flush())}))}else{var o=new Error("probe error");o.transport=r.name,e.emitReserved("upgradeError",o)}})))};function i(){n||(n=!0,h(),r.close(),r=null)}var s=function(t){var n=new Error("probe error: "+t);n.transport=r.name,i(),e.emitReserved("upgradeError",n)};function u(){s("transport closed")}function c(){s("socket closed")}function p(t){r&&t.name!==r.name&&i()}var h=function(){r.removeListener("open",o),r.removeListener("error",s),r.removeListener("close",u),e.off("close",c),e.off("upgrading",p)};r.once("open",o),r.once("error",s),r.once("close",u),this.once("close",c),this.once("upgrading",p),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}},{key:"onHandshake",value:function(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((function(){t.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}},{key:"flush",value:function(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){var t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}},{key:"getWritablePackets",value:function(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;for(var t,e=1,r=0;r<this.writeBuffer.length;r++){var n=this.writeBuffer[r].data;if(n&&(e+="string"==typeof(t=n)?function(t){for(var e=0,r=0,n=0,o=t.length;n<o;n++)(e=t.charCodeAt(n))<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}(t):Math.ceil(1.33*(t.byteLength||t.size))),r>0&&e>this.maxPayload)return this.writeBuffer.slice(0,r);e+=2}return this.writeBuffer}},{key:"write",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"send",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"sendPacket",value:function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},r=function r(){t.off("upgrade",r),t.off("upgradeError",r),e()},n=function(){t.once("upgrade",r),t.once("upgradeError",r)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?n():e()})):this.upgrading?n():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}]),a}(C);ct.protocol=4;return function(t,e){return new ct(t,e)}}));
18117
18123
  //# sourceMappingURL=engine.io.min.js.map
18118
18124
  ;
18119
18125
  function BindingHelper(handlerContext) {
@@ -18215,7 +18221,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18215
18221
  var merge = require('utils/merge');
18216
18222
 
18217
18223
  require('utils/events'); // events
18218
-
18224
+
18219
18225
  /**
18220
18226
  * Gina Link Handler
18221
18227
  *
@@ -18265,7 +18271,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18265
18271
 
18266
18272
  // XML Request
18267
18273
  var xhr = null;
18268
-
18274
+
18269
18275
  /**
18270
18276
  * XML Request options
18271
18277
  * */
@@ -18283,7 +18289,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18283
18289
 
18284
18290
  var registeredLinks = [];
18285
18291
 
18286
-
18292
+
18287
18293
 
18288
18294
  var proxyClick = function($childNode, $el, evt) {
18289
18295
 
@@ -18293,25 +18299,25 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18293
18299
  triggerEvent(gina, $el, evt);
18294
18300
  });
18295
18301
  }
18296
-
18297
- var getLinkById = function(id) {
18302
+
18303
+ var getLinkById = function(id) {
18298
18304
  return ( typeof(instance.$links[id]) != 'undefined' ) ? instance.$links[id] : null;
18299
18305
  }
18300
-
18306
+
18301
18307
  var getLinkByUrl = function(url) {
18302
18308
  var $link = null;
18303
-
18309
+
18304
18310
  for (var p in gina.link.$links) {
18305
18311
  if ( typeof(gina.link.$links[p].url) != 'undefined' && gina.link.$links[p].url == url ) {
18306
18312
  $link = gina.link.$links[p];
18307
18313
  break;
18308
18314
  }
18309
18315
  }
18310
-
18316
+
18311
18317
  return $link;
18312
18318
  }
18313
-
18314
-
18319
+
18320
+
18315
18321
 
18316
18322
  /**
18317
18323
  * linkRequest
@@ -18324,12 +18330,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18324
18330
  // link object
18325
18331
  var $link = getLinkByUrl(url);
18326
18332
  var id = $link.id;
18327
-
18328
-
18333
+
18334
+
18329
18335
  // link element
18330
18336
  var $el = document.getElementById(id) || null;
18331
-
18332
- var hLinkIsRequired = null;
18337
+
18338
+ var hLinkIsRequired = null;
18333
18339
  // forward callback to HTML data event attribute through `hform` status
18334
18340
  hLinkIsRequired = ( $el.getAttribute('data-gina-link-event-on-success') || $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
18335
18341
  // success -> data-gina-form-event-on-submit-success
@@ -18351,20 +18357,23 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18351
18357
  } else {
18352
18358
  options = merge(options, xhrOptions);
18353
18359
  }
18354
-
18360
+
18355
18361
  if ( /^(http|https)\:/.test(url) && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url) ) {
18356
18362
  // is request from same domain ?
18357
18363
  //options.headers['Origin'] = window.protocol+'//'+window.location.host;
18358
18364
  //options.headers['Origin'] = '*';
18359
18365
  //options.headers['Host'] = 'https://freelancer-app.fr.local:3154';
18360
18366
  var isSameDomain = ( new RegExp(window.location.hostname).test(url) ) ? true : false;
18367
+ if (gina.config.envIsDev) {
18368
+ console.debug('Checking CORS from Link plugin...\TODO - local CORS Proxy');
18369
+ }
18361
18370
  if (!isSameDomain) {
18362
18371
  // proxy external urls
18363
18372
  // TODO - instead of using `cors.io`, try to intégrate a local CORS proxy similar to : http://oskarhane.com/avoid-cors-with-nginx-proxy_pass/
18364
18373
  //url = url.match(/^(https|http)\:/)[0] + '//cors.io/?' + url;
18365
18374
  url = url.match(/^(https|http)\:/)[0] + '//corsacme.herokuapp.com/?'+ url;
18366
18375
  //delete options.headers['X-Requested-With']
18367
- }
18376
+ }
18368
18377
  }
18369
18378
  options.url = url;
18370
18379
  // updating link options
@@ -18372,7 +18381,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18372
18381
  options = merge($link.options, options);
18373
18382
 
18374
18383
 
18375
- if ( options.withCredentials ) { // Preflighted requests
18384
+ if ( options.withCredentials ) { // Preflighted requests
18376
18385
  if ('withCredentials' in xhr) {
18377
18386
  // XHR for Chrome/Firefox/Opera/Safari.
18378
18387
  if (options.isSynchrone) {
@@ -18391,7 +18400,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18391
18400
  triggerEvent(gina, $el, 'error.' + id, result)
18392
18401
  }
18393
18402
  } else { // simple requests
18394
-
18403
+
18395
18404
  if (options.isSynchrone) {
18396
18405
  xhr.open(options.method, options.url, options.isSynchrone)
18397
18406
  } else {
@@ -18399,12 +18408,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18399
18408
  }
18400
18409
  }
18401
18410
 
18402
-
18411
+
18403
18412
 
18404
18413
  if (!xhr)
18405
18414
  throw new Error('No `xhr` object initiated');
18406
-
18407
-
18415
+
18416
+
18408
18417
  options.$link = $link;
18409
18418
  //xhr = handleXhr(xhr, $el, options);
18410
18419
  handleXhr(xhr, $el, options, require);
@@ -18413,18 +18422,18 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18413
18422
  }
18414
18423
 
18415
18424
  // var listenToXhrEvents = function($link) {
18416
-
18425
+
18417
18426
  // //data-gina-link-event-on-success
18418
18427
  // var htmlSuccesEventCallback = $link.target.getAttribute('data-gina-link-event-on-success') || null;
18419
18428
  // if (htmlSuccesEventCallback != null) {
18420
-
18429
+
18421
18430
  // if ( /\((.*)\)/.test(htmlSuccesEventCallback) ) {
18422
18431
  // eval(htmlSuccesEventCallback)
18423
18432
  // } else {
18424
18433
  // $link.on('success.hlink', window[htmlSuccesEventCallback])
18425
18434
  // }
18426
18435
  // }
18427
-
18436
+
18428
18437
  // //data-gina-link-event-on-error
18429
18438
  // var htmlErrorEventCallback = $link.target.getAttribute('data-gina-link-event-on-error') || null;
18430
18439
  // if (htmlErrorEventCallback != null) {
@@ -18435,53 +18444,53 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18435
18444
  // }
18436
18445
  // }
18437
18446
  // }
18438
-
18439
-
18440
18447
 
18441
-
18448
+
18449
+
18450
+
18442
18451
  function registerLink($link, options) {
18443
-
18452
+
18444
18453
  if ( typeof(options) != 'object' ) {
18445
18454
  throw new Error('`options` must be an object')
18446
18455
  }
18447
-
18448
- $link.options = merge(options, self.options);
18449
-
18456
+
18457
+ $link.options = merge(options, self.options);
18458
+
18450
18459
  // link element
18451
18460
  var id = $link.id;
18452
18461
  var $el = document.getElementById(id) || null;
18453
-
18454
- if ( typeof(instance.$links[$link.id]) == 'undefined' ) {
18455
18462
 
18456
-
18463
+ if ( typeof(instance.$links[$link.id]) == 'undefined' ) {
18464
+
18465
+
18457
18466
 
18458
18467
  if ( registeredLinks.indexOf($link.id) > -1 ) {
18459
18468
  throw new Error('`link '+$link.id+'` already exists !')
18460
18469
  }
18461
-
18462
-
18470
+
18471
+
18463
18472
  if (!gina.events[evt]) {
18464
-
18465
-
18466
-
18473
+
18474
+
18475
+
18467
18476
  // attach click events
18468
18477
  addListener(gina, $el, evt, function(e) {
18469
18478
  cancelEvent(e);
18470
18479
 
18471
18480
  var $localLink = getLinkById(e.target.id)
18472
- // loading & binding link
18481
+ // loading & binding link
18473
18482
  var localUrl = $localLink.url;
18474
18483
 
18475
- // Non-Preflighted requests
18484
+ // Non-Preflighted requests
18476
18485
  if ( typeof($localLink.options.isSynchrone) == 'undefined' ) {
18477
18486
  $localLink.options.isSynchrone = false;
18478
18487
  }
18479
18488
  if ( typeof($localLink.options.withCredentials) == 'undefined' ) {
18480
18489
  $localLink.options.withCredentials = false
18481
18490
  }
18482
-
18483
- linkRequest(localUrl, $localLink.options);
18484
-
18491
+
18492
+ linkRequest(localUrl, $localLink.options);
18493
+
18485
18494
  //delete gina.events[ $localLink.id ];
18486
18495
  //removeListener(gina, event.target, event.type)
18487
18496
  });
@@ -18499,21 +18508,21 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18499
18508
  }
18500
18509
  }
18501
18510
  }
18502
-
18503
-
18504
18511
 
18505
-
18512
+
18513
+
18514
+
18506
18515
  $link.request = linkRequest;
18507
18516
  $link.getLinkById = getLinkById;
18508
18517
  $link.getLinkByUrl = getLinkByUrl;
18509
-
18518
+
18510
18519
  instance.$links[$link.id] = $link;
18511
-
18512
-
18513
-
18520
+
18521
+
18522
+
18514
18523
  }
18515
18524
  }
18516
-
18525
+
18517
18526
  /**
18518
18527
  * bindLinks
18519
18528
  *
@@ -18521,13 +18530,13 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18521
18530
  * @param {object} [options]
18522
18531
  * */
18523
18532
  var bindLinks = function($target, options) {
18524
-
18533
+
18525
18534
  var id = null;
18526
18535
  if ( typeof($target) == 'undefined' ) {
18527
18536
  $target = instance.target;
18528
18537
  id = instance.id;
18529
18538
  }
18530
-
18539
+
18531
18540
  // binding form elements
18532
18541
  var found = null
18533
18542
  , $el = null
@@ -18542,45 +18551,45 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18542
18551
  // buttons
18543
18552
  //, $button = $target.getElementsByTagName('button')
18544
18553
  ;
18545
-
18546
- var i = 0, len = $a.length;
18554
+
18555
+ var i = 0, len = $a.length;
18547
18556
  for (; i < len; ++i) {
18548
18557
  found = $a[i].getAttribute('data-gina-link');
18549
-
18558
+
18550
18559
  if (!found) continue;
18551
-
18560
+
18552
18561
  $el = $a[i];
18553
18562
  props = {
18554
18563
  type: 'a',
18555
18564
  method: 'GET'
18556
18565
  };
18557
-
18558
-
18566
+
18567
+
18559
18568
  url = $el.getAttribute('data-gina-link-url');
18560
18569
  if ( typeof(url) != 'undefined' && url != null ) {
18561
18570
  props.url = url
18562
18571
  } else {
18563
18572
  props.url = $el.getAttribute('href')
18564
18573
  }
18565
-
18566
-
18567
-
18568
-
18574
+
18575
+
18576
+
18577
+
18569
18578
  elId = $el.getAttribute('id');
18570
18579
  if ( typeof(elId) == 'undefined' || elId == null || elId == '' || /popin\.link/.test(elId) ) {
18571
-
18580
+
18572
18581
  // unbind popin link
18573
18582
  // if ( /popin\.link/.test(elId) ) {
18574
-
18583
+
18575
18584
  // }
18576
-
18585
+
18577
18586
  elId = 'link.click.'+ 'gina-link-' + instance.id +'-'+ uuid.v4();
18578
- }
18587
+ }
18579
18588
  $el['id'] = elId;
18580
18589
  props.id = elId;
18581
18590
  evt = elId;
18582
18591
  $el.setAttribute('id', evt);
18583
-
18592
+
18584
18593
  if ($el.tagName == 'A') {
18585
18594
  onclickAttribute = $el.getAttribute('onclick');
18586
18595
  }
@@ -18595,25 +18604,25 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18595
18604
  }
18596
18605
  $el.setAttribute('onclick', onclickAttribute);
18597
18606
  }
18598
-
18607
+
18599
18608
  $newLink = null;
18600
-
18601
- if ( typeof(instance.$links[props.id]) == 'undefined' ) {
18602
- props.target = $el;
18603
- $newLink = merge(props, $link);
18609
+
18610
+ if ( typeof(instance.$links[props.id]) == 'undefined' ) {
18611
+ props.target = $el;
18612
+ $newLink = merge(props, $link);
18604
18613
  registerLink($newLink, options);
18605
18614
  }
18606
-
18607
-
18615
+
18616
+
18608
18617
  }
18609
-
18618
+
18610
18619
  }
18611
18620
 
18612
18621
  var init = function(options) {
18613
-
18622
+
18614
18623
  setupInstanceProto();
18615
18624
  instance.on('init', function(event) {
18616
-
18625
+
18617
18626
  // setting up AJAX
18618
18627
  if (window.XMLHttpRequest) { // Mozilla, Safari, ...
18619
18628
  xhr = new XMLHttpRequest();
@@ -18626,8 +18635,8 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18626
18635
  }
18627
18636
  catch (e) {}
18628
18637
  }
18629
- }
18630
-
18638
+ }
18639
+
18631
18640
  // proxies
18632
18641
  // click on main document
18633
18642
  evt = 'click';// click proxy
@@ -18639,7 +18648,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18639
18648
  event.target.id = event.target.getAttribute('id')
18640
18649
  }
18641
18650
 
18642
-
18651
+
18643
18652
 
18644
18653
  if ( /^link\.click\./.test(event.target.id) ) {
18645
18654
  cancelEvent(event);
@@ -18650,12 +18659,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18650
18659
 
18651
18660
  }
18652
18661
  });
18653
-
18662
+
18654
18663
  if ( typeof(options) == 'undefined' ) {
18655
18664
  options = {}
18656
18665
  }
18657
18666
  instance.options = options;
18658
-
18667
+
18659
18668
  bindLinks(instance.target, options);
18660
18669
  gina.linkIsBinded = true;
18661
18670
 
@@ -18666,14 +18675,14 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18666
18675
  triggerEvent(gina, instance.target, 'ready.' + instance.id, instance);
18667
18676
  });
18668
18677
 
18669
-
18670
-
18678
+
18679
+
18671
18680
 
18672
18681
  instance.initialized = true;
18673
18682
 
18674
18683
  return instance
18675
18684
  }
18676
-
18685
+
18677
18686
  var setupInstanceProto = function() {
18678
18687
 
18679
18688
  instance.bindLinks = bindLinks;
@@ -18681,7 +18690,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18681
18690
  instance.getLinkById = getLinkById;
18682
18691
  instance.getLinkByUrl = getLinkByUrl;
18683
18692
  }
18684
-
18693
+
18685
18694
  return init(options)
18686
18695
  };
18687
18696
 
@@ -18725,7 +18734,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18725
18734
  eventData : {},
18726
18735
 
18727
18736
  '$popins' : {},
18728
- activePopinId : null,
18737
+ activePopinId : null,
18729
18738
  getActivePopin : null, // returns the active $popin
18730
18739
  target : document, // by default
18731
18740
  isReady : false,
@@ -18795,7 +18804,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18795
18804
  gina.popinContainer = instance.id;
18796
18805
  //gina.hasPopinHandler = true;
18797
18806
  }
18798
-
18807
+
18799
18808
  var popinGetContainer = function () {
18800
18809
  instance.target = document.getElementById(gina.popinContainer);
18801
18810
  instance.on = on;
@@ -18809,51 +18818,51 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18809
18818
  triggerEvent(gina, $el, evt);
18810
18819
  });
18811
18820
  }
18812
-
18813
- var getPopinById = function(id) {
18821
+
18822
+ var getPopinById = function(id) {
18814
18823
  return ( typeof(instance.$popins[id]) != 'undefined' ) ? instance.$popins[id] : null;
18815
18824
  }
18816
-
18825
+
18817
18826
  var getPopinByName = function(name) {
18818
-
18827
+
18819
18828
  var $popin = null;
18820
-
18829
+
18821
18830
  for (var p in instance.$popins) {
18822
18831
  if ( instance.$popins[p].name === name ) {
18823
18832
  $popin = instance.$popins[p];
18824
18833
  break;
18825
18834
  }
18826
18835
  }
18827
-
18836
+
18828
18837
  return $popin;
18829
- }
18830
-
18831
- function getActivePopin() {
18838
+ }
18839
+
18840
+ function getActivePopin() {
18832
18841
  var $popin = null;
18833
-
18842
+
18834
18843
  for (var p in gina.popin.$popins) {
18835
18844
  if ( typeof(gina.popin.$popins[p].isOpen) != 'undefined' && gina.popin.$popins[p].isOpen ) {
18836
18845
  $popin = gina.popin.$popins[p];
18837
18846
  break;
18838
18847
  }
18839
18848
  }
18840
-
18849
+
18841
18850
  if (!$popin && gina.popin.activePopinId) {
18842
18851
  $popin = gina.popin.$popins[gina.popin.activePopinId]
18843
18852
  }
18844
-
18853
+
18845
18854
  return $popin;
18846
- }
18847
-
18855
+ }
18856
+
18848
18857
 
18849
18858
  var bindOpen = function($popin, isRouting) {
18850
-
18859
+
18851
18860
  isRouting = ( typeof(isRouting) != 'undefined' ) ? isRouting : false;
18852
-
18861
+
18853
18862
  var attr = 'data-gina-popin-name';
18854
18863
  var $els = getElementsByAttribute(attr);
18855
18864
  var $el = null, name = null;
18856
- var url = null;
18865
+ var url = null;
18857
18866
  var proceed = null, evt = null;
18858
18867
  var i = null, len = null;
18859
18868
 
@@ -18888,9 +18897,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18888
18897
  evt = 'popin.click.'+ 'gina-popin-' + instance.id +'-'+ uuid.v4() +'-'+ name;
18889
18898
  $el['id'] = evt;
18890
18899
  $el.setAttribute( 'id', evt);
18891
-
18900
+
18892
18901
  if (!gina.events[evt]) {
18893
-
18902
+
18894
18903
  // attach click events
18895
18904
  addListener(gina, $el, evt, function(e) {
18896
18905
  cancelEvent(e);
@@ -18904,19 +18913,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18904
18913
  console.debug('active popin should be ', $popin.id);
18905
18914
  gina.popin.activePopinId = $popin.id;
18906
18915
  popinBind(e, $popin);
18907
- if (!$popin.isOpen) {
18916
+ if (!$popin.isOpen) {
18908
18917
  popinOpen($popin.name);
18909
- }
18918
+ }
18910
18919
  }
18911
18920
  });
18912
18921
 
18913
- // loading & binding popin
18922
+ // loading & binding popin
18914
18923
  // Non-Preflighted requests
18915
- var options = {
18924
+ var options = {
18916
18925
  isSynchrone: false,
18917
18926
  withCredentials: false // by default
18918
- };
18919
- options = merge($popin.options, options);
18927
+ };
18928
+ options = merge($popin.options, options);
18920
18929
  var url = this.getAttribute('data-gina-popin-url') || this.getAttribute('href');
18921
18930
  if (!url) {
18922
18931
  throw new Error('Popin `url` not defined, please check value for `data-gina-popin-url`');
@@ -18946,7 +18955,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18946
18955
  evt = 'click';// click proxy
18947
18956
  // for proxies, use popinInstance.id as target is always `document`
18948
18957
  addListener(gina, document, evt, function(event) {
18949
-
18958
+
18950
18959
  if ( event.target.getAttribute('disabled') != null && event.target.getAttribute('disabled') != 'false' ) {
18951
18960
  return false;
18952
18961
  }
@@ -18966,7 +18975,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18966
18975
  if ( /^popin\.click\./.test(event.target.id) ) {
18967
18976
  cancelEvent(event);
18968
18977
  //console.log('popin.click !! ', event.target);
18969
- var _evt = event.target.id;
18978
+ var _evt = event.target.id;
18970
18979
 
18971
18980
  if ( new RegExp( '^popin.click.gina-popin-' + instance.id).test(_evt) )
18972
18981
  triggerEvent(gina, event.target, _evt, event.detail);
@@ -18975,21 +18984,21 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18975
18984
 
18976
18985
  gina.popinIsBinded = false
18977
18986
  }
18978
-
18979
-
18987
+
18988
+
18980
18989
  function popinBind(e, $popin) {
18981
-
18990
+
18982
18991
  var $el = e.target;
18983
18992
  var eventType = e.type;
18984
-
18985
- if (
18986
- typeof(e.detail) != 'undefined'
18987
- && typeof(e.detail.trim) == 'function'
18993
+
18994
+ if (
18995
+ typeof(e.detail) != 'undefined'
18996
+ && typeof(e.detail.trim) == 'function'
18988
18997
  ) {
18989
18998
  $el.innerHTML = e.detail.trim();
18990
18999
  }
18991
-
18992
-
19000
+
19001
+
18993
19002
  var register = function (type, evt, $element) {
18994
19003
  var isLink = $element.getAttribute('data-gina-popin-is-link');
18995
19004
  isLink = ( /^true$/i.test(isLink) ) ? true : false;
@@ -19001,37 +19010,37 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19001
19010
  addListener(gina, $element, evt, function(event) {
19002
19011
 
19003
19012
  cancelEvent(event);
19004
-
19013
+
19005
19014
  if (type != 'close') {
19006
-
19015
+
19007
19016
  var fired = false;
19008
19017
  var _evt = 'loaded.' + $popin.id;
19009
-
19018
+
19010
19019
  if ( typeof(gina.events[_evt]) == 'undefined' ) {
19011
19020
  addListener(gina, $el, _evt, function(e) {
19012
-
19021
+
19013
19022
  e.preventDefault();
19014
19023
 
19015
19024
  if (!fired) {
19016
- fired = true;
19017
- popinLoadContent(e.detail);
19025
+ fired = true;
19026
+ popinLoadContent(e.detail);
19018
19027
  }
19019
19028
  });
19020
19029
  }
19021
-
19030
+
19022
19031
  // Non-Preflighted requests
19023
- var options = {
19032
+ var options = {
19024
19033
  isSynchrone: false,
19025
19034
  withCredentials: false
19026
19035
  };
19027
- //options = merge(options, $popin.options);
19028
- options = merge($popin.options, options);
19036
+ //options = merge(options, $popin.options);
19037
+ options = merge($popin.options, options);
19029
19038
  popinLoad($popin.name, $element.href, options);
19030
- }
19031
-
19039
+ }
19040
+
19032
19041
  removeListener(gina, event.target, event.type)
19033
19042
  });
19034
-
19043
+
19035
19044
  addListener(gina, $element, 'click', function(event) {
19036
19045
  cancelEvent(event);
19037
19046
  // ignore disabled
@@ -19040,58 +19049,59 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19040
19049
  }
19041
19050
  // NB.: `type == 'action'` will be handled by the form validator
19042
19051
  if ( type == 'link' ) {
19043
- //console.debug('This is a link', event.target);
19052
+ var linkHref = event.target.getAttribute('href') || null;
19053
+ // console.debug('This is a link', event.target);
19044
19054
  var linkTarget = event.target.getAttribute('target');
19045
- if ( linkTarget != null && linkTarget != '' ) {
19046
- var _window = window.open(linkHref, event.target.getAttribute('target'));
19055
+ if ( linkTarget != null && linkTarget != '' ) {
19056
+ var _window = window.open(linkHref, linkTarget);
19047
19057
  // _window.onload = function onWindowLoad() {
19048
- // var $popin = getActivePopin();
19058
+ // var $popin = getActivePopin();
19049
19059
  // triggerEvent(gina, $popin, 'loaded.' + id);
19050
19060
  // }
19051
19061
  } else { // else, inside viewbox
19052
- // TODO - Integrate https://github.com/box/viewer.js#loading-a-simple-viewer
19062
+ // TODO - Integrate https://github.com/box/viewer.js#loading-a-simple-viewer
19053
19063
  triggerEvent(gina, event.target, event.currentTarget.id, $popin);
19054
19064
  }
19055
-
19065
+
19056
19066
  } /**else if ( type == 'action' ) {
19057
19067
  // rewrite form attributes
19058
19068
  //console.debug('This is an action ', event.target);
19059
19069
  }*/ else { // close
19060
-
19070
+
19061
19071
  if ( typeof(event.target.id) == 'undefined' ) {
19062
19072
  event.target.setAttribute('id', evt +'.'+ uuid.v4() );
19063
19073
  event.target.id = event.target.getAttribute('id')
19064
19074
  }
19065
-
19075
+
19066
19076
  if ( /^popin\.close\./.test(event.target.id) ) {
19067
19077
  cancelEvent(event);
19068
19078
  // Just in case we left the popin with a link:target = _blank
19069
19079
  $popin.isRedirecting = false;
19070
19080
  popinClose($popin.name);
19071
19081
  }
19072
-
19082
+
19073
19083
  if ( /^popin\.click\./.test(event.target.id) ) {
19074
19084
  cancelEvent(event);
19075
19085
  var _evt = event.target.id;
19076
-
19086
+
19077
19087
  if ( new RegExp( '^popin.click.gina-popin-' + instance.id).test(_evt) )
19078
19088
  triggerEvent(gina, event.target, _evt, event.detail);
19079
-
19089
+
19080
19090
  }
19081
- }
19091
+ }
19082
19092
  });
19083
-
19093
+
19084
19094
  };
19085
-
19095
+
19086
19096
  gina.popinIsBinded = true;
19087
-
19097
+
19088
19098
  var i = null
19089
19099
  , b = null
19090
19100
  , len = null
19091
19101
  ;
19092
19102
  // bind overlay on click
19093
- if (!$popin.isOpen) {
19094
-
19103
+ if (!$popin.isOpen) {
19104
+
19095
19105
  var $overlay = instance.target.childNodes[0];
19096
19106
  addListener(gina, $overlay, 'mousedown', function(event) {
19097
19107
 
@@ -19100,13 +19110,13 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19100
19110
 
19101
19111
  // remove listeners
19102
19112
  removeListener(gina, event.target, 'mousedown');
19103
-
19113
+
19104
19114
  // binding popin close
19105
19115
  var $close = []
19106
- , $buttonsTMP = []
19116
+ , $buttonsTMP = []
19107
19117
  ;
19108
-
19109
- i = 0;
19118
+
19119
+ i = 0;
19110
19120
  $buttonsTMP = $el.getElementsByTagName('button');
19111
19121
  b = 0; len = $buttonsTMP.length;
19112
19122
  if ( len > 0 ) {
@@ -19114,10 +19124,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19114
19124
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19115
19125
  $close[i] = $buttonsTMP[b];
19116
19126
  ++i;
19117
- }
19127
+ }
19118
19128
  }
19119
19129
  }
19120
-
19130
+
19121
19131
  $buttonsTMP = $el.getElementsByTagName('div');
19122
19132
  b = 0; len = $buttonsTMP.length;
19123
19133
  if ( len > 0 ) {
@@ -19125,10 +19135,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19125
19135
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19126
19136
  $close[i] = $buttonsTMP[b];
19127
19137
  ++i
19128
- }
19138
+ }
19129
19139
  }
19130
19140
  }
19131
-
19141
+
19132
19142
  $buttonsTMP = $el.getElementsByTagName('a');
19133
19143
  b = 0; len = $buttonsTMP.length;
19134
19144
  if ( len > 0 ) {
@@ -19136,10 +19146,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19136
19146
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19137
19147
  $close[i] = $buttonsTMP[b];
19138
19148
  ++i
19139
- }
19149
+ }
19140
19150
  }
19141
19151
  }
19142
-
19152
+
19143
19153
  b = 0; len = $close.length;
19144
19154
  for (; b < len; ++b) {
19145
19155
  let $el = $close[b];
@@ -19149,23 +19159,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19149
19159
  if ( typeof(gina.events[ evt ]) != 'undefined' && gina.events[ evt ] == eId ) {
19150
19160
  removeListener(gina, $el, evt);
19151
19161
  }
19152
- if ( typeof(gina.events[ eId ]) != 'undefined' && gina.events[ eId ] == eId ) {
19162
+ if ( typeof(gina.events[ eId ]) != 'undefined' && gina.events[ eId ] == eId ) {
19153
19163
  removeListener(gina, $el, eId);
19154
19164
  }
19155
-
19165
+
19156
19166
  if ( typeof(gina.events[ evt +'.'+ eId ]) != 'undefined' && gina.events[ evt +'.'+ eId ] == eId ) {
19157
19167
  removeListener(gina, $el, evt +'.'+ eId);
19158
19168
  }
19159
-
19169
+
19160
19170
  if ( typeof(gina.events[ evt +'.'+ eId ]) != 'undefined' && gina.events[ evt +'.'+ eId ] == evt +'.'+ eId ) {
19161
19171
  removeListener(gina, $el, evt +'.'+ eId);
19162
19172
  }
19163
19173
  }
19164
-
19165
-
19174
+
19175
+
19166
19176
  //removeListener(gina, $close[b], $close[b].getAttribute('id') );
19167
19177
  }
19168
-
19178
+
19169
19179
  // div with click
19170
19180
  // var $elTMP = $form.target.getElementsByTagName('div');
19171
19181
  // if ( $elTMP.length > 0 ) {
@@ -19180,19 +19190,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19180
19190
  // $els.push( $elTMP[i] )
19181
19191
  // }
19182
19192
  // }
19183
-
19193
+
19184
19194
  // Just in case we left the popin with a link:target = _blank
19185
19195
  $popin.isRedirecting = false;
19186
19196
  popinClose($popin.name);
19187
19197
  }
19188
-
19198
+
19189
19199
  });
19190
19200
  }
19191
19201
  // detecting form in popin
19192
19202
  if ( /<form/i.test($el.innerHTML) && typeof($validatorInstance) != 'undefined' && $validatorInstance ) {
19193
19203
  $popin.hasForm = true;
19194
19204
  }
19195
-
19205
+
19196
19206
  // binding popin close & links (& its target attributes)
19197
19207
  var $close = []
19198
19208
  , $buttonsTMP = []
@@ -19206,7 +19216,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19206
19216
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19207
19217
  $close[i] = $buttonsTMP[b];
19208
19218
  ++i
19209
- }
19219
+ }
19210
19220
  }
19211
19221
  }
19212
19222
 
@@ -19217,7 +19227,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19217
19227
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19218
19228
  $close[i] = $buttonsTMP[b];
19219
19229
  ++i;
19220
- }
19230
+ }
19221
19231
  }
19222
19232
  }
19223
19233
 
@@ -19230,15 +19240,15 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19230
19240
  ++i;
19231
19241
  continue
19232
19242
  }
19233
-
19234
- if (
19235
- typeof($buttonsTMP[b]) != 'undefined'
19236
- && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19237
- // ignore href already bindded byr formValidator or the user
19243
+
19244
+ if (
19245
+ typeof($buttonsTMP[b]) != 'undefined'
19246
+ && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19247
+ // ignore href already bindded byr formValidator or the user
19238
19248
  && !$buttonsTMP[b].id
19239
19249
  ||
19240
19250
  typeof($buttonsTMP[b]) != 'undefined'
19241
- && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19251
+ && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19242
19252
  && !/^(click\.|popin\.link)/.test($buttonsTMP[b].id)
19243
19253
  ) {
19244
19254
  $link.push($buttonsTMP[b]);
@@ -19246,7 +19256,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19246
19256
  }
19247
19257
  }
19248
19258
  }
19249
-
19259
+
19250
19260
  var onclickAttribute = null, evt = null;
19251
19261
  // close events
19252
19262
  b = 0; len = $close.length;
@@ -19273,14 +19283,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19273
19283
 
19274
19284
  } else {
19275
19285
  evt = $close[b]['id'];
19276
- }
19286
+ }
19277
19287
 
19278
19288
 
19279
19289
  if ( typeof(gina.events[evt]) == 'undefined' || gina.events[evt] != $close[b].id ) {
19280
19290
  register('close', evt, $close[b])
19281
19291
  }
19282
19292
  }
19283
-
19293
+
19284
19294
  // link events
19285
19295
  i = 0; len = $link.length;
19286
19296
  var _form = null, f = null, fLen = null;
@@ -19292,16 +19302,16 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19292
19302
  , isSubmitLink = null
19293
19303
  , isLink = null
19294
19304
  ;
19295
-
19305
+
19296
19306
  for (; i < len; ++i) {
19297
19307
  // if is disabled, stop propagation
19298
19308
  if ( $link[i].getAttribute('disabled') != null ) {
19299
19309
  continue;
19300
19310
  }
19301
-
19302
- $link[i]['id'] = ( /^null$/i.test($link[i].getAttribute('id')) ) ? null : $link[i].getAttribute('id');
19311
+
19312
+ $link[i]['id'] = ( /^null$/i.test($link[i].getAttribute('id')) ) ? null : $link[i].getAttribute('id');
19303
19313
  if (!$link[i]['id'] || !/^popin\.link/.test($link[i]['id']) || !/^popin\.click/.test($link[i]['id']) ) {
19304
-
19314
+
19305
19315
  // just in case
19306
19316
  isLink = true;
19307
19317
  aHref = $link[i].getAttribute('href');
@@ -19310,7 +19320,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19310
19320
  $link[i].setAttribute('href', '#');
19311
19321
  isLink = false;
19312
19322
  }
19313
- // link or action ?
19323
+ // link or action ?
19314
19324
  if (/^null$/i.test($link[i]['id'])) {
19315
19325
  if ( isLink ) {
19316
19326
  evt = 'popin.link.' + uuid.v4();
@@ -19322,29 +19332,29 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19322
19332
  } else {
19323
19333
  evt = $link[i]['id'];
19324
19334
  }
19325
-
19326
- $link[i]['id'] = evt;
19335
+
19336
+ $link[i]['id'] = evt;
19327
19337
  $link[i].setAttribute( 'id', evt);
19328
-
19338
+
19329
19339
  } else {
19330
19340
  evt = $link[i]['id'];
19331
19341
  }
19332
-
19342
+
19333
19343
  // ignore `isSubmitLink == true`
19334
19344
  // will be handled by validator
19335
19345
  isSubmitLink = $link[i].getAttribute('data-gina-form-submit');
19336
- isSubmitLink = ( isSubmitLink && /^true$/i.test(isSubmitLink) ) ? true : false;
19346
+ isSubmitLink = ( isSubmitLink && /^true$/i.test(isSubmitLink) ) ? true : false;
19337
19347
  if (isSubmitLink) {
19338
19348
  continue;
19339
19349
  }
19340
-
19341
-
19350
+
19351
+
19342
19352
  if ( !/^(null|\s*)$/.test($link[i].getAttribute('href')) ) {
19343
19353
  addListener(gina, $link[i], 'click', function(linkEvent) {
19344
19354
  linkEvent.preventDefault();
19345
-
19355
+
19346
19356
  $popin.isRedirecting = true;
19347
-
19357
+
19348
19358
  if ($popin.hasForm) {
19349
19359
  // Experimental - inheritedData
19350
19360
  // Inhertitance from previously request: merging datas with current form context
@@ -19361,7 +19371,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19361
19371
  inheritedData = merge(inheritedData, JSON.parse(decodeURIComponent(_formData)));
19362
19372
  }
19363
19373
  }
19364
-
19374
+
19365
19375
  // has already params ?
19366
19376
  if ( inheritedData.count() > 0 ) {
19367
19377
  if ( /\?/.test(linkEvent.currentTarget.href) ) {
@@ -19369,7 +19379,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19369
19379
  } else {
19370
19380
  linkEvent.currentTarget.href += '?inheritedData=' + encodeURIComponent(JSON.stringify(inheritedData));
19371
19381
  }
19372
- }
19382
+ }
19373
19383
  }
19374
19384
  })
19375
19385
  }
@@ -19377,10 +19387,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19377
19387
  if ( typeof(gina.events[evt]) == 'undefined' || gina.events[evt] != $link[i].id ) {
19378
19388
  register('link', evt, $link[i])
19379
19389
  }
19380
-
19381
-
19382
- } // EO for(; i < len; ++i)
19383
-
19390
+
19391
+
19392
+ } // EO for(; i < len; ++i)
19393
+
19384
19394
  // bind with formValidator if forms are found
19385
19395
  if ($popin.hasForm) {
19386
19396
  var _id = null;
@@ -19407,22 +19417,22 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19407
19417
  removeListener(gina, $popin.target, eventType);
19408
19418
  }
19409
19419
  }
19410
-
19420
+
19411
19421
  }
19412
-
19422
+
19413
19423
  function updateToolbar(result, resultIsObject) {
19414
19424
  // update toolbar errors
19415
19425
  var $popin = getActivePopin();
19416
-
19426
+
19417
19427
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && typeof(result) != 'undefined' && typeof(resultIsObject) != 'undefined' && result ) {
19418
-
19428
+
19419
19429
  var XHRData = result;
19420
-
19421
- try {
19430
+
19431
+ try {
19422
19432
  var XHRDataNew = null;
19423
19433
  if ( !resultIsObject && XHRData.error && /^(\{|\[)/.test(XHRData.error) )
19424
19434
  XHRData.error = JSON.parse(XHRData.error);
19425
-
19435
+
19426
19436
  // bad .. should not happen
19427
19437
  if ( typeof(XHRData.error) != 'undefined' && typeof(XHRData.error) == 'object' && typeof(XHRData.error) == 'object' ) {
19428
19438
  // by default
@@ -19440,7 +19450,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19440
19450
  } else if ( typeof(XHRData.error) != 'undefined' && typeof(XHRData.error) == 'string' ) {
19441
19451
  XHRData = result;
19442
19452
  }
19443
-
19453
+
19444
19454
  XHRData.isXHRViewData = true;
19445
19455
  ginaToolbar.update('data-xhr', XHRData );
19446
19456
  return;
@@ -19448,7 +19458,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19448
19458
  throw err
19449
19459
  }
19450
19460
  }
19451
-
19461
+
19452
19462
  // update toolbar
19453
19463
  try {
19454
19464
  var $popin = getPopinById(instance.activePopinId);
@@ -19456,17 +19466,17 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19456
19466
  } catch (err) {
19457
19467
  ginaToolbar.update('data-xhr', err );
19458
19468
  }
19459
-
19460
-
19469
+
19470
+
19461
19471
  // XHRData
19462
- var XHRData = null;
19472
+ var XHRData = null;
19463
19473
  if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19464
19474
  // converting Element to DOM object
19465
- XHRData = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-data');
19475
+ XHRData = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-data');
19466
19476
  } else {
19467
19477
  XHRData = document.getElementById('gina-without-layout-xhr-data');
19468
19478
  }
19469
-
19479
+
19470
19480
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && XHRData ) {
19471
19481
  try {
19472
19482
 
@@ -19484,19 +19494,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19484
19494
 
19485
19495
  // XHRView
19486
19496
  var XHRView = null;
19487
- if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19497
+ if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19488
19498
  // converting Element to DOM object
19489
- XHRView = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-view');
19499
+ XHRView = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-view');
19490
19500
  } else {
19491
19501
  XHRView = document.getElementById('gina-without-layout-xhr-view');
19492
19502
  }
19493
-
19503
+
19494
19504
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && XHRView ) {
19495
19505
  try {
19496
19506
 
19497
19507
  if ( typeof(XHRView.value) != 'undefined' && XHRView.value ) {
19498
-
19499
- XHRView = JSON.parse( decodeURIComponent( XHRView.value ) );
19508
+
19509
+ XHRView = JSON.parse( decodeURIComponent( XHRView.value ) );
19500
19510
  // reset data-xhr
19501
19511
  //ginaToolbar.update("view-xhr", null);
19502
19512
  ginaToolbar.update('view-xhr', XHRView);
@@ -19548,12 +19558,12 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19548
19558
  // popin object
19549
19559
  var $popin = getPopinByName(name);
19550
19560
  var id = $popin.id;
19551
-
19561
+
19552
19562
  // set as active if none is active
19553
19563
  if ( !gina.popin.activePopinId ) {
19554
19564
  gina.popin.activePopinId = id;
19555
19565
  }
19556
-
19566
+
19557
19567
  // popin element
19558
19568
  var $el = document.getElementById(id) || null;
19559
19569
 
@@ -19572,28 +19582,31 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19572
19582
  // In order to inherit without overriding default xhrOptions
19573
19583
  var isWithCredentials = xhrOptions.withCredentials;
19574
19584
  options = merge(options, xhrOptions);
19575
-
19585
+
19576
19586
  options.withCredentials = isWithCredentials;
19577
19587
  }
19578
-
19579
- if (
19588
+
19589
+ if (
19580
19590
  /^(http|https)\:/.test(url)
19581
- && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url)
19591
+ && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url)
19582
19592
  ) {
19583
19593
  // is request from same domain ?
19584
19594
  //options.headers['Origin'] = window.protocol+'//'+window.location.host;
19585
19595
  //options.headers['Origin'] = '*';
19586
19596
  //options.headers['Host'] = 'https://domain.local:3154';
19587
19597
  var isSameDomain = ( new RegExp(window.location.hostname).test(url) ) ? true : false;
19598
+ if (gina.config.envIsDev) {
19599
+ console.debug('Checking CORS from Popin plugin...\TODO - local CORS Proxy');
19600
+ }
19588
19601
  if (!isSameDomain) {
19589
19602
  // proxy external urls
19590
19603
  // TODO - instead of using `cors.io` or similar services, try to intégrate a local CORS proxy similar to : http://oskarhane.com/avoid-cors-with-nginx-proxy_pass/
19591
19604
  //url = url.match(/^(https|http)\:/)[0] + '//cors.io/?' + url;
19592
19605
  url = url.match(/^(https|http)\:/)[0] + '//corsacme.herokuapp.com/?'+ url;
19593
19606
  //url = url.match(/^(https|http)\:/)[0] + '//cors-anywhere.herokuapp.com/' + url;
19594
-
19607
+
19595
19608
  //delete options.headers['X-Requested-With']
19596
-
19609
+
19597
19610
  // remove credentials on untrusted env
19598
19611
  // if forced by user options, it will be restored with $popin.options merge
19599
19612
  options.withCredentials = false;
@@ -19604,7 +19617,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19604
19617
  $popin.options = merge(options, $popin.options);
19605
19618
 
19606
19619
 
19607
- if ( options.withCredentials ) { // Preflighted requests
19620
+ if ( options.withCredentials ) { // Preflighted requests
19608
19621
  if ('withCredentials' in xhr) {
19609
19622
  // XHR for Chrome/Firefox/Opera/Safari.
19610
19623
  if (options.isSynchrone) {
@@ -19623,7 +19636,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19623
19636
  triggerEvent(gina, $el, 'error.' + id, result)
19624
19637
  }
19625
19638
  } else { // simple requests
19626
-
19639
+
19627
19640
  if (options.isSynchrone) {
19628
19641
  xhr.open(options.method, options.url, options.isSynchrone)
19629
19642
  } else {
@@ -19631,32 +19644,32 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19631
19644
  }
19632
19645
  }
19633
19646
 
19634
-
19647
+
19635
19648
 
19636
19649
  if (xhr) {
19637
19650
  // setting up headers
19638
19651
  xhr.withCredentials = ( typeof(options.withCredentials) != 'undefined' ) ? options.withCredentials : false;
19639
-
19652
+
19640
19653
  xhr.onerror = function(event, err) {
19641
-
19654
+
19642
19655
  var error = 'Transaction error: might be due to the server CORS settings.\nPlease, check the console for more details.';
19643
19656
  var result = {
19644
19657
  'status': xhr.status, //500,
19645
19658
  'error' : error
19646
- };
19647
-
19659
+ };
19660
+
19648
19661
  var resultIsObject = true;
19649
- instance.eventData.error = result +'/n'+ err;
19662
+ instance.eventData.error = result +'\n'+ err;
19650
19663
  updateToolbar(result, resultIsObject);
19651
19664
  triggerEvent(gina, $el, 'error.' + id, result)
19652
19665
  }
19653
-
19654
-
19666
+
19667
+
19655
19668
  for (var header in options.headers) {
19656
19669
  xhr.setRequestHeader(header, options.headers[header]);
19657
19670
  }
19658
-
19659
-
19671
+
19672
+
19660
19673
  // catching ready state cb
19661
19674
  xhr.onreadystatechange = function (event) {
19662
19675
  if (xhr.readyState == 4) {
@@ -19675,20 +19688,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19675
19688
  result.contentType = contentType;
19676
19689
  isRedirecting = false;
19677
19690
  }
19678
-
19691
+
19679
19692
 
19680
19693
  instance.eventData.success = result;
19681
-
19682
- if (
19694
+
19695
+ if (
19683
19696
  !isJsonContent && $popin.isOpen && !$popin.hasForm
19684
19697
  ||
19685
19698
  !isJsonContent && $popin.isOpen && isRedirecting
19686
- ) {
19699
+ ) {
19687
19700
  popinLoadContent(result, isRedirecting);
19688
19701
  } else {
19689
-
19690
- if (
19691
- isJsonContent && typeof(result.location) != 'undefined'
19702
+
19703
+ if (
19704
+ isJsonContent && typeof(result.location) != 'undefined'
19692
19705
  ||
19693
19706
  isJsonContent && typeof(result.reload) != 'undefined'
19694
19707
  ) {
@@ -19700,14 +19713,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19700
19713
  isXhrRedirect = true;
19701
19714
  }
19702
19715
  if ( typeof(result.location) != 'undefined' && isXhrRedirect ) {
19703
-
19704
- if (
19705
- typeof(result.popin) != 'undefined'
19716
+
19717
+ if (
19718
+ typeof(result.popin) != 'undefined'
19706
19719
  && typeof(result.popin.close) != 'undefined'
19707
19720
  ) {
19708
19721
  $popin.isRedirecting = false;
19709
19722
  $popin.close();
19710
-
19723
+
19711
19724
  var _reload = (result.popin.reload) ? result.popin.reload : false;
19712
19725
  if ( !result.popin.location && !result.popin.url) {
19713
19726
  delete result.popin;
@@ -19715,9 +19728,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19715
19728
  if (_reload) {
19716
19729
  result.popin = { reload: _reload };
19717
19730
  }
19718
- }
19731
+ }
19719
19732
  }
19720
-
19733
+
19721
19734
  var _target = '_self'; // by default
19722
19735
  if ( typeof(result.target) != 'undefined' ) {
19723
19736
  if ( /^(blank|self|parent|top)$/ ) {
@@ -19725,7 +19738,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19725
19738
  }
19726
19739
  _target = result.target
19727
19740
  }
19728
-
19741
+
19729
19742
  // special case of location without having the popin open
19730
19743
  // can occure while tunnelling
19731
19744
  if ( /^_self$/.test(_target) ) {
@@ -19735,7 +19748,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19735
19748
  } else {
19736
19749
  popinUrl = result.location;
19737
19750
  }
19738
-
19751
+
19739
19752
  $popin
19740
19753
  .load( $popin.name, popinUrl, $popin.options );
19741
19754
  return setTimeout( function onPopinredirect($popin){
@@ -19745,22 +19758,22 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19745
19758
  }
19746
19759
  }, 50, $popin);
19747
19760
  }
19748
-
19749
-
19761
+
19762
+
19750
19763
  window.open(result.location, _target);
19751
19764
  return;
19752
19765
  }
19753
-
19766
+
19754
19767
  if ( typeof(result.location) != 'undefined' ) {
19755
19768
  document.location = result.location;
19756
19769
  return;
19757
19770
  }
19758
-
19771
+
19759
19772
  if ( typeof(result.reload) != 'undefined' ) {
19760
19773
  document.location.reload();
19761
19774
  return;
19762
19775
  }
19763
-
19776
+
19764
19777
  if ( typeof(result.popin) != 'undefined' ) {
19765
19778
  if ( typeof(result.popin.close) != 'undefined' ) {
19766
19779
  $popin.isRedirecting = false;
@@ -19768,7 +19781,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19768
19781
  }
19769
19782
  }
19770
19783
  }
19771
-
19784
+
19772
19785
  //if ( !isJsonContent && $popin.hasForm) {
19773
19786
  //$validatorInstance.handleXhrResponse(xhr, $forms[0], $forms[0].id, event, true);
19774
19787
  //handleXhr(xhr, $el, options, require)
@@ -19778,23 +19791,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19778
19791
  triggerEvent(gina, $el, 'loaded.' + id, result);
19779
19792
  return
19780
19793
  }
19781
-
19794
+
19782
19795
  triggerEvent(gina, $forms[0], 'success.' + id, result);
19783
-
19796
+
19784
19797
  }
19785
-
19798
+
19786
19799
  if (GINA_ENV_IS_DEV)
19787
19800
  updateToolbar(result);
19788
19801
 
19789
19802
  } catch (err) {
19790
-
19803
+
19791
19804
  var resultIsObject = false;
19792
-
19805
+
19793
19806
  var result = {
19794
19807
  'status': 422,
19795
19808
  'error' : err.description || err.stack
19796
19809
  };
19797
-
19810
+
19798
19811
  if ( /application\/json/.test( xhr.getResponseHeader("Content-Type") ) ) {
19799
19812
  result.error = JSON.parse(xhr.responseText);
19800
19813
  resultIsObject = true
@@ -19820,8 +19833,8 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19820
19833
  resultIsObject = true
19821
19834
  }
19822
19835
 
19823
- instance.eventData.error = result;
19824
-
19836
+ instance.eventData.error = result;
19837
+
19825
19838
 
19826
19839
  // update toolbar
19827
19840
  if (GINA_ENV_IS_DEV)
@@ -19866,18 +19879,18 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19866
19879
  // sending
19867
19880
  //var data = JSON.stringify({ sample: 'data'});
19868
19881
  xhr.send();
19869
-
19882
+
19870
19883
 
19871
19884
  return {
19872
19885
  'open': function () {
19873
19886
  var fired = false;
19874
19887
  addListener(gina, $el, 'loaded.' + id, function(e) {
19875
-
19888
+
19876
19889
  e.preventDefault();
19877
19890
 
19878
19891
  if (!fired) {
19879
19892
  fired = true;
19880
-
19893
+
19881
19894
  instance.activePopinId = $popin.id;
19882
19895
  popinBind(e, $popin);
19883
19896
  popinOpen($popin.name);
@@ -19892,40 +19905,40 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19892
19905
 
19893
19906
  /**
19894
19907
  * popinLoadContent
19895
- *
19908
+ *
19896
19909
  * @param {string} html - plain/text
19897
19910
  * @param {boolean} [isRedirecting] - to handle link inside popin without form
19898
19911
  */
19899
19912
  function popinLoadContent(stringContent, isRedirecting) {
19900
-
19901
- var $popin = getActivePopin();
19902
- if ( !$popin ) {
19913
+
19914
+ var $popin = getActivePopin();
19915
+ if ( !$popin ) {
19903
19916
  return;
19904
19917
  }
19905
19918
  if (!$popin.isOpen)
19906
19919
  throw new Error('Popin `'+$popin.name+'` is not open !');
19907
-
19920
+
19908
19921
  $popin.isRedirecting = ( typeof(isRedirecting) != 'undefined' ) ? isRedirecting : false;
19909
-
19922
+
19910
19923
  var $el = $popin.target;
19911
- // if (
19912
- // typeof(stringContent) != 'undefined'
19913
- // && typeof(stringContent.trim) == 'function'
19924
+ // if (
19925
+ // typeof(stringContent) != 'undefined'
19926
+ // && typeof(stringContent.trim) == 'function'
19914
19927
  // ) {
19915
- $el.innerHTML = stringContent.trim();
19928
+ $el.innerHTML = stringContent.trim();
19916
19929
  // }
19917
-
19918
- popinUnbind($popin.name, true);
19930
+
19931
+ popinUnbind($popin.name, true);
19919
19932
  popinBind({ target: $el, type: 'loaded.' + $popin.id }, $popin);
19920
-
19933
+
19921
19934
  if ( !$popin.isRedirecting ) {
19922
19935
  triggerEvent(gina, instance.target, 'open.'+ $popin.id, $popin);
19923
19936
  } else {
19924
19937
  triggerEvent(gina, instance.target, 'loaded.' + $popin.id, $popin);
19925
19938
  }
19926
19939
  }
19927
-
19928
- function getScript(source) {
19940
+
19941
+ function getScript(source) {
19929
19942
  // then trigger scripts load
19930
19943
  //var xhr = new XMLHttpRequest();
19931
19944
  var xhr = setupXhr();
@@ -19934,28 +19947,28 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19934
19947
  xhr.onload = function () {
19935
19948
  eval(xhr.response);
19936
19949
  };
19937
- xhr.send();
19950
+ xhr.send();
19938
19951
  }
19939
-
19952
+
19940
19953
  /**
19941
19954
  * popinOpen
19942
- *
19955
+ *
19943
19956
  * If you get a x-origin error, check if you have `Vary` rule
19944
19957
  * set in your policy : // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
19945
- *
19958
+ *
19946
19959
  * Add to your project/env.json the following rule
19947
- * {
19960
+ * {
19948
19961
  * "$bundle" : {
19949
19962
  * "server": {
19950
19963
  * "response": {
19951
19964
  * // other definitions ...
19952
- *
19965
+ *
19953
19966
  * "vary": "Origin"
19954
19967
  * }
19955
19968
  * }
19956
- * }
19969
+ * }
19957
19970
  * }
19958
- *
19971
+ *
19959
19972
  * Opens a popin by name
19960
19973
  *
19961
19974
  * @parama {string} name
@@ -19967,10 +19980,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19967
19980
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getPopinById(this.id);
19968
19981
  if ( !$popin ) {
19969
19982
  throw new Error('Popin name `'+name+'` not found !')
19970
- }
19983
+ }
19971
19984
  id = $popin.id;
19972
19985
  $el = document.getElementById(id);
19973
-
19986
+
19974
19987
  // load external resources in order of declaration
19975
19988
  // TODO - Add support for stylesheets
19976
19989
  var globalScriptsList = $popin.parentScripts
@@ -19980,7 +19993,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19980
19993
  , len = scripts.length
19981
19994
  ;
19982
19995
  var domain = gina.config.hostname.replace(/(https|http|)\:\/\//, '').replace(/\:\d+$/, '');
19983
- var reDomain = new RegExp(domain+'\:\\d+\|'+domain);
19996
+ var reDomain = new RegExp(domain+'\:\\d+\|'+domain);
19984
19997
  for (;i < len; ++i) {
19985
19998
  if ( typeof(scripts[i].src) == 'undefined' || scripts[i].src == '' ) {
19986
19999
  continue;
@@ -19991,20 +20004,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19991
20004
  // don't load if already in the global context
19992
20005
  if ( globalScriptsList.indexOf(filename) > -1 )
19993
20006
  continue;
19994
-
20007
+
19995
20008
  getScript(scripts[i].src);
19996
20009
  }
19997
20010
  //i = 0; len = styles.length
19998
-
20011
+
19999
20012
  popinBind({ target: $el, type: 'loaded.' + $popin.id }, $popin);
20000
-
20013
+
20001
20014
 
20002
20015
  if ( !/gina-popin-is-active/.test($el.className) )
20003
20016
  $el.className += ' gina-popin-is-active';
20004
20017
 
20005
20018
  // overlay
20006
20019
  if ( !/gina-popin-is-active/.test(instance.target.firstChild.className) )
20007
- instance.target.firstChild.className += ' gina-popin-is-active';
20020
+ instance.target.firstChild.className += ' gina-popin-is-active';
20008
20021
  // overlay
20009
20022
  if ( /gina-popin-is-active/.test(instance.target.firstChild.className) ) {
20010
20023
  removeListener(gina, instance.target, 'open.'+ $popin.id)
@@ -20013,7 +20026,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20013
20026
  $popin.isOpen = true;
20014
20027
  // so it can be forwarded to the handler who is listening
20015
20028
  $popin.target = $el;
20016
-
20029
+
20017
20030
  instance.activePopinId = $popin.id;
20018
20031
 
20019
20032
  // update toolbar
@@ -20068,17 +20081,17 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20068
20081
  *
20069
20082
  * */
20070
20083
  function popinUnbind(name, isRouting) {
20071
-
20084
+
20072
20085
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
20073
20086
  var $el = null;
20074
20087
  if ( !$popin && typeof(name) != 'undefined' ) {
20075
20088
  throw new Error('Popin `'+name+'` not found !');
20076
20089
  }
20077
-
20090
+
20078
20091
  // by default
20079
20092
  if ( typeof($popin) != 'undefined' && $popin != null ) {
20080
20093
  $el = $popin.target;
20081
-
20094
+
20082
20095
  isRouting = ( typeof(isRouting) != 'undefined' ) ? isRouting : false;
20083
20096
 
20084
20097
  if ( $el != null && /gina-popin-is-active/.test($el.className) ) {
@@ -20086,7 +20099,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20086
20099
  instance.target.firstChild.className = instance.target.firstChild.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
20087
20100
  $el.className = $el.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
20088
20101
  $el.innerHTML = '';
20089
- }
20102
+ }
20090
20103
 
20091
20104
  // removing from FormValidator instance
20092
20105
  if ($validatorInstance) {
@@ -20100,15 +20113,15 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20100
20113
  }
20101
20114
  }
20102
20115
  }
20103
-
20116
+
20104
20117
  gina.popinIsBinded = false;
20105
-
20118
+
20106
20119
  // remove listeners
20107
20120
  removeListener(gina, $popin.target, 'loaded.' + $popin.id);
20108
20121
  }
20109
- }
20122
+ }
20110
20123
  }
20111
-
20124
+
20112
20125
 
20113
20126
  /**
20114
20127
  * popinClose
@@ -20119,7 +20132,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20119
20132
  *
20120
20133
  * */
20121
20134
  function popinClose(name) {
20122
-
20135
+
20123
20136
  var $popin = null;
20124
20137
  if ( typeof(name) == 'undefined' && /^true$/.test(this.isOpen) ) {
20125
20138
  name = this.name;
@@ -20128,7 +20141,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20128
20141
  $popin = getPopinByName(name) || getActivePopin();
20129
20142
  if (!$popin)
20130
20143
  return;
20131
-
20144
+
20132
20145
  name = $popin.name;
20133
20146
  }
20134
20147
  //var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
@@ -20138,29 +20151,29 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20138
20151
  }
20139
20152
  if (!$popin.isOpen)
20140
20153
  return;
20141
-
20154
+
20142
20155
  // by default
20143
20156
  if ( typeof($popin) != 'undefined' && $popin != null ) {
20144
-
20157
+
20145
20158
  // in case popinClose is called by the user e.g.: binding cancel/close with a <A> tag
20146
20159
  // but at the same time, the <A> href is not empty -> redirection wanted in the HTML
20147
20160
  // in this case, we want to ignore close
20148
20161
  if ( $popin.isRedirecting )
20149
20162
  return;
20150
-
20163
+
20151
20164
  $el = $popin.target;
20152
-
20165
+
20153
20166
  removeListener(gina, $popin.target, 'ready.' + instance.id);
20154
-
20167
+
20155
20168
  if ( $popin.hasForm ) {
20156
20169
  $popin.hasForm = false;
20157
20170
  }
20158
20171
 
20159
20172
  if ( $el != null && /gina-popin-is-active/.test($el.className) ) {
20160
-
20161
- popinUnbind(name);
20173
+
20174
+ popinUnbind(name);
20162
20175
  $popin.isOpen = false;
20163
- gina.popinIsBinded = false;
20176
+ gina.popinIsBinded = false;
20164
20177
 
20165
20178
  // restore toolbar
20166
20179
  if ( GINA_ENV_IS_DEV && gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar )
@@ -20173,16 +20186,16 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20173
20186
  ;
20174
20187
  try {
20175
20188
  for (; s<sLen; ++s) {
20176
- document.getElementById( $popin.$headers[s].id ).remove();
20189
+ document.getElementById( $popin.$headers[s].id ).remove();
20177
20190
  }
20178
20191
  } catch(err){
20179
20192
  console.warn('Could not remove script `'+ $popin.$headers[s].id +'`\n'+ err.stack)
20180
20193
  }
20181
- $popin.$headers = [];
20194
+ $popin.$headers = [];
20182
20195
  }
20183
20196
  triggerEvent(gina, $popin.target, 'close.'+ $popin.id, $popin);
20184
20197
  }
20185
- }
20198
+ }
20186
20199
  }
20187
20200
 
20188
20201
  /**
@@ -20194,26 +20207,26 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20194
20207
  *
20195
20208
  * */
20196
20209
  function popinDestroy(name) {
20197
-
20210
+
20198
20211
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
20199
20212
  var id = null, $el = null;
20200
20213
  if ( !$popin && typeof(name) != 'undefined' ) {
20201
20214
  throw new Error('Popin `'+name+'` not found !');
20202
20215
  }
20203
-
20216
+
20204
20217
  id = $popin.id;
20205
20218
  }
20206
-
20219
+
20207
20220
  function registerPopin($popin, options) {
20208
-
20221
+
20209
20222
  if ( typeof(options) != 'object' ) {
20210
20223
  throw new Error('`options` must be an object')
20211
20224
  }
20212
-
20225
+
20213
20226
  $popin.options = merge(options, self.options);
20214
20227
  $popin.id = 'gina-popin-' + instance.id +'-'+ $popin.options['name'];
20215
-
20216
- if ( typeof(instance.$popins[$popin.id]) == 'undefined' ) {
20228
+
20229
+ if ( typeof(instance.$popins[$popin.id]) == 'undefined' ) {
20217
20230
 
20218
20231
  if ( typeof($popin.options['name']) != 'string' || $popin.options['name'] == '' ) {
20219
20232
  throw new Error('`options.name` can not be left `empty` or `undefined`')
@@ -20228,20 +20241,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20228
20241
  $validatorInstance = $popin.options['validator'];
20229
20242
  $popin.validateFormById = $validatorInstance.validateFormById;
20230
20243
  }
20231
-
20244
+
20232
20245
 
20233
20246
  $popin.options['class'] = 'gina-popin-container ' + $popin.options['class'];
20234
20247
 
20235
-
20236
- $popin.name = $popin.options['name'];
20237
- $popin.target = instance.target;
20248
+
20249
+ $popin.name = $popin.options['name'];
20250
+ $popin.target = instance.target;
20238
20251
  $popin.load = popinLoad;
20239
20252
  $popin.loadContent = popinLoadContent;
20240
20253
  $popin.open = popinOpen;
20241
20254
  $popin.close = popinClose;
20242
20255
  if (GINA_ENV_IS_DEV)
20243
20256
  $popin.updateToolbar = updateToolbar;
20244
-
20257
+
20245
20258
  // Get main resources
20246
20259
  $popin.parentScripts = [];
20247
20260
  $popin.parentStyles = [];
@@ -20259,7 +20272,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20259
20272
  $popin.parentScripts[s] = filename;
20260
20273
  }
20261
20274
  // Parent Styles
20262
- var mainDocumentStyles = document.getElementsByTagName('link');
20275
+ var mainDocumentStyles = document.getElementsByTagName('link');
20263
20276
  for (let s = 0, len = mainDocumentStyles.length; s < len; s++ ) {
20264
20277
  if ( typeof(mainDocumentStyles[s].rel) == 'undefined' || !/stylesheet/i.test(mainDocumentStyles[s].rel) )
20265
20278
  continue;
@@ -20269,9 +20282,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20269
20282
  .replace(reDomain, '');
20270
20283
  $popin.parentStyles[s] = filename;
20271
20284
  }
20272
-
20273
-
20274
-
20285
+
20286
+
20287
+
20275
20288
  instance.$popins[$popin.id] = $popin;
20276
20289
 
20277
20290
  // setting up AJAX
@@ -20287,23 +20300,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20287
20300
  catch (e) {}
20288
20301
  }
20289
20302
  }
20290
-
20291
-
20292
-
20293
- bindOpen($popin);
20303
+
20304
+
20305
+
20306
+ bindOpen($popin);
20294
20307
  }
20295
20308
  }
20296
20309
 
20297
20310
  var init = function(options) {
20298
-
20311
+
20299
20312
  setupInstanceProto();
20300
20313
  //instance.on('init', function(event) {
20301
20314
  addListener(gina, instance.target, 'init.'+instance.id, function(e) {
20302
-
20315
+
20303
20316
  var $newPopin = null;
20304
20317
  var popinId = 'gina-popin-' + instance.id +'-'+ options['name'];
20305
- if ( typeof(instance.$popins[popinId]) == 'undefined' ) {
20306
- var $newPopin = merge({}, $popin);
20318
+ if ( typeof(instance.$popins[popinId]) == 'undefined' ) {
20319
+ var $newPopin = merge({}, $popin);
20307
20320
  registerPopin($newPopin, options);
20308
20321
  }
20309
20322
 
@@ -20314,14 +20327,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20314
20327
  triggerEvent(gina, instance.target, 'ready.' + instance.id, $newPopin);
20315
20328
  });
20316
20329
 
20317
-
20318
-
20330
+
20331
+
20319
20332
 
20320
20333
  instance.initialized = true;
20321
20334
 
20322
20335
  return instance
20323
20336
  }
20324
-
20337
+
20325
20338
  var setupInstanceProto = function() {
20326
20339
  instance.getPopinById = getPopinById;
20327
20340
  instance.getPopinByName = getPopinByName;
@@ -20331,7 +20344,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20331
20344
  instance.open = popinOpen;
20332
20345
  instance.close = popinClose;
20333
20346
  }
20334
-
20347
+
20335
20348
 
20336
20349
  if ( !gina.hasPopinHandler ) {
20337
20350
  popinCreateContainer();
@@ -20379,7 +20392,7 @@ define("utils/effects", function(){});
20379
20392
  /**
20380
20393
  * Object.assign
20381
20394
  * Ref.: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
20382
- *
20395
+ *
20383
20396
  */
20384
20397
  if (typeof Object.assign !== 'function') {
20385
20398
  // Must be writable: true, enumerable: false, configurable: true
@@ -20409,20 +20422,20 @@ if (typeof Object.assign !== 'function') {
20409
20422
  configurable: true
20410
20423
  });
20411
20424
  }
20412
-
20425
+
20413
20426
  if ( typeof(JSON.clone) == 'undefined' ) {
20414
20427
  /**
20415
20428
  * JSON.clone
20416
20429
  * Clone JSON object
20417
- *
20418
- * Changes made here must be reflected in:
20430
+ *
20431
+ * Changes made here must be reflected in:
20419
20432
  * - gina/utils/prototypes.js
20420
20433
  * - gina/framework/version/helpers/prototypes.js
20421
- * - gina/framework/version/core/asset/js/plugin/src/gina/utils/polyfill.js
20422
- *
20434
+ * - gina/framework/version/core/asset/plugin/src/gina/utils/polyfill.js
20435
+ *
20423
20436
  * @param {object} source
20424
20437
  * @param {object} [target]
20425
- *
20438
+ *
20426
20439
  * @returns {object} cloned JSON object
20427
20440
  **/
20428
20441
  var clone = function(source, target) {
@@ -20437,7 +20450,7 @@ if ( typeof(JSON.clone) == 'undefined' ) {
20437
20450
  , len = Object.getOwnPropertyNames(source).length || 0
20438
20451
  , keys = Object.keys(source)
20439
20452
  ;
20440
-
20453
+
20441
20454
  while (i<len) {
20442
20455
  target[keys[i]] = (typeof target[keys[i]] == 'undefined') ? clone(source[keys[i]], null) : target[keys[i]];
20443
20456
  i++;
@@ -20446,12 +20459,12 @@ if ( typeof(JSON.clone) == 'undefined' ) {
20446
20459
 
20447
20460
  return target;
20448
20461
  };
20449
-
20462
+
20450
20463
  JSON.clone = clone;
20451
20464
  // WHY NOT USE SOMETHING ELSE ?
20452
20465
  // Could have been fine, but not working when you have references pointg to another object
20453
- // return Object.assign({}, source);
20454
-
20466
+ // return Object.assign({}, source);
20467
+
20455
20468
  // Performences issue
20456
20469
  //return JSON.parse(JSON.stringify(source));
20457
20470
  }
@@ -20460,14 +20473,14 @@ if ( typeof(JSON.escape) == 'undefined' ) {
20460
20473
  /**
20461
20474
  * JSON.escape
20462
20475
  * Escape special characters
20463
- *
20464
- * Changes made here must be reflected in:
20476
+ *
20477
+ * Changes made here must be reflected in:
20465
20478
  * - gina/utils/prototypes.js
20466
20479
  * - gina/framework/version/helpers/prototypes.js
20467
- * - gina/framework/version/core/asset/js/plugin/src/gina/utils/polyfill.js
20468
- *
20480
+ * - gina/framework/version/core/asset/plugin/src/gina/utils/polyfill.js
20481
+ *
20469
20482
  * @param {object} jsonStr
20470
- *
20483
+ *
20471
20484
  * @returns {object} escaped JSON string
20472
20485
  **/
20473
20486
  var escape = function(jsonStr){
@@ -20477,11 +20490,11 @@ if ( typeof(JSON.escape) == 'undefined' ) {
20477
20490
  .replace(/\r/g, "\\r")
20478
20491
  .replace(/\t/g, "\\t")
20479
20492
  ;
20480
- } catch (err) {
20493
+ } catch (err) {
20481
20494
  throw err;
20482
20495
  }
20483
20496
  };
20484
-
20497
+
20485
20498
  JSON.escape = escape;
20486
20499
  };
20487
20500
  define("utils/polyfill", function(){});
@@ -20489,7 +20502,7 @@ define("utils/polyfill", function(){});
20489
20502
 
20490
20503
  /**
20491
20504
  * This file is part of the gina package.
20492
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
20505
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
20493
20506
  *
20494
20507
  * For the full copyright and license information, please view the LICENSE
20495
20508
  * file that was distributed with this source code.