twenty-sdk 0.5.2 → 0.6.0

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 (266) hide show
  1. package/README.md +29 -10
  2. package/dist/{AllIcons-CGPKtPQS-C-ZFgy8B.mjs → AllIcons-CGPKtPQS-CBzLmrUd.mjs} +6666 -6695
  3. package/dist/{AllIcons-CGPKtPQS-sO2O4z-k.js → AllIcons-CGPKtPQS-CoHKEEHb.js} +3790 -3810
  4. package/dist/HtmlTagToRemoteComponent-DBOkvIRB.mjs +13283 -0
  5. package/dist/HtmlTagToRemoteComponent-DzQ2I9Lz.js +29 -0
  6. package/dist/cli/commands/app/app-dev.d.ts +0 -16
  7. package/dist/cli/commands/app/app-typecheck.d.ts +6 -0
  8. package/dist/cli/commands/app/app-uninstall.d.ts +2 -2
  9. package/dist/cli/commands/app-command.d.ts +1 -1
  10. package/dist/cli/commands/entity/entity-add.d.ts +3 -0
  11. package/dist/cli/commands/logic-function/logic-function-execute.d.ts +2 -1
  12. package/dist/cli/commands/logic-function/logic-function-logs.d.ts +1 -1
  13. package/dist/cli/utilities/api/api-service.d.ts +37 -9
  14. package/dist/cli/utilities/build/common/esbuild-result-processor.d.ts +2 -2
  15. package/dist/cli/utilities/build/common/esbuild-watcher.d.ts +2 -2
  16. package/dist/cli/utilities/build/common/file-upload-watcher.d.ts +1 -1
  17. package/dist/cli/utilities/build/common/front-component-build/jsx-runtime-remote-wrapper-plugin.d.ts +6 -0
  18. package/dist/cli/utilities/build/common/front-component-build/jsx-transform-to-remote-dom-worker-format-plugin.d.ts +0 -1
  19. package/dist/cli/utilities/build/common/front-component-build/preact-alias-plugin.d.ts +2 -0
  20. package/dist/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins.d.ts +5 -1
  21. package/dist/cli/utilities/build/common/restartable-watcher-interface.d.ts +2 -2
  22. package/dist/cli/utilities/build/common/tsc-watcher.d.ts +18 -0
  23. package/dist/cli/utilities/build/common/typecheck-plugin.d.ts +10 -0
  24. package/dist/cli/utilities/build/manifest/manifest-build.d.ts +2 -2
  25. package/dist/cli/utilities/build/manifest/manifest-extract-config-from-file.d.ts +1 -1
  26. package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +10 -2
  27. package/dist/cli/utilities/build/manifest/manifest-reader.d.ts +2 -0
  28. package/dist/cli/utilities/build/manifest/manifest-update-checksums.d.ts +2 -2
  29. package/dist/cli/utilities/build/manifest/manifest-validate.d.ts +1 -1
  30. package/dist/cli/utilities/build/manifest/manifest-writer.d.ts +1 -1
  31. package/dist/cli/utilities/build/manifest/utils/generate-default-field-universal-identifier.d.ts +5 -0
  32. package/dist/cli/utilities/build/manifest/utils/get-default-fields-in-object-fields.d.ts +6 -0
  33. package/dist/cli/utilities/build/manifest/utils/get-default-object-fields.d.ts +3 -0
  34. package/dist/cli/utilities/build/manifest/utils/get-default-relation-object-fields.d.ts +6 -0
  35. package/dist/cli/utilities/client/client-service.d.ts +5 -3
  36. package/dist/cli/utilities/config/config-service.d.ts +2 -0
  37. package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state.d.ts +75 -0
  38. package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator.d.ts +29 -0
  39. package/dist/cli/utilities/dev/orchestrator/steps/build-manifest-orchestrator-step.d.ts +16 -0
  40. package/dist/cli/utilities/dev/orchestrator/steps/check-server-orchestrator-step.d.ts +17 -0
  41. package/dist/cli/utilities/dev/orchestrator/steps/ensure-valid-tokens-orchestrator-step.d.ts +22 -0
  42. package/dist/cli/utilities/dev/orchestrator/steps/generate-api-client-orchestrator-step.d.ts +18 -0
  43. package/dist/cli/utilities/dev/orchestrator/steps/resolve-application-orchestrator-step.d.ts +20 -0
  44. package/dist/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.d.ts +43 -0
  45. package/dist/cli/utilities/dev/orchestrator/steps/sync-application-orchestrator-step.d.ts +22 -0
  46. package/dist/cli/utilities/dev/orchestrator/steps/upload-files-orchestrator-step.d.ts +25 -0
  47. package/dist/cli/utilities/dev/ui/components/dev-ui-application-panel.d.ts +12 -0
  48. package/dist/cli/utilities/dev/ui/components/dev-ui-entity-section.d.ts +16 -0
  49. package/dist/cli/utilities/dev/ui/components/dev-ui-event-log.d.ts +5 -0
  50. package/dist/cli/utilities/dev/{dev-ui.d.ts → ui/components/dev-ui.d.ts} +1 -1
  51. package/dist/cli/utilities/dev/ui/dev-ui-constants.d.ts +27 -0
  52. package/dist/cli/utilities/dev/ui/dev-ui-hooks.d.ts +3 -0
  53. package/dist/cli/utilities/dev/ui/dev-ui-ink-context.d.ts +10 -0
  54. package/dist/cli/utilities/dev/ui/dev-ui-state-manager.d.ts +10 -0
  55. package/dist/cli/utilities/entity/entity-field-template.d.ts +2 -2
  56. package/dist/cli/utilities/entity/entity-front-component-template.d.ts +1 -1
  57. package/dist/cli/utilities/entity/entity-logic-function-template.d.ts +1 -1
  58. package/dist/cli/utilities/entity/entity-navigation-menu-item-template.d.ts +5 -0
  59. package/dist/cli/utilities/entity/entity-object-template.d.ts +2 -1
  60. package/dist/cli/utilities/entity/entity-page-layout-template.d.ts +3 -0
  61. package/dist/cli/utilities/entity/entity-role-template.d.ts +1 -1
  62. package/dist/cli/utilities/entity/entity-skill-template.d.ts +4 -0
  63. package/dist/cli/utilities/entity/entity-view-template.d.ts +5 -0
  64. package/dist/cli/utilities/error/serialize-error.d.ts +1 -0
  65. package/dist/cli/utilities/file/file-jsonc.d.ts +1 -1
  66. package/dist/cli/utilities/file/file-path.d.ts +1 -1
  67. package/dist/cli/utilities/file/file-uploader.d.ts +3 -3
  68. package/dist/cli/utilities/typescript/typescript-diagnostics.d.ts +1 -1
  69. package/dist/cli/utilities/typescript/typescript-program.d.ts +1 -1
  70. package/dist/cli.cjs +356 -85
  71. package/dist/cli.mjs +5260 -4313
  72. package/dist/front-component-renderer/host/components/FrontComponentRenderer.d.ts +14 -0
  73. package/dist/front-component-renderer/host/components/RemoteStyleRenderer.d.ts +6 -0
  74. package/dist/front-component-renderer/host/utils/createHtmlHostWrapper.d.ts +8 -0
  75. package/dist/front-component-renderer/index.cjs +25 -0
  76. package/dist/{front-component → front-component-renderer}/index.d.ts +5 -5
  77. package/dist/front-component-renderer/index.mjs +11744 -0
  78. package/dist/front-component-renderer/polyfills/MockCSSStyleSheet.d.ts +17 -0
  79. package/dist/front-component-renderer/polyfills/installStyleBridge.d.ts +2 -0
  80. package/dist/front-component-renderer/remote/components/FrontComponentHostCommunicationApiEffect.d.ts +8 -0
  81. package/dist/front-component-renderer/remote/components/FrontComponentUpdateContextEffect.d.ts +11 -0
  82. package/dist/{front-component → front-component-renderer}/remote/components/FrontComponentWorkerEffect.d.ts +5 -4
  83. package/dist/front-component-renderer/remote/generated/remote-components.d.ts +44 -0
  84. package/dist/front-component-renderer/remote/generated/remote-elements.d.ts +193 -0
  85. package/dist/front-component-renderer/remote/utils/installStylePropertyOnRemoteElements.d.ts +1 -0
  86. package/dist/front-component-renderer/remote/utils/patchRemoteElementSetAttribute.d.ts +1 -0
  87. package/dist/front-component-renderer/remote/worker/remote-worker.d.ts +3 -0
  88. package/dist/front-component-renderer/remote/worker/utils/setWorkerEnv.d.ts +1 -0
  89. package/dist/{front-component → front-component-renderer}/types/FrontComponentExecutionContext.d.ts +1 -0
  90. package/dist/front-component-renderer/types/FrontComponentHostCommunicationApi.d.ts +8 -0
  91. package/dist/{front-component → front-component-renderer}/types/HostToWorkerRenderContext.d.ts +2 -1
  92. package/dist/front-component-renderer/types/PropertySchema.d.ts +4 -0
  93. package/dist/{front-component → front-component-renderer}/types/WorkerExports.d.ts +3 -3
  94. package/dist/get-function-input-schema-BZ7_XyUh-By3UDh4s.mjs +62 -0
  95. package/dist/get-function-input-schema-BZ7_XyUh-GxSybvDe.js +1 -0
  96. package/dist/index-CicdakVv.js +2430 -0
  97. package/dist/index-DeMzdViF.mjs +33940 -0
  98. package/dist/index.cjs +2 -5
  99. package/dist/index.mjs +408 -2493
  100. package/dist/sdk/action/Action.d.ts +4 -0
  101. package/dist/sdk/action/Action.js +33 -0
  102. package/dist/sdk/action/Action.js.map +1 -0
  103. package/dist/sdk/action/ActionLink.d.ts +10 -0
  104. package/dist/sdk/action/ActionLink.js +39 -0
  105. package/dist/sdk/action/ActionLink.js.map +1 -0
  106. package/dist/sdk/action/ActionOpenSidePanelPage.d.ts +9 -0
  107. package/dist/sdk/action/ActionOpenSidePanelPage.js +54 -0
  108. package/dist/sdk/action/ActionOpenSidePanelPage.js.map +1 -0
  109. package/dist/sdk/action/index.d.ts +6 -0
  110. package/dist/sdk/application/application-config.d.ts +2 -2
  111. package/dist/sdk/application/define-application.d.ts +2 -2
  112. package/dist/sdk/application/define-application.js +12 -0
  113. package/dist/sdk/application/define-application.js.map +1 -0
  114. package/dist/sdk/common/types/define-entity.type.d.ts +9 -6
  115. package/dist/sdk/common/utils/create-validation-result.d.ts +1 -1
  116. package/dist/sdk/common/utils/create-validation-result.js +12 -0
  117. package/dist/sdk/common/utils/create-validation-result.js.map +1 -0
  118. package/dist/sdk/define-front-component.d.ts +2 -2
  119. package/dist/sdk/define-front-component.js +20 -0
  120. package/dist/sdk/define-front-component.js.map +1 -0
  121. package/dist/sdk/fields/define-field.d.ts +2 -2
  122. package/dist/sdk/fields/define-field.js +15 -0
  123. package/dist/sdk/fields/define-field.js.map +1 -0
  124. package/dist/sdk/fields/validate-fields.d.ts +1 -1
  125. package/dist/sdk/fields/validate-fields.js +16 -0
  126. package/dist/sdk/fields/validate-fields.js.map +1 -0
  127. package/dist/{HtmlTagToRemoteComponent-DRdIf3GJ.mjs → sdk/front-component-api/constants/AllowedHtmlElements.js} +4 -14
  128. package/dist/sdk/front-component-api/constants/AllowedHtmlElements.js.map +1 -0
  129. package/dist/sdk/front-component-api/constants/CommonHtmlEvents.js +26 -0
  130. package/dist/sdk/front-component-api/constants/CommonHtmlEvents.js.map +1 -0
  131. package/dist/sdk/front-component-api/constants/EventToReact.js +26 -0
  132. package/dist/sdk/front-component-api/constants/EventToReact.js.map +1 -0
  133. package/dist/sdk/front-component-api/constants/HtmlCommonProperties.d.ts +2 -0
  134. package/dist/sdk/front-component-api/constants/HtmlCommonProperties.js +15 -0
  135. package/dist/sdk/front-component-api/constants/HtmlCommonProperties.js.map +1 -0
  136. package/dist/sdk/front-component-api/constants/HtmlTagToRemoteComponent.d.ts +2 -0
  137. package/dist/sdk/front-component-api/constants/HtmlTagToRemoteComponent.js +24 -0
  138. package/dist/sdk/front-component-api/constants/HtmlTagToRemoteComponent.js.map +1 -0
  139. package/dist/sdk/front-component-api/context/frontComponentContext.d.ts +2 -2
  140. package/dist/sdk/front-component-api/context/frontComponentContext.js +11 -0
  141. package/dist/sdk/front-component-api/context/frontComponentContext.js.map +1 -0
  142. package/dist/sdk/front-component-api/functions/closeSidePanel.d.ts +2 -0
  143. package/dist/sdk/front-component-api/functions/closeSidePanel.js +12 -0
  144. package/dist/sdk/front-component-api/functions/closeSidePanel.js.map +1 -0
  145. package/dist/sdk/front-component-api/functions/enqueueSnackbar.d.ts +2 -0
  146. package/dist/sdk/front-component-api/functions/enqueueSnackbar.js +12 -0
  147. package/dist/sdk/front-component-api/functions/enqueueSnackbar.js.map +1 -0
  148. package/dist/sdk/front-component-api/functions/navigate.d.ts +1 -4
  149. package/dist/sdk/front-component-api/functions/navigate.js +12 -0
  150. package/dist/sdk/front-component-api/functions/navigate.js.map +1 -0
  151. package/dist/sdk/front-component-api/functions/openSidePanelPage.d.ts +2 -0
  152. package/dist/sdk/front-component-api/functions/openSidePanelPage.js +12 -0
  153. package/dist/sdk/front-component-api/functions/openSidePanelPage.js.map +1 -0
  154. package/dist/sdk/front-component-api/functions/unmountFrontComponent.d.ts +2 -0
  155. package/dist/sdk/front-component-api/functions/unmountFrontComponent.js +12 -0
  156. package/dist/sdk/front-component-api/functions/unmountFrontComponent.js.map +1 -0
  157. package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.d.ts +23 -0
  158. package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.js +6 -0
  159. package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.js.map +1 -0
  160. package/dist/sdk/front-component-api/hooks/useFrontComponentExecutionContext.d.ts +2 -2
  161. package/dist/sdk/front-component-api/hooks/useFrontComponentExecutionContext.js +18 -0
  162. package/dist/sdk/front-component-api/hooks/useFrontComponentExecutionContext.js.map +1 -0
  163. package/dist/sdk/front-component-api/hooks/useFrontComponentId.d.ts +1 -0
  164. package/dist/sdk/front-component-api/hooks/useFrontComponentId.js +6 -0
  165. package/dist/sdk/front-component-api/hooks/useFrontComponentId.js.map +1 -0
  166. package/dist/sdk/front-component-api/hooks/useUserId.d.ts +1 -1
  167. package/dist/sdk/front-component-api/hooks/useUserId.js +6 -0
  168. package/dist/sdk/front-component-api/hooks/useUserId.js.map +1 -0
  169. package/dist/sdk/front-component-api/index.d.ts +14 -1
  170. package/dist/sdk/front-component-api/types/FrontComponentExecutionContext.d.ts +1 -0
  171. package/dist/sdk/front-component-api/utils/getFrontComponentActionErrorDedupeKey.d.ts +1 -0
  172. package/dist/sdk/front-component-api/utils/getFrontComponentActionErrorDedupeKey.js +5 -0
  173. package/dist/sdk/front-component-api/utils/getFrontComponentActionErrorDedupeKey.js.map +1 -0
  174. package/dist/sdk/front-component-config.d.ts +2 -1
  175. package/dist/sdk/front-component-renderer/polyfills/MockCSSStyleSheet.js +31 -0
  176. package/dist/sdk/front-component-renderer/polyfills/MockCSSStyleSheet.js.map +1 -0
  177. package/dist/sdk/front-component-renderer/polyfills/installStyleBridge.js +121 -0
  178. package/dist/sdk/front-component-renderer/polyfills/installStyleBridge.js.map +1 -0
  179. package/dist/sdk/front-component-renderer/remote/utils/exposeGlobals.js +8 -0
  180. package/dist/sdk/front-component-renderer/remote/utils/exposeGlobals.js.map +1 -0
  181. package/dist/sdk/index.d.ts +26 -13
  182. package/dist/sdk/index.js +79 -0
  183. package/dist/sdk/index.js.map +1 -0
  184. package/dist/sdk/logic-functions/define-logic-function.d.ts +2 -2
  185. package/dist/sdk/logic-functions/define-logic-function.js +12 -0
  186. package/dist/sdk/logic-functions/define-logic-function.js.map +1 -0
  187. package/dist/sdk/logic-functions/logic-function-config.d.ts +4 -2
  188. package/dist/sdk/navigation-menu-items/define-navigation-menu-item.d.ts +3 -0
  189. package/dist/sdk/navigation-menu-items/define-navigation-menu-item.js +9 -0
  190. package/dist/sdk/navigation-menu-items/define-navigation-menu-item.js.map +1 -0
  191. package/dist/sdk/objects/define-object.d.ts +3 -3
  192. package/dist/sdk/objects/define-object.js +20 -0
  193. package/dist/sdk/objects/define-object.js.map +1 -0
  194. package/dist/sdk/objects/object-config.d.ts +4 -0
  195. package/dist/sdk/page-layouts/define-page-layout.d.ts +3 -0
  196. package/dist/sdk/page-layouts/define-page-layout.js +15 -0
  197. package/dist/sdk/page-layouts/define-page-layout.js.map +1 -0
  198. package/dist/sdk/page-layouts/page-layout-config.d.ts +2 -0
  199. package/dist/sdk/roles/define-role.d.ts +2 -2
  200. package/dist/sdk/roles/define-role.js +15 -0
  201. package/dist/sdk/roles/define-role.js.map +1 -0
  202. package/dist/sdk/skills/define-skill.d.ts +3 -0
  203. package/dist/sdk/skills/define-skill.js +9 -0
  204. package/dist/sdk/skills/define-skill.js.map +1 -0
  205. package/dist/sdk/views/define-view.d.ts +3 -0
  206. package/dist/sdk/views/define-view.js +24 -0
  207. package/dist/sdk/views/define-view.js.map +1 -0
  208. package/dist/sdk/views/view-config.d.ts +2 -0
  209. package/dist/ui/index.cjs +1 -47
  210. package/dist/ui/index.d.ts +1 -0
  211. package/dist/ui/index.mjs +692 -2401
  212. package/package.json +47 -12
  213. package/dist/HtmlTagToRemoteComponent-B6lQe_K8.js +0 -1
  214. package/dist/IconWorld-DynX4UYH.mjs +0 -3003
  215. package/dist/IconWorld-JYjJym3l.js +0 -1876
  216. package/dist/_commonjsHelpers-DKOUU3wS.js +0 -1
  217. package/dist/_commonjsHelpers-DaMA6jEr.mjs +0 -8
  218. package/dist/cli/commands/app/app-generate.d.ts +0 -4
  219. package/dist/cli/utilities/build/common/front-component-build/react-globals-plugin.d.ts +0 -1
  220. package/dist/cli/utilities/build/common/front-component-build/twenty-sdk-globals-plugin.d.ts +0 -1
  221. package/dist/cli/utilities/build/common/front-component-build/twenty-sdk-ui-globals-plugin.d.ts +0 -1
  222. package/dist/cli/utilities/build/common/front-component-build/twenty-shared-globals-plugin.d.ts +0 -1
  223. package/dist/cli/utilities/build/common/front-component-build/types/ParsedImportSpecifier.d.ts +0 -4
  224. package/dist/cli/utilities/build/common/front-component-build/utils/collect-named-imports.d.ts +0 -4
  225. package/dist/cli/utilities/build/common/front-component-build/utils/create-front-component-build-options.d.ts +0 -13
  226. package/dist/cli/utilities/build/common/front-component-build/utils/create-globals-plugin.d.ts +0 -15
  227. package/dist/cli/utilities/build/common/front-component-build/utils/extract-names-from-import-specifier.d.ts +0 -2
  228. package/dist/cli/utilities/build/common/front-component-build/utils/replace-html-tags-with-remote-components.d.ts +0 -1
  229. package/dist/cli/utilities/dev/dev-mode-orchestrator.d.ts +0 -42
  230. package/dist/cli/utilities/dev/dev-ui-state-manager.d.ts +0 -31
  231. package/dist/cli/utilities/dev/dev-ui-state.d.ts +0 -27
  232. package/dist/front-component/__stories__/FrontComponentRenderer.stories.d.ts +0 -9
  233. package/dist/front-component/__stories__/mocks/interactive.front-component.d.ts +0 -7
  234. package/dist/front-component/__stories__/mocks/lifecycle.front-component.d.ts +0 -7
  235. package/dist/front-component/__stories__/mocks/static.front-component.d.ts +0 -7
  236. package/dist/front-component/__stories__/utils/buildMockComponents.d.ts +0 -1
  237. package/dist/front-component/__stories__/utils/loadBuiltComponent.d.ts +0 -1
  238. package/dist/front-component/host/components/FrontComponentRenderer.d.ts +0 -13
  239. package/dist/front-component/host/generated/host-index.d.ts +0 -1
  240. package/dist/front-component/index.cjs +0 -1
  241. package/dist/front-component/index.mjs +0 -5736
  242. package/dist/front-component/remote/components/FrontComponentHostCommunicationApiEffect.d.ts +0 -8
  243. package/dist/front-component/remote/components/FrontComponentUpdateContextEffect.d.ts +0 -10
  244. package/dist/front-component/remote/generated/remote-components.d.ts +0 -299
  245. package/dist/front-component/remote/generated/remote-elements.d.ts +0 -3335
  246. package/dist/front-component/remote/generated/remote-index.d.ts +0 -2
  247. package/dist/front-component/remote/mock/mock-front-component.d.ts +0 -3
  248. package/dist/front-component/remote/worker/remote-worker.d.ts +0 -0
  249. package/dist/front-component/types/FrontComponentHostCommunicationApi.d.ts +0 -4
  250. package/dist/front-component/types/PropertySchema.d.ts +0 -4
  251. package/dist/index.d.ts +0 -1
  252. package/dist/isValidCountryCode-ujmwsK7z-B8kSH7O8.mjs +0 -10248
  253. package/dist/isValidCountryCode-ujmwsK7z-DwSvvT1u.js +0 -25
  254. package/dist/navigation-_M4-TT0O.js +0 -503
  255. package/dist/navigation-udgao_jA.mjs +0 -30041
  256. package/dist/sdk/front-component-common/HtmlCommonProperties.d.ts +0 -2
  257. package/dist/sdk/front-component-common/HtmlTagToRemoteComponent.d.ts +0 -1
  258. package/dist/sdk/front-component-common/index.d.ts +0 -7
  259. /package/dist/{front-component → front-component-renderer}/host/generated/host-component-registry.d.ts +0 -0
  260. /package/dist/{front-component → front-component-renderer}/remote/components/FrontComponentErrorEffect.d.ts +0 -0
  261. /package/dist/{front-component → front-component-renderer}/remote/utils/exposeGlobals.d.ts +0 -0
  262. /package/dist/{front-component/remote/worker → front-component-renderer/remote/worker/utils}/createRemoteWorker.d.ts +0 -0
  263. /package/dist/sdk/{front-component-common → front-component-api/constants}/AllowedHtmlElements.d.ts +0 -0
  264. /package/dist/sdk/{front-component-common → front-component-api/constants}/CommonHtmlEvents.d.ts +0 -0
  265. /package/dist/sdk/{front-component-common → front-component-api/constants}/EventToReact.d.ts +0 -0
  266. /package/dist/sdk/{front-component-common → front-component-api/constants}/SerializedEventData.d.ts +0 -0
package/dist/cli.cjs CHANGED
@@ -1,40 +1,63 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var am=Object.create;var ou=Object.defineProperty;var om=Object.getOwnPropertyDescriptor;var um=Object.getOwnPropertyNames;var cm=Object.getPrototypeOf,lm=Object.prototype.hasOwnProperty;var fm=(c,a,i,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let g of um(a))!lm.call(c,g)&&g!==i&&ou(c,g,{get:()=>a[g],enumerable:!(f=om(a,g))||f.enumerable});return c};var uu=(c,a,i)=>(i=c!=null?am(cm(c)):{},fm(a||!c||!c.__esModule?ou(i,"default",{value:c,enumerable:!0}):i,c));const ie=require("path"),hm=require("chalk"),gu=require("fs-extra"),pm=require("crypto"),dm=require("node:fs/promises"),je=require("./isValidCountryCode-ujmwsK7z-DwSvvT1u.js"),gm=require("@sniptt/guards"),mm=require("lodash.camelcase"),ft=require("./HtmlTagToRemoteComponent-B6lQe_K8.js"),vm=require("fs/promises"),_m=require("esbuild"),wm=require("chokidar"),ym=require("os"),xm=require("axios"),Sm=require("fs"),Am=require("graphql-sse"),As=require("graphql/index"),bm=require("typescript"),Em=require("module"),mu=require("fast-glob"),W=require("react/jsx-runtime"),Cm=require("@genql/cli"),Tm=require("inquirer"),bt=require("./_commonjsHelpers-DKOUU3wS.js"),Qn=require("uuid"),vu=require("commander"),Fm=require("util"),Rn=c=>c&&c.__esModule?c:{default:c};function Gt(c){if(c&&c.__esModule)return c;const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const f=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(a,i,f.get?f:{enumerable:!0,get:()=>c[i]})}}return a.default=c,Object.freeze(a)}const ee=Gt(ie),b=Rn(hm),V=Gt(gu),_u=Rn(pm),Im=Gt(dm),Rm=Rn(mm),Fs=Gt(vm),wu=Gt(_m),yu=Rn(wm),Is=Gt(ym),zr=Rn(xm),cu=Gt(Sm),Fn=Gt(bm),At=Rn(Tm),Pm=c=>gm.isNonEmptyString(c)?c[0].toUpperCase()+c.slice(1):"",Om=c=>Pm(Rm.default(c)),Lm=c=>typeof c=="object"&&c!==null&&!Array.isArray(c),Et=process.env.INIT_CWD||process.cwd(),Yn=c=>c&&!c?.startsWith("/")?ie.join(Et,c):c,Mm=async(c,a,i)=>{const f=new Set(i),g=a.filter(_=>!f.has(_));for(const _ of g){const S=_.replace(/\.tsx?$/,".mjs"),A=ee.default.join(c,S),I=`${A}.map`;await V.remove(A),await V.remove(I)}},Nm=async({result:c,appPath:a,fileFolder:i,lastChecksums:f,onFileBuilt:g})=>{const _=Object.keys(c.metafile?.outputs??{}).filter(S=>S.endsWith(".mjs"));for(const S of _){const A=ee.default.resolve(S),I=ee.default.relative(a,A),P=c.metafile?.outputs?.[S]?.entryPoint||"",J=ee.default.relative(a,P),G=await V.readFile(A),K=_u.default.createHash("md5").update(G).digest("hex");f.get(I)!==K&&(f.set(I,K),g&&await g({fileFolder:i,builtPath:I,sourcePath:J,checksum:K}))}},Um=["react-dom"],Wm="RemoteComponents",Dm=()=>{const c=Object.keys(ft.HTML_TAG_TO_REMOTE_COMPONENT).join("|");return new RegExp(`(<\\/?)\\b(${c})\\b(?=[\\s>\\/>])`,"g")},$m=Dm(),Bm=c=>c.replace($m,(a,i,f)=>{const g=ft.HTML_TAG_TO_REMOTE_COMPONENT[f];return je.Tr(g)?`${i}${Wm}.${g}`:a}),km=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,lu=/export\s+default\s+defineFrontComponent\s*\(\s*\{[^}]*component\s*:\s*(\w+)[^}]*\}\s*\)\s*;?/s,jm=c=>{let a=c.replace(km,"");const i=a.match(lu);if(i){const f=i[1],g=new RegExp(`export\\s+(const|function)\\s+${f}\\b`);a=a.replace(g,`$1 ${f}`),a=a.replace(lu,`export default globalThis.jsx(${f}, {});`)}return a},qm={name:"jsx-transform-to-remote-dom-worker-format-plugin",setup:c=>{c.onLoad({filter:/\.tsx$/},async({path:a})=>{try{const i=await Im.readFile(a,"utf8"),f=Bm(i),g=f!==i,_=jm(f);return{contents:g?`var RemoteComponents = globalThis.RemoteComponents;
3
- ${_}`:_,loader:"tsx"}}catch(i){return{errors:[{text:`Failed to transform front component: ${i instanceof Error?i.message:String(i)}`,location:{file:a}}]}}})}},Gm=/^(\w+)\s+as\s+(\w+)$/,Hm=c=>{const a=c.trim(),i=a.match(Gm);if(je.Tr(i)){const[,f,g]=i;return{originalName:f,aliasName:g}}return{originalName:a,aliasName:a}},Km=c=>c.split(",").map(a=>a.trim()).filter(a=>a.length>0).filter(a=>!a.startsWith("type ")).map(a=>Hm(a).originalName),Zr=({sourceContent:c,pattern:a})=>{const i=new Map;let f;for(;je.Tr(f=a.exec(c));){const g=f.groups?.namedImports,_=f.groups?.subPath??"";i.has(_)||i.set(_,new Set),g&&Km(g).forEach(S=>i.get(_)?.add(S))}return a.lastIndex=0,i},Xr=c=>{const a=c.namespace??c.pluginName;return{name:c.pluginName,setup:i=>{const f=new Map;i.onStart(()=>{f.clear()}),i.onResolve({filter:c.moduleFilter},async({importer:g,path:_})=>{if(g&&!f.has(g))try{const S=await Fs.readFile(g,"utf-8");f.set(g,c.collectImports(S))}catch{f.set(g,new Map)}return{path:g?`${_}?importer=${encodeURIComponent(g)}`:_,namespace:a,pluginData:{importerFilePath:g,originalPath:_}}}),i.onLoad({filter:/.*/,namespace:a},({pluginData:g})=>{const{originalPath:_,importerFilePath:S}=g;if(c.staticContents?.[_])return{contents:c.staticContents[_],loader:"js"};const A=_===c.moduleName?"":_.replace(`${c.moduleName}/`,""),P=f.get(S)?.get(A)??new Set;return{contents:c.generateExports({namedImports:P,moduleSubPath:A}),loader:"js"}})}}},bs=/import\s+(?:(?<defaultImport>\w+)\s*,?\s*)?(?:\{(?<namedImports>[^}]*)\})?\s*from\s*['"]react['"];?/g,zm=/^react(\/jsx-runtime)?$/,Jm=`
4
- export var jsx = /* @__PURE__ */ (() => globalThis.jsx)();
5
- export var jsxs = /* @__PURE__ */ (() => globalThis.jsxs)();
6
- export var Fragment = /* @__PURE__ */ (() => globalThis.React.Fragment)();
7
- `.trim(),Ym=c=>{const a=Zr({sourceContent:c,pattern:bs});let i;for(;je.Tr(i=bs.exec(c));)i.groups?.defaultImport&&(a.has("")||a.set("",new Set),a.get("").add("default"));return bs.lastIndex=0,a},Zm=({namedImports:c})=>{const a=[];for(const i of c)i==="default"?a.push("export default /* @__PURE__ */ (() => globalThis.React)();"):a.push(`export var ${i} = /* @__PURE__ */ (() => globalThis.React.${i})();`);return a.join(`
8
- `)},Xm=Xr({pluginName:"react-globals",namespace:"react-globals",moduleName:"react",moduleFilter:zm,collectImports:Ym,generateExports:Zm,staticContents:{"react/jsx-runtime":Jm}}),Qm=/^\/\/.*$\n/gm,Vm={name:"strip-comments",setup:c=>{c.onEnd(async a=>{if(a.errors.length>0)return;const i=Object.keys(a.metafile?.outputs??{}).filter(f=>f.endsWith(".mjs"));for(const f of i){const g=ee.default.resolve(f),_=await Fs.readFile(g,"utf-8"),S=_.replace(Qm,"");S!==_&&await Fs.writeFile(g,S,"utf-8")}})}},e0=/import\s+(?:\{(?<namedImports>[^}]*)\})?\s*from\s*['"]twenty-sdk['"];?/g,t0=/^twenty-sdk$/,n0=Xr({pluginName:"twenty-sdk-globals",namespace:"twenty-sdk-globals",moduleName:"twenty-sdk",moduleFilter:t0,collectImports:c=>Zr({sourceContent:c,pattern:e0}),generateExports:({namedImports:c})=>[...c].map(a=>`export var ${a} = /* @__PURE__ */ (() => globalThis.TwentySdk.${a})();`).join(`
9
- `)}),r0=/import\s+\{(?<namedImports>[^}]*)\}\s*from\s*['"]twenty-sdk\/ui['"];?/g,i0=/^twenty-sdk\/ui$/,s0=Xr({pluginName:"twenty-sdk-ui-globals",namespace:"twenty-sdk-ui-globals",moduleName:"twenty-sdk/ui",moduleFilter:i0,collectImports:c=>Zr({sourceContent:c,pattern:r0}),generateExports:({namedImports:c})=>[...c].map(a=>`export var ${a} = /* @__PURE__ */ (() => globalThis.RemoteComponents.TwentyUi${a})();`).join(`
10
- `)}),a0=/import\s+\{(?<namedImports>[^}]*)\}\s*from\s*['"]twenty-shared(?:\/(?<subPath>[^'"]*?))?['"];?/g,o0=/^twenty-shared(\/.*)?$/,u0=c=>c===""?"globalThis.TwentyShared":`globalThis.TwentyShared['${c}']`,c0=Xr({pluginName:"twenty-shared-globals",namespace:"twenty-shared-globals",moduleName:"twenty-shared",moduleFilter:o0,collectImports:c=>Zr({sourceContent:c,pattern:a0}),generateExports:({namedImports:c,moduleSubPath:a})=>{const i=u0(a);return[...c].map(f=>`export var ${f} = /* @__PURE__ */ (() => ${i}.${f})();`).join(`
11
- `)}}),l0=()=>[Xm,n0,s0,c0,qm,Vm],Rs="public",f0="TWENTY_API_KEY",h0="TWENTY_API_URL",p0={js:`import { createRequire as __createRequire } from 'module';
12
- const require = __createRequire(import.meta.url);`},qt=".twenty/output";var ve=(c=>(c.Object="object",c.Field="field",c.LogicFunction="logicFunction",c.FrontComponent="frontComponent",c.Role="role",c))(ve||{});const d0=["path","fs","crypto","stream","util","os","url","http","https","events","buffer","querystring","assert","zlib","net","tls","child_process","worker_threads","twenty-sdk","twenty-sdk/*","twenty-shared","twenty-shared/*"];class xu{constructor(a){this.esBuildContext=null,this.isRestarting=!1,this.lastChecksums=new Map,this.buildCompletePromise=Promise.resolve(),this.resolveBuildComplete=null,this.appPath=a.appPath,this.sourcePaths=a.sourcePaths,this.watchMode=a.watch??!0,this.onFileBuilt=a.handleFileBuilt,this.onBuildError=a.handleBuildError,this.config=a.config}shouldRestart(a){const i=this.sourcePaths.sort().join(","),f=[...a].sort().join(",");return i!==f}async start(){this.sourcePaths.length>0&&await this.createContext()}async close(){await this.esBuildContext?.dispose(),this.esBuildContext=null}async restart(a){if(!this.isRestarting){this.isRestarting=!0;try{await this.close();const i=ee.default.join(this.appPath,qt);await Mm(i,this.sourcePaths,a),this.sourcePaths=a,this.lastChecksums.clear(),this.sourcePaths.length>0&&await this.createContext()}finally{this.isRestarting=!1}}}async createContext(){const a=ee.default.join(this.appPath,qt),i={};for(const _ of this.sourcePaths){const S=_.replace(/\.tsx?$/,"");i[S]=ee.default.join(this.appPath,_)}const f=this,g=[...this.config.extraPlugins??[],{name:"build-notifications",setup:_=>{_.onEnd(async S=>{try{if(S.errors.length>0){S.errors[0].text.includes("Could not resolve")||await this.onBuildError?.(S.errors.map(A=>({error:A.text,location:A.location})));return}await Nm({result:S,appPath:this.appPath,fileFolder:this.config.fileFolder,lastChecksums:f.lastChecksums,onFileBuilt:f.onFileBuilt})}finally{f.resolveBuildComplete?.()}})}}];this.esBuildContext=await wu.context({entryPoints:i,bundle:!0,splitting:!1,format:"esm",platform:this.config.platform,outdir:a,outExtension:{".js":".mjs"},external:this.config.externalModules,tsconfig:ee.default.join(this.appPath,"tsconfig.json"),jsx:this.config.jsx,sourcemap:!0,metafile:!0,logLevel:"silent",minify:this.config.minify,banner:this.config.banner,plugins:g}),this.buildCompletePromise=new Promise(_=>{this.resolveBuildComplete=_}),await this.esBuildContext.rebuild(),await this.buildCompletePromise,this.watchMode&&await this.esBuildContext.watch()}}const g0={name:"external-patterns",setup:c=>{c.onResolve({filter:/(?:^|\/)generated(?:\/|$)/},a=>({path:a.path,external:!0}))}},m0=c=>new xu({...c,config:{externalModules:d0,fileFolder:ft.N.BuiltLogicFunction,platform:"node",extraPlugins:[g0],banner:p0}}),v0=c=>new xu({...c,config:{externalModules:Um,fileFolder:ft.N.BuiltFrontComponent,jsx:"automatic",extraPlugins:l0()}});class _0{constructor(a){this.watcher=null,this.appPath=a.appPath,this.handleChangeDetected=a.handleChangeDetected}async start(){this.watcher=yu.default.watch(this.appPath,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50},usePolling:!0}),this.watcher.on("all",async(a,i)=>{if(a==="addDir")return;const f=ie.relative(this.appPath,i),g=f.startsWith("node_modules")||f.startsWith("generated")||f.startsWith("dist"),_=f.startsWith(Rs),S=["package.json","yarn.lock"].includes(f),A=f.endsWith(".ts")||f.endsWith(".tsx"),I=f.startsWith(".");(g||!A||I)&&!_&&!S||this.handleChangeDetected(f,a)})}async close(){await this.watcher?.close()}}const w0=({manifest:c,builtFileInfos:a})=>{let i=structuredClone(c);for(const[f,{fileFolder:g,checksum:_}]of a.entries()){const S=ie.relative(qt,f);if(g===ft.N.BuiltLogicFunction){const A=i.logicFunctions,I=A.findIndex(P=>P.builtHandlerPath===S);if(I===-1)continue;i={...i,logicFunctions:A.map((P,J)=>J===I?{...P,builtHandlerChecksum:_}:P)}}if(g===ft.N.PublicAsset){const A=i.publicAssets,I=A.findIndex(P=>P.filePath===S);if(I===-1)continue;i={...i,publicAssets:A.map((P,J)=>J===I?{...P,checksum:_}:P)};continue}if(g===ft.N.BuiltFrontComponent){const A=i.frontComponents,I=A.findIndex(P=>P.builtComponentPath===S)??-1;if(I===-1)continue;i={...i,frontComponents:A.map((P,J)=>J===I?{...P,builtComponentChecksum:_}:P)}}g===ft.N.Dependencies&&(S==="package.json"&&(i.application.packageJsonChecksum=_),S==="yarn.lock"&&(i.application.yarnLockChecksum=_))}return i},y0=async(c,a)=>{const i=ee.default.join(c,qt);await V.ensureDir(i);const f=ee.default.join(i,"manifest.json");return await V.writeJSON(f,a,{spaces:2}),f},x0=ee.join(Is.tmpdir(),".twenty-sdk-test"),S0=()=>process.env.NODE_ENV==="test"?ee.join(x0,"config.json"):ee.join(Is.homedir(),".twenty","config.json"),St="default",Yr=class Yr{constructor(){this.configPath=S0()}static setActiveWorkspace(a){this.activeWorkspace=a??St}static getActiveWorkspace(){return this.activeWorkspace}getActiveWorkspaceName(){return Yr.getActiveWorkspace()}async readRawConfig(){await V.ensureFile(this.configPath);const a=await V.readFile(this.configPath,"utf8");return JSON.parse(a||"{}")}async getConfig(){return this.getConfigForWorkspace(this.getActiveWorkspaceName())}async getConfigForWorkspace(a){const i=this.getDefaultConfig();try{const f=await this.readRawConfig(),g=a===St&&!f.profiles?.[St]?f:f.profiles?.[a],_=g?.apiUrl??i.apiUrl,S=g?.apiKey;return{apiUrl:_,apiKey:S}}catch{return i}}async setConfig(a){const i=await this.readRawConfig(),f=this.getActiveWorkspaceName();i.profiles||(i.profiles={});const g=i.profiles[f]||{apiUrl:""};i.profiles[f]={...g,...a},await V.ensureDir(ee.dirname(this.configPath)),await V.writeFile(this.configPath,JSON.stringify(i,null,2))}async clearConfig(){const a=await this.readRawConfig(),i=this.getActiveWorkspaceName();if(a.profiles||(a.profiles={}),a.profiles[i]&&delete a.profiles[i],i===St){const f=this.getDefaultConfig();delete a.apiKey,a.apiUrl=f.apiUrl}await V.ensureDir(ee.dirname(this.configPath)),await V.writeFile(this.configPath,JSON.stringify(a,null,2))}getDefaultConfig(){return{apiUrl:"http://localhost:3000"}}async getAvailableWorkspaces(){try{const a=await this.readRawConfig(),i=new Set;return i.add(St),a.profiles&&Object.keys(a.profiles).forEach(f=>i.add(f)),Array.from(i).sort()}catch{return[St]}}async getDefaultWorkspace(){try{return(await this.readRawConfig()).defaultWorkspace??St}catch{return St}}async setDefaultWorkspace(a){const i=await this.readRawConfig();i.defaultWorkspace=a,await V.ensureDir(ee.dirname(this.configPath)),await V.writeFile(this.configPath,JSON.stringify(i,null,2))}};Yr.activeWorkspace=St;let Ae=Yr;class Ct{constructor(a){const{disableInterceptors:i=!1}=a||{};this.configService=new Ae,this.client=zr.default.create(),this.client.interceptors.request.use(async f=>{const g=await this.configService.getConfig();return f.baseURL=g.apiUrl,g.apiKey&&(f.headers.Authorization=`Bearer ${g.apiKey}`),f}),!i&&this.client.interceptors.response.use(f=>f,f=>{throw f.response?.status===401?console.error(b.default.red("Authentication failed. Please run `twenty auth:login` first.")):f.response?.status===403?console.error(b.default.red("Access denied. Check your API key and workspace permissions.")):f.code==="ECONNREFUSED"&&console.error(b.default.red("Cannot connect to Twenty server. Is it running?")),f})}async validateAuth(){try{const i=await this.client.post("/metadata",{query:`
2
+ "use strict";var wm=Object.create;var tl=Object.defineProperty;var xm=Object.getOwnPropertyDescriptor;var Sm=Object.getOwnPropertyNames;var Am=Object.getPrototypeOf,Im=Object.prototype.hasOwnProperty;var Fm=(o,s,r,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let p of Sm(s))!Im.call(o,p)&&p!==r&&tl(o,p,{get:()=>s[p],enumerable:!(l=xm(s,p))||l.enumerable});return o};var Em=(o,s,r)=>(r=o!=null?wm(Am(o)):{},Fm(s||!o||!o.__esModule?tl(r,"default",{value:o,enumerable:!0}):r,o));const $=require("path"),Tm=require("chalk"),L=require("react/jsx-runtime"),Gn=require("react"),fl=require("fs-extra"),bm=require("os"),Cm=require("axios"),Pm=require("fs"),Rm=require("graphql-sse"),ds=require("graphql"),P=require("./HtmlTagToRemoteComponent-DzQ2I9Lz.js"),Om=require("@genql/cli"),Lm=require("typescript"),km=require("esbuild"),Nm=require("module"),pl=require("fast-glob");require("@sniptt/guards");const We=require("uuid"),Um=require("crypto"),Dm=require("node:fs/promises"),Wm=require("fs/promises"),dl=require("node:child_process"),$m=require("node:path"),Mm=require("chokidar"),Bm=require("inquirer"),jm=require("lodash.kebabcase"),hl=require("commander"),qm=require("util"),Mt=o=>o&&o.__esModule?o:{default:o};function Bt(o){if(o&&o.__esModule)return o;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(s,r,l.get?l:{enumerable:!0,get:()=>o[r]})}}return s.default=o,Object.freeze(s)}const Y=Bt($),A=Mt(Tm),gl=Mt(Gn),k=Bt(fl),ms=Bt(bm),hn=Mt(Cm),nl=Bt(Pm),gn=Bt(Lm),ml=Bt(km),Hr=Mt(Um),Hm=Bt(Dm),rl=Bt(Wm),jr=Mt($m),vl=Mt(Mm),ot=Mt(Bm),Ze=Mt(jm);var Mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const Ie=process.env.INIT_CWD||process.cwd(),jn=o=>o&&!o?.startsWith("/")?$.join(Ie,o):o,Br="api-client",vs="public",Gm="TWENTY_API_KEY",il="TWENTY_API_URL",Gr="generated",Jm={js:`import { createRequire as __createRequire } from 'module';
3
+ const require = __createRequire(import.meta.url);`},Qe=".twenty/output";var K=(o=>(o.Object="object",o.Field="field",o.LogicFunction="logicFunction",o.FrontComponent="frontComponent",o.Role="role",o.Skill="skill",o.View="view",o.NavigationMenuItem="navigationMenuItem",o.PageLayout="pageLayout",o))(K||{});const Xe={idle:{color:"gray",icon:""},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},zm=o=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[o],Km=o=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[o],Vm=o=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[o],Ym={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},yl=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],_l=["↑","⇡","↟","⤒"],wl={[K.Object]:"Objects",[K.Field]:"Fields",[K.LogicFunction]:"Logic functions",[K.FrontComponent]:"Front components",[K.Role]:"Roles",[K.Skill]:"Skills",[K.View]:"Views",[K.NavigationMenuItem]:"Navigation menu items",[K.PageLayout]:"Page layouts"},xl=Object.keys(wl),Xm={info:"gray",success:"green",error:"red",warning:"yellow"},Zm=o=>o.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),Qm=(o,s=40)=>{if(o.length<=s)return o;const r=o.split("/");return r.length<=2?o:`.../${r.slice(-2).join("/")}`},ev=o=>{const s=new Map;for(const r of xl)s.set(r,[]);for(const r of o.values()){if(!r.type)continue;const l=s.get(r.type)??[];l.push(r),s.set(r.type,l)}return s},tv=o=>!o.frontendUrl||!o.steps.resolveApplication.output.universalIdentifier?null:`${o.frontendUrl}/settings/applications`,nv=o=>o.some(s=>s==="error")?"error":o.some(s=>s==="in_progress")?"in_progress":o.every(s=>s==="done")?"done":"idle",rv=o=>{const s=[...o.entities.values()],r=s.some(v=>v.status==="error"),l=s.some(v=>v.status==="building"),p=s.length>0&&s.every(v=>v.status==="uploading"||v.status==="success"),m=r?"error":l?"in_progress":p?"done":"idle";return[{label:"Application Initialization",status:nv([o.steps.checkServer.status,o.steps.ensureValidTokens.status,o.steps.resolveApplication.status])},{label:"Resources Build",status:m},{label:"Resources Upload",status:o.steps.uploadFiles.status},{label:"Manifest Build",status:o.steps.buildManifest.status},{label:"Application Synchronization",status:o.steps.syncApplication.status},{label:"Api Client Generation",status:o.steps.generateApiClient.status}]},sl=(o,s=80,r=!0)=>{const[l,p]=Gn.useState(0);return Gn.useEffect(()=>{if(!r)return;const m=setInterval(()=>{p(v=>(v+1)%o.length)},s);return()=>clearInterval(m)},[o,s,r]),o[l]},ys=o=>{const s=Xe[o],r=sl(yl,80,s.icon==="spinner"),l=sl(_l,200,s.icon==="upload");return s.icon==="spinner"?r:s.icon==="upload"?l:s.icon},Sl=gl.default.createContext(null),iv=Sl.Provider,Et=()=>{const o=gl.default.useContext(Sl);if(!o)throw new Error("useInk must be used within InkProvider");return o},sv=({uiStatus:o})=>{const{Text:s}=Et(),r=ys(o),l=Xe[o];return L.jsxs(s,{color:l.color,children:[r," "]})},av=({entity:o})=>{const{Box:s,Text:r}=Et();return L.jsxs(s,{children:[L.jsx(sv,{uiStatus:Km(o.status)}),L.jsx(r,{children:o.name}),o.path!==o.name&&L.jsxs(r,{dimColor:!0,children:[" (",Qm(o.path),")"]})]})},ov=({type:o,entities:s})=>{const{Box:r,Text:l}=Et();return s.length===0?null:L.jsxs(r,{flexDirection:"column",marginTop:1,children:[L.jsx(l,{bold:!0,dimColor:!0,children:wl[o]}),s.map(p=>L.jsx(av,{entity:p},p.path))]})},lv=()=>{const{Box:o,Text:s}=Et();return L.jsx(o,{marginTop:1,children:L.jsxs(s,{dimColor:!0,children:[L.jsx(s,{color:Xe.idle.color,children:Xe.idle.icon})," ","pending"," ",L.jsx(s,{color:Xe.in_progress.color,children:yl[0]})," ","building"," ",L.jsx(s,{color:Xe.uploading.color,children:_l[0]})," ","uploading"," ",L.jsx(s,{color:Xe.done.color,children:Xe.done.icon})," ","success"," ",L.jsx(s,{color:Xe.error.color,children:Xe.error.icon})," ","error"]})})},uv=({state:o})=>{const{Text:s}=Et(),r=Vm(o.pipeline.status),l=ys(r),p=Xe[r],m=Ym[o.pipeline.status];return L.jsxs(s,{color:p.color,children:[l," ",m,o.pipeline.error&&`: ${o.pipeline.error}`]})},cv=({label:o,status:s})=>{const{Box:r,Text:l}=Et(),p=zm(s),m=ys(p),v=Xe[p];return L.jsxs(r,{children:[L.jsxs(l,{dimColor:!0,children:[o,": "]}),L.jsxs(l,{color:v.color,children:[m," ",s.replace("_"," ")]})]})},fv=({state:o})=>{const{Box:s,Text:r}=Et(),l=ev(o.entities),p=tv(o);return L.jsxs(s,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[L.jsx(r,{bold:!0,color:"cyan",children:"Application"}),L.jsxs(s,{marginLeft:2,flexDirection:"column",children:[L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Name: "}),L.jsx(r,{bold:!0,children:o.pipeline.appName??"Loading..."})]}),L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Overall Status: "}),L.jsx(uv,{state:o})]}),p&&L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Open:"}),L.jsxs(r,{bold:!0,color:"cyan",children:[" ",p]})]})]}),L.jsx(s,{marginLeft:2,flexDirection:"column",marginTop:1,children:rv(o).map(m=>L.jsx(cv,{label:m.label,status:m.status},m.label))}),L.jsx(s,{marginLeft:2,flexDirection:"column",children:xl.map(m=>{const v=l.get(m)??[];return L.jsx(ov,{type:m,entities:v},m)})})]})},pv=({event:o})=>{const{Box:s,Text:r}=Et(),l=Xm[o.status],p=Zm(o.timestamp);return L.jsxs(s,{children:[L.jsxs(r,{dimColor:!0,children:[p," "]}),L.jsx(r,{color:l,children:o.message})]})},dv=({uiStateManager:o})=>{const{Box:s,Static:r}=Et(),[,l]=Gn.useReducer(m=>m+1,0);Gn.useEffect(()=>o.subscribe(()=>l()),[o]);const p=o.getSnapshot();return L.jsxs(L.Fragment,{children:[L.jsx(r,{items:p.events,children:m=>L.jsx(pv,{event:m},m.id)}),L.jsxs(s,{marginTop:1,flexDirection:"column",children:[L.jsx(fv,{state:p}),L.jsx(lv,{})]})]})},hv=async o=>{const s=await import("ink"),{render:r,Box:l,Text:p,Static:m}=s,{unmount:v}=r(L.jsx(iv,{value:{Box:l,Text:p,Static:m},children:L.jsx(dv,{uiStateManager:o})}));return{unmount:v}};class gv{constructor(s){this.listeners=new Set,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){for(const s of this.listeners)s(this.orchestratorState)}}const mv=Y.join(ms.tmpdir(),".twenty-sdk-test"),vv=()=>process.env.NODE_ENV==="test"?Y.join(mv,"config.json"):Y.join(ms.homedir(),".twenty","config.json"),Ft="default",qr=class qr{constructor(){this.configPath=vv()}static setActiveWorkspace(s){this.activeWorkspace=s??Ft}static getActiveWorkspace(){return this.activeWorkspace}getActiveWorkspaceName(){return qr.getActiveWorkspace()}async readRawConfig(){await k.ensureFile(this.configPath);const s=await k.readFile(this.configPath,"utf8");return JSON.parse(s||"{}")}async getConfig(){return this.getConfigForWorkspace(this.getActiveWorkspaceName())}async getConfigForWorkspace(s){const r=this.getDefaultConfig();try{const l=await this.readRawConfig(),p=s===Ft&&!l.profiles?.[Ft]?l:l.profiles?.[s],m=p?.apiUrl??r.apiUrl,v=p?.apiKey,E=p?.applicationAccessToken,b=p?.applicationRefreshToken;return{apiUrl:m,apiKey:v,applicationAccessToken:E,applicationRefreshToken:b}}catch{return r}}async setConfig(s){const r=await this.readRawConfig(),l=this.getActiveWorkspaceName();r.profiles||(r.profiles={});const p=r.profiles[l]||{apiUrl:""};r.profiles[l]={...p,...s},await k.ensureDir(Y.dirname(this.configPath)),await k.writeFile(this.configPath,JSON.stringify(r,null,2))}async clearConfig(){const s=await this.readRawConfig(),r=this.getActiveWorkspaceName();if(s.profiles||(s.profiles={}),s.profiles[r]&&delete s.profiles[r],r===Ft){const l=this.getDefaultConfig();delete s.apiKey,s.apiUrl=l.apiUrl}await k.ensureDir(Y.dirname(this.configPath)),await k.writeFile(this.configPath,JSON.stringify(s,null,2))}getDefaultConfig(){return{apiUrl:"http://localhost:3000"}}async getAvailableWorkspaces(){try{const s=await this.readRawConfig(),r=new Set;return r.add(Ft),s.profiles&&Object.keys(s.profiles).forEach(l=>r.add(l)),Array.from(r).sort()}catch{return[Ft]}}async getDefaultWorkspace(){try{return(await this.readRawConfig()).defaultWorkspace??Ft}catch{return Ft}}async setDefaultWorkspace(s){const r=await this.readRawConfig();r.defaultWorkspace=s,await k.ensureDir(Y.dirname(this.configPath)),await k.writeFile(this.configPath,JSON.stringify(r,null,2))}};qr.activeWorkspace=Ft;let we=qr;class Tt{constructor(s){const{disableInterceptors:r=!1}=s||{};this.configService=new we,this.client=hn.default.create(),this.client.interceptors.request.use(async l=>{const p=await this.configService.getConfig();return l.baseURL=p.apiUrl,!l.headers.Authorization&&p.apiKey&&(l.headers.Authorization=`Bearer ${p.apiKey}`),l}),!r&&this.client.interceptors.response.use(l=>l,l=>{throw l.response?.status===401?console.error(A.default.red("Authentication failed. Please run `twenty auth:login` first.")):l.response?.status===403?console.error(A.default.red("Access denied. Check your API key and workspace permissions.")):l.code==="ECONNREFUSED"&&console.error(A.default.red("Cannot connect to Twenty server. Is it running?")),l})}async validateAuth(){try{const r=await this.client.post("/metadata",{query:`
13
4
  query CurrentWorkspace {
14
5
  currentWorkspace {
15
6
  id
16
7
  }
17
8
  }
18
- `},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return{authValid:i.status===200&&!i.data.errors,serverUp:i.status===200}}catch{return{authValid:!1,serverUp:!1}}}async checkApplicationExist(a){try{const f=await this.client.post("/metadata",{query:`
19
- query CheckApplicationExist($universalIdentifier: UUID!) {
20
- checkApplicationExist(universalIdentifier: $universalIdentifier)
9
+ `},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return{authValid:r.status===200&&!r.data.errors,serverUp:r.status===200}}catch{return{authValid:!1,serverUp:!1}}}async findOneApplication(s){try{const l=await this.client.post("/metadata",{query:`
10
+ query FindOneApplication($universalIdentifier: UUID!) {
11
+ findOneApplication(universalIdentifier: $universalIdentifier) {
12
+ id
13
+ universalIdentifier
14
+ }
15
+ }
16
+ `,variables:{universalIdentifier:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return l.data.errors?l.data.errors.some(m=>m.extensions?.code==="NOT_FOUND")?{success:!0,data:null}:{success:!1,error:l.data.errors[0]}:{success:!0,data:l.data.data.findOneApplication}}catch(r){return{success:!1,error:r}}}async generateApplicationToken(s){try{const l=await this.client.post("/metadata",{query:`
17
+ mutation GenerateApplicationToken($applicationId: UUID!) {
18
+ generateApplicationToken(applicationId: $applicationId) {
19
+ applicationAccessToken {
20
+ token
21
+ expiresAt
22
+ }
23
+ applicationRefreshToken {
24
+ token
25
+ expiresAt
26
+ }
27
+ }
28
+ }
29
+ `,variables:{applicationId:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return l.data.errors?{success:!1,error:l.data.errors[0]}:{success:!0,data:l.data.data.generateApplicationToken}}catch(r){return{success:!1,error:r}}}async renewApplicationToken(s){try{const l=await this.client.post("/metadata",{query:`
30
+ mutation RenewApplicationToken($applicationRefreshToken: String!) {
31
+ renewApplicationToken(applicationRefreshToken: $applicationRefreshToken) {
32
+ applicationAccessToken {
33
+ token
34
+ expiresAt
35
+ }
36
+ applicationRefreshToken {
37
+ token
38
+ expiresAt
39
+ }
40
+ }
21
41
  }
22
- `,variables:{universalIdentifier:a}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]}:{success:!0,data:f.data.data.checkApplicationExist,message:"Successfully find application"}}catch(i){return{success:!1,error:i}}}async createApplication(a){try{const i=`
42
+ `,variables:{applicationRefreshToken:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return l.data.errors?{success:!1,error:l.data.errors[0]}:{success:!0,data:l.data.data.renewApplicationToken}}catch(r){return{success:!1,error:r}}}async createApplication(s){try{const r=`
23
43
  mutation CreateOneApplication($input: CreateApplicationInput!) {
24
44
  createOneApplication(input: $input) {
25
45
  id
26
46
  universalIdentifier
27
47
  }
28
48
  }
29
- `,f={input:{universalIdentifier:a.application.universalIdentifier,name:a.application.displayName,version:"0.0.1",sourcePath:"cli-sync"}},g=await this.client.post("/metadata",{query:i,variables:f},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return g.data.errors?{success:!1,error:g.data.errors[0]}:{success:!0,data:g.data.data.createOneApplication,message:`Successfully create application: ${a.application.displayName}`}}catch(i){return{success:!1,error:i}}}async syncApplication(a){try{const i=`
49
+ `,l={input:{universalIdentifier:s.application.universalIdentifier,name:s.application.displayName,version:"0.0.1",sourcePath:"cli-sync"}},p=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return p.data.errors?{success:!1,error:p.data.errors[0]}:{success:!0,data:p.data.data.createOneApplication,message:`Successfully create application: ${s.application.displayName}`}}catch(r){return{success:!1,error:r}}}async syncApplication(s){try{const r=`
30
50
  mutation SyncApplication($manifest: JSON!) {
31
- syncApplication(manifest: $manifest)
51
+ syncApplication(manifest: $manifest) {
52
+ applicationUniversalIdentifier
53
+ actions
54
+ }
32
55
  }
33
- `,f={manifest:a},g=await this.client.post("/metadata",{query:i,variables:f},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return g.data.errors?{success:!1,error:g.data.errors[0]}:{success:!0,data:g.data.data.syncApplication,message:`Successfully synced application: ${a.application.displayName}`}}catch(i){return{success:!1,error:i}}}async uninstallApplication(a){try{const i=`
56
+ `,l={manifest:s},p=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return p.data.errors?{success:!1,error:p.data.errors[0]}:{success:!0,data:p.data.data.syncApplication,message:`Successfully synced application: ${s.application.displayName}`}}catch(r){if(hn.default.isAxiosError(r)&&r.response){const l=r.response.data?.errors;return Array.isArray(l)&&l.length>0?{success:!1,error:l[0]?.message||r.message}:{success:!1,error:r.response.data?.message||`HTTP ${r.response.status}: ${r.message}`}}return{success:!1,error:r instanceof Error?r.message:r}}}async uninstallApplication(s){try{const r=`
34
57
  mutation UninstallApplication($universalIdentifier: String!) {
35
58
  uninstallApplication(universalIdentifier: $universalIdentifier)
36
59
  }
37
- `,f={universalIdentifier:a},g=await this.client.post("/metadata",{query:i,variables:f},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return g.data.errors?{success:!1,error:g.data.errors[0]?.message||"Failed to delete application"}:{success:!0,data:g.data.data.uninstallApplication,message:"Successfully uninstalled application"}}catch(i){if(zr.default.isAxiosError(i)&&i.response)return{success:!1,error:i.response.data?.errors?.[0]?.message||i.message};throw i}}async getSchema(){try{const a=As.getIntrospectionQuery(),i=await this.client.post("/graphql",{query:a},{headers:{"Content-Type":"application/json",Accept:"*/*"}});if(i.data.errors)return{success:!1,error:`GraphQL introspection errors: ${JSON.stringify(i.data.errors)}`};const f=As.buildClientSchema(i.data.data);return{success:!0,data:As.printSchema(f),message:"Successfully load schema"}}catch(a){if(zr.default.isAxiosError(a)&&a.response)return{success:!1,error:a.response.data.errors[0]?.message||"Failed to load graphql Schema"};throw a}}async findLogicFunctions(){try{const i=await this.client.post("/metadata",{query:`
60
+ `,l={universalIdentifier:s},p=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return p.data.errors?{success:!1,error:p.data.errors[0]?.message||"Failed to delete application"}:{success:!0,data:p.data.data.uninstallApplication,message:"Successfully uninstalled application"}}catch(r){if(hn.default.isAxiosError(r)&&r.response)return{success:!1,error:r.response.data?.errors?.[0]?.message||r.message};throw r}}async getSchema(s){try{const r=ds.getIntrospectionQuery(),l={"Content-Type":"application/json",Accept:"*/*"};s?.authToken&&(l.Authorization=`Bearer ${s.authToken}`);const p=await this.client.post("/graphql",{query:r},{headers:l});if(p.data.errors)return{success:!1,error:`GraphQL introspection errors: ${JSON.stringify(p.data.errors)}`};const m=ds.buildClientSchema(p.data.data);return{success:!0,data:ds.printSchema(m),message:"Successfully load schema"}}catch(r){if(hn.default.isAxiosError(r)&&r.response)return{success:!1,error:r.response.data.errors[0]?.message||"Failed to load graphql Schema"};throw r}}async findLogicFunctions(){try{const r=await this.client.post("/metadata",{query:`
38
61
  query FindManyLogicFunctions {
39
62
  findManyLogicFunctions {
40
63
  id
@@ -43,7 +66,7 @@ const require = __createRequire(import.meta.url);`},qt=".twenty/output";var ve=(
43
66
  applicationId
44
67
  }
45
68
  }
46
- `},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return i.data.errors?{success:!1,error:i.data.errors[0]?.message||"Failed to fetch functions"}:{success:!0,data:i.data.data.findManyLogicFunctions}}catch(a){return{success:!1,error:a}}}async executeLogicFunction({functionId:a,payload:i}){try{const f=`
69
+ `},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return r.data.errors?{success:!1,error:r.data.errors[0]?.message||"Failed to fetch functions"}:{success:!0,data:r.data.data.findManyLogicFunctions}}catch(s){return{success:!1,error:s}}}async executeLogicFunction({functionId:s,payload:r}){try{const l=`
47
70
  mutation ExecuteOneLogicFunction($input: ExecuteOneLogicFunctionInput!) {
48
71
  executeOneLogicFunction(input: $input) {
49
72
  data
@@ -53,38 +76,40 @@ const require = __createRequire(import.meta.url);`},qt=".twenty/output";var ve=(
53
76
  error
54
77
  }
55
78
  }
56
- `,g={input:{id:a,payload:i}},_=await this.client.post("/metadata",{query:f,variables:g},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return _.data.errors?{success:!1,error:_.data.errors[0]?.message||"Failed to execute logic function"}:{success:!0,data:_.data.data.executeOneLogicFunction}}catch(f){return{success:!1,error:f}}}async subscribeToLogs({applicationUniversalIdentifier:a,functionUniversalIdentifier:i,functionName:f}){const g=await this.configService.getConfig(),_=Am.createClient({url:g.apiUrl+"/graphql",headers:{Authorization:`Bearer ${g.apiKey}`,"Content-Type":"application/json",Accept:"text/event-stream"}}),S=`
79
+ `,p={input:{id:s,payload:r}},m=await this.client.post("/metadata",{query:l,variables:p},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return m.data.errors?{success:!1,error:m.data.errors[0]?.message||"Failed to execute logic function"}:{success:!0,data:m.data.data.executeOneLogicFunction}}catch(l){return{success:!1,error:l}}}async subscribeToLogs({applicationUniversalIdentifier:s,functionUniversalIdentifier:r,functionName:l}){const p=await this.configService.getConfig(),m=Rm.createClient({url:p.apiUrl+"/graphql",headers:{Authorization:`Bearer ${p.apiKey}`,"Content-Type":"application/json",Accept:"text/event-stream"}}),v=`
57
80
  subscription SubscribeToLogs($input: LogicFunctionLogsInput!) {
58
81
  logicFunctionLogs(input: $input) {
59
82
  logs
60
83
  }
61
84
  }
62
- `,A={input:{applicationUniversalIdentifier:a,universalIdentifier:i,name:f}};_.subscribe({query:S,variables:A},{next:({data:I})=>console.log(I?.logicFunctionLogs.logs),error:I=>console.error(I),complete:()=>console.log("Completed")})}async uploadFile({filePath:a,builtHandlerPath:i,fileFolder:f,applicationUniversalIdentifier:g}){try{const _=ee.resolve(a);if(!cu.existsSync(_))return{success:!1,error:`File not found: ${_}`};const S=ee.basename(_),A=cu.readFileSync(_),I=this.getMimeType(S),P=`
85
+ `,E={input:{applicationUniversalIdentifier:s,universalIdentifier:r,name:l}};m.subscribe({query:v,variables:E},{next:({data:b})=>console.log(b?.logicFunctionLogs.logs),error:b=>console.error(b),complete:()=>console.log("Completed")})}async uploadFile({filePath:s,builtHandlerPath:r,fileFolder:l,applicationUniversalIdentifier:p}){try{const m=Y.resolve(s);if(!nl.existsSync(m))return{success:!1,error:`File not found: ${m}`};const v=Y.basename(m),E=nl.readFileSync(m),b=this.getMimeType(v),M=`
63
86
  mutation UploadApplicationFile($file: Upload!, $applicationUniversalIdentifier: String!, $fileFolder: FileFolder!, $filePath: String!) {
64
87
  uploadApplicationFile(file: $file, applicationUniversalIdentifier: $applicationUniversalIdentifier, fileFolder: $fileFolder, filePath: $filePath)
65
88
  { path }
66
89
  }
67
- `,J=Om(f),G=JSON.stringify({query:P,variables:{file:null,applicationUniversalIdentifier:g,filePath:i,fileFolder:J}}),K=JSON.stringify({0:["variables.file"]}),k=new FormData;k.append("operations",G),k.append("map",K),k.append("0",new Blob([new Uint8Array(A)],{type:I}),S);const ue=await this.client.post("/metadata",k);return ue.data.errors?{success:!1,error:ue.data.errors[0]?.message||"Failed to upload file"}:{success:!0,data:ue.data.data.uploadApplicationFile,message:`Successfully uploaded ${S}`}}catch(_){return zr.default.isAxiosError(_)&&_.response?{success:!1,error:_.response.data?.errors?.[0]?.message||_.message}:{success:!1,error:_}}}getMimeType(a){const i=ee.extname(a).toLowerCase();return{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".bmp":"image/bmp",".ico":"image/x-icon",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".txt":"text/plain",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".mp3":"audio/mpeg",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".js":"application/javascript",".ts":"application/typescript",".jsx":"application/javascript",".tsx":"application/typescript",".html":"text/html",".css":"text/css"}[i]||"application/octet-stream"}}class A0{constructor(a){this.apiService=new Ct,this.applicationUniversalIdentifier=a.applicationUniversalIdentifier,this.appPath=a.appPath}async uploadFile({builtPath:a,fileFolder:i}){const f=ie.relative(qt,a);return await this.apiService.uploadFile({filePath:ee.default.join(this.appPath,a),builtHandlerPath:f,fileFolder:i,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}var Su=(c=>(c.DefineApplication="defineApplication",c.DefineField="defineField",c.DefineLogicFunction="defineLogicFunction",c.DefineObject="defineObject",c.DefineRole="defineRole",c.DefineFrontComponent="defineFrontComponent",c))(Su||{}),jt=(c=>(c.Application="application",c.Fields="fields",c.LogicFunctions="logicFunctions",c.Objects="objects",c.Roles="roles",c.FrontComponents="frontComponents",c.PublicAssets="publicAssets",c))(jt||{});const b0={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineFrontComponent:"frontComponents"},E0=c=>{if(!Fn.isCallExpression(c))return;const a=c.expression;if(Fn.isIdentifier(a)&&Object.values(Su).includes(a.text))return a.text},C0=c=>{const a=Fn.createSourceFile("temp.ts",c,Fn.ScriptTarget.Latest,!0),i=[];Fn.forEachChild(a,f=>{i.push(f)});for(const f of i)if(Fn.isExportAssignment(f)){if(f.isExportEquals||!f.expression)return;const g=E0(f.expression);if(g)return g}},T0=["twenty-sdk/ui"],F0={name:"manifest-mock",setup:c=>{const a=new RegExp(`^(${T0.map(i=>i.replace("/","\\/")).join("|")})$`);c.onResolve({filter:a},({path:i})=>({path:i,namespace:"manifest-mock"})),c.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},Tn=async({filePath:c,appPath:a})=>{const i=await I0({filePath:c,appPath:a});return R0(i,c)},I0=async({filePath:c,appPath:a})=>{const i=ee.default.join(a,"tsconfig.json"),f=await V.pathExists(i),g=Em.createRequire(ee.default.join(a,"package.json"));let _,S;try{_=ee.default.dirname(g.resolve("react/package.json")),S=ee.default.dirname(g.resolve("react-dom/package.json"))}catch{}const I=(await wu.build({entryPoints:[c],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:f?i:void 0,alias:{..._&&{react:_},...S&&{"react-dom":S}},plugins:[F0],logLevel:"silent"})).outputFiles[0].text,P=await V.mkdtemp(ee.default.join(Is.default.tmpdir(),"twenty-manifest-")),J=ee.default.join(P,"module.cjs");try{return await V.writeFile(J,I),require(J)}finally{await V.remove(P)}},R0=(c,a)=>{if(je.Tr(c.default)&&Lm(c.default))return c.default;throw new Error(`Config file ${a} must export a config object default export`)},P0=async c=>await mu.glob(["**/*.ts","**/*.tsx"],{cwd:c,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),O0=async c=>await mu.glob([`${Rs}/**/*`],{cwd:c,onlyFiles:!0}),Qr=async c=>{const a=await P0(c),i=[];let f;const g=[],_=[],S=[],A=[],I=[],P=[],J=[],G=[],K=[],k=[],ue=[],Oe=[],pe=[];for(const F of a){const Z=await gu.readFile(F,"utf-8"),z=ie.relative(c,F),se=C0(Z);if(!se)continue;switch(b0[se]){case jt.Application:{const ne=await Tn({appPath:c,filePath:F});f={...ne.config,yarnLockChecksum:null,packageJsonChecksum:null},i.push(...ne.errors),J.push(z);break}case jt.Objects:{const ne=await Tn({appPath:c,filePath:F});g.push(ne.config),i.push(...ne.errors),G.push(z);break}case jt.Fields:{const ne=await Tn({appPath:c,filePath:F});_.push(ne.config),i.push(...ne.errors),K.push(z);break}case jt.Roles:{const ne=await Tn({appPath:c,filePath:F});S.push(ne.config),i.push(...ne.errors),k.push(z);break}case jt.LogicFunctions:{const ne=await Tn({appPath:c,filePath:F});i.push(...ne.errors);const{handler:Ht,...Ge}=ne.config,ht=ie.relative(c,F),Ft={...Ge,handlerName:"default.config.handler",sourceHandlerPath:ht,builtHandlerPath:ht.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};A.push(Ft),ue.push(z);break}case jt.FrontComponents:{const ne=await Tn({appPath:c,filePath:F});i.push(...ne.errors);const{component:Ht,...Ge}=ne.config,ht=ie.relative(c,F),Ft={...Ge,componentName:Ht.name,sourceComponentPath:ht,builtComponentPath:ht.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:""};I.push(Ft),Oe.push(z);break}case jt.PublicAssets:break;default:je.ln()}}const Le=await O0(c);for(const F of Le)P.push({filePath:F,fileName:ie.basename(F),fileType:ie.extname(F).replace(/^\./,""),checksum:null}),pe.push(ie.relative(c,F));return f||i.push("Cannot build application, please export default defineApplication() to define an application"),{manifest:f?{application:f,objects:g,fields:_,roles:S,logicFunctions:A,frontComponents:I,publicAssets:P}:null,filePaths:{application:J,objects:G,fields:K,roles:k,logicFunctions:ue,frontComponents:Oe,publicAssets:pe},errors:i}},L0=c=>{const a=new Set,i=new Set;for(const f of c)a.has(f)?i.add(f):a.add(f);return Array.from(i)},Au=c=>{const a=[];if(!c)return[];for(const[i,f]of Object.entries(c))i==="universalIdentifier"&&typeof f=="string"&&a.push(f),typeof f=="object"&&a.push(...Au(f));return a},M0=c=>{const a=[],i=[],f=L0(Au(c));return f.length>0&&a.push(`Duplicate universal identifiers: ${f.join(", ")}`),je.Zo(c.objects)||i.push("No object defined"),je.Zo(c.logicFunctions)||i.push("No logic function defined"),je.Zo(c.frontComponents)||i.push("No front component defined"),{errors:a,warnings:i,isValid:a.length===0}};class N0{constructor(a){this.builtFileInfos=new Map,this.fileUploader=null,this.apiService=new Ct({disableInterceptors:!0}),this.activeUploads=new Set,this.syncTimer=null,this.isSyncing=!1,this.serverReady=!1,this.serverErrorLogged=!1,this.appPath=a.appPath,this.debounceMs=a.debounceMs??200,this.handleManifestBuilt=a.handleManifestBuilt,this.uiStateManager=a.uiStateManager}async checkServer(){const a=await this.apiService.validateAuth();if(!a.serverUp){this.serverErrorLogged||(this.uiStateManager.addEvent({message:"Cannot reach server",status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error",error:"Cannot connect to Twenty server. Is it running?"}),this.serverErrorLogged=!0);return}if(!a.authValid){this.serverErrorLogged||(this.uiStateManager.addEvent({message:"Authentication failed",status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error",error:'Cannot authenticate. Check your credentials are correct with "yarn auth:login"'}),this.serverErrorLogged=!0);return}this.serverErrorLogged=!1,this.serverReady=!0}async handleChangeDetected(a,i){this.serverReady||await this.checkServer(),this.serverReady&&(this.uiStateManager.addEvent({message:`Change detected: ${a}`,status:"info"}),i==="unlink"?this.uiStateManager.removeEntity(a):this.uiStateManager.updateFileStatus(a,"building"),this.scheduleSync())}handleFileBuildError(a){this.uiStateManager.addEvent({message:"Build failed:",status:"error"});for(const i of a)this.uiStateManager.addEvent({message:i.error,status:"error"})}handleFileBuilt({fileFolder:a,builtPath:i,sourcePath:f,checksum:g}){this.uiStateManager.addEvent({message:`Successfully built ${i}`,status:"success"}),this.builtFileInfos.set(i,{checksum:g,builtPath:i,sourcePath:f,fileFolder:a}),this.fileUploader&&this.uploadFile(i,f,a),this.scheduleSync()}uploadFile(a,i,f){this.uiStateManager.addEvent({message:`Uploading ${a}`,status:"info"}),this.uiStateManager.updateFileStatus(i,"uploading");const g=this.fileUploader.uploadFile({builtPath:a,fileFolder:f}).then(_=>{_.success?(this.uiStateManager.addEvent({message:`Successfully uploaded ${a}`,status:"success"}),this.uiStateManager.updateFileStatus(i,"success")):this.uiStateManager.addEvent({message:`Failed to upload ${a}: ${_.error}`,status:"error"})}).catch(_=>{this.uiStateManager.addEvent({message:`Upload failed for ${a}: ${_}`,status:"error"})}).finally(()=>{this.activeUploads.delete(g)});this.activeUploads.add(g)}cancelPendingSync(){this.syncTimer&&(clearTimeout(this.syncTimer),this.syncTimer=null)}scheduleSync(){this.cancelPendingSync(),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.isSyncing){this.isSyncing=!0;try{this.uiStateManager.addEvent({message:"Building manifest",status:"info"}),this.uiStateManager.updateManifestState({manifestStatus:"building"});const a=await Qr(this.appPath);if(a.errors.length>0||!a.manifest){for(const _ of a.errors)this.uiStateManager.addEvent({message:_,status:"error"});this.uiStateManager.updateManifestState({manifestStatus:"error",error:a.errors[a.errors.length-1]});return}const i=M0(a.manifest);if(!i.isValid){for(const _ of i.errors)this.uiStateManager.addEvent({message:_,status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error",error:_});return}if(this.uiStateManager.updateManifestState({appName:a.manifest.application.displayName}),this.uiStateManager.updateAllFilesTypes({manifestFilePaths:a.filePaths}),i.warnings.length>0)for(const _ of i.warnings)this.uiStateManager.addEvent({message:`⚠ ${_}`,status:"warning"});if(this.uiStateManager.addEvent({message:"Successfully built manifest",status:"success"}),await this.handleManifestBuilt(a),!this.fileUploader){const _=await this.apiService.checkApplicationExist(a.manifest.application.universalIdentifier);if(!_.success){this.uiStateManager.addEvent({message:`Failed to check if application ${a.manifest.application.universalIdentifier} already exists`,status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error",error:"Failed to check if application already exists"});return}if(!_.data){this.uiStateManager.addEvent({message:"Creating application",status:"info"});const A=await this.apiService.createApplication(a.manifest);if(A.success)this.uiStateManager.addEvent({message:"Application created",status:"success"});else{this.uiStateManager.addEvent({message:`Application creation failed with error ${JSON.stringify(A.error,null,2)}`,status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error",error:`Application creation failed with error ${JSON.stringify(A.error,null,2)}`});return}}this.fileUploader=new A0({appPath:this.appPath,applicationUniversalIdentifier:a.manifest.application.universalIdentifier});for(const[A,{fileFolder:I,sourcePath:P}]of this.builtFileInfos.entries())this.uploadFile(A,P,I)}for(;this.activeUploads.size>0;)await Promise.all(this.activeUploads);const f=w0({manifest:a.manifest,builtFileInfos:this.builtFileInfos});this.uiStateManager.addEvent({message:"Manifest checksums set",status:"info"}),await y0(this.appPath,f),this.uiStateManager.addEvent({message:"Manifest saved to output directory",status:"info"}),this.uiStateManager.addEvent({message:"Syncing manifest",status:"info"}),this.uiStateManager.updateManifestState({manifestStatus:"syncing"});const g=await this.apiService.syncApplication(f);this.uiStateManager.updateAllFilesStatus("success"),g.success?(this.uiStateManager.addEvent({message:"✓ Synced",status:"success"}),this.uiStateManager.updateManifestState({manifestStatus:"synced"})):(this.uiStateManager.addEvent({message:`Sync failed with error ${JSON.stringify(g.error,null,2)}`,status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error"}))}catch(a){this.uiStateManager.addEvent({message:`Sync failed with error ${JSON.stringify(a,null,2)}`,status:"error"}),this.uiStateManager.updateManifestState({manifestStatus:"error"})}finally{this.isSyncing=!1}}}}const U0={pending:["building","uploading","success"],building:["pending","uploading","success"],uploading:["pending","success"],success:["pending","building","uploading"]};class W0{constructor({appPath:a,frontendUrl:i}){this.eventIdCounter=0,this.listeners=new Set,this.state={appPath:a,frontendUrl:i,appName:null,appDescription:null,appUniversalIdentifier:null,manifestStatus:"idle",entities:new Map,events:[]}}getSnapshot(){return this.state}subscribe(a){return this.listeners.add(a),a(this.getSnapshot()),()=>this.listeners.delete(a)}notify(){for(const a of this.listeners)a(this.state)}addEvent({message:a,status:i="info"}){const f={id:++this.eventIdCounter,timestamp:new Date,message:a.slice(0,5e3),status:i};this.state={...this.state,events:[...this.state.events.slice(-201),f]},this.notify()}updateManifestState({manifestStatus:a,appName:i,error:f}){this.state={...this.state,...a?{manifestStatus:a}:{},...i?{appName:i}:{},...f?{error:f.slice(0,5e3)}:{error:void 0}},this.notify()}convertEntityTypeToSyncableEntity(a){switch(a){case"objects":return ve.Object;case"fields":return ve.Field;case"logicFunctions":return ve.LogicFunction;case"frontComponents":return ve.FrontComponent;case"roles":return ve.Role;default:return}}updateAllFilesTypes({manifestFilePaths:a}){const i=new Map;Object.entries(a).forEach(([g,_])=>{_.forEach(S=>{const A=this.convertEntityTypeToSyncableEntity(g);A&&i.set(S,A)})});const f=new Map(this.state.entities);for(const[g,_]of f)f.set(g,{..._,type:i.get(g)});this.state={...this.state,entities:f},this.notify()}updateAllFilesStatus(a){const i=new Map(this.state.entities);for(const[f,g]of i)i.set(f,{...g,status:a});this.state={...this.state,entities:i},this.notify()}removeEntity(a){const i=new Map(this.state.entities);i.delete(a),this.state={...this.state,entities:i}}updateFileStatus(a,i){const f=new Map(this.state.entities),g=f.get(a);g?.status&&!U0[g.status].find(_=>_===i)||(f.set(a,g?{...g,status:i}:{name:a,path:a,status:i}),this.state={...this.state,entities:f},this.notify())}}const Es=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],fu=["↑","⇡","↟","⤒"],Jr={pending:"○",success:"✓"},Zn={pending:"gray",building:"yellow",uploading:"cyan",success:"green"},bu={[ve.Object]:"Objects",[ve.Field]:"Fields",[ve.LogicFunction]:"Logic functions",[ve.FrontComponent]:"Front components",[ve.Role]:"Roles"},Eu=Object.keys(bu),D0={info:"gray",success:"green",error:"red",warning:"yellow"},$0=c=>{const a=new Map;for(const i of Eu)a.set(i,[]);for(const i of c.values()){if(!i.type)continue;const f=a.get(i.type)??[];f.push(i),a.set(i.type,f)}return a},B0=c=>c.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),k0=(c,a=40)=>{if(c.length<=a)return c;const i=c.split("/");return i.length<=2?c:`.../${i.slice(-2).join("/")}`},j0=c=>!c.frontendUrl||!c.appUniversalIdentifier?null:`${c.frontendUrl}/settings/applications`,q0=async c=>{const[a,i]=await Promise.all([import("react"),import("ink")]),{useState:f,useEffect:g}=a,{render:_,Box:S,Text:A,Static:I}=i,P=(F,Z=80)=>{const[z,se]=f(0);return g(()=>{const qe=setInterval(()=>{se(ne=>(ne+1)%F.length)},Z);return()=>clearInterval(qe)},[F.length,Z]),F[z]},J=({event:F})=>{const Z=D0[F.status],z=B0(F.timestamp);return W.jsxs(S,{children:[W.jsxs(A,{dimColor:!0,children:[z," "]}),W.jsx(A,{color:Z,children:F.message})]})},G=({status:F})=>{const Z=P(Es,200),z=P(fu,200),se={building:Z,uploading:z,pending:Jr.pending,success:Jr.success};return W.jsxs(A,{color:Zn[F],children:[se[F]," "]})},K=({entity:F})=>W.jsxs(S,{children:[W.jsx(G,{status:F.status}),W.jsx(A,{children:F.name}),F.path!==F.name&&W.jsxs(A,{dimColor:!0,children:[" (",k0(F.path),")"]})]}),k=({type:F,entities:Z})=>Z.length===0?null:W.jsxs(S,{flexDirection:"column",marginTop:1,children:[W.jsx(A,{bold:!0,dimColor:!0,children:bu[F]}),Z.map(z=>W.jsx(K,{entity:z},z.path))]}),ue={synced:{color:"green",icon:"✓",text:"Synced"},building:{color:"yellow",icon:"spinner",text:"Building..."},syncing:{color:"yellow",icon:"spinner",text:"Syncing..."},error:{color:"red",icon:null,text:"Error"},idle:{color:"gray",icon:null,text:"Idle"}},Oe=({snapshot:F})=>{const Z=P(Es,80),z=ue[F.manifestStatus],se=z.icon==="spinner"?Z:z.icon;return W.jsxs(A,{color:z.color,children:[se?`${se} `:"",z.text,F.error&&`: ${F.error}`]})},pe=({snapshot:F})=>{const Z=$0(F.entities),z=j0(F);return W.jsxs(S,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[W.jsx(A,{bold:!0,color:"cyan",children:"Application"}),W.jsxs(S,{marginLeft:2,flexDirection:"column",children:[W.jsxs(S,{children:[W.jsx(A,{dimColor:!0,children:"Name: "}),W.jsx(A,{bold:!0,children:F.appName??"Loading..."})]}),F.appDescription&&W.jsxs(S,{children:[W.jsx(A,{dimColor:!0,children:"Description: "}),W.jsx(A,{children:F.appDescription})]}),W.jsxs(S,{children:[W.jsx(A,{dimColor:!0,children:"Status: "}),W.jsx(Oe,{snapshot:F})]}),z&&W.jsxs(S,{children:[W.jsx(A,{dimColor:!0,children:"Open:"}),W.jsxs(A,{bold:!0,color:"cyan",children:[" ",z]})]})]}),W.jsx(S,{marginLeft:2,flexDirection:"column",children:Eu.map(se=>{const qe=Z.get(se)??[];return W.jsx(k,{type:se,entities:qe},se)})})]})},Le=()=>W.jsx(S,{marginTop:1,children:W.jsxs(A,{dimColor:!0,children:[W.jsx(A,{color:Zn.pending,children:Jr.pending})," ","pending ",W.jsx(A,{color:Zn.building,children:Es[0]})," ","building ",W.jsx(A,{color:Zn.uploading,children:fu[0]})," ","uploading"," ",W.jsx(A,{color:Zn.success,children:Jr.success})," ","success"]})}),Tt=()=>{const[F,Z]=f(c.getSnapshot());return g(()=>c.subscribe(Z),[]),W.jsxs(W.Fragment,{children:[W.jsx(I,{items:F.events,children:z=>W.jsx(J,{event:z},z.id)}),W.jsxs(S,{marginTop:1,flexDirection:"column",children:[W.jsx(pe,{snapshot:F}),W.jsx(Le,{})]})]})},{unmount:Te}=_(W.jsx(Tt,{}));return{unmount:Te}};class hu{constructor(a){this.watcher=null,this.appPath=a.appPath,this.fileFolder=a.fileFolder,this.watchPaths=a.watchPaths,this.handleFileBuilt=a.handleFileBuilt}async start(){const a=this.watchPaths.map(i=>ie.join(this.appPath,i));for(const i of a)if(!await V.pathExists(i))return;this.watcher=yu.default.watch(a,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50},usePolling:!0}),this.watcher.on("all",(i,f)=>{i!=="addDir"&&((i==="add"||i==="change")&&this.copyAndNotify(f),i==="unlink"&&this.handleUnlink(f))})}async close(){await this.watcher?.close()}async copyAndNotify(a){const i=ie.relative(this.appPath,a),f=ie.join(qt,i),g=ie.join(this.appPath,f);await V.ensureDir(ie.dirname(g)),await V.copy(a,g);const _=await V.readFile(g),S=_u.default.createHash("md5").update(_).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:f,sourcePath:i,checksum:S})}async handleUnlink(a){const i=ie.relative(this.appPath,a),f=ie.join(qt,i),g=ie.join(this.appPath,f);await V.remove(g)}}class G0{constructor(){this.appPath="",this.orchestrator=null,this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.watchersStarted=!1,this.uiStateManager=null,this.unmountUI=null}async close(){this.unmountUI?.(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}async execute(a){this.appPath=a.appPath??Et,await this.cleanOutputDir(),this.uiStateManager=new W0({appPath:this.appPath,frontendUrl:process.env.FRONTEND_URL});const{unmount:i}=await q0(this.uiStateManager);this.unmountUI=i,this.orchestrator=new N0({appPath:this.appPath,handleManifestBuilt:this.handleWatcherRestarts.bind(this),uiStateManager:this.uiStateManager}),await this.startManifestWatcher(),this.setupGracefulShutdown()}async cleanOutputDir(){const a=ee.default.join(this.appPath,qt);await V.ensureDir(a),await V.emptyDir(a)}async startManifestWatcher(){this.manifestWatcher=new _0({appPath:this.appPath,handleChangeDetected:this.orchestrator.handleChangeDetected.bind(this.orchestrator)}),await this.manifestWatcher.start()}async handleWatcherRestarts(a){const{logicFunctions:i,frontComponents:f}=a.filePaths;if(!this.watchersStarted){this.watchersStarted=!0,await this.startFileWatchers(i,f);return}this.logicFunctionsWatcher?.shouldRestart(i)&&await this.logicFunctionsWatcher.restart(i),this.frontComponentsWatcher?.shouldRestart(f)&&await this.frontComponentsWatcher.restart(f)}async startFileWatchers(a,i){await Promise.all([this.startLogicFunctionsWatcher(a),this.startFrontComponentsWatcher(i),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(a){this.logicFunctionsWatcher=m0({appPath:this.appPath,sourcePaths:a,handleBuildError:this.orchestrator.handleFileBuildError.bind(this.orchestrator),handleFileBuilt:this.orchestrator.handleFileBuilt.bind(this.orchestrator)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(a){this.frontComponentsWatcher=v0({appPath:this.appPath,sourcePaths:a,handleBuildError:this.orchestrator.handleFileBuildError.bind(this.orchestrator),handleFileBuilt:this.orchestrator.handleFileBuilt.bind(this.orchestrator)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new hu({appPath:this.appPath,fileFolder:ft.N.PublicAsset,watchPaths:[Rs],handleFileBuilt:this.orchestrator.handleFileBuilt.bind(this.orchestrator)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new hu({appPath:this.appPath,fileFolder:ft.N.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.orchestrator.handleFileBuilt.bind(this.orchestrator)}),this.dependencyWatcher.start()}setupGracefulShutdown(){const a=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",a),process.on("SIGTERM",a)}}const H0="generated";class K0{constructor(){this.configService=new Ae,this.apiService=new Ct}async generate(a){const i=ie.join(a,H0);console.log(b.default.blue("📦 Generating Twenty client...")),console.log(b.default.gray(`📁 Output Path: ${i}`)),console.log("");const f=await this.configService.getConfig(),g=f.apiUrl,_=f.apiKey;if(!g||!_){console.log(b.default.yellow("⚠️ Skipping Client generation: API URL or token not configured"));return}console.log(b.default.gray(`API URL: ${g}`)),console.log(b.default.gray(`Output: ${i}`));const S=await this.apiService.getSchema();if(!S.success)return;const{data:A}=S,I=ie.resolve(i);await Cm.generate({schema:A,output:I,scalarTypes:{DateTime:"string",JSON:"Record<string, unknown>",UUID:"string"}}),await this.injectTwentyClient(I),console.log(b.default.green("✓ Client generated successfully!")),console.log(b.default.gray(`Generated files at: ${i}`))}async injectTwentyClient(a){const i=`
90
+ `,H=P.AO(l),X=JSON.stringify({query:M,variables:{file:null,applicationUniversalIdentifier:p,filePath:r,fileFolder:H}}),N=JSON.stringify({0:["variables.file"]}),V=new FormData;V.append("operations",X),V.append("map",N),V.append("0",new Blob([new Uint8Array(E)],{type:b}),v);const ie=await this.client.post("/metadata",V);return ie.data.errors?{success:!1,error:ie.data.errors[0]?.message||"Failed to upload file"}:{success:!0,data:ie.data.data.uploadApplicationFile,message:`Successfully uploaded ${v}`}}catch(m){return hn.default.isAxiosError(m)&&m.response?{success:!1,error:m.response.data?.errors?.[0]?.message||m.message}:{success:!1,error:m}}}getMimeType(s){const r=Y.extname(s).toLowerCase();return{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".bmp":"image/bmp",".ico":"image/x-icon",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".txt":"text/plain",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".mp3":"audio/mpeg",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".js":"application/javascript",".ts":"application/typescript",".jsx":"application/javascript",".tsx":"application/typescript",".html":"text/html",".css":"text/css"}[r]||"application/octet-stream"}}class yv{constructor(){this.apiService=new Tt({disableInterceptors:!0})}async generate({appPath:s,authToken:r}){const l=this.resolveGeneratedPath(s),p=`${l}.tmp`,m=await this.apiService.getSchema({authToken:r});if(!m.success)throw new Error(`Failed to introspect schema: ${JSON.stringify(m.error)}`);const{data:v}=m;await k.ensureDir(p),await k.emptyDir(p),await Om.generate({schema:v,output:p,scalarTypes:{DateTime:"string",JSON:"Record<string, unknown>",UUID:"string"}}),await this.injectTwentyClient(p),await k.remove(l),await k.move(p,l)}resolveGeneratedPath(s){return $.join(s,"node_modules","twenty-sdk",Gr)}async injectTwentyClient(s){const r=`
68
91
 
69
92
  // ----------------------------------------------------
70
- // Custom Twenty client (auto-injected)
93
+ // Custom Twenty client (auto-injected)
71
94
  // ----------------------------------------------------
72
95
 
73
96
  const defaultOptions: ClientOptions = {
74
- url: \`\${process.env.${h0}}/graphql\`,
97
+ url: \`\${process.env.${il}}/graphql\`,
98
+ metadataUrl: \`\${process.env.${il}}/metadata\`,
75
99
  headers: {
76
100
  'Content-Type': 'application/json',
77
- Authorization: \`Bearer \${process.env.${f0}}\`,
101
+ Authorization: \`Bearer \${process.env.${Gm}}\`,
78
102
  },
79
103
  }
80
104
 
81
105
  export default class Twenty {
82
106
  private client: Client;
83
- private apiUrl: string;
107
+ private url: string;
108
+ private metadataUrl: string;
84
109
  private authorizationToken: string;
85
110
 
86
111
  constructor(options?: ClientOptions) {
87
- const merged: ClientOptions = {
112
+ const merged: ClientOptions = {
88
113
  ...defaultOptions,
89
114
  ...options,
90
115
  headers: {
@@ -92,9 +117,9 @@ export default class Twenty {
92
117
  ...(options?.headers ?? {}),
93
118
  },
94
119
  };
95
-
96
120
  this.client = createClient(merged);
97
- this.apiUrl = merged.url;
121
+ this.url = merged.url;
122
+ this.metadataUrl = merged.metadataUrl;
98
123
  this.authorizationToken = merged.headers.Authorization;
99
124
  }
100
125
 
@@ -110,21 +135,29 @@ export default class Twenty {
110
135
  fileBuffer: Buffer,
111
136
  filename: string,
112
137
  contentType: string = 'application/octet-stream',
113
- fileFolder: string = 'Attachment',
114
- ): Promise<{ path: string; token: string }> {
138
+ fieldMetadataUniversalIdentifier: string,
139
+ ): Promise<{
140
+ id: string;
141
+ path: string;
142
+ size: number;
143
+ createdAt: string;
144
+ url: string;
145
+ }> {
115
146
  const form = new FormData();
116
147
 
117
- form.append('operations', JSON.stringify({
118
- query: \`mutation UploadFile($file: Upload!, $fileFolder: FileFolder) {
119
- uploadFile(file: $file, fileFolder: $fileFolder) { path token }
148
+ form.append(
149
+ 'operations',
150
+ JSON.stringify({
151
+ query: \`mutation UploadFilesFieldFileByUniversalIdentifier($file: Upload!, $fieldMetadataUniversalIdentifier: String!) {
152
+ uploadFilesFieldFileByUniversalIdentifier(file: $file, fieldMetadataUniversalIdentifier: $fieldMetadataUniversalIdentifier) { id path size createdAt url }
120
153
  }\`,
121
- variables: { file: null, fileFolder },
122
- }));
154
+ variables: { file: null, fieldMetadataUniversalIdentifier },
155
+ }),
156
+ );
123
157
  form.append('map', JSON.stringify({ '0': ['variables.file'] }));
124
158
  form.append('0', new Blob([fileBuffer], { type: contentType }), filename);
125
159
 
126
-
127
- const response = await fetch(\`\${this.apiUrl}/graphql\`, {
160
+ const response = await fetch(this.metadataUrl, {
128
161
  method: 'POST',
129
162
  headers: {
130
163
  Authorization: this.authorizationToken,
@@ -138,30 +171,205 @@ export default class Twenty {
138
171
  throw new GenqlError(result.errors, result.data);
139
172
  }
140
173
 
141
- return result.data.uploadFile;
174
+ return result.data.uploadFilesFieldFileByUniversalIdentifier;
175
+ }
176
+ }
177
+
178
+ `;await k.appendFile($.join(s,"index.ts"),r)}}var Al=(o=>(o.DefineApplication="defineApplication",o.DefineField="defineField",o.DefineLogicFunction="defineLogicFunction",o.DefineObject="defineObject",o.DefineRole="defineRole",o.DefineSkill="defineSkill",o.DefineFrontComponent="defineFrontComponent",o.DefineView="defineView",o.DefineNavigationMenuItem="defineNavigationMenuItem",o.DefinePageLayout="definePageLayout",o))(Al||{}),Ye=(o=>(o.Application="application",o.Fields="fields",o.LogicFunctions="logicFunctions",o.Objects="objects",o.Roles="roles",o.Skills="skills",o.FrontComponents="frontComponents",o.PublicAssets="publicAssets",o.Views="views",o.NavigationMenuItems="navigationMenuItems",o.PageLayouts="pageLayouts",o))(Ye||{});const _v={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},wv=o=>{if(!gn.isCallExpression(o))return;const s=o.expression;if(gn.isIdentifier(s)&&Object.values(Al).includes(s.text))return s.text},xv=o=>{const s=gn.createSourceFile("temp.ts",o,gn.ScriptTarget.Latest,!0),r=[];gn.forEachChild(s,l=>{r.push(l)});for(const l of r)if(gn.isExportAssignment(l)){if(l.isExportEquals||!l.expression)return;const p=wv(l.expression);if(p)return p}},Sv=["twenty-sdk/ui"],Av={name:"manifest-mock",setup:o=>{const s=new RegExp(`^(${Sv.map(r=>r.replace("/","\\/")).join("|")})$`);o.onResolve({filter:s},({path:r})=>({path:r,namespace:"manifest-mock"})),o.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},pt=async({filePath:o,appPath:s})=>{const r=await Iv({filePath:o,appPath:s});return Fv(r,o)},Iv=async({filePath:o,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),l=await k.pathExists(r),p=Nm.createRequire(Y.default.join(s,"package.json"));let m,v;try{m=Y.default.dirname(p.resolve("react/package.json")),v=Y.default.dirname(p.resolve("react-dom/package.json"))}catch{}const b=(await ml.build({entryPoints:[o],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:l?r:void 0,alias:{...m&&{react:m},...v&&{"react-dom":v}},plugins:[Av],logLevel:"silent"})).outputFiles[0].text,M=await k.mkdtemp(Y.default.join(ms.default.tmpdir(),"twenty-manifest-")),H=Y.default.join(M,"module.cjs");try{return await k.writeFile(H,b),require(H)}finally{await k.remove(M)}},Fv=(o,s)=>{if(P.o(o.default)&&P.AN(o.default))return o.default;throw new Error(`Config file ${s} must export a config object default export`)},Ev={type:"object",properties:{}},Tv=async o=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-GxSybvDe.js")),r=s(o)[0];return r?.type==="object"&&P.o(r.properties)?{type:"object",properties:r.properties}:Ev},bv="142046f0-4d80-48b5-ad56-26ad410e895c",at=({objectConfig:o,fieldName:s})=>{const r=`${o.universalIdentifier}-${s}`;return We.v5(r,bv)},Cv=o=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:P.R.UUID,universalIdentifier:at({objectConfig:o,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:P.R.TEXT,universalIdentifier:at({objectConfig:o,fieldName:"name"})},l={name:"createdAt",label:"Creation date",description:"Creation date",icon:"IconCalendar",isNullable:!1,defaultValue:"now",type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"createdAt"})},p={name:"updatedAt",label:"Last update",description:"Last time the record was changed",icon:"IconCalendarClock",isNullable:!1,defaultValue:"now",type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"updatedAt"})},m={name:"deletedAt",label:"Deleted at",description:"Deletion date",icon:"IconCalendarClock",isNullable:!0,defaultValue:null,type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"deletedAt"})},v={name:"createdBy",label:"Created by",description:"The creator of the record",icon:"IconCreativeCommonsSa",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:P.R.ACTOR,universalIdentifier:at({objectConfig:o,fieldName:"createdBy"})},E={name:"updatedBy",label:"Updated by",description:"The workspace member who last updated the record",icon:"IconUserCircle",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:P.R.ACTOR,universalIdentifier:at({objectConfig:o,fieldName:"updatedBy"})},b={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:P.R.POSITION,universalIdentifier:at({objectConfig:o,fieldName:"position"})},M={name:"searchVector",label:"Search vector",icon:"IconSearch",description:"Search vector",isNullable:!0,defaultValue:null,type:P.R.TS_VECTOR,universalIdentifier:at({objectConfig:o,fieldName:"searchVector"})};return[s,r,l,p,m,v,E,b,M]},qn={targetFieldName:o=>`target${P.cs(o.nameSingular)}`,targetLabel:o=>P.cs(o.nameSingular),icon:"IconBuildingSkyscraper"},Pv=[{...qn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:P.y.timelineActivity.morphIds.targetMorphId.morphId},{...qn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:P.R.RELATION,standardObjectKey:"favorite"},{...qn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:P.y.attachment.morphIds.targetMorphId.morphId},{...qn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:P.y.noteTarget.morphIds.targetMorphId.morphId},{...qn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:P.y.taskTarget.morphIds.targetMorphId.morphId}],Rv=({config:o,forwardFieldUniversalIdentifier:s,objectConfig:r,universalIdentifier:l})=>{const p=P.y[o.standardObjectKey],m={name:o.targetFieldName(r),label:o.targetLabel(r),description:`${o.targetLabel(r)} ${r.labelSingular}`,icon:o.targetIcon,isNullable:!0,universalSettings:{relationType:P.V.MANY_TO_ONE,onDelete:P.W.SET_NULL,joinColumnName:`target${P.cs(r.nameSingular)}Id`},universalIdentifier:l,objectUniversalIdentifier:p.universalIdentifier,relationTargetFieldMetadataUniversalIdentifier:s,relationTargetObjectMetadataUniversalIdentifier:r.universalIdentifier};return o.targetFieldType===P.R.MORPH_RELATION?{...m,type:o.targetFieldType,morphId:o.morphId}:{...m,type:o.targetFieldType}},Ov=o=>{const s=[],r=[];for(const l of Pv){const p=P.y[l.standardObjectKey],m=at({objectConfig:o,fieldName:l.fieldName}),v=at({objectConfig:o,fieldName:`${l.fieldName}Inverse`}),E={name:l.fieldName,label:l.label,description:`${o.labelPlural} tied to the ${l.targetLabel(o)}`,icon:l.icon,isNullable:!1,type:P.R.RELATION,universalSettings:{relationType:P.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:p.universalIdentifier},b=Rv({config:l,objectConfig:o,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(b)}return{objectFields:s,fields:r}},Lv=o=>{const s=Cv(o),{objectFields:r,fields:l}=Ov(o),p=(o.fields??[]).map(v=>v.name),m=[...o.fields];for(const v of s)p.includes(v.name)||m.push(v);for(const v of r)p.includes(v.name)||m.push(v);return{objectFields:m,fields:l}},kv=async o=>await pl.glob(["**/*.ts","**/*.tsx"],{cwd:o,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),Nv=async o=>await pl.glob([`${vs}/**/*`],{cwd:o,onlyFiles:!0}),Il=async o=>{const s=await kv(o),r=[];let l;const p=[],m=[],v=[],E=[],b=[],M=[],H=[],X=[],N=[],V=[],ie=[],lt=[],Fe=[],dt=[],vn=[],$e=[],bt=[],Me=[],Ct=[],Be=[],Pt=[];for(const le of s){const Jn=await fl.readFile(le,"utf-8"),Pe=$.relative(o,le),zn=xv(Jn);if(!zn)continue;switch(_v[zn]){case Ye.Application:{const B=await pt({appPath:o,filePath:le});l={...B.config,yarnLockChecksum:null,packageJsonChecksum:null,apiClientChecksum:null},r.push(...B.errors),ie.push(Pe);break}case Ye.Objects:{const B=await pt({appPath:o,filePath:le}),{objectFields:de,fields:ht}=Lv(B.config),Re=B.config.labelIdentifierFieldMetadataUniversalIdentifier??de.find(_n=>_n.name==="name")?.universalIdentifier;if(!Re){r.push(`No label identifier field found for object ${B.config.nameSingular}. Please add a field with name "name" to your object.`);break}const ve={...B.config,fields:de,labelIdentifierFieldMetadataUniversalIdentifier:Re};p.push(ve),m.push(...ht),r.push(...B.errors),lt.push(Pe);break}case Ye.Fields:{const B=await pt({appPath:o,filePath:le});m.push(B.config),r.push(...B.errors),Fe.push(Pe);break}case Ye.Roles:{const B=await pt({appPath:o,filePath:le});v.push(B.config),r.push(...B.errors),dt.push(Pe);break}case Ye.Skills:{const B=await pt({appPath:o,filePath:le});E.push(B.config),r.push(...B.errors),vn.push(Pe);break}case Ye.LogicFunctions:{const B=await pt({appPath:o,filePath:le});r.push(...B.errors);const{handler:de,...ht}=B.config,Re=$.relative(o,le),ve=ht.toolInputSchema??await Tv(Jn),_n={...ht,toolInputSchema:ve,handlerName:"default.config.handler",sourceHandlerPath:Re,builtHandlerPath:Re.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};b.push(_n),$e.push(Pe);break}case Ye.FrontComponents:{const B=await pt({appPath:o,filePath:le});r.push(...B.errors);const{component:de,...ht}=B.config,Re=$.relative(o,le),ve={...ht,componentName:de.name,sourceComponentPath:Re,builtComponentPath:Re.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:"",isHeadless:ht.isHeadless??!1};M.push(ve),bt.push(Pe);break}case Ye.Views:{const B=await pt({appPath:o,filePath:le}),de={...B.config};X.push(de),r.push(...B.errors),Ct.push(Pe);break}case Ye.NavigationMenuItems:{const B=await pt({appPath:o,filePath:le});N.push(B.config),r.push(...B.errors),Be.push(Pe);break}case Ye.PageLayouts:{const B=await pt({appPath:o,filePath:le}),de={...B.config};V.push(de),r.push(...B.errors),Pt.push(Pe);break}case Ye.PublicAssets:break;default:P.dt()}}const yn=await Nv(o);for(const le of yn)H.push({filePath:le,fileName:$.basename(le),fileType:$.extname(le).replace(/^\./,""),checksum:null}),Me.push($.relative(o,le));return l||r.push("Cannot build application, please export default defineApplication() to define an application"),{manifest:l?{application:l,objects:p,fields:m,roles:v,skills:E,logicFunctions:b,frontComponents:M,publicAssets:H,views:X,navigationMenuItems:N,pageLayouts:V}:null,filePaths:{application:ie,objects:lt,fields:Fe,roles:dt,skills:vn,logicFunctions:$e,frontComponents:bt,publicAssets:Me,views:Ct,navigationMenuItems:Be,pageLayouts:Pt},errors:r}},Uv=o=>{const s=new Set,r=new Set;for(const l of o)s.has(l)?r.add(l):s.add(l);return Array.from(r)},Fl=o=>{const s=[];if(!o)return[];for(const[r,l]of Object.entries(o))r==="universalIdentifier"&&typeof l=="string"&&s.push(l),typeof l=="object"&&s.push(...Fl(l));return s},Dv=o=>{const s=[],r=[],l=Uv(Fl(o));return l.length>0&&s.push(`Duplicate universal identifiers: ${l.join(", ")}`),P.na(o.objects)||r.push("No object defined"),P.na(o.logicFunctions)||r.push("No logic function defined"),P.na(o.frontComponents)||r.push("No front component defined"),{errors:s,warnings:r,isValid:s.length===0}};class Wv{constructor({state:s,notify:r}){this.state=s,this.notify=r}async execute(s){const r=this.state.steps.buildManifest;r.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],p=await Il(s.appPath);if(p.errors.length>0||!p.manifest){for(const v of p.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}const m=Dv(p.manifest);if(!m.isValid){for(const v of m.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(m.warnings.length>0)for(const v of m.warnings)l.push({message:`⚠ ${v}`,status:"warning"});return l.push({message:"Successfully built manifest",status:"success"}),r.output={result:p},r.status="done",this.state.updatePipeline({appName:p.manifest.application.displayName}),this.state.updateEntitiesFromManifest(p.filePaths),this.state.applyStepEvents(l),p}}class $v{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();return r.serverUp?r.authValid?(s.output={isReady:!0,errorLogged:!1},s.status="done",this.notify(),!0):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed",status:"error"}]),this.state.updatePipeline({status:"error"})),!1):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Cannot reach server",status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}}class Mv{constructor({apiService:s,configService:r,state:l,notify:p}){this.apiService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){if(!s.applicationId)return;const r=this.state.steps.ensureValidTokens;r.status="in_progress",this.notify();const l=await this.configService.getConfig();if(l.applicationAccessToken&&!this.isTokenExpired(l.applicationAccessToken)){r.status="done",this.notify();return}if(l.applicationRefreshToken&&!this.isTokenExpired(l.applicationRefreshToken)){const p=await this.apiService.renewApplicationToken(l.applicationRefreshToken);if(p.success){await this.configService.setConfig({applicationAccessToken:p.data.applicationAccessToken.token,applicationRefreshToken:p.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:"Application tokens renewed",status:"success"}]),r.status="done",this.notify();return}this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:`Failed to renew application tokens: ${JSON.stringify(p.error,null,2)}`,status:"error"}]),await this.exchangeTokens({applicationId:s.applicationId});return}await this.exchangeTokens({applicationId:s.applicationId})}async exchangeTokens(s){const r=await this.apiService.generateApplicationToken(s.applicationId);if(!r.success){this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:`Failed to generate application tokens: ${JSON.stringify(r.error,null,2)}`,status:"error"}]),this.state.steps.ensureValidTokens.status="error",this.notify();return}await this.configService.setConfig({applicationAccessToken:r.data.applicationAccessToken.token,applicationRefreshToken:r.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:"Application tokens stored in config",status:"success"}]),this.state.steps.ensureValidTokens.status="done",this.notify()}isTokenExpired(s){try{const r=JSON.parse(Buffer.from(s.split(".")[1],"base64").toString());return Date.now()>=r.exp*1e3-6e4}catch{return!0}}}class Bv{constructor({clientService:s,configService:r,state:l,notify:p}){this.clientService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generate({appPath:s.appPath,authToken:l.applicationAccessToken}),r.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),r.status="error"}this.notify()}}class jv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.resolveApplication;r.status="in_progress",this.notify();const l=s.manifest.application.universalIdentifier,p=await this.apiService.findOneApplication(l);if(!p.success)return this.state.applyStepEvents([{message:`Failed to find application ${l}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output;if(p.data)return r.output={applicationId:p.data.id,universalIdentifier:p.data.universalIdentifier},r.status="done",this.notify(),r.output;const m=await this.apiService.createApplication(s.manifest);return m.success?(r.output={applicationId:m.data.id,universalIdentifier:m.data.universalIdentifier},this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:"Application created",status:"success"}]),r.status="done",this.notify(),r.output):(this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:`Application creation failed with error ${JSON.stringify(m.error,null,2)}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output)}}const qv=async(o,s,r)=>{const l=new Set(r),p=s.filter(m=>!l.has(m));for(const m of p){const v=m.replace(/\.tsx?$/,".mjs"),E=Y.default.join(o,v),b=`${E}.map`;await k.remove(E),await k.remove(b)}},Hv=async({result:o,appPath:s,fileFolder:r,lastChecksums:l,onFileBuilt:p})=>{const m=Object.keys(o.metafile?.outputs??{}).filter(v=>v.endsWith(".mjs"));for(const v of m){const E=Y.default.resolve(v),b=Y.default.relative(s,E),M=o.metafile?.outputs?.[v]?.entryPoint||"",H=Y.default.relative(s,M),X=await k.readFile(E),N=Hr.default.createHash("md5").update(X).digest("hex");l.get(b)!==N&&(l.set(b,N),p&&await p({fileFolder:r,builtPath:b,sourcePath:H,checksum:N}))}},Gv=[],Jv=`
179
+ export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};
180
+
181
+ var _injectedStyleKeys = {};
182
+
183
+ export function injectStyleViaHead(cssText) {
184
+ if (!cssText) return;
185
+ var hash = 0;
186
+ for (var i = 0; i < cssText.length; i++) {
187
+ hash = ((hash << 5) - hash + cssText.charCodeAt(i)) | 0;
188
+ }
189
+ var key = 'jsx-style-' + hash;
190
+ if (_injectedStyleKeys[key]) return;
191
+ _injectedStyleKeys[key] = true;
192
+ var el = document.createElement('style');
193
+ el.setAttribute('data-jsx-style', key);
194
+ el.textContent = cssText;
195
+ document.head.appendChild(el);
196
+ }
197
+
198
+ export function extractCssText(children) {
199
+ if (typeof children === 'string') return children;
200
+ if (Array.isArray(children))
201
+ return children
202
+ .filter(function (c) { return typeof c === 'string'; })
203
+ .join('');
204
+ return '';
205
+ }
206
+
207
+ var _reactToDomEvent = {
208
+ ondoubleclick: 'ondblclick',
209
+ };
210
+
211
+ function _isEventProp(name) {
212
+ return (
213
+ name.length > 2 &&
214
+ name.charCodeAt(0) === 111 &&
215
+ name.charCodeAt(1) === 110 &&
216
+ name.charCodeAt(2) >= 65 &&
217
+ name.charCodeAt(2) <= 90
218
+ );
219
+ }
220
+
221
+ export function splitEventProps(props) {
222
+ if (!props) return { cleanProps: props, events: null };
223
+ var events = null;
224
+ var cleanProps = null;
225
+ for (var k in props) {
226
+ if (_isEventProp(k) && typeof props[k] === 'function') {
227
+ if (!events) {
228
+ events = {};
229
+ cleanProps = {};
230
+ for (var j in props) {
231
+ if (j === k) break;
232
+ cleanProps[j] = props[j];
233
+ }
234
+ }
235
+ events[k] = props[k];
236
+ } else if (events) {
237
+ cleanProps[k] = props[k];
238
+ }
142
239
  }
240
+ return { cleanProps: cleanProps || props, events: events };
143
241
  }
144
242
 
145
- `;await V.appendFile(ie.join(a,"index.ts"),i)}}class z0{constructor(){this.clientService=new K0}async execute(a=Et){try{await this.clientService.generate(a)}catch(i){throw console.error(b.default.red("Generate Twenty client failed:"),i instanceof Error?i.message:i),i}}}class J0{constructor(){this.apiService=new Ct}async execute({appPath:a=Et,askForConfirmation:i}){try{console.log(b.default.blue("🚀 Uninstall Twenty Application")),console.log(b.default.gray(`📁 App Path: ${a}`)),console.log(""),i&&!await this.confirmationPrompt()&&(console.error(b.default.red("⛔️ Aborting uninstall")),process.exit(1));const{manifest:f}=await Qr(a);if(!f)return{success:!1,error:"Build failed"};const g=await this.apiService.uninstallApplication(f.application.universalIdentifier);return g.success===!1?console.error(b.default.red("❌ Uninstall failed:"),g.error):console.log(b.default.green("✅ Application uninstalled successfully")),g}catch(f){throw console.error(b.default.red("Uninstall failed:"),f instanceof Error?f.message:f),f}}async confirmationPrompt(){const{confirmation:a}=await At.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return a}}class Y0{constructor(){this.configService=new Ae}async execute(){try{const a=await this.configService.getAvailableWorkspaces(),i=await this.configService.getDefaultWorkspace();if(a.length===0){console.log(b.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(b.default.blue(`Available workspaces:
146
- `));for(const f of a){const g=await this.configService.getConfigForWorkspace(f),_=!!g.apiKey,A=f===i?b.default.green(" (default)"):"",I=_?b.default.green("●"):b.default.gray("○");console.log(` ${I} ${f}${A}`),console.log(b.default.gray(` API URL: ${g.apiUrl}`))}console.log(""),console.log(b.default.gray("● = authenticated, ○ = no credentials")),console.log(b.default.gray("Use `twenty auth:switch <workspace>` to change default"))}catch(a){console.error(b.default.red("List failed:"),a instanceof Error?a.message:a),process.exit(1)}}}class Z0{constructor(){this.configService=new Ae,this.apiService=new Ct}async execute(a){try{let{apiKey:i,apiUrl:f}=a;const g=await this.configService.getConfig();if(f||(f=(await At.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:g.apiUrl,validate:A=>{try{return new URL(A),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),i||(i=(await At.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:A=>A.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:f,apiKey:i}),(await this.apiService.validateAuth()).authValid){const S=Ae.getActiveWorkspace();console.log(b.default.green(`✓ Successfully authenticated with Twenty (workspace: ${S})`))}else console.log(b.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(i){console.error(b.default.red("Login failed:"),i instanceof Error?i.message:i),process.exit(1)}}}class X0{constructor(){this.configService=new Ae}async execute(){try{await this.configService.clearConfig();const a=Ae.getActiveWorkspace();console.log(b.default.green(`✓ Successfully logged out (workspace: ${a})`))}catch(a){console.error(b.default.red("Logout failed:"),a instanceof Error?a.message:a),process.exit(1)}}}class Q0{constructor(){this.configService=new Ae,this.apiService=new Ct}async execute(){try{const a=Ae.getActiveWorkspace(),i=await this.configService.getConfig();if(console.log(b.default.blue("Authentication Status:")),console.log(`Workspace: ${a}`),console.log(`API URL: ${i.apiUrl}`),console.log(`API Key: ${i.apiKey?"***"+i.apiKey.slice(-4):"Not set"}`),i.apiKey){const f=await this.apiService.validateAuth();console.log(`Status: ${f.authValid?b.default.green("✓ Valid"):b.default.red("✗ Invalid")}`)}else console.log(`Status: ${b.default.yellow("⚠ Not authenticated")}`)}catch(a){console.error(b.default.red("Status check failed:"),a instanceof Error?a.message:a),process.exit(1)}}}class V0{constructor(){this.apiService=new Ct}async execute({appPath:a=Et,functionUniversalIdentifier:i,functionName:f,payload:g="{}"}){try{let _;try{_=JSON.parse(g)}catch{console.error(b.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const{manifest:S}=await Qr(a);S||(console.error(b.default.red("Failed to build manifest.")),process.exit(1));const A=await this.apiService.findLogicFunctions();A.success||(console.error(b.default.red("Failed to fetch functions:"),A.error instanceof Error?A.error.message:A.error),process.exit(1));const I=A.data.filter(k=>k.universalIdentifier&&this.belongsToApplication(k,S)),P=I.find(k=>i?k.universalIdentifier===i:f?k.name===f:!1);if(!P){const k=i||f;console.error(b.default.red(`Function "${k}" not found in application.`)),console.log(""),I.length>0?(console.log(b.default.cyan("Available functions:")),I.forEach(ue=>{console.log(` - ${b.default.white(ue.name)} (${ue.universalIdentifier})`)})):console.log(b.default.yellow("No functions found for this application. Have you synced your app with `yarn app:dev`?")),process.exit(1)}console.log(b.default.blue(`🚀 Executing function "${P.name}"...`)),console.log(b.default.gray(` Payload: ${JSON.stringify(_)}`)),console.log("");const J=await this.apiService.executeLogicFunction({functionId:P.id,payload:_});J.success||(console.error(b.default.red("Execution failed:"),J.error instanceof Error?J.error.message:J.error),process.exit(1));const G=J.data;console.log(b.default.cyan("─".repeat(60))),console.log(b.default.cyan("Execution Result")),console.log(b.default.cyan("─".repeat(60)));const K=G.status==="SUCCESS"?b.default.green:b.default.red;console.log(`${b.default.bold("Status:")} ${K(G.status)}`),console.log(`${b.default.bold("Duration:")} ${G.duration}ms`),je.Tr(G.data)&&(console.log(""),console.log(b.default.bold("Data:")),console.log(b.default.white(JSON.stringify(G.data,null,2)))),G.error&&(console.log(""),console.log(b.default.bold.red("Error:")),console.log(b.default.red(` Type: ${G.error.errorType}`)),console.log(b.default.red(` Message: ${G.error.errorMessage}`)),G.error.stackTrace&&(console.log(""),console.log(b.default.gray("Stack trace:")),console.log(b.default.gray(G.error.stackTrace)))),G.logs&&(console.log(""),console.log(b.default.bold("Logs:")),console.log(b.default.gray(G.logs))),console.log(b.default.cyan("─".repeat(60))),G.status!=="SUCCESS"&&process.exit(1)}catch(_){console.error(b.default.red("Execution failed:"),_ instanceof Error?_.message:_),process.exit(1)}}belongsToApplication(a,i){return i.logicFunctions.some(f=>f.universalIdentifier===a.universalIdentifier)}}class ev{constructor(){this.apiService=new Ct}async execute({appPath:a=Et,functionUniversalIdentifier:i,functionName:f}){try{const{manifest:g}=await Qr(a);g||process.exit(1),this.logWatchInfo({appName:g.application.displayName,functionUniversalIdentifier:i,functionName:f}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:g.application.universalIdentifier,functionUniversalIdentifier:i,functionName:f})}catch(g){console.error(b.default.red("Watch logs failed:"),g instanceof Error?g.message:g),process.exit(1)}}logWatchInfo({appName:a,functionUniversalIdentifier:i,functionName:f}){const g=a??"Twenty Application",_=i||f?`function "${i||f}"`:"functions";console.log(b.default.blue(`🚀 Watching ${g} ${_} logs:`)),console.log("")}}class tv{constructor(){this.configService=new Ae,this.apiService=new Ct}async execute(a){try{let{workspace:i}=a;const f=await this.configService.getAvailableWorkspaces(),g=await this.configService.getDefaultWorkspace();if(f.length===0){console.log(b.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}if(!i){const A=f.map(P=>({name:P===g?`${P} (current default)`:P,value:P}));i=(await At.default.prompt([{type:"list",name:"workspace",message:"Select a workspace to set as default:",choices:A,default:g}])).workspace}if(f.includes(i)||(console.log(b.default.red(`✗ Workspace "${i}" not found. Available workspaces: ${f.join(", ")}`)),process.exit(1)),i===g){console.log(b.default.blue(`ℹ "${i}" is already the default workspace.`));return}await this.configService.setDefaultWorkspace(i),Ae.setActiveWorkspace(i);const S=!!(await this.configService.getConfig()).apiKey;console.log(b.default.green(`✓ Switched default workspace to "${i}"`)),S?(await this.apiService.validateAuth()).authValid?console.log(b.default.green("✓ Authentication is valid")):console.log(b.default.yellow("⚠ Authentication credentials exist but are invalid. Run `twenty auth:login` to re-authenticate.")):console.log(b.default.yellow("⚠ No credentials configured for this workspace. Run `twenty auth:login` to authenticate."))}catch(i){console.error(b.default.red("Switch failed:"),i instanceof Error?i.message:i),process.exit(1)}}}var Cs,pu;function nv(){if(pu)return Cs;pu=1;var c="[object Symbol]",a=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,f="\\ud800-\\udfff",g="\\u0300-\\u036f\\ufe20-\\ufe23",_="\\u20d0-\\u20f0",S="\\u2700-\\u27bf",A="a-z\\xdf-\\xf6\\xf8-\\xff",I="\\xac\\xb1\\xd7\\xf7",P="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",J="\\u2000-\\u206f",G=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",K="A-Z\\xc0-\\xd6\\xd8-\\xde",k="\\ufe0e\\ufe0f",ue=I+P+J+G,Oe="['’]",pe="["+ue+"]",Le="["+g+_+"]",Tt="\\d+",Te="["+S+"]",F="["+A+"]",Z="[^"+f+ue+Tt+S+A+K+"]",z="\\ud83c[\\udffb-\\udfff]",se="(?:"+Le+"|"+z+")",qe="[^"+f+"]",ne="(?:\\ud83c[\\udde6-\\uddff]){2}",Ht="[\\ud800-\\udbff][\\udc00-\\udfff]",Ge="["+K+"]",ht="\\u200d",Ft="(?:"+F+"|"+Z+")",Vn="(?:"+Ge+"|"+Z+")",er="(?:"+Oe+"(?:d|ll|m|re|s|t|ve))?",tr="(?:"+Oe+"(?:D|LL|M|RE|S|T|VE))?",at=se+"?",et="["+k+"]?",Vr="(?:"+ht+"(?:"+[qe,ne,Ht].join("|")+")"+et+at+")*",un=et+at+Vr,He="(?:"+[Te,ne,Ht].join("|")+")"+un,ei=RegExp(Oe,"g"),ti=RegExp(Le,"g"),ni=RegExp([Ge+"?"+F+"+"+er+"(?="+[pe,Ge,"$"].join("|")+")",Vn+"+"+tr+"(?="+[pe,Ge+Ft,"$"].join("|")+")",Ge+"?"+Ft+"+"+er,Ge+"+"+tr,Tt,He].join("|"),"g"),It=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,cn={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"ss"},ri=typeof bt.commonjsGlobal=="object"&&bt.commonjsGlobal&&bt.commonjsGlobal.Object===Object&&bt.commonjsGlobal,Kt=typeof self=="object"&&self&&self.Object===Object&&self,zt=ri||Kt||Function("return this")();function ii(O,de,ot,ir){for(var Xt=-1,Ln=O?O.length:0;++Xt<Ln;)ot=de(ot,O[Xt],Xt,O);return ot}function ln(O){return O.match(a)||[]}function fn(O){return function(de){return O?.[de]}}var nr=fn(cn);function Me(O){return It.test(O)}function Jt(O){return O.match(ni)||[]}var si=Object.prototype,tt=si.toString,On=zt.Symbol,rr=On?On.prototype:void 0,Rt=rr?rr.toString:void 0;function Ne(O){if(typeof O=="string")return O;if(ai(O))return Rt?Rt.call(O):"";var de=O+"";return de=="0"&&1/O==-1/0?"-0":de}function Yt(O){return function(de){return ii(Ot(oi(de).replace(ei,"")),O,"")}}function hn(O){return!!O&&typeof O=="object"}function ai(O){return typeof O=="symbol"||hn(O)&&tt.call(O)==c}function Pt(O){return O==null?"":Ne(O)}function oi(O){return O=Pt(O),O&&O.replace(i,nr).replace(ti,"")}var Zt=Yt(function(O,de,ot){return O+(ot?"-":"")+de.toLowerCase()});function Ot(O,de,ot){return O=Pt(O),de=de,de===void 0?Me(O)?Jt(O):ln(O):O.match(de)||[]}return Cs=Zt,Cs}var rv=nv();const In=bt.getDefaultExportFromCjs(rv),iv=({name:c,universalIdentifier:a=Qn.v4()})=>{const i=In(c);return`import { defineFrontComponent } from 'twenty-sdk';
243
+ export function makeEventRef(events, userRef) {
244
+ return function(el) {
245
+ if (el) {
246
+ for (var name in events) {
247
+ var domName = _reactToDomEvent[name.toLowerCase()] || name.toLowerCase();
248
+ el[domName] = events[name];
249
+ }
250
+ }
251
+ if (typeof userRef === 'function') userRef(el);
252
+ else if (userRef != null && typeof userRef === 'object') userRef.current = el;
253
+ };
254
+ }
255
+ `.trim(),zv=`
256
+ import {
257
+ jsx as _originalJsx,
258
+ jsxs as _originalJsxs,
259
+ Fragment,
260
+ } from '__real_react_jsx_runtime__';
261
+
262
+ import {
263
+ customElementMap,
264
+ injectStyleViaHead,
265
+ extractCssText,
266
+ splitEventProps,
267
+ makeEventRef,
268
+ } from '__jsx_shared_helpers__';
269
+
270
+ function _wrapJsxFactory(originalFactory) {
271
+ return function wrappedJsx(type, props, key) {
272
+ if (typeof type === 'string') {
273
+ if (type === 'style') {
274
+ var css =
275
+ props && props.dangerouslySetInnerHTML
276
+ ? props.dangerouslySetInnerHTML.__html || ''
277
+ : extractCssText(props && props.children);
278
+ injectStyleViaHead(css);
279
+ return null;
280
+ }
281
+
282
+ var customTag = customElementMap[type];
283
+ if (customTag) {
284
+ var split = splitEventProps(props);
285
+ if (split.events) {
286
+ var cp = split.cleanProps;
287
+ cp.ref = makeEventRef(split.events, cp.ref);
288
+ return originalFactory(customTag, cp, key);
289
+ }
290
+ return originalFactory(customTag, props, key);
291
+ }
292
+ }
293
+ return originalFactory(type, props, key);
294
+ };
295
+ }
296
+
297
+ export var jsx = _wrapJsxFactory(_originalJsx);
298
+ export var jsxs = _wrapJsxFactory(_originalJsxs);
299
+ export { Fragment };
300
+ `.trim(),Kv=`
301
+ export * from '__real_react__';
302
+ import _React from '__real_react__';
303
+
304
+ import {
305
+ customElementMap,
306
+ injectStyleViaHead,
307
+ extractCssText,
308
+ splitEventProps,
309
+ makeEventRef,
310
+ } from '__jsx_shared_helpers__';
311
+
312
+ var _originalCreateElement = _React.createElement;
313
+
314
+ function createElement(type) {
315
+ var args = arguments;
316
+ if (typeof type === 'string') {
317
+ if (type === 'style') {
318
+ var props = args.length > 1 ? args[1] : null;
319
+ if (props) {
320
+ var css = props.dangerouslySetInnerHTML
321
+ ? props.dangerouslySetInnerHTML.__html || ''
322
+ : extractCssText(props.children);
323
+ injectStyleViaHead(css);
324
+ }
325
+ return null;
326
+ }
327
+
328
+ var customTag = customElementMap[type];
329
+ if (customTag) {
330
+ var ceProps = args.length > 1 ? args[1] : null;
331
+ var split = splitEventProps(ceProps);
332
+ if (split.events) {
333
+ var cp = split.cleanProps || {};
334
+ cp.ref = makeEventRef(split.events, cp.ref);
335
+ var newArgs = [customTag, cp];
336
+ for (var i = 2; i < args.length; i++) newArgs.push(args[i]);
337
+ return _originalCreateElement.apply(null, newArgs);
338
+ }
339
+ var newArgs2 = [customTag];
340
+ for (var i2 = 1; i2 < args.length; i2++) newArgs2.push(args[i2]);
341
+ return _originalCreateElement.apply(null, newArgs2);
342
+ }
343
+ }
344
+ return _originalCreateElement.apply(null, args);
345
+ }
346
+
347
+ export { createElement };
348
+ export default Object.assign({}, _React, { createElement: createElement });
349
+ `.trim(),Vv=o=>{const s="react/jsx-runtime",r="react";return{name:"jsx-runtime-remote-wrapper",setup:l=>{let p,m;l.onResolve({filter:/^__jsx_shared_helpers__$/},()=>({path:"__jsx_shared_helpers__",namespace:"jsx-shared-helpers"})),l.onLoad({filter:/.*/,namespace:"jsx-shared-helpers"},()=>({contents:Jv,loader:"js"})),l.onResolve({filter:/^react\/jsx-runtime$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return p||(p=(await l.resolve(s,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react/jsx-runtime",namespace:"jsx-runtime-wrapper"}}),l.onResolve({filter:/^__real_react_jsx_runtime__$/},()=>{if(!p)throw new Error("jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet");return{path:p}}),l.onLoad({filter:/.*/,namespace:"jsx-runtime-wrapper"},()=>({contents:zv,loader:"js"})),l.onResolve({filter:/^react$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return m||(m=(await l.resolve(r,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react",namespace:"react-wrapper"}}),l.onResolve({filter:/^__real_react__$/},()=>{if(!m)throw new Error("jsx-runtime-remote-wrapper: real react path not resolved yet");return{path:m}}),l.onLoad({filter:/.*/,namespace:"react-wrapper"},()=>({contents:Kv,loader:"js"}))}}},Yv=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,al=/export\s+default\s+defineFrontComponent\s*\(\s*\{[\s\S]*?component\s*:\s*(\w+)[\s\S]*?\}\s*\)\s*;?/s,Xv=o=>{let s=o.replace(Yv,"");const r=s.match(al);if(r){const l=r[1],p=new RegExp(`export\\s+(const|function)\\s+${l}\\b`);s=s.replace(p,`$1 ${l}`),s=`import { createRoot as __createRoot } from 'react-dom/client';
350
+ import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
351
+ `+s,s=s.replace(al,`export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${l}, {})); }`)}return s},Zv={name:"jsx-transform-to-remote-dom-worker-format-plugin",setup:o=>{o.onLoad({filter:/\.tsx$/},async({path:s})=>{try{const r=await Hm.readFile(s,"utf8");return{contents:Xv(r),loader:"tsx"}}catch(r){return{errors:[{text:`Failed to transform front component: ${r instanceof Error?r.message:String(r)}`,location:{file:s}}]}}})}},Qv=/^\/\/.*$\n/gm,ey={name:"strip-comments",setup:o=>{o.onEnd(async s=>{if(s.errors.length>0)return;const r=Object.keys(s.metafile?.outputs??{}).filter(l=>l.endsWith(".mjs"));for(const l of r){const p=Y.default.resolve(l),m=await rl.readFile(p,"utf-8"),v=m.replace(Qv,"");v!==m&&await rl.writeFile(p,v,"utf-8")}})}},ty=o=>[Vv(),Zv,ey],ny=/^(.+)\((\d+),(\d+)\): error TS\d+: (.+)$/,El=o=>{const s=o.match(ny);if(!s)return null;const[,r,l,p,m]=s;return{text:m,file:r,line:Number(l),column:Number(p)-1}},ry=o=>{const s=[];for(const r of o.split(`
352
+ `)){const l=El(r);l&&s.push(l)}return s},Tl=o=>{const s=jr.default.join(o,"tsconfig.json"),r=jr.default.join(o,"node_modules",".bin","tsc");return new Promise(l=>{dl.execFile(r,["--noEmit","--pretty","false","-p",s],{cwd:o},(p,m,v)=>{l(ry(v||m))})})},iy=o=>o.map(s=>({text:s.text,location:{file:s.file,line:s.line,column:s.column,lineText:"",length:0,namespace:"",suggestion:""}})),bl=o=>({name:"typecheck",setup:s=>{s.onStart(async()=>{const r=await Tl(o);return{errors:iy(r)}})}}),sy=["path","fs","crypto","stream","util","os","url","http","https","events","buffer","querystring","assert","zlib","net","tls","child_process","worker_threads","twenty-sdk","twenty-sdk/*","twenty-shared","twenty-shared/*"];class Cl{constructor(s){this.esBuildContext=null,this.isRestarting=!1,this.lastChecksums=new Map,this.buildCompletePromise=Promise.resolve(),this.resolveBuildComplete=null,this.appPath=s.appPath,this.sourcePaths=s.sourcePaths,this.watchMode=s.watch??!0,this.onFileBuilt=s.handleFileBuilt,this.onBuildError=s.handleBuildError,this.config=s.config}shouldRestart(s){const r=this.sourcePaths.sort().join(","),l=[...s].sort().join(",");return r!==l}async start(){this.sourcePaths.length>0&&await this.createContext()}async close(){await this.esBuildContext?.dispose(),this.esBuildContext=null}async restart(s){if(!this.isRestarting){this.isRestarting=!0;try{await this.close();const r=Y.default.join(this.appPath,Qe);await qv(r,this.sourcePaths,s),this.sourcePaths=s,this.lastChecksums.clear(),this.sourcePaths.length>0&&await this.createContext()}finally{this.isRestarting=!1}}}async createContext(){const s=Y.default.join(this.appPath,Qe),r={};for(const m of this.sourcePaths){const v=m.replace(/\.tsx?$/,"");r[v]=Y.default.join(this.appPath,m)}const l=this,p=[...this.config.extraPlugins??[],{name:"build-notifications",setup:m=>{m.onEnd(async v=>{try{if(v.errors.length>0){v.errors[0].text.includes("Could not resolve")||await this.onBuildError?.(v.errors.map(E=>({error:E.text,location:E.location})));return}await Hv({result:v,appPath:this.appPath,fileFolder:this.config.fileFolder,lastChecksums:l.lastChecksums,onFileBuilt:l.onFileBuilt})}finally{l.resolveBuildComplete?.()}})}}];this.esBuildContext=await ml.context({entryPoints:r,bundle:!0,splitting:!1,format:"esm",platform:this.config.platform,outdir:s,outExtension:{".js":".mjs"},external:this.config.externalModules,tsconfig:Y.default.join(this.appPath,"tsconfig.json"),jsx:this.config.jsx,sourcemap:!0,metafile:!0,logLevel:"silent",minify:this.config.minify,banner:this.config.banner,plugins:p}),this.buildCompletePromise=new Promise(m=>{this.resolveBuildComplete=m}),await this.esBuildContext.rebuild(),await this.buildCompletePromise,this.watchMode&&await this.esBuildContext.watch()}}const Pl=o=>({name:"sdk-generated-resolver",setup:s=>{s.onResolve({filter:/^twenty-sdk\/generated/},()=>({path:Y.default.join(o,"node_modules","twenty-sdk",Gr,"index.ts")}))}}),ay=o=>new Cl({...o,config:{externalModules:sy,fileFolder:P.U.BuiltLogicFunction,platform:"node",extraPlugins:[bl(o.appPath),Pl(o.appPath)],banner:Jm}}),oy=o=>new Cl({...o,config:{externalModules:Gv,fileFolder:P.U.BuiltFrontComponent,jsx:"automatic",extraPlugins:[bl(o.appPath),Pl(o.appPath),...ty()]}});class ol{constructor(s){this.watcher=null,this.appPath=s.appPath,this.fileFolder=s.fileFolder,this.watchPaths=s.watchPaths,this.handleFileBuilt=s.handleFileBuilt}async start(){const s=this.watchPaths.map(r=>$.join(this.appPath,r));for(const r of s)if(!await k.pathExists(r))return;this.watcher=vl.default.watch(s,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{r==="addDir"||r==="unlinkDir"||((r==="add"||r==="change")&&this.copyAndNotify(l),r==="unlink"&&this.handleUnlink(l))})}async close(){await this.watcher?.close()}async copyAndNotify(s){const r=$.relative(this.appPath,s),l=$.join(Qe,r),p=$.join(this.appPath,l);await k.ensureDir($.dirname(p)),await k.copy(s,p);const m=await k.readFile(p),v=Hr.default.createHash("md5").update(m).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:r,checksum:v})}async handleUnlink(s){const r=$.relative(this.appPath,s),l=$.join(Qe,r),p=$.join(this.appPath,l);await k.remove(p)}}class ly{constructor(s){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=s.appPath,this.onErrors=s.onErrors}async start(){const s=jr.default.join(this.appPath,"node_modules",".bin","tsc");if(!await k.pathExists(s))return;const r=jr.default.join(this.appPath,"tsconfig.json");this.process=dl.spawn(s,["--watch","--noEmit","--pretty","false","-p",r],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(s){this.buffer+=s;const r=this.buffer.split(`
353
+ `);this.buffer=r.pop()??"";for(const l of r)this.processLine(l)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=El(s);r&&this.pendingErrors.push(r)}}const uy=new Set(["node_modules",Gr,"dist",".twenty"]);class cy{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=vl.default.watch(this.appPath,{ignored:r=>{const l=$.relative(s,r);if(l==="")return!1;const p=l.split(Y.default.sep)[0];return uy.has(p)||p.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{if(r==="addDir"||r==="unlinkDir")return;const p=$.relative(this.appPath,l),m=p.startsWith(vs),v=["package.json","yarn.lock"].includes(p);!(p.endsWith(".ts")||p.endsWith(".tsx"))&&!m&&!v||this.handleChangeDetected(p,r)})}async close(){await this.watcher?.close()}}class fy{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new cy({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this)}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:l}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,l);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info"}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=ay({appPath:this.state.appPath,sourcePaths:s,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=oy({appPath:this.state.appPath,sourcePaths:s,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new ol({appPath:this.state.appPath,fileFolder:P.U.PublicAsset,watchPaths:[vs],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new ol({appPath:this.state.appPath,fileFolder:P.U.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new ly({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}const py=({manifest:o,builtFileInfos:s})=>{let r=structuredClone(o);for(const[p,{fileFolder:m,checksum:v}]of s.entries()){const E=$.relative(Qe,p);if(m===P.U.BuiltLogicFunction){const b=r.logicFunctions,M=b.findIndex(H=>H.builtHandlerPath===E);if(M===-1)continue;r={...r,logicFunctions:b.map((H,X)=>X===M?{...H,builtHandlerChecksum:v}:H)}}if(m===P.U.PublicAsset){const b=r.publicAssets,M=b.findIndex(H=>H.filePath===E);if(M===-1)continue;r={...r,publicAssets:b.map((H,X)=>X===M?{...H,checksum:v}:H)};continue}if(m===P.U.BuiltFrontComponent){const b=r.frontComponents,M=b.findIndex(H=>H.builtComponentPath===E)??-1;if(M===-1)continue;r={...r,frontComponents:b.map((H,X)=>X===M?{...H,builtComponentChecksum:v}:H)}}m===P.U.Dependencies&&(E==="package.json"&&(r.application.packageJsonChecksum=v),E==="yarn.lock"&&(r.application.yarnLockChecksum=v))}const l=[];for(const[p,{fileFolder:m}]of s.entries()){const v=$.relative(Qe,p);if(m===P.U.Dependencies&&v.startsWith(`${Br}/`)){const E=s.get(p);E&&l.push(E.checksum)}}return l.length>0&&(r.application.apiClientChecksum=Hr.default.createHash("md5").update(l.sort().join("")).digest("hex")),r},dy=async(o,s)=>{const r=Y.default.join(o,Qe);await k.ensureDir(r);const l=Y.default.join(r,"manifest.json");return await k.writeJSON(l,s,{spaces:2}),l},Rl=o=>{if(typeof o=="string")return o;if(hn.default.isAxiosError(o)){const r=[],l=o.response?.status,p=o.response?.statusText;l&&r.push(`HTTP ${l}${p?` ${p}`:""}`);const m=o.response?.data?.errors;if(Array.isArray(m)&&m.length>0){const v=m.map(E=>E.message??"Unknown GraphQL error").join("; ");r.push(v)}else o.response?.data?.message?r.push(o.response.data.message):o.message&&r.push(o.message);return o.code&&r.push(`(${o.code})`),r.join(" - ")||"Unknown Axios error"}if(o instanceof Error)return o.message||o.toString();const s=JSON.stringify(o,null,2);return s==="{}"||s===void 0?String(o):s};class hy{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],p=py({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await dy(s.appPath,p),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const m=await this.apiService.syncApplication(p);if(m.success){l.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const v=`Sync failed with error: ${Rl(m.error)}`;l.push({message:v,status:"error"}),r.output={syncStatus:"error",error:v},r.status="error",this.state.updatePipeline({status:"error",error:v}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class gy{constructor(s){this.apiService=new Tt,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const l=$.relative(Qe,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:l,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const my=["types.ts","schema.ts"];class vy{constructor({state:s,notify:r}){this.state=s,this.notify=r}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new gy({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,l){const p=this.state.steps.uploadFiles;if(!p.output.fileUploader)return;this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading");const m=p.output.fileUploader.uploadFile({builtPath:s,fileFolder:l}).then(v=>{v.success?(this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):this.state.addEvent({message:`Failed to upload ${s}: ${v.error}`,status:"error"})}).catch(v=>{this.state.addEvent({message:`Upload failed for ${s}: ${v}`,status:"error"})}).finally(()=>{p.output.activeUploads.delete(m)});p.output.activeUploads.add(m)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}async copyAndUploadApiClientFiles(s){const r=$.join(s,"node_modules","twenty-sdk",Gr);if(!await k.pathExists(r))return;const l=$.join(s,Qe,Br);await k.ensureDir(l);for(const p of my){const m=$.join(r,p);if(!await k.pathExists(m))continue;await k.copy(m,$.join(l,p));const v=await k.readFile(m),E=Hr.default.createHash("md5").update(v).digest("hex"),b=$.join(Qe,Br,p),M=$.join(Br,p);this.state.steps.uploadFiles.output.builtFileInfos.set(b,{checksum:E,builtPath:b,sourcePath:M,fileFolder:P.U.Dependencies}),this.uploadFile(b,M,P.U.Dependencies)}}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,l,r)}}class yy{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Tt({disableInterceptors:!0}),l=new we,p=new yv,m={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new $v({...m,apiService:r}),this.ensureValidTokensStep=new Mv({...m,apiService:r,configService:l}),this.buildManifestStep=new Wv(m),this.resolveApplicationStep=new jv({...m,apiService:r}),this.uploadFilesStep=new vy(m),this.generateApiClientStep=new Bv({...m,clientService:p,configService:l}),this.syncApplicationStep=new hy({...m,apiService:r}),this.startWatchersStep=new fy({...m,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this)})}async start(){const s=Y.default.join(this.state.appPath,Qe);await k.ensureDir(s),await k.emptyDir(s),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${Rl(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;await this.ensureValidTokensStep.execute({applicationId:this.state.steps.resolveApplication.output.applicationId});const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),await this.uploadFilesStep.copyAndUploadApiClientFiles(this.state.appPath))}async initializePipeline(s){const r=await this.resolveApplicationStep.execute({manifest:s});return r.applicationId?(await this.ensureValidTokensStep.exchangeTokens({applicationId:r.applicationId}),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0):!1}}const _y={objects:K.Object,fields:K.Field,logicFunctions:K.LogicFunction,frontComponents:K.FrontComponent,roles:K.Role,skills:K.Skill,views:K.View,navigationMenuItems:K.NavigationMenuItem,pageLayouts:K.PageLayout},wy=200,xy={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class Sy{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.frontendUrl=s.frontendUrl,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(wy-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),p=l.get(s);p?.status&&!xy[p.status].includes(r)||(l.set(s,p?{...p,status:r}:{name:s,path:s,status:r}),this.entities=l)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[l,p]of r)r.set(l,{...p,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[p,m]of Object.entries(s)){const v=_y[p];if(v)for(const E of m)r.set(E,v)}const l=new Map(this.entities);for(const[p,m]of l)l.set(p,{...m,type:r.get(p)});this.entities=l}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),l=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,l}}class Ay{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}async execute(s){const r=s.appPath??Ie,l=new Sy({appPath:r,frontendUrl:process.env.FRONTEND_URL}),p=new gv(l);l.onChange=()=>p.notify();const{unmount:m}=await hv(p);this.unmountUI=m,this.orchestrator=new yy({state:l}),await this.orchestrator.start(),this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",s),process.on("SIGTERM",s)}}const Iy=o=>`${A.default.cyan(o.file)}:${A.default.yellow(String(o.line))}:${A.default.yellow(String(o.column+1))} - ${A.default.red("error")} ${o.text}`;class Fy{async execute(s){const r=s.appPath??Ie;console.log(A.default.blue("Running type check...")),console.log(A.default.gray(`App path: ${r}`)),console.log("");const l=await Tl(r);l.length===0&&(console.log(A.default.green("✓ No type errors found")),process.exit(0));for(const p of l)console.log(Iy(p));console.log(""),console.log(A.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}const _s=async o=>{const s=Y.default.join(o,Qe);await k.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await k.pathExists(r)){const{manifest:l}=await Il(o);return l}return await k.readJson(r)};class Ey{constructor(){this.apiService=new Tt}async execute({appPath:s=Ie,askForConfirmation:r}){try{console.log(A.default.blue("🚀 Uninstall Twenty Application")),console.log(A.default.gray(`📁 App Path: ${s}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error(A.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await _s(s);if(!l)return{success:!1,error:"Build failed"};const p=await this.apiService.uninstallApplication(l.application.universalIdentifier);return p.success===!1?console.error(A.default.red("❌ Uninstall failed:"),p.error):console.log(A.default.green("✅ Application uninstalled successfully")),p}catch(l){throw console.error(A.default.red("Uninstall failed:"),l instanceof Error?l.message:l),l}}async confirmationPrompt(){const{confirmation:s}=await ot.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Ty{constructor(){this.configService=new we}async execute(){try{const s=await this.configService.getAvailableWorkspaces(),r=await this.configService.getDefaultWorkspace();if(s.length===0){console.log(A.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(A.default.blue(`Available workspaces:
354
+ `));for(const l of s){const p=await this.configService.getConfigForWorkspace(l),m=!!p.apiKey,E=l===r?A.default.green(" (default)"):"",b=m?A.default.green("●"):A.default.gray("○");console.log(` ${b} ${l}${E}`),console.log(A.default.gray(` API URL: ${p.apiUrl}`))}console.log(""),console.log(A.default.gray("● = authenticated, ○ = no credentials")),console.log(A.default.gray("Use `twenty auth:switch <workspace>` to change default"))}catch(s){console.error(A.default.red("List failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class by{constructor(){this.configService=new we,this.apiService=new Tt}async execute(s){try{let{apiKey:r,apiUrl:l}=s;const p=await this.configService.getConfig();if(l||(l=(await ot.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:p.apiUrl,validate:E=>{try{return new URL(E),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),r||(r=(await ot.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:E=>E.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:l,apiKey:r}),(await this.apiService.validateAuth()).authValid){const v=we.getActiveWorkspace();console.log(A.default.green(`✓ Successfully authenticated with Twenty (workspace: ${v})`))}else console.log(A.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(r){console.error(A.default.red("Login failed:"),r instanceof Error?r.message:r),process.exit(1)}}}class Cy{constructor(){this.configService=new we}async execute(){try{await this.configService.clearConfig();const s=we.getActiveWorkspace();console.log(A.default.green(`✓ Successfully logged out (workspace: ${s})`))}catch(s){console.error(A.default.red("Logout failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Py{constructor(){this.configService=new we,this.apiService=new Tt}async execute(){try{const s=we.getActiveWorkspace(),r=await this.configService.getConfig();if(console.log(A.default.blue("Authentication Status:")),console.log(`Workspace: ${s}`),console.log(`API URL: ${r.apiUrl}`),console.log(`API Key: ${r.apiKey?"***"+r.apiKey.slice(-4):"Not set"}`),r.apiKey){const l=await this.apiService.validateAuth();console.log(`Status: ${l.authValid?A.default.green("✓ Valid"):A.default.red("✗ Invalid")}`)}else console.log(`Status: ${A.default.yellow("⚠ Not authenticated")}`)}catch(s){console.error(A.default.red("Status check failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Ry{constructor(){this.apiService=new Tt}async execute({appPath:s=Ie,postInstall:r=!1,functionUniversalIdentifier:l,functionName:p,payload:m="{}"}){try{let v;try{v=JSON.parse(m)}catch{console.error(A.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const E=await _s(s);E||(console.error(A.default.red("Failed to build manifest.")),process.exit(1));const b=await this.apiService.findLogicFunctions();b.success||(console.error(A.default.red("Failed to fetch functions:"),b.error instanceof Error?b.error.message:b.error),process.exit(1));const M=b.data.filter(ie=>ie.universalIdentifier&&this.belongsToApplication(ie,E)),H=M.find(ie=>r?ie.universalIdentifier===E.application.postInstallLogicFunctionUniversalIdentifier:l?ie.universalIdentifier===l:p?ie.name===p:!1);if(!H){const ie=r?"post install":l||p;console.error(A.default.red(`Function "${ie}" not found in application.`)),console.log(""),M.length>0?(console.log(A.default.cyan("Available functions:")),M.forEach(lt=>{console.log(` - ${A.default.white(lt.name)} (${lt.universalIdentifier})`)})):console.log(A.default.yellow("No functions found for this application. Have you synced your app with `yarn app:dev`?")),process.exit(1)}console.log(A.default.blue(`🚀 Executing function "${H.name}"...`)),console.log(A.default.gray(` Payload: ${JSON.stringify(v)}`)),console.log("");const X=await this.apiService.executeLogicFunction({functionId:H.id,payload:v});X.success||(console.error(A.default.red("Execution failed:"),X.error instanceof Error?X.error.message:X.error),process.exit(1));const N=X.data;console.log(A.default.cyan("─".repeat(60))),console.log(A.default.cyan("Execution Result")),console.log(A.default.cyan("─".repeat(60)));const V=N.status==="SUCCESS"?A.default.green:A.default.red;console.log(`${A.default.bold("Status:")} ${V(N.status)}`),console.log(`${A.default.bold("Duration:")} ${N.duration}ms`),P.o(N.data)&&(console.log(""),console.log(A.default.bold("Data:")),console.log(A.default.white(JSON.stringify(N.data,null,2)))),N.error&&(console.log(""),console.log(A.default.bold.red("Error:")),console.log(A.default.red(` Type: ${N.error.errorType}`)),console.log(A.default.red(` Message: ${N.error.errorMessage}`)),N.error.stackTrace&&(console.log(""),console.log(A.default.gray("Stack trace:")),console.log(A.default.gray(N.error.stackTrace)))),N.logs&&(console.log(""),console.log(A.default.bold("Logs:")),console.log(A.default.gray(N.logs))),console.log(A.default.cyan("─".repeat(60))),N.status!=="SUCCESS"&&process.exit(1)}catch(v){console.error(A.default.red("Execution failed:"),v instanceof Error?v.message:v),process.exit(1)}}belongsToApplication(s,r){return r.logicFunctions.some(l=>l.universalIdentifier===s.universalIdentifier)}}class Oy{constructor(){this.apiService=new Tt}async execute({appPath:s=Ie,functionUniversalIdentifier:r,functionName:l}){try{const p=await _s(s);p||process.exit(1),this.logWatchInfo({appName:p.application.displayName,functionUniversalIdentifier:r,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:p.application.universalIdentifier,functionUniversalIdentifier:r,functionName:l})}catch(p){console.error(A.default.red("Watch logs failed:"),p instanceof Error?p.message:p),process.exit(1)}}logWatchInfo({appName:s,functionUniversalIdentifier:r,functionName:l}){const p=s??"Twenty Application",m=r||l?`function "${r||l}"`:"functions";console.log(A.default.blue(`🚀 Watching ${p} ${m} logs:`)),console.log("")}}class Ly{constructor(){this.configService=new we,this.apiService=new Tt}async execute(s){try{let{workspace:r}=s;const l=await this.configService.getAvailableWorkspaces(),p=await this.configService.getDefaultWorkspace();if(l.length===0){console.log(A.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}if(!r){const E=l.map(M=>({name:M===p?`${M} (current default)`:M,value:M}));r=(await ot.default.prompt([{type:"list",name:"workspace",message:"Select a workspace to set as default:",choices:E,default:p}])).workspace}if(l.includes(r)||(console.log(A.default.red(`✗ Workspace "${r}" not found. Available workspaces: ${l.join(", ")}`)),process.exit(1)),r===p){console.log(A.default.blue(`ℹ "${r}" is already the default workspace.`));return}await this.configService.setDefaultWorkspace(r),we.setActiveWorkspace(r);const v=!!(await this.configService.getConfig()).apiKey;console.log(A.default.green(`✓ Switched default workspace to "${r}"`)),v?(await this.apiService.validateAuth()).authValid?console.log(A.default.green("✓ Authentication is valid")):console.log(A.default.yellow("⚠ Authentication credentials exist but are invalid. Run `twenty auth:login` to re-authenticate.")):console.log(A.default.yellow("⚠ No credentials configured for this workspace. Run `twenty auth:login` to authenticate."))}catch(r){console.error(A.default.red("Switch failed:"),r instanceof Error?r.message:r),process.exit(1)}}}const ky=({name:o,universalIdentifier:s=We.v4()})=>{const r=Ze.default(o);return`import { defineFrontComponent } from 'twenty-sdk';
147
355
 
148
356
  // React component - implement your UI here
149
357
  const Component = () => {
150
358
  return (
151
359
  <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>
152
360
  <h1>My new component!</h1>
153
- <p>This is your front component: ${i}</p>
361
+ <p>This is your front component: ${r}</p>
154
362
  </div>
155
363
  );
156
364
  };
157
365
 
158
366
  export default defineFrontComponent({
159
- universalIdentifier: '${a}',
160
- name: '${i}',
367
+ universalIdentifier: '${s}',
368
+ name: '${r}',
161
369
  description: 'Add a description for your front component',
162
370
  component: Component,
163
371
  });
164
- `},sv=({name:c,universalIdentifier:a=Qn.v4()})=>{const i=In(c);return`import { defineLogicFunction } from 'twenty-sdk';
372
+ `},Ny=({name:o,universalIdentifier:s=We.v4()})=>{const r=Ze.default(o);return`import { defineLogicFunction } from 'twenty-sdk';
165
373
 
166
374
  // Logic function handler - rename and implement your logic
167
375
  const handler = async (params: {
@@ -177,15 +385,15 @@ const handler = async (params: {
177
385
  };
178
386
 
179
387
  export default defineLogicFunction({
180
- universalIdentifier: '${a}',
181
- name: '${i}',
388
+ universalIdentifier: '${s}',
389
+ name: '${r}',
182
390
  description: 'Add a description for your logic function',
183
391
  timeoutSeconds: 5,
184
392
  handler,
185
393
  // Add your trigger here
186
394
  // Route trigger example:
187
395
  // httpRouteTriggerSettings: {
188
- // path: '/${i}',
396
+ // path: '/${r}',
189
397
  // httpMethod: 'POST',
190
398
  // isAuthRequired: true,
191
399
  // },
@@ -197,42 +405,55 @@ export default defineLogicFunction({
197
405
  // databaseEventTriggerSettings: {
198
406
  // eventName: 'objectName.created',
199
407
  // },
200
- ],
201
408
  });
202
- `};var Xn={exports:{}};/**
409
+ `},ll=({name:o,universalIdentifier:s=We.v4(),viewUniversalIdentifier:r})=>{const l=Ze.default(o),p=r?` viewUniversalIdentifier: '${r}',`:` // Link to a view:
410
+ // viewUniversalIdentifier: '...',
411
+ // Or link to an object:
412
+ // targetObjectUniversalIdentifier: '...',
413
+ // Or link to an external URL:
414
+ // link: 'https://example.com',`;return`import { defineNavigationMenuItem } from 'twenty-sdk';
415
+
416
+ export default defineNavigationMenuItem({
417
+ universalIdentifier: '${s}',
418
+ name: '${l}',
419
+ icon: 'IconList',
420
+ position: 0,
421
+ ${p}
422
+ });
423
+ `};var Hn={exports:{}};/**
203
424
  * @license
204
425
  * Lodash <https://lodash.com/>
205
426
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
206
427
  * Released under MIT license <https://lodash.com/license>
207
428
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
208
429
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
209
- */var av=Xn.exports,du;function ov(){return du||(du=1,function(c,a){(function(){var i,f="4.17.21",g=200,_="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",S="Expected a function",A="Invalid `variable` option passed into `_.template`",I="__lodash_hash_undefined__",P=500,J="__lodash_placeholder__",G=1,K=2,k=4,ue=1,Oe=2,pe=1,Le=2,Tt=4,Te=8,F=16,Z=32,z=64,se=128,qe=256,ne=512,Ht=30,Ge="...",ht=800,Ft=16,Vn=1,er=2,tr=3,at=1/0,et=9007199254740991,Vr=17976931348623157e292,un=NaN,He=4294967295,ei=He-1,ti=He>>>1,ni=[["ary",se],["bind",pe],["bindKey",Le],["curry",Te],["curryRight",F],["flip",ne],["partial",Z],["partialRight",z],["rearg",qe]],It="[object Arguments]",cn="[object Array]",ri="[object AsyncFunction]",Kt="[object Boolean]",zt="[object Date]",ii="[object DOMException]",ln="[object Error]",fn="[object Function]",nr="[object GeneratorFunction]",Me="[object Map]",Jt="[object Number]",si="[object Null]",tt="[object Object]",On="[object Promise]",rr="[object Proxy]",Rt="[object RegExp]",Ne="[object Set]",Yt="[object String]",hn="[object Symbol]",ai="[object Undefined]",Pt="[object WeakMap]",oi="[object WeakSet]",Zt="[object ArrayBuffer]",Ot="[object DataView]",O="[object Float32Array]",de="[object Float64Array]",ot="[object Int8Array]",ir="[object Int16Array]",Xt="[object Int32Array]",Ln="[object Uint8Array]",ui="[object Uint8ClampedArray]",ci="[object Uint16Array]",li="[object Uint32Array]",Cu=/\b__p \+= '';/g,Tu=/\b(__p \+=) '' \+/g,Fu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ps=/&(?:amp|lt|gt|quot|#39);/g,Os=/[&<>"']/g,Iu=RegExp(Ps.source),Ru=RegExp(Os.source),Pu=/<%-([\s\S]+?)%>/g,Ou=/<%([\s\S]+?)%>/g,Ls=/<%=([\s\S]+?)%>/g,Lu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mu=/^\w*$/,Nu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fi=/[\\^$.*+?()[\]{}|]/g,Uu=RegExp(fi.source),hi=/^\s+/,Wu=/\s/,Du=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$u=/\{\n\/\* \[wrapped with (.+)\] \*/,Bu=/,? & /,ku=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ju=/[()=,{}\[\]\/\s]/,qu=/\\(\\)?/g,Gu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ms=/\w*$/,Hu=/^[-+]0x[0-9a-f]+$/i,Ku=/^0b[01]+$/i,zu=/^\[object .+?Constructor\]$/,Ju=/^0o[0-7]+$/i,Yu=/^(?:0|[1-9]\d*)$/,Zu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sr=/($^)/,Xu=/['\n\r\u2028\u2029\\]/g,ar="\\ud800-\\udfff",Qu="\\u0300-\\u036f",Vu="\\ufe20-\\ufe2f",ec="\\u20d0-\\u20ff",Ns=Qu+Vu+ec,Us="\\u2700-\\u27bf",Ws="a-z\\xdf-\\xf6\\xf8-\\xff",tc="\\xac\\xb1\\xd7\\xf7",nc="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rc="\\u2000-\\u206f",ic=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ds="A-Z\\xc0-\\xd6\\xd8-\\xde",$s="\\ufe0e\\ufe0f",Bs=tc+nc+rc+ic,pi="['’]",sc="["+ar+"]",ks="["+Bs+"]",or="["+Ns+"]",js="\\d+",ac="["+Us+"]",qs="["+Ws+"]",Gs="[^"+ar+Bs+js+Us+Ws+Ds+"]",di="\\ud83c[\\udffb-\\udfff]",oc="(?:"+or+"|"+di+")",Hs="[^"+ar+"]",gi="(?:\\ud83c[\\udde6-\\uddff]){2}",mi="[\\ud800-\\udbff][\\udc00-\\udfff]",pn="["+Ds+"]",Ks="\\u200d",zs="(?:"+qs+"|"+Gs+")",uc="(?:"+pn+"|"+Gs+")",Js="(?:"+pi+"(?:d|ll|m|re|s|t|ve))?",Ys="(?:"+pi+"(?:D|LL|M|RE|S|T|VE))?",Zs=oc+"?",Xs="["+$s+"]?",cc="(?:"+Ks+"(?:"+[Hs,gi,mi].join("|")+")"+Xs+Zs+")*",lc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",fc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qs=Xs+Zs+cc,hc="(?:"+[ac,gi,mi].join("|")+")"+Qs,pc="(?:"+[Hs+or+"?",or,gi,mi,sc].join("|")+")",dc=RegExp(pi,"g"),gc=RegExp(or,"g"),vi=RegExp(di+"(?="+di+")|"+pc+Qs,"g"),mc=RegExp([pn+"?"+qs+"+"+Js+"(?="+[ks,pn,"$"].join("|")+")",uc+"+"+Ys+"(?="+[ks,pn+zs,"$"].join("|")+")",pn+"?"+zs+"+"+Js,pn+"+"+Ys,fc,lc,js,hc].join("|"),"g"),vc=RegExp("["+Ks+ar+Ns+$s+"]"),_c=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,wc=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],yc=-1,ae={};ae[O]=ae[de]=ae[ot]=ae[ir]=ae[Xt]=ae[Ln]=ae[ui]=ae[ci]=ae[li]=!0,ae[It]=ae[cn]=ae[Zt]=ae[Kt]=ae[Ot]=ae[zt]=ae[ln]=ae[fn]=ae[Me]=ae[Jt]=ae[tt]=ae[Rt]=ae[Ne]=ae[Yt]=ae[Pt]=!1;var re={};re[It]=re[cn]=re[Zt]=re[Ot]=re[Kt]=re[zt]=re[O]=re[de]=re[ot]=re[ir]=re[Xt]=re[Me]=re[Jt]=re[tt]=re[Rt]=re[Ne]=re[Yt]=re[hn]=re[Ln]=re[ui]=re[ci]=re[li]=!0,re[ln]=re[fn]=re[Pt]=!1;var xc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Sc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ac={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},bc={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ec=parseFloat,Cc=parseInt,Vs=typeof bt.commonjsGlobal=="object"&&bt.commonjsGlobal&&bt.commonjsGlobal.Object===Object&&bt.commonjsGlobal,Tc=typeof self=="object"&&self&&self.Object===Object&&self,we=Vs||Tc||Function("return this")(),_i=a&&!a.nodeType&&a,Qt=_i&&!0&&c&&!c.nodeType&&c,ea=Qt&&Qt.exports===_i,wi=ea&&Vs.process,Ke=function(){try{var p=Qt&&Qt.require&&Qt.require("util").types;return p||wi&&wi.binding&&wi.binding("util")}catch{}}(),ta=Ke&&Ke.isArrayBuffer,na=Ke&&Ke.isDate,ra=Ke&&Ke.isMap,ia=Ke&&Ke.isRegExp,sa=Ke&&Ke.isSet,aa=Ke&&Ke.isTypedArray;function Ue(p,v,m){switch(m.length){case 0:return p.call(v);case 1:return p.call(v,m[0]);case 2:return p.call(v,m[0],m[1]);case 3:return p.call(v,m[0],m[1],m[2])}return p.apply(v,m)}function Fc(p,v,m,C){for(var N=-1,Y=p==null?0:p.length;++N<Y;){var ge=p[N];v(C,ge,m(ge),p)}return C}function ze(p,v){for(var m=-1,C=p==null?0:p.length;++m<C&&v(p[m],m,p)!==!1;);return p}function Ic(p,v){for(var m=p==null?0:p.length;m--&&v(p[m],m,p)!==!1;);return p}function oa(p,v){for(var m=-1,C=p==null?0:p.length;++m<C;)if(!v(p[m],m,p))return!1;return!0}function Lt(p,v){for(var m=-1,C=p==null?0:p.length,N=0,Y=[];++m<C;){var ge=p[m];v(ge,m,p)&&(Y[N++]=ge)}return Y}function ur(p,v){var m=p==null?0:p.length;return!!m&&dn(p,v,0)>-1}function yi(p,v,m){for(var C=-1,N=p==null?0:p.length;++C<N;)if(m(v,p[C]))return!0;return!1}function oe(p,v){for(var m=-1,C=p==null?0:p.length,N=Array(C);++m<C;)N[m]=v(p[m],m,p);return N}function Mt(p,v){for(var m=-1,C=v.length,N=p.length;++m<C;)p[N+m]=v[m];return p}function xi(p,v,m,C){var N=-1,Y=p==null?0:p.length;for(C&&Y&&(m=p[++N]);++N<Y;)m=v(m,p[N],N,p);return m}function Rc(p,v,m,C){var N=p==null?0:p.length;for(C&&N&&(m=p[--N]);N--;)m=v(m,p[N],N,p);return m}function Si(p,v){for(var m=-1,C=p==null?0:p.length;++m<C;)if(v(p[m],m,p))return!0;return!1}var Pc=Ai("length");function Oc(p){return p.split("")}function Lc(p){return p.match(ku)||[]}function ua(p,v,m){var C;return m(p,function(N,Y,ge){if(v(N,Y,ge))return C=Y,!1}),C}function cr(p,v,m,C){for(var N=p.length,Y=m+(C?1:-1);C?Y--:++Y<N;)if(v(p[Y],Y,p))return Y;return-1}function dn(p,v,m){return v===v?Hc(p,v,m):cr(p,ca,m)}function Mc(p,v,m,C){for(var N=m-1,Y=p.length;++N<Y;)if(C(p[N],v))return N;return-1}function ca(p){return p!==p}function la(p,v){var m=p==null?0:p.length;return m?Ei(p,v)/m:un}function Ai(p){return function(v){return v==null?i:v[p]}}function bi(p){return function(v){return p==null?i:p[v]}}function fa(p,v,m,C,N){return N(p,function(Y,ge,te){m=C?(C=!1,Y):v(m,Y,ge,te)}),m}function Nc(p,v){var m=p.length;for(p.sort(v);m--;)p[m]=p[m].value;return p}function Ei(p,v){for(var m,C=-1,N=p.length;++C<N;){var Y=v(p[C]);Y!==i&&(m=m===i?Y:m+Y)}return m}function Ci(p,v){for(var m=-1,C=Array(p);++m<p;)C[m]=v(m);return C}function Uc(p,v){return oe(v,function(m){return[m,p[m]]})}function ha(p){return p&&p.slice(0,ma(p)+1).replace(hi,"")}function We(p){return function(v){return p(v)}}function Ti(p,v){return oe(v,function(m){return p[m]})}function Mn(p,v){return p.has(v)}function pa(p,v){for(var m=-1,C=p.length;++m<C&&dn(v,p[m],0)>-1;);return m}function da(p,v){for(var m=p.length;m--&&dn(v,p[m],0)>-1;);return m}function Wc(p,v){for(var m=p.length,C=0;m--;)p[m]===v&&++C;return C}var Dc=bi(xc),$c=bi(Sc);function Bc(p){return"\\"+bc[p]}function kc(p,v){return p==null?i:p[v]}function gn(p){return vc.test(p)}function jc(p){return _c.test(p)}function qc(p){for(var v,m=[];!(v=p.next()).done;)m.push(v.value);return m}function Fi(p){var v=-1,m=Array(p.size);return p.forEach(function(C,N){m[++v]=[N,C]}),m}function ga(p,v){return function(m){return p(v(m))}}function Nt(p,v){for(var m=-1,C=p.length,N=0,Y=[];++m<C;){var ge=p[m];(ge===v||ge===J)&&(p[m]=J,Y[N++]=m)}return Y}function lr(p){var v=-1,m=Array(p.size);return p.forEach(function(C){m[++v]=C}),m}function Gc(p){var v=-1,m=Array(p.size);return p.forEach(function(C){m[++v]=[C,C]}),m}function Hc(p,v,m){for(var C=m-1,N=p.length;++C<N;)if(p[C]===v)return C;return-1}function Kc(p,v,m){for(var C=m+1;C--;)if(p[C]===v)return C;return C}function mn(p){return gn(p)?Jc(p):Pc(p)}function nt(p){return gn(p)?Yc(p):Oc(p)}function ma(p){for(var v=p.length;v--&&Wu.test(p.charAt(v)););return v}var zc=bi(Ac);function Jc(p){for(var v=vi.lastIndex=0;vi.test(p);)++v;return v}function Yc(p){return p.match(vi)||[]}function Zc(p){return p.match(mc)||[]}var Xc=function p(v){v=v==null?we:vn.defaults(we.Object(),v,vn.pick(we,wc));var m=v.Array,C=v.Date,N=v.Error,Y=v.Function,ge=v.Math,te=v.Object,Ii=v.RegExp,Qc=v.String,Je=v.TypeError,fr=m.prototype,Vc=Y.prototype,_n=te.prototype,hr=v["__core-js_shared__"],pr=Vc.toString,Q=_n.hasOwnProperty,el=0,va=function(){var e=/[^.]+$/.exec(hr&&hr.keys&&hr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),dr=_n.toString,tl=pr.call(te),nl=we._,rl=Ii("^"+pr.call(Q).replace(fi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gr=ea?v.Buffer:i,Ut=v.Symbol,mr=v.Uint8Array,_a=gr?gr.allocUnsafe:i,vr=ga(te.getPrototypeOf,te),wa=te.create,ya=_n.propertyIsEnumerable,_r=fr.splice,xa=Ut?Ut.isConcatSpreadable:i,Nn=Ut?Ut.iterator:i,Vt=Ut?Ut.toStringTag:i,wr=function(){try{var e=sn(te,"defineProperty");return e({},"",{}),e}catch{}}(),il=v.clearTimeout!==we.clearTimeout&&v.clearTimeout,sl=C&&C.now!==we.Date.now&&C.now,al=v.setTimeout!==we.setTimeout&&v.setTimeout,yr=ge.ceil,xr=ge.floor,Ri=te.getOwnPropertySymbols,ol=gr?gr.isBuffer:i,Sa=v.isFinite,ul=fr.join,cl=ga(te.keys,te),me=ge.max,xe=ge.min,ll=C.now,fl=v.parseInt,Aa=ge.random,hl=fr.reverse,Pi=sn(v,"DataView"),Un=sn(v,"Map"),Oi=sn(v,"Promise"),wn=sn(v,"Set"),Wn=sn(v,"WeakMap"),Dn=sn(te,"create"),Sr=Wn&&new Wn,yn={},pl=an(Pi),dl=an(Un),gl=an(Oi),ml=an(wn),vl=an(Wn),Ar=Ut?Ut.prototype:i,$n=Ar?Ar.valueOf:i,ba=Ar?Ar.toString:i;function o(e){if(le(e)&&!U(e)&&!(e instanceof q)){if(e instanceof Ye)return e;if(Q.call(e,"__wrapped__"))return Co(e)}return new Ye(e)}var xn=function(){function e(){}return function(t){if(!ce(t))return{};if(wa)return wa(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function br(){}function Ye(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}o.templateSettings={escape:Pu,evaluate:Ou,interpolate:Ls,variable:"",imports:{_:o}},o.prototype=br.prototype,o.prototype.constructor=o,Ye.prototype=xn(br.prototype),Ye.prototype.constructor=Ye;function q(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=He,this.__views__=[]}function _l(){var e=new q(this.__wrapped__);return e.__actions__=Fe(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Fe(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Fe(this.__views__),e}function wl(){if(this.__filtered__){var e=new q(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function yl(){var e=this.__wrapped__.value(),t=this.__dir__,n=U(e),r=t<0,s=n?e.length:0,u=Lf(0,s,this.__views__),l=u.start,h=u.end,d=h-l,w=r?h:l-1,y=this.__iteratees__,x=y.length,E=0,T=xe(d,this.__takeCount__);if(!n||!r&&s==d&&T==d)return Ja(e,this.__actions__);var L=[];e:for(;d--&&E<T;){w+=t;for(var $=-1,M=e[w];++$<x;){var j=y[$],H=j.iteratee,Be=j.type,Ce=H(M);if(Be==er)M=Ce;else if(!Ce){if(Be==Vn)continue e;break e}}L[E++]=M}return L}q.prototype=xn(br.prototype),q.prototype.constructor=q;function en(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function xl(){this.__data__=Dn?Dn(null):{},this.size=0}function Sl(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Al(e){var t=this.__data__;if(Dn){var n=t[e];return n===I?i:n}return Q.call(t,e)?t[e]:i}function bl(e){var t=this.__data__;return Dn?t[e]!==i:Q.call(t,e)}function El(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Dn&&t===i?I:t,this}en.prototype.clear=xl,en.prototype.delete=Sl,en.prototype.get=Al,en.prototype.has=bl,en.prototype.set=El;function pt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Cl(){this.__data__=[],this.size=0}function Tl(e){var t=this.__data__,n=Er(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():_r.call(t,n,1),--this.size,!0}function Fl(e){var t=this.__data__,n=Er(t,e);return n<0?i:t[n][1]}function Il(e){return Er(this.__data__,e)>-1}function Rl(e,t){var n=this.__data__,r=Er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}pt.prototype.clear=Cl,pt.prototype.delete=Tl,pt.prototype.get=Fl,pt.prototype.has=Il,pt.prototype.set=Rl;function dt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pl(){this.size=0,this.__data__={hash:new en,map:new(Un||pt),string:new en}}function Ol(e){var t=Wr(this,e).delete(e);return this.size-=t?1:0,t}function Ll(e){return Wr(this,e).get(e)}function Ml(e){return Wr(this,e).has(e)}function Nl(e,t){var n=Wr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}dt.prototype.clear=Pl,dt.prototype.delete=Ol,dt.prototype.get=Ll,dt.prototype.has=Ml,dt.prototype.set=Nl;function tn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new dt;++t<n;)this.add(e[t])}function Ul(e){return this.__data__.set(e,I),this}function Wl(e){return this.__data__.has(e)}tn.prototype.add=tn.prototype.push=Ul,tn.prototype.has=Wl;function rt(e){var t=this.__data__=new pt(e);this.size=t.size}function Dl(){this.__data__=new pt,this.size=0}function $l(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Bl(e){return this.__data__.get(e)}function kl(e){return this.__data__.has(e)}function jl(e,t){var n=this.__data__;if(n instanceof pt){var r=n.__data__;if(!Un||r.length<g-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new dt(r)}return n.set(e,t),this.size=n.size,this}rt.prototype.clear=Dl,rt.prototype.delete=$l,rt.prototype.get=Bl,rt.prototype.has=kl,rt.prototype.set=jl;function Ea(e,t){var n=U(e),r=!n&&on(e),s=!n&&!r&&kt(e),u=!n&&!r&&!s&&En(e),l=n||r||s||u,h=l?Ci(e.length,Qc):[],d=h.length;for(var w in e)(t||Q.call(e,w))&&!(l&&(w=="length"||s&&(w=="offset"||w=="parent")||u&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||_t(w,d)))&&h.push(w);return h}function Ca(e){var t=e.length;return t?e[qi(0,t-1)]:i}function ql(e,t){return Dr(Fe(e),nn(t,0,e.length))}function Gl(e){return Dr(Fe(e))}function Li(e,t,n){(n!==i&&!it(e[t],n)||n===i&&!(t in e))&&gt(e,t,n)}function Bn(e,t,n){var r=e[t];(!(Q.call(e,t)&&it(r,n))||n===i&&!(t in e))&&gt(e,t,n)}function Er(e,t){for(var n=e.length;n--;)if(it(e[n][0],t))return n;return-1}function Hl(e,t,n,r){return Wt(e,function(s,u,l){t(r,s,n(s),l)}),r}function Ta(e,t){return e&&ct(t,_e(t),e)}function Kl(e,t){return e&&ct(t,Re(t),e)}function gt(e,t,n){t=="__proto__"&&wr?wr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Mi(e,t){for(var n=-1,r=t.length,s=m(r),u=e==null;++n<r;)s[n]=u?i:ds(e,t[n]);return s}function nn(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function Ze(e,t,n,r,s,u){var l,h=t&G,d=t&K,w=t&k;if(n&&(l=s?n(e,r,s,u):n(e)),l!==i)return l;if(!ce(e))return e;var y=U(e);if(y){if(l=Nf(e),!h)return Fe(e,l)}else{var x=Se(e),E=x==fn||x==nr;if(kt(e))return Xa(e,h);if(x==tt||x==It||E&&!s){if(l=d||E?{}:vo(e),!h)return d?bf(e,Kl(l,e)):Af(e,Ta(l,e))}else{if(!re[x])return s?e:{};l=Uf(e,x,h)}}u||(u=new rt);var T=u.get(e);if(T)return T;u.set(e,l),Ko(e)?e.forEach(function(M){l.add(Ze(M,t,n,M,e,u))}):Go(e)&&e.forEach(function(M,j){l.set(j,Ze(M,t,n,j,e,u))});var L=w?d?es:Vi:d?Re:_e,$=y?i:L(e);return ze($||e,function(M,j){$&&(j=M,M=e[j]),Bn(l,j,Ze(M,t,n,j,e,u))}),l}function zl(e){var t=_e(e);return function(n){return Fa(n,e,t)}}function Fa(e,t,n){var r=n.length;if(e==null)return!r;for(e=te(e);r--;){var s=n[r],u=t[s],l=e[s];if(l===i&&!(s in e)||!u(l))return!1}return!0}function Ia(e,t,n){if(typeof e!="function")throw new Je(S);return zn(function(){e.apply(i,n)},t)}function kn(e,t,n,r){var s=-1,u=ur,l=!0,h=e.length,d=[],w=t.length;if(!h)return d;n&&(t=oe(t,We(n))),r?(u=yi,l=!1):t.length>=g&&(u=Mn,l=!1,t=new tn(t));e:for(;++s<h;){var y=e[s],x=n==null?y:n(y);if(y=r||y!==0?y:0,l&&x===x){for(var E=w;E--;)if(t[E]===x)continue e;d.push(y)}else u(t,x,r)||d.push(y)}return d}var Wt=no(ut),Ra=no(Ui,!0);function Jl(e,t){var n=!0;return Wt(e,function(r,s,u){return n=!!t(r,s,u),n}),n}function Cr(e,t,n){for(var r=-1,s=e.length;++r<s;){var u=e[r],l=t(u);if(l!=null&&(h===i?l===l&&!$e(l):n(l,h)))var h=l,d=u}return d}function Yl(e,t,n,r){var s=e.length;for(n=D(n),n<0&&(n=-n>s?0:s+n),r=r===i||r>s?s:D(r),r<0&&(r+=s),r=n>r?0:Jo(r);n<r;)e[n++]=t;return e}function Pa(e,t){var n=[];return Wt(e,function(r,s,u){t(r,s,u)&&n.push(r)}),n}function ye(e,t,n,r,s){var u=-1,l=e.length;for(n||(n=Df),s||(s=[]);++u<l;){var h=e[u];t>0&&n(h)?t>1?ye(h,t-1,n,r,s):Mt(s,h):r||(s[s.length]=h)}return s}var Ni=ro(),Oa=ro(!0);function ut(e,t){return e&&Ni(e,t,_e)}function Ui(e,t){return e&&Oa(e,t,_e)}function Tr(e,t){return Lt(t,function(n){return wt(e[n])})}function rn(e,t){t=$t(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[lt(t[n++])];return n&&n==r?e:i}function La(e,t,n){var r=t(e);return U(e)?r:Mt(r,n(e))}function be(e){return e==null?e===i?ai:si:Vt&&Vt in te(e)?Of(e):Hf(e)}function Wi(e,t){return e>t}function Zl(e,t){return e!=null&&Q.call(e,t)}function Xl(e,t){return e!=null&&t in te(e)}function Ql(e,t,n){return e>=xe(t,n)&&e<me(t,n)}function Di(e,t,n){for(var r=n?yi:ur,s=e[0].length,u=e.length,l=u,h=m(u),d=1/0,w=[];l--;){var y=e[l];l&&t&&(y=oe(y,We(t))),d=xe(y.length,d),h[l]=!n&&(t||s>=120&&y.length>=120)?new tn(l&&y):i}y=e[0];var x=-1,E=h[0];e:for(;++x<s&&w.length<d;){var T=y[x],L=t?t(T):T;if(T=n||T!==0?T:0,!(E?Mn(E,L):r(w,L,n))){for(l=u;--l;){var $=h[l];if(!($?Mn($,L):r(e[l],L,n)))continue e}E&&E.push(L),w.push(T)}}return w}function Vl(e,t,n,r){return ut(e,function(s,u,l){t(r,n(s),u,l)}),r}function jn(e,t,n){t=$t(t,e),e=xo(e,t);var r=e==null?e:e[lt(Qe(t))];return r==null?i:Ue(r,e,n)}function Ma(e){return le(e)&&be(e)==It}function ef(e){return le(e)&&be(e)==Zt}function tf(e){return le(e)&&be(e)==zt}function qn(e,t,n,r,s){return e===t?!0:e==null||t==null||!le(e)&&!le(t)?e!==e&&t!==t:nf(e,t,n,r,qn,s)}function nf(e,t,n,r,s,u){var l=U(e),h=U(t),d=l?cn:Se(e),w=h?cn:Se(t);d=d==It?tt:d,w=w==It?tt:w;var y=d==tt,x=w==tt,E=d==w;if(E&&kt(e)){if(!kt(t))return!1;l=!0,y=!1}if(E&&!y)return u||(u=new rt),l||En(e)?po(e,t,n,r,s,u):Rf(e,t,d,n,r,s,u);if(!(n&ue)){var T=y&&Q.call(e,"__wrapped__"),L=x&&Q.call(t,"__wrapped__");if(T||L){var $=T?e.value():e,M=L?t.value():t;return u||(u=new rt),s($,M,n,r,u)}}return E?(u||(u=new rt),Pf(e,t,n,r,s,u)):!1}function rf(e){return le(e)&&Se(e)==Me}function $i(e,t,n,r){var s=n.length,u=s,l=!r;if(e==null)return!u;for(e=te(e);s--;){var h=n[s];if(l&&h[2]?h[1]!==e[h[0]]:!(h[0]in e))return!1}for(;++s<u;){h=n[s];var d=h[0],w=e[d],y=h[1];if(l&&h[2]){if(w===i&&!(d in e))return!1}else{var x=new rt;if(r)var E=r(w,y,d,e,t,x);if(!(E===i?qn(y,w,ue|Oe,r,x):E))return!1}}return!0}function Na(e){if(!ce(e)||Bf(e))return!1;var t=wt(e)?rl:zu;return t.test(an(e))}function sf(e){return le(e)&&be(e)==Rt}function af(e){return le(e)&&Se(e)==Ne}function of(e){return le(e)&&Gr(e.length)&&!!ae[be(e)]}function Ua(e){return typeof e=="function"?e:e==null?Pe:typeof e=="object"?U(e)?$a(e[0],e[1]):Da(e):su(e)}function Bi(e){if(!Kn(e))return cl(e);var t=[];for(var n in te(e))Q.call(e,n)&&n!="constructor"&&t.push(n);return t}function uf(e){if(!ce(e))return Gf(e);var t=Kn(e),n=[];for(var r in e)r=="constructor"&&(t||!Q.call(e,r))||n.push(r);return n}function ki(e,t){return e<t}function Wa(e,t){var n=-1,r=Ie(e)?m(e.length):[];return Wt(e,function(s,u,l){r[++n]=t(s,u,l)}),r}function Da(e){var t=ns(e);return t.length==1&&t[0][2]?wo(t[0][0],t[0][1]):function(n){return n===e||$i(n,e,t)}}function $a(e,t){return is(e)&&_o(t)?wo(lt(e),t):function(n){var r=ds(n,e);return r===i&&r===t?gs(n,e):qn(t,r,ue|Oe)}}function Fr(e,t,n,r,s){e!==t&&Ni(t,function(u,l){if(s||(s=new rt),ce(u))cf(e,t,l,n,Fr,r,s);else{var h=r?r(as(e,l),u,l+"",e,t,s):i;h===i&&(h=u),Li(e,l,h)}},Re)}function cf(e,t,n,r,s,u,l){var h=as(e,n),d=as(t,n),w=l.get(d);if(w){Li(e,n,w);return}var y=u?u(h,d,n+"",e,t,l):i,x=y===i;if(x){var E=U(d),T=!E&&kt(d),L=!E&&!T&&En(d);y=d,E||T||L?U(h)?y=h:fe(h)?y=Fe(h):T?(x=!1,y=Xa(d,!0)):L?(x=!1,y=Qa(d,!0)):y=[]:Jn(d)||on(d)?(y=h,on(h)?y=Yo(h):(!ce(h)||wt(h))&&(y=vo(d))):x=!1}x&&(l.set(d,y),s(y,d,r,u,l),l.delete(d)),Li(e,n,y)}function Ba(e,t){var n=e.length;if(n)return t+=t<0?n:0,_t(t,n)?e[t]:i}function ka(e,t,n){t.length?t=oe(t,function(u){return U(u)?function(l){return rn(l,u.length===1?u[0]:u)}:u}):t=[Pe];var r=-1;t=oe(t,We(R()));var s=Wa(e,function(u,l,h){var d=oe(t,function(w){return w(u)});return{criteria:d,index:++r,value:u}});return Nc(s,function(u,l){return Sf(u,l,n)})}function lf(e,t){return ja(e,t,function(n,r){return gs(e,r)})}function ja(e,t,n){for(var r=-1,s=t.length,u={};++r<s;){var l=t[r],h=rn(e,l);n(h,l)&&Gn(u,$t(l,e),h)}return u}function ff(e){return function(t){return rn(t,e)}}function ji(e,t,n,r){var s=r?Mc:dn,u=-1,l=t.length,h=e;for(e===t&&(t=Fe(t)),n&&(h=oe(e,We(n)));++u<l;)for(var d=0,w=t[u],y=n?n(w):w;(d=s(h,y,d,r))>-1;)h!==e&&_r.call(h,d,1),_r.call(e,d,1);return e}function qa(e,t){for(var n=e?t.length:0,r=n-1;n--;){var s=t[n];if(n==r||s!==u){var u=s;_t(s)?_r.call(e,s,1):Ki(e,s)}}return e}function qi(e,t){return e+xr(Aa()*(t-e+1))}function hf(e,t,n,r){for(var s=-1,u=me(yr((t-e)/(n||1)),0),l=m(u);u--;)l[r?u:++s]=e,e+=n;return l}function Gi(e,t){var n="";if(!e||t<1||t>et)return n;do t%2&&(n+=e),t=xr(t/2),t&&(e+=e);while(t);return n}function B(e,t){return os(yo(e,t,Pe),e+"")}function pf(e){return Ca(Cn(e))}function df(e,t){var n=Cn(e);return Dr(n,nn(t,0,n.length))}function Gn(e,t,n,r){if(!ce(e))return e;t=$t(t,e);for(var s=-1,u=t.length,l=u-1,h=e;h!=null&&++s<u;){var d=lt(t[s]),w=n;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(s!=l){var y=h[d];w=r?r(y,d,h):i,w===i&&(w=ce(y)?y:_t(t[s+1])?[]:{})}Bn(h,d,w),h=h[d]}return e}var Ga=Sr?function(e,t){return Sr.set(e,t),e}:Pe,gf=wr?function(e,t){return wr(e,"toString",{configurable:!0,enumerable:!1,value:vs(t),writable:!0})}:Pe;function mf(e){return Dr(Cn(e))}function Xe(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var u=m(s);++r<s;)u[r]=e[r+t];return u}function vf(e,t){var n;return Wt(e,function(r,s,u){return n=t(r,s,u),!n}),!!n}function Ir(e,t,n){var r=0,s=e==null?r:e.length;if(typeof t=="number"&&t===t&&s<=ti){for(;r<s;){var u=r+s>>>1,l=e[u];l!==null&&!$e(l)&&(n?l<=t:l<t)?r=u+1:s=u}return s}return Hi(e,t,Pe,n)}function Hi(e,t,n,r){var s=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var l=t!==t,h=t===null,d=$e(t),w=t===i;s<u;){var y=xr((s+u)/2),x=n(e[y]),E=x!==i,T=x===null,L=x===x,$=$e(x);if(l)var M=r||L;else w?M=L&&(r||E):h?M=L&&E&&(r||!T):d?M=L&&E&&!T&&(r||!$):T||$?M=!1:M=r?x<=t:x<t;M?s=y+1:u=y}return xe(u,ei)}function Ha(e,t){for(var n=-1,r=e.length,s=0,u=[];++n<r;){var l=e[n],h=t?t(l):l;if(!n||!it(h,d)){var d=h;u[s++]=l===0?0:l}}return u}function Ka(e){return typeof e=="number"?e:$e(e)?un:+e}function De(e){if(typeof e=="string")return e;if(U(e))return oe(e,De)+"";if($e(e))return ba?ba.call(e):"";var t=e+"";return t=="0"&&1/e==-at?"-0":t}function Dt(e,t,n){var r=-1,s=ur,u=e.length,l=!0,h=[],d=h;if(n)l=!1,s=yi;else if(u>=g){var w=t?null:Ff(e);if(w)return lr(w);l=!1,s=Mn,d=new tn}else d=t?[]:h;e:for(;++r<u;){var y=e[r],x=t?t(y):y;if(y=n||y!==0?y:0,l&&x===x){for(var E=d.length;E--;)if(d[E]===x)continue e;t&&d.push(x),h.push(y)}else s(d,x,n)||(d!==h&&d.push(x),h.push(y))}return h}function Ki(e,t){return t=$t(t,e),e=xo(e,t),e==null||delete e[lt(Qe(t))]}function za(e,t,n,r){return Gn(e,t,n(rn(e,t)),r)}function Rr(e,t,n,r){for(var s=e.length,u=r?s:-1;(r?u--:++u<s)&&t(e[u],u,e););return n?Xe(e,r?0:u,r?u+1:s):Xe(e,r?u+1:0,r?s:u)}function Ja(e,t){var n=e;return n instanceof q&&(n=n.value()),xi(t,function(r,s){return s.func.apply(s.thisArg,Mt([r],s.args))},n)}function zi(e,t,n){var r=e.length;if(r<2)return r?Dt(e[0]):[];for(var s=-1,u=m(r);++s<r;)for(var l=e[s],h=-1;++h<r;)h!=s&&(u[s]=kn(u[s]||l,e[h],t,n));return Dt(ye(u,1),t,n)}function Ya(e,t,n){for(var r=-1,s=e.length,u=t.length,l={};++r<s;){var h=r<u?t[r]:i;n(l,e[r],h)}return l}function Ji(e){return fe(e)?e:[]}function Yi(e){return typeof e=="function"?e:Pe}function $t(e,t){return U(e)?e:is(e,t)?[e]:Eo(X(e))}var _f=B;function Bt(e,t,n){var r=e.length;return n=n===i?r:n,!t&&n>=r?e:Xe(e,t,n)}var Za=il||function(e){return we.clearTimeout(e)};function Xa(e,t){if(t)return e.slice();var n=e.length,r=_a?_a(n):new e.constructor(n);return e.copy(r),r}function Zi(e){var t=new e.constructor(e.byteLength);return new mr(t).set(new mr(e)),t}function wf(e,t){var n=t?Zi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function yf(e){var t=new e.constructor(e.source,Ms.exec(e));return t.lastIndex=e.lastIndex,t}function xf(e){return $n?te($n.call(e)):{}}function Qa(e,t){var n=t?Zi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Va(e,t){if(e!==t){var n=e!==i,r=e===null,s=e===e,u=$e(e),l=t!==i,h=t===null,d=t===t,w=$e(t);if(!h&&!w&&!u&&e>t||u&&l&&d&&!h&&!w||r&&l&&d||!n&&d||!s)return 1;if(!r&&!u&&!w&&e<t||w&&n&&s&&!r&&!u||h&&n&&s||!l&&s||!d)return-1}return 0}function Sf(e,t,n){for(var r=-1,s=e.criteria,u=t.criteria,l=s.length,h=n.length;++r<l;){var d=Va(s[r],u[r]);if(d){if(r>=h)return d;var w=n[r];return d*(w=="desc"?-1:1)}}return e.index-t.index}function eo(e,t,n,r){for(var s=-1,u=e.length,l=n.length,h=-1,d=t.length,w=me(u-l,0),y=m(d+w),x=!r;++h<d;)y[h]=t[h];for(;++s<l;)(x||s<u)&&(y[n[s]]=e[s]);for(;w--;)y[h++]=e[s++];return y}function to(e,t,n,r){for(var s=-1,u=e.length,l=-1,h=n.length,d=-1,w=t.length,y=me(u-h,0),x=m(y+w),E=!r;++s<y;)x[s]=e[s];for(var T=s;++d<w;)x[T+d]=t[d];for(;++l<h;)(E||s<u)&&(x[T+n[l]]=e[s++]);return x}function Fe(e,t){var n=-1,r=e.length;for(t||(t=m(r));++n<r;)t[n]=e[n];return t}function ct(e,t,n,r){var s=!n;n||(n={});for(var u=-1,l=t.length;++u<l;){var h=t[u],d=r?r(n[h],e[h],h,n,e):i;d===i&&(d=e[h]),s?gt(n,h,d):Bn(n,h,d)}return n}function Af(e,t){return ct(e,rs(e),t)}function bf(e,t){return ct(e,go(e),t)}function Pr(e,t){return function(n,r){var s=U(n)?Fc:Hl,u=t?t():{};return s(n,e,R(r,2),u)}}function Sn(e){return B(function(t,n){var r=-1,s=n.length,u=s>1?n[s-1]:i,l=s>2?n[2]:i;for(u=e.length>3&&typeof u=="function"?(s--,u):i,l&&Ee(n[0],n[1],l)&&(u=s<3?i:u,s=1),t=te(t);++r<s;){var h=n[r];h&&e(t,h,r,u)}return t})}function no(e,t){return function(n,r){if(n==null)return n;if(!Ie(n))return e(n,r);for(var s=n.length,u=t?s:-1,l=te(n);(t?u--:++u<s)&&r(l[u],u,l)!==!1;);return n}}function ro(e){return function(t,n,r){for(var s=-1,u=te(t),l=r(t),h=l.length;h--;){var d=l[e?h:++s];if(n(u[d],d,u)===!1)break}return t}}function Ef(e,t,n){var r=t&pe,s=Hn(e);function u(){var l=this&&this!==we&&this instanceof u?s:e;return l.apply(r?n:this,arguments)}return u}function io(e){return function(t){t=X(t);var n=gn(t)?nt(t):i,r=n?n[0]:t.charAt(0),s=n?Bt(n,1).join(""):t.slice(1);return r[e]()+s}}function An(e){return function(t){return xi(ru(nu(t).replace(dc,"")),e,"")}}function Hn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=xn(e.prototype),r=e.apply(n,t);return ce(r)?r:n}}function Cf(e,t,n){var r=Hn(e);function s(){for(var u=arguments.length,l=m(u),h=u,d=bn(s);h--;)l[h]=arguments[h];var w=u<3&&l[0]!==d&&l[u-1]!==d?[]:Nt(l,d);if(u-=w.length,u<n)return co(e,t,Or,s.placeholder,i,l,w,i,i,n-u);var y=this&&this!==we&&this instanceof s?r:e;return Ue(y,this,l)}return s}function so(e){return function(t,n,r){var s=te(t);if(!Ie(t)){var u=R(n,3);t=_e(t),n=function(h){return u(s[h],h,s)}}var l=e(t,n,r);return l>-1?s[u?t[l]:l]:i}}function ao(e){return vt(function(t){var n=t.length,r=n,s=Ye.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if(typeof u!="function")throw new Je(S);if(s&&!l&&Ur(u)=="wrapper")var l=new Ye([],!0)}for(r=l?r:n;++r<n;){u=t[r];var h=Ur(u),d=h=="wrapper"?ts(u):i;d&&ss(d[0])&&d[1]==(se|Te|Z|qe)&&!d[4].length&&d[9]==1?l=l[Ur(d[0])].apply(l,d[3]):l=u.length==1&&ss(u)?l[h]():l.thru(u)}return function(){var w=arguments,y=w[0];if(l&&w.length==1&&U(y))return l.plant(y).value();for(var x=0,E=n?t[x].apply(this,w):y;++x<n;)E=t[x].call(this,E);return E}})}function Or(e,t,n,r,s,u,l,h,d,w){var y=t&se,x=t&pe,E=t&Le,T=t&(Te|F),L=t&ne,$=E?i:Hn(e);function M(){for(var j=arguments.length,H=m(j),Be=j;Be--;)H[Be]=arguments[Be];if(T)var Ce=bn(M),ke=Wc(H,Ce);if(r&&(H=eo(H,r,s,T)),u&&(H=to(H,u,l,T)),j-=ke,T&&j<w){var he=Nt(H,Ce);return co(e,t,Or,M.placeholder,n,H,he,h,d,w-j)}var st=x?n:this,xt=E?st[e]:e;return j=H.length,h?H=Kf(H,h):L&&j>1&&H.reverse(),y&&d<j&&(H.length=d),this&&this!==we&&this instanceof M&&(xt=$||Hn(xt)),xt.apply(st,H)}return M}function oo(e,t){return function(n,r){return Vl(n,e,t(r),{})}}function Lr(e,t){return function(n,r){var s;if(n===i&&r===i)return t;if(n!==i&&(s=n),r!==i){if(s===i)return r;typeof n=="string"||typeof r=="string"?(n=De(n),r=De(r)):(n=Ka(n),r=Ka(r)),s=e(n,r)}return s}}function Xi(e){return vt(function(t){return t=oe(t,We(R())),B(function(n){var r=this;return e(t,function(s){return Ue(s,r,n)})})})}function Mr(e,t){t=t===i?" ":De(t);var n=t.length;if(n<2)return n?Gi(t,e):t;var r=Gi(t,yr(e/mn(t)));return gn(t)?Bt(nt(r),0,e).join(""):r.slice(0,e)}function Tf(e,t,n,r){var s=t&pe,u=Hn(e);function l(){for(var h=-1,d=arguments.length,w=-1,y=r.length,x=m(y+d),E=this&&this!==we&&this instanceof l?u:e;++w<y;)x[w]=r[w];for(;d--;)x[w++]=arguments[++h];return Ue(E,s?n:this,x)}return l}function uo(e){return function(t,n,r){return r&&typeof r!="number"&&Ee(t,n,r)&&(n=r=i),t=yt(t),n===i?(n=t,t=0):n=yt(n),r=r===i?t<n?1:-1:yt(r),hf(t,n,r,e)}}function Nr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ve(t),n=Ve(n)),e(t,n)}}function co(e,t,n,r,s,u,l,h,d,w){var y=t&Te,x=y?l:i,E=y?i:l,T=y?u:i,L=y?i:u;t|=y?Z:z,t&=~(y?z:Z),t&Tt||(t&=-4);var $=[e,t,s,T,x,L,E,h,d,w],M=n.apply(i,$);return ss(e)&&So(M,$),M.placeholder=r,Ao(M,e,t)}function Qi(e){var t=ge[e];return function(n,r){if(n=Ve(n),r=r==null?0:xe(D(r),292),r&&Sa(n)){var s=(X(n)+"e").split("e"),u=t(s[0]+"e"+(+s[1]+r));return s=(X(u)+"e").split("e"),+(s[0]+"e"+(+s[1]-r))}return t(n)}}var Ff=wn&&1/lr(new wn([,-0]))[1]==at?function(e){return new wn(e)}:ys;function lo(e){return function(t){var n=Se(t);return n==Me?Fi(t):n==Ne?Gc(t):Uc(t,e(t))}}function mt(e,t,n,r,s,u,l,h){var d=t&Le;if(!d&&typeof e!="function")throw new Je(S);var w=r?r.length:0;if(w||(t&=-97,r=s=i),l=l===i?l:me(D(l),0),h=h===i?h:D(h),w-=s?s.length:0,t&z){var y=r,x=s;r=s=i}var E=d?i:ts(e),T=[e,t,n,r,s,y,x,u,l,h];if(E&&qf(T,E),e=T[0],t=T[1],n=T[2],r=T[3],s=T[4],h=T[9]=T[9]===i?d?0:e.length:me(T[9]-w,0),!h&&t&(Te|F)&&(t&=-25),!t||t==pe)var L=Ef(e,t,n);else t==Te||t==F?L=Cf(e,t,h):(t==Z||t==(pe|Z))&&!s.length?L=Tf(e,t,n,r):L=Or.apply(i,T);var $=E?Ga:So;return Ao($(L,T),e,t)}function fo(e,t,n,r){return e===i||it(e,_n[n])&&!Q.call(r,n)?t:e}function ho(e,t,n,r,s,u){return ce(e)&&ce(t)&&(u.set(t,e),Fr(e,t,i,ho,u),u.delete(t)),e}function If(e){return Jn(e)?i:e}function po(e,t,n,r,s,u){var l=n&ue,h=e.length,d=t.length;if(h!=d&&!(l&&d>h))return!1;var w=u.get(e),y=u.get(t);if(w&&y)return w==t&&y==e;var x=-1,E=!0,T=n&Oe?new tn:i;for(u.set(e,t),u.set(t,e);++x<h;){var L=e[x],$=t[x];if(r)var M=l?r($,L,x,t,e,u):r(L,$,x,e,t,u);if(M!==i){if(M)continue;E=!1;break}if(T){if(!Si(t,function(j,H){if(!Mn(T,H)&&(L===j||s(L,j,n,r,u)))return T.push(H)})){E=!1;break}}else if(!(L===$||s(L,$,n,r,u))){E=!1;break}}return u.delete(e),u.delete(t),E}function Rf(e,t,n,r,s,u,l){switch(n){case Ot:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Zt:return!(e.byteLength!=t.byteLength||!u(new mr(e),new mr(t)));case Kt:case zt:case Jt:return it(+e,+t);case ln:return e.name==t.name&&e.message==t.message;case Rt:case Yt:return e==t+"";case Me:var h=Fi;case Ne:var d=r&ue;if(h||(h=lr),e.size!=t.size&&!d)return!1;var w=l.get(e);if(w)return w==t;r|=Oe,l.set(e,t);var y=po(h(e),h(t),r,s,u,l);return l.delete(e),y;case hn:if($n)return $n.call(e)==$n.call(t)}return!1}function Pf(e,t,n,r,s,u){var l=n&ue,h=Vi(e),d=h.length,w=Vi(t),y=w.length;if(d!=y&&!l)return!1;for(var x=d;x--;){var E=h[x];if(!(l?E in t:Q.call(t,E)))return!1}var T=u.get(e),L=u.get(t);if(T&&L)return T==t&&L==e;var $=!0;u.set(e,t),u.set(t,e);for(var M=l;++x<d;){E=h[x];var j=e[E],H=t[E];if(r)var Be=l?r(H,j,E,t,e,u):r(j,H,E,e,t,u);if(!(Be===i?j===H||s(j,H,n,r,u):Be)){$=!1;break}M||(M=E=="constructor")}if($&&!M){var Ce=e.constructor,ke=t.constructor;Ce!=ke&&"constructor"in e&&"constructor"in t&&!(typeof Ce=="function"&&Ce instanceof Ce&&typeof ke=="function"&&ke instanceof ke)&&($=!1)}return u.delete(e),u.delete(t),$}function vt(e){return os(yo(e,i,Io),e+"")}function Vi(e){return La(e,_e,rs)}function es(e){return La(e,Re,go)}var ts=Sr?function(e){return Sr.get(e)}:ys;function Ur(e){for(var t=e.name+"",n=yn[t],r=Q.call(yn,t)?n.length:0;r--;){var s=n[r],u=s.func;if(u==null||u==e)return s.name}return t}function bn(e){var t=Q.call(o,"placeholder")?o:e;return t.placeholder}function R(){var e=o.iteratee||_s;return e=e===_s?Ua:e,arguments.length?e(arguments[0],arguments[1]):e}function Wr(e,t){var n=e.__data__;return $f(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ns(e){for(var t=_e(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,_o(s)]}return t}function sn(e,t){var n=kc(e,t);return Na(n)?n:i}function Of(e){var t=Q.call(e,Vt),n=e[Vt];try{e[Vt]=i;var r=!0}catch{}var s=dr.call(e);return r&&(t?e[Vt]=n:delete e[Vt]),s}var rs=Ri?function(e){return e==null?[]:(e=te(e),Lt(Ri(e),function(t){return ya.call(e,t)}))}:xs,go=Ri?function(e){for(var t=[];e;)Mt(t,rs(e)),e=vr(e);return t}:xs,Se=be;(Pi&&Se(new Pi(new ArrayBuffer(1)))!=Ot||Un&&Se(new Un)!=Me||Oi&&Se(Oi.resolve())!=On||wn&&Se(new wn)!=Ne||Wn&&Se(new Wn)!=Pt)&&(Se=function(e){var t=be(e),n=t==tt?e.constructor:i,r=n?an(n):"";if(r)switch(r){case pl:return Ot;case dl:return Me;case gl:return On;case ml:return Ne;case vl:return Pt}return t});function Lf(e,t,n){for(var r=-1,s=n.length;++r<s;){var u=n[r],l=u.size;switch(u.type){case"drop":e+=l;break;case"dropRight":t-=l;break;case"take":t=xe(t,e+l);break;case"takeRight":e=me(e,t-l);break}}return{start:e,end:t}}function Mf(e){var t=e.match($u);return t?t[1].split(Bu):[]}function mo(e,t,n){t=$t(t,e);for(var r=-1,s=t.length,u=!1;++r<s;){var l=lt(t[r]);if(!(u=e!=null&&n(e,l)))break;e=e[l]}return u||++r!=s?u:(s=e==null?0:e.length,!!s&&Gr(s)&&_t(l,s)&&(U(e)||on(e)))}function Nf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function vo(e){return typeof e.constructor=="function"&&!Kn(e)?xn(vr(e)):{}}function Uf(e,t,n){var r=e.constructor;switch(t){case Zt:return Zi(e);case Kt:case zt:return new r(+e);case Ot:return wf(e,n);case O:case de:case ot:case ir:case Xt:case Ln:case ui:case ci:case li:return Qa(e,n);case Me:return new r;case Jt:case Yt:return new r(e);case Rt:return yf(e);case Ne:return new r;case hn:return xf(e)}}function Wf(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Du,`{
430
+ */var Uy=Hn.exports,ul;function Dy(){return ul||(ul=1,function(o,s){(function(){var r,l="4.17.21",p=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",v="Expected a function",E="Invalid `variable` option passed into `_.template`",b="__lodash_hash_undefined__",M=500,H="__lodash_placeholder__",X=1,N=2,V=4,ie=1,lt=2,Fe=1,dt=2,vn=4,$e=8,bt=16,Me=32,Ct=64,Be=128,Pt=256,yn=512,ws=30,xs="...",le=800,Jn=16,Pe=1,zn=2,Ss=3,B=1/0,de=9007199254740991,ht=17976931348623157e292,Re=NaN,ve=4294967295,_n=ve-1,Ol=ve>>>1,Ll=[["ary",Be],["bind",Fe],["bindKey",dt],["curry",$e],["curryRight",bt],["flip",yn],["partial",Me],["partialRight",Ct],["rearg",Pt]],Xt="[object Arguments]",Kn="[object Array]",kl="[object AsyncFunction]",wn="[object Boolean]",xn="[object Date]",Nl="[object DOMException]",Vn="[object Error]",Yn="[object Function]",As="[object GeneratorFunction]",et="[object Map]",Sn="[object Number]",Ul="[object Null]",gt="[object Object]",Is="[object Promise]",Dl="[object Proxy]",An="[object RegExp]",tt="[object Set]",In="[object String]",Xn="[object Symbol]",Wl="[object Undefined]",Fn="[object WeakMap]",$l="[object WeakSet]",En="[object ArrayBuffer]",Zt="[object DataView]",Jr="[object Float32Array]",zr="[object Float64Array]",Kr="[object Int8Array]",Vr="[object Int16Array]",Yr="[object Int32Array]",Xr="[object Uint8Array]",Zr="[object Uint8ClampedArray]",Qr="[object Uint16Array]",ei="[object Uint32Array]",Ml=/\b__p \+= '';/g,Bl=/\b(__p \+=) '' \+/g,jl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fs=/&(?:amp|lt|gt|quot|#39);/g,Es=/[&<>"']/g,ql=RegExp(Fs.source),Hl=RegExp(Es.source),Gl=/<%-([\s\S]+?)%>/g,Jl=/<%([\s\S]+?)%>/g,Ts=/<%=([\s\S]+?)%>/g,zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kl=/^\w*$/,Vl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ti=/[\\^$.*+?()[\]{}|]/g,Yl=RegExp(ti.source),ni=/^\s+/,Xl=/\s/,Zl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ql=/\{\n\/\* \[wrapped with (.+)\] \*/,eu=/,? & /,tu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,nu=/[()=,{}\[\]\/\s]/,ru=/\\(\\)?/g,iu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bs=/\w*$/,su=/^[-+]0x[0-9a-f]+$/i,au=/^0b[01]+$/i,ou=/^\[object .+?Constructor\]$/,lu=/^0o[0-7]+$/i,uu=/^(?:0|[1-9]\d*)$/,cu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zn=/($^)/,fu=/['\n\r\u2028\u2029\\]/g,Qn="\\ud800-\\udfff",pu="\\u0300-\\u036f",du="\\ufe20-\\ufe2f",hu="\\u20d0-\\u20ff",Cs=pu+du+hu,Ps="\\u2700-\\u27bf",Rs="a-z\\xdf-\\xf6\\xf8-\\xff",gu="\\xac\\xb1\\xd7\\xf7",mu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vu="\\u2000-\\u206f",yu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Os="A-Z\\xc0-\\xd6\\xd8-\\xde",Ls="\\ufe0e\\ufe0f",ks=gu+mu+vu+yu,ri="['’]",_u="["+Qn+"]",Ns="["+ks+"]",er="["+Cs+"]",Us="\\d+",wu="["+Ps+"]",Ds="["+Rs+"]",Ws="[^"+Qn+ks+Us+Ps+Rs+Os+"]",ii="\\ud83c[\\udffb-\\udfff]",xu="(?:"+er+"|"+ii+")",$s="[^"+Qn+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",ai="[\\ud800-\\udbff][\\udc00-\\udfff]",Qt="["+Os+"]",Ms="\\u200d",Bs="(?:"+Ds+"|"+Ws+")",Su="(?:"+Qt+"|"+Ws+")",js="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",qs="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",Hs=xu+"?",Gs="["+Ls+"]?",Au="(?:"+Ms+"(?:"+[$s,si,ai].join("|")+")"+Gs+Hs+")*",Iu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Js=Gs+Hs+Au,Eu="(?:"+[wu,si,ai].join("|")+")"+Js,Tu="(?:"+[$s+er+"?",er,si,ai,_u].join("|")+")",bu=RegExp(ri,"g"),Cu=RegExp(er,"g"),oi=RegExp(ii+"(?="+ii+")|"+Tu+Js,"g"),Pu=RegExp([Qt+"?"+Ds+"+"+js+"(?="+[Ns,Qt,"$"].join("|")+")",Su+"+"+qs+"(?="+[Ns,Qt+Bs,"$"].join("|")+")",Qt+"?"+Bs+"+"+js,Qt+"+"+qs,Fu,Iu,Us,Eu].join("|"),"g"),Ru=RegExp("["+Ms+Qn+Cs+Ls+"]"),Ou=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ku=-1,re={};re[Jr]=re[zr]=re[Kr]=re[Vr]=re[Yr]=re[Xr]=re[Zr]=re[Qr]=re[ei]=!0,re[Xt]=re[Kn]=re[En]=re[wn]=re[Zt]=re[xn]=re[Vn]=re[Yn]=re[et]=re[Sn]=re[gt]=re[An]=re[tt]=re[In]=re[Fn]=!1;var ne={};ne[Xt]=ne[Kn]=ne[En]=ne[Zt]=ne[wn]=ne[xn]=ne[Jr]=ne[zr]=ne[Kr]=ne[Vr]=ne[Yr]=ne[et]=ne[Sn]=ne[gt]=ne[An]=ne[tt]=ne[In]=ne[Xn]=ne[Xr]=ne[Zr]=ne[Qr]=ne[ei]=!0,ne[Vn]=ne[Yn]=ne[Fn]=!1;var Nu={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Uu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Du={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Wu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$u=parseFloat,Mu=parseInt,zs=typeof Mr=="object"&&Mr&&Mr.Object===Object&&Mr,Bu=typeof self=="object"&&self&&self.Object===Object&&self,ge=zs||Bu||Function("return this")(),li=s&&!s.nodeType&&s,jt=li&&!0&&o&&!o.nodeType&&o,Ks=jt&&jt.exports===li,ui=Ks&&zs.process,je=function(){try{var h=jt&&jt.require&&jt.require("util").types;return h||ui&&ui.binding&&ui.binding("util")}catch{}}(),Vs=je&&je.isArrayBuffer,Ys=je&&je.isDate,Xs=je&&je.isMap,Zs=je&&je.isRegExp,Qs=je&&je.isSet,ea=je&&je.isTypedArray;function Oe(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function ju(h,_,y,F){for(var U=-1,Z=h==null?0:h.length;++U<Z;){var fe=h[U];_(F,fe,y(fe),h)}return F}function qe(h,_){for(var y=-1,F=h==null?0:h.length;++y<F&&_(h[y],y,h)!==!1;);return h}function qu(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function ta(h,_){for(var y=-1,F=h==null?0:h.length;++y<F;)if(!_(h[y],y,h))return!1;return!0}function Rt(h,_){for(var y=-1,F=h==null?0:h.length,U=0,Z=[];++y<F;){var fe=h[y];_(fe,y,h)&&(Z[U++]=fe)}return Z}function tr(h,_){var y=h==null?0:h.length;return!!y&&en(h,_,0)>-1}function ci(h,_,y){for(var F=-1,U=h==null?0:h.length;++F<U;)if(y(_,h[F]))return!0;return!1}function se(h,_){for(var y=-1,F=h==null?0:h.length,U=Array(F);++y<F;)U[y]=_(h[y],y,h);return U}function Ot(h,_){for(var y=-1,F=_.length,U=h.length;++y<F;)h[U+y]=_[y];return h}function fi(h,_,y,F){var U=-1,Z=h==null?0:h.length;for(F&&Z&&(y=h[++U]);++U<Z;)y=_(y,h[U],U,h);return y}function Hu(h,_,y,F){var U=h==null?0:h.length;for(F&&U&&(y=h[--U]);U--;)y=_(y,h[U],U,h);return y}function pi(h,_){for(var y=-1,F=h==null?0:h.length;++y<F;)if(_(h[y],y,h))return!0;return!1}var Gu=di("length");function Ju(h){return h.split("")}function zu(h){return h.match(tu)||[]}function na(h,_,y){var F;return y(h,function(U,Z,fe){if(_(U,Z,fe))return F=Z,!1}),F}function nr(h,_,y,F){for(var U=h.length,Z=y+(F?1:-1);F?Z--:++Z<U;)if(_(h[Z],Z,h))return Z;return-1}function en(h,_,y){return _===_?sc(h,_,y):nr(h,ra,y)}function Ku(h,_,y,F){for(var U=y-1,Z=h.length;++U<Z;)if(F(h[U],_))return U;return-1}function ra(h){return h!==h}function ia(h,_){var y=h==null?0:h.length;return y?gi(h,_)/y:Re}function di(h){return function(_){return _==null?r:_[h]}}function hi(h){return function(_){return h==null?r:h[_]}}function sa(h,_,y,F,U){return U(h,function(Z,fe,te){y=F?(F=!1,Z):_(y,Z,fe,te)}),y}function Vu(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function gi(h,_){for(var y,F=-1,U=h.length;++F<U;){var Z=_(h[F]);Z!==r&&(y=y===r?Z:y+Z)}return y}function mi(h,_){for(var y=-1,F=Array(h);++y<h;)F[y]=_(y);return F}function Yu(h,_){return se(_,function(y){return[y,h[y]]})}function aa(h){return h&&h.slice(0,ca(h)+1).replace(ni,"")}function Le(h){return function(_){return h(_)}}function vi(h,_){return se(_,function(y){return h[y]})}function Tn(h,_){return h.has(_)}function oa(h,_){for(var y=-1,F=h.length;++y<F&&en(_,h[y],0)>-1;);return y}function la(h,_){for(var y=h.length;y--&&en(_,h[y],0)>-1;);return y}function Xu(h,_){for(var y=h.length,F=0;y--;)h[y]===_&&++F;return F}var Zu=hi(Nu),Qu=hi(Uu);function ec(h){return"\\"+Wu[h]}function tc(h,_){return h==null?r:h[_]}function tn(h){return Ru.test(h)}function nc(h){return Ou.test(h)}function rc(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function yi(h){var _=-1,y=Array(h.size);return h.forEach(function(F,U){y[++_]=[U,F]}),y}function ua(h,_){return function(y){return h(_(y))}}function Lt(h,_){for(var y=-1,F=h.length,U=0,Z=[];++y<F;){var fe=h[y];(fe===_||fe===H)&&(h[y]=H,Z[U++]=y)}return Z}function rr(h){var _=-1,y=Array(h.size);return h.forEach(function(F){y[++_]=F}),y}function ic(h){var _=-1,y=Array(h.size);return h.forEach(function(F){y[++_]=[F,F]}),y}function sc(h,_,y){for(var F=y-1,U=h.length;++F<U;)if(h[F]===_)return F;return-1}function ac(h,_,y){for(var F=y+1;F--;)if(h[F]===_)return F;return F}function nn(h){return tn(h)?lc(h):Gu(h)}function nt(h){return tn(h)?uc(h):Ju(h)}function ca(h){for(var _=h.length;_--&&Xl.test(h.charAt(_)););return _}var oc=hi(Du);function lc(h){for(var _=oi.lastIndex=0;oi.test(h);)++_;return _}function uc(h){return h.match(oi)||[]}function cc(h){return h.match(Pu)||[]}var fc=function h(_){_=_==null?ge:rn.defaults(ge.Object(),_,rn.pick(ge,Lu));var y=_.Array,F=_.Date,U=_.Error,Z=_.Function,fe=_.Math,te=_.Object,_i=_.RegExp,pc=_.String,He=_.TypeError,ir=y.prototype,dc=Z.prototype,sn=te.prototype,sr=_["__core-js_shared__"],ar=dc.toString,ee=sn.hasOwnProperty,hc=0,fa=function(){var e=/[^.]+$/.exec(sr&&sr.keys&&sr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),or=sn.toString,gc=ar.call(te),mc=ge._,vc=_i("^"+ar.call(ee).replace(ti,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lr=Ks?_.Buffer:r,kt=_.Symbol,ur=_.Uint8Array,pa=lr?lr.allocUnsafe:r,cr=ua(te.getPrototypeOf,te),da=te.create,ha=sn.propertyIsEnumerable,fr=ir.splice,ga=kt?kt.isConcatSpreadable:r,bn=kt?kt.iterator:r,qt=kt?kt.toStringTag:r,pr=function(){try{var e=Kt(te,"defineProperty");return e({},"",{}),e}catch{}}(),yc=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,_c=F&&F.now!==ge.Date.now&&F.now,wc=_.setTimeout!==ge.setTimeout&&_.setTimeout,dr=fe.ceil,hr=fe.floor,wi=te.getOwnPropertySymbols,xc=lr?lr.isBuffer:r,ma=_.isFinite,Sc=ir.join,Ac=ua(te.keys,te),pe=fe.max,ye=fe.min,Ic=F.now,Fc=_.parseInt,va=fe.random,Ec=ir.reverse,xi=Kt(_,"DataView"),Cn=Kt(_,"Map"),Si=Kt(_,"Promise"),an=Kt(_,"Set"),Pn=Kt(_,"WeakMap"),Rn=Kt(te,"create"),gr=Pn&&new Pn,on={},Tc=Vt(xi),bc=Vt(Cn),Cc=Vt(Si),Pc=Vt(an),Rc=Vt(Pn),mr=kt?kt.prototype:r,On=mr?mr.valueOf:r,ya=mr?mr.toString:r;function u(e){if(oe(e)&&!D(e)&&!(e instanceof J)){if(e instanceof Ge)return e;if(ee.call(e,"__wrapped__"))return wo(e)}return new Ge(e)}var ln=function(){function e(){}return function(t){if(!ae(t))return{};if(da)return da(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function Ge(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}u.templateSettings={escape:Gl,evaluate:Jl,interpolate:Ts,variable:"",imports:{_:u}},u.prototype=vr.prototype,u.prototype.constructor=u,Ge.prototype=ln(vr.prototype),Ge.prototype.constructor=Ge;function J(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ve,this.__views__=[]}function Oc(){var e=new J(this.__wrapped__);return e.__actions__=Ee(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ee(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ee(this.__views__),e}function Lc(){if(this.__filtered__){var e=new J(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function kc(){var e=this.__wrapped__.value(),t=this.__dir__,n=D(e),i=t<0,a=n?e.length:0,c=zf(0,a,this.__views__),f=c.start,d=c.end,g=d-f,w=i?d:f-1,x=this.__iteratees__,S=x.length,I=0,T=ye(g,this.__takeCount__);if(!n||!i&&a==g&&T==g)return ja(e,this.__actions__);var R=[];e:for(;g--&&I<T;){w+=t;for(var j=-1,O=e[w];++j<S;){var G=x[j],z=G.iteratee,Ue=G.type,Ae=z(O);if(Ue==zn)O=Ae;else if(!Ae){if(Ue==Pe)continue e;break e}}R[I++]=O}return R}J.prototype=ln(vr.prototype),J.prototype.constructor=J;function Ht(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Nc(){this.__data__=Rn?Rn(null):{},this.size=0}function Uc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Dc(e){var t=this.__data__;if(Rn){var n=t[e];return n===b?r:n}return ee.call(t,e)?t[e]:r}function Wc(e){var t=this.__data__;return Rn?t[e]!==r:ee.call(t,e)}function $c(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===r?b:t,this}Ht.prototype.clear=Nc,Ht.prototype.delete=Uc,Ht.prototype.get=Dc,Ht.prototype.has=Wc,Ht.prototype.set=$c;function mt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Mc(){this.__data__=[],this.size=0}function Bc(e){var t=this.__data__,n=yr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():fr.call(t,n,1),--this.size,!0}function jc(e){var t=this.__data__,n=yr(t,e);return n<0?r:t[n][1]}function qc(e){return yr(this.__data__,e)>-1}function Hc(e,t){var n=this.__data__,i=yr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}mt.prototype.clear=Mc,mt.prototype.delete=Bc,mt.prototype.get=jc,mt.prototype.has=qc,mt.prototype.set=Hc;function vt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Gc(){this.size=0,this.__data__={hash:new Ht,map:new(Cn||mt),string:new Ht}}function Jc(e){var t=Pr(this,e).delete(e);return this.size-=t?1:0,t}function zc(e){return Pr(this,e).get(e)}function Kc(e){return Pr(this,e).has(e)}function Vc(e,t){var n=Pr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}vt.prototype.clear=Gc,vt.prototype.delete=Jc,vt.prototype.get=zc,vt.prototype.has=Kc,vt.prototype.set=Vc;function Gt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new vt;++t<n;)this.add(e[t])}function Yc(e){return this.__data__.set(e,b),this}function Xc(e){return this.__data__.has(e)}Gt.prototype.add=Gt.prototype.push=Yc,Gt.prototype.has=Xc;function rt(e){var t=this.__data__=new mt(e);this.size=t.size}function Zc(){this.__data__=new mt,this.size=0}function Qc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ef(e){return this.__data__.get(e)}function tf(e){return this.__data__.has(e)}function nf(e,t){var n=this.__data__;if(n instanceof mt){var i=n.__data__;if(!Cn||i.length<p-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new vt(i)}return n.set(e,t),this.size=n.size,this}rt.prototype.clear=Zc,rt.prototype.delete=Qc,rt.prototype.get=ef,rt.prototype.has=tf,rt.prototype.set=nf;function _a(e,t){var n=D(e),i=!n&&Yt(e),a=!n&&!i&&$t(e),c=!n&&!i&&!a&&pn(e),f=n||i||a||c,d=f?mi(e.length,pc):[],g=d.length;for(var w in e)(t||ee.call(e,w))&&!(f&&(w=="length"||a&&(w=="offset"||w=="parent")||c&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||xt(w,g)))&&d.push(w);return d}function wa(e){var t=e.length;return t?e[Li(0,t-1)]:r}function rf(e,t){return Rr(Ee(e),Jt(t,0,e.length))}function sf(e){return Rr(Ee(e))}function Ai(e,t,n){(n!==r&&!it(e[t],n)||n===r&&!(t in e))&&yt(e,t,n)}function Ln(e,t,n){var i=e[t];(!(ee.call(e,t)&&it(i,n))||n===r&&!(t in e))&&yt(e,t,n)}function yr(e,t){for(var n=e.length;n--;)if(it(e[n][0],t))return n;return-1}function af(e,t,n,i){return Nt(e,function(a,c,f){t(i,a,n(a),f)}),i}function xa(e,t){return e&&ct(t,he(t),e)}function of(e,t){return e&&ct(t,be(t),e)}function yt(e,t,n){t=="__proto__"&&pr?pr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ii(e,t){for(var n=-1,i=t.length,a=y(i),c=e==null;++n<i;)a[n]=c?r:is(e,t[n]);return a}function Jt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Je(e,t,n,i,a,c){var f,d=t&X,g=t&N,w=t&V;if(n&&(f=a?n(e,i,a,c):n(e)),f!==r)return f;if(!ae(e))return e;var x=D(e);if(x){if(f=Vf(e),!d)return Ee(e,f)}else{var S=_e(e),I=S==Yn||S==As;if($t(e))return Ga(e,d);if(S==gt||S==Xt||I&&!a){if(f=g||I?{}:co(e),!d)return g?Wf(e,of(f,e)):Df(e,xa(f,e))}else{if(!ne[S])return a?e:{};f=Yf(e,S,d)}}c||(c=new rt);var T=c.get(e);if(T)return T;c.set(e,f),Mo(e)?e.forEach(function(O){f.add(Je(O,t,n,O,e,c))}):Wo(e)&&e.forEach(function(O,G){f.set(G,Je(O,t,n,G,e,c))});var R=w?g?Hi:qi:g?be:he,j=x?r:R(e);return qe(j||e,function(O,G){j&&(G=O,O=e[G]),Ln(f,G,Je(O,t,n,G,e,c))}),f}function lf(e){var t=he(e);return function(n){return Sa(n,e,t)}}function Sa(e,t,n){var i=n.length;if(e==null)return!i;for(e=te(e);i--;){var a=n[i],c=t[a],f=e[a];if(f===r&&!(a in e)||!c(f))return!1}return!0}function Aa(e,t,n){if(typeof e!="function")throw new He(v);return Mn(function(){e.apply(r,n)},t)}function kn(e,t,n,i){var a=-1,c=tr,f=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,Le(n))),i?(c=ci,f=!1):t.length>=p&&(c=Tn,f=!1,t=new Gt(t));e:for(;++a<d;){var x=e[a],S=n==null?x:n(x);if(x=i||x!==0?x:0,f&&S===S){for(var I=w;I--;)if(t[I]===S)continue e;g.push(x)}else c(t,S,i)||g.push(x)}return g}var Nt=Ya(ut),Ia=Ya(Ei,!0);function uf(e,t){var n=!0;return Nt(e,function(i,a,c){return n=!!t(i,a,c),n}),n}function _r(e,t,n){for(var i=-1,a=e.length;++i<a;){var c=e[i],f=t(c);if(f!=null&&(d===r?f===f&&!Ne(f):n(f,d)))var d=f,g=c}return g}function cf(e,t,n,i){var a=e.length;for(n=W(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:W(i),i<0&&(i+=a),i=n>i?0:jo(i);n<i;)e[n++]=t;return e}function Fa(e,t){var n=[];return Nt(e,function(i,a,c){t(i,a,c)&&n.push(i)}),n}function me(e,t,n,i,a){var c=-1,f=e.length;for(n||(n=Zf),a||(a=[]);++c<f;){var d=e[c];t>0&&n(d)?t>1?me(d,t-1,n,i,a):Ot(a,d):i||(a[a.length]=d)}return a}var Fi=Xa(),Ea=Xa(!0);function ut(e,t){return e&&Fi(e,t,he)}function Ei(e,t){return e&&Ea(e,t,he)}function wr(e,t){return Rt(t,function(n){return St(e[n])})}function zt(e,t){t=Dt(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[ft(t[n++])];return n&&n==i?e:r}function Ta(e,t,n){var i=t(e);return D(e)?i:Ot(i,n(e))}function xe(e){return e==null?e===r?Wl:Ul:qt&&qt in te(e)?Jf(e):sp(e)}function Ti(e,t){return e>t}function ff(e,t){return e!=null&&ee.call(e,t)}function pf(e,t){return e!=null&&t in te(e)}function df(e,t,n){return e>=ye(t,n)&&e<pe(t,n)}function bi(e,t,n){for(var i=n?ci:tr,a=e[0].length,c=e.length,f=c,d=y(c),g=1/0,w=[];f--;){var x=e[f];f&&t&&(x=se(x,Le(t))),g=ye(x.length,g),d[f]=!n&&(t||a>=120&&x.length>=120)?new Gt(f&&x):r}x=e[0];var S=-1,I=d[0];e:for(;++S<a&&w.length<g;){var T=x[S],R=t?t(T):T;if(T=n||T!==0?T:0,!(I?Tn(I,R):i(w,R,n))){for(f=c;--f;){var j=d[f];if(!(j?Tn(j,R):i(e[f],R,n)))continue e}I&&I.push(R),w.push(T)}}return w}function hf(e,t,n,i){return ut(e,function(a,c,f){t(i,n(a),c,f)}),i}function Nn(e,t,n){t=Dt(t,e),e=go(e,t);var i=e==null?e:e[ft(Ke(t))];return i==null?r:Oe(i,e,n)}function ba(e){return oe(e)&&xe(e)==Xt}function gf(e){return oe(e)&&xe(e)==En}function mf(e){return oe(e)&&xe(e)==xn}function Un(e,t,n,i,a){return e===t?!0:e==null||t==null||!oe(e)&&!oe(t)?e!==e&&t!==t:vf(e,t,n,i,Un,a)}function vf(e,t,n,i,a,c){var f=D(e),d=D(t),g=f?Kn:_e(e),w=d?Kn:_e(t);g=g==Xt?gt:g,w=w==Xt?gt:w;var x=g==gt,S=w==gt,I=g==w;if(I&&$t(e)){if(!$t(t))return!1;f=!0,x=!1}if(I&&!x)return c||(c=new rt),f||pn(e)?oo(e,t,n,i,a,c):Hf(e,t,g,n,i,a,c);if(!(n&ie)){var T=x&&ee.call(e,"__wrapped__"),R=S&&ee.call(t,"__wrapped__");if(T||R){var j=T?e.value():e,O=R?t.value():t;return c||(c=new rt),a(j,O,n,i,c)}}return I?(c||(c=new rt),Gf(e,t,n,i,a,c)):!1}function yf(e){return oe(e)&&_e(e)==et}function Ci(e,t,n,i){var a=n.length,c=a,f=!i;if(e==null)return!c;for(e=te(e);a--;){var d=n[a];if(f&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++a<c;){d=n[a];var g=d[0],w=e[g],x=d[1];if(f&&d[2]){if(w===r&&!(g in e))return!1}else{var S=new rt;if(i)var I=i(w,x,g,e,t,S);if(!(I===r?Un(x,w,ie|lt,i,S):I))return!1}}return!0}function Ca(e){if(!ae(e)||ep(e))return!1;var t=St(e)?vc:ou;return t.test(Vt(e))}function _f(e){return oe(e)&&xe(e)==An}function wf(e){return oe(e)&&_e(e)==tt}function xf(e){return oe(e)&&Dr(e.length)&&!!re[xe(e)]}function Pa(e){return typeof e=="function"?e:e==null?Ce:typeof e=="object"?D(e)?La(e[0],e[1]):Oa(e):Qo(e)}function Pi(e){if(!$n(e))return Ac(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function Sf(e){if(!ae(e))return ip(e);var t=$n(e),n=[];for(var i in e)i=="constructor"&&(t||!ee.call(e,i))||n.push(i);return n}function Ri(e,t){return e<t}function Ra(e,t){var n=-1,i=Te(e)?y(e.length):[];return Nt(e,function(a,c,f){i[++n]=t(a,c,f)}),i}function Oa(e){var t=Ji(e);return t.length==1&&t[0][2]?po(t[0][0],t[0][1]):function(n){return n===e||Ci(n,e,t)}}function La(e,t){return Ki(e)&&fo(t)?po(ft(e),t):function(n){var i=is(n,e);return i===r&&i===t?ss(n,e):Un(t,i,ie|lt)}}function xr(e,t,n,i,a){e!==t&&Fi(t,function(c,f){if(a||(a=new rt),ae(c))Af(e,t,f,n,xr,i,a);else{var d=i?i(Yi(e,f),c,f+"",e,t,a):r;d===r&&(d=c),Ai(e,f,d)}},be)}function Af(e,t,n,i,a,c,f){var d=Yi(e,n),g=Yi(t,n),w=f.get(g);if(w){Ai(e,n,w);return}var x=c?c(d,g,n+"",e,t,f):r,S=x===r;if(S){var I=D(g),T=!I&&$t(g),R=!I&&!T&&pn(g);x=g,I||T||R?D(d)?x=d:ue(d)?x=Ee(d):T?(S=!1,x=Ga(g,!0)):R?(S=!1,x=Ja(g,!0)):x=[]:Bn(g)||Yt(g)?(x=d,Yt(d)?x=qo(d):(!ae(d)||St(d))&&(x=co(g))):S=!1}S&&(f.set(g,x),a(x,g,i,c,f),f.delete(g)),Ai(e,n,x)}function ka(e,t){var n=e.length;if(n)return t+=t<0?n:0,xt(t,n)?e[t]:r}function Na(e,t,n){t.length?t=se(t,function(c){return D(c)?function(f){return zt(f,c.length===1?c[0]:c)}:c}):t=[Ce];var i=-1;t=se(t,Le(C()));var a=Ra(e,function(c,f,d){var g=se(t,function(w){return w(c)});return{criteria:g,index:++i,value:c}});return Vu(a,function(c,f){return Uf(c,f,n)})}function If(e,t){return Ua(e,t,function(n,i){return ss(e,i)})}function Ua(e,t,n){for(var i=-1,a=t.length,c={};++i<a;){var f=t[i],d=zt(e,f);n(d,f)&&Dn(c,Dt(f,e),d)}return c}function Ff(e){return function(t){return zt(t,e)}}function Oi(e,t,n,i){var a=i?Ku:en,c=-1,f=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,Le(n)));++c<f;)for(var g=0,w=t[c],x=n?n(w):w;(g=a(d,x,g,i))>-1;)d!==e&&fr.call(d,g,1),fr.call(e,g,1);return e}function Da(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==c){var c=a;xt(a)?fr.call(e,a,1):Ui(e,a)}}return e}function Li(e,t){return e+hr(va()*(t-e+1))}function Ef(e,t,n,i){for(var a=-1,c=pe(dr((t-e)/(n||1)),0),f=y(c);c--;)f[i?c:++a]=e,e+=n;return f}function ki(e,t){var n="";if(!e||t<1||t>de)return n;do t%2&&(n+=e),t=hr(t/2),t&&(e+=e);while(t);return n}function q(e,t){return Xi(ho(e,t,Ce),e+"")}function Tf(e){return wa(dn(e))}function bf(e,t){var n=dn(e);return Rr(n,Jt(t,0,n.length))}function Dn(e,t,n,i){if(!ae(e))return e;t=Dt(t,e);for(var a=-1,c=t.length,f=c-1,d=e;d!=null&&++a<c;){var g=ft(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=f){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:xt(t[a+1])?[]:{})}Ln(d,g,w),d=d[g]}return e}var Wa=gr?function(e,t){return gr.set(e,t),e}:Ce,Cf=pr?function(e,t){return pr(e,"toString",{configurable:!0,enumerable:!1,value:os(t),writable:!0})}:Ce;function Pf(e){return Rr(dn(e))}function ze(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var c=y(a);++i<a;)c[i]=e[i+t];return c}function Rf(e,t){var n;return Nt(e,function(i,a,c){return n=t(i,a,c),!n}),!!n}function Sr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=Ol){for(;i<a;){var c=i+a>>>1,f=e[c];f!==null&&!Ne(f)&&(n?f<=t:f<t)?i=c+1:a=c}return a}return Ni(e,t,Ce,n)}function Ni(e,t,n,i){var a=0,c=e==null?0:e.length;if(c===0)return 0;t=n(t);for(var f=t!==t,d=t===null,g=Ne(t),w=t===r;a<c;){var x=hr((a+c)/2),S=n(e[x]),I=S!==r,T=S===null,R=S===S,j=Ne(S);if(f)var O=i||R;else w?O=R&&(i||I):d?O=R&&I&&(i||!T):g?O=R&&I&&!T&&(i||!j):T||j?O=!1:O=i?S<=t:S<t;O?a=x+1:c=x}return ye(c,_n)}function $a(e,t){for(var n=-1,i=e.length,a=0,c=[];++n<i;){var f=e[n],d=t?t(f):f;if(!n||!it(d,g)){var g=d;c[a++]=f===0?0:f}}return c}function Ma(e){return typeof e=="number"?e:Ne(e)?Re:+e}function ke(e){if(typeof e=="string")return e;if(D(e))return se(e,ke)+"";if(Ne(e))return ya?ya.call(e):"";var t=e+"";return t=="0"&&1/e==-B?"-0":t}function Ut(e,t,n){var i=-1,a=tr,c=e.length,f=!0,d=[],g=d;if(n)f=!1,a=ci;else if(c>=p){var w=t?null:jf(e);if(w)return rr(w);f=!1,a=Tn,g=new Gt}else g=t?[]:d;e:for(;++i<c;){var x=e[i],S=t?t(x):x;if(x=n||x!==0?x:0,f&&S===S){for(var I=g.length;I--;)if(g[I]===S)continue e;t&&g.push(S),d.push(x)}else a(g,S,n)||(g!==d&&g.push(S),d.push(x))}return d}function Ui(e,t){return t=Dt(t,e),e=go(e,t),e==null||delete e[ft(Ke(t))]}function Ba(e,t,n,i){return Dn(e,t,n(zt(e,t)),i)}function Ar(e,t,n,i){for(var a=e.length,c=i?a:-1;(i?c--:++c<a)&&t(e[c],c,e););return n?ze(e,i?0:c,i?c+1:a):ze(e,i?c+1:0,i?a:c)}function ja(e,t){var n=e;return n instanceof J&&(n=n.value()),fi(t,function(i,a){return a.func.apply(a.thisArg,Ot([i],a.args))},n)}function Di(e,t,n){var i=e.length;if(i<2)return i?Ut(e[0]):[];for(var a=-1,c=y(i);++a<i;)for(var f=e[a],d=-1;++d<i;)d!=a&&(c[a]=kn(c[a]||f,e[d],t,n));return Ut(me(c,1),t,n)}function qa(e,t,n){for(var i=-1,a=e.length,c=t.length,f={};++i<a;){var d=i<c?t[i]:r;n(f,e[i],d)}return f}function Wi(e){return ue(e)?e:[]}function $i(e){return typeof e=="function"?e:Ce}function Dt(e,t){return D(e)?e:Ki(e,t)?[e]:_o(Q(e))}var Of=q;function Wt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ze(e,t,n)}var Ha=yc||function(e){return ge.clearTimeout(e)};function Ga(e,t){if(t)return e.slice();var n=e.length,i=pa?pa(n):new e.constructor(n);return e.copy(i),i}function Mi(e){var t=new e.constructor(e.byteLength);return new ur(t).set(new ur(e)),t}function Lf(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function kf(e){var t=new e.constructor(e.source,bs.exec(e));return t.lastIndex=e.lastIndex,t}function Nf(e){return On?te(On.call(e)):{}}function Ja(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function za(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,c=Ne(e),f=t!==r,d=t===null,g=t===t,w=Ne(t);if(!d&&!w&&!c&&e>t||c&&f&&g&&!d&&!w||i&&f&&g||!n&&g||!a)return 1;if(!i&&!c&&!w&&e<t||w&&n&&a&&!i&&!c||d&&n&&a||!f&&a||!g)return-1}return 0}function Uf(e,t,n){for(var i=-1,a=e.criteria,c=t.criteria,f=a.length,d=n.length;++i<f;){var g=za(a[i],c[i]);if(g){if(i>=d)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function Ka(e,t,n,i){for(var a=-1,c=e.length,f=n.length,d=-1,g=t.length,w=pe(c-f,0),x=y(g+w),S=!i;++d<g;)x[d]=t[d];for(;++a<f;)(S||a<c)&&(x[n[a]]=e[a]);for(;w--;)x[d++]=e[a++];return x}function Va(e,t,n,i){for(var a=-1,c=e.length,f=-1,d=n.length,g=-1,w=t.length,x=pe(c-d,0),S=y(x+w),I=!i;++a<x;)S[a]=e[a];for(var T=a;++g<w;)S[T+g]=t[g];for(;++f<d;)(I||a<c)&&(S[T+n[f]]=e[a++]);return S}function Ee(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function ct(e,t,n,i){var a=!n;n||(n={});for(var c=-1,f=t.length;++c<f;){var d=t[c],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?yt(n,d,g):Ln(n,d,g)}return n}function Df(e,t){return ct(e,zi(e),t)}function Wf(e,t){return ct(e,lo(e),t)}function Ir(e,t){return function(n,i){var a=D(n)?ju:af,c=t?t():{};return a(n,e,C(i,2),c)}}function un(e){return q(function(t,n){var i=-1,a=n.length,c=a>1?n[a-1]:r,f=a>2?n[2]:r;for(c=e.length>3&&typeof c=="function"?(a--,c):r,f&&Se(n[0],n[1],f)&&(c=a<3?r:c,a=1),t=te(t);++i<a;){var d=n[i];d&&e(t,d,i,c)}return t})}function Ya(e,t){return function(n,i){if(n==null)return n;if(!Te(n))return e(n,i);for(var a=n.length,c=t?a:-1,f=te(n);(t?c--:++c<a)&&i(f[c],c,f)!==!1;);return n}}function Xa(e){return function(t,n,i){for(var a=-1,c=te(t),f=i(t),d=f.length;d--;){var g=f[e?d:++a];if(n(c[g],g,c)===!1)break}return t}}function $f(e,t,n){var i=t&Fe,a=Wn(e);function c(){var f=this&&this!==ge&&this instanceof c?a:e;return f.apply(i?n:this,arguments)}return c}function Za(e){return function(t){t=Q(t);var n=tn(t)?nt(t):r,i=n?n[0]:t.charAt(0),a=n?Wt(n,1).join(""):t.slice(1);return i[e]()+a}}function cn(e){return function(t){return fi(Xo(Yo(t).replace(bu,"")),e,"")}}function Wn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=ln(e.prototype),i=e.apply(n,t);return ae(i)?i:n}}function Mf(e,t,n){var i=Wn(e);function a(){for(var c=arguments.length,f=y(c),d=c,g=fn(a);d--;)f[d]=arguments[d];var w=c<3&&f[0]!==g&&f[c-1]!==g?[]:Lt(f,g);if(c-=w.length,c<n)return ro(e,t,Fr,a.placeholder,r,f,w,r,r,n-c);var x=this&&this!==ge&&this instanceof a?i:e;return Oe(x,this,f)}return a}function Qa(e){return function(t,n,i){var a=te(t);if(!Te(t)){var c=C(n,3);t=he(t),n=function(d){return c(a[d],d,a)}}var f=e(t,n,i);return f>-1?a[c?t[f]:f]:r}}function eo(e){return wt(function(t){var n=t.length,i=n,a=Ge.prototype.thru;for(e&&t.reverse();i--;){var c=t[i];if(typeof c!="function")throw new He(v);if(a&&!f&&Cr(c)=="wrapper")var f=new Ge([],!0)}for(i=f?i:n;++i<n;){c=t[i];var d=Cr(c),g=d=="wrapper"?Gi(c):r;g&&Vi(g[0])&&g[1]==(Be|$e|Me|Pt)&&!g[4].length&&g[9]==1?f=f[Cr(g[0])].apply(f,g[3]):f=c.length==1&&Vi(c)?f[d]():f.thru(c)}return function(){var w=arguments,x=w[0];if(f&&w.length==1&&D(x))return f.plant(x).value();for(var S=0,I=n?t[S].apply(this,w):x;++S<n;)I=t[S].call(this,I);return I}})}function Fr(e,t,n,i,a,c,f,d,g,w){var x=t&Be,S=t&Fe,I=t&dt,T=t&($e|bt),R=t&yn,j=I?r:Wn(e);function O(){for(var G=arguments.length,z=y(G),Ue=G;Ue--;)z[Ue]=arguments[Ue];if(T)var Ae=fn(O),De=Xu(z,Ae);if(i&&(z=Ka(z,i,a,T)),c&&(z=Va(z,c,f,T)),G-=De,T&&G<w){var ce=Lt(z,Ae);return ro(e,t,Fr,O.placeholder,n,z,ce,d,g,w-G)}var st=S?n:this,It=I?st[e]:e;return G=z.length,d?z=ap(z,d):R&&G>1&&z.reverse(),x&&g<G&&(z.length=g),this&&this!==ge&&this instanceof O&&(It=j||Wn(It)),It.apply(st,z)}return O}function to(e,t){return function(n,i){return hf(n,e,t(i),{})}}function Er(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=ke(n),i=ke(i)):(n=Ma(n),i=Ma(i)),a=e(n,i)}return a}}function Bi(e){return wt(function(t){return t=se(t,Le(C())),q(function(n){var i=this;return e(t,function(a){return Oe(a,i,n)})})})}function Tr(e,t){t=t===r?" ":ke(t);var n=t.length;if(n<2)return n?ki(t,e):t;var i=ki(t,dr(e/nn(t)));return tn(t)?Wt(nt(i),0,e).join(""):i.slice(0,e)}function Bf(e,t,n,i){var a=t&Fe,c=Wn(e);function f(){for(var d=-1,g=arguments.length,w=-1,x=i.length,S=y(x+g),I=this&&this!==ge&&this instanceof f?c:e;++w<x;)S[w]=i[w];for(;g--;)S[w++]=arguments[++d];return Oe(I,a?n:this,S)}return f}function no(e){return function(t,n,i){return i&&typeof i!="number"&&Se(t,n,i)&&(n=i=r),t=At(t),n===r?(n=t,t=0):n=At(n),i=i===r?t<n?1:-1:At(i),Ef(t,n,i,e)}}function br(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ve(t),n=Ve(n)),e(t,n)}}function ro(e,t,n,i,a,c,f,d,g,w){var x=t&$e,S=x?f:r,I=x?r:f,T=x?c:r,R=x?r:c;t|=x?Me:Ct,t&=~(x?Ct:Me),t&vn||(t&=-4);var j=[e,t,a,T,S,R,I,d,g,w],O=n.apply(r,j);return Vi(e)&&mo(O,j),O.placeholder=i,vo(O,e,t)}function ji(e){var t=fe[e];return function(n,i){if(n=Ve(n),i=i==null?0:ye(W(i),292),i&&ma(n)){var a=(Q(n)+"e").split("e"),c=t(a[0]+"e"+(+a[1]+i));return a=(Q(c)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var jf=an&&1/rr(new an([,-0]))[1]==B?function(e){return new an(e)}:cs;function io(e){return function(t){var n=_e(t);return n==et?yi(t):n==tt?ic(t):Yu(t,e(t))}}function _t(e,t,n,i,a,c,f,d){var g=t&dt;if(!g&&typeof e!="function")throw new He(v);var w=i?i.length:0;if(w||(t&=-97,i=a=r),f=f===r?f:pe(W(f),0),d=d===r?d:W(d),w-=a?a.length:0,t&Ct){var x=i,S=a;i=a=r}var I=g?r:Gi(e),T=[e,t,n,i,a,x,S,c,f,d];if(I&&rp(T,I),e=T[0],t=T[1],n=T[2],i=T[3],a=T[4],d=T[9]=T[9]===r?g?0:e.length:pe(T[9]-w,0),!d&&t&($e|bt)&&(t&=-25),!t||t==Fe)var R=$f(e,t,n);else t==$e||t==bt?R=Mf(e,t,d):(t==Me||t==(Fe|Me))&&!a.length?R=Bf(e,t,n,i):R=Fr.apply(r,T);var j=I?Wa:mo;return vo(j(R,T),e,t)}function so(e,t,n,i){return e===r||it(e,sn[n])&&!ee.call(i,n)?t:e}function ao(e,t,n,i,a,c){return ae(e)&&ae(t)&&(c.set(t,e),xr(e,t,r,ao,c),c.delete(t)),e}function qf(e){return Bn(e)?r:e}function oo(e,t,n,i,a,c){var f=n&ie,d=e.length,g=t.length;if(d!=g&&!(f&&g>d))return!1;var w=c.get(e),x=c.get(t);if(w&&x)return w==t&&x==e;var S=-1,I=!0,T=n&lt?new Gt:r;for(c.set(e,t),c.set(t,e);++S<d;){var R=e[S],j=t[S];if(i)var O=f?i(j,R,S,t,e,c):i(R,j,S,e,t,c);if(O!==r){if(O)continue;I=!1;break}if(T){if(!pi(t,function(G,z){if(!Tn(T,z)&&(R===G||a(R,G,n,i,c)))return T.push(z)})){I=!1;break}}else if(!(R===j||a(R,j,n,i,c))){I=!1;break}}return c.delete(e),c.delete(t),I}function Hf(e,t,n,i,a,c,f){switch(n){case Zt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case En:return!(e.byteLength!=t.byteLength||!c(new ur(e),new ur(t)));case wn:case xn:case Sn:return it(+e,+t);case Vn:return e.name==t.name&&e.message==t.message;case An:case In:return e==t+"";case et:var d=yi;case tt:var g=i&ie;if(d||(d=rr),e.size!=t.size&&!g)return!1;var w=f.get(e);if(w)return w==t;i|=lt,f.set(e,t);var x=oo(d(e),d(t),i,a,c,f);return f.delete(e),x;case Xn:if(On)return On.call(e)==On.call(t)}return!1}function Gf(e,t,n,i,a,c){var f=n&ie,d=qi(e),g=d.length,w=qi(t),x=w.length;if(g!=x&&!f)return!1;for(var S=g;S--;){var I=d[S];if(!(f?I in t:ee.call(t,I)))return!1}var T=c.get(e),R=c.get(t);if(T&&R)return T==t&&R==e;var j=!0;c.set(e,t),c.set(t,e);for(var O=f;++S<g;){I=d[S];var G=e[I],z=t[I];if(i)var Ue=f?i(z,G,I,t,e,c):i(G,z,I,e,t,c);if(!(Ue===r?G===z||a(G,z,n,i,c):Ue)){j=!1;break}O||(O=I=="constructor")}if(j&&!O){var Ae=e.constructor,De=t.constructor;Ae!=De&&"constructor"in e&&"constructor"in t&&!(typeof Ae=="function"&&Ae instanceof Ae&&typeof De=="function"&&De instanceof De)&&(j=!1)}return c.delete(e),c.delete(t),j}function wt(e){return Xi(ho(e,r,Ao),e+"")}function qi(e){return Ta(e,he,zi)}function Hi(e){return Ta(e,be,lo)}var Gi=gr?function(e){return gr.get(e)}:cs;function Cr(e){for(var t=e.name+"",n=on[t],i=ee.call(on,t)?n.length:0;i--;){var a=n[i],c=a.func;if(c==null||c==e)return a.name}return t}function fn(e){var t=ee.call(u,"placeholder")?u:e;return t.placeholder}function C(){var e=u.iteratee||ls;return e=e===ls?Pa:e,arguments.length?e(arguments[0],arguments[1]):e}function Pr(e,t){var n=e.__data__;return Qf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ji(e){for(var t=he(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,fo(a)]}return t}function Kt(e,t){var n=tc(e,t);return Ca(n)?n:r}function Jf(e){var t=ee.call(e,qt),n=e[qt];try{e[qt]=r;var i=!0}catch{}var a=or.call(e);return i&&(t?e[qt]=n:delete e[qt]),a}var zi=wi?function(e){return e==null?[]:(e=te(e),Rt(wi(e),function(t){return ha.call(e,t)}))}:fs,lo=wi?function(e){for(var t=[];e;)Ot(t,zi(e)),e=cr(e);return t}:fs,_e=xe;(xi&&_e(new xi(new ArrayBuffer(1)))!=Zt||Cn&&_e(new Cn)!=et||Si&&_e(Si.resolve())!=Is||an&&_e(new an)!=tt||Pn&&_e(new Pn)!=Fn)&&(_e=function(e){var t=xe(e),n=t==gt?e.constructor:r,i=n?Vt(n):"";if(i)switch(i){case Tc:return Zt;case bc:return et;case Cc:return Is;case Pc:return tt;case Rc:return Fn}return t});function zf(e,t,n){for(var i=-1,a=n.length;++i<a;){var c=n[i],f=c.size;switch(c.type){case"drop":e+=f;break;case"dropRight":t-=f;break;case"take":t=ye(t,e+f);break;case"takeRight":e=pe(e,t-f);break}}return{start:e,end:t}}function Kf(e){var t=e.match(Ql);return t?t[1].split(eu):[]}function uo(e,t,n){t=Dt(t,e);for(var i=-1,a=t.length,c=!1;++i<a;){var f=ft(t[i]);if(!(c=e!=null&&n(e,f)))break;e=e[f]}return c||++i!=a?c:(a=e==null?0:e.length,!!a&&Dr(a)&&xt(f,a)&&(D(e)||Yt(e)))}function Vf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function co(e){return typeof e.constructor=="function"&&!$n(e)?ln(cr(e)):{}}function Yf(e,t,n){var i=e.constructor;switch(t){case En:return Mi(e);case wn:case xn:return new i(+e);case Zt:return Lf(e,n);case Jr:case zr:case Kr:case Vr:case Yr:case Xr:case Zr:case Qr:case ei:return Ja(e,n);case et:return new i;case Sn:case In:return new i(e);case An:return kf(e);case tt:return new i;case Xn:return Nf(e)}}function Xf(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(Zl,`{
210
431
  /* [wrapped with `+t+`] */
211
- `)}function Df(e){return U(e)||on(e)||!!(xa&&e&&e[xa])}function _t(e,t){var n=typeof e;return t=t??et,!!t&&(n=="number"||n!="symbol"&&Yu.test(e))&&e>-1&&e%1==0&&e<t}function Ee(e,t,n){if(!ce(n))return!1;var r=typeof t;return(r=="number"?Ie(n)&&_t(t,n.length):r=="string"&&t in n)?it(n[t],e):!1}function is(e,t){if(U(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||$e(e)?!0:Mu.test(e)||!Lu.test(e)||t!=null&&e in te(t)}function $f(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ss(e){var t=Ur(e),n=o[t];if(typeof n!="function"||!(t in q.prototype))return!1;if(e===n)return!0;var r=ts(n);return!!r&&e===r[0]}function Bf(e){return!!va&&va in e}var kf=hr?wt:Ss;function Kn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||_n;return e===n}function _o(e){return e===e&&!ce(e)}function wo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in te(n))}}function jf(e){var t=jr(e,function(r){return n.size===P&&n.clear(),r}),n=t.cache;return t}function qf(e,t){var n=e[1],r=t[1],s=n|r,u=s<(pe|Le|se),l=r==se&&n==Te||r==se&&n==qe&&e[7].length<=t[8]||r==(se|qe)&&t[7].length<=t[8]&&n==Te;if(!(u||l))return e;r&pe&&(e[2]=t[2],s|=n&pe?0:Tt);var h=t[3];if(h){var d=e[3];e[3]=d?eo(d,h,t[4]):h,e[4]=d?Nt(e[3],J):t[4]}return h=t[5],h&&(d=e[5],e[5]=d?to(d,h,t[6]):h,e[6]=d?Nt(e[5],J):t[6]),h=t[7],h&&(e[7]=h),r&se&&(e[8]=e[8]==null?t[8]:xe(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=s,e}function Gf(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function Hf(e){return dr.call(e)}function yo(e,t,n){return t=me(t===i?e.length-1:t,0),function(){for(var r=arguments,s=-1,u=me(r.length-t,0),l=m(u);++s<u;)l[s]=r[t+s];s=-1;for(var h=m(t+1);++s<t;)h[s]=r[s];return h[t]=n(l),Ue(e,this,h)}}function xo(e,t){return t.length<2?e:rn(e,Xe(t,0,-1))}function Kf(e,t){for(var n=e.length,r=xe(t.length,n),s=Fe(e);r--;){var u=t[r];e[r]=_t(u,n)?s[u]:i}return e}function as(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var So=bo(Ga),zn=al||function(e,t){return we.setTimeout(e,t)},os=bo(gf);function Ao(e,t,n){var r=t+"";return os(e,Wf(r,zf(Mf(r),n)))}function bo(e){var t=0,n=0;return function(){var r=ll(),s=Ft-(r-n);if(n=r,s>0){if(++t>=ht)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Dr(e,t){var n=-1,r=e.length,s=r-1;for(t=t===i?r:t;++n<t;){var u=qi(n,s),l=e[u];e[u]=e[n],e[n]=l}return e.length=t,e}var Eo=jf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Nu,function(n,r,s,u){t.push(s?u.replace(qu,"$1"):r||n)}),t});function lt(e){if(typeof e=="string"||$e(e))return e;var t=e+"";return t=="0"&&1/e==-at?"-0":t}function an(e){if(e!=null){try{return pr.call(e)}catch{}try{return e+""}catch{}}return""}function zf(e,t){return ze(ni,function(n){var r="_."+n[0];t&n[1]&&!ur(e,r)&&e.push(r)}),e.sort()}function Co(e){if(e instanceof q)return e.clone();var t=new Ye(e.__wrapped__,e.__chain__);return t.__actions__=Fe(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Jf(e,t,n){(n?Ee(e,t,n):t===i)?t=1:t=me(D(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var s=0,u=0,l=m(yr(r/t));s<r;)l[u++]=Xe(e,s,s+=t);return l}function Yf(e){for(var t=-1,n=e==null?0:e.length,r=0,s=[];++t<n;){var u=e[t];u&&(s[r++]=u)}return s}function Zf(){var e=arguments.length;if(!e)return[];for(var t=m(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Mt(U(n)?Fe(n):[n],ye(t,1))}var Xf=B(function(e,t){return fe(e)?kn(e,ye(t,1,fe,!0)):[]}),Qf=B(function(e,t){var n=Qe(t);return fe(n)&&(n=i),fe(e)?kn(e,ye(t,1,fe,!0),R(n,2)):[]}),Vf=B(function(e,t){var n=Qe(t);return fe(n)&&(n=i),fe(e)?kn(e,ye(t,1,fe,!0),i,n):[]});function eh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:D(t),Xe(e,t<0?0:t,r)):[]}function th(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:D(t),t=r-t,Xe(e,0,t<0?0:t)):[]}function nh(e,t){return e&&e.length?Rr(e,R(t,3),!0,!0):[]}function rh(e,t){return e&&e.length?Rr(e,R(t,3),!0):[]}function ih(e,t,n,r){var s=e==null?0:e.length;return s?(n&&typeof n!="number"&&Ee(e,t,n)&&(n=0,r=s),Yl(e,t,n,r)):[]}function To(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:D(n);return s<0&&(s=me(r+s,0)),cr(e,R(t,3),s)}function Fo(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r-1;return n!==i&&(s=D(n),s=n<0?me(r+s,0):xe(s,r-1)),cr(e,R(t,3),s,!0)}function Io(e){var t=e==null?0:e.length;return t?ye(e,1):[]}function sh(e){var t=e==null?0:e.length;return t?ye(e,at):[]}function ah(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:D(t),ye(e,t)):[]}function oh(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var s=e[t];r[s[0]]=s[1]}return r}function Ro(e){return e&&e.length?e[0]:i}function uh(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:D(n);return s<0&&(s=me(r+s,0)),dn(e,t,s)}function ch(e){var t=e==null?0:e.length;return t?Xe(e,0,-1):[]}var lh=B(function(e){var t=oe(e,Ji);return t.length&&t[0]===e[0]?Di(t):[]}),fh=B(function(e){var t=Qe(e),n=oe(e,Ji);return t===Qe(n)?t=i:n.pop(),n.length&&n[0]===e[0]?Di(n,R(t,2)):[]}),hh=B(function(e){var t=Qe(e),n=oe(e,Ji);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?Di(n,i,t):[]});function ph(e,t){return e==null?"":ul.call(e,t)}function Qe(e){var t=e==null?0:e.length;return t?e[t-1]:i}function dh(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r;return n!==i&&(s=D(n),s=s<0?me(r+s,0):xe(s,r-1)),t===t?Kc(e,t,s):cr(e,ca,s,!0)}function gh(e,t){return e&&e.length?Ba(e,D(t)):i}var mh=B(Po);function Po(e,t){return e&&e.length&&t&&t.length?ji(e,t):e}function vh(e,t,n){return e&&e.length&&t&&t.length?ji(e,t,R(n,2)):e}function _h(e,t,n){return e&&e.length&&t&&t.length?ji(e,t,i,n):e}var wh=vt(function(e,t){var n=e==null?0:e.length,r=Mi(e,t);return qa(e,oe(t,function(s){return _t(s,n)?+s:s}).sort(Va)),r});function yh(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,s=[],u=e.length;for(t=R(t,3);++r<u;){var l=e[r];t(l,r,e)&&(n.push(l),s.push(r))}return qa(e,s),n}function us(e){return e==null?e:hl.call(e)}function xh(e,t,n){var r=e==null?0:e.length;return r?(n&&typeof n!="number"&&Ee(e,t,n)?(t=0,n=r):(t=t==null?0:D(t),n=n===i?r:D(n)),Xe(e,t,n)):[]}function Sh(e,t){return Ir(e,t)}function Ah(e,t,n){return Hi(e,t,R(n,2))}function bh(e,t){var n=e==null?0:e.length;if(n){var r=Ir(e,t);if(r<n&&it(e[r],t))return r}return-1}function Eh(e,t){return Ir(e,t,!0)}function Ch(e,t,n){return Hi(e,t,R(n,2),!0)}function Th(e,t){var n=e==null?0:e.length;if(n){var r=Ir(e,t,!0)-1;if(it(e[r],t))return r}return-1}function Fh(e){return e&&e.length?Ha(e):[]}function Ih(e,t){return e&&e.length?Ha(e,R(t,2)):[]}function Rh(e){var t=e==null?0:e.length;return t?Xe(e,1,t):[]}function Ph(e,t,n){return e&&e.length?(t=n||t===i?1:D(t),Xe(e,0,t<0?0:t)):[]}function Oh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:D(t),t=r-t,Xe(e,t<0?0:t,r)):[]}function Lh(e,t){return e&&e.length?Rr(e,R(t,3),!1,!0):[]}function Mh(e,t){return e&&e.length?Rr(e,R(t,3)):[]}var Nh=B(function(e){return Dt(ye(e,1,fe,!0))}),Uh=B(function(e){var t=Qe(e);return fe(t)&&(t=i),Dt(ye(e,1,fe,!0),R(t,2))}),Wh=B(function(e){var t=Qe(e);return t=typeof t=="function"?t:i,Dt(ye(e,1,fe,!0),i,t)});function Dh(e){return e&&e.length?Dt(e):[]}function $h(e,t){return e&&e.length?Dt(e,R(t,2)):[]}function Bh(e,t){return t=typeof t=="function"?t:i,e&&e.length?Dt(e,i,t):[]}function cs(e){if(!(e&&e.length))return[];var t=0;return e=Lt(e,function(n){if(fe(n))return t=me(n.length,t),!0}),Ci(t,function(n){return oe(e,Ai(n))})}function Oo(e,t){if(!(e&&e.length))return[];var n=cs(e);return t==null?n:oe(n,function(r){return Ue(t,i,r)})}var kh=B(function(e,t){return fe(e)?kn(e,t):[]}),jh=B(function(e){return zi(Lt(e,fe))}),qh=B(function(e){var t=Qe(e);return fe(t)&&(t=i),zi(Lt(e,fe),R(t,2))}),Gh=B(function(e){var t=Qe(e);return t=typeof t=="function"?t:i,zi(Lt(e,fe),i,t)}),Hh=B(cs);function Kh(e,t){return Ya(e||[],t||[],Bn)}function zh(e,t){return Ya(e||[],t||[],Gn)}var Jh=B(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,Oo(e,n)});function Lo(e){var t=o(e);return t.__chain__=!0,t}function Yh(e,t){return t(e),e}function $r(e,t){return t(e)}var Zh=vt(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,s=function(u){return Mi(u,e)};return t>1||this.__actions__.length||!(r instanceof q)||!_t(n)?this.thru(s):(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:$r,args:[s],thisArg:i}),new Ye(r,this.__chain__).thru(function(u){return t&&!u.length&&u.push(i),u}))});function Xh(){return Lo(this)}function Qh(){return new Ye(this.value(),this.__chain__)}function Vh(){this.__values__===i&&(this.__values__=zo(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function ep(){return this}function tp(e){for(var t,n=this;n instanceof br;){var r=Co(n);r.__index__=0,r.__values__=i,t?s.__wrapped__=r:t=r;var s=r;n=n.__wrapped__}return s.__wrapped__=e,t}function np(){var e=this.__wrapped__;if(e instanceof q){var t=e;return this.__actions__.length&&(t=new q(this)),t=t.reverse(),t.__actions__.push({func:$r,args:[us],thisArg:i}),new Ye(t,this.__chain__)}return this.thru(us)}function rp(){return Ja(this.__wrapped__,this.__actions__)}var ip=Pr(function(e,t,n){Q.call(e,n)?++e[n]:gt(e,n,1)});function sp(e,t,n){var r=U(e)?oa:Jl;return n&&Ee(e,t,n)&&(t=i),r(e,R(t,3))}function ap(e,t){var n=U(e)?Lt:Pa;return n(e,R(t,3))}var op=so(To),up=so(Fo);function cp(e,t){return ye(Br(e,t),1)}function lp(e,t){return ye(Br(e,t),at)}function fp(e,t,n){return n=n===i?1:D(n),ye(Br(e,t),n)}function Mo(e,t){var n=U(e)?ze:Wt;return n(e,R(t,3))}function No(e,t){var n=U(e)?Ic:Ra;return n(e,R(t,3))}var hp=Pr(function(e,t,n){Q.call(e,n)?e[n].push(t):gt(e,n,[t])});function pp(e,t,n,r){e=Ie(e)?e:Cn(e),n=n&&!r?D(n):0;var s=e.length;return n<0&&(n=me(s+n,0)),Hr(e)?n<=s&&e.indexOf(t,n)>-1:!!s&&dn(e,t,n)>-1}var dp=B(function(e,t,n){var r=-1,s=typeof t=="function",u=Ie(e)?m(e.length):[];return Wt(e,function(l){u[++r]=s?Ue(t,l,n):jn(l,t,n)}),u}),gp=Pr(function(e,t,n){gt(e,n,t)});function Br(e,t){var n=U(e)?oe:Wa;return n(e,R(t,3))}function mp(e,t,n,r){return e==null?[]:(U(t)||(t=t==null?[]:[t]),n=r?i:n,U(n)||(n=n==null?[]:[n]),ka(e,t,n))}var vp=Pr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function _p(e,t,n){var r=U(e)?xi:fa,s=arguments.length<3;return r(e,R(t,4),n,s,Wt)}function wp(e,t,n){var r=U(e)?Rc:fa,s=arguments.length<3;return r(e,R(t,4),n,s,Ra)}function yp(e,t){var n=U(e)?Lt:Pa;return n(e,qr(R(t,3)))}function xp(e){var t=U(e)?Ca:pf;return t(e)}function Sp(e,t,n){(n?Ee(e,t,n):t===i)?t=1:t=D(t);var r=U(e)?ql:df;return r(e,t)}function Ap(e){var t=U(e)?Gl:mf;return t(e)}function bp(e){if(e==null)return 0;if(Ie(e))return Hr(e)?mn(e):e.length;var t=Se(e);return t==Me||t==Ne?e.size:Bi(e).length}function Ep(e,t,n){var r=U(e)?Si:vf;return n&&Ee(e,t,n)&&(t=i),r(e,R(t,3))}var Cp=B(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Ee(e,t[0],t[1])?t=[]:n>2&&Ee(t[0],t[1],t[2])&&(t=[t[0]]),ka(e,ye(t,1),[])}),kr=sl||function(){return we.Date.now()};function Tp(e,t){if(typeof t!="function")throw new Je(S);return e=D(e),function(){if(--e<1)return t.apply(this,arguments)}}function Uo(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,mt(e,se,i,i,i,i,t)}function Wo(e,t){var n;if(typeof t!="function")throw new Je(S);return e=D(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var ls=B(function(e,t,n){var r=pe;if(n.length){var s=Nt(n,bn(ls));r|=Z}return mt(e,r,t,n,s)}),Do=B(function(e,t,n){var r=pe|Le;if(n.length){var s=Nt(n,bn(Do));r|=Z}return mt(t,r,e,n,s)});function $o(e,t,n){t=n?i:t;var r=mt(e,Te,i,i,i,i,i,t);return r.placeholder=$o.placeholder,r}function Bo(e,t,n){t=n?i:t;var r=mt(e,F,i,i,i,i,i,t);return r.placeholder=Bo.placeholder,r}function ko(e,t,n){var r,s,u,l,h,d,w=0,y=!1,x=!1,E=!0;if(typeof e!="function")throw new Je(S);t=Ve(t)||0,ce(n)&&(y=!!n.leading,x="maxWait"in n,u=x?me(Ve(n.maxWait)||0,t):u,E="trailing"in n?!!n.trailing:E);function T(he){var st=r,xt=s;return r=s=i,w=he,l=e.apply(xt,st),l}function L(he){return w=he,h=zn(j,t),y?T(he):l}function $(he){var st=he-d,xt=he-w,au=t-st;return x?xe(au,u-xt):au}function M(he){var st=he-d,xt=he-w;return d===i||st>=t||st<0||x&&xt>=u}function j(){var he=kr();if(M(he))return H(he);h=zn(j,$(he))}function H(he){return h=i,E&&r?T(he):(r=s=i,l)}function Be(){h!==i&&Za(h),w=0,r=d=s=h=i}function Ce(){return h===i?l:H(kr())}function ke(){var he=kr(),st=M(he);if(r=arguments,s=this,d=he,st){if(h===i)return L(d);if(x)return Za(h),h=zn(j,t),T(d)}return h===i&&(h=zn(j,t)),l}return ke.cancel=Be,ke.flush=Ce,ke}var Fp=B(function(e,t){return Ia(e,1,t)}),Ip=B(function(e,t,n){return Ia(e,Ve(t)||0,n)});function Rp(e){return mt(e,ne)}function jr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Je(S);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],u=n.cache;if(u.has(s))return u.get(s);var l=e.apply(this,r);return n.cache=u.set(s,l)||u,l};return n.cache=new(jr.Cache||dt),n}jr.Cache=dt;function qr(e){if(typeof e!="function")throw new Je(S);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Pp(e){return Wo(2,e)}var Op=_f(function(e,t){t=t.length==1&&U(t[0])?oe(t[0],We(R())):oe(ye(t,1),We(R()));var n=t.length;return B(function(r){for(var s=-1,u=xe(r.length,n);++s<u;)r[s]=t[s].call(this,r[s]);return Ue(e,this,r)})}),fs=B(function(e,t){var n=Nt(t,bn(fs));return mt(e,Z,i,t,n)}),jo=B(function(e,t){var n=Nt(t,bn(jo));return mt(e,z,i,t,n)}),Lp=vt(function(e,t){return mt(e,qe,i,i,i,t)});function Mp(e,t){if(typeof e!="function")throw new Je(S);return t=t===i?t:D(t),B(e,t)}function Np(e,t){if(typeof e!="function")throw new Je(S);return t=t==null?0:me(D(t),0),B(function(n){var r=n[t],s=Bt(n,0,t);return r&&Mt(s,r),Ue(e,this,s)})}function Up(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new Je(S);return ce(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),ko(e,t,{leading:r,maxWait:t,trailing:s})}function Wp(e){return Uo(e,1)}function Dp(e,t){return fs(Yi(t),e)}function $p(){if(!arguments.length)return[];var e=arguments[0];return U(e)?e:[e]}function Bp(e){return Ze(e,k)}function kp(e,t){return t=typeof t=="function"?t:i,Ze(e,k,t)}function jp(e){return Ze(e,G|k)}function qp(e,t){return t=typeof t=="function"?t:i,Ze(e,G|k,t)}function Gp(e,t){return t==null||Fa(e,t,_e(t))}function it(e,t){return e===t||e!==e&&t!==t}var Hp=Nr(Wi),Kp=Nr(function(e,t){return e>=t}),on=Ma(function(){return arguments}())?Ma:function(e){return le(e)&&Q.call(e,"callee")&&!ya.call(e,"callee")},U=m.isArray,zp=ta?We(ta):ef;function Ie(e){return e!=null&&Gr(e.length)&&!wt(e)}function fe(e){return le(e)&&Ie(e)}function Jp(e){return e===!0||e===!1||le(e)&&be(e)==Kt}var kt=ol||Ss,Yp=na?We(na):tf;function Zp(e){return le(e)&&e.nodeType===1&&!Jn(e)}function Xp(e){if(e==null)return!0;if(Ie(e)&&(U(e)||typeof e=="string"||typeof e.splice=="function"||kt(e)||En(e)||on(e)))return!e.length;var t=Se(e);if(t==Me||t==Ne)return!e.size;if(Kn(e))return!Bi(e).length;for(var n in e)if(Q.call(e,n))return!1;return!0}function Qp(e,t){return qn(e,t)}function Vp(e,t,n){n=typeof n=="function"?n:i;var r=n?n(e,t):i;return r===i?qn(e,t,i,n):!!r}function hs(e){if(!le(e))return!1;var t=be(e);return t==ln||t==ii||typeof e.message=="string"&&typeof e.name=="string"&&!Jn(e)}function ed(e){return typeof e=="number"&&Sa(e)}function wt(e){if(!ce(e))return!1;var t=be(e);return t==fn||t==nr||t==ri||t==rr}function qo(e){return typeof e=="number"&&e==D(e)}function Gr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=et}function ce(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function le(e){return e!=null&&typeof e=="object"}var Go=ra?We(ra):rf;function td(e,t){return e===t||$i(e,t,ns(t))}function nd(e,t,n){return n=typeof n=="function"?n:i,$i(e,t,ns(t),n)}function rd(e){return Ho(e)&&e!=+e}function id(e){if(kf(e))throw new N(_);return Na(e)}function sd(e){return e===null}function ad(e){return e==null}function Ho(e){return typeof e=="number"||le(e)&&be(e)==Jt}function Jn(e){if(!le(e)||be(e)!=tt)return!1;var t=vr(e);if(t===null)return!0;var n=Q.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&pr.call(n)==tl}var ps=ia?We(ia):sf;function od(e){return qo(e)&&e>=-et&&e<=et}var Ko=sa?We(sa):af;function Hr(e){return typeof e=="string"||!U(e)&&le(e)&&be(e)==Yt}function $e(e){return typeof e=="symbol"||le(e)&&be(e)==hn}var En=aa?We(aa):of;function ud(e){return e===i}function cd(e){return le(e)&&Se(e)==Pt}function ld(e){return le(e)&&be(e)==oi}var fd=Nr(ki),hd=Nr(function(e,t){return e<=t});function zo(e){if(!e)return[];if(Ie(e))return Hr(e)?nt(e):Fe(e);if(Nn&&e[Nn])return qc(e[Nn]());var t=Se(e),n=t==Me?Fi:t==Ne?lr:Cn;return n(e)}function yt(e){if(!e)return e===0?e:0;if(e=Ve(e),e===at||e===-at){var t=e<0?-1:1;return t*Vr}return e===e?e:0}function D(e){var t=yt(e),n=t%1;return t===t?n?t-n:t:0}function Jo(e){return e?nn(D(e),0,He):0}function Ve(e){if(typeof e=="number")return e;if($e(e))return un;if(ce(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ce(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ha(e);var n=Ku.test(e);return n||Ju.test(e)?Cc(e.slice(2),n?2:8):Hu.test(e)?un:+e}function Yo(e){return ct(e,Re(e))}function pd(e){return e?nn(D(e),-et,et):e===0?e:0}function X(e){return e==null?"":De(e)}var dd=Sn(function(e,t){if(Kn(t)||Ie(t)){ct(t,_e(t),e);return}for(var n in t)Q.call(t,n)&&Bn(e,n,t[n])}),Zo=Sn(function(e,t){ct(t,Re(t),e)}),Kr=Sn(function(e,t,n,r){ct(t,Re(t),e,r)}),gd=Sn(function(e,t,n,r){ct(t,_e(t),e,r)}),md=vt(Mi);function vd(e,t){var n=xn(e);return t==null?n:Ta(n,t)}var _d=B(function(e,t){e=te(e);var n=-1,r=t.length,s=r>2?t[2]:i;for(s&&Ee(t[0],t[1],s)&&(r=1);++n<r;)for(var u=t[n],l=Re(u),h=-1,d=l.length;++h<d;){var w=l[h],y=e[w];(y===i||it(y,_n[w])&&!Q.call(e,w))&&(e[w]=u[w])}return e}),wd=B(function(e){return e.push(i,ho),Ue(Xo,i,e)});function yd(e,t){return ua(e,R(t,3),ut)}function xd(e,t){return ua(e,R(t,3),Ui)}function Sd(e,t){return e==null?e:Ni(e,R(t,3),Re)}function Ad(e,t){return e==null?e:Oa(e,R(t,3),Re)}function bd(e,t){return e&&ut(e,R(t,3))}function Ed(e,t){return e&&Ui(e,R(t,3))}function Cd(e){return e==null?[]:Tr(e,_e(e))}function Td(e){return e==null?[]:Tr(e,Re(e))}function ds(e,t,n){var r=e==null?i:rn(e,t);return r===i?n:r}function Fd(e,t){return e!=null&&mo(e,t,Zl)}function gs(e,t){return e!=null&&mo(e,t,Xl)}var Id=oo(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=dr.call(t)),e[t]=n},vs(Pe)),Rd=oo(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=dr.call(t)),Q.call(e,t)?e[t].push(n):e[t]=[n]},R),Pd=B(jn);function _e(e){return Ie(e)?Ea(e):Bi(e)}function Re(e){return Ie(e)?Ea(e,!0):uf(e)}function Od(e,t){var n={};return t=R(t,3),ut(e,function(r,s,u){gt(n,t(r,s,u),r)}),n}function Ld(e,t){var n={};return t=R(t,3),ut(e,function(r,s,u){gt(n,s,t(r,s,u))}),n}var Md=Sn(function(e,t,n){Fr(e,t,n)}),Xo=Sn(function(e,t,n,r){Fr(e,t,n,r)}),Nd=vt(function(e,t){var n={};if(e==null)return n;var r=!1;t=oe(t,function(u){return u=$t(u,e),r||(r=u.length>1),u}),ct(e,es(e),n),r&&(n=Ze(n,G|K|k,If));for(var s=t.length;s--;)Ki(n,t[s]);return n});function Ud(e,t){return Qo(e,qr(R(t)))}var Wd=vt(function(e,t){return e==null?{}:lf(e,t)});function Qo(e,t){if(e==null)return{};var n=oe(es(e),function(r){return[r]});return t=R(t),ja(e,n,function(r,s){return t(r,s[0])})}function Dd(e,t,n){t=$t(t,e);var r=-1,s=t.length;for(s||(s=1,e=i);++r<s;){var u=e==null?i:e[lt(t[r])];u===i&&(r=s,u=n),e=wt(u)?u.call(e):u}return e}function $d(e,t,n){return e==null?e:Gn(e,t,n)}function Bd(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:Gn(e,t,n,r)}var Vo=lo(_e),eu=lo(Re);function kd(e,t,n){var r=U(e),s=r||kt(e)||En(e);if(t=R(t,4),n==null){var u=e&&e.constructor;s?n=r?new u:[]:ce(e)?n=wt(u)?xn(vr(e)):{}:n={}}return(s?ze:ut)(e,function(l,h,d){return t(n,l,h,d)}),n}function jd(e,t){return e==null?!0:Ki(e,t)}function qd(e,t,n){return e==null?e:za(e,t,Yi(n))}function Gd(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:za(e,t,Yi(n),r)}function Cn(e){return e==null?[]:Ti(e,_e(e))}function Hd(e){return e==null?[]:Ti(e,Re(e))}function Kd(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=Ve(n),n=n===n?n:0),t!==i&&(t=Ve(t),t=t===t?t:0),nn(Ve(e),t,n)}function zd(e,t,n){return t=yt(t),n===i?(n=t,t=0):n=yt(n),e=Ve(e),Ql(e,t,n)}function Jd(e,t,n){if(n&&typeof n!="boolean"&&Ee(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=yt(e),t===i?(t=e,e=0):t=yt(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var s=Aa();return xe(e+s*(t-e+Ec("1e-"+((s+"").length-1))),t)}return qi(e,t)}var Yd=An(function(e,t,n){return t=t.toLowerCase(),e+(n?tu(t):t)});function tu(e){return ms(X(e).toLowerCase())}function nu(e){return e=X(e),e&&e.replace(Zu,Dc).replace(gc,"")}function Zd(e,t,n){e=X(e),t=De(t);var r=e.length;n=n===i?r:nn(D(n),0,r);var s=n;return n-=t.length,n>=0&&e.slice(n,s)==t}function Xd(e){return e=X(e),e&&Ru.test(e)?e.replace(Os,$c):e}function Qd(e){return e=X(e),e&&Uu.test(e)?e.replace(fi,"\\$&"):e}var Vd=An(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),eg=An(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),tg=io("toLowerCase");function ng(e,t,n){e=X(e),t=D(t);var r=t?mn(e):0;if(!t||r>=t)return e;var s=(t-r)/2;return Mr(xr(s),n)+e+Mr(yr(s),n)}function rg(e,t,n){e=X(e),t=D(t);var r=t?mn(e):0;return t&&r<t?e+Mr(t-r,n):e}function ig(e,t,n){e=X(e),t=D(t);var r=t?mn(e):0;return t&&r<t?Mr(t-r,n)+e:e}function sg(e,t,n){return n||t==null?t=0:t&&(t=+t),fl(X(e).replace(hi,""),t||0)}function ag(e,t,n){return(n?Ee(e,t,n):t===i)?t=1:t=D(t),Gi(X(e),t)}function og(){var e=arguments,t=X(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var ug=An(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function cg(e,t,n){return n&&typeof n!="number"&&Ee(e,t,n)&&(t=n=i),n=n===i?He:n>>>0,n?(e=X(e),e&&(typeof t=="string"||t!=null&&!ps(t))&&(t=De(t),!t&&gn(e))?Bt(nt(e),0,n):e.split(t,n)):[]}var lg=An(function(e,t,n){return e+(n?" ":"")+ms(t)});function fg(e,t,n){return e=X(e),n=n==null?0:nn(D(n),0,e.length),t=De(t),e.slice(n,n+t.length)==t}function hg(e,t,n){var r=o.templateSettings;n&&Ee(e,t,n)&&(t=i),e=X(e),t=Kr({},t,r,fo);var s=Kr({},t.imports,r.imports,fo),u=_e(s),l=Ti(s,u),h,d,w=0,y=t.interpolate||sr,x="__p += '",E=Ii((t.escape||sr).source+"|"+y.source+"|"+(y===Ls?Gu:sr).source+"|"+(t.evaluate||sr).source+"|$","g"),T="//# sourceURL="+(Q.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++yc+"]")+`
212
- `;e.replace(E,function(M,j,H,Be,Ce,ke){return H||(H=Be),x+=e.slice(w,ke).replace(Xu,Bc),j&&(h=!0,x+=`' +
213
- __e(`+j+`) +
214
- '`),Ce&&(d=!0,x+=`';
215
- `+Ce+`;
216
- __p += '`),H&&(x+=`' +
217
- ((__t = (`+H+`)) == null ? '' : __t) +
218
- '`),w=ke+M.length,M}),x+=`';
219
- `;var L=Q.call(t,"variable")&&t.variable;if(!L)x=`with (obj) {
220
- `+x+`
432
+ `)}function Zf(e){return D(e)||Yt(e)||!!(ga&&e&&e[ga])}function xt(e,t){var n=typeof e;return t=t??de,!!t&&(n=="number"||n!="symbol"&&uu.test(e))&&e>-1&&e%1==0&&e<t}function Se(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Te(n)&&xt(t,n.length):i=="string"&&t in n)?it(n[t],e):!1}function Ki(e,t){if(D(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ne(e)?!0:Kl.test(e)||!zl.test(e)||t!=null&&e in te(t)}function Qf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vi(e){var t=Cr(e),n=u[t];if(typeof n!="function"||!(t in J.prototype))return!1;if(e===n)return!0;var i=Gi(n);return!!i&&e===i[0]}function ep(e){return!!fa&&fa in e}var tp=sr?St:ps;function $n(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||sn;return e===n}function fo(e){return e===e&&!ae(e)}function po(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in te(n))}}function np(e){var t=Nr(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function rp(e,t){var n=e[1],i=t[1],a=n|i,c=a<(Fe|dt|Be),f=i==Be&&n==$e||i==Be&&n==Pt&&e[7].length<=t[8]||i==(Be|Pt)&&t[7].length<=t[8]&&n==$e;if(!(c||f))return e;i&Fe&&(e[2]=t[2],a|=n&Fe?0:vn);var d=t[3];if(d){var g=e[3];e[3]=g?Ka(g,d,t[4]):d,e[4]=g?Lt(e[3],H):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Va(g,d,t[6]):d,e[6]=g?Lt(e[5],H):t[6]),d=t[7],d&&(e[7]=d),i&Be&&(e[8]=e[8]==null?t[8]:ye(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function ip(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function sp(e){return or.call(e)}function ho(e,t,n){return t=pe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,c=pe(i.length-t,0),f=y(c);++a<c;)f[a]=i[t+a];a=-1;for(var d=y(t+1);++a<t;)d[a]=i[a];return d[t]=n(f),Oe(e,this,d)}}function go(e,t){return t.length<2?e:zt(e,ze(t,0,-1))}function ap(e,t){for(var n=e.length,i=ye(t.length,n),a=Ee(e);i--;){var c=t[i];e[i]=xt(c,n)?a[c]:r}return e}function Yi(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var mo=yo(Wa),Mn=wc||function(e,t){return ge.setTimeout(e,t)},Xi=yo(Cf);function vo(e,t,n){var i=t+"";return Xi(e,Xf(i,op(Kf(i),n)))}function yo(e){var t=0,n=0;return function(){var i=Ic(),a=Jn-(i-n);if(n=i,a>0){if(++t>=le)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Rr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var c=Li(n,a),f=e[c];e[c]=e[n],e[n]=f}return e.length=t,e}var _o=np(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vl,function(n,i,a,c){t.push(a?c.replace(ru,"$1"):i||n)}),t});function ft(e){if(typeof e=="string"||Ne(e))return e;var t=e+"";return t=="0"&&1/e==-B?"-0":t}function Vt(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}function op(e,t){return qe(Ll,function(n){var i="_."+n[0];t&n[1]&&!tr(e,i)&&e.push(i)}),e.sort()}function wo(e){if(e instanceof J)return e.clone();var t=new Ge(e.__wrapped__,e.__chain__);return t.__actions__=Ee(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function lp(e,t,n){(n?Se(e,t,n):t===r)?t=1:t=pe(W(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,c=0,f=y(dr(i/t));a<i;)f[c++]=ze(e,a,a+=t);return f}function up(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var c=e[t];c&&(a[i++]=c)}return a}function cp(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ot(D(n)?Ee(n):[n],me(t,1))}var fp=q(function(e,t){return ue(e)?kn(e,me(t,1,ue,!0)):[]}),pp=q(function(e,t){var n=Ke(t);return ue(n)&&(n=r),ue(e)?kn(e,me(t,1,ue,!0),C(n,2)):[]}),dp=q(function(e,t){var n=Ke(t);return ue(n)&&(n=r),ue(e)?kn(e,me(t,1,ue,!0),r,n):[]});function hp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),ze(e,t<0?0:t,i)):[]}function gp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,ze(e,0,t<0?0:t)):[]}function mp(e,t){return e&&e.length?Ar(e,C(t,3),!0,!0):[]}function vp(e,t){return e&&e.length?Ar(e,C(t,3),!0):[]}function yp(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&Se(e,t,n)&&(n=0,i=a),cf(e,t,n,i)):[]}function xo(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),nr(e,C(t,3),a)}function So(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=W(n),a=n<0?pe(i+a,0):ye(a,i-1)),nr(e,C(t,3),a,!0)}function Ao(e){var t=e==null?0:e.length;return t?me(e,1):[]}function _p(e){var t=e==null?0:e.length;return t?me(e,B):[]}function wp(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function xp(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];i[a[0]]=a[1]}return i}function Io(e){return e&&e.length?e[0]:r}function Sp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),en(e,t,a)}function Ap(e){var t=e==null?0:e.length;return t?ze(e,0,-1):[]}var Ip=q(function(e){var t=se(e,Wi);return t.length&&t[0]===e[0]?bi(t):[]}),Fp=q(function(e){var t=Ke(e),n=se(e,Wi);return t===Ke(n)?t=r:n.pop(),n.length&&n[0]===e[0]?bi(n,C(t,2)):[]}),Ep=q(function(e){var t=Ke(e),n=se(e,Wi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?bi(n,r,t):[]});function Tp(e,t){return e==null?"":Sc.call(e,t)}function Ke(e){var t=e==null?0:e.length;return t?e[t-1]:r}function bp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=W(n),a=a<0?pe(i+a,0):ye(a,i-1)),t===t?ac(e,t,a):nr(e,ra,a,!0)}function Cp(e,t){return e&&e.length?ka(e,W(t)):r}var Pp=q(Fo);function Fo(e,t){return e&&e.length&&t&&t.length?Oi(e,t):e}function Rp(e,t,n){return e&&e.length&&t&&t.length?Oi(e,t,C(n,2)):e}function Op(e,t,n){return e&&e.length&&t&&t.length?Oi(e,t,r,n):e}var Lp=wt(function(e,t){var n=e==null?0:e.length,i=Ii(e,t);return Da(e,se(t,function(a){return xt(a,n)?+a:a}).sort(za)),i});function kp(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],c=e.length;for(t=C(t,3);++i<c;){var f=e[i];t(f,i,e)&&(n.push(f),a.push(i))}return Da(e,a),n}function Zi(e){return e==null?e:Ec.call(e)}function Np(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&Se(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),ze(e,t,n)):[]}function Up(e,t){return Sr(e,t)}function Dp(e,t,n){return Ni(e,t,C(n,2))}function Wp(e,t){var n=e==null?0:e.length;if(n){var i=Sr(e,t);if(i<n&&it(e[i],t))return i}return-1}function $p(e,t){return Sr(e,t,!0)}function Mp(e,t,n){return Ni(e,t,C(n,2),!0)}function Bp(e,t){var n=e==null?0:e.length;if(n){var i=Sr(e,t,!0)-1;if(it(e[i],t))return i}return-1}function jp(e){return e&&e.length?$a(e):[]}function qp(e,t){return e&&e.length?$a(e,C(t,2)):[]}function Hp(e){var t=e==null?0:e.length;return t?ze(e,1,t):[]}function Gp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),ze(e,0,t<0?0:t)):[]}function Jp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,ze(e,t<0?0:t,i)):[]}function zp(e,t){return e&&e.length?Ar(e,C(t,3),!1,!0):[]}function Kp(e,t){return e&&e.length?Ar(e,C(t,3)):[]}var Vp=q(function(e){return Ut(me(e,1,ue,!0))}),Yp=q(function(e){var t=Ke(e);return ue(t)&&(t=r),Ut(me(e,1,ue,!0),C(t,2))}),Xp=q(function(e){var t=Ke(e);return t=typeof t=="function"?t:r,Ut(me(e,1,ue,!0),r,t)});function Zp(e){return e&&e.length?Ut(e):[]}function Qp(e,t){return e&&e.length?Ut(e,C(t,2)):[]}function ed(e,t){return t=typeof t=="function"?t:r,e&&e.length?Ut(e,r,t):[]}function Qi(e){if(!(e&&e.length))return[];var t=0;return e=Rt(e,function(n){if(ue(n))return t=pe(n.length,t),!0}),mi(t,function(n){return se(e,di(n))})}function Eo(e,t){if(!(e&&e.length))return[];var n=Qi(e);return t==null?n:se(n,function(i){return Oe(t,r,i)})}var td=q(function(e,t){return ue(e)?kn(e,t):[]}),nd=q(function(e){return Di(Rt(e,ue))}),rd=q(function(e){var t=Ke(e);return ue(t)&&(t=r),Di(Rt(e,ue),C(t,2))}),id=q(function(e){var t=Ke(e);return t=typeof t=="function"?t:r,Di(Rt(e,ue),r,t)}),sd=q(Qi);function ad(e,t){return qa(e||[],t||[],Ln)}function od(e,t){return qa(e||[],t||[],Dn)}var ld=q(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,Eo(e,n)});function To(e){var t=u(e);return t.__chain__=!0,t}function ud(e,t){return t(e),e}function Or(e,t){return t(e)}var cd=wt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(c){return Ii(c,e)};return t>1||this.__actions__.length||!(i instanceof J)||!xt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:Or,args:[a],thisArg:r}),new Ge(i,this.__chain__).thru(function(c){return t&&!c.length&&c.push(r),c}))});function fd(){return To(this)}function pd(){return new Ge(this.value(),this.__chain__)}function dd(){this.__values__===r&&(this.__values__=Bo(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function hd(){return this}function gd(e){for(var t,n=this;n instanceof vr;){var i=wo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function md(){var e=this.__wrapped__;if(e instanceof J){var t=e;return this.__actions__.length&&(t=new J(this)),t=t.reverse(),t.__actions__.push({func:Or,args:[Zi],thisArg:r}),new Ge(t,this.__chain__)}return this.thru(Zi)}function vd(){return ja(this.__wrapped__,this.__actions__)}var yd=Ir(function(e,t,n){ee.call(e,n)?++e[n]:yt(e,n,1)});function _d(e,t,n){var i=D(e)?ta:uf;return n&&Se(e,t,n)&&(t=r),i(e,C(t,3))}function wd(e,t){var n=D(e)?Rt:Fa;return n(e,C(t,3))}var xd=Qa(xo),Sd=Qa(So);function Ad(e,t){return me(Lr(e,t),1)}function Id(e,t){return me(Lr(e,t),B)}function Fd(e,t,n){return n=n===r?1:W(n),me(Lr(e,t),n)}function bo(e,t){var n=D(e)?qe:Nt;return n(e,C(t,3))}function Co(e,t){var n=D(e)?qu:Ia;return n(e,C(t,3))}var Ed=Ir(function(e,t,n){ee.call(e,n)?e[n].push(t):yt(e,n,[t])});function Td(e,t,n,i){e=Te(e)?e:dn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),Wr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&en(e,t,n)>-1}var bd=q(function(e,t,n){var i=-1,a=typeof t=="function",c=Te(e)?y(e.length):[];return Nt(e,function(f){c[++i]=a?Oe(t,f,n):Nn(f,t,n)}),c}),Cd=Ir(function(e,t,n){yt(e,n,t)});function Lr(e,t){var n=D(e)?se:Ra;return n(e,C(t,3))}function Pd(e,t,n,i){return e==null?[]:(D(t)||(t=t==null?[]:[t]),n=i?r:n,D(n)||(n=n==null?[]:[n]),Na(e,t,n))}var Rd=Ir(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Od(e,t,n){var i=D(e)?fi:sa,a=arguments.length<3;return i(e,C(t,4),n,a,Nt)}function Ld(e,t,n){var i=D(e)?Hu:sa,a=arguments.length<3;return i(e,C(t,4),n,a,Ia)}function kd(e,t){var n=D(e)?Rt:Fa;return n(e,Ur(C(t,3)))}function Nd(e){var t=D(e)?wa:Tf;return t(e)}function Ud(e,t,n){(n?Se(e,t,n):t===r)?t=1:t=W(t);var i=D(e)?rf:bf;return i(e,t)}function Dd(e){var t=D(e)?sf:Pf;return t(e)}function Wd(e){if(e==null)return 0;if(Te(e))return Wr(e)?nn(e):e.length;var t=_e(e);return t==et||t==tt?e.size:Pi(e).length}function $d(e,t,n){var i=D(e)?pi:Rf;return n&&Se(e,t,n)&&(t=r),i(e,C(t,3))}var Md=q(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Se(e,t[0],t[1])?t=[]:n>2&&Se(t[0],t[1],t[2])&&(t=[t[0]]),Na(e,me(t,1),[])}),kr=_c||function(){return ge.Date.now()};function Bd(e,t){if(typeof t!="function")throw new He(v);return e=W(e),function(){if(--e<1)return t.apply(this,arguments)}}function Po(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,_t(e,Be,r,r,r,r,t)}function Ro(e,t){var n;if(typeof t!="function")throw new He(v);return e=W(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var es=q(function(e,t,n){var i=Fe;if(n.length){var a=Lt(n,fn(es));i|=Me}return _t(e,i,t,n,a)}),Oo=q(function(e,t,n){var i=Fe|dt;if(n.length){var a=Lt(n,fn(Oo));i|=Me}return _t(t,i,e,n,a)});function Lo(e,t,n){t=n?r:t;var i=_t(e,$e,r,r,r,r,r,t);return i.placeholder=Lo.placeholder,i}function ko(e,t,n){t=n?r:t;var i=_t(e,bt,r,r,r,r,r,t);return i.placeholder=ko.placeholder,i}function No(e,t,n){var i,a,c,f,d,g,w=0,x=!1,S=!1,I=!0;if(typeof e!="function")throw new He(v);t=Ve(t)||0,ae(n)&&(x=!!n.leading,S="maxWait"in n,c=S?pe(Ve(n.maxWait)||0,t):c,I="trailing"in n?!!n.trailing:I);function T(ce){var st=i,It=a;return i=a=r,w=ce,f=e.apply(It,st),f}function R(ce){return w=ce,d=Mn(G,t),x?T(ce):f}function j(ce){var st=ce-g,It=ce-w,el=t-st;return S?ye(el,c-It):el}function O(ce){var st=ce-g,It=ce-w;return g===r||st>=t||st<0||S&&It>=c}function G(){var ce=kr();if(O(ce))return z(ce);d=Mn(G,j(ce))}function z(ce){return d=r,I&&i?T(ce):(i=a=r,f)}function Ue(){d!==r&&Ha(d),w=0,i=g=a=d=r}function Ae(){return d===r?f:z(kr())}function De(){var ce=kr(),st=O(ce);if(i=arguments,a=this,g=ce,st){if(d===r)return R(g);if(S)return Ha(d),d=Mn(G,t),T(g)}return d===r&&(d=Mn(G,t)),f}return De.cancel=Ue,De.flush=Ae,De}var jd=q(function(e,t){return Aa(e,1,t)}),qd=q(function(e,t,n){return Aa(e,Ve(t)||0,n)});function Hd(e){return _t(e,yn)}function Nr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new He(v);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],c=n.cache;if(c.has(a))return c.get(a);var f=e.apply(this,i);return n.cache=c.set(a,f)||c,f};return n.cache=new(Nr.Cache||vt),n}Nr.Cache=vt;function Ur(e){if(typeof e!="function")throw new He(v);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Gd(e){return Ro(2,e)}var Jd=Of(function(e,t){t=t.length==1&&D(t[0])?se(t[0],Le(C())):se(me(t,1),Le(C()));var n=t.length;return q(function(i){for(var a=-1,c=ye(i.length,n);++a<c;)i[a]=t[a].call(this,i[a]);return Oe(e,this,i)})}),ts=q(function(e,t){var n=Lt(t,fn(ts));return _t(e,Me,r,t,n)}),Uo=q(function(e,t){var n=Lt(t,fn(Uo));return _t(e,Ct,r,t,n)}),zd=wt(function(e,t){return _t(e,Pt,r,r,r,t)});function Kd(e,t){if(typeof e!="function")throw new He(v);return t=t===r?t:W(t),q(e,t)}function Vd(e,t){if(typeof e!="function")throw new He(v);return t=t==null?0:pe(W(t),0),q(function(n){var i=n[t],a=Wt(n,0,t);return i&&Ot(a,i),Oe(e,this,a)})}function Yd(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new He(v);return ae(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),No(e,t,{leading:i,maxWait:t,trailing:a})}function Xd(e){return Po(e,1)}function Zd(e,t){return ts($i(t),e)}function Qd(){if(!arguments.length)return[];var e=arguments[0];return D(e)?e:[e]}function eh(e){return Je(e,V)}function th(e,t){return t=typeof t=="function"?t:r,Je(e,V,t)}function nh(e){return Je(e,X|V)}function rh(e,t){return t=typeof t=="function"?t:r,Je(e,X|V,t)}function ih(e,t){return t==null||Sa(e,t,he(t))}function it(e,t){return e===t||e!==e&&t!==t}var sh=br(Ti),ah=br(function(e,t){return e>=t}),Yt=ba(function(){return arguments}())?ba:function(e){return oe(e)&&ee.call(e,"callee")&&!ha.call(e,"callee")},D=y.isArray,oh=Vs?Le(Vs):gf;function Te(e){return e!=null&&Dr(e.length)&&!St(e)}function ue(e){return oe(e)&&Te(e)}function lh(e){return e===!0||e===!1||oe(e)&&xe(e)==wn}var $t=xc||ps,uh=Ys?Le(Ys):mf;function ch(e){return oe(e)&&e.nodeType===1&&!Bn(e)}function fh(e){if(e==null)return!0;if(Te(e)&&(D(e)||typeof e=="string"||typeof e.splice=="function"||$t(e)||pn(e)||Yt(e)))return!e.length;var t=_e(e);if(t==et||t==tt)return!e.size;if($n(e))return!Pi(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function ph(e,t){return Un(e,t)}function dh(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?Un(e,t,r,n):!!i}function ns(e){if(!oe(e))return!1;var t=xe(e);return t==Vn||t==Nl||typeof e.message=="string"&&typeof e.name=="string"&&!Bn(e)}function hh(e){return typeof e=="number"&&ma(e)}function St(e){if(!ae(e))return!1;var t=xe(e);return t==Yn||t==As||t==kl||t==Dl}function Do(e){return typeof e=="number"&&e==W(e)}function Dr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=de}function ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function oe(e){return e!=null&&typeof e=="object"}var Wo=Xs?Le(Xs):yf;function gh(e,t){return e===t||Ci(e,t,Ji(t))}function mh(e,t,n){return n=typeof n=="function"?n:r,Ci(e,t,Ji(t),n)}function vh(e){return $o(e)&&e!=+e}function yh(e){if(tp(e))throw new U(m);return Ca(e)}function _h(e){return e===null}function wh(e){return e==null}function $o(e){return typeof e=="number"||oe(e)&&xe(e)==Sn}function Bn(e){if(!oe(e)||xe(e)!=gt)return!1;var t=cr(e);if(t===null)return!0;var n=ee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ar.call(n)==gc}var rs=Zs?Le(Zs):_f;function xh(e){return Do(e)&&e>=-de&&e<=de}var Mo=Qs?Le(Qs):wf;function Wr(e){return typeof e=="string"||!D(e)&&oe(e)&&xe(e)==In}function Ne(e){return typeof e=="symbol"||oe(e)&&xe(e)==Xn}var pn=ea?Le(ea):xf;function Sh(e){return e===r}function Ah(e){return oe(e)&&_e(e)==Fn}function Ih(e){return oe(e)&&xe(e)==$l}var Fh=br(Ri),Eh=br(function(e,t){return e<=t});function Bo(e){if(!e)return[];if(Te(e))return Wr(e)?nt(e):Ee(e);if(bn&&e[bn])return rc(e[bn]());var t=_e(e),n=t==et?yi:t==tt?rr:dn;return n(e)}function At(e){if(!e)return e===0?e:0;if(e=Ve(e),e===B||e===-B){var t=e<0?-1:1;return t*ht}return e===e?e:0}function W(e){var t=At(e),n=t%1;return t===t?n?t-n:t:0}function jo(e){return e?Jt(W(e),0,ve):0}function Ve(e){if(typeof e=="number")return e;if(Ne(e))return Re;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=aa(e);var n=au.test(e);return n||lu.test(e)?Mu(e.slice(2),n?2:8):su.test(e)?Re:+e}function qo(e){return ct(e,be(e))}function Th(e){return e?Jt(W(e),-de,de):e===0?e:0}function Q(e){return e==null?"":ke(e)}var bh=un(function(e,t){if($n(t)||Te(t)){ct(t,he(t),e);return}for(var n in t)ee.call(t,n)&&Ln(e,n,t[n])}),Ho=un(function(e,t){ct(t,be(t),e)}),$r=un(function(e,t,n,i){ct(t,be(t),e,i)}),Ch=un(function(e,t,n,i){ct(t,he(t),e,i)}),Ph=wt(Ii);function Rh(e,t){var n=ln(e);return t==null?n:xa(n,t)}var Oh=q(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Se(t[0],t[1],a)&&(i=1);++n<i;)for(var c=t[n],f=be(c),d=-1,g=f.length;++d<g;){var w=f[d],x=e[w];(x===r||it(x,sn[w])&&!ee.call(e,w))&&(e[w]=c[w])}return e}),Lh=q(function(e){return e.push(r,ao),Oe(Go,r,e)});function kh(e,t){return na(e,C(t,3),ut)}function Nh(e,t){return na(e,C(t,3),Ei)}function Uh(e,t){return e==null?e:Fi(e,C(t,3),be)}function Dh(e,t){return e==null?e:Ea(e,C(t,3),be)}function Wh(e,t){return e&&ut(e,C(t,3))}function $h(e,t){return e&&Ei(e,C(t,3))}function Mh(e){return e==null?[]:wr(e,he(e))}function Bh(e){return e==null?[]:wr(e,be(e))}function is(e,t,n){var i=e==null?r:zt(e,t);return i===r?n:i}function jh(e,t){return e!=null&&uo(e,t,ff)}function ss(e,t){return e!=null&&uo(e,t,pf)}var qh=to(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=or.call(t)),e[t]=n},os(Ce)),Hh=to(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=or.call(t)),ee.call(e,t)?e[t].push(n):e[t]=[n]},C),Gh=q(Nn);function he(e){return Te(e)?_a(e):Pi(e)}function be(e){return Te(e)?_a(e,!0):Sf(e)}function Jh(e,t){var n={};return t=C(t,3),ut(e,function(i,a,c){yt(n,t(i,a,c),i)}),n}function zh(e,t){var n={};return t=C(t,3),ut(e,function(i,a,c){yt(n,a,t(i,a,c))}),n}var Kh=un(function(e,t,n){xr(e,t,n)}),Go=un(function(e,t,n,i){xr(e,t,n,i)}),Vh=wt(function(e,t){var n={};if(e==null)return n;var i=!1;t=se(t,function(c){return c=Dt(c,e),i||(i=c.length>1),c}),ct(e,Hi(e),n),i&&(n=Je(n,X|N|V,qf));for(var a=t.length;a--;)Ui(n,t[a]);return n});function Yh(e,t){return Jo(e,Ur(C(t)))}var Xh=wt(function(e,t){return e==null?{}:If(e,t)});function Jo(e,t){if(e==null)return{};var n=se(Hi(e),function(i){return[i]});return t=C(t),Ua(e,n,function(i,a){return t(i,a[0])})}function Zh(e,t,n){t=Dt(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var c=e==null?r:e[ft(t[i])];c===r&&(i=a,c=n),e=St(c)?c.call(e):c}return e}function Qh(e,t,n){return e==null?e:Dn(e,t,n)}function eg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Dn(e,t,n,i)}var zo=io(he),Ko=io(be);function tg(e,t,n){var i=D(e),a=i||$t(e)||pn(e);if(t=C(t,4),n==null){var c=e&&e.constructor;a?n=i?new c:[]:ae(e)?n=St(c)?ln(cr(e)):{}:n={}}return(a?qe:ut)(e,function(f,d,g){return t(n,f,d,g)}),n}function ng(e,t){return e==null?!0:Ui(e,t)}function rg(e,t,n){return e==null?e:Ba(e,t,$i(n))}function ig(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ba(e,t,$i(n),i)}function dn(e){return e==null?[]:vi(e,he(e))}function sg(e){return e==null?[]:vi(e,be(e))}function ag(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Ve(n),n=n===n?n:0),t!==r&&(t=Ve(t),t=t===t?t:0),Jt(Ve(e),t,n)}function og(e,t,n){return t=At(t),n===r?(n=t,t=0):n=At(n),e=Ve(e),df(e,t,n)}function lg(e,t,n){if(n&&typeof n!="boolean"&&Se(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=At(e),t===r?(t=e,e=0):t=At(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=va();return ye(e+a*(t-e+$u("1e-"+((a+"").length-1))),t)}return Li(e,t)}var ug=cn(function(e,t,n){return t=t.toLowerCase(),e+(n?Vo(t):t)});function Vo(e){return as(Q(e).toLowerCase())}function Yo(e){return e=Q(e),e&&e.replace(cu,Zu).replace(Cu,"")}function cg(e,t,n){e=Q(e),t=ke(t);var i=e.length;n=n===r?i:Jt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function fg(e){return e=Q(e),e&&Hl.test(e)?e.replace(Es,Qu):e}function pg(e){return e=Q(e),e&&Yl.test(e)?e.replace(ti,"\\$&"):e}var dg=cn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),hg=cn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),gg=Za("toLowerCase");function mg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return Tr(hr(a),n)+e+Tr(dr(a),n)}function vg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?e+Tr(t-i,n):e}function yg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?Tr(t-i,n)+e:e}function _g(e,t,n){return n||t==null?t=0:t&&(t=+t),Fc(Q(e).replace(ni,""),t||0)}function wg(e,t,n){return(n?Se(e,t,n):t===r)?t=1:t=W(t),ki(Q(e),t)}function xg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Sg=cn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Ag(e,t,n){return n&&typeof n!="number"&&Se(e,t,n)&&(t=n=r),n=n===r?ve:n>>>0,n?(e=Q(e),e&&(typeof t=="string"||t!=null&&!rs(t))&&(t=ke(t),!t&&tn(e))?Wt(nt(e),0,n):e.split(t,n)):[]}var Ig=cn(function(e,t,n){return e+(n?" ":"")+as(t)});function Fg(e,t,n){return e=Q(e),n=n==null?0:Jt(W(n),0,e.length),t=ke(t),e.slice(n,n+t.length)==t}function Eg(e,t,n){var i=u.templateSettings;n&&Se(e,t,n)&&(t=r),e=Q(e),t=$r({},t,i,so);var a=$r({},t.imports,i.imports,so),c=he(a),f=vi(a,c),d,g,w=0,x=t.interpolate||Zn,S="__p += '",I=_i((t.escape||Zn).source+"|"+x.source+"|"+(x===Ts?iu:Zn).source+"|"+(t.evaluate||Zn).source+"|$","g"),T="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ku+"]")+`
433
+ `;e.replace(I,function(O,G,z,Ue,Ae,De){return z||(z=Ue),S+=e.slice(w,De).replace(fu,ec),G&&(d=!0,S+=`' +
434
+ __e(`+G+`) +
435
+ '`),Ae&&(g=!0,S+=`';
436
+ `+Ae+`;
437
+ __p += '`),z&&(S+=`' +
438
+ ((__t = (`+z+`)) == null ? '' : __t) +
439
+ '`),w=De+O.length,O}),S+=`';
440
+ `;var R=ee.call(t,"variable")&&t.variable;if(!R)S=`with (obj) {
441
+ `+S+`
221
442
  }
222
- `;else if(ju.test(L))throw new N(A);x=(d?x.replace(Cu,""):x).replace(Tu,"$1").replace(Fu,"$1;"),x="function("+(L||"obj")+`) {
223
- `+(L?"":`obj || (obj = {});
224
- `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(d?`, __j = Array.prototype.join;
443
+ `;else if(nu.test(R))throw new U(E);S=(g?S.replace(Ml,""):S).replace(Bl,"$1").replace(jl,"$1;"),S="function("+(R||"obj")+`) {
444
+ `+(R?"":`obj || (obj = {});
445
+ `)+"var __t, __p = ''"+(d?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
225
446
  function print() { __p += __j.call(arguments, '') }
226
447
  `:`;
227
- `)+x+`return __p
228
- }`;var $=iu(function(){return Y(u,T+"return "+x).apply(i,l)});if($.source=x,hs($))throw $;return $}function pg(e){return X(e).toLowerCase()}function dg(e){return X(e).toUpperCase()}function gg(e,t,n){if(e=X(e),e&&(n||t===i))return ha(e);if(!e||!(t=De(t)))return e;var r=nt(e),s=nt(t),u=pa(r,s),l=da(r,s)+1;return Bt(r,u,l).join("")}function mg(e,t,n){if(e=X(e),e&&(n||t===i))return e.slice(0,ma(e)+1);if(!e||!(t=De(t)))return e;var r=nt(e),s=da(r,nt(t))+1;return Bt(r,0,s).join("")}function vg(e,t,n){if(e=X(e),e&&(n||t===i))return e.replace(hi,"");if(!e||!(t=De(t)))return e;var r=nt(e),s=pa(r,nt(t));return Bt(r,s).join("")}function _g(e,t){var n=Ht,r=Ge;if(ce(t)){var s="separator"in t?t.separator:s;n="length"in t?D(t.length):n,r="omission"in t?De(t.omission):r}e=X(e);var u=e.length;if(gn(e)){var l=nt(e);u=l.length}if(n>=u)return e;var h=n-mn(r);if(h<1)return r;var d=l?Bt(l,0,h).join(""):e.slice(0,h);if(s===i)return d+r;if(l&&(h+=d.length-h),ps(s)){if(e.slice(h).search(s)){var w,y=d;for(s.global||(s=Ii(s.source,X(Ms.exec(s))+"g")),s.lastIndex=0;w=s.exec(y);)var x=w.index;d=d.slice(0,x===i?h:x)}}else if(e.indexOf(De(s),h)!=h){var E=d.lastIndexOf(s);E>-1&&(d=d.slice(0,E))}return d+r}function wg(e){return e=X(e),e&&Iu.test(e)?e.replace(Ps,zc):e}var yg=An(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ms=io("toUpperCase");function ru(e,t,n){return e=X(e),t=n?i:t,t===i?jc(e)?Zc(e):Lc(e):e.match(t)||[]}var iu=B(function(e,t){try{return Ue(e,i,t)}catch(n){return hs(n)?n:new N(n)}}),xg=vt(function(e,t){return ze(t,function(n){n=lt(n),gt(e,n,ls(e[n],e))}),e});function Sg(e){var t=e==null?0:e.length,n=R();return e=t?oe(e,function(r){if(typeof r[1]!="function")throw new Je(S);return[n(r[0]),r[1]]}):[],B(function(r){for(var s=-1;++s<t;){var u=e[s];if(Ue(u[0],this,r))return Ue(u[1],this,r)}})}function Ag(e){return zl(Ze(e,G))}function vs(e){return function(){return e}}function bg(e,t){return e==null||e!==e?t:e}var Eg=ao(),Cg=ao(!0);function Pe(e){return e}function _s(e){return Ua(typeof e=="function"?e:Ze(e,G))}function Tg(e){return Da(Ze(e,G))}function Fg(e,t){return $a(e,Ze(t,G))}var Ig=B(function(e,t){return function(n){return jn(n,e,t)}}),Rg=B(function(e,t){return function(n){return jn(e,n,t)}});function ws(e,t,n){var r=_e(t),s=Tr(t,r);n==null&&!(ce(t)&&(s.length||!r.length))&&(n=t,t=e,e=this,s=Tr(t,_e(t)));var u=!(ce(n)&&"chain"in n)||!!n.chain,l=wt(e);return ze(s,function(h){var d=t[h];e[h]=d,l&&(e.prototype[h]=function(){var w=this.__chain__;if(u||w){var y=e(this.__wrapped__),x=y.__actions__=Fe(this.__actions__);return x.push({func:d,args:arguments,thisArg:e}),y.__chain__=w,y}return d.apply(e,Mt([this.value()],arguments))})}),e}function Pg(){return we._===this&&(we._=nl),this}function ys(){}function Og(e){return e=D(e),B(function(t){return Ba(t,e)})}var Lg=Xi(oe),Mg=Xi(oa),Ng=Xi(Si);function su(e){return is(e)?Ai(lt(e)):ff(e)}function Ug(e){return function(t){return e==null?i:rn(e,t)}}var Wg=uo(),Dg=uo(!0);function xs(){return[]}function Ss(){return!1}function $g(){return{}}function Bg(){return""}function kg(){return!0}function jg(e,t){if(e=D(e),e<1||e>et)return[];var n=He,r=xe(e,He);t=R(t),e-=He;for(var s=Ci(r,t);++n<e;)t(n);return s}function qg(e){return U(e)?oe(e,lt):$e(e)?[e]:Fe(Eo(X(e)))}function Gg(e){var t=++el;return X(e)+t}var Hg=Lr(function(e,t){return e+t},0),Kg=Qi("ceil"),zg=Lr(function(e,t){return e/t},1),Jg=Qi("floor");function Yg(e){return e&&e.length?Cr(e,Pe,Wi):i}function Zg(e,t){return e&&e.length?Cr(e,R(t,2),Wi):i}function Xg(e){return la(e,Pe)}function Qg(e,t){return la(e,R(t,2))}function Vg(e){return e&&e.length?Cr(e,Pe,ki):i}function em(e,t){return e&&e.length?Cr(e,R(t,2),ki):i}var tm=Lr(function(e,t){return e*t},1),nm=Qi("round"),rm=Lr(function(e,t){return e-t},0);function im(e){return e&&e.length?Ei(e,Pe):0}function sm(e,t){return e&&e.length?Ei(e,R(t,2)):0}return o.after=Tp,o.ary=Uo,o.assign=dd,o.assignIn=Zo,o.assignInWith=Kr,o.assignWith=gd,o.at=md,o.before=Wo,o.bind=ls,o.bindAll=xg,o.bindKey=Do,o.castArray=$p,o.chain=Lo,o.chunk=Jf,o.compact=Yf,o.concat=Zf,o.cond=Sg,o.conforms=Ag,o.constant=vs,o.countBy=ip,o.create=vd,o.curry=$o,o.curryRight=Bo,o.debounce=ko,o.defaults=_d,o.defaultsDeep=wd,o.defer=Fp,o.delay=Ip,o.difference=Xf,o.differenceBy=Qf,o.differenceWith=Vf,o.drop=eh,o.dropRight=th,o.dropRightWhile=nh,o.dropWhile=rh,o.fill=ih,o.filter=ap,o.flatMap=cp,o.flatMapDeep=lp,o.flatMapDepth=fp,o.flatten=Io,o.flattenDeep=sh,o.flattenDepth=ah,o.flip=Rp,o.flow=Eg,o.flowRight=Cg,o.fromPairs=oh,o.functions=Cd,o.functionsIn=Td,o.groupBy=hp,o.initial=ch,o.intersection=lh,o.intersectionBy=fh,o.intersectionWith=hh,o.invert=Id,o.invertBy=Rd,o.invokeMap=dp,o.iteratee=_s,o.keyBy=gp,o.keys=_e,o.keysIn=Re,o.map=Br,o.mapKeys=Od,o.mapValues=Ld,o.matches=Tg,o.matchesProperty=Fg,o.memoize=jr,o.merge=Md,o.mergeWith=Xo,o.method=Ig,o.methodOf=Rg,o.mixin=ws,o.negate=qr,o.nthArg=Og,o.omit=Nd,o.omitBy=Ud,o.once=Pp,o.orderBy=mp,o.over=Lg,o.overArgs=Op,o.overEvery=Mg,o.overSome=Ng,o.partial=fs,o.partialRight=jo,o.partition=vp,o.pick=Wd,o.pickBy=Qo,o.property=su,o.propertyOf=Ug,o.pull=mh,o.pullAll=Po,o.pullAllBy=vh,o.pullAllWith=_h,o.pullAt=wh,o.range=Wg,o.rangeRight=Dg,o.rearg=Lp,o.reject=yp,o.remove=yh,o.rest=Mp,o.reverse=us,o.sampleSize=Sp,o.set=$d,o.setWith=Bd,o.shuffle=Ap,o.slice=xh,o.sortBy=Cp,o.sortedUniq=Fh,o.sortedUniqBy=Ih,o.split=cg,o.spread=Np,o.tail=Rh,o.take=Ph,o.takeRight=Oh,o.takeRightWhile=Lh,o.takeWhile=Mh,o.tap=Yh,o.throttle=Up,o.thru=$r,o.toArray=zo,o.toPairs=Vo,o.toPairsIn=eu,o.toPath=qg,o.toPlainObject=Yo,o.transform=kd,o.unary=Wp,o.union=Nh,o.unionBy=Uh,o.unionWith=Wh,o.uniq=Dh,o.uniqBy=$h,o.uniqWith=Bh,o.unset=jd,o.unzip=cs,o.unzipWith=Oo,o.update=qd,o.updateWith=Gd,o.values=Cn,o.valuesIn=Hd,o.without=kh,o.words=ru,o.wrap=Dp,o.xor=jh,o.xorBy=qh,o.xorWith=Gh,o.zip=Hh,o.zipObject=Kh,o.zipObjectDeep=zh,o.zipWith=Jh,o.entries=Vo,o.entriesIn=eu,o.extend=Zo,o.extendWith=Kr,ws(o,o),o.add=Hg,o.attempt=iu,o.camelCase=Yd,o.capitalize=tu,o.ceil=Kg,o.clamp=Kd,o.clone=Bp,o.cloneDeep=jp,o.cloneDeepWith=qp,o.cloneWith=kp,o.conformsTo=Gp,o.deburr=nu,o.defaultTo=bg,o.divide=zg,o.endsWith=Zd,o.eq=it,o.escape=Xd,o.escapeRegExp=Qd,o.every=sp,o.find=op,o.findIndex=To,o.findKey=yd,o.findLast=up,o.findLastIndex=Fo,o.findLastKey=xd,o.floor=Jg,o.forEach=Mo,o.forEachRight=No,o.forIn=Sd,o.forInRight=Ad,o.forOwn=bd,o.forOwnRight=Ed,o.get=ds,o.gt=Hp,o.gte=Kp,o.has=Fd,o.hasIn=gs,o.head=Ro,o.identity=Pe,o.includes=pp,o.indexOf=uh,o.inRange=zd,o.invoke=Pd,o.isArguments=on,o.isArray=U,o.isArrayBuffer=zp,o.isArrayLike=Ie,o.isArrayLikeObject=fe,o.isBoolean=Jp,o.isBuffer=kt,o.isDate=Yp,o.isElement=Zp,o.isEmpty=Xp,o.isEqual=Qp,o.isEqualWith=Vp,o.isError=hs,o.isFinite=ed,o.isFunction=wt,o.isInteger=qo,o.isLength=Gr,o.isMap=Go,o.isMatch=td,o.isMatchWith=nd,o.isNaN=rd,o.isNative=id,o.isNil=ad,o.isNull=sd,o.isNumber=Ho,o.isObject=ce,o.isObjectLike=le,o.isPlainObject=Jn,o.isRegExp=ps,o.isSafeInteger=od,o.isSet=Ko,o.isString=Hr,o.isSymbol=$e,o.isTypedArray=En,o.isUndefined=ud,o.isWeakMap=cd,o.isWeakSet=ld,o.join=ph,o.kebabCase=Vd,o.last=Qe,o.lastIndexOf=dh,o.lowerCase=eg,o.lowerFirst=tg,o.lt=fd,o.lte=hd,o.max=Yg,o.maxBy=Zg,o.mean=Xg,o.meanBy=Qg,o.min=Vg,o.minBy=em,o.stubArray=xs,o.stubFalse=Ss,o.stubObject=$g,o.stubString=Bg,o.stubTrue=kg,o.multiply=tm,o.nth=gh,o.noConflict=Pg,o.noop=ys,o.now=kr,o.pad=ng,o.padEnd=rg,o.padStart=ig,o.parseInt=sg,o.random=Jd,o.reduce=_p,o.reduceRight=wp,o.repeat=ag,o.replace=og,o.result=Dd,o.round=nm,o.runInContext=p,o.sample=xp,o.size=bp,o.snakeCase=ug,o.some=Ep,o.sortedIndex=Sh,o.sortedIndexBy=Ah,o.sortedIndexOf=bh,o.sortedLastIndex=Eh,o.sortedLastIndexBy=Ch,o.sortedLastIndexOf=Th,o.startCase=lg,o.startsWith=fg,o.subtract=rm,o.sum=im,o.sumBy=sm,o.template=hg,o.times=jg,o.toFinite=yt,o.toInteger=D,o.toLength=Jo,o.toLower=pg,o.toNumber=Ve,o.toSafeInteger=pd,o.toString=X,o.toUpper=dg,o.trim=gg,o.trimEnd=mg,o.trimStart=vg,o.truncate=_g,o.unescape=wg,o.uniqueId=Gg,o.upperCase=yg,o.upperFirst=ms,o.each=Mo,o.eachRight=No,o.first=Ro,ws(o,function(){var e={};return ut(o,function(t,n){Q.call(o.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),o.VERSION=f,ze(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),ze(["drop","take"],function(e,t){q.prototype[e]=function(n){n=n===i?1:me(D(n),0);var r=this.__filtered__&&!t?new q(this):this.clone();return r.__filtered__?r.__takeCount__=xe(n,r.__takeCount__):r.__views__.push({size:xe(n,He),type:e+(r.__dir__<0?"Right":"")}),r},q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),ze(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==Vn||n==tr;q.prototype[e]=function(s){var u=this.clone();return u.__iteratees__.push({iteratee:R(s,3),type:n}),u.__filtered__=u.__filtered__||r,u}}),ze(["head","last"],function(e,t){var n="take"+(t?"Right":"");q.prototype[e]=function(){return this[n](1).value()[0]}}),ze(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");q.prototype[e]=function(){return this.__filtered__?new q(this):this[n](1)}}),q.prototype.compact=function(){return this.filter(Pe)},q.prototype.find=function(e){return this.filter(e).head()},q.prototype.findLast=function(e){return this.reverse().find(e)},q.prototype.invokeMap=B(function(e,t){return typeof e=="function"?new q(this):this.map(function(n){return jn(n,e,t)})}),q.prototype.reject=function(e){return this.filter(qr(R(e)))},q.prototype.slice=function(e,t){e=D(e);var n=this;return n.__filtered__&&(e>0||t<0)?new q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(t=D(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},q.prototype.toArray=function(){return this.take(He)},ut(q.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),s=o[r?"take"+(t=="last"?"Right":""):t],u=r||/^find/.test(t);s&&(o.prototype[t]=function(){var l=this.__wrapped__,h=r?[1]:arguments,d=l instanceof q,w=h[0],y=d||U(l),x=function(j){var H=s.apply(o,Mt([j],h));return r&&E?H[0]:H};y&&n&&typeof w=="function"&&w.length!=1&&(d=y=!1);var E=this.__chain__,T=!!this.__actions__.length,L=u&&!E,$=d&&!T;if(!u&&y){l=$?l:new q(this);var M=e.apply(l,h);return M.__actions__.push({func:$r,args:[x],thisArg:i}),new Ye(M,E)}return L&&$?e.apply(this,h):(M=this.thru(x),L?r?M.value()[0]:M.value():M)})}),ze(["pop","push","shift","sort","splice","unshift"],function(e){var t=fr[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var s=arguments;if(r&&!this.__chain__){var u=this.value();return t.apply(U(u)?u:[],s)}return this[n](function(l){return t.apply(U(l)?l:[],s)})}}),ut(q.prototype,function(e,t){var n=o[t];if(n){var r=n.name+"";Q.call(yn,r)||(yn[r]=[]),yn[r].push({name:t,func:n})}}),yn[Or(i,Le).name]=[{name:"wrapper",func:i}],q.prototype.clone=_l,q.prototype.reverse=wl,q.prototype.value=yl,o.prototype.at=Zh,o.prototype.chain=Xh,o.prototype.commit=Qh,o.prototype.next=Vh,o.prototype.plant=tp,o.prototype.reverse=np,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=rp,o.prototype.first=o.prototype.head,Nn&&(o.prototype[Nn]=ep),o},vn=Xc();Qt?((Qt.exports=vn)._=vn,_i._=vn):we._=vn}).call(av)}(Xn,Xn.exports)),Xn.exports}var uv=ov();const Ts=c=>{const a=uv.startCase(c).toLowerCase();return a.charAt(0).toUpperCase()+a.slice(1)},cv=({data:c})=>`import { defineObject } from 'twenty-sdk';
448
+ `)+S+`return __p
449
+ }`;var j=Zo(function(){return Z(c,T+"return "+S).apply(r,f)});if(j.source=S,ns(j))throw j;return j}function Tg(e){return Q(e).toLowerCase()}function bg(e){return Q(e).toUpperCase()}function Cg(e,t,n){if(e=Q(e),e&&(n||t===r))return aa(e);if(!e||!(t=ke(t)))return e;var i=nt(e),a=nt(t),c=oa(i,a),f=la(i,a)+1;return Wt(i,c,f).join("")}function Pg(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ca(e)+1);if(!e||!(t=ke(t)))return e;var i=nt(e),a=la(i,nt(t))+1;return Wt(i,0,a).join("")}function Rg(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(ni,"");if(!e||!(t=ke(t)))return e;var i=nt(e),a=oa(i,nt(t));return Wt(i,a).join("")}function Og(e,t){var n=ws,i=xs;if(ae(t)){var a="separator"in t?t.separator:a;n="length"in t?W(t.length):n,i="omission"in t?ke(t.omission):i}e=Q(e);var c=e.length;if(tn(e)){var f=nt(e);c=f.length}if(n>=c)return e;var d=n-nn(i);if(d<1)return i;var g=f?Wt(f,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(f&&(d+=g.length-d),rs(a)){if(e.slice(d).search(a)){var w,x=g;for(a.global||(a=_i(a.source,Q(bs.exec(a))+"g")),a.lastIndex=0;w=a.exec(x);)var S=w.index;g=g.slice(0,S===r?d:S)}}else if(e.indexOf(ke(a),d)!=d){var I=g.lastIndexOf(a);I>-1&&(g=g.slice(0,I))}return g+i}function Lg(e){return e=Q(e),e&&ql.test(e)?e.replace(Fs,oc):e}var kg=cn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),as=Za("toUpperCase");function Xo(e,t,n){return e=Q(e),t=n?r:t,t===r?nc(e)?cc(e):zu(e):e.match(t)||[]}var Zo=q(function(e,t){try{return Oe(e,r,t)}catch(n){return ns(n)?n:new U(n)}}),Ng=wt(function(e,t){return qe(t,function(n){n=ft(n),yt(e,n,es(e[n],e))}),e});function Ug(e){var t=e==null?0:e.length,n=C();return e=t?se(e,function(i){if(typeof i[1]!="function")throw new He(v);return[n(i[0]),i[1]]}):[],q(function(i){for(var a=-1;++a<t;){var c=e[a];if(Oe(c[0],this,i))return Oe(c[1],this,i)}})}function Dg(e){return lf(Je(e,X))}function os(e){return function(){return e}}function Wg(e,t){return e==null||e!==e?t:e}var $g=eo(),Mg=eo(!0);function Ce(e){return e}function ls(e){return Pa(typeof e=="function"?e:Je(e,X))}function Bg(e){return Oa(Je(e,X))}function jg(e,t){return La(e,Je(t,X))}var qg=q(function(e,t){return function(n){return Nn(n,e,t)}}),Hg=q(function(e,t){return function(n){return Nn(e,n,t)}});function us(e,t,n){var i=he(t),a=wr(t,i);n==null&&!(ae(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=wr(t,he(t)));var c=!(ae(n)&&"chain"in n)||!!n.chain,f=St(e);return qe(a,function(d){var g=t[d];e[d]=g,f&&(e.prototype[d]=function(){var w=this.__chain__;if(c||w){var x=e(this.__wrapped__),S=x.__actions__=Ee(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),x.__chain__=w,x}return g.apply(e,Ot([this.value()],arguments))})}),e}function Gg(){return ge._===this&&(ge._=mc),this}function cs(){}function Jg(e){return e=W(e),q(function(t){return ka(t,e)})}var zg=Bi(se),Kg=Bi(ta),Vg=Bi(pi);function Qo(e){return Ki(e)?di(ft(e)):Ff(e)}function Yg(e){return function(t){return e==null?r:zt(e,t)}}var Xg=no(),Zg=no(!0);function fs(){return[]}function ps(){return!1}function Qg(){return{}}function em(){return""}function tm(){return!0}function nm(e,t){if(e=W(e),e<1||e>de)return[];var n=ve,i=ye(e,ve);t=C(t),e-=ve;for(var a=mi(i,t);++n<e;)t(n);return a}function rm(e){return D(e)?se(e,ft):Ne(e)?[e]:Ee(_o(Q(e)))}function im(e){var t=++hc;return Q(e)+t}var sm=Er(function(e,t){return e+t},0),am=ji("ceil"),om=Er(function(e,t){return e/t},1),lm=ji("floor");function um(e){return e&&e.length?_r(e,Ce,Ti):r}function cm(e,t){return e&&e.length?_r(e,C(t,2),Ti):r}function fm(e){return ia(e,Ce)}function pm(e,t){return ia(e,C(t,2))}function dm(e){return e&&e.length?_r(e,Ce,Ri):r}function hm(e,t){return e&&e.length?_r(e,C(t,2),Ri):r}var gm=Er(function(e,t){return e*t},1),mm=ji("round"),vm=Er(function(e,t){return e-t},0);function ym(e){return e&&e.length?gi(e,Ce):0}function _m(e,t){return e&&e.length?gi(e,C(t,2)):0}return u.after=Bd,u.ary=Po,u.assign=bh,u.assignIn=Ho,u.assignInWith=$r,u.assignWith=Ch,u.at=Ph,u.before=Ro,u.bind=es,u.bindAll=Ng,u.bindKey=Oo,u.castArray=Qd,u.chain=To,u.chunk=lp,u.compact=up,u.concat=cp,u.cond=Ug,u.conforms=Dg,u.constant=os,u.countBy=yd,u.create=Rh,u.curry=Lo,u.curryRight=ko,u.debounce=No,u.defaults=Oh,u.defaultsDeep=Lh,u.defer=jd,u.delay=qd,u.difference=fp,u.differenceBy=pp,u.differenceWith=dp,u.drop=hp,u.dropRight=gp,u.dropRightWhile=mp,u.dropWhile=vp,u.fill=yp,u.filter=wd,u.flatMap=Ad,u.flatMapDeep=Id,u.flatMapDepth=Fd,u.flatten=Ao,u.flattenDeep=_p,u.flattenDepth=wp,u.flip=Hd,u.flow=$g,u.flowRight=Mg,u.fromPairs=xp,u.functions=Mh,u.functionsIn=Bh,u.groupBy=Ed,u.initial=Ap,u.intersection=Ip,u.intersectionBy=Fp,u.intersectionWith=Ep,u.invert=qh,u.invertBy=Hh,u.invokeMap=bd,u.iteratee=ls,u.keyBy=Cd,u.keys=he,u.keysIn=be,u.map=Lr,u.mapKeys=Jh,u.mapValues=zh,u.matches=Bg,u.matchesProperty=jg,u.memoize=Nr,u.merge=Kh,u.mergeWith=Go,u.method=qg,u.methodOf=Hg,u.mixin=us,u.negate=Ur,u.nthArg=Jg,u.omit=Vh,u.omitBy=Yh,u.once=Gd,u.orderBy=Pd,u.over=zg,u.overArgs=Jd,u.overEvery=Kg,u.overSome=Vg,u.partial=ts,u.partialRight=Uo,u.partition=Rd,u.pick=Xh,u.pickBy=Jo,u.property=Qo,u.propertyOf=Yg,u.pull=Pp,u.pullAll=Fo,u.pullAllBy=Rp,u.pullAllWith=Op,u.pullAt=Lp,u.range=Xg,u.rangeRight=Zg,u.rearg=zd,u.reject=kd,u.remove=kp,u.rest=Kd,u.reverse=Zi,u.sampleSize=Ud,u.set=Qh,u.setWith=eg,u.shuffle=Dd,u.slice=Np,u.sortBy=Md,u.sortedUniq=jp,u.sortedUniqBy=qp,u.split=Ag,u.spread=Vd,u.tail=Hp,u.take=Gp,u.takeRight=Jp,u.takeRightWhile=zp,u.takeWhile=Kp,u.tap=ud,u.throttle=Yd,u.thru=Or,u.toArray=Bo,u.toPairs=zo,u.toPairsIn=Ko,u.toPath=rm,u.toPlainObject=qo,u.transform=tg,u.unary=Xd,u.union=Vp,u.unionBy=Yp,u.unionWith=Xp,u.uniq=Zp,u.uniqBy=Qp,u.uniqWith=ed,u.unset=ng,u.unzip=Qi,u.unzipWith=Eo,u.update=rg,u.updateWith=ig,u.values=dn,u.valuesIn=sg,u.without=td,u.words=Xo,u.wrap=Zd,u.xor=nd,u.xorBy=rd,u.xorWith=id,u.zip=sd,u.zipObject=ad,u.zipObjectDeep=od,u.zipWith=ld,u.entries=zo,u.entriesIn=Ko,u.extend=Ho,u.extendWith=$r,us(u,u),u.add=sm,u.attempt=Zo,u.camelCase=ug,u.capitalize=Vo,u.ceil=am,u.clamp=ag,u.clone=eh,u.cloneDeep=nh,u.cloneDeepWith=rh,u.cloneWith=th,u.conformsTo=ih,u.deburr=Yo,u.defaultTo=Wg,u.divide=om,u.endsWith=cg,u.eq=it,u.escape=fg,u.escapeRegExp=pg,u.every=_d,u.find=xd,u.findIndex=xo,u.findKey=kh,u.findLast=Sd,u.findLastIndex=So,u.findLastKey=Nh,u.floor=lm,u.forEach=bo,u.forEachRight=Co,u.forIn=Uh,u.forInRight=Dh,u.forOwn=Wh,u.forOwnRight=$h,u.get=is,u.gt=sh,u.gte=ah,u.has=jh,u.hasIn=ss,u.head=Io,u.identity=Ce,u.includes=Td,u.indexOf=Sp,u.inRange=og,u.invoke=Gh,u.isArguments=Yt,u.isArray=D,u.isArrayBuffer=oh,u.isArrayLike=Te,u.isArrayLikeObject=ue,u.isBoolean=lh,u.isBuffer=$t,u.isDate=uh,u.isElement=ch,u.isEmpty=fh,u.isEqual=ph,u.isEqualWith=dh,u.isError=ns,u.isFinite=hh,u.isFunction=St,u.isInteger=Do,u.isLength=Dr,u.isMap=Wo,u.isMatch=gh,u.isMatchWith=mh,u.isNaN=vh,u.isNative=yh,u.isNil=wh,u.isNull=_h,u.isNumber=$o,u.isObject=ae,u.isObjectLike=oe,u.isPlainObject=Bn,u.isRegExp=rs,u.isSafeInteger=xh,u.isSet=Mo,u.isString=Wr,u.isSymbol=Ne,u.isTypedArray=pn,u.isUndefined=Sh,u.isWeakMap=Ah,u.isWeakSet=Ih,u.join=Tp,u.kebabCase=dg,u.last=Ke,u.lastIndexOf=bp,u.lowerCase=hg,u.lowerFirst=gg,u.lt=Fh,u.lte=Eh,u.max=um,u.maxBy=cm,u.mean=fm,u.meanBy=pm,u.min=dm,u.minBy=hm,u.stubArray=fs,u.stubFalse=ps,u.stubObject=Qg,u.stubString=em,u.stubTrue=tm,u.multiply=gm,u.nth=Cp,u.noConflict=Gg,u.noop=cs,u.now=kr,u.pad=mg,u.padEnd=vg,u.padStart=yg,u.parseInt=_g,u.random=lg,u.reduce=Od,u.reduceRight=Ld,u.repeat=wg,u.replace=xg,u.result=Zh,u.round=mm,u.runInContext=h,u.sample=Nd,u.size=Wd,u.snakeCase=Sg,u.some=$d,u.sortedIndex=Up,u.sortedIndexBy=Dp,u.sortedIndexOf=Wp,u.sortedLastIndex=$p,u.sortedLastIndexBy=Mp,u.sortedLastIndexOf=Bp,u.startCase=Ig,u.startsWith=Fg,u.subtract=vm,u.sum=ym,u.sumBy=_m,u.template=Eg,u.times=nm,u.toFinite=At,u.toInteger=W,u.toLength=jo,u.toLower=Tg,u.toNumber=Ve,u.toSafeInteger=Th,u.toString=Q,u.toUpper=bg,u.trim=Cg,u.trimEnd=Pg,u.trimStart=Rg,u.truncate=Og,u.unescape=Lg,u.uniqueId=im,u.upperCase=kg,u.upperFirst=as,u.each=bo,u.eachRight=Co,u.first=Io,us(u,function(){var e={};return ut(u,function(t,n){ee.call(u.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),u.VERSION=l,qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){u[e].placeholder=u}),qe(["drop","take"],function(e,t){J.prototype[e]=function(n){n=n===r?1:pe(W(n),0);var i=this.__filtered__&&!t?new J(this):this.clone();return i.__filtered__?i.__takeCount__=ye(n,i.__takeCount__):i.__views__.push({size:ye(n,ve),type:e+(i.__dir__<0?"Right":"")}),i},J.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),qe(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==Pe||n==Ss;J.prototype[e]=function(a){var c=this.clone();return c.__iteratees__.push({iteratee:C(a,3),type:n}),c.__filtered__=c.__filtered__||i,c}}),qe(["head","last"],function(e,t){var n="take"+(t?"Right":"");J.prototype[e]=function(){return this[n](1).value()[0]}}),qe(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");J.prototype[e]=function(){return this.__filtered__?new J(this):this[n](1)}}),J.prototype.compact=function(){return this.filter(Ce)},J.prototype.find=function(e){return this.filter(e).head()},J.prototype.findLast=function(e){return this.reverse().find(e)},J.prototype.invokeMap=q(function(e,t){return typeof e=="function"?new J(this):this.map(function(n){return Nn(n,e,t)})}),J.prototype.reject=function(e){return this.filter(Ur(C(e)))},J.prototype.slice=function(e,t){e=W(e);var n=this;return n.__filtered__&&(e>0||t<0)?new J(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=W(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},J.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},J.prototype.toArray=function(){return this.take(ve)},ut(J.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=u[i?"take"+(t=="last"?"Right":""):t],c=i||/^find/.test(t);a&&(u.prototype[t]=function(){var f=this.__wrapped__,d=i?[1]:arguments,g=f instanceof J,w=d[0],x=g||D(f),S=function(G){var z=a.apply(u,Ot([G],d));return i&&I?z[0]:z};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var I=this.__chain__,T=!!this.__actions__.length,R=c&&!I,j=g&&!T;if(!c&&x){f=j?f:new J(this);var O=e.apply(f,d);return O.__actions__.push({func:Or,args:[S],thisArg:r}),new Ge(O,I)}return R&&j?e.apply(this,d):(O=this.thru(S),R?i?O.value()[0]:O.value():O)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var t=ir[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var c=this.value();return t.apply(D(c)?c:[],a)}return this[n](function(f){return t.apply(D(f)?f:[],a)})}}),ut(J.prototype,function(e,t){var n=u[t];if(n){var i=n.name+"";ee.call(on,i)||(on[i]=[]),on[i].push({name:t,func:n})}}),on[Fr(r,dt).name]=[{name:"wrapper",func:r}],J.prototype.clone=Oc,J.prototype.reverse=Lc,J.prototype.value=kc,u.prototype.at=cd,u.prototype.chain=fd,u.prototype.commit=pd,u.prototype.next=dd,u.prototype.plant=gd,u.prototype.reverse=md,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vd,u.prototype.first=u.prototype.head,bn&&(u.prototype[bn]=hd),u},rn=fc();jt?((jt.exports=rn)._=rn,li._=rn):ge._=rn}).call(Uy)}(Hn,Hn.exports)),Hn.exports}var Wy=Dy();const hs=o=>{const s=Wy.startCase(o).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},$y=({data:o,universalIdentifier:s=We.v4()})=>`import { defineObject } from 'twenty-sdk';
229
450
 
230
451
  export default defineObject({
231
- universalIdentifier: '${Qn.v4()}',
232
- nameSingular: '${c.nameSingular}',
233
- namePlural: '${c.namePlural}',
234
- labelSingular: '${c.labelSingular}',
235
- labelPlural: '${c.labelPlural}',
452
+ universalIdentifier: '${s}',
453
+ nameSingular: '${o.nameSingular}',
454
+ namePlural: '${o.namePlural}',
455
+ labelSingular: '${o.labelSingular}',
456
+ labelPlural: '${o.labelPlural}',
236
457
  icon: 'IconBox',
237
458
  fields: [
238
459
  // Add your fields here using defineField helper
@@ -245,28 +466,78 @@ export default defineObject({
245
466
  // },
246
467
  ],
247
468
  });
248
- `,lv=({name:c,universalIdentifier:a=Qn.v4()})=>{const i=In(c);return`import { defineRole } from 'twenty-sdk';
469
+ `,My=({name:o})=>`import { definePageLayout } from 'twenty-sdk';
249
470
 
250
- export const ${i.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
251
- '${a}';
471
+ export default definePageLayout({
472
+ universalIdentifier: '${We.v4()}',
473
+ name: '${o}',
474
+ tabs: [
475
+ {
476
+ universalIdentifier: '${We.v4()}',
477
+ title: 'Overview',
478
+ widgets: [],
479
+ },
480
+ ],
481
+ });
482
+ `,By=({name:o,universalIdentifier:s=We.v4()})=>{const r=Ze.default(o);return`import { defineRole } from 'twenty-sdk';
483
+
484
+ export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
485
+ '${s}';
252
486
 
253
487
  export default defineRole({
254
- universalIdentifier: ${i.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER,
255
- label: '${c}',
488
+ universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER,
489
+ label: '${o}',
256
490
  description: 'Add a description for your role',
257
491
  canReadAllObjectRecords: true,
258
492
  canUpdateAllObjectRecords: true,
259
493
  canSoftDeleteAllObjectRecords: true,
260
494
  canDestroyAllObjectRecords: false,
261
495
  });
262
- `},fv=({data:c})=>{const a=Qn.v4(),i=c.description?`
263
- description: '${c.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
496
+ `},jy=({name:o,universalIdentifier:s=We.v4()})=>{const r=Ze.default(o);return`import { defineSkill } from 'twenty-sdk';
497
+
498
+ export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
499
+ '${s}';
500
+
501
+ export default defineSkill({
502
+ universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER,
503
+ name: '${r}',
504
+ label: '${o}',
505
+ description: 'Add a description for your skill',
506
+ content: 'Add the skill content here',
507
+ });
508
+ `},cl=({name:o,universalIdentifier:s=We.v4(),objectUniversalIdentifier:r="fill-later"})=>{const l=Ze.default(o);return`import { defineView } from 'twenty-sdk';
509
+
510
+ export default defineView({
511
+ universalIdentifier: '${s}',
512
+ name: '${l}',
513
+ objectUniversalIdentifier: '${r}',
514
+ icon: 'IconList',
515
+ position: 0,
516
+ // fields: [
517
+ // {
518
+ // universalIdentifier: '...',
519
+ // fieldMetadataUniversalIdentifier: '...',
520
+ // position: 0,
521
+ // isVisible: true,
522
+ // },
523
+ // ],
524
+ // filters: [
525
+ // {
526
+ // universalIdentifier: '...',
527
+ // fieldMetadataUniversalIdentifier: '...',
528
+ // operand: 'Contains',
529
+ // value: '',
530
+ // },
531
+ // ],
532
+ });
533
+ `},qy=({data:o})=>{const s=We.v4(),r=o.description?`
534
+ description: '${o.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
264
535
 
265
536
  export default defineField({
266
- universalIdentifier: '${a}',
267
- name: '${c.name}',
268
- label: '${c.label}',
269
- type: FieldMetadataType.${c.type},
270
- objectUniversalIdentifier: '${c.objectUniversalIdentifier}',${i}
537
+ universalIdentifier: '${s}',
538
+ name: '${o.name}',
539
+ label: '${o.label}',
540
+ type: FieldMetadataType.${o.type},
541
+ objectUniversalIdentifier: '${o.objectUniversalIdentifier}',${r}
271
542
  });
272
- `},hv="src";class pv{async execute(a,i){try{const f=a??await this.getEntity(),g=this.getFolderName(f),_=i?ie.join(Et,i):ie.join(Et,hv,g);await V.ensureDir(_);const{name:S,file:A}=await this.getEntityData(f),I=ie.join(_,this.getFileName(S,f));if(await V.pathExists(I)){const{overwrite:P}=await this.handleFileExist();if(!P)return}await V.writeFile(I,A),console.log(b.default.green(`✓ Created ${g}:`),b.default.cyan(ie.relative(Et,I)))}catch(f){console.error(b.default.red("Add new entity failed:"),f instanceof Error?f.message:f),process.exit(1)}}async getEntityData(a){switch(a){case ve.Object:{const i=await this.getObjectData(),f=i.nameSingular,g=cv({data:i});return{name:f,file:g}}case ve.Field:{const i=await this.getFieldData(),f=i.name,g=fv({data:i});return{name:f,file:g}}case ve.LogicFunction:{const i=await this.getEntityName(a),f=sv({name:i});return{name:i,file:f}}case ve.FrontComponent:{const i=await this.getEntityName(a),f=iv({name:i});return{name:i,file:f}}case ve.Role:{const i=await this.getEntityName(a),f=lv({name:i});return{name:i,file:f}}default:je.ln()}}async getEntity(){const{entity:a}=await At.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(ve)}]);return a}async handleFileExist(){return await At.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(a){const{name:i}=await At.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${a}:`,default:"",validate:f=>f.length===0?`${a} name is required`:!0}]);return i}async getFieldData(){return At.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:a=>Ts(a.name),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(je.s),default:je.s.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return At.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(a,i)=>a.trim()===i?.nameSingular.trim()?"Name plural must be different from name singular":!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:a=>Ts(a.nameSingular),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:a=>Ts(a.namePlural),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(a){return`${In(a)}s`}getFileName(a,i){switch(i){case ve.FrontComponent:return`${In(a)}.tsx`;default:return`${In(a)}.ts`}}}const dv=c=>{const a=new Y0,i=new Z0,f=new X0,g=new Q0,_=new tv;c.command("auth:login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async K=>{await i.execute(K)}),c.command("auth:logout").description("Remove authentication credentials").action(async()=>{await f.execute()}),c.command("auth:status").description("Check authentication status").action(async()=>{await g.execute()}),c.command("auth:switch [workspace]").description("Switch the default workspace for authentication").action(async K=>{await _.execute({workspace:K})}),c.command("auth:list").description("List all configured workspaces").action(async()=>{await a.execute()});const S=new G0,A=new J0,I=new pv,P=new z0,J=new ev,G=new V0;c.command("app:dev [appPath]").description("Watch and sync local application changes").action(async K=>{await S.execute({appPath:Yn(K)})}),c.command("app:uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(K,k)=>{try{const ue=await A.execute({appPath:Yn(K),askForConfirmation:!k?.yes});process.exit(ue.success?0:1)}catch{process.exit(1)}}),c.command("entity:add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(ve).join("|")})`).action(async(K,k)=>{await I.execute(K,k?.path)}),c.command("app:generate [appPath]").description("Generate Twenty client").action(async K=>{await P.execute(Yn(K))}),c.command("function:logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(K,k)=>{await J.execute({...k,appPath:Yn(K)})}),c.command("function:execute [appPath]").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").description("Execute a logic function with a JSON payload").action(async(K,k)=>{!k?.functionUniversalIdentifier&&!k?.functionName&&(console.error(b.default.red("Error: Either --functionName (-n) or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await G.execute({...k,payload:k?.payload??"{}",appPath:Yn(K)})})},gv="0.5.2",mv={version:gv};Fm.inspect.defaultOptions.depth=10;const Pn=new vu.Command;Pn.name("twenty").description("CLI for Twenty application development").version(mv.version);Pn.option("--workspace <name>","Use a specific workspace configuration (overrides the default set by auth:switch)");Pn.hook("preAction",async c=>{let i=(c.optsWithGlobals?c.optsWithGlobals():c.opts()).workspace;i||(i=await new Ae().getDefaultWorkspace()),Ae.setActiveWorkspace(i),console.log(b.default.gray(`👩‍💻 Workspace - ${Ae.getActiveWorkspace()}`))});dv(Pn);Pn.exitOverride();try{Pn.parse()}catch(c){c instanceof vu.CommanderError&&process.exit(c.exitCode),c instanceof Error&&(console.error(b.default.red("Error:"),c.message),process.exit(1))}
543
+ `},gs="src";class Hy{async execute(s,r){try{const l=s??await this.getEntity(),p=this.getFolderName(l),m=r?$.join(Ie,r):$.join(Ie,gs,p);await k.ensureDir(m);const{name:v,file:E}=await this.getEntityData(l),b=$.join(m,this.getFileName(v,l));if(await k.pathExists(b)){const{overwrite:M}=await this.handleFileExist();if(!M)return}await k.writeFile(b,E),console.log(A.default.green(`✓ Created ${p}:`),A.default.cyan($.relative(Ie,b))),l===K.Object&&await this.promptAndCreateViewAndNavigationMenuItem(v,r)}catch(l){console.error(A.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(s){switch(s){case K.Object:{const r=await this.getObjectData(),l=r.nameSingular,p=We.v4();this.lastObjectUniversalIdentifier=p;const m=$y({data:r,universalIdentifier:p});return{name:l,file:m}}case K.Field:{const r=await this.getFieldData(),l=r.name,p=qy({data:r});return{name:l,file:p}}case K.LogicFunction:{const r=await this.getEntityName(s),l=Ny({name:r});return{name:r,file:l}}case K.FrontComponent:{const r=await this.getEntityName(s),l=ky({name:r});return{name:r,file:l}}case K.Role:{const r=await this.getEntityName(s),l=By({name:r});return{name:r,file:l}}case K.Skill:{const r=await this.getEntityName(s),l=jy({name:r});return{name:r,file:l}}case K.View:{const l=(await this.getViewData()).name,p=cl({name:l});return{name:l,file:p}}case K.NavigationMenuItem:{const r=await this.getEntityName(s),l=ll({name:r});return{name:r,file:l}}case K.PageLayout:{const r=await this.getEntityName(s),l=My({name:r});return{name:r,file:l}}default:P.dt()}}async promptAndCreateViewAndNavigationMenuItem(s,r){const{createViewAndNavItem:l}=await ot.default.prompt([{type:"confirm",name:"createViewAndNavItem",message:"Also create a view and navigation menu item for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const p=We.v4(),m=cl({name:`all-${Ze.default(s)}`,universalIdentifier:p,objectUniversalIdentifier:this.lastObjectUniversalIdentifier}),v=r?$.join(Ie,r):$.join(Ie,gs,this.getFolderName(K.View));await k.ensureDir(v);const E=`all-${Ze.default(s)}.ts`,b=$.join(v,E);if(await k.pathExists(b)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await k.writeFile(b,m),console.log(A.default.green("✓ Created view:"),A.default.cyan($.relative(Ie,b)));const M=ll({name:s,viewUniversalIdentifier:p}),H=r?$.join(Ie,r):$.join(Ie,gs,this.getFolderName(K.NavigationMenuItem));await k.ensureDir(H);const X=`${Ze.default(s)}.ts`,N=$.join(H,X);if(await k.pathExists(N)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await k.writeFile(N,M),console.log(A.default.green("✓ Created navigation menu item:"),A.default.cyan($.relative(Ie,N)))}async getEntity(){const{entity:s}=await ot.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(K)}]);return s}async handleFileExist(){return await ot.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(s){const{name:r}=await ot.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${s}:`,default:"",validate:l=>l.length===0?`${s} name is required`:!0}]);return r}async getFieldData(){return ot.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:s=>hs(s.name),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(P.R),default:P.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return ot.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(s,r)=>s.trim()===r?.nameSingular.trim()?"Name plural must be different from name singular":!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:s=>hs(s.nameSingular),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:s=>hs(s.namePlural),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return ot.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this view belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(s){return`${Ze.default(s)}s`}getFileName(s,r){switch(r){case K.FrontComponent:return`${Ze.default(s)}.tsx`;default:return`${Ze.default(s)}.ts`}}}const Gy=o=>{const s=new Ty,r=new by,l=new Cy,p=new Py,m=new Ly;o.command("auth:login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async N=>{await r.execute(N)}),o.command("auth:logout").description("Remove authentication credentials").action(async()=>{await l.execute()}),o.command("auth:status").description("Check authentication status").action(async()=>{await p.execute()}),o.command("auth:switch [workspace]").description("Switch the default workspace for authentication").action(async N=>{await m.execute({workspace:N})}),o.command("auth:list").description("List all configured workspaces").action(async()=>{await s.execute()});const v=new Ay,E=new Fy,b=new Ey,M=new Hy,H=new Oy,X=new Ry;o.command("app:dev [appPath]").description("Watch and sync local application changes").action(async N=>{await v.execute({appPath:jn(N)})}),o.command("app:typecheck [appPath]").description("Run TypeScript type checking on the application").action(async N=>{await E.execute({appPath:jn(N)})}),o.command("app:uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(N,V)=>{try{const ie=await b.execute({appPath:jn(N),askForConfirmation:!V?.yes});process.exit(ie.success?0:1)}catch{process.exit(1)}}),o.command("entity:add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(K).join("|")})`).action(async(N,V)=>{await M.execute(N,V?.path)}),o.command("function:logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(N,V)=>{await H.execute({...V,appPath:jn(N)})}),o.command("function:execute [appPath]").option("--postInstall","Execute post-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").description("Execute a logic function with a JSON payload").action(async(N,V)=>{!V?.postInstall&&!V?.functionUniversalIdentifier&&!V?.functionName&&(console.error(A.default.red("Error: Either --postInstall or --functionName (-n) or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await X.execute({...V,payload:V?.payload??"{}",appPath:jn(N)})})},Jy="0.6.0",zy={version:Jy};qm.inspect.defaultOptions.depth=10;const mn=new hl.Command;mn.name("twenty").description("CLI for Twenty application development").version(zy.version);mn.option("--workspace <name>","Use a specific workspace configuration (overrides the default set by auth:switch)");mn.hook("preAction",async o=>{let r=(o.optsWithGlobals?o.optsWithGlobals():o.opts()).workspace;r||(r=await new we().getDefaultWorkspace()),we.setActiveWorkspace(r),console.log(A.default.gray(`👩‍💻 Workspace - ${we.getActiveWorkspace()}`))});Gy(mn);mn.exitOverride();try{mn.parse()}catch(o){o instanceof hl.CommanderError&&process.exit(o.exitCode),o instanceof Error&&(console.error(A.default.red("Error:"),o.message),process.exit(1))}