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