@lotte-innovate/ui-component-test 0.1.114 → 0.1.116

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. package/README.md +1 -2
  2. package/dist/globals.css +3 -3
  3. package/dist/lib/Typography/Header/index.d.ts +1 -1
  4. package/dist/lib/Typography/Header/index.js +2 -2
  5. package/dist/lib/Typography/Text/index.d.ts +1 -1
  6. package/dist/lib/Typography/Text/index.js +2 -2
  7. package/dist/lib/color/alpha.mjs.map +1 -1
  8. package/dist/lib/color/constants.mjs.map +1 -1
  9. package/dist/lib/color/light.mjs.map +1 -1
  10. package/dist/lib/components/Accordion/index.d.ts +1 -1
  11. package/dist/lib/components/Accordion/index.js +4 -4
  12. package/dist/lib/components/AlertDialog/AlertDialogAction.d.ts +1 -1
  13. package/dist/lib/components/AlertDialog/AlertDialogAction.js +3 -3
  14. package/dist/lib/components/AlertDialog/AlertDialogCancel.d.ts +1 -1
  15. package/dist/lib/components/AlertDialog/AlertDialogCancel.js +2 -2
  16. package/dist/lib/components/AlertDialog/AlertDialogContent.js +2 -2
  17. package/dist/lib/components/AlertDialog/AlertDialogDescription.js +1 -1
  18. package/dist/lib/components/AlertDialog/AlertDialogRoot.d.ts +1 -1
  19. package/dist/lib/components/AlertDialog/AlertDialogRoot.js +2 -2
  20. package/dist/lib/components/AlertDialog/AlertDialogTitle.js +1 -1
  21. package/dist/lib/components/AlertDialog/AlertDialogTrigger.d.ts +1 -1
  22. package/dist/lib/components/AlertDialog/AlertDialogTrigger.js +4 -4
  23. package/dist/lib/components/AlertDialog/index.mjs.map +1 -1
  24. package/dist/lib/components/AspectRatio/index.js +3 -3
  25. package/dist/lib/components/Avatar/index.js +4 -4
  26. package/dist/lib/components/Badge/index.d.ts +1 -1
  27. package/dist/lib/components/Badge/index.js +4 -4
  28. package/dist/lib/components/BarChart/index.d.ts +1 -1
  29. package/dist/lib/components/BarChart/index.js +4 -4
  30. package/dist/lib/components/BarChart/index.mjs.map +1 -1
  31. package/dist/lib/components/Breadcrumb/BreadcrumbEllipsis.js +1 -1
  32. package/dist/lib/components/Breadcrumb/BreadcrumbEllipsis.mjs.map +1 -1
  33. package/dist/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  34. package/dist/lib/components/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  35. package/dist/lib/components/Breadcrumb/BreadcrumbLink.js +1 -1
  36. package/dist/lib/components/Breadcrumb/BreadcrumbLink.mjs.map +1 -1
  37. package/dist/lib/components/Breadcrumb/BreadcrumbList.js +1 -1
  38. package/dist/lib/components/Breadcrumb/BreadcrumbList.mjs.map +1 -1
  39. package/dist/lib/components/Breadcrumb/BreadcrumbPage.js +1 -1
  40. package/dist/lib/components/Breadcrumb/BreadcrumbPage.mjs.map +1 -1
  41. package/dist/lib/components/Breadcrumb/BreadcrumbRoot.js +3 -3
  42. package/dist/lib/components/Breadcrumb/BreadcrumbSeparator.js +1 -1
  43. package/dist/lib/components/Breadcrumb/BreadcrumbSeparator.mjs.map +1 -1
  44. package/dist/lib/components/Breadcrumb/index.mjs.map +1 -1
  45. package/dist/lib/components/BubbleChart/index.d.ts +1 -1
  46. package/dist/lib/components/BubbleChart/index.js +4 -4
  47. package/dist/lib/components/BubbleChart/index.mjs.map +1 -1
  48. package/dist/lib/components/Button/index.d.ts +1 -1
  49. package/dist/lib/components/Button/index.js +4 -4
  50. package/dist/lib/components/Callout/CalloutIcon.js +2 -2
  51. package/dist/lib/components/Callout/CalloutRoot.d.ts +1 -1
  52. package/dist/lib/components/Callout/CalloutRoot.js +3 -3
  53. package/dist/lib/components/Callout/CalloutText.js +1 -1
  54. package/dist/lib/components/Callout/index.mjs.map +1 -1
  55. package/dist/lib/components/Card/index.d.ts +1 -1
  56. package/dist/lib/components/Card/index.js +3 -3
  57. package/dist/lib/components/Checkbox/index.d.ts +1 -1
  58. package/dist/lib/components/Checkbox/index.js +4 -4
  59. package/dist/lib/components/CheckboxCard/index.d.ts +2 -2
  60. package/dist/lib/components/CheckboxCard/index.js +5 -5
  61. package/dist/lib/components/CheckboxGroup/CheckboxGroupItem.d.ts +1 -1
  62. package/dist/lib/components/CheckboxGroup/CheckboxGroupItem.js +1 -1
  63. package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.d.ts +2 -2
  64. package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.js +3 -3
  65. package/dist/lib/components/CheckboxGroup/index.mjs.map +1 -1
  66. package/dist/lib/components/Collapsible/index.d.ts +1 -1
  67. package/dist/lib/components/Collapsible/index.js +4 -4
  68. package/dist/lib/components/ContextMenu/ContextMenuCheckboxItem.js +2 -2
  69. package/dist/lib/components/ContextMenu/ContextMenuContent.js +2 -2
  70. package/dist/lib/components/ContextMenu/ContextMenuGroup.mjs.map +1 -1
  71. package/dist/lib/components/ContextMenu/ContextMenuItem.js +3 -3
  72. package/dist/lib/components/ContextMenu/ContextMenuItemIndicator.js +2 -2
  73. package/dist/lib/components/ContextMenu/ContextMenuLabel.js +2 -2
  74. package/dist/lib/components/ContextMenu/ContextMenuRadioItem.js +2 -2
  75. package/dist/lib/components/ContextMenu/ContextMenuRoot.d.ts +1 -1
  76. package/dist/lib/components/ContextMenu/ContextMenuRoot.js +2 -2
  77. package/dist/lib/components/ContextMenu/ContextMenuSeparator.js +1 -1
  78. package/dist/lib/components/ContextMenu/ContextMenuSeparator.mjs.map +1 -1
  79. package/dist/lib/components/ContextMenu/ContextMenuSubContent.js +2 -2
  80. package/dist/lib/components/ContextMenu/ContextMenuSubTrigger.js +3 -3
  81. package/dist/lib/components/ContextMenu/ContextMenuTrigger.js +1 -1
  82. package/dist/lib/components/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
  83. package/dist/lib/components/ContextMenu/index.mjs.map +1 -1
  84. package/dist/lib/components/DataList/DataListItem.js +2 -2
  85. package/dist/lib/components/DataList/DataListLabel.js +2 -2
  86. package/dist/lib/components/DataList/DataListRoot.js +2 -2
  87. package/dist/lib/components/DataList/DataListValue.js +2 -2
  88. package/dist/lib/components/DataList/index.mjs.map +1 -1
  89. package/dist/lib/components/Dialog/DialogAction.js +3 -3
  90. package/dist/lib/components/Dialog/DialogCancel.js +1 -1
  91. package/dist/lib/components/Dialog/DialogContent.js +2 -2
  92. package/dist/lib/components/Dialog/DialogDescription.js +1 -1
  93. package/dist/lib/components/Dialog/DialogRoot.js +2 -2
  94. package/dist/lib/components/Dialog/DialogSlot.js +1 -1
  95. package/dist/lib/components/Dialog/DialogTitle.js +1 -1
  96. package/dist/lib/components/Dialog/DialogTrigger.mjs.map +1 -1
  97. package/dist/lib/components/Dialog/index.mjs.map +1 -1
  98. package/dist/lib/components/DoughnutChart/index.d.ts +1 -1
  99. package/dist/lib/components/DoughnutChart/index.js +3 -3
  100. package/dist/lib/components/DoughnutChart/index.mjs.map +1 -1
  101. package/dist/lib/components/DropdownMenu/DropdonMenuRadioGroup.mjs.map +1 -1
  102. package/dist/lib/components/DropdownMenu/DropdonMenuSubContent.js +2 -2
  103. package/dist/lib/components/DropdownMenu/DropdownMenuCheckboxItem.js +2 -2
  104. package/dist/lib/components/DropdownMenu/DropdownMenuContent.js +2 -2
  105. package/dist/lib/components/DropdownMenu/DropdownMenuItem.d.ts +1 -1
  106. package/dist/lib/components/DropdownMenu/DropdownMenuItem.js +3 -3
  107. package/dist/lib/components/DropdownMenu/DropdownMenuItemIndicator.js +2 -2
  108. package/dist/lib/components/DropdownMenu/DropdownMenuLable.js +1 -1
  109. package/dist/lib/components/DropdownMenu/DropdownMenuRadioItem.js +2 -2
  110. package/dist/lib/components/DropdownMenu/DropdownMenuRoot.d.ts +1 -1
  111. package/dist/lib/components/DropdownMenu/DropdownMenuRoot.js +2 -2
  112. package/dist/lib/components/DropdownMenu/DropdownMenuSeparator.js +1 -1
  113. package/dist/lib/components/DropdownMenu/DropdownMenuSeparator.mjs.map +1 -1
  114. package/dist/lib/components/DropdownMenu/DropdownMenuSub.mjs.map +1 -1
  115. package/dist/lib/components/DropdownMenu/DropdownMenuSubTrigger.js +3 -3
  116. package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
  117. package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  118. package/dist/lib/components/DropdownMenu/index.mjs.map +1 -1
  119. package/dist/lib/components/Editor/index copy.js +2 -2
  120. package/dist/lib/components/Editor/index.d.ts +15 -16
  121. package/dist/lib/components/Editor/index.js +51 -93
  122. package/dist/lib/components/Editor/index.mjs +1 -1
  123. package/dist/lib/components/Footer/index.js +3 -3
  124. package/dist/lib/components/Gnb/GnbInfo.js +1 -1
  125. package/dist/lib/components/Gnb/GnbLogo.js +2 -2
  126. package/dist/lib/components/Gnb/GnbMenu.d.ts +1 -1
  127. package/dist/lib/components/Gnb/GnbMenu.js +1 -1
  128. package/dist/lib/components/Gnb/GnbRoot.js +3 -3
  129. package/dist/lib/components/Gnb/index.mjs.map +1 -1
  130. package/dist/lib/components/Grid/Pagination.mjs.map +1 -1
  131. package/dist/lib/components/Grid/index.js +2 -2
  132. package/dist/lib/components/HoverCard/HoverCardContent.js +2 -2
  133. package/dist/lib/components/HoverCard/HoverCardRoot.js +2 -2
  134. package/dist/lib/components/HoverCard/HoverCardTrigger.mjs.map +1 -1
  135. package/dist/lib/components/HoverCard/index.mjs.map +1 -1
  136. package/dist/lib/components/IconButton/index.d.ts +1 -1
  137. package/dist/lib/components/IconButton/index.js +4 -4
  138. package/dist/lib/components/Inset/index.js +3 -3
  139. package/dist/lib/components/Label/index.d.ts +1 -1
  140. package/dist/lib/components/Label/index.js +3 -3
  141. package/dist/lib/components/LineChart/index.d.ts +1 -1
  142. package/dist/lib/components/LineChart/index.js +4 -4
  143. package/dist/lib/components/LineChart/index.mjs.map +1 -1
  144. package/dist/lib/components/Menubar/MenubarCheckboxItem.js +3 -3
  145. package/dist/lib/components/Menubar/MenubarContent.js +2 -2
  146. package/dist/lib/components/Menubar/MenubarItem.js +3 -3
  147. package/dist/lib/components/Menubar/MenubarItemIndicator.js +2 -2
  148. package/dist/lib/components/Menubar/MenubarMenu.mjs.map +1 -1
  149. package/dist/lib/components/Menubar/MenubarRadioItem.js +3 -3
  150. package/dist/lib/components/Menubar/MenubarRoot.d.ts +1 -1
  151. package/dist/lib/components/Menubar/MenubarRoot.js +4 -4
  152. package/dist/lib/components/Menubar/MenubarSeparator.js +1 -1
  153. package/dist/lib/components/Menubar/MenubarSeparator.mjs.map +1 -1
  154. package/dist/lib/components/Menubar/MenubarSub.mjs.map +1 -1
  155. package/dist/lib/components/Menubar/MenubarSubContent.js +2 -2
  156. package/dist/lib/components/Menubar/MenubarSubTrigger.js +3 -3
  157. package/dist/lib/components/Menubar/MenubarTrigger.js +2 -2
  158. package/dist/lib/components/Menubar/index.mjs.map +1 -1
  159. package/dist/lib/components/NavigationMenu/NavigationMenuContent.js +2 -2
  160. package/dist/lib/components/NavigationMenu/NavigationMenuIndicator.js +1 -1
  161. package/dist/lib/components/NavigationMenu/NavigationMenuIndicator.mjs.map +1 -1
  162. package/dist/lib/components/NavigationMenu/NavigationMenuItem.mjs.map +1 -1
  163. package/dist/lib/components/NavigationMenu/NavigationMenuLink.js +3 -3
  164. package/dist/lib/components/NavigationMenu/NavigationMenuList.js +3 -3
  165. package/dist/lib/components/NavigationMenu/NavigationMenuRoot.d.ts +1 -1
  166. package/dist/lib/components/NavigationMenu/NavigationMenuRoot.js +3 -3
  167. package/dist/lib/components/NavigationMenu/NavigationMenuTrigger.js +3 -3
  168. package/dist/lib/components/NavigationMenu/NavigationMenuViewport.js +2 -2
  169. package/dist/lib/components/NavigationMenu/index.mjs.map +1 -1
  170. package/dist/lib/components/PieChart/index.d.ts +1 -1
  171. package/dist/lib/components/PieChart/index.js +3 -3
  172. package/dist/lib/components/PieChart/index.mjs.map +1 -1
  173. package/dist/lib/components/Popover/PopoverClose.js +1 -1
  174. package/dist/lib/components/Popover/PopoverContent.d.ts +1 -1
  175. package/dist/lib/components/Popover/PopoverContent.js +2 -2
  176. package/dist/lib/components/Popover/PopoverRoot.js +1 -1
  177. package/dist/lib/components/Popover/PopoverTrigger.mjs.map +1 -1
  178. package/dist/lib/components/Popover/index.mjs.map +1 -1
  179. package/dist/lib/components/Progress/index.js +4 -4
  180. package/dist/lib/components/RadarChart/index.d.ts +1 -1
  181. package/dist/lib/components/RadarChart/index.js +4 -4
  182. package/dist/lib/components/RadarChart/index.mjs.map +1 -1
  183. package/dist/lib/components/Radio/index.d.ts +1 -1
  184. package/dist/lib/components/Radio/index.js +4 -4
  185. package/dist/lib/components/RadioCards/RadioCardsItem.js +1 -1
  186. package/dist/lib/components/RadioCards/RadioCardsRoot.js +4 -4
  187. package/dist/lib/components/RadioCards/index.mjs.map +1 -1
  188. package/dist/lib/components/RadioGroup/RadioGroupItem.js +1 -1
  189. package/dist/lib/components/RadioGroup/RadioGroupRoot.d.ts +1 -1
  190. package/dist/lib/components/RadioGroup/RadioGroupRoot.js +3 -3
  191. package/dist/lib/components/RadioGroup/index.mjs.map +1 -1
  192. package/dist/lib/components/ScrollArea/index.js +1 -1
  193. package/dist/lib/components/SegmentedControl/SegmentedControlItem.js +1 -1
  194. package/dist/lib/components/SegmentedControl/SegmentedControlItem.mjs.map +1 -1
  195. package/dist/lib/components/SegmentedControl/SegmentedControlRoot.d.ts +1 -1
  196. package/dist/lib/components/SegmentedControl/SegmentedControlRoot.js +3 -3
  197. package/dist/lib/components/SegmentedControl/index.mjs.map +1 -1
  198. package/dist/lib/components/Select/index.d.ts +2 -2
  199. package/dist/lib/components/Select/index.js +6 -6
  200. package/dist/lib/components/Select/index.mjs +1 -1
  201. package/dist/lib/components/Separator/index.js +3 -3
  202. package/dist/lib/components/Skeleton/index.d.ts +1 -1
  203. package/dist/lib/components/Skeleton/index.js +3 -3
  204. package/dist/lib/components/Slider/index.d.ts +1 -1
  205. package/dist/lib/components/Slider/index.js +4 -4
  206. package/dist/lib/components/Spinner/index.d.ts +1 -1
  207. package/dist/lib/components/Spinner/index.js +3 -3
  208. package/dist/lib/components/TabNav/index.js +3 -3
  209. package/dist/lib/components/Table/index.d.ts +1 -1
  210. package/dist/lib/components/Table/index.js +3 -3
  211. package/dist/lib/components/Tabs/index.d.ts +1 -1
  212. package/dist/lib/components/Tabs/index.js +4 -4
  213. package/dist/lib/components/TextArea/index.d.ts +1 -1
  214. package/dist/lib/components/TextArea/index.js +4 -4
  215. package/dist/lib/components/TextField/index.d.ts +1 -1
  216. package/dist/lib/components/TextField/index.js +4 -4
  217. package/dist/lib/components/Timeline/TimelineConnector.js +1 -1
  218. package/dist/lib/components/Timeline/TimelineContent.js +1 -1
  219. package/dist/lib/components/Timeline/TimelineDescription.js +1 -1
  220. package/dist/lib/components/Timeline/TimelineHeader.js +1 -1
  221. package/dist/lib/components/Timeline/TimelineIcon.js +2 -2
  222. package/dist/lib/components/Timeline/TimelineItem.js +1 -1
  223. package/dist/lib/components/Timeline/TimelineRoot.js +2 -2
  224. package/dist/lib/components/Timeline/TimelineTime.js +1 -1
  225. package/dist/lib/components/Timeline/TimelineTitle.js +1 -1
  226. package/dist/lib/components/Toast/ToastActionButton.d.ts +1 -1
  227. package/dist/lib/components/Toast/ToastActionButton.js +5 -5
  228. package/dist/lib/components/Toast/ToastDescription.d.ts +1 -1
  229. package/dist/lib/components/Toast/ToastDescription.js +1 -1
  230. package/dist/lib/components/Toast/ToastRoot.js +3 -3
  231. package/dist/lib/components/Toast/ToastTitle.d.ts +1 -1
  232. package/dist/lib/components/Toast/ToastTitle.js +1 -1
  233. package/dist/lib/components/Toast/index.mjs.map +1 -1
  234. package/dist/lib/components/Toggle/ToggleWithText.d.ts +1 -1
  235. package/dist/lib/components/Toggle/ToggleWithText.js +5 -5
  236. package/dist/lib/components/Toggle/index.d.ts +1 -1
  237. package/dist/lib/components/Toggle/index.js +4 -4
  238. package/dist/lib/components/ToggleGroup/ToggleGroupItem.d.ts +1 -1
  239. package/dist/lib/components/ToggleGroup/ToggleGroupItem.js +2 -2
  240. package/dist/lib/components/ToggleGroup/ToggleGroupRoot.d.ts +1 -1
  241. package/dist/lib/components/ToggleGroup/ToggleGroupRoot.js +4 -4
  242. package/dist/lib/components/ToggleGroup/index.mjs.map +1 -1
  243. package/dist/lib/components/ToggleSwitch/index.js +5 -5
  244. package/dist/lib/components/Tooltip/index.d.ts +1 -1
  245. package/dist/lib/components/Tooltip/index.js +3 -3
  246. package/dist/lib/constants.js +1 -1
  247. package/dist/lib/constants.mjs.map +1 -1
  248. package/dist/lib/theme/ThemeProvider.d.ts +1 -1
  249. package/dist/lib/utils/useDarkMode.js +1 -1
  250. package/dist/lib/utils/utils.mjs.map +1 -1
  251. package/dist/public/tinymce/icons/default/icons.d.ts +0 -0
  252. package/dist/public/tinymce/icons/default/icons.js +195 -0
  253. package/dist/public/tinymce/icons/default/index.d.ts +1 -0
  254. package/dist/public/tinymce/icons/default/index.js +8 -0
  255. package/dist/public/tinymce/models/dom/index.d.ts +1 -0
  256. package/dist/public/tinymce/models/dom/index.js +8 -0
  257. package/dist/public/tinymce/models/dom/model.d.ts +0 -0
  258. package/dist/public/tinymce/models/dom/model.js +7988 -0
  259. package/dist/public/tinymce/plugins/advlist/index.d.ts +1 -0
  260. package/dist/public/tinymce/plugins/advlist/index.js +8 -0
  261. package/dist/public/tinymce/plugins/advlist/plugin.d.ts +0 -0
  262. package/dist/public/tinymce/plugins/advlist/plugin.js +255 -0
  263. package/dist/public/tinymce/plugins/code/index.d.ts +1 -0
  264. package/dist/public/tinymce/plugins/code/index.js +8 -0
  265. package/dist/public/tinymce/plugins/code/plugin.d.ts +0 -0
  266. package/dist/public/tinymce/plugins/code/plugin.js +77 -0
  267. package/dist/public/tinymce/plugins/codesample/index.d.ts +1 -0
  268. package/dist/public/tinymce/plugins/codesample/index.js +8 -0
  269. package/dist/public/tinymce/plugins/codesample/plugin.d.ts +45 -0
  270. package/dist/public/tinymce/plugins/codesample/plugin.js +2462 -0
  271. package/dist/public/tinymce/plugins/image/index.d.ts +1 -0
  272. package/dist/public/tinymce/plugins/image/index.js +8 -0
  273. package/dist/public/tinymce/plugins/image/plugin.d.ts +0 -0
  274. package/dist/public/tinymce/plugins/image/plugin.js +1523 -0
  275. package/dist/public/tinymce/plugins/link/index.d.ts +1 -0
  276. package/dist/public/tinymce/plugins/link/index.js +8 -0
  277. package/dist/public/tinymce/plugins/link/plugin.d.ts +0 -0
  278. package/dist/public/tinymce/plugins/link/plugin.js +1246 -0
  279. package/dist/public/tinymce/plugins/lists/index.d.ts +1 -0
  280. package/dist/public/tinymce/plugins/lists/index.js +8 -0
  281. package/dist/public/tinymce/plugins/lists/plugin.d.ts +0 -0
  282. package/dist/public/tinymce/plugins/lists/plugin.js +2191 -0
  283. package/dist/public/tinymce/plugins/table/index.d.ts +1 -0
  284. package/dist/public/tinymce/plugins/table/index.js +8 -0
  285. package/dist/public/tinymce/plugins/table/plugin.d.ts +0 -0
  286. package/dist/public/tinymce/plugins/table/plugin.js +3399 -0
  287. package/dist/public/tinymce/skins/content/default/content.d.ts +0 -0
  288. package/dist/public/tinymce/skins/content/default/content.js +3 -0
  289. package/dist/public/tinymce/skins/ui/oxide/content.d.ts +0 -0
  290. package/dist/public/tinymce/skins/ui/oxide/content.js +3 -0
  291. package/dist/public/tinymce/skins/ui/oxide/skin.d.ts +0 -0
  292. package/dist/public/tinymce/skins/ui/oxide/skin.js +3 -0
  293. package/dist/public/tinymce/themes/silver/index.d.ts +1 -0
  294. package/dist/public/tinymce/themes/silver/index.js +8 -0
  295. package/dist/public/tinymce/themes/silver/theme.d.ts +0 -0
  296. package/dist/public/tinymce/themes/silver/theme.js +29731 -0
  297. package/dist/tsconfig.tsbuildinfo +1 -1
  298. package/package.json +2 -4
  299. package/dist/lib/tailwind.config.d.ts +0 -3
  300. package/dist/lib/tsconfig.tsbuildinfo +0 -1
  301. package/public/skins/content/default/content.css +0 -61
  302. package/public/skins/ui/oxide/content.min.css +0 -1
  303. package/public/skins/ui/oxide/skin.min.css +0 -1
@@ -0,0 +1,2191 @@
1
+ "use strict";
2
+ /**
3
+ * TinyMCE version 6.8.5 (TBD)
4
+ */
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
17
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
18
+ if (ar || !(i in from)) {
19
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
20
+ ar[i] = from[i];
21
+ }
22
+ }
23
+ return to.concat(ar || Array.prototype.slice.call(from));
24
+ };
25
+ (function () {
26
+ 'use strict';
27
+ var global$7 = tinymce.util.Tools.resolve('tinymce.PluginManager');
28
+ var hasProto = function (v, constructor, predicate) {
29
+ var _a;
30
+ if (predicate(v, constructor.prototype)) {
31
+ return true;
32
+ }
33
+ else {
34
+ return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
35
+ }
36
+ };
37
+ var typeOf = function (x) {
38
+ var t = typeof x;
39
+ if (x === null) {
40
+ return 'null';
41
+ }
42
+ else if (t === 'object' && Array.isArray(x)) {
43
+ return 'array';
44
+ }
45
+ else if (t === 'object' && hasProto(x, String, function (o, proto) { return proto.isPrototypeOf(o); })) {
46
+ return 'string';
47
+ }
48
+ else {
49
+ return t;
50
+ }
51
+ };
52
+ var isType$1 = function (type) { return function (value) { return typeOf(value) === type; }; };
53
+ var isSimpleType = function (type) { return function (value) { return typeof value === type; }; };
54
+ var isString = isType$1('string');
55
+ var isObject = isType$1('object');
56
+ var isArray = isType$1('array');
57
+ var isBoolean = isSimpleType('boolean');
58
+ var isNullable = function (a) { return a === null || a === undefined; };
59
+ var isNonNullable = function (a) { return !isNullable(a); };
60
+ var isFunction = isSimpleType('function');
61
+ var isNumber = isSimpleType('number');
62
+ var noop = function () {
63
+ };
64
+ var compose1 = function (fbc, fab) { return function (a) { return fbc(fab(a)); }; };
65
+ var constant = function (value) {
66
+ return function () {
67
+ return value;
68
+ };
69
+ };
70
+ var tripleEquals = function (a, b) {
71
+ return a === b;
72
+ };
73
+ function curry(fn) {
74
+ var initialArgs = [];
75
+ for (var _i = 1; _i < arguments.length; _i++) {
76
+ initialArgs[_i - 1] = arguments[_i];
77
+ }
78
+ return function () {
79
+ var restArgs = [];
80
+ for (var _i = 0; _i < arguments.length; _i++) {
81
+ restArgs[_i] = arguments[_i];
82
+ }
83
+ var all = initialArgs.concat(restArgs);
84
+ return fn.apply(null, all);
85
+ };
86
+ }
87
+ var not = function (f) { return function (t) { return !f(t); }; };
88
+ var never = constant(false);
89
+ var Optional = /** @class */ (function () {
90
+ function Optional(tag, value) {
91
+ this.tag = tag;
92
+ this.value = value;
93
+ }
94
+ Optional.some = function (value) {
95
+ return new Optional(true, value);
96
+ };
97
+ Optional.none = function () {
98
+ return Optional.singletonNone;
99
+ };
100
+ Optional.prototype.fold = function (onNone, onSome) {
101
+ if (this.tag) {
102
+ return onSome(this.value);
103
+ }
104
+ else {
105
+ return onNone();
106
+ }
107
+ };
108
+ Optional.prototype.isSome = function () {
109
+ return this.tag;
110
+ };
111
+ Optional.prototype.isNone = function () {
112
+ return !this.tag;
113
+ };
114
+ Optional.prototype.map = function (mapper) {
115
+ if (this.tag) {
116
+ return Optional.some(mapper(this.value));
117
+ }
118
+ else {
119
+ return Optional.none();
120
+ }
121
+ };
122
+ Optional.prototype.bind = function (binder) {
123
+ if (this.tag) {
124
+ return binder(this.value);
125
+ }
126
+ else {
127
+ return Optional.none();
128
+ }
129
+ };
130
+ Optional.prototype.exists = function (predicate) {
131
+ return this.tag && predicate(this.value);
132
+ };
133
+ Optional.prototype.forall = function (predicate) {
134
+ return !this.tag || predicate(this.value);
135
+ };
136
+ Optional.prototype.filter = function (predicate) {
137
+ if (!this.tag || predicate(this.value)) {
138
+ return this;
139
+ }
140
+ else {
141
+ return Optional.none();
142
+ }
143
+ };
144
+ Optional.prototype.getOr = function (replacement) {
145
+ return this.tag ? this.value : replacement;
146
+ };
147
+ Optional.prototype.or = function (replacement) {
148
+ return this.tag ? this : replacement;
149
+ };
150
+ Optional.prototype.getOrThunk = function (thunk) {
151
+ return this.tag ? this.value : thunk();
152
+ };
153
+ Optional.prototype.orThunk = function (thunk) {
154
+ return this.tag ? this : thunk();
155
+ };
156
+ Optional.prototype.getOrDie = function (message) {
157
+ if (!this.tag) {
158
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
159
+ }
160
+ else {
161
+ return this.value;
162
+ }
163
+ };
164
+ Optional.from = function (value) {
165
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
166
+ };
167
+ Optional.prototype.getOrNull = function () {
168
+ return this.tag ? this.value : null;
169
+ };
170
+ Optional.prototype.getOrUndefined = function () {
171
+ return this.value;
172
+ };
173
+ Optional.prototype.each = function (worker) {
174
+ if (this.tag) {
175
+ worker(this.value);
176
+ }
177
+ };
178
+ Optional.prototype.toArray = function () {
179
+ return this.tag ? [this.value] : [];
180
+ };
181
+ Optional.prototype.toString = function () {
182
+ return this.tag ? "some(".concat(this.value, ")") : 'none()';
183
+ };
184
+ return Optional;
185
+ }());
186
+ Optional.singletonNone = new Optional(false);
187
+ var nativeSlice = Array.prototype.slice;
188
+ var nativeIndexOf = Array.prototype.indexOf;
189
+ var nativePush = Array.prototype.push;
190
+ var rawIndexOf = function (ts, t) { return nativeIndexOf.call(ts, t); };
191
+ var contains$1 = function (xs, x) { return rawIndexOf(xs, x) > -1; };
192
+ var exists = function (xs, pred) {
193
+ for (var i = 0, len = xs.length; i < len; i++) {
194
+ var x = xs[i];
195
+ if (pred(x, i)) {
196
+ return true;
197
+ }
198
+ }
199
+ return false;
200
+ };
201
+ var map = function (xs, f) {
202
+ var len = xs.length;
203
+ var r = new Array(len);
204
+ for (var i = 0; i < len; i++) {
205
+ var x = xs[i];
206
+ r[i] = f(x, i);
207
+ }
208
+ return r;
209
+ };
210
+ var each$1 = function (xs, f) {
211
+ for (var i = 0, len = xs.length; i < len; i++) {
212
+ var x = xs[i];
213
+ f(x, i);
214
+ }
215
+ };
216
+ var filter$1 = function (xs, pred) {
217
+ var r = [];
218
+ for (var i = 0, len = xs.length; i < len; i++) {
219
+ var x = xs[i];
220
+ if (pred(x, i)) {
221
+ r.push(x);
222
+ }
223
+ }
224
+ return r;
225
+ };
226
+ var groupBy = function (xs, f) {
227
+ if (xs.length === 0) {
228
+ return [];
229
+ }
230
+ else {
231
+ var wasType = f(xs[0]);
232
+ var r = [];
233
+ var group = [];
234
+ for (var i = 0, len = xs.length; i < len; i++) {
235
+ var x = xs[i];
236
+ var type_1 = f(x);
237
+ if (type_1 !== wasType) {
238
+ r.push(group);
239
+ group = [];
240
+ }
241
+ wasType = type_1;
242
+ group.push(x);
243
+ }
244
+ if (group.length !== 0) {
245
+ r.push(group);
246
+ }
247
+ return r;
248
+ }
249
+ };
250
+ var foldl = function (xs, f, acc) {
251
+ each$1(xs, function (x, i) {
252
+ acc = f(acc, x, i);
253
+ });
254
+ return acc;
255
+ };
256
+ var findUntil = function (xs, pred, until) {
257
+ for (var i = 0, len = xs.length; i < len; i++) {
258
+ var x = xs[i];
259
+ if (pred(x, i)) {
260
+ return Optional.some(x);
261
+ }
262
+ else if (until(x, i)) {
263
+ break;
264
+ }
265
+ }
266
+ return Optional.none();
267
+ };
268
+ var find = function (xs, pred) {
269
+ return findUntil(xs, pred, never);
270
+ };
271
+ var flatten = function (xs) {
272
+ var r = [];
273
+ for (var i = 0, len = xs.length; i < len; ++i) {
274
+ if (!isArray(xs[i])) {
275
+ throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
276
+ }
277
+ nativePush.apply(r, xs[i]);
278
+ }
279
+ return r;
280
+ };
281
+ var bind = function (xs, f) { return flatten(map(xs, f)); };
282
+ var reverse = function (xs) {
283
+ var r = nativeSlice.call(xs, 0);
284
+ r.reverse();
285
+ return r;
286
+ };
287
+ var get$1 = function (xs, i) { return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); };
288
+ var head = function (xs) { return get$1(xs, 0); };
289
+ var last = function (xs) { return get$1(xs, xs.length - 1); };
290
+ var unique = function (xs, comparator) {
291
+ var r = [];
292
+ var isDuplicated = isFunction(comparator) ? function (x) { return exists(r, function (i) { return comparator(i, x); }); } : function (x) { return contains$1(r, x); };
293
+ for (var i = 0, len = xs.length; i < len; i++) {
294
+ var x = xs[i];
295
+ if (!isDuplicated(x)) {
296
+ r.push(x);
297
+ }
298
+ }
299
+ return r;
300
+ };
301
+ var is$2 = function (lhs, rhs, comparator) {
302
+ if (comparator === void 0) { comparator = tripleEquals; }
303
+ return lhs.exists(function (left) { return comparator(left, rhs); });
304
+ };
305
+ var equals = function (lhs, rhs, comparator) {
306
+ if (comparator === void 0) { comparator = tripleEquals; }
307
+ return lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
308
+ };
309
+ var lift2 = function (oa, ob, f) { return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none(); };
310
+ var COMMENT = 8;
311
+ var DOCUMENT = 9;
312
+ var DOCUMENT_FRAGMENT = 11;
313
+ var ELEMENT = 1;
314
+ var TEXT = 3;
315
+ var fromHtml = function (html, scope) {
316
+ var doc = scope || document;
317
+ var div = doc.createElement('div');
318
+ div.innerHTML = html;
319
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
320
+ var message = 'HTML does not have a single root node';
321
+ console.error(message, html);
322
+ throw new Error(message);
323
+ }
324
+ return fromDom$1(div.childNodes[0]);
325
+ };
326
+ var fromTag = function (tag, scope) {
327
+ var doc = scope || document;
328
+ var node = doc.createElement(tag);
329
+ return fromDom$1(node);
330
+ };
331
+ var fromText = function (text, scope) {
332
+ var doc = scope || document;
333
+ var node = doc.createTextNode(text);
334
+ return fromDom$1(node);
335
+ };
336
+ var fromDom$1 = function (node) {
337
+ if (node === null || node === undefined) {
338
+ throw new Error('Node cannot be null or undefined');
339
+ }
340
+ return { dom: node };
341
+ };
342
+ var fromPoint = function (docElm, x, y) { return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$1); };
343
+ var SugarElement = {
344
+ fromHtml: fromHtml,
345
+ fromTag: fromTag,
346
+ fromText: fromText,
347
+ fromDom: fromDom$1,
348
+ fromPoint: fromPoint
349
+ };
350
+ var is$1 = function (element, selector) {
351
+ var dom = element.dom;
352
+ if (dom.nodeType !== ELEMENT) {
353
+ return false;
354
+ }
355
+ else {
356
+ var elem = dom;
357
+ if (elem.matches !== undefined) {
358
+ return elem.matches(selector);
359
+ }
360
+ else if (elem.msMatchesSelector !== undefined) {
361
+ return elem.msMatchesSelector(selector);
362
+ }
363
+ else if (elem.webkitMatchesSelector !== undefined) {
364
+ return elem.webkitMatchesSelector(selector);
365
+ }
366
+ else if (elem.mozMatchesSelector !== undefined) {
367
+ return elem.mozMatchesSelector(selector);
368
+ }
369
+ else {
370
+ throw new Error('Browser lacks native selectors');
371
+ }
372
+ }
373
+ };
374
+ var eq = function (e1, e2) { return e1.dom === e2.dom; };
375
+ var contains = function (e1, e2) {
376
+ var d1 = e1.dom;
377
+ var d2 = e2.dom;
378
+ return d1 === d2 ? false : d1.contains(d2);
379
+ };
380
+ var is = is$1;
381
+ var Global = typeof window !== 'undefined' ? window : Function('return this;')();
382
+ var path = function (parts, scope) {
383
+ var o = scope !== undefined && scope !== null ? scope : Global;
384
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
385
+ o = o[parts[i]];
386
+ }
387
+ return o;
388
+ };
389
+ var resolve = function (p, scope) {
390
+ var parts = p.split('.');
391
+ return path(parts, scope);
392
+ };
393
+ var unsafe = function (name, scope) {
394
+ return resolve(name, scope);
395
+ };
396
+ var getOrDie = function (name, scope) {
397
+ var actual = unsafe(name, scope);
398
+ if (actual === undefined || actual === null) {
399
+ throw new Error(name + ' not available on this browser');
400
+ }
401
+ return actual;
402
+ };
403
+ var getPrototypeOf = Object.getPrototypeOf;
404
+ var sandHTMLElement = function (scope) {
405
+ return getOrDie('HTMLElement', scope);
406
+ };
407
+ var isPrototypeOf = function (x) {
408
+ var scope = resolve('ownerDocument.defaultView', x);
409
+ return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf(x).constructor.name));
410
+ };
411
+ var name = function (element) {
412
+ var r = element.dom.nodeName;
413
+ return r.toLowerCase();
414
+ };
415
+ var type = function (element) { return element.dom.nodeType; };
416
+ var isType = function (t) { return function (element) { return type(element) === t; }; };
417
+ var isComment = function (element) { return type(element) === COMMENT || name(element) === '#comment'; };
418
+ var isHTMLElement = function (element) { return isElement$1(element) && isPrototypeOf(element.dom); };
419
+ var isElement$1 = isType(ELEMENT);
420
+ var isText = isType(TEXT);
421
+ var isDocument = isType(DOCUMENT);
422
+ var isDocumentFragment = isType(DOCUMENT_FRAGMENT);
423
+ var isTag = function (tag) { return function (e) { return isElement$1(e) && name(e) === tag; }; };
424
+ var owner = function (element) { return SugarElement.fromDom(element.dom.ownerDocument); };
425
+ var documentOrOwner = function (dos) { return isDocument(dos) ? dos : owner(dos); };
426
+ var parent = function (element) { return Optional.from(element.dom.parentNode).map(SugarElement.fromDom); };
427
+ var parentElement = function (element) { return Optional.from(element.dom.parentElement).map(SugarElement.fromDom); };
428
+ var nextSibling = function (element) { return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); };
429
+ var children = function (element) { return map(element.dom.childNodes, SugarElement.fromDom); };
430
+ var child = function (element, index) {
431
+ var cs = element.dom.childNodes;
432
+ return Optional.from(cs[index]).map(SugarElement.fromDom);
433
+ };
434
+ var firstChild = function (element) { return child(element, 0); };
435
+ var lastChild = function (element) { return child(element, element.dom.childNodes.length - 1); };
436
+ var isShadowRoot = function (dos) { return isDocumentFragment(dos) && isNonNullable(dos.dom.host); };
437
+ var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
438
+ var getRootNode = supported ? function (e) { return SugarElement.fromDom(e.dom.getRootNode()); } : documentOrOwner;
439
+ var getShadowRoot = function (e) {
440
+ var r = getRootNode(e);
441
+ return isShadowRoot(r) ? Optional.some(r) : Optional.none();
442
+ };
443
+ var getShadowHost = function (e) { return SugarElement.fromDom(e.dom.host); };
444
+ var inBody = function (element) {
445
+ var dom = isText(element) ? element.dom.parentNode : element.dom;
446
+ if (dom === undefined || dom === null || dom.ownerDocument === null) {
447
+ return false;
448
+ }
449
+ var doc = dom.ownerDocument;
450
+ return getShadowRoot(SugarElement.fromDom(dom)).fold(function () { return doc.body.contains(dom); }, compose1(inBody, getShadowHost));
451
+ };
452
+ var ClosestOrAncestor = function (is, ancestor, scope, a, isRoot) {
453
+ if (is(scope, a)) {
454
+ return Optional.some(scope);
455
+ }
456
+ else if (isFunction(isRoot) && isRoot(scope)) {
457
+ return Optional.none();
458
+ }
459
+ else {
460
+ return ancestor(scope, a, isRoot);
461
+ }
462
+ };
463
+ var ancestor$3 = function (scope, predicate, isRoot) {
464
+ var element = scope.dom;
465
+ var stop = isFunction(isRoot) ? isRoot : never;
466
+ while (element.parentNode) {
467
+ element = element.parentNode;
468
+ var el = SugarElement.fromDom(element);
469
+ if (predicate(el)) {
470
+ return Optional.some(el);
471
+ }
472
+ else if (stop(el)) {
473
+ break;
474
+ }
475
+ }
476
+ return Optional.none();
477
+ };
478
+ var closest$2 = function (scope, predicate, isRoot) {
479
+ var is = function (s, test) { return test(s); };
480
+ return ClosestOrAncestor(is, ancestor$3, scope, predicate, isRoot);
481
+ };
482
+ var ancestor$2 = function (scope, selector, isRoot) { return ancestor$3(scope, function (e) { return is$1(e, selector); }, isRoot); };
483
+ var closest$1 = function (scope, selector, isRoot) {
484
+ var is = function (element, selector) { return is$1(element, selector); };
485
+ return ClosestOrAncestor(is, ancestor$2, scope, selector, isRoot);
486
+ };
487
+ var closest = function (target) { return closest$1(target, '[contenteditable]'); };
488
+ var isEditable = function (element, assumeEditable) {
489
+ if (assumeEditable === void 0) { assumeEditable = false; }
490
+ if (inBody(element)) {
491
+ return element.dom.isContentEditable;
492
+ }
493
+ else {
494
+ return closest(element).fold(constant(assumeEditable), function (editable) { return getRaw(editable) === 'true'; });
495
+ }
496
+ };
497
+ var getRaw = function (element) { return element.dom.contentEditable; };
498
+ var before$1 = function (marker, element) {
499
+ var parent$1 = parent(marker);
500
+ parent$1.each(function (v) {
501
+ v.dom.insertBefore(element.dom, marker.dom);
502
+ });
503
+ };
504
+ var after = function (marker, element) {
505
+ var sibling = nextSibling(marker);
506
+ sibling.fold(function () {
507
+ var parent$1 = parent(marker);
508
+ parent$1.each(function (v) {
509
+ append$1(v, element);
510
+ });
511
+ }, function (v) {
512
+ before$1(v, element);
513
+ });
514
+ };
515
+ var prepend = function (parent, element) {
516
+ var firstChild$1 = firstChild(parent);
517
+ firstChild$1.fold(function () {
518
+ append$1(parent, element);
519
+ }, function (v) {
520
+ parent.dom.insertBefore(element.dom, v.dom);
521
+ });
522
+ };
523
+ var append$1 = function (parent, element) {
524
+ parent.dom.appendChild(element.dom);
525
+ };
526
+ var before = function (marker, elements) {
527
+ each$1(elements, function (x) {
528
+ before$1(marker, x);
529
+ });
530
+ };
531
+ var append = function (parent, elements) {
532
+ each$1(elements, function (x) {
533
+ append$1(parent, x);
534
+ });
535
+ };
536
+ var empty = function (element) {
537
+ element.dom.textContent = '';
538
+ each$1(children(element), function (rogue) {
539
+ remove(rogue);
540
+ });
541
+ };
542
+ var remove = function (element) {
543
+ var dom = element.dom;
544
+ if (dom.parentNode !== null) {
545
+ dom.parentNode.removeChild(dom);
546
+ }
547
+ };
548
+ var global$6 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
549
+ var global$5 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
550
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
551
+ var fromDom = function (nodes) { return map(nodes, SugarElement.fromDom); };
552
+ var keys = Object.keys;
553
+ var each = function (obj, f) {
554
+ var props = keys(obj);
555
+ for (var k = 0, len = props.length; k < len; k++) {
556
+ var i = props[k];
557
+ var x = obj[i];
558
+ f(x, i);
559
+ }
560
+ };
561
+ var objAcc = function (r) { return function (x, i) {
562
+ r[i] = x;
563
+ }; };
564
+ var internalFilter = function (obj, pred, onTrue, onFalse) {
565
+ each(obj, function (x, i) {
566
+ (pred(x, i) ? onTrue : onFalse)(x, i);
567
+ });
568
+ };
569
+ var filter = function (obj, pred) {
570
+ var t = {};
571
+ internalFilter(obj, pred, objAcc(t), noop);
572
+ return t;
573
+ };
574
+ var rawSet = function (dom, key, value) {
575
+ if (isString(value) || isBoolean(value) || isNumber(value)) {
576
+ dom.setAttribute(key, value + '');
577
+ }
578
+ else {
579
+ console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
580
+ throw new Error('Attribute value was not simple');
581
+ }
582
+ };
583
+ var setAll = function (element, attrs) {
584
+ var dom = element.dom;
585
+ each(attrs, function (v, k) {
586
+ rawSet(dom, k, v);
587
+ });
588
+ };
589
+ var clone$1 = function (element) { return foldl(element.dom.attributes, function (acc, attr) {
590
+ acc[attr.name] = attr.value;
591
+ return acc;
592
+ }, {}); };
593
+ var clone = function (original, isDeep) { return SugarElement.fromDom(original.dom.cloneNode(isDeep)); };
594
+ var deep = function (original) { return clone(original, true); };
595
+ var shallowAs = function (original, tag) {
596
+ var nu = SugarElement.fromTag(tag);
597
+ var attributes = clone$1(original);
598
+ setAll(nu, attributes);
599
+ return nu;
600
+ };
601
+ var mutate = function (original, tag) {
602
+ var nu = shallowAs(original, tag);
603
+ after(original, nu);
604
+ var children$1 = children(original);
605
+ append(nu, children$1);
606
+ remove(original);
607
+ return nu;
608
+ };
609
+ var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
610
+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
611
+ var matchNodeName = function (name) { return function (node) { return isNonNullable(node) && node.nodeName.toLowerCase() === name; }; };
612
+ var matchNodeNames = function (regex) { return function (node) { return isNonNullable(node) && regex.test(node.nodeName); }; };
613
+ var isTextNode$1 = function (node) { return isNonNullable(node) && node.nodeType === 3; };
614
+ var isElement = function (node) { return isNonNullable(node) && node.nodeType === 1; };
615
+ var isListNode = matchNodeNames(/^(OL|UL|DL)$/);
616
+ var isOlUlNode = matchNodeNames(/^(OL|UL)$/);
617
+ var isOlNode = matchNodeName('ol');
618
+ var isListItemNode = matchNodeNames(/^(LI|DT|DD)$/);
619
+ var isDlItemNode = matchNodeNames(/^(DT|DD)$/);
620
+ var isTableCellNode = matchNodeNames(/^(TH|TD)$/);
621
+ var isBr = matchNodeName('br');
622
+ var isFirstChild = function (node) {
623
+ var _a;
624
+ return ((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === node;
625
+ };
626
+ var isTextBlock = function (editor, node) { return isNonNullable(node) && node.nodeName in editor.schema.getTextBlockElements(); };
627
+ var isBlock = function (node, blockElements) { return isNonNullable(node) && node.nodeName in blockElements; };
628
+ var isVoid = function (editor, node) { return isNonNullable(node) && node.nodeName in editor.schema.getVoidElements(); };
629
+ var isBogusBr = function (dom, node) {
630
+ if (!isBr(node)) {
631
+ return false;
632
+ }
633
+ return dom.isBlock(node.nextSibling) && !isBr(node.previousSibling);
634
+ };
635
+ var isEmpty$2 = function (dom, elm, keepBookmarks) {
636
+ var empty = dom.isEmpty(elm);
637
+ if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
638
+ return false;
639
+ }
640
+ return empty;
641
+ };
642
+ var isChildOfBody = function (dom, elm) { return dom.isChildOf(elm, dom.getRoot()); };
643
+ var option = function (name) { return function (editor) { return editor.options.get(name); }; };
644
+ var register$3 = function (editor) {
645
+ var registerOption = editor.options.register;
646
+ registerOption('lists_indent_on_tab', {
647
+ processor: 'boolean',
648
+ default: true
649
+ });
650
+ };
651
+ var shouldIndentOnTab = option('lists_indent_on_tab');
652
+ var getForcedRootBlock = option('forced_root_block');
653
+ var getForcedRootBlockAttrs = option('forced_root_block_attrs');
654
+ var createTextBlock = function (editor, contentNode) {
655
+ var dom = editor.dom;
656
+ var blockElements = editor.schema.getBlockElements();
657
+ var fragment = dom.createFragment();
658
+ var blockName = getForcedRootBlock(editor);
659
+ var blockAttrs = getForcedRootBlockAttrs(editor);
660
+ var node;
661
+ var textBlock;
662
+ var hasContentNode = false;
663
+ textBlock = dom.create(blockName, blockAttrs);
664
+ if (!isBlock(contentNode.firstChild, blockElements)) {
665
+ fragment.appendChild(textBlock);
666
+ }
667
+ while (node = contentNode.firstChild) {
668
+ var nodeName = node.nodeName;
669
+ if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
670
+ hasContentNode = true;
671
+ }
672
+ if (isBlock(node, blockElements)) {
673
+ fragment.appendChild(node);
674
+ textBlock = null;
675
+ }
676
+ else {
677
+ if (!textBlock) {
678
+ textBlock = dom.create(blockName, blockAttrs);
679
+ fragment.appendChild(textBlock);
680
+ }
681
+ textBlock.appendChild(node);
682
+ }
683
+ }
684
+ if (!hasContentNode && textBlock) {
685
+ textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));
686
+ }
687
+ return fragment;
688
+ };
689
+ var DOM$2 = global$3.DOM;
690
+ var splitList = function (editor, list, li) {
691
+ var removeAndKeepBookmarks = function (targetNode) {
692
+ var parent = targetNode.parentNode;
693
+ if (parent) {
694
+ global$2.each(bookmarks, function (node) {
695
+ parent.insertBefore(node, li.parentNode);
696
+ });
697
+ }
698
+ DOM$2.remove(targetNode);
699
+ };
700
+ var bookmarks = DOM$2.select('span[data-mce-type="bookmark"]', list);
701
+ var newBlock = createTextBlock(editor, li);
702
+ var tmpRng = DOM$2.createRng();
703
+ tmpRng.setStartAfter(li);
704
+ tmpRng.setEndAfter(list);
705
+ var fragment = tmpRng.extractContents();
706
+ for (var node = fragment.firstChild; node; node = node.firstChild) {
707
+ if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
708
+ DOM$2.remove(node);
709
+ break;
710
+ }
711
+ }
712
+ if (!editor.dom.isEmpty(fragment)) {
713
+ DOM$2.insertAfter(fragment, list);
714
+ }
715
+ DOM$2.insertAfter(newBlock, list);
716
+ var parent = li.parentElement;
717
+ if (parent && isEmpty$2(editor.dom, parent)) {
718
+ removeAndKeepBookmarks(parent);
719
+ }
720
+ DOM$2.remove(li);
721
+ if (isEmpty$2(editor.dom, list)) {
722
+ DOM$2.remove(list);
723
+ }
724
+ };
725
+ var isDescriptionDetail = isTag('dd');
726
+ var isDescriptionTerm = isTag('dt');
727
+ var outdentDlItem = function (editor, item) {
728
+ if (isDescriptionDetail(item)) {
729
+ mutate(item, 'dt');
730
+ }
731
+ else if (isDescriptionTerm(item)) {
732
+ parentElement(item).each(function (dl) { return splitList(editor, dl.dom, item.dom); });
733
+ }
734
+ };
735
+ var indentDlItem = function (item) {
736
+ if (isDescriptionTerm(item)) {
737
+ mutate(item, 'dd');
738
+ }
739
+ };
740
+ var dlIndentation = function (editor, indentation, dlItems) {
741
+ if (indentation === 'Indent') {
742
+ each$1(dlItems, indentDlItem);
743
+ }
744
+ else {
745
+ each$1(dlItems, function (item) { return outdentDlItem(editor, item); });
746
+ }
747
+ };
748
+ var getNormalizedPoint = function (container, offset) {
749
+ if (isTextNode$1(container)) {
750
+ return {
751
+ container: container,
752
+ offset: offset
753
+ };
754
+ }
755
+ var node = global$6.getNode(container, offset);
756
+ if (isTextNode$1(node)) {
757
+ return {
758
+ container: node,
759
+ offset: offset >= container.childNodes.length ? node.data.length : 0
760
+ };
761
+ }
762
+ else if (node.previousSibling && isTextNode$1(node.previousSibling)) {
763
+ return {
764
+ container: node.previousSibling,
765
+ offset: node.previousSibling.data.length
766
+ };
767
+ }
768
+ else if (node.nextSibling && isTextNode$1(node.nextSibling)) {
769
+ return {
770
+ container: node.nextSibling,
771
+ offset: 0
772
+ };
773
+ }
774
+ return {
775
+ container: container,
776
+ offset: offset
777
+ };
778
+ };
779
+ var normalizeRange = function (rng) {
780
+ var outRng = rng.cloneRange();
781
+ var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);
782
+ outRng.setStart(rangeStart.container, rangeStart.offset);
783
+ var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);
784
+ outRng.setEnd(rangeEnd.container, rangeEnd.offset);
785
+ return outRng;
786
+ };
787
+ var listNames = [
788
+ 'OL',
789
+ 'UL',
790
+ 'DL'
791
+ ];
792
+ var listSelector = listNames.join(',');
793
+ var getParentList = function (editor, node) {
794
+ var selectionStart = node || editor.selection.getStart(true);
795
+ return editor.dom.getParent(selectionStart, listSelector, getClosestListHost(editor, selectionStart));
796
+ };
797
+ var isParentListSelected = function (parentList, selectedBlocks) { return isNonNullable(parentList) && selectedBlocks.length === 1 && selectedBlocks[0] === parentList; };
798
+ var findSubLists = function (parentList) { return filter$1(parentList.querySelectorAll(listSelector), isListNode); };
799
+ var getSelectedSubLists = function (editor) {
800
+ var parentList = getParentList(editor);
801
+ var selectedBlocks = editor.selection.getSelectedBlocks();
802
+ if (isParentListSelected(parentList, selectedBlocks)) {
803
+ return findSubLists(parentList);
804
+ }
805
+ else {
806
+ return filter$1(selectedBlocks, function (elm) {
807
+ return isListNode(elm) && parentList !== elm;
808
+ });
809
+ }
810
+ };
811
+ var findParentListItemsNodes = function (editor, elms) {
812
+ var listItemsElms = global$2.map(elms, function (elm) {
813
+ var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListHost(editor, elm));
814
+ return parentLi ? parentLi : elm;
815
+ });
816
+ return unique(listItemsElms);
817
+ };
818
+ var getSelectedListItems = function (editor) {
819
+ var selectedBlocks = editor.selection.getSelectedBlocks();
820
+ return filter$1(findParentListItemsNodes(editor, selectedBlocks), isListItemNode);
821
+ };
822
+ var getSelectedDlItems = function (editor) { return filter$1(getSelectedListItems(editor), isDlItemNode); };
823
+ var getClosestEditingHost = function (editor, elm) {
824
+ var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
825
+ return parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
826
+ };
827
+ var isListHost = function (schema, node) { return !isListNode(node) && !isListItemNode(node) && exists(listNames, function (listName) { return schema.isValidChild(node.nodeName, listName); }); };
828
+ var getClosestListHost = function (editor, elm) {
829
+ var parentBlocks = editor.dom.getParents(elm, editor.dom.isBlock);
830
+ var parentBlock = find(parentBlocks, function (elm) { return isListHost(editor.schema, elm); });
831
+ return parentBlock.getOr(editor.getBody());
832
+ };
833
+ var isListInsideAnLiWithFirstAndLastNotListElement = function (list) { return parent(list).exists(function (parent) { return isListItemNode(parent.dom) && firstChild(parent).exists(function (firstChild) { return !isListNode(firstChild.dom); }) && lastChild(parent).exists(function (lastChild) { return !isListNode(lastChild.dom); }); }); };
834
+ var findLastParentListNode = function (editor, elm) {
835
+ var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
836
+ return last(parentLists);
837
+ };
838
+ var getSelectedLists = function (editor) {
839
+ var firstList = findLastParentListNode(editor, editor.selection.getStart());
840
+ var subsequentLists = filter$1(editor.selection.getSelectedBlocks(), isOlUlNode);
841
+ return firstList.toArray().concat(subsequentLists);
842
+ };
843
+ var getParentLists = function (editor) {
844
+ var elm = editor.selection.getStart();
845
+ return editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
846
+ };
847
+ var getSelectedListRoots = function (editor) {
848
+ var selectedLists = getSelectedLists(editor);
849
+ var parentLists = getParentLists(editor);
850
+ return find(parentLists, function (p) { return isListInsideAnLiWithFirstAndLastNotListElement(SugarElement.fromDom(p)); }).fold(function () { return getUniqueListRoots(editor, selectedLists); }, function (l) { return [l]; });
851
+ };
852
+ var getUniqueListRoots = function (editor, lists) {
853
+ var listRoots = map(lists, function (list) { return findLastParentListNode(editor, list).getOr(list); });
854
+ return unique(listRoots);
855
+ };
856
+ var isCustomList = function (list) { return /\btox\-/.test(list.className); };
857
+ var inList = function (parents, listName) { return findUntil(parents, isListNode, isTableCellNode).exists(function (list) { return list.nodeName === listName && !isCustomList(list); }); };
858
+ var isWithinNonEditable = function (editor, element) { return element !== null && !editor.dom.isEditable(element); };
859
+ var selectionIsWithinNonEditableList = function (editor) {
860
+ var parentList = getParentList(editor);
861
+ return isWithinNonEditable(editor, parentList);
862
+ };
863
+ var isWithinNonEditableList = function (editor, element) {
864
+ var parentList = editor.dom.getParent(element, 'ol,ul,dl');
865
+ return isWithinNonEditable(editor, parentList);
866
+ };
867
+ var setNodeChangeHandler = function (editor, nodeChangeHandler) {
868
+ var initialNode = editor.selection.getNode();
869
+ nodeChangeHandler({
870
+ parents: editor.dom.getParents(initialNode),
871
+ element: initialNode
872
+ });
873
+ editor.on('NodeChange', nodeChangeHandler);
874
+ return function () { return editor.off('NodeChange', nodeChangeHandler); };
875
+ };
876
+ var fromElements = function (elements, scope) {
877
+ var doc = scope || document;
878
+ var fragment = doc.createDocumentFragment();
879
+ each$1(elements, function (element) {
880
+ fragment.appendChild(element.dom);
881
+ });
882
+ return SugarElement.fromDom(fragment);
883
+ };
884
+ var fireListEvent = function (editor, action, element) { return editor.dispatch('ListMutation', {
885
+ action: action,
886
+ element: element
887
+ }); };
888
+ var blank = function (r) { return function (s) { return s.replace(r, ''); }; };
889
+ var trim = blank(/^\s+|\s+$/g);
890
+ var isNotEmpty = function (s) { return s.length > 0; };
891
+ var isEmpty$1 = function (s) { return !isNotEmpty(s); };
892
+ var isSupported = function (dom) { return dom.style !== undefined && isFunction(dom.style.getPropertyValue); };
893
+ var internalSet = function (dom, property, value) {
894
+ if (!isString(value)) {
895
+ console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
896
+ throw new Error('CSS value must be a string: ' + value);
897
+ }
898
+ if (isSupported(dom)) {
899
+ dom.style.setProperty(property, value);
900
+ }
901
+ };
902
+ var set = function (element, property, value) {
903
+ var dom = element.dom;
904
+ internalSet(dom, property, value);
905
+ };
906
+ var isList = function (el) { return is(el, 'OL,UL'); };
907
+ var isListItem = function (el) { return is(el, 'LI'); };
908
+ var hasFirstChildList = function (el) { return firstChild(el).exists(isList); };
909
+ var hasLastChildList = function (el) { return lastChild(el).exists(isList); };
910
+ var isEntryList = function (entry) { return 'listAttributes' in entry; };
911
+ var isEntryComment = function (entry) { return 'isComment' in entry; };
912
+ var isEntryFragment = function (entry) { return 'isFragment' in entry; };
913
+ var isIndented = function (entry) { return entry.depth > 0; };
914
+ var isSelected = function (entry) { return entry.isSelected; };
915
+ var cloneItemContent = function (li) {
916
+ var children$1 = children(li);
917
+ var content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;
918
+ return map(content, deep);
919
+ };
920
+ var createEntry = function (li, depth, isSelected) { return parent(li).filter(isElement$1).map(function (list) { return ({
921
+ depth: depth,
922
+ dirty: false,
923
+ isSelected: isSelected,
924
+ content: cloneItemContent(li),
925
+ itemAttributes: clone$1(li),
926
+ listAttributes: clone$1(list),
927
+ listType: name(list),
928
+ isInPreviousLi: false
929
+ }); }); };
930
+ var joinSegment = function (parent, child) {
931
+ append$1(parent.item, child.list);
932
+ };
933
+ var joinSegments = function (segments) {
934
+ for (var i = 1; i < segments.length; i++) {
935
+ joinSegment(segments[i - 1], segments[i]);
936
+ }
937
+ };
938
+ var appendSegments = function (head$1, tail) {
939
+ lift2(last(head$1), head(tail), joinSegment);
940
+ };
941
+ var createSegment = function (scope, listType) {
942
+ var segment = {
943
+ list: SugarElement.fromTag(listType, scope),
944
+ item: SugarElement.fromTag('li', scope)
945
+ };
946
+ append$1(segment.list, segment.item);
947
+ return segment;
948
+ };
949
+ var createSegments = function (scope, entry, size) {
950
+ var segments = [];
951
+ for (var i = 0; i < size; i++) {
952
+ segments.push(createSegment(scope, isEntryList(entry) ? entry.listType : entry.parentListType));
953
+ }
954
+ return segments;
955
+ };
956
+ var populateSegments = function (segments, entry) {
957
+ for (var i = 0; i < segments.length - 1; i++) {
958
+ set(segments[i].item, 'list-style-type', 'none');
959
+ }
960
+ last(segments).each(function (segment) {
961
+ if (isEntryList(entry)) {
962
+ setAll(segment.list, entry.listAttributes);
963
+ setAll(segment.item, entry.itemAttributes);
964
+ }
965
+ append(segment.item, entry.content);
966
+ });
967
+ };
968
+ var normalizeSegment = function (segment, entry) {
969
+ if (name(segment.list) !== entry.listType) {
970
+ segment.list = mutate(segment.list, entry.listType);
971
+ }
972
+ setAll(segment.list, entry.listAttributes);
973
+ };
974
+ var createItem = function (scope, attr, content) {
975
+ var item = SugarElement.fromTag('li', scope);
976
+ setAll(item, attr);
977
+ append(item, content);
978
+ return item;
979
+ };
980
+ var appendItem = function (segment, item) {
981
+ append$1(segment.list, item);
982
+ segment.item = item;
983
+ };
984
+ var writeShallow = function (scope, cast, entry) {
985
+ var newCast = cast.slice(0, entry.depth);
986
+ last(newCast).each(function (segment) {
987
+ if (isEntryList(entry)) {
988
+ var item = createItem(scope, entry.itemAttributes, entry.content);
989
+ appendItem(segment, item);
990
+ normalizeSegment(segment, entry);
991
+ }
992
+ else if (isEntryFragment(entry)) {
993
+ append(segment.item, entry.content);
994
+ }
995
+ else {
996
+ var item = SugarElement.fromHtml("<!--".concat(entry.content, "-->"));
997
+ append$1(segment.list, item);
998
+ }
999
+ });
1000
+ return newCast;
1001
+ };
1002
+ var writeDeep = function (scope, cast, entry) {
1003
+ var segments = createSegments(scope, entry, entry.depth - cast.length);
1004
+ joinSegments(segments);
1005
+ populateSegments(segments, entry);
1006
+ appendSegments(cast, segments);
1007
+ return cast.concat(segments);
1008
+ };
1009
+ var composeList = function (scope, entries) {
1010
+ var firstCommentEntryOpt = Optional.none();
1011
+ var cast = foldl(entries, function (cast, entry, i) {
1012
+ if (!isEntryComment(entry)) {
1013
+ return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry);
1014
+ }
1015
+ else {
1016
+ if (i === 0) {
1017
+ firstCommentEntryOpt = Optional.some(entry);
1018
+ return cast;
1019
+ }
1020
+ return writeShallow(scope, cast, entry);
1021
+ }
1022
+ }, []);
1023
+ firstCommentEntryOpt.each(function (firstCommentEntry) {
1024
+ var item = SugarElement.fromHtml("<!--".concat(firstCommentEntry.content, "-->"));
1025
+ head(cast).each(function (fistCast) {
1026
+ prepend(fistCast.list, item);
1027
+ });
1028
+ });
1029
+ return head(cast).map(function (segment) { return segment.list; });
1030
+ };
1031
+ var indentEntry = function (indentation, entry) {
1032
+ switch (indentation) {
1033
+ case 'Indent':
1034
+ entry.depth++;
1035
+ break;
1036
+ case 'Outdent':
1037
+ entry.depth--;
1038
+ break;
1039
+ case 'Flatten':
1040
+ entry.depth = 0;
1041
+ }
1042
+ entry.dirty = true;
1043
+ };
1044
+ var cloneListProperties = function (target, source) {
1045
+ if (isEntryList(target) && isEntryList(source)) {
1046
+ target.listType = source.listType;
1047
+ target.listAttributes = __assign({}, source.listAttributes);
1048
+ }
1049
+ };
1050
+ var cleanListProperties = function (entry) {
1051
+ entry.listAttributes = filter(entry.listAttributes, function (_value, key) { return key !== 'start'; });
1052
+ };
1053
+ var closestSiblingEntry = function (entries, start) {
1054
+ var depth = entries[start].depth;
1055
+ var matches = function (entry) { return entry.depth === depth && !entry.dirty; };
1056
+ var until = function (entry) { return entry.depth < depth; };
1057
+ return findUntil(reverse(entries.slice(0, start)), matches, until).orThunk(function () { return findUntil(entries.slice(start + 1), matches, until); });
1058
+ };
1059
+ var normalizeEntries = function (entries) {
1060
+ each$1(entries, function (entry, i) {
1061
+ closestSiblingEntry(entries, i).fold(function () {
1062
+ if (entry.dirty && isEntryList(entry)) {
1063
+ cleanListProperties(entry);
1064
+ }
1065
+ }, function (matchingEntry) { return cloneListProperties(entry, matchingEntry); });
1066
+ });
1067
+ return entries;
1068
+ };
1069
+ var Cell = function (initial) {
1070
+ var value = initial;
1071
+ var get = function () {
1072
+ return value;
1073
+ };
1074
+ var set = function (v) {
1075
+ value = v;
1076
+ };
1077
+ return {
1078
+ get: get,
1079
+ set: set
1080
+ };
1081
+ };
1082
+ var parseSingleItem = function (depth, itemSelection, selectionState, item) {
1083
+ var _a;
1084
+ if (isComment(item)) {
1085
+ return [{
1086
+ depth: depth + 1,
1087
+ content: (_a = item.dom.nodeValue) !== null && _a !== void 0 ? _a : '',
1088
+ dirty: false,
1089
+ isSelected: false,
1090
+ isComment: true
1091
+ }];
1092
+ }
1093
+ itemSelection.each(function (selection) {
1094
+ if (eq(selection.start, item)) {
1095
+ selectionState.set(true);
1096
+ }
1097
+ });
1098
+ var currentItemEntry = createEntry(item, depth, selectionState.get());
1099
+ itemSelection.each(function (selection) {
1100
+ if (eq(selection.end, item)) {
1101
+ selectionState.set(false);
1102
+ }
1103
+ });
1104
+ var childListEntries = lastChild(item).filter(isList).map(function (list) { return parseList(depth, itemSelection, selectionState, list); }).getOr([]);
1105
+ return currentItemEntry.toArray().concat(childListEntries);
1106
+ };
1107
+ var parseItem = function (depth, itemSelection, selectionState, item) { return firstChild(item).filter(isList).fold(function () { return parseSingleItem(depth, itemSelection, selectionState, item); }, function (list) {
1108
+ var parsedSiblings = foldl(children(item), function (acc, liChild, i) {
1109
+ if (i === 0) {
1110
+ return acc;
1111
+ }
1112
+ else {
1113
+ if (isListItem(liChild)) {
1114
+ return acc.concat(parseSingleItem(depth, itemSelection, selectionState, liChild));
1115
+ }
1116
+ else {
1117
+ var fragment = {
1118
+ isFragment: true,
1119
+ depth: depth,
1120
+ content: [liChild],
1121
+ isSelected: false,
1122
+ dirty: false,
1123
+ parentListType: name(list)
1124
+ };
1125
+ return acc.concat(fragment);
1126
+ }
1127
+ }
1128
+ }, []);
1129
+ return parseList(depth, itemSelection, selectionState, list).concat(parsedSiblings);
1130
+ }); };
1131
+ var parseList = function (depth, itemSelection, selectionState, list) { return bind(children(list), function (element) {
1132
+ var parser = isList(element) ? parseList : parseItem;
1133
+ var newDepth = depth + 1;
1134
+ return parser(newDepth, itemSelection, selectionState, element);
1135
+ }); };
1136
+ var parseLists = function (lists, itemSelection) {
1137
+ var selectionState = Cell(false);
1138
+ var initialDepth = 0;
1139
+ return map(lists, function (list) { return ({
1140
+ sourceList: list,
1141
+ entries: parseList(initialDepth, itemSelection, selectionState, list)
1142
+ }); });
1143
+ };
1144
+ var outdentedComposer = function (editor, entries) {
1145
+ var normalizedEntries = normalizeEntries(entries);
1146
+ return map(normalizedEntries, function (entry) {
1147
+ var content = !isEntryComment(entry) ? fromElements(entry.content) : fromElements([SugarElement.fromHtml("<!--".concat(entry.content, "-->"))]);
1148
+ return SugarElement.fromDom(createTextBlock(editor, content.dom));
1149
+ });
1150
+ };
1151
+ var indentedComposer = function (editor, entries) {
1152
+ var normalizedEntries = normalizeEntries(entries);
1153
+ return composeList(editor.contentDocument, normalizedEntries).toArray();
1154
+ };
1155
+ var composeEntries = function (editor, entries) { return bind(groupBy(entries, isIndented), function (entries) {
1156
+ var groupIsIndented = head(entries).exists(isIndented);
1157
+ return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);
1158
+ }); };
1159
+ var indentSelectedEntries = function (entries, indentation) {
1160
+ each$1(filter$1(entries, isSelected), function (entry) { return indentEntry(indentation, entry); });
1161
+ };
1162
+ var getItemSelection = function (editor) {
1163
+ var selectedListItems = map(getSelectedListItems(editor), SugarElement.fromDom);
1164
+ return lift2(find(selectedListItems, not(hasFirstChildList)), find(reverse(selectedListItems), not(hasFirstChildList)), function (start, end) { return ({
1165
+ start: start,
1166
+ end: end
1167
+ }); });
1168
+ };
1169
+ var listIndentation = function (editor, lists, indentation) {
1170
+ var entrySets = parseLists(lists, getItemSelection(editor));
1171
+ each$1(entrySets, function (entrySet) {
1172
+ indentSelectedEntries(entrySet.entries, indentation);
1173
+ var composedLists = composeEntries(editor, entrySet.entries);
1174
+ each$1(composedLists, function (composedList) {
1175
+ fireListEvent(editor, indentation === 'Indent' ? 'IndentList' : 'OutdentList', composedList.dom);
1176
+ });
1177
+ before(entrySet.sourceList, composedLists);
1178
+ remove(entrySet.sourceList);
1179
+ });
1180
+ };
1181
+ var selectionIndentation = function (editor, indentation) {
1182
+ var lists = fromDom(getSelectedListRoots(editor));
1183
+ var dlItems = fromDom(getSelectedDlItems(editor));
1184
+ var isHandled = false;
1185
+ if (lists.length || dlItems.length) {
1186
+ var bookmark = editor.selection.getBookmark();
1187
+ listIndentation(editor, lists, indentation);
1188
+ dlIndentation(editor, indentation, dlItems);
1189
+ editor.selection.moveToBookmark(bookmark);
1190
+ editor.selection.setRng(normalizeRange(editor.selection.getRng()));
1191
+ editor.nodeChanged();
1192
+ isHandled = true;
1193
+ }
1194
+ return isHandled;
1195
+ };
1196
+ var handleIndentation = function (editor, indentation) { return !selectionIsWithinNonEditableList(editor) && selectionIndentation(editor, indentation); };
1197
+ var indentListSelection = function (editor) { return handleIndentation(editor, 'Indent'); };
1198
+ var outdentListSelection = function (editor) { return handleIndentation(editor, 'Outdent'); };
1199
+ var flattenListSelection = function (editor) { return handleIndentation(editor, 'Flatten'); };
1200
+ var zeroWidth = '\uFEFF';
1201
+ var isZwsp = function (char) { return char === zeroWidth; };
1202
+ var ancestor$1 = function (scope, predicate, isRoot) { return ancestor$3(scope, predicate, isRoot).isSome(); };
1203
+ var ancestor = function (element, target) { return ancestor$1(element, curry(eq, target)); };
1204
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
1205
+ var DOM$1 = global$3.DOM;
1206
+ var createBookmark = function (rng) {
1207
+ var bookmark = {};
1208
+ var setupEndPoint = function (start) {
1209
+ var container = rng[start ? 'startContainer' : 'endContainer'];
1210
+ var offset = rng[start ? 'startOffset' : 'endOffset'];
1211
+ if (isElement(container)) {
1212
+ var offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' });
1213
+ if (container.hasChildNodes()) {
1214
+ offset = Math.min(offset, container.childNodes.length - 1);
1215
+ if (start) {
1216
+ container.insertBefore(offsetNode, container.childNodes[offset]);
1217
+ }
1218
+ else {
1219
+ DOM$1.insertAfter(offsetNode, container.childNodes[offset]);
1220
+ }
1221
+ }
1222
+ else {
1223
+ container.appendChild(offsetNode);
1224
+ }
1225
+ container = offsetNode;
1226
+ offset = 0;
1227
+ }
1228
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
1229
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
1230
+ };
1231
+ setupEndPoint(true);
1232
+ if (!rng.collapsed) {
1233
+ setupEndPoint();
1234
+ }
1235
+ return bookmark;
1236
+ };
1237
+ var resolveBookmark = function (bookmark) {
1238
+ var restoreEndPoint = function (start) {
1239
+ var nodeIndex = function (container) {
1240
+ var _a;
1241
+ var node = (_a = container.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild;
1242
+ var idx = 0;
1243
+ while (node) {
1244
+ if (node === container) {
1245
+ return idx;
1246
+ }
1247
+ if (!isElement(node) || node.getAttribute('data-mce-type') !== 'bookmark') {
1248
+ idx++;
1249
+ }
1250
+ node = node.nextSibling;
1251
+ }
1252
+ return -1;
1253
+ };
1254
+ var container = bookmark[start ? 'startContainer' : 'endContainer'];
1255
+ var offset = bookmark[start ? 'startOffset' : 'endOffset'];
1256
+ if (!container) {
1257
+ return;
1258
+ }
1259
+ if (isElement(container) && container.parentNode) {
1260
+ var node = container;
1261
+ offset = nodeIndex(container);
1262
+ container = container.parentNode;
1263
+ DOM$1.remove(node);
1264
+ if (!container.hasChildNodes() && DOM$1.isBlock(container)) {
1265
+ container.appendChild(DOM$1.create('br'));
1266
+ }
1267
+ }
1268
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
1269
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
1270
+ };
1271
+ restoreEndPoint(true);
1272
+ restoreEndPoint();
1273
+ var rng = DOM$1.createRng();
1274
+ rng.setStart(bookmark.startContainer, bookmark.startOffset);
1275
+ if (bookmark.endContainer) {
1276
+ rng.setEnd(bookmark.endContainer, bookmark.endOffset);
1277
+ }
1278
+ return normalizeRange(rng);
1279
+ };
1280
+ var listToggleActionFromListName = function (listName) {
1281
+ switch (listName) {
1282
+ case 'UL':
1283
+ return 'ToggleUlList';
1284
+ case 'OL':
1285
+ return 'ToggleOlList';
1286
+ case 'DL':
1287
+ return 'ToggleDLList';
1288
+ }
1289
+ };
1290
+ var updateListStyle = function (dom, el, detail) {
1291
+ var type = detail['list-style-type'] ? detail['list-style-type'] : null;
1292
+ dom.setStyle(el, 'list-style-type', type);
1293
+ };
1294
+ var setAttribs = function (elm, attrs) {
1295
+ global$2.each(attrs, function (value, key) {
1296
+ elm.setAttribute(key, value);
1297
+ });
1298
+ };
1299
+ var updateListAttrs = function (dom, el, detail) {
1300
+ setAttribs(el, detail['list-attributes']);
1301
+ global$2.each(dom.select('li', el), function (li) {
1302
+ setAttribs(li, detail['list-item-attributes']);
1303
+ });
1304
+ };
1305
+ var updateListWithDetails = function (dom, el, detail) {
1306
+ updateListStyle(dom, el, detail);
1307
+ updateListAttrs(dom, el, detail);
1308
+ };
1309
+ var removeStyles = function (dom, element, styles) {
1310
+ global$2.each(styles, function (style) { return dom.setStyle(element, style, ''); });
1311
+ };
1312
+ var isInline = function (editor, node) { return isNonNullable(node) && !isBlock(node, editor.schema.getBlockElements()); };
1313
+ var getEndPointNode = function (editor, rng, start, root) {
1314
+ var container = rng[start ? 'startContainer' : 'endContainer'];
1315
+ var offset = rng[start ? 'startOffset' : 'endOffset'];
1316
+ if (isElement(container)) {
1317
+ container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
1318
+ }
1319
+ if (!start && isBr(container.nextSibling)) {
1320
+ container = container.nextSibling;
1321
+ }
1322
+ var findBlockAncestor = function (node) {
1323
+ while (!editor.dom.isBlock(node) && node.parentNode && root !== node) {
1324
+ node = node.parentNode;
1325
+ }
1326
+ return node;
1327
+ };
1328
+ var findBetterContainer = function (container, forward) {
1329
+ var _a;
1330
+ var walker = new global$5(container, findBlockAncestor(container));
1331
+ var dir = forward ? 'next' : 'prev';
1332
+ var node;
1333
+ while (node = walker[dir]()) {
1334
+ if (!(isVoid(editor, node) || isZwsp(node.textContent) || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length) === 0)) {
1335
+ return Optional.some(node);
1336
+ }
1337
+ }
1338
+ return Optional.none();
1339
+ };
1340
+ if (start && isTextNode$1(container)) {
1341
+ if (isZwsp(container.textContent)) {
1342
+ container = findBetterContainer(container, false).getOr(container);
1343
+ }
1344
+ else {
1345
+ if (container.parentNode !== null && isInline(editor, container.parentNode)) {
1346
+ container = container.parentNode;
1347
+ }
1348
+ while (container.previousSibling !== null && (isInline(editor, container.previousSibling) || isTextNode$1(container.previousSibling))) {
1349
+ container = container.previousSibling;
1350
+ }
1351
+ }
1352
+ }
1353
+ if (!start && isTextNode$1(container)) {
1354
+ if (isZwsp(container.textContent)) {
1355
+ container = findBetterContainer(container, true).getOr(container);
1356
+ }
1357
+ else {
1358
+ if (container.parentNode !== null && isInline(editor, container.parentNode)) {
1359
+ container = container.parentNode;
1360
+ }
1361
+ while (container.nextSibling !== null && (isInline(editor, container.nextSibling) || isTextNode$1(container.nextSibling))) {
1362
+ container = container.nextSibling;
1363
+ }
1364
+ }
1365
+ }
1366
+ while (container.parentNode !== root) {
1367
+ var parent_1 = container.parentNode;
1368
+ if (isTextBlock(editor, container)) {
1369
+ return container;
1370
+ }
1371
+ if (/^(TD|TH)$/.test(parent_1.nodeName)) {
1372
+ return container;
1373
+ }
1374
+ container = parent_1;
1375
+ }
1376
+ return container;
1377
+ };
1378
+ var getSelectedTextBlocks = function (editor, rng, root) {
1379
+ var textBlocks = [];
1380
+ var dom = editor.dom;
1381
+ var startNode = getEndPointNode(editor, rng, true, root);
1382
+ var endNode = getEndPointNode(editor, rng, false, root);
1383
+ var block;
1384
+ var siblings = [];
1385
+ for (var node = startNode; node; node = node.nextSibling) {
1386
+ siblings.push(node);
1387
+ if (node === endNode) {
1388
+ break;
1389
+ }
1390
+ }
1391
+ global$2.each(siblings, function (node) {
1392
+ var _a;
1393
+ if (isTextBlock(editor, node)) {
1394
+ textBlocks.push(node);
1395
+ block = null;
1396
+ return;
1397
+ }
1398
+ if (dom.isBlock(node) || isBr(node)) {
1399
+ if (isBr(node)) {
1400
+ dom.remove(node);
1401
+ }
1402
+ block = null;
1403
+ return;
1404
+ }
1405
+ var nextSibling = node.nextSibling;
1406
+ if (global$1.isBookmarkNode(node)) {
1407
+ if (isListNode(nextSibling) || isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
1408
+ block = null;
1409
+ return;
1410
+ }
1411
+ }
1412
+ if (!block) {
1413
+ block = dom.create('p');
1414
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(block, node);
1415
+ textBlocks.push(block);
1416
+ }
1417
+ block.appendChild(node);
1418
+ });
1419
+ return textBlocks;
1420
+ };
1421
+ var hasCompatibleStyle = function (dom, sib, detail) {
1422
+ var sibStyle = dom.getStyle(sib, 'list-style-type');
1423
+ var detailStyle = detail ? detail['list-style-type'] : '';
1424
+ detailStyle = detailStyle === null ? '' : detailStyle;
1425
+ return sibStyle === detailStyle;
1426
+ };
1427
+ var getRootSearchStart = function (editor, range) {
1428
+ var start = editor.selection.getStart(true);
1429
+ var startPoint = getEndPointNode(editor, range, true, editor.getBody());
1430
+ if (ancestor(SugarElement.fromDom(startPoint), SugarElement.fromDom(range.commonAncestorContainer))) {
1431
+ return range.commonAncestorContainer;
1432
+ }
1433
+ else {
1434
+ return start;
1435
+ }
1436
+ };
1437
+ var applyList = function (editor, listName, detail) {
1438
+ var rng = editor.selection.getRng();
1439
+ var listItemName = 'LI';
1440
+ var root = getClosestListHost(editor, getRootSearchStart(editor, rng));
1441
+ var dom = editor.dom;
1442
+ if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
1443
+ return;
1444
+ }
1445
+ listName = listName.toUpperCase();
1446
+ if (listName === 'DL') {
1447
+ listItemName = 'DT';
1448
+ }
1449
+ var bookmark = createBookmark(rng);
1450
+ var selectedTextBlocks = filter$1(getSelectedTextBlocks(editor, rng, root), editor.dom.isEditable);
1451
+ global$2.each(selectedTextBlocks, function (block) {
1452
+ var listBlock;
1453
+ var sibling = block.previousSibling;
1454
+ var parent = block.parentNode;
1455
+ if (!isListItemNode(parent)) {
1456
+ if (sibling && isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
1457
+ listBlock = sibling;
1458
+ block = dom.rename(block, listItemName);
1459
+ sibling.appendChild(block);
1460
+ }
1461
+ else {
1462
+ listBlock = dom.create(listName);
1463
+ parent.insertBefore(listBlock, block);
1464
+ listBlock.appendChild(block);
1465
+ block = dom.rename(block, listItemName);
1466
+ }
1467
+ removeStyles(dom, block, [
1468
+ 'margin',
1469
+ 'margin-right',
1470
+ 'margin-bottom',
1471
+ 'margin-left',
1472
+ 'margin-top',
1473
+ 'padding',
1474
+ 'padding-right',
1475
+ 'padding-bottom',
1476
+ 'padding-left',
1477
+ 'padding-top'
1478
+ ]);
1479
+ updateListWithDetails(dom, listBlock, detail);
1480
+ mergeWithAdjacentLists(editor.dom, listBlock);
1481
+ }
1482
+ });
1483
+ editor.selection.setRng(resolveBookmark(bookmark));
1484
+ };
1485
+ var isValidLists = function (list1, list2) {
1486
+ return isListNode(list1) && list1.nodeName === (list2 === null || list2 === void 0 ? void 0 : list2.nodeName);
1487
+ };
1488
+ var hasSameListStyle = function (dom, list1, list2) {
1489
+ var targetStyle = dom.getStyle(list1, 'list-style-type', true);
1490
+ var style = dom.getStyle(list2, 'list-style-type', true);
1491
+ return targetStyle === style;
1492
+ };
1493
+ var hasSameClasses = function (elm1, elm2) {
1494
+ return elm1.className === elm2.className;
1495
+ };
1496
+ var shouldMerge = function (dom, list1, list2) {
1497
+ return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
1498
+ };
1499
+ var mergeWithAdjacentLists = function (dom, listBlock) {
1500
+ var node;
1501
+ var sibling = listBlock.nextSibling;
1502
+ if (shouldMerge(dom, listBlock, sibling)) {
1503
+ var liSibling = sibling;
1504
+ while (node = liSibling.firstChild) {
1505
+ listBlock.appendChild(node);
1506
+ }
1507
+ dom.remove(liSibling);
1508
+ }
1509
+ sibling = listBlock.previousSibling;
1510
+ if (shouldMerge(dom, listBlock, sibling)) {
1511
+ var liSibling = sibling;
1512
+ while (node = liSibling.lastChild) {
1513
+ listBlock.insertBefore(node, listBlock.firstChild);
1514
+ }
1515
+ dom.remove(liSibling);
1516
+ }
1517
+ };
1518
+ var updateList$1 = function (editor, list, listName, detail) {
1519
+ if (list.nodeName !== listName) {
1520
+ var newList = editor.dom.rename(list, listName);
1521
+ updateListWithDetails(editor.dom, newList, detail);
1522
+ fireListEvent(editor, listToggleActionFromListName(listName), newList);
1523
+ }
1524
+ else {
1525
+ updateListWithDetails(editor.dom, list, detail);
1526
+ fireListEvent(editor, listToggleActionFromListName(listName), list);
1527
+ }
1528
+ };
1529
+ var updateCustomList = function (editor, list, listName, detail) {
1530
+ list.classList.forEach(function (cls, _, classList) {
1531
+ if (cls.startsWith('tox-')) {
1532
+ classList.remove(cls);
1533
+ if (classList.length === 0) {
1534
+ list.removeAttribute('class');
1535
+ }
1536
+ }
1537
+ });
1538
+ if (list.nodeName !== listName) {
1539
+ var newList = editor.dom.rename(list, listName);
1540
+ updateListWithDetails(editor.dom, newList, detail);
1541
+ fireListEvent(editor, listToggleActionFromListName(listName), newList);
1542
+ }
1543
+ else {
1544
+ updateListWithDetails(editor.dom, list, detail);
1545
+ fireListEvent(editor, listToggleActionFromListName(listName), list);
1546
+ }
1547
+ };
1548
+ var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
1549
+ var parentIsList = isListNode(parentList);
1550
+ if (parentIsList && parentList.nodeName === listName && !hasListStyleDetail(detail) && !isCustomList(parentList)) {
1551
+ flattenListSelection(editor);
1552
+ }
1553
+ else {
1554
+ applyList(editor, listName, detail);
1555
+ var bookmark = createBookmark(editor.selection.getRng());
1556
+ var allLists = parentIsList ? __spreadArray([
1557
+ parentList
1558
+ ], lists, true) : lists;
1559
+ var updateFunction_1 = parentIsList && isCustomList(parentList) ? updateCustomList : updateList$1;
1560
+ global$2.each(allLists, function (elm) {
1561
+ updateFunction_1(editor, elm, listName, detail);
1562
+ });
1563
+ editor.selection.setRng(resolveBookmark(bookmark));
1564
+ }
1565
+ };
1566
+ var hasListStyleDetail = function (detail) {
1567
+ return 'list-style-type' in detail;
1568
+ };
1569
+ var toggleSingleList = function (editor, parentList, listName, detail) {
1570
+ if (parentList === editor.getBody()) {
1571
+ return;
1572
+ }
1573
+ if (parentList) {
1574
+ if (parentList.nodeName === listName && !hasListStyleDetail(detail) && !isCustomList(parentList)) {
1575
+ flattenListSelection(editor);
1576
+ }
1577
+ else {
1578
+ var bookmark = createBookmark(editor.selection.getRng());
1579
+ if (isCustomList(parentList)) {
1580
+ parentList.classList.forEach(function (cls, _, classList) {
1581
+ if (cls.startsWith('tox-')) {
1582
+ classList.remove(cls);
1583
+ if (classList.length === 0) {
1584
+ parentList.removeAttribute('class');
1585
+ }
1586
+ }
1587
+ });
1588
+ }
1589
+ updateListWithDetails(editor.dom, parentList, detail);
1590
+ var newList = editor.dom.rename(parentList, listName);
1591
+ mergeWithAdjacentLists(editor.dom, newList);
1592
+ editor.selection.setRng(resolveBookmark(bookmark));
1593
+ applyList(editor, listName, detail);
1594
+ fireListEvent(editor, listToggleActionFromListName(listName), newList);
1595
+ }
1596
+ }
1597
+ else {
1598
+ applyList(editor, listName, detail);
1599
+ fireListEvent(editor, listToggleActionFromListName(listName), parentList);
1600
+ }
1601
+ };
1602
+ var toggleList = function (editor, listName, _detail) {
1603
+ var parentList = getParentList(editor);
1604
+ if (isWithinNonEditableList(editor, parentList)) {
1605
+ return;
1606
+ }
1607
+ var selectedSubLists = getSelectedSubLists(editor);
1608
+ var detail = isObject(_detail) ? _detail : {};
1609
+ if (selectedSubLists.length > 0) {
1610
+ toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
1611
+ }
1612
+ else {
1613
+ toggleSingleList(editor, parentList, listName, detail);
1614
+ }
1615
+ };
1616
+ var DOM = global$3.DOM;
1617
+ var normalizeList = function (dom, list) {
1618
+ var parentNode = list.parentElement;
1619
+ if (parentNode && parentNode.nodeName === 'LI' && parentNode.firstChild === list) {
1620
+ var sibling = parentNode.previousSibling;
1621
+ if (sibling && sibling.nodeName === 'LI') {
1622
+ sibling.appendChild(list);
1623
+ if (isEmpty$2(dom, parentNode)) {
1624
+ DOM.remove(parentNode);
1625
+ }
1626
+ }
1627
+ else {
1628
+ DOM.setStyle(parentNode, 'listStyleType', 'none');
1629
+ }
1630
+ }
1631
+ if (isListNode(parentNode)) {
1632
+ var sibling = parentNode.previousSibling;
1633
+ if (sibling && sibling.nodeName === 'LI') {
1634
+ sibling.appendChild(list);
1635
+ }
1636
+ }
1637
+ };
1638
+ var normalizeLists = function (dom, element) {
1639
+ var lists = global$2.grep(dom.select('ol,ul', element));
1640
+ global$2.each(lists, function (list) {
1641
+ normalizeList(dom, list);
1642
+ });
1643
+ };
1644
+ var findNextCaretContainer = function (editor, rng, isForward, root) {
1645
+ var node = rng.startContainer;
1646
+ var offset = rng.startOffset;
1647
+ if (isTextNode$1(node) && (isForward ? offset < node.data.length : offset > 0)) {
1648
+ return node;
1649
+ }
1650
+ var nonEmptyBlocks = editor.schema.getNonEmptyElements();
1651
+ if (isElement(node)) {
1652
+ node = global$6.getNode(node, offset);
1653
+ }
1654
+ var walker = new global$5(node, root);
1655
+ if (isForward) {
1656
+ if (isBogusBr(editor.dom, node)) {
1657
+ walker.next();
1658
+ }
1659
+ }
1660
+ var walkFn = isForward ? walker.next.bind(walker) : walker.prev2.bind(walker);
1661
+ while (node = walkFn()) {
1662
+ if (node.nodeName === 'LI' && !node.hasChildNodes()) {
1663
+ return node;
1664
+ }
1665
+ if (nonEmptyBlocks[node.nodeName]) {
1666
+ return node;
1667
+ }
1668
+ if (isTextNode$1(node) && node.data.length > 0) {
1669
+ return node;
1670
+ }
1671
+ }
1672
+ return null;
1673
+ };
1674
+ var hasOnlyOneBlockChild = function (dom, elm) {
1675
+ var childNodes = elm.childNodes;
1676
+ return childNodes.length === 1 && !isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
1677
+ };
1678
+ var isUnwrappable = function (node) { return Optional.from(node).map(SugarElement.fromDom).filter(isHTMLElement).exists(function (el) { return isEditable(el) && !contains$1(['details'], name(el)); }); };
1679
+ var unwrapSingleBlockChild = function (dom, elm) {
1680
+ if (hasOnlyOneBlockChild(dom, elm) && isUnwrappable(elm.firstChild)) {
1681
+ dom.remove(elm.firstChild, true);
1682
+ }
1683
+ };
1684
+ var moveChildren = function (dom, fromElm, toElm) {
1685
+ var node;
1686
+ var targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
1687
+ unwrapSingleBlockChild(dom, fromElm);
1688
+ if (!isEmpty$2(dom, fromElm, true)) {
1689
+ while (node = fromElm.firstChild) {
1690
+ targetElm.appendChild(node);
1691
+ }
1692
+ }
1693
+ };
1694
+ var mergeLiElements = function (dom, fromElm, toElm) {
1695
+ var listNode;
1696
+ var ul = fromElm.parentNode;
1697
+ if (!isChildOfBody(dom, fromElm) || !isChildOfBody(dom, toElm)) {
1698
+ return;
1699
+ }
1700
+ if (isListNode(toElm.lastChild)) {
1701
+ listNode = toElm.lastChild;
1702
+ }
1703
+ if (ul === toElm.lastChild) {
1704
+ if (isBr(ul.previousSibling)) {
1705
+ dom.remove(ul.previousSibling);
1706
+ }
1707
+ }
1708
+ var node = toElm.lastChild;
1709
+ if (node && isBr(node) && fromElm.hasChildNodes()) {
1710
+ dom.remove(node);
1711
+ }
1712
+ if (isEmpty$2(dom, toElm, true)) {
1713
+ empty(SugarElement.fromDom(toElm));
1714
+ }
1715
+ moveChildren(dom, fromElm, toElm);
1716
+ if (listNode) {
1717
+ toElm.appendChild(listNode);
1718
+ }
1719
+ var contains$1 = contains(SugarElement.fromDom(toElm), SugarElement.fromDom(fromElm));
1720
+ var nestedLists = contains$1 ? dom.getParents(fromElm, isListNode, toElm) : [];
1721
+ dom.remove(fromElm);
1722
+ each$1(nestedLists, function (list) {
1723
+ if (isEmpty$2(dom, list) && list !== dom.getRoot()) {
1724
+ dom.remove(list);
1725
+ }
1726
+ });
1727
+ };
1728
+ var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
1729
+ empty(SugarElement.fromDom(toLi));
1730
+ mergeLiElements(editor.dom, fromLi, toLi);
1731
+ editor.selection.setCursorLocation(toLi, 0);
1732
+ };
1733
+ var mergeForward = function (editor, rng, fromLi, toLi) {
1734
+ var dom = editor.dom;
1735
+ if (dom.isEmpty(toLi)) {
1736
+ mergeIntoEmptyLi(editor, fromLi, toLi);
1737
+ }
1738
+ else {
1739
+ var bookmark = createBookmark(rng);
1740
+ mergeLiElements(dom, fromLi, toLi);
1741
+ editor.selection.setRng(resolveBookmark(bookmark));
1742
+ }
1743
+ };
1744
+ var mergeBackward = function (editor, rng, fromLi, toLi) {
1745
+ var bookmark = createBookmark(rng);
1746
+ mergeLiElements(editor.dom, fromLi, toLi);
1747
+ var resolvedBookmark = resolveBookmark(bookmark);
1748
+ editor.selection.setRng(resolvedBookmark);
1749
+ };
1750
+ var backspaceDeleteFromListToListCaret = function (editor, isForward) {
1751
+ var dom = editor.dom, selection = editor.selection;
1752
+ var selectionStartElm = selection.getStart();
1753
+ var root = getClosestEditingHost(editor, selectionStartElm);
1754
+ var li = dom.getParent(selection.getStart(), 'LI', root);
1755
+ if (li) {
1756
+ var ul = li.parentElement;
1757
+ if (ul === editor.getBody() && isEmpty$2(dom, ul)) {
1758
+ return true;
1759
+ }
1760
+ var rng_1 = normalizeRange(selection.getRng());
1761
+ var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng_1, isForward, root), 'LI', root);
1762
+ var willMergeParentIntoChild = otherLi_1 && (isForward ? dom.isChildOf(li, otherLi_1) : dom.isChildOf(otherLi_1, li));
1763
+ if (otherLi_1 && otherLi_1 !== li && !willMergeParentIntoChild) {
1764
+ editor.undoManager.transact(function () {
1765
+ if (isForward) {
1766
+ mergeForward(editor, rng_1, otherLi_1, li);
1767
+ }
1768
+ else {
1769
+ if (isFirstChild(li)) {
1770
+ outdentListSelection(editor);
1771
+ }
1772
+ else {
1773
+ mergeBackward(editor, rng_1, li, otherLi_1);
1774
+ }
1775
+ }
1776
+ });
1777
+ return true;
1778
+ }
1779
+ else if (willMergeParentIntoChild && !isForward && otherLi_1 !== li) {
1780
+ editor.undoManager.transact(function () {
1781
+ if (rng_1.commonAncestorContainer.parentElement) {
1782
+ var bookmark = createBookmark(rng_1);
1783
+ var oldParentElRef = rng_1.commonAncestorContainer.parentElement;
1784
+ moveChildren(dom, rng_1.commonAncestorContainer.parentElement, otherLi_1);
1785
+ oldParentElRef.remove();
1786
+ var resolvedBookmark = resolveBookmark(bookmark);
1787
+ editor.selection.setRng(resolvedBookmark);
1788
+ }
1789
+ });
1790
+ return true;
1791
+ }
1792
+ else if (!otherLi_1) {
1793
+ if (!isForward && rng_1.startOffset === 0 && rng_1.endOffset === 0) {
1794
+ editor.undoManager.transact(function () {
1795
+ flattenListSelection(editor);
1796
+ });
1797
+ return true;
1798
+ }
1799
+ }
1800
+ }
1801
+ return false;
1802
+ };
1803
+ var removeBlock = function (dom, block, root) {
1804
+ var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
1805
+ dom.remove(block);
1806
+ if (parentBlock && dom.isEmpty(parentBlock)) {
1807
+ dom.remove(parentBlock);
1808
+ }
1809
+ };
1810
+ var backspaceDeleteIntoListCaret = function (editor, isForward) {
1811
+ var dom = editor.dom;
1812
+ var selectionStartElm = editor.selection.getStart();
1813
+ var root = getClosestEditingHost(editor, selectionStartElm);
1814
+ var block = dom.getParent(selectionStartElm, dom.isBlock, root);
1815
+ if (block && dom.isEmpty(block)) {
1816
+ var rng = normalizeRange(editor.selection.getRng());
1817
+ var otherLi_2 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1818
+ if (otherLi_2) {
1819
+ var findValidElement = function (element) { return contains$1([
1820
+ 'td',
1821
+ 'th',
1822
+ 'caption'
1823
+ ], name(element)); };
1824
+ var findRoot = function (node) { return node.dom === root; };
1825
+ var otherLiCell = closest$2(SugarElement.fromDom(otherLi_2), findValidElement, findRoot);
1826
+ var caretCell = closest$2(SugarElement.fromDom(rng.startContainer), findValidElement, findRoot);
1827
+ if (!equals(otherLiCell, caretCell, eq)) {
1828
+ return false;
1829
+ }
1830
+ editor.undoManager.transact(function () {
1831
+ var parentNode = otherLi_2.parentNode;
1832
+ removeBlock(dom, block, root);
1833
+ mergeWithAdjacentLists(dom, parentNode);
1834
+ editor.selection.select(otherLi_2, true);
1835
+ editor.selection.collapse(isForward);
1836
+ });
1837
+ return true;
1838
+ }
1839
+ }
1840
+ return false;
1841
+ };
1842
+ var backspaceDeleteCaret = function (editor, isForward) {
1843
+ return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
1844
+ };
1845
+ var hasListSelection = function (editor) {
1846
+ var selectionStartElm = editor.selection.getStart();
1847
+ var root = getClosestEditingHost(editor, selectionStartElm);
1848
+ var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
1849
+ return startListParent || getSelectedListItems(editor).length > 0;
1850
+ };
1851
+ var backspaceDeleteRange = function (editor) {
1852
+ if (hasListSelection(editor)) {
1853
+ editor.undoManager.transact(function () {
1854
+ editor.execCommand('Delete');
1855
+ normalizeLists(editor.dom, editor.getBody());
1856
+ });
1857
+ return true;
1858
+ }
1859
+ return false;
1860
+ };
1861
+ var backspaceDelete = function (editor, isForward) {
1862
+ var selection = editor.selection;
1863
+ return !isWithinNonEditableList(editor, selection.getNode()) && (selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor));
1864
+ };
1865
+ var setup$2 = function (editor) {
1866
+ editor.on('ExecCommand', function (e) {
1867
+ var cmd = e.command.toLowerCase();
1868
+ if ((cmd === 'delete' || cmd === 'forwarddelete') && hasListSelection(editor)) {
1869
+ normalizeLists(editor.dom, editor.getBody());
1870
+ }
1871
+ });
1872
+ editor.on('keydown', function (e) {
1873
+ if (e.keyCode === global$4.BACKSPACE) {
1874
+ if (backspaceDelete(editor, false)) {
1875
+ e.preventDefault();
1876
+ }
1877
+ }
1878
+ else if (e.keyCode === global$4.DELETE) {
1879
+ if (backspaceDelete(editor, true)) {
1880
+ e.preventDefault();
1881
+ }
1882
+ }
1883
+ });
1884
+ };
1885
+ var get = function (editor) { return ({
1886
+ backspaceDelete: function (isForward) {
1887
+ backspaceDelete(editor, isForward);
1888
+ }
1889
+ }); };
1890
+ var updateList = function (editor, update) {
1891
+ var parentList = getParentList(editor);
1892
+ if (parentList === null || isWithinNonEditableList(editor, parentList)) {
1893
+ return;
1894
+ }
1895
+ editor.undoManager.transact(function () {
1896
+ if (isObject(update.styles)) {
1897
+ editor.dom.setStyles(parentList, update.styles);
1898
+ }
1899
+ if (isObject(update.attrs)) {
1900
+ each(update.attrs, function (v, k) { return editor.dom.setAttrib(parentList, k, v); });
1901
+ }
1902
+ });
1903
+ };
1904
+ var parseAlphabeticBase26 = function (str) {
1905
+ var chars = reverse(trim(str).split(''));
1906
+ var values = map(chars, function (char, i) {
1907
+ var charValue = char.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 1;
1908
+ return Math.pow(26, i) * charValue;
1909
+ });
1910
+ return foldl(values, function (sum, v) { return sum + v; }, 0);
1911
+ };
1912
+ var composeAlphabeticBase26 = function (value) {
1913
+ value--;
1914
+ if (value < 0) {
1915
+ return '';
1916
+ }
1917
+ else {
1918
+ var remainder = value % 26;
1919
+ var quotient = Math.floor(value / 26);
1920
+ var rest = composeAlphabeticBase26(quotient);
1921
+ var char = String.fromCharCode('A'.charCodeAt(0) + remainder);
1922
+ return rest + char;
1923
+ }
1924
+ };
1925
+ var isUppercase = function (str) { return /^[A-Z]+$/.test(str); };
1926
+ var isLowercase = function (str) { return /^[a-z]+$/.test(str); };
1927
+ var isNumeric = function (str) { return /^[0-9]+$/.test(str); };
1928
+ var deduceListType = function (start) {
1929
+ if (isNumeric(start)) {
1930
+ return 2;
1931
+ }
1932
+ else if (isUppercase(start)) {
1933
+ return 0;
1934
+ }
1935
+ else if (isLowercase(start)) {
1936
+ return 1;
1937
+ }
1938
+ else if (isEmpty$1(start)) {
1939
+ return 3;
1940
+ }
1941
+ else {
1942
+ return 4;
1943
+ }
1944
+ };
1945
+ var parseStartValue = function (start) {
1946
+ switch (deduceListType(start)) {
1947
+ case 2:
1948
+ return Optional.some({
1949
+ listStyleType: Optional.none(),
1950
+ start: start
1951
+ });
1952
+ case 0:
1953
+ return Optional.some({
1954
+ listStyleType: Optional.some('upper-alpha'),
1955
+ start: parseAlphabeticBase26(start).toString()
1956
+ });
1957
+ case 1:
1958
+ return Optional.some({
1959
+ listStyleType: Optional.some('lower-alpha'),
1960
+ start: parseAlphabeticBase26(start).toString()
1961
+ });
1962
+ case 3:
1963
+ return Optional.some({
1964
+ listStyleType: Optional.none(),
1965
+ start: ''
1966
+ });
1967
+ case 4:
1968
+ return Optional.none();
1969
+ }
1970
+ };
1971
+ var parseDetail = function (detail) {
1972
+ var start = parseInt(detail.start, 10);
1973
+ if (is$2(detail.listStyleType, 'upper-alpha')) {
1974
+ return composeAlphabeticBase26(start);
1975
+ }
1976
+ else if (is$2(detail.listStyleType, 'lower-alpha')) {
1977
+ return composeAlphabeticBase26(start).toLowerCase();
1978
+ }
1979
+ else {
1980
+ return detail.start;
1981
+ }
1982
+ };
1983
+ var open = function (editor) {
1984
+ var currentList = getParentList(editor);
1985
+ if (!isOlNode(currentList) || isWithinNonEditableList(editor, currentList)) {
1986
+ return;
1987
+ }
1988
+ editor.windowManager.open({
1989
+ title: 'List Properties',
1990
+ body: {
1991
+ type: 'panel',
1992
+ items: [{
1993
+ type: 'input',
1994
+ name: 'start',
1995
+ label: 'Start list at number',
1996
+ inputMode: 'numeric'
1997
+ }]
1998
+ },
1999
+ initialData: {
2000
+ start: parseDetail({
2001
+ start: editor.dom.getAttrib(currentList, 'start', '1'),
2002
+ listStyleType: Optional.from(editor.dom.getStyle(currentList, 'list-style-type'))
2003
+ })
2004
+ },
2005
+ buttons: [
2006
+ {
2007
+ type: 'cancel',
2008
+ name: 'cancel',
2009
+ text: 'Cancel'
2010
+ },
2011
+ {
2012
+ type: 'submit',
2013
+ name: 'save',
2014
+ text: 'Save',
2015
+ primary: true
2016
+ }
2017
+ ],
2018
+ onSubmit: function (api) {
2019
+ var data = api.getData();
2020
+ parseStartValue(data.start).each(function (detail) {
2021
+ editor.execCommand('mceListUpdate', false, {
2022
+ attrs: { start: detail.start === '1' ? '' : detail.start },
2023
+ styles: { 'list-style-type': detail.listStyleType.getOr('') }
2024
+ });
2025
+ });
2026
+ api.close();
2027
+ }
2028
+ });
2029
+ };
2030
+ var queryListCommandState = function (editor, listName) { return function () {
2031
+ var parentList = getParentList(editor);
2032
+ return isNonNullable(parentList) && parentList.nodeName === listName;
2033
+ }; };
2034
+ var registerDialog = function (editor) {
2035
+ editor.addCommand('mceListProps', function () {
2036
+ open(editor);
2037
+ });
2038
+ };
2039
+ var register$2 = function (editor) {
2040
+ editor.on('BeforeExecCommand', function (e) {
2041
+ var cmd = e.command.toLowerCase();
2042
+ if (cmd === 'indent') {
2043
+ indentListSelection(editor);
2044
+ }
2045
+ else if (cmd === 'outdent') {
2046
+ outdentListSelection(editor);
2047
+ }
2048
+ });
2049
+ editor.addCommand('InsertUnorderedList', function (ui, detail) {
2050
+ toggleList(editor, 'UL', detail);
2051
+ });
2052
+ editor.addCommand('InsertOrderedList', function (ui, detail) {
2053
+ toggleList(editor, 'OL', detail);
2054
+ });
2055
+ editor.addCommand('InsertDefinitionList', function (ui, detail) {
2056
+ toggleList(editor, 'DL', detail);
2057
+ });
2058
+ editor.addCommand('RemoveList', function () {
2059
+ flattenListSelection(editor);
2060
+ });
2061
+ registerDialog(editor);
2062
+ editor.addCommand('mceListUpdate', function (ui, detail) {
2063
+ if (isObject(detail)) {
2064
+ updateList(editor, detail);
2065
+ }
2066
+ });
2067
+ editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
2068
+ editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
2069
+ editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
2070
+ };
2071
+ var global = tinymce.util.Tools.resolve('tinymce.html.Node');
2072
+ var isTextNode = function (node) { return node.type === 3; };
2073
+ var isEmpty = function (nodeBuffer) { return nodeBuffer.length === 0; };
2074
+ var wrapInvalidChildren = function (list) {
2075
+ var insertListItem = function (buffer, refNode) {
2076
+ var li = global.create('li');
2077
+ each$1(buffer, function (node) { return li.append(node); });
2078
+ if (refNode) {
2079
+ list.insert(li, refNode, true);
2080
+ }
2081
+ else {
2082
+ list.append(li);
2083
+ }
2084
+ };
2085
+ var reducer = function (buffer, node) {
2086
+ if (isTextNode(node)) {
2087
+ return __spreadArray(__spreadArray([], buffer, true), [
2088
+ node
2089
+ ], false);
2090
+ }
2091
+ else if (!isEmpty(buffer) && !isTextNode(node)) {
2092
+ insertListItem(buffer, node);
2093
+ return [];
2094
+ }
2095
+ else {
2096
+ return buffer;
2097
+ }
2098
+ };
2099
+ var restBuffer = foldl(list.children(), reducer, []);
2100
+ if (!isEmpty(restBuffer)) {
2101
+ insertListItem(restBuffer);
2102
+ }
2103
+ };
2104
+ var setup$1 = function (editor) {
2105
+ editor.on('PreInit', function () {
2106
+ var parser = editor.parser;
2107
+ parser.addNodeFilter('ul,ol', function (nodes) { return each$1(nodes, wrapInvalidChildren); });
2108
+ });
2109
+ };
2110
+ var setupTabKey = function (editor) {
2111
+ editor.on('keydown', function (e) {
2112
+ if (e.keyCode !== global$4.TAB || global$4.metaKeyPressed(e)) {
2113
+ return;
2114
+ }
2115
+ editor.undoManager.transact(function () {
2116
+ if (e.shiftKey ? outdentListSelection(editor) : indentListSelection(editor)) {
2117
+ e.preventDefault();
2118
+ }
2119
+ });
2120
+ });
2121
+ };
2122
+ var setup = function (editor) {
2123
+ if (shouldIndentOnTab(editor)) {
2124
+ setupTabKey(editor);
2125
+ }
2126
+ setup$2(editor);
2127
+ };
2128
+ var setupToggleButtonHandler = function (editor, listName) { return function (api) {
2129
+ var toggleButtonHandler = function (e) {
2130
+ api.setActive(inList(e.parents, listName));
2131
+ api.setEnabled(!isWithinNonEditableList(editor, e.element) && editor.selection.isEditable());
2132
+ };
2133
+ api.setEnabled(editor.selection.isEditable());
2134
+ return setNodeChangeHandler(editor, toggleButtonHandler);
2135
+ }; };
2136
+ var register$1 = function (editor) {
2137
+ var exec = function (command) { return function () { return editor.execCommand(command); }; };
2138
+ if (!editor.hasPlugin('advlist')) {
2139
+ editor.ui.registry.addToggleButton('numlist', {
2140
+ icon: 'ordered-list',
2141
+ active: false,
2142
+ tooltip: 'Numbered list',
2143
+ onAction: exec('InsertOrderedList'),
2144
+ onSetup: setupToggleButtonHandler(editor, 'OL')
2145
+ });
2146
+ editor.ui.registry.addToggleButton('bullist', {
2147
+ icon: 'unordered-list',
2148
+ active: false,
2149
+ tooltip: 'Bullet list',
2150
+ onAction: exec('InsertUnorderedList'),
2151
+ onSetup: setupToggleButtonHandler(editor, 'UL')
2152
+ });
2153
+ }
2154
+ };
2155
+ var setupMenuButtonHandler = function (editor, listName) { return function (api) {
2156
+ var menuButtonHandler = function (e) { return api.setEnabled(inList(e.parents, listName) && !isWithinNonEditableList(editor, e.element)); };
2157
+ return setNodeChangeHandler(editor, menuButtonHandler);
2158
+ }; };
2159
+ var register = function (editor) {
2160
+ var listProperties = {
2161
+ text: 'List properties...',
2162
+ icon: 'ordered-list',
2163
+ onAction: function () { return editor.execCommand('mceListProps'); },
2164
+ onSetup: setupMenuButtonHandler(editor, 'OL')
2165
+ };
2166
+ editor.ui.registry.addMenuItem('listprops', listProperties);
2167
+ editor.ui.registry.addContextMenu('lists', {
2168
+ update: function (node) {
2169
+ var parentList = getParentList(editor, node);
2170
+ return isOlNode(parentList) ? ['listprops'] : [];
2171
+ }
2172
+ });
2173
+ };
2174
+ var Plugin = function () {
2175
+ global$7.add('lists', function (editor) {
2176
+ register$3(editor);
2177
+ setup$1(editor);
2178
+ if (!editor.hasPlugin('rtc', true)) {
2179
+ setup(editor);
2180
+ register$2(editor);
2181
+ }
2182
+ else {
2183
+ registerDialog(editor);
2184
+ }
2185
+ register$1(editor);
2186
+ register(editor);
2187
+ return get(editor);
2188
+ });
2189
+ };
2190
+ Plugin();
2191
+ })();