@baloise/ds-core 18.2.0 → 18.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bal-accordion-trigger.js +67 -29
- package/components/bal-app.js +2 -2
- package/components/bal-badge2.js +1 -1
- package/components/bal-button-group2.js +2 -2
- package/components/bal-card-actions.js +1 -1
- package/components/bal-card-button.js +1 -1
- package/components/bal-card-content2.js +1 -1
- package/components/bal-card-subtitle.js +1 -1
- package/components/bal-card-title.js +1 -1
- package/components/bal-card2.js +2 -2
- package/components/bal-carousel.js +1 -1
- package/components/bal-checkbox-button.js +1 -1
- package/components/bal-checkbox2.js +1 -1
- package/components/bal-close2.js +1 -1
- package/components/bal-content2.js +1 -1
- package/components/bal-data-item.js +1 -1
- package/components/bal-data-label.js +1 -1
- package/components/bal-data-value.js +1 -1
- package/components/bal-data.js +1 -1
- package/components/bal-date-calendar-cell2.js +1 -1
- package/components/bal-date-calendar2.js +1 -1
- package/components/bal-date.js +1 -1
- package/components/bal-divider.js +1 -1
- package/components/bal-dropdown.js +2 -2
- package/components/bal-field-control.js +2 -2
- package/components/bal-field-hint.js +1 -1
- package/components/bal-field-label.js +1 -1
- package/components/bal-field-message.js +2 -2
- package/components/bal-field.js +2 -2
- package/components/bal-file-upload.js +4 -4
- package/components/bal-footer.js +3 -3
- package/components/bal-form-col.js +2 -2
- package/components/bal-form-grid.js +1 -1
- package/components/bal-form.js +1 -1
- package/components/bal-heading2.js +1 -1
- package/components/bal-hint-text2.js +1 -1
- package/components/bal-hint-title2.js +1 -1
- package/components/bal-icon2.js +1692 -311
- package/components/bal-input-date2.js +2 -2
- package/components/bal-input-group2.js +1 -1
- package/components/bal-input-slider.js +3 -3
- package/components/bal-input-stepper.js +3 -3
- package/components/bal-input.js +1 -1
- package/components/bal-label2.js +1 -1
- package/components/bal-list-item-content2.js +2 -2
- package/components/bal-list-item-icon2.js +2 -2
- package/components/bal-list-item-subtitle2.js +1 -1
- package/components/bal-list-item-title2.js +1 -1
- package/components/bal-list2.js +1 -1
- package/components/bal-modal-body.js +1 -1
- package/components/bal-modal-header.js +1 -1
- package/components/bal-modal.js +5 -5
- package/components/bal-nav-link-grid-col2.js +1 -1
- package/components/bal-nav-link-grid2.js +1 -1
- package/components/bal-nav-link-group.js +1 -1
- package/components/bal-nav-link2.js +2 -2
- package/components/bal-nav-menu-bar2.js +1 -1
- package/components/bal-nav-menu-flyout2.js +1 -1
- package/components/bal-nav-meta-bar2.js +1 -1
- package/components/bal-nav.js +2 -2
- package/components/bal-navbar-brand.js +1 -1
- package/components/bal-navbar-menu-end.js +1 -1
- package/components/bal-navbar-menu-start.js +1 -1
- package/components/bal-navbar-menu.js +1 -1
- package/components/bal-navbar.js +1 -1
- package/components/bal-notices.js +1 -1
- package/components/bal-notification.js +1 -1
- package/components/bal-number-input.js +1 -1
- package/components/bal-option-list.js +1 -1
- package/components/bal-option.js +1 -1
- package/components/bal-pagination.js +4 -4
- package/components/bal-popover-content2.js +1 -1
- package/components/bal-popup.js +1 -1
- package/components/bal-progress-bar.js +1 -1
- package/components/bal-radio-button.js +1 -1
- package/components/bal-radio2.js +1 -1
- package/components/bal-segment-item.js +1 -1
- package/components/bal-segment.js +1 -1
- package/components/bal-select-option2.js +1 -1
- package/components/bal-select2.js +5 -5
- package/components/bal-shape2.js +4 -4
- package/components/bal-sheet.js +1 -1
- package/components/bal-snackbar.js +1 -1
- package/components/bal-spinner2.js +1 -1
- package/components/bal-stack2.js +1 -1
- package/components/bal-stage-back-link.js +2 -2
- package/components/bal-stage-body.js +1 -1
- package/components/bal-stage-foot.js +1 -1
- package/components/bal-stage-head.js +1 -1
- package/components/bal-stage-image.js +1 -1
- package/components/bal-stage.js +1 -1
- package/components/bal-step-item.js +2 -2
- package/components/bal-tab-item.js +2 -2
- package/components/bal-table.js +1 -1
- package/components/bal-tabs2.js +2 -2
- package/components/bal-tag-group.js +1 -1
- package/components/bal-tag2.js +1 -1
- package/components/bal-text2.js +2 -2
- package/components/bal-textarea.js +1 -1
- package/components/bal-time-input.js +1 -1
- package/components/bal-toast.js +1 -1
- package/components/bal-tooltip.js +1 -1
- package/components/index.js +1 -1
- package/components/tokens.esm.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
- package/dist/baloise-design-system/index.esm.js +1 -1
- package/dist/baloise-design-system/{p-c22c22090f.system.entry.js → p-00e75d0c35.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c9cbfd5a61.entry.js → p-038c618cc5.entry.js} +1 -1
- package/dist/baloise-design-system/{p-0b851cd59c.system.entry.js → p-0aeaf649aa.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-187e7da1ed.entry.js → p-0f9d3cbaaf.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b46a35c33c.system.entry.js → p-108886df74.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-cb0d5c384b.system.entry.js → p-11447dc62e.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-fb87f31739.system.entry.js → p-13d1a22814.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-fe6d53dfdf.system.entry.js → p-14901b6156.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c4aabcc6bc.system.entry.js → p-152b86b426.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7c074055e7.system.entry.js → p-1812c4e712.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a7b46eaa9f.system.entry.js → p-190cd62ab2.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-225aca33c2.entry.js → p-1ba2dc4b48.entry.js} +1 -1
- package/dist/baloise-design-system/p-1d482bc569.entry.js +1 -0
- package/dist/baloise-design-system/{p-a0737d5595.entry.js → p-1d78f65898.entry.js} +1 -1
- package/dist/baloise-design-system/{p-e0a3b80c8c.system.entry.js → p-24898ae0b6.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4c695be0.system.js → p-25617878.system.js} +1 -1
- package/dist/baloise-design-system/{p-5c31de6847.system.entry.js → p-259e90ef2b.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-36a4ecfe.system.js → p-2697b3c0.system.js} +1 -1
- package/dist/baloise-design-system/{p-ea8491b628.entry.js → p-277384b233.entry.js} +1 -1
- package/dist/baloise-design-system/{p-221c096477.entry.js → p-28fbcf6fc9.entry.js} +1 -1
- package/dist/baloise-design-system/{p-f2234a5a71.entry.js → p-29908af0fd.entry.js} +1 -1
- package/dist/baloise-design-system/{p-04a8a75fb8.entry.js → p-2e7c157f61.entry.js} +1 -1
- package/dist/baloise-design-system/{p-5c7352eada.entry.js → p-3113f8a2a0.entry.js} +1 -1
- package/dist/baloise-design-system/{p-8d49461b8f.entry.js → p-32322fa69a.entry.js} +1 -1
- package/dist/baloise-design-system/p-345aa92d.system.js +1 -1
- package/dist/baloise-design-system/{p-9276f29a07.entry.js → p-34caa16d21.entry.js} +1 -1
- package/dist/baloise-design-system/{p-421a77b6c1.system.entry.js → p-38a74d2653.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-3913c6ae.js +1 -1
- package/dist/baloise-design-system/{p-b4b88e4c03.system.entry.js → p-3928a3ae1f.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4d857d11b6.system.entry.js → p-3a022b8d82.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-ebecd76c66.system.entry.js → p-3c02768646.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7ddbde5c84.entry.js → p-3f3ebc8590.entry.js} +1 -1
- package/dist/baloise-design-system/p-3f6d4b4d69.entry.js +1 -0
- package/dist/baloise-design-system/{p-448d3298a1.entry.js → p-3f86c5d396.entry.js} +1 -1
- package/dist/baloise-design-system/{p-fb4f6a95a6.entry.js → p-40977d8619.entry.js} +1 -1
- package/dist/baloise-design-system/p-42e06975cf.system.entry.js +2 -0
- package/dist/baloise-design-system/{p-4c9ac6263c.entry.js → p-470ce384f4.entry.js} +1 -1
- package/dist/baloise-design-system/{p-9a00ac7fc8.system.entry.js → p-471441221c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-327cd52735.entry.js → p-47d8602fd8.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7496834468.system.entry.js → p-4915eb7e22.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-4a2f22bde2.entry.js +1 -0
- package/dist/baloise-design-system/{p-774cad80b8.entry.js → p-4d4dd885fc.entry.js} +1 -1
- package/dist/baloise-design-system/p-50084ba924.entry.js +1 -0
- package/dist/baloise-design-system/{p-1288c2ed8a.entry.js → p-50e3e41042.entry.js} +1 -1
- package/dist/baloise-design-system/{p-607d361ba3.system.entry.js → p-513711e292.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b51a692e99.entry.js → p-5218b32665.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4155b8f059.system.entry.js → p-52a97b97f8.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-253668db69.entry.js → p-57b6f2900e.entry.js} +1 -1
- package/dist/baloise-design-system/p-58c4ff0652.entry.js +1 -0
- package/dist/baloise-design-system/{p-908a7c5cfd.system.entry.js → p-5d84d62ded.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-0ad80f603a.entry.js → p-60c0470d4a.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4857a7ee.js → p-60c0b0fb.js} +1 -1
- package/dist/baloise-design-system/{p-4bc159376b.system.entry.js → p-61f268e54c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-0e506e98e2.system.entry.js → p-63297f8b3b.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-afabc522e1.entry.js → p-63a1bc9737.entry.js} +1 -1
- package/dist/baloise-design-system/p-659ecadc.system.js +1 -1
- package/dist/baloise-design-system/{p-8723e490bf.system.entry.js → p-68a9ea13a0.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-9ed80c87cf.entry.js → p-68bcae4459.entry.js} +1 -1
- package/dist/baloise-design-system/{p-191459a962.entry.js → p-69ceb45b58.entry.js} +1 -1
- package/dist/baloise-design-system/{p-bfb6c67686.entry.js → p-6ce02b4115.entry.js} +1 -1
- package/dist/baloise-design-system/{p-864cf36d45.system.entry.js → p-712e5c9739.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a8a62f0a85.system.entry.js → p-72a3289f25.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-7467605b28.entry.js +1 -0
- package/dist/baloise-design-system/{p-eeb954c6bc.system.entry.js → p-74cf083d69.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4e7c82ad7e.system.entry.js → p-7a3ec63587.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-dce0104d78.system.entry.js → p-7f87eea164.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-cca78c7a8e.entry.js → p-82c5915caf.entry.js} +1 -1
- package/dist/baloise-design-system/p-84fb413164.entry.js +1 -0
- package/dist/baloise-design-system/{p-808cc1fd05.entry.js → p-86997be9b6.entry.js} +1 -1
- package/dist/baloise-design-system/{p-5d9f23045a.system.entry.js → p-8839179d19.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-0242cdf474.entry.js → p-89d4432ac2.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3ae755102b.system.entry.js → p-8ffd1803be.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-dcb77164fc.system.entry.js → p-9070cf534c.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-90a7f09c63.entry.js +1 -0
- package/dist/baloise-design-system/{p-e3c51dd5ce.system.entry.js → p-91a7fe0fc1.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7162e44f.system.js → p-934c6104.system.js} +1 -1
- package/dist/baloise-design-system/{p-0724c5fc39.entry.js → p-96876b3902.entry.js} +1 -1
- package/dist/baloise-design-system/{p-894409314e.system.entry.js → p-97ca986ad0.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-e6196821f7.system.entry.js → p-9b78ab02f8.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-676d07ed2e.system.entry.js → p-9ca539a218.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3bcfc7b117.system.entry.js → p-9da6a64729.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1b7a378e4b.system.entry.js → p-9ee4bb3be6.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-9effa7fc0c.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-d4996fd889.system.entry.js → p-a01e0d6335.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-08ba87f822.entry.js → p-a13164e512.entry.js} +1 -1
- package/dist/baloise-design-system/p-a1d4fd7a40.entry.js +2 -0
- package/dist/baloise-design-system/{p-27d9d109b4.entry.js → p-a2dff75011.entry.js} +1 -1
- package/dist/baloise-design-system/{p-40d5ef4e.system.js → p-a2ea159e.system.js} +1 -1
- package/dist/baloise-design-system/{p-15f77798ad.entry.js → p-a3cb7f216f.entry.js} +1 -1
- package/dist/baloise-design-system/{p-5429e0223f.system.entry.js → p-a779279aae.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1b31484d81.entry.js → p-a8b8e39162.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3c447e2884.entry.js → p-a8f4c51f7d.entry.js} +1 -1
- package/dist/baloise-design-system/{p-eaf6fe83b7.entry.js → p-a9cd77d64b.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4b22207353.system.entry.js → p-ac2d4c2c2b.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c9c007a260.entry.js → p-ac4e801e21.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a2f19988.js → p-ade97788.js} +1 -1
- package/dist/baloise-design-system/p-aebe807c86.entry.js +1 -0
- package/dist/baloise-design-system/{p-e6d0ea6084.entry.js → p-b21ea8fd1f.entry.js} +1 -1
- package/dist/baloise-design-system/{p-9b9a37274f.system.entry.js → p-b4b81faccc.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1f0ddd16a2.system.entry.js → p-b5e8f8c5b5.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-b75d2a74cd.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-5f3e40e522.system.entry.js → p-ba40faa1d5.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-447bb8d6ce.entry.js → p-bd4f20f9ed.entry.js} +1 -1
- package/dist/baloise-design-system/{p-2568bb635f.entry.js → p-c0c4b24075.entry.js} +1 -1
- package/dist/baloise-design-system/{p-702d0efef4.entry.js → p-c1a3776980.entry.js} +1 -1
- package/dist/baloise-design-system/p-c2c574cb.js +1 -0
- package/dist/baloise-design-system/{p-29709a5fee.system.entry.js → p-c4320b3a46.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1d09b5700d.system.entry.js → p-c72db97c1c.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-c7cf7b2c6d.entry.js +1 -0
- package/dist/baloise-design-system/{p-eeb7176703.system.entry.js → p-c7e205efa7.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-9c204d3ac7.entry.js → p-ca80a03f51.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1fd9b1f748.system.entry.js → p-cce29204c3.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-53093cf5c3.system.entry.js → p-cd8072c189.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3114657eb7.system.entry.js → p-cec9dcd5f0.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-380ca15c13.system.entry.js → p-d49d8917c3.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-778ff1954d.system.entry.js → p-d4f12ff22c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-ba23bf69be.system.entry.js → p-dc18c95e40.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-56021799ec.entry.js → p-e50a9800ba.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7bf3e88ae4.entry.js → p-e6646714bb.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b7ea548704.system.entry.js → p-e85c10c09b.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-6e37071912.entry.js → p-eedc7103b3.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a0d0cd2901.entry.js → p-ef911c2b87.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3a0896c8a9.entry.js → p-f1186421ec.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a5c70dd2dd.system.entry.js → p-f863ef794a.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-7b7968e8d3.system.entry.js → p-fb95929111.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-93906ca075.entry.js → p-fed37bccaa.entry.js} +1 -1
- package/dist/cjs/bal-accordion_4.cjs.entry.js +62 -27
- package/dist/cjs/bal-app.cjs.entry.js +2 -2
- package/dist/cjs/bal-badge.cjs.entry.js +1 -1
- package/dist/cjs/bal-button_2.cjs.entry.js +2 -2
- package/dist/cjs/bal-card_6.cjs.entry.js +7 -7
- package/dist/cjs/bal-carousel_2.cjs.entry.js +4 -4
- package/dist/cjs/bal-checkbox-button.cjs.entry.js +1 -1
- package/dist/cjs/bal-checkbox_2.cjs.entry.js +1 -1
- package/dist/cjs/bal-close.cjs.entry.js +1 -1
- package/dist/cjs/bal-content.cjs.entry.js +1 -1
- package/dist/cjs/bal-data_4.cjs.entry.js +4 -4
- package/dist/cjs/bal-date-calendar-cell.cjs.entry.js +1 -1
- package/dist/cjs/bal-date-calendar_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-date.cjs.entry.js +1 -1
- package/dist/cjs/bal-divider.cjs.entry.js +1 -1
- package/dist/cjs/bal-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/bal-field_5.cjs.entry.js +8 -8
- package/dist/cjs/bal-file-upload.cjs.entry.js +4 -4
- package/dist/cjs/bal-footer.cjs.entry.js +3 -3
- package/dist/cjs/bal-form-col_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-form.cjs.entry.js +1 -1
- package/dist/cjs/bal-heading_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-hint_5.cjs.entry.js +6 -6
- package/dist/cjs/bal-icon.cjs.entry.js +1684 -311
- package/dist/cjs/bal-input-group.cjs.entry.js +1 -1
- package/dist/cjs/bal-input-slider.cjs.entry.js +3 -3
- package/dist/cjs/bal-input-stepper.cjs.entry.js +3 -3
- package/dist/cjs/bal-input.cjs.entry.js +1 -1
- package/dist/cjs/bal-label.cjs.entry.js +1 -1
- package/dist/cjs/bal-list_8.cjs.entry.js +10 -10
- package/dist/cjs/bal-logo.cjs.entry.js +3 -3
- package/dist/cjs/bal-modal_3.cjs.entry.js +7 -7
- package/dist/cjs/bal-nav_8.cjs.entry.js +13 -13
- package/dist/cjs/bal-navbar_5.cjs.entry.js +8 -8
- package/dist/cjs/bal-notices_3.cjs.entry.js +3 -3
- package/dist/cjs/bal-notification.cjs.entry.js +1 -1
- package/dist/cjs/bal-number-input.cjs.entry.js +1 -1
- package/dist/cjs/bal-option_2.cjs.entry.js +2 -2
- package/dist/cjs/bal-pagination.cjs.entry.js +7 -7
- package/dist/cjs/bal-popup.cjs.entry.js +1 -1
- package/dist/cjs/bal-progress-bar.cjs.entry.js +5 -5
- package/dist/cjs/bal-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/bal-radio_2.cjs.entry.js +1 -1
- package/dist/cjs/bal-segment_2.cjs.entry.js +6 -6
- package/dist/cjs/bal-select_2.cjs.entry.js +6 -6
- package/dist/cjs/bal-shape.cjs.entry.js +5 -5
- package/dist/cjs/bal-sheet.cjs.entry.js +1 -1
- package/dist/cjs/bal-spinner.cjs.entry.js +1 -1
- package/dist/cjs/bal-stack.cjs.entry.js +1 -1
- package/dist/cjs/bal-stage_6.cjs.entry.js +7 -7
- package/dist/cjs/bal-step-item.cjs.entry.js +2 -2
- package/dist/cjs/bal-steps.cjs.entry.js +3 -3
- package/dist/cjs/bal-tab-item_2.cjs.entry.js +7 -7
- package/dist/cjs/bal-table.cjs.entry.js +1 -1
- package/dist/cjs/bal-tag_2.cjs.entry.js +2 -2
- package/dist/cjs/bal-textarea.cjs.entry.js +1 -1
- package/dist/cjs/bal-time-input.cjs.entry.js +1 -1
- package/dist/cjs/bal-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/baloise-design-system.cjs.js +1 -1
- package/dist/cjs/{breakpoints.decorator-90762be4.js → breakpoints.decorator-a75a8dbc.js} +1 -1
- package/dist/cjs/{breakpoints.subject-7ee9fb88.js → breakpoints.subject-99007fbd.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/initialize-2e8978a4.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{tokens.esm-aa5d038b.js → tokens.esm-836b8c42.js} +1 -1
- package/dist/cjs/{window-resize.decorator-30d9f5ca.js → window-resize.decorator-dd0ecc12.js} +1 -1
- package/dist/collection/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.css +1 -1
- package/dist/collection/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.js +77 -12
- package/dist/collection/components/bal-accordion/bal-accordion.i18n.js +20 -20
- package/dist/collection/components/bal-app/bal-app.js +2 -2
- package/dist/collection/components/bal-badge/bal-badge.js +1 -1
- package/dist/collection/components/bal-button/bal-button-group/bal-button-group.js +2 -2
- package/dist/collection/components/bal-card/bal-card-actions/bal-card-actions.js +1 -1
- package/dist/collection/components/bal-card/bal-card-button/bal-card-button.js +1 -1
- package/dist/collection/components/bal-card/bal-card-content/bal-card-content.js +1 -1
- package/dist/collection/components/bal-card/bal-card-subtitle/bal-card-subtitle.js +1 -1
- package/dist/collection/components/bal-card/bal-card-title/bal-card-title.js +1 -1
- package/dist/collection/components/bal-card/bal-card.js +2 -2
- package/dist/collection/components/bal-carousel/bal-carousel.js +1 -1
- package/dist/collection/components/bal-checkbox/bal-checkbox-button/bal-checkbox-button.js +1 -1
- package/dist/collection/components/bal-checkbox/bal-checkbox.js +1 -1
- package/dist/collection/components/bal-close/bal-close.js +1 -1
- package/dist/collection/components/bal-content/bal-content.js +1 -1
- package/dist/collection/components/bal-data/bal-data-item/bal-data-item.js +1 -1
- package/dist/collection/components/bal-data/bal-data-label/bal-data-label.js +1 -1
- package/dist/collection/components/bal-data/bal-data-value/bal-data-value.js +1 -1
- package/dist/collection/components/bal-data/bal-data.js +1 -1
- package/dist/collection/components/bal-date/bal-date-calendar/bal-date-calendar.js +1 -1
- package/dist/collection/components/bal-date/bal-date-calendar-cell/bal-date-calendar-cell.js +1 -1
- package/dist/collection/components/bal-date/bal-date.js +1 -1
- package/dist/collection/components/bal-divider/bal-divider.js +1 -1
- package/dist/collection/components/bal-dropdown/bal-dropdown.js +2 -2
- package/dist/collection/components/bal-field/bal-field-control/bal-field-control.js +2 -2
- package/dist/collection/components/bal-field/bal-field-hint/bal-field-hint.js +1 -1
- package/dist/collection/components/bal-field/bal-field-label/bal-field-label.js +1 -1
- package/dist/collection/components/bal-field/bal-field-message/bal-field-message.js +2 -2
- package/dist/collection/components/bal-field/bal-field.js +2 -2
- package/dist/collection/components/bal-file-upload/bal-file-upload.js +4 -4
- package/dist/collection/components/bal-footer/bal-footer.js +3 -3
- package/dist/collection/components/bal-form/bal-form.js +1 -1
- package/dist/collection/components/bal-form-grid/bal-form-col/bal-form-col.js +2 -2
- package/dist/collection/components/bal-form-grid/bal-form-grid.js +1 -1
- package/dist/collection/components/bal-heading/bal-heading.js +1 -1
- package/dist/collection/components/bal-hint/bal-hint-text/bal-hint-text.js +1 -1
- package/dist/collection/components/bal-hint/bal-hint-title/bal-hint-title.js +1 -1
- package/dist/collection/components/bal-icon/bal-icon.css +1 -1
- package/dist/collection/components/bal-icon/bal-icon.js +85 -8
- package/dist/collection/components/bal-input/bal-input-date/bal-input-date.js +2 -2
- package/dist/collection/components/bal-input/bal-input.js +1 -1
- package/dist/collection/components/bal-input-group/bal-input-group.js +1 -1
- package/dist/collection/components/bal-input-slider/bal-input-slider.js +3 -3
- package/dist/collection/components/bal-input-stepper/bal-input-stepper.js +3 -3
- package/dist/collection/components/bal-label/bal-label.js +1 -1
- package/dist/collection/components/bal-list/bal-list-item-content/bal-list-item-content.js +2 -2
- package/dist/collection/components/bal-list/bal-list-item-icon/bal-list-item-icon.js +2 -2
- package/dist/collection/components/bal-list/bal-list-item-subtitle/bal-list-item-subtitle.js +1 -1
- package/dist/collection/components/bal-list/bal-list-item-title/bal-list-item-title.js +1 -1
- package/dist/collection/components/bal-list/bal-list.js +1 -1
- package/dist/collection/components/bal-modal/bal-modal-body/bal-modal-body.js +1 -1
- package/dist/collection/components/bal-modal/bal-modal-header/bal-modal-header.js +1 -1
- package/dist/collection/components/bal-modal/bal-modal.js +5 -5
- package/dist/collection/components/bal-nav/bal-nav-link/bal-nav-link.js +2 -2
- package/dist/collection/components/bal-nav/bal-nav-link-grid/bal-nav-link-grid.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav-link-grid-col/bal-nav-link-grid-col.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav-link-group/bal-nav-link-group.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav-menu-bar/bal-nav-menu-bar.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav-menu-flyout/bal-nav-menu-flyout.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav-meta-bar/bal-nav-meta-bar.js +1 -1
- package/dist/collection/components/bal-nav/bal-nav.js +2 -2
- package/dist/collection/components/bal-navbar/bal-navbar-brand/bal-navbar-brand.js +1 -1
- package/dist/collection/components/bal-navbar/bal-navbar-menu/bal-navbar-menu.js +1 -1
- package/dist/collection/components/bal-navbar/bal-navbar-menu-end/bal-navbar-menu-end.js +1 -1
- package/dist/collection/components/bal-navbar/bal-navbar-menu-start/bal-navbar-menu-start.js +1 -1
- package/dist/collection/components/bal-navbar/bal-navbar.js +1 -1
- package/dist/collection/components/bal-notices/bal-notices.js +1 -1
- package/dist/collection/components/bal-notification/bal-notification.js +1 -1
- package/dist/collection/components/bal-number-input/bal-number-input.js +1 -1
- package/dist/collection/components/bal-option/bal-option.js +1 -1
- package/dist/collection/components/bal-option-list/bal-option-list.js +1 -1
- package/dist/collection/components/bal-pagination/bal-pagination.js +4 -4
- package/dist/collection/components/bal-popover/bal-popover-content/bal-popover-content.js +1 -1
- package/dist/collection/components/bal-popup/bal-popup.js +1 -1
- package/dist/collection/components/bal-progress-bar/bal-progress-bar.js +1 -1
- package/dist/collection/components/bal-radio/bal-radio-button/bal-radio-button.js +1 -1
- package/dist/collection/components/bal-radio/bal-radio.js +1 -1
- package/dist/collection/components/bal-segment/bal-segment-item/bal-segment-item.js +1 -1
- package/dist/collection/components/bal-segment/bal-segment.js +1 -1
- package/dist/collection/components/bal-select/bal-select-option/bal-select-option.js +1 -1
- package/dist/collection/components/bal-select/bal-select.js +5 -5
- package/dist/collection/components/bal-shape/bal-shape.js +4 -4
- package/dist/collection/components/bal-sheet/bal-sheet.js +1 -1
- package/dist/collection/components/bal-snackbar/bal-snackbar.js +1 -1
- package/dist/collection/components/bal-spinner/bal-spinner.js +1 -1
- package/dist/collection/components/bal-stack/bal-stack.js +1 -1
- package/dist/collection/components/bal-stage/bal-stage-back-link/bal-stage-back-link.js +2 -2
- package/dist/collection/components/bal-stage/bal-stage-body/bal-stage-body.js +1 -1
- package/dist/collection/components/bal-stage/bal-stage-foot/bal-stage-foot.js +1 -1
- package/dist/collection/components/bal-stage/bal-stage-head/bal-stage-head.js +1 -1
- package/dist/collection/components/bal-stage/bal-stage-image/bal-stage-image.js +1 -1
- package/dist/collection/components/bal-stage/bal-stage.js +1 -1
- package/dist/collection/components/bal-steps/bal-step-item/bal-step-item.js +2 -2
- package/dist/collection/components/bal-table/bal-table.js +1 -1
- package/dist/collection/components/bal-tabs/bal-tab-item/bal-tab-item.js +2 -2
- package/dist/collection/components/bal-tabs/bal-tabs.js +2 -2
- package/dist/collection/components/bal-tag/bal-tag-group/bal-tag-group.js +1 -1
- package/dist/collection/components/bal-tag/bal-tag.js +1 -1
- package/dist/collection/components/bal-text/bal-text.js +2 -2
- package/dist/collection/components/bal-textarea/bal-textarea.js +1 -1
- package/dist/collection/components/bal-time-input/bal-time-input.js +1 -1
- package/dist/collection/components/bal-toast/bal-toast.js +1 -1
- package/dist/collection/components/bal-tooltip/bal-tooltip.js +1 -1
- package/dist/collection/utils/constants/version.constant.js +1 -1
- package/dist/esm/bal-accordion_4.entry.js +62 -27
- package/dist/esm/bal-app.entry.js +2 -2
- package/dist/esm/bal-badge.entry.js +1 -1
- package/dist/esm/bal-button_2.entry.js +2 -2
- package/dist/esm/bal-card_6.entry.js +7 -7
- package/dist/esm/bal-carousel_2.entry.js +4 -4
- package/dist/esm/bal-checkbox-button.entry.js +1 -1
- package/dist/esm/bal-checkbox_2.entry.js +1 -1
- package/dist/esm/bal-close.entry.js +1 -1
- package/dist/esm/bal-content.entry.js +1 -1
- package/dist/esm/bal-data_4.entry.js +4 -4
- package/dist/esm/bal-date-calendar-cell.entry.js +1 -1
- package/dist/esm/bal-date-calendar_2.entry.js +3 -3
- package/dist/esm/bal-date.entry.js +1 -1
- package/dist/esm/bal-divider.entry.js +1 -1
- package/dist/esm/bal-dropdown.entry.js +2 -2
- package/dist/esm/bal-field_5.entry.js +8 -8
- package/dist/esm/bal-file-upload.entry.js +4 -4
- package/dist/esm/bal-footer.entry.js +3 -3
- package/dist/esm/bal-form-col_2.entry.js +3 -3
- package/dist/esm/bal-form.entry.js +1 -1
- package/dist/esm/bal-heading_2.entry.js +3 -3
- package/dist/esm/bal-hint_5.entry.js +6 -6
- package/dist/esm/bal-icon.entry.js +1684 -311
- package/dist/esm/bal-input-group.entry.js +1 -1
- package/dist/esm/bal-input-slider.entry.js +3 -3
- package/dist/esm/bal-input-stepper.entry.js +3 -3
- package/dist/esm/bal-input.entry.js +1 -1
- package/dist/esm/bal-label.entry.js +1 -1
- package/dist/esm/bal-list_8.entry.js +10 -10
- package/dist/esm/bal-logo.entry.js +3 -3
- package/dist/esm/bal-modal_3.entry.js +7 -7
- package/dist/esm/bal-nav_8.entry.js +13 -13
- package/dist/esm/bal-navbar_5.entry.js +8 -8
- package/dist/esm/bal-notices_3.entry.js +3 -3
- package/dist/esm/bal-notification.entry.js +1 -1
- package/dist/esm/bal-number-input.entry.js +1 -1
- package/dist/esm/bal-option_2.entry.js +2 -2
- package/dist/esm/bal-pagination.entry.js +7 -7
- package/dist/esm/bal-popup.entry.js +1 -1
- package/dist/esm/bal-progress-bar.entry.js +5 -5
- package/dist/esm/bal-radio-button.entry.js +1 -1
- package/dist/esm/bal-radio_2.entry.js +1 -1
- package/dist/esm/bal-segment_2.entry.js +6 -6
- package/dist/esm/bal-select_2.entry.js +6 -6
- package/dist/esm/bal-shape.entry.js +5 -5
- package/dist/esm/bal-sheet.entry.js +1 -1
- package/dist/esm/bal-spinner.entry.js +1 -1
- package/dist/esm/bal-stack.entry.js +1 -1
- package/dist/esm/bal-stage_6.entry.js +7 -7
- package/dist/esm/bal-step-item.entry.js +2 -2
- package/dist/esm/bal-steps.entry.js +3 -3
- package/dist/esm/bal-tab-item_2.entry.js +7 -7
- package/dist/esm/bal-table.entry.js +1 -1
- package/dist/esm/bal-tag_2.entry.js +2 -2
- package/dist/esm/bal-textarea.entry.js +1 -1
- package/dist/esm/bal-time-input.entry.js +1 -1
- package/dist/esm/bal-tooltip.entry.js +1 -1
- package/dist/esm/baloise-design-system.js +1 -1
- package/dist/esm/{breakpoints.decorator-2074b85a.js → breakpoints.decorator-3c6214ed.js} +1 -1
- package/dist/esm/{breakpoints.subject-3329beee.js → breakpoints.subject-6b4e30ba.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/initialize-be160cc4.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{tokens.esm-9895930d.js → tokens.esm-2ce9e0f4.js} +1 -1
- package/dist/esm/{window-resize.decorator-9c64a902.js → window-resize.decorator-3ffd7301.js} +1 -1
- package/dist/esm-es5/bal-accordion_4.entry.js +1 -1
- package/dist/esm-es5/bal-app.entry.js +1 -1
- package/dist/esm-es5/bal-badge.entry.js +1 -1
- package/dist/esm-es5/bal-button_2.entry.js +1 -1
- package/dist/esm-es5/bal-card_6.entry.js +1 -1
- package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
- package/dist/esm-es5/bal-checkbox-button.entry.js +1 -1
- package/dist/esm-es5/bal-checkbox_2.entry.js +1 -1
- package/dist/esm-es5/bal-close.entry.js +1 -1
- package/dist/esm-es5/bal-content.entry.js +1 -1
- package/dist/esm-es5/bal-data_4.entry.js +1 -1
- package/dist/esm-es5/bal-date-calendar-cell.entry.js +1 -1
- package/dist/esm-es5/bal-date-calendar_2.entry.js +1 -1
- package/dist/esm-es5/bal-date.entry.js +1 -1
- package/dist/esm-es5/bal-divider.entry.js +1 -1
- package/dist/esm-es5/bal-dropdown.entry.js +1 -1
- package/dist/esm-es5/bal-field_5.entry.js +1 -1
- package/dist/esm-es5/bal-file-upload.entry.js +1 -1
- package/dist/esm-es5/bal-footer.entry.js +1 -1
- package/dist/esm-es5/bal-form-col_2.entry.js +1 -1
- package/dist/esm-es5/bal-form.entry.js +1 -1
- package/dist/esm-es5/bal-heading_2.entry.js +1 -1
- package/dist/esm-es5/bal-hint_5.entry.js +1 -1
- package/dist/esm-es5/bal-icon.entry.js +2 -1
- package/dist/esm-es5/bal-input-group.entry.js +1 -1
- package/dist/esm-es5/bal-input-slider.entry.js +1 -1
- package/dist/esm-es5/bal-input-stepper.entry.js +1 -1
- package/dist/esm-es5/bal-input.entry.js +1 -1
- package/dist/esm-es5/bal-label.entry.js +1 -1
- package/dist/esm-es5/bal-list_8.entry.js +1 -1
- package/dist/esm-es5/bal-logo.entry.js +1 -1
- package/dist/esm-es5/bal-modal_3.entry.js +1 -1
- package/dist/esm-es5/bal-nav_8.entry.js +1 -1
- package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
- package/dist/esm-es5/bal-notices_3.entry.js +1 -1
- package/dist/esm-es5/bal-notification.entry.js +1 -1
- package/dist/esm-es5/bal-number-input.entry.js +1 -1
- package/dist/esm-es5/bal-option_2.entry.js +1 -1
- package/dist/esm-es5/bal-pagination.entry.js +1 -1
- package/dist/esm-es5/bal-popup.entry.js +1 -1
- package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
- package/dist/esm-es5/bal-radio-button.entry.js +1 -1
- package/dist/esm-es5/bal-radio_2.entry.js +1 -1
- package/dist/esm-es5/bal-segment_2.entry.js +1 -1
- package/dist/esm-es5/bal-select_2.entry.js +1 -1
- package/dist/esm-es5/bal-shape.entry.js +1 -1
- package/dist/esm-es5/bal-sheet.entry.js +1 -1
- package/dist/esm-es5/bal-spinner.entry.js +1 -1
- package/dist/esm-es5/bal-stack.entry.js +1 -1
- package/dist/esm-es5/bal-stage_6.entry.js +1 -1
- package/dist/esm-es5/bal-step-item.entry.js +1 -1
- package/dist/esm-es5/bal-steps.entry.js +1 -1
- package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
- package/dist/esm-es5/bal-table.entry.js +1 -1
- package/dist/esm-es5/bal-tag_2.entry.js +1 -1
- package/dist/esm-es5/bal-textarea.entry.js +1 -1
- package/dist/esm-es5/bal-time-input.entry.js +1 -1
- package/dist/esm-es5/bal-tooltip.entry.js +1 -1
- package/dist/esm-es5/baloise-design-system.js +1 -1
- package/dist/esm-es5/{breakpoints.decorator-2074b85a.js → breakpoints.decorator-3c6214ed.js} +1 -1
- package/dist/esm-es5/{breakpoints.subject-3329beee.js → breakpoints.subject-6b4e30ba.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/initialize-be160cc4.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{window-resize.decorator-9c64a902.js → window-resize.decorator-3ffd7301.js} +1 -1
- package/dist/html.html-data.json +24 -1
- package/dist/types/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.d.ts +42 -1
- package/dist/types/components/bal-accordion/bal-accordion.interfaces.d.ts +1 -0
- package/dist/types/components/bal-icon/bal-icon.d.ts +21 -2
- package/dist/types/components/bal-icon/bal-icon.interfaces.d.ts +1 -0
- package/dist/types/components.d.ts +26 -2
- package/package.json +7 -6
- package/dist/baloise-design-system/p-01d99206b2.entry.js +0 -1
- package/dist/baloise-design-system/p-309f1f7d4e.entry.js +0 -1
- package/dist/baloise-design-system/p-35ca0dde1e.entry.js +0 -1
- package/dist/baloise-design-system/p-36f131eec6.entry.js +0 -1
- package/dist/baloise-design-system/p-3cfd6d7831.entry.js +0 -1
- package/dist/baloise-design-system/p-4d9a45256c.entry.js +0 -1
- package/dist/baloise-design-system/p-5c6d332a4e.entry.js +0 -1
- package/dist/baloise-design-system/p-5d6f66047b.system.entry.js +0 -1
- package/dist/baloise-design-system/p-6c29304485.system.entry.js +0 -1
- package/dist/baloise-design-system/p-75051cae.js +0 -1
- package/dist/baloise-design-system/p-76e1b06450.system.entry.js +0 -1
- package/dist/baloise-design-system/p-7c4d5ab726.entry.js +0 -1
- package/dist/baloise-design-system/p-8255d835fe.entry.js +0 -1
- package/dist/baloise-design-system/p-a1d210ca31.entry.js +0 -1
- package/dist/baloise-design-system/p-bab48d7af7.entry.js +0 -1
- /package/dist/baloise-design-system/{p-105f0019.system.js → p-1f610a13.system.js} +0 -0
- /package/dist/baloise-design-system/{p-8b3520e9.js → p-c8c2e2d9.js} +0 -0
- /package/dist/esm-es5/{tokens.esm-9895930d.js → tokens.esm-2ce9e0f4.js} +0 -0
|
@@ -8,6 +8,1356 @@ import './log-dfd1c19f.js';
|
|
|
8
8
|
import './browser-a8073d92.js';
|
|
9
9
|
import './config.utils-cd529084.js';
|
|
10
10
|
|
|
11
|
+
var purify = {exports: {}};
|
|
12
|
+
|
|
13
|
+
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
|
14
|
+
|
|
15
|
+
(function (module, exports) {
|
|
16
|
+
(function (global, factory) {
|
|
17
|
+
module.exports = factory() ;
|
|
18
|
+
})(commonjsGlobal, (function () {
|
|
19
|
+
const {
|
|
20
|
+
entries,
|
|
21
|
+
setPrototypeOf,
|
|
22
|
+
isFrozen,
|
|
23
|
+
getPrototypeOf,
|
|
24
|
+
getOwnPropertyDescriptor
|
|
25
|
+
} = Object;
|
|
26
|
+
let {
|
|
27
|
+
freeze,
|
|
28
|
+
seal,
|
|
29
|
+
create
|
|
30
|
+
} = Object; // eslint-disable-line import/no-mutable-exports
|
|
31
|
+
let {
|
|
32
|
+
apply,
|
|
33
|
+
construct
|
|
34
|
+
} = typeof Reflect !== 'undefined' && Reflect;
|
|
35
|
+
if (!freeze) {
|
|
36
|
+
freeze = function freeze(x) {
|
|
37
|
+
return x;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (!seal) {
|
|
41
|
+
seal = function seal(x) {
|
|
42
|
+
return x;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (!apply) {
|
|
46
|
+
apply = function apply(fun, thisValue, args) {
|
|
47
|
+
return fun.apply(thisValue, args);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (!construct) {
|
|
51
|
+
construct = function construct(Func, args) {
|
|
52
|
+
return new Func(...args);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
56
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
57
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
58
|
+
const arrayPush = unapply(Array.prototype.push);
|
|
59
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
60
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
61
|
+
const stringToString = unapply(String.prototype.toString);
|
|
62
|
+
const stringMatch = unapply(String.prototype.match);
|
|
63
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
64
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
65
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
66
|
+
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
67
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
68
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
71
|
+
*
|
|
72
|
+
* @param func - The function to be wrapped and called.
|
|
73
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
74
|
+
*/
|
|
75
|
+
function unapply(func) {
|
|
76
|
+
return function (thisArg) {
|
|
77
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
78
|
+
args[_key - 1] = arguments[_key];
|
|
79
|
+
}
|
|
80
|
+
return apply(func, thisArg, args);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
85
|
+
*
|
|
86
|
+
* @param func - The constructor function to be wrapped and called.
|
|
87
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
88
|
+
*/
|
|
89
|
+
function unconstruct(func) {
|
|
90
|
+
return function () {
|
|
91
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
92
|
+
args[_key2] = arguments[_key2];
|
|
93
|
+
}
|
|
94
|
+
return construct(func, args);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Add properties to a lookup table
|
|
99
|
+
*
|
|
100
|
+
* @param set - The set to which elements will be added.
|
|
101
|
+
* @param array - The array containing elements to be added to the set.
|
|
102
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
103
|
+
* @returns The modified set with added elements.
|
|
104
|
+
*/
|
|
105
|
+
function addToSet(set, array) {
|
|
106
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
|
|
107
|
+
if (setPrototypeOf) {
|
|
108
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
109
|
+
// independent of any properties defined on Object.prototype.
|
|
110
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
111
|
+
setPrototypeOf(set, null);
|
|
112
|
+
}
|
|
113
|
+
let l = array.length;
|
|
114
|
+
while (l--) {
|
|
115
|
+
let element = array[l];
|
|
116
|
+
if (typeof element === 'string') {
|
|
117
|
+
const lcElement = transformCaseFunc(element);
|
|
118
|
+
if (lcElement !== element) {
|
|
119
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
120
|
+
if (!isFrozen(array)) {
|
|
121
|
+
array[l] = lcElement;
|
|
122
|
+
}
|
|
123
|
+
element = lcElement;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
set[element] = true;
|
|
127
|
+
}
|
|
128
|
+
return set;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Clean up an array to harden against CSPP
|
|
132
|
+
*
|
|
133
|
+
* @param array - The array to be cleaned.
|
|
134
|
+
* @returns The cleaned version of the array
|
|
135
|
+
*/
|
|
136
|
+
function cleanArray(array) {
|
|
137
|
+
for (let index = 0; index < array.length; index++) {
|
|
138
|
+
const isPropertyExist = objectHasOwnProperty(array, index);
|
|
139
|
+
if (!isPropertyExist) {
|
|
140
|
+
array[index] = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return array;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Shallow clone an object
|
|
147
|
+
*
|
|
148
|
+
* @param object - The object to be cloned.
|
|
149
|
+
* @returns A new object that copies the original.
|
|
150
|
+
*/
|
|
151
|
+
function clone(object) {
|
|
152
|
+
const newObject = create(null);
|
|
153
|
+
for (const [property, value] of entries(object)) {
|
|
154
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
155
|
+
if (isPropertyExist) {
|
|
156
|
+
if (Array.isArray(value)) {
|
|
157
|
+
newObject[property] = cleanArray(value);
|
|
158
|
+
} else if (value && typeof value === 'object' && value.constructor === Object) {
|
|
159
|
+
newObject[property] = clone(value);
|
|
160
|
+
} else {
|
|
161
|
+
newObject[property] = value;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return newObject;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
169
|
+
*
|
|
170
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
171
|
+
* @param prop - The property name for which to find the getter function.
|
|
172
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
173
|
+
*/
|
|
174
|
+
function lookupGetter(object, prop) {
|
|
175
|
+
while (object !== null) {
|
|
176
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
177
|
+
if (desc) {
|
|
178
|
+
if (desc.get) {
|
|
179
|
+
return unapply(desc.get);
|
|
180
|
+
}
|
|
181
|
+
if (typeof desc.value === 'function') {
|
|
182
|
+
return unapply(desc.value);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
object = getPrototypeOf(object);
|
|
186
|
+
}
|
|
187
|
+
function fallbackValue() {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return fallbackValue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
194
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
195
|
+
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
196
|
+
// List of SVG elements that are disallowed by default.
|
|
197
|
+
// We still need to know them so that we can do namespace
|
|
198
|
+
// checks properly in case one wants to add them to
|
|
199
|
+
// allow-list.
|
|
200
|
+
const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
201
|
+
const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
|
|
202
|
+
// Similarly to SVG, we want to know all MathML elements,
|
|
203
|
+
// even those that we disallow by default.
|
|
204
|
+
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
205
|
+
const text = freeze(['#text']);
|
|
206
|
+
|
|
207
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
208
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
209
|
+
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
210
|
+
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
211
|
+
|
|
212
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
213
|
+
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
214
|
+
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
215
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
216
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
217
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
218
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
219
|
+
);
|
|
220
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
221
|
+
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
222
|
+
);
|
|
223
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
224
|
+
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
225
|
+
|
|
226
|
+
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
227
|
+
__proto__: null,
|
|
228
|
+
ARIA_ATTR: ARIA_ATTR,
|
|
229
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
230
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT,
|
|
231
|
+
DATA_ATTR: DATA_ATTR,
|
|
232
|
+
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
233
|
+
ERB_EXPR: ERB_EXPR,
|
|
234
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
235
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
236
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
237
|
+
TMPLIT_EXPR: TMPLIT_EXPR
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
241
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
242
|
+
const NODE_TYPE = {
|
|
243
|
+
element: 1,
|
|
244
|
+
attribute: 2,
|
|
245
|
+
text: 3,
|
|
246
|
+
cdataSection: 4,
|
|
247
|
+
entityReference: 5,
|
|
248
|
+
// Deprecated
|
|
249
|
+
entityNode: 6,
|
|
250
|
+
// Deprecated
|
|
251
|
+
progressingInstruction: 7,
|
|
252
|
+
comment: 8,
|
|
253
|
+
document: 9,
|
|
254
|
+
documentType: 10,
|
|
255
|
+
documentFragment: 11,
|
|
256
|
+
notation: 12 // Deprecated
|
|
257
|
+
};
|
|
258
|
+
const getGlobal = function getGlobal() {
|
|
259
|
+
return typeof window === 'undefined' ? null : window;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Creates a no-op policy for internal use only.
|
|
263
|
+
* Don't export this function outside this module!
|
|
264
|
+
* @param trustedTypes The policy factory.
|
|
265
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
266
|
+
* @return The policy created (or null, if Trusted Types
|
|
267
|
+
* are not supported or creating the policy failed).
|
|
268
|
+
*/
|
|
269
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
270
|
+
if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
// Allow the callers to control the unique policy name
|
|
274
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
275
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
276
|
+
let suffix = null;
|
|
277
|
+
const ATTR_NAME = 'data-tt-policy-suffix';
|
|
278
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
279
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
280
|
+
}
|
|
281
|
+
const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
282
|
+
try {
|
|
283
|
+
return trustedTypes.createPolicy(policyName, {
|
|
284
|
+
createHTML(html) {
|
|
285
|
+
return html;
|
|
286
|
+
},
|
|
287
|
+
createScriptURL(scriptUrl) {
|
|
288
|
+
return scriptUrl;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
} catch (_) {
|
|
292
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
293
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
294
|
+
// if TT are enforced.
|
|
295
|
+
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const _createHooksMap = function _createHooksMap() {
|
|
300
|
+
return {
|
|
301
|
+
afterSanitizeAttributes: [],
|
|
302
|
+
afterSanitizeElements: [],
|
|
303
|
+
afterSanitizeShadowDOM: [],
|
|
304
|
+
beforeSanitizeAttributes: [],
|
|
305
|
+
beforeSanitizeElements: [],
|
|
306
|
+
beforeSanitizeShadowDOM: [],
|
|
307
|
+
uponSanitizeAttribute: [],
|
|
308
|
+
uponSanitizeElement: [],
|
|
309
|
+
uponSanitizeShadowNode: []
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
function createDOMPurify() {
|
|
313
|
+
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
314
|
+
const DOMPurify = root => createDOMPurify(root);
|
|
315
|
+
DOMPurify.version = '3.2.4';
|
|
316
|
+
DOMPurify.removed = [];
|
|
317
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
318
|
+
// Not running in a browser, provide a factory function
|
|
319
|
+
// so that you can pass your own Window
|
|
320
|
+
DOMPurify.isSupported = false;
|
|
321
|
+
return DOMPurify;
|
|
322
|
+
}
|
|
323
|
+
let {
|
|
324
|
+
document
|
|
325
|
+
} = window;
|
|
326
|
+
const originalDocument = document;
|
|
327
|
+
const currentScript = originalDocument.currentScript;
|
|
328
|
+
const {
|
|
329
|
+
DocumentFragment,
|
|
330
|
+
HTMLTemplateElement,
|
|
331
|
+
Node,
|
|
332
|
+
Element,
|
|
333
|
+
NodeFilter,
|
|
334
|
+
NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
|
|
335
|
+
HTMLFormElement,
|
|
336
|
+
DOMParser,
|
|
337
|
+
trustedTypes
|
|
338
|
+
} = window;
|
|
339
|
+
const ElementPrototype = Element.prototype;
|
|
340
|
+
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
341
|
+
const remove = lookupGetter(ElementPrototype, 'remove');
|
|
342
|
+
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
343
|
+
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
344
|
+
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
345
|
+
// As per issue #47, the web-components registry is inherited by a
|
|
346
|
+
// new document created via createHTMLDocument. As per the spec
|
|
347
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
348
|
+
// a new empty registry is used when creating a template contents owner
|
|
349
|
+
// document, so we use that as our parent document to ensure nothing
|
|
350
|
+
// is inherited.
|
|
351
|
+
if (typeof HTMLTemplateElement === 'function') {
|
|
352
|
+
const template = document.createElement('template');
|
|
353
|
+
if (template.content && template.content.ownerDocument) {
|
|
354
|
+
document = template.content.ownerDocument;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
let trustedTypesPolicy;
|
|
358
|
+
let emptyHTML = '';
|
|
359
|
+
const {
|
|
360
|
+
implementation,
|
|
361
|
+
createNodeIterator,
|
|
362
|
+
createDocumentFragment,
|
|
363
|
+
getElementsByTagName
|
|
364
|
+
} = document;
|
|
365
|
+
const {
|
|
366
|
+
importNode
|
|
367
|
+
} = originalDocument;
|
|
368
|
+
let hooks = _createHooksMap();
|
|
369
|
+
/**
|
|
370
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
371
|
+
*/
|
|
372
|
+
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
|
|
373
|
+
const {
|
|
374
|
+
MUSTACHE_EXPR,
|
|
375
|
+
ERB_EXPR,
|
|
376
|
+
TMPLIT_EXPR,
|
|
377
|
+
DATA_ATTR,
|
|
378
|
+
ARIA_ATTR,
|
|
379
|
+
IS_SCRIPT_OR_DATA,
|
|
380
|
+
ATTR_WHITESPACE,
|
|
381
|
+
CUSTOM_ELEMENT
|
|
382
|
+
} = EXPRESSIONS;
|
|
383
|
+
let {
|
|
384
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
385
|
+
} = EXPRESSIONS;
|
|
386
|
+
/**
|
|
387
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
388
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
389
|
+
*/
|
|
390
|
+
/* allowed element names */
|
|
391
|
+
let ALLOWED_TAGS = null;
|
|
392
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
393
|
+
/* Allowed attribute names */
|
|
394
|
+
let ALLOWED_ATTR = null;
|
|
395
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
396
|
+
/*
|
|
397
|
+
* Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
|
|
398
|
+
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
399
|
+
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
400
|
+
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
401
|
+
*/
|
|
402
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
403
|
+
tagNameCheck: {
|
|
404
|
+
writable: true,
|
|
405
|
+
configurable: false,
|
|
406
|
+
enumerable: true,
|
|
407
|
+
value: null
|
|
408
|
+
},
|
|
409
|
+
attributeNameCheck: {
|
|
410
|
+
writable: true,
|
|
411
|
+
configurable: false,
|
|
412
|
+
enumerable: true,
|
|
413
|
+
value: null
|
|
414
|
+
},
|
|
415
|
+
allowCustomizedBuiltInElements: {
|
|
416
|
+
writable: true,
|
|
417
|
+
configurable: false,
|
|
418
|
+
enumerable: true,
|
|
419
|
+
value: false
|
|
420
|
+
}
|
|
421
|
+
}));
|
|
422
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
423
|
+
let FORBID_TAGS = null;
|
|
424
|
+
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
425
|
+
let FORBID_ATTR = null;
|
|
426
|
+
/* Decide if ARIA attributes are okay */
|
|
427
|
+
let ALLOW_ARIA_ATTR = true;
|
|
428
|
+
/* Decide if custom data attributes are okay */
|
|
429
|
+
let ALLOW_DATA_ATTR = true;
|
|
430
|
+
/* Decide if unknown protocols are okay */
|
|
431
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
432
|
+
/* Decide if self-closing tags in attributes are allowed.
|
|
433
|
+
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
434
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
435
|
+
/* Output should be safe for common template engines.
|
|
436
|
+
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
437
|
+
*/
|
|
438
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
439
|
+
/* Output should be safe even for XML used within HTML and alike.
|
|
440
|
+
* This means, DOMPurify removes comments when containing risky content.
|
|
441
|
+
*/
|
|
442
|
+
let SAFE_FOR_XML = true;
|
|
443
|
+
/* Decide if document with <html>... should be returned */
|
|
444
|
+
let WHOLE_DOCUMENT = false;
|
|
445
|
+
/* Track whether config is already set on this instance of DOMPurify. */
|
|
446
|
+
let SET_CONFIG = false;
|
|
447
|
+
/* Decide if all elements (e.g. style, script) must be children of
|
|
448
|
+
* document.body. By default, browsers might move them to document.head */
|
|
449
|
+
let FORCE_BODY = false;
|
|
450
|
+
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
451
|
+
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
452
|
+
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
453
|
+
*/
|
|
454
|
+
let RETURN_DOM = false;
|
|
455
|
+
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
456
|
+
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
457
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
458
|
+
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
459
|
+
* case Trusted Types are not supported */
|
|
460
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
461
|
+
/* Output should be free from DOM clobbering attacks?
|
|
462
|
+
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
463
|
+
*/
|
|
464
|
+
let SANITIZE_DOM = true;
|
|
465
|
+
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
466
|
+
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
467
|
+
*
|
|
468
|
+
* HTML/DOM spec rules that enable DOM Clobbering:
|
|
469
|
+
* - Named Access on Window (§7.3.3)
|
|
470
|
+
* - DOM Tree Accessors (§3.1.5)
|
|
471
|
+
* - Form Element Parent-Child Relations (§4.10.3)
|
|
472
|
+
* - Iframe srcdoc / Nested WindowProxies (§4.8.5)
|
|
473
|
+
* - HTMLCollection (§4.2.10.2)
|
|
474
|
+
*
|
|
475
|
+
* Namespace isolation is implemented by prefixing `id` and `name` attributes
|
|
476
|
+
* with a constant string, i.e., `user-content-`
|
|
477
|
+
*/
|
|
478
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
479
|
+
const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
480
|
+
/* Keep element content when removing element? */
|
|
481
|
+
let KEEP_CONTENT = true;
|
|
482
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
483
|
+
* of importing it into a new Document and returning a sanitized copy */
|
|
484
|
+
let IN_PLACE = false;
|
|
485
|
+
/* Allow usage of profiles like html, svg and mathMl */
|
|
486
|
+
let USE_PROFILES = {};
|
|
487
|
+
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
488
|
+
let FORBID_CONTENTS = null;
|
|
489
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
490
|
+
/* Tags that are safe for data: URIs */
|
|
491
|
+
let DATA_URI_TAGS = null;
|
|
492
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
493
|
+
/* Attributes safe for values like "javascript:" */
|
|
494
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
495
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
496
|
+
const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
497
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
498
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
499
|
+
/* Document namespace */
|
|
500
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
501
|
+
let IS_EMPTY_INPUT = false;
|
|
502
|
+
/* Allowed XHTML+XML namespaces */
|
|
503
|
+
let ALLOWED_NAMESPACES = null;
|
|
504
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
505
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
506
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
|
|
507
|
+
// Certain elements are allowed in both SVG and HTML
|
|
508
|
+
// namespace. We need to specify them explicitly
|
|
509
|
+
// so that they don't get erroneously deleted from
|
|
510
|
+
// HTML namespace.
|
|
511
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
512
|
+
/* Parsing of strict XHTML documents */
|
|
513
|
+
let PARSER_MEDIA_TYPE = null;
|
|
514
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
515
|
+
const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
516
|
+
let transformCaseFunc = null;
|
|
517
|
+
/* Keep a reference to config to pass to hooks */
|
|
518
|
+
let CONFIG = null;
|
|
519
|
+
/* Ideally, do not touch anything below this line */
|
|
520
|
+
/* ______________________________________________ */
|
|
521
|
+
const formElement = document.createElement('form');
|
|
522
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
523
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* _parseConfig
|
|
527
|
+
*
|
|
528
|
+
* @param cfg optional config literal
|
|
529
|
+
*/
|
|
530
|
+
// eslint-disable-next-line complexity
|
|
531
|
+
const _parseConfig = function _parseConfig() {
|
|
532
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
533
|
+
if (CONFIG && CONFIG === cfg) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
/* Shield configuration object from tampering */
|
|
537
|
+
if (!cfg || typeof cfg !== 'object') {
|
|
538
|
+
cfg = {};
|
|
539
|
+
}
|
|
540
|
+
/* Shield configuration object from prototype pollution */
|
|
541
|
+
cfg = clone(cfg);
|
|
542
|
+
PARSER_MEDIA_TYPE =
|
|
543
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
544
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
545
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
546
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
547
|
+
/* Set configuration parameters */
|
|
548
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
549
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
550
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
551
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
552
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
553
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
554
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
555
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
556
|
+
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
557
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
558
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
559
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
560
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
|
|
561
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
562
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
|
|
563
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
564
|
+
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
565
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
566
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
567
|
+
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
568
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
569
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
570
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
571
|
+
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
572
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
573
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
574
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
575
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
576
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
577
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
578
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
579
|
+
}
|
|
580
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
581
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
582
|
+
}
|
|
583
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
584
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
585
|
+
}
|
|
586
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
587
|
+
ALLOW_DATA_ATTR = false;
|
|
588
|
+
}
|
|
589
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
590
|
+
RETURN_DOM = true;
|
|
591
|
+
}
|
|
592
|
+
/* Parse profile info */
|
|
593
|
+
if (USE_PROFILES) {
|
|
594
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
595
|
+
ALLOWED_ATTR = [];
|
|
596
|
+
if (USE_PROFILES.html === true) {
|
|
597
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
598
|
+
addToSet(ALLOWED_ATTR, html);
|
|
599
|
+
}
|
|
600
|
+
if (USE_PROFILES.svg === true) {
|
|
601
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
602
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
603
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
604
|
+
}
|
|
605
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
606
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
607
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
608
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
609
|
+
}
|
|
610
|
+
if (USE_PROFILES.mathMl === true) {
|
|
611
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
612
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
613
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
/* Merge configuration parameters */
|
|
617
|
+
if (cfg.ADD_TAGS) {
|
|
618
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
619
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
620
|
+
}
|
|
621
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
622
|
+
}
|
|
623
|
+
if (cfg.ADD_ATTR) {
|
|
624
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
625
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
626
|
+
}
|
|
627
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
628
|
+
}
|
|
629
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
630
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
631
|
+
}
|
|
632
|
+
if (cfg.FORBID_CONTENTS) {
|
|
633
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
634
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
635
|
+
}
|
|
636
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
637
|
+
}
|
|
638
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
639
|
+
if (KEEP_CONTENT) {
|
|
640
|
+
ALLOWED_TAGS['#text'] = true;
|
|
641
|
+
}
|
|
642
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
643
|
+
if (WHOLE_DOCUMENT) {
|
|
644
|
+
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
645
|
+
}
|
|
646
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
647
|
+
if (ALLOWED_TAGS.table) {
|
|
648
|
+
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
649
|
+
delete FORBID_TAGS.tbody;
|
|
650
|
+
}
|
|
651
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
652
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
|
|
653
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
654
|
+
}
|
|
655
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
|
|
656
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
657
|
+
}
|
|
658
|
+
// Overwrite existing TrustedTypes policy.
|
|
659
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
660
|
+
// Sign local variables required by `sanitize`.
|
|
661
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
662
|
+
} else {
|
|
663
|
+
// Uninitialized policy, attempt to initialize the internal dompurify policy.
|
|
664
|
+
if (trustedTypesPolicy === undefined) {
|
|
665
|
+
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
666
|
+
}
|
|
667
|
+
// If creating the internal policy succeeded sign internal variables.
|
|
668
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
|
|
669
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
// Prevent further manipulation of configuration.
|
|
673
|
+
// Not available in IE8, Safari 5, etc.
|
|
674
|
+
if (freeze) {
|
|
675
|
+
freeze(cfg);
|
|
676
|
+
}
|
|
677
|
+
CONFIG = cfg;
|
|
678
|
+
};
|
|
679
|
+
/* Keep track of all possible SVG and MathML tags
|
|
680
|
+
* so that we can perform the namespace checks
|
|
681
|
+
* correctly. */
|
|
682
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
683
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
684
|
+
/**
|
|
685
|
+
* @param element a DOM element whose namespace is being checked
|
|
686
|
+
* @returns Return false if the element has a
|
|
687
|
+
* namespace that a spec-compliant parser would never
|
|
688
|
+
* return. Return true otherwise.
|
|
689
|
+
*/
|
|
690
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
691
|
+
let parent = getParentNode(element);
|
|
692
|
+
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
693
|
+
// can be null. We just simulate parent in this case.
|
|
694
|
+
if (!parent || !parent.tagName) {
|
|
695
|
+
parent = {
|
|
696
|
+
namespaceURI: NAMESPACE,
|
|
697
|
+
tagName: 'template'
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
701
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
702
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
706
|
+
// The only way to switch from HTML namespace to SVG
|
|
707
|
+
// is via <svg>. If it happens via any other tag, then
|
|
708
|
+
// it should be killed.
|
|
709
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
710
|
+
return tagName === 'svg';
|
|
711
|
+
}
|
|
712
|
+
// The only way to switch from MathML to SVG is via`
|
|
713
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
714
|
+
// text integration points.
|
|
715
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
716
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
717
|
+
}
|
|
718
|
+
// We only allow elements that are defined in SVG
|
|
719
|
+
// spec. All others are disallowed in SVG namespace.
|
|
720
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
721
|
+
}
|
|
722
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
723
|
+
// The only way to switch from HTML namespace to MathML
|
|
724
|
+
// is via <math>. If it happens via any other tag, then
|
|
725
|
+
// it should be killed.
|
|
726
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
727
|
+
return tagName === 'math';
|
|
728
|
+
}
|
|
729
|
+
// The only way to switch from SVG to MathML is via
|
|
730
|
+
// <math> and HTML integration points
|
|
731
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
732
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
733
|
+
}
|
|
734
|
+
// We only allow elements that are defined in MathML
|
|
735
|
+
// spec. All others are disallowed in MathML namespace.
|
|
736
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
737
|
+
}
|
|
738
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
739
|
+
// The only way to switch from SVG to HTML is via
|
|
740
|
+
// HTML integration points, and from MathML to HTML
|
|
741
|
+
// is via MathML text integration points
|
|
742
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
// We disallow tags that are specific for MathML
|
|
749
|
+
// or SVG and should never appear in HTML namespace
|
|
750
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
751
|
+
}
|
|
752
|
+
// For XHTML and XML documents that support custom namespaces
|
|
753
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
754
|
+
return true;
|
|
755
|
+
}
|
|
756
|
+
// The code should never reach this place (this means
|
|
757
|
+
// that the element somehow got namespace that is not
|
|
758
|
+
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
759
|
+
// Return false just in case.
|
|
760
|
+
return false;
|
|
761
|
+
};
|
|
762
|
+
/**
|
|
763
|
+
* _forceRemove
|
|
764
|
+
*
|
|
765
|
+
* @param node a DOM node
|
|
766
|
+
*/
|
|
767
|
+
const _forceRemove = function _forceRemove(node) {
|
|
768
|
+
arrayPush(DOMPurify.removed, {
|
|
769
|
+
element: node
|
|
770
|
+
});
|
|
771
|
+
try {
|
|
772
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
773
|
+
getParentNode(node).removeChild(node);
|
|
774
|
+
} catch (_) {
|
|
775
|
+
remove(node);
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
/**
|
|
779
|
+
* _removeAttribute
|
|
780
|
+
*
|
|
781
|
+
* @param name an Attribute name
|
|
782
|
+
* @param element a DOM node
|
|
783
|
+
*/
|
|
784
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
785
|
+
try {
|
|
786
|
+
arrayPush(DOMPurify.removed, {
|
|
787
|
+
attribute: element.getAttributeNode(name),
|
|
788
|
+
from: element
|
|
789
|
+
});
|
|
790
|
+
} catch (_) {
|
|
791
|
+
arrayPush(DOMPurify.removed, {
|
|
792
|
+
attribute: null,
|
|
793
|
+
from: element
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
element.removeAttribute(name);
|
|
797
|
+
// We void attribute values for unremovable "is" attributes
|
|
798
|
+
if (name === 'is') {
|
|
799
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
800
|
+
try {
|
|
801
|
+
_forceRemove(element);
|
|
802
|
+
} catch (_) {}
|
|
803
|
+
} else {
|
|
804
|
+
try {
|
|
805
|
+
element.setAttribute(name, '');
|
|
806
|
+
} catch (_) {}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
/**
|
|
811
|
+
* _initDocument
|
|
812
|
+
*
|
|
813
|
+
* @param dirty - a string of dirty markup
|
|
814
|
+
* @return a DOM, filled with the dirty markup
|
|
815
|
+
*/
|
|
816
|
+
const _initDocument = function _initDocument(dirty) {
|
|
817
|
+
/* Create a HTML document */
|
|
818
|
+
let doc = null;
|
|
819
|
+
let leadingWhitespace = null;
|
|
820
|
+
if (FORCE_BODY) {
|
|
821
|
+
dirty = '<remove></remove>' + dirty;
|
|
822
|
+
} else {
|
|
823
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
824
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
825
|
+
leadingWhitespace = matches && matches[0];
|
|
826
|
+
}
|
|
827
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
|
|
828
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
829
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
830
|
+
}
|
|
831
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
832
|
+
/*
|
|
833
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
834
|
+
* DOMParser not work for svg when has multiple root element.
|
|
835
|
+
*/
|
|
836
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
837
|
+
try {
|
|
838
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
839
|
+
} catch (_) {}
|
|
840
|
+
}
|
|
841
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
842
|
+
if (!doc || !doc.documentElement) {
|
|
843
|
+
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
844
|
+
try {
|
|
845
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
846
|
+
} catch (_) {
|
|
847
|
+
// Syntax error if dirtyPayload is invalid xml
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
const body = doc.body || doc.documentElement;
|
|
851
|
+
if (dirty && leadingWhitespace) {
|
|
852
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
853
|
+
}
|
|
854
|
+
/* Work on whole document or just its body */
|
|
855
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
856
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
857
|
+
}
|
|
858
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
862
|
+
*
|
|
863
|
+
* @param root The root element or node to start traversing on.
|
|
864
|
+
* @return The created NodeIterator
|
|
865
|
+
*/
|
|
866
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
867
|
+
return createNodeIterator.call(root.ownerDocument || root, root,
|
|
868
|
+
// eslint-disable-next-line no-bitwise
|
|
869
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
870
|
+
};
|
|
871
|
+
/**
|
|
872
|
+
* _isClobbered
|
|
873
|
+
*
|
|
874
|
+
* @param element element to check for clobbering attacks
|
|
875
|
+
* @return true if clobbered, false if safe
|
|
876
|
+
*/
|
|
877
|
+
const _isClobbered = function _isClobbered(element) {
|
|
878
|
+
return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
|
|
879
|
+
};
|
|
880
|
+
/**
|
|
881
|
+
* Checks whether the given object is a DOM node.
|
|
882
|
+
*
|
|
883
|
+
* @param value object to check whether it's a DOM node
|
|
884
|
+
* @return true is object is a DOM node
|
|
885
|
+
*/
|
|
886
|
+
const _isNode = function _isNode(value) {
|
|
887
|
+
return typeof Node === 'function' && value instanceof Node;
|
|
888
|
+
};
|
|
889
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
890
|
+
arrayForEach(hooks, hook => {
|
|
891
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* _sanitizeElements
|
|
896
|
+
*
|
|
897
|
+
* @protect nodeName
|
|
898
|
+
* @protect textContent
|
|
899
|
+
* @protect removeChild
|
|
900
|
+
* @param currentNode to check for permission to exist
|
|
901
|
+
* @return true if node was killed, false if left alive
|
|
902
|
+
*/
|
|
903
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
904
|
+
let content = null;
|
|
905
|
+
/* Execute a hook if present */
|
|
906
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
907
|
+
/* Check if element is clobbered or can clobber */
|
|
908
|
+
if (_isClobbered(currentNode)) {
|
|
909
|
+
_forceRemove(currentNode);
|
|
910
|
+
return true;
|
|
911
|
+
}
|
|
912
|
+
/* Now let's check the element's type and name */
|
|
913
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
914
|
+
/* Execute a hook if present */
|
|
915
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
916
|
+
tagName,
|
|
917
|
+
allowedTags: ALLOWED_TAGS
|
|
918
|
+
});
|
|
919
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
920
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
921
|
+
_forceRemove(currentNode);
|
|
922
|
+
return true;
|
|
923
|
+
}
|
|
924
|
+
/* Remove any occurrence of processing instructions */
|
|
925
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
926
|
+
_forceRemove(currentNode);
|
|
927
|
+
return true;
|
|
928
|
+
}
|
|
929
|
+
/* Remove any kind of possibly harmful comments */
|
|
930
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
931
|
+
_forceRemove(currentNode);
|
|
932
|
+
return true;
|
|
933
|
+
}
|
|
934
|
+
/* Remove element if anything forbids its presence */
|
|
935
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
936
|
+
/* Check if we have a custom element to handle */
|
|
937
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
938
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
942
|
+
return false;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
/* Keep content except for bad-listed elements */
|
|
946
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
947
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
948
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
949
|
+
if (childNodes && parentNode) {
|
|
950
|
+
const childCount = childNodes.length;
|
|
951
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
952
|
+
const childClone = cloneNode(childNodes[i], true);
|
|
953
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
954
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
_forceRemove(currentNode);
|
|
959
|
+
return true;
|
|
960
|
+
}
|
|
961
|
+
/* Check whether element has a valid namespace */
|
|
962
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
963
|
+
_forceRemove(currentNode);
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
967
|
+
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
968
|
+
_forceRemove(currentNode);
|
|
969
|
+
return true;
|
|
970
|
+
}
|
|
971
|
+
/* Sanitize element content to be template-safe */
|
|
972
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
973
|
+
/* Get the element's text content */
|
|
974
|
+
content = currentNode.textContent;
|
|
975
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
976
|
+
content = stringReplace(content, expr, ' ');
|
|
977
|
+
});
|
|
978
|
+
if (currentNode.textContent !== content) {
|
|
979
|
+
arrayPush(DOMPurify.removed, {
|
|
980
|
+
element: currentNode.cloneNode()
|
|
981
|
+
});
|
|
982
|
+
currentNode.textContent = content;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
/* Execute a hook if present */
|
|
986
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
987
|
+
return false;
|
|
988
|
+
};
|
|
989
|
+
/**
|
|
990
|
+
* _isValidAttribute
|
|
991
|
+
*
|
|
992
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
993
|
+
* @param lcName Lowercase attribute name.
|
|
994
|
+
* @param value Attribute value.
|
|
995
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
996
|
+
*/
|
|
997
|
+
// eslint-disable-next-line complexity
|
|
998
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
999
|
+
/* Make sure attribute cannot clobber */
|
|
1000
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1001
|
+
return false;
|
|
1002
|
+
}
|
|
1003
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
1004
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
1005
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
1006
|
+
We don't need to check the value; it's always URI safe. */
|
|
1007
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1008
|
+
if (
|
|
1009
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1010
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1011
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1012
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
|
|
1013
|
+
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1014
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1015
|
+
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
1019
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
|
|
1020
|
+
return false;
|
|
1021
|
+
} else ;
|
|
1022
|
+
return true;
|
|
1023
|
+
};
|
|
1024
|
+
/**
|
|
1025
|
+
* _isBasicCustomElement
|
|
1026
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
1027
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
1028
|
+
*
|
|
1029
|
+
* @param tagName name of the tag of the node to sanitize
|
|
1030
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
1031
|
+
*/
|
|
1032
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
1033
|
+
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* _sanitizeAttributes
|
|
1037
|
+
*
|
|
1038
|
+
* @protect attributes
|
|
1039
|
+
* @protect nodeName
|
|
1040
|
+
* @protect removeAttribute
|
|
1041
|
+
* @protect setAttribute
|
|
1042
|
+
*
|
|
1043
|
+
* @param currentNode to sanitize
|
|
1044
|
+
*/
|
|
1045
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
1046
|
+
/* Execute a hook if present */
|
|
1047
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
1048
|
+
const {
|
|
1049
|
+
attributes
|
|
1050
|
+
} = currentNode;
|
|
1051
|
+
/* Check if we have attributes; if not we might have a text node */
|
|
1052
|
+
if (!attributes || _isClobbered(currentNode)) {
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
const hookEvent = {
|
|
1056
|
+
attrName: '',
|
|
1057
|
+
attrValue: '',
|
|
1058
|
+
keepAttr: true,
|
|
1059
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
1060
|
+
forceKeepAttr: undefined
|
|
1061
|
+
};
|
|
1062
|
+
let l = attributes.length;
|
|
1063
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
1064
|
+
while (l--) {
|
|
1065
|
+
const attr = attributes[l];
|
|
1066
|
+
const {
|
|
1067
|
+
name,
|
|
1068
|
+
namespaceURI,
|
|
1069
|
+
value: attrValue
|
|
1070
|
+
} = attr;
|
|
1071
|
+
const lcName = transformCaseFunc(name);
|
|
1072
|
+
let value = name === 'value' ? attrValue : stringTrim(attrValue);
|
|
1073
|
+
/* Execute a hook if present */
|
|
1074
|
+
hookEvent.attrName = lcName;
|
|
1075
|
+
hookEvent.attrValue = value;
|
|
1076
|
+
hookEvent.keepAttr = true;
|
|
1077
|
+
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
1078
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
1079
|
+
value = hookEvent.attrValue;
|
|
1080
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
1081
|
+
* Prefix id and name attributes with `user-content-`
|
|
1082
|
+
*/
|
|
1083
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
1084
|
+
// Remove the attribute with this value
|
|
1085
|
+
_removeAttribute(name, currentNode);
|
|
1086
|
+
// Prefix the value and later re-create the attribute with the sanitized value
|
|
1087
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1088
|
+
}
|
|
1089
|
+
/* Work around a security issue with comments inside attributes */
|
|
1090
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1091
|
+
_removeAttribute(name, currentNode);
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
/* Did the hooks approve of the attribute? */
|
|
1095
|
+
if (hookEvent.forceKeepAttr) {
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
1098
|
+
/* Remove attribute */
|
|
1099
|
+
_removeAttribute(name, currentNode);
|
|
1100
|
+
/* Did the hooks approve of the attribute? */
|
|
1101
|
+
if (!hookEvent.keepAttr) {
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
1105
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
1106
|
+
_removeAttribute(name, currentNode);
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
/* Sanitize attribute content to be template-safe */
|
|
1110
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
1111
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1112
|
+
value = stringReplace(value, expr, ' ');
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
/* Is `value` valid for this attribute? */
|
|
1116
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1117
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1118
|
+
continue;
|
|
1119
|
+
}
|
|
1120
|
+
/* Handle attributes that require Trusted Types */
|
|
1121
|
+
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
1122
|
+
if (namespaceURI) ; else {
|
|
1123
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
1124
|
+
case 'TrustedHTML':
|
|
1125
|
+
{
|
|
1126
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
1127
|
+
break;
|
|
1128
|
+
}
|
|
1129
|
+
case 'TrustedScriptURL':
|
|
1130
|
+
{
|
|
1131
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
1138
|
+
try {
|
|
1139
|
+
if (namespaceURI) {
|
|
1140
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
1141
|
+
} else {
|
|
1142
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
1143
|
+
currentNode.setAttribute(name, value);
|
|
1144
|
+
}
|
|
1145
|
+
if (_isClobbered(currentNode)) {
|
|
1146
|
+
_forceRemove(currentNode);
|
|
1147
|
+
} else {
|
|
1148
|
+
arrayPop(DOMPurify.removed);
|
|
1149
|
+
}
|
|
1150
|
+
} catch (_) {}
|
|
1151
|
+
}
|
|
1152
|
+
/* Execute a hook if present */
|
|
1153
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* _sanitizeShadowDOM
|
|
1157
|
+
*
|
|
1158
|
+
* @param fragment to iterate over recursively
|
|
1159
|
+
*/
|
|
1160
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
1161
|
+
let shadowNode = null;
|
|
1162
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
1163
|
+
/* Execute a hook if present */
|
|
1164
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
1165
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
1166
|
+
/* Execute a hook if present */
|
|
1167
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
1168
|
+
/* Sanitize tags and elements */
|
|
1169
|
+
_sanitizeElements(shadowNode);
|
|
1170
|
+
/* Check attributes next */
|
|
1171
|
+
_sanitizeAttributes(shadowNode);
|
|
1172
|
+
/* Deep shadow DOM detected */
|
|
1173
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
|
1174
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
/* Execute a hook if present */
|
|
1178
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
1179
|
+
};
|
|
1180
|
+
// eslint-disable-next-line complexity
|
|
1181
|
+
DOMPurify.sanitize = function (dirty) {
|
|
1182
|
+
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1183
|
+
let body = null;
|
|
1184
|
+
let importedNode = null;
|
|
1185
|
+
let currentNode = null;
|
|
1186
|
+
let returnNode = null;
|
|
1187
|
+
/* Make sure we have a string to sanitize.
|
|
1188
|
+
DO NOT return early, as this will return the wrong type if
|
|
1189
|
+
the user has requested a DOM object rather than a string */
|
|
1190
|
+
IS_EMPTY_INPUT = !dirty;
|
|
1191
|
+
if (IS_EMPTY_INPUT) {
|
|
1192
|
+
dirty = '<!-->';
|
|
1193
|
+
}
|
|
1194
|
+
/* Stringify, in case dirty is an object */
|
|
1195
|
+
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
1196
|
+
if (typeof dirty.toString === 'function') {
|
|
1197
|
+
dirty = dirty.toString();
|
|
1198
|
+
if (typeof dirty !== 'string') {
|
|
1199
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
1200
|
+
}
|
|
1201
|
+
} else {
|
|
1202
|
+
throw typeErrorCreate('toString is not a function');
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
/* Return dirty HTML if DOMPurify cannot run */
|
|
1206
|
+
if (!DOMPurify.isSupported) {
|
|
1207
|
+
return dirty;
|
|
1208
|
+
}
|
|
1209
|
+
/* Assign config vars */
|
|
1210
|
+
if (!SET_CONFIG) {
|
|
1211
|
+
_parseConfig(cfg);
|
|
1212
|
+
}
|
|
1213
|
+
/* Clean up removed elements */
|
|
1214
|
+
DOMPurify.removed = [];
|
|
1215
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
1216
|
+
if (typeof dirty === 'string') {
|
|
1217
|
+
IN_PLACE = false;
|
|
1218
|
+
}
|
|
1219
|
+
if (IN_PLACE) {
|
|
1220
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
1221
|
+
if (dirty.nodeName) {
|
|
1222
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
1223
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1224
|
+
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
} else if (dirty instanceof Node) {
|
|
1228
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
1229
|
+
elements being stripped by the parser */
|
|
1230
|
+
body = _initDocument('<!---->');
|
|
1231
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
1232
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
|
|
1233
|
+
/* Node is already a body, use as is */
|
|
1234
|
+
body = importedNode;
|
|
1235
|
+
} else if (importedNode.nodeName === 'HTML') {
|
|
1236
|
+
body = importedNode;
|
|
1237
|
+
} else {
|
|
1238
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
1239
|
+
body.appendChild(importedNode);
|
|
1240
|
+
}
|
|
1241
|
+
} else {
|
|
1242
|
+
/* Exit directly if we have nothing to do */
|
|
1243
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
1244
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
1245
|
+
dirty.indexOf('<') === -1) {
|
|
1246
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
1247
|
+
}
|
|
1248
|
+
/* Initialize the document to work on */
|
|
1249
|
+
body = _initDocument(dirty);
|
|
1250
|
+
/* Check we have a DOM node from the data */
|
|
1251
|
+
if (!body) {
|
|
1252
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
1256
|
+
if (body && FORCE_BODY) {
|
|
1257
|
+
_forceRemove(body.firstChild);
|
|
1258
|
+
}
|
|
1259
|
+
/* Get node iterator */
|
|
1260
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
1261
|
+
/* Now start iterating over the created document */
|
|
1262
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
1263
|
+
/* Sanitize tags and elements */
|
|
1264
|
+
_sanitizeElements(currentNode);
|
|
1265
|
+
/* Check attributes next */
|
|
1266
|
+
_sanitizeAttributes(currentNode);
|
|
1267
|
+
/* Shadow DOM detected, sanitize it */
|
|
1268
|
+
if (currentNode.content instanceof DocumentFragment) {
|
|
1269
|
+
_sanitizeShadowDOM(currentNode.content);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
/* If we sanitized `dirty` in-place, return it. */
|
|
1273
|
+
if (IN_PLACE) {
|
|
1274
|
+
return dirty;
|
|
1275
|
+
}
|
|
1276
|
+
/* Return sanitized string or DOM */
|
|
1277
|
+
if (RETURN_DOM) {
|
|
1278
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
1279
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
1280
|
+
while (body.firstChild) {
|
|
1281
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
1282
|
+
returnNode.appendChild(body.firstChild);
|
|
1283
|
+
}
|
|
1284
|
+
} else {
|
|
1285
|
+
returnNode = body;
|
|
1286
|
+
}
|
|
1287
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
1288
|
+
/*
|
|
1289
|
+
AdoptNode() is not used because internal state is not reset
|
|
1290
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
1291
|
+
in theory but we would rather not risk another attack vector.
|
|
1292
|
+
The state that is cloned by importNode() is explicitly defined
|
|
1293
|
+
by the specs.
|
|
1294
|
+
*/
|
|
1295
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
1296
|
+
}
|
|
1297
|
+
return returnNode;
|
|
1298
|
+
}
|
|
1299
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1300
|
+
/* Serialize doctype if allowed */
|
|
1301
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
1302
|
+
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
1303
|
+
}
|
|
1304
|
+
/* Sanitize final string template-safe */
|
|
1305
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
1306
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1307
|
+
serializedHTML = stringReplace(serializedHTML, expr, ' ');
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
1311
|
+
};
|
|
1312
|
+
DOMPurify.setConfig = function () {
|
|
1313
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1314
|
+
_parseConfig(cfg);
|
|
1315
|
+
SET_CONFIG = true;
|
|
1316
|
+
};
|
|
1317
|
+
DOMPurify.clearConfig = function () {
|
|
1318
|
+
CONFIG = null;
|
|
1319
|
+
SET_CONFIG = false;
|
|
1320
|
+
};
|
|
1321
|
+
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
1322
|
+
/* Initialize shared config vars if necessary. */
|
|
1323
|
+
if (!CONFIG) {
|
|
1324
|
+
_parseConfig({});
|
|
1325
|
+
}
|
|
1326
|
+
const lcTag = transformCaseFunc(tag);
|
|
1327
|
+
const lcName = transformCaseFunc(attr);
|
|
1328
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
1329
|
+
};
|
|
1330
|
+
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
1331
|
+
if (typeof hookFunction !== 'function') {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
1335
|
+
};
|
|
1336
|
+
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
1337
|
+
if (hookFunction !== undefined) {
|
|
1338
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
1339
|
+
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
1340
|
+
}
|
|
1341
|
+
return arrayPop(hooks[entryPoint]);
|
|
1342
|
+
};
|
|
1343
|
+
DOMPurify.removeHooks = function (entryPoint) {
|
|
1344
|
+
hooks[entryPoint] = [];
|
|
1345
|
+
};
|
|
1346
|
+
DOMPurify.removeAllHooks = function () {
|
|
1347
|
+
hooks = _createHooksMap();
|
|
1348
|
+
};
|
|
1349
|
+
return DOMPurify;
|
|
1350
|
+
}
|
|
1351
|
+
var purify = createDOMPurify();
|
|
1352
|
+
|
|
1353
|
+
return purify;
|
|
1354
|
+
|
|
1355
|
+
}));
|
|
1356
|
+
|
|
1357
|
+
}(purify));
|
|
1358
|
+
|
|
1359
|
+
const DOMPurify = purify.exports;
|
|
1360
|
+
|
|
11
1361
|
/**
|
|
12
1362
|
* lodash (Custom Build) <https://lodash.com/>
|
|
13
1363
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
@@ -23,35 +1373,141 @@ var INFINITY$1 = 1 / 0;
|
|
|
23
1373
|
/** `Object#toString` result references. */
|
|
24
1374
|
var symbolTag$1 = '[object Symbol]';
|
|
25
1375
|
|
|
1376
|
+
/** Used to match words composed of alphanumeric characters. */
|
|
1377
|
+
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
1378
|
+
|
|
1379
|
+
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
1380
|
+
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
1381
|
+
|
|
26
1382
|
/** Used to compose unicode character classes. */
|
|
27
1383
|
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
28
1384
|
rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
|
29
1385
|
rsComboSymbolsRange$1 = '\\u20d0-\\u20f0',
|
|
30
|
-
|
|
1386
|
+
rsDingbatRange = '\\u2700-\\u27bf',
|
|
1387
|
+
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
|
1388
|
+
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
|
1389
|
+
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
|
1390
|
+
rsPunctuationRange = '\\u2000-\\u206f',
|
|
1391
|
+
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
|
1392
|
+
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
|
1393
|
+
rsVarRange$1 = '\\ufe0e\\ufe0f',
|
|
1394
|
+
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
31
1395
|
|
|
32
1396
|
/** Used to compose unicode capture groups. */
|
|
33
|
-
var
|
|
1397
|
+
var rsApos = "['\u2019]",
|
|
1398
|
+
rsAstral$1 = '[' + rsAstralRange$1 + ']',
|
|
1399
|
+
rsBreak = '[' + rsBreakRange + ']',
|
|
34
1400
|
rsCombo$1 = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']',
|
|
1401
|
+
rsDigits = '\\d+',
|
|
1402
|
+
rsDingbat = '[' + rsDingbatRange + ']',
|
|
1403
|
+
rsLower = '[' + rsLowerRange + ']',
|
|
1404
|
+
rsMisc = '[^' + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
|
35
1405
|
rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
|
|
36
1406
|
rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
|
|
37
1407
|
rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
|
|
38
1408
|
rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
39
1409
|
rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
1410
|
+
rsUpper = '[' + rsUpperRange + ']',
|
|
40
1411
|
rsZWJ$1 = '\\u200d';
|
|
41
1412
|
|
|
42
1413
|
/** Used to compose unicode regexes. */
|
|
43
|
-
var
|
|
1414
|
+
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
|
1415
|
+
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
|
1416
|
+
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
|
1417
|
+
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
|
1418
|
+
reOptMod$1 = rsModifier$1 + '?',
|
|
44
1419
|
rsOptVar$1 = '[' + rsVarRange$1 + ']?',
|
|
45
1420
|
rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
|
|
46
1421
|
rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
|
|
1422
|
+
rsEmoji = '(?:' + [rsDingbat, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsSeq$1,
|
|
47
1423
|
rsSymbol$1 = '(?:' + [rsNonAstral$1 + rsCombo$1 + '?', rsCombo$1, rsRegional$1, rsSurrPair$1, rsAstral$1].join('|') + ')';
|
|
48
1424
|
|
|
1425
|
+
/** Used to match apostrophes. */
|
|
1426
|
+
var reApos = RegExp(rsApos, 'g');
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
1430
|
+
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
1431
|
+
*/
|
|
1432
|
+
var reComboMark = RegExp(rsCombo$1, 'g');
|
|
1433
|
+
|
|
49
1434
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
50
1435
|
var reUnicode$1 = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol$1 + rsSeq$1, 'g');
|
|
51
1436
|
|
|
1437
|
+
/** Used to match complex or compound words. */
|
|
1438
|
+
var reUnicodeWord = RegExp([
|
|
1439
|
+
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
|
1440
|
+
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
|
1441
|
+
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
|
1442
|
+
rsUpper + '+' + rsOptUpperContr,
|
|
1443
|
+
rsDigits,
|
|
1444
|
+
rsEmoji
|
|
1445
|
+
].join('|'), 'g');
|
|
1446
|
+
|
|
52
1447
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
53
1448
|
var reHasUnicode$1 = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboMarksRange$1 + rsComboSymbolsRange$1 + rsVarRange$1 + ']');
|
|
54
1449
|
|
|
1450
|
+
/** Used to detect strings that need a more robust regexp to match words. */
|
|
1451
|
+
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
1452
|
+
|
|
1453
|
+
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
1454
|
+
var deburredLetters = {
|
|
1455
|
+
// Latin-1 Supplement block.
|
|
1456
|
+
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
|
1457
|
+
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
|
1458
|
+
'\xc7': 'C', '\xe7': 'c',
|
|
1459
|
+
'\xd0': 'D', '\xf0': 'd',
|
|
1460
|
+
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
|
1461
|
+
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
|
1462
|
+
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
|
1463
|
+
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
|
1464
|
+
'\xd1': 'N', '\xf1': 'n',
|
|
1465
|
+
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
|
1466
|
+
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
|
1467
|
+
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
|
1468
|
+
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
|
1469
|
+
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
|
1470
|
+
'\xc6': 'Ae', '\xe6': 'ae',
|
|
1471
|
+
'\xde': 'Th', '\xfe': 'th',
|
|
1472
|
+
'\xdf': 'ss',
|
|
1473
|
+
// Latin Extended-A block.
|
|
1474
|
+
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
|
1475
|
+
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
|
1476
|
+
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
|
1477
|
+
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
|
1478
|
+
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
|
1479
|
+
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
|
1480
|
+
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
|
1481
|
+
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
|
1482
|
+
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
|
1483
|
+
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
|
1484
|
+
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
|
1485
|
+
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
|
1486
|
+
'\u0134': 'J', '\u0135': 'j',
|
|
1487
|
+
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
|
1488
|
+
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
|
1489
|
+
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
|
1490
|
+
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
|
1491
|
+
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
|
1492
|
+
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
|
1493
|
+
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
|
1494
|
+
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
|
1495
|
+
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
|
1496
|
+
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
|
1497
|
+
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
|
1498
|
+
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
|
1499
|
+
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
|
1500
|
+
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
|
1501
|
+
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
|
1502
|
+
'\u0174': 'W', '\u0175': 'w',
|
|
1503
|
+
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
|
1504
|
+
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
|
1505
|
+
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
|
1506
|
+
'\u0132': 'IJ', '\u0133': 'ij',
|
|
1507
|
+
'\u0152': 'Oe', '\u0153': 'oe',
|
|
1508
|
+
'\u0149': "'n", '\u017f': 'ss'
|
|
1509
|
+
};
|
|
1510
|
+
|
|
55
1511
|
/** Detect free variable `global` from Node.js. */
|
|
56
1512
|
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
57
1513
|
|
|
@@ -61,6 +1517,31 @@ var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && se
|
|
|
61
1517
|
/** Used as a reference to the global object. */
|
|
62
1518
|
var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
|
|
63
1519
|
|
|
1520
|
+
/**
|
|
1521
|
+
* A specialized version of `_.reduce` for arrays without support for
|
|
1522
|
+
* iteratee shorthands.
|
|
1523
|
+
*
|
|
1524
|
+
* @private
|
|
1525
|
+
* @param {Array} [array] The array to iterate over.
|
|
1526
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1527
|
+
* @param {*} [accumulator] The initial value.
|
|
1528
|
+
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
1529
|
+
* the initial value.
|
|
1530
|
+
* @returns {*} Returns the accumulated value.
|
|
1531
|
+
*/
|
|
1532
|
+
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
1533
|
+
var index = -1,
|
|
1534
|
+
length = array ? array.length : 0;
|
|
1535
|
+
|
|
1536
|
+
if (initAccum && length) {
|
|
1537
|
+
accumulator = array[++index];
|
|
1538
|
+
}
|
|
1539
|
+
while (++index < length) {
|
|
1540
|
+
accumulator = iteratee(accumulator, array[index], index, array);
|
|
1541
|
+
}
|
|
1542
|
+
return accumulator;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
64
1545
|
/**
|
|
65
1546
|
* Converts an ASCII `string` to an array.
|
|
66
1547
|
*
|
|
@@ -72,6 +1553,40 @@ function asciiToArray$1(string) {
|
|
|
72
1553
|
return string.split('');
|
|
73
1554
|
}
|
|
74
1555
|
|
|
1556
|
+
/**
|
|
1557
|
+
* Splits an ASCII `string` into an array of its words.
|
|
1558
|
+
*
|
|
1559
|
+
* @private
|
|
1560
|
+
* @param {string} The string to inspect.
|
|
1561
|
+
* @returns {Array} Returns the words of `string`.
|
|
1562
|
+
*/
|
|
1563
|
+
function asciiWords(string) {
|
|
1564
|
+
return string.match(reAsciiWord) || [];
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
1569
|
+
*
|
|
1570
|
+
* @private
|
|
1571
|
+
* @param {Object} object The object to query.
|
|
1572
|
+
* @returns {Function} Returns the new accessor function.
|
|
1573
|
+
*/
|
|
1574
|
+
function basePropertyOf(object) {
|
|
1575
|
+
return function(key) {
|
|
1576
|
+
return object == null ? undefined : object[key];
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
1582
|
+
* letters to basic Latin letters.
|
|
1583
|
+
*
|
|
1584
|
+
* @private
|
|
1585
|
+
* @param {string} letter The matched letter to deburr.
|
|
1586
|
+
* @returns {string} Returns the deburred letter.
|
|
1587
|
+
*/
|
|
1588
|
+
var deburrLetter = basePropertyOf(deburredLetters);
|
|
1589
|
+
|
|
75
1590
|
/**
|
|
76
1591
|
* Checks if `string` contains Unicode symbols.
|
|
77
1592
|
*
|
|
@@ -83,6 +1598,17 @@ function hasUnicode$1(string) {
|
|
|
83
1598
|
return reHasUnicode$1.test(string);
|
|
84
1599
|
}
|
|
85
1600
|
|
|
1601
|
+
/**
|
|
1602
|
+
* Checks if `string` contains a word composed of Unicode symbols.
|
|
1603
|
+
*
|
|
1604
|
+
* @private
|
|
1605
|
+
* @param {string} string The string to inspect.
|
|
1606
|
+
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
1607
|
+
*/
|
|
1608
|
+
function hasUnicodeWord(string) {
|
|
1609
|
+
return reHasUnicodeWord.test(string);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
86
1612
|
/**
|
|
87
1613
|
* Converts `string` to an array.
|
|
88
1614
|
*
|
|
@@ -107,6 +1633,17 @@ function unicodeToArray$1(string) {
|
|
|
107
1633
|
return string.match(reUnicode$1) || [];
|
|
108
1634
|
}
|
|
109
1635
|
|
|
1636
|
+
/**
|
|
1637
|
+
* Splits a Unicode `string` into an array of its words.
|
|
1638
|
+
*
|
|
1639
|
+
* @private
|
|
1640
|
+
* @param {string} The string to inspect.
|
|
1641
|
+
* @returns {Array} Returns the words of `string`.
|
|
1642
|
+
*/
|
|
1643
|
+
function unicodeWords(string) {
|
|
1644
|
+
return string.match(reUnicodeWord) || [];
|
|
1645
|
+
}
|
|
1646
|
+
|
|
110
1647
|
/** Used for built-in method references. */
|
|
111
1648
|
var objectProto$1 = Object.prototype;
|
|
112
1649
|
|
|
@@ -216,6 +1753,19 @@ function createCaseFirst$1(methodName) {
|
|
|
216
1753
|
};
|
|
217
1754
|
}
|
|
218
1755
|
|
|
1756
|
+
/**
|
|
1757
|
+
* Creates a function like `_.camelCase`.
|
|
1758
|
+
*
|
|
1759
|
+
* @private
|
|
1760
|
+
* @param {Function} callback The function to combine each word.
|
|
1761
|
+
* @returns {Function} Returns the new compounder function.
|
|
1762
|
+
*/
|
|
1763
|
+
function createCompounder(callback) {
|
|
1764
|
+
return function(string) {
|
|
1765
|
+
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
|
|
219
1769
|
/**
|
|
220
1770
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
221
1771
|
* and has a `typeof` result of "object".
|
|
@@ -291,6 +1841,73 @@ function toString$1(value) {
|
|
|
291
1841
|
return value == null ? '' : baseToString$1(value);
|
|
292
1842
|
}
|
|
293
1843
|
|
|
1844
|
+
/**
|
|
1845
|
+
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
1846
|
+
*
|
|
1847
|
+
* @static
|
|
1848
|
+
* @memberOf _
|
|
1849
|
+
* @since 3.0.0
|
|
1850
|
+
* @category String
|
|
1851
|
+
* @param {string} [string=''] The string to convert.
|
|
1852
|
+
* @returns {string} Returns the camel cased string.
|
|
1853
|
+
* @example
|
|
1854
|
+
*
|
|
1855
|
+
* _.camelCase('Foo Bar');
|
|
1856
|
+
* // => 'fooBar'
|
|
1857
|
+
*
|
|
1858
|
+
* _.camelCase('--foo-bar--');
|
|
1859
|
+
* // => 'fooBar'
|
|
1860
|
+
*
|
|
1861
|
+
* _.camelCase('__FOO_BAR__');
|
|
1862
|
+
* // => 'fooBar'
|
|
1863
|
+
*/
|
|
1864
|
+
var camelCase = createCompounder(function(result, word, index) {
|
|
1865
|
+
word = word.toLowerCase();
|
|
1866
|
+
return result + (index ? capitalize(word) : word);
|
|
1867
|
+
});
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Converts the first character of `string` to upper case and the remaining
|
|
1871
|
+
* to lower case.
|
|
1872
|
+
*
|
|
1873
|
+
* @static
|
|
1874
|
+
* @memberOf _
|
|
1875
|
+
* @since 3.0.0
|
|
1876
|
+
* @category String
|
|
1877
|
+
* @param {string} [string=''] The string to capitalize.
|
|
1878
|
+
* @returns {string} Returns the capitalized string.
|
|
1879
|
+
* @example
|
|
1880
|
+
*
|
|
1881
|
+
* _.capitalize('FRED');
|
|
1882
|
+
* // => 'Fred'
|
|
1883
|
+
*/
|
|
1884
|
+
function capitalize(string) {
|
|
1885
|
+
return upperFirst$1(toString$1(string).toLowerCase());
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* Deburrs `string` by converting
|
|
1890
|
+
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
1891
|
+
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
1892
|
+
* letters to basic Latin letters and removing
|
|
1893
|
+
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
1894
|
+
*
|
|
1895
|
+
* @static
|
|
1896
|
+
* @memberOf _
|
|
1897
|
+
* @since 3.0.0
|
|
1898
|
+
* @category String
|
|
1899
|
+
* @param {string} [string=''] The string to deburr.
|
|
1900
|
+
* @returns {string} Returns the deburred string.
|
|
1901
|
+
* @example
|
|
1902
|
+
*
|
|
1903
|
+
* _.deburr('déjà vu');
|
|
1904
|
+
* // => 'deja vu'
|
|
1905
|
+
*/
|
|
1906
|
+
function deburr(string) {
|
|
1907
|
+
string = toString$1(string);
|
|
1908
|
+
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
1909
|
+
}
|
|
1910
|
+
|
|
294
1911
|
/**
|
|
295
1912
|
* Converts the first character of `string` to upper case.
|
|
296
1913
|
*
|
|
@@ -310,7 +1927,36 @@ function toString$1(value) {
|
|
|
310
1927
|
*/
|
|
311
1928
|
var upperFirst$1 = createCaseFirst$1('toUpperCase');
|
|
312
1929
|
|
|
313
|
-
|
|
1930
|
+
/**
|
|
1931
|
+
* Splits `string` into an array of its words.
|
|
1932
|
+
*
|
|
1933
|
+
* @static
|
|
1934
|
+
* @memberOf _
|
|
1935
|
+
* @since 3.0.0
|
|
1936
|
+
* @category String
|
|
1937
|
+
* @param {string} [string=''] The string to inspect.
|
|
1938
|
+
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
1939
|
+
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
1940
|
+
* @returns {Array} Returns the words of `string`.
|
|
1941
|
+
* @example
|
|
1942
|
+
*
|
|
1943
|
+
* _.words('fred, barney, & pebbles');
|
|
1944
|
+
* // => ['fred', 'barney', 'pebbles']
|
|
1945
|
+
*
|
|
1946
|
+
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
1947
|
+
* // => ['fred', 'barney', '&', 'pebbles']
|
|
1948
|
+
*/
|
|
1949
|
+
function words(string, pattern, guard) {
|
|
1950
|
+
string = toString$1(string);
|
|
1951
|
+
pattern = guard ? undefined : pattern;
|
|
1952
|
+
|
|
1953
|
+
if (pattern === undefined) {
|
|
1954
|
+
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
1955
|
+
}
|
|
1956
|
+
return string.match(pattern) || [];
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
var lodash_camelcase = camelCase;
|
|
314
1960
|
|
|
315
1961
|
/**
|
|
316
1962
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -327,141 +1973,35 @@ var INFINITY = 1 / 0;
|
|
|
327
1973
|
/** `Object#toString` result references. */
|
|
328
1974
|
var symbolTag = '[object Symbol]';
|
|
329
1975
|
|
|
330
|
-
/** Used to match words composed of alphanumeric characters. */
|
|
331
|
-
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
332
|
-
|
|
333
|
-
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
334
|
-
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
335
|
-
|
|
336
1976
|
/** Used to compose unicode character classes. */
|
|
337
1977
|
var rsAstralRange = '\\ud800-\\udfff',
|
|
338
1978
|
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
|
339
1979
|
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
|
340
|
-
|
|
341
|
-
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
|
342
|
-
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
|
343
|
-
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
|
344
|
-
rsPunctuationRange = '\\u2000-\\u206f',
|
|
345
|
-
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
|
346
|
-
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
|
347
|
-
rsVarRange = '\\ufe0e\\ufe0f',
|
|
348
|
-
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
1980
|
+
rsVarRange = '\\ufe0e\\ufe0f';
|
|
349
1981
|
|
|
350
1982
|
/** Used to compose unicode capture groups. */
|
|
351
|
-
var
|
|
352
|
-
rsAstral = '[' + rsAstralRange + ']',
|
|
353
|
-
rsBreak = '[' + rsBreakRange + ']',
|
|
1983
|
+
var rsAstral = '[' + rsAstralRange + ']',
|
|
354
1984
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
|
355
|
-
rsDigits = '\\d+',
|
|
356
|
-
rsDingbat = '[' + rsDingbatRange + ']',
|
|
357
|
-
rsLower = '[' + rsLowerRange + ']',
|
|
358
|
-
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
|
359
1985
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
360
1986
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
361
1987
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
362
1988
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
363
1989
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
364
|
-
rsUpper = '[' + rsUpperRange + ']',
|
|
365
1990
|
rsZWJ = '\\u200d';
|
|
366
1991
|
|
|
367
1992
|
/** Used to compose unicode regexes. */
|
|
368
|
-
var
|
|
369
|
-
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
|
370
|
-
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
|
371
|
-
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
|
372
|
-
reOptMod = rsModifier + '?',
|
|
1993
|
+
var reOptMod = rsModifier + '?',
|
|
373
1994
|
rsOptVar = '[' + rsVarRange + ']?',
|
|
374
1995
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
375
1996
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
376
|
-
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
|
377
1997
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
378
1998
|
|
|
379
|
-
/** Used to match apostrophes. */
|
|
380
|
-
var reApos = RegExp(rsApos, 'g');
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
384
|
-
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
385
|
-
*/
|
|
386
|
-
var reComboMark = RegExp(rsCombo, 'g');
|
|
387
|
-
|
|
388
1999
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
389
|
-
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
390
|
-
|
|
391
|
-
/** Used to match complex or compound words. */
|
|
392
|
-
var reUnicodeWord = RegExp([
|
|
393
|
-
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
|
394
|
-
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
|
395
|
-
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
|
396
|
-
rsUpper + '+' + rsOptUpperContr,
|
|
397
|
-
rsDigits,
|
|
398
|
-
rsEmoji
|
|
399
|
-
].join('|'), 'g');
|
|
2000
|
+
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
400
2001
|
|
|
401
2002
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
402
2003
|
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
|
403
2004
|
|
|
404
|
-
/** Used to detect strings that need a more robust regexp to match words. */
|
|
405
|
-
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
406
|
-
|
|
407
|
-
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
408
|
-
var deburredLetters = {
|
|
409
|
-
// Latin-1 Supplement block.
|
|
410
|
-
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
|
411
|
-
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
|
412
|
-
'\xc7': 'C', '\xe7': 'c',
|
|
413
|
-
'\xd0': 'D', '\xf0': 'd',
|
|
414
|
-
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
|
415
|
-
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
|
416
|
-
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
|
417
|
-
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
|
418
|
-
'\xd1': 'N', '\xf1': 'n',
|
|
419
|
-
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
|
420
|
-
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
|
421
|
-
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
|
422
|
-
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
|
423
|
-
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
|
424
|
-
'\xc6': 'Ae', '\xe6': 'ae',
|
|
425
|
-
'\xde': 'Th', '\xfe': 'th',
|
|
426
|
-
'\xdf': 'ss',
|
|
427
|
-
// Latin Extended-A block.
|
|
428
|
-
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
|
429
|
-
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
|
430
|
-
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
|
431
|
-
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
|
432
|
-
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
|
433
|
-
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
|
434
|
-
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
|
435
|
-
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
|
436
|
-
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
|
437
|
-
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
|
438
|
-
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
|
439
|
-
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
|
440
|
-
'\u0134': 'J', '\u0135': 'j',
|
|
441
|
-
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
|
442
|
-
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
|
443
|
-
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
|
444
|
-
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
|
445
|
-
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
|
446
|
-
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
|
447
|
-
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
|
448
|
-
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
|
449
|
-
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
|
450
|
-
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
|
451
|
-
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
|
452
|
-
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
|
453
|
-
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
|
454
|
-
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
|
455
|
-
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
|
456
|
-
'\u0174': 'W', '\u0175': 'w',
|
|
457
|
-
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
|
458
|
-
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
|
459
|
-
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
|
460
|
-
'\u0132': 'IJ', '\u0133': 'ij',
|
|
461
|
-
'\u0152': 'Oe', '\u0153': 'oe',
|
|
462
|
-
'\u0149': "'n", '\u017f': 'ss'
|
|
463
|
-
};
|
|
464
|
-
|
|
465
2005
|
/** Detect free variable `global` from Node.js. */
|
|
466
2006
|
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
467
2007
|
|
|
@@ -471,31 +2011,6 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
|
|
471
2011
|
/** Used as a reference to the global object. */
|
|
472
2012
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
473
2013
|
|
|
474
|
-
/**
|
|
475
|
-
* A specialized version of `_.reduce` for arrays without support for
|
|
476
|
-
* iteratee shorthands.
|
|
477
|
-
*
|
|
478
|
-
* @private
|
|
479
|
-
* @param {Array} [array] The array to iterate over.
|
|
480
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
481
|
-
* @param {*} [accumulator] The initial value.
|
|
482
|
-
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
483
|
-
* the initial value.
|
|
484
|
-
* @returns {*} Returns the accumulated value.
|
|
485
|
-
*/
|
|
486
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
487
|
-
var index = -1,
|
|
488
|
-
length = array ? array.length : 0;
|
|
489
|
-
|
|
490
|
-
if (initAccum && length) {
|
|
491
|
-
accumulator = array[++index];
|
|
492
|
-
}
|
|
493
|
-
while (++index < length) {
|
|
494
|
-
accumulator = iteratee(accumulator, array[index], index, array);
|
|
495
|
-
}
|
|
496
|
-
return accumulator;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
2014
|
/**
|
|
500
2015
|
* Converts an ASCII `string` to an array.
|
|
501
2016
|
*
|
|
@@ -507,40 +2022,6 @@ function asciiToArray(string) {
|
|
|
507
2022
|
return string.split('');
|
|
508
2023
|
}
|
|
509
2024
|
|
|
510
|
-
/**
|
|
511
|
-
* Splits an ASCII `string` into an array of its words.
|
|
512
|
-
*
|
|
513
|
-
* @private
|
|
514
|
-
* @param {string} The string to inspect.
|
|
515
|
-
* @returns {Array} Returns the words of `string`.
|
|
516
|
-
*/
|
|
517
|
-
function asciiWords(string) {
|
|
518
|
-
return string.match(reAsciiWord) || [];
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
523
|
-
*
|
|
524
|
-
* @private
|
|
525
|
-
* @param {Object} object The object to query.
|
|
526
|
-
* @returns {Function} Returns the new accessor function.
|
|
527
|
-
*/
|
|
528
|
-
function basePropertyOf(object) {
|
|
529
|
-
return function(key) {
|
|
530
|
-
return object == null ? undefined : object[key];
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
536
|
-
* letters to basic Latin letters.
|
|
537
|
-
*
|
|
538
|
-
* @private
|
|
539
|
-
* @param {string} letter The matched letter to deburr.
|
|
540
|
-
* @returns {string} Returns the deburred letter.
|
|
541
|
-
*/
|
|
542
|
-
var deburrLetter = basePropertyOf(deburredLetters);
|
|
543
|
-
|
|
544
2025
|
/**
|
|
545
2026
|
* Checks if `string` contains Unicode symbols.
|
|
546
2027
|
*
|
|
@@ -552,17 +2033,6 @@ function hasUnicode(string) {
|
|
|
552
2033
|
return reHasUnicode.test(string);
|
|
553
2034
|
}
|
|
554
2035
|
|
|
555
|
-
/**
|
|
556
|
-
* Checks if `string` contains a word composed of Unicode symbols.
|
|
557
|
-
*
|
|
558
|
-
* @private
|
|
559
|
-
* @param {string} string The string to inspect.
|
|
560
|
-
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
561
|
-
*/
|
|
562
|
-
function hasUnicodeWord(string) {
|
|
563
|
-
return reHasUnicodeWord.test(string);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
2036
|
/**
|
|
567
2037
|
* Converts `string` to an array.
|
|
568
2038
|
*
|
|
@@ -587,17 +2057,6 @@ function unicodeToArray(string) {
|
|
|
587
2057
|
return string.match(reUnicode) || [];
|
|
588
2058
|
}
|
|
589
2059
|
|
|
590
|
-
/**
|
|
591
|
-
* Splits a Unicode `string` into an array of its words.
|
|
592
|
-
*
|
|
593
|
-
* @private
|
|
594
|
-
* @param {string} The string to inspect.
|
|
595
|
-
* @returns {Array} Returns the words of `string`.
|
|
596
|
-
*/
|
|
597
|
-
function unicodeWords(string) {
|
|
598
|
-
return string.match(reUnicodeWord) || [];
|
|
599
|
-
}
|
|
600
|
-
|
|
601
2060
|
/** Used for built-in method references. */
|
|
602
2061
|
var objectProto = Object.prototype;
|
|
603
2062
|
|
|
@@ -707,19 +2166,6 @@ function createCaseFirst(methodName) {
|
|
|
707
2166
|
};
|
|
708
2167
|
}
|
|
709
2168
|
|
|
710
|
-
/**
|
|
711
|
-
* Creates a function like `_.camelCase`.
|
|
712
|
-
*
|
|
713
|
-
* @private
|
|
714
|
-
* @param {Function} callback The function to combine each word.
|
|
715
|
-
* @returns {Function} Returns the new compounder function.
|
|
716
|
-
*/
|
|
717
|
-
function createCompounder(callback) {
|
|
718
|
-
return function(string) {
|
|
719
|
-
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
720
|
-
};
|
|
721
|
-
}
|
|
722
|
-
|
|
723
2169
|
/**
|
|
724
2170
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
725
2171
|
* and has a `typeof` result of "object".
|
|
@@ -795,73 +2241,6 @@ function toString(value) {
|
|
|
795
2241
|
return value == null ? '' : baseToString(value);
|
|
796
2242
|
}
|
|
797
2243
|
|
|
798
|
-
/**
|
|
799
|
-
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
800
|
-
*
|
|
801
|
-
* @static
|
|
802
|
-
* @memberOf _
|
|
803
|
-
* @since 3.0.0
|
|
804
|
-
* @category String
|
|
805
|
-
* @param {string} [string=''] The string to convert.
|
|
806
|
-
* @returns {string} Returns the camel cased string.
|
|
807
|
-
* @example
|
|
808
|
-
*
|
|
809
|
-
* _.camelCase('Foo Bar');
|
|
810
|
-
* // => 'fooBar'
|
|
811
|
-
*
|
|
812
|
-
* _.camelCase('--foo-bar--');
|
|
813
|
-
* // => 'fooBar'
|
|
814
|
-
*
|
|
815
|
-
* _.camelCase('__FOO_BAR__');
|
|
816
|
-
* // => 'fooBar'
|
|
817
|
-
*/
|
|
818
|
-
var camelCase = createCompounder(function(result, word, index) {
|
|
819
|
-
word = word.toLowerCase();
|
|
820
|
-
return result + (index ? capitalize(word) : word);
|
|
821
|
-
});
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Converts the first character of `string` to upper case and the remaining
|
|
825
|
-
* to lower case.
|
|
826
|
-
*
|
|
827
|
-
* @static
|
|
828
|
-
* @memberOf _
|
|
829
|
-
* @since 3.0.0
|
|
830
|
-
* @category String
|
|
831
|
-
* @param {string} [string=''] The string to capitalize.
|
|
832
|
-
* @returns {string} Returns the capitalized string.
|
|
833
|
-
* @example
|
|
834
|
-
*
|
|
835
|
-
* _.capitalize('FRED');
|
|
836
|
-
* // => 'Fred'
|
|
837
|
-
*/
|
|
838
|
-
function capitalize(string) {
|
|
839
|
-
return upperFirst(toString(string).toLowerCase());
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Deburrs `string` by converting
|
|
844
|
-
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
845
|
-
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
846
|
-
* letters to basic Latin letters and removing
|
|
847
|
-
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
848
|
-
*
|
|
849
|
-
* @static
|
|
850
|
-
* @memberOf _
|
|
851
|
-
* @since 3.0.0
|
|
852
|
-
* @category String
|
|
853
|
-
* @param {string} [string=''] The string to deburr.
|
|
854
|
-
* @returns {string} Returns the deburred string.
|
|
855
|
-
* @example
|
|
856
|
-
*
|
|
857
|
-
* _.deburr('déjà vu');
|
|
858
|
-
* // => 'deja vu'
|
|
859
|
-
*/
|
|
860
|
-
function deburr(string) {
|
|
861
|
-
string = toString(string);
|
|
862
|
-
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
863
|
-
}
|
|
864
|
-
|
|
865
2244
|
/**
|
|
866
2245
|
* Converts the first character of `string` to upper case.
|
|
867
2246
|
*
|
|
@@ -881,38 +2260,9 @@ function deburr(string) {
|
|
|
881
2260
|
*/
|
|
882
2261
|
var upperFirst = createCaseFirst('toUpperCase');
|
|
883
2262
|
|
|
884
|
-
|
|
885
|
-
* Splits `string` into an array of its words.
|
|
886
|
-
*
|
|
887
|
-
* @static
|
|
888
|
-
* @memberOf _
|
|
889
|
-
* @since 3.0.0
|
|
890
|
-
* @category String
|
|
891
|
-
* @param {string} [string=''] The string to inspect.
|
|
892
|
-
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
893
|
-
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
894
|
-
* @returns {Array} Returns the words of `string`.
|
|
895
|
-
* @example
|
|
896
|
-
*
|
|
897
|
-
* _.words('fred, barney, & pebbles');
|
|
898
|
-
* // => ['fred', 'barney', 'pebbles']
|
|
899
|
-
*
|
|
900
|
-
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
901
|
-
* // => ['fred', 'barney', '&', 'pebbles']
|
|
902
|
-
*/
|
|
903
|
-
function words(string, pattern, guard) {
|
|
904
|
-
string = toString(string);
|
|
905
|
-
pattern = guard ? undefined : pattern;
|
|
906
|
-
|
|
907
|
-
if (pattern === undefined) {
|
|
908
|
-
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
909
|
-
}
|
|
910
|
-
return string.match(pattern) || [];
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
var lodash_camelcase = camelCase;
|
|
2263
|
+
var lodash_upperfirst = upperFirst;
|
|
914
2264
|
|
|
915
|
-
const balIconCss = ":root,:host{--bal-icon-color-grey:var(--bal-color-grey-5);--bal-icon-color-grey-light:var(--bal-color-border-grey-dark);--bal-icon-color-grey-dark:var(--bal-color-grey-6);--bal-icon-color-success:var(--bal-color-success);--bal-icon-color-success-dark:var(--bal-color-success-5);--bal-icon-color-success-darker:var(--bal-color-success-6);--bal-icon-color-warning:var(--bal-color-warning);--bal-icon-color-warning-dark:var(--bal-color-warning-5);--bal-icon-color-warning-darker:var(--bal-color-warning-6);--bal-icon-color-danger:var(--bal-color-danger);--bal-icon-color-danger-dark:var(--bal-color-danger-5);--bal-icon-color-danger-darker:var(--bal-color-danger-6);--bal-icon-color-primary:var(--bal-color-primary);--bal-icon-color-primary-dark:var(--bal-color-primary-6);--bal-icon-color-blue:var(--bal-color-primary);--bal-icon-color-light-blue:var(--bal-color-light-blue-5);--bal-icon-color-primary-light:var(--bal-color-primary-3);--bal-icon-color-white:var(--bal-color-white)}.bal-icon{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;position:static;pointer-events:visible;width:1.125rem;max-height:1.125rem}.bal-icon--shadow svg{-webkit-filter:drop-shadow(0px 0px 5rem rgba(0, 0, 0, 0.5));filter:drop-shadow(0px 0px 5rem rgba(0, 0, 0, 0.5))}.bal-icon--is-inline{display:-ms-inline-flexbox;display:inline-flex}.bal-icon__inner{display:block;position:static;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out, -webkit-transform .2s ease-in-out;padding:.063rem;width:1.125rem;max-height:1.125rem}.bal-icon__inner--turn-plus{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.bal-icon__inner--turn-caret-down,.bal-icon__inner--turn-caret-up{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.bal-icon__inner--turn-nav-go-down{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.bal-icon__inner>svg{vertical-align:top}.bal-icon--is-xsmall{width:.75rem;max-height:.75rem}.bal-icon--is-x-small{width:.75rem;max-height:.75rem}.bal-icon--is-small{width:.875rem;max-height:.875rem}.bal-icon--is-medium{width:1.625rem;max-height:1.625rem}.bal-icon--is-large{width:2.5rem;max-height:2.5rem;padding:0}.bal-icon--is-x-large{width:5rem;max-height:5rem;padding:0}.bal-icon--is-xx-large{width:11rem;max-height:11rem;padding:0}.bal-icon--is-grey svg,.bal-icon--is-grey g,.bal-icon--is-grey path,.bal-icon--is-grey circle{fill:var(--bal-icon-color-grey)}.bal-icon--is-grey-light svg,.bal-icon--is-grey-light g,.bal-icon--is-grey-light path,.bal-icon--is-grey-light circle{fill:var(--bal-icon-color-grey-light)}.bal-icon--is-grey-dark svg,.bal-icon--is-grey-dark g,.bal-icon--is-grey-dark path,.bal-icon--is-grey-dark circle{fill:var(--bal-icon-color-grey-dark)}.bal-icon--is-success svg,.bal-icon--is-success g,.bal-icon--is-success path,.bal-icon--is-success circle{fill:var(--bal-icon-color-success)}.bal-icon--is-success-dark svg,.bal-icon--is-success-dark g,.bal-icon--is-success-dark path,.bal-icon--is-success-dark circle{fill:var(--bal-icon-color-success-dark)}.bal-icon--is-success-darker svg,.bal-icon--is-success-darker g,.bal-icon--is-success-darker path,.bal-icon--is-success-darker circle{fill:var(--bal-icon-color-success-darker)}.bal-icon--is-warning svg,.bal-icon--is-warning g,.bal-icon--is-warning path,.bal-icon--is-warning circle{fill:var(--bal-icon-color-warning)}.bal-icon--is-warning-dark svg,.bal-icon--is-warning-dark g,.bal-icon--is-warning-dark path,.bal-icon--is-warning-dark circle{fill:var(--bal-icon-color-warning-dark)}.bal-icon--is-warning-darker svg,.bal-icon--is-warning-darker g,.bal-icon--is-warning-darker path,.bal-icon--is-warning-darker circle{fill:var(--bal-icon-color-warning-darker)}.bal-icon--is-danger svg,.bal-icon--is-danger g,.bal-icon--is-danger path,.bal-icon--is-danger circle{fill:var(--bal-icon-color-danger)}.bal-icon--is-danger-dark svg,.bal-icon--is-danger-dark g,.bal-icon--is-danger-dark path,.bal-icon--is-danger-dark circle{fill:var(--bal-icon-color-danger-dark)}.bal-icon--is-danger-darker svg,.bal-icon--is-danger-darker g,.bal-icon--is-danger-darker path,.bal-icon--is-danger-darker circle{fill:var(--bal-icon-color-danger-darker)}.bal-icon--is-primary svg,.bal-icon--is-primary g,.bal-icon--is-primary path,.bal-icon--is-primary circle{fill:var(--bal-icon-color-primary)}.bal-icon--is-primary-dark svg,.bal-icon--is-primary-dark g,.bal-icon--is-primary-dark path,.bal-icon--is-primary-dark circle{fill:var(--bal-icon-color-primary-dark)}.bal-icon--is-blue svg,.bal-icon--is-blue g,.bal-icon--is-blue path,.bal-icon--is-blue circle{fill:var(--bal-icon-color-blue)}.bal-icon--is-light-blue svg,.bal-icon--is-light-blue g,.bal-icon--is-light-blue path,.bal-icon--is-light-blue circle{fill:var(--bal-icon-color-light-blue)}.bal-icon--is-primary-light svg,.bal-icon--is-primary-light g,.bal-icon--is-primary-light path,.bal-icon--is-primary-light circle{fill:var(--bal-icon-color-primary-light)}.bal-icon--is-white svg,.bal-icon--is-white g,.bal-icon--is-white path,.bal-icon--is-white circle,.bal-icon--is-inverted svg,.bal-icon--is-inverted g,.bal-icon--is-inverted path,.bal-icon--is-inverted circle{fill:var(--bal-icon-color-white)}.icon-text{-ms-flex-align:center;align-items:center;color:inherit;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;-ms-flex-wrap:nowrap;flex-wrap:nowrap;word-break:break-word;line-height:1.5rem}.icon-text.is-small{line-height:1.75rem}.icon-text.is-medium{line-height:1.5rem}.icon-text.is-large{line-height:3rem}.icon-text.is-x-large{line-height:4rem}.icon-text.is-xlarge{line-height:4rem}.icon-text .icon{-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.icon-text .icon:not(:last-child){margin-right:.5rem}.icon-text .icon:not(:first-child){margin-right:.5rem}div.icon-text{display:-ms-flexbox;display:flex}";
|
|
2265
|
+
const balIconCss = ":root,:host{--bal-icon-color-grey:var(--bal-color-grey-5);--bal-icon-color-grey-light:var(--bal-color-border-grey-dark);--bal-icon-color-grey-dark:var(--bal-color-grey-6);--bal-icon-color-success:var(--bal-color-success);--bal-icon-color-success-dark:var(--bal-color-success-5);--bal-icon-color-success-darker:var(--bal-color-success-6);--bal-icon-color-warning:var(--bal-color-warning);--bal-icon-color-warning-dark:var(--bal-color-warning-5);--bal-icon-color-warning-darker:var(--bal-color-warning-6);--bal-icon-color-danger:var(--bal-color-danger);--bal-icon-color-danger-dark:var(--bal-color-danger-5);--bal-icon-color-danger-darker:var(--bal-color-danger-6);--bal-icon-color-primary:var(--bal-color-primary);--bal-icon-color-primary-dark:var(--bal-color-primary-6);--bal-icon-color-blue:var(--bal-color-primary);--bal-icon-color-light-blue:var(--bal-color-light-blue-5);--bal-icon-color-primary-light:var(--bal-color-primary-3);--bal-icon-color-white:var(--bal-color-white)}.bal-icon{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;position:static;pointer-events:visible;width:1.125rem;max-height:1.125rem}.bal-icon--shadow svg{-webkit-filter:drop-shadow(0px 0px 5rem rgba(0, 0, 0, 0.5));filter:drop-shadow(0px 0px 5rem rgba(0, 0, 0, 0.5))}.bal-icon--is-inline{display:-ms-inline-flexbox;display:inline-flex}.bal-icon__inner{display:block;position:static;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out, -webkit-transform .2s ease-in-out;padding:.063rem;width:1.125rem;max-height:1.125rem}.bal-icon__inner--turn-plus{-webkit-transform:rotate(225deg);transform:rotate(225deg)}.bal-icon__inner--turn-caret-down,.bal-icon__inner--turn-caret-up{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.bal-icon__inner--turn-nav-go-down{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.bal-icon__inner>svg{vertical-align:top}.bal-icon--is-xsmall{width:.75rem;max-height:.75rem}.bal-icon--is-x-small{width:.75rem;max-height:.75rem}.bal-icon--is-small{width:.875rem;max-height:.875rem}.bal-icon--is-medium{width:1.625rem;max-height:1.625rem}.bal-icon--is-large{width:2.5rem;max-height:2.5rem;padding:0}.bal-icon--is-x-large{width:5rem;max-height:5rem;padding:0}.bal-icon--is-xx-large{width:11rem;max-height:11rem;padding:0}.bal-icon--tile{background:var(--bal-color-purple-1);border-radius:var(--bal-radius-normal);height:2rem;width:2rem;max-height:2rem}@media screen and (min-width: 769px),print{.bal-icon--tile{height:3.5rem;width:3.5rem;max-height:3.5rem}}.bal-icon--tile-color-green{background:var(--bal-color-green-1)}.bal-icon--tile-color-red{background:var(--bal-color-red-1)}.bal-icon--tile-color-yellow{background:var(--bal-color-yellow-1)}.bal-icon__inner--tile{width:2rem;max-height:2rem}@media screen and (min-width: 769px),print{.bal-icon__inner--tile{width:3rem;max-height:3rem}}.bal-icon--is-grey svg,.bal-icon--is-grey g,.bal-icon--is-grey path,.bal-icon--is-grey circle{fill:var(--bal-icon-color-grey)}.bal-icon--is-grey-light svg,.bal-icon--is-grey-light g,.bal-icon--is-grey-light path,.bal-icon--is-grey-light circle{fill:var(--bal-icon-color-grey-light)}.bal-icon--is-grey-dark svg,.bal-icon--is-grey-dark g,.bal-icon--is-grey-dark path,.bal-icon--is-grey-dark circle{fill:var(--bal-icon-color-grey-dark)}.bal-icon--is-success svg,.bal-icon--is-success g,.bal-icon--is-success path,.bal-icon--is-success circle{fill:var(--bal-icon-color-success)}.bal-icon--is-success-dark svg,.bal-icon--is-success-dark g,.bal-icon--is-success-dark path,.bal-icon--is-success-dark circle{fill:var(--bal-icon-color-success-dark)}.bal-icon--is-success-darker svg,.bal-icon--is-success-darker g,.bal-icon--is-success-darker path,.bal-icon--is-success-darker circle{fill:var(--bal-icon-color-success-darker)}.bal-icon--is-warning svg,.bal-icon--is-warning g,.bal-icon--is-warning path,.bal-icon--is-warning circle{fill:var(--bal-icon-color-warning)}.bal-icon--is-warning-dark svg,.bal-icon--is-warning-dark g,.bal-icon--is-warning-dark path,.bal-icon--is-warning-dark circle{fill:var(--bal-icon-color-warning-dark)}.bal-icon--is-warning-darker svg,.bal-icon--is-warning-darker g,.bal-icon--is-warning-darker path,.bal-icon--is-warning-darker circle{fill:var(--bal-icon-color-warning-darker)}.bal-icon--is-danger svg,.bal-icon--is-danger g,.bal-icon--is-danger path,.bal-icon--is-danger circle{fill:var(--bal-icon-color-danger)}.bal-icon--is-danger-dark svg,.bal-icon--is-danger-dark g,.bal-icon--is-danger-dark path,.bal-icon--is-danger-dark circle{fill:var(--bal-icon-color-danger-dark)}.bal-icon--is-danger-darker svg,.bal-icon--is-danger-darker g,.bal-icon--is-danger-darker path,.bal-icon--is-danger-darker circle{fill:var(--bal-icon-color-danger-darker)}.bal-icon--is-primary svg,.bal-icon--is-primary g,.bal-icon--is-primary path,.bal-icon--is-primary circle{fill:var(--bal-icon-color-primary)}.bal-icon--is-primary-dark svg,.bal-icon--is-primary-dark g,.bal-icon--is-primary-dark path,.bal-icon--is-primary-dark circle{fill:var(--bal-icon-color-primary-dark)}.bal-icon--is-blue svg,.bal-icon--is-blue g,.bal-icon--is-blue path,.bal-icon--is-blue circle{fill:var(--bal-icon-color-blue)}.bal-icon--is-light-blue svg,.bal-icon--is-light-blue g,.bal-icon--is-light-blue path,.bal-icon--is-light-blue circle{fill:var(--bal-icon-color-light-blue)}.bal-icon--is-primary-light svg,.bal-icon--is-primary-light g,.bal-icon--is-primary-light path,.bal-icon--is-primary-light circle{fill:var(--bal-icon-color-primary-light)}.bal-icon--is-white svg,.bal-icon--is-white g,.bal-icon--is-white path,.bal-icon--is-white circle,.bal-icon--is-inverted svg,.bal-icon--is-inverted g,.bal-icon--is-inverted path,.bal-icon--is-inverted circle{fill:var(--bal-icon-color-white)}.icon-text{-ms-flex-align:center;align-items:center;color:inherit;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;-ms-flex-wrap:nowrap;flex-wrap:nowrap;word-break:break-word;line-height:1.5rem}.icon-text.is-small{line-height:1.75rem}.icon-text.is-medium{line-height:1.5rem}.icon-text.is-large{line-height:3rem}.icon-text.is-x-large{line-height:4rem}.icon-text.is-xlarge{line-height:4rem}.icon-text .icon{-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.icon-text .icon:not(:last-child){margin-right:.5rem}.icon-text .icon:not(:first-child){margin-right:.5rem}div.icon-text{display:-ms-flexbox;display:flex}";
|
|
916
2266
|
const BalIconStyle0 = balIconCss;
|
|
917
2267
|
|
|
918
2268
|
const Icon = class {
|
|
@@ -922,7 +2272,7 @@ const Icon = class {
|
|
|
922
2272
|
* PRIVATE METHODS
|
|
923
2273
|
* ------------------------------------------------------
|
|
924
2274
|
*/
|
|
925
|
-
this.
|
|
2275
|
+
this.generateSvgContent = (iconName) => {
|
|
926
2276
|
const hasIcons = Object.keys(this.icons).length > 0;
|
|
927
2277
|
if (hasIcons && iconName && iconName.length > 0) {
|
|
928
2278
|
// We are doing this to avoid breaking change.
|
|
@@ -934,16 +2284,22 @@ const Icon = class {
|
|
|
934
2284
|
}
|
|
935
2285
|
const icon = this.icons[`balIcon${lodash_upperfirst(lodash_camelcase(iconName))}`];
|
|
936
2286
|
if (icon) {
|
|
937
|
-
|
|
2287
|
+
this.svgContent = icon;
|
|
2288
|
+
return;
|
|
938
2289
|
}
|
|
939
2290
|
}
|
|
940
|
-
|
|
2291
|
+
this.svgContent = DOMPurify.sanitize(this.svg) || '';
|
|
941
2292
|
};
|
|
942
2293
|
this.icons = defaultConfig.icons;
|
|
2294
|
+
this.svgContent = '';
|
|
2295
|
+
this.innerColor = '';
|
|
2296
|
+
this.innerSize = '';
|
|
943
2297
|
this.name = '';
|
|
944
2298
|
this.svg = '';
|
|
945
2299
|
this.size = '';
|
|
946
2300
|
this.color = '';
|
|
2301
|
+
this.tile = false;
|
|
2302
|
+
this.tileColor = '';
|
|
947
2303
|
this.inline = false;
|
|
948
2304
|
this.inverted = false;
|
|
949
2305
|
this.turn = false;
|
|
@@ -953,6 +2309,19 @@ const Icon = class {
|
|
|
953
2309
|
this.hovered = false;
|
|
954
2310
|
this.pressed = false;
|
|
955
2311
|
}
|
|
2312
|
+
nameChanged() {
|
|
2313
|
+
this.generateSvgContent(this.name);
|
|
2314
|
+
}
|
|
2315
|
+
svgChanged() {
|
|
2316
|
+
this.generateSvgContent(this.name);
|
|
2317
|
+
}
|
|
2318
|
+
/**
|
|
2319
|
+
* LIFE CYCLE
|
|
2320
|
+
* ------------------------------------------------------
|
|
2321
|
+
*/
|
|
2322
|
+
connectedCallback() {
|
|
2323
|
+
this.generateSvgContent(this.name);
|
|
2324
|
+
}
|
|
956
2325
|
/**
|
|
957
2326
|
* LISTENERS
|
|
958
2327
|
* ------------------------------------------------------
|
|
@@ -962,6 +2331,7 @@ const Icon = class {
|
|
|
962
2331
|
*/
|
|
963
2332
|
async configChanged(state) {
|
|
964
2333
|
this.icons = state.icons;
|
|
2334
|
+
this.generateSvgContent(this.name);
|
|
965
2335
|
}
|
|
966
2336
|
parseColor() {
|
|
967
2337
|
if (!!this.disabled) {
|
|
@@ -1016,9 +2386,12 @@ const Icon = class {
|
|
|
1016
2386
|
render() {
|
|
1017
2387
|
const color = this.parseColor();
|
|
1018
2388
|
const block = BEM.block('icon');
|
|
1019
|
-
|
|
1020
|
-
return (h(Host, { key: '8a997585e6ac61a483a4d417707bfb38ee4240bb', "aria-hidden": "true", class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('is-inverted').class(this.inverted)), block.modifier('is-inline').class(this.inline)), block.modifier('shadow').class(this.shadow)), block.modifier(`is-${this.size}`).class(!!this.size)), block.modifier(`is-${color}`).class()) }, h("div", { key: '1978890263e8a3fd0a4551ff67f84f16c378989e', class: Object.assign(Object.assign(Object.assign({}, block.element('inner').class()), block.element('inner').modifier(`turn-${this.name}`).class(this.turn)), block.modifier(`is-${this.size}`).class(!!this.size)), innerHTML: svgContent })));
|
|
2389
|
+
return (h(Host, { key: '7878580914412bb12603f9854d765106c7acc5ef', "aria-hidden": "true", class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('tile').class(this.tile)), block.modifier(`tile-color-${this.tileColor}`).class(this.tile && !!this.tileColor)), block.modifier('is-inverted').class(this.inverted)), block.modifier('is-inline').class(this.inline)), block.modifier('shadow').class(this.shadow)), block.modifier(`is-${this.size}`).class(!!this.size)), block.modifier(`is-${color}`).class()) }, h("div", { key: '3ca28f2b9329ccb31c4bc435e2c0e2b416681167', class: Object.assign(Object.assign(Object.assign(Object.assign({}, block.element('inner').class()), block.element('inner').modifier(`turn-${this.name}`).class(this.turn)), block.element('inner').modifier('tile').class(this.tile)), block.modifier(`is-${this.size}`).class(!!this.size)), innerHTML: this.svgContent })));
|
|
1021
2390
|
}
|
|
2391
|
+
static get watchers() { return {
|
|
2392
|
+
"name": ["nameChanged"],
|
|
2393
|
+
"svg": ["svgChanged"]
|
|
2394
|
+
}; }
|
|
1022
2395
|
};
|
|
1023
2396
|
__decorate([
|
|
1024
2397
|
ListenToConfig(),
|