@vc-shell/framework 1.1.43 → 1.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/core/plugins/modularity/loader.ts +120 -74
  3. package/core/services/app-bar-mobile-buttons-service.ts +1 -1
  4. package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
  5. package/dist/core/services/app-bar-mobile-buttons-service.d.ts +1 -1
  6. package/dist/core/services/app-bar-mobile-buttons-service.d.ts.map +1 -1
  7. package/dist/framework.js +33347 -295
  8. package/dist/index.css +1 -9
  9. package/dist/index.d.ts +0 -4
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/locales/de.json +0 -84
  12. package/dist/locales/en.json +0 -84
  13. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue.d.ts.map +1 -1
  14. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +1 -1
  15. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -1
  16. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.d.ts.map +1 -1
  17. package/dist/shared/components/change-password-button/change-password-button.vue.d.ts.map +1 -1
  18. package/dist/shared/components/logout-button/logout-button.vue.d.ts.map +1 -1
  19. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  20. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  21. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +6 -6
  22. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
  25. package/dist/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue.d.ts.map +1 -1
  26. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts +0 -26
  27. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts.map +1 -1
  28. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  29. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  30. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  31. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts +0 -5
  32. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  33. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +0 -20
  34. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  35. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  36. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +36 -0
  37. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts.map +1 -0
  38. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts +17 -0
  39. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts.map +1 -0
  40. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +16 -2381
  41. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  42. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  43. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  44. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  45. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
  46. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  47. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue.d.ts.map +1 -1
  48. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  49. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  50. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  51. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
  52. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue.d.ts.map +1 -1
  53. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts.map +1 -1
  54. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  55. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  56. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +2 -2
  57. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
  58. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts.map +1 -1
  59. package/dist/vendor-boolbase-Cp9L0GAZ.js +25 -0
  60. package/dist/vendor-cheerio-HN9zIPZn.js +3135 -0
  61. package/dist/vendor-cheerio-select-5Ry0HvBq.js +306 -0
  62. package/dist/vendor-core-js-l0sNRNKZ.js +1 -0
  63. package/dist/vendor-css-select-DRIZ9kfZ.js +966 -0
  64. package/dist/vendor-css-what-DuPJ1HEF.js +448 -0
  65. package/dist/vendor-cypress-signalr-mock-BKdBJpdt.js +778 -0
  66. package/dist/vendor-date-fns-515YWkk-.js +6724 -0
  67. package/dist/vendor-dom-serializer-nQMsqjYW.js +286 -0
  68. package/dist/vendor-dom7-CJLPMwy5.js +941 -0
  69. package/dist/vendor-domelementtype-CjSzQey5.js +53 -0
  70. package/dist/vendor-domhandler-9z8cS16a.js +484 -0
  71. package/dist/vendor-dompurify-CRFzu7ib.js +1336 -0
  72. package/dist/vendor-domutils-Bc-Opz-v.js +981 -0
  73. package/dist/vendor-entities-Bfsx4xOQ.js +636 -0
  74. package/dist/vendor-floating-ui-core-wV8u8QP4.js +511 -0
  75. package/dist/vendor-floating-ui-dom-DDnRPs17.js +706 -0
  76. package/dist/vendor-floating-ui-utils-OMIFy1QU.js +296 -0
  77. package/dist/vendor-floating-ui-vue-D-tCDAMm.js +167 -0
  78. package/dist/vendor-fontsource-plus-jakarta-sans.css +1 -0
  79. package/dist/vendor-headlessui-vue-CY9FRgTb.js +83 -0
  80. package/dist/vendor-htmlparser2-B1dhFPOs.js +1426 -0
  81. package/dist/vendor-iconify-vue-DfRGgyNu.js +1840 -0
  82. package/dist/vendor-intlify-core-base-BuknsFQe.js +1876 -0
  83. package/dist/vendor-intlify-message-compiler-CuOQDWx1.js +1508 -0
  84. package/dist/vendor-intlify-shared-Cz4YRMuC.js +241 -0
  85. package/dist/vendor-iso-639-1-BJCk9DvE.js +819 -0
  86. package/dist/vendor-linkify-it-CKUf4vsc.js +830 -0
  87. package/dist/vendor-linkifyjs-BfyGgbCh.js +1756 -0
  88. package/dist/vendor-lodash-es-BySUOlwf.js +18333 -0
  89. package/dist/vendor-markdown-it-D-apazHa.js +6000 -0
  90. package/dist/vendor-markdown-it-task-lists-rxMVH6Ku.js +131 -0
  91. package/dist/vendor-mdurl-BNh2CCgT.js +537 -0
  92. package/dist/vendor-microsoft-applicationinsights-analytics-js-kG3lLg8X.js +1275 -0
  93. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-C0uQkiQq.js +591 -0
  94. package/dist/vendor-microsoft-applicationinsights-channel-js-Dyd_PXA3.js +2153 -0
  95. package/dist/vendor-microsoft-applicationinsights-common-CfmP1_Qr.js +2470 -0
  96. package/dist/vendor-microsoft-applicationinsights-core-js-Cq4YSEvZ.js +6589 -0
  97. package/dist/vendor-microsoft-applicationinsights-dependencies-js-C56OBFr4.js +1510 -0
  98. package/dist/vendor-microsoft-applicationinsights-properties-js-CBJTBawx.js +761 -0
  99. package/dist/vendor-microsoft-applicationinsights-shims-CX8sJgar.js +70 -0
  100. package/dist/vendor-microsoft-applicationinsights-web-pim2ri-g.js +667 -0
  101. package/dist/vendor-microsoft-dynamicproto-js-CFBBUu9p.js +520 -0
  102. package/dist/vendor-microsoft-signalr-dUnlRsGm.js +3339 -0
  103. package/dist/vendor-moment-Mki5YqAR.js +5679 -0
  104. package/dist/vendor-nevware21-ts-async-CLMApQ9E.js +395 -0
  105. package/dist/vendor-nevware21-ts-utils-e8v8Jty3.js +1160 -0
  106. package/dist/vendor-normalize-css.css +1 -0
  107. package/dist/vendor-nth-check-Bx8TxtJt.js +157 -0
  108. package/dist/vendor-orderedmap-dGG6uMFJ.js +137 -0
  109. package/dist/vendor-parse5-Bt2NhSzR.js +8432 -0
  110. package/dist/vendor-parse5-htmlparser2-tree-adapter-BUUtKzf8.js +216 -0
  111. package/dist/vendor-popperjs-core-Cr2byIky.js +1790 -0
  112. package/dist/vendor-prettier-B4PaeWRQ.js +98 -0
  113. package/dist/vendor-prosemirror-commands-BH9lWGpW.js +561 -0
  114. package/dist/vendor-prosemirror-dropcursor-CeyPcxrA.js +146 -0
  115. package/dist/vendor-prosemirror-gapcursor-U8UoUJII.js +236 -0
  116. package/dist/vendor-prosemirror-history-BDaJkvNx.js +414 -0
  117. package/dist/vendor-prosemirror-keymap-BbWvIWmH.js +128 -0
  118. package/dist/vendor-prosemirror-markdown-gB0PXBbz.js +866 -0
  119. package/dist/vendor-prosemirror-model-BZu3WVcD.js +3463 -0
  120. package/dist/vendor-prosemirror-schema-list-Bl9NpKA7.js +158 -0
  121. package/dist/vendor-prosemirror-state-BvL9Pxph.js +1003 -0
  122. package/dist/vendor-prosemirror-tables-17qAnviK.js +2159 -0
  123. package/dist/vendor-prosemirror-transform-CE9VV3qg.js +2156 -0
  124. package/dist/vendor-prosemirror-view-CU2WTHT7.js +5811 -0
  125. package/dist/vendor-punycode-js-iAs5RxMf.js +441 -0
  126. package/dist/vendor-rope-sequence-BdXDKoGt.js +207 -0
  127. package/dist/vendor-semver-CVLMK-S4.js +2702 -0
  128. package/dist/vendor-ssr-window-s6OpKa3O.js +150 -0
  129. package/dist/vendor-swiper-CdiyNHVt.js +5679 -0
  130. package/dist/vendor-swiper.css +1 -0
  131. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +1 -0
  132. package/dist/vendor-tanstack-vue-virtual-l0sNRNKZ.js +1 -0
  133. package/dist/vendor-tippy-js-DWFe2TfK.js +1647 -0
  134. package/dist/vendor-tiptap-core-NfwGfaQk.js +4910 -0
  135. package/dist/vendor-tiptap-extension-blockquote-jmWBTtsI.js +57 -0
  136. package/dist/vendor-tiptap-extension-bold-p5frh4ak.js +97 -0
  137. package/dist/vendor-tiptap-extension-bubble-menu-KUhZSfrs.js +218 -0
  138. package/dist/vendor-tiptap-extension-bullet-list-COmZRoSB.js +73 -0
  139. package/dist/vendor-tiptap-extension-code-block-DyTARZss.js +221 -0
  140. package/dist/vendor-tiptap-extension-code-jVv6CXpX.js +75 -0
  141. package/dist/vendor-tiptap-extension-document-DssuotYs.js +13 -0
  142. package/dist/vendor-tiptap-extension-dropcursor-BoO0Qv91.js +26 -0
  143. package/dist/vendor-tiptap-extension-floating-menu-CrO8CN5w.js +165 -0
  144. package/dist/vendor-tiptap-extension-gapcursor-KpsWEoMD.js +30 -0
  145. package/dist/vendor-tiptap-extension-hard-break-ldOzhSvf.js +68 -0
  146. package/dist/vendor-tiptap-extension-heading-CKz2llX0.js +77 -0
  147. package/dist/vendor-tiptap-extension-history-DeKZ2VQ9.js +48 -0
  148. package/dist/vendor-tiptap-extension-horizontal-rule-CAjWRyDS.js +92 -0
  149. package/dist/vendor-tiptap-extension-image-ZagcEYuk.js +76 -0
  150. package/dist/vendor-tiptap-extension-italic-CM4xdznY.js +96 -0
  151. package/dist/vendor-tiptap-extension-link-Z-AMC4Ri.js +414 -0
  152. package/dist/vendor-tiptap-extension-list-item-BJi5QpXc.js +37 -0
  153. package/dist/vendor-tiptap-extension-ordered-list-C_TMrfBE.js +97 -0
  154. package/dist/vendor-tiptap-extension-paragraph-CQw0E0Au.js +39 -0
  155. package/dist/vendor-tiptap-extension-placeholder-BBNVKfa_.js +66 -0
  156. package/dist/vendor-tiptap-extension-strike-DUyMYX1Z.js +79 -0
  157. package/dist/vendor-tiptap-extension-table-cell-CoDIMPA5.js +47 -0
  158. package/dist/vendor-tiptap-extension-table-header-DvbGHnmw.js +47 -0
  159. package/dist/vendor-tiptap-extension-table-row-D1uqN5Aj.js +26 -0
  160. package/dist/vendor-tiptap-extension-table-tKS4MOM4.js +354 -0
  161. package/dist/vendor-tiptap-extension-text-DtRBhKB2.js +12 -0
  162. package/dist/vendor-tiptap-extension-underline-DqaSFp_P.js +50 -0
  163. package/dist/vendor-tiptap-markdown-7-PCADTU.js +1017 -0
  164. package/dist/vendor-tiptap-pm-l0sNRNKZ.js +1 -0
  165. package/dist/vendor-tiptap-starter-kit-CDSV_Zuu.js +88 -0
  166. package/dist/vendor-tiptap-vue-3-DZg2fjq_.js +268 -0
  167. package/dist/vendor-truncate-html-3qQY0Djo.js +196 -0
  168. package/dist/vendor-uc-micro-jjt6LQ65.js +23 -0
  169. package/dist/vendor-vee-validate-i18n-v_gHjRmD.js +154 -0
  170. package/dist/vendor-vee-validate-rules-DzV3VY3N.js +536 -0
  171. package/dist/vendor-vue-currency-input-DGAkEFBO.js +545 -0
  172. package/dist/vendor-vue-demi-l0sNRNKZ.js +1 -0
  173. package/dist/vendor-vue-devtools-api-DXYR8qBG.js +169 -0
  174. package/dist/vendor-vue-i18n-Co752uk3.js +1897 -0
  175. package/dist/vendor-vue3-application-insights-CYWFCr_J.js +119 -0
  176. package/dist/vendor-vue3-touch-events-BJEAiSa3.js +416 -0
  177. package/dist/vendor-vuepic-vue-datepicker-BSWXRSiu.js +5019 -0
  178. package/dist/vendor-vuepic-vue-datepicker.css +1 -0
  179. package/dist/vendor-vueuse-components-l1bL12mE.js +339 -0
  180. package/dist/vendor-vueuse-core-DGcJOmwG.js +7743 -0
  181. package/dist/vendor-vueuse-shared-_mOXsFuM.js +1568 -0
  182. package/dist/vendor-w3c-keyname-BOm2dtJm.js +121 -0
  183. package/package.json +22 -11
  184. package/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue +3 -3
  185. package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +2 -1
  186. package/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.ts +1 -0
  187. package/shared/components/change-password-button/change-password-button.vue +1 -2
  188. package/shared/components/logout-button/logout-button.vue +1 -2
  189. package/shared/components/notifications/components/notification-container/index.ts +1 -1
  190. package/shared/components/notifications/core/notification.ts +1 -1
  191. package/shared/components/settings-menu-item/settings-menu-item.vue +1 -0
  192. package/shared/components/sidebar/sidebar.vue +2 -2
  193. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +2 -1
  194. package/ui/components/atoms/vc-hint/vc-hint.vue +2 -0
  195. package/ui/components/atoms/vc-icon/composables/use-icon.ts +1 -1
  196. package/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue +18 -14
  197. package/ui/components/atoms/vc-icon/icons/index.ts +1 -27
  198. package/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue +7 -11
  199. package/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue +37 -31
  200. package/ui/components/atoms/vc-icon/vc-icon-examples.vue +1 -1
  201. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +4 -5
  202. package/ui/components/atoms/vc-icon/vc-icon.vue +33 -163
  203. package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +22 -70
  204. package/ui/components/atoms/vc-icon/vc-material-icon.vue +28 -59
  205. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +2 -3
  206. package/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue +103 -0
  207. package/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue +252 -0
  208. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +1 -4
  209. package/ui/components/molecules/vc-editor/vc-editor.vue +666 -360
  210. package/ui/components/molecules/vc-form/vc-form.vue +7 -5
  211. package/ui/components/molecules/vc-input/vc-input.vue +1 -1
  212. package/ui/components/molecules/vc-pagination/vc-pagination.vue +4 -17
  213. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarMobileActions.vue +1 -1
  214. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue +1 -3
  215. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -4
  216. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +1 -3
  217. package/ui/components/organisms/vc-app/vc-app.backupsb.ts +214 -214
  218. package/ui/components/organisms/vc-app/vc-app.vue +3 -5
  219. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +3 -10
  220. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/mobile/vc-blade-toolbar-mobile.vue +1 -1
  221. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue +2 -2
  222. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue +2 -2
  223. package/ui/components/organisms/vc-blade/vc-blade.vue +4 -5
  224. package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +1 -3
  225. package/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue +1 -2
  226. package/ui/components/organisms/vc-table/composables/useTableState.ts +5 -5
  227. package/dist/apl-B2DGVGxc.js +0 -76
  228. package/dist/asciiarmor-2LVJmxlE.js +0 -34
  229. package/dist/asn1-jKiBa2Ya.js +0 -95
  230. package/dist/asterisk-DS281yxp.js +0 -271
  231. package/dist/brainfuck-C_p9pTT8.js +0 -34
  232. package/dist/clike-DGTaUp48.js +0 -620
  233. package/dist/clojure-CCKyeQKf.js +0 -800
  234. package/dist/cmake-CuaCgAKt.js +0 -28
  235. package/dist/cobol-BlTKFDRj.js +0 -72
  236. package/dist/coffeescript-BVCvwO8I.js +0 -179
  237. package/dist/commonlisp-D_kxz07b.js +0 -75
  238. package/dist/crystal-D309uH6_.js +0 -217
  239. package/dist/css-BkF-NPzE.js +0 -1553
  240. package/dist/cypher-BMq4Fwjl.js +0 -68
  241. package/dist/d-BZcgY6La.js +0 -127
  242. package/dist/diff-Cg9d_RX2.js +0 -18
  243. package/dist/dockerfile-DIy8NleC.js +0 -194
  244. package/dist/dtd-CtLokQ-U.js +0 -84
  245. package/dist/dylan-QYeExnWK.js +0 -234
  246. package/dist/ebnf-DUPDuY4r.js +0 -78
  247. package/dist/ecl-CiXN-g_D.js +0 -121
  248. package/dist/eiffel-yQhjl4T1.js +0 -110
  249. package/dist/elm-CNT9vbN0.js +0 -108
  250. package/dist/erlang-CFOYdy9e.js +0 -487
  251. package/dist/factor-DDOC7X6P.js +0 -65
  252. package/dist/fcl-CPC2WYrI.js +0 -103
  253. package/dist/forth-BmxRyE9S.js +0 -60
  254. package/dist/fortran-9bvPyrOW.js +0 -442
  255. package/dist/gas-cpmYfFX2.js +0 -183
  256. package/dist/gherkin-CJuwpceU.js +0 -34
  257. package/dist/groovy-DZeT_VM-.js +0 -146
  258. package/dist/haskell-Bvt3Qq1t.js +0 -375
  259. package/dist/haxe-70NVW1pR.js +0 -359
  260. package/dist/http-D9LttvKF.js +0 -44
  261. package/dist/idl-B6TRFYjl.js +0 -947
  262. package/dist/index-4DWvmoYg.js +0 -71
  263. package/dist/index-52o7mJaX.js +0 -156
  264. package/dist/index-B0KatioT.js +0 -98
  265. package/dist/index-BP3W8zuk.js +0 -268
  266. package/dist/index-BykT5L1A.js +0 -148134
  267. package/dist/index-CfXo9hsG.js +0 -75
  268. package/dist/index-Ch37pBUt.js +0 -308
  269. package/dist/index-D2KGkAYT.js +0 -93
  270. package/dist/index-D83zQom_.js +0 -58
  271. package/dist/index-DuQrVLbu.js +0 -134
  272. package/dist/index-_fdMid5h.js +0 -288
  273. package/dist/index-a1wO-owY.js +0 -545
  274. package/dist/index-crMpNSFe.js +0 -611
  275. package/dist/index-dmBRpHHY.js +0 -137
  276. package/dist/index-kBdB14Fz.js +0 -341
  277. package/dist/index-uBhy41le.js +0 -249
  278. package/dist/index-zZrijNsr.js +0 -299
  279. package/dist/javascript-C2yteZeJ.js +0 -691
  280. package/dist/jinja2-DnB6dQmV.js +0 -154
  281. package/dist/julia-DpvXAuO6.js +0 -241
  282. package/dist/livescript-CanGTf8u.js +0 -272
  283. package/dist/lua-XplVlWi_.js +0 -217
  284. package/dist/mathematica-jaRHnSxC.js +0 -35
  285. package/dist/mbox-BctzC1hL.js +0 -76
  286. package/dist/mirc-CFBPAOaF.js +0 -72
  287. package/dist/mllike-BSnXJBGA.js +0 -272
  288. package/dist/modelica-vUgVs--1.js +0 -93
  289. package/dist/mscgen-Cpl0NYLN.js +0 -104
  290. package/dist/mumps-CQoS1kWX.js +0 -25
  291. package/dist/nginx-zDPm3Z74.js +0 -89
  292. package/dist/nsis-fePjrhq7.js +0 -62
  293. package/dist/ntriples-CsNjv2QF.js +0 -79
  294. package/dist/octave-C8PmmSRH.js +0 -143
  295. package/dist/oz-Ce8aN8oE.js +0 -151
  296. package/dist/pascal-De0D6mP7.js +0 -77
  297. package/dist/perl-B4bSCe1C.js +0 -915
  298. package/dist/pig-D24Z8EXi.js +0 -54
  299. package/dist/powershell-DkYVfTzP.js +0 -249
  300. package/dist/properties-Dn9wna3M.js +0 -26
  301. package/dist/protobuf-BPIjwpzm.js +0 -49
  302. package/dist/pug-CwAQJzGR.js +0 -248
  303. package/dist/puppet-nyd4dhjf.js +0 -45
  304. package/dist/python-BkR3uSy8.js +0 -313
  305. package/dist/q-DXjKs-tC.js +0 -83
  306. package/dist/r-LKEuhEGI.js +0 -104
  307. package/dist/rpm-IznJm2Xc.js +0 -57
  308. package/dist/ruby-CcYfvIk6.js +0 -228
  309. package/dist/sas-7E8yHoCW.js +0 -105
  310. package/dist/scheme-DjibxsNh.js +0 -124
  311. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +0 -113
  312. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +0 -1
  313. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +0 -3
  314. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +0 -1
  315. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +0 -102
  316. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +0 -1
  317. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +0 -4
  318. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +0 -1
  319. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +0 -3
  320. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +0 -1
  321. package/dist/shell-C0C2sNA_.js +0 -182
  322. package/dist/sieve-Bwz7vjP5.js +0 -72
  323. package/dist/simple-mode-B0dvCdAA.js +0 -89
  324. package/dist/smalltalk-Bhddl2pB.js +0 -48
  325. package/dist/solr-BNlsLglM.js +0 -41
  326. package/dist/sparql-FarWu_Gb.js +0 -197
  327. package/dist/spreadsheet-C-cy4P5N.js +0 -49
  328. package/dist/sql-CfG5lQ3l.js +0 -282
  329. package/dist/stex-Du4h4KAU.js +0 -129
  330. package/dist/stylus-CAdqWld3.js +0 -250
  331. package/dist/swift-DSxqR9R6.js +0 -230
  332. package/dist/tcl-xfoLljhY.js +0 -81
  333. package/dist/textile-D1AWE-pc.js +0 -295
  334. package/dist/tiddlywiki-5wqsXtSk.js +0 -155
  335. package/dist/tiki-__Kn3CeS.js +0 -181
  336. package/dist/toml-BHiuTcfn.js +0 -49
  337. package/dist/troff-D2UO-fKf.js +0 -35
  338. package/dist/ttcn-Bsa4sfRm.js +0 -123
  339. package/dist/ttcn-cfg-Bac_acMi.js +0 -88
  340. package/dist/turtle-xwJUxoPV.js +0 -80
  341. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts +0 -7
  342. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts.map +0 -1
  343. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts +0 -7
  344. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts.map +0 -1
  345. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts +0 -7
  346. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts.map +0 -1
  347. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts +0 -7
  348. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts.map +0 -1
  349. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts +0 -7
  350. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts.map +0 -1
  351. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts +0 -7
  352. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts.map +0 -1
  353. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts +0 -7
  354. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts.map +0 -1
  355. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts +0 -7
  356. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts.map +0 -1
  357. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts +0 -7
  358. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts.map +0 -1
  359. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts +0 -7
  360. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts.map +0 -1
  361. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts +0 -7
  362. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts.map +0 -1
  363. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts +0 -7
  364. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts.map +0 -1
  365. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts +0 -7
  366. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts.map +0 -1
  367. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts +0 -7
  368. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts.map +0 -1
  369. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts +0 -7
  370. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts.map +0 -1
  371. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts +0 -7
  372. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts.map +0 -1
  373. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts +0 -7
  374. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts.map +0 -1
  375. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts +0 -7
  376. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts.map +0 -1
  377. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts +0 -7
  378. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts.map +0 -1
  379. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts +0 -7
  380. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts.map +0 -1
  381. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts +0 -7
  382. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts.map +0 -1
  383. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts +0 -7
  384. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts.map +0 -1
  385. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts +0 -7
  386. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts.map +0 -1
  387. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts +0 -7
  388. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts.map +0 -1
  389. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts +0 -7
  390. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts.map +0 -1
  391. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts +0 -7
  392. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts.map +0 -1
  393. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts +0 -7
  394. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts.map +0 -1
  395. package/dist/vb-c2kQGd6-.js +0 -74
  396. package/dist/vbscript-1f_Dhg5H.js +0 -324
  397. package/dist/velocity-DJd0pTTC.js +0 -96
  398. package/dist/verilog-CiS1jyi5.js +0 -262
  399. package/dist/vhdl-T9HkrbI2.js +0 -106
  400. package/dist/webidl-CjfDENEo.js +0 -155
  401. package/dist/xquery-BUQdORAS.js +0 -422
  402. package/dist/yacas-C0absKBh.js +0 -73
  403. package/dist/z80-Pki2zAjW.js +0 -61
  404. package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +0 -186
  405. package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +0 -175
  406. package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +0 -185
  407. package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +0 -245
  408. package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +0 -192
  409. package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +0 -347
  410. package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +0 -239
  411. package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +0 -186
  412. package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +0 -281
  413. package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +0 -312
  414. package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +0 -361
  415. package/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.ts +0 -224
  416. package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +0 -131
  417. package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +0 -666
  418. package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +0 -202
  419. package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +0 -178
  420. package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +0 -203
  421. package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +0 -92
  422. package/shared/modules/dynamic/components/fields/storybook/common/args.ts +0 -130
  423. package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +0 -8
  424. package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +0 -54
  425. package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +0 -16
  426. package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +0 -41
  427. package/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue +0 -15
  428. package/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue +0 -20
  429. package/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue +0 -13
  430. package/ui/components/atoms/vc-icon/icons/BellIcon.vue +0 -14
  431. package/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue +0 -13
  432. package/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue +0 -13
  433. package/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue +0 -13
  434. package/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue +0 -13
  435. package/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue +0 -16
  436. package/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue +0 -20
  437. package/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue +0 -14
  438. package/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue +0 -14
  439. package/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue +0 -27
  440. package/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue +0 -22
  441. package/ui/components/atoms/vc-icon/icons/LogoutIcon.vue +0 -13
  442. package/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue +0 -14
  443. package/ui/components/atoms/vc-icon/icons/OffersIcon.vue +0 -23
  444. package/ui/components/atoms/vc-icon/icons/OrdersIcon.vue +0 -19
  445. package/ui/components/atoms/vc-icon/icons/PeopleIcon.vue +0 -21
  446. package/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue +0 -20
  447. package/ui/components/atoms/vc-icon/icons/ProductsIcon.vue +0 -23
  448. package/ui/components/atoms/vc-icon/icons/ProfileIcon.vue +0 -18
  449. package/ui/components/atoms/vc-icon/icons/SearchIcon.vue +0 -14
  450. package/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue +0 -21
  451. package/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue +0 -16
  452. package/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue +0 -26
  453. package/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue +0 -19
@@ -0,0 +1,3135 @@
1
+ import { t as textContent, i as innerText, u as uniqueSort, n as nextElementSibling, p as prevElementSibling, g as getSiblings, a as getChildren, r as removeElement } from './vendor-domutils-Bc-Opz-v.js';
2
+ import { c as cloneNode, D as Document, i as isTag, a as isDocument, h as hasChildren, T as Text } from './vendor-domhandler-9z8cS16a.js';
3
+ import { s as select, f as filter$1, a as some, i as is$1 } from './vendor-cheerio-select-5Ry0HvBq.js';
4
+ import { s as serializeOuter, p as parse$2, a as parseFragment } from './vendor-parse5-Bt2NhSzR.js';
5
+ import { a as adapter } from './vendor-parse5-htmlparser2-tree-adapter-BUUtKzf8.js';
6
+ import { r as render$1 } from './vendor-dom-serializer-nQMsqjYW.js';
7
+ import { p as parseDocument } from './vendor-htmlparser2-B1dhFPOs.js';
8
+
9
+ const defaultOpts = {
10
+ xml: false,
11
+ decodeEntities: true,
12
+ };
13
+ const xmlModeDefault = {
14
+ _useHtmlParser2: true,
15
+ xmlMode: true,
16
+ };
17
+ /**
18
+ * Flatten the options for Cheerio.
19
+ *
20
+ * This will set `_useHtmlParser2` to true if `xml` is set to true.
21
+ *
22
+ * @param options - The options to flatten.
23
+ * @returns The flattened options.
24
+ */
25
+ function flatten(options) {
26
+ return (options === null || options === void 0 ? void 0 : options.xml)
27
+ ? typeof options.xml === 'boolean'
28
+ ? xmlModeDefault
29
+ : { ...xmlModeDefault, ...options.xml }
30
+ : options !== null && options !== void 0 ? options : undefined;
31
+ }
32
+
33
+ /**
34
+ * Helper function to render a DOM.
35
+ *
36
+ * @param that - Cheerio instance to render.
37
+ * @param dom - The DOM to render. Defaults to `that`'s root.
38
+ * @param options - Options for rendering.
39
+ * @returns The rendered document.
40
+ */
41
+ function render(that, dom, options) {
42
+ if (!that)
43
+ return '';
44
+ return that(dom !== null && dom !== void 0 ? dom : that._root.children, null, undefined, options).toString();
45
+ }
46
+ /**
47
+ * Checks if a passed object is an options object.
48
+ *
49
+ * @param dom - Object to check if it is an options object.
50
+ * @returns Whether the object is an options object.
51
+ */
52
+ function isOptions(dom, options) {
53
+ return (typeof dom === 'object' &&
54
+ dom != null &&
55
+ !('length' in dom) &&
56
+ !('type' in dom));
57
+ }
58
+ function html$1(dom, options) {
59
+ /*
60
+ * Be flexible about parameters, sometimes we call html(),
61
+ * with options as only parameter
62
+ * check dom argument for dom element specific properties
63
+ * assume there is no 'length' or 'type' properties in the options object
64
+ */
65
+ const toRender = isOptions(dom) ? ((options = dom), undefined) : dom;
66
+ /*
67
+ * Sometimes `$.html()` is used without preloading html,
68
+ * so fallback non-existing options to the default ones.
69
+ */
70
+ const opts = {
71
+ ...defaultOpts,
72
+ ...this === null || this === void 0 ? void 0 : this._options,
73
+ ...flatten(options !== null && options !== void 0 ? options : {}),
74
+ };
75
+ return render(this, toRender, opts);
76
+ }
77
+ /**
78
+ * Render the document as XML.
79
+ *
80
+ * @param dom - Element to render.
81
+ * @returns THe rendered document.
82
+ */
83
+ function xml(dom) {
84
+ const options = { ...this._options, xmlMode: true };
85
+ return render(this, dom, options);
86
+ }
87
+ /**
88
+ * Render the document as text.
89
+ *
90
+ * This returns the `textContent` of the passed elements. The result will
91
+ * include the contents of `script` and `stype` elements. To avoid this, use
92
+ * `.prop('innerText')` instead.
93
+ *
94
+ * @param elements - Elements to render.
95
+ * @returns The rendered document.
96
+ */
97
+ function text$1(elements) {
98
+ const elems = elements ? elements : this ? this.root() : [];
99
+ let ret = '';
100
+ for (let i = 0; i < elems.length; i++) {
101
+ ret += textContent(elems[i]);
102
+ }
103
+ return ret;
104
+ }
105
+ function parseHTML(data, context, keepScripts = typeof context === 'boolean' ? context : false) {
106
+ if (!data || typeof data !== 'string') {
107
+ return null;
108
+ }
109
+ if (typeof context === 'boolean') {
110
+ keepScripts = context;
111
+ }
112
+ const parsed = this.load(data, defaultOpts, false);
113
+ if (!keepScripts) {
114
+ parsed('script').remove();
115
+ }
116
+ /*
117
+ * The `children` array is used by Cheerio internally to group elements that
118
+ * share the same parents. When nodes created through `parseHTML` are
119
+ * inserted into previously-existing DOM structures, they will be removed
120
+ * from the `children` array. The results of `parseHTML` should remain
121
+ * constant across these operations, so a shallow copy should be returned.
122
+ */
123
+ return parsed.root()[0].children.slice();
124
+ }
125
+ /**
126
+ * Sometimes you need to work with the top-level root element. To query it, you
127
+ * can use `$.root()`.
128
+ *
129
+ * @example
130
+ *
131
+ * ```js
132
+ * $.root().append('<ul id="vegetables"></ul>').html();
133
+ * //=> <ul id="fruits">...</ul><ul id="vegetables"></ul>
134
+ * ```
135
+ *
136
+ * @returns Cheerio instance wrapping the root node.
137
+ * @alias Cheerio.root
138
+ */
139
+ function root() {
140
+ return this(this._root);
141
+ }
142
+ /**
143
+ * Checks to see if the `contained` DOM element is a descendant of the
144
+ * `container` DOM element.
145
+ *
146
+ * @param container - Potential parent node.
147
+ * @param contained - Potential child node.
148
+ * @returns Indicates if the nodes contain one another.
149
+ * @alias Cheerio.contains
150
+ * @see {@link https://api.jquery.com/jQuery.contains/}
151
+ */
152
+ function contains(container, contained) {
153
+ // According to the jQuery API, an element does not "contain" itself
154
+ if (contained === container) {
155
+ return false;
156
+ }
157
+ /*
158
+ * Step up the descendants, stopping when the root element is reached
159
+ * (signaled by `.parent` returning a reference to the same object)
160
+ */
161
+ let next = contained;
162
+ while (next && next !== next.parent) {
163
+ next = next.parent;
164
+ if (next === container) {
165
+ return true;
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+ /**
171
+ * $.merge().
172
+ *
173
+ * @param arr1 - First array.
174
+ * @param arr2 - Second array.
175
+ * @returns `arr1`, with elements of `arr2` inserted.
176
+ * @alias Cheerio.merge
177
+ * @see {@link https://api.jquery.com/jQuery.merge/}
178
+ */
179
+ function merge(arr1, arr2) {
180
+ if (!isArrayLike(arr1) || !isArrayLike(arr2)) {
181
+ return;
182
+ }
183
+ let newLength = arr1.length;
184
+ const len = +arr2.length;
185
+ for (let i = 0; i < len; i++) {
186
+ arr1[newLength++] = arr2[i];
187
+ }
188
+ arr1.length = newLength;
189
+ return arr1;
190
+ }
191
+ /**
192
+ * Checks if an object is array-like.
193
+ *
194
+ * @param item - Item to check.
195
+ * @returns Indicates if the item is array-like.
196
+ */
197
+ function isArrayLike(item) {
198
+ if (Array.isArray(item)) {
199
+ return true;
200
+ }
201
+ if (typeof item !== 'object' ||
202
+ !Object.prototype.hasOwnProperty.call(item, 'length') ||
203
+ typeof item.length !== 'number' ||
204
+ item.length < 0) {
205
+ return false;
206
+ }
207
+ for (let i = 0; i < item.length; i++) {
208
+ if (!(i in item)) {
209
+ return false;
210
+ }
211
+ }
212
+ return true;
213
+ }
214
+
215
+ const staticMethods = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
216
+ __proto__: null,
217
+ contains,
218
+ html: html$1,
219
+ merge,
220
+ parseHTML,
221
+ root,
222
+ text: text$1,
223
+ xml
224
+ }, Symbol.toStringTag, { value: 'Module' }));
225
+
226
+ /**
227
+ * Checks if an object is a Cheerio instance.
228
+ *
229
+ * @category Utils
230
+ * @param maybeCheerio - The object to check.
231
+ * @returns Whether the object is a Cheerio instance.
232
+ */
233
+ function isCheerio(maybeCheerio) {
234
+ return maybeCheerio.cheerio != null;
235
+ }
236
+ /**
237
+ * Convert a string to camel case notation.
238
+ *
239
+ * @private
240
+ * @category Utils
241
+ * @param str - The string to be converted.
242
+ * @returns String in camel case notation.
243
+ */
244
+ function camelCase(str) {
245
+ return str.replace(/[_.-](\w|$)/g, (_, x) => x.toUpperCase());
246
+ }
247
+ /**
248
+ * Convert a string from camel case to "CSS case", where word boundaries are
249
+ * described by hyphens ("-") and all characters are lower-case.
250
+ *
251
+ * @private
252
+ * @category Utils
253
+ * @param str - The string to be converted.
254
+ * @returns String in "CSS case".
255
+ */
256
+ function cssCase(str) {
257
+ return str.replace(/[A-Z]/g, '-$&').toLowerCase();
258
+ }
259
+ /**
260
+ * Iterate over each DOM element without creating intermediary Cheerio instances.
261
+ *
262
+ * This is indented for use internally to avoid otherwise unnecessary memory
263
+ * pressure introduced by _make.
264
+ *
265
+ * @category Utils
266
+ * @param array - The array to iterate over.
267
+ * @param fn - Function to call.
268
+ * @returns The original instance.
269
+ */
270
+ function domEach(array, fn) {
271
+ const len = array.length;
272
+ for (let i = 0; i < len; i++)
273
+ fn(array[i], i);
274
+ return array;
275
+ }
276
+ /**
277
+ * Create a deep copy of the given DOM structure. Sets the parents of the copies
278
+ * of the passed nodes to `null`.
279
+ *
280
+ * @private
281
+ * @category Utils
282
+ * @param dom - The domhandler-compliant DOM structure.
283
+ * @returns - The cloned DOM.
284
+ */
285
+ function cloneDom(dom) {
286
+ const clone = 'length' in dom
287
+ ? Array.prototype.map.call(dom, (el) => cloneNode(el, true))
288
+ : [cloneNode(dom, true)];
289
+ // Add a root node around the cloned nodes
290
+ const root = new Document(clone);
291
+ clone.forEach((node) => {
292
+ node.parent = root;
293
+ });
294
+ return clone;
295
+ }
296
+ var CharacterCodes;
297
+ (function (CharacterCodes) {
298
+ CharacterCodes[CharacterCodes["LowerA"] = 97] = "LowerA";
299
+ CharacterCodes[CharacterCodes["LowerZ"] = 122] = "LowerZ";
300
+ CharacterCodes[CharacterCodes["UpperA"] = 65] = "UpperA";
301
+ CharacterCodes[CharacterCodes["UpperZ"] = 90] = "UpperZ";
302
+ CharacterCodes[CharacterCodes["Exclamation"] = 33] = "Exclamation";
303
+ })(CharacterCodes || (CharacterCodes = {}));
304
+ /**
305
+ * Check if string is HTML.
306
+ *
307
+ * Tests for a `<` within a string, immediate followed by a letter and
308
+ * eventually followed by a `>`.
309
+ *
310
+ * @private
311
+ * @category Utils
312
+ * @param str - The string to check.
313
+ * @returns Indicates if `str` is HTML.
314
+ */
315
+ function isHtml(str) {
316
+ const tagStart = str.indexOf('<');
317
+ if (tagStart < 0 || tagStart > str.length - 3)
318
+ return false;
319
+ const tagChar = str.charCodeAt(tagStart + 1);
320
+ return (((tagChar >= CharacterCodes.LowerA && tagChar <= CharacterCodes.LowerZ) ||
321
+ (tagChar >= CharacterCodes.UpperA && tagChar <= CharacterCodes.UpperZ) ||
322
+ tagChar === CharacterCodes.Exclamation) &&
323
+ str.includes('>', tagStart + 2));
324
+ }
325
+
326
+ /**
327
+ * Methods for getting and modifying attributes.
328
+ *
329
+ * @module cheerio/attributes
330
+ */
331
+ const hasOwn = Object.prototype.hasOwnProperty;
332
+ const rspace = /\s+/;
333
+ const dataAttrPrefix = 'data-';
334
+ /*
335
+ * Lookup table for coercing string data-* attributes to their corresponding
336
+ * JavaScript primitives
337
+ */
338
+ const primitives = {
339
+ null: null,
340
+ true: true,
341
+ false: false,
342
+ };
343
+ // Attributes that are booleans
344
+ const rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i;
345
+ // Matches strings that look like JSON objects or arrays
346
+ const rbrace = /^{[^]*}$|^\[[^]*]$/;
347
+ function getAttr(elem, name, xmlMode) {
348
+ var _a;
349
+ if (!elem || !isTag(elem))
350
+ return undefined;
351
+ (_a = elem.attribs) !== null && _a !== void 0 ? _a : (elem.attribs = {});
352
+ // Return the entire attribs object if no attribute specified
353
+ if (!name) {
354
+ return elem.attribs;
355
+ }
356
+ if (hasOwn.call(elem.attribs, name)) {
357
+ // Get the (decoded) attribute
358
+ return !xmlMode && rboolean.test(name) ? name : elem.attribs[name];
359
+ }
360
+ // Mimic the DOM and return text content as value for `option's`
361
+ if (elem.name === 'option' && name === 'value') {
362
+ return text$1(elem.children);
363
+ }
364
+ // Mimic DOM with default value for radios/checkboxes
365
+ if (elem.name === 'input' &&
366
+ (elem.attribs['type'] === 'radio' || elem.attribs['type'] === 'checkbox') &&
367
+ name === 'value') {
368
+ return 'on';
369
+ }
370
+ return undefined;
371
+ }
372
+ /**
373
+ * Sets the value of an attribute. The attribute will be deleted if the value is `null`.
374
+ *
375
+ * @private
376
+ * @param el - The element to set the attribute on.
377
+ * @param name - The attribute's name.
378
+ * @param value - The attribute's value.
379
+ */
380
+ function setAttr(el, name, value) {
381
+ if (value === null) {
382
+ removeAttribute(el, name);
383
+ }
384
+ else {
385
+ el.attribs[name] = `${value}`;
386
+ }
387
+ }
388
+ function attr(name, value) {
389
+ // Set the value (with attr map support)
390
+ if (typeof name === 'object' || value !== undefined) {
391
+ if (typeof value === 'function') {
392
+ if (typeof name !== 'string') {
393
+ {
394
+ throw new Error('Bad combination of arguments.');
395
+ }
396
+ }
397
+ return domEach(this, (el, i) => {
398
+ if (isTag(el))
399
+ setAttr(el, name, value.call(el, i, el.attribs[name]));
400
+ });
401
+ }
402
+ return domEach(this, (el) => {
403
+ if (!isTag(el))
404
+ return;
405
+ if (typeof name === 'object') {
406
+ Object.keys(name).forEach((objName) => {
407
+ const objValue = name[objName];
408
+ setAttr(el, objName, objValue);
409
+ });
410
+ }
411
+ else {
412
+ setAttr(el, name, value);
413
+ }
414
+ });
415
+ }
416
+ return arguments.length > 1
417
+ ? this
418
+ : getAttr(this[0], name, this.options.xmlMode);
419
+ }
420
+ /**
421
+ * Gets a node's prop.
422
+ *
423
+ * @private
424
+ * @category Attributes
425
+ * @param el - Element to get the prop of.
426
+ * @param name - Name of the prop.
427
+ * @returns The prop's value.
428
+ */
429
+ function getProp(el, name, xmlMode) {
430
+ return name in el
431
+ ? // @ts-expect-error TS doesn't like us accessing the value directly here.
432
+ el[name]
433
+ : !xmlMode && rboolean.test(name)
434
+ ? getAttr(el, name, false) !== undefined
435
+ : getAttr(el, name, xmlMode);
436
+ }
437
+ /**
438
+ * Sets the value of a prop.
439
+ *
440
+ * @private
441
+ * @param el - The element to set the prop on.
442
+ * @param name - The prop's name.
443
+ * @param value - The prop's value.
444
+ */
445
+ function setProp(el, name, value, xmlMode) {
446
+ if (name in el) {
447
+ // @ts-expect-error Overriding value
448
+ el[name] = value;
449
+ }
450
+ else {
451
+ setAttr(el, name, !xmlMode && rboolean.test(name) ? (value ? '' : null) : `${value}`);
452
+ }
453
+ }
454
+ function prop(name, value) {
455
+ var _a;
456
+ if (typeof name === 'string' && value === undefined) {
457
+ const el = this[0];
458
+ if (!el || !isTag(el))
459
+ return undefined;
460
+ switch (name) {
461
+ case 'style': {
462
+ const property = this.css();
463
+ const keys = Object.keys(property);
464
+ keys.forEach((p, i) => {
465
+ property[i] = p;
466
+ });
467
+ property.length = keys.length;
468
+ return property;
469
+ }
470
+ case 'tagName':
471
+ case 'nodeName': {
472
+ return el.name.toUpperCase();
473
+ }
474
+ case 'href':
475
+ case 'src': {
476
+ const prop = (_a = el.attribs) === null || _a === void 0 ? void 0 : _a[name];
477
+ /* eslint-disable node/no-unsupported-features/node-builtins */
478
+ if (typeof URL !== 'undefined' &&
479
+ ((name === 'href' && (el.tagName === 'a' || el.name === 'link')) ||
480
+ (name === 'src' &&
481
+ (el.tagName === 'img' ||
482
+ el.tagName === 'iframe' ||
483
+ el.tagName === 'audio' ||
484
+ el.tagName === 'video' ||
485
+ el.tagName === 'source'))) &&
486
+ prop !== undefined &&
487
+ this.options.baseURI) {
488
+ return new URL(prop, this.options.baseURI).href;
489
+ }
490
+ /* eslint-enable node/no-unsupported-features/node-builtins */
491
+ return prop;
492
+ }
493
+ case 'innerText': {
494
+ return innerText(el);
495
+ }
496
+ case 'textContent': {
497
+ return textContent(el);
498
+ }
499
+ case 'outerHTML':
500
+ return this.clone().wrap('<container />').parent().html();
501
+ case 'innerHTML':
502
+ return this.html();
503
+ default:
504
+ return getProp(el, name, this.options.xmlMode);
505
+ }
506
+ }
507
+ if (typeof name === 'object' || value !== undefined) {
508
+ if (typeof value === 'function') {
509
+ if (typeof name === 'object') {
510
+ throw new Error('Bad combination of arguments.');
511
+ }
512
+ return domEach(this, (el, i) => {
513
+ if (isTag(el)) {
514
+ setProp(el, name, value.call(el, i, getProp(el, name, this.options.xmlMode)), this.options.xmlMode);
515
+ }
516
+ });
517
+ }
518
+ return domEach(this, (el) => {
519
+ if (!isTag(el))
520
+ return;
521
+ if (typeof name === 'object') {
522
+ Object.keys(name).forEach((key) => {
523
+ const val = name[key];
524
+ setProp(el, key, val, this.options.xmlMode);
525
+ });
526
+ }
527
+ else {
528
+ setProp(el, name, value, this.options.xmlMode);
529
+ }
530
+ });
531
+ }
532
+ return undefined;
533
+ }
534
+ /**
535
+ * Sets the value of a data attribute.
536
+ *
537
+ * @private
538
+ * @param el - The element to set the data attribute on.
539
+ * @param name - The data attribute's name.
540
+ * @param value - The data attribute's value.
541
+ */
542
+ function setData(el, name, value) {
543
+ var _a;
544
+ const elem = el;
545
+ (_a = elem.data) !== null && _a !== void 0 ? _a : (elem.data = {});
546
+ if (typeof name === 'object')
547
+ Object.assign(elem.data, name);
548
+ else if (typeof name === 'string' && value !== undefined) {
549
+ elem.data[name] = value;
550
+ }
551
+ }
552
+ /**
553
+ * Read the specified attribute from the equivalent HTML5 `data-*` attribute,
554
+ * and (if present) cache the value in the node's internal data store. If no
555
+ * attribute name is specified, read _all_ HTML5 `data-*` attributes in this manner.
556
+ *
557
+ * @private
558
+ * @category Attributes
559
+ * @param el - Element to get the data attribute of.
560
+ * @param name - Name of the data attribute.
561
+ * @returns The data attribute's value, or a map with all of the data attributes.
562
+ */
563
+ function readData(el, name) {
564
+ let domNames;
565
+ let jsNames;
566
+ let value;
567
+ if (name == null) {
568
+ domNames = Object.keys(el.attribs).filter((attrName) => attrName.startsWith(dataAttrPrefix));
569
+ jsNames = domNames.map((domName) => camelCase(domName.slice(dataAttrPrefix.length)));
570
+ }
571
+ else {
572
+ domNames = [dataAttrPrefix + cssCase(name)];
573
+ jsNames = [name];
574
+ }
575
+ for (let idx = 0; idx < domNames.length; ++idx) {
576
+ const domName = domNames[idx];
577
+ const jsName = jsNames[idx];
578
+ if (hasOwn.call(el.attribs, domName) &&
579
+ !hasOwn.call(el.data, jsName)) {
580
+ value = el.attribs[domName];
581
+ if (hasOwn.call(primitives, value)) {
582
+ value = primitives[value];
583
+ }
584
+ else if (value === String(Number(value))) {
585
+ value = Number(value);
586
+ }
587
+ else if (rbrace.test(value)) {
588
+ try {
589
+ value = JSON.parse(value);
590
+ }
591
+ catch (e) {
592
+ /* Ignore */
593
+ }
594
+ }
595
+ el.data[jsName] = value;
596
+ }
597
+ }
598
+ return name == null ? el.data : value;
599
+ }
600
+ function data(name, value) {
601
+ var _a;
602
+ const elem = this[0];
603
+ if (!elem || !isTag(elem))
604
+ return;
605
+ const dataEl = elem;
606
+ (_a = dataEl.data) !== null && _a !== void 0 ? _a : (dataEl.data = {});
607
+ // Return the entire data object if no data specified
608
+ if (!name) {
609
+ return readData(dataEl);
610
+ }
611
+ // Set the value (with attr map support)
612
+ if (typeof name === 'object' || value !== undefined) {
613
+ domEach(this, (el) => {
614
+ if (isTag(el)) {
615
+ if (typeof name === 'object')
616
+ setData(el, name);
617
+ else
618
+ setData(el, name, value);
619
+ }
620
+ });
621
+ return this;
622
+ }
623
+ if (hasOwn.call(dataEl.data, name)) {
624
+ return dataEl.data[name];
625
+ }
626
+ return readData(dataEl, name);
627
+ }
628
+ function val(value) {
629
+ const querying = arguments.length === 0;
630
+ const element = this[0];
631
+ if (!element || !isTag(element))
632
+ return querying ? undefined : this;
633
+ switch (element.name) {
634
+ case 'textarea':
635
+ return this.text(value);
636
+ case 'select': {
637
+ const option = this.find('option:selected');
638
+ if (!querying) {
639
+ if (this.attr('multiple') == null && typeof value === 'object') {
640
+ return this;
641
+ }
642
+ this.find('option').removeAttr('selected');
643
+ const values = typeof value !== 'object' ? [value] : value;
644
+ for (let i = 0; i < values.length; i++) {
645
+ this.find(`option[value="${values[i]}"]`).attr('selected', '');
646
+ }
647
+ return this;
648
+ }
649
+ return this.attr('multiple')
650
+ ? option.toArray().map((el) => text$1(el.children))
651
+ : option.attr('value');
652
+ }
653
+ case 'input':
654
+ case 'option':
655
+ return querying
656
+ ? this.attr('value')
657
+ : this.attr('value', value);
658
+ }
659
+ return undefined;
660
+ }
661
+ /**
662
+ * Remove an attribute.
663
+ *
664
+ * @private
665
+ * @param elem - Node to remove attribute from.
666
+ * @param name - Name of the attribute to remove.
667
+ */
668
+ function removeAttribute(elem, name) {
669
+ if (!elem.attribs || !hasOwn.call(elem.attribs, name))
670
+ return;
671
+ delete elem.attribs[name];
672
+ }
673
+ /**
674
+ * Splits a space-separated list of names to individual names.
675
+ *
676
+ * @category Attributes
677
+ * @param names - Names to split.
678
+ * @returns - Split names.
679
+ */
680
+ function splitNames(names) {
681
+ return names ? names.trim().split(rspace) : [];
682
+ }
683
+ /**
684
+ * Method for removing attributes by `name`.
685
+ *
686
+ * @category Attributes
687
+ * @example
688
+ *
689
+ * ```js
690
+ * $('.pear').removeAttr('class').html();
691
+ * //=> <li>Pear</li>
692
+ *
693
+ * $('.apple').attr('id', 'favorite');
694
+ * $('.apple').removeAttr('id class').html();
695
+ * //=> <li>Apple</li>
696
+ * ```
697
+ *
698
+ * @param name - Name of the attribute.
699
+ * @returns The instance itself.
700
+ * @see {@link https://api.jquery.com/removeAttr/}
701
+ */
702
+ function removeAttr(name) {
703
+ const attrNames = splitNames(name);
704
+ for (let i = 0; i < attrNames.length; i++) {
705
+ domEach(this, (elem) => {
706
+ if (isTag(elem))
707
+ removeAttribute(elem, attrNames[i]);
708
+ });
709
+ }
710
+ return this;
711
+ }
712
+ /**
713
+ * Check to see if _any_ of the matched elements have the given `className`.
714
+ *
715
+ * @category Attributes
716
+ * @example
717
+ *
718
+ * ```js
719
+ * $('.pear').hasClass('pear');
720
+ * //=> true
721
+ *
722
+ * $('apple').hasClass('fruit');
723
+ * //=> false
724
+ *
725
+ * $('li').hasClass('pear');
726
+ * //=> true
727
+ * ```
728
+ *
729
+ * @param className - Name of the class.
730
+ * @returns Indicates if an element has the given `className`.
731
+ * @see {@link https://api.jquery.com/hasClass/}
732
+ */
733
+ function hasClass(className) {
734
+ return this.toArray().some((elem) => {
735
+ const clazz = isTag(elem) && elem.attribs['class'];
736
+ let idx = -1;
737
+ if (clazz && className.length) {
738
+ while ((idx = clazz.indexOf(className, idx + 1)) > -1) {
739
+ const end = idx + className.length;
740
+ if ((idx === 0 || rspace.test(clazz[idx - 1])) &&
741
+ (end === clazz.length || rspace.test(clazz[end]))) {
742
+ return true;
743
+ }
744
+ }
745
+ }
746
+ return false;
747
+ });
748
+ }
749
+ /**
750
+ * Adds class(es) to all of the matched elements. Also accepts a `function`.
751
+ *
752
+ * @category Attributes
753
+ * @example
754
+ *
755
+ * ```js
756
+ * $('.pear').addClass('fruit').html();
757
+ * //=> <li class="pear fruit">Pear</li>
758
+ *
759
+ * $('.apple').addClass('fruit red').html();
760
+ * //=> <li class="apple fruit red">Apple</li>
761
+ * ```
762
+ *
763
+ * @param value - Name of new class.
764
+ * @returns The instance itself.
765
+ * @see {@link https://api.jquery.com/addClass/}
766
+ */
767
+ function addClass(value) {
768
+ // Support functions
769
+ if (typeof value === 'function') {
770
+ return domEach(this, (el, i) => {
771
+ if (isTag(el)) {
772
+ const className = el.attribs['class'] || '';
773
+ addClass.call([el], value.call(el, i, className));
774
+ }
775
+ });
776
+ }
777
+ // Return if no value or not a string or function
778
+ if (!value || typeof value !== 'string')
779
+ return this;
780
+ const classNames = value.split(rspace);
781
+ const numElements = this.length;
782
+ for (let i = 0; i < numElements; i++) {
783
+ const el = this[i];
784
+ // If selected element isn't a tag, move on
785
+ if (!isTag(el))
786
+ continue;
787
+ // If we don't already have classes — always set xmlMode to false here, as it doesn't matter for classes
788
+ const className = getAttr(el, 'class', false);
789
+ if (!className) {
790
+ setAttr(el, 'class', classNames.join(' ').trim());
791
+ }
792
+ else {
793
+ let setClass = ` ${className} `;
794
+ // Check if class already exists
795
+ for (let j = 0; j < classNames.length; j++) {
796
+ const appendClass = `${classNames[j]} `;
797
+ if (!setClass.includes(` ${appendClass}`))
798
+ setClass += appendClass;
799
+ }
800
+ setAttr(el, 'class', setClass.trim());
801
+ }
802
+ }
803
+ return this;
804
+ }
805
+ /**
806
+ * Removes one or more space-separated classes from the selected elements. If no
807
+ * `className` is defined, all classes will be removed. Also accepts a `function`.
808
+ *
809
+ * @category Attributes
810
+ * @example
811
+ *
812
+ * ```js
813
+ * $('.pear').removeClass('pear').html();
814
+ * //=> <li class="">Pear</li>
815
+ *
816
+ * $('.apple').addClass('red').removeClass().html();
817
+ * //=> <li class="">Apple</li>
818
+ * ```
819
+ *
820
+ * @param name - Name of the class. If not specified, removes all elements.
821
+ * @returns The instance itself.
822
+ * @see {@link https://api.jquery.com/removeClass/}
823
+ */
824
+ function removeClass(name) {
825
+ // Handle if value is a function
826
+ if (typeof name === 'function') {
827
+ return domEach(this, (el, i) => {
828
+ if (isTag(el)) {
829
+ removeClass.call([el], name.call(el, i, el.attribs['class'] || ''));
830
+ }
831
+ });
832
+ }
833
+ const classes = splitNames(name);
834
+ const numClasses = classes.length;
835
+ const removeAll = arguments.length === 0;
836
+ return domEach(this, (el) => {
837
+ if (!isTag(el))
838
+ return;
839
+ if (removeAll) {
840
+ // Short circuit the remove all case as this is the nice one
841
+ el.attribs['class'] = '';
842
+ }
843
+ else {
844
+ const elClasses = splitNames(el.attribs['class']);
845
+ let changed = false;
846
+ for (let j = 0; j < numClasses; j++) {
847
+ const index = elClasses.indexOf(classes[j]);
848
+ if (index >= 0) {
849
+ elClasses.splice(index, 1);
850
+ changed = true;
851
+ /*
852
+ * We have to do another pass to ensure that there are not duplicate
853
+ * classes listed
854
+ */
855
+ j--;
856
+ }
857
+ }
858
+ if (changed) {
859
+ el.attribs['class'] = elClasses.join(' ');
860
+ }
861
+ }
862
+ });
863
+ }
864
+ /**
865
+ * Add or remove class(es) from the matched elements, depending on either the
866
+ * class's presence or the value of the switch argument. Also accepts a `function`.
867
+ *
868
+ * @category Attributes
869
+ * @example
870
+ *
871
+ * ```js
872
+ * $('.apple.green').toggleClass('fruit green red').html();
873
+ * //=> <li class="apple fruit red">Apple</li>
874
+ *
875
+ * $('.apple.green').toggleClass('fruit green red', true).html();
876
+ * //=> <li class="apple green fruit red">Apple</li>
877
+ * ```
878
+ *
879
+ * @param value - Name of the class. Can also be a function.
880
+ * @param stateVal - If specified the state of the class.
881
+ * @returns The instance itself.
882
+ * @see {@link https://api.jquery.com/toggleClass/}
883
+ */
884
+ function toggleClass(value, stateVal) {
885
+ // Support functions
886
+ if (typeof value === 'function') {
887
+ return domEach(this, (el, i) => {
888
+ if (isTag(el)) {
889
+ toggleClass.call([el], value.call(el, i, el.attribs['class'] || '', stateVal), stateVal);
890
+ }
891
+ });
892
+ }
893
+ // Return if no value or not a string or function
894
+ if (!value || typeof value !== 'string')
895
+ return this;
896
+ const classNames = value.split(rspace);
897
+ const numClasses = classNames.length;
898
+ const state = typeof stateVal === 'boolean' ? (stateVal ? 1 : -1) : 0;
899
+ const numElements = this.length;
900
+ for (let i = 0; i < numElements; i++) {
901
+ const el = this[i];
902
+ // If selected element isn't a tag, move on
903
+ if (!isTag(el))
904
+ continue;
905
+ const elementClasses = splitNames(el.attribs['class']);
906
+ // Check if class already exists
907
+ for (let j = 0; j < numClasses; j++) {
908
+ // Check if the class name is currently defined
909
+ const index = elementClasses.indexOf(classNames[j]);
910
+ // Add if stateValue === true or we are toggling and there is no value
911
+ if (state >= 0 && index < 0) {
912
+ elementClasses.push(classNames[j]);
913
+ }
914
+ else if (state <= 0 && index >= 0) {
915
+ // Otherwise remove but only if the item exists
916
+ elementClasses.splice(index, 1);
917
+ }
918
+ }
919
+ el.attribs['class'] = elementClasses.join(' ');
920
+ }
921
+ return this;
922
+ }
923
+
924
+ const Attributes = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
925
+ __proto__: null,
926
+ addClass,
927
+ attr,
928
+ data,
929
+ hasClass,
930
+ prop,
931
+ removeAttr,
932
+ removeClass,
933
+ toggleClass,
934
+ val
935
+ }, Symbol.toStringTag, { value: 'Module' }));
936
+
937
+ /**
938
+ * Methods for traversing the DOM structure.
939
+ *
940
+ * @module cheerio/traversing
941
+ */
942
+ const reSiblingSelector = /^\s*[~+]/;
943
+ /**
944
+ * Get the descendants of each element in the current set of matched elements,
945
+ * filtered by a selector, jQuery object, or element.
946
+ *
947
+ * @category Traversing
948
+ * @example
949
+ *
950
+ * ```js
951
+ * $('#fruits').find('li').length;
952
+ * //=> 3
953
+ * $('#fruits').find($('.apple')).length;
954
+ * //=> 1
955
+ * ```
956
+ *
957
+ * @param selectorOrHaystack - Element to look for.
958
+ * @returns The found elements.
959
+ * @see {@link https://api.jquery.com/find/}
960
+ */
961
+ function find(selectorOrHaystack) {
962
+ var _a;
963
+ if (!selectorOrHaystack) {
964
+ return this._make([]);
965
+ }
966
+ const context = this.toArray();
967
+ if (typeof selectorOrHaystack !== 'string') {
968
+ const haystack = isCheerio(selectorOrHaystack)
969
+ ? selectorOrHaystack.toArray()
970
+ : [selectorOrHaystack];
971
+ return this._make(haystack.filter((elem) => context.some((node) => contains(node, elem))));
972
+ }
973
+ const elems = reSiblingSelector.test(selectorOrHaystack)
974
+ ? context
975
+ : this.children().toArray();
976
+ const options = {
977
+ context,
978
+ root: (_a = this._root) === null || _a === void 0 ? void 0 : _a[0],
979
+ // Pass options that are recognized by `cheerio-select`
980
+ xmlMode: this.options.xmlMode,
981
+ lowerCaseTags: this.options.lowerCaseTags,
982
+ lowerCaseAttributeNames: this.options.lowerCaseAttributeNames,
983
+ pseudos: this.options.pseudos,
984
+ quirksMode: this.options.quirksMode,
985
+ };
986
+ return this._make(select(selectorOrHaystack, elems, options));
987
+ }
988
+ /**
989
+ * Creates a matcher, using a particular mapping function. Matchers provide a
990
+ * function that finds elements using a generating function, supporting filtering.
991
+ *
992
+ * @private
993
+ * @param matchMap - Mapping function.
994
+ * @returns - Function for wrapping generating functions.
995
+ */
996
+ function _getMatcher(matchMap) {
997
+ return function (fn, ...postFns) {
998
+ return function (selector) {
999
+ var _a;
1000
+ let matched = matchMap(fn, this);
1001
+ if (selector) {
1002
+ matched = filterArray(matched, selector, this.options.xmlMode, (_a = this._root) === null || _a === void 0 ? void 0 : _a[0]);
1003
+ }
1004
+ return this._make(
1005
+ // Post processing is only necessary if there is more than one element.
1006
+ this.length > 1 && matched.length > 1
1007
+ ? postFns.reduce((elems, fn) => fn(elems), matched)
1008
+ : matched);
1009
+ };
1010
+ };
1011
+ }
1012
+ /** Matcher that adds multiple elements for each entry in the input. */
1013
+ const _matcher = _getMatcher((fn, elems) => {
1014
+ const ret = [];
1015
+ for (let i = 0; i < elems.length; i++) {
1016
+ const value = fn(elems[i]);
1017
+ ret.push(value);
1018
+ }
1019
+ return new Array().concat(...ret);
1020
+ });
1021
+ /** Matcher that adds at most one element for each entry in the input. */
1022
+ const _singleMatcher = _getMatcher((fn, elems) => {
1023
+ const ret = [];
1024
+ for (let i = 0; i < elems.length; i++) {
1025
+ const value = fn(elems[i]);
1026
+ if (value !== null) {
1027
+ ret.push(value);
1028
+ }
1029
+ }
1030
+ return ret;
1031
+ });
1032
+ /**
1033
+ * Matcher that supports traversing until a condition is met.
1034
+ *
1035
+ * @returns A function usable for `*Until` methods.
1036
+ */
1037
+ function _matchUntil(nextElem, ...postFns) {
1038
+ // We use a variable here that is used from within the matcher.
1039
+ let matches = null;
1040
+ const innerMatcher = _getMatcher((nextElem, elems) => {
1041
+ const matched = [];
1042
+ domEach(elems, (elem) => {
1043
+ for (let next; (next = nextElem(elem)); elem = next) {
1044
+ // FIXME: `matched` might contain duplicates here and the index is too large.
1045
+ if (matches === null || matches === void 0 ? void 0 : matches(next, matched.length))
1046
+ break;
1047
+ matched.push(next);
1048
+ }
1049
+ });
1050
+ return matched;
1051
+ })(nextElem, ...postFns);
1052
+ return function (selector, filterSelector) {
1053
+ // Override `matches` variable with the new target.
1054
+ matches =
1055
+ typeof selector === 'string'
1056
+ ? (elem) => is$1(elem, selector, this.options)
1057
+ : selector
1058
+ ? getFilterFn(selector)
1059
+ : null;
1060
+ const ret = innerMatcher.call(this, filterSelector);
1061
+ // Set `matches` to `null`, so we don't waste memory.
1062
+ matches = null;
1063
+ return ret;
1064
+ };
1065
+ }
1066
+ function _removeDuplicates(elems) {
1067
+ return Array.from(new Set(elems));
1068
+ }
1069
+ /**
1070
+ * Get the parent of each element in the current set of matched elements,
1071
+ * optionally filtered by a selector.
1072
+ *
1073
+ * @category Traversing
1074
+ * @example
1075
+ *
1076
+ * ```js
1077
+ * $('.pear').parent().attr('id');
1078
+ * //=> fruits
1079
+ * ```
1080
+ *
1081
+ * @param selector - If specified filter for parent.
1082
+ * @returns The parents.
1083
+ * @see {@link https://api.jquery.com/parent/}
1084
+ */
1085
+ const parent = _singleMatcher(({ parent }) => (parent && !isDocument(parent) ? parent : null), _removeDuplicates);
1086
+ /**
1087
+ * Get a set of parents filtered by `selector` of each element in the current
1088
+ * set of match elements.
1089
+ *
1090
+ * @category Traversing
1091
+ * @example
1092
+ *
1093
+ * ```js
1094
+ * $('.orange').parents().length;
1095
+ * //=> 2
1096
+ * $('.orange').parents('#fruits').length;
1097
+ * //=> 1
1098
+ * ```
1099
+ *
1100
+ * @param selector - If specified filter for parents.
1101
+ * @returns The parents.
1102
+ * @see {@link https://api.jquery.com/parents/}
1103
+ */
1104
+ const parents = _matcher((elem) => {
1105
+ const matched = [];
1106
+ while (elem.parent && !isDocument(elem.parent)) {
1107
+ matched.push(elem.parent);
1108
+ elem = elem.parent;
1109
+ }
1110
+ return matched;
1111
+ }, uniqueSort, (elems) => elems.reverse());
1112
+ /**
1113
+ * Get the ancestors of each element in the current set of matched elements, up
1114
+ * to but not including the element matched by the selector, DOM node, or cheerio object.
1115
+ *
1116
+ * @category Traversing
1117
+ * @example
1118
+ *
1119
+ * ```js
1120
+ * $('.orange').parentsUntil('#food').length;
1121
+ * //=> 1
1122
+ * ```
1123
+ *
1124
+ * @param selector - Selector for element to stop at.
1125
+ * @param filterSelector - Optional filter for parents.
1126
+ * @returns The parents.
1127
+ * @see {@link https://api.jquery.com/parentsUntil/}
1128
+ */
1129
+ const parentsUntil = _matchUntil(({ parent }) => (parent && !isDocument(parent) ? parent : null), uniqueSort, (elems) => elems.reverse());
1130
+ /**
1131
+ * For each element in the set, get the first element that matches the selector
1132
+ * by testing the element itself and traversing up through its ancestors in the DOM tree.
1133
+ *
1134
+ * @category Traversing
1135
+ * @example
1136
+ *
1137
+ * ```js
1138
+ * $('.orange').closest();
1139
+ * //=> []
1140
+ *
1141
+ * $('.orange').closest('.apple');
1142
+ * // => []
1143
+ *
1144
+ * $('.orange').closest('li');
1145
+ * //=> [<li class="orange">Orange</li>]
1146
+ *
1147
+ * $('.orange').closest('#fruits');
1148
+ * //=> [<ul id="fruits"> ... </ul>]
1149
+ * ```
1150
+ *
1151
+ * @param selector - Selector for the element to find.
1152
+ * @returns The closest nodes.
1153
+ * @see {@link https://api.jquery.com/closest/}
1154
+ */
1155
+ function closest(selector) {
1156
+ var _a;
1157
+ const set = [];
1158
+ if (!selector) {
1159
+ return this._make(set);
1160
+ }
1161
+ const selectOpts = {
1162
+ xmlMode: this.options.xmlMode,
1163
+ root: (_a = this._root) === null || _a === void 0 ? void 0 : _a[0],
1164
+ };
1165
+ const selectFn = typeof selector === 'string'
1166
+ ? (elem) => is$1(elem, selector, selectOpts)
1167
+ : getFilterFn(selector);
1168
+ domEach(this, (elem) => {
1169
+ while (elem && isTag(elem)) {
1170
+ if (selectFn(elem, 0)) {
1171
+ // Do not add duplicate elements to the set
1172
+ if (!set.includes(elem)) {
1173
+ set.push(elem);
1174
+ }
1175
+ break;
1176
+ }
1177
+ elem = elem.parent;
1178
+ }
1179
+ });
1180
+ return this._make(set);
1181
+ }
1182
+ /**
1183
+ * Gets the next sibling of the first selected element, optionally filtered by a selector.
1184
+ *
1185
+ * @category Traversing
1186
+ * @example
1187
+ *
1188
+ * ```js
1189
+ * $('.apple').next().hasClass('orange');
1190
+ * //=> true
1191
+ * ```
1192
+ *
1193
+ * @param selector - If specified filter for sibling.
1194
+ * @returns The next nodes.
1195
+ * @see {@link https://api.jquery.com/next/}
1196
+ */
1197
+ const next = _singleMatcher((elem) => nextElementSibling(elem));
1198
+ /**
1199
+ * Gets all the following siblings of the first selected element, optionally
1200
+ * filtered by a selector.
1201
+ *
1202
+ * @category Traversing
1203
+ * @example
1204
+ *
1205
+ * ```js
1206
+ * $('.apple').nextAll();
1207
+ * //=> [<li class="orange">Orange</li>, <li class="pear">Pear</li>]
1208
+ * $('.apple').nextAll('.orange');
1209
+ * //=> [<li class="orange">Orange</li>]
1210
+ * ```
1211
+ *
1212
+ * @param selector - If specified filter for siblings.
1213
+ * @returns The next nodes.
1214
+ * @see {@link https://api.jquery.com/nextAll/}
1215
+ */
1216
+ const nextAll = _matcher((elem) => {
1217
+ const matched = [];
1218
+ while (elem.next) {
1219
+ elem = elem.next;
1220
+ if (isTag(elem))
1221
+ matched.push(elem);
1222
+ }
1223
+ return matched;
1224
+ }, _removeDuplicates);
1225
+ /**
1226
+ * Gets all the following siblings up to but not including the element matched
1227
+ * by the selector, optionally filtered by another selector.
1228
+ *
1229
+ * @category Traversing
1230
+ * @example
1231
+ *
1232
+ * ```js
1233
+ * $('.apple').nextUntil('.pear');
1234
+ * //=> [<li class="orange">Orange</li>]
1235
+ * ```
1236
+ *
1237
+ * @param selector - Selector for element to stop at.
1238
+ * @param filterSelector - If specified filter for siblings.
1239
+ * @returns The next nodes.
1240
+ * @see {@link https://api.jquery.com/nextUntil/}
1241
+ */
1242
+ const nextUntil = _matchUntil((el) => nextElementSibling(el), _removeDuplicates);
1243
+ /**
1244
+ * Gets the previous sibling of the first selected element optionally filtered
1245
+ * by a selector.
1246
+ *
1247
+ * @category Traversing
1248
+ * @example
1249
+ *
1250
+ * ```js
1251
+ * $('.orange').prev().hasClass('apple');
1252
+ * //=> true
1253
+ * ```
1254
+ *
1255
+ * @param selector - If specified filter for siblings.
1256
+ * @returns The previous nodes.
1257
+ * @see {@link https://api.jquery.com/prev/}
1258
+ */
1259
+ const prev = _singleMatcher((elem) => prevElementSibling(elem));
1260
+ /**
1261
+ * Gets all the preceding siblings of the first selected element, optionally
1262
+ * filtered by a selector.
1263
+ *
1264
+ * @category Traversing
1265
+ * @example
1266
+ *
1267
+ * ```js
1268
+ * $('.pear').prevAll();
1269
+ * //=> [<li class="orange">Orange</li>, <li class="apple">Apple</li>]
1270
+ *
1271
+ * $('.pear').prevAll('.orange');
1272
+ * //=> [<li class="orange">Orange</li>]
1273
+ * ```
1274
+ *
1275
+ * @param selector - If specified filter for siblings.
1276
+ * @returns The previous nodes.
1277
+ * @see {@link https://api.jquery.com/prevAll/}
1278
+ */
1279
+ const prevAll = _matcher((elem) => {
1280
+ const matched = [];
1281
+ while (elem.prev) {
1282
+ elem = elem.prev;
1283
+ if (isTag(elem))
1284
+ matched.push(elem);
1285
+ }
1286
+ return matched;
1287
+ }, _removeDuplicates);
1288
+ /**
1289
+ * Gets all the preceding siblings up to but not including the element matched
1290
+ * by the selector, optionally filtered by another selector.
1291
+ *
1292
+ * @category Traversing
1293
+ * @example
1294
+ *
1295
+ * ```js
1296
+ * $('.pear').prevUntil('.apple');
1297
+ * //=> [<li class="orange">Orange</li>]
1298
+ * ```
1299
+ *
1300
+ * @param selector - Selector for element to stop at.
1301
+ * @param filterSelector - If specified filter for siblings.
1302
+ * @returns The previous nodes.
1303
+ * @see {@link https://api.jquery.com/prevUntil/}
1304
+ */
1305
+ const prevUntil = _matchUntil((el) => prevElementSibling(el), _removeDuplicates);
1306
+ /**
1307
+ * Get the siblings of each element (excluding the element) in the set of
1308
+ * matched elements, optionally filtered by a selector.
1309
+ *
1310
+ * @category Traversing
1311
+ * @example
1312
+ *
1313
+ * ```js
1314
+ * $('.pear').siblings().length;
1315
+ * //=> 2
1316
+ *
1317
+ * $('.pear').siblings('.orange').length;
1318
+ * //=> 1
1319
+ * ```
1320
+ *
1321
+ * @param selector - If specified filter for siblings.
1322
+ * @returns The siblings.
1323
+ * @see {@link https://api.jquery.com/siblings/}
1324
+ */
1325
+ const siblings = _matcher((elem) => getSiblings(elem).filter((el) => isTag(el) && el !== elem), uniqueSort);
1326
+ /**
1327
+ * Gets the element children of each element in the set of matched elements.
1328
+ *
1329
+ * @category Traversing
1330
+ * @example
1331
+ *
1332
+ * ```js
1333
+ * $('#fruits').children().length;
1334
+ * //=> 3
1335
+ *
1336
+ * $('#fruits').children('.pear').text();
1337
+ * //=> Pear
1338
+ * ```
1339
+ *
1340
+ * @param selector - If specified filter for children.
1341
+ * @returns The children.
1342
+ * @see {@link https://api.jquery.com/children/}
1343
+ */
1344
+ const children = _matcher((elem) => getChildren(elem).filter(isTag), _removeDuplicates);
1345
+ /**
1346
+ * Gets the children of each element in the set of matched elements, including
1347
+ * text and comment nodes.
1348
+ *
1349
+ * @category Traversing
1350
+ * @example
1351
+ *
1352
+ * ```js
1353
+ * $('#fruits').contents().length;
1354
+ * //=> 3
1355
+ * ```
1356
+ *
1357
+ * @returns The children.
1358
+ * @see {@link https://api.jquery.com/contents/}
1359
+ */
1360
+ function contents() {
1361
+ const elems = this.toArray().reduce((newElems, elem) => hasChildren(elem) ? newElems.concat(elem.children) : newElems, []);
1362
+ return this._make(elems);
1363
+ }
1364
+ /**
1365
+ * Iterates over a cheerio object, executing a function for each matched
1366
+ * element. When the callback is fired, the function is fired in the context of
1367
+ * the DOM element, so `this` refers to the current element, which is equivalent
1368
+ * to the function parameter `element`. To break out of the `each` loop early,
1369
+ * return with `false`.
1370
+ *
1371
+ * @category Traversing
1372
+ * @example
1373
+ *
1374
+ * ```js
1375
+ * const fruits = [];
1376
+ *
1377
+ * $('li').each(function (i, elem) {
1378
+ * fruits[i] = $(this).text();
1379
+ * });
1380
+ *
1381
+ * fruits.join(', ');
1382
+ * //=> Apple, Orange, Pear
1383
+ * ```
1384
+ *
1385
+ * @param fn - Function to execute.
1386
+ * @returns The instance itself, useful for chaining.
1387
+ * @see {@link https://api.jquery.com/each/}
1388
+ */
1389
+ function each(fn) {
1390
+ let i = 0;
1391
+ const len = this.length;
1392
+ while (i < len && fn.call(this[i], i, this[i]) !== false)
1393
+ ++i;
1394
+ return this;
1395
+ }
1396
+ /**
1397
+ * Pass each element in the current matched set through a function, producing a
1398
+ * new Cheerio object containing the return values. The function can return an
1399
+ * individual data item or an array of data items to be inserted into the
1400
+ * resulting set. If an array is returned, the elements inside the array are
1401
+ * inserted into the set. If the function returns null or undefined, no element
1402
+ * will be inserted.
1403
+ *
1404
+ * @category Traversing
1405
+ * @example
1406
+ *
1407
+ * ```js
1408
+ * $('li')
1409
+ * .map(function (i, el) {
1410
+ * // this === el
1411
+ * return $(this).text();
1412
+ * })
1413
+ * .toArray()
1414
+ * .join(' ');
1415
+ * //=> "apple orange pear"
1416
+ * ```
1417
+ *
1418
+ * @param fn - Function to execute.
1419
+ * @returns The mapped elements, wrapped in a Cheerio collection.
1420
+ * @see {@link https://api.jquery.com/map/}
1421
+ */
1422
+ function map(fn) {
1423
+ let elems = [];
1424
+ for (let i = 0; i < this.length; i++) {
1425
+ const el = this[i];
1426
+ const val = fn.call(el, i, el);
1427
+ if (val != null) {
1428
+ elems = elems.concat(val);
1429
+ }
1430
+ }
1431
+ return this._make(elems);
1432
+ }
1433
+ /**
1434
+ * Creates a function to test if a filter is matched.
1435
+ *
1436
+ * @param match - A filter.
1437
+ * @returns A function that determines if a filter has been matched.
1438
+ */
1439
+ function getFilterFn(match) {
1440
+ if (typeof match === 'function') {
1441
+ return (el, i) => match.call(el, i, el);
1442
+ }
1443
+ if (isCheerio(match)) {
1444
+ return (el) => Array.prototype.includes.call(match, el);
1445
+ }
1446
+ return function (el) {
1447
+ return match === el;
1448
+ };
1449
+ }
1450
+ function filter(match) {
1451
+ var _a;
1452
+ return this._make(filterArray(this.toArray(), match, this.options.xmlMode, (_a = this._root) === null || _a === void 0 ? void 0 : _a[0]));
1453
+ }
1454
+ function filterArray(nodes, match, xmlMode, root) {
1455
+ return typeof match === 'string'
1456
+ ? filter$1(match, nodes, { xmlMode, root })
1457
+ : nodes.filter(getFilterFn(match));
1458
+ }
1459
+ /**
1460
+ * Checks the current list of elements and returns `true` if _any_ of the
1461
+ * elements match the selector. If using an element or Cheerio selection,
1462
+ * returns `true` if _any_ of the elements match. If using a predicate function,
1463
+ * the function is executed in the context of the selected element, so `this`
1464
+ * refers to the current element.
1465
+ *
1466
+ * @category Attributes
1467
+ * @param selector - Selector for the selection.
1468
+ * @returns Whether or not the selector matches an element of the instance.
1469
+ * @see {@link https://api.jquery.com/is/}
1470
+ */
1471
+ function is(selector) {
1472
+ const nodes = this.toArray();
1473
+ return typeof selector === 'string'
1474
+ ? some(nodes.filter(isTag), selector, this.options)
1475
+ : selector
1476
+ ? nodes.some(getFilterFn(selector))
1477
+ : false;
1478
+ }
1479
+ /**
1480
+ * Remove elements from the set of matched elements. Given a Cheerio object that
1481
+ * represents a set of DOM elements, the `.not()` method constructs a new
1482
+ * Cheerio object from a subset of the matching elements. The supplied selector
1483
+ * is tested against each element; the elements that don't match the selector
1484
+ * will be included in the result.
1485
+ *
1486
+ * The `.not()` method can take a function as its argument in the same way that
1487
+ * `.filter()` does. Elements for which the function returns `true` are excluded
1488
+ * from the filtered set; all other elements are included.
1489
+ *
1490
+ * @category Traversing
1491
+ * @example <caption>Selector</caption>
1492
+ *
1493
+ * ```js
1494
+ * $('li').not('.apple').length;
1495
+ * //=> 2
1496
+ * ```
1497
+ *
1498
+ * @example <caption>Function</caption>
1499
+ *
1500
+ * ```js
1501
+ * $('li').not(function (i, el) {
1502
+ * // this === el
1503
+ * return $(this).attr('class') === 'orange';
1504
+ * }).length; //=> 2
1505
+ * ```
1506
+ *
1507
+ * @param match - Value to look for, following the rules above.
1508
+ * @param container - Optional node to filter instead.
1509
+ * @returns The filtered collection.
1510
+ * @see {@link https://api.jquery.com/not/}
1511
+ */
1512
+ function not(match) {
1513
+ let nodes = this.toArray();
1514
+ if (typeof match === 'string') {
1515
+ const matches = new Set(filter$1(match, nodes, this.options));
1516
+ nodes = nodes.filter((el) => !matches.has(el));
1517
+ }
1518
+ else {
1519
+ const filterFn = getFilterFn(match);
1520
+ nodes = nodes.filter((el, i) => !filterFn(el, i));
1521
+ }
1522
+ return this._make(nodes);
1523
+ }
1524
+ /**
1525
+ * Filters the set of matched elements to only those which have the given DOM
1526
+ * element as a descendant or which have a descendant that matches the given
1527
+ * selector. Equivalent to `.filter(':has(selector)')`.
1528
+ *
1529
+ * @category Traversing
1530
+ * @example <caption>Selector</caption>
1531
+ *
1532
+ * ```js
1533
+ * $('ul').has('.pear').attr('id');
1534
+ * //=> fruits
1535
+ * ```
1536
+ *
1537
+ * @example <caption>Element</caption>
1538
+ *
1539
+ * ```js
1540
+ * $('ul').has($('.pear')[0]).attr('id');
1541
+ * //=> fruits
1542
+ * ```
1543
+ *
1544
+ * @param selectorOrHaystack - Element to look for.
1545
+ * @returns The filtered collection.
1546
+ * @see {@link https://api.jquery.com/has/}
1547
+ */
1548
+ function has(selectorOrHaystack) {
1549
+ return this.filter(typeof selectorOrHaystack === 'string'
1550
+ ? // Using the `:has` selector here short-circuits searches.
1551
+ `:has(${selectorOrHaystack})`
1552
+ : (_, el) => this._make(el).find(selectorOrHaystack).length > 0);
1553
+ }
1554
+ /**
1555
+ * Will select the first element of a cheerio object.
1556
+ *
1557
+ * @category Traversing
1558
+ * @example
1559
+ *
1560
+ * ```js
1561
+ * $('#fruits').children().first().text();
1562
+ * //=> Apple
1563
+ * ```
1564
+ *
1565
+ * @returns The first element.
1566
+ * @see {@link https://api.jquery.com/first/}
1567
+ */
1568
+ function first() {
1569
+ return this.length > 1 ? this._make(this[0]) : this;
1570
+ }
1571
+ /**
1572
+ * Will select the last element of a cheerio object.
1573
+ *
1574
+ * @category Traversing
1575
+ * @example
1576
+ *
1577
+ * ```js
1578
+ * $('#fruits').children().last().text();
1579
+ * //=> Pear
1580
+ * ```
1581
+ *
1582
+ * @returns The last element.
1583
+ * @see {@link https://api.jquery.com/last/}
1584
+ */
1585
+ function last() {
1586
+ return this.length > 0 ? this._make(this[this.length - 1]) : this;
1587
+ }
1588
+ /**
1589
+ * Reduce the set of matched elements to the one at the specified index. Use
1590
+ * `.eq(-i)` to count backwards from the last selected element.
1591
+ *
1592
+ * @category Traversing
1593
+ * @example
1594
+ *
1595
+ * ```js
1596
+ * $('li').eq(0).text();
1597
+ * //=> Apple
1598
+ *
1599
+ * $('li').eq(-1).text();
1600
+ * //=> Pear
1601
+ * ```
1602
+ *
1603
+ * @param i - Index of the element to select.
1604
+ * @returns The element at the `i`th position.
1605
+ * @see {@link https://api.jquery.com/eq/}
1606
+ */
1607
+ function eq(i) {
1608
+ var _a;
1609
+ i = +i;
1610
+ // Use the first identity optimization if possible
1611
+ if (i === 0 && this.length <= 1)
1612
+ return this;
1613
+ if (i < 0)
1614
+ i = this.length + i;
1615
+ return this._make((_a = this[i]) !== null && _a !== void 0 ? _a : []);
1616
+ }
1617
+ function get(i) {
1618
+ if (i == null) {
1619
+ return this.toArray();
1620
+ }
1621
+ return this[i < 0 ? this.length + i : i];
1622
+ }
1623
+ /**
1624
+ * Retrieve all the DOM elements contained in the jQuery set as an array.
1625
+ *
1626
+ * @example
1627
+ *
1628
+ * ```js
1629
+ * $('li').toArray();
1630
+ * //=> [ {...}, {...}, {...} ]
1631
+ * ```
1632
+ *
1633
+ * @returns The contained items.
1634
+ */
1635
+ function toArray() {
1636
+ return Array.prototype.slice.call(this);
1637
+ }
1638
+ /**
1639
+ * Search for a given element from among the matched elements.
1640
+ *
1641
+ * @category Traversing
1642
+ * @example
1643
+ *
1644
+ * ```js
1645
+ * $('.pear').index();
1646
+ * //=> 2 $('.orange').index('li');
1647
+ * //=> 1
1648
+ * $('.apple').index($('#fruit, li'));
1649
+ * //=> 1
1650
+ * ```
1651
+ *
1652
+ * @param selectorOrNeedle - Element to look for.
1653
+ * @returns The index of the element.
1654
+ * @see {@link https://api.jquery.com/index/}
1655
+ */
1656
+ function index(selectorOrNeedle) {
1657
+ let $haystack;
1658
+ let needle;
1659
+ if (selectorOrNeedle == null) {
1660
+ $haystack = this.parent().children();
1661
+ needle = this[0];
1662
+ }
1663
+ else if (typeof selectorOrNeedle === 'string') {
1664
+ $haystack = this._make(selectorOrNeedle);
1665
+ needle = this[0];
1666
+ }
1667
+ else {
1668
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1669
+ $haystack = this;
1670
+ needle = isCheerio(selectorOrNeedle)
1671
+ ? selectorOrNeedle[0]
1672
+ : selectorOrNeedle;
1673
+ }
1674
+ return Array.prototype.indexOf.call($haystack, needle);
1675
+ }
1676
+ /**
1677
+ * Gets the elements matching the specified range (0-based position).
1678
+ *
1679
+ * @category Traversing
1680
+ * @example
1681
+ *
1682
+ * ```js
1683
+ * $('li').slice(1).eq(0).text();
1684
+ * //=> 'Orange'
1685
+ *
1686
+ * $('li').slice(1, 2).length;
1687
+ * //=> 1
1688
+ * ```
1689
+ *
1690
+ * @param start - A position at which the elements begin to be selected. If
1691
+ * negative, it indicates an offset from the end of the set.
1692
+ * @param end - A position at which the elements stop being selected. If
1693
+ * negative, it indicates an offset from the end of the set. If omitted, the
1694
+ * range continues until the end of the set.
1695
+ * @returns The elements matching the specified range.
1696
+ * @see {@link https://api.jquery.com/slice/}
1697
+ */
1698
+ function slice(start, end) {
1699
+ return this._make(Array.prototype.slice.call(this, start, end));
1700
+ }
1701
+ /**
1702
+ * End the most recent filtering operation in the current chain and return the
1703
+ * set of matched elements to its previous state.
1704
+ *
1705
+ * @category Traversing
1706
+ * @example
1707
+ *
1708
+ * ```js
1709
+ * $('li').eq(0).end().length;
1710
+ * //=> 3
1711
+ * ```
1712
+ *
1713
+ * @returns The previous state of the set of matched elements.
1714
+ * @see {@link https://api.jquery.com/end/}
1715
+ */
1716
+ function end() {
1717
+ var _a;
1718
+ return (_a = this.prevObject) !== null && _a !== void 0 ? _a : this._make([]);
1719
+ }
1720
+ /**
1721
+ * Add elements to the set of matched elements.
1722
+ *
1723
+ * @category Traversing
1724
+ * @example
1725
+ *
1726
+ * ```js
1727
+ * $('.apple').add('.orange').length;
1728
+ * //=> 2
1729
+ * ```
1730
+ *
1731
+ * @param other - Elements to add.
1732
+ * @param context - Optionally the context of the new selection.
1733
+ * @returns The combined set.
1734
+ * @see {@link https://api.jquery.com/add/}
1735
+ */
1736
+ function add(other, context) {
1737
+ const selection = this._make(other, context);
1738
+ const contents = uniqueSort([...this.get(), ...selection.get()]);
1739
+ return this._make(contents);
1740
+ }
1741
+ /**
1742
+ * Add the previous set of elements on the stack to the current set, optionally
1743
+ * filtered by a selector.
1744
+ *
1745
+ * @category Traversing
1746
+ * @example
1747
+ *
1748
+ * ```js
1749
+ * $('li').eq(0).addBack('.orange').length;
1750
+ * //=> 2
1751
+ * ```
1752
+ *
1753
+ * @param selector - Selector for the elements to add.
1754
+ * @returns The combined set.
1755
+ * @see {@link https://api.jquery.com/addBack/}
1756
+ */
1757
+ function addBack(selector) {
1758
+ return this.prevObject
1759
+ ? this.add(selector ? this.prevObject.filter(selector) : this.prevObject)
1760
+ : this;
1761
+ }
1762
+
1763
+ const Traversing = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1764
+ __proto__: null,
1765
+ add,
1766
+ addBack,
1767
+ children,
1768
+ closest,
1769
+ contents,
1770
+ each,
1771
+ end,
1772
+ eq,
1773
+ filter,
1774
+ filterArray,
1775
+ find,
1776
+ first,
1777
+ get,
1778
+ has,
1779
+ index,
1780
+ is,
1781
+ last,
1782
+ map,
1783
+ next,
1784
+ nextAll,
1785
+ nextUntil,
1786
+ not,
1787
+ parent,
1788
+ parents,
1789
+ parentsUntil,
1790
+ prev,
1791
+ prevAll,
1792
+ prevUntil,
1793
+ siblings,
1794
+ slice,
1795
+ toArray
1796
+ }, Symbol.toStringTag, { value: 'Module' }));
1797
+
1798
+ /**
1799
+ * Get the parse function with options.
1800
+ *
1801
+ * @param parser - The parser function.
1802
+ * @returns The parse function with options.
1803
+ */
1804
+ function getParse(parser) {
1805
+ /**
1806
+ * Parse a HTML string or a node.
1807
+ *
1808
+ * @param content - The HTML string or node.
1809
+ * @param options - The parser options.
1810
+ * @param isDocument - If `content` is a document.
1811
+ * @param context - The context node in the DOM tree.
1812
+ * @returns The parsed document node.
1813
+ */
1814
+ return function parse(content, options, isDocument$1, context) {
1815
+ if (typeof Buffer !== 'undefined' && Buffer.isBuffer(content)) {
1816
+ content = content.toString();
1817
+ }
1818
+ if (typeof content === 'string') {
1819
+ return parser(content, options, isDocument$1, context);
1820
+ }
1821
+ const doc = content;
1822
+ if (!Array.isArray(doc) && isDocument(doc)) {
1823
+ // If `doc` is already a root, just return it
1824
+ return doc;
1825
+ }
1826
+ // Add conent to new root element
1827
+ const root = new Document([]);
1828
+ // Update the DOM using the root
1829
+ update(doc, root);
1830
+ return root;
1831
+ };
1832
+ }
1833
+ /**
1834
+ * Update the dom structure, for one changed layer.
1835
+ *
1836
+ * @param newChilds - The new children.
1837
+ * @param parent - The new parent.
1838
+ * @returns The parent node.
1839
+ */
1840
+ function update(newChilds, parent) {
1841
+ // Normalize
1842
+ const arr = Array.isArray(newChilds) ? newChilds : [newChilds];
1843
+ // Update parent
1844
+ if (parent) {
1845
+ parent.children = arr;
1846
+ }
1847
+ else {
1848
+ parent = null;
1849
+ }
1850
+ // Update neighbors
1851
+ for (let i = 0; i < arr.length; i++) {
1852
+ const node = arr[i];
1853
+ // Cleanly remove existing nodes from their previous structures.
1854
+ if (node.parent && node.parent.children !== arr) {
1855
+ removeElement(node);
1856
+ }
1857
+ if (parent) {
1858
+ node.prev = arr[i - 1] || null;
1859
+ node.next = arr[i + 1] || null;
1860
+ }
1861
+ else {
1862
+ node.prev = node.next = null;
1863
+ }
1864
+ node.parent = parent;
1865
+ }
1866
+ return parent;
1867
+ }
1868
+
1869
+ /**
1870
+ * Methods for modifying the DOM structure.
1871
+ *
1872
+ * @module cheerio/manipulation
1873
+ */
1874
+ /**
1875
+ * Create an array of nodes, recursing into arrays and parsing strings if necessary.
1876
+ *
1877
+ * @private
1878
+ * @category Manipulation
1879
+ * @param elem - Elements to make an array of.
1880
+ * @param clone - Optionally clone nodes.
1881
+ * @returns The array of nodes.
1882
+ */
1883
+ function _makeDomArray(elem, clone) {
1884
+ if (elem == null) {
1885
+ return [];
1886
+ }
1887
+ if (isCheerio(elem)) {
1888
+ return clone ? cloneDom(elem.get()) : elem.get();
1889
+ }
1890
+ if (Array.isArray(elem)) {
1891
+ return elem.reduce((newElems, el) => newElems.concat(this._makeDomArray(el, clone)), []);
1892
+ }
1893
+ if (typeof elem === 'string') {
1894
+ return this._parse(elem, this.options, false, null).children;
1895
+ }
1896
+ return clone ? cloneDom([elem]) : [elem];
1897
+ }
1898
+ function _insert(concatenator) {
1899
+ return function (...elems) {
1900
+ const lastIdx = this.length - 1;
1901
+ return domEach(this, (el, i) => {
1902
+ if (!hasChildren(el))
1903
+ return;
1904
+ const domSrc = typeof elems[0] === 'function'
1905
+ ? elems[0].call(el, i, this._render(el.children))
1906
+ : elems;
1907
+ const dom = this._makeDomArray(domSrc, i < lastIdx);
1908
+ concatenator(dom, el.children, el);
1909
+ });
1910
+ };
1911
+ }
1912
+ /**
1913
+ * Modify an array in-place, removing some number of elements and adding new
1914
+ * elements directly following them.
1915
+ *
1916
+ * @private
1917
+ * @category Manipulation
1918
+ * @param array - Target array to splice.
1919
+ * @param spliceIdx - Index at which to begin changing the array.
1920
+ * @param spliceCount - Number of elements to remove from the array.
1921
+ * @param newElems - Elements to insert into the array.
1922
+ * @param parent - The parent of the node.
1923
+ * @returns The spliced array.
1924
+ */
1925
+ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) {
1926
+ var _a, _b;
1927
+ const spliceArgs = [
1928
+ spliceIdx,
1929
+ spliceCount,
1930
+ ...newElems,
1931
+ ];
1932
+ const prev = spliceIdx === 0 ? null : array[spliceIdx - 1];
1933
+ const next = spliceIdx + spliceCount >= array.length
1934
+ ? null
1935
+ : array[spliceIdx + spliceCount];
1936
+ /*
1937
+ * Before splicing in new elements, ensure they do not already appear in the
1938
+ * current array.
1939
+ */
1940
+ for (let idx = 0; idx < newElems.length; ++idx) {
1941
+ const node = newElems[idx];
1942
+ const oldParent = node.parent;
1943
+ if (oldParent) {
1944
+ const oldSiblings = oldParent.children;
1945
+ const prevIdx = oldSiblings.indexOf(node);
1946
+ if (prevIdx > -1) {
1947
+ oldParent.children.splice(prevIdx, 1);
1948
+ if (parent === oldParent && spliceIdx > prevIdx) {
1949
+ spliceArgs[0]--;
1950
+ }
1951
+ }
1952
+ }
1953
+ node.parent = parent;
1954
+ if (node.prev) {
1955
+ node.prev.next = (_a = node.next) !== null && _a !== void 0 ? _a : null;
1956
+ }
1957
+ if (node.next) {
1958
+ node.next.prev = (_b = node.prev) !== null && _b !== void 0 ? _b : null;
1959
+ }
1960
+ node.prev = idx === 0 ? prev : newElems[idx - 1];
1961
+ node.next = idx === newElems.length - 1 ? next : newElems[idx + 1];
1962
+ }
1963
+ if (prev) {
1964
+ prev.next = newElems[0];
1965
+ }
1966
+ if (next) {
1967
+ next.prev = newElems[newElems.length - 1];
1968
+ }
1969
+ return array.splice(...spliceArgs);
1970
+ }
1971
+ /**
1972
+ * Insert every element in the set of matched elements to the end of the target.
1973
+ *
1974
+ * @category Manipulation
1975
+ * @example
1976
+ *
1977
+ * ```js
1978
+ * $('<li class="plum">Plum</li>').appendTo('#fruits');
1979
+ * $.html();
1980
+ * //=> <ul id="fruits">
1981
+ * // <li class="apple">Apple</li>
1982
+ * // <li class="orange">Orange</li>
1983
+ * // <li class="pear">Pear</li>
1984
+ * // <li class="plum">Plum</li>
1985
+ * // </ul>
1986
+ * ```
1987
+ *
1988
+ * @param target - Element to append elements to.
1989
+ * @returns The instance itself.
1990
+ * @see {@link https://api.jquery.com/appendTo/}
1991
+ */
1992
+ function appendTo(target) {
1993
+ const appendTarget = isCheerio(target) ? target : this._make(target);
1994
+ appendTarget.append(this);
1995
+ return this;
1996
+ }
1997
+ /**
1998
+ * Insert every element in the set of matched elements to the beginning of the target.
1999
+ *
2000
+ * @category Manipulation
2001
+ * @example
2002
+ *
2003
+ * ```js
2004
+ * $('<li class="plum">Plum</li>').prependTo('#fruits');
2005
+ * $.html();
2006
+ * //=> <ul id="fruits">
2007
+ * // <li class="plum">Plum</li>
2008
+ * // <li class="apple">Apple</li>
2009
+ * // <li class="orange">Orange</li>
2010
+ * // <li class="pear">Pear</li>
2011
+ * // </ul>
2012
+ * ```
2013
+ *
2014
+ * @param target - Element to prepend elements to.
2015
+ * @returns The instance itself.
2016
+ * @see {@link https://api.jquery.com/prependTo/}
2017
+ */
2018
+ function prependTo(target) {
2019
+ const prependTarget = isCheerio(target) ? target : this._make(target);
2020
+ prependTarget.prepend(this);
2021
+ return this;
2022
+ }
2023
+ /**
2024
+ * Inserts content as the _last_ child of each of the selected elements.
2025
+ *
2026
+ * @category Manipulation
2027
+ * @example
2028
+ *
2029
+ * ```js
2030
+ * $('ul').append('<li class="plum">Plum</li>');
2031
+ * $.html();
2032
+ * //=> <ul id="fruits">
2033
+ * // <li class="apple">Apple</li>
2034
+ * // <li class="orange">Orange</li>
2035
+ * // <li class="pear">Pear</li>
2036
+ * // <li class="plum">Plum</li>
2037
+ * // </ul>
2038
+ * ```
2039
+ *
2040
+ * @see {@link https://api.jquery.com/append/}
2041
+ */
2042
+ const append = _insert((dom, children, parent) => {
2043
+ uniqueSplice(children, children.length, 0, dom, parent);
2044
+ });
2045
+ /**
2046
+ * Inserts content as the _first_ child of each of the selected elements.
2047
+ *
2048
+ * @category Manipulation
2049
+ * @example
2050
+ *
2051
+ * ```js
2052
+ * $('ul').prepend('<li class="plum">Plum</li>');
2053
+ * $.html();
2054
+ * //=> <ul id="fruits">
2055
+ * // <li class="plum">Plum</li>
2056
+ * // <li class="apple">Apple</li>
2057
+ * // <li class="orange">Orange</li>
2058
+ * // <li class="pear">Pear</li>
2059
+ * // </ul>
2060
+ * ```
2061
+ *
2062
+ * @see {@link https://api.jquery.com/prepend/}
2063
+ */
2064
+ const prepend = _insert((dom, children, parent) => {
2065
+ uniqueSplice(children, 0, 0, dom, parent);
2066
+ });
2067
+ function _wrap(insert) {
2068
+ return function (wrapper) {
2069
+ const lastIdx = this.length - 1;
2070
+ const lastParent = this.parents().last();
2071
+ for (let i = 0; i < this.length; i++) {
2072
+ const el = this[i];
2073
+ const wrap = typeof wrapper === 'function'
2074
+ ? wrapper.call(el, i, el)
2075
+ : typeof wrapper === 'string' && !isHtml(wrapper)
2076
+ ? lastParent.find(wrapper).clone()
2077
+ : wrapper;
2078
+ const [wrapperDom] = this._makeDomArray(wrap, i < lastIdx);
2079
+ if (!wrapperDom || !hasChildren(wrapperDom))
2080
+ continue;
2081
+ let elInsertLocation = wrapperDom;
2082
+ /*
2083
+ * Find the deepest child. Only consider the first tag child of each node
2084
+ * (ignore text); stop if no children are found.
2085
+ */
2086
+ let j = 0;
2087
+ while (j < elInsertLocation.children.length) {
2088
+ const child = elInsertLocation.children[j];
2089
+ if (isTag(child)) {
2090
+ elInsertLocation = child;
2091
+ j = 0;
2092
+ }
2093
+ else {
2094
+ j++;
2095
+ }
2096
+ }
2097
+ insert(el, elInsertLocation, [wrapperDom]);
2098
+ }
2099
+ return this;
2100
+ };
2101
+ }
2102
+ /**
2103
+ * The .wrap() function can take any string or object that could be passed to
2104
+ * the $() factory function to specify a DOM structure. This structure may be
2105
+ * nested several levels deep, but should contain only one inmost element. A
2106
+ * copy of this structure will be wrapped around each of the elements in the set
2107
+ * of matched elements. This method returns the original set of elements for
2108
+ * chaining purposes.
2109
+ *
2110
+ * @category Manipulation
2111
+ * @example
2112
+ *
2113
+ * ```js
2114
+ * const redFruit = $('<div class="red-fruit"></div>');
2115
+ * $('.apple').wrap(redFruit);
2116
+ *
2117
+ * //=> <ul id="fruits">
2118
+ * // <div class="red-fruit">
2119
+ * // <li class="apple">Apple</li>
2120
+ * // </div>
2121
+ * // <li class="orange">Orange</li>
2122
+ * // <li class="plum">Plum</li>
2123
+ * // </ul>
2124
+ *
2125
+ * const healthy = $('<div class="healthy"></div>');
2126
+ * $('li').wrap(healthy);
2127
+ *
2128
+ * //=> <ul id="fruits">
2129
+ * // <div class="healthy">
2130
+ * // <li class="apple">Apple</li>
2131
+ * // </div>
2132
+ * // <div class="healthy">
2133
+ * // <li class="orange">Orange</li>
2134
+ * // </div>
2135
+ * // <div class="healthy">
2136
+ * // <li class="plum">Plum</li>
2137
+ * // </div>
2138
+ * // </ul>
2139
+ * ```
2140
+ *
2141
+ * @param wrapper - The DOM structure to wrap around each element in the selection.
2142
+ * @see {@link https://api.jquery.com/wrap/}
2143
+ */
2144
+ const wrap = _wrap((el, elInsertLocation, wrapperDom) => {
2145
+ const { parent } = el;
2146
+ if (!parent)
2147
+ return;
2148
+ const siblings = parent.children;
2149
+ const index = siblings.indexOf(el);
2150
+ update([el], elInsertLocation);
2151
+ /*
2152
+ * The previous operation removed the current element from the `siblings`
2153
+ * array, so the `dom` array can be inserted without removing any
2154
+ * additional elements.
2155
+ */
2156
+ uniqueSplice(siblings, index, 0, wrapperDom, parent);
2157
+ });
2158
+ /**
2159
+ * The .wrapInner() function can take any string or object that could be passed
2160
+ * to the $() factory function to specify a DOM structure. This structure may be
2161
+ * nested several levels deep, but should contain only one inmost element. The
2162
+ * structure will be wrapped around the content of each of the elements in the
2163
+ * set of matched elements.
2164
+ *
2165
+ * @category Manipulation
2166
+ * @example
2167
+ *
2168
+ * ```js
2169
+ * const redFruit = $('<div class="red-fruit"></div>');
2170
+ * $('.apple').wrapInner(redFruit);
2171
+ *
2172
+ * //=> <ul id="fruits">
2173
+ * // <li class="apple">
2174
+ * // <div class="red-fruit">Apple</div>
2175
+ * // </li>
2176
+ * // <li class="orange">Orange</li>
2177
+ * // <li class="pear">Pear</li>
2178
+ * // </ul>
2179
+ *
2180
+ * const healthy = $('<div class="healthy"></div>');
2181
+ * $('li').wrapInner(healthy);
2182
+ *
2183
+ * //=> <ul id="fruits">
2184
+ * // <li class="apple">
2185
+ * // <div class="healthy">Apple</div>
2186
+ * // </li>
2187
+ * // <li class="orange">
2188
+ * // <div class="healthy">Orange</div>
2189
+ * // </li>
2190
+ * // <li class="pear">
2191
+ * // <div class="healthy">Pear</div>
2192
+ * // </li>
2193
+ * // </ul>
2194
+ * ```
2195
+ *
2196
+ * @param wrapper - The DOM structure to wrap around the content of each element
2197
+ * in the selection.
2198
+ * @returns The instance itself, for chaining.
2199
+ * @see {@link https://api.jquery.com/wrapInner/}
2200
+ */
2201
+ const wrapInner = _wrap((el, elInsertLocation, wrapperDom) => {
2202
+ if (!hasChildren(el))
2203
+ return;
2204
+ update(el.children, elInsertLocation);
2205
+ update(wrapperDom, el);
2206
+ });
2207
+ /**
2208
+ * The .unwrap() function, removes the parents of the set of matched elements
2209
+ * from the DOM, leaving the matched elements in their place.
2210
+ *
2211
+ * @category Manipulation
2212
+ * @example <caption>without selector</caption>
2213
+ *
2214
+ * ```js
2215
+ * const $ = cheerio.load(
2216
+ * '<div id=test>\n <div><p>Hello</p></div>\n <div><p>World</p></div>\n</div>'
2217
+ * );
2218
+ * $('#test p').unwrap();
2219
+ *
2220
+ * //=> <div id=test>
2221
+ * // <p>Hello</p>
2222
+ * // <p>World</p>
2223
+ * // </div>
2224
+ * ```
2225
+ *
2226
+ * @example <caption>with selector</caption>
2227
+ *
2228
+ * ```js
2229
+ * const $ = cheerio.load(
2230
+ * '<div id=test>\n <p>Hello</p>\n <b><p>World</p></b>\n</div>'
2231
+ * );
2232
+ * $('#test p').unwrap('b');
2233
+ *
2234
+ * //=> <div id=test>
2235
+ * // <p>Hello</p>
2236
+ * // <p>World</p>
2237
+ * // </div>
2238
+ * ```
2239
+ *
2240
+ * @param selector - A selector to check the parent element against. If an
2241
+ * element's parent does not match the selector, the element won't be unwrapped.
2242
+ * @returns The instance itself, for chaining.
2243
+ * @see {@link https://api.jquery.com/unwrap/}
2244
+ */
2245
+ function unwrap(selector) {
2246
+ this.parent(selector)
2247
+ .not('body')
2248
+ .each((_, el) => {
2249
+ this._make(el).replaceWith(el.children);
2250
+ });
2251
+ return this;
2252
+ }
2253
+ /**
2254
+ * The .wrapAll() function can take any string or object that could be passed to
2255
+ * the $() function to specify a DOM structure. This structure may be nested
2256
+ * several levels deep, but should contain only one inmost element. The
2257
+ * structure will be wrapped around all of the elements in the set of matched
2258
+ * elements, as a single group.
2259
+ *
2260
+ * @category Manipulation
2261
+ * @example <caption>With markup passed to `wrapAll`</caption>
2262
+ *
2263
+ * ```js
2264
+ * const $ = cheerio.load(
2265
+ * '<div class="container"><div class="inner">First</div><div class="inner">Second</div></div>'
2266
+ * );
2267
+ * $('.inner').wrapAll("<div class='new'></div>");
2268
+ *
2269
+ * //=> <div class="container">
2270
+ * // <div class='new'>
2271
+ * // <div class="inner">First</div>
2272
+ * // <div class="inner">Second</div>
2273
+ * // </div>
2274
+ * // </div>
2275
+ * ```
2276
+ *
2277
+ * @example <caption>With an existing cheerio instance</caption>
2278
+ *
2279
+ * ```js
2280
+ * const $ = cheerio.load(
2281
+ * '<span>Span 1</span><strong>Strong</strong><span>Span 2</span>'
2282
+ * );
2283
+ * const wrap = $('<div><p><em><b></b></em></p></div>');
2284
+ * $('span').wrapAll(wrap);
2285
+ *
2286
+ * //=> <div>
2287
+ * // <p>
2288
+ * // <em>
2289
+ * // <b>
2290
+ * // <span>Span 1</span>
2291
+ * // <span>Span 2</span>
2292
+ * // </b>
2293
+ * // </em>
2294
+ * // </p>
2295
+ * // </div>
2296
+ * // <strong>Strong</strong>
2297
+ * ```
2298
+ *
2299
+ * @param wrapper - The DOM structure to wrap around all matched elements in the
2300
+ * selection.
2301
+ * @returns The instance itself.
2302
+ * @see {@link https://api.jquery.com/wrapAll/}
2303
+ */
2304
+ function wrapAll(wrapper) {
2305
+ const el = this[0];
2306
+ if (el) {
2307
+ const wrap = this._make(typeof wrapper === 'function' ? wrapper.call(el, 0, el) : wrapper).insertBefore(el);
2308
+ // If html is given as wrapper, wrap may contain text elements
2309
+ let elInsertLocation;
2310
+ for (let i = 0; i < wrap.length; i++) {
2311
+ if (wrap[i].type === 'tag')
2312
+ elInsertLocation = wrap[i];
2313
+ }
2314
+ let j = 0;
2315
+ /*
2316
+ * Find the deepest child. Only consider the first tag child of each node
2317
+ * (ignore text); stop if no children are found.
2318
+ */
2319
+ while (elInsertLocation && j < elInsertLocation.children.length) {
2320
+ const child = elInsertLocation.children[j];
2321
+ if (child.type === 'tag') {
2322
+ elInsertLocation = child;
2323
+ j = 0;
2324
+ }
2325
+ else {
2326
+ j++;
2327
+ }
2328
+ }
2329
+ if (elInsertLocation)
2330
+ this._make(elInsertLocation).append(this);
2331
+ }
2332
+ return this;
2333
+ }
2334
+ /* eslint-disable jsdoc/check-param-names*/
2335
+ /**
2336
+ * Insert content next to each element in the set of matched elements.
2337
+ *
2338
+ * @category Manipulation
2339
+ * @example
2340
+ *
2341
+ * ```js
2342
+ * $('.apple').after('<li class="plum">Plum</li>');
2343
+ * $.html();
2344
+ * //=> <ul id="fruits">
2345
+ * // <li class="apple">Apple</li>
2346
+ * // <li class="plum">Plum</li>
2347
+ * // <li class="orange">Orange</li>
2348
+ * // <li class="pear">Pear</li>
2349
+ * // </ul>
2350
+ * ```
2351
+ *
2352
+ * @param content - HTML string, DOM element, array of DOM elements or Cheerio
2353
+ * to insert after each element in the set of matched elements.
2354
+ * @returns The instance itself.
2355
+ * @see {@link https://api.jquery.com/after/}
2356
+ */
2357
+ function after(...elems) {
2358
+ const lastIdx = this.length - 1;
2359
+ return domEach(this, (el, i) => {
2360
+ const { parent } = el;
2361
+ if (!hasChildren(el) || !parent) {
2362
+ return;
2363
+ }
2364
+ const siblings = parent.children;
2365
+ const index = siblings.indexOf(el);
2366
+ // If not found, move on
2367
+ /* istanbul ignore next */
2368
+ if (index < 0)
2369
+ return;
2370
+ const domSrc = typeof elems[0] === 'function'
2371
+ ? elems[0].call(el, i, this._render(el.children))
2372
+ : elems;
2373
+ const dom = this._makeDomArray(domSrc, i < lastIdx);
2374
+ // Add element after `this` element
2375
+ uniqueSplice(siblings, index + 1, 0, dom, parent);
2376
+ });
2377
+ }
2378
+ /* eslint-enable jsdoc/check-param-names*/
2379
+ /**
2380
+ * Insert every element in the set of matched elements after the target.
2381
+ *
2382
+ * @category Manipulation
2383
+ * @example
2384
+ *
2385
+ * ```js
2386
+ * $('<li class="plum">Plum</li>').insertAfter('.apple');
2387
+ * $.html();
2388
+ * //=> <ul id="fruits">
2389
+ * // <li class="apple">Apple</li>
2390
+ * // <li class="plum">Plum</li>
2391
+ * // <li class="orange">Orange</li>
2392
+ * // <li class="pear">Pear</li>
2393
+ * // </ul>
2394
+ * ```
2395
+ *
2396
+ * @param target - Element to insert elements after.
2397
+ * @returns The set of newly inserted elements.
2398
+ * @see {@link https://api.jquery.com/insertAfter/}
2399
+ */
2400
+ function insertAfter(target) {
2401
+ if (typeof target === 'string') {
2402
+ target = this._make(target);
2403
+ }
2404
+ this.remove();
2405
+ const clones = [];
2406
+ this._makeDomArray(target).forEach((el) => {
2407
+ const clonedSelf = this.clone().toArray();
2408
+ const { parent } = el;
2409
+ if (!parent) {
2410
+ return;
2411
+ }
2412
+ const siblings = parent.children;
2413
+ const index = siblings.indexOf(el);
2414
+ // If not found, move on
2415
+ /* istanbul ignore next */
2416
+ if (index < 0)
2417
+ return;
2418
+ // Add cloned `this` element(s) after target element
2419
+ uniqueSplice(siblings, index + 1, 0, clonedSelf, parent);
2420
+ clones.push(...clonedSelf);
2421
+ });
2422
+ return this._make(clones);
2423
+ }
2424
+ /* eslint-disable jsdoc/check-param-names*/
2425
+ /**
2426
+ * Insert content previous to each element in the set of matched elements.
2427
+ *
2428
+ * @category Manipulation
2429
+ * @example
2430
+ *
2431
+ * ```js
2432
+ * $('.apple').before('<li class="plum">Plum</li>');
2433
+ * $.html();
2434
+ * //=> <ul id="fruits">
2435
+ * // <li class="plum">Plum</li>
2436
+ * // <li class="apple">Apple</li>
2437
+ * // <li class="orange">Orange</li>
2438
+ * // <li class="pear">Pear</li>
2439
+ * // </ul>
2440
+ * ```
2441
+ *
2442
+ * @param content - HTML string, DOM element, array of DOM elements or Cheerio
2443
+ * to insert before each element in the set of matched elements.
2444
+ * @returns The instance itself.
2445
+ * @see {@link https://api.jquery.com/before/}
2446
+ */
2447
+ function before(...elems) {
2448
+ const lastIdx = this.length - 1;
2449
+ return domEach(this, (el, i) => {
2450
+ const { parent } = el;
2451
+ if (!hasChildren(el) || !parent) {
2452
+ return;
2453
+ }
2454
+ const siblings = parent.children;
2455
+ const index = siblings.indexOf(el);
2456
+ // If not found, move on
2457
+ /* istanbul ignore next */
2458
+ if (index < 0)
2459
+ return;
2460
+ const domSrc = typeof elems[0] === 'function'
2461
+ ? elems[0].call(el, i, this._render(el.children))
2462
+ : elems;
2463
+ const dom = this._makeDomArray(domSrc, i < lastIdx);
2464
+ // Add element before `el` element
2465
+ uniqueSplice(siblings, index, 0, dom, parent);
2466
+ });
2467
+ }
2468
+ /* eslint-enable jsdoc/check-param-names*/
2469
+ /**
2470
+ * Insert every element in the set of matched elements before the target.
2471
+ *
2472
+ * @category Manipulation
2473
+ * @example
2474
+ *
2475
+ * ```js
2476
+ * $('<li class="plum">Plum</li>').insertBefore('.apple');
2477
+ * $.html();
2478
+ * //=> <ul id="fruits">
2479
+ * // <li class="plum">Plum</li>
2480
+ * // <li class="apple">Apple</li>
2481
+ * // <li class="orange">Orange</li>
2482
+ * // <li class="pear">Pear</li>
2483
+ * // </ul>
2484
+ * ```
2485
+ *
2486
+ * @param target - Element to insert elements before.
2487
+ * @returns The set of newly inserted elements.
2488
+ * @see {@link https://api.jquery.com/insertBefore/}
2489
+ */
2490
+ function insertBefore(target) {
2491
+ const targetArr = this._make(target);
2492
+ this.remove();
2493
+ const clones = [];
2494
+ domEach(targetArr, (el) => {
2495
+ const clonedSelf = this.clone().toArray();
2496
+ const { parent } = el;
2497
+ if (!parent) {
2498
+ return;
2499
+ }
2500
+ const siblings = parent.children;
2501
+ const index = siblings.indexOf(el);
2502
+ // If not found, move on
2503
+ /* istanbul ignore next */
2504
+ if (index < 0)
2505
+ return;
2506
+ // Add cloned `this` element(s) after target element
2507
+ uniqueSplice(siblings, index, 0, clonedSelf, parent);
2508
+ clones.push(...clonedSelf);
2509
+ });
2510
+ return this._make(clones);
2511
+ }
2512
+ /**
2513
+ * Removes the set of matched elements from the DOM and all their children.
2514
+ * `selector` filters the set of matched elements to be removed.
2515
+ *
2516
+ * @category Manipulation
2517
+ * @example
2518
+ *
2519
+ * ```js
2520
+ * $('.pear').remove();
2521
+ * $.html();
2522
+ * //=> <ul id="fruits">
2523
+ * // <li class="apple">Apple</li>
2524
+ * // <li class="orange">Orange</li>
2525
+ * // </ul>
2526
+ * ```
2527
+ *
2528
+ * @param selector - Optional selector for elements to remove.
2529
+ * @returns The instance itself.
2530
+ * @see {@link https://api.jquery.com/remove/}
2531
+ */
2532
+ function remove(selector) {
2533
+ // Filter if we have selector
2534
+ const elems = selector ? this.filter(selector) : this;
2535
+ domEach(elems, (el) => {
2536
+ removeElement(el);
2537
+ el.prev = el.next = el.parent = null;
2538
+ });
2539
+ return this;
2540
+ }
2541
+ /**
2542
+ * Replaces matched elements with `content`.
2543
+ *
2544
+ * @category Manipulation
2545
+ * @example
2546
+ *
2547
+ * ```js
2548
+ * const plum = $('<li class="plum">Plum</li>');
2549
+ * $('.pear').replaceWith(plum);
2550
+ * $.html();
2551
+ * //=> <ul id="fruits">
2552
+ * // <li class="apple">Apple</li>
2553
+ * // <li class="orange">Orange</li>
2554
+ * // <li class="plum">Plum</li>
2555
+ * // </ul>
2556
+ * ```
2557
+ *
2558
+ * @param content - Replacement for matched elements.
2559
+ * @returns The instance itself.
2560
+ * @see {@link https://api.jquery.com/replaceWith/}
2561
+ */
2562
+ function replaceWith(content) {
2563
+ return domEach(this, (el, i) => {
2564
+ const { parent } = el;
2565
+ if (!parent) {
2566
+ return;
2567
+ }
2568
+ const siblings = parent.children;
2569
+ const cont = typeof content === 'function' ? content.call(el, i, el) : content;
2570
+ const dom = this._makeDomArray(cont);
2571
+ /*
2572
+ * In the case that `dom` contains nodes that already exist in other
2573
+ * structures, ensure those nodes are properly removed.
2574
+ */
2575
+ update(dom, null);
2576
+ const index = siblings.indexOf(el);
2577
+ // Completely remove old element
2578
+ uniqueSplice(siblings, index, 1, dom, parent);
2579
+ if (!dom.includes(el)) {
2580
+ el.parent = el.prev = el.next = null;
2581
+ }
2582
+ });
2583
+ }
2584
+ /**
2585
+ * Empties an element, removing all its children.
2586
+ *
2587
+ * @category Manipulation
2588
+ * @example
2589
+ *
2590
+ * ```js
2591
+ * $('ul').empty();
2592
+ * $.html();
2593
+ * //=> <ul id="fruits"></ul>
2594
+ * ```
2595
+ *
2596
+ * @returns The instance itself.
2597
+ * @see {@link https://api.jquery.com/empty/}
2598
+ */
2599
+ function empty() {
2600
+ return domEach(this, (el) => {
2601
+ if (!hasChildren(el))
2602
+ return;
2603
+ el.children.forEach((child) => {
2604
+ child.next = child.prev = child.parent = null;
2605
+ });
2606
+ el.children.length = 0;
2607
+ });
2608
+ }
2609
+ function html(str) {
2610
+ if (str === undefined) {
2611
+ const el = this[0];
2612
+ if (!el || !hasChildren(el))
2613
+ return null;
2614
+ return this._render(el.children);
2615
+ }
2616
+ return domEach(this, (el) => {
2617
+ if (!hasChildren(el))
2618
+ return;
2619
+ el.children.forEach((child) => {
2620
+ child.next = child.prev = child.parent = null;
2621
+ });
2622
+ const content = isCheerio(str)
2623
+ ? str.toArray()
2624
+ : this._parse(`${str}`, this.options, false, el).children;
2625
+ update(content, el);
2626
+ });
2627
+ }
2628
+ /**
2629
+ * Turns the collection to a string. Alias for `.html()`.
2630
+ *
2631
+ * @category Manipulation
2632
+ * @returns The rendered document.
2633
+ */
2634
+ function toString() {
2635
+ return this._render(this);
2636
+ }
2637
+ function text(str) {
2638
+ // If `str` is undefined, act as a "getter"
2639
+ if (str === undefined) {
2640
+ return text$1(this);
2641
+ }
2642
+ if (typeof str === 'function') {
2643
+ // Function support
2644
+ return domEach(this, (el, i) => this._make(el).text(str.call(el, i, text$1([el]))));
2645
+ }
2646
+ // Append text node to each selected elements
2647
+ return domEach(this, (el) => {
2648
+ if (!hasChildren(el))
2649
+ return;
2650
+ el.children.forEach((child) => {
2651
+ child.next = child.prev = child.parent = null;
2652
+ });
2653
+ const textNode = new Text(`${str}`);
2654
+ update(textNode, el);
2655
+ });
2656
+ }
2657
+ /**
2658
+ * Clone the cheerio object.
2659
+ *
2660
+ * @category Manipulation
2661
+ * @example
2662
+ *
2663
+ * ```js
2664
+ * const moreFruit = $('#fruits').clone();
2665
+ * ```
2666
+ *
2667
+ * @returns The cloned object.
2668
+ * @see {@link https://api.jquery.com/clone/}
2669
+ */
2670
+ function clone() {
2671
+ return this._make(cloneDom(this.get()));
2672
+ }
2673
+
2674
+ const Manipulation = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2675
+ __proto__: null,
2676
+ _makeDomArray,
2677
+ after,
2678
+ append,
2679
+ appendTo,
2680
+ before,
2681
+ clone,
2682
+ empty,
2683
+ html,
2684
+ insertAfter,
2685
+ insertBefore,
2686
+ prepend,
2687
+ prependTo,
2688
+ remove,
2689
+ replaceWith,
2690
+ text,
2691
+ toString,
2692
+ unwrap,
2693
+ wrap,
2694
+ wrapAll,
2695
+ wrapInner
2696
+ }, Symbol.toStringTag, { value: 'Module' }));
2697
+
2698
+ /**
2699
+ * Set multiple CSS properties for every matched element.
2700
+ *
2701
+ * @category CSS
2702
+ * @param prop - The names of the properties.
2703
+ * @param val - The new values.
2704
+ * @returns The instance itself.
2705
+ * @see {@link https://api.jquery.com/css/}
2706
+ */
2707
+ function css(prop, val) {
2708
+ if ((prop != null && val != null) ||
2709
+ // When `prop` is a "plain" object
2710
+ (typeof prop === 'object' && !Array.isArray(prop))) {
2711
+ return domEach(this, (el, i) => {
2712
+ if (isTag(el)) {
2713
+ // `prop` can't be an array here anymore.
2714
+ setCss(el, prop, val, i);
2715
+ }
2716
+ });
2717
+ }
2718
+ if (this.length === 0) {
2719
+ return undefined;
2720
+ }
2721
+ return getCss(this[0], prop);
2722
+ }
2723
+ /**
2724
+ * Set styles of all elements.
2725
+ *
2726
+ * @private
2727
+ * @param el - Element to set style of.
2728
+ * @param prop - Name of property.
2729
+ * @param value - Value to set property to.
2730
+ * @param idx - Optional index within the selection.
2731
+ */
2732
+ function setCss(el, prop, value, idx) {
2733
+ if (typeof prop === 'string') {
2734
+ const styles = getCss(el);
2735
+ const val = typeof value === 'function' ? value.call(el, idx, styles[prop]) : value;
2736
+ if (val === '') {
2737
+ delete styles[prop];
2738
+ }
2739
+ else if (val != null) {
2740
+ styles[prop] = val;
2741
+ }
2742
+ el.attribs['style'] = stringify(styles);
2743
+ }
2744
+ else if (typeof prop === 'object') {
2745
+ Object.keys(prop).forEach((k, i) => {
2746
+ setCss(el, k, prop[k], i);
2747
+ });
2748
+ }
2749
+ }
2750
+ function getCss(el, prop) {
2751
+ if (!el || !isTag(el))
2752
+ return;
2753
+ const styles = parse$1(el.attribs['style']);
2754
+ if (typeof prop === 'string') {
2755
+ return styles[prop];
2756
+ }
2757
+ if (Array.isArray(prop)) {
2758
+ const newStyles = {};
2759
+ prop.forEach((item) => {
2760
+ if (styles[item] != null) {
2761
+ newStyles[item] = styles[item];
2762
+ }
2763
+ });
2764
+ return newStyles;
2765
+ }
2766
+ return styles;
2767
+ }
2768
+ /**
2769
+ * Stringify `obj` to styles.
2770
+ *
2771
+ * @private
2772
+ * @category CSS
2773
+ * @param obj - Object to stringify.
2774
+ * @returns The serialized styles.
2775
+ */
2776
+ function stringify(obj) {
2777
+ return Object.keys(obj).reduce((str, prop) => `${str}${str ? ' ' : ''}${prop}: ${obj[prop]};`, '');
2778
+ }
2779
+ /**
2780
+ * Parse `styles`.
2781
+ *
2782
+ * @private
2783
+ * @category CSS
2784
+ * @param styles - Styles to be parsed.
2785
+ * @returns The parsed styles.
2786
+ */
2787
+ function parse$1(styles) {
2788
+ styles = (styles || '').trim();
2789
+ if (!styles)
2790
+ return {};
2791
+ const obj = {};
2792
+ let key;
2793
+ for (const str of styles.split(';')) {
2794
+ const n = str.indexOf(':');
2795
+ // If there is no :, or if it is the first/last character, add to the previous item's value
2796
+ if (n < 1 || n === str.length - 1) {
2797
+ const trimmed = str.trimEnd();
2798
+ if (trimmed.length > 0 && key !== undefined) {
2799
+ obj[key] += `;${trimmed}`;
2800
+ }
2801
+ }
2802
+ else {
2803
+ key = str.slice(0, n).trim();
2804
+ obj[key] = str.slice(n + 1).trim();
2805
+ }
2806
+ }
2807
+ return obj;
2808
+ }
2809
+
2810
+ const Css = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2811
+ __proto__: null,
2812
+ css
2813
+ }, Symbol.toStringTag, { value: 'Module' }));
2814
+
2815
+ /*
2816
+ * https://github.com/jquery/jquery/blob/2.1.3/src/manipulation/var/rcheckableType.js
2817
+ * https://github.com/jquery/jquery/blob/2.1.3/src/serialize.js
2818
+ */
2819
+ const submittableSelector = 'input,select,textarea,keygen';
2820
+ const r20 = /%20/g;
2821
+ const rCRLF = /\r?\n/g;
2822
+ /**
2823
+ * Encode a set of form elements as a string for submission.
2824
+ *
2825
+ * @category Forms
2826
+ * @example
2827
+ *
2828
+ * ```js
2829
+ * $('<form><input name="foo" value="bar" /></form>').serialize();
2830
+ * //=> 'foo=bar'
2831
+ * ```
2832
+ *
2833
+ * @returns The serialized form.
2834
+ * @see {@link https://api.jquery.com/serialize/}
2835
+ */
2836
+ function serialize() {
2837
+ // Convert form elements into name/value objects
2838
+ const arr = this.serializeArray();
2839
+ // Serialize each element into a key/value string
2840
+ const retArr = arr.map((data) => `${encodeURIComponent(data.name)}=${encodeURIComponent(data.value)}`);
2841
+ // Return the resulting serialization
2842
+ return retArr.join('&').replace(r20, '+');
2843
+ }
2844
+ /**
2845
+ * Encode a set of form elements as an array of names and values.
2846
+ *
2847
+ * @category Forms
2848
+ * @example
2849
+ *
2850
+ * ```js
2851
+ * $('<form><input name="foo" value="bar" /></form>').serializeArray();
2852
+ * //=> [ { name: 'foo', value: 'bar' } ]
2853
+ * ```
2854
+ *
2855
+ * @returns The serialized form.
2856
+ * @see {@link https://api.jquery.com/serializeArray/}
2857
+ */
2858
+ function serializeArray() {
2859
+ // Resolve all form elements from either forms or collections of form elements
2860
+ return this.map((_, elem) => {
2861
+ const $elem = this._make(elem);
2862
+ if (isTag(elem) && elem.name === 'form') {
2863
+ return $elem.find(submittableSelector).toArray();
2864
+ }
2865
+ return $elem.filter(submittableSelector).toArray();
2866
+ })
2867
+ .filter(
2868
+ // Verify elements have a name (`attr.name`) and are not disabled (`:enabled`)
2869
+ '[name!=""]:enabled' +
2870
+ // And cannot be clicked (`[type=submit]`) or are used in `x-www-form-urlencoded` (`[type=file]`)
2871
+ ':not(:submit, :button, :image, :reset, :file)' +
2872
+ // And are either checked/don't have a checkable state
2873
+ ':matches([checked], :not(:checkbox, :radio))'
2874
+ // Convert each of the elements to its value(s)
2875
+ )
2876
+ .map((_, elem) => {
2877
+ var _a;
2878
+ const $elem = this._make(elem);
2879
+ const name = $elem.attr('name'); // We have filtered for elements with a name before.
2880
+ // If there is no value set (e.g. `undefined`, `null`), then default value to empty
2881
+ const value = (_a = $elem.val()) !== null && _a !== void 0 ? _a : '';
2882
+ // If we have an array of values (e.g. `<select multiple>`), return an array of key/value pairs
2883
+ if (Array.isArray(value)) {
2884
+ return value.map((val) =>
2885
+ /*
2886
+ * We trim replace any line endings (e.g. `\r` or `\r\n` with `\r\n`) to guarantee consistency across platforms
2887
+ * These can occur inside of `<textarea>'s`
2888
+ */
2889
+ ({ name, value: val.replace(rCRLF, '\r\n') }));
2890
+ }
2891
+ // Otherwise (e.g. `<input type="text">`, return only one key/value pair
2892
+ return { name, value: value.replace(rCRLF, '\r\n') };
2893
+ })
2894
+ .toArray();
2895
+ }
2896
+
2897
+ const Forms = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2898
+ __proto__: null,
2899
+ serialize,
2900
+ serializeArray
2901
+ }, Symbol.toStringTag, { value: 'Module' }));
2902
+
2903
+ class Cheerio {
2904
+ /**
2905
+ * Instance of cheerio. Methods are specified in the modules. Usage of this
2906
+ * constructor is not recommended. Please use `$.load` instead.
2907
+ *
2908
+ * @private
2909
+ * @param elements - The new selection.
2910
+ * @param root - Sets the root node.
2911
+ * @param options - Options for the instance.
2912
+ */
2913
+ constructor(elements, root, options) {
2914
+ this.length = 0;
2915
+ this.options = options;
2916
+ this._root = root;
2917
+ if (elements) {
2918
+ for (let idx = 0; idx < elements.length; idx++) {
2919
+ this[idx] = elements[idx];
2920
+ }
2921
+ this.length = elements.length;
2922
+ }
2923
+ }
2924
+ }
2925
+ /** Set a signature of the object. */
2926
+ Cheerio.prototype.cheerio = '[cheerio object]';
2927
+ /*
2928
+ * Make cheerio an array-like object
2929
+ */
2930
+ Cheerio.prototype.splice = Array.prototype.splice;
2931
+ // Support for (const element of $(...)) iteration:
2932
+ Cheerio.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
2933
+ // Plug in the API
2934
+ Object.assign(Cheerio.prototype, Attributes, Traversing, Manipulation, Css, Forms);
2935
+
2936
+ function getLoad(parse, render) {
2937
+ /**
2938
+ * Create a querying function, bound to a document created from the provided markup.
2939
+ *
2940
+ * Note that similar to web browser contexts, this operation may introduce
2941
+ * `<html>`, `<head>`, and `<body>` elements; set `isDocument` to `false` to
2942
+ * switch to fragment mode and disable this.
2943
+ *
2944
+ * @param content - Markup to be loaded.
2945
+ * @param options - Options for the created instance.
2946
+ * @param isDocument - Allows parser to be switched to fragment mode.
2947
+ * @returns The loaded document.
2948
+ * @see {@link https://cheerio.js.org#loading} for additional usage information.
2949
+ */
2950
+ return function load(content, options, isDocument = true) {
2951
+ if (content == null) {
2952
+ throw new Error('cheerio.load() expects a string');
2953
+ }
2954
+ const internalOpts = { ...defaultOpts, ...flatten(options) };
2955
+ const initialRoot = parse(content, internalOpts, isDocument, null);
2956
+ /** Create an extended class here, so that extensions only live on one instance. */
2957
+ class LoadedCheerio extends Cheerio {
2958
+ _make(selector, context) {
2959
+ const cheerio = initialize(selector, context);
2960
+ cheerio.prevObject = this;
2961
+ return cheerio;
2962
+ }
2963
+ _parse(content, options, isDocument, context) {
2964
+ return parse(content, options, isDocument, context);
2965
+ }
2966
+ _render(dom) {
2967
+ return render(dom, this.options);
2968
+ }
2969
+ }
2970
+ function initialize(selector, context, root = initialRoot, opts) {
2971
+ // $($)
2972
+ if (selector && isCheerio(selector))
2973
+ return selector;
2974
+ const options = {
2975
+ ...internalOpts,
2976
+ ...flatten(opts),
2977
+ };
2978
+ const r = typeof root === 'string'
2979
+ ? [parse(root, options, false, null)]
2980
+ : 'length' in root
2981
+ ? root
2982
+ : [root];
2983
+ const rootInstance = isCheerio(r)
2984
+ ? r
2985
+ : new LoadedCheerio(r, null, options);
2986
+ // Add a cyclic reference, so that calling methods on `_root` never fails.
2987
+ rootInstance._root = rootInstance;
2988
+ // $(), $(null), $(undefined), $(false)
2989
+ if (!selector) {
2990
+ return new LoadedCheerio(undefined, rootInstance, options);
2991
+ }
2992
+ const elements = typeof selector === 'string' && isHtml(selector)
2993
+ ? // $(<html>)
2994
+ parse(selector, options, false, null).children
2995
+ : isNode(selector)
2996
+ ? // $(dom)
2997
+ [selector]
2998
+ : Array.isArray(selector)
2999
+ ? // $([dom])
3000
+ selector
3001
+ : undefined;
3002
+ const instance = new LoadedCheerio(elements, rootInstance, options);
3003
+ if (elements) {
3004
+ return instance;
3005
+ }
3006
+ if (typeof selector !== 'string') {
3007
+ throw new Error('Unexpected type of selector');
3008
+ }
3009
+ // We know that our selector is a string now.
3010
+ let search = selector;
3011
+ const searchContext = !context
3012
+ ? // If we don't have a context, maybe we have a root, from loading
3013
+ rootInstance
3014
+ : typeof context === 'string'
3015
+ ? isHtml(context)
3016
+ ? // $('li', '<ul>...</ul>')
3017
+ new LoadedCheerio([parse(context, options, false, null)], rootInstance, options)
3018
+ : // $('li', 'ul')
3019
+ ((search = `${context} ${search}`), rootInstance)
3020
+ : isCheerio(context)
3021
+ ? // $('li', $)
3022
+ context
3023
+ : // $('li', node), $('li', [nodes])
3024
+ new LoadedCheerio(Array.isArray(context) ? context : [context], rootInstance, options);
3025
+ // If we still don't have a context, return
3026
+ if (!searchContext)
3027
+ return instance;
3028
+ /*
3029
+ * #id, .class, tag
3030
+ */
3031
+ return searchContext.find(search);
3032
+ }
3033
+ // Add in static methods & properties
3034
+ Object.assign(initialize, staticMethods, {
3035
+ load,
3036
+ // `_root` and `_options` are used in static methods.
3037
+ _root: initialRoot,
3038
+ _options: internalOpts,
3039
+ // Add `fn` for plugins
3040
+ fn: LoadedCheerio.prototype,
3041
+ // Add the prototype here to maintain `instanceof` behavior.
3042
+ prototype: LoadedCheerio.prototype,
3043
+ });
3044
+ return initialize;
3045
+ };
3046
+ }
3047
+ function isNode(obj) {
3048
+ return (!!obj.name ||
3049
+ obj.type === 'root' ||
3050
+ obj.type === 'text' ||
3051
+ obj.type === 'comment');
3052
+ }
3053
+
3054
+ /**
3055
+ * Parse the content with `parse5` in the context of the given `ParentNode`.
3056
+ *
3057
+ * @param content - The content to parse.
3058
+ * @param options - A set of options to use to parse.
3059
+ * @param isDocument - Whether to parse the content as a full HTML document.
3060
+ * @param context - The context in which to parse the content.
3061
+ * @returns The parsed content.
3062
+ */
3063
+ function parseWithParse5(content, options, isDocument, context) {
3064
+ const opts = {
3065
+ scriptingEnabled: typeof options.scriptingEnabled === 'boolean'
3066
+ ? options.scriptingEnabled
3067
+ : true,
3068
+ treeAdapter: adapter,
3069
+ sourceCodeLocationInfo: options.sourceCodeLocationInfo,
3070
+ };
3071
+ return isDocument
3072
+ ? parse$2(content, opts)
3073
+ : parseFragment(context, content, opts);
3074
+ }
3075
+ const renderOpts = { treeAdapter: adapter };
3076
+ /**
3077
+ * Renders the given DOM tree with `parse5` and returns the result as a string.
3078
+ *
3079
+ * @param dom - The DOM tree to render.
3080
+ * @returns The rendered document.
3081
+ */
3082
+ function renderWithParse5(dom) {
3083
+ /*
3084
+ * `dom-serializer` passes over the special "root" node and renders the
3085
+ * node's children in its place. To mimic this behavior with `parse5`, an
3086
+ * equivalent operation must be applied to the input array.
3087
+ */
3088
+ const nodes = 'length' in dom ? dom : [dom];
3089
+ for (let index = 0; index < nodes.length; index += 1) {
3090
+ const node = nodes[index];
3091
+ if (isDocument(node)) {
3092
+ Array.prototype.splice.call(nodes, index, 1, ...node.children);
3093
+ }
3094
+ }
3095
+ let result = '';
3096
+ for (let index = 0; index < nodes.length; index += 1) {
3097
+ const node = nodes[index];
3098
+ result += serializeOuter(node, renderOpts);
3099
+ }
3100
+ return result;
3101
+ }
3102
+
3103
+ /**
3104
+ * Types used in signatures of Cheerio methods.
3105
+ *
3106
+ * @category Cheerio
3107
+ */
3108
+ const parse = getParse((content, options, isDocument, context) => options.xmlMode || options._useHtmlParser2
3109
+ ? parseDocument(content, options)
3110
+ : parseWithParse5(content, options, isDocument, context));
3111
+ // Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616
3112
+ /**
3113
+ * Create a querying function, bound to a document created from the provided markup.
3114
+ *
3115
+ * Note that similar to web browser contexts, this operation may introduce
3116
+ * `<html>`, `<head>`, and `<body>` elements; set `isDocument` to `false` to
3117
+ * switch to fragment mode and disable this.
3118
+ *
3119
+ * @param content - Markup to be loaded.
3120
+ * @param options - Options for the created instance.
3121
+ * @param isDocument - Allows parser to be switched to fragment mode.
3122
+ * @returns The loaded document.
3123
+ * @see {@link https://cheerio.js.org#loading} for additional usage information.
3124
+ */
3125
+ const load = getLoad(parse, (dom, options) => options.xmlMode || options._useHtmlParser2
3126
+ ? render$1(dom, options)
3127
+ : renderWithParse5(dom));
3128
+ /**
3129
+ * The default cheerio instance.
3130
+ *
3131
+ * @deprecated Use the function returned by `load` instead.
3132
+ */
3133
+ const cheerio = load([]);
3134
+
3135
+ export { cheerio as c };