@bigbinary/neeto-molecules 3.15.43 → 3.15.44

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 (426) hide show
  1. package/dist/AuditLogs.js +539 -0
  2. package/dist/AuditLogs.js.map +1 -0
  3. package/dist/BoardView.js +394 -0
  4. package/dist/BoardView.js.map +1 -0
  5. package/dist/Breadcrumbs.js +46 -0
  6. package/dist/Breadcrumbs.js.map +1 -0
  7. package/dist/BrowserPreview.js +50 -0
  8. package/dist/BrowserPreview.js.map +1 -0
  9. package/dist/BrowserSupport.js +348 -0
  10. package/dist/BrowserSupport.js.map +1 -0
  11. package/dist/Builder.js +786 -0
  12. package/dist/Builder.js.map +1 -0
  13. package/dist/ButtonGroup.js +36 -0
  14. package/dist/ButtonGroup.js.map +1 -0
  15. package/dist/CalendarView.js +353 -0
  16. package/dist/CalendarView.js.map +1 -0
  17. package/dist/CardLayout.js +49 -0
  18. package/dist/CardLayout.js.map +1 -0
  19. package/dist/Chevron-6dLkaXtR.js +246 -0
  20. package/dist/Chevron-6dLkaXtR.js.map +1 -0
  21. package/dist/Codeblock.js +58 -0
  22. package/dist/Codeblock.js.map +1 -0
  23. package/dist/Columns.js +21 -0
  24. package/dist/Columns.js.map +1 -0
  25. package/dist/ConfigurePageSidebar.js +97 -0
  26. package/dist/ConfigurePageSidebar.js.map +1 -0
  27. package/dist/ConfirmationModal.js +110 -0
  28. package/dist/ConfirmationModal.js.map +1 -0
  29. package/dist/Container.js +38 -0
  30. package/dist/Container.js.map +1 -0
  31. package/dist/CopyToClipboardButton.js +82 -0
  32. package/dist/CopyToClipboardButton.js.map +1 -0
  33. package/dist/Currency.js +917 -0
  34. package/dist/Currency.js.map +1 -0
  35. package/dist/DateFormat.js +45 -0
  36. package/dist/DateFormat.js.map +1 -0
  37. package/dist/DateRangeFilter.js +178 -0
  38. package/dist/DateRangeFilter.js.map +1 -0
  39. package/dist/DeleteArchiveModal.js +98 -0
  40. package/dist/DeleteArchiveModal.js.map +1 -0
  41. package/dist/DeviceIncompatibilityMessage.js +95 -0
  42. package/dist/DeviceIncompatibilityMessage.js.map +1 -0
  43. package/dist/DocumentEditor.js +183 -0
  44. package/dist/DocumentEditor.js.map +1 -0
  45. package/dist/DownloadMobileAppCallout.js +40 -0
  46. package/dist/DownloadMobileAppCallout.js.map +1 -0
  47. package/dist/DynamicVariables.js +115 -0
  48. package/dist/DynamicVariables.js.map +1 -0
  49. package/dist/EmailForm.js +567 -0
  50. package/dist/EmailForm.js.map +1 -0
  51. package/dist/EmailPreview.js +140 -0
  52. package/dist/EmailPreview.js.map +1 -0
  53. package/dist/EmojiPicker.js +112 -0
  54. package/dist/EmojiPicker.js.map +1 -0
  55. package/dist/EmojiReactions.js +82 -0
  56. package/dist/EmojiReactions.js.map +1 -0
  57. package/dist/Engagements.js +292 -0
  58. package/dist/Engagements.js.map +1 -0
  59. package/dist/ErrorPage.js +1811 -0
  60. package/dist/ErrorPage.js.map +1 -0
  61. package/dist/FileUpload.js +595 -0
  62. package/dist/FileUpload.js.map +1 -0
  63. package/dist/FinderModal.js +280 -0
  64. package/dist/FinderModal.js.map +1 -0
  65. package/dist/FloatingActionMenu.js +854 -0
  66. package/dist/FloatingActionMenu.js.map +1 -0
  67. package/dist/GoogleFontPicker.js +581 -0
  68. package/dist/GoogleFontPicker.js.map +1 -0
  69. package/dist/Header.js +126 -0
  70. package/dist/Header.js.map +1 -0
  71. package/dist/HelpPopover.js +83 -0
  72. package/dist/HelpPopover.js.map +1 -0
  73. package/dist/IconPicker.js +1159 -0
  74. package/dist/IconPicker.js.map +1 -0
  75. package/dist/ImageWithFallback.js +49 -0
  76. package/dist/ImageWithFallback.js.map +1 -0
  77. package/dist/InlineInput.js +230 -0
  78. package/dist/InlineInput.js.map +1 -0
  79. package/dist/Insights.js +358 -0
  80. package/dist/Insights.js.map +1 -0
  81. package/dist/IntegrationCard.js +227 -0
  82. package/dist/IntegrationCard.js.map +1 -0
  83. package/dist/IpRestriction.js +3617 -0
  84. package/dist/IpRestriction.js.map +1 -0
  85. package/dist/KeyboardShortcuts.js +284 -0
  86. package/dist/KeyboardShortcuts.js.map +1 -0
  87. package/dist/LoginPage.js +184 -0
  88. package/dist/LoginPage.js.map +1 -0
  89. package/dist/MadeWith.js +41 -0
  90. package/dist/MadeWith.js.map +1 -0
  91. package/dist/MenuBar.js +1326 -0
  92. package/dist/MenuBar.js.map +1 -0
  93. package/dist/Metadata.js +218 -0
  94. package/dist/Metadata.js.map +1 -0
  95. package/dist/MobilePreviewHeader.js +25 -0
  96. package/dist/MobilePreviewHeader.js.map +1 -0
  97. package/dist/MoreDropdown.js +163 -0
  98. package/dist/MoreDropdown.js.map +1 -0
  99. package/dist/NavigationHeader.js +264 -0
  100. package/dist/NavigationHeader.js.map +1 -0
  101. package/dist/NeetoWidget.js +2867 -0
  102. package/dist/NeetoWidget.js.map +1 -0
  103. package/dist/Onboarding.js +246 -0
  104. package/dist/Onboarding.js.map +1 -0
  105. package/dist/OptionFields.js +717 -0
  106. package/dist/OptionFields.js.map +1 -0
  107. package/dist/PageLoader.js +40 -0
  108. package/dist/PageLoader.js.map +1 -0
  109. package/dist/PhoneNumber.js +75 -0
  110. package/dist/PhoneNumber.js.map +1 -0
  111. package/dist/ProductEmbed.js +884 -0
  112. package/dist/ProductEmbed.js.map +1 -0
  113. package/dist/PublishBlock.js +447 -0
  114. package/dist/PublishBlock.js.map +1 -0
  115. package/dist/PublishYourItem.js +58 -0
  116. package/dist/PublishYourItem.js.map +1 -0
  117. package/dist/Rename.js +366 -0
  118. package/dist/Rename.js.map +1 -0
  119. package/dist/ResponsiveDevicePicker.js +63 -0
  120. package/dist/ResponsiveDevicePicker.js.map +1 -0
  121. package/dist/Schedule.js +926 -0
  122. package/dist/Schedule.js.map +1 -0
  123. package/dist/Scrollable.js +42 -0
  124. package/dist/Scrollable.js.map +1 -0
  125. package/dist/Search.js +110 -0
  126. package/dist/Search.js.map +1 -0
  127. package/dist/SendToFields.js +2221 -0
  128. package/dist/SendToFields.js.map +1 -0
  129. package/dist/SessionEnvironment.js +431 -0
  130. package/dist/SessionEnvironment.js.map +1 -0
  131. package/dist/Settings.js +250 -0
  132. package/dist/Settings.js.map +1 -0
  133. package/dist/ShareRecordingPane.js +216 -0
  134. package/dist/ShareRecordingPane.js.map +1 -0
  135. package/dist/ShareViaEmail.js +416 -0
  136. package/dist/ShareViaEmail.js.map +1 -0
  137. package/dist/ShareViaLink.js +1556 -0
  138. package/dist/ShareViaLink.js.map +1 -0
  139. package/dist/Sidebar.js +294 -0
  140. package/dist/Sidebar.js.map +1 -0
  141. package/dist/StatusDropdown.js +109 -0
  142. package/dist/StatusDropdown.js.map +1 -0
  143. package/dist/StickyRibbonsContainer.js +131 -0
  144. package/dist/StickyRibbonsContainer.js.map +1 -0
  145. package/dist/SubHeader.js +209 -0
  146. package/dist/SubHeader.js.map +1 -0
  147. package/dist/SubscriptionNotificationsContainer.js +77 -0
  148. package/dist/SubscriptionNotificationsContainer.js.map +1 -0
  149. package/dist/SuffixedInput.js +111 -0
  150. package/dist/SuffixedInput.js.map +1 -0
  151. package/dist/TableWrapper.js +27 -0
  152. package/dist/TableWrapper.js.map +1 -0
  153. package/dist/Taxonomy.js +496 -0
  154. package/dist/Taxonomy.js.map +1 -0
  155. package/dist/TimeFormat.js +14 -0
  156. package/dist/TimeFormat.js.map +1 -0
  157. package/dist/TimezoneMismatchModal.js +138 -0
  158. package/dist/TimezoneMismatchModal.js.map +1 -0
  159. package/dist/ToggleFeatureCard.js +211 -0
  160. package/dist/ToggleFeatureCard.js.map +1 -0
  161. package/dist/_commonjsHelpers-BFTU3MAI.js +8 -0
  162. package/dist/_commonjsHelpers-BFTU3MAI.js.map +1 -0
  163. package/dist/cjs/AuditLogs.js +541 -0
  164. package/dist/cjs/AuditLogs.js.map +1 -0
  165. package/dist/cjs/BoardView.js +396 -0
  166. package/dist/cjs/BoardView.js.map +1 -0
  167. package/dist/cjs/Breadcrumbs.js +48 -0
  168. package/dist/cjs/Breadcrumbs.js.map +1 -0
  169. package/dist/cjs/BrowserPreview.js +52 -0
  170. package/dist/cjs/BrowserPreview.js.map +1 -0
  171. package/dist/cjs/BrowserSupport.js +350 -0
  172. package/dist/cjs/BrowserSupport.js.map +1 -0
  173. package/dist/cjs/Builder.js +794 -0
  174. package/dist/cjs/Builder.js.map +1 -0
  175. package/dist/cjs/ButtonGroup.js +38 -0
  176. package/dist/cjs/ButtonGroup.js.map +1 -0
  177. package/dist/cjs/CalendarView.js +355 -0
  178. package/dist/cjs/CalendarView.js.map +1 -0
  179. package/dist/cjs/CardLayout.js +51 -0
  180. package/dist/cjs/CardLayout.js.map +1 -0
  181. package/dist/cjs/Chevron-wfVdaB4-.js +256 -0
  182. package/dist/cjs/Chevron-wfVdaB4-.js.map +1 -0
  183. package/dist/cjs/Codeblock.js +60 -0
  184. package/dist/cjs/Codeblock.js.map +1 -0
  185. package/dist/cjs/Columns.js +35 -0
  186. package/dist/cjs/Columns.js.map +1 -0
  187. package/dist/cjs/ConfigurePageSidebar.js +99 -0
  188. package/dist/cjs/ConfigurePageSidebar.js.map +1 -0
  189. package/dist/cjs/ConfirmationModal.js +131 -0
  190. package/dist/cjs/ConfirmationModal.js.map +1 -0
  191. package/dist/cjs/Container.js +40 -0
  192. package/dist/cjs/Container.js.map +1 -0
  193. package/dist/cjs/CopyToClipboardButton.js +84 -0
  194. package/dist/cjs/CopyToClipboardButton.js.map +1 -0
  195. package/dist/cjs/Currency.js +920 -0
  196. package/dist/cjs/Currency.js.map +1 -0
  197. package/dist/cjs/DateFormat.js +47 -0
  198. package/dist/cjs/DateFormat.js.map +1 -0
  199. package/dist/cjs/DateRangeFilter.js +180 -0
  200. package/dist/cjs/DateRangeFilter.js.map +1 -0
  201. package/dist/cjs/DeleteArchiveModal.js +100 -0
  202. package/dist/cjs/DeleteArchiveModal.js.map +1 -0
  203. package/dist/cjs/DeviceIncompatibilityMessage.js +115 -0
  204. package/dist/cjs/DeviceIncompatibilityMessage.js.map +1 -0
  205. package/dist/cjs/DocumentEditor.js +185 -0
  206. package/dist/cjs/DocumentEditor.js.map +1 -0
  207. package/dist/cjs/DownloadMobileAppCallout.js +42 -0
  208. package/dist/cjs/DownloadMobileAppCallout.js.map +1 -0
  209. package/dist/cjs/DynamicVariables.js +117 -0
  210. package/dist/cjs/DynamicVariables.js.map +1 -0
  211. package/dist/cjs/EmailForm.js +593 -0
  212. package/dist/cjs/EmailForm.js.map +1 -0
  213. package/dist/cjs/EmailPreview.js +142 -0
  214. package/dist/cjs/EmailPreview.js.map +1 -0
  215. package/dist/cjs/EmojiPicker.js +114 -0
  216. package/dist/cjs/EmojiPicker.js.map +1 -0
  217. package/dist/cjs/EmojiReactions.js +84 -0
  218. package/dist/cjs/EmojiReactions.js.map +1 -0
  219. package/dist/cjs/Engagements.js +294 -0
  220. package/dist/cjs/Engagements.js.map +1 -0
  221. package/dist/cjs/ErrorPage.js +1831 -0
  222. package/dist/cjs/ErrorPage.js.map +1 -0
  223. package/dist/cjs/FileUpload.js +598 -0
  224. package/dist/cjs/FileUpload.js.map +1 -0
  225. package/dist/cjs/FinderModal.js +282 -0
  226. package/dist/cjs/FinderModal.js.map +1 -0
  227. package/dist/cjs/FloatingActionMenu.js +875 -0
  228. package/dist/cjs/FloatingActionMenu.js.map +1 -0
  229. package/dist/cjs/GoogleFontPicker.js +583 -0
  230. package/dist/cjs/GoogleFontPicker.js.map +1 -0
  231. package/dist/cjs/Header.js +128 -0
  232. package/dist/cjs/Header.js.map +1 -0
  233. package/dist/cjs/HelpPopover.js +85 -0
  234. package/dist/cjs/HelpPopover.js.map +1 -0
  235. package/dist/cjs/IconPicker.js +1161 -0
  236. package/dist/cjs/IconPicker.js.map +1 -0
  237. package/dist/cjs/ImageWithFallback.js +51 -0
  238. package/dist/cjs/ImageWithFallback.js.map +1 -0
  239. package/dist/cjs/InlineInput.js +233 -0
  240. package/dist/cjs/InlineInput.js.map +1 -0
  241. package/dist/cjs/Insights.js +360 -0
  242. package/dist/cjs/Insights.js.map +1 -0
  243. package/dist/cjs/IntegrationCard.js +229 -0
  244. package/dist/cjs/IntegrationCard.js.map +1 -0
  245. package/dist/cjs/IpRestriction.js +3638 -0
  246. package/dist/cjs/IpRestriction.js.map +1 -0
  247. package/dist/cjs/KeyboardShortcuts.js +286 -0
  248. package/dist/cjs/KeyboardShortcuts.js.map +1 -0
  249. package/dist/cjs/LoginPage.js +205 -0
  250. package/dist/cjs/LoginPage.js.map +1 -0
  251. package/dist/cjs/MadeWith.js +43 -0
  252. package/dist/cjs/MadeWith.js.map +1 -0
  253. package/dist/cjs/MenuBar.js +1328 -0
  254. package/dist/cjs/MenuBar.js.map +1 -0
  255. package/dist/cjs/Metadata.js +220 -0
  256. package/dist/cjs/Metadata.js.map +1 -0
  257. package/dist/cjs/MobilePreviewHeader.js +27 -0
  258. package/dist/cjs/MobilePreviewHeader.js.map +1 -0
  259. package/dist/cjs/MoreDropdown.js +165 -0
  260. package/dist/cjs/MoreDropdown.js.map +1 -0
  261. package/dist/cjs/NavigationHeader.js +266 -0
  262. package/dist/cjs/NavigationHeader.js.map +1 -0
  263. package/dist/cjs/NeetoWidget.js +2888 -0
  264. package/dist/cjs/NeetoWidget.js.map +1 -0
  265. package/dist/cjs/Onboarding.js +248 -0
  266. package/dist/cjs/Onboarding.js.map +1 -0
  267. package/dist/cjs/OptionFields.js +719 -0
  268. package/dist/cjs/OptionFields.js.map +1 -0
  269. package/dist/cjs/PageLoader.js +42 -0
  270. package/dist/cjs/PageLoader.js.map +1 -0
  271. package/dist/cjs/PhoneNumber.js +80 -0
  272. package/dist/cjs/PhoneNumber.js.map +1 -0
  273. package/dist/cjs/ProductEmbed.js +886 -0
  274. package/dist/cjs/ProductEmbed.js.map +1 -0
  275. package/dist/cjs/PublishBlock.js +449 -0
  276. package/dist/cjs/PublishBlock.js.map +1 -0
  277. package/dist/cjs/PublishYourItem.js +60 -0
  278. package/dist/cjs/PublishYourItem.js.map +1 -0
  279. package/dist/cjs/Rename.js +368 -0
  280. package/dist/cjs/Rename.js.map +1 -0
  281. package/dist/cjs/ResponsiveDevicePicker.js +65 -0
  282. package/dist/cjs/ResponsiveDevicePicker.js.map +1 -0
  283. package/dist/cjs/Schedule.js +947 -0
  284. package/dist/cjs/Schedule.js.map +1 -0
  285. package/dist/cjs/Scrollable.js +44 -0
  286. package/dist/cjs/Scrollable.js.map +1 -0
  287. package/dist/cjs/Search.js +112 -0
  288. package/dist/cjs/Search.js.map +1 -0
  289. package/dist/cjs/SendToFields.js +2223 -0
  290. package/dist/cjs/SendToFields.js.map +1 -0
  291. package/dist/cjs/SessionEnvironment.js +433 -0
  292. package/dist/cjs/SessionEnvironment.js.map +1 -0
  293. package/dist/cjs/Settings.js +252 -0
  294. package/dist/cjs/Settings.js.map +1 -0
  295. package/dist/cjs/ShareRecordingPane.js +218 -0
  296. package/dist/cjs/ShareRecordingPane.js.map +1 -0
  297. package/dist/cjs/ShareViaEmail.js +437 -0
  298. package/dist/cjs/ShareViaEmail.js.map +1 -0
  299. package/dist/cjs/ShareViaLink.js +1577 -0
  300. package/dist/cjs/ShareViaLink.js.map +1 -0
  301. package/dist/cjs/Sidebar.js +315 -0
  302. package/dist/cjs/Sidebar.js.map +1 -0
  303. package/dist/cjs/StatusDropdown.js +111 -0
  304. package/dist/cjs/StatusDropdown.js.map +1 -0
  305. package/dist/cjs/StickyRibbonsContainer.js +133 -0
  306. package/dist/cjs/StickyRibbonsContainer.js.map +1 -0
  307. package/dist/cjs/SubHeader.js +211 -0
  308. package/dist/cjs/SubHeader.js.map +1 -0
  309. package/dist/cjs/SubscriptionNotificationsContainer.js +79 -0
  310. package/dist/cjs/SubscriptionNotificationsContainer.js.map +1 -0
  311. package/dist/cjs/SuffixedInput.js +113 -0
  312. package/dist/cjs/SuffixedInput.js.map +1 -0
  313. package/dist/cjs/TableWrapper.js +29 -0
  314. package/dist/cjs/TableWrapper.js.map +1 -0
  315. package/dist/cjs/Taxonomy.js +517 -0
  316. package/dist/cjs/Taxonomy.js.map +1 -0
  317. package/dist/cjs/TimeFormat.js +16 -0
  318. package/dist/cjs/TimeFormat.js.map +1 -0
  319. package/dist/cjs/TimezoneMismatchModal.js +140 -0
  320. package/dist/cjs/TimezoneMismatchModal.js.map +1 -0
  321. package/dist/cjs/ToggleFeatureCard.js +213 -0
  322. package/dist/cjs/ToggleFeatureCard.js.map +1 -0
  323. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +11 -0
  324. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js.map +1 -0
  325. package/dist/cjs/index-JY2zVpnv.js +1189 -0
  326. package/dist/cjs/index-JY2zVpnv.js.map +1 -0
  327. package/dist/cjs/inject-css-vQvjPR2x.js +6 -0
  328. package/dist/cjs/inject-css-vQvjPR2x.js.map +1 -0
  329. package/dist/cjs/phone-number-BN-c0rfv.js +320 -0
  330. package/dist/cjs/phone-number-BN-c0rfv.js.map +1 -0
  331. package/dist/cjs/platform-BUcCb8Jx.js +1254 -0
  332. package/dist/cjs/platform-BUcCb8Jx.js.map +1 -0
  333. package/dist/cjs/useColumns-BP8c4PV-.js +282 -0
  334. package/dist/cjs/useColumns-BP8c4PV-.js.map +1 -0
  335. package/dist/index-DAYCJu79.js +1187 -0
  336. package/dist/index-DAYCJu79.js.map +1 -0
  337. package/dist/inject-css-DmrvuTKK.js +4 -0
  338. package/dist/inject-css-DmrvuTKK.js.map +1 -0
  339. package/dist/phone-number-CXCBroLh.js +295 -0
  340. package/dist/phone-number-CXCBroLh.js.map +1 -0
  341. package/dist/platform-F44zJ4Xh.js +1252 -0
  342. package/dist/platform-F44zJ4Xh.js.map +1 -0
  343. package/dist/styles/page-loader.css +1 -0
  344. package/dist/styles/page-loader.js +3 -0
  345. package/dist/useColumns-Db5uic1-.js +274 -0
  346. package/dist/useColumns-Db5uic1-.js.map +1 -0
  347. package/package.json +1 -1
  348. package/types/AuditLogs.d.ts +22 -0
  349. package/types/BoardView.d.ts +149 -0
  350. package/types/Breadcrumbs.d.ts +30 -0
  351. package/types/BrowserPreview.d.ts +30 -0
  352. package/types/BrowserSupport.d.ts +110 -0
  353. package/types/Builder.d.ts +99 -0
  354. package/types/ButtonGroup.d.ts +45 -0
  355. package/types/CalendarView.d.ts +98 -0
  356. package/types/CardLayout.d.ts +34 -0
  357. package/types/Codeblock.d.ts +37 -0
  358. package/types/Columns.d.ts +168 -0
  359. package/types/ConfigurePageSidebar.d.ts +45 -0
  360. package/types/ConfirmationModal.d.ts +65 -0
  361. package/types/Container.d.ts +38 -0
  362. package/types/CopyToClipboardButton.d.ts +28 -0
  363. package/types/Currency.d.ts +50 -0
  364. package/types/DateFormat.d.ts +15 -0
  365. package/types/DateRangeFilter.d.ts +56 -0
  366. package/types/DeleteArchiveModal.d.ts +65 -0
  367. package/types/DeviceIncompatibilityMessage.d.ts +19 -0
  368. package/types/DocumentEditor.d.ts +61 -0
  369. package/types/DownloadMobileAppCallout.d.ts +35 -0
  370. package/types/DynamicVariables.d.ts +48 -0
  371. package/types/EmailForm.d.ts +165 -0
  372. package/types/EmailFormProvider.d.ts +48 -0
  373. package/types/EmailPreview.d.ts +43 -0
  374. package/types/EmojiPicker.d.ts +35 -0
  375. package/types/EmojiReactions.d.ts +62 -0
  376. package/types/Engagements.d.ts +131 -0
  377. package/types/ErrorPage.d.ts +22 -0
  378. package/types/FileUpload.d.ts +89 -0
  379. package/types/FinderModal.d.ts +66 -0
  380. package/types/FloatingActionMenu.d.ts +59 -0
  381. package/types/GoogleFontPicker.d.ts +68 -0
  382. package/types/Header.d.ts +37 -0
  383. package/types/HelpPopover.d.ts +45 -0
  384. package/types/IconPicker.d.ts +45 -0
  385. package/types/ImageWithFallback.d.ts +24 -0
  386. package/types/InlineInput.d.ts +87 -0
  387. package/types/Insights.d.ts +112 -0
  388. package/types/IntegrationCard.d.ts +60 -0
  389. package/types/IpRestriction.d.ts +25 -0
  390. package/types/KeyboardShortcuts.d.ts +149 -0
  391. package/types/LoginPage.d.ts +45 -0
  392. package/types/MadeWith.d.ts +18 -0
  393. package/types/MenuBar.d.ts +127 -0
  394. package/types/Metadata.d.ts +109 -0
  395. package/types/MobilePreviewHeader.d.ts +19 -0
  396. package/types/MoreDropdown.d.ts +52 -0
  397. package/types/NavigationHeader.d.ts +180 -0
  398. package/types/NeetoWidget.d.ts +43 -0
  399. package/types/Onboarding.d.ts +70 -0
  400. package/types/OptionFields.d.ts +70 -0
  401. package/types/PageLoader.d.ts +40 -0
  402. package/types/PhoneNumber.d.ts +112 -0
  403. package/types/ProductEmbed.d.ts +93 -0
  404. package/types/PublishBlock.d.ts +148 -0
  405. package/types/Rename.d.ts +73 -0
  406. package/types/ResponsiveDevicePicker.d.ts +32 -0
  407. package/types/Schedule.d.ts +146 -0
  408. package/types/Scrollable.d.ts +30 -0
  409. package/types/Search.d.ts +22 -0
  410. package/types/SendToFields.d.ts +67 -0
  411. package/types/SessionEnvironment.d.ts +170 -0
  412. package/types/Settings.d.ts +108 -0
  413. package/types/ShareRecordingPane.d.ts +85 -0
  414. package/types/ShareViaEmail.d.ts +99 -0
  415. package/types/ShareViaLink.d.ts +183 -0
  416. package/types/Sidebar.d.ts +51 -0
  417. package/types/StatusDropdown.d.ts +74 -0
  418. package/types/StickyRibbonsContainer.d.ts +28 -0
  419. package/types/SubHeader.d.ts +105 -0
  420. package/types/SubscriptionNotificationsContainer.d.ts +26 -0
  421. package/types/SuffixedInput.d.ts +45 -0
  422. package/types/TableWrapper.d.ts +40 -0
  423. package/types/Taxonomy.d.ts +59 -0
  424. package/types/TimeFormat.d.ts +13 -0
  425. package/types/TimezoneMismatchModal.d.ts +41 -0
  426. package/types/ToggleFeatureCard.d.ts +38 -0
@@ -0,0 +1,2888 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var i18next = require('i18next');
5
+ var ramda = require('ramda');
6
+ var reactQuery = require('@tanstack/react-query');
7
+ var Info = require('@bigbinary/neeto-icons/Info');
8
+ var Callout = require('@bigbinary/neetoui/Callout');
9
+ var reactI18next = require('react-i18next');
10
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
11
+ var React = require('react');
12
+ var classnames = require('classnames');
13
+ var neetoCist = require('@bigbinary/neeto-cist');
14
+ var usePrevious = require('@bigbinary/neeto-commons-frontend/react-utils/usePrevious');
15
+ var Button = require('@bigbinary/neetoui/Button');
16
+ var Toastr = require('@bigbinary/neetoui/Toastr');
17
+ var Typography = require('@bigbinary/neetoui/Typography');
18
+ var Spinner = require('@bigbinary/neetoui/Spinner');
19
+ var jsxRuntime = require('react/jsx-runtime');
20
+ var Select = require('@bigbinary/neetoui/Select');
21
+ var CopyToClipboardButton = require('./CopyToClipboardButton.js');
22
+ var _commonjsHelpers = require('./_commonjsHelpers-BJu3ubxk.js');
23
+ var injectCss = require('./inject-css-vQvjPR2x.js');
24
+ var formik = require('formik');
25
+ var Pane = require('@bigbinary/neetoui/Pane');
26
+ var Input = require('@bigbinary/neetoui/formik/Input');
27
+ var MultiEmailInput = require('@bigbinary/neetoui/formik/MultiEmailInput');
28
+ var axios = require('axios');
29
+ var yup = require('yup');
30
+ var useMutationWithInvalidation = require('@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation');
31
+ var Label = require('@bigbinary/neetoui/Label');
32
+ var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
33
+ var Switch = require('@bigbinary/neetoui/Switch');
34
+ var Tooltip = require('@bigbinary/neetoui/Tooltip');
35
+ require('@babel/runtime/helpers/objectWithoutProperties');
36
+ require('@bigbinary/neeto-commons-frontend/utils/general');
37
+ require('@bigbinary/neeto-icons/Copy');
38
+ require('@bigbinary/neeto-icons/Check');
39
+
40
+ function _interopNamespaceDefault(e) {
41
+ var n = Object.create(null);
42
+ if (e) {
43
+ Object.keys(e).forEach(function (k) {
44
+ if (k !== 'default') {
45
+ var d = Object.getOwnPropertyDescriptor(e, k);
46
+ Object.defineProperty(n, k, d.get ? d : {
47
+ enumerable: true,
48
+ get: function () { return e[k]; }
49
+ });
50
+ }
51
+ });
52
+ }
53
+ n.default = e;
54
+ return Object.freeze(n);
55
+ }
56
+
57
+ var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
58
+
59
+ var NEETO_WIDGET_USER_IDENTITY_KEY = "NeetoWidgetUserIdentity";
60
+ var SESSION_CONTEXT_KEY = "NeetoReplayWidgetSessionContext";
61
+ var INSTALLATION_HELP_EMAIL = "support@neeto.com";
62
+ var SAMPLE_CONTEXT_CODE_STRING = "window.".concat(SESSION_CONTEXT_KEY, " = {\n key1: \"value\",\n key2: [\"array\", \"of\", \"values\"],\n /* More key-value pairs */\n}");
63
+ var WIDGET_TYPES = {
64
+ engage: "engage",
65
+ chat: "chat",
66
+ replay: "replay"
67
+ };
68
+ var WIDGET_HELP_LINKS = {
69
+ engage: "https://help.neetoengage.com/articles/installation",
70
+ chat: "https://help.neetochat.com/articles/installation-using-javascript-snippet",
71
+ replay: "https://help.neetoreplay.com/articles/install-widget"
72
+ };
73
+ var WIDGET_DESCRIPTIONS = {
74
+ engage: i18next.t("neetoMolecules.widget.email.body.values.embedCode.description.engage"),
75
+ chat: i18next.t("neetoMolecules.widget.email.body.values.embedCode.description.chat"),
76
+ replay: i18next.t("neetoMolecules.widget.email.body.values.embedCode.description.replay")
77
+ };
78
+ var WIDGET_TYPES_VALUES = ramda.values(WIDGET_TYPES);
79
+ var QUERY_KEYS = {
80
+ apiKey: "neetoWidgetApiKey",
81
+ configuration: "neetoWidgetConfiguration"
82
+ };
83
+ var DEFAULT_QUERY_STALE_TIME = 60 * 60 * 1000; // 1 hour in milliseconds
84
+
85
+ var EMAIL_TYPES = {
86
+ embedCode: "embedCode",
87
+ userIdentity: "userIdentity",
88
+ sessionContext: "sessionContext",
89
+ "null": ""
90
+ };
91
+ var RAILS_ENV = {
92
+ production: "production",
93
+ staging: "staging",
94
+ development: "development"
95
+ };
96
+ var NEETO_WIDGET_SCRIPT_URL = {
97
+ staging: "https://d3nshle8hzelnq.cloudfront.net/neeto-widget-staging.js",
98
+ production: "https://d13nryxs46eypn.cloudfront.net/neeto-widget.js"
99
+ };
100
+ var AVAILABLE_FRAMEWORK_OPTIONS = Object.freeze({
101
+ rails: "rails",
102
+ django: "django",
103
+ php: "php"
104
+ });
105
+ var FRAMEWORK_SELECT_OPTIONS = [{
106
+ label: "Ruby(Rails)",
107
+ value: AVAILABLE_FRAMEWORK_OPTIONS.rails
108
+ }, {
109
+ label: "Python(Django)",
110
+ value: AVAILABLE_FRAMEWORK_OPTIONS.django
111
+ }, {
112
+ label: "PHP",
113
+ value: AVAILABLE_FRAMEWORK_OPTIONS.php
114
+ }];
115
+ var SAMPLE_USER_IDENTITY_CODE_STRING = _defineProperty(_defineProperty(_defineProperty({}, AVAILABLE_FRAMEWORK_OPTIONS.rails, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: \"<%= current_user.id %>\", // User identifier\"\n name: \"<%= current_user.name %>\", // Full name\n email: \"<%= current_user.email %>\", // Email address\n started_at: \"<%= current_user.created_at.to_i %>\" // Signup date as a Unix timestamp ,\n}")), AVAILABLE_FRAMEWORK_OPTIONS.django, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: \"{{ request.user.id|escapejs }}\", // User identifier\n name: \"{{ request.user.name|escapejs }}\", // Full name\n email: \"{{ request.user.email|escapejs }}\", // Email address\n started_at: \"{{ request.user.created_at|date:'U' }}\" // Signup date as a Unix timestamp\"\n}")), AVAILABLE_FRAMEWORK_OPTIONS.php, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: <?php echo json_encode($current_user->id) ?>, // User identifier\n name: <?php echo json_encode($current_user->name) ?>, // Full name\n email: <?php echo json_encode($current_user->email) ?>, // Email address\n started_at: <?php echo strtotime($current_user->created_at) ?> // Signup date as a Unix timestamp\" ,\n}"));
116
+ var WIDGET_CONFIG_URL = "/api/widget/v1/neeto_widget_tokens";
117
+ var EMBED_CODE_EMAIL_URL = "/api/widget/v1/email_snippets";
118
+ var CHAT_WIDGET_KB_BASE_URL = "https://help.neetochat.com";
119
+ var ENGAGE_WIDGET_KB_BASE_URL = "https://help.neetoengage.com";
120
+ var REPLAY_WIDGET_KB_BASE_URL = "https://help.neetoreplay.com";
121
+ var NEETO_REPLAY_CONFIGURE_URL = "".concat(REPLAY_WIDGET_KB_BASE_URL, "/articles/configure-widget");
122
+ var NEETO_CHAT_USER_IDENTITY_URL = "".concat(CHAT_WIDGET_KB_BASE_URL, "/articles/info-about-logged-in-users");
123
+ var WIDGET_KB_HELP_URL = {
124
+ engage: "".concat(ENGAGE_WIDGET_KB_BASE_URL, "/categories/widget-installation-usage"),
125
+ chat: "".concat(CHAT_WIDGET_KB_BASE_URL, "/categories/installation"),
126
+ replay: "".concat(REPLAY_WIDGET_KB_BASE_URL, "/categories/widget-installation-usage")
127
+ };
128
+ var USE_NEETO_WIDGET_NPM_PAGE_URL = "https://www.npmjs.com/package/@bigbinary/react-use-neeto-widget";
129
+
130
+ var ChatWidgetBody = function ChatWidgetBody(_ref) {
131
+ var widgets = _ref.widgets;
132
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
133
+ children: [widgets.includes(WIDGET_TYPES.engage) && /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
134
+ i18nKey: "neetoMolecules.widget.email.body.values.embedCode.engageHelp",
135
+ values: {
136
+ helpLink: WIDGET_HELP_LINKS.engage
137
+ },
138
+ components: {
139
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
140
+ className: "mb-2",
141
+ style: "body2"
142
+ }),
143
+ a: /*#__PURE__*/jsxRuntime.jsx(Button, {
144
+ href: WIDGET_HELP_LINKS.engage,
145
+ rel: "noreferrer",
146
+ style: "link",
147
+ target: "_blank"
148
+ })
149
+ }
150
+ }), widgets.includes(WIDGET_TYPES.chat) && /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
151
+ i18nKey: "neetoMolecules.widget.email.body.values.embedCode.chatHelp",
152
+ values: {
153
+ helpLink: WIDGET_HELP_LINKS.chat
154
+ },
155
+ components: {
156
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
157
+ className: "mb-2",
158
+ style: "body2"
159
+ }),
160
+ a: /*#__PURE__*/jsxRuntime.jsx(Button, {
161
+ href: WIDGET_HELP_LINKS.chat,
162
+ rel: "noreferrer",
163
+ style: "link",
164
+ target: "_blank"
165
+ })
166
+ }
167
+ }), widgets.includes(WIDGET_TYPES.replay) && /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
168
+ i18nKey: "neetoMolecules.widget.email.body.values.embedCode.replayHelp",
169
+ values: {
170
+ helpLink: WIDGET_HELP_LINKS.replay
171
+ },
172
+ components: {
173
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
174
+ className: "mb-2",
175
+ style: "body2"
176
+ }),
177
+ a: /*#__PURE__*/jsxRuntime.jsx(Button, {
178
+ href: WIDGET_HELP_LINKS.replay,
179
+ rel: "noreferrer",
180
+ style: "link",
181
+ target: "_blank"
182
+ })
183
+ }
184
+ })]
185
+ });
186
+ };
187
+
188
+ var prism = {exports: {}};
189
+
190
+ (function (module) {
191
+ /* **********************************************
192
+ Begin prism-core.js
193
+ ********************************************** */
194
+
195
+ /// <reference lib="WebWorker"/>
196
+
197
+ var _self = (typeof window !== 'undefined')
198
+ ? window // if in browser
199
+ : (
200
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
201
+ ? self // if in worker
202
+ : {} // if in node js
203
+ );
204
+
205
+ /**
206
+ * Prism: Lightweight, robust, elegant syntax highlighting
207
+ *
208
+ * @license MIT <https://opensource.org/licenses/MIT>
209
+ * @author Lea Verou <https://lea.verou.me>
210
+ * @namespace
211
+ * @public
212
+ */
213
+ var Prism = (function (_self) {
214
+
215
+ // Private helper vars
216
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
217
+ var uniqueId = 0;
218
+
219
+ // The grammar object for plaintext
220
+ var plainTextGrammar = {};
221
+
222
+
223
+ var _ = {
224
+ /**
225
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
226
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
227
+ * additional languages or plugins yourself.
228
+ *
229
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
230
+ *
231
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
232
+ * empty Prism object into the global scope before loading the Prism script like this:
233
+ *
234
+ * ```js
235
+ * window.Prism = window.Prism || {};
236
+ * Prism.manual = true;
237
+ * // add a new <script> to load Prism's script
238
+ * ```
239
+ *
240
+ * @default false
241
+ * @type {boolean}
242
+ * @memberof Prism
243
+ * @public
244
+ */
245
+ manual: _self.Prism && _self.Prism.manual,
246
+ /**
247
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
248
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
249
+ * own worker, you don't want it to do this.
250
+ *
251
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
252
+ *
253
+ * You obviously have to change this value before Prism executes. To do this, you can add an
254
+ * empty Prism object into the global scope before loading the Prism script like this:
255
+ *
256
+ * ```js
257
+ * window.Prism = window.Prism || {};
258
+ * Prism.disableWorkerMessageHandler = true;
259
+ * // Load Prism's script
260
+ * ```
261
+ *
262
+ * @default false
263
+ * @type {boolean}
264
+ * @memberof Prism
265
+ * @public
266
+ */
267
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
268
+
269
+ /**
270
+ * A namespace for utility methods.
271
+ *
272
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
273
+ * change or disappear at any time.
274
+ *
275
+ * @namespace
276
+ * @memberof Prism
277
+ */
278
+ util: {
279
+ encode: function encode(tokens) {
280
+ if (tokens instanceof Token) {
281
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
282
+ } else if (Array.isArray(tokens)) {
283
+ return tokens.map(encode);
284
+ } else {
285
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
286
+ }
287
+ },
288
+
289
+ /**
290
+ * Returns the name of the type of the given value.
291
+ *
292
+ * @param {any} o
293
+ * @returns {string}
294
+ * @example
295
+ * type(null) === 'Null'
296
+ * type(undefined) === 'Undefined'
297
+ * type(123) === 'Number'
298
+ * type('foo') === 'String'
299
+ * type(true) === 'Boolean'
300
+ * type([1, 2]) === 'Array'
301
+ * type({}) === 'Object'
302
+ * type(String) === 'Function'
303
+ * type(/abc+/) === 'RegExp'
304
+ */
305
+ type: function (o) {
306
+ return Object.prototype.toString.call(o).slice(8, -1);
307
+ },
308
+
309
+ /**
310
+ * Returns a unique number for the given object. Later calls will still return the same number.
311
+ *
312
+ * @param {Object} obj
313
+ * @returns {number}
314
+ */
315
+ objId: function (obj) {
316
+ if (!obj['__id']) {
317
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
318
+ }
319
+ return obj['__id'];
320
+ },
321
+
322
+ /**
323
+ * Creates a deep clone of the given object.
324
+ *
325
+ * The main intended use of this function is to clone language definitions.
326
+ *
327
+ * @param {T} o
328
+ * @param {Record<number, any>} [visited]
329
+ * @returns {T}
330
+ * @template T
331
+ */
332
+ clone: function deepClone(o, visited) {
333
+ visited = visited || {};
334
+
335
+ var clone; var id;
336
+ switch (_.util.type(o)) {
337
+ case 'Object':
338
+ id = _.util.objId(o);
339
+ if (visited[id]) {
340
+ return visited[id];
341
+ }
342
+ clone = /** @type {Record<string, any>} */ ({});
343
+ visited[id] = clone;
344
+
345
+ for (var key in o) {
346
+ if (o.hasOwnProperty(key)) {
347
+ clone[key] = deepClone(o[key], visited);
348
+ }
349
+ }
350
+
351
+ return /** @type {any} */ (clone);
352
+
353
+ case 'Array':
354
+ id = _.util.objId(o);
355
+ if (visited[id]) {
356
+ return visited[id];
357
+ }
358
+ clone = [];
359
+ visited[id] = clone;
360
+
361
+ (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
362
+ clone[i] = deepClone(v, visited);
363
+ });
364
+
365
+ return /** @type {any} */ (clone);
366
+
367
+ default:
368
+ return o;
369
+ }
370
+ },
371
+
372
+ /**
373
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
374
+ *
375
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
376
+ *
377
+ * @param {Element} element
378
+ * @returns {string}
379
+ */
380
+ getLanguage: function (element) {
381
+ while (element) {
382
+ var m = lang.exec(element.className);
383
+ if (m) {
384
+ return m[1].toLowerCase();
385
+ }
386
+ element = element.parentElement;
387
+ }
388
+ return 'none';
389
+ },
390
+
391
+ /**
392
+ * Sets the Prism `language-xxxx` class of the given element.
393
+ *
394
+ * @param {Element} element
395
+ * @param {string} language
396
+ * @returns {void}
397
+ */
398
+ setLanguage: function (element, language) {
399
+ // remove all `language-xxxx` classes
400
+ // (this might leave behind a leading space)
401
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
402
+
403
+ // add the new `language-xxxx` class
404
+ // (using `classList` will automatically clean up spaces for us)
405
+ element.classList.add('language-' + language);
406
+ },
407
+
408
+ /**
409
+ * Returns the script element that is currently executing.
410
+ *
411
+ * This does __not__ work for line script element.
412
+ *
413
+ * @returns {HTMLScriptElement | null}
414
+ */
415
+ currentScript: function () {
416
+ if (typeof document === 'undefined') {
417
+ return null;
418
+ }
419
+ if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
420
+ return /** @type {any} */ (document.currentScript);
421
+ }
422
+
423
+ // IE11 workaround
424
+ // we'll get the src of the current script by parsing IE11's error stack trace
425
+ // this will not work for inline scripts
426
+
427
+ try {
428
+ throw new Error();
429
+ } catch (err) {
430
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
431
+ // A stack will look like this:
432
+ //
433
+ // Error
434
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
435
+ // at Global code (http://localhost/components/prism-core.js:606:1)
436
+
437
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
438
+ if (src) {
439
+ var scripts = document.getElementsByTagName('script');
440
+ for (var i in scripts) {
441
+ if (scripts[i].src == src) {
442
+ return scripts[i];
443
+ }
444
+ }
445
+ }
446
+ return null;
447
+ }
448
+ },
449
+
450
+ /**
451
+ * Returns whether a given class is active for `element`.
452
+ *
453
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
454
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
455
+ * given class is just the given class with a `no-` prefix.
456
+ *
457
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
458
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
459
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
460
+ *
461
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
462
+ * version of it, the class is considered active.
463
+ *
464
+ * @param {Element} element
465
+ * @param {string} className
466
+ * @param {boolean} [defaultActivation=false]
467
+ * @returns {boolean}
468
+ */
469
+ isActive: function (element, className, defaultActivation) {
470
+ var no = 'no-' + className;
471
+
472
+ while (element) {
473
+ var classList = element.classList;
474
+ if (classList.contains(className)) {
475
+ return true;
476
+ }
477
+ if (classList.contains(no)) {
478
+ return false;
479
+ }
480
+ element = element.parentElement;
481
+ }
482
+ return !!defaultActivation;
483
+ }
484
+ },
485
+
486
+ /**
487
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
488
+ *
489
+ * @namespace
490
+ * @memberof Prism
491
+ * @public
492
+ */
493
+ languages: {
494
+ /**
495
+ * The grammar for plain, unformatted text.
496
+ */
497
+ plain: plainTextGrammar,
498
+ plaintext: plainTextGrammar,
499
+ text: plainTextGrammar,
500
+ txt: plainTextGrammar,
501
+
502
+ /**
503
+ * Creates a deep copy of the language with the given id and appends the given tokens.
504
+ *
505
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
506
+ * will be overwritten at its original position.
507
+ *
508
+ * ## Best practices
509
+ *
510
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
511
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
512
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
513
+ *
514
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
515
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
516
+ *
517
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
518
+ * @param {Grammar} redef The new tokens to append.
519
+ * @returns {Grammar} The new language created.
520
+ * @public
521
+ * @example
522
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
523
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
524
+ * // at its original position
525
+ * 'comment': { ... },
526
+ * // CSS doesn't have a 'color' token, so this token will be appended
527
+ * 'color': /\b(?:red|green|blue)\b/
528
+ * });
529
+ */
530
+ extend: function (id, redef) {
531
+ var lang = _.util.clone(_.languages[id]);
532
+
533
+ for (var key in redef) {
534
+ lang[key] = redef[key];
535
+ }
536
+
537
+ return lang;
538
+ },
539
+
540
+ /**
541
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
542
+ *
543
+ * ## Usage
544
+ *
545
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
546
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
547
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
548
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
549
+ * this:
550
+ *
551
+ * ```js
552
+ * Prism.languages.markup.style = {
553
+ * // token
554
+ * };
555
+ * ```
556
+ *
557
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
558
+ * before existing tokens. For the CSS example above, you would use it like this:
559
+ *
560
+ * ```js
561
+ * Prism.languages.insertBefore('markup', 'cdata', {
562
+ * 'style': {
563
+ * // token
564
+ * }
565
+ * });
566
+ * ```
567
+ *
568
+ * ## Special cases
569
+ *
570
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
571
+ * will be ignored.
572
+ *
573
+ * This behavior can be used to insert tokens after `before`:
574
+ *
575
+ * ```js
576
+ * Prism.languages.insertBefore('markup', 'comment', {
577
+ * 'comment': Prism.languages.markup.comment,
578
+ * // tokens after 'comment'
579
+ * });
580
+ * ```
581
+ *
582
+ * ## Limitations
583
+ *
584
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
585
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
586
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
587
+ * deleting properties which is necessary to insert at arbitrary positions.
588
+ *
589
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
590
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
591
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
592
+ *
593
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
594
+ * you hold the target object in a variable, then the value of the variable will not change.
595
+ *
596
+ * ```js
597
+ * var oldMarkup = Prism.languages.markup;
598
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
599
+ *
600
+ * assert(oldMarkup !== Prism.languages.markup);
601
+ * assert(newMarkup === Prism.languages.markup);
602
+ * ```
603
+ *
604
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
605
+ * object to be modified.
606
+ * @param {string} before The key to insert before.
607
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
608
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
609
+ * object to be modified.
610
+ *
611
+ * Defaults to `Prism.languages`.
612
+ * @returns {Grammar} The new grammar object.
613
+ * @public
614
+ */
615
+ insertBefore: function (inside, before, insert, root) {
616
+ root = root || /** @type {any} */ (_.languages);
617
+ var grammar = root[inside];
618
+ /** @type {Grammar} */
619
+ var ret = {};
620
+
621
+ for (var token in grammar) {
622
+ if (grammar.hasOwnProperty(token)) {
623
+
624
+ if (token == before) {
625
+ for (var newToken in insert) {
626
+ if (insert.hasOwnProperty(newToken)) {
627
+ ret[newToken] = insert[newToken];
628
+ }
629
+ }
630
+ }
631
+
632
+ // Do not insert token which also occur in insert. See #1525
633
+ if (!insert.hasOwnProperty(token)) {
634
+ ret[token] = grammar[token];
635
+ }
636
+ }
637
+ }
638
+
639
+ var old = root[inside];
640
+ root[inside] = ret;
641
+
642
+ // Update references in other language definitions
643
+ _.languages.DFS(_.languages, function (key, value) {
644
+ if (value === old && key != inside) {
645
+ this[key] = ret;
646
+ }
647
+ });
648
+
649
+ return ret;
650
+ },
651
+
652
+ // Traverse a language definition with Depth First Search
653
+ DFS: function DFS(o, callback, type, visited) {
654
+ visited = visited || {};
655
+
656
+ var objId = _.util.objId;
657
+
658
+ for (var i in o) {
659
+ if (o.hasOwnProperty(i)) {
660
+ callback.call(o, i, o[i], type || i);
661
+
662
+ var property = o[i];
663
+ var propertyType = _.util.type(property);
664
+
665
+ if (propertyType === 'Object' && !visited[objId(property)]) {
666
+ visited[objId(property)] = true;
667
+ DFS(property, callback, null, visited);
668
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
669
+ visited[objId(property)] = true;
670
+ DFS(property, callback, i, visited);
671
+ }
672
+ }
673
+ }
674
+ }
675
+ },
676
+
677
+ plugins: {},
678
+
679
+ /**
680
+ * This is the most high-level function in Prism’s API.
681
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
682
+ * each one of them.
683
+ *
684
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
685
+ *
686
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
687
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
688
+ * @memberof Prism
689
+ * @public
690
+ */
691
+ highlightAll: function (async, callback) {
692
+ _.highlightAllUnder(document, async, callback);
693
+ },
694
+
695
+ /**
696
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
697
+ * {@link Prism.highlightElement} on each one of them.
698
+ *
699
+ * The following hooks will be run:
700
+ * 1. `before-highlightall`
701
+ * 2. `before-all-elements-highlight`
702
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
703
+ *
704
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
705
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
706
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
707
+ * @memberof Prism
708
+ * @public
709
+ */
710
+ highlightAllUnder: function (container, async, callback) {
711
+ var env = {
712
+ callback: callback,
713
+ container: container,
714
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
715
+ };
716
+
717
+ _.hooks.run('before-highlightall', env);
718
+
719
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
720
+
721
+ _.hooks.run('before-all-elements-highlight', env);
722
+
723
+ for (var i = 0, element; (element = env.elements[i++]);) {
724
+ _.highlightElement(element, async === true, env.callback);
725
+ }
726
+ },
727
+
728
+ /**
729
+ * Highlights the code inside a single element.
730
+ *
731
+ * The following hooks will be run:
732
+ * 1. `before-sanity-check`
733
+ * 2. `before-highlight`
734
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
735
+ * 4. `before-insert`
736
+ * 5. `after-highlight`
737
+ * 6. `complete`
738
+ *
739
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
740
+ * the element's language.
741
+ *
742
+ * @param {Element} element The element containing the code.
743
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
744
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
745
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
746
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
747
+ *
748
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
749
+ * asynchronous highlighting to work. You can build your own bundle on the
750
+ * [Download page](https://prismjs.com/download.html).
751
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
752
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
753
+ * @memberof Prism
754
+ * @public
755
+ */
756
+ highlightElement: function (element, async, callback) {
757
+ // Find language
758
+ var language = _.util.getLanguage(element);
759
+ var grammar = _.languages[language];
760
+
761
+ // Set language on the element, if not present
762
+ _.util.setLanguage(element, language);
763
+
764
+ // Set language on the parent, for styling
765
+ var parent = element.parentElement;
766
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
767
+ _.util.setLanguage(parent, language);
768
+ }
769
+
770
+ var code = element.textContent;
771
+
772
+ var env = {
773
+ element: element,
774
+ language: language,
775
+ grammar: grammar,
776
+ code: code
777
+ };
778
+
779
+ function insertHighlightedCode(highlightedCode) {
780
+ env.highlightedCode = highlightedCode;
781
+
782
+ _.hooks.run('before-insert', env);
783
+
784
+ env.element.innerHTML = env.highlightedCode;
785
+
786
+ _.hooks.run('after-highlight', env);
787
+ _.hooks.run('complete', env);
788
+ callback && callback.call(env.element);
789
+ }
790
+
791
+ _.hooks.run('before-sanity-check', env);
792
+
793
+ // plugins may change/add the parent/element
794
+ parent = env.element.parentElement;
795
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
796
+ parent.setAttribute('tabindex', '0');
797
+ }
798
+
799
+ if (!env.code) {
800
+ _.hooks.run('complete', env);
801
+ callback && callback.call(env.element);
802
+ return;
803
+ }
804
+
805
+ _.hooks.run('before-highlight', env);
806
+
807
+ if (!env.grammar) {
808
+ insertHighlightedCode(_.util.encode(env.code));
809
+ return;
810
+ }
811
+
812
+ if (async && _self.Worker) {
813
+ var worker = new Worker(_.filename);
814
+
815
+ worker.onmessage = function (evt) {
816
+ insertHighlightedCode(evt.data);
817
+ };
818
+
819
+ worker.postMessage(JSON.stringify({
820
+ language: env.language,
821
+ code: env.code,
822
+ immediateClose: true
823
+ }));
824
+ } else {
825
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
826
+ }
827
+ },
828
+
829
+ /**
830
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
831
+ * and the language definitions to use, and returns a string with the HTML produced.
832
+ *
833
+ * The following hooks will be run:
834
+ * 1. `before-tokenize`
835
+ * 2. `after-tokenize`
836
+ * 3. `wrap`: On each {@link Token}.
837
+ *
838
+ * @param {string} text A string with the code to be highlighted.
839
+ * @param {Grammar} grammar An object containing the tokens to use.
840
+ *
841
+ * Usually a language definition like `Prism.languages.markup`.
842
+ * @param {string} language The name of the language definition passed to `grammar`.
843
+ * @returns {string} The highlighted HTML.
844
+ * @memberof Prism
845
+ * @public
846
+ * @example
847
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
848
+ */
849
+ highlight: function (text, grammar, language) {
850
+ var env = {
851
+ code: text,
852
+ grammar: grammar,
853
+ language: language
854
+ };
855
+ _.hooks.run('before-tokenize', env);
856
+ if (!env.grammar) {
857
+ throw new Error('The language "' + env.language + '" has no grammar.');
858
+ }
859
+ env.tokens = _.tokenize(env.code, env.grammar);
860
+ _.hooks.run('after-tokenize', env);
861
+ return Token.stringify(_.util.encode(env.tokens), env.language);
862
+ },
863
+
864
+ /**
865
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
866
+ * and the language definitions to use, and returns an array with the tokenized code.
867
+ *
868
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
869
+ *
870
+ * This method could be useful in other contexts as well, as a very crude parser.
871
+ *
872
+ * @param {string} text A string with the code to be highlighted.
873
+ * @param {Grammar} grammar An object containing the tokens to use.
874
+ *
875
+ * Usually a language definition like `Prism.languages.markup`.
876
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
877
+ * @memberof Prism
878
+ * @public
879
+ * @example
880
+ * let code = `var foo = 0;`;
881
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
882
+ * tokens.forEach(token => {
883
+ * if (token instanceof Prism.Token && token.type === 'number') {
884
+ * console.log(`Found numeric literal: ${token.content}`);
885
+ * }
886
+ * });
887
+ */
888
+ tokenize: function (text, grammar) {
889
+ var rest = grammar.rest;
890
+ if (rest) {
891
+ for (var token in rest) {
892
+ grammar[token] = rest[token];
893
+ }
894
+
895
+ delete grammar.rest;
896
+ }
897
+
898
+ var tokenList = new LinkedList();
899
+ addAfter(tokenList, tokenList.head, text);
900
+
901
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
902
+
903
+ return toArray(tokenList);
904
+ },
905
+
906
+ /**
907
+ * @namespace
908
+ * @memberof Prism
909
+ * @public
910
+ */
911
+ hooks: {
912
+ all: {},
913
+
914
+ /**
915
+ * Adds the given callback to the list of callbacks for the given hook.
916
+ *
917
+ * The callback will be invoked when the hook it is registered for is run.
918
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
919
+ *
920
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
921
+ *
922
+ * @param {string} name The name of the hook.
923
+ * @param {HookCallback} callback The callback function which is given environment variables.
924
+ * @public
925
+ */
926
+ add: function (name, callback) {
927
+ var hooks = _.hooks.all;
928
+
929
+ hooks[name] = hooks[name] || [];
930
+
931
+ hooks[name].push(callback);
932
+ },
933
+
934
+ /**
935
+ * Runs a hook invoking all registered callbacks with the given environment variables.
936
+ *
937
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
938
+ *
939
+ * @param {string} name The name of the hook.
940
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
941
+ * @public
942
+ */
943
+ run: function (name, env) {
944
+ var callbacks = _.hooks.all[name];
945
+
946
+ if (!callbacks || !callbacks.length) {
947
+ return;
948
+ }
949
+
950
+ for (var i = 0, callback; (callback = callbacks[i++]);) {
951
+ callback(env);
952
+ }
953
+ }
954
+ },
955
+
956
+ Token: Token
957
+ };
958
+ _self.Prism = _;
959
+
960
+
961
+ // Typescript note:
962
+ // The following can be used to import the Token type in JSDoc:
963
+ //
964
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
965
+
966
+ /**
967
+ * Creates a new token.
968
+ *
969
+ * @param {string} type See {@link Token#type type}
970
+ * @param {string | TokenStream} content See {@link Token#content content}
971
+ * @param {string|string[]} [alias] The alias(es) of the token.
972
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
973
+ * @class
974
+ * @global
975
+ * @public
976
+ */
977
+ function Token(type, content, alias, matchedStr) {
978
+ /**
979
+ * The type of the token.
980
+ *
981
+ * This is usually the key of a pattern in a {@link Grammar}.
982
+ *
983
+ * @type {string}
984
+ * @see GrammarToken
985
+ * @public
986
+ */
987
+ this.type = type;
988
+ /**
989
+ * The strings or tokens contained by this token.
990
+ *
991
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
992
+ *
993
+ * @type {string | TokenStream}
994
+ * @public
995
+ */
996
+ this.content = content;
997
+ /**
998
+ * The alias(es) of the token.
999
+ *
1000
+ * @type {string|string[]}
1001
+ * @see GrammarToken
1002
+ * @public
1003
+ */
1004
+ this.alias = alias;
1005
+ // Copy of the full string this token was created from
1006
+ this.length = (matchedStr || '').length | 0;
1007
+ }
1008
+
1009
+ /**
1010
+ * A token stream is an array of strings and {@link Token Token} objects.
1011
+ *
1012
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
1013
+ * them.
1014
+ *
1015
+ * 1. No adjacent strings.
1016
+ * 2. No empty strings.
1017
+ *
1018
+ * The only exception here is the token stream that only contains the empty string and nothing else.
1019
+ *
1020
+ * @typedef {Array<string | Token>} TokenStream
1021
+ * @global
1022
+ * @public
1023
+ */
1024
+
1025
+ /**
1026
+ * Converts the given token or token stream to an HTML representation.
1027
+ *
1028
+ * The following hooks will be run:
1029
+ * 1. `wrap`: On each {@link Token}.
1030
+ *
1031
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
1032
+ * @param {string} language The name of current language.
1033
+ * @returns {string} The HTML representation of the token or token stream.
1034
+ * @memberof Token
1035
+ * @static
1036
+ */
1037
+ Token.stringify = function stringify(o, language) {
1038
+ if (typeof o == 'string') {
1039
+ return o;
1040
+ }
1041
+ if (Array.isArray(o)) {
1042
+ var s = '';
1043
+ o.forEach(function (e) {
1044
+ s += stringify(e, language);
1045
+ });
1046
+ return s;
1047
+ }
1048
+
1049
+ var env = {
1050
+ type: o.type,
1051
+ content: stringify(o.content, language),
1052
+ tag: 'span',
1053
+ classes: ['token', o.type],
1054
+ attributes: {},
1055
+ language: language
1056
+ };
1057
+
1058
+ var aliases = o.alias;
1059
+ if (aliases) {
1060
+ if (Array.isArray(aliases)) {
1061
+ Array.prototype.push.apply(env.classes, aliases);
1062
+ } else {
1063
+ env.classes.push(aliases);
1064
+ }
1065
+ }
1066
+
1067
+ _.hooks.run('wrap', env);
1068
+
1069
+ var attributes = '';
1070
+ for (var name in env.attributes) {
1071
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
1072
+ }
1073
+
1074
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
1075
+ };
1076
+
1077
+ /**
1078
+ * @param {RegExp} pattern
1079
+ * @param {number} pos
1080
+ * @param {string} text
1081
+ * @param {boolean} lookbehind
1082
+ * @returns {RegExpExecArray | null}
1083
+ */
1084
+ function matchPattern(pattern, pos, text, lookbehind) {
1085
+ pattern.lastIndex = pos;
1086
+ var match = pattern.exec(text);
1087
+ if (match && lookbehind && match[1]) {
1088
+ // change the match to remove the text matched by the Prism lookbehind group
1089
+ var lookbehindLength = match[1].length;
1090
+ match.index += lookbehindLength;
1091
+ match[0] = match[0].slice(lookbehindLength);
1092
+ }
1093
+ return match;
1094
+ }
1095
+
1096
+ /**
1097
+ * @param {string} text
1098
+ * @param {LinkedList<string | Token>} tokenList
1099
+ * @param {any} grammar
1100
+ * @param {LinkedListNode<string | Token>} startNode
1101
+ * @param {number} startPos
1102
+ * @param {RematchOptions} [rematch]
1103
+ * @returns {void}
1104
+ * @private
1105
+ *
1106
+ * @typedef RematchOptions
1107
+ * @property {string} cause
1108
+ * @property {number} reach
1109
+ */
1110
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
1111
+ for (var token in grammar) {
1112
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
1113
+ continue;
1114
+ }
1115
+
1116
+ var patterns = grammar[token];
1117
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
1118
+
1119
+ for (var j = 0; j < patterns.length; ++j) {
1120
+ if (rematch && rematch.cause == token + ',' + j) {
1121
+ return;
1122
+ }
1123
+
1124
+ var patternObj = patterns[j];
1125
+ var inside = patternObj.inside;
1126
+ var lookbehind = !!patternObj.lookbehind;
1127
+ var greedy = !!patternObj.greedy;
1128
+ var alias = patternObj.alias;
1129
+
1130
+ if (greedy && !patternObj.pattern.global) {
1131
+ // Without the global flag, lastIndex won't work
1132
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
1133
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
1134
+ }
1135
+
1136
+ /** @type {RegExp} */
1137
+ var pattern = patternObj.pattern || patternObj;
1138
+
1139
+ for ( // iterate the token list and keep track of the current token/string position
1140
+ var currentNode = startNode.next, pos = startPos;
1141
+ currentNode !== tokenList.tail;
1142
+ pos += currentNode.value.length, currentNode = currentNode.next
1143
+ ) {
1144
+
1145
+ if (rematch && pos >= rematch.reach) {
1146
+ break;
1147
+ }
1148
+
1149
+ var str = currentNode.value;
1150
+
1151
+ if (tokenList.length > text.length) {
1152
+ // Something went terribly wrong, ABORT, ABORT!
1153
+ return;
1154
+ }
1155
+
1156
+ if (str instanceof Token) {
1157
+ continue;
1158
+ }
1159
+
1160
+ var removeCount = 1; // this is the to parameter of removeBetween
1161
+ var match;
1162
+
1163
+ if (greedy) {
1164
+ match = matchPattern(pattern, pos, text, lookbehind);
1165
+ if (!match || match.index >= text.length) {
1166
+ break;
1167
+ }
1168
+
1169
+ var from = match.index;
1170
+ var to = match.index + match[0].length;
1171
+ var p = pos;
1172
+
1173
+ // find the node that contains the match
1174
+ p += currentNode.value.length;
1175
+ while (from >= p) {
1176
+ currentNode = currentNode.next;
1177
+ p += currentNode.value.length;
1178
+ }
1179
+ // adjust pos (and p)
1180
+ p -= currentNode.value.length;
1181
+ pos = p;
1182
+
1183
+ // the current node is a Token, then the match starts inside another Token, which is invalid
1184
+ if (currentNode.value instanceof Token) {
1185
+ continue;
1186
+ }
1187
+
1188
+ // find the last node which is affected by this match
1189
+ for (
1190
+ var k = currentNode;
1191
+ k !== tokenList.tail && (p < to || typeof k.value === 'string');
1192
+ k = k.next
1193
+ ) {
1194
+ removeCount++;
1195
+ p += k.value.length;
1196
+ }
1197
+ removeCount--;
1198
+
1199
+ // replace with the new match
1200
+ str = text.slice(pos, p);
1201
+ match.index -= pos;
1202
+ } else {
1203
+ match = matchPattern(pattern, 0, str, lookbehind);
1204
+ if (!match) {
1205
+ continue;
1206
+ }
1207
+ }
1208
+
1209
+ // eslint-disable-next-line no-redeclare
1210
+ var from = match.index;
1211
+ var matchStr = match[0];
1212
+ var before = str.slice(0, from);
1213
+ var after = str.slice(from + matchStr.length);
1214
+
1215
+ var reach = pos + str.length;
1216
+ if (rematch && reach > rematch.reach) {
1217
+ rematch.reach = reach;
1218
+ }
1219
+
1220
+ var removeFrom = currentNode.prev;
1221
+
1222
+ if (before) {
1223
+ removeFrom = addAfter(tokenList, removeFrom, before);
1224
+ pos += before.length;
1225
+ }
1226
+
1227
+ removeRange(tokenList, removeFrom, removeCount);
1228
+
1229
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1230
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
1231
+
1232
+ if (after) {
1233
+ addAfter(tokenList, currentNode, after);
1234
+ }
1235
+
1236
+ if (removeCount > 1) {
1237
+ // at least one Token object was removed, so we have to do some rematching
1238
+ // this can only happen if the current pattern is greedy
1239
+
1240
+ /** @type {RematchOptions} */
1241
+ var nestedRematch = {
1242
+ cause: token + ',' + j,
1243
+ reach: reach
1244
+ };
1245
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1246
+
1247
+ // the reach might have been extended because of the rematching
1248
+ if (rematch && nestedRematch.reach > rematch.reach) {
1249
+ rematch.reach = nestedRematch.reach;
1250
+ }
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+ }
1256
+
1257
+ /**
1258
+ * @typedef LinkedListNode
1259
+ * @property {T} value
1260
+ * @property {LinkedListNode<T> | null} prev The previous node.
1261
+ * @property {LinkedListNode<T> | null} next The next node.
1262
+ * @template T
1263
+ * @private
1264
+ */
1265
+
1266
+ /**
1267
+ * @template T
1268
+ * @private
1269
+ */
1270
+ function LinkedList() {
1271
+ /** @type {LinkedListNode<T>} */
1272
+ var head = { value: null, prev: null, next: null };
1273
+ /** @type {LinkedListNode<T>} */
1274
+ var tail = { value: null, prev: head, next: null };
1275
+ head.next = tail;
1276
+
1277
+ /** @type {LinkedListNode<T>} */
1278
+ this.head = head;
1279
+ /** @type {LinkedListNode<T>} */
1280
+ this.tail = tail;
1281
+ this.length = 0;
1282
+ }
1283
+
1284
+ /**
1285
+ * Adds a new node with the given value to the list.
1286
+ *
1287
+ * @param {LinkedList<T>} list
1288
+ * @param {LinkedListNode<T>} node
1289
+ * @param {T} value
1290
+ * @returns {LinkedListNode<T>} The added node.
1291
+ * @template T
1292
+ */
1293
+ function addAfter(list, node, value) {
1294
+ // assumes that node != list.tail && values.length >= 0
1295
+ var next = node.next;
1296
+
1297
+ var newNode = { value: value, prev: node, next: next };
1298
+ node.next = newNode;
1299
+ next.prev = newNode;
1300
+ list.length++;
1301
+
1302
+ return newNode;
1303
+ }
1304
+ /**
1305
+ * Removes `count` nodes after the given node. The given node will not be removed.
1306
+ *
1307
+ * @param {LinkedList<T>} list
1308
+ * @param {LinkedListNode<T>} node
1309
+ * @param {number} count
1310
+ * @template T
1311
+ */
1312
+ function removeRange(list, node, count) {
1313
+ var next = node.next;
1314
+ for (var i = 0; i < count && next !== list.tail; i++) {
1315
+ next = next.next;
1316
+ }
1317
+ node.next = next;
1318
+ next.prev = node;
1319
+ list.length -= i;
1320
+ }
1321
+ /**
1322
+ * @param {LinkedList<T>} list
1323
+ * @returns {T[]}
1324
+ * @template T
1325
+ */
1326
+ function toArray(list) {
1327
+ var array = [];
1328
+ var node = list.head.next;
1329
+ while (node !== list.tail) {
1330
+ array.push(node.value);
1331
+ node = node.next;
1332
+ }
1333
+ return array;
1334
+ }
1335
+
1336
+
1337
+ if (!_self.document) {
1338
+ if (!_self.addEventListener) {
1339
+ // in Node.js
1340
+ return _;
1341
+ }
1342
+
1343
+ if (!_.disableWorkerMessageHandler) {
1344
+ // In worker
1345
+ _self.addEventListener('message', function (evt) {
1346
+ var message = JSON.parse(evt.data);
1347
+ var lang = message.language;
1348
+ var code = message.code;
1349
+ var immediateClose = message.immediateClose;
1350
+
1351
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
1352
+ if (immediateClose) {
1353
+ _self.close();
1354
+ }
1355
+ }, false);
1356
+ }
1357
+
1358
+ return _;
1359
+ }
1360
+
1361
+ // Get current script and highlight
1362
+ var script = _.util.currentScript();
1363
+
1364
+ if (script) {
1365
+ _.filename = script.src;
1366
+
1367
+ if (script.hasAttribute('data-manual')) {
1368
+ _.manual = true;
1369
+ }
1370
+ }
1371
+
1372
+ function highlightAutomaticallyCallback() {
1373
+ if (!_.manual) {
1374
+ _.highlightAll();
1375
+ }
1376
+ }
1377
+
1378
+ if (!_.manual) {
1379
+ // If the document state is "loading", then we'll use DOMContentLoaded.
1380
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1381
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1382
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
1383
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1384
+ // See https://github.com/PrismJS/prism/issues/2102
1385
+ var readyState = document.readyState;
1386
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1387
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1388
+ } else {
1389
+ if (window.requestAnimationFrame) {
1390
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
1391
+ } else {
1392
+ window.setTimeout(highlightAutomaticallyCallback, 16);
1393
+ }
1394
+ }
1395
+ }
1396
+
1397
+ return _;
1398
+
1399
+ }(_self));
1400
+
1401
+ if (module.exports) {
1402
+ module.exports = Prism;
1403
+ }
1404
+
1405
+ // hack for components to work correctly in node.js
1406
+ if (typeof _commonjsHelpers.commonjsGlobal !== 'undefined') {
1407
+ _commonjsHelpers.commonjsGlobal.Prism = Prism;
1408
+ }
1409
+
1410
+ // some additional documentation/types
1411
+
1412
+ /**
1413
+ * The expansion of a simple `RegExp` literal to support additional properties.
1414
+ *
1415
+ * @typedef GrammarToken
1416
+ * @property {RegExp} pattern The regular expression of the token.
1417
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
1418
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
1419
+ * @property {boolean} [greedy=false] Whether the token is greedy.
1420
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
1421
+ * @property {Grammar} [inside] The nested grammar of this token.
1422
+ *
1423
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
1424
+ *
1425
+ * This can be used to make nested and even recursive language definitions.
1426
+ *
1427
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
1428
+ * each another.
1429
+ * @global
1430
+ * @public
1431
+ */
1432
+
1433
+ /**
1434
+ * @typedef Grammar
1435
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1436
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1437
+ * @global
1438
+ * @public
1439
+ */
1440
+
1441
+ /**
1442
+ * A function which will invoked after an element was successfully highlighted.
1443
+ *
1444
+ * @callback HighlightCallback
1445
+ * @param {Element} element The element successfully highlighted.
1446
+ * @returns {void}
1447
+ * @global
1448
+ * @public
1449
+ */
1450
+
1451
+ /**
1452
+ * @callback HookCallback
1453
+ * @param {Object<string, any>} env The environment variables of the hook.
1454
+ * @returns {void}
1455
+ * @global
1456
+ * @public
1457
+ */
1458
+
1459
+
1460
+ /* **********************************************
1461
+ Begin prism-markup.js
1462
+ ********************************************** */
1463
+
1464
+ Prism.languages.markup = {
1465
+ 'comment': {
1466
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1467
+ greedy: true
1468
+ },
1469
+ 'prolog': {
1470
+ pattern: /<\?[\s\S]+?\?>/,
1471
+ greedy: true
1472
+ },
1473
+ 'doctype': {
1474
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1475
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1476
+ greedy: true,
1477
+ inside: {
1478
+ 'internal-subset': {
1479
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1480
+ lookbehind: true,
1481
+ greedy: true,
1482
+ inside: null // see below
1483
+ },
1484
+ 'string': {
1485
+ pattern: /"[^"]*"|'[^']*'/,
1486
+ greedy: true
1487
+ },
1488
+ 'punctuation': /^<!|>$|[[\]]/,
1489
+ 'doctype-tag': /^DOCTYPE/i,
1490
+ 'name': /[^\s<>'"]+/
1491
+ }
1492
+ },
1493
+ 'cdata': {
1494
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1495
+ greedy: true
1496
+ },
1497
+ 'tag': {
1498
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1499
+ greedy: true,
1500
+ inside: {
1501
+ 'tag': {
1502
+ pattern: /^<\/?[^\s>\/]+/,
1503
+ inside: {
1504
+ 'punctuation': /^<\/?/,
1505
+ 'namespace': /^[^\s>\/:]+:/
1506
+ }
1507
+ },
1508
+ 'special-attr': [],
1509
+ 'attr-value': {
1510
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1511
+ inside: {
1512
+ 'punctuation': [
1513
+ {
1514
+ pattern: /^=/,
1515
+ alias: 'attr-equals'
1516
+ },
1517
+ {
1518
+ pattern: /^(\s*)["']|["']$/,
1519
+ lookbehind: true
1520
+ }
1521
+ ]
1522
+ }
1523
+ },
1524
+ 'punctuation': /\/?>/,
1525
+ 'attr-name': {
1526
+ pattern: /[^\s>\/]+/,
1527
+ inside: {
1528
+ 'namespace': /^[^\s>\/:]+:/
1529
+ }
1530
+ }
1531
+
1532
+ }
1533
+ },
1534
+ 'entity': [
1535
+ {
1536
+ pattern: /&[\da-z]{1,8};/i,
1537
+ alias: 'named-entity'
1538
+ },
1539
+ /&#x?[\da-f]{1,8};/i
1540
+ ]
1541
+ };
1542
+
1543
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
1544
+ Prism.languages.markup['entity'];
1545
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1546
+
1547
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
1548
+ Prism.hooks.add('wrap', function (env) {
1549
+
1550
+ if (env.type === 'entity') {
1551
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
1552
+ }
1553
+ });
1554
+
1555
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1556
+ /**
1557
+ * Adds an inlined language to markup.
1558
+ *
1559
+ * An example of an inlined language is CSS with `<style>` tags.
1560
+ *
1561
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1562
+ * case insensitive.
1563
+ * @param {string} lang The language key.
1564
+ * @example
1565
+ * addInlined('style', 'css');
1566
+ */
1567
+ value: function addInlined(tagName, lang) {
1568
+ var includedCdataInside = {};
1569
+ includedCdataInside['language-' + lang] = {
1570
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1571
+ lookbehind: true,
1572
+ inside: Prism.languages[lang]
1573
+ };
1574
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1575
+
1576
+ var inside = {
1577
+ 'included-cdata': {
1578
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1579
+ inside: includedCdataInside
1580
+ }
1581
+ };
1582
+ inside['language-' + lang] = {
1583
+ pattern: /[\s\S]+/,
1584
+ inside: Prism.languages[lang]
1585
+ };
1586
+
1587
+ var def = {};
1588
+ def[tagName] = {
1589
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
1590
+ lookbehind: true,
1591
+ greedy: true,
1592
+ inside: inside
1593
+ };
1594
+
1595
+ Prism.languages.insertBefore('markup', 'cdata', def);
1596
+ }
1597
+ });
1598
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1599
+ /**
1600
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1601
+ *
1602
+ * An example of an inlined language is CSS with `style` attributes.
1603
+ *
1604
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1605
+ * case insensitive.
1606
+ * @param {string} lang The language key.
1607
+ * @example
1608
+ * addAttribute('style', 'css');
1609
+ */
1610
+ value: function (attrName, lang) {
1611
+ Prism.languages.markup.tag.inside['special-attr'].push({
1612
+ pattern: RegExp(
1613
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1614
+ 'i'
1615
+ ),
1616
+ lookbehind: true,
1617
+ inside: {
1618
+ 'attr-name': /^[^\s=]+/,
1619
+ 'attr-value': {
1620
+ pattern: /=[\s\S]+/,
1621
+ inside: {
1622
+ 'value': {
1623
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1624
+ lookbehind: true,
1625
+ alias: [lang, 'language-' + lang],
1626
+ inside: Prism.languages[lang]
1627
+ },
1628
+ 'punctuation': [
1629
+ {
1630
+ pattern: /^=/,
1631
+ alias: 'attr-equals'
1632
+ },
1633
+ /"|'/
1634
+ ]
1635
+ }
1636
+ }
1637
+ }
1638
+ });
1639
+ }
1640
+ });
1641
+
1642
+ Prism.languages.html = Prism.languages.markup;
1643
+ Prism.languages.mathml = Prism.languages.markup;
1644
+ Prism.languages.svg = Prism.languages.markup;
1645
+
1646
+ Prism.languages.xml = Prism.languages.extend('markup', {});
1647
+ Prism.languages.ssml = Prism.languages.xml;
1648
+ Prism.languages.atom = Prism.languages.xml;
1649
+ Prism.languages.rss = Prism.languages.xml;
1650
+
1651
+
1652
+ /* **********************************************
1653
+ Begin prism-css.js
1654
+ ********************************************** */
1655
+
1656
+ (function (Prism) {
1657
+
1658
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1659
+
1660
+ Prism.languages.css = {
1661
+ 'comment': /\/\*[\s\S]*?\*\//,
1662
+ 'atrule': {
1663
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
1664
+ inside: {
1665
+ 'rule': /^@[\w-]+/,
1666
+ 'selector-function-argument': {
1667
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1668
+ lookbehind: true,
1669
+ alias: 'selector'
1670
+ },
1671
+ 'keyword': {
1672
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1673
+ lookbehind: true
1674
+ }
1675
+ // See rest below
1676
+ }
1677
+ },
1678
+ 'url': {
1679
+ // https://drafts.csswg.org/css-values-3/#urls
1680
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1681
+ greedy: true,
1682
+ inside: {
1683
+ 'function': /^url/i,
1684
+ 'punctuation': /^\(|\)$/,
1685
+ 'string': {
1686
+ pattern: RegExp('^' + string.source + '$'),
1687
+ alias: 'url'
1688
+ }
1689
+ }
1690
+ },
1691
+ 'selector': {
1692
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1693
+ lookbehind: true
1694
+ },
1695
+ 'string': {
1696
+ pattern: string,
1697
+ greedy: true
1698
+ },
1699
+ 'property': {
1700
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1701
+ lookbehind: true
1702
+ },
1703
+ 'important': /!important\b/i,
1704
+ 'function': {
1705
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1706
+ lookbehind: true
1707
+ },
1708
+ 'punctuation': /[(){};:,]/
1709
+ };
1710
+
1711
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1712
+
1713
+ var markup = Prism.languages.markup;
1714
+ if (markup) {
1715
+ markup.tag.addInlined('style', 'css');
1716
+ markup.tag.addAttribute('style', 'css');
1717
+ }
1718
+
1719
+ }(Prism));
1720
+
1721
+
1722
+ /* **********************************************
1723
+ Begin prism-clike.js
1724
+ ********************************************** */
1725
+
1726
+ Prism.languages.clike = {
1727
+ 'comment': [
1728
+ {
1729
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1730
+ lookbehind: true,
1731
+ greedy: true
1732
+ },
1733
+ {
1734
+ pattern: /(^|[^\\:])\/\/.*/,
1735
+ lookbehind: true,
1736
+ greedy: true
1737
+ }
1738
+ ],
1739
+ 'string': {
1740
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1741
+ greedy: true
1742
+ },
1743
+ 'class-name': {
1744
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1745
+ lookbehind: true,
1746
+ inside: {
1747
+ 'punctuation': /[.\\]/
1748
+ }
1749
+ },
1750
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1751
+ 'boolean': /\b(?:false|true)\b/,
1752
+ 'function': /\b\w+(?=\()/,
1753
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1754
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1755
+ 'punctuation': /[{}[\];(),.:]/
1756
+ };
1757
+
1758
+
1759
+ /* **********************************************
1760
+ Begin prism-javascript.js
1761
+ ********************************************** */
1762
+
1763
+ Prism.languages.javascript = Prism.languages.extend('clike', {
1764
+ 'class-name': [
1765
+ Prism.languages.clike['class-name'],
1766
+ {
1767
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1768
+ lookbehind: true
1769
+ }
1770
+ ],
1771
+ 'keyword': [
1772
+ {
1773
+ pattern: /((?:^|\})\s*)catch\b/,
1774
+ lookbehind: true
1775
+ },
1776
+ {
1777
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1778
+ lookbehind: true
1779
+ },
1780
+ ],
1781
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1782
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1783
+ 'number': {
1784
+ pattern: RegExp(
1785
+ /(^|[^\w$])/.source +
1786
+ '(?:' +
1787
+ (
1788
+ // constant
1789
+ /NaN|Infinity/.source +
1790
+ '|' +
1791
+ // binary integer
1792
+ /0[bB][01]+(?:_[01]+)*n?/.source +
1793
+ '|' +
1794
+ // octal integer
1795
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
1796
+ '|' +
1797
+ // hexadecimal integer
1798
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
1799
+ '|' +
1800
+ // decimal bigint
1801
+ /\d+(?:_\d+)*n/.source +
1802
+ '|' +
1803
+ // decimal number (integer or float) but no bigint
1804
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
1805
+ ) +
1806
+ ')' +
1807
+ /(?![\w$])/.source
1808
+ ),
1809
+ lookbehind: true
1810
+ },
1811
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1812
+ });
1813
+
1814
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1815
+
1816
+ Prism.languages.insertBefore('javascript', 'keyword', {
1817
+ 'regex': {
1818
+ pattern: RegExp(
1819
+ // lookbehind
1820
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1821
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
1822
+ // Regex pattern:
1823
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1824
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1825
+ // with the only syntax, so we have to define 2 different regex patterns.
1826
+ /\//.source +
1827
+ '(?:' +
1828
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
1829
+ '|' +
1830
+ // `v` flag syntax. This supports 3 levels of nested character classes.
1831
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
1832
+ ')' +
1833
+ // lookahead
1834
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1835
+ ),
1836
+ lookbehind: true,
1837
+ greedy: true,
1838
+ inside: {
1839
+ 'regex-source': {
1840
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1841
+ lookbehind: true,
1842
+ alias: 'language-regex',
1843
+ inside: Prism.languages.regex
1844
+ },
1845
+ 'regex-delimiter': /^\/|\/$/,
1846
+ 'regex-flags': /^[a-z]+$/,
1847
+ }
1848
+ },
1849
+ // This must be declared before keyword because we use "function" inside the look-forward
1850
+ 'function-variable': {
1851
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1852
+ alias: 'function'
1853
+ },
1854
+ 'parameter': [
1855
+ {
1856
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1857
+ lookbehind: true,
1858
+ inside: Prism.languages.javascript
1859
+ },
1860
+ {
1861
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1862
+ lookbehind: true,
1863
+ inside: Prism.languages.javascript
1864
+ },
1865
+ {
1866
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1867
+ lookbehind: true,
1868
+ inside: Prism.languages.javascript
1869
+ },
1870
+ {
1871
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1872
+ lookbehind: true,
1873
+ inside: Prism.languages.javascript
1874
+ }
1875
+ ],
1876
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1877
+ });
1878
+
1879
+ Prism.languages.insertBefore('javascript', 'string', {
1880
+ 'hashbang': {
1881
+ pattern: /^#!.*/,
1882
+ greedy: true,
1883
+ alias: 'comment'
1884
+ },
1885
+ 'template-string': {
1886
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1887
+ greedy: true,
1888
+ inside: {
1889
+ 'template-punctuation': {
1890
+ pattern: /^`|`$/,
1891
+ alias: 'string'
1892
+ },
1893
+ 'interpolation': {
1894
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1895
+ lookbehind: true,
1896
+ inside: {
1897
+ 'interpolation-punctuation': {
1898
+ pattern: /^\$\{|\}$/,
1899
+ alias: 'punctuation'
1900
+ },
1901
+ rest: Prism.languages.javascript
1902
+ }
1903
+ },
1904
+ 'string': /[\s\S]+/
1905
+ }
1906
+ },
1907
+ 'string-property': {
1908
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1909
+ lookbehind: true,
1910
+ greedy: true,
1911
+ alias: 'property'
1912
+ }
1913
+ });
1914
+
1915
+ Prism.languages.insertBefore('javascript', 'operator', {
1916
+ 'literal-property': {
1917
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1918
+ lookbehind: true,
1919
+ alias: 'property'
1920
+ },
1921
+ });
1922
+
1923
+ if (Prism.languages.markup) {
1924
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
1925
+
1926
+ // add attribute support for all DOM events.
1927
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1928
+ Prism.languages.markup.tag.addAttribute(
1929
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1930
+ 'javascript'
1931
+ );
1932
+ }
1933
+
1934
+ Prism.languages.js = Prism.languages.javascript;
1935
+
1936
+
1937
+ /* **********************************************
1938
+ Begin prism-file-highlight.js
1939
+ ********************************************** */
1940
+
1941
+ (function () {
1942
+
1943
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
1944
+ return;
1945
+ }
1946
+
1947
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1948
+ if (!Element.prototype.matches) {
1949
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1950
+ }
1951
+
1952
+ var LOADING_MESSAGE = 'Loading…';
1953
+ var FAILURE_MESSAGE = function (status, message) {
1954
+ return '✖ Error ' + status + ' while fetching file: ' + message;
1955
+ };
1956
+ var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
1957
+
1958
+ var EXTENSIONS = {
1959
+ 'js': 'javascript',
1960
+ 'py': 'python',
1961
+ 'rb': 'ruby',
1962
+ 'ps1': 'powershell',
1963
+ 'psm1': 'powershell',
1964
+ 'sh': 'bash',
1965
+ 'bat': 'batch',
1966
+ 'h': 'c',
1967
+ 'tex': 'latex'
1968
+ };
1969
+
1970
+ var STATUS_ATTR = 'data-src-status';
1971
+ var STATUS_LOADING = 'loading';
1972
+ var STATUS_LOADED = 'loaded';
1973
+ var STATUS_FAILED = 'failed';
1974
+
1975
+ var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
1976
+ + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1977
+
1978
+ /**
1979
+ * Loads the given file.
1980
+ *
1981
+ * @param {string} src The URL or path of the source file to load.
1982
+ * @param {(result: string) => void} success
1983
+ * @param {(reason: string) => void} error
1984
+ */
1985
+ function loadFile(src, success, error) {
1986
+ var xhr = new XMLHttpRequest();
1987
+ xhr.open('GET', src, true);
1988
+ xhr.onreadystatechange = function () {
1989
+ if (xhr.readyState == 4) {
1990
+ if (xhr.status < 400 && xhr.responseText) {
1991
+ success(xhr.responseText);
1992
+ } else {
1993
+ if (xhr.status >= 400) {
1994
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1995
+ } else {
1996
+ error(FAILURE_EMPTY_MESSAGE);
1997
+ }
1998
+ }
1999
+ }
2000
+ };
2001
+ xhr.send(null);
2002
+ }
2003
+
2004
+ /**
2005
+ * Parses the given range.
2006
+ *
2007
+ * This returns a range with inclusive ends.
2008
+ *
2009
+ * @param {string | null | undefined} range
2010
+ * @returns {[number, number | undefined] | undefined}
2011
+ */
2012
+ function parseRange(range) {
2013
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
2014
+ if (m) {
2015
+ var start = Number(m[1]);
2016
+ var comma = m[2];
2017
+ var end = m[3];
2018
+
2019
+ if (!comma) {
2020
+ return [start, start];
2021
+ }
2022
+ if (!end) {
2023
+ return [start, undefined];
2024
+ }
2025
+ return [start, Number(end)];
2026
+ }
2027
+ return undefined;
2028
+ }
2029
+
2030
+ Prism.hooks.add('before-highlightall', function (env) {
2031
+ env.selector += ', ' + SELECTOR;
2032
+ });
2033
+
2034
+ Prism.hooks.add('before-sanity-check', function (env) {
2035
+ var pre = /** @type {HTMLPreElement} */ (env.element);
2036
+ if (pre.matches(SELECTOR)) {
2037
+ env.code = ''; // fast-path the whole thing and go to complete
2038
+
2039
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
2040
+
2041
+ // add code element with loading message
2042
+ var code = pre.appendChild(document.createElement('CODE'));
2043
+ code.textContent = LOADING_MESSAGE;
2044
+
2045
+ var src = pre.getAttribute('data-src');
2046
+
2047
+ var language = env.language;
2048
+ if (language === 'none') {
2049
+ // the language might be 'none' because there is no language set;
2050
+ // in this case, we want to use the extension as the language
2051
+ var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
2052
+ language = EXTENSIONS[extension] || extension;
2053
+ }
2054
+
2055
+ // set language classes
2056
+ Prism.util.setLanguage(code, language);
2057
+ Prism.util.setLanguage(pre, language);
2058
+
2059
+ // preload the language
2060
+ var autoloader = Prism.plugins.autoloader;
2061
+ if (autoloader) {
2062
+ autoloader.loadLanguages(language);
2063
+ }
2064
+
2065
+ // load file
2066
+ loadFile(
2067
+ src,
2068
+ function (text) {
2069
+ // mark as loaded
2070
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
2071
+
2072
+ // handle data-range
2073
+ var range = parseRange(pre.getAttribute('data-range'));
2074
+ if (range) {
2075
+ var lines = text.split(/\r\n?|\n/g);
2076
+
2077
+ // the range is one-based and inclusive on both ends
2078
+ var start = range[0];
2079
+ var end = range[1] == null ? lines.length : range[1];
2080
+
2081
+ if (start < 0) { start += lines.length; }
2082
+ start = Math.max(0, Math.min(start - 1, lines.length));
2083
+ if (end < 0) { end += lines.length; }
2084
+ end = Math.max(0, Math.min(end, lines.length));
2085
+
2086
+ text = lines.slice(start, end).join('\n');
2087
+
2088
+ // add data-start for line numbers
2089
+ if (!pre.hasAttribute('data-start')) {
2090
+ pre.setAttribute('data-start', String(start + 1));
2091
+ }
2092
+ }
2093
+
2094
+ // highlight code
2095
+ code.textContent = text;
2096
+ Prism.highlightElement(code);
2097
+ },
2098
+ function (error) {
2099
+ // mark as failed
2100
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
2101
+
2102
+ code.textContent = error;
2103
+ }
2104
+ );
2105
+ }
2106
+ });
2107
+
2108
+ Prism.plugins.fileHighlight = {
2109
+ /**
2110
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
2111
+ *
2112
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
2113
+ *
2114
+ * @param {ParentNode} [container=document]
2115
+ */
2116
+ highlight: function highlight(container) {
2117
+ var elements = (container || document).querySelectorAll(SELECTOR);
2118
+
2119
+ for (var i = 0, element; (element = elements[i++]);) {
2120
+ Prism.highlightElement(element);
2121
+ }
2122
+ }
2123
+ };
2124
+
2125
+ var logged = false;
2126
+ /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
2127
+ Prism.fileHighlight = function () {
2128
+ if (!logged) {
2129
+ console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
2130
+ logged = true;
2131
+ }
2132
+ Prism.plugins.fileHighlight.highlight.apply(this, arguments);
2133
+ };
2134
+
2135
+ }());
2136
+ } (prism));
2137
+
2138
+ var prismExports = prism.exports;
2139
+ var Prism = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(prismExports);
2140
+
2141
+ var css = "code[class*=language-],pre[class*=language-]{word-wrap:normal;background:none;color:#ccc;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;-webkit-hyphens:none;hyphens:none;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;white-space:pre;word-break:normal;word-spacing:normal}pre[class*=language-]{margin:.5em 0;overflow:auto;padding:1em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{border-radius:.3em;padding:.1em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}";
2142
+ injectCss.n(css,{});
2143
+
2144
+ var SyntaxHighlighter = function SyntaxHighlighter(_ref) {
2145
+ var className = _ref.className,
2146
+ code = _ref.code,
2147
+ language = _ref.language;
2148
+ React.useEffect(function () {
2149
+ Prism.highlightAll();
2150
+ }, [code]);
2151
+ return /*#__PURE__*/jsxRuntime.jsx("pre", {
2152
+ className: className,
2153
+ children: /*#__PURE__*/jsxRuntime.jsx("code", {
2154
+ className: "language-".concat(language),
2155
+ children: code
2156
+ })
2157
+ });
2158
+ };
2159
+ var SyntaxHighlighter$1 = /*#__PURE__*/React.memo(SyntaxHighlighter);
2160
+
2161
+ var CodeBlock = function CodeBlock(_ref) {
2162
+ var _ref$title = _ref.title,
2163
+ title = _ref$title === void 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
2164
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2165
+ i18nKey: "neetoMolecules.codeblock.codeSnippet"
2166
+ })
2167
+ }) : _ref$title,
2168
+ codeString = _ref.codeString,
2169
+ _ref$showCopyButton = _ref.showCopyButton,
2170
+ showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
2171
+ _ref$className = _ref.className,
2172
+ className = _ref$className === void 0 ? "" : _ref$className,
2173
+ _ref$sendViaEmail = _ref.sendViaEmail,
2174
+ sendViaEmail = _ref$sendViaEmail === void 0 ? undefined : _ref$sendViaEmail,
2175
+ _ref$frameworkProps = _ref.frameworkProps,
2176
+ frameworkProps = _ref$frameworkProps === void 0 ? {} : _ref$frameworkProps;
2177
+ var _useTranslation = reactI18next.useTranslation(),
2178
+ t = _useTranslation.t;
2179
+ var _ref2 = frameworkProps !== null && frameworkProps !== void 0 ? frameworkProps : {},
2180
+ selectedFramework = _ref2.selectedFramework,
2181
+ setSelectedFramework = _ref2.setSelectedFramework;
2182
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
2183
+ className: classnames(["relative", className]),
2184
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2185
+ className: "neeto-ui-rounded-lg neeto-ui-border-gray-200 neeto-ui-bg-gray-50 flex w-full flex-wrap items-center justify-between gap-2 rounded-b-none border p-3",
2186
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Typography, {
2187
+ className: "m-0 flex-shrink-0",
2188
+ "data-cy": "code-block-title-text",
2189
+ style: "h4",
2190
+ children: title
2191
+ }), selectedFramework && /*#__PURE__*/jsxRuntime.jsx(Select, {
2192
+ className: "w-40",
2193
+ "data-testid": "framework-select",
2194
+ options: FRAMEWORK_SELECT_OPTIONS,
2195
+ value: selectedFramework,
2196
+ onChange: setSelectedFramework
2197
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2198
+ className: "ml-auto flex flex-shrink-0 items-center justify-end gap-2",
2199
+ children: [sendViaEmail ? /*#__PURE__*/jsxRuntime.jsx(Button, {
2200
+ style: "text",
2201
+ label: t("neetoMolecules.widget.installation.snippet.sendViaEmail"),
2202
+ onClick: sendViaEmail
2203
+ }) : null, showCopyButton && /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
2204
+ label: t("neetoMolecules.widget.installation.snippet.copy"),
2205
+ style: "primary",
2206
+ value: codeString
2207
+ })]
2208
+ })]
2209
+ }), /*#__PURE__*/jsxRuntime.jsx(SyntaxHighlighter$1, {
2210
+ className: "neeto-ui-bg-gray-800 neeto-ui-rounded-lg m-0 rounded-t-none",
2211
+ code: codeString,
2212
+ language: "javascript"
2213
+ })]
2214
+ });
2215
+ };
2216
+
2217
+ var buildEmbedWidgetScript = function buildEmbedWidgetScript() {
2218
+ var widgetScriptUrl = window.globalProps.railsEnv === RAILS_ENV.production ? NEETO_WIDGET_SCRIPT_URL.production : NEETO_WIDGET_SCRIPT_URL.staging;
2219
+ return "<script src=\"".concat(widgetScriptUrl, "\"></script>");
2220
+ };
2221
+ var indentAndFormat = function indentAndFormat(str) {
2222
+ var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ramda.identity;
2223
+ return str.split("\n").map(formatter).join("\n ");
2224
+ };
2225
+ var getCommentedCommand = function getCommentedCommand(command, isEnabled) {
2226
+ return isEnabled ? command : "/// ".concat(command);
2227
+ };
2228
+ var embedWidgetEnvironment = function embedWidgetEnvironment() {
2229
+ switch (window.globalProps.railsEnv) {
2230
+ case RAILS_ENV.production:
2231
+ return "";
2232
+ case RAILS_ENV.development:
2233
+ return "environment: \"".concat(RAILS_ENV.development, "\",");
2234
+ case RAILS_ENV.staging:
2235
+ return "environment: \"".concat(RAILS_ENV.staging, "\",");
2236
+ default:
2237
+ return "/* Unidentified RAILS_ENV, */";
2238
+ }
2239
+ };
2240
+ var embedWidgetApiKey = function embedWidgetApiKey(apiKey) {
2241
+ return "apiKey: \"".concat(apiKey, "\",");
2242
+ };
2243
+ var addEngageOptions = function addEngageOptions() {
2244
+ return "neetoEngageOptions: {\n elementId: \"neetoengage-trigger\",\n},";
2245
+ };
2246
+ var wrapBlockInOnLoad = function wrapBlockInOnLoad(codeBlock) {
2247
+ return "window.addEventListener(\"load\", () => ".concat(codeBlock, ");");
2248
+ };
2249
+ var embedWidgetFunctionCall = function embedWidgetFunctionCall(enabledWidgets, apiKey) {
2250
+ return "embedNeetoWidget({\n ".concat(embedWidgetEnvironment(), "\n ").concat(indentAndFormat(embedWidgetApiKey(apiKey)), "\n ").concat(indentAndFormat(addEngageOptions(), function (cmd) {
2251
+ return getCommentedCommand(cmd, enabledWidgets.engage);
2252
+ }), "\n})");
2253
+ };
2254
+ var filterMarkedCommands = function filterMarkedCommands(queryString) {
2255
+ return queryString.split("\n").filter(function (line) {
2256
+ return !line.includes("///") && line.trim();
2257
+ }).join("\n");
2258
+ };
2259
+ var getSampleUserIdentity = function getSampleUserIdentity(enabledWidgets, selectedFramework) {
2260
+ var splitCodeLines = SAMPLE_USER_IDENTITY_CODE_STRING[selectedFramework].split("\n");
2261
+ return filterMarkedCommands(splitCodeLines.map(function (cmd) {
2262
+ var isEmailKey = cmd.includes("email");
2263
+ var isObjectStartLine = cmd === splitCodeLines[0];
2264
+ var isObjectEndLine = cmd === ramda.last(splitCodeLines);
2265
+ var isLineHidden = !isEmailKey && !isObjectStartLine && !isObjectEndLine;
2266
+ if (!enabledWidgets.chat && isLineHidden || !enabledWidgets.chat && !enabledWidgets.replay) {
2267
+ return null;
2268
+ }
2269
+ return cmd;
2270
+ }).join("\n"));
2271
+ };
2272
+ var sampleConsolidatedCodeString = function sampleConsolidatedCodeString(enabledWidgets, apiKey) {
2273
+ return filterMarkedCommands("".concat(buildEmbedWidgetScript(), "\n<script>\n ").concat(enabledWidgets.chat || enabledWidgets.replay ? "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {};") : "", "\n ").concat(enabledWidgets.replay ? "window.".concat(SESSION_CONTEXT_KEY, " = {};") : "", "\n\n ").concat(indentAndFormat(wrapBlockInOnLoad(embedWidgetFunctionCall(enabledWidgets, apiKey))), "\n</script>"));
2274
+ };
2275
+ var getEmailWidgetSnippetFormInitialValues = function getEmailWidgetSnippetFormInitialValues(subject) {
2276
+ return {
2277
+ emails: "",
2278
+ subject: subject
2279
+ };
2280
+ };
2281
+ var getSortedPrefixedWidgets = function getSortedPrefixedWidgets(widgets) {
2282
+ var sortedWidgets = widgets.sort().map(function (widget) {
2283
+ return "Neeto".concat(neetoCist.capitalize(widget));
2284
+ });
2285
+ return sortedWidgets.length === 1 ? sortedWidgets : i18next.t("neetoMolecules.widget.email.widgetList", {
2286
+ widgets: sortedWidgets
2287
+ });
2288
+ };
2289
+ var getWidgetDescriptions = function getWidgetDescriptions(widgets) {
2290
+ var values = Object.entries(WIDGET_DESCRIPTIONS).filter(function (_ref) {
2291
+ var _ref2 = _slicedToArray(_ref, 1),
2292
+ widget = _ref2[0];
2293
+ return widgets.includes(widget);
2294
+ });
2295
+ return ramda.pluck(1, values);
2296
+ };
2297
+ var getEmailWidgetSnippetValidationSchema = function getEmailWidgetSnippetValidationSchema() {
2298
+ return yup__namespace.object({
2299
+ emails: yup__namespace.array().required().label(i18next.t("neetoMolecules.widget.email.fields.emails.label")),
2300
+ subject: yup__namespace.string().required().label(i18next.t("neetoMolecules.widget.email.fields.subject.label"))
2301
+ });
2302
+ };
2303
+ var getWidgetApiKeyUrl = function getWidgetApiKeyUrl() {
2304
+ return "api/widget/v1/api_keys/".concat(window.globalProps.organization.subdomain);
2305
+ };
2306
+ var shouldShowSwitches = function shouldShowSwitches() {
2307
+ var _globalProps$user;
2308
+ var email = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || "";
2309
+ if (window.globalProps.railsEnv === RAILS_ENV.production) {
2310
+ return email.toLowerCase().endsWith("@bigbinary.com");
2311
+ }
2312
+ return true;
2313
+ };
2314
+
2315
+ var queryWidgetApiKey = function queryWidgetApiKey() {
2316
+ return axios.get(getWidgetApiKeyUrl(), {
2317
+ showToastr: false
2318
+ });
2319
+ };
2320
+ var emailWidgetSnippet = function emailWidgetSnippet(data) {
2321
+ return axios.post(EMBED_CODE_EMAIL_URL, data);
2322
+ };
2323
+ var fetchWidgetConfiguration = function fetchWidgetConfiguration() {
2324
+ return axios.get(WIDGET_CONFIG_URL);
2325
+ };
2326
+ var updateWidgetConfiguration = function updateWidgetConfiguration(_ref) {
2327
+ var id = _ref.id,
2328
+ payload = _ref.payload;
2329
+ return axios.put("".concat(WIDGET_CONFIG_URL, "/").concat(id), payload);
2330
+ };
2331
+
2332
+ var useEmailEmbedCode = function useEmailEmbedCode(onSuccess) {
2333
+ return reactQuery.useMutation({
2334
+ mutationFn: function mutationFn(emailData) {
2335
+ return emailWidgetSnippet(emailData);
2336
+ },
2337
+ onSuccess: onSuccess
2338
+ });
2339
+ };
2340
+
2341
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2342
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2343
+ var CodeSnippet = function CodeSnippet(_ref) {
2344
+ var isPaneOpen = _ref.isPaneOpen,
2345
+ onClose = _ref.onClose,
2346
+ _ref$onSent = _ref.onSent,
2347
+ onSent = _ref$onSent === void 0 ? neetoCist.noop : _ref$onSent,
2348
+ codeString = _ref.codeString,
2349
+ _ref$subject = _ref.subject,
2350
+ subject = _ref$subject === void 0 ? "" : _ref$subject,
2351
+ _ref$body = _ref.body,
2352
+ body = _ref$body === void 0 ? "" : _ref$body,
2353
+ _ref$emailType = _ref.emailType,
2354
+ emailType = _ref$emailType === void 0 ? EMAIL_TYPES.embedCode : _ref$emailType,
2355
+ _ref$enabledWidgets = _ref.enabledWidgets,
2356
+ enabledWidgets = _ref$enabledWidgets === void 0 ? {} : _ref$enabledWidgets;
2357
+ var _useTranslation = reactI18next.useTranslation(),
2358
+ t = _useTranslation.t;
2359
+ var _useState = React.useState(FRAMEWORK_SELECT_OPTIONS[0]),
2360
+ _useState2 = _slicedToArray(_useState, 2),
2361
+ selectedFramework = _useState2[0],
2362
+ setSelectedFramework = _useState2[1];
2363
+ var emailMutation = useEmailEmbedCode(onSent);
2364
+ var codeToDisplay = emailType === EMAIL_TYPES.userIdentity ? getSampleUserIdentity(enabledWidgets, selectedFramework.value) : codeString;
2365
+ var handleSubmit = function handleSubmit(formData) {
2366
+ var _body$ref$current$inn, _body$ref;
2367
+ if (ramda.any(function (_ref2) {
2368
+ var valid = _ref2.valid;
2369
+ return !valid;
2370
+ }, formData.emails)) {
2371
+ Toastr.error(t("neetoMolecules.widget.email.fields.emails.invalidError"));
2372
+ return;
2373
+ }
2374
+ emailMutation.mutate({
2375
+ subject: formData.subject,
2376
+ emails: ramda.pluck("value", formData.emails),
2377
+ message: (_body$ref$current$inn = (_body$ref = body.ref) === null || _body$ref === void 0 ? void 0 : _body$ref.current.innerHTML) !== null && _body$ref$current$inn !== void 0 ? _body$ref$current$inn : body,
2378
+ snippet: codeToDisplay
2379
+ });
2380
+ };
2381
+ var renderCodeBlockProps = function renderCodeBlockProps() {
2382
+ var props = {
2383
+ codeString: codeToDisplay,
2384
+ showCopyButton: false,
2385
+ className: "neeto-ui-rounded-lg"
2386
+ };
2387
+ if (emailType === EMAIL_TYPES.userIdentity) {
2388
+ props = ramda.assoc("frameworkProps", {
2389
+ selectedFramework: selectedFramework,
2390
+ setSelectedFramework: setSelectedFramework
2391
+ }, props);
2392
+ }
2393
+ return props;
2394
+ };
2395
+ return /*#__PURE__*/jsxRuntime.jsx(Pane, {
2396
+ onClose: onClose,
2397
+ isOpen: isPaneOpen,
2398
+ children: /*#__PURE__*/jsxRuntime.jsx(formik.Formik, {
2399
+ initialValues: getEmailWidgetSnippetFormInitialValues(subject),
2400
+ validationSchema: getEmailWidgetSnippetValidationSchema(),
2401
+ onSubmit: handleSubmit,
2402
+ children: /*#__PURE__*/jsxRuntime.jsxs(formik.Form, {
2403
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
2404
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2405
+ style: "h2",
2406
+ children: t("neetoMolecules.widget.email.title")
2407
+ })
2408
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane.Body, {
2409
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
2410
+ className: "w-full space-y-4",
2411
+ children: [/*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, {
2412
+ required: true,
2413
+ label: t("neetoMolecules.widget.email.fields.emails.label"),
2414
+ name: "emails",
2415
+ placeholder: t("neetoMolecules.widget.email.fields.emails.placeholder")
2416
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
2417
+ required: true,
2418
+ label: t("neetoMolecules.widget.email.fields.subject.label"),
2419
+ name: "subject",
2420
+ type: "text"
2421
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
2422
+ style: "body2",
2423
+ children: body
2424
+ }), /*#__PURE__*/jsxRuntime.jsx(CodeBlock, _objectSpread$3({}, renderCodeBlockProps()))]
2425
+ })
2426
+ }), /*#__PURE__*/jsxRuntime.jsxs(Pane.Footer, {
2427
+ className: "gap-x-2",
2428
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
2429
+ disabled: emailMutation.isPending,
2430
+ label: t("neetoMolecules.widget.email.actions.send"),
2431
+ loading: emailMutation.isPending,
2432
+ type: "submit"
2433
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, {
2434
+ label: t("neetoMolecules.widget.email.actions.cancel"),
2435
+ style: "text",
2436
+ onClick: onClose
2437
+ })]
2438
+ })]
2439
+ })
2440
+ })
2441
+ });
2442
+ };
2443
+
2444
+ var useForceUpdate = function useForceUpdate() {
2445
+ // eslint-disable-next-line react/hook-use-state
2446
+ var _useState = React.useState(0),
2447
+ _useState2 = _slicedToArray(_useState, 2),
2448
+ setValue = _useState2[1];
2449
+ return function () {
2450
+ return setValue(function (value) {
2451
+ return value + 1;
2452
+ });
2453
+ };
2454
+ };
2455
+
2456
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2457
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2458
+ var useFetchApiKey = function useFetchApiKey() {
2459
+ return reactQuery.useQuery({
2460
+ queryKey: [QUERY_KEYS.apiKey],
2461
+ queryFn: function queryFn() {
2462
+ if (window.globalProps.railsEnv === "heroku" || !window.globalProps.ssoEnabled) {
2463
+ return Promise.resolve({
2464
+ widgetApiKey: "placeholder-api-key"
2465
+ });
2466
+ }
2467
+ return queryWidgetApiKey();
2468
+ },
2469
+ staleTime: DEFAULT_QUERY_STALE_TIME
2470
+ });
2471
+ };
2472
+ var useFetchConfigurations = function useFetchConfigurations() {
2473
+ return reactQuery.useQuery({
2474
+ queryKey: [QUERY_KEYS.configuration],
2475
+ queryFn: fetchWidgetConfiguration,
2476
+ staleTime: DEFAULT_QUERY_STALE_TIME
2477
+ });
2478
+ };
2479
+ var useUpdateConfigurations = function useUpdateConfigurations() {
2480
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2481
+ return useMutationWithInvalidation(updateWidgetConfiguration, _objectSpread$2({
2482
+ keysToInvalidate: [[QUERY_KEYS.configuration]]
2483
+ }, options));
2484
+ };
2485
+
2486
+ var TooltipSwitch = withT(function (_ref) {
2487
+ var t = _ref.t,
2488
+ enabledClientApps = _ref.enabledClientApps,
2489
+ widget = _ref.widget,
2490
+ selectedWidgets = _ref.selectedWidgets,
2491
+ updateSelectedWidgets = _ref.updateSelectedWidgets;
2492
+ return /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
2493
+ disabled: enabledClientApps.includes(widget),
2494
+ placement: "right",
2495
+ content: t("neetoMolecules.widget.tooltips.productIsDisabled", {
2496
+ productName: "Neeto".concat(neetoCist.capitalize(widget))
2497
+ }),
2498
+ children: /*#__PURE__*/jsxRuntime.jsx(Switch, {
2499
+ checked: selectedWidgets.includes(widget),
2500
+ disabled: !enabledClientApps.includes(widget),
2501
+ onChange: function onChange() {
2502
+ return updateSelectedWidgets(widget);
2503
+ }
2504
+ })
2505
+ });
2506
+ });
2507
+
2508
+ var SelectionSwitches = function SelectionSwitches(_ref) {
2509
+ var selectedWidgets = _ref.selectedWidgets,
2510
+ updateSelectedWidgets = _ref.updateSelectedWidgets,
2511
+ primaryApp = _ref.primaryApp,
2512
+ enabledClientApps = _ref.enabledClientApps;
2513
+ var primaryWidget = WIDGET_TYPES_VALUES.includes(primaryApp) ? primaryApp : "";
2514
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
2515
+ className: "mb-4 flex w-full flex-wrap items-center justify-between gap-6",
2516
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2517
+ className: "flex items-center space-x-2",
2518
+ children: [neetoCist.isNotEmpty(primaryWidget) && /*#__PURE__*/jsxRuntime.jsx(TooltipSwitch, {
2519
+ enabledClientApps: enabledClientApps,
2520
+ selectedWidgets: selectedWidgets,
2521
+ updateSelectedWidgets: updateSelectedWidgets,
2522
+ widget: primaryWidget
2523
+ }), /*#__PURE__*/jsxRuntime.jsxs(Label, {
2524
+ children: ["Neeto", neetoCist.capitalize(primaryWidget)]
2525
+ })]
2526
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2527
+ className: "flex flex-wrap items-center gap-6 sm:justify-end",
2528
+ children: WIDGET_TYPES_VALUES.map(function (widget, index) {
2529
+ return primaryApp !== widget && /*#__PURE__*/jsxRuntime.jsxs("div", {
2530
+ className: "flex items-center space-x-2",
2531
+ children: [/*#__PURE__*/jsxRuntime.jsx(TooltipSwitch, {
2532
+ enabledClientApps: enabledClientApps,
2533
+ selectedWidgets: selectedWidgets,
2534
+ updateSelectedWidgets: updateSelectedWidgets,
2535
+ widget: widget
2536
+ }), /*#__PURE__*/jsxRuntime.jsxs(Label, {
2537
+ children: ["Neeto", neetoCist.capitalize(widget)]
2538
+ })]
2539
+ }, index);
2540
+ })
2541
+ })]
2542
+ });
2543
+ };
2544
+
2545
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2546
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2547
+ var EmbedCode = function EmbedCode(_ref) {
2548
+ var showSessionContext = _ref.showSessionContext,
2549
+ showUserIdentity = _ref.showUserIdentity,
2550
+ _ref$primaryApp = _ref.primaryApp,
2551
+ primaryApp = _ref$primaryApp === void 0 ? "" : _ref$primaryApp,
2552
+ _ref$maxWidth = _ref.maxWidth,
2553
+ maxWidth = _ref$maxWidth === void 0 ? "max-w-3xl" : _ref$maxWidth;
2554
+ var _useState = React.useState(EMAIL_TYPES["null"]),
2555
+ _useState2 = _slicedToArray(_useState, 2),
2556
+ emailType = _useState2[0],
2557
+ setEmailType = _useState2[1];
2558
+ var _useState3 = React.useState(FRAMEWORK_SELECT_OPTIONS[0]),
2559
+ _useState4 = _slicedToArray(_useState3, 2),
2560
+ selectedFramework = _useState4[0],
2561
+ setSelectedFramework = _useState4[1];
2562
+ var _useTranslation = reactI18next.useTranslation(),
2563
+ t = _useTranslation.t;
2564
+ var bodyRef = React.useRef();
2565
+ var forceUpdate = useForceUpdate();
2566
+ React.useEffect(function () {
2567
+ forceUpdate();
2568
+ }, []);
2569
+ var _useFetchApiKey = useFetchApiKey(),
2570
+ _useFetchApiKey$data = _useFetchApiKey.data,
2571
+ _useFetchApiKey$data2 = _useFetchApiKey$data === void 0 ? {} : _useFetchApiKey$data,
2572
+ _useFetchApiKey$data3 = _useFetchApiKey$data2.widgetApiKey,
2573
+ widgetApiKey = _useFetchApiKey$data3 === void 0 ? "" : _useFetchApiKey$data3,
2574
+ isLoadingApiKey = _useFetchApiKey.isLoading;
2575
+ var _useFetchConfiguratio = useFetchConfigurations(),
2576
+ _useFetchConfiguratio2 = _useFetchConfiguratio.data,
2577
+ _useFetchConfiguratio3 = _useFetchConfiguratio2 === void 0 ? {} : _useFetchConfiguratio2,
2578
+ _useFetchConfiguratio4 = _useFetchConfiguratio3.neetoWidgetTokens,
2579
+ neetoWidgetTokens = _useFetchConfiguratio4 === void 0 ? [] : _useFetchConfiguratio4,
2580
+ isLoadingConfigurations = _useFetchConfiguratio.isLoading;
2581
+ var _useUpdateConfigurati = useUpdateConfigurations(),
2582
+ updateWidgetConfiguration = _useUpdateConfigurati.mutate;
2583
+ var previousEmailType = usePrevious(emailType);
2584
+ var selectedWidgets = neetoWidgetTokens.filter(function (item) {
2585
+ return item.enabled && (shouldShowSwitches() || item.clientApplicationName.toLowerCase() === primaryApp);
2586
+ }).map(function (item) {
2587
+ return item.clientApplicationName.toLowerCase();
2588
+ });
2589
+ var isOnlyChatWidgetSelected = selectedWidgets.length === 1 && selectedWidgets[0] === WIDGET_TYPES.chat;
2590
+ var enabledClientApps = neetoWidgetTokens.filter(ramda.prop("clientApplicationEnabled")).map(function (item) {
2591
+ return item.clientApplicationName.toLowerCase();
2592
+ });
2593
+ var enabledWidgets = ramda.fromPairs(selectedWidgets.map(function (widget) {
2594
+ return [widget, true];
2595
+ }));
2596
+ var shouldShowUserIdentity = showUserIdentity !== null && showUserIdentity !== void 0 ? showUserIdentity : enabledWidgets.chat || enabledWidgets.replay;
2597
+ var shouldShowSessionContext = showSessionContext !== null && showSessionContext !== void 0 ? showSessionContext : enabledWidgets.replay;
2598
+ var updateSelectedWidgets = function updateSelectedWidgets(widget) {
2599
+ var widgetId = neetoWidgetTokens.find(function (item) {
2600
+ return item.clientApplicationName.toLowerCase() === widget;
2601
+ }).id;
2602
+ var isEnabled = !selectedWidgets.includes(widget);
2603
+ updateWidgetConfiguration({
2604
+ id: widgetId,
2605
+ payload: {
2606
+ enabled: isEnabled
2607
+ }
2608
+ }, {
2609
+ onSuccess: function onSuccess() {
2610
+ var productName = "neeto".concat(neetoCist.capitalize(widget));
2611
+ var response = isEnabled ? "neetoMolecules.widget.installation.enabled" : "neetoMolecules.widget.installation.disabled";
2612
+ Toastr.success(t(response, {
2613
+ productName: productName
2614
+ }));
2615
+ }
2616
+ });
2617
+ };
2618
+ var getEmbedCodeString = function getEmbedCodeString() {
2619
+ return neetoCist.isNotEmpty(widgetApiKey) ? sampleConsolidatedCodeString(enabledWidgets, widgetApiKey) : "";
2620
+ };
2621
+ var _getSnippetProps = function getSnippetProps(selectedEmailType) {
2622
+ switch (selectedEmailType) {
2623
+ case EMAIL_TYPES.embedCode:
2624
+ return {
2625
+ codeString: getEmbedCodeString(),
2626
+ subject: t("neetoMolecules.widget.email.fields.subject.values.embedCode", {
2627
+ widgetList: getSortedPrefixedWidgets(selectedWidgets)
2628
+ }),
2629
+ body: /*#__PURE__*/jsxRuntime.jsxs("div", {
2630
+ ref: bodyRef,
2631
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2632
+ i18nKey: "neetoMolecules.widget.email.body.values.embedCode.mainText",
2633
+ components: {
2634
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2635
+ className: "mb-2",
2636
+ style: "body2"
2637
+ })
2638
+ },
2639
+ values: {
2640
+ val: getWidgetDescriptions(selectedWidgets)
2641
+ }
2642
+ }), /*#__PURE__*/jsxRuntime.jsx(ChatWidgetBody, {
2643
+ widgets: selectedWidgets
2644
+ }), /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2645
+ i18nKey: "neetoMolecules.widget.email.body.values.embedCode.supportText",
2646
+ values: {
2647
+ helpEmail: INSTALLATION_HELP_EMAIL
2648
+ },
2649
+ components: {
2650
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2651
+ className: "mb-2",
2652
+ style: "body2"
2653
+ }),
2654
+ mail: /*#__PURE__*/jsxRuntime.jsx(Button, {
2655
+ href: "mailto:".concat(INSTALLATION_HELP_EMAIL),
2656
+ rel: "noreferrer",
2657
+ style: "link",
2658
+ target: "_blank"
2659
+ })
2660
+ }
2661
+ })]
2662
+ })
2663
+ };
2664
+ case EMAIL_TYPES.userIdentity:
2665
+ return {
2666
+ emailType: EMAIL_TYPES.userIdentity,
2667
+ enabledWidgets: enabledWidgets,
2668
+ subject: t("neetoMolecules.widget.email.fields.subject.values.userIdentity"),
2669
+ body: /*#__PURE__*/jsxRuntime.jsx("div", {
2670
+ ref: bodyRef,
2671
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2672
+ i18nKey: "neetoMolecules.widget.email.body.values.userIdentity",
2673
+ components: {
2674
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2675
+ className: "mb-2",
2676
+ style: "body2"
2677
+ }),
2678
+ configureLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
2679
+ rel: "noreferrer",
2680
+ style: "link",
2681
+ target: "_blank",
2682
+ href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
2683
+ })
2684
+ },
2685
+ values: {
2686
+ userIdentityKbUrl: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
2687
+ }
2688
+ })
2689
+ })
2690
+ };
2691
+ case EMAIL_TYPES.sessionContext:
2692
+ return {
2693
+ codeString: SAMPLE_CONTEXT_CODE_STRING,
2694
+ subject: t("neetoMolecules.widget.email.fields.subject.values.sessionContext"),
2695
+ body: /*#__PURE__*/jsxRuntime.jsx("div", {
2696
+ ref: bodyRef,
2697
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2698
+ i18nKey: "neetoMolecules.widget.email.body.values.sessionContext",
2699
+ values: {
2700
+ sessionContextKbUrl: NEETO_REPLAY_CONFIGURE_URL
2701
+ },
2702
+ components: {
2703
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2704
+ className: "mb-2",
2705
+ style: "body2"
2706
+ }),
2707
+ configureLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
2708
+ href: NEETO_REPLAY_CONFIGURE_URL,
2709
+ rel: "noreferrer",
2710
+ style: "link",
2711
+ target: "_blank"
2712
+ })
2713
+ }
2714
+ })
2715
+ })
2716
+ };
2717
+ case EMAIL_TYPES["null"]:
2718
+ return previousEmailType !== EMAIL_TYPES["null"] ? _getSnippetProps(previousEmailType) : {};
2719
+ default:
2720
+ throw new Error(t("neetoMolecules.widget.email.invalidType"));
2721
+ }
2722
+ };
2723
+ var handleSendViaEmail = function handleSendViaEmail(selectedEmail) {
2724
+ if (ramda.isEmpty(selectedWidgets)) {
2725
+ Toastr.error(t("neetoMolecules.widget.installation.snippet.disabledError"));
2726
+ return;
2727
+ }
2728
+ setEmailType(selectedEmail);
2729
+ };
2730
+ var getSelectedWidgetsInstructionsKey = function getSelectedWidgetsInstructionsKey() {
2731
+ if (ramda.isEmpty(selectedWidgets)) {
2732
+ return "neetoMolecules.widget.installation.instructions.placement.noneOfThese";
2733
+ }
2734
+ if (isOnlyChatWidgetSelected) {
2735
+ return "neetoMolecules.widget.installation.instructions.placement.selectedChatWidget";
2736
+ }
2737
+ return "neetoMolecules.widget.installation.instructions.placement.selectedWidgets";
2738
+ };
2739
+ var embedHelpTextTranslationComponents = {
2740
+ fontBold: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2741
+ component: "span",
2742
+ style: "body2",
2743
+ weight: "semibold"
2744
+ }),
2745
+ widgetNpmLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
2746
+ href: USE_NEETO_WIDGET_NPM_PAGE_URL,
2747
+ rel: "noreferrer",
2748
+ style: "link",
2749
+ target: "_blank"
2750
+ }),
2751
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button, {
2752
+ href: WIDGET_KB_HELP_URL[primaryApp],
2753
+ rel: "noreferrer",
2754
+ style: "link",
2755
+ target: "_blank"
2756
+ })
2757
+ };
2758
+ if (isLoadingApiKey || isLoadingConfigurations) {
2759
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
2760
+ className: "flex h-full w-full items-center justify-center",
2761
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
2762
+ });
2763
+ }
2764
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
2765
+ className: "mx-auto mb-10 w-full flex-col items-center justify-start",
2766
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2767
+ className: classnames("mx-auto", maxWidth),
2768
+ children: [shouldShowSwitches() && /*#__PURE__*/jsxRuntime.jsx(SelectionSwitches, {
2769
+ enabledClientApps: enabledClientApps,
2770
+ primaryApp: primaryApp,
2771
+ selectedWidgets: selectedWidgets,
2772
+ updateSelectedWidgets: updateSelectedWidgets
2773
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2774
+ className: "mb-8 w-full flex-grow flex-col items-center justify-start",
2775
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2776
+ className: "mx-auto mb-2 w-full",
2777
+ "data-testid": "embed-code-block",
2778
+ children: /*#__PURE__*/jsxRuntime.jsx(CodeBlock, {
2779
+ className: "neeto-ui-rounded-lg",
2780
+ codeString: getEmbedCodeString(),
2781
+ sendViaEmail: function sendViaEmail() {
2782
+ return handleSendViaEmail(EMAIL_TYPES.embedCode);
2783
+ },
2784
+ title: /*#__PURE__*/jsxRuntime.jsx("div", {
2785
+ children: t("neetoMolecules.widget.title.embedCode")
2786
+ })
2787
+ })
2788
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2789
+ className: "w-full",
2790
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2791
+ components: embedHelpTextTranslationComponents,
2792
+ i18nKey: getSelectedWidgetsInstructionsKey(),
2793
+ values: {
2794
+ widgetList: getSortedPrefixedWidgets(selectedWidgets)
2795
+ }
2796
+ })
2797
+ })]
2798
+ }), shouldShowUserIdentity ? /*#__PURE__*/jsxRuntime.jsxs("div", {
2799
+ className: "mb-8 w-full flex-grow flex-col items-center justify-start",
2800
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2801
+ className: "mx-auto mb-2 w-full",
2802
+ children: /*#__PURE__*/jsxRuntime.jsx(CodeBlock, {
2803
+ className: "neeto-ui-rounded-lg",
2804
+ frameworkProps: {
2805
+ selectedFramework: selectedFramework,
2806
+ setSelectedFramework: setSelectedFramework
2807
+ },
2808
+ title: t("neetoMolecules.widget.title.userIdentity"),
2809
+ codeString: getSampleUserIdentity(enabledWidgets, selectedFramework.value),
2810
+ sendViaEmail: function sendViaEmail() {
2811
+ return handleSendViaEmail(EMAIL_TYPES.userIdentity);
2812
+ }
2813
+ })
2814
+ }), /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2815
+ i18nKey: "neetoMolecules.widget.installation.instructions.userIdentity",
2816
+ components: {
2817
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2818
+ style: "body2"
2819
+ }),
2820
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button, {
2821
+ rel: "noreferrer",
2822
+ style: "link",
2823
+ target: "_blank",
2824
+ href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
2825
+ })
2826
+ }
2827
+ })]
2828
+ }) : null, shouldShowSessionContext ? /*#__PURE__*/jsxRuntime.jsxs("div", {
2829
+ className: "w-full flex-grow flex-col items-center justify-start",
2830
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2831
+ className: "mx-auto mb-2 w-full",
2832
+ children: /*#__PURE__*/jsxRuntime.jsx(CodeBlock, {
2833
+ className: "neeto-ui-rounded-lg",
2834
+ codeString: SAMPLE_CONTEXT_CODE_STRING,
2835
+ title: t("neetoMolecules.widget.title.sessionContext"),
2836
+ sendViaEmail: function sendViaEmail() {
2837
+ return handleSendViaEmail(EMAIL_TYPES.sessionContext);
2838
+ }
2839
+ })
2840
+ }), /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2841
+ i18nKey: "neetoMolecules.widget.installation.instructions.sessionContext",
2842
+ components: {
2843
+ p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2844
+ style: "body2"
2845
+ }),
2846
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button, {
2847
+ href: NEETO_REPLAY_CONFIGURE_URL,
2848
+ rel: "noreferrer",
2849
+ style: "link",
2850
+ target: "_blank"
2851
+ })
2852
+ }
2853
+ })]
2854
+ }) : null]
2855
+ }), /*#__PURE__*/jsxRuntime.jsx(CodeSnippet, _objectSpread$1({
2856
+ isPaneOpen: !!emailType && neetoCist.isNotEmpty(selectedWidgets),
2857
+ onClose: function onClose() {
2858
+ return setEmailType(EMAIL_TYPES["null"]);
2859
+ }
2860
+ }, _getSnippetProps(emailType)))]
2861
+ });
2862
+ };
2863
+ var EmbedCode$1 = /*#__PURE__*/React.memo(EmbedCode);
2864
+
2865
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2866
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2867
+ var queryClient = new reactQuery.QueryClient();
2868
+ var Main = function Main(props) {
2869
+ var _useTranslation = reactI18next.useTranslation(),
2870
+ t = _useTranslation.t;
2871
+ var shouldRenderEmbedCode = window.globalProps.ssoEnabled;
2872
+ return shouldRenderEmbedCode ? /*#__PURE__*/jsxRuntime.jsx(reactQuery.QueryClientProvider, {
2873
+ client: queryClient,
2874
+ children: /*#__PURE__*/jsxRuntime.jsx(EmbedCode$1, _objectSpread({}, props))
2875
+ }) : /*#__PURE__*/jsxRuntime.jsx(Callout, {
2876
+ icon: Info,
2877
+ style: "info",
2878
+ children: t("neetoMolecules.widget.developmentInfo")
2879
+ });
2880
+ };
2881
+
2882
+ var NeetoWidget = {
2883
+ EmbedCode: Main,
2884
+ WIDGET_TYPES: WIDGET_TYPES
2885
+ };
2886
+
2887
+ module.exports = NeetoWidget;
2888
+ //# sourceMappingURL=NeetoWidget.js.map